contrib/fuzz/Makefile
author Jun Wu <quark@fb.com>
Tue, 06 Mar 2018 19:31:17 -0800
changeset 36765 04d64163039a
parent 36679 624cbd1477a6
child 38173 fa0ddd5e8fff
permissions -rw-r--r--
fuzz: fix xdiff build Recent xdiff code cleanups removed some files and changed some structures. Update fuzz code. Differential Revision: https://phab.mercurial-scm.org/D2707
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35670
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
     1
bdiff.o: ../../mercurial/bdiff.c
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
     2
	clang -g -O1 -fsanitize=fuzzer-no-link,address -c -o bdiff.o \
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
     3
	  ../../mercurial/bdiff.c
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
     4
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
     5
bdiff: bdiff.cc bdiff.o
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
     6
	clang -DHG_FUZZER_INCLUDE_MAIN=1 -g -O1 -fsanitize=fuzzer-no-link,address \
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
     7
	  -I../../mercurial bdiff.cc bdiff.o -o bdiff
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
     8
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
     9
bdiff-oss-fuzz.o: ../../mercurial/bdiff.c
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
    10
	$$CC $$CFLAGS -c -o bdiff-oss-fuzz.o ../../mercurial/bdiff.c
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
    11
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
    12
bdiff_fuzzer: bdiff.cc bdiff-oss-fuzz.o
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
    13
	$$CXX $$CXXFLAGS -std=c++11 -I../../mercurial bdiff.cc \
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
    14
	  bdiff-oss-fuzz.o -lFuzzingEngine -o $$OUT/bdiff_fuzzer
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
    15
36679
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    16
x%.o: ../../mercurial/thirdparty/xdiff/x%.c ../../mercurial/thirdparty/xdiff/*.h
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    17
	clang -g -O1 -fsanitize=fuzzer-no-link,address -c \
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    18
	  -o $@ \
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    19
	  $<
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    20
36765
04d64163039a fuzz: fix xdiff build
Jun Wu <quark@fb.com>
parents: 36679
diff changeset
    21
xdiff: xdiff.cc xdiffi.o xprepare.o  xutils.o
36679
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    22
	clang -DHG_FUZZER_INCLUDE_MAIN=1 -g -O1 -fsanitize=fuzzer-no-link,address \
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    23
	  -I../../mercurial xdiff.cc \
36765
04d64163039a fuzz: fix xdiff build
Jun Wu <quark@fb.com>
parents: 36679
diff changeset
    24
	  xdiffi.o xprepare.o xutils.o -o xdiff
35670
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
    25
36679
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    26
fuzz-x%.o: ../../mercurial/thirdparty/xdiff/x%.c ../../mercurial/thirdparty/xdiff/*.h
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    27
	$$CC $$CFLAGS -c \
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    28
	  -o $@ \
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    29
	  $<
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    30
36765
04d64163039a fuzz: fix xdiff build
Jun Wu <quark@fb.com>
parents: 36679
diff changeset
    31
xdiff_fuzzer: xdiff.cc fuzz-xdiffi.o fuzz-xprepare.o  fuzz-xutils.o
36679
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    32
	$$CXX $$CXXFLAGS -std=c++11 -I../../mercurial xdiff.cc \
36765
04d64163039a fuzz: fix xdiff build
Jun Wu <quark@fb.com>
parents: 36679
diff changeset
    33
	  fuzz-xdiffi.o fuzz-xprepare.o fuzz-xutils.o \
36679
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    34
	  -lFuzzingEngine -o $$OUT/xdiff_fuzzer
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    35
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    36
all: bdiff xdiff
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    37
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    38
oss-fuzz: bdiff_fuzzer xdiff_fuzzer
35670
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
    39
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
    40
.PHONY: all oss-fuzz