2 # shellcheck disable=SC2034
3 TEST_DESCRIPTION
="root filesystem on a ext4 filesystem"
6 command -v systemctl
&> /dev
/null
9 # Uncomment this to debug failures
10 #DEBUGFAIL="rd.shell=1 rd.break=pre-mount"
12 declare -a disk_args
=()
13 declare -i disk_index
=0
14 qemu_add_drive_args disk_index disk_args
"$TESTDIR"/marker.img marker
15 qemu_add_drive_args disk_index disk_args
"$TESTDIR"/root.img root
20 -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=LABEL=dracut rw loglevel=77 systemd.log_level=debug systemd.log_target=console rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 init=/sbin/init rd.shell=0 $DEBUGFAIL" \
21 -initrd "$TESTDIR"/initramfs.testing ||
return 1
23 test_marker_check ||
return 1
27 # Create what will eventually be our root filesystem onto an overlay
28 "$DRACUT" -l --keep --tmpdir "$TESTDIR" \
30 -i .
/test-init.sh
/sbin
/init \
31 -i "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \
32 -i "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \
33 --no-hostonly --no-hostonly-cmdline --nomdadmconf --nohardlink \
34 -f "$TESTDIR"/initramfs.root
"$KVERSION" ||
return 1
35 mkdir
-p "$TESTDIR"/overlay
/source && mv "$TESTDIR"/dracut.
*/initramfs
/* "$TESTDIR"/overlay
/source && rm -rf "$TESTDIR"/dracut.
*
37 # second, install the files needed to make the root filesystem
38 # create an initramfs that will create the target root filesystem.
39 # We do it this way so that we do not risk trashing the host mdraid
40 # devices, volume groups, encrypted partitions, etc.
41 "$DRACUT" -l -i "$TESTDIR"/overlay
/ \
44 -i .
/create-root.sh
/lib
/dracut
/hooks
/initqueue
/01-create-root.sh \
46 --no-hostonly-cmdline -N \
47 -f "$TESTDIR"/initramfs.makeroot
"$KVERSION" ||
return 1
48 rm -rf -- "$TESTDIR"/overlay
50 declare -a disk_args
=()
51 declare -i disk_index
=0
52 qemu_add_drive_args disk_index disk_args
"$TESTDIR"/marker.img marker
1
53 qemu_add_drive_args disk_index disk_args
"$TESTDIR"/root.img root
80
55 # Invoke KVM and/or QEMU to actually create the target filesystem.
58 -append "root=/dev/fakeroot rw rootfstype=ext4 quiet console=ttyS0,115200n81 selinux=0" \
59 -initrd "$TESTDIR"/initramfs.makeroot ||
return 1
60 test_marker_check dracut-root-block-created ||
return 1
61 rm -- "$TESTDIR"/marker.img
63 # systemd-analyze.sh calls man indirectly
64 # make the man command succeed always
65 "$DRACUT" -l -i "$TESTDIR"/overlay
/ \
67 -o "network kernel-network-modules" \
68 -d "piix ide-gd_mod ata_piix ext4 sd_mod" \
69 -i .
/systemd-analyze.sh
/lib
/dracut
/hooks
/pre-pivot
/00-systemd-analyze.sh \
70 -i "/bin/true" "/usr/bin/man" \
71 --no-hostonly-cmdline -N \
72 -f "$TESTDIR"/initramfs.testing
"$KVERSION" ||
return 1
75 # shellcheck disable=SC1090
76 .
"$testdir"/test-functions