-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·154 lines (122 loc) · 4.68 KB
/
test.sh
File metadata and controls
executable file
·154 lines (122 loc) · 4.68 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
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/bin/bash
# GitHub Actions version of .circleci/test.sh
# Replaces `circleci tests split` with split_files.mjs
set +e
set +o pipefail
ROOT=$(dirname $0)/../..
SPLIT="$ROOT/.github/scripts/split_files.mjs"
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
}
# Ensure output directories exist (not present in fresh GHA checkout)
mkdir -p build/test_images
case $1 in
no-gl-jasmine)
SUITE=$(ls -1 $ROOT/test/jasmine/tests/* | sort | node "$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 | node "$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
;;
virtual-webgl-jasmine)
SHARDS=($(node $ROOT/tasks/shard_jasmine_tests.js --limit=5 --tag=gl | node "$SPLIT"))
for s in ${SHARDS[@]}; do
MAX_AUTO_RETRY=2
retry ./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --virtualWebgl --tags=gl --skip-tags=noCI,noVirtualWebgl --doNotFailOnEmptyTestSuite -- "$s"
done
exit $EXIT_STATE
;;
flaky-no-gl-jasmine)
SHARDS=($(node $ROOT/tasks/shard_jasmine_tests.js --limit=1 --tag=flaky | node "$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-firefox)
./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --FF --bundleTest=mathjax --nowatch || EXIT_STATE=$?
exit $EXIT_STATE
;;
mathjax-firefox)
./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --FF --bundleTest=mathjax --nowatch &&
./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --FF --bundleTest=mathjax --mathjax3 --nowatch &&
./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --FF --bundleTest=mathjax_config --mathjax3 --nowatch &&
./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --FF --bundleTest=mathjax_config --nowatch || EXIT_STATE=$?
exit $EXIT_STATE
;;
make-baselines-virtual-webgl)
SUITE=$({\
find $ROOT/test/image/mocks/gl* -type f -printf "%f\n"; \
find $ROOT/test/image/mocks/map* -type f -printf "%f\n"; \
} | sed 's/\.json$//1' | sort | node "$SPLIT")
python test/image/make_baseline.py virtual-webgl $SUITE || EXIT_STATE=$?
exit $EXIT_STATE
;;
make-baselines-mathjax3)
MATHJAX3_MOCKS=$(jq -r '.compare_mathjax3 | join(" ")' test/image/compare_pixels_collections.json)
python test/image/make_baseline.py mathjax3 $MATHJAX3_MOCKS || EXIT_STATE=$?
exit $EXIT_STATE
;;
make-baselines-b64)
SUITE=$(find $ROOT/test/image/mocks/ -type f -printf "%f\n" | sed 's/\.json$//1' | sort | node "$SPLIT")
python test/image/make_baseline.py b64 $SUITE || EXIT_STATE=$?
exit $EXIT_STATE
;;
make-baselines)
SUITE=$(find $ROOT/test/image/mocks/ -type f -printf "%f\n" | sed 's/\.json$//1' | sort | node "$SPLIT")
python test/image/make_baseline.py $SUITE || EXIT_STATE=$?
exit $EXIT_STATE
;;
make-exports)
python test/image/make_exports.py || EXIT_STATE=$?
exit $EXIT_STATE
;;
test-image)
node test/image/compare_pixels_test.mjs || EXIT_STATE=$?
exit $EXIT_STATE
;;
test-image-mathjax3)
node test/image/compare_pixels_test.mjs mathjax3 || EXIT_STATE=$?
exit $EXIT_STATE
;;
test-image-virtual-webgl)
node test/image/compare_pixels_test.mjs virtual-webgl || EXIT_STATE=$?
exit $EXIT_STATE
;;
source-syntax)
npm run lint || EXIT_STATE=$?
npm run test-syntax || EXIT_STATE=$?
exit $EXIT_STATE
;;
esac