add afl-fuzz error capturing for qemu_mode and unicorn_mode
MODIFY
test/test.sh
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??"

add afl-fuzz error capturing for qemu_mode and unicorn_mode