2 TEST_DESCRIPTION="root filesystem on LVM PV on a isw dmraid"
4 KVERSION=${KVERSION-$(uname -r)}
6 # Uncomment this to debug failures
7 #DEBUGFAIL="rd.shell rd.break"
8 #DEBUGFAIL="$DEBUGFAIL udev.log-priority=debug"
11 echo "CLIENT TEST START: $@"
13 -hda $TESTDIR/root.ext2 \
17 -net none -kernel /boot/vmlinuz-$KVERSION \
18 -append "$@ root=LABEL=root rw quiet rd.retry=5 rd.debug console=ttyS0,115200n81 selinux=0 rd.info $DEBUGFAIL" \
19 -initrd $TESTDIR/initramfs.testing
20 if ! grep -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 client_run rd.md.imsm=0 || return 1
32 echo "IMSM test does not work anymore"
34 client_run || return 1
35 client_run rd.dm=0 || return 1
36 # This test succeeds, because the mirror parts are found without
37 # assembling the mirror itsself, which is what we want
38 client_run rd.md=0 rd.md.imsm failme && return 1
39 client_run rd.md=0 failme && return 1
40 # the following test hangs on newer md
41 #client_run rd.dm=0 rd.md.imsm rd.md.conf=0 || return 1
46 # echo "IMSM test does not work anymore"
49 # Create the blank file to use as a root filesystem
50 rm -f $TESTDIR/root.ext2
53 dd if=/dev/null of=$TESTDIR/root.ext2 bs=1M seek=1
54 dd if=/dev/null of=$TESTDIR/disk1 bs=1M seek=80
55 dd if=/dev/null of=$TESTDIR/disk2 bs=1M seek=80
58 # Create what will eventually be our root filesystem onto an overlay
60 initdir=$TESTDIR/overlay/source
61 . $basedir/dracut-functions
62 dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
63 mount dmesg ifconfig dhclient mkdir cp ping dhclient
64 for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
65 [ -f ${_terminfodir}/l/linux ] && break
67 dracut_install -o ${_terminfodir}/l/linux
68 inst "$basedir/modules.d/40network/dhclient-script" "/sbin/dhclient-script"
69 inst "$basedir/modules.d/40network/ifup" "/sbin/ifup"
71 inst ./test-init /sbin/init
72 find_binary plymouth >/dev/null && dracut_install plymouth
73 (cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
74 cp -a /etc/ld.so.conf* $initdir/etc
76 sudo ldconfig -r "$initdir"
79 # second, install the files needed to make the root filesystem
81 initdir=$TESTDIR/overlay
82 . $basedir/dracut-functions
83 dracut_install sfdisk mke2fs poweroff cp umount
84 inst_hook initqueue 01 ./create-root.sh
85 inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
88 # create an initramfs that will create the target root filesystem.
89 # We do it this way so that we do not risk trashing the host mdraid
90 # devices, volume groups, encrypted partitions, etc.
91 $basedir/dracut -l -i $TESTDIR/overlay / \
92 -m "dash lvm mdraid dmraid udev-rules base rootfs-block kernel-modules" \
93 -d "piix ide-gd_mod ata_piix ext2 sd_mod dm-multipath dm-crypt dm-round-robin faulty linear multipath raid0 raid10 raid1 raid456" \
94 -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
95 rm -rf $TESTDIR/overlay
96 # Invoke KVM and/or QEMU to actually create the target filesystem.
98 -hda $TESTDIR/root.ext2 \
100 -hdc $TESTDIR/disk2 \
101 -m 256M -nographic -net none \
102 -kernel "/boot/vmlinuz-$kernel" \
103 -append "root=/dev/dracut/root rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \
104 -initrd $TESTDIR/initramfs.makeroot || return 1
105 grep -m 1 -q dracut-root-block-created $TESTDIR/root.ext2 || return 1
107 initdir=$TESTDIR/overlay
108 . $basedir/dracut-functions
109 dracut_install poweroff shutdown
110 inst_hook emergency 000 ./hard-off.sh
111 inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
113 sudo $basedir/dracut -l -i $TESTDIR/overlay / \
114 -o "plymouth network" \
116 -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
117 -f $TESTDIR/initramfs.testing $KVERSION || return 1
124 . $testdir/test-functions