-
Notifications
You must be signed in to change notification settings - Fork 7
/
test-symcc.sh
executable file
·56 lines (47 loc) · 1.12 KB
/
test-symcc.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
#!/bin/bash
#
# Setup for SYMCC
#
FILES=`ls test-*.c|sed 's/\.c//'`
export PATH=$PATH:/symcc:/symcc_build
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 CC=symcc CFLAGS="-g -D__AFL_COMPILER=1" compile
export SYMCC_OUTPUT_DIR=`pwd`/out
for j in $FILES; do
test -x $j && {
# Setup individual run
echo ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ > test.txt
PREV=-1
CUR=0
rm -f 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
cat test.txt | ./$j
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