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.
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
integration_tests += [
|
||||
integration_test_template + {
|
||||
'name' : fs.name(meson.current_source_dir()),
|
||||
},
|
||||
]
|
||||
|
||||
testdata_subdirs += [meson.current_source_dir() / 'TEST-52-HONORFIRSTSHUTDOWN.units']
|
||||
@@ -151,6 +151,31 @@ options to provide mkosi with a directory containing the systemd packages or a
|
||||
repository file that points to a repository with the systemd packages that
|
||||
should be installed.
|
||||
|
||||
If the rpms are installed on the host system that the tests are running on,
|
||||
you'll probably want to disable usage of the tools tree so that the tools from
|
||||
the host system are used to build the image by adding the following to
|
||||
`mkosi.local.conf`:
|
||||
|
||||
```conf
|
||||
[Build]
|
||||
ToolsTree=
|
||||
```
|
||||
|
||||
On the other hand, if the rpms are available but not installed on the host
|
||||
system, you'll want to make sure they're installed into the mkosi tools tree so
|
||||
that they're used to build the image by using either
|
||||
`ToolsTreePackageDirectories=` or `ToolsTreeSandboxTrees=` similarly to
|
||||
`PackageDirectories=` or `SandboxTrees=` mentioned above.
|
||||
|
||||
Finally, we'll make use of the standalone mode of running the integration tests
|
||||
to avoid having to install any build dependencies.
|
||||
|
||||
```sh
|
||||
$ mkosi -f sandbox -- meson setup testsuite test/integration-tests/standalone
|
||||
$ mkosi -f
|
||||
$ mkosi sandbox -- meson test -C testsuite --num-processes "$(($(nproc) / 4))"
|
||||
```
|
||||
|
||||
### SELinux AVCs
|
||||
|
||||
To have `TEST-06-SELINUX` check for SELinux denials, write the following to
|
||||
@@ -8,5 +8,3 @@ integration_tests += [
|
||||
'storage' : 'persistent',
|
||||
},
|
||||
]
|
||||
|
||||
testdata_subdirs += [meson.current_source_dir() / 'TEST-04-JOURNAL.units']
|
||||
@@ -13,5 +13,3 @@ integration_tests += [
|
||||
'mkosi-args' : integration_test_template['mkosi-args'] + ['--runtime-build-sources=no'],
|
||||
},
|
||||
]
|
||||
|
||||
testdata_subdirs += [meson.current_source_dir() / 'TEST-06-SELINUX.units']
|
||||
@@ -6,5 +6,3 @@ integration_tests += [
|
||||
'unit' : files('TEST-07-PID1.service'),
|
||||
},
|
||||
]
|
||||
|
||||
testdata_subdirs += [meson.current_source_dir() / 'TEST-07-PID1.units']
|
||||
-2
@@ -7,5 +7,3 @@ integration_tests += [
|
||||
'coredump-exclude-regex' : '/(bash|sleep)$',
|
||||
},
|
||||
]
|
||||
|
||||
testdata_subdirs += [meson.current_source_dir() / 'TEST-16-EXTEND-TIMEOUT.units']
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user