diff options
author | van Hauser <vh@thc.org> | 2020-03-23 18:19:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-23 18:19:20 +0100 |
commit | 82432195a8e46f67394b528fbfe8749903c7f064 (patch) | |
tree | 1289a776f96b7af6fed7b1c61509368de14aeb46 /test/checkcommit.sh | |
parent | 0e1d82dd9f5cfe48b294e876924acea2f5094f01 (diff) | |
parent | 77b81e7361f7286cc3e0174b87ae5facb9f1290d (diff) | |
download | afl++-82432195a8e46f67394b528fbfe8749903c7f064.tar.gz |
Merge pull request #266 from AFLplusplus/dev
Diffstat (limited to 'test/checkcommit.sh')
-rwxr-xr-x | test/checkcommit.sh | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/test/checkcommit.sh b/test/checkcommit.sh new file mode 100755 index 00000000..27d08d36 --- /dev/null +++ b/test/checkcommit.sh @@ -0,0 +1,41 @@ +#!/bin/sh +CMDLINE="/prg/tests/normal/tiff-4.0.4/tools/thumbnail @@ /dev/null" +INDIR="/prg/tests/normal/tiff-4.0.4/in-small" + +test -z "$1" -o -n "$4" && { + echo "Syntax: $0 commit-id <indir> \"<cmdline>\"" + echo + echo "Switches to the defined commit ID, compiles with profiling and runs" + echo "afl-fuzz on a defind target and input directory, saving timing," + echo "fuzzer_stats and profiling output to \"<commit-id>.out\"" + echo "Honors CFLAGS and LDFLAGS" + echo + echo "Defaults:" + echo " indir: \"$INDIR\"" + echo " cmdline: \"$CMDLINE\"" + exit 1 +} + +C=$1 +test -n "$2" && INDIR=$2 +test -n "$3" && CMDLINE=$3 + +git checkout "$C" || { echo "CHECKOUT FAIL $C" > $C.out ; exit 1 ; } +export AFL_BENCH_JUST_ONE=1 +test -z "$CFLAGS" && CFLAGS="-O3 -funroll-loops" +export CFLAGS="$CFLAGS -pg" +export LDFLAGS="$LDFLAGS -pg" +make >/dev/null 2>&1 || echo ERROR: BUILD FAILURE +test -x ./afl-fuzz || { echo "BUILD FAIL $C" > $C.out ; make clean ; exit 1 ; } + +START=`date +%s` +echo $START > $C.out +time nice -n -20 ./afl-fuzz -i "$INDIR" -s 123 -o out-profile -- $CMDLINE 2>> $C.out +STOP=`date +%s` +echo $STOP >> $C.out +echo RUNTIME: `expr $STOP - $START` >> $C.out +cat out-profile/fuzzer_stats >> $C.out +gprof ./afl-fuzz gmon.out >> $C.out + +make clean >/dev/null 2>&1 +rm -rf out-profile gmon.out |