summaryrefslogtreecommitdiffstats
path: root/test/meson.build
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2024-04-05 18:19:59 +0200
committerRichard Maw <richard.maw@codethink.co.uk>2024-04-18 17:26:38 +0200
commit945b722f13808a6dfd3c00cb1ef78c3c41011687 (patch)
tree08244cbe6338b191db79aa090c217a04f6818901 /test/meson.build
parentmkosi: Extend default device timeout to 20 seconds (diff)
downloadsystemd-945b722f13808a6dfd3c00cb1ef78c3c41011687.tar.xz
systemd-945b722f13808a6dfd3c00cb1ef78c3c41011687.zip
test: Add mkosi-based integration test runner
The first two tests are included to ensure parallel test execution is demonstrable.
Diffstat (limited to '')
-rw-r--r--test/meson.build41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/meson.build b/test/meson.build
index aadf37a139..4009eeece2 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -331,3 +331,44 @@ if want_tests != 'false' and conf.get('ENABLE_KERNEL_INSTALL') == 1
depends : deps,
suite : 'kernel-install')
endif
+
+############################################################
+
+if get_option('integration-tests') != false
+ 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,
+ }
+
+ # TODO: This fs.exists call isn't included in rebuild logic
+ # so if you add a new meson.build in a subdir
+ # you need to touch another build file to get it to reparse.
+ 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'],
+ integration_test_wrapper,
+ env: test_env,
+ args : args,
+ depends : test_params['depends'],
+ timeout : test_params['timeout'],
+ suite : 'integration-tests')
+ endforeach
+endif