diff options
Diffstat (limited to 'fuzz/Makefile.am')
-rw-r--r-- | fuzz/Makefile.am | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/fuzz/Makefile.am b/fuzz/Makefile.am new file mode 100644 index 0000000..a6d4b67 --- /dev/null +++ b/fuzz/Makefile.am @@ -0,0 +1,87 @@ +AM_CFLAGS = $(WERROR_CFLAGS) $(WARN_CFLAGS) -Wno-unused-parameter -Wno-pedantic +AM_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir) -I$(top_builddir)/lib -I$(top_srcdir)/lib \ + -DSRCDIR=\"$(abs_srcdir)\" +LDADD = ../lib/libgnu.a \ + $(GETADDRINFO_LIB) $(HOSTENT_LIB) $(INET_NTOP_LIB) $(INET_PTON_LIB) \ + $(LIBSOCKET) $(LIB_CLOCK_GETTIME) $(LIB_CRYPTO) $(LIB_GETLOGIN) $(LIB_NANOSLEEP) $(LIB_POLL) \ + $(LIB_POSIX_SPAWN) $(LIB_PTHREAD_SIGMASK) $(LIB_SELECT) $(LIBICONV) $(LIBINTL) \ + $(LIBMULTITHREAD) $(LIBTHREAD) $(SERVENT_LIB) @INTL_MACOSX_LIBS@ \ + -ldl + +WGET_TESTS = \ + wget_css_fuzzer$(EXEEXT) \ + wget_cookie_fuzzer$(EXEEXT) \ + wget_ftpls_fuzzer$(EXEEXT) \ + wget_html_fuzzer$(EXEEXT) \ + wget_netrc_fuzzer$(EXEEXT) \ + wget_options_fuzzer$(EXEEXT) \ + wget_robots_fuzzer$(EXEEXT) \ + wget_url_fuzzer$(EXEEXT) + +if FUZZING + bin_PROGRAMS = $(WGET_TESTS) + LDADD += $(LIB_FUZZING_ENGINE) + MAIN = fuzzer.h +# AM_LDFLAGS = -no-install -all-static +else + AM_CPPFLAGS += -DTEST_RUN + AM_TESTS_ENVIRONMENT = export VALGRIND_TESTS"=@VALGRIND_TESTS@"; + TESTS = $(WGET_TESTS) + check_PROGRAMS = $(WGET_TESTS) + MAIN = main.c fuzzer.h +endif + +# Make libunittest "PHONY" so we're always sure we're up-to-date. +.PHONY: ../src/libunittest.a +../src/libunittest.a: + $(MAKE) $(AM_MAKEFLAGS) -C ../src libunittest.a + +wget_css_fuzzer_SOURCES = wget_css_fuzzer.c $(MAIN) +wget_css_fuzzer_LDADD = ../src/libunittest.a $(LDADD) + +wget_cookie_fuzzer_SOURCES = wget_cookie_fuzzer.c $(MAIN) +wget_cookie_fuzzer_LDADD = ../src/libunittest.a $(LDADD) + +wget_ftpls_fuzzer_SOURCES = wget_ftpls_fuzzer.c $(MAIN) +wget_ftpls_fuzzer_LDADD = ../src/libunittest.a $(LDADD) + +wget_html_fuzzer_SOURCES = wget_html_fuzzer.c $(MAIN) +wget_html_fuzzer_LDADD = ../src/libunittest.a $(LDADD) + +wget_netrc_fuzzer_SOURCES = wget_netrc_fuzzer.c $(MAIN) +wget_netrc_fuzzer_LDADD = ../src/libunittest.a $(LDADD) + +wget_options_fuzzer_SOURCES = wget_options_fuzzer.c $(MAIN) +wget_options_fuzzer_LDADD = ../src/libunittest.a $(LDADD) + +wget_robots_fuzzer_SOURCES = wget_robots_fuzzer.c $(MAIN) +wget_robots_fuzzer_LDADD = ../src/libunittest.a $(LDADD) + +wget_url_fuzzer_SOURCES = wget_url_fuzzer.c $(MAIN) +wget_url_fuzzer_LDADD = ../src/libunittest.a $(LDADD) + +#EXTRA_DIST = $(wildcard *.options) $(wildcard *.dict) \ +# $(wildcard *.in) $(wildcard *.repro) + +dist-hook: + find $(srcdir) -name '*.options' -exec cp -v '{}' $(distdir) ';' + find $(srcdir) -name '*.dict' -exec cp -v '{}' $(distdir) ';' +# find $(srcdir) -name '*.in' -exec cp -vr '{}' $(distdir) ';' + find $(srcdir) -name '*.repro' -exec cp -vr '{}' $(distdir) ';' + +clean-local: + rm -rf *.gc?? *.log lcov + +oss-fuzz: + if test "$$OUT" != ""; then \ + XLIBS="-lpsl -lgnutls -lnettle -lhogweed -lidn2 -lunistring"; \ + for ccfile in wget*_fuzzer.c; do \ + fuzzer=$$(basename $$ccfile .c); \ + $$CXX $$CXXFLAGS -I$(top_srcdir)/src -I$(top_srcdir) -I$(top_srcdir)/lib \ + "$${fuzzer}.c" -o "$${fuzzer}" \ + ../src/libunittest.a ../lib/libgnu.a $${LIB_FUZZING_ENGINE} \ + -Wl,-Bstatic $${XLIBS} -Wl,-Bdynamic; \ + done; \ + fi + +.PHONY: oss-fuzz |