Files
systemd/test/meson.build

407 lines
16 KiB
Meson
Raw Normal View History

# SPDX-License-Identifier: LGPL-2.1-or-later
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,
env : test_env,
suite : 'sysusers')
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,
env : test_env,
suite : 'sysusers')
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
############################################################
if want_tests != 'false' and conf.get('ENABLE_HWDB') == 1
exe = executables_by_name.get('systemd-hwdb')
test('hwdb-test',
files('hwdb-test.sh'),
suite : 'dist',
args : exe.full_path(),
depends : exe,
timeout : 90)
endif
############################################################
if want_tests != 'false'
systemctl = executables_by_name.get('systemctl')
systemd_id128 = executables_by_name.get('systemd-id128')
test('test-systemctl-enable',
files('test-systemctl-enable.sh'),
# https://github.com/mesonbuild/meson/issues/2681
args : [systemctl.full_path(),
systemd_id128.full_path()],
depends : [systemctl, systemd_id128],
suite : 'systemctl')
endif
############################################################
if want_tests != 'false' and conf.get('HAVE_SYSV_COMPAT') == 1
exe = executables_by_name.get('systemd-sysv-generator')
test('sysv-generator-test',
files('sysv-generator-test.py'),
depends : exe,
suite : 'sysv')
endif
############################################################
if want_tests != 'false' and conf.get('HAVE_BLKID') == 1
exe = executables_by_name.get('bootctl')
test('test-bootctl-json',
files('test-bootctl-json.sh'),
args : exe.full_path(),
depends : exe,
suite : 'boot')
endif
############################################################
if want_tests != 'false' and conf.get('ENABLE_TMPFILES') == 1
test_systemd_tmpfiles_py = files('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,
suite : 'tmpfiles')
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,
suite : 'tmpfiles')
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,
suite : 'test')
endif
if install_tests
install_data(test_compare_versions_sh,
install_dir : unittestsdir)
endif
############################################################
if want_tests != 'false'
test('rule-syntax-check',
files('rule-syntax-check.py'),
suite : 'dist',
args : all_rules)
exe = executables_by_name.get('udevadm')
test('udev-rules-check',
exe,
suite : 'udev',
args : ['verify', '--resolve-names=late', all_rules])
endif
meson: re-attach rule-syntax-check.py test 39/248 rule-syntax-check OK 0.07 s --- command --- /home/zbyszek/src/systemd-work/test/rule-syntax-check.py \ /home/zbyszek/src/systemd-work/build/../rules/60-block.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-cdrom_id.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-drm.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-evdev.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-input-id.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-persistent-alsa.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-persistent-input.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-persistent-storage.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-persistent-storage-tape.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-persistent-v4l.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-sensor.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-serial.rules \ /home/zbyszek/src/systemd-work/build/../rules/70-joystick.rules \ /home/zbyszek/src/systemd-work/build/../rules/70-mouse.rules \ /home/zbyszek/src/systemd-work/build/../rules/70-touchpad.rules \ /home/zbyszek/src/systemd-work/build/../rules/75-net-description.rules \ /home/zbyszek/src/systemd-work/build/../rules/75-probe_mtd.rules \ /home/zbyszek/src/systemd-work/build/../rules/78-sound-card.rules \ /home/zbyszek/src/systemd-work/build/../rules/80-drivers.rules \ /home/zbyszek/src/systemd-work/build/../rules/80-net-setup-link.rules \ /home/zbyszek/src/systemd-work/build/rules/50-udev-default.rules \ /home/zbyszek/src/systemd-work/build/rules/64-btrfs.rules \ /home/zbyszek/src/systemd-work/build/rules/99-systemd.rules --- stdout --- ... ------- It got dropped by mistake in 72cdb3e783174dcf9223a49f03e3b0e2ca95ddb8.
2017-11-22 12:42:28 +01:00
############################################################
tests: add a runner for installed tests We have "installed tests", but don't provide an easy way to run them. The protocol is very simple: each test must return 0 for success, 77 means "skipped", anything else is an error. In addition, we want to print test output only if the test failed. I wrote this simple script. It is pretty basic, but implements the functions listed above. Since it is written in python it should be easy to add option parsing (like running only specific tests, or running unsafe tests, etc.) I looked at the following alternatives: - Ubuntu root-unittests: this works, but just dumps all output to the terminal, has no coloring. - @ssahani's test runner [2] It uses the unittest library and the test suite was implented as a class, and doesn't implement any of the functions listed above. - cram [3,4] cram runs our tests, but does not understand the "ignore the output" part, has not support for our magic skip code (it uses hardcoded 80 instead), and seems dead upstream. - meson test Here the idea would be to provide an almost-empty meson.build file under /usr/lib/systemd/tests/ that would just define all the tests. This would allow us to reuse the test runner we use normally. Unfortunately meson requires a build directory and configuration to be done before running tests. This would be possible, but seems a lot of effort to just run a few binaries. [1] https://salsa.debian.org/systemd-team/systemd/blob/242c96addb06480ec9cd75248a5660f37a17b4b9/debian/tests/root-unittests [2] https://github.com/systemd/systemd-fedora-ci/blob/master/upstream/systemd-upstream-tests.py [3] https://bitheap.org/cram/ [4] https://pypi.org/project/pytest-cram/ Fixes #10069.
2018-09-20 16:34:14 +02:00
if install_tests
install_data('run-unit-tests.py',
install_mode : 'rwxr-xr-x',
install_dir : testsdir)
install_data('integration-test-setup.sh',
install_mode : 'rwxr-xr-x',
install_dir : testdata_dir)
endif
############################################################
test_fstab_generator_sh = files('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,
suite : 'fstab')
endif
if install_tests
install_data(test_fstab_generator_sh,
install_mode : 'rwxr-xr-x',
install_dir : unittestsdir)
endif
############################################################
test_network_generator_conversion_sh = files('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,
suite : 'network')
endif
if install_tests
install_data(test_network_generator_conversion_sh,
install_mode : 'rwxr-xr-x',
install_dir : unittestsdir)
tests: add a runner for installed tests We have "installed tests", but don't provide an easy way to run them. The protocol is very simple: each test must return 0 for success, 77 means "skipped", anything else is an error. In addition, we want to print test output only if the test failed. I wrote this simple script. It is pretty basic, but implements the functions listed above. Since it is written in python it should be easy to add option parsing (like running only specific tests, or running unsafe tests, etc.) I looked at the following alternatives: - Ubuntu root-unittests: this works, but just dumps all output to the terminal, has no coloring. - @ssahani's test runner [2] It uses the unittest library and the test suite was implented as a class, and doesn't implement any of the functions listed above. - cram [3,4] cram runs our tests, but does not understand the "ignore the output" part, has not support for our magic skip code (it uses hardcoded 80 instead), and seems dead upstream. - meson test Here the idea would be to provide an almost-empty meson.build file under /usr/lib/systemd/tests/ that would just define all the tests. This would allow us to reuse the test runner we use normally. Unfortunately meson requires a build directory and configuration to be done before running tests. This would be possible, but seems a lot of effort to just run a few binaries. [1] https://salsa.debian.org/systemd-team/systemd/blob/242c96addb06480ec9cd75248a5660f37a17b4b9/debian/tests/root-unittests [2] https://github.com/systemd/systemd-fedora-ci/blob/master/upstream/systemd-upstream-tests.py [3] https://bitheap.org/cram/ [4] https://pypi.org/project/pytest-cram/ Fixes #10069.
2018-09-20 16:34:14 +02:00
endif
############################################################
sys_script_py = files('sys-script.py')
test_udev_py = files('test-udev.py')
if want_tests != 'false'
exe = executables_by_name.get('test-udev-rule-runner')
test('test-udev',
test_udev_py,
args : ['-v'],
env : test_env + { 'UDEV_RULE_RUNNER' : exe.full_path() },
depends : exe,
timeout : 180,
suite : 'udev')
endif
if install_tests
install_data(
sys_script_py,
test_udev_py,
install_dir : unittestsdir)
test: rewrite udev-test.pl in Python I tried to keep this a 1:1 rewrite with the same field names. Nevertheless, some changes were made: - exp_add_error and exp_rem_error are dropped. Those fields meant that "./test-udev add <devpath>" actually succeeded, but symlinks were not created, and exp_links was ignored and could contain bogus content. Instead, exp_links and not_exp_links are adjusted to not contain garbage and the tests check that "./test-udev add" succeeds and that the links are as expected from exp_links and not_exp_links. - cleanup was only used in one rule, and that rule was expected to fail, so cleanup wasn't actually necessary. So the cleanup field and the logic to call cleanup from individual tests is removed. - a bunch of fields were set, but didn't seem to be connected to any implementation: not_exp_name, not_exp_test. e62acc3159935781f05fa59c48e5a74e85c61ce2 did a rewrite of some of the tests and it seems that not_exp_test was added by mistake and not_exp_name was left behind by mistake. In Python, the field list is declared in the class, so it's harder to assign an unused attribute. Those uses were converted to not_exp_links. - in most rules, r"""…""" is used, so that escaping is not necessary. - the logic to generate devices was only used in one place, and the generator function also had provisions to handle arguments that were never given. all_block_devs() is made much simpler. - Descriptions that started with a capital letter were shortened and lowercased. - no special test case counting is done. pytest just counts the cases (Rules objects). - the output for failures is also removed. If something goes wrong, the user can use pytest --pdb or such to debug the issue. - perl version used a semaphore to manage udev runners, and would fork, optionally wait a bit, and then start the runner. In the python version, we just spawn them all and wait for them to exit. It's not very convenient to call fork() from python, so instead the runner was modified (in previous commit) to wait. The test can be called as: (cd build && sudo pytest -v ../test/udev-test.py) sudo meson test -C build udev-test.py -v I think this generally provides functionality that is close to the perl version. It seems some of the checks are now more fully implemented. Support for strace/gdb/valgrind is missing. Runtime goes down: 8.36 s → 5.78 s.
2023-05-04 22:40:38 +02:00
endif
############################################################
rpm = find_program('rpm', required : false)
rpmspec = find_program('rpmspec', required : false)
if rpm.found() and rpmspec.found()
if want_tests != 'false'
test('test-rpm-macros',
files('test-rpm-macros.sh'),
suite : 'dist',
args : [meson.project_build_root()],
depends : rpm_depends)
endif
else
message('Skipping test-rpm-macros since rpm and/or rpmspec are not available')
endif
############################################################
if want_tests != 'false' and conf.get('HAVE_DMI') == 1
udev_dmi_memory_id_test = files('udev-dmi-memory-id-test.sh')
exe = executables_by_name.get('dmi_memory_id')
if git.found() and fs.is_dir(meson.project_source_root() / '.git')
out = run_command(
meson: call find_program() once and reuse the variable everywhere Meson 0.58 has gotten quite bad with emitting a message every time a quoted command is used: Program /home/zbyszek/src/systemd-work/tools/meson-make-symlink.sh found: YES (/home/zbyszek/src/systemd-work/tools/meson-make-symlink.sh) Program sh found: YES (/usr/bin/sh) Program sh found: YES (/usr/bin/sh) Program sh found: YES (/usr/bin/sh) Program sh found: YES (/usr/bin/sh) Program sh found: YES (/usr/bin/sh) Program sh found: YES (/usr/bin/sh) Program xsltproc found: YES (/usr/bin/xsltproc) Configuring custom-entities.ent using configuration Message: Skipping bootctl.1 because ENABLE_EFI is false Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Message: Skipping journal-remote.conf.5 because HAVE_MICROHTTPD is false Message: Skipping journal-upload.conf.5 because HAVE_MICROHTTPD is false Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Message: Skipping loader.conf.5 because ENABLE_EFI is false Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) ... Let's suffer one message only for each command. Hopefully we can silence even this when https://github.com/mesonbuild/meson/issues/8642 is resolved.
2021-05-14 14:16:17 +02:00
env, '-u', 'GIT_WORK_TREE',
git, '--git-dir=@0@/.git'.format(meson.project_source_root()),
'ls-files', ':/test/dmidecode-dumps/*.bin',
check: true)
else
out = run_command(
sh, '-c', 'cd "$1"; echo test/dmidecode-dumps/*.bin', '_', meson.project_source_root(),
check: true)
endif
foreach p : out.stdout().split()
source = meson.project_source_root() / p
2023-06-14 16:05:52 +02:00
test('dmidecode_' + fs.stem(p),
udev_dmi_memory_id_test,
suite : 'udev',
args : [exe.full_path(),
2021-07-27 17:48:53 +02:00
source,
source + '.txt'],
depends : exe)
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,
suite : 'kernel-install')
endif
############################################################
if want_tests != 'false'
test: Make it possible to run the integration tests standalone Currently, to run the integration tests, it's still necessary to install various other build tools besides meson: A compiler, gperf, libcap, ... which we want to avoid in CI systems where we receive prebuilt systemd packages and only want to test them. Examples are Debian's autopkgtest CI and Fedora CI. Let's make it possible for these systems to run the integration tests without having to install any other build dependency besides meson by extracting the logic required to run the integration tests with meson into a separate subdirectory and adding a standalone top-level meson.build file which can be used to configure a meson tree with as its only purpose running the integration tests. Practically, we do the following: - all the integration test directories and integration-test-wrapper.py are moved from test/ to test/integration-test/. - All the installation logic is kept out of test/integration-test/ or any of its subdirectories and moved into test/meson.build instead. - We add test/integration-test/standalone/meson.build to run the integration tests standalone. This meson file includes test/integration-test via a cute symlink hack to trick meson into including a parent directory with subdir(). - Documentation is included on how to use the new standalone mode. - TEST-64-UDEV-STORAGE and TEST-85-NETWORK are changed to generate separate units for each testcase to make them behave more like the other integration tests.
2025-03-26 14:30:20 +01:00
subdir('integration-tests')
endif
test: Make it possible to run the integration tests standalone Currently, to run the integration tests, it's still necessary to install various other build tools besides meson: A compiler, gperf, libcap, ... which we want to avoid in CI systems where we receive prebuilt systemd packages and only want to test them. Examples are Debian's autopkgtest CI and Fedora CI. Let's make it possible for these systems to run the integration tests without having to install any other build dependency besides meson by extracting the logic required to run the integration tests with meson into a separate subdirectory and adding a standalone top-level meson.build file which can be used to configure a meson tree with as its only purpose running the integration tests. Practically, we do the following: - all the integration test directories and integration-test-wrapper.py are moved from test/ to test/integration-test/. - All the installation logic is kept out of test/integration-test/ or any of its subdirectories and moved into test/meson.build instead. - We add test/integration-test/standalone/meson.build to run the integration tests standalone. This meson file includes test/integration-test via a cute symlink hack to trick meson into including a parent directory with subdir(). - Documentation is included on how to use the new standalone mode. - TEST-64-UDEV-STORAGE and TEST-85-NETWORK are changed to generate separate units for each testcase to make them behave more like the other integration tests.
2025-03-26 14:30:20 +01:00
if install_tests
if meson.version().version_compare('<1.3.0')
if not rsync.found()
error('rsync is required to install the integration test data')
endif
rsync_r = rsync.full_path() + ' -rlpt --exclude .gitattributes -- "@0@" "${DESTDIR:-}@1@"'
endif
if meson.version().version_compare('>=1.3.0')
# Installing symlinks to directories is broken in install_subdir() so we exclude the
# standalone directory from install_subdir() and handle it manually.
# TODO: Remove when https://github.com/mesonbuild/meson/pull/14471 is available in all
# supported distributions.
install_subdir('integration-tests',
install_dir : testsdir,
exclude_directories : ['standalone'],
follow_symlinks : false)
install_emptydir(testsdir / 'integration-tests/standalone')
install_data('integration-tests/standalone/meson.build',
install_dir : testsdir / 'integration-tests/standalone')
install_symlink('integration-tests',
pointing_to : '..',
install_dir : testsdir / 'integration-tests/standalone')
else
meson.add_install_script(sh, '-c',
rsync_r.format(meson.current_source_dir() / 'integration-tests', testsdir))
endif
foreach integration_test : integration_tests
integration_test_unit_env = []
integration_test_extra_unit_properties = []
integration_test_extra_service_properties = []
foreach key, value : integration_test['configuration']['env']
integration_test_unit_env += [f'@key@=@value@']
endforeach
foreach key, value : integration_test['configuration']['unit']
integration_test_extra_unit_properties += [f'@key@=@value@']
endforeach
foreach key, value : integration_test['configuration']['service']
integration_test_extra_service_properties += [f'@key@=@value@']
endforeach
integration_test_unit = configure_file(
input : 'test.service.in',
output : '@0@.service'.format(integration_test['name']),
configuration : integration_test['configuration'] + {
'env' : ' '.join(integration_test_unit_env),
'unit' : '\n'.join(integration_test_extra_unit_properties),
'service' : '\n'.join(integration_test_extra_service_properties),
},
)
install_data(integration_test_unit, install_dir : testdata_dir / 'units')
endforeach
test: Make it possible to run the integration tests standalone Currently, to run the integration tests, it's still necessary to install various other build tools besides meson: A compiler, gperf, libcap, ... which we want to avoid in CI systems where we receive prebuilt systemd packages and only want to test them. Examples are Debian's autopkgtest CI and Fedora CI. Let's make it possible for these systems to run the integration tests without having to install any other build dependency besides meson by extracting the logic required to run the integration tests with meson into a separate subdirectory and adding a standalone top-level meson.build file which can be used to configure a meson tree with as its only purpose running the integration tests. Practically, we do the following: - all the integration test directories and integration-test-wrapper.py are moved from test/ to test/integration-test/. - All the installation logic is kept out of test/integration-test/ or any of its subdirectories and moved into test/meson.build instead. - We add test/integration-test/standalone/meson.build to run the integration tests standalone. This meson file includes test/integration-test via a cute symlink hack to trick meson into including a parent directory with subdir(). - Documentation is included on how to use the new standalone mode. - TEST-64-UDEV-STORAGE and TEST-85-NETWORK are changed to generate separate units for each testcase to make them behave more like the other integration tests.
2025-03-26 14:30:20 +01:00
testdata_subdirs = [
'auxv',
'journal-data',
'knot-data',
'test-cgroup-mask',
'test-cgroup-unit-default',
'test-engine',
test: Make it possible to run the integration tests standalone Currently, to run the integration tests, it's still necessary to install various other build tools besides meson: A compiler, gperf, libcap, ... which we want to avoid in CI systems where we receive prebuilt systemd packages and only want to test them. Examples are Debian's autopkgtest CI and Fedora CI. Let's make it possible for these systems to run the integration tests without having to install any other build dependency besides meson by extracting the logic required to run the integration tests with meson into a separate subdirectory and adding a standalone top-level meson.build file which can be used to configure a meson tree with as its only purpose running the integration tests. Practically, we do the following: - all the integration test directories and integration-test-wrapper.py are moved from test/ to test/integration-test/. - All the installation logic is kept out of test/integration-test/ or any of its subdirectories and moved into test/meson.build instead. - We add test/integration-test/standalone/meson.build to run the integration tests standalone. This meson file includes test/integration-test via a cute symlink hack to trick meson into including a parent directory with subdir(). - Documentation is included on how to use the new standalone mode. - TEST-64-UDEV-STORAGE and TEST-85-NETWORK are changed to generate separate units for each testcase to make them behave more like the other integration tests.
2025-03-26 14:30:20 +01:00
'test-execute',
'test-fstab-generator',
'test-journals',
'test-network',
'test-network-generator-conversion',
test: Make it possible to run the integration tests standalone Currently, to run the integration tests, it's still necessary to install various other build tools besides meson: A compiler, gperf, libcap, ... which we want to avoid in CI systems where we receive prebuilt systemd packages and only want to test them. Examples are Debian's autopkgtest CI and Fedora CI. Let's make it possible for these systems to run the integration tests without having to install any other build dependency besides meson by extracting the logic required to run the integration tests with meson into a separate subdirectory and adding a standalone top-level meson.build file which can be used to configure a meson tree with as its only purpose running the integration tests. Practically, we do the following: - all the integration test directories and integration-test-wrapper.py are moved from test/ to test/integration-test/. - All the installation logic is kept out of test/integration-test/ or any of its subdirectories and moved into test/meson.build instead. - We add test/integration-test/standalone/meson.build to run the integration tests standalone. This meson file includes test/integration-test via a cute symlink hack to trick meson into including a parent directory with subdir(). - Documentation is included on how to use the new standalone mode. - TEST-64-UDEV-STORAGE and TEST-85-NETWORK are changed to generate separate units for each testcase to make them behave more like the other integration tests.
2025-03-26 14:30:20 +01:00
'test-path',
'test-path-util',
'test-sched-prio',
test: Make it possible to run the integration tests standalone Currently, to run the integration tests, it's still necessary to install various other build tools besides meson: A compiler, gperf, libcap, ... which we want to avoid in CI systems where we receive prebuilt systemd packages and only want to test them. Examples are Debian's autopkgtest CI and Fedora CI. Let's make it possible for these systems to run the integration tests without having to install any other build dependency besides meson by extracting the logic required to run the integration tests with meson into a separate subdirectory and adding a standalone top-level meson.build file which can be used to configure a meson tree with as its only purpose running the integration tests. Practically, we do the following: - all the integration test directories and integration-test-wrapper.py are moved from test/ to test/integration-test/. - All the installation logic is kept out of test/integration-test/ or any of its subdirectories and moved into test/meson.build instead. - We add test/integration-test/standalone/meson.build to run the integration tests standalone. This meson file includes test/integration-test via a cute symlink hack to trick meson into including a parent directory with subdir(). - Documentation is included on how to use the new standalone mode. - TEST-64-UDEV-STORAGE and TEST-85-NETWORK are changed to generate separate units for each testcase to make them behave more like the other integration tests.
2025-03-26 14:30:20 +01:00
'test-umount',
'integration-tests/TEST-07-PID1/TEST-07-PID1.units',
'integration-tests/TEST-03-JOBS/TEST-03-JOBS.units',
'integration-tests/TEST-04-JOURNAL/TEST-04-JOURNAL.units',
'integration-tests/TEST-06-SELINUX/TEST-06-SELINUX.units',
'integration-tests/TEST-16-EXTEND-TIMEOUT/TEST-16-EXTEND-TIMEOUT.units',
'integration-tests/TEST-23-UNIT-FILE/TEST-23-UNIT-FILE.units',
'integration-tests/TEST-30-ONCLOCKCHANGE/TEST-30-ONCLOCKCHANGE.units',
'integration-tests/TEST-38-FREEZER/TEST-38-FREEZER.units',
test: Make it possible to run the integration tests standalone Currently, to run the integration tests, it's still necessary to install various other build tools besides meson: A compiler, gperf, libcap, ... which we want to avoid in CI systems where we receive prebuilt systemd packages and only want to test them. Examples are Debian's autopkgtest CI and Fedora CI. Let's make it possible for these systems to run the integration tests without having to install any other build dependency besides meson by extracting the logic required to run the integration tests with meson into a separate subdirectory and adding a standalone top-level meson.build file which can be used to configure a meson tree with as its only purpose running the integration tests. Practically, we do the following: - all the integration test directories and integration-test-wrapper.py are moved from test/ to test/integration-test/. - All the installation logic is kept out of test/integration-test/ or any of its subdirectories and moved into test/meson.build instead. - We add test/integration-test/standalone/meson.build to run the integration tests standalone. This meson file includes test/integration-test via a cute symlink hack to trick meson into including a parent directory with subdir(). - Documentation is included on how to use the new standalone mode. - TEST-64-UDEV-STORAGE and TEST-85-NETWORK are changed to generate separate units for each testcase to make them behave more like the other integration tests.
2025-03-26 14:30:20 +01:00
'integration-tests/TEST-52-HONORFIRSTSHUTDOWN/TEST-52-HONORFIRSTSHUTDOWN.units',
'integration-tests/TEST-55-OOMD/TEST-55-OOMD.units',
'integration-tests/TEST-62-RESTRICT-IFACES/TEST-62-RESTRICT-IFACES.units',
test: Make it possible to run the integration tests standalone Currently, to run the integration tests, it's still necessary to install various other build tools besides meson: A compiler, gperf, libcap, ... which we want to avoid in CI systems where we receive prebuilt systemd packages and only want to test them. Examples are Debian's autopkgtest CI and Fedora CI. Let's make it possible for these systems to run the integration tests without having to install any other build dependency besides meson by extracting the logic required to run the integration tests with meson into a separate subdirectory and adding a standalone top-level meson.build file which can be used to configure a meson tree with as its only purpose running the integration tests. Practically, we do the following: - all the integration test directories and integration-test-wrapper.py are moved from test/ to test/integration-test/. - All the installation logic is kept out of test/integration-test/ or any of its subdirectories and moved into test/meson.build instead. - We add test/integration-test/standalone/meson.build to run the integration tests standalone. This meson file includes test/integration-test via a cute symlink hack to trick meson into including a parent directory with subdir(). - Documentation is included on how to use the new standalone mode. - TEST-64-UDEV-STORAGE and TEST-85-NETWORK are changed to generate separate units for each testcase to make them behave more like the other integration tests.
2025-03-26 14:30:20 +01:00
'integration-tests/TEST-63-PATH/TEST-63-PATH.units',
'integration-tests/TEST-65-ANALYZE/TEST-65-ANALYZE.units',
'integration-tests/TEST-66-DEVICE-ISOLATION/TEST-66-DEVICE-ISOLATION.units',
test: Make it possible to run the integration tests standalone Currently, to run the integration tests, it's still necessary to install various other build tools besides meson: A compiler, gperf, libcap, ... which we want to avoid in CI systems where we receive prebuilt systemd packages and only want to test them. Examples are Debian's autopkgtest CI and Fedora CI. Let's make it possible for these systems to run the integration tests without having to install any other build dependency besides meson by extracting the logic required to run the integration tests with meson into a separate subdirectory and adding a standalone top-level meson.build file which can be used to configure a meson tree with as its only purpose running the integration tests. Practically, we do the following: - all the integration test directories and integration-test-wrapper.py are moved from test/ to test/integration-test/. - All the installation logic is kept out of test/integration-test/ or any of its subdirectories and moved into test/meson.build instead. - We add test/integration-test/standalone/meson.build to run the integration tests standalone. This meson file includes test/integration-test via a cute symlink hack to trick meson into including a parent directory with subdir(). - Documentation is included on how to use the new standalone mode. - TEST-64-UDEV-STORAGE and TEST-85-NETWORK are changed to generate separate units for each testcase to make them behave more like the other integration tests.
2025-03-26 14:30:20 +01:00
'integration-tests/TEST-80-NOTIFYACCESS/TEST-80-NOTIFYACCESS.units',
'units',
test: Make it possible to run the integration tests standalone Currently, to run the integration tests, it's still necessary to install various other build tools besides meson: A compiler, gperf, libcap, ... which we want to avoid in CI systems where we receive prebuilt systemd packages and only want to test them. Examples are Debian's autopkgtest CI and Fedora CI. Let's make it possible for these systems to run the integration tests without having to install any other build dependency besides meson by extracting the logic required to run the integration tests with meson into a separate subdirectory and adding a standalone top-level meson.build file which can be used to configure a meson tree with as its only purpose running the integration tests. Practically, we do the following: - all the integration test directories and integration-test-wrapper.py are moved from test/ to test/integration-test/. - All the installation logic is kept out of test/integration-test/ or any of its subdirectories and moved into test/meson.build instead. - We add test/integration-test/standalone/meson.build to run the integration tests standalone. This meson file includes test/integration-test via a cute symlink hack to trick meson into including a parent directory with subdir(). - Documentation is included on how to use the new standalone mode. - TEST-64-UDEV-STORAGE and TEST-85-NETWORK are changed to generate separate units for each testcase to make them behave more like the other integration tests.
2025-03-26 14:30:20 +01:00
]
foreach subdir : testdata_subdirs
# install_subdir() before meson 1.3.0 does not handle symlinks correctly (it follows them
# instead of copying the symlink) so we use rsync instead.
if meson.version().version_compare('>=1.3.0')
install_subdir(subdir,
exclude_files : ['.gitattributes'],
install_dir : testdata_dir,
follow_symlinks : false)
else
meson.add_install_script(sh, '-c',
rsync_r.format(meson.current_source_dir() / subdir, testdata_dir))
endif
endforeach
install_data(kbd_model_map,
install_dir : testdata_dir + '/test-keymap-util')
if conf.get('HAVE_ZSTD') == 1 and efi_arch != ''
install_subdir('test-bcd',
exclude_files : '.gitattributes',
install_dir : testdata_dir)
endif
install_subdir('test-resolve',
exclude_files : '.gitattributes',
install_dir : testdata_dir)
# The unit tests implemented as shell scripts expect to find testdata/
# in the directory where they are stored.
assert(fs.parent(unittestsdir) / 'testdata' == testdata_dir)
install_symlink('testdata',
pointing_to : '../testdata',
install_dir : unittestsdir)
endif