-
Notifications
You must be signed in to change notification settings - Fork 8
/
run-test
executable file
·48 lines (38 loc) · 908 Bytes
/
run-test
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
#!/bin/sh
all_tests=$(echo "$*" | tr ' ' '\n')
num_fails=0
num_tests=0
IFS="
"
cur_dir=$(pwd)
export PATH="$cur_dir:${PATH};"
[ $# = 0 ] && all_tests="./tests/*"
[ $# != 1 ] && echo "Running tests"
# for test in $all_tests; do
for test in $all_tests; do
[ -f "$test" ] && continue
num_tests=$((num_tests + 1))
# Setup
save_dir=$(pwd)
cd "$test" || exit 1
[ -d actual ] && rm -rf actual
cp -r setup actual
# Run
cd actual || exit 1
[ $# != 1 ] && echo
basename "$test:"
./run-test
# Results
for line in $(./results); do
echo "$line"
new_fails=$(echo "$line" | grep -c "^[^ ]*FAIL")
num_fails=$((num_fails + new_fails))
done
# Cleanup
cd "$save_dir" || exit 1
done
echo
[ $# != 1 ] && echo "Total number of tests: $num_tests"
echo "Total number of failures: $num_fails"
[ $num_fails -gt 0 ] && exit 1
exit 0