2 TEST_DESCRIPTION
="root filesystem on LVM PV on a isw dmraid"
4 KVERSION
=${KVERSION-$(uname -r)}
6 # Uncomment this to debug failures
8 #DEBUGFAIL="$DEBUGFAIL udev.log-priority=debug"
11 echo "CLIENT TEST START: $@"
13 -drive format
=raw
,index
=0,media
=disk
,file=$TESTDIR/root.ext2 \
14 -drive format
=raw
,index
=1,media
=disk
,file=$TESTDIR/disk1 \
15 -drive format
=raw
,index
=2,media
=disk
,file=$TESTDIR/disk2 \
18 -append "$* root=LABEL=root rw debug rd.retry=5 rd.debug console=ttyS0,115200n81 selinux=0 rd.info $DEBUGFAIL" \
19 -initrd $TESTDIR/initramfs.testing
20 if ! grep -F -m 1 -q dracut-root-block-success
$TESTDIR/root.ext2
; then
21 echo "CLIENT TEST END: $@ [FAIL]"
25 sed -i -e 's#dracut-root-block-success#dracut-root-block-xxxxxxx#' $TESTDIR/root.ext2
26 echo "CLIENT TEST END: $@ [OK]"
31 read MD_UUID
< $TESTDIR/mduuid
32 client_run rd.auto rd.md.imsm
=0 ||
return 1
33 client_run rd.auto rd.md.uuid
=$MD_UUID rd.dm
=0 ||
return 1
34 # This test succeeds, because the mirror parts are found without
35 # assembling the mirror itsself, which is what we want
36 client_run rd.auto rd.md.uuid
=$MD_UUID rd.md
=0 rd.md.imsm failme
&& return 1
37 client_run rd.auto rd.md.uuid
=$MD_UUID rd.md
=0 failme
&& return 1
38 # the following test hangs on newer md
39 client_run rd.auto rd.md.uuid
=$MD_UUID rd.dm
=0 rd.md.imsm rd.md.conf
=0 ||
return 1
45 # Create the blank file to use as a root filesystem
46 rm -f -- $TESTDIR/root.ext2
47 rm -f -- $TESTDIR/disk1
48 rm -f -- $TESTDIR/disk2
49 dd if=/dev
/null of
=$TESTDIR/root.ext2 bs
=1M seek
=1
50 dd if=/dev
/null of
=$TESTDIR/disk1 bs
=1M seek
=80
51 dd if=/dev
/null of
=$TESTDIR/disk2 bs
=1M seek
=80
54 # Create what will eventually be our root filesystem onto an overlay
56 export initdir
=$TESTDIR/overlay
/source
57 .
$basedir/dracut-functions.sh
60 mkdir
-p -- dev sys proc etc var
/run tmp
61 mkdir
-p root usr
/bin usr
/lib usr
/lib64 usr
/sbin
62 for i
in bin sbin lib lib64
; do
66 inst_multiple sh df free
ls shutdown poweroff stty
cat ps
ln ip route \
67 mount dmesg ifconfig dhclient mkdir
cp ping dhclient
68 for _terminfodir
in /lib
/terminfo
/etc
/terminfo
/usr
/share
/terminfo
; do
69 [ -f ${_terminfodir}/l
/linux
] && break
71 inst_multiple
-o ${_terminfodir}/l
/linux
72 inst_simple
/etc
/os-release
73 inst
"$basedir/modules.d/40network/dhclient-script.sh" "/sbin/dhclient-script"
74 inst
"$basedir/modules.d/40network/ifup.sh" "/sbin/ifup"
76 inst .
/test-init.sh
/sbin
/init
77 find_binary plymouth
>/dev
/null
&& inst_multiple plymouth
78 cp -a /etc
/ld.so.conf
* $initdir/etc
80 sudo ldconfig
-r "$initdir"
83 # second, install the files needed to make the root filesystem
85 export initdir
=$TESTDIR/overlay
86 .
$basedir/dracut-functions.sh
87 inst_multiple sfdisk mke2fs poweroff
cp umount
grep
88 inst_hook initqueue
01 .
/create-root.sh
89 inst_simple .
/99-idesymlinks.rules
/etc
/udev
/rules.d
/99-idesymlinks.rules
92 # create an initramfs that will create the target root filesystem.
93 # We do it this way so that we do not risk trashing the host mdraid
94 # devices, volume groups, encrypted partitions, etc.
95 $basedir/dracut.sh
-l -i $TESTDIR/overlay
/ \
96 -m "dash lvm mdraid dmraid udev-rules base rootfs-block fs-lib kernel-modules" \
97 -d "piix ide-gd_mod ata_piix ext2 sd_mod dm-multipath dm-crypt dm-round-robin faulty linear multipath raid0 raid10 raid1 raid456" \
98 --no-hostonly-cmdline -N \
99 -f $TESTDIR/initramfs.makeroot
$KVERSION ||
return 1
100 rm -rf -- $TESTDIR/overlay
101 # Invoke KVM and/or QEMU to actually create the target filesystem.
103 -drive format
=raw
,index
=0,media
=disk
,file=$TESTDIR/root.ext2 \
104 -drive format
=raw
,index
=1,media
=disk
,file=$TESTDIR/disk1 \
105 -drive format
=raw
,index
=2,media
=disk
,file=$TESTDIR/disk2 \
106 -m 256M
-nographic -net none \
107 -append "root=/dev/dracut/root rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \
108 -initrd $TESTDIR/initramfs.makeroot ||
return 1
109 grep -F -m 1 -q dracut-root-block-created
$TESTDIR/root.ext2 ||
return 1
110 eval $
(grep -F --binary-files=text
-m 1 MD_UUID
$TESTDIR/root.ext2
)
111 echo $MD_UUID > $TESTDIR/mduuid
113 export initdir
=$TESTDIR/overlay
114 .
$basedir/dracut-functions.sh
115 inst_multiple poweroff shutdown
116 inst_hook emergency
000 .
/hard-off.sh
117 inst_simple .
/99-idesymlinks.rules
/etc
/udev
/rules.d
/99-idesymlinks.rules
119 sudo
$basedir/dracut.sh
-l -i $TESTDIR/overlay
/ \
120 -o "plymouth network kernel-network-modules" \
122 -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
123 --no-hostonly-cmdline -N \
124 -f $TESTDIR/initramfs.testing
$KVERSION ||
return 1
131 .
$testdir/test-functions