-
Notifications
You must be signed in to change notification settings - Fork 7
/
test-symsan.sh
executable file
·55 lines (46 loc) · 1.16 KB
/
test-symsan.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
#!/bin/bash
#
# Setup for symsan
#
FILES=`ls test-*.c|sed 's/\.c//'`
make clean
make CC=cc CFLAGS="-g -D__AFL_COMPILER=1" compile
for i in $FILES; do
test -x $i && mv $i $i.plain
done
make KO_USE_Z3=1 KO_CC=clang-12 CC=/workdir/symsan/build/bin/ko-clang CFLAGS="-g -D__AFL_COMPILER=1" compile
export TAINT_OPTIONS="taint_file=test.txt:output_dir=out"
for j in $FILES; do
test -x $j && {
# Setup individual run
echo ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ > test.txt
PREV=-1
CUR=0
rm -fr core
i=test.txt
while [ '!' "$PREV" = "$CUR" -a '!' -f core -a -e test.txt ]; do
PREV=$CUR
echo CUR=$CUR FILE=$i
rm -rf out
mkdir out
./$j test.txt
mv test.txt $j.data
FILE=
for i in out/*; do
RES=$(./$j.plain $i 2>&1|grep -w at |sed 's/.* //')
echo FILE=$i RES=$RES CUR=$CUR BEST=$FILE
test -n "$RES" && {
test "$RES" -gt "$CUR" && { CUR=$RES; FILE=$i; }
}
done
test -n "$FILE" && cp $FILE ./test.txt
done
test -e core && echo CORE found
test -e test.txt && mv test.txt $j.data
} | tee $j.log
done
rm -rf out core
echo
echo RESULTS
echo =======
grep CORE *.log