]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
test(BTRFSRAID): make test 15 use the test dracut modules
authorLaszlo Gombos <laszlo.gombos@gmail.com>
Mon, 15 Apr 2024 01:10:24 +0000 (21:10 -0400)
committerNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
Wed, 17 Apr 2024 11:32:16 +0000 (07:32 -0400)
test/TEST-15-BTRFSRAID/finished-false.sh [deleted file]
test/TEST-15-BTRFSRAID/hard-off.sh [deleted file]
test/TEST-15-BTRFSRAID/test.sh

diff --git a/test/TEST-15-BTRFSRAID/finished-false.sh b/test/TEST-15-BTRFSRAID/finished-false.sh
deleted file mode 100755 (executable)
index ecdbef9..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-exit 1
diff --git a/test/TEST-15-BTRFSRAID/hard-off.sh b/test/TEST-15-BTRFSRAID/hard-off.sh
deleted file mode 100755 (executable)
index 01acb19..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-getargbool 0 rd.shell || poweroff -f
-getargbool 0 failme && poweroff -f
index 74817f7f501f86e8041c85fc7b0cfb707d5891a6..328fdd576cdcc062d0bcd354d5ae6e1c11610cf1 100755 (executable)
@@ -6,7 +6,6 @@ TEST_DESCRIPTION="root filesystem on multiple device btrfs"
 #DEBUGFAIL="rd.shell"
 test_run() {
     declare -a disk_args=()
-    # shellcheck disable=SC2034
     declare -i disk_index=0
     qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
     qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid-1.img raid1
@@ -28,58 +27,25 @@ test_setup() {
     rm -f -- "$DISKIMAGE"
     dd if=/dev/zero of="$DISKIMAGE" bs=1M count=1024
 
-    kernel=$KVERSION
     # Create what will eventually be our root filesystem onto an overlay
-    (
-        # shellcheck disable=SC2030
-        export initdir=$TESTDIR/overlay/source
-        # shellcheck disable=SC1090
-        . "$PKGLIBDIR"/dracut-init.sh
-        (
-            cd "$initdir" || exit
-            mkdir -p -- dev sys proc etc var/run tmp
-            mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin
-        )
-        inst_multiple sh df free ls shutdown poweroff stty cat ps ln \
-            mount dmesg mkdir cp sync dd
-        for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
-            [ -f ${_terminfodir}/l/linux ] && break
-        done
-        inst_multiple -o ${_terminfodir}/l/linux
-
-        inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
-        inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
-        inst_binary "${PKGLIBDIR}/dracut-util" "/usr/bin/dracut-util"
-        ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
-        ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"
-
-        inst_multiple grep
-        inst ./test-init.sh /sbin/init
-        inst_simple /etc/os-release
-        find_binary plymouth > /dev/null && inst_multiple plymouth
-        cp -a /etc/ld.so.conf* "$initdir"/etc
-        ldconfig -r "$initdir"
-    )
+    "$DRACUT" -l --keep --tmpdir "$TESTDIR" \
+        -m "test-root" \
+        -i ./test-init.sh /sbin/init \
+        -i "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \
+        -i "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \
+        --no-hostonly --no-hostonly-cmdline --nohardlink \
+        -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1
+    mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.*
 
     # second, install the files needed to make the root filesystem
-    (
-        # shellcheck disable=SC2031
-        # shellcheck disable=SC2030
-        export initdir=$TESTDIR/overlay
-        # shellcheck disable=SC1090
-        . "$PKGLIBDIR"/dracut-init.sh
-        inst_multiple sfdisk mkfs.btrfs poweroff cp umount dd sync
-        inst_hook initqueue 01 ./create-root.sh
-        inst_hook initqueue/finished 01 ./finished-false.sh
-    )
-
     # create an initramfs that will create the target root filesystem.
     # We do it this way so that we do not risk trashing the host mdraid
     # devices, volume groups, encrypted partitions, etc.
     "$DRACUT" -l -i "$TESTDIR"/overlay / \
-        -m "bash btrfs rootfs-block kernel-modules qemu" \
+        -m "test-makeroot bash btrfs rootfs-block kernel-modules" \
         -d "piix ide-gd_mod ata_piix btrfs sd_mod" \
-        --nomdadmconf \
+        -I "mkfs.btrfs" \
+        -i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \
         --no-hostonly-cmdline -N \
         -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
 
@@ -102,17 +68,8 @@ test_setup() {
 
     test_marker_check dracut-root-block-created || return 1
 
-    (
-        # shellcheck disable=SC2031
-        export initdir=$TESTDIR/overlay
-        # shellcheck disable=SC1090
-        . "$PKGLIBDIR"/dracut-init.sh
-        inst_multiple poweroff shutdown
-        inst_hook shutdown-emergency 000 ./hard-off.sh
-        inst_hook emergency 000 ./hard-off.sh
-    )
     "$DRACUT" -l -i "$TESTDIR"/overlay / \
-        -a "debug" \
+        -a "test" \
         -d "piix ide-gd_mod ata_piix btrfs sd_mod" \
         --no-hostonly-cmdline -N \
         -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1