meson: move several test declarations

One of the notable change is that previously test-sysusers.sh was installed
unconditionally, but now it is installed only when sysusers is enabled.

Another change is that test-sysv-generator is now re-introduced which
was mistakenly dropped by 6c713961ab.
This commit is contained in:
Yu Watanabe 2023-06-26 03:46:05 +09:00
parent e3b7fe92e9
commit e5cc6d107c
2 changed files with 160 additions and 139 deletions

View file

@ -2466,8 +2466,6 @@ subdir('src/systemd')
subdir('src/test')
subdir('src/fuzz')
subdir('rules.d')
subdir('test')
subdir('src/ukify/test') # needs to be last for test_env variable
alias_target('devel', libsystemd_pc, libudev_pc, systemd_pc, udev_pc)
@ -2588,111 +2586,6 @@ endforeach
############################################################
if want_tests != 'false'
exe = executables_by_name.get('systemd-analyze')
test('test-compare-versions',
test_compare_versions_sh,
args : exe.full_path())
endif
if want_tests != 'false'
exe = executables_by_name.get('systemd-fstab-generator')
test('test-fstab-generator',
test_fstab_generator_sh,
# https://github.com/mesonbuild/meson/issues/2681
args : exe.full_path(),
env : test_env,
depends : exe)
endif
if conf.get('HAVE_BLKID') == 1 and conf.get('ENABLE_BOOTLOADER') == 1
if want_tests != 'false'
exe = executables_by_name.get('bootctl')
test('test-bootctl-json',
test_bootctl_json_sh,
args : exe.full_path(),
depends : exe)
endif
endif
if want_tests != 'false'
systemctl = executables_by_name.get('systemctl')
systemd_id128 = executables_by_name.get('systemd-id128')
test('test-systemctl-enable',
test_systemctl_enable_sh,
# https://github.com/mesonbuild/meson/issues/2681
args : [systemctl.full_path(),
systemd_id128.full_path()])
endif
if enable_sysusers
if want_tests != 'false'
exe = executables_by_name.get('systemd-sysusers')
test('test-sysusers',
test_sysusers_sh,
# https://github.com/mesonbuild/meson/issues/2681
args : exe.full_path())
endif
if have_standalone_binaries
if want_tests != 'false'
exe = executables_by_name.get('systemd-sysusers.standalone')
test('test-sysusers.standalone',
test_sysusers_sh,
# https://github.com/mesonbuild/meson/issues/2681
args : exe.full_path())
endif
endif
endif
if conf.get('ENABLE_TMPFILES') == 1
if want_tests != 'false'
exe = executables_by_name.get('systemd-tmpfiles')
test('test-systemd-tmpfiles',
test_systemd_tmpfiles_py,
# https://github.com/mesonbuild/meson/issues/2681
args : exe.full_path())
endif
if have_standalone_binaries
if want_tests != 'false'
exe = executables_by_name.get('systemd-tmpfiles.standalone')
test('test-systemd-tmpfiles.standalone',
test_systemd_tmpfiles_py,
# https://github.com/mesonbuild/meson/issues/2681
args : exe.full_path())
endif
endif
endif
if conf.get('ENABLE_HWDB') == 1
if want_tests != 'false'
exe = executables_by_name.get('systemd-hwdb')
test('hwdb-test',
hwdb_test_sh,
suite : 'dist',
args : exe.full_path(),
timeout : 90)
endif
endif
if want_tests != 'false'
exe = executables_by_name.get('udevadm')
test('udev-rules-check',
exe,
suite : 'dist',
args : ['verify', '--resolve-names=never', all_rules])
endif
if want_tests != 'false'
exe = executables_by_name.get('systemd-network-generator')
test('test-network-generator-conversion',
test_network_generator_conversion_sh,
# https://github.com/mesonbuild/meson/issues/2681
args : exe.full_path(),
depends : exe)
endif
ukify = custom_target(
'ukify',
input : 'src/ukify/ukify.py',
@ -2705,24 +2598,11 @@ if want_ukify
public_programs += ukify
endif
if want_tests != 'false' and conf.get('ENABLE_KERNEL_INSTALL') == 1
kernel_install = executables_by_name.get('kernel-install')
args = [kernel_install.full_path(), loaderentry_install.full_path(), uki_copy_install]
deps = [kernel_install, loaderentry_install]
if want_ukify and boot_stubs.length() > 0
args += [ukify.full_path(), ukify_install.full_path(), boot_stubs[0]]
deps += [ukify, ukify_install, boot_stubs[0]]
endif
test('test-kernel-install',
test_kernel_install_sh,
env : test_env,
args : args,
depends: deps)
endif
############################################################
subdir('rules.d')
subdir('test')
runtest_env = custom_target(
'systemd-runtest.env',
output : 'systemd-runtest.env',

View file

@ -49,30 +49,118 @@ if install_tests
unittestsdir / 'testdata')
endif
test_bootctl_json_sh = find_program('test-bootctl-json.sh')
test_fstab_generator_sh = find_program('test-fstab-generator.sh')
test_network_generator_conversion_sh = find_program('test-network-generator-conversion.sh')
test_systemctl_enable_sh = find_program('test-systemctl-enable.sh')
test_systemd_tmpfiles_py = find_program('test-systemd-tmpfiles.py')
hwdb_test_sh = find_program('hwdb-test.sh')
############################################################
if conf.get('ENABLE_SYSUSERS') == 1
test_sysusers_sh = configure_file(
input : 'test-sysusers.sh.in',
output : 'test-sysusers.sh',
configuration : conf)
if want_tests != 'false'
exe = executables_by_name.get('systemd-sysusers')
test('test-sysusers',
test_sysusers_sh,
# https://github.com/mesonbuild/meson/issues/2681
args : exe.full_path(),
depends : exe)
if have_standalone_binaries
exe = executables_by_name.get('systemd-sysusers.standalone')
test('test-sysusers.standalone',
test_sysusers_sh,
# https://github.com/mesonbuild/meson/issues/2681
args : exe.full_path(),
depends : exe)
endif
endif
if install_tests
install_data(test_sysusers_sh,
install_dir : unittestsdir)
install_subdir('test-sysusers',
exclude_files : '.gitattributes',
install_dir : testdata_dir)
endif
endif
############################################################
test_sysusers_sh = configure_file(
input : 'test-sysusers.sh.in',
output : 'test-sysusers.sh',
configuration : conf)
if install_tests and conf.get('ENABLE_SYSUSERS') == 1
install_data(test_sysusers_sh,
install_dir : unittestsdir)
install_subdir('test-sysusers',
exclude_files : '.gitattributes',
install_dir : testdata_dir)
if want_tests != 'false' and conf.get('ENABLE_HWDB') == 1
hwdb_test_sh = find_program('hwdb-test.sh')
exe = executables_by_name.get('systemd-hwdb')
test('hwdb-test',
hwdb_test_sh,
suite : 'dist',
args : exe.full_path(),
depends : exe,
timeout : 90)
endif
############################################################
if want_tests != 'false'
test_systemctl_enable_sh = find_program('test-systemctl-enable.sh')
systemctl = executables_by_name.get('systemctl')
systemd_id128 = executables_by_name.get('systemd-id128')
test('test-systemctl-enable',
test_systemctl_enable_sh,
# https://github.com/mesonbuild/meson/issues/2681
args : [systemctl.full_path(),
systemd_id128.full_path()],
depends : [systemctl, systemd_id128])
endif
############################################################
if want_tests != 'false' and conf.get('HAVE_SYSV_COMPAT') == 1
sysv_generator_test_py = find_program('sysv-generator-test.py')
exe = executables_by_name.get('systemd-sysv-generator')
test('sysv-generator-test',
sysv_generator_test_py,
depends : exe)
endif
############################################################
if want_tests != 'false' and conf.get('HAVE_BLKID') == 1 and conf.get('ENABLE_BOOTLOADER') == 1
test_bootctl_json_sh = find_program('test-bootctl-json.sh')
exe = executables_by_name.get('bootctl')
test('test-bootctl-json',
test_bootctl_json_sh,
args : exe.full_path(),
depends : exe)
endif
############################################################
if want_tests != 'false' and conf.get('ENABLE_TMPFILES') == 1
test_systemd_tmpfiles_py = find_program('test-systemd-tmpfiles.py')
exe = executables_by_name.get('systemd-tmpfiles')
test('test-systemd-tmpfiles',
test_systemd_tmpfiles_py,
args : exe.full_path(),
depends : exe)
if have_standalone_binaries
exe = executables_by_name.get('systemd-tmpfiles.standalone')
test('test-systemd-tmpfiles.standalone',
test_systemd_tmpfiles_py,
args : exe.full_path(),
depends : exe)
endif
endif
############################################################
test_compare_versions_sh = files('test-compare-versions.sh')
if want_tests != 'false'
exe = executables_by_name.get('systemd-analyze')
test('test-compare-versions',
test_compare_versions_sh,
args : exe.full_path(),
depends : exe)
endif
if install_tests
install_data(test_compare_versions_sh,
install_dir : unittestsdir)
@ -86,6 +174,12 @@ if want_tests != 'false'
rule_syntax_check_py,
suite : 'dist',
args : all_rules)
exe = executables_by_name.get('udevadm')
test('udev-rules-check',
exe,
suite : 'dist',
args : ['verify', '--resolve-names=never', all_rules])
endif
############################################################
@ -94,11 +188,38 @@ if install_tests
install_data('run-unit-tests.py',
install_mode : 'rwxr-xr-x',
install_dir : testsdir)
endif
############################################################
test_fstab_generator_sh = find_program('test-fstab-generator.sh')
if want_tests != 'false'
exe = executables_by_name.get('systemd-fstab-generator')
test('test-fstab-generator',
test_fstab_generator_sh,
# https://github.com/mesonbuild/meson/issues/2681
args : exe.full_path(),
env : test_env,
depends : exe)
endif
if install_tests
install_data('test-fstab-generator.sh',
install_mode : 'rwxr-xr-x',
install_dir : unittestsdir)
endif
############################################################
test_network_generator_conversion_sh = find_program('test-network-generator-conversion.sh')
if want_tests != 'false'
exe = executables_by_name.get('systemd-network-generator')
test('test-network-generator-conversion',
test_network_generator_conversion_sh,
# https://github.com/mesonbuild/meson/issues/2681
args : exe.full_path(),
depends : exe)
endif
if install_tests
install_data('test-network-generator-conversion.sh',
install_mode : 'rwxr-xr-x',
install_dir : unittestsdir)
@ -162,4 +283,24 @@ if want_tests != 'false' and dmi_arches.contains(host_machine.cpu_family())
endforeach
endif
############################################################
if want_tests != 'false' and conf.get('ENABLE_KERNEL_INSTALL') == 1
kernel_install = executables_by_name.get('kernel-install')
args = [kernel_install.full_path(), loaderentry_install.full_path(), uki_copy_install]
deps = [kernel_install, loaderentry_install]
if want_ukify and boot_stubs.length() > 0
args += [ukify.full_path(), ukify_install.full_path(), boot_stubs[0]]
deps += [ukify, ukify_install, boot_stubs[0]]
endif
test('test-kernel-install',
test_kernel_install_sh,
env : test_env,
args : args,
depends : deps)
endif
############################################################
subdir('fuzz')