about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
authorhexcoder- <heiko@hexco.de>2019-09-26 00:28:25 +0200
committerhexcoder- <heiko@hexco.de>2019-09-26 00:28:25 +0200
commitf66c0a5d980c0e472d937de44da1a5fe4886b06a (patch)
tree285d5d11a05a2a23ccddbd3b0b9da159a3ace156 /test
parenta609b08c0ad1c3e9825604b3b97b634ac9bf344c (diff)
parente63c9ec05e34c3cf1e32c319ba295e8e5facf41d (diff)
downloadafl++-f66c0a5d980c0e472d937de44da1a5fe4886b06a.tar.gz
Merge branch 'master' of https://github.com/vanhauser-thc/AFLplusplus
Diffstat (limited to 'test')
-rwxr-xr-xtest/test.sh41
1 files changed, 39 insertions, 2 deletions
diff --git a/test/test.sh b/test/test.sh
index 6f6fe693..2d367fc9 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -177,7 +177,7 @@ rm -f test-compcov
 
 $ECHO "$BLUE[*] Testing: qemu_mode"
 test -e ../afl-qemu-trace && {
-  gcc -o test-instr ../test-instr.c
+  gcc -no-pie -o test-instr ../test-instr.c
   gcc -o test-compcov test-compcov.c
   test -e test-instr -a -e test-compcov && {
     test -n "$TIMEOUT" && {
@@ -207,10 +207,47 @@ test -e ../afl-qemu-trace && {
   } || $ECHO "$RED[-] gcc compilation of test targets failed - what is going on??"
   
   $ECHO "$YELLOW[?] we need a test case for qemu_mode persistent mode"
+  # 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
+  #  timeout -s KILL 10 ../afl-fuzz -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"
 
+$ECHO "$BLUE[*] Testing: unicorn_mode"
+test -d ../unicorn_mode/unicorn && {
+  test -e ../unicorn_mode/samples/simple/simple_target.bin -a -e ../unicorn_mode/samples/compcov_x64/compcov_target.bin && {
+    test -n "$TIMEOUT" && {
+      mkdir -p in
+      echo 0 > in/in
+      $ECHO "$GREY[*] running afl-fuzz for unicorn_mode, this will take approx 15 seconds"
+      {
+        timeout -s KILL 15 ../afl-fuzz -U -i in -o out -d -- python ../unicorn_mode/samples/simple/simple_test_harness.py @@ > /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 unicorn_mode"
+      } || $ECHO "$RED[!] afl-fuzz is not working correctly with unicorn_mode"
+
+      $ECHO "$GREY[*] running afl-fuzz for unicorn_mode compcov, this will take approx 15 seconds"
+      {
+        export AFL_COMPCOV_LEVEL=2
+        timeout -s KILL 15 ../afl-fuzz -U -i in -o out -d -- python ../unicorn_mode/samples/compcov_x64/compcov_test_harness.py @@ > /dev/null 2>&1
+      } > /dev/null 2>&1
+      test -n "$( ls out/queue/id:000001* 2> /dev/null )" && {
+        $ECHO "$GREEN[+] afl-fuzz is working correctly with unicorn_mode compcov"
+      } || $ECHO "$RED[!] afl-fuzz is not working correctly with unicorn_mode compcov"
+      rm -rf in out
+    } || $ECHO "$YELLOW[-] we cannot test afl-fuzz because we are missing the timeout command"
+  } || $ECHO "$RED[-] missing sample binaries in unicorn_mode/samples/ - what is going on??"
+  
+} || $ECHO "$YELLOW[-] qemu_mode is not compiled, cannot test"
+
 $ECHO "$GREY[*] all test cases completed.$RESET"
 
-# unicorn_mode ?