mirror of
https://github.com/systemd/systemd.git
synced 2025-03-28 02:50:16 +03:00
test: Enable TEST-08-INITRD on mkosi
This commit is contained in:
parent
deaa4fb41b
commit
b13b7978e7
22
mkosi.images/exitrd/mkosi.conf
Normal file
22
mkosi.images/exitrd/mkosi.conf
Normal file
@ -0,0 +1,22 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
[Config]
|
||||
ConfigureScripts=
|
||||
|
||||
[Output]
|
||||
Format=directory
|
||||
|
||||
[Content]
|
||||
Bootable=no
|
||||
@Locale=C.UTF-8
|
||||
WithDocs=no
|
||||
CleanPackageMetadata=yes
|
||||
MakeInitrd=yes
|
||||
|
||||
BuildSources=
|
||||
Packages=
|
||||
BuildPackages=
|
||||
VolatilePackages=
|
||||
|
||||
Packages=
|
||||
bash
|
34
mkosi.images/exitrd/mkosi.conf.d/10-arch.conf
Normal file
34
mkosi.images/exitrd/mkosi.conf.d/10-arch.conf
Normal file
@ -0,0 +1,34 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
[Match]
|
||||
Distribution=arch
|
||||
|
||||
[Content]
|
||||
Packages=
|
||||
systemd
|
||||
|
||||
RemoveFiles=
|
||||
# Arch Linux doesn't split their gcc-libs package so we manually remove
|
||||
# unneeded stuff here to make sure it doesn't end up in the image.
|
||||
/usr/lib/libgfortran.so*
|
||||
/usr/lib/libgo.so*
|
||||
/usr/lib/libgomp.so*
|
||||
/usr/lib/libgphobos.so*
|
||||
/usr/lib/libobjc.so*
|
||||
/usr/lib/libasan.so*
|
||||
/usr/lib/libtsan.so*
|
||||
/usr/lib/liblsan.so*
|
||||
/usr/lib/libubsan.so*
|
||||
/usr/lib/libstdc++.so*
|
||||
/usr/lib/libgdruntime.so*
|
||||
|
||||
# Remove all files that are only required for development.
|
||||
/usr/lib/*.a
|
||||
/usr/include/*
|
||||
|
||||
/usr/share/i18n/*
|
||||
/usr/share/hwdata/*
|
||||
/usr/share/iana-etc/*
|
||||
/usr/share/locale/*
|
||||
/usr/share/terminfo/*
|
||||
/usr/share/zoneinfo/*
|
9
mkosi.images/exitrd/mkosi.conf.d/10-centos-fedora.conf
Normal file
9
mkosi.images/exitrd/mkosi.conf.d/10-centos-fedora.conf
Normal file
@ -0,0 +1,9 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
[Match]
|
||||
Distribution=|centos
|
||||
Distribution=|fedora
|
||||
|
||||
[Content]
|
||||
Packages=
|
||||
systemd-standalone-shutdown
|
9
mkosi.images/exitrd/mkosi.conf.d/10-debian-ubuntu.conf
Normal file
9
mkosi.images/exitrd/mkosi.conf.d/10-debian-ubuntu.conf
Normal file
@ -0,0 +1,9 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
[Match]
|
||||
Distribution=|debian
|
||||
Distribution=|ubuntu
|
||||
|
||||
[Content]
|
||||
Packages=
|
||||
systemd
|
8
mkosi.images/exitrd/mkosi.conf.d/10-opensuse.conf
Normal file
8
mkosi.images/exitrd/mkosi.conf.d/10-opensuse.conf
Normal file
@ -0,0 +1,8 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
[Match]
|
||||
Distribution=opensuse
|
||||
|
||||
[Content]
|
||||
Packages=
|
||||
systemd
|
12
mkosi.images/exitrd/mkosi.extra/shutdown
Executable file
12
mkosi.images/exitrd/mkosi.extra/shutdown
Executable file
@ -0,0 +1,12 @@
|
||||
#!/usr/bin/bash
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
set -eux
|
||||
|
||||
EXIT_CODE=()
|
||||
|
||||
# Translate a successful exit code to 124 so that we can detect that the exitrd was actually used.
|
||||
if [[ "$*" == *"--exit-code=123"* ]]; then
|
||||
EXIT_CODE+=("--exit-code=124")
|
||||
fi
|
||||
|
||||
exec /usr/lib/systemd/systemd-shutdown "$@" "${EXIT_CODE[@]}"
|
@ -0,0 +1,11 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
[Unit]
|
||||
Description=Create a mount in /run that should survive the transition from initrd
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStart=mkdir /run/initrd-mount-source /run/initrd-mount-target
|
||||
ExecStart=mount -v --bind /run/initrd-mount-source /run/initrd-mount-target
|
||||
ExecStart=cp -v /etc/initrd-release /run/initrd-mount-target/hello-world
|
@ -2,6 +2,7 @@
|
||||
|
||||
[Config]
|
||||
Dependencies=
|
||||
exitrd
|
||||
minimal-base
|
||||
minimal-0
|
||||
minimal-1
|
||||
@ -24,6 +25,7 @@ ExtraTrees=
|
||||
%O/minimal-1.root-%a-verity.raw:/usr/share/minimal_1.verity
|
||||
%O/minimal-1.root-%a-verity-sig.raw:/usr/share/minimal_1.verity.sig
|
||||
%O/minimal-base:/usr/share/TEST-13-NSPAWN-container-template
|
||||
%O/exitrd:/exitrd
|
||||
|
||||
Packages=
|
||||
acl
|
||||
|
@ -3,6 +3,9 @@
|
||||
integration_tests += [
|
||||
integration_test_template + {
|
||||
'name' : fs.name(meson.current_source_dir()),
|
||||
'enabled' : false,
|
||||
'cmdline' : integration_test_template['cmdline'] + [
|
||||
'rd.systemd.wants=initrd-run-mount.service',
|
||||
],
|
||||
'exit-code' : 124,
|
||||
},
|
||||
]
|
||||
|
@ -47,6 +47,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('--exit-code', required=True, type=int)
|
||||
parser.add_argument('mkosi_args', nargs="*")
|
||||
args = parser.parse_args()
|
||||
|
||||
@ -148,13 +149,12 @@ def main():
|
||||
|
||||
result = subprocess.run(cmd)
|
||||
|
||||
# Return code 123 is the expected success code
|
||||
if result.returncode in (123, 77):
|
||||
if result.returncode in (args.exit_code, 77):
|
||||
# Do not keep journal files for tests that don't fail.
|
||||
if journal_file:
|
||||
journal_file.unlink(missing_ok=True)
|
||||
|
||||
exit(0 if result.returncode == 123 else 77)
|
||||
exit(0 if result.returncode == args.exit_code else 77)
|
||||
|
||||
if journal_file:
|
||||
ops = []
|
||||
|
@ -292,6 +292,7 @@ integration_test_template = {
|
||||
'cmdline' : [],
|
||||
'credentials' : [],
|
||||
'qemu-args' : [],
|
||||
'exit-code' : 123,
|
||||
}
|
||||
testdata_subdirs = [
|
||||
'auxv',
|
||||
@ -384,6 +385,7 @@ foreach integration_test : integration_tests
|
||||
'--name', integration_test['name'],
|
||||
'--storage', integration_test['storage'],
|
||||
'--firmware', integration_test['firmware'],
|
||||
'--exit-code', integration_test['exit-code'].to_string(),
|
||||
]
|
||||
|
||||
if 'unit' in integration_test
|
||||
|
Loading…
x
Reference in New Issue
Block a user