]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: stop registering .standalone in executables_by_name 43130/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Thu, 23 Jul 2026 21:19:16 +0000 (23:19 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Thu, 23 Jul 2026 22:36:44 +0000 (00:36 +0200)
af4c5730e524c972994232259e5051b951142485 tried to have meson stop
building all possible .standalone binaries in for tests. But it turns out
that those binaries are still built for meson-test-prereq, because they
are listed in executables_by_name, and we interate over
executables_by_name and add all exes found there as dependencies for two
tests: test-link-abi and libshared-unused-symbols. So we'd end up still
building all the .standalone binaries. To really fix this, define the
executables() for .standalone targets, but don't add them to this array.

A secondary change is to set build_by_default to true for .standalone
binaries if have_dlopen_tests is set. This means that we'll build more
binaries in the "build" phase, instead of only building them "on demand"
for tests. I think it is nicer to build everything that'll be used in one
step, and then only run the tests in the test target. For example, tests
may be run under root or in some special environment, and building thins
there is iffy.

The overall effect of this change should be that we stop building or
testing .standalone variants for binaries that we'll not later install,
unless -Ddlopen-tests=true is specified.

Also exclude .standalone binaries from check-help test. The test fails
for some binaries when the width is exceeded because of the ".standalone"
suffix in the name. The actual binary would be called without the
suffix, so the test is not testing a realistic scenario.

meson.build

index e3d0b3c5a23dd5393c5cb956e666896c14f46271..c5b3b7dfe83d53316b919757fbfcac5d4f6c9ca4 100644 (file)
@@ -1829,7 +1829,7 @@ fuzzer_exes = []
 sources = []
 
 # binaries that have --help and are intended for use by humans,
-# usually, but not always, installed in /bin.
+# usually, but not always, installed in /usr/bin.
 public_programs = []
 
 # D-Bus introspection XML export
@@ -2367,7 +2367,7 @@ foreach dict : executables
                 install_shared = install == 'yes'
                 install_static = install_shared and install_standalone
                 build_by_default_shared = build_by_default
-                build_by_default_static = build_by_default and install_standalone
+                build_by_default_static = build_by_default and (install_standalone or want_dlopen_tests)
         elif install == 'static'
                 if is_test or is_fuzz
                         error('Install mode "@0@" is not supported for test or fuzzer target "@1@"'.format(install, name))
@@ -2444,9 +2444,9 @@ foreach dict : executables
                         install: install_static,
                 )
 
-                executables_by_name += { name_static : exe_static }
-
                 if build_by_default_static
+                        executables_by_name += { name_static : exe_static }
+
                         if dict.get('dbus', false) and not build_by_default_shared
                                 dbus_programs += exe_static
                         endif
@@ -2763,18 +2763,20 @@ endif
 foreach exec : public_programs
         name = fs.name(exec.full_path())
         if want_tests != 'false'
-                test('check-help-' + name,
-                     check_help_sh,
-                     suite : 'dist',
-                     args : exec.full_path(),
-                     depends: exec)
-
                 test('check-version-' + name,
                      check_version_sh,
                      suite : 'dist',
                      args : [exec.full_path(),
                              project_major_version],
                      depends: exec)
+
+                if not name.endswith('.standalone')
+                        test('check-help-' + name,
+                             check_help_sh,
+                             suite : 'dist',
+                             args : exec.full_path(),
+                             depends: exec)
+                endif
         endif
 endforeach