Skip to content

Commit 28911f7

Browse files
pks-tgitster
authored andcommitted
meson: wire up fuzzers
Meson does not yet know to build our fuzzers. Introduce a new build option "fuzzers" and wire up the fuzzers in case it is enabled. Adapt our CI jobs so that they build the fuzzers by default. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 88d4bff commit 28911f7

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

ci/run-build-and-tests.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ case "$jobname" in
5353
*-meson)
5454
group "Configure" meson setup build . \
5555
--warnlevel 2 --werror \
56-
--wrap-mode nofallback
56+
--wrap-mode nofallback \
57+
-Dfuzzers=true
5758
group "Build" meson compile -C build --
5859
if test -n "$run_tests"
5960
then

meson.build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,6 +1906,10 @@ if get_option('tests')
19061906
subdir('t')
19071907
endif
19081908

1909+
if get_option('fuzzers')
1910+
subdir('oss-fuzz')
1911+
endif
1912+
19091913
subdir('bin-wrappers')
19101914
if get_option('docs') != []
19111915
subdir('Documentation')

meson_options.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,5 @@ option('tests', type: 'boolean', value: true,
9595
description: 'Enable building tests. This requires Perl, but is separate from the "perl" option such that you can build tests without Perl features enabled.')
9696
option('test_output_directory', type: 'string',
9797
description: 'Path to the directory used to store test outputs')
98+
option('fuzzers', type: 'boolean', value: false,
99+
description: 'Enable building fuzzers.')

oss-fuzz/meson.build

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
fuzz_programs = [
2+
'fuzz-commit-graph.c',
3+
'fuzz-config.c',
4+
'fuzz-credential-from-url-gently.c',
5+
'fuzz-date.c',
6+
'fuzz-pack-headers.c',
7+
'fuzz-pack-idx.c',
8+
'fuzz-parse-attr-line.c',
9+
'fuzz-url-decode-mem.c',
10+
]
11+
12+
foreach fuzz_program : fuzz_programs
13+
executable(fs.stem(fuzz_program),
14+
sources: [
15+
'dummy-cmd-main.c',
16+
fuzz_program,
17+
],
18+
dependencies: [libgit, common_main],
19+
)
20+
endforeach

0 commit comments

Comments
 (0)