- v[0-9]+-stable
paths:
- .github/workflows/coverage.yml
- - test/integration-test-wrapper.py
+ - test/integration-tests/integration-test-wrapper.py
permissions:
contents: read
VALIDATE_GITHUB_ACTIONS: true
- name: Check that tabs are not used in Python code
- run: sh -c '! git grep -P "\\t" -- src/boot/generate-hwids-section.py src/ukify/ukify.py test/integration-test-wrapper.py'
+ run: sh -c '! git grep -P "\\t" -- src/boot/generate-hwids-section.py src/ukify/ukify.py test/integration-tests/integration-test-wrapper.py'
- name: Install ruff and mypy
run: |
- name: Run mypy
run: |
python3 -m mypy --version
- python3 -m mypy src/boot/generate-hwids-section.py src/test/generate-sym-test.py src/ukify/ukify.py test/integration-test-wrapper.py
+ python3 -m mypy src/boot/generate-hwids-section.py src/test/generate-sym-test.py src/ukify/ukify.py test/integration-tests/integration-test-wrapper.py
- name: Run ruff check
run: |
ruff --version
- ruff check src/boot/generate-hwids-section.py src/test/generate-sym-test.py src/ukify/ukify.py test/integration-test-wrapper.py
+ ruff check src/boot/generate-hwids-section.py src/test/generate-sym-test.py src/ukify/ukify.py test/integration-tests/integration-test-wrapper.py
- name: Run ruff format
run: |
ruff --version
- if ! ruff format --check src/boot/generate-hwids-section.py src/test/generate-sym-test.py src/ukify/ukify.py test/integration-test-wrapper.py
+ if ! ruff format --check src/boot/generate-hwids-section.py src/test/generate-sym-test.py src/ukify/ukify.py test/integration-tests/integration-test-wrapper.py
then
echo "Please run 'ruff format' on the above files or apply the diffs below manually"
- ruff format --check --quiet --diff src/boot/generate-hwids-section.py src/test/generate-sym-test.py src/ukify/ukify.py test/integration-test-wrapper.py
+ ruff format --check --quiet --diff src/boot/generate-hwids-section.py src/test/generate-sym-test.py src/ukify/ukify.py test/integration-tests/integration-test-wrapper.py
fi
Most of those tests should be able to run via `systemd-nspawn`, which is orders-of-magnitude faster than `qemu`, but some tests require privileged operations like using `dm-crypt` or `loopdev`.
They are clearly marked if that is the case.
-See [`test/README.md`](https://github.com/systemd/systemd/blob/main/test/README.md) for more specific details.
+See [`test/integration-tests/README.md`](https://github.com/systemd/systemd/blob/main/test/integration-tests/README.md) for more specific details.
## hwdb
configure -C build -D…".)
2. Run the full integration test suite as described in
- [test/README.md](/../test/README.md). This will build OS images with a number
- of integration tests and run them using `systemd-nspawn` and `qemu`. Requires
- root.
+ [test/integration-tests/README.md](/../test/integration-tests/README.md).
+ This will build OS images with a number of integration tests and run them
+ using `systemd-nspawn` and `qemu`. Requires root.
3. Use `./coccinelle/run-coccinelle.sh` to run all
[Coccinelle](http://coccinelle.lip6.fr/) semantic patch scripts we ship. The
MKOSI_CFLAGS="$MKOSI_CFLAGS -fprofile-dir=/coverage"
fi
+# The opensuse spec tars up stuff in test/ and unpacks it in test/integration-tests, which we now use for our
+# own purposes, so let's get rid of that specific bit of logic in the opensuse spec until they've had a chance
+# to adapt.
+sed "pkg/$PKG_SUBDIR${GIT_SUBDIR:+/$GIT_SUBDIR}/systemd.spec" -e '1062,1075d' -e '/integration-tests\/README/d' >/tmp/systemd.spec
+mount --bind /tmp/systemd.spec "pkg/$PKG_SUBDIR${GIT_SUBDIR:+/$GIT_SUBDIR}/systemd.spec"
+
build() {
IFS=
# shellcheck disable=SC2046
--dry-run=no \
--size=auto \
--offline=true \
- --root test/TEST-24-CRYPTSETUP \
- --definitions test/TEST-24-CRYPTSETUP/keydev.repart \
+ --root test/integration-tests/TEST-24-CRYPTSETUP \
+ --definitions test/integration-tests/TEST-24-CRYPTSETUP/keydev.repart \
"$OUTPUTDIR/keydev.raw"
can_test_pkcs11() {
certtool --generate-self-signed \
--load-privkey="pkcs11:token=TestToken;object=RSATestKey;type=private" \
--load-pubkey="pkcs11:token=TestToken;object=RSATestKey;type=public" \
- --template "test/TEST-24-CRYPTSETUP/template.cfg" \
+ --template "test/integration-tests/TEST-24-CRYPTSETUP/template.cfg" \
--outder --outfile "/tmp/rsa_test.crt"
pkcs11-tool --module "$SOFTHSM_MODULE" --token-label "TestToken" --pin "env:GNUTLS_PIN" --so-pin "env:GNUTLS_SO_PIN" --write-object "/tmp/rsa_test.crt" --type cert --label "RSATestKey"
certtool --generate-self-signed \
--load-privkey="pkcs11:token=TestToken;object=ECTestKey;type=private" \
--load-pubkey="pkcs11:token=TestToken;object=ECTestKey;type=public" \
- --template "test/TEST-24-CRYPTSETUP/template.cfg" \
+ --template "test/integration-tests/TEST-24-CRYPTSETUP/template.cfg" \
--outder --outfile "/tmp/ec_test.crt"
pkcs11-tool --module "$SOFTHSM_MODULE" --token-label "TestToken" --pin "env:GNUTLS_PIN" --so-pin "env:GNUTLS_SO_PIN" --write-object "/tmp/ec_test.crt" --type cert --label "ECTestKey"
+++ /dev/null
-# 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']
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
'storage' : 'persistent',
},
]
-
-testdata_subdirs += [meson.current_source_dir() / 'TEST-04-JOURNAL.units']
'mkosi-args' : integration_test_template['mkosi-args'] + ['--runtime-build-sources=no'],
},
]
-
-testdata_subdirs += [meson.current_source_dir() / 'TEST-06-SELINUX.units']
'unit' : files('TEST-07-PID1.service'),
},
]
-
-testdata_subdirs += [meson.current_source_dir() / 'TEST-07-PID1.units']
'coredump-exclude-regex' : '/(bash|sleep)$',
},
]
-
-testdata_subdirs += [meson.current_source_dir() / 'TEST-16-EXTEND-TIMEOUT.units']
# SPDX-License-Identifier: LGPL-2.1-or-later
name = fs.name(meson.current_source_dir())
-unit = configure_file(
- input : files('../test.service.in'),
- output : '@0@.service'.format(name),
- # Disable user service manager by default for performance.
- configuration : integration_test_template['configuration'] + {
- 'wants' : '',
- 'after' : '',
- },
-)
-
udev_storage_tests = []
+udev_storage_test_template = {
+ 'enabled' : true,
+}
+
+qemu = find_program('qemu-system-@0@'.format(host_machine.cpu_family()), 'qemu-kvm', dirs : ['/usr/libexec'], native : true, required : false)
+if qemu.found()
+ devices = run_command(qemu, '-device', 'help', check : true).stdout().strip()
+else
+ devices = ''
+endif
cmdline = []
qemu_args = ['-device', 'virtio-scsi-pci,id=scsi0']
qemu_args += ['-device', f'scsi-hd,drive=@id@,vendor=systemd,product=foobar,serial=deadbeefbtrfs@i@']
endforeach
-udev_storage_tests += {
+udev_storage_tests += udev_storage_test_template + {
'name' : 'btrfs_basic',
'cmdline' : cmdline,
'qemu-args' : qemu_args,
qemu_args += ['-device', f'scsi-hd,drive=@id@,vendor=systemd,product=foobar,serial=deadbeefiscsi@i@']
endforeach
-udev_storage_tests += {
+udev_storage_tests += udev_storage_test_template + {
'name' : 'iscsi_lvm',
'cmdline' : cmdline,
'qemu-args' : qemu_args,
qemu_args += ['-device', 'virtio-blk-pci,drive=drive0,bus=pci_bridge25,addr=1,serial=long-sysfs-path']
-udev_storage_tests += {
+udev_storage_tests += udev_storage_test_template + {
'name' : 'long_sysfs_path',
'cmdline' : cmdline,
'qemu-args' : qemu_args,
qemu_args += ['-device', f'scsi-hd,drive=@id@,vendor=systemd,product=foobar,serial=deadbeeflvm@i@']
endforeach
-udev_storage_tests += {
+udev_storage_tests += udev_storage_test_template + {
'name' : 'lvm_basic',
'cmdline' : cmdline,
'qemu-args' : qemu_args,
qemu_args += ['-device', f'scsi-hd,drive=@id@,vendor=systemd,product=foobar,serial=deadbeefmdadm@i@']
endforeach
-udev_storage_tests += {
+udev_storage_tests += udev_storage_test_template + {
'name' : 'mdadm_basic',
'cmdline' : cmdline,
'qemu-args' : qemu_args,
qemu_args += ['-device', f'scsi-hd,drive=@id@,vendor=systemd,product=foobar,serial=deadbeefmdadmlvm@i@']
endforeach
-udev_storage_tests += {
+udev_storage_tests += udev_storage_test_template + {
'name' : 'mdadm_lvm',
'cmdline' : cmdline,
'qemu-args' : qemu_args,
endforeach
endforeach
-udev_storage_tests += {
+udev_storage_tests += udev_storage_test_template + {
'name' : 'multipath_basic_failover',
'cmdline' : cmdline,
'qemu-args' : qemu_args,
qemu_args += ['-device', f'scsi-hd,drive=@id@,serial=deadbeeftest@i@']
endforeach
-udev_storage_tests += {
+udev_storage_tests += udev_storage_test_template + {
'name' : 'simultaneous_events',
'cmdline' : cmdline,
'qemu-args' : qemu_args,
qemu_args += ['-device', f'scsi-hd,drive=@id@,serial=@id@,bus=scsi@div@.0,channel=0,scsi-id=@mod@,lun=0']
endforeach
-udev_storage_tests += {
+udev_storage_tests += udev_storage_test_template + {
'name' : 'virtio_scsi_basic',
'cmdline' : cmdline,
'qemu-args' : qemu_args,
}
-qemu = find_program('qemu-system-@0@'.format(host_machine.cpu_family()), 'qemu-kvm', dirs : ['/usr/libexec'], native : true, required : false)
-if qemu.found()
- devices = run_command(qemu, '-device', 'help', check : true).stdout().strip()
- if devices.contains('name "nvme"')
- cmdline = []
- qemu_args = []
-
- foreach i : range(20)
- cmdline += [f'--drive=nvme@i@:1M::']
- endforeach
-
- foreach i : range(5)
- qemu_args += ['-device', f'nvme,drive=nvme@i@,serial=deadbeef@i@,max_ioqpairs=8']
- endforeach
-
- foreach i : range(5, 10)
- qemu_args += ['-device', f'"nvme,drive=nvme@i@,serial= deadbeef @i@ ,max_ioqpairs=8"']
- endforeach
-
- foreach i : range(10, 15)
- qemu_args += ['-device', f'"nvme,drive=nvme@i@,serial= dead/beef/@i@ ,max_ioqpairs=8"']
- endforeach
-
- foreach i : range(15, 20)
- qemu_args += ['-device', f'"nvme,drive=nvme@i@,serial=dead/../../beef/@i@,max_ioqpairs=8"']
- endforeach
-
- udev_storage_tests += {
- 'name' : 'nvme_basic',
- 'cmdline' : cmdline,
- 'qemu-args' : qemu_args,
- }
-
- cmdline = []
-
- foreach id : ['nvme0', 'nvme1']
- cmdline += [f'--drive=@id@:1M::']
- endforeach
-
- qemu_args = [
- # Create an NVM Subsystem Device
- '-device', 'nvme-subsys,id=nvme-subsys-64,nqn=subsys64',
- # Attach two NVM controllers to it
- '-device', 'nvme,subsys=nvme-subsys-64,serial=deadbeef',
- '-device', 'nvme,subsys=nvme-subsys-64,serial=deadbeef',
- # And create two shared namespaces attached to both controllers
- '-device', 'nvme-ns,drive=nvme0,nsid=16,shared=on',
- '-device', 'nvme-ns,drive=nvme1,nsid=17,shared=on',
- ]
-
- udev_storage_tests += {
- 'name' : 'nvme_subsystem',
- 'cmdline' : cmdline,
- 'qemu-args' : qemu_args,
- }
- endif
-
- if devices.contains('name "virtio-scsi-pci"')
- cmdline = []
- qemu_args = ['-device', 'virtio-scsi-pci,id=scsi0,num_queues=4']
-
- foreach i : range(16)
- id = f'drive@i@'
- cmdline += [f'--drive=@id@:40M::']
- qemu_args += ['-device', f'scsi-hd,drive=@id@,serial=@id@,bus=scsi0.0,channel=0,scsi-id=0,lun=@i@']
- endforeach
-
- udev_storage_tests += {
- 'name' : 'virtio_scsi_identically_named_partitions',
- 'cmdline' : cmdline,
- 'qemu-args' : qemu_args,
- }
- endif
-endif
+cmdline = []
+qemu_args = []
+
+foreach i : range(20)
+ cmdline += [f'--drive=nvme@i@:1M::']
+endforeach
+
+foreach i : range(5)
+ qemu_args += ['-device', f'nvme,drive=nvme@i@,serial=deadbeef@i@,max_ioqpairs=8']
+endforeach
+foreach i : range(5, 10)
+ qemu_args += ['-device', f'"nvme,drive=nvme@i@,serial= deadbeef @i@ ,max_ioqpairs=8"']
+endforeach
+
+foreach i : range(10, 15)
+ qemu_args += ['-device', f'"nvme,drive=nvme@i@,serial= dead/beef/@i@ ,max_ioqpairs=8"']
+endforeach
+
+foreach i : range(15, 20)
+ qemu_args += ['-device', f'"nvme,drive=nvme@i@,serial=dead/../../beef/@i@,max_ioqpairs=8"']
+endforeach
+
+udev_storage_tests += udev_storage_test_template + {
+ 'name' : 'nvme_basic',
+ 'cmdline' : cmdline,
+ 'qemu-args' : qemu_args,
+ 'enabled' : devices.contains('name "nvme"'),
+}
+
+cmdline = []
+
+foreach id : ['nvme0', 'nvme1']
+ cmdline += [f'--drive=@id@:1M::']
+endforeach
+
+qemu_args = [
+ # Create an NVM Subsystem Device
+ '-device', 'nvme-subsys,id=nvme-subsys-64,nqn=subsys64',
+ # Attach two NVM controllers to it
+ '-device', 'nvme,subsys=nvme-subsys-64,serial=deadbeef',
+ '-device', 'nvme,subsys=nvme-subsys-64,serial=deadbeef',
+ # And create two shared namespaces attached to both controllers
+ '-device', 'nvme-ns,drive=nvme0,nsid=16,shared=on',
+ '-device', 'nvme-ns,drive=nvme1,nsid=17,shared=on',
+]
+
+udev_storage_tests += udev_storage_test_template + {
+ 'name' : 'nvme_subsystem',
+ 'cmdline' : cmdline,
+ 'qemu-args' : qemu_args,
+ 'enabled' : devices.contains('name "nvme"'),
+}
+
+cmdline = []
+qemu_args = ['-device', 'virtio-scsi-pci,id=scsi0,num_queues=4']
+
+foreach i : range(16)
+ id = f'drive@i@'
+ cmdline += [f'--drive=@id@:40M::']
+ qemu_args += ['-device', f'scsi-hd,drive=@id@,serial=@id@,bus=scsi0.0,channel=0,scsi-id=0,lun=@i@']
+endforeach
+
+udev_storage_tests += udev_storage_test_template + {
+ 'name' : 'virtio_scsi_identically_named_partitions',
+ 'cmdline' : cmdline,
+ 'qemu-args' : qemu_args,
+ 'enabled' : devices.contains('name "virtio-scsi-pci"'),
+}
foreach testcase : udev_storage_tests
qemu_args = ' '.join(testcase['qemu-args'])
integration_tests += [
integration_test_template + {
'name' : '@0@-@1@'.format(name, testcase['name']),
- # Make sure the service is still named TEST-64-UDEV-STORAGE.service.
- 'unit' : unit,
- 'cmdline' : integration_test_template['cmdline'] + [
- 'systemd.setenv=TEST_FUNCTION_NAME=testcase_@0@'.format(testcase['name'])
- ],
+ # Disable user service manager by default for performance.
+ 'configuration' : integration_test_template['configuration'] + {
+ 'wants' : '',
+ 'after' : '',
+ 'command' : f'/usr/lib/systemd/tests/testdata/units/@name@.sh',
+ 'env' : integration_test_template['configuration']['env'] + {
+ 'TEST_FUNCTION_NAME': 'testcase_@0@'.format(testcase['name']),
+ },
+ },
'mkosi-args' : integration_test_template['mkosi-args'] + cmdline,
'priority' : 10,
'vm' : true,
# Suppress ASan error
# 'multipathd[1820]: ==1820==ERROR: AddressSanitizer: Joining already joined thread, aborting.'
- 'sanitizer-exclude-regex' : 'multipathd'
+ 'sanitizer-exclude-regex' : 'multipathd',
+ 'enabled' : testcase['enabled'],
},
]
endforeach
'name' : fs.name(meson.current_source_dir()),
},
]
-
-testdata_subdirs += [meson.current_source_dir() / 'TEST-74-AUX-UTILS.units']
'name' : fs.name(meson.current_source_dir()),
},
]
-
-testdata_subdirs += [meson.current_source_dir() / 'TEST-03-JOBS.units']
'name' : fs.name(meson.current_source_dir()),
},
]
-
-testdata_subdirs += [meson.current_source_dir() / 'TEST-63-PATH.units']
'name' : fs.name(meson.current_source_dir()),
},
]
-
-testdata_subdirs += [meson.current_source_dir() / 'TEST-23-UNIT-FILE.units']
'name' : fs.name(meson.current_source_dir()),
},
]
-
-testdata_subdirs += [meson.current_source_dir() / 'TEST-80-NOTIFYACCESS.units']
--- /dev/null
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+integration_tests += [
+ integration_test_template + {
+ 'name' : fs.name(meson.current_source_dir()),
+ },
+]
'vm' : true,
},
]
-
-testdata_subdirs += [meson.current_source_dir() / 'TEST-30-ONCLOCKCHANGE.units']
# SPDX-License-Identifier: LGPL-2.1-or-later
name = fs.name(meson.current_source_dir())
-unit = configure_file(
- input : files('../test.service.in'),
- output : '@0@.service'.format(name),
- configuration : integration_test_template['configuration'] + {
- 'command' : '@0@ --no-journal'.format(testdata_dir / 'test-network/systemd-networkd-tests.py')
- },
-)
foreach testcase : [
'NetworkctlTests',
integration_tests += [
integration_test_template + {
'name' : '@0@-@1@'.format(name, testcase),
- 'unit' : unit,
- 'cmdline' : integration_test_template['cmdline'] + [
- 'systemd.setenv=TEST_MATCH_TESTCASE=@0@'.format(testcase)
- ],
+ 'configuration' : integration_test_template['configuration'] + {
+ 'command' : '/usr/lib/systemd/tests/testdata/test-network/systemd-networkd-tests.py --no-journal',
+ 'env' : integration_test_template['configuration']['env'] + {
+ 'TEST_MATCH_TESTCASE': testcase,
+ }
+ },
'priority' : 10,
'vm' : true,
},
--- /dev/null
+..
\ No newline at end of file
--- /dev/null
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+integration_test_wrapper = find_program('integration-test-wrapper.py')
+integration_tests = []
+integration_test_template = {
+ 'mkosi-args' : [],
+ 'timeout' : 1800,
+ 'storage' : 'volatile',
+ 'priority' : 0,
+ 'firmware' : 'linux',
+ 'enabled' : true,
+ 'configuration' : {
+ 'memory-accounting' : 'no',
+ 'command' : '/usr/lib/systemd/tests/testdata/units/%N.sh',
+ 'wants' : 'multi-user.target user@4711.service',
+ 'after' : 'user@4711.service',
+ 'env' : {},
+ },
+ 'cmdline' : [],
+ 'credentials' : [],
+ 'qemu-args' : [],
+ 'exit-code' : 123,
+ 'vm' : false,
+ 'coredump-exclude-regex' : '',
+ 'sanitizer-exclude-regex' : '',
+ 'rtc' : false,
+}
+
+foreach dirname : [
+ 'TEST-01-BASIC',
+ 'TEST-02-UNITTESTS',
+ 'TEST-03-JOBS',
+ 'TEST-04-JOURNAL',
+ 'TEST-05-RLIMITS',
+ 'TEST-06-SELINUX',
+ 'TEST-07-PID1',
+ 'TEST-08-INITRD',
+ 'TEST-09-REBOOT',
+ 'TEST-13-NSPAWN',
+ 'TEST-15-DROPIN',
+ 'TEST-16-EXTEND-TIMEOUT',
+ 'TEST-17-UDEV',
+ 'TEST-18-FAILUREACTION',
+ 'TEST-19-CGROUP',
+ 'TEST-21-DFUZZER',
+ 'TEST-22-TMPFILES',
+ 'TEST-23-UNIT-FILE',
+ 'TEST-24-CRYPTSETUP',
+ 'TEST-25-IMPORT',
+ 'TEST-26-SYSTEMCTL',
+ 'TEST-29-PORTABLE',
+ 'TEST-30-ONCLOCKCHANGE',
+ 'TEST-31-DEVICE-ENUMERATION',
+ 'TEST-32-OOMPOLICY',
+ 'TEST-34-DYNAMICUSERMIGRATE',
+ 'TEST-35-LOGIN',
+ 'TEST-36-NUMAPOLICY',
+ 'TEST-38-FREEZER',
+ 'TEST-43-PRIVATEUSER-UNPRIV',
+ 'TEST-44-LOG-NAMESPACE',
+ 'TEST-45-TIMEDATE',
+ 'TEST-46-HOMED',
+ 'TEST-50-DISSECT',
+ 'TEST-52-HONORFIRSTSHUTDOWN',
+ 'TEST-53-ISSUE-16347',
+ 'TEST-54-CREDS',
+ 'TEST-55-OOMD',
+ 'TEST-58-REPART',
+ 'TEST-59-RELOADING-RESTART',
+ 'TEST-60-MOUNT-RATELIMIT',
+ 'TEST-62-RESTRICT-IFACES',
+ 'TEST-63-PATH',
+ 'TEST-64-UDEV-STORAGE',
+ 'TEST-65-ANALYZE',
+ 'TEST-66-DEVICE-ISOLATION',
+ 'TEST-67-INTEGRITY',
+ 'TEST-68-PROPAGATE-EXIT-STATUS',
+ 'TEST-69-SHUTDOWN',
+ 'TEST-70-TPM2',
+ 'TEST-71-HOSTNAME',
+ 'TEST-72-SYSUPDATE',
+ 'TEST-73-LOCALE',
+ 'TEST-74-AUX-UTILS',
+ 'TEST-75-RESOLVED',
+ 'TEST-76-SYSCTL',
+ 'TEST-78-SIGQUEUE',
+ 'TEST-79-MEMPRESS',
+ 'TEST-80-NOTIFYACCESS',
+ 'TEST-81-GENERATORS',
+ 'TEST-82-SOFTREBOOT',
+ 'TEST-83-BTRFS',
+ 'TEST-84-STORAGETM',
+ 'TEST-85-NETWORK',
+ 'TEST-86-MULTI-PROFILE-UKI',
+ 'TEST-87-AUX-UTILS-VM',
+]
+ subdir(dirname)
+endforeach
+
+foreach integration_test : integration_tests
+ integration_test_args = [
+ # We don't use meson.project_source_root() because that doesn't work for running the tests
+ # standalone (see standalone/meson.build).
+ '--meson-source-dir', meson.current_source_dir() / '../..',
+ '--meson-build-dir', meson.project_build_root(),
+ '--name', integration_test['name'],
+ '--storage', integration_test['storage'],
+ '--firmware', integration_test['firmware'],
+ '--exit-code', integration_test['exit-code'].to_string(),
+ '--coredump-exclude-regex', integration_test['coredump-exclude-regex'],
+ '--sanitizer-exclude-regex', integration_test['sanitizer-exclude-regex'],
+ ]
+
+ if 'unit' in integration_test
+ integration_test_args += ['--unit', fs.name(integration_test['unit'])]
+ else
+ integration_test_args += ['--unit', '@0@.service'.format(integration_test['name'])]
+ endif
+
+ if integration_test['vm']
+ integration_test_args += ['--vm']
+ endif
+
+ if integration_test['rtc']
+ integration_test_args += ['--rtc']
+ endif
+
+ if not mkosi.found()
+ continue
+ endif
+
+ integration_test_args += ['--mkosi', mkosi.full_path(), '--']
+
+ if integration_test['cmdline'].length() > 0
+ integration_test_args += [
+ '--kernel-command-line-extra=@0@'.format(' '.join(integration_test['cmdline']))
+ ]
+ endif
+
+ foreach credential : integration_test['credentials']
+ integration_test_args += ['--credential', credential]
+ endforeach
+
+ if integration_test['qemu-args'].length() > 0
+ integration_test_args += ['--qemu-args=@0@'.format(' '.join(integration_test['qemu-args']))]
+ endif
+
+ integration_test_args += integration_test['mkosi-args']
+
+ integration_test_env = {}
+
+ if want_integration_tests
+ integration_test_env += {'SYSTEMD_INTEGRATION_TESTS': '1'}
+ endif
+
+ if not integration_test['enabled']
+ continue
+ endif
+
+ # 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(
+ integration_test['name'],
+ integration_test_wrapper,
+ env : integration_test_env,
+ args : integration_test_args,
+ timeout : integration_test['timeout'],
+ priority : integration_test['priority'],
+ suite : 'integration-tests',
+ )
+endforeach
--- /dev/null
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+# This meson file can be used to run the integration tests without having to install any other dependencies
+# as follows:
+#
+# mkosi -f sandbox -- meson setup testsuite test/integration-tests/standalone
+# mkosi genkey
+# mkosi -f
+# mkosi sandbox -- meson test -C testsuite
+#
+project('systemd-testsuite',
+ version : files('../../../meson.version'),
+ license : 'LGPLv2+',
+ default_options: ['warning_level=2'],
+ meson_version : '>= 0.62.0',
+)
+
+fs = import('fs')
+mkosi = find_program('mkosi', required : true)
+want_integration_tests = true
+
+# meson refuses .. in subdir() so we use a symlink to trick it into accepting it anyway.
+subdir('integration-tests')
############################################################
if want_tests != 'false'
- integration_test_wrapper = find_program('integration-test-wrapper.py')
- integration_tests = []
- integration_test_template = {
- 'mkosi-args' : [],
- 'timeout' : 1800,
- 'storage' : 'volatile',
- 'priority' : 0,
- 'firmware' : 'linux',
- 'enabled' : true,
- 'configuration' : {
- 'memory-accounting' : 'no',
- 'command' : testdata_dir / 'units/%N.sh',
- 'wants' : 'multi-user.target user@4711.service',
- 'after' : 'user@4711.service',
- },
- 'cmdline' : [],
- 'credentials' : [],
- 'qemu-args' : [],
- 'exit-code' : 123,
- 'vm' : false,
- 'coredump-exclude-regex' : '',
- 'sanitizer-exclude-regex' : '',
- 'rtc' : false,
- }
- testdata_subdirs = [
- 'auxv',
- 'journal-data',
- 'knot-data',
- 'test-journals',
- 'units',
- 'test-execute',
- 'test-fstab-generator',
- 'test-path',
- 'test-path-util',
- 'test-umount',
- 'test-network',
- 'test-network-generator-conversion',
- ]
-
- foreach dirname : [
- 'TEST-01-BASIC',
- 'TEST-02-UNITTESTS',
- 'TEST-03-JOBS',
- 'TEST-04-JOURNAL',
- 'TEST-05-RLIMITS',
- 'TEST-06-SELINUX',
- 'TEST-07-PID1',
- 'TEST-08-INITRD',
- 'TEST-09-REBOOT',
- 'TEST-13-NSPAWN',
- 'TEST-15-DROPIN',
- 'TEST-16-EXTEND-TIMEOUT',
- 'TEST-17-UDEV',
- 'TEST-18-FAILUREACTION',
- 'TEST-19-CGROUP',
- 'TEST-21-DFUZZER',
- 'TEST-22-TMPFILES',
- 'TEST-23-UNIT-FILE',
- 'TEST-24-CRYPTSETUP',
- 'TEST-25-IMPORT',
- 'TEST-26-SYSTEMCTL',
- 'TEST-29-PORTABLE',
- 'TEST-30-ONCLOCKCHANGE',
- 'TEST-31-DEVICE-ENUMERATION',
- 'TEST-32-OOMPOLICY',
- 'TEST-34-DYNAMICUSERMIGRATE',
- 'TEST-35-LOGIN',
- 'TEST-36-NUMAPOLICY',
- 'TEST-38-FREEZER',
- 'TEST-43-PRIVATEUSER-UNPRIV',
- 'TEST-44-LOG-NAMESPACE',
- 'TEST-45-TIMEDATE',
- 'TEST-46-HOMED',
- 'TEST-50-DISSECT',
- 'TEST-52-HONORFIRSTSHUTDOWN',
- 'TEST-53-ISSUE-16347',
- 'TEST-54-CREDS',
- 'TEST-55-OOMD',
- 'TEST-58-REPART',
- 'TEST-59-RELOADING-RESTART',
- 'TEST-60-MOUNT-RATELIMIT',
- 'TEST-62-RESTRICT-IFACES',
- 'TEST-63-PATH',
- 'TEST-64-UDEV-STORAGE',
- 'TEST-65-ANALYZE',
- 'TEST-66-DEVICE-ISOLATION',
- 'TEST-67-INTEGRITY',
- 'TEST-68-PROPAGATE-EXIT-STATUS',
- 'TEST-69-SHUTDOWN',
- 'TEST-70-TPM2',
- 'TEST-71-HOSTNAME',
- 'TEST-72-SYSUPDATE',
- 'TEST-73-LOCALE',
- 'TEST-74-AUX-UTILS',
- 'TEST-75-RESOLVED',
- 'TEST-76-SYSCTL',
- 'TEST-78-SIGQUEUE',
- 'TEST-79-MEMPRESS',
- 'TEST-80-NOTIFYACCESS',
- 'TEST-81-GENERATORS',
- 'TEST-82-SOFTREBOOT',
- 'TEST-83-BTRFS',
- 'TEST-84-STORAGETM',
- 'TEST-85-NETWORK',
- 'TEST-86-MULTI-PROFILE-UKI',
- 'TEST-87-AUX-UTILS-VM',
- ]
- subdir(dirname)
- endforeach
+ subdir('integration-tests')
+endif
+if install_tests
foreach integration_test : integration_tests
- integration_test_args = [
- '--meson-source-dir', meson.project_source_root(),
- '--meson-build-dir', meson.project_build_root(),
- '--name', integration_test['name'],
- '--storage', integration_test['storage'],
- '--firmware', integration_test['firmware'],
- '--exit-code', integration_test['exit-code'].to_string(),
- '--coredump-exclude-regex', integration_test['coredump-exclude-regex'],
- '--sanitizer-exclude-regex', integration_test['sanitizer-exclude-regex'],
- ]
-
if 'unit' in integration_test
integration_test_unit = integration_test['unit']
else
+ integration_test_unit_env = []
+
+ foreach key, value : integration_test['configuration']['env']
+ integration_test_unit_env += [f'@key@=@value@']
+ endforeach
+
integration_test_unit = configure_file(
input : 'test.service.in',
output : '@0@.service'.format(integration_test['name']),
- configuration : integration_test['configuration'],
+ configuration : integration_test['configuration'] + {
+ 'env' : ' '.join(integration_test_unit_env)
+ },
)
endif
- integration_test_args += ['--unit', fs.name(integration_test_unit)]
if install_tests
install_data(integration_test_unit, install_dir : testdata_dir / 'units')
endif
-
- if integration_test['vm']
- integration_test_args += ['--vm']
- endif
-
- if integration_test['rtc']
- integration_test_args += ['--rtc']
- endif
-
- if not mkosi.found()
- continue
- endif
-
- integration_test_args += ['--mkosi', mkosi.full_path(), '--']
-
- if integration_test['cmdline'].length() > 0
- integration_test_args += [
- '--kernel-command-line-extra=@0@'.format(' '.join(integration_test['cmdline']))
- ]
- endif
-
- foreach credential : integration_test['credentials']
- integration_test_args += ['--credential', credential]
- endforeach
-
- if integration_test['qemu-args'].length() > 0
- integration_test_args += ['--qemu-args=@0@'.format(' '.join(integration_test['qemu-args']))]
- endif
-
- integration_test_args += integration_test['mkosi-args']
-
- integration_test_env = {}
-
- if want_integration_tests
- integration_test_env += {'SYSTEMD_INTEGRATION_TESTS': '1'}
- endif
-
- if not integration_test['enabled']
- continue
- endif
-
- # 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(
- integration_test['name'],
- integration_test_wrapper,
- env : integration_test_env,
- args : integration_test_args,
- timeout : integration_test['timeout'],
- priority : integration_test['priority'],
- suite : 'integration-tests',
- )
endforeach
-endif
-if install_tests
+ testdata_subdirs = [
+ 'auxv',
+ 'journal-data',
+ 'knot-data',
+ 'test-journals',
+ 'units',
+ 'test-execute',
+ 'test-fstab-generator',
+ 'test-path',
+ 'test-path-util',
+ 'test-umount',
+ 'test-network',
+ 'test-network-generator-conversion',
+ '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-52-HONORFIRSTSHUTDOWN/TEST-52-HONORFIRSTSHUTDOWN.units',
+ 'integration-tests/TEST-63-PATH/TEST-63-PATH.units',
+ 'integration-tests/TEST-74-AUX-UTILS/TEST-74-AUX-UTILS.units',
+ 'integration-tests/TEST-80-NOTIFYACCESS/TEST-80-NOTIFYACCESS.units',
+ ]
+
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.
ExecStart=@command@
Type=oneshot
MemoryAccounting=@memory-accounting@
-Environment=SYSTEMD_PAGER=
+Environment=SYSTEMD_PAGER= @env@