about summary refs log tree commit diff
diff options
context:
space:
mode:
authorhexcoder- <heiko@hexco.de>2019-10-12 00:39:59 +0200
committerhexcoder- <heiko@hexco.de>2019-10-12 00:39:59 +0200
commitbd312607a36a319ecfbd01820dc1ac222afabcd2 (patch)
tree94b08500a9dc1820fbc9f39ac397dd5c69fc54bd
parent99f2abfd711f0cdfe56f08b63b8ee2effe58cbed (diff)
downloadafl++-bd312607a36a319ecfbd01820dc1ac222afabcd2.tar.gz
add afl-fuzz error capturing for qemu_mode and unicorn_mode
-rwxr-xr-xtest/test.sh42
1 files changed, 28 insertions, 14 deletions
diff --git a/test/test.sh b/test/test.sh
index a7376d16..27bf708f 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -222,24 +222,31 @@ test -e ../afl-qemu-trace && {
       echo 0 > in/in
       $ECHO "$GREY[*] running afl-fuzz for qemu_mode, this will take approx 10 seconds"
       {
-        ../afl-fuzz -V10 -Q -i in -o out -- ./test-instr > /dev/null 2>&1
-      } > /dev/null 2>&1
+        ../afl-fuzz -V10 -Q -i in -o out -- ./test-instr >>errors 2>&1
+      } >>errors 2>&1
       test -n "$( ls out/queue/id:000002* 2> /dev/null )" && {
         $ECHO "$GREEN[+] afl-fuzz is working correctly with qemu_mode"
-      } || $ECHO "$RED[!] afl-fuzz is not working correctly with qemu_mode"
+      } || {
+        cat errors
+        $ECHO "$RED[!] afl-fuzz is not working correctly with qemu_mode"
+      }
+      rm -f errors
 
       test -e ../libcompcov.so && {
         $ECHO "$GREY[*] running afl-fuzz for qemu_mode libcompcov, this will take approx 10 seconds"
         {
           export AFL_PRELOAD=../libcompcov.so 
           export AFL_COMPCOV_LEVEL=2
-          ../afl-fuzz -V10 -Q -i in -o out -- ./test-compcov > /dev/null 2>&1
-        } > /dev/null 2>&1
+          ../afl-fuzz -V10 -Q -i in -o out -- ./test-compcov >>errors 2>&1
+        } >>errors 2>&1
         test -n "$( ls out/queue/id:000002* 2> /dev/null )" && {
           $ECHO "$GREEN[+] afl-fuzz is working correctly with qemu_mode libcompcov"
-        } || $ECHO "$RED[!] afl-fuzz is not working correctly with qemu_mode libcompcov"
+        } || {
+          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 -rf in out
+      rm -rf in out errors
     }
   } || $ECHO "$RED[-] gcc compilation of test targets failed - what is going on??"
   
@@ -267,21 +274,28 @@ test -d ../unicorn_mode/unicorn && {
       echo 0 > in/in
       $ECHO "$GREY[*] running afl-fuzz for unicorn_mode, this will take approx 15 seconds"
       {
-        ../afl-fuzz -V15 -U -i in -o out -d -- python ../unicorn_mode/samples/simple/simple_test_harness.py @@ > /dev/null 2>&1
-      } > /dev/null 2>&1
+        ../afl-fuzz -V15 -U -i in -o out -d -- python ../unicorn_mode/samples/simple/simple_test_harness.py @@ >>errors 2>&1
+      } >>errors 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"
+      } || {
+        cat errors
+        $ECHO "$RED[!] afl-fuzz is not working correctly with unicorn_mode"
+      }
+      rm -f errors
 
       $ECHO "$GREY[*] running afl-fuzz for unicorn_mode compcov, this will take approx 15 seconds"
       {
         export AFL_COMPCOV_LEVEL=2
-        ../afl-fuzz -V15 -U -i in -o out -d -- python ../unicorn_mode/samples/compcov_x64/compcov_test_harness.py @@ > /dev/null 2>&1
-      } > /dev/null 2>&1
+        ../afl-fuzz -V15 -U -i in -o out -d -- python ../unicorn_mode/samples/compcov_x64/compcov_test_harness.py @@ >>errors 2>&1
+      } >>errors 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
+      } || {
+        cat errors
+        $ECHO "$RED[!] afl-fuzz is not working correctly with unicorn_mode compcov"
+      }
+      rm -rf in out errors
     }
   } || $ECHO "$RED[-] missing sample binaries in unicorn_mode/samples/ - what is going on??"