skip unicorn tests if cannot import unicornafl

This commit is contained in:
Andrea Fioraldi
2019-12-16 09:44:17 +01:00
parent 7832daf969
commit 26d27d9121

View File

@ -555,12 +555,10 @@ test -d ../unicorn_mode/unicorn && {
mkdir -p in mkdir -p in
echo 0 > in/in echo 0 > in/in
$ECHO "$GREY[*] Using python binary $PY" $ECHO "$GREY[*] Using python binary $PY"
$ECHO "$GREY[*] emulating one input in unicornafl" if ! $PY -c 'import unicornafl' 2> /dev/null ; then
$PY ../unicorn_mode/samples/simple/simple_test_harness.py ../unicorn_mode/samples/simple/sample_inputs/sample1.bin $ECHO "$YELLOW[-] we cannot test unicorn_mode because it is not present"
$ECHO "$GREY[*] emulating a single fuzz test in unicorn_mode" else
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" $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 ../afl-fuzz -V25 -U -i in -o out -d -- "$PY" ../unicorn_mode/samples/simple/simple_test_harness.py @@ >>errors 2>&1
@ -595,6 +593,8 @@ test -d ../unicorn_mode/unicorn && {
} }
rm -rf in out errors rm -rf in out errors
} }
fi
}
} || { } || {
$ECHO "$RED[-] missing sample binaries in unicorn_mode/samples/ - what is going on??" $ECHO "$RED[-] missing sample binaries in unicorn_mode/samples/ - what is going on??"
CODE=1 CODE=1