From e75d8a7cbc98c13a1e75360e7ea6a36123ad849d Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 13:01:54 +0100 Subject: [PATCH] test: Correct generation of .test metadata 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 --- test/meson.build | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/test/meson.build b/test/meson.build index fa2338cc0..423707154 100644 --- a/test/meson.build +++ b/test/meson.build @@ -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', -- 2.47.3