From 573a3dc076cfecb2337cca118bdbd7c4452b1ec6 Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Sat, 21 Feb 2015 21:05:10 +0100 Subject: Add Makefile target to fuzz with AFL Also add a compact test case. As far as I understand, a good test case should exercise many code paths while being as small as possible. There's probably still room for improvement. The variable $AFL_PATH must point to the directory containing the AFL binaries. It can be set as an environment variable or passed to make on the command line. --- Makefile | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index e6a2314..7cf1cc8 100644 --- a/Makefile +++ b/Makefile @@ -59,6 +59,17 @@ prof: cmake .. -DCMAKE_BUILD_TYPE=Profile; \ make +afl: + @[ -n "$(AFL_PATH)" ] || { echo '$$AFL_PATH not set'; false; } + mkdir -p $(BUILDDIR) + cd $(BUILDDIR) && cmake .. -DCMAKE_C_COMPILER=$(AFL_PATH)/afl-gcc + make + $(AFL_PATH)/afl-fuzz \ + -i test/afl_test_cases \ + -o test/afl_results \ + -m none \ + $(CMARK) + mingw: mkdir -p $(MINGW_BUILDDIR); \ cd $(MINGW_BUILDDIR); \ -- cgit v1.2.3