afl-fuzz: add usage info when no python support is there, use it in test.sh

This commit is contained in:
hexcoder-
2020-04-08 17:53:25 +00:00
committed by van Hauser
parent d397bba6b2
commit ae05f5c4b0
2 changed files with 78 additions and 70 deletions

View File

@ -198,6 +198,8 @@ static void usage(afl_state_t *afl, u8 *argv0, int more_help) {
#ifdef USE_PYTHON
SAYF("Compiled with %s module support, see docs/custom_mutator.md\n",
(char *)PYTHON_VERSION);
#else
SAYF("Compiled without python module support\n");
#endif
SAYF("For additional help please consult %s/README.md\n\n", doc_path);

View File

@ -471,8 +471,9 @@ test -e ../afl-clang-lto -a -e ../afl-llvm-lto-instrumentation.so && {
}
$ECHO "$BLUE[*] Testing: gcc_plugin"
export AFL_CC=`command -v gcc`
test -e ../afl-gcc-fast -a -e ../afl-gcc-rt.o && {
SAVE_AFL_CC=${AFL_CC}
export AFL_CC=`command -v gcc`
../afl-gcc-fast -o test-instr.plain.gccpi ../test-instr.c > /dev/null 2>&1
AFL_HARDEN=1 ../afl-gcc-fast -o test-compcov.harden.gccpi test-compcov.c > /dev/null 2>&1
test -e test-instr.plain.gccpi && {
@ -574,6 +575,7 @@ test -e ../afl-gcc-fast -a -e ../afl-gcc-rt.o && {
CODE=1
}
rm -f test-persistent
export AFL_CC=${SAVE_AFL_CC} # restore the default compiler
} || {
$ECHO "$YELLOW[-] gcc_plugin not compiled, cannot test"
INCOMPLETE=1
@ -894,7 +896,7 @@ test -d ../unicorn_mode/unicornafl && {
}
$ECHO "$BLUE[*] Testing: custom mutator"
unset AFL_CC # Test case "gcc_plugin" sets AFL_CC to "gcc". We reset it to use the default compiler
test "1" = "`../afl-fuzz | grep -i 'without python' >/dev/null; echo $?`" && {
test `uname -s` = 'Darwin' && {
CUSTOM_MUTATOR_PATH=$( realpath ../examples/custom_mutators )
} || {
@ -970,6 +972,10 @@ test -e test-custom-mutator.c -a -e ${CUSTOM_MUTATOR_PATH}/example.c -a -e ${CUS
INCOMPLETE=1
}
unset CUSTOM_MUTATOR_PATH
} || {
$ECHO "$YELLOW[-] no python support in afl-fuzz, cannot test"
INCOMPLETE=1
}
$ECHO "$BLUE[*] Execution cmocka Unit-Tests $GREY"
unset AFL_CC