]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
test: use build_ext4_image where possible
authorBenjamin Drung <benjamin.drung@canonical.com>
Tue, 27 Jan 2026 22:43:49 +0000 (23:43 +0100)
committerLaszlo <laszlo.gombos@gmail.com>
Wed, 28 Jan 2026 01:10:25 +0000 (20:10 -0500)
To speed up the test execution use `build_ext4_image` to build rootfs
ext4 images in cases where QEMU was only used to build an unencrypted
ext4 rootfs. This applies the improvement from commit 6e51e550abb8
("test(NFS): use build_ext4_image to build server rootfs") to all other
test cases.

15 files changed:
test/TEST-40-SYSTEMD/create-root.sh [deleted file]
test/TEST-40-SYSTEMD/test.sh
test/TEST-42-SYSTEMD-INITRD/create-root.sh [deleted file]
test/TEST-42-SYSTEMD-INITRD/test.sh
test/TEST-44-DRIVERS/create-root.sh [deleted file]
test/TEST-44-DRIVERS/test.sh
test/TEST-70-ISCSI/create-client-root.sh
test/TEST-70-ISCSI/create-server-root.sh [deleted file]
test/TEST-70-ISCSI/test.sh
test/TEST-71-ISCSI-MULTI/create-client-root.sh
test/TEST-71-ISCSI-MULTI/create-server-root.sh [deleted file]
test/TEST-71-ISCSI-MULTI/test.sh
test/TEST-72-NBD/create-client-root.sh [deleted file]
test/TEST-72-NBD/create-server-root.sh [deleted file]
test/TEST-72-NBD/test.sh

diff --git a/test/TEST-40-SYSTEMD/create-root.sh b/test/TEST-40-SYSTEMD/create-root.sh
deleted file mode 100755 (executable)
index db3c066..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-trap 'poweroff -f' EXIT
-set -e
-
-mkfs.ext4 -q -L '  rdinit=/bin/sh' /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root
-mkdir -p /root
-mount -t ext4 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root /root
-cp -a -t /root /source/*
-mkdir -p /root/run
-umount /root
-echo "dracut-root-block-created" | dd oflag=direct of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none
-sync /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker
-poweroff -f
index bad3975b7fe9e2bc2799df4e3ba0dd80d0293b57..efc9df5bc1bfe868eb43daa51708f771eea7a492 100755 (executable)
@@ -21,33 +21,11 @@ test_run() {
 }
 
 test_setup() {
-    # Create what will eventually be our root filesystem onto an overlay
+    # Create client root filesystem
     call_dracut --tmpdir "$TESTDIR" \
         --add-confdir test-root \
         -f "$TESTDIR"/initramfs.root
-    mkdir -p "$TESTDIR"/overlay/source
-    mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source
-    rm -rf "$TESTDIR"/dracut.*
-
-    # 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.
-    call_dracut -i "$TESTDIR"/overlay / \
-        --add-confdir "test-makeroot" \
-        -i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \
-        -f "$TESTDIR"/initramfs.makeroot
-
-    declare -a disk_args=()
-    qemu_add_drive disk_args "$TESTDIR"/marker.img marker 1
-    qemu_add_drive disk_args "$TESTDIR"/root.img root 1
-
-    # Invoke KVM and/or QEMU to actually create the target filesystem.
-    "$testdir"/run-qemu \
-        "${disk_args[@]}" \
-        -append "root=/dev/fakeroot quiet" \
-        -initrd "$TESTDIR"/initramfs.makeroot
-    test_marker_check dracut-root-block-created
-    rm -- "$TESTDIR"/marker.img
+    build_ext4_image "$TESTDIR"/dracut.*/initramfs/ "$TESTDIR"/root.img '  rdinit=/bin/sh'
 
     # systemd-analyze.sh calls man indirectly
     # make the man command succeed always
diff --git a/test/TEST-42-SYSTEMD-INITRD/create-root.sh b/test/TEST-42-SYSTEMD-INITRD/create-root.sh
deleted file mode 100755 (executable)
index b21bcc4..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-trap 'poweroff -f' EXIT
-set -e
-
-mkfs.ext4 -q -L dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root
-mkdir -p /root
-mount -t ext4 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root /root
-cp -a -t /root /source/*
-mkdir -p /root/run
-umount /root
-echo "dracut-root-block-created" | dd oflag=direct of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none
-sync /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker
-poweroff -f
index 8ed222c76e9654aab88b5413d0cb45a8a57fa8d3..57c7d422d5496957ce258481bc03d5ff1b861bdc 100755 (executable)
@@ -35,33 +35,11 @@ test_run() {
 }
 
 test_setup() {
-    # Create what will eventually be our root filesystem onto an overlay
+    # Create client root filesystem
     call_dracut --tmpdir "$TESTDIR" \
         --add-confdir test-root \
         -f "$TESTDIR"/initramfs.root
-    mkdir -p "$TESTDIR"/overlay/source
-    mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source
-    rm -rf "$TESTDIR"/dracut.*
-
-    # 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.
-    call_dracut -i "$TESTDIR"/overlay / \
-        --add-confdir test-makeroot \
-        -i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \
-        -f "$TESTDIR"/initramfs.makeroot
-
-    declare -a disk_args=()
-    qemu_add_drive disk_args "$TESTDIR"/marker.img marker 1
-    qemu_add_drive disk_args "$TESTDIR"/root.img root 1
-
-    # Invoke KVM and/or QEMU to actually create the target filesystem.
-    "$testdir"/run-qemu \
-        "${disk_args[@]}" \
-        -append "root=/dev/fakeroot quiet" \
-        -initrd "$TESTDIR"/initramfs.makeroot
-    test_marker_check dracut-root-block-created
-    rm -- "$TESTDIR"/marker.img
+    build_ext4_image "$TESTDIR"/dracut.*/initramfs/ "$TESTDIR"/root.img dracut
 
     # initrd for required kernel modules
     # Improve boot time by generating two initrds. Do not re-compress kernel modules
diff --git a/test/TEST-44-DRIVERS/create-root.sh b/test/TEST-44-DRIVERS/create-root.sh
deleted file mode 100755 (executable)
index 6c847f6..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-trap 'poweroff -f' EXIT
-set -e
-
-mkfs.ext4 -q -L dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root
-mkdir -p /root
-mount -t ext4 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root /root
-cp -a -t /root /source/*
-mkdir -p /root/run
-umount /root
-mkfs.xfs -q /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_mnt
-echo "dracut-root-block-created" | dd oflag=direct of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none
-sync /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker
-poweroff -f
index 9597fe4142bfef0e8ac600b69eff7c1f5ec8b755..da604c796407f6c4005a6231aba26c2c2bea18a1 100755 (executable)
@@ -31,7 +31,7 @@ test_run() {
 }
 
 test_setup() {
-    # Create what will eventually be our root filesystem onto an overlay
+    # Create client root filesystem
     call_dracut --tmpdir "$TESTDIR" \
         --no-kernel \
         --add "systemd-udevd systemd-journald systemd-tmpfiles systemd-ldconfig systemd-ask-password shutdown" \
@@ -48,27 +48,11 @@ test_setup() {
     # make sure /lib/modules directory exists inside the rootfs
     mkdir -p "$TESTDIR"/overlay/source/lib/modules "$TESTDIR"/overlay/source/mnt
 
-    # 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.
-    call_dracut -i "$TESTDIR"/overlay / \
-        --add-confdir "test-makeroot" \
-        -I "mkfs.xfs" \
-        -i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \
-        -f "$TESTDIR"/initramfs.makeroot
+    build_ext4_image "$TESTDIR/overlay/source" "$TESTDIR"/root.img dracut
 
-    declare -a disk_args=()
-    qemu_add_drive disk_args "$TESTDIR"/marker.img marker 1
-    qemu_add_drive disk_args "$TESTDIR"/root.img root 1
-    qemu_add_drive disk_args "$TESTDIR"/mnt.img mnt 1
-
-    # Invoke KVM and/or QEMU to actually create the target filesystem.
-    "$testdir"/run-qemu \
-        "${disk_args[@]}" \
-        -append "root=/dev/fakeroot quiet" \
-        -initrd "$TESTDIR"/initramfs.makeroot
-    test_marker_check dracut-root-block-created
-    rm -- "$TESTDIR"/marker.img
+    rm -f "$TESTDIR/mnt.img"
+    truncate -s 512M "$TESTDIR/mnt.img"
+    mkfs.xfs -q "$TESTDIR/mnt.img"
 
     test_dracut \
         --add-drivers xfs \
index e5944dea264573ed1dd0d8e9e24309858eb04923..93a4b6d1c4216614318e511a8562beac2953bc9c 100755 (executable)
@@ -3,11 +3,6 @@
 trap 'poweroff -f' EXIT
 set -ex
 
-mkfs.ext4 -q -L singleroot -F /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_singleroot
-mkdir -p /sysroot
-mount -t ext4 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_singleroot /sysroot
-cp -a -t /sysroot /source/*
-umount /sysroot
 mdadm --create /dev/md0 --run --level=stripe --raid-devices=2 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid0-1 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid0-2
 mdadm -W /dev/md0 || :
 lvm pvcreate -ff -y /dev/md0
diff --git a/test/TEST-70-ISCSI/create-server-root.sh b/test/TEST-70-ISCSI/create-server-root.sh
deleted file mode 100755 (executable)
index ba2178b..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-trap 'poweroff -f' EXIT
-mkfs.ext4 -q -L dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root
-mkdir -p /root
-mount -t ext4 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root /root
-cp -a -t /root /source/*
-mkdir -p /root/run
-umount /root
-echo "dracut-root-block-created" | dd oflag=direct of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none
-sync /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker
-poweroff -f
index 8a404b0f6a04a687a49755b4b27c7b3d10ea6c70..f6c09119a5e4b8e700013a463ca17c53f7aa1bd4 100755 (executable)
@@ -122,7 +122,7 @@ test_check() {
 }
 
 test_setup() {
-    # Create what will eventually be the client root filesystem onto an overlay
+    # Create client root filesystem
     call_dracut --tmpdir "$TESTDIR" \
         --add-confdir test-root \
         -I "ip grep setsid" \
@@ -134,6 +134,8 @@ test_setup() {
     mkdir -p -- "$TESTDIR"/overlay/source/var/lib/nfs/rpc_pipefs
     inst_init ./client-init.sh "$TESTDIR"/overlay/source
 
+    build_ext4_image "$TESTDIR/overlay/source" "$TESTDIR"/singleroot.img singleroot
+
     # 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.
@@ -147,7 +149,6 @@ test_setup() {
 
     declare -a disk_args=()
     qemu_add_drive disk_args "$TESTDIR"/marker.img marker 1
-    qemu_add_drive disk_args "$TESTDIR"/singleroot.img singleroot 1
     qemu_add_drive disk_args "$TESTDIR"/raid0-1.img raid0-1 1
     qemu_add_drive disk_args "$TESTDIR"/raid0-2.img raid0-2 1
 
@@ -159,7 +160,7 @@ test_setup() {
     test_marker_check dracut-root-block-created
     rm -- "$TESTDIR"/marker.img
 
-    # Create what will eventually be the server root filesystem onto an overlay
+    # Create server root filesystem
     call_dracut --tmpdir "$TESTDIR" \
         --add-confdir test-root \
         -a "$USE_NETWORK" \
@@ -175,26 +176,7 @@ test_setup() {
     mkdir -p "$TESTDIR"/overlay/source/var/lib/dhcpd
     inst_init ./server-init.sh "$TESTDIR"/overlay/source
 
-    # 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.
-    call_dracut -i "$TESTDIR"/overlay / \
-        --add-confdir test-makeroot \
-        -i ./create-server-root.sh /lib/dracut/hooks/initqueue/01-create-server-root.sh \
-        -f "$TESTDIR"/initramfs.makeroot
-    rm -rf -- "$TESTDIR"/overlay
-
-    declare -a disk_args=()
-    qemu_add_drive disk_args "$TESTDIR"/marker.img marker 1
-    qemu_add_drive disk_args "$TESTDIR"/server.img root 1
-
-    # Invoke KVM and/or QEMU to actually create the target filesystem.
-    "$testdir"/run-qemu \
-        "${disk_args[@]}" \
-        -append "root=/dev/dracut/root rw quiet" \
-        -initrd "$TESTDIR"/initramfs.makeroot
-    test_marker_check dracut-root-block-created
-    rm -- "$TESTDIR"/marker.img
+    build_ext4_image "$TESTDIR/overlay/source" "$TESTDIR"/server.img dracut
 
     # Make server's dracut image
     call_dracut \
index e5944dea264573ed1dd0d8e9e24309858eb04923..93a4b6d1c4216614318e511a8562beac2953bc9c 100755 (executable)
@@ -3,11 +3,6 @@
 trap 'poweroff -f' EXIT
 set -ex
 
-mkfs.ext4 -q -L singleroot -F /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_singleroot
-mkdir -p /sysroot
-mount -t ext4 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_singleroot /sysroot
-cp -a -t /sysroot /source/*
-umount /sysroot
 mdadm --create /dev/md0 --run --level=stripe --raid-devices=2 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid0-1 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid0-2
 mdadm -W /dev/md0 || :
 lvm pvcreate -ff -y /dev/md0
diff --git a/test/TEST-71-ISCSI-MULTI/create-server-root.sh b/test/TEST-71-ISCSI-MULTI/create-server-root.sh
deleted file mode 100755 (executable)
index ba2178b..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-trap 'poweroff -f' EXIT
-mkfs.ext4 -q -L dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root
-mkdir -p /root
-mount -t ext4 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root /root
-cp -a -t /root /source/*
-mkdir -p /root/run
-umount /root
-echo "dracut-root-block-created" | dd oflag=direct of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none
-sync /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker
-poweroff -f
index 81f94910cc40497d8ca5320bfcab9727135857f9..68184353bed41ef0ff454f0e7999bd528f6e9c25 100755 (executable)
@@ -130,7 +130,7 @@ test_check() {
 }
 
 test_setup() {
-    # Create what will eventually be our root filesystem onto an overlay
+    # Create client root filesystem
     rm -rf -- "$TESTDIR"/overlay
     call_dracut --keep --tmpdir "$TESTDIR" \
         --add-confdir test-root \
@@ -143,6 +143,8 @@ test_setup() {
     mkdir -p -- "$TESTDIR"/overlay/source/var/lib/nfs/rpc_pipefs
     inst_init ./client-init.sh "$TESTDIR"/overlay/source
 
+    build_ext4_image "$TESTDIR/overlay/source" "$TESTDIR"/singleroot.img singleroot
+
     # 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.
@@ -156,7 +158,6 @@ test_setup() {
 
     declare -a disk_args=()
     qemu_add_drive disk_args "$TESTDIR"/marker.img marker 1
-    qemu_add_drive disk_args "$TESTDIR"/singleroot.img singleroot 1
     qemu_add_drive disk_args "$TESTDIR"/raid0-1.img raid0-1 1
     qemu_add_drive disk_args "$TESTDIR"/raid0-2.img raid0-2 1
 
@@ -168,6 +169,7 @@ test_setup() {
     test_marker_check dracut-root-block-created
     rm -- "$TESTDIR"/marker.img
 
+    # Create server root filesystem
     rm -rf -- "$TESTDIR"/overlay
     call_dracut --tmpdir "$TESTDIR" \
         --add-confdir test-root \
@@ -185,26 +187,7 @@ test_setup() {
     mkdir -p -- "$TESTDIR"/overlay/source/var/lib/dhcpd "$TESTDIR"/overlay/source/etc/iscsi
     inst_init ./server-init.sh "$TESTDIR"/overlay/source
 
-    # 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.
-    call_dracut -i "$TESTDIR"/overlay / \
-        --add-confdir test-makeroot \
-        -i ./create-server-root.sh /lib/dracut/hooks/initqueue/01-create-server-root.sh \
-        -f "$TESTDIR"/initramfs.makeroot
-    rm -rf -- "$TESTDIR"/overlay
-
-    declare -a disk_args=()
-    qemu_add_drive disk_args "$TESTDIR"/marker.img marker 1
-    qemu_add_drive disk_args "$TESTDIR"/server.img root 1
-
-    # Invoke KVM and/or QEMU to actually create the target filesystem.
-    "$testdir"/run-qemu \
-        "${disk_args[@]}" \
-        -append "root=/dev/dracut/root rw rootfstype=ext4 quiet" \
-        -initrd "$TESTDIR"/initramfs.makeroot
-    test_marker_check dracut-root-block-created
-    rm -- "$TESTDIR"/marker.img
+    build_ext4_image "$TESTDIR/overlay/source" "$TESTDIR"/server.img dracut
 
     # Make client's dracut image
     test_dracut \
diff --git a/test/TEST-72-NBD/create-client-root.sh b/test/TEST-72-NBD/create-client-root.sh
deleted file mode 100755 (executable)
index 7ba15c1..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-
-trap 'poweroff -f' EXIT
-set -e
-
-mkfs.ext4 -q -L dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root
-mkdir -p /root
-mount -t ext4 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root /root
-cp -a -t /root /source/*
-mkdir -p /root/run
-umount /root
-{
-    echo "dracut-root-block-created"
-    echo "ID_FS_UUID=$ID_FS_UUID"
-} | dd oflag=direct of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none
-sync /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker
-poweroff -f
diff --git a/test/TEST-72-NBD/create-server-root.sh b/test/TEST-72-NBD/create-server-root.sh
deleted file mode 100755 (executable)
index 7ba15c1..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-
-trap 'poweroff -f' EXIT
-set -e
-
-mkfs.ext4 -q -L dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root
-mkdir -p /root
-mount -t ext4 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root /root
-cp -a -t /root /source/*
-mkdir -p /root/run
-umount /root
-{
-    echo "dracut-root-block-created"
-    echo "ID_FS_UUID=$ID_FS_UUID"
-} | dd oflag=direct of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none
-sync /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker
-poweroff -f
index e639f87c04ef4a557bf1927d9dff00e77c09126d..a3e9fa603a10954d66b9b3b5d2d20090d23641d2 100755 (executable)
@@ -220,24 +220,7 @@ make_client_root() {
     rm -rf "$TESTDIR"/dracut.*
     inst_init ./client-init.sh "$TESTDIR"/overlay/source
 
-    # 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.
-    call_dracut -i "$TESTDIR"/overlay / \
-        --add-confdir test-makeroot \
-        -i ./create-client-root.sh /lib/dracut/hooks/initqueue/01-create-client-root.sh \
-        -f "$TESTDIR"/initramfs.makeroot
-
-    declare -a disk_args=()
-    qemu_add_drive disk_args "$TESTDIR"/marker.img marker 1
-    qemu_add_drive disk_args "$TESTDIR"/unencrypted.img root 1
-
-    # Invoke KVM and/or QEMU to actually create the target filesystem.
-    "$testdir"/run-qemu \
-        "${disk_args[@]}" \
-        -append "root=/dev/dracut/root rw quiet" \
-        -initrd "$TESTDIR"/initramfs.makeroot
-    test_marker_check dracut-root-block-created
+    build_ext4_image "$TESTDIR/overlay/source" "$TESTDIR"/unencrypted.img dracut
     rm -fr "$TESTDIR"/overlay
 }
 
@@ -272,24 +255,7 @@ EOF
     mkdir -p -- "$TESTDIR"/overlay/source/var/lib/dhcpd "$TESTDIR"/overlay/source/etc/nbd-server
     inst_init ./server-init.sh "$TESTDIR"/overlay/source
 
-    # 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.
-    call_dracut -i "$TESTDIR"/overlay / \
-        --add-confdir test-makeroot \
-        -i ./create-server-root.sh /lib/dracut/hooks/initqueue/01-create-server-root.sh \
-        -f "$TESTDIR"/initramfs.makeroot
-
-    declare -a disk_args=()
-    qemu_add_drive disk_args "$TESTDIR"/marker.img marker 1
-    qemu_add_drive disk_args "$TESTDIR"/server.img root 1
-
-    # Invoke KVM and/or QEMU to actually create the target filesystem.
-    "$testdir"/run-qemu \
-        "${disk_args[@]}" \
-        -append "root=/dev/dracut/root rw rootfstype=ext4 quiet" \
-        -initrd "$TESTDIR"/initramfs.makeroot
-    test_marker_check dracut-root-block-created
+    build_ext4_image "$TESTDIR/overlay/source" "$TESTDIR"/server.img dracut
     rm -fr "$TESTDIR"/overlay
 }