]>
Commit | Line | Data |
---|---|---|
0e9bb3f3 HH |
1 | #!/bin/bash |
2 | TEST_DESCRIPTION="root filesystem on LVM PV on a isw dmraid" | |
3 | ||
4 | KVERSION=${KVERSION-$(uname -r)} | |
5 | ||
6 | # Uncomment this to debug failures | |
07434861 | 7 | #DEBUGFAIL="rd.shell rd.break" |
cc97412c | 8 | #DEBUGFAIL="$DEBUGFAIL udev.log-priority=debug" |
0e9bb3f3 | 9 | |
0e9bb3f3 HH |
10 | client_run() { |
11 | echo "CLIENT TEST START: $@" | |
0be1785a HH |
12 | $testdir/run-qemu \ |
13 | -hda $TESTDIR/root.ext2 \ | |
14 | -hdb $TESTDIR/disk1 \ | |
15 | -hdc $TESTDIR/disk2 \ | |
16 | -m 256M -nographic \ | |
0e9bb3f3 | 17 | -net none -kernel /boot/vmlinuz-$KVERSION \ |
fa7ada31 | 18 | -append "$@ root=LABEL=root rw quiet rd.retry=5 rd.debug console=ttyS0,115200n81 selinux=0 rd.info $DEBUGFAIL" \ |
0be1785a HH |
19 | -initrd $TESTDIR/initramfs.testing |
20 | if ! grep -m 1 -q dracut-root-block-success $TESTDIR/root.ext2; then | |
0e9bb3f3 HH |
21 | echo "CLIENT TEST END: $@ [FAIL]" |
22 | return 1; | |
23 | fi | |
24 | ||
0be1785a | 25 | sed -i -e 's#dracut-root-block-success#dracut-root-block-xxxxxxx#' $TESTDIR/root.ext2 |
0e9bb3f3 HH |
26 | echo "CLIENT TEST END: $@ [OK]" |
27 | return 0 | |
28 | } | |
29 | ||
30 | test_run() { | |
0be1785a HH |
31 | echo "IMSM test does not work anymore" |
32 | return 1 | |
33 | ||
fa7ada31 | 34 | client_run rd.md.imsm || return 1 |
26fbe9a1 | 35 | client_run || return 1 |
fa7ada31 | 36 | client_run rd.dm=0 || return 1 |
26fbe9a1 HH |
37 | # This test succeeds, because the mirror parts are found without |
38 | # assembling the mirror itsself, which is what we want | |
fa7ada31 HH |
39 | client_run rd.md=0 rd.md.imsm failme && return 1 |
40 | client_run rd.md=0 failme && return 1 | |
cc97412c | 41 | # the following test hangs on newer md |
fa7ada31 | 42 | #client_run rd.dm=0 rd.md.imsm rd.md.conf=0 || return 1 |
2f02ae9d | 43 | return 0 |
0e9bb3f3 HH |
44 | } |
45 | ||
46 | test_setup() { | |
0be1785a HH |
47 | echo "IMSM test does not work anymore" |
48 | return 1 | |
49 | ||
0e9bb3f3 | 50 | # Create the blank file to use as a root filesystem |
0be1785a HH |
51 | rm -f $TESTDIR/root.ext2 |
52 | rm -f $TESTDIR/disk1 | |
53 | rm -f $TESTDIR/disk2 | |
54 | dd if=/dev/null of=$TESTDIR/root.ext2 bs=1M seek=1 | |
55 | dd if=/dev/null of=$TESTDIR/disk1 bs=1M seek=80 | |
56 | dd if=/dev/null of=$TESTDIR/disk2 bs=1M seek=80 | |
0e9bb3f3 HH |
57 | |
58 | kernel=$KVERSION | |
59 | # Create what will eventually be our root filesystem onto an overlay | |
60 | ( | |
0be1785a | 61 | initdir=$TESTDIR/overlay/source |
0e9bb3f3 HH |
62 | . $basedir/dracut-functions |
63 | dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \ | |
3b403b32 | 64 | /lib/terminfo/l/linux mount dmesg ifconfig dhclient mkdir cp ping dhclient |
0e9bb3f3 HH |
65 | inst "$basedir/modules.d/40network/dhclient-script" "/sbin/dhclient-script" |
66 | inst "$basedir/modules.d/40network/ifup" "/sbin/ifup" | |
67 | dracut_install grep | |
68 | inst ./test-init /sbin/init | |
69 | find_binary plymouth >/dev/null && dracut_install plymouth | |
70 | (cd "$initdir"; mkdir -p dev sys proc etc var/run tmp ) | |
8a080127 | 71 | cp -a /etc/ld.so.conf* $initdir/etc |
07434861 | 72 | mkdir $initdir/run |
8a080127 | 73 | sudo ldconfig -r "$initdir" |
0e9bb3f3 | 74 | ) |
3b403b32 | 75 | |
0e9bb3f3 HH |
76 | # second, install the files needed to make the root filesystem |
77 | ( | |
0be1785a | 78 | initdir=$TESTDIR/overlay |
0e9bb3f3 | 79 | . $basedir/dracut-functions |
3b403b32 | 80 | dracut_install sfdisk mke2fs poweroff cp umount |
0b53ca70 | 81 | inst_hook initqueue 01 ./create-root.sh |
778d2ba2 | 82 | inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules |
0e9bb3f3 | 83 | ) |
3b403b32 | 84 | |
0e9bb3f3 HH |
85 | # create an initramfs that will create the target root filesystem. |
86 | # We do it this way so that we do not risk trashing the host mdraid | |
87 | # devices, volume groups, encrypted partitions, etc. | |
0be1785a | 88 | $basedir/dracut -l -i $TESTDIR/overlay / \ |
0e9bb3f3 | 89 | -m "dash lvm mdraid dmraid udev-rules base rootfs-block kernel-modules" \ |
778d2ba2 | 90 | -d "piix ide-gd_mod ata_piix ext2 sd_mod dm-multipath dm-crypt dm-round-robin faulty linear multipath raid0 raid10 raid1 raid456" \ |
0be1785a HH |
91 | -f $TESTDIR/initramfs.makeroot $KVERSION || return 1 |
92 | rm -rf $TESTDIR/overlay | |
0e9bb3f3 | 93 | # Invoke KVM and/or QEMU to actually create the target filesystem. |
0be1785a HH |
94 | $testdir/run-qemu \ |
95 | -hda $TESTDIR/root.ext2 \ | |
96 | -hdb $TESTDIR/disk1 \ | |
97 | -hdc $TESTDIR/disk2 \ | |
98 | -m 256M -nographic -net none \ | |
0e9bb3f3 | 99 | -kernel "/boot/vmlinuz-$kernel" \ |
8eb16b08 | 100 | -append "root=/dev/dracut/root rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \ |
0be1785a HH |
101 | -initrd $TESTDIR/initramfs.makeroot || return 1 |
102 | grep -m 1 -q dracut-root-block-created $TESTDIR/root.ext2 || return 1 | |
0e9bb3f3 | 103 | ( |
0be1785a | 104 | initdir=$TESTDIR/overlay |
0e9bb3f3 HH |
105 | . $basedir/dracut-functions |
106 | dracut_install poweroff shutdown | |
0b53ca70 | 107 | inst_hook emergency 000 ./hard-off.sh |
778d2ba2 | 108 | inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules |
0e9bb3f3 | 109 | ) |
0be1785a | 110 | sudo $basedir/dracut -l -i $TESTDIR/overlay / \ |
9c111e59 | 111 | -o "plymouth network" \ |
0e9bb3f3 | 112 | -a "debug" \ |
778d2ba2 | 113 | -d "piix ide-gd_mod ata_piix ext2 sd_mod" \ |
0be1785a | 114 | -f $TESTDIR/initramfs.testing $KVERSION || return 1 |
0e9bb3f3 HH |
115 | } |
116 | ||
117 | test_cleanup() { | |
0be1785a | 118 | return 0 |
0e9bb3f3 HH |
119 | } |
120 | ||
121 | . $testdir/test-functions |