contrib/fuzz/Makefile
author Arseniy Alekseyev <aalekseyev@janestreet.com>
Mon, 08 Jan 2024 15:25:33 +0000
branchstable
changeset 51166 ded1bad5653d
parent 46818 1977495dbbe2
permissions -rw-r--r--
tests: fix nondeterministic test failure in test-contrib-perf.t It turns out (not too shockingly!) the kernel sometimes has some work to do, perhaps at the very least context-switching, so asserting the system time is 0.000000 doesn't work.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46648
25b1610f8534 fuzz: if the caller of our makefile sets CC and CXX, trust them
Augie Fackler <augie@google.com>
parents: 46259
diff changeset
     1
CC ?= clang
25b1610f8534 fuzz: if the caller of our makefile sets CC and CXX, trust them
Augie Fackler <augie@google.com>
parents: 46259
diff changeset
     2
CXX ?= clang++
38242
bf901559e647 fuzz: expand variables by make
Yuya Nishihara <yuya@tcha.org>
parents: 38208
diff changeset
     3
43831
5a9e2ae9899b fuzz: use a more standard approach to allow local builds of fuzzers
Augie Fackler <augie@google.com>
parents: 43830
diff changeset
     4
# By default, use our own standalone_fuzz_target_runner.
5a9e2ae9899b fuzz: use a more standard approach to allow local builds of fuzzers
Augie Fackler <augie@google.com>
parents: 43830
diff changeset
     5
# This runner does no fuzzing, but simply executes the inputs
5a9e2ae9899b fuzz: use a more standard approach to allow local builds of fuzzers
Augie Fackler <augie@google.com>
parents: 43830
diff changeset
     6
# provided via parameters.
5a9e2ae9899b fuzz: use a more standard approach to allow local builds of fuzzers
Augie Fackler <augie@google.com>
parents: 43830
diff changeset
     7
# Run e.g. "make all LIB_FUZZING_ENGINE=/path/to/libFuzzer.a"
5a9e2ae9899b fuzz: use a more standard approach to allow local builds of fuzzers
Augie Fackler <augie@google.com>
parents: 43830
diff changeset
     8
# to link the fuzzer(s) against a real fuzzing engine.
5a9e2ae9899b fuzz: use a more standard approach to allow local builds of fuzzers
Augie Fackler <augie@google.com>
parents: 43830
diff changeset
     9
#
5a9e2ae9899b fuzz: use a more standard approach to allow local builds of fuzzers
Augie Fackler <augie@google.com>
parents: 43830
diff changeset
    10
# OSS-Fuzz will define its own value for LIB_FUZZING_ENGINE.
5a9e2ae9899b fuzz: use a more standard approach to allow local builds of fuzzers
Augie Fackler <augie@google.com>
parents: 43830
diff changeset
    11
LIB_FUZZING_ENGINE ?= standalone_fuzz_target_runner.o
43828
53f582bee3d1 fuzz: follow modern guidelines and use LIB_FUZZING_ENGINE
Augie Fackler <augie@google.com>
parents: 43659
diff changeset
    12
46818
1977495dbbe2 fuzz: use Python 3 in makefile
Martin von Zweigbergk <martinvonz@google.com>
parents: 46648
diff changeset
    13
# Default to Python 3.
1977495dbbe2 fuzz: use Python 3 in makefile
Martin von Zweigbergk <martinvonz@google.com>
parents: 46648
diff changeset
    14
#
1977495dbbe2 fuzz: use Python 3 in makefile
Martin von Zweigbergk <martinvonz@google.com>
parents: 46648
diff changeset
    15
# Windows ships Python 3 as `python.exe`, which may not be on PATH.  py.exe is.
1977495dbbe2 fuzz: use Python 3 in makefile
Martin von Zweigbergk <martinvonz@google.com>
parents: 46648
diff changeset
    16
ifeq ($(OS),Windows_NT)
1977495dbbe2 fuzz: use Python 3 in makefile
Martin von Zweigbergk <martinvonz@google.com>
parents: 46648
diff changeset
    17
PYTHON?=py -3
1977495dbbe2 fuzz: use Python 3 in makefile
Martin von Zweigbergk <martinvonz@google.com>
parents: 46648
diff changeset
    18
else
1977495dbbe2 fuzz: use Python 3 in makefile
Martin von Zweigbergk <martinvonz@google.com>
parents: 46648
diff changeset
    19
PYTHON?=python3
1977495dbbe2 fuzz: use Python 3 in makefile
Martin von Zweigbergk <martinvonz@google.com>
parents: 46648
diff changeset
    20
endif
1977495dbbe2 fuzz: use Python 3 in makefile
Martin von Zweigbergk <martinvonz@google.com>
parents: 46648
diff changeset
    21
43830
bf0453866c80 fuzz: use a variable to allow specifying python-config to use
Augie Fackler <augie@google.com>
parents: 43829
diff changeset
    22
PYTHON_CONFIG ?= $$OUT/sanpy/bin/python-config
46259
4e85439c1760 fuzz: fix Makefile default PYTHON_CONFIG_FLAGS to be modern
Augie Fackler <augie@google.com>
parents: 44997
diff changeset
    23
PYTHON_CONFIG_FLAGS ?= --ldflags --embed
43830
bf0453866c80 fuzz: use a variable to allow specifying python-config to use
Augie Fackler <augie@google.com>
parents: 43829
diff changeset
    24
43829
d1587fadff06 fuzz: suppress deprecated-register warnings in our compile
Augie Fackler <augie@google.com>
parents: 43828
diff changeset
    25
CXXFLAGS += -Wno-deprecated-register
d1587fadff06 fuzz: suppress deprecated-register warnings in our compile
Augie Fackler <augie@google.com>
parents: 43828
diff changeset
    26
43833
19da643dc10c tests: finally fix up test-fuzz-targets.t
Augie Fackler <augie@google.com>
parents: 43831
diff changeset
    27
all: standalone_fuzz_target_runner.o oss-fuzz
38243
4dd3b6c68f96 fuzz: fix the default make target
Yuya Nishihara <yuya@tcha.org>
parents: 38242
diff changeset
    28
43831
5a9e2ae9899b fuzz: use a more standard approach to allow local builds of fuzzers
Augie Fackler <augie@google.com>
parents: 43830
diff changeset
    29
standalone_fuzz_target_runner.o: standalone_fuzz_target_runner.cc
5a9e2ae9899b fuzz: use a more standard approach to allow local builds of fuzzers
Augie Fackler <augie@google.com>
parents: 43830
diff changeset
    30
43861
d74d78aa74e9 fuzz: clean up production of seed corpora
Augie Fackler <augie@google.com>
parents: 43835
diff changeset
    31
$$OUT/%_fuzzer_seed_corpus.zip: %_corpus.py
46818
1977495dbbe2 fuzz: use Python 3 in makefile
Martin von Zweigbergk <martinvonz@google.com>
parents: 46648
diff changeset
    32
	$(PYTHON) $< $@
43861
d74d78aa74e9 fuzz: clean up production of seed corpora
Augie Fackler <augie@google.com>
parents: 43835
diff changeset
    33
41023
ef103c96ed33 fuzz: extract Python initialization to utility package
Augie Fackler <augie@google.com>
parents: 41022
diff changeset
    34
pyutil.o: pyutil.cc pyutil.h
ef103c96ed33 fuzz: extract Python initialization to utility package
Augie Fackler <augie@google.com>
parents: 41022
diff changeset
    35
	$(CXX) $(CXXFLAGS) -g -O1 \
43830
bf0453866c80 fuzz: use a variable to allow specifying python-config to use
Augie Fackler <augie@google.com>
parents: 43829
diff changeset
    36
	  `$(PYTHON_CONFIG) --cflags` \
41023
ef103c96ed33 fuzz: extract Python initialization to utility package
Augie Fackler <augie@google.com>
parents: 41022
diff changeset
    37
	  -I../../mercurial -c -o pyutil.o pyutil.cc
ef103c96ed33 fuzz: extract Python initialization to utility package
Augie Fackler <augie@google.com>
parents: 41022
diff changeset
    38
35670
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
    39
bdiff-oss-fuzz.o: ../../mercurial/bdiff.c
38242
bf901559e647 fuzz: expand variables by make
Yuya Nishihara <yuya@tcha.org>
parents: 38208
diff changeset
    40
	$(CC) $(CFLAGS) -c -o bdiff-oss-fuzz.o ../../mercurial/bdiff.c
35670
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
    41
43659
6f5c352f41b6 fuzz: clean out most of fuzzutil
Augie Fackler <augie@google.com>
parents: 43153
diff changeset
    42
bdiff_fuzzer: bdiff.cc bdiff-oss-fuzz.o
38242
bf901559e647 fuzz: expand variables by make
Yuya Nishihara <yuya@tcha.org>
parents: 38208
diff changeset
    43
	$(CXX) $(CXXFLAGS) -std=c++17 -I../../mercurial bdiff.cc \
43828
53f582bee3d1 fuzz: follow modern guidelines and use LIB_FUZZING_ENGINE
Augie Fackler <augie@google.com>
parents: 43659
diff changeset
    44
	  bdiff-oss-fuzz.o $(LIB_FUZZING_ENGINE) -o \
38207
36d55f90e2a3 fuzzutil: make it possible to use absl when C++17 isn't supported
Augie Fackler <augie@google.com>
parents: 38206
diff changeset
    45
	  $$OUT/bdiff_fuzzer
35670
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
    46
38258
46dcb9f14900 fuzz: new fuzzer for the mpatch code
Augie Fackler <augie@google.com>
parents: 38246
diff changeset
    47
mpatch.o: ../../mercurial/mpatch.c
46dcb9f14900 fuzz: new fuzzer for the mpatch code
Augie Fackler <augie@google.com>
parents: 38246
diff changeset
    48
	$(CC) -g -O1 -fsanitize=fuzzer-no-link,address -c -o mpatch.o \
46dcb9f14900 fuzz: new fuzzer for the mpatch code
Augie Fackler <augie@google.com>
parents: 38246
diff changeset
    49
	  ../../mercurial/mpatch.c
46dcb9f14900 fuzz: new fuzzer for the mpatch code
Augie Fackler <augie@google.com>
parents: 38246
diff changeset
    50
46dcb9f14900 fuzz: new fuzzer for the mpatch code
Augie Fackler <augie@google.com>
parents: 38246
diff changeset
    51
mpatch-oss-fuzz.o: ../../mercurial/mpatch.c
46dcb9f14900 fuzz: new fuzzer for the mpatch code
Augie Fackler <augie@google.com>
parents: 38246
diff changeset
    52
	$(CC) $(CFLAGS) -c -o mpatch-oss-fuzz.o ../../mercurial/mpatch.c
46dcb9f14900 fuzz: new fuzzer for the mpatch code
Augie Fackler <augie@google.com>
parents: 38246
diff changeset
    53
43861
d74d78aa74e9 fuzz: clean up production of seed corpora
Augie Fackler <augie@google.com>
parents: 43835
diff changeset
    54
mpatch_fuzzer: mpatch.cc mpatch-oss-fuzz.o $$OUT/mpatch_fuzzer_seed_corpus.zip
38258
46dcb9f14900 fuzz: new fuzzer for the mpatch code
Augie Fackler <augie@google.com>
parents: 38246
diff changeset
    55
	$(CXX) $(CXXFLAGS) -std=c++17 -I../../mercurial mpatch.cc \
43828
53f582bee3d1 fuzz: follow modern guidelines and use LIB_FUZZING_ENGINE
Augie Fackler <augie@google.com>
parents: 43659
diff changeset
    56
	  mpatch-oss-fuzz.o $(LIB_FUZZING_ENGINE) -o \
38258
46dcb9f14900 fuzz: new fuzzer for the mpatch code
Augie Fackler <augie@google.com>
parents: 38246
diff changeset
    57
	  $$OUT/mpatch_fuzzer
46dcb9f14900 fuzz: new fuzzer for the mpatch code
Augie Fackler <augie@google.com>
parents: 38246
diff changeset
    58
36708
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    59
fuzz-x%.o: ../../mercurial/thirdparty/xdiff/x%.c ../../mercurial/thirdparty/xdiff/*.h
38242
bf901559e647 fuzz: expand variables by make
Yuya Nishihara <yuya@tcha.org>
parents: 38208
diff changeset
    60
	$(CC) $(CFLAGS) -c \
36708
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    61
	  -o $@ \
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    62
	  $<
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    63
43659
6f5c352f41b6 fuzz: clean out most of fuzzutil
Augie Fackler <augie@google.com>
parents: 43153
diff changeset
    64
xdiff_fuzzer: xdiff.cc fuzz-xdiffi.o fuzz-xprepare.o fuzz-xutils.o 
38242
bf901559e647 fuzz: expand variables by make
Yuya Nishihara <yuya@tcha.org>
parents: 38208
diff changeset
    65
	$(CXX) $(CXXFLAGS) -std=c++17 -I../../mercurial xdiff.cc \
43659
6f5c352f41b6 fuzz: clean out most of fuzzutil
Augie Fackler <augie@google.com>
parents: 43153
diff changeset
    66
	  fuzz-xdiffi.o fuzz-xprepare.o fuzz-xutils.o \
43828
53f582bee3d1 fuzz: follow modern guidelines and use LIB_FUZZING_ENGINE
Augie Fackler <augie@google.com>
parents: 43659
diff changeset
    67
	  $(LIB_FUZZING_ENGINE) -o $$OUT/xdiff_fuzzer
36708
624cbd1477a6 fuzz: add a fuzzer for xdiff
Augie Fackler <augie@google.com>
parents: 35670
diff changeset
    68
43835
d9f85f61f0ed fuzz: clean up some repetition on building parsers.so fuzzers
Augie Fackler <augie@google.com>
parents: 43834
diff changeset
    69
parsers-%.o: ../../mercurial/cext/%.c
d9f85f61f0ed fuzz: clean up some repetition on building parsers.so fuzzers
Augie Fackler <augie@google.com>
parents: 43834
diff changeset
    70
	$(CC) -I../../mercurial `$(PYTHON_CONFIG) --cflags` $(CFLAGS) -c \
d9f85f61f0ed fuzz: clean up some repetition on building parsers.so fuzzers
Augie Fackler <augie@google.com>
parents: 43834
diff changeset
    71
	  -o $@ $<
40054
8c692a6b5ad1 fuzz: new fuzzer for cext/manifest.c
Augie Fackler <augie@google.com>
parents: 38258
diff changeset
    72
43835
d9f85f61f0ed fuzz: clean up some repetition on building parsers.so fuzzers
Augie Fackler <augie@google.com>
parents: 43834
diff changeset
    73
PARSERS_OBJS=parsers-manifest.o parsers-charencode.o parsers-parsers.o parsers-dirs.o parsers-pathencode.o parsers-revlog.o
40054
8c692a6b5ad1 fuzz: new fuzzer for cext/manifest.c
Augie Fackler <augie@google.com>
parents: 38258
diff changeset
    74
43862
b7af8a02a304 fuzz: add a seed corpus for the dirs fuzzer
Augie Fackler <augie@google.com>
parents: 43861
diff changeset
    75
dirs_fuzzer: dirs.cc pyutil.o $(PARSERS_OBJS) $$OUT/dirs_fuzzer_seed_corpus.zip
43830
bf0453866c80 fuzz: use a variable to allow specifying python-config to use
Augie Fackler <augie@google.com>
parents: 43829
diff changeset
    76
	$(CXX) $(CXXFLAGS) `$(PYTHON_CONFIG) --cflags` \
43150
7ff40418c6bf fuzz: new fuzzer for dirs.c
Augie Fackler <augie@google.com>
parents: 41183
diff changeset
    77
	  -Wno-register -Wno-macro-redefined \
7ff40418c6bf fuzz: new fuzzer for dirs.c
Augie Fackler <augie@google.com>
parents: 41183
diff changeset
    78
	  -I../../mercurial dirs.cc \
43835
d9f85f61f0ed fuzz: clean up some repetition on building parsers.so fuzzers
Augie Fackler <augie@google.com>
parents: 43834
diff changeset
    79
	  pyutil.o $(PARSERS_OBJS) \
44997
ef8dcee272ac fuzz: add config knob for PYTHON_CONFIG_FLAGS
Augie Fackler <augie@google.com>
parents: 43862
diff changeset
    80
	  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) $(PYTHON_CONFIG_FLAGS)` \
43150
7ff40418c6bf fuzz: new fuzzer for dirs.c
Augie Fackler <augie@google.com>
parents: 41183
diff changeset
    81
	  -o $$OUT/dirs_fuzzer
7ff40418c6bf fuzz: new fuzzer for dirs.c
Augie Fackler <augie@google.com>
parents: 41183
diff changeset
    82
43835
d9f85f61f0ed fuzz: clean up some repetition on building parsers.so fuzzers
Augie Fackler <augie@google.com>
parents: 43834
diff changeset
    83
fncache_fuzzer: fncache.cc 
43830
bf0453866c80 fuzz: use a variable to allow specifying python-config to use
Augie Fackler <augie@google.com>
parents: 43829
diff changeset
    84
	$(CXX) $(CXXFLAGS) `$(PYTHON_CONFIG) --cflags` \
43152
b37dd26935ee fuzz: new fuzzer for fncache-related functions
Augie Fackler <augie@google.com>
parents: 43150
diff changeset
    85
	  -Wno-register -Wno-macro-redefined \
b37dd26935ee fuzz: new fuzzer for fncache-related functions
Augie Fackler <augie@google.com>
parents: 43150
diff changeset
    86
	  -I../../mercurial fncache.cc \
43835
d9f85f61f0ed fuzz: clean up some repetition on building parsers.so fuzzers
Augie Fackler <augie@google.com>
parents: 43834
diff changeset
    87
	  pyutil.o $(PARSERS_OBJS) \
44997
ef8dcee272ac fuzz: add config knob for PYTHON_CONFIG_FLAGS
Augie Fackler <augie@google.com>
parents: 43862
diff changeset
    88
	  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) $(PYTHON_CONFIG_FLAGS)` \
43152
b37dd26935ee fuzz: new fuzzer for fncache-related functions
Augie Fackler <augie@google.com>
parents: 43150
diff changeset
    89
	  -o $$OUT/fncache_fuzzer
b37dd26935ee fuzz: new fuzzer for fncache-related functions
Augie Fackler <augie@google.com>
parents: 43150
diff changeset
    90
43835
d9f85f61f0ed fuzz: clean up some repetition on building parsers.so fuzzers
Augie Fackler <augie@google.com>
parents: 43834
diff changeset
    91
jsonescapeu8fast_fuzzer: jsonescapeu8fast.cc pyutil.o $(PARSERS_OBJS)
43830
bf0453866c80 fuzz: use a variable to allow specifying python-config to use
Augie Fackler <augie@google.com>
parents: 43829
diff changeset
    92
	$(CXX) $(CXXFLAGS) `$(PYTHON_CONFIG) --cflags` \
43153
741fb1a95da2 fuzz: new target to fuzz jsonescapeu8fast
Augie Fackler <augie@google.com>
parents: 43152
diff changeset
    93
	  -Wno-register -Wno-macro-redefined \
741fb1a95da2 fuzz: new target to fuzz jsonescapeu8fast
Augie Fackler <augie@google.com>
parents: 43152
diff changeset
    94
	  -I../../mercurial jsonescapeu8fast.cc \
43835
d9f85f61f0ed fuzz: clean up some repetition on building parsers.so fuzzers
Augie Fackler <augie@google.com>
parents: 43834
diff changeset
    95
	  pyutil.o $(PARSERS_OBJS) \
44997
ef8dcee272ac fuzz: add config knob for PYTHON_CONFIG_FLAGS
Augie Fackler <augie@google.com>
parents: 43862
diff changeset
    96
	  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) $(PYTHON_CONFIG_FLAGS)` \
43153
741fb1a95da2 fuzz: new target to fuzz jsonescapeu8fast
Augie Fackler <augie@google.com>
parents: 43152
diff changeset
    97
	  -o $$OUT/jsonescapeu8fast_fuzzer
741fb1a95da2 fuzz: new target to fuzz jsonescapeu8fast
Augie Fackler <augie@google.com>
parents: 43152
diff changeset
    98
43861
d74d78aa74e9 fuzz: clean up production of seed corpora
Augie Fackler <augie@google.com>
parents: 43835
diff changeset
    99
manifest_fuzzer: manifest.cc pyutil.o $(PARSERS_OBJS) $$OUT/manifest_fuzzer_seed_corpus.zip
43830
bf0453866c80 fuzz: use a variable to allow specifying python-config to use
Augie Fackler <augie@google.com>
parents: 43829
diff changeset
   100
	$(CXX) $(CXXFLAGS) `$(PYTHON_CONFIG) --cflags` \
40054
8c692a6b5ad1 fuzz: new fuzzer for cext/manifest.c
Augie Fackler <augie@google.com>
parents: 38258
diff changeset
   101
	  -Wno-register -Wno-macro-redefined \
8c692a6b5ad1 fuzz: new fuzzer for cext/manifest.c
Augie Fackler <augie@google.com>
parents: 38258
diff changeset
   102
	  -I../../mercurial manifest.cc \
43835
d9f85f61f0ed fuzz: clean up some repetition on building parsers.so fuzzers
Augie Fackler <augie@google.com>
parents: 43834
diff changeset
   103
	  pyutil.o $(PARSERS_OBJS) \
44997
ef8dcee272ac fuzz: add config knob for PYTHON_CONFIG_FLAGS
Augie Fackler <augie@google.com>
parents: 43862
diff changeset
   104
	  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) $(PYTHON_CONFIG_FLAGS)` \
40054
8c692a6b5ad1 fuzz: new fuzzer for cext/manifest.c
Augie Fackler <augie@google.com>
parents: 38258
diff changeset
   105
	  -o $$OUT/manifest_fuzzer
8c692a6b5ad1 fuzz: new fuzzer for cext/manifest.c
Augie Fackler <augie@google.com>
parents: 38258
diff changeset
   106
43861
d74d78aa74e9 fuzz: clean up production of seed corpora
Augie Fackler <augie@google.com>
parents: 43835
diff changeset
   107
revlog_fuzzer: revlog.cc pyutil.o $(PARSERS_OBJS) $$OUT/revlog_fuzzer_seed_corpus.zip
43830
bf0453866c80 fuzz: use a variable to allow specifying python-config to use
Augie Fackler <augie@google.com>
parents: 43829
diff changeset
   108
	$(CXX) $(CXXFLAGS) `$(PYTHON_CONFIG) --cflags` \
41024
c06f0ef9a5ba fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents: 41023
diff changeset
   109
	  -Wno-register -Wno-macro-redefined \
c06f0ef9a5ba fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents: 41023
diff changeset
   110
	  -I../../mercurial revlog.cc \
43835
d9f85f61f0ed fuzz: clean up some repetition on building parsers.so fuzzers
Augie Fackler <augie@google.com>
parents: 43834
diff changeset
   111
	  pyutil.o $(PARSERS_OBJS) \
44997
ef8dcee272ac fuzz: add config knob for PYTHON_CONFIG_FLAGS
Augie Fackler <augie@google.com>
parents: 43862
diff changeset
   112
	  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) $(PYTHON_CONFIG_FLAGS)` \
41024
c06f0ef9a5ba fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents: 41023
diff changeset
   113
	  -o $$OUT/revlog_fuzzer
c06f0ef9a5ba fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents: 41023
diff changeset
   114
43861
d74d78aa74e9 fuzz: clean up production of seed corpora
Augie Fackler <augie@google.com>
parents: 43835
diff changeset
   115
dirstate_fuzzer: dirstate.cc pyutil.o $(PARSERS_OBJS) $$OUT/dirstate_fuzzer_seed_corpus.zip
43830
bf0453866c80 fuzz: use a variable to allow specifying python-config to use
Augie Fackler <augie@google.com>
parents: 43829
diff changeset
   116
	$(CXX) $(CXXFLAGS) `$(PYTHON_CONFIG) --cflags` \
41025
b444407f635b fuzz: new fuzzer for dirstate parser
Augie Fackler <augie@google.com>
parents: 41024
diff changeset
   117
	  -Wno-register -Wno-macro-redefined \
b444407f635b fuzz: new fuzzer for dirstate parser
Augie Fackler <augie@google.com>
parents: 41024
diff changeset
   118
	  -I../../mercurial dirstate.cc \
43835
d9f85f61f0ed fuzz: clean up some repetition on building parsers.so fuzzers
Augie Fackler <augie@google.com>
parents: 43834
diff changeset
   119
	  pyutil.o $(PARSERS_OBJS) \
44997
ef8dcee272ac fuzz: add config knob for PYTHON_CONFIG_FLAGS
Augie Fackler <augie@google.com>
parents: 43862
diff changeset
   120
	  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) $(PYTHON_CONFIG_FLAGS)` \
41025
b444407f635b fuzz: new fuzzer for dirstate parser
Augie Fackler <augie@google.com>
parents: 41024
diff changeset
   121
	  -o $$OUT/dirstate_fuzzer
b444407f635b fuzz: new fuzzer for dirstate parser
Augie Fackler <augie@google.com>
parents: 41024
diff changeset
   122
43861
d74d78aa74e9 fuzz: clean up production of seed corpora
Augie Fackler <augie@google.com>
parents: 43835
diff changeset
   123
fm1readmarkers_fuzzer: fm1readmarkers.cc pyutil.o $(PARSERS_OBJS) $$OUT/fm1readmarkers_fuzzer_seed_corpus.zip
43830
bf0453866c80 fuzz: use a variable to allow specifying python-config to use
Augie Fackler <augie@google.com>
parents: 43829
diff changeset
   124
	$(CXX) $(CXXFLAGS) `$(PYTHON_CONFIG) --cflags` \
41027
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents: 41025
diff changeset
   125
	  -Wno-register -Wno-macro-redefined \
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents: 41025
diff changeset
   126
	  -I../../mercurial fm1readmarkers.cc \
43835
d9f85f61f0ed fuzz: clean up some repetition on building parsers.so fuzzers
Augie Fackler <augie@google.com>
parents: 43834
diff changeset
   127
	  pyutil.o $(PARSERS_OBJS) \
44997
ef8dcee272ac fuzz: add config knob for PYTHON_CONFIG_FLAGS
Augie Fackler <augie@google.com>
parents: 43862
diff changeset
   128
	  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) $(PYTHON_CONFIG_FLAGS)` \
41027
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents: 41025
diff changeset
   129
	  -o $$OUT/fm1readmarkers_fuzzer
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents: 41025
diff changeset
   130
38208
fbe239064064 fuzz: add clean target
Augie Fackler <augie@google.com>
parents: 38207
diff changeset
   131
clean:
38246
9db30f438ddd fuzz: fix "make clean" to pass even if no binaries built yet
Yuya Nishihara <yuya@tcha.org>
parents: 38245
diff changeset
   132
	$(RM) *.o *_fuzzer \
38208
fbe239064064 fuzz: add clean target
Augie Fackler <augie@google.com>
parents: 38207
diff changeset
   133
	  bdiff \
38258
46dcb9f14900 fuzz: new fuzzer for the mpatch code
Augie Fackler <augie@google.com>
parents: 38246
diff changeset
   134
	  mpatch \
38208
fbe239064064 fuzz: add clean target
Augie Fackler <augie@google.com>
parents: 38207
diff changeset
   135
	  xdiff
fbe239064064 fuzz: add clean target
Augie Fackler <augie@google.com>
parents: 38207
diff changeset
   136
43861
d74d78aa74e9 fuzz: clean up production of seed corpora
Augie Fackler <augie@google.com>
parents: 43835
diff changeset
   137
oss-fuzz: bdiff_fuzzer mpatch_fuzzer xdiff_fuzzer dirs_fuzzer fncache_fuzzer jsonescapeu8fast_fuzzer manifest_fuzzer revlog_fuzzer dirstate_fuzzer fm1readmarkers_fuzzer
35670
2b9e2415f5b5 contrib: add some basic scaffolding for some fuzz test targets
Augie Fackler <augie@google.com>
parents:
diff changeset
   138
41183
c01fac6749e5 fuzz: stop building Python in the Makefile
Augie Fackler <augie@google.com>
parents: 41027
diff changeset
   139
.PHONY: all clean oss-fuzz