-
Notifications
You must be signed in to change notification settings - Fork 688
/
run-all.sh
executable file
·38 lines (36 loc) · 1001 Bytes
/
run-all.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
#!/usr/bin/env bash
DIR=${1:-.}
# use a precompiled header for the template to improve perf
g++ -Wall -Wfatal-errors -Wconversion -std=c++17 -O2 $DIR/stress-tests/utilities/template.h
trap "rm -f $DIR/stress-tests/utilities/template.h.gch" EXIT
tests="$(find $DIR/stress-tests -name '*.cpp')"
declare -i pass=0
declare -i fail=0
failTests=""
ulimit -s 524288 # For 2-sat test
for test in $tests; do
echo "$(basename $test): "
start=`date +%s.%N`
g++ -Wall -Wfatal-errors -Wconversion -std=c++17 -O2 $test && ./a.out
retCode=$?
if (($retCode != 0)); then
echo "Failed with $retCode"
fail+=1
failTests="$failTests$test\n"
else
pass+=1
fi
end=`date +%s.%N`
runtime=$( echo "$end - $start" | bc -l )
echo "Took $runtime seconds"
rm -f a.out
echo
done
echo "$pass/$(($pass+$fail)) tests passed"
if (($fail == 0)); then
echo "No tests failed"
exit 0
else
echo -e "These tests failed: \n $failTests"
exit 1
fi