diff options
author | Andrea Fioraldi <andreafioraldi@gmail.com> | 2019-10-13 10:34:51 +0200 |
---|---|---|
committer | Andrea Fioraldi <andreafioraldi@gmail.com> | 2019-10-13 10:34:51 +0200 |
commit | 8f854ee83a6dd70ff5a3e70f6064928b35d2ab17 (patch) | |
tree | 5747f6b00805aa869c89bd195e59f5c20b7cf2b3 | |
parent | bd312607a36a319ecfbd01820dc1ac222afabcd2 (diff) | |
download | afl++-8f854ee83a6dd70ff5a3e70f6064928b35d2ab17.tar.gz |
test for persistent qemu
-rwxr-xr-x | test/test.sh | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/test/test.sh b/test/test.sh index 27bf708f..94d28047 100755 --- a/test/test.sh +++ b/test/test.sh @@ -113,7 +113,11 @@ test -e ../${AFL_GCC} -a -e ../afl-showmap -a -e ../afl-fuzz && { $ECHO "$BLUE[*] Testing: llvm_mode" test -e ../afl-clang-fast && { # on FreeBSD need to set AFL_CC - export AFL_CC=`llvm-config --bindir`/clang + if which clang >/dev/null; then + export AFL_CC=`which clang` + else + export AFL_CC=`llvm-config --bindir`/clang + fi ../afl-clang-fast -o test-instr.plain ../test-instr.c > /dev/null 2>&1 AFL_HARDEN=1 ../afl-clang-fast -o test-compcov.harden test-compcov.c > /dev/null 2>&1 test -e test-instr.plain && { @@ -244,25 +248,28 @@ test -e ../afl-qemu-trace && { } || { cat errors $ECHO "$RED[!] afl-fuzz is not working correctly with qemu_mode libcompcov" - } + } } || $ECHO "$YELLOW[-] we cannot test qemu_mode libcompcov because it is not present" + rm -f errors + + $ECHO "$GREY[*] running afl-fuzz for persistent qemu_mode, this will take approx 10 seconds" + { + export AFL_QEMU_PERSISTENT_ADDR=0x$(nm test-instr | grep "T main" | awk '{ print $1 }') + export AFL_QEMU_PERSISTENT_GPR=1 + ../afl-fuzz -V10 -Q -i in -o out -- ./test-instr > /dev/null 2>&1 + } >>errors 2>&1 + test -n "$( ls out/queue/id:000002* 2> /dev/null )" && { + $ECHO "$GREEN[+] afl-fuzz is working correctly with persistent qemu_mode" + } || { + cat errors + $ECHO "$RED[!] afl-fuzz is not working correctly with persistent qemu_mode" + exit 1 + } + $ECHO "$YELLOW[?] we need a test case for qemu_mode unsigaction library" rm -rf in out errors } } || $ECHO "$RED[-] gcc compilation of test targets failed - what is going on??" - $ECHO "$YELLOW[?] we need a test case for qemu_mode persistent mode" - $ECHO "$YELLOW[?] we need a test case for qemu_mode unsigaction library" - # This works but there are already problems with persistent (e.g. stability) - #$ECHO "$GREY[*] running afl-fuzz for persistent qemu_mode, this will take approx 10 seconds" - #{ - # export AFL_QEMU_PERSISTENT_ADDR=0x$(nm test-instr | grep "T main" | awk '{ print $1 }') - # export AFL_QEMU_PERSISTENT_GPR=1 - # ../afl-fuzz -V10 -Q -i in -o out -- ./test-instr > /dev/null 2>&1 - #} > /dev/null 2>&1 - #test -n "$( ls out/queue/id:000002* 2> /dev/null )" && { - # $ECHO "$GREEN[+] afl-fuzz is working correctly with persistent qemu_mode" - #} || $ECHO "$RED[!] afl-fuzz is not working correctly with persistent qemu_mode" - rm -f test-instr test-compcov } || $ECHO "$YELLOW[-] qemu_mode is not compiled, cannot test" |