-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathrun-cn-seq-test-gen.sh
executable file
·93 lines (78 loc) · 1.89 KB
/
run-cn-seq-test-gen.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
#!/bin/bash
# copying from run-ci.sh
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$(ocamlfind query z3)
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(ocamlfind query z3)
CN=$OPAM_SWITCH_PREFIX/bin/cn
DIRNAME=$(dirname "$0")
# Clean directory
cd "$DIRNAME"/cn-seq-test-gen || exit
rm -rf build decorated test
mkdir build decorated test
# For UBSan
export UBSAN_OPTIONS=halt_on_error=1
# Get `*.c` files
FILES=$(find "$DIRNAME"/src -name '*.c')
# Track failures
NUM_FAILED=0
FAILED=''
function separator() {
printf '\n'
for i in {1..60}; do
printf "="
done
printf '\n\n'
}
CONFIGS=("--num-samples=30 --max-resets=1")
# For each configuration
for CONFIG in "${CONFIGS[@]}"; do
separator
echo "Running CI with CLI config \"$CONFIG\""
separator
# Test each `*.c` file
for TEST in $FILES; do
CLEANUP="rm -rf test/* run_tests.sh;separator"
# Run passing tests
if [[ $TEST == *.pass.c ]]; then
$CN seq-test "$TEST" --output-dir="test" $CONFIG
RET=$?
if [[ "$RET" != 0 ]]; then
echo
echo "$TEST -- Tests failed unexpectedly"
NUM_FAILED=$(($NUM_FAILED + 1))
FAILED="$FAILED $TEST($CONFIG)"
eval "$CLEANUP"
continue
else
echo
echo "$TEST -- Tests passed successfully"
fi
fi
# Run failing tests
if [[ $TEST == *.fail.c ]]; then
$CN seq-test "$TEST" --output-dir="test" $CONFIG
RET=$?
if [[ "$RET" = 0 ]]; then
echo
echo "$TEST -- Tests passed unexpectedly"
NUM_FAILED=$(($NUM_FAILED + 1))
FAILED="$FAILED $TEST($CONFIG)"
eval "$CLEANUP"
continue
else
echo
echo "$TEST -- Tests failed successfully"
fi
fi
eval "$CLEANUP"
done
done
echo 'Done running tests.'
echo
if [ -z "$FAILED" ]; then
echo "All tests passed."
exit 0
else
echo "$NUM_FAILED tests failed:"
echo " $FAILED"
exit 1
fi