]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: skip TEST-08-INITRD if systemd didn't run in the initrd
authorFrantisek Sumsal <frantisek@sumsal.cz>
Fri, 15 Dec 2023 10:04:39 +0000 (11:04 +0100)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Fri, 15 Dec 2023 15:51:25 +0000 (16:51 +0100)
This test requires systemd in the initrd, which is not the case in
mkinitrd-based initrds (Ubuntu/Debian).

Resolves: #30481

test/TEST-08-INITRD/test.sh
test/units/testsuite-08.sh

index 29fd1f78998d100bde164a8594e00cd06fa07a74..caa27f69fdf5c5eb63ce5d1ca39831f32414d6c1 100755 (executable)
@@ -44,8 +44,13 @@ EOF
 }
 
 check_result_qemu_hook() {
+    local workspace="${1:?}"
     local console_log="${TESTDIR:?}/console.log"
 
+    if [[ -e "$workspace/skipped" ]]; then
+        return 0
+    fi
+
     if [[ ! -e "$console_log" ]]; then
         dfatal "Missing console log - this shouldn't happen"
         return 1
index 9598c8ea0c219b44d0e338167eee6bfe410b27b4..5c6b4cee7908e124dcabc2d172390cc4110d5961 100755 (executable)
@@ -8,6 +8,14 @@ if systemd-detect-virt -qc; then
     exit 1
 fi
 
+# This test requires systemd to run in the initrd as well, which is not the case
+# for mkinitrd-based initrd (Ubuntu/Debian)
+if [[ "$(systemctl show -P InitRDTimestampMonotonic)" -eq 0 ]]; then
+    echo "systemd didn't run in the initrd, skipping the test"
+    touch /skipped
+    exit 0
+fi
+
 # We should've created a mount under /run in initrd (see the other half of the test)
 # that should've survived the transition from initrd to the real system
 test -d /run/initrd-mount-target