From e51c988222cd21facab11d9e5cd22cbfad4f66dc Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Fri, 7 Oct 2022 23:38:50 +0200 Subject: [PATCH] Add initial support for fuzzing --- tests/Makefile | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/Makefile b/tests/Makefile index 66ce4277..95b52821 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -107,6 +107,7 @@ clean: $(RM) *.exe *.s *~ *.o *.log a*.dat $(RM) *.gcda *.gcno *.gcov all.info test.tar *.synt clang_output_* *.c.c *.end.c *.first.c *.middle.c *.analyzer $(RMDIR) coverage coverage-dir mlib-report + $(RMDIR) fuzzer-testsuite fuzzer-findings distclean: clean $(RM) *.depend depend @@ -246,6 +247,24 @@ analyze: $(MAKE) `ls test-*.c|$(SED) 's/\.c/\.analyzer/g'` +##################################################################################################### +# Fuzzer (american fuzzy lop) +##################################################################################################### + +FUZZ= + +fuzz-generic: + $(MAKE) check-${FUZZ}.log CXX=afl-g++ + mkdir -p fuzzer-testsuite + echo "0 1 2 3 4 5 6 7 8 9 10 11" > fuzzer-testsuite/t1 + afl-fuzz -i fuzzer-testsuite/ -o fuzzer-findings ./check-${FUZZ}.exe -1 + +fuzz-array: + $(MAKE) fuzz-generic FUZZ=array + +fuzz-list: + $(MAKE) fuzz-generic FUZZ=list + ##################################################################################################### # Test with the maximum representative number of compiler and flags. #####################################################################################################