summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorPhil Turnbull <philipturnbull@github.com>2017-06-26 15:05:30 -0400
committerPhil Turnbull <philipturnbull@github.com>2017-06-27 15:37:04 -0400
commitc1dea4ee507ef62b121051e34e36a9b24459ea39 (patch)
treeb08c2272ff191ea8ee29ebac00ecd9bd8b89aa84 /Makefile
parent70a6a168146baa6ab0df33d4ddf424ba5d40b151 (diff)
Add Makefile target and harness to fuzz with libFuzzer
This can be run locally with `make libFuzzer` but the harness will be integrated into oss-fuzz for large-scale fuzzing.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile8
1 files changed, 8 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 1b58bf7..c10c035 100644
--- a/Makefile
+++ b/Makefile
@@ -14,6 +14,7 @@ BENCHFILE=$(BENCHDIR)/benchinput.md
ALLTESTS=alltests.md
NUMRUNS?=10
CMARK=$(BUILDDIR)/src/cmark
+CMARK_FUZZ=$(BUILDDIR)/src/cmark-fuzz
PROG?=$(CMARK)
VERSION?=$(SPECVERSION)
RELEASE?=CommonMark-$(VERSION)
@@ -81,6 +82,13 @@ afl:
-t 100 \
$(CMARK) $(CMARK_OPTS)
+libFuzzer:
+ @[ -n "$(LIB_FUZZER_PATH)" ] || { echo '$$LIB_FUZZER_PATH not set'; false; }
+ mkdir -p $(BUILDDIR)
+ cd $(BUILDDIR) && cmake -DCMAKE_BUILD_TYPE=Asan -DCMARK_LIB_FUZZER=ON -DCMAKE_LIB_FUZZER_PATH=$(LIB_FUZZER_PATH) ..
+ $(MAKE) -j2 -C $(BUILDDIR) cmark-fuzz
+ test/run-cmark-fuzz $(CMARK_FUZZ)
+
clang-check: all
${CLANG_CHECK} -p build -analyze src/*.c