Commit graph

41 commits

Author SHA1 Message Date
Luca Boccassi 8f4bbd096b test: fix TEST_SKIP for test cases with subtests
TEST-64-UDEV-STORAGE is invoked with the subtest appended, so TEST_SKIP=TEST-64-UDEV-STORAGE
does not work. Fix it by using TEST_SKIP as a partial match.

Follow-up for ddc91af4ea
2024-09-11 13:55:53 +02:00
Daan De Meyer 7560a5393a test: Set show_status=error
The TEST-64-UDEV-STORAGE tests fail before we even start the test.
Let's set show_status=error to get more information when those failures
happen.
2024-08-28 19:20:56 +02:00
Daan De Meyer c8e7cfeddc tests: Don't override QemuKvm= value if TEST_NO_KVM=0
Let's disable KVM if TEST_NO_KVM=1 is set but let's not specify anything
if it's not set so the QemuKvm= setting from mkosi.conf is used.
2024-08-21 01:52:09 +09:00
Luca Boccassi ddc91af4ea test: add TEST_SKIP to mkosi integration test wrapper
Takes a space-separate list of test names, allows to skip one or more tests
2024-08-15 10:39:51 +02:00
Daan De Meyer dd1c01b20f test: Implement TEST_SHELL for mkosi based test runner
TEST_SHELL can be used to get a shell in the integration test
environment without actually immediately starting the test.
2024-08-05 15:00:24 +02:00
Daan De Meyer 578ee05155 test: Don't mount build sources into image when running non-interactively 2024-07-29 13:40:42 +02:00
Daan De Meyer 20345a86b7 mkosi: Adapt configuration to take into account configuration rework
In https://github.com/systemd/mkosi/pull/2847, the '@' specifier is
removed, CLI arguments take priority over configuration files again
and the "main" image is defined at the top level instead of in
mkosi.images/. Additionally, not every setting from the top level
configuration is inherited by the images in mkosi.images/ anymore,
only settings which make sense to be inherited are inherited.

This commit gets rid of all the usages of '@', moves the "main" image
configuration from mkosi.images/system to the top level and gets rid
of various hacks we had in place to deal with quirks of the old
configuration parsing logic.

We also remove usages of Images= and --append as these options are
removed by the mentioned PR.
2024-07-09 08:07:09 +02:00
Daan De Meyer 32f3617fd7 test: pull in multi-user.target explicitly
Let's make sure we pull in multi-user.target so that we get a console
when a test fails and we're running meson test with --interactive.
2024-06-28 13:34:37 +02:00
Luca Boccassi 59d4970a55 mkosi: add support for TEST_SAVE_JOURNAL to integration test wrapper
Same variable and values as supported by the shell suite
2024-06-25 12:16:59 +02:00
Luca Boccassi 464d182b3e test: support TEST_NO_QEMU in mkosi integration wrapper
Same as the old integration test suite, allow skipping tests that
require qemu.
ppc64el's vsock support doesn't appear to work, so we'll skip it,
as it is already done in the legacy framework.
2024-06-17 15:52:50 +01:00
Luca Boccassi 7d2701e7d1 test: support TEST_NO_KVM
The shell integration suite allows to manually deselect KVM, so
suppor the same env var for the same purpose in python.
2024-06-17 15:52:50 +01:00
Luca Boccassi 626518ecd5 test: drop obsolete comment
We want to keep various logic here instead of mkosi, so drop the
temporary comment
2024-06-17 15:52:50 +01:00
Luca Boccassi 88c2ef1f75 Revert "test: Run end.sh when running integration tests with mkosi"
It seems this introduced a regression in the CentOS CI;

14:25:58 FAILED TASKS:14:25:58 -------------
14:25:58 TEST-03-JOBS
14:25:58 TEST-52-HONORFIRSTSHUTDOWN
14:25:58 TEST-63-PATH

Revert for now.

This reverts commit da3c6fc553.
2024-06-03 16:29:23 +01:00
Daan De Meyer da3c6fc553 test: Run end.sh when running integration tests with mkosi 2024-06-02 19:15:21 +02:00
Daan De Meyer 1e5a1bbe02 test: Run tests that don't need a vm in systemd-nspawn
If we're not running the test as root, stick to using a virtual
machine, as mkosi can't do rootless nspawn yet.
2024-05-29 14:10:50 +02:00
Daan De Meyer e2f9f3409a meson: Look up mkosi once 2024-05-27 12:02:31 +02:00
Daan De Meyer b13b7978e7 test: Enable TEST-08-INITRD on mkosi 2024-05-15 10:09:53 +02:00
Daan De Meyer eb4c962aa4 test: Ignore configure scripts in minimal images
These are always aimed at the system image so ignore any specified
configure scripts in the minimal images.
2024-05-14 12:43:28 +02:00
Daan De Meyer 348f5017a4 test: Generate basic testsuite services with meson
Most of these are identical, let's just generate from a meson
template.
2024-05-14 12:43:28 +02:00
Daan De Meyer f483e08313 test: Simplify argument/variable names 2024-05-14 12:43:28 +02:00
Daan De Meyer 7a321b5a21 test: Rename testsuite-XX units to match test name
Having these named differently than the test itself mostly creates
unecessary confusion and makes writing logic against the tests harder
so let's rename the testsuite-xx units and scripts to just use the
test name itself.
2024-05-14 12:43:28 +02:00
Daan De Meyer f1f87f3b2e test: Add infra to mark integration tests as slow
Some integration tests take much more time than others, let's add
a test param that can be used to configure this and integrate it
with the slow-tests meson option.
2024-05-07 19:06:42 +02:00
Daan De Meyer a77f65d0c9 ci: Print a helpful link to download and view a failed test's journal 2024-05-07 19:06:39 +02:00
Daan De Meyer ca2e19f2b7 test: Don't keep journals for skipped tests
Let's make sure we don't save journals for tests that were skipped.
2024-05-07 17:34:42 +02:00
Daan De Meyer 1f2c9bda49 test: Default to linux qemu firmware
Direct kernel boot results in much faster boot times so let's use
it by default.

We disable it for tests that need to reboot because +-50% of the
time, doing a reboot when using direct kernel boot causes qemu to
hang on reboot. Until we figure that out, let's use UEFI for the
tests that need to reboot.
2024-05-06 11:57:09 +02:00
Daan De Meyer d91bb1cbf0 test: Always shutdown on test success in mkosi
When we want to get an interactive shell in a test that fails because
of a race condition, we might need to run the test a few times with
--repeat before it fails. However, currently, when -i is used, the VM
needs to be shut down manually each time before the next run can start.

Let's always shut down the VM if the test succeeds so that --repeat can
be used with -i to run the test until it fails and then get an interactive
shell in the VM.
2024-05-06 10:56:54 +02:00
Daan De Meyer 0596237e0e test: Use MESON_TEST_ITERATION if available
This allows running the same test multiple times concurrently with
meson's --repeat option. Proposed upstream but not yet merged:
https://github.com/mesonbuild/meson/pull/13177.
2024-05-06 10:56:54 +02:00
Daan De Meyer 3cb61e0d1c test: Pass through test matching environment variables to the mkosi VM 2024-05-06 10:56:54 +02:00
Daan De Meyer bdade5f597 test: Formatting fixes 2024-05-06 10:56:43 +02:00
Daan De Meyer 69e02d94f5 meson: Remove --debug from mkosi arguments
The exit status issue for which we introduced this was fixed so
let's remove --debug again to make the meson output less verbose.
2024-05-05 14:49:21 +02:00
Daan De Meyer 9a69900a4b test: Make journal storage configurable per test and make persistent for TEST-09-JOURNAL
Also fix a bug in the logic since it's 'volatile' and not 'runtime'.
2024-04-30 22:10:05 +02:00
Daan De Meyer 27f166c523 mkosi: Use systemd.crash_action=poweroff in integration tests
Some integration tests expect to be able to reboot so switch to using
the new systemd.crash_action=poweroff instead.
2024-04-30 17:01:41 +02:00
Daan De Meyer e911a335ed mkosi: Mask systemd-networkd-wait-online when --runtime-network=none
Otherwise it will wait forever waiting for an interface to appear.
See https://github.com/systemd/systemd/issues/29388.
2024-04-30 17:01:41 +02:00
Daan De Meyer d99deaaaea mkosi: Disable --runtime-scratch=no for tests
Breaks TEST-83-BTRFS if enabled.
2024-04-30 17:01:41 +02:00
Daan De Meyer 06489e8332 mkosi: Make sure our extra kernel command line overrides the config one 2024-04-30 17:01:41 +02:00
Daan De Meyer c89244842b test: Don't persist journal in mkosi image if we're not debugging tests
If we're not debugging tests, there's no point in persisting the journal,
so let's use the volatile journal storage mode in that case to avoid doing
unnecessary work.

We don't disable journal storage alltogether since various tests check
that stuff is written to the journal.
2024-04-30 15:20:55 +02:00
Richard Maw ab5f60cb23 test: Disable network by default in mkosi tests 2024-04-26 15:55:42 +01:00
Daan De Meyer cf5e1b5d39 test: Skip meson integration tests if SYSTEMD_INTEGRATION_TESTS != 1
We cannot mark a test suite as excluded by default in meson. Instead,
let's require that SYSTEMD_INTEGRATION_TESTS=1 and skip any integration
test if it's not set. This is effectively the same as excluding it by
default. If the integration-test option is enabled, we'll set the
environment variable by default, just like we do with SYSTEMD_SLOW_TESTS
and the slow-tests meson option.
2024-04-25 17:06:40 +02:00
Richard Maw 125b2fee18 test: Add --debug when running mkosi through integration-test-wrapper 2024-04-24 18:27:07 +01:00
Richard Maw 2fd849016b test: Shut down tests on crash
If an assert in systemd fails it can't shut down normally.

By default it freezes. For interactive runs we want the crash shell
to enable further debugging, but during test runs we want it to exit
without having to wait for the test timeout.

By deactivating the crash shell, enabling reboot, and configuring qemu
so that it shuts down instead of rebooting we can shut down instead.

Because by default UEFI will enroll keys and then reboot
we also have to set --qemu-firmware-variables=custom
so it doesn't need to auto-enroll.

Because mkosi has to handle not receiving an EXIT_STATUS notification
it falls back to the exit code of qemu, which in the case of reboot
would be 0, we also override the success exit status to 123
and check that we got that as an exit code from mkosi.
2024-04-24 11:01:45 +02:00
Daan De Meyer b85e54961c 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.
2024-04-23 10:32:42 +02:00