diff --git a/.github/workflows/mkosi.yml b/.github/workflows/mkosi.yml index 66a58c56d7e..be5f1edfee9 100644 --- a/.github/workflows/mkosi.yml +++ b/.github/workflows/mkosi.yml @@ -71,7 +71,7 @@ jobs: steps: - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 - - uses: systemd/mkosi@55f17a8ae67ece9712324c3107804daad94ad0d9 + - uses: systemd/mkosi@8770a4e3390a68522f187acbcd33311040563fda # Freeing up disk space with rm -rf can take multiple minutes. Since we don't need the extra free space # immediately, we remove the files in the background. However, we first move them to a different location @@ -182,7 +182,7 @@ jobs: run: meson compile -C build mkosi - name: Run integration tests - run: meson test -C build --no-rebuild --suite integration-tests --print-errorlogs --no-stdsplit --num-processes "$(($(nproc) - 1))" + run: sudo meson test -C build --no-rebuild --suite integration-tests --print-errorlogs --no-stdsplit --num-processes "$(($(nproc) - 1))" - name: Archive failed test journals uses: actions/upload-artifact@v4 diff --git a/mkosi.conf b/mkosi.conf index 9d23f4f8b2c..2da8804a7ef 100644 --- a/mkosi.conf +++ b/mkosi.conf @@ -14,6 +14,9 @@ MinimumVersion=23~devel Environment=ASAN_OPTIONS=verify_asan_link_order=false MKOSI_ASAN_OPTIONS=strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1:disable_coredump=0:use_madv_dontdump=1 MKOSI_UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1 + # The kernel versions in CentOS Stream 9 and Ubuntu 22.04 don't support orphan_file, but later + # versions of mkfs.ext4 enabled it by default, so we disable it explicitly. + SYSTEMD_REPART_MKFS_OPTIONS_EXT4="-O ^orphan_file" @SELinuxRelabel=no BuildSourcesEphemeral=yes diff --git a/mkosi.conf.d/10-centos.conf b/mkosi.conf.d/10-centos.conf index 69fa1350e60..ae2706c7917 100644 --- a/mkosi.conf.d/10-centos.conf +++ b/mkosi.conf.d/10-centos.conf @@ -8,6 +8,3 @@ Distribution=centos Repositories=epel epel-next hyperscale-packages-main - -[Content] -Environment=SYSTEMD_REPART_MKFS_OPTIONS_EXT4="-O ^orphan_file" diff --git a/mkosi.images/system/mkosi.conf.d/10-centos/mkosi.conf b/mkosi.images/system/mkosi.conf.d/10-centos/mkosi.conf index 60ea1cb6a3b..843b96d9a61 100644 --- a/mkosi.images/system/mkosi.conf.d/10-centos/mkosi.conf +++ b/mkosi.images/system/mkosi.conf.d/10-centos/mkosi.conf @@ -3,9 +3,6 @@ [Match] Distribution=centos -[Output] -RepartDirectories=mkosi.repart - [Content] Packages= rpmautospec-rpm-macros diff --git a/mkosi.images/system/mkosi.conf.d/10-centos/mkosi.repart/10-root.conf.d/xfs.conf b/mkosi.images/system/mkosi.conf.d/10-centos/mkosi.repart/10-root.conf.d/xfs.conf deleted file mode 100644 index a50de68110e..00000000000 --- a/mkosi.images/system/mkosi.conf.d/10-centos/mkosi.repart/10-root.conf.d/xfs.conf +++ /dev/null @@ -1,6 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1-or-later - -[Partition] -# btrfs isn't supported on CentOS. Ideally we'd use xfs instead but we lose xattrs when doing rootless -# population of xfs which is required for testing SELinux so let's do ext4 instead. -Format=ext4 diff --git a/mkosi.images/system/mkosi.extra/usr/lib/systemd/system-preset/00-mkosi.preset b/mkosi.images/system/mkosi.extra/usr/lib/systemd/system-preset/00-mkosi.preset index aea1b5eea0c..0f69549f6a0 100644 --- a/mkosi.images/system/mkosi.extra/usr/lib/systemd/system-preset/00-mkosi.preset +++ b/mkosi.images/system/mkosi.extra/usr/lib/systemd/system-preset/00-mkosi.preset @@ -34,3 +34,7 @@ enable systemd-timesyncd.service # Skipped if selinux is not enabled, required for TEST-06-SELINUX. enable autorelabel.service + +# Enabled by default on OpenSUSE and not conditioned out in containers, so let's disable these here instead. +disable iscsi.service +disable iscsid.socket diff --git a/mkosi.images/system/mkosi.repart/10-root.conf b/mkosi.images/system/mkosi.repart/10-root.conf index 3c25dbfb14d..715b9254630 100644 --- a/mkosi.images/system/mkosi.repart/10-root.conf +++ b/mkosi.images/system/mkosi.repart/10-root.conf @@ -2,7 +2,7 @@ [Partition] Type=root -Format=btrfs +Format=ext4 CopyFiles=/ SizeMinBytes=8G SizeMaxBytes=8G diff --git a/test/TEST-06-SELINUX/meson.build b/test/TEST-06-SELINUX/meson.build index dd1dfb0bafe..7a850beb816 100644 --- a/test/TEST-06-SELINUX/meson.build +++ b/test/TEST-06-SELINUX/meson.build @@ -6,6 +6,7 @@ integration_tests += [ 'cmdline' : integration_test_template['cmdline'] + ['selinux=1', 'lsm=selinux'], # FIXME; Figure out why reboot sometimes hangs with 'linux' firmware. 'firmware' : 'uefi', + 'vm' : true, }, ] diff --git a/test/TEST-08-INITRD/meson.build b/test/TEST-08-INITRD/meson.build index 34edec0d355..dcbfe20134c 100644 --- a/test/TEST-08-INITRD/meson.build +++ b/test/TEST-08-INITRD/meson.build @@ -7,5 +7,6 @@ integration_tests += [ 'rd.systemd.wants=initrd-run-mount.service', ], 'exit-code' : 124, + 'vm' : true, }, ] diff --git a/test/TEST-13-NSPAWN/meson.build b/test/TEST-13-NSPAWN/meson.build index 8dec5f37e73..77370ce4588 100644 --- a/test/TEST-13-NSPAWN/meson.build +++ b/test/TEST-13-NSPAWN/meson.build @@ -3,5 +3,6 @@ integration_tests += [ integration_test_template + { 'name' : fs.name(meson.current_source_dir()), + 'vm' : true, }, ] diff --git a/test/TEST-17-UDEV/meson.build b/test/TEST-17-UDEV/meson.build index 8dec5f37e73..77370ce4588 100644 --- a/test/TEST-17-UDEV/meson.build +++ b/test/TEST-17-UDEV/meson.build @@ -3,5 +3,6 @@ integration_tests += [ integration_test_template + { 'name' : fs.name(meson.current_source_dir()), + 'vm' : true, }, ] diff --git a/test/TEST-21-DFUZZER/meson.build b/test/TEST-21-DFUZZER/meson.build index 3373df297c1..29c8e434cac 100644 --- a/test/TEST-21-DFUZZER/meson.build +++ b/test/TEST-21-DFUZZER/meson.build @@ -6,5 +6,6 @@ integration_tests += [ 'timeout' : 3600, 'priority' : 50, 'slow' : true, + 'vm' : true, }, ] diff --git a/test/TEST-24-CRYPTSETUP/meson.build b/test/TEST-24-CRYPTSETUP/meson.build index ec621d5068e..cef370bd656 100644 --- a/test/TEST-24-CRYPTSETUP/meson.build +++ b/test/TEST-24-CRYPTSETUP/meson.build @@ -20,5 +20,6 @@ integration_tests += [ 'mkosi-args' : integration_test_template['mkosi-args'] + [ '--runtime-size=11G', ], + 'vm' : true, }, ] diff --git a/test/TEST-29-PORTABLE/meson.build b/test/TEST-29-PORTABLE/meson.build index 8dec5f37e73..77370ce4588 100644 --- a/test/TEST-29-PORTABLE/meson.build +++ b/test/TEST-29-PORTABLE/meson.build @@ -3,5 +3,6 @@ integration_tests += [ integration_test_template + { 'name' : fs.name(meson.current_source_dir()), + 'vm' : true, }, ] diff --git a/test/TEST-30-ONCLOCKCHANGE/meson.build b/test/TEST-30-ONCLOCKCHANGE/meson.build index 174ec42867f..cd0f1f6574a 100644 --- a/test/TEST-30-ONCLOCKCHANGE/meson.build +++ b/test/TEST-30-ONCLOCKCHANGE/meson.build @@ -3,6 +3,7 @@ integration_tests += [ integration_test_template + { 'name' : fs.name(meson.current_source_dir()), + 'vm' : true, }, ] diff --git a/test/TEST-31-DEVICE-ENUMERATION/meson.build b/test/TEST-31-DEVICE-ENUMERATION/meson.build index 8dec5f37e73..77370ce4588 100644 --- a/test/TEST-31-DEVICE-ENUMERATION/meson.build +++ b/test/TEST-31-DEVICE-ENUMERATION/meson.build @@ -3,5 +3,6 @@ integration_tests += [ integration_test_template + { 'name' : fs.name(meson.current_source_dir()), + 'vm' : true, }, ] diff --git a/test/TEST-32-OOMPOLICY/meson.build b/test/TEST-32-OOMPOLICY/meson.build index 2b832a8f6d3..b715c0dd261 100644 --- a/test/TEST-32-OOMPOLICY/meson.build +++ b/test/TEST-32-OOMPOLICY/meson.build @@ -6,5 +6,6 @@ integration_tests += [ 'configuration' : integration_test_template['configuration'] + { 'memory-accounting' : 'yes', }, + 'vm' : true, }, ] diff --git a/test/TEST-36-NUMAPOLICY/meson.build b/test/TEST-36-NUMAPOLICY/meson.build index 8dec5f37e73..77370ce4588 100644 --- a/test/TEST-36-NUMAPOLICY/meson.build +++ b/test/TEST-36-NUMAPOLICY/meson.build @@ -3,5 +3,6 @@ integration_tests += [ integration_test_template + { 'name' : fs.name(meson.current_source_dir()), + 'vm' : true, }, ] diff --git a/test/TEST-38-FREEZER/meson.build b/test/TEST-38-FREEZER/meson.build index 8dec5f37e73..77370ce4588 100644 --- a/test/TEST-38-FREEZER/meson.build +++ b/test/TEST-38-FREEZER/meson.build @@ -3,5 +3,6 @@ integration_tests += [ integration_test_template + { 'name' : fs.name(meson.current_source_dir()), + 'vm' : true, }, ] diff --git a/test/TEST-50-DISSECT/meson.build b/test/TEST-50-DISSECT/meson.build index 8dec5f37e73..77370ce4588 100644 --- a/test/TEST-50-DISSECT/meson.build +++ b/test/TEST-50-DISSECT/meson.build @@ -3,5 +3,6 @@ integration_tests += [ integration_test_template + { 'name' : fs.name(meson.current_source_dir()), + 'vm' : true, }, ] diff --git a/test/TEST-53-ISSUE-16347/meson.build b/test/TEST-53-ISSUE-16347/meson.build index 8d6df66cb06..4c764a21c39 100644 --- a/test/TEST-53-ISSUE-16347/meson.build +++ b/test/TEST-53-ISSUE-16347/meson.build @@ -6,5 +6,6 @@ integration_tests += [ 'mkosi-args' : integration_test_template['mkosi-args'] + [ '--configure-script', meson.current_source_dir() / 'mkosi.configure', ], + 'vm' : true, }, ] diff --git a/test/TEST-55-OOMD/meson.build b/test/TEST-55-OOMD/meson.build index 71014a3158a..adc05097869 100644 --- a/test/TEST-55-OOMD/meson.build +++ b/test/TEST-55-OOMD/meson.build @@ -5,6 +5,7 @@ integration_tests += [ 'name' : fs.name(meson.current_source_dir()), 'credentials' : integration_test_template['credentials'] + [ files('systemd.unit-dropin.init.scope'), - ] + ], + 'vm' : true, }, ] diff --git a/test/TEST-62-RESTRICT-IFACES/meson.build b/test/TEST-62-RESTRICT-IFACES/meson.build index 8dec5f37e73..77370ce4588 100644 --- a/test/TEST-62-RESTRICT-IFACES/meson.build +++ b/test/TEST-62-RESTRICT-IFACES/meson.build @@ -3,5 +3,6 @@ integration_tests += [ integration_test_template + { 'name' : fs.name(meson.current_source_dir()), + 'vm' : true, }, ] diff --git a/test/TEST-64-UDEV-STORAGE/meson.build b/test/TEST-64-UDEV-STORAGE/meson.build index 3c206d9f54e..363104d861b 100644 --- a/test/TEST-64-UDEV-STORAGE/meson.build +++ b/test/TEST-64-UDEV-STORAGE/meson.build @@ -33,6 +33,7 @@ foreach testcase : [ '--configure-script', files('@0@.configure'.format(testcase)), ], 'priority' : 10, + 'vm' : true, }, ] endforeach diff --git a/test/TEST-66-DEVICE-ISOLATION/meson.build b/test/TEST-66-DEVICE-ISOLATION/meson.build index 8dec5f37e73..77370ce4588 100644 --- a/test/TEST-66-DEVICE-ISOLATION/meson.build +++ b/test/TEST-66-DEVICE-ISOLATION/meson.build @@ -3,5 +3,6 @@ integration_tests += [ integration_test_template + { 'name' : fs.name(meson.current_source_dir()), + 'vm' : true, }, ] diff --git a/test/TEST-67-INTEGRITY/meson.build b/test/TEST-67-INTEGRITY/meson.build index 8dec5f37e73..77370ce4588 100644 --- a/test/TEST-67-INTEGRITY/meson.build +++ b/test/TEST-67-INTEGRITY/meson.build @@ -3,5 +3,6 @@ integration_tests += [ integration_test_template + { 'name' : fs.name(meson.current_source_dir()), + 'vm' : true, }, ] diff --git a/test/TEST-70-TPM2/meson.build b/test/TEST-70-TPM2/meson.build index 4e0bf908746..d84c2b78382 100644 --- a/test/TEST-70-TPM2/meson.build +++ b/test/TEST-70-TPM2/meson.build @@ -7,5 +7,6 @@ integration_tests += [ 'wants' : '@0@ tpm2.target'.format(integration_test_template['configuration']['wants']), 'after' : '@0@ tpm2.target'.format(integration_test_template['configuration']['after']), }, + 'vm' : true, }, ] diff --git a/test/TEST-82-SOFTREBOOT/meson.build b/test/TEST-82-SOFTREBOOT/meson.build index a9b26ffd840..a7c1bf0bd55 100644 --- a/test/TEST-82-SOFTREBOOT/meson.build +++ b/test/TEST-82-SOFTREBOOT/meson.build @@ -6,5 +6,6 @@ integration_tests += [ 'unit' : files('TEST-82-SOFTREBOOT.service'), 'cmdline' : ['systemd.set_credential=kernelcmdlinecred:uff'], 'storage' : 'persistent', + 'vm' : true, }, ] diff --git a/test/TEST-83-BTRFS/meson.build b/test/TEST-83-BTRFS/meson.build index 8dec5f37e73..77370ce4588 100644 --- a/test/TEST-83-BTRFS/meson.build +++ b/test/TEST-83-BTRFS/meson.build @@ -3,5 +3,6 @@ integration_tests += [ integration_test_template + { 'name' : fs.name(meson.current_source_dir()), + 'vm' : true, }, ] diff --git a/test/TEST-84-STORAGETM/meson.build b/test/TEST-84-STORAGETM/meson.build index 8dec5f37e73..77370ce4588 100644 --- a/test/TEST-84-STORAGETM/meson.build +++ b/test/TEST-84-STORAGETM/meson.build @@ -3,5 +3,6 @@ integration_tests += [ integration_test_template + { 'name' : fs.name(meson.current_source_dir()), + 'vm' : true, }, ] diff --git a/test/TEST-85-NETWORK/meson.build b/test/TEST-85-NETWORK/meson.build index 629275883c4..47ec02940ee 100644 --- a/test/TEST-85-NETWORK/meson.build +++ b/test/TEST-85-NETWORK/meson.build @@ -25,6 +25,7 @@ foreach testcase : network_testcases 'systemd.setenv=TEST_MATCH_TESTCASE=@0@'.format(testcase) ], 'priority' : 10, + 'vm' : true, }, ] endforeach diff --git a/test/integration-test-wrapper.py b/test/integration-test-wrapper.py index c84296d8164..5b098a3e01f 100755 --- a/test/integration-test-wrapper.py +++ b/test/integration-test-wrapper.py @@ -48,6 +48,7 @@ def main(): parser.add_argument('--storage', required=True) parser.add_argument('--firmware', required=True) parser.add_argument('--slow', action=argparse.BooleanOptionalAction) + parser.add_argument('--vm', action=argparse.BooleanOptionalAction) parser.add_argument('--exit-code', required=True, type=int) parser.add_argument('mkosi_args', nargs="*") args = parser.parse_args() @@ -145,7 +146,7 @@ def main(): ), ]), '--credential', f"journal.storage={'persistent' if sys.stderr.isatty() else args.storage}", - 'qemu', + 'qemu' if args.vm or os.getuid() != 0 else 'boot', ] result = subprocess.run(cmd) diff --git a/test/meson.build b/test/meson.build index 5c15ade344c..92edd079b44 100644 --- a/test/meson.build +++ b/test/meson.build @@ -293,6 +293,7 @@ integration_test_template = { 'credentials' : [], 'qemu-args' : [], 'exit-code' : 123, + 'vm' : false, } testdata_subdirs = [ 'auxv', @@ -407,6 +408,10 @@ foreach integration_test : integration_tests integration_test_args += ['--slow'] endif + if integration_test['vm'] + integration_test_args += ['--vm'] + endif + if not mkosi.found() continue endif