meson: skip symbol analysis when tests are disabled or build type is not dev (#44322)

The libshared-unused-symbols test references every executable, including
tests and fuzzers whose build_by_default is false. Meson 1.3 adds test
prerequisites to Ninja's all target, so registering this test pulls
those executables into a build configured even if -Dtests=false.

The resulting executables fail to link because src/shared/tests.c is
excluded from libsystemd-shared when tests are disabled.

Follow-up for 3f0fc93219

(cherry picked from commit dac6eb0a24)
(cherry picked from commit d3ccae621e)
This commit is contained in:
Luca Boccassi committed 2026-11-05 14:30:21 +00:00
1 parent d5d3f5f9ce
commit 9c06ee2277
1 file changed
+12 -10
+12 -10
View File
@@ -2685,17 +2685,19 @@ if spatch.found()
endforeach
endif
symbol_analysis_exes = []
foreach name, exe : executables_by_name
symbol_analysis_exes += exe
endforeach
if want_tests != 'false' and conf.get('BUILD_MODE_DEVELOPER') == 1
symbol_analysis_exes = []
foreach name, exe : executables_by_name
symbol_analysis_exes += exe
endforeach
test(
'libshared-unused-symbols',
find_unused_library_symbols_py,
suite : 'unused-symbols',
args : [libshared, libcore] + nss_targets + pam_targets + symbol_analysis_exes,
)
test(
'libshared-unused-symbols',
find_unused_library_symbols_py,
suite : 'unused-symbols',
args : [libshared, libcore] + nss_targets + pam_targets + symbol_analysis_exes,
)
endif
run_target(
'check-api-docs',