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 <smcv@collabora.com>
This commit is contained in:
Simon McVittie 2022-06-24 13:01:54 +01:00
parent c8ecf552c8
commit e75d8a7cbc

View 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',