-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_test.sh
executable file
·53 lines (45 loc) · 917 Bytes
/
run_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
#!/usr/bin/env bash
while [[ $# -gt 1 ]]
do
_key="$1"
case $_key in
-t|--tests)
_tests="$2"
shift
;;
*)
echo "Unknown option: $_key"
exit 1
;;
esac
shift # past argument or value
done
if [ "x$_tests" = "x" ]; then
_tests=`ls tests/test_*.cpp | sed -e 's/tests\/\(.*\)\.cpp/\1/'`
fi
echo $_tests
case "$_tests" in
*unit*)
_dc_run_opts="--no-deps --rm"
;;
*)
_dc_run_opts="--rm"
;;
esac
_dc_opts="-f docker-compose.yml"
exit_code=0
for _t in $_tests; do
_command="docker-compose $_dc_opts run $_dc_run_opts xssp ./$_t"
echo $_command
$_command
e=$?
if [ $e -ne 0 ] ; then
exit_code=$e
fi
done
# Remove all containers and network only if the tests passed. Keep them around
# for debugging the failed tests.
if [ $exit_code -eq 0 ]; then
docker-compose down
fi
exit $exit_code