-
Notifications
You must be signed in to change notification settings - Fork 8
/
check.sh
executable file
·57 lines (49 loc) · 918 Bytes
/
check.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
#!/usr/bin/env bash
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
if [ -n "$1" ]
then
echo "using CN=$1 in $PWD"
CN="$1"
else
CN="cn verify"
fi
good=0
bad=0
declare -a bad_tests
for file in $SCRIPT_DIR/src/examples/*c;
do
echo "Checking $file ..."
$CN $file
retval=$?
if [[ $file == *.broken.c ]]
then
if [[ $retval -ne 0 ]];
then
good=$(($good+1))
else
bad_tests[$bad]=$file
bad=$(($bad+1))
fi
else
if [[ $retval -eq 0 ]];
then
good=$(($good+1))
else
bad_tests[$bad]=$file
bad=$(($bad+1))
fi
fi
done
echo "----------------------------"
echo "$good good, $bad bad"
echo "----------------------------"
if [[ "$bad" = 0 ]]
then
exit 0
else
echo "Failed tests:"
for file in ${bad_tests[@]}; do
echo $file
done
exit 1
fi