1
0
mirror of https://gitlab.gnome.org/GNOME/glib.git synced 2026-10-24 00:49:00 +03:00

fuzzing: Skip build if oss-fuzz and tests are both omitted

Builds that omit both fuzzing and tests aren't going to want the fuzzing
unit tests.
This commit is contained in:
Benjamin Gilbert
2026-06-28 18:21:08 -07:00
parent 2156dbf215
commit 03a23ff71a

View File

@@ -69,19 +69,22 @@ else
extra_sources += 'driver.c'
endif
foreach target_name : fuzz_targets
exe = executable(target_name, [extra_sources, target_name + '.c'],
c_args : extra_c_args,
dependencies : deps,
)
# If the FuzzingEngine isn’t available, build some unit tests to check that
# the fuzzing files do basically work. This doesn’t do any actual fuzzing though.
# Pass in the README as an arbitrary fuzzing input, just so we have something.
if build_tests and not have_fuzzing_engine
test(target_name, exe,
args : files('README.md'),
suite : 'fuzzing',
if have_fuzzing_engine or build_tests
foreach target_name : fuzz_targets
exe = executable(target_name, [extra_sources, target_name + '.c'],
c_args : extra_c_args,
dependencies : deps,
)
endif
endforeach
# If the FuzzingEngine isn’t available, build some unit tests to check
# that the fuzzing files do basically work. This doesn’t do any actual
# fuzzing though. Pass in the README as an arbitrary fuzzing input,
# just so we have something.
if not have_fuzzing_engine
test(target_name, exe,
args : files('README.md'),
suite : 'fuzzing',
)
endif
endforeach
endif