summaryrefslogtreecommitdiff
path: root/tools/fuzz
diff options
context:
space:
mode:
Diffstat (limited to 'tools/fuzz')
-rwxr-xr-xtools/fuzz28
1 files changed, 28 insertions, 0 deletions
diff --git a/tools/fuzz b/tools/fuzz
new file mode 100755
index 0000000..892e950
--- /dev/null
+++ b/tools/fuzz
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+if [ $# -ne 1 ]
+then
+ echo Usage: tools/fuzz BUILD_TYPE
+ exit 1
+fi
+
+rm -rf builds/fuzz-$1
+mkdir -p builds/fuzz-$1
+cd builds/fuzz-$1
+../../configure --enable-enable-build-mode=$1 --disable-shared CC=afl-cc
+make clean && make
+mkdir -p fuzz-in
+mkdir -p fuzz-out
+mkdir -p fuzz-in-min
+cp ../../tests/scripts/good/*.aplwc fuzz-in
+cp ../../tests/scripts/bad/*.aplwc fuzz-in
+afl-cmin -i fuzz-in -o fuzz-in-min -- ./aplwc @@
+rm fuzz-in/*
+cd fuzz-in-min
+for f in *
+do
+ afl-tmin -i "$f" -o "../fuzz-in/$f" -- ../aplwc @@
+done
+cd ..
+rm -rf fuzz-in-min
+afl-fuzz -i fuzz-in -o fuzz-out -m 20 -t 50 -- ./aplwc @@