-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathrun_unit_test.sh
executable file
·56 lines (45 loc) · 1.46 KB
/
run_unit_test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
set -e
cd $(dirname "${BASH_SOURCE[0]}")
BUILD_DIR=./build
TEST_TMP_DIR=$BUILD_DIR/unit_tests
SEMS_TESTER=/usr/bin/sems-tester
[ "$GDB" == "1" ] && SEMS_TESTER="gdb -q -ex r --args $SEMS_TESTER"
SEMS_TESTER_CFG=./unit_tests/etc/sems_test.cfg
MODULE_PREFIX=YetiTest
DEFAULT_FILTER=$MODULE_PREFIX.*:$MODULE_PREFIX/*
for d in rsr logs lib dump record; do
mkdir -p $TEST_TMP_DIR/$d
done
#prepare lib dir
for m in \
$BUILD_DIR/src/yeti_unit.so \
/usr/lib/sems/plug-in/wav.so \
/usr/lib/sems/plug-in/uac_auth.so \
/usr/lib/sems/plug-in/jsonrpc.so \
/usr/lib/sems/plug-in/postgresql.so \
/usr/lib/sems/plug-in/registrar_client.so \
/usr/lib/sems/plug-in/session_timer.so \
/usr/lib/sems/plug-in/unit_tests/redis_unit.so \
/usr/lib/sems/plug-in/registrar.so
do
name=$(basename $m)
cp -uv $m $TEST_TMP_DIR/lib/${name//"_unit"/}
done
if [ $# -gt 0 ]; then
filter=$1
shift
if [ $filter == "all" ]; then
cmd="$SEMS_TESTER -c $SEMS_TESTER_CFG --gtest_filter=$DEFAULT_FILTER $@"
else
if [[ $filter == *"."* || $filter == *"/"* ]]; then
cmd="$SEMS_TESTER -c $SEMS_TESTER_CFG --gtest_also_run_disabled_tests --gtest_filter=$filter $@"
else
cmd="$SEMS_TESTER -c $SEMS_TESTER_CFG --gtest_also_run_disabled_tests --gtest_filter=$MODULE_PREFIX.$filter:$MODULE_PREFIX/$filter $@"
fi
fi
else
cmd="$SEMS_TESTER -c $SEMS_TESTER_CFG --gtest_filter=$DEFAULT_FILTER --gtest_list_tests"
fi
echo $cmd
exec $cmd