-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathtest.sh
executable file
·104 lines (81 loc) · 2.79 KB
/
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
# override CircleCi's default run settings
set +e
set +o pipefail
ROOT=$(dirname $0)/..
EXIT_STATE=0
MAX_AUTO_RETRY=0
log () {
echo -e "\n$1"
}
# inspired by https://unix.stackexchange.com/a/82602
retry () {
local n=1
until [ $n -ge $MAX_AUTO_RETRY ]; do
"$@" --failFast && break
log "run $n of $MAX_AUTO_RETRY failed, trying again ..."
n=$[$n+1]
done
if [ $n -eq $MAX_AUTO_RETRY ]; then
log "one last time, w/o failing fast"
"$@" && n=0
fi
if [ $n -eq $MAX_AUTO_RETRY ]; then
log "all $n runs failed, moving on."
EXIT_STATE=1
fi
}
case $1 in
no-gl-jasmine)
SUITE=$(circleci tests glob "$ROOT/test/jasmine/tests/*" | circleci tests split)
MAX_AUTO_RETRY=2
retry npm run test-jasmine -- $SUITE --skip-tags=gl,noCI,flaky || EXIT_STATE=$?
exit $EXIT_STATE
;;
webgl-jasmine)
SHARDS=($(node $ROOT/tasks/shard_jasmine_tests.js --limit=5 --tag=gl | circleci tests split))
for s in ${SHARDS[@]}; do
MAX_AUTO_RETRY=2
retry npm run test-jasmine -- "$s" --tags=gl --skip-tags=noCI --doNotFailOnEmptyTestSuite
done
exit $EXIT_STATE
;;
flaky-no-gl-jasmine)
SHARDS=($(node $ROOT/tasks/shard_jasmine_tests.js --limit=1 --tag=flaky | circleci tests split))
for s in ${SHARDS[@]}; do
MAX_AUTO_RETRY=5
retry npm run test-jasmine -- "$s" --tags=flaky --skip-tags=noCI
done
exit $EXIT_STATE
;;
bundle-jasmine)
npm run test-bundle || EXIT_STATE=$?
exit $EXIT_STATE
;;
mathjax-v2-firefox)
./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --FF --bundleTest=mathjax_v2 --nowatch || EXIT_STATE=$?
exit $EXIT_STATE
;;
mathjax-v2-firefox82+)
./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --FF --skip-tags=noFF82 --bundleTest=mathjax_v2 --nowatch || EXIT_STATE=$?
exit $EXIT_STATE
;;
mathjax-v3-firefox82+)
./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --FF --skip-tags=noFF82 --bundleTest=mathjax_v2 --nowatch || EXIT_STATE=$?
exit $EXIT_STATE
;;
make-baselines)
SUITE=$(find $ROOT/test/image/mocks/ -type f -printf "%f\n" | sed 's/\.json$//1' | circleci tests split)
python3 test/image/make_baseline.py $SUITE || EXIT_STATE=$?
exit $EXIT_STATE
;;
test-image)
node test/image/compare_pixels_test.js || { tar -cvf build/baselines.tar build/test_images/*.png ; exit 1 ; } || EXIT_STATE=$?
exit $EXIT_STATE
;;
source-syntax)
npm run lint || EXIT_STATE=$?
npm run test-syntax || EXIT_STATE=$?
exit $EXIT_STATE
;;
esac