1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-25 18:50:18 +03:00

Merge pull request #33065 from DaanDeMeyer/nspawn

test: Run tests that don't need a vm in systemd-nspawn
This commit is contained in:
Daan De Meyer 2024-05-29 15:23:48 +02:00 committed by GitHub
commit aa6178058b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
33 changed files with 42 additions and 17 deletions

View File

@ -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

View File

@ -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

View File

@ -8,6 +8,3 @@ Distribution=centos
Repositories=epel
epel-next
hyperscale-packages-main
[Content]
Environment=SYSTEMD_REPART_MKFS_OPTIONS_EXT4="-O ^orphan_file"

View File

@ -3,9 +3,6 @@
[Match]
Distribution=centos
[Output]
RepartDirectories=mkosi.repart
[Content]
Packages=
rpmautospec-rpm-macros

View File

@ -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

View File

@ -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

View File

@ -2,7 +2,7 @@
[Partition]
Type=root
Format=btrfs
Format=ext4
CopyFiles=/
SizeMinBytes=8G
SizeMaxBytes=8G

View File

@ -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,
},
]

View File

@ -7,5 +7,6 @@ integration_tests += [
'rd.systemd.wants=initrd-run-mount.service',
],
'exit-code' : 124,
'vm' : true,
},
]

View File

@ -3,5 +3,6 @@
integration_tests += [
integration_test_template + {
'name' : fs.name(meson.current_source_dir()),
'vm' : true,
},
]

View File

@ -3,5 +3,6 @@
integration_tests += [
integration_test_template + {
'name' : fs.name(meson.current_source_dir()),
'vm' : true,
},
]

View File

@ -6,5 +6,6 @@ integration_tests += [
'timeout' : 3600,
'priority' : 50,
'slow' : true,
'vm' : true,
},
]

View File

@ -20,5 +20,6 @@ integration_tests += [
'mkosi-args' : integration_test_template['mkosi-args'] + [
'--runtime-size=11G',
],
'vm' : true,
},
]

View File

@ -3,5 +3,6 @@
integration_tests += [
integration_test_template + {
'name' : fs.name(meson.current_source_dir()),
'vm' : true,
},
]

View File

@ -3,6 +3,7 @@
integration_tests += [
integration_test_template + {
'name' : fs.name(meson.current_source_dir()),
'vm' : true,
},
]

View File

@ -3,5 +3,6 @@
integration_tests += [
integration_test_template + {
'name' : fs.name(meson.current_source_dir()),
'vm' : true,
},
]

View File

@ -6,5 +6,6 @@ integration_tests += [
'configuration' : integration_test_template['configuration'] + {
'memory-accounting' : 'yes',
},
'vm' : true,
},
]

View File

@ -3,5 +3,6 @@
integration_tests += [
integration_test_template + {
'name' : fs.name(meson.current_source_dir()),
'vm' : true,
},
]

View File

@ -3,5 +3,6 @@
integration_tests += [
integration_test_template + {
'name' : fs.name(meson.current_source_dir()),
'vm' : true,
},
]

View File

@ -3,5 +3,6 @@
integration_tests += [
integration_test_template + {
'name' : fs.name(meson.current_source_dir()),
'vm' : true,
},
]

View File

@ -6,5 +6,6 @@ integration_tests += [
'mkosi-args' : integration_test_template['mkosi-args'] + [
'--configure-script', meson.current_source_dir() / 'mkosi.configure',
],
'vm' : true,
},
]

View File

@ -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,
},
]

View File

@ -3,5 +3,6 @@
integration_tests += [
integration_test_template + {
'name' : fs.name(meson.current_source_dir()),
'vm' : true,
},
]

View File

@ -33,6 +33,7 @@ foreach testcase : [
'--configure-script', files('@0@.configure'.format(testcase)),
],
'priority' : 10,
'vm' : true,
},
]
endforeach

View File

@ -3,5 +3,6 @@
integration_tests += [
integration_test_template + {
'name' : fs.name(meson.current_source_dir()),
'vm' : true,
},
]

View File

@ -3,5 +3,6 @@
integration_tests += [
integration_test_template + {
'name' : fs.name(meson.current_source_dir()),
'vm' : true,
},
]

View File

@ -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,
},
]

View File

@ -6,5 +6,6 @@ integration_tests += [
'unit' : files('TEST-82-SOFTREBOOT.service'),
'cmdline' : ['systemd.set_credential=kernelcmdlinecred:uff'],
'storage' : 'persistent',
'vm' : true,
},
]

View File

@ -3,5 +3,6 @@
integration_tests += [
integration_test_template + {
'name' : fs.name(meson.current_source_dir()),
'vm' : true,
},
]

View File

@ -3,5 +3,6 @@
integration_tests += [
integration_test_template + {
'name' : fs.name(meson.current_source_dir()),
'vm' : true,
},
]

View File

@ -25,6 +25,7 @@ foreach testcase : network_testcases
'systemd.setenv=TEST_MATCH_TESTCASE=@0@'.format(testcase)
],
'priority' : 10,
'vm' : true,
},
]
endforeach

View File

@ -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)

View File

@ -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