]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
test: Correct generation of .test metadata
authorSimon McVittie <smcv@collabora.com>
Fri, 24 Jun 2022 12:01:54 +0000 (13:01 +0100)
committerSimon McVittie <smcv@collabora.com>
Wed, 13 Jul 2022 19:36:13 +0000 (20:36 +0100)
If a helper executable is not, in itself, a test-case, then we should
not generate metadata that tells ginsttest-runner to run it as a
test-case.

Meanwhile, we were previously generating foo_with_config.test metadata
for tests that don't get installed; stop doing that.

We also need to distinguish between the abstract name of the test
(which usually does not start with test-), the name of the .test file
(which does start with test- for compiled executables), and the name
of the executable (which may include .exe as well). To make validation
against the Autotools build system as straightforward as possible,
generate exactly the same names as in Autotools. We can consider removing
the test- prefix later, if we remove the Autotools build system.

Signed-off-by: Simon McVittie <smcv@collabora.com>
test/meson.build

index fa2338cc00ae6c252dd756f9e1a4edeee989472f..423707154a4cdb4de7b0b8a37c7a5e6e815857b8 100644 (file)
@@ -85,6 +85,8 @@ xdgdir = custom_target('gen-xdgdir',
     output: 'XDG_RUNTIME_DIR'
 )
 
+installed_tests = []
+
 ###############################################################################
 # Dbus testutils
 
@@ -536,6 +538,13 @@ foreach test: tests
             timeout: timeout,
         )
     endif
+
+    if install and test.get('test', true)
+        installed_tests += [{
+            'name': 'test-' + test.get('name'),
+            'exe': 'test-' + test.get('name') + exe_ext,
+        }]
+    endif
 endforeach
 
 
@@ -573,6 +582,10 @@ foreach script: scripts
             install_mode: 'rwxr-xr-x',
             install_dir: test_exec_dir,
         )
+        installed_tests += [{
+            'name': name,
+            'exe': name,
+        }]
     endif
 
     # Some scripts might be used in tests but not themselves tests,
@@ -588,27 +601,27 @@ foreach script: scripts
 endforeach
 
 
-foreach exe : scripts + tests
-    name = exe.get('name')
-    install = exe.get('install', true)
+foreach test_case: installed_tests
+    name = test_case.get('name')
+    exe = test_case.get('exe', name)
 
     meta_config = configuration_data()
     meta_config.set('command',
         'env @0@/@1@ --tap'.format(
-            get_option('prefix') / test_exec_dir, name
+            get_option('prefix') / test_exec_dir, exe,
     ))
     configure_file(
         input : 'meta_template.test.in',
         output: name + '.test',
         configuration: meta_config,
-        install: install_tests and install,
+        install: install_tests,
         install_dir: test_meta_dir
     )
 
     meta_config = configuration_data()
     meta_config.set('command',
         'env DBUS_TEST_EXEC=@0@ DBUS_TEST_DATA=@0@/data @0@/@1@ --tap'.format(
-            get_option('prefix') / test_exec_dir, name
+            get_option('prefix') / test_exec_dir, exe,
     ))
     configure_file(
         input : 'meta_template.test.in',