From 311efaae253f2c7d317f3f296aac16b19e622bb1 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Tue, 13 Feb 2024 13:43:49 +0000 Subject: [PATCH] meson: do not attempt to install tests when they are disabled If -Dtests=false but -Dinstall-tests=true the build will fail, as some tests will be pulled in the build but not their prerequisites. It doesn't make sense to ask for tests to be installed if they are disabled. FAILED: test-acd cc -o test-acd test-acd.p/src_libsystemd-network_test-acd.c.o -flto -Wl,--as-needed -Wl,--no-undefined -pie -fstack-protector -Wl,-z,relro -specs=/usr/share/debhelper/dh_package_notes/debian-package-notes.specs -g -O2 -ffile-prefix-map=/tmp/s=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -ffat-lto-objects -Wdate-time -D_FORTIFY_SOURCE=2 '-Wl,-rpath,$ORIGIN/src/shared:XXXXXXXXXXXXXXX' -Wl,-rpath-link,/tmp/s/obj-x86_64-linux-gnu/src/shared -Wl,--start-group src/shared/libsystemd-shared-255.so src/libsystemd-network/libsystemd-network.a -Wl,--end-group -Wl,--fatal-warnings -Wl,-z,now -Wl,-z,relro -Wl,--warn-common -Wl,--gc-sections -Wl,--fatal-warnings -Wl,-z,now -Wl,-z,relro -Wl,--warn-common -Wl,--gc-sections /usr/bin/ld: /tmp/cc0oYwFZ.ltrans0.ltrans.o: in function `main': ./obj-x86_64-linux-gnu/./obj-x86_64-linux-gnu/:85:(.text.startup+0x33): undefined reference to `test_setup_logging' collect2: error: ld returned 1 exit status --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index c031db78a7..ff79efd989 100644 --- a/meson.build +++ b/meson.build @@ -313,7 +313,7 @@ meson_build_sh = find_program('tools/meson-build.sh') want_tests = get_option('tests') slow_tests = want_tests != 'false' and get_option('slow-tests') fuzz_tests = want_tests != 'false' and get_option('fuzz-tests') -install_tests = get_option('install-tests') +install_tests = want_tests != 'false' and get_option('install-tests') if add_languages('cpp', native : false, required : fuzzer_build) # Used only for tests -- 2.25.1