aboutsummaryrefslogtreecommitdiff
path: root/Makefile.fuzz
diff options
context:
space:
mode:
authorGravatar Yevgeny Pats <yev.pats@gmail.com> 2019-08-18 11:40:59 +0300
committerGravatar Miek Gieben <miek@miek.nl> 2019-08-18 08:40:59 +0000
commitc33fc9e3b091facdabaf028764ae3df5d85b53d3 (patch)
tree38c27896231ea0cbd16cf03e543b7731835fad29 /Makefile.fuzz
parentbbc78abf6f24e6b42105cca2cc3989517ff8b952 (diff)
downloadcoredns-c33fc9e3b091facdabaf028764ae3df5d85b53d3.tar.gz
coredns-c33fc9e3b091facdabaf028764ae3df5d85b53d3.tar.zst
coredns-c33fc9e3b091facdabaf028764ae3df5d85b53d3.zip
Add Continuous Fuzzing Integration to Fuzzit (#3093)
This feature introduce continuous fuzzing with the following features: * Ruzzing: fuzz-targets are run continuously on master ( the fuzzers are updated every time new code is pushed to master) * Regresion: In addition to unit-tests travis runs all fuzz targets through the generated corpus to catch bugs early on in the CI process before merge.
Diffstat (limited to 'Makefile.fuzz')
-rw-r--r--Makefile.fuzz13
1 files changed, 13 insertions, 0 deletions
diff --git a/Makefile.fuzz b/Makefile.fuzz
index 666f4c93d..b2340c420 100644
--- a/Makefile.fuzz
+++ b/Makefile.fuzz
@@ -14,6 +14,7 @@
#$ go get github.com/dvyukov/go-fuzz/go-fuzz-build
REPO:="github.com/coredns/coredns"
+# set LIBFUZZER=YES to build libfuzzer compatible targets
FUZZ:=$(dir $(wildcard plugin/*/fuzz.go)) # plugin/cache/
PLUGINS:=$(foreach f,$(FUZZ),$(subst plugin, ,$(f:/=))) # > /cache
@@ -25,13 +26,25 @@ echo:
.PHONY: $(PLUGINS)
$(PLUGINS): echo
+ifeq ($(LIBFUZZER), YES)
+ go-fuzz-build -tags fuzz -libfuzzer -o $(@).a ./plugin/$(@)
+ clang -fsanitize=fuzzer $(@).a -o $(@)
+else
go-fuzz-build -tags fuzz $(REPO)/plugin/$(@)
go-fuzz -bin=./$(@)-fuzz.zip -workdir=fuzz/$(@)
+endif
+
.PHONY: corefile
corefile:
+ifeq ($(LIBFUZZER), YES)
+ go-fuzz-build -tags fuzz -libfuzzer -o $(@).a ./test
+ clang -fsanitize=fuzzer $(@).a -o $(@)
+else
go-fuzz-build -tags fuzz $(REPO)/test
go-fuzz -bin=./test-fuzz.zip -workdir=fuzz/$(@)
+endif
+
.PHONY: clean