Repository navigation
Expand file tree
/
Copy pathrun_tests.sh
More file actions
executable file
·60 lines (56 loc) · 1.57 KB
/
Copy pathrun_tests.sh
File metadata and controls
executable file
·60 lines (56 loc) · 1.57 KB
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
57
58
59
60
#!/bin/bash
# set -ev
ROOT=${TRAVIS_BUILD_DIR:-"$( cd "$(dirname "$0")/../../.." ; pwd -P )"}
# fail the job when a build fails, with an error annotation naming what failed
build_or_fail(){
if ! make "$@"; then
echo "::error title=Build failed::make $* failed in ${PWD#$ROOT/}"
exit 1
fi
}
# if [ "$OPT" == "qbs" ]; then
# exit 0
# else
echo "##[group]**** Running unit tests ****"
cd $ROOT/tests
for group in *; do
# android / ios / emscripten have their own CI jobs; native linux Makefile can't run them
case "$group" in
android|ios|tvOS|emscripten) continue ;;
esac
if [ -d $group ]; then
echo "##[group] $group"
for test in $group/*; do
if [ -d $test ]; then
cd $test
cp ../../../scripts/templates/linux/Makefile .
cp ../../../scripts/templates/linux/config.make .
sleep 0.3
build_or_fail -j2 Debug
sleep 0.3
cd bin
binname=$(basename ${test})
if [[ -f ./${binname}_debug ]]; then
# GitHub linux runners have no DISPLAY; xvfb gives GLFW a software GL context
if [ -z "${DISPLAY:-}" ] && command -v xvfb-run >/dev/null 2>&1; then
xvfb-run -a gdb -batch -ex "run" -ex "bt" -ex "q \$_exitcode" ./${binname}_debug
else
gdb -batch -ex "run" -ex "bt" -ex "q \$_exitcode" ./${binname}_debug
fi
else
echo "Binary not found: ${binname}_debug"
exit 1
fi
errorcode=$?
if [[ $errorcode -ne 0 ]]; then
echo "Test failed: ${binname}_debug with error code: $errorcode"
exit $errorcode
fi
cd $ROOT/tests
fi
done
echo "##[endgroup]"
fi
done
# fi
echo "##[endgroup]"