]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: make sure the unit test scripts find testdata/ even if they are not installed...
authorFranck Bui <fbui@suse.com>
Fri, 17 Mar 2023 13:18:50 +0000 (14:18 +0100)
committerFranck Bui <fbui@suse.com>
Fri, 24 Mar 2023 13:10:04 +0000 (14:10 +0100)
testdata/ is shared by both the unit tests and the integration tests. Hence it
makes sense to place them right under /usr/lib/systemd/tests/ while the tests
themself are located under dedicated sub-directories:

     /usr/lib/systemd/tests/
     ├── integration-tests
     ├── testdata
     └── unit-tests
         ├── testdata -> ../testdata

However the unit tests implemented as shell scripts (such as
test-fstab-generator.sh) expect to find testdata/ where the scripts are
installed, ie they do something like:

  src="$(dirname "$0")/testdata/test-fstab-generator"

This patch installs a symlink in 'unitestsdir' named "testdata" and that points
to whatever value 'testdata_dir' is set.

test/meson.build

index a05b66720886d1f5b0b040077846e1324f2ea997..80a83813cb47fee276bfa693e070fad31625093f 100644 (file)
@@ -57,6 +57,12 @@ if install_tests
         install_data('create-busybox-container',
                      install_mode : 'rwxr-xr-x',
                      install_dir : testdata_dir)
+
+        # The unit tests implemented as shell scripts expect to find testdata/
+        # in the directory where they are stored.
+        meson.add_install_script(meson_make_symlink,
+                                 testdata_dir,
+                                 unittestsdir / 'testdata')
 endif
 
 test_bootctl_json_sh = find_program('test-bootctl-json.sh')