[test suite] integrate afl-cov with afl-fuzz wrapper scripts

Here is an example for the client-rc.sh wrapper script to have it also
generate code coverage results for afl-fuzz (afl-cov is enabled via two
environmental variables AFL_COV and CODE_DIR).

$ cd /tmp/afl-ramdisk/fwknop.git/test/afl/
$ AFL_COV=1 CODE_DIR=/home/mbr/git/fwknop.git ./fuzzing-wrappers/client-rc.sh
This commit is contained in:
Michael Rash
2015-06-29 19:06:50 -07:00
parent 5ba88e7b83
commit ca54ec7a9b
+16
View File
@@ -20,6 +20,22 @@ BANNER="$TSTR$GIT_STR"
### set up directories
dir_init $ARCHIVE_DIR $FDIR $OUT_DIR PREV_OUT_DIR
### see if we're going to enable code coverage with afl-cov
if [ "$AFL_COV" != "" ]
then
echo "[+] Enabling afl-cov coverage mode..."
if [ "$CODE_DIR" = "" ]
then
echo "[*] Must set CODE_DIR with path to gcov compiled code"
exit 1
fi
### kick off afl-cov in --background mode
afl-cov -d $OUT_DIR --live --background --sleep 10 --coverage-cmd \
"LD_LIBRARY_PATH=$CODE_DIR/test/afl/$LIB_DIR $CODE_DIR/test/afl/$CLIENT --rc-file AFL_FILE -T -a 1.1.1.1 -n testhost2.com" \
--code-dir $CODE_DIR
fi
### make sure the client rc file can be parsed (a failure
### exit status is expected though)
./fuzzing-wrappers/helpers/fwknop-rc-test.sh && exit $?