]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
test: introduce make_test_rootfs
authorBenjamin Drung <benjamin.drung@canonical.com>
Sat, 7 Feb 2026 22:58:52 +0000 (23:58 +0100)
committerNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
Sun, 8 Feb 2026 00:44:12 +0000 (19:44 -0500)
Test 72 NBD has the helper functions `make_client_rootfs` and
`make_server_rootfs` which makes the test easier to read.

Introduce `make_test_rootfs` for the simpler tests (where there are no
client/server).

test/TEST-11-USR-MOUNT/test.sh
test/TEST-26-ENC-RAID-LVM/test.sh

index 544573247bbda19d50711d08359b1ab4090801ff..fb4522fbe6d491b1d4199b14cad66118ff47e15c 100755 (executable)
@@ -41,7 +41,7 @@ test_run() {
     client_run "readonly root snapshot" "rd.fstab=0 subvol=snapshot-root"
 }
 
-test_setup() {
+make_test_rootfs() {
     # Create what will eventually be our root filesystem onto an overlay
     build_client_rootfs "$TESTDIR/overlay/source"
     echo "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root /usr btrfs subvol=usr,rw 0 2" \
@@ -72,7 +72,10 @@ test_setup() {
         echo "Could not create root filesystem"
         return 1
     fi
+}
 
+test_setup() {
+    make_test_rootfs
     test_dracut \
         --add-drivers "btrfs"
 }
index 642ce5d98f50d5a579a862570de0da54462040fd..babe0ba82b78df526a44369e1813180c2ea0588d 100755 (executable)
@@ -47,7 +47,7 @@ test_run() {
     return 0
 }
 
-test_setup() {
+make_test_rootfs() {
     # Create what will eventually be our root filesystem onto an overlay
     build_client_rootfs "$TESTDIR/overlay/source"
 
@@ -73,6 +73,11 @@ test_setup() {
         -initrd "$TESTDIR"/initramfs.makeroot
     test_marker_check dracut-root-block-created
     rm -rf "$TESTDIR"/overlay
+}
+
+test_setup() {
+    make_test_rootfs
+
     cryptoUUIDS=$(grep -F -a -m 3 ID_FS_UUID "$TESTDIR"/marker.img)
     for uuid in $cryptoUUIDS; do
         eval "$uuid"