2 # shellcheck disable=SC2034
3 TEST_DESCRIPTION
="root filesystem on LVM PV on a isw dmraid"
5 # Uncomment this to debug failures
7 #DEBUGFAIL="$DEBUGFAIL udev.log-priority=debug"
10 echo "CLIENT TEST START: $*"
12 declare -a disk_args
=()
13 # shellcheck disable=SC2034
14 declare -i disk_index
=0
15 qemu_add_drive_args disk_index disk_args
"$TESTDIR"/marker.img marker
16 qemu_add_drive_args disk_index disk_args
"$TESTDIR"/disk-1.img disk1
17 qemu_add_drive_args disk_index disk_args
"$TESTDIR"/disk-2.img disk2
22 -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot $* root=LABEL=root rw debug rd.retry=5 rd.debug console=ttyS0,115200n81 selinux=0 rd.info rd.shell=0 $DEBUGFAIL" \
23 -initrd "$TESTDIR"/initramfs.testing ||
return 1
25 if ! test_marker_check
; then
26 echo "CLIENT TEST END: $* [FAIL]"
30 echo "CLIENT TEST END: $* [OK]"
35 read -r MD_UUID
< "$TESTDIR"/mduuid
36 if [[ -z $MD_UUID ]]; then
41 client_run rd.auto rd.md.imsm
=0 ||
return 1
42 client_run rd.md.uuid
="$MD_UUID" rd.dm
=0 ||
return 1
43 # This test succeeds, because the mirror parts are found without
44 # assembling the mirror itself, which is what we want
45 client_run rd.md.uuid
="$MD_UUID" rd.md
=0 rd.md.imsm failme
&& return 1
46 client_run rd.md.uuid
="$MD_UUID" rd.md
=0 failme
&& return 1
47 # the following test hangs on newer md
48 client_run rd.md.uuid
="$MD_UUID" rd.dm
=0 rd.md.imsm rd.md.conf
=0 ||
return 1
54 # Create what will eventually be our root filesystem onto an overlay
56 # shellcheck disable=SC2030
57 export initdir
=$TESTDIR/overlay
/source
58 # shellcheck disable=SC1090
59 .
"$PKGLIBDIR"/dracut-init.sh
62 mkdir
-p -- dev sys proc etc var
/run tmp
63 mkdir
-p root usr
/bin usr
/lib usr
/lib64 usr
/sbin
65 inst_multiple sh df free
ls shutdown poweroff stty
cat ps
ln \
66 mount dmesg mkdir
cp dd sync
67 for _terminfodir
in /lib
/terminfo
/etc
/terminfo
/usr
/share
/terminfo
; do
68 [ -f ${_terminfodir}/l
/linux
] && break
70 inst_multiple
-o ${_terminfodir}/l
/linux
71 inst_simple
/etc
/os-release
73 inst_simple
"${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
74 inst_simple
"${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
75 inst_binary
"${PKGLIBDIR}/dracut-util" "/usr/bin/dracut-util"
76 ln -s dracut-util
"${initdir}/usr/bin/dracut-getarg"
77 ln -s dracut-util
"${initdir}/usr/bin/dracut-getargs"
80 inst .
/test-init.sh
/sbin
/init
81 find_binary plymouth
> /dev
/null
&& inst_multiple plymouth
82 cp -a /etc
/ld.so.conf
* "$initdir"/etc
83 mkdir
-p "$initdir"/run
84 ldconfig
-r "$initdir"
87 # second, install the files needed to make the root filesystem
89 # shellcheck disable=SC2030
90 # shellcheck disable=SC2031
91 export initdir
=$TESTDIR/overlay
92 # shellcheck disable=SC1090
93 .
"$PKGLIBDIR"/dracut-init.sh
94 inst_multiple sfdisk mkfs.ext4 poweroff
cp umount
grep dd sync realpath
95 inst_hook initqueue
01 .
/create-root.sh
98 # create an initramfs that will create the target root filesystem.
99 # We do it this way so that we do not risk trashing the host mdraid
100 # devices, volume groups, encrypted partitions, etc.
101 "$DRACUT" -l -i "$TESTDIR"/overlay
/ \
102 -m "bash lvm mdraid dmraid kernel-modules qemu" \
103 -d "piix ide-gd_mod ata_piix ext4 sd_mod dm-multipath dm-crypt dm-round-robin faulty linear multipath raid0 raid10 raid1 raid456" \
104 --no-hostonly-cmdline -N \
105 -f "$TESTDIR"/initramfs.makeroot
"$KVERSION" ||
return 1
106 rm -rf -- "$TESTDIR"/overlay
108 # Create the blank files to use as a root filesystem
109 declare -a disk_args
=()
110 # shellcheck disable=SC2034
111 declare -i disk_index
=0
112 qemu_add_drive_args disk_index disk_args
"$TESTDIR"/marker.img marker
1
113 qemu_add_drive_args disk_index disk_args
"$TESTDIR"/disk-1.img disk1
100
114 qemu_add_drive_args disk_index disk_args
"$TESTDIR"/disk-2.img disk2
100
116 # Invoke KVM and/or QEMU to actually create the target filesystem.
117 "$testdir"/run-qemu \
119 -append "root=/dev/dracut/root rw rootfstype=ext4 quiet console=ttyS0,115200n81 selinux=0" \
120 -initrd "$TESTDIR"/initramfs.makeroot ||
return 1
121 test_marker_check dracut-root-block-created ||
return 1
122 eval "$(grep -F --binary-files=text -m 1 MD_UUID "$TESTDIR"/marker.img)"
124 if [[ -z $MD_UUID ]]; then
129 echo "$MD_UUID" > "$TESTDIR"/mduuid
131 # shellcheck disable=SC2031
132 export initdir
=$TESTDIR/overlay
133 # shellcheck disable=SC1090
134 .
"$PKGLIBDIR"/dracut-init.sh
135 inst_multiple poweroff shutdown
136 inst_hook shutdown-emergency
000 .
/hard-off.sh
137 inst_hook emergency
000 .
/hard-off.sh
139 "$DRACUT" -l -i "$TESTDIR"/overlay
/ \
140 -o "plymouth network kernel-network-modules" \
142 -d "piix ide-gd_mod ata_piix ext4 sd_mod" \
143 --no-hostonly-cmdline -N \
144 -f "$TESTDIR"/initramfs.testing
"$KVERSION" ||
return 1
147 # shellcheck disable=SC1090
148 .
"$testdir"/test-functions