summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2015-03-13 00:18:30 -0700
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2015-03-13 00:18:30 -0700
commit15fba1debca5498989048677ffda38758b2df984 (patch)
treed2891e531717681619f55e79fc5efa81b46822e2 /Makefile
parent0542b1869b6970003caa954ebc5f1dea41d48032 (diff)
tests: Add support for afl-fuzz
With the current setup it successfully finds the (fixed) DOCTYPE buffer overrun in ~50 minutes (on a single core).
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile11
1 files changed, 8 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 897bcbb..b50ff69 100644
--- a/Makefile
+++ b/Makefile
@@ -3,10 +3,10 @@ defines=standard
BUILD=build/make-$(CXX)-$(config)-$(defines)
-SOURCES=src/pugixml.cpp $(wildcard tests/*.cpp)
+SOURCES=src/pugixml.cpp tests/main.cpp tests/allocator.cpp tests/test.cpp tests/writer_string.cpp $(wildcard tests/test_*.cpp)
EXECUTABLE=$(BUILD)/test
-CXXFLAGS=-c -g -Wall -Wextra -Werror -pedantic
+CXXFLAGS=-g -Wall -Wextra -Werror -pedantic
LDFLAGS=
ifeq ($(config),release)
@@ -39,6 +39,11 @@ 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 @@
+
clean:
rm -rf $(BUILD)
@@ -47,7 +52,7 @@ $(EXECUTABLE): $(OBJECTS)
$(BUILD)/%.o: %
@mkdir -p $(dir $@)
- $(CXX) $< $(CXXFLAGS) -MMD -MP -o $@
+ $(CXX) $< $(CXXFLAGS) -c -MMD -MP -o $@
-include $(OBJECTS:.o=.d)