]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
test: add TEST-13-SYSROOT to cover --sysroot option
authorJames Le Cuirot <jlecuirot@microsoft.com>
Thu, 27 Mar 2025 16:44:30 +0000 (16:44 +0000)
committerNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
Sun, 4 May 2025 21:50:50 +0000 (17:50 -0400)
This really just uses the regular root filesystem but symlinked to
another directory. Ideally, this would use an image for a different
architecture, but that would be more intensive.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
.github/workflows/integration.yml
test/TEST-13-SYSROOT/Makefile [new file with mode: 0644]
test/TEST-13-SYSROOT/test.sh [new file with mode: 0755]

index 5d513baed64319f53a31fc0dd0bd9c982daa08d6..53000c0b25910501232d69a911c49360c961f8a2 100644 (file)
@@ -83,6 +83,7 @@ jobs:
                 test:
                     - "11"
                     - "12"
+                    - "13"
                     - "20"
                     - "23"
                     - "26"
diff --git a/test/TEST-13-SYSROOT/Makefile b/test/TEST-13-SYSROOT/Makefile
new file mode 100644 (file)
index 0000000..2dcab81
--- /dev/null
@@ -0,0 +1 @@
+-include ../Makefile.testdir
diff --git a/test/TEST-13-SYSROOT/test.sh b/test/TEST-13-SYSROOT/test.sh
new file mode 100755 (executable)
index 0000000..e0a2451
--- /dev/null
@@ -0,0 +1,37 @@
+#!/usr/bin/env bash
+set -e
+# shellcheck disable=SC2034
+TEST_DESCRIPTION="initramfs created from sysroot"
+
+test_run() {
+    declare -a disk_args=()
+    # shellcheck disable=SC2034  # disk_index used in qemu_add_drive
+    declare -i disk_index=0
+    qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker
+    qemu_add_drive disk_index disk_args "$TESTDIR"/root.img root
+
+    test_marker_reset
+
+    "$testdir"/run-qemu -nic none \
+        "${disk_args[@]}" \
+        -append "$TEST_KERNEL_CMDLINE" \
+        -initrd "$TESTDIR"/initramfs.testing
+
+    test_marker_check
+}
+
+test_setup() {
+    # create root filesystem
+    "$DRACUT" -N --keep --tmpdir "$TESTDIR" \
+        --add-confdir test-root \
+        -f "$TESTDIR"/initramfs.root "$KVERSION"
+
+    dd if=/dev/zero of="$TESTDIR"/root.img bs=200MiB count=1 status=none && sync
+    mkfs.ext4 -q -L dracut -d "$TESTDIR"/dracut.*/initramfs/ "$TESTDIR"/root.img && sync
+
+    ln -s / "$TESTDIR"/sysroot
+    test_dracut --sysroot "$TESTDIR"/sysroot
+}
+
+# shellcheck disable=SC1090
+. "$testdir"/test-functions