diff options
author | van Hauser <vh@thc.org> | 2020-03-22 09:32:13 +0100 |
---|---|---|
committer | van Hauser <vh@thc.org> | 2020-03-22 09:32:13 +0100 |
commit | 38fa2fe0b1abdf693e197da5dd83fdc5c6772634 (patch) | |
tree | 1a0c0679e058fe1b0a494d4652576f5e21bc9f4d /test | |
parent | 5a0cc43ee142842d845a0281fa8f5d0d0721a8ba (diff) | |
download | afl++-38fa2fe0b1abdf693e197da5dd83fdc5c6772634.tar.gz |
add commit test script test/checkcommit.sh
Diffstat (limited to 'test')
-rwxr-xr-x | test/checkcommit.sh | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/checkcommit.sh b/test/checkcommit.sh new file mode 100755 index 00000000..ec75d516 --- /dev/null +++ b/test/checkcommit.sh @@ -0,0 +1,39 @@ +#!/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 + 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 +export CFLAGS="-O3 -funroll-loops -pg" +export 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 ./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 |