summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2017-02-07 23:34:39 -0800
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2017-02-09 07:36:32 -0800
commit00ef791078ec318f663b0cffdb18fd928394d591 (patch)
treed18bd84cec695fecbe5066bf2937cbcc5954a291 /Makefile
parente748f435e5481b5a44686486e8f467823688b2c0 (diff)
fuzz: Use libFuzzer instead of afl-fuzz
This allows us to have faster fuzz cycles since the fuzzer is in-process.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile11
1 files changed, 7 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index f9b26d6..e483e02 100644
--- a/Makefile
+++ b/Makefile
@@ -68,10 +68,9 @@ test: $(EXECUTABLE)
./$(EXECUTABLE)
endif
-fuzz:
- @mkdir -p $(BUILD)
- $(AFL)/afl-clang++ tests/fuzz_parse.cpp tests/allocator.cpp src/pugixml.cpp $(CXXFLAGS) -o $(BUILD)/fuzz_parse
- $(AFL)/afl-fuzz -i tests/data_fuzz_parse -o $(BUILD)/fuzz_parse_out -x $(AFL)/testcases/_extras/xml/ -- $(BUILD)/fuzz_parse @@
+fuzz_%: $(BUILD)/fuzz_%
+ @mkdir -p build/$@
+ $< build/$@ tests/data_$*
clean:
rm -rf $(BUILD)
@@ -87,6 +86,10 @@ build/pugixml-%: .FORCE | $(RELEASE)
$(EXECUTABLE): $(OBJECTS)
$(CXX) $(OBJECTS) $(LDFLAGS) -o $@
+$(BUILD)/fuzz_%: tests/fuzz_%.cpp src/pugixml.cpp
+ @mkdir -p $(BUILD)
+ clang++ $(CXXFLAGS) -fsanitize=address -fsanitize-coverage=trace-pc-guard $^ libFuzzer.a -o $@
+
$(BUILD)/%.o: %
@mkdir -p $(dir $@)
$(CXX) $< $(CXXFLAGS) -c -MMD -MP -o $@