From 03a23ff71a9a68964eeb839128cf8a0fb7e9475f Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Sun, 28 Jun 2026 18:21:08 -0700 Subject: [PATCH] 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. --- fuzzing/meson.build | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/fuzzing/meson.build b/fuzzing/meson.build index 2738eee3e..86a4f5cd1 100644 --- a/fuzzing/meson.build +++ b/fuzzing/meson.build @@ -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