diff options
author | Daan De Meyer <daan.j.demeyer@gmail.com> | 2024-04-19 09:17:58 +0200 |
---|---|---|
committer | Daan De Meyer <daan.j.demeyer@gmail.com> | 2024-04-23 10:32:42 +0200 |
commit | b85e54961ce9f84cc978341dc5b69a62f2bb98b3 (patch) | |
tree | bf24f25d6830f6d8cc91dc10227094b177fdb4c4 /test/meson.build | |
parent | mkosi: Deal with ubuntu's special debug packages (diff) | |
download | systemd-b85e54961ce9f84cc978341dc5b69a62f2bb98b3.tar.xz systemd-b85e54961ce9f84cc978341dc5b69a62f2bb98b3.zip |
test: Various mkosi integration test improvements
- Stop using logging module since the default output formatting is
pretty bad. Prefer print() for now.
- Log less, logging the full mkosi command line is rather verbose,
especially when it contains multi-line dropins.
- Streamline the journalctl command we output for debugging failed
tests.
- Don't force usage of the disk image format.
- Don't force running without unit tests.
- Don't force disabling RuntimeBuildSources.
- Update documentation to streamline the command for running a single
test and remove sudo as it's not required anymore.
- Improve the console output by having the test unit's output logged
to both the journal and the console.
- Disable journal console log forwarding as we have journal forwarding
as a better alternative.
- Delete existing journal file before running test.
- Delete journal files of succeeded tests to reduce disk usage.
- Rename system_mkosi target to just mkosi
- Pass in mkosi source directory explicitly to accomodate arbitrary
build directory locations.
- Add test interactive debugging if stdout is connected to a tty
- Stop explicitly using the 'system' image since it'll likely be
dropped soon.
- Only forward journal if we're not running in debugging mode.
- Stop using testsuite.target and instead just add the necessary
extras to the main testsuite unit via the credential dropin.
- Override type to idle so test output is not interleaved with
status output.
- Don't build mkosi target by default
- Always add the mkosi target if mkosi is found
- Remove dependency of the integration tests on the mkosi target
as otherwise the image is always built, even though we configure
it to not be built by default.
- Move mkosi output, cache and build directory into build/ so that
invocations from meson and regular invocations share the same
directories.
- Various aesthetic cleanups.
Diffstat (limited to 'test/meson.build')
-rw-r--r-- | test/meson.build | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/test/meson.build b/test/meson.build index 4009eeece2..8e0d11682e 100644 --- a/test/meson.build +++ b/test/meson.build @@ -334,21 +334,19 @@ endif ############################################################ -if get_option('integration-tests') != false - integration_test_wrapper = find_program('integration_test_wrapper.py') +if get_option('integration-tests') + if not mkosi.found() + error('Could not find mkosi which is required to run the integration tests') + endif + + integration_test_wrapper = find_program('integration-test-wrapper.py') integration_tests = { '01': 'TEST-01-BASIC', '02': 'TEST-02-UNITTESTS', } foreach test_number, dirname : integration_tests - test_unit_name = f'testsuite-@test_number@.service' test_params = { - 'test_name' : dirname, - 'mkosi_image_name' : 'system', - 'mkosi_output_path' : system_mkosi, - 'test_number' : test_number, 'mkosi_args' : [], - 'depends' : [system_mkosi], 'timeout' : 600, } @@ -358,16 +356,22 @@ if get_option('integration-tests') != false if fs.exists(dirname / 'meson.build') subdir(dirname) endif - args = ['--test-name', test_params['test_name'], - '--mkosi-image-name', test_params['mkosi_image_name'], - '--mkosi-output-path', test_params['mkosi_output_path'], - '--test-number', test_params['test_number']] - args += ['--'] + test_params['mkosi_args'] - test(test_params['test_name'], + + args = [ + '--meson-source-dir', meson.project_source_root(), + '--meson-build-dir', meson.project_build_root(), + '--test-name', dirname, + '--test-number', test_number, + '--', + ] + test_params['mkosi_args'] + + # We don't explicitly depend on the "mkosi" target because that means the image is rebuilt + # on every "ninja -C build". Instead, the mkosi target has to be rebuilt manually before + # running the integration tests with mkosi. + test(dirname, integration_test_wrapper, env: test_env, args : args, - depends : test_params['depends'], timeout : test_params['timeout'], suite : 'integration-tests') endforeach |