-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunall.sh
executable file
·55 lines (51 loc) · 1.54 KB
/
runall.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
#!/usr/bin/env bash
TOTAL_FAILED=0
TOTAL_SUCCESS=0
run_and_capture() {
r=$(stack run rules-$1 2>/dev/null | grep -E "(FAIL|SUCCESS|WARNING|INFO|====>|>>>)" |
(
LOCAL_FAILED=0
LOCAL_SUCCESS=0
while IFS= read -r line; do
echo $line 1>&2
if [[ $line =~ ^\[SUCCESS\].* ]]; then
export LOCAL_SUCCESS=$((LOCAL_SUCCESS + 1))
elif [[ $line =~ ^\[SUCCESS-Overall\].* ]]; then
export LOCAL_SUCCESS=$((LOCAL_SUCCESS + 1))
elif [[ $line =~ ^\[SUCCESS-.*\].* ]]; then
true
elif [[ $line =~ ^\[FAIL\].* ]]; then
export LOCAL_FAILED=$((LOCAL_FAILED + 1))
elif [[ $line =~ ^\[FAIL-Overall\].* ]]; then
export LOCAL_FAILED=$((LOCAL_FAILED + 1))
elif [[ $line =~ ^\[FAIL-.*\].* ]]; then
true
elif [[ $line =~ ^\[WARNING\].* ]]; then
true
elif [[ $line =~ ^\[INFO-.*\].* ]]; then
true
elif [[ $line =~ ^\[INFO\].* ]]; then
true
elif [[ $line =~ ^====\>.* ]]; then
true
elif [[ $line =~ ^\>\>\>.* ]]; then
true
else
echo "Unknown line: $line"
exit 1
fi
done
echo "$LOCAL_SUCCESS $LOCAL_FAILED"
))
r=($r)
TOTAL_SUCCESS=$((TOTAL_SUCCESS + ${r[0]}))
TOTAL_FAILED=$((TOTAL_FAILED + ${r[1]}))
}
ALL_RULES=$(ls rules)
for rule in $ALL_RULES; do
if [[ $rule != "debug" && $rule != "generalize" ]]; then
run_and_capture $rule
fi
done
echo "Total success: $TOTAL_SUCCESS"
echo "Total failed: $TOTAL_FAILED"