]>
Commit | Line | Data |
---|---|---|
ff12a795 | 1 | #!/usr/bin/env bash |
7b3cec95 | 2 | # SPDX-License-Identifier: LGPL-2.1-or-later |
818567fc | 3 | set -e |
3f161ba9 | 4 | |
898720b7 | 5 | TEST_DESCRIPTION="Basic systemd setup" |
8c3534b5 | 6 | IMAGE_NAME="basic" |
9103671d | 7 | RUN_IN_UNPRIVILEGED_CONTAINER=${RUN_IN_UNPRIVILEGED_CONTAINER:-yes} |
9d84eb20 | 8 | TEST_REQUIRE_INSTALL_TESTS=0 |
508a7f04 | 9 | TEST_SUPPORTING_SERVICES_SHOULD_BE_MASKED=0 |
898720b7 | 10 | |
06afda6b FS |
11 | # Check if we can correctly deserialize if the kernel cmdline contains "weird" stuff |
12 | # like an invalid argument, "end of arguments" separator, or a sysvinit argument (-z) | |
13 | # See: https://github.com/systemd/systemd/issues/28184 | |
14 | KERNEL_APPEND="foo -- -z bar --- baz $KERNEL_APPEND" | |
15 | ||
3f161ba9 FS |
16 | # shellcheck source=test/test-functions |
17 | . "${TEST_BASE_DIR:?}/test-functions" | |
898720b7 | 18 | |
d9e606e8 LB |
19 | test_append_files() { |
20 | # install tests manually so the test is functional even when -Dinstall-tests=false | |
3f161ba9 | 21 | local dst="${1:?}/usr/lib/systemd/tests/testdata/units/" |
59b8cb3c | 22 | mkdir -p "$dst" |
3f161ba9 | 23 | cp -v "$TEST_UNITS_DIR"/{testsuite-01,end}.service "$TEST_UNITS_DIR/testsuite.target" "$dst" |
898720b7 HH |
24 | } |
25 | ||
8256994c FS |
26 | # Setup a one shot service in initrd that creates a dummy bind mount under /run |
27 | # to check if the mount persists though the initrd transition. The "check" part | |
28 | # is in the respective testsuite-01.sh script. | |
29 | # | |
30 | # See: https://github.com/systemd/systemd/issues/28452 | |
31 | run_qemu_hook() { | |
32 | local extra="$WORKDIR/initrd.extra" | |
33 | ||
34 | mkdir -m 755 "$extra" | |
35 | mkdir -m 755 "$extra/etc" "$extra/etc/systemd" "$extra/etc/systemd/system" "$extra/etc/systemd/system/initrd.target.wants" | |
36 | ||
37 | cat >"$extra/etc/systemd/system/initrd-run-mount.service" <<EOF | |
38 | [Unit] | |
39 | Description=Create a mount in /run that should survive the transition from initrd | |
40 | ||
41 | [Service] | |
42 | Type=oneshot | |
43 | RemainAfterExit=yes | |
44 | ExecStart=sh -xec "mkdir /run/initrd-mount-source /run/initrd-mount-target; mount -v --bind /run/initrd-mount-source /run/initrd-mount-target" | |
45 | EOF | |
46 | ln -svrf "$extra/etc/systemd/system/initrd-run-mount.service" "$extra/etc/systemd/system/initrd.target.wants/initrd-run-mount.service" | |
47 | ||
48 | (cd "$extra" && find . | cpio -o -H newc -R root:root > "$extra.cpio") | |
49 | ||
50 | INITRD_EXTRA="$extra.cpio" | |
51 | } | |
52 | ||
c4cd6205 | 53 | do_test "$@" |