-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.kb
44 lines (39 loc) · 919 Bytes
/
run.kb
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
#! /bin/bash
# args[1] must be the json file
# args[2] is the check option, or-sum of some of the following:
# normalCheck_mask = 0x1
# ifMultiCmp_mask = 0x2
# ifRefresh_mask = 0x4
# args[3] is the start index of the json file
# remove '["' and '"*'
function get_file_name(){
local file=${1#\[\"}
echo ${file%%\"*}
}
if [ ! -d "./cache" ] ; then
mkdir ./cache
fi
cnt=0
hit=0
if [ $# -ge 3 ] ; then
start=$3
else
start=0
fi
while read line ; do
if [ $start -gt 0 ] ; then
((start--))
continue
fi
file=$(get_file_name $line)
echo "$line" > cache/guide.json
python3 checker.py ${file%\.c}.o cache/guide.json $2 >> run.log # assuming .o file locates at the same directory
if [ $? -ne 0 ] ; then
echo trigger on $line
((hit++))
else
echo nothing at $line
fi
((cnt++))
done < $1
echo trigger $hit / $cnt