fix: dev: Build the fuzzers without the libbindtest test library

Every fuzz target depended on libtest_dep, which forces building the
libbindtest shared library.  In a static build (as used by OSS-Fuzz)
that link fails: libbindtest's netmgr wrappers multiply-define symbols
that also live in the static libisc/libns archives, and the static
system libraries are not position independent.

Only fuzz_dns_qp actually uses the qp test helpers, so give it just
tests/libtest/qp.c via the new libtest_qp_dep and drop libtest_dep
from the fuzzers.

Assisted-by: Claude:claude-opus-4-8

Merge branch 'mnowak/fuzz-drop-libbindtest' into 'main'

See merge request isc-projects/bind9!12194
This commit is contained in:
Michal Nowak 2026-06-08 12:09:24 +02:00
commit c8e9823121
2 changed files with 18 additions and 5 deletions

View file

@ -1873,6 +1873,13 @@ subdir('doc')
subdir('tests')
foreach name, sources : fuzz_binaries
# Only fuzz_dns_qp uses the qp test helpers; give it just those sources
# rather than the whole libbindtest library (see libtest_qp_dep).
fuzz_deps = [libdns_dep, libisc_dep]
if name == 'fuzz_dns_qp'
fuzz_deps += libtest_qp_dep
endif
fuzz_bin = executable(
name,
sources,
@ -1880,13 +1887,10 @@ foreach name, sources : fuzz_binaries
implicit_include_directories: true,
install: false,
c_args: ['-Wno-vla'],
include_directories: test_inc,
link_args: fuzz_link_args,
sources: default_sanitize_options,
dependencies: [
libdns_dep,
libisc_dep,
libtest_dep,
],
dependencies: fuzz_deps,
)
test(

View file

@ -39,6 +39,15 @@ libtest_dep = declare_dependency(
include_directories: test_inc,
)
# Minimal dependency providing just the qp test helpers (compiled into the
# consumer), for the fuzzers. It avoids linking the whole libbindtest shared
# library, which cannot be built from static archives - e.g. the OSS-Fuzz
# build, where libbindtest's netmgr wrappers clash with libisc/libns.
libtest_qp_dep = declare_dependency(
sources: files('libtest' / 'qp.c'),
include_directories: test_inc,
)
if not cmocka_dep.found()
subdir_done()
endif