diff options
author | Andrea Fioraldi <andreafioraldi@gmail.com> | 2019-12-16 09:44:17 +0100 |
---|---|---|
committer | Andrea Fioraldi <andreafioraldi@gmail.com> | 2019-12-16 09:44:17 +0100 |
commit | 26d27d912178bbffe5116790409d403f22629fe1 (patch) | |
tree | c6c95d98ae1e7e0b316943a56bede2a60ce339af | |
parent | 7832daf9694e6666f9a71e3112cae03b4ba9a887 (diff) | |
download | afl++-26d27d912178bbffe5116790409d403f22629fe1.tar.gz |
skip unicorn tests if cannot import unicornafl
-rwxr-xr-x | test/test.sh | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/test/test.sh b/test/test.sh index 7b3b2046..a75f991d 100755 --- a/test/test.sh +++ b/test/test.sh @@ -555,45 +555,45 @@ test -d ../unicorn_mode/unicorn && { mkdir -p in echo 0 > in/in $ECHO "$GREY[*] Using python binary $PY" - $ECHO "$GREY[*] emulating one input in unicornafl" - $PY ../unicorn_mode/samples/simple/simple_test_harness.py ../unicorn_mode/samples/simple/sample_inputs/sample1.bin - $ECHO "$GREY[*] emulating a single fuzz test in unicorn_mode" - AFL_NO_UI=1 AFL_BENCH_UNTIL_CRASH=1 AFL_BENCH_JUST_ONE=1 AFL_DEBUG_CHILD_OUTPUT=1 ../afl-fuzz -U -i in -o out -d -- "$PY" ../unicorn_mode/samples/simple/simple_test_harness.py @@ - $ECHO "$GREEN[*] if you saw UC returned Error: above, everything worked fine - afl unicorn found the crash. :)" - - $ECHO "$GREY[*] running afl-fuzz for unicorn_mode, this will take approx 25 seconds" + if ! $PY -c 'import unicornafl' 2> /dev/null ; then + $ECHO "$YELLOW[-] we cannot test unicorn_mode because it is not present" + else { - ../afl-fuzz -V25 -U -i in -o out -d -- "$PY" ../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 CUT------------------------------------------------------------------CUT - cat errors - echo CUT------------------------------------------------------------------CUT - $ECHO "$RED[!] afl-fuzz is not working correctly with unicorn_mode" - CODE=1 - } - rm -f errors + $ECHO "$GREY[*] running afl-fuzz for unicorn_mode, this will take approx 25 seconds" + { + ../afl-fuzz -V25 -U -i in -o out -d -- "$PY" ../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 CUT------------------------------------------------------------------CUT + cat errors + echo CUT------------------------------------------------------------------CUT + $ECHO "$RED[!] afl-fuzz is not working correctly with unicorn_mode" + CODE=1 + } + rm -f errors - printf '\x01\x01' > in/in - # This seed is close to the first byte of the comparison. - # If CompCov works, a new tuple will appear in the map => new input in queue - $ECHO "$GREY[*] running afl-fuzz for unicorn_mode compcov, this will take approx 35 seconds" - { - export AFL_COMPCOV_LEVEL=2 - ../afl-fuzz -V35 -U -i in -o out -d -- "$PY" ../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 CUT------------------------------------------------------------------CUT - cat errors - echo CUT------------------------------------------------------------------CUT - $ECHO "$RED[!] afl-fuzz is not working correctly with unicorn_mode compcov" - CODE=1 + printf '\x01\x01' > in/in + # This seed is close to the first byte of the comparison. + # If CompCov works, a new tuple will appear in the map => new input in queue + $ECHO "$GREY[*] running afl-fuzz for unicorn_mode compcov, this will take approx 35 seconds" + { + export AFL_COMPCOV_LEVEL=2 + ../afl-fuzz -V35 -U -i in -o out -d -- "$PY" ../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 CUT------------------------------------------------------------------CUT + cat errors + echo CUT------------------------------------------------------------------CUT + $ECHO "$RED[!] afl-fuzz is not working correctly with unicorn_mode compcov" + CODE=1 + } + rm -rf in out errors } - rm -rf in out errors + fi } } || { $ECHO "$RED[-] missing sample binaries in unicorn_mode/samples/ - what is going on??" |