]> git.ipfire.org Git - thirdparty/dracut.git/blame - test/old.TEST-14-IMSM/test.sh
dracut-functions.sh: add find_mp_fsopts
[thirdparty/dracut.git] / test / old.TEST-14-IMSM / test.sh
CommitLineData
0e9bb3f3
HH
1#!/bin/bash
2TEST_DESCRIPTION="root filesystem on LVM PV on a isw dmraid"
3
4KVERSION=${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
10client_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 19 -initrd $TESTDIR/initramfs.testing
021b2fdd 20 if ! grep -F -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
30test_run() {
96d22bd7 31 client_run rd.md.imsm=0 || return 1
0be1785a 32 echo "IMSM test does not work anymore"
96d22bd7 33 return 0
26fbe9a1 34 client_run || return 1
fa7ada31 35 client_run rd.dm=0 || return 1
26fbe9a1
HH
36 # This test succeeds, because the mirror parts are found without
37 # assembling the mirror itsself, which is what we want
fa7ada31
HH
38 client_run rd.md=0 rd.md.imsm failme && return 1
39 client_run rd.md=0 failme && return 1
cc97412c 40 # the following test hangs on newer md
fa7ada31 41 #client_run rd.dm=0 rd.md.imsm rd.md.conf=0 || return 1
2f02ae9d 42 return 0
0e9bb3f3
HH
43}
44
45test_setup() {
96d22bd7
HH
46# echo "IMSM test does not work anymore"
47# return 1
0be1785a 48
0e9bb3f3 49 # Create the blank file to use as a root filesystem
32bd2fbb
HH
50 rm -f -- $TESTDIR/root.ext2
51 rm -f -- $TESTDIR/disk1
52 rm -f -- $TESTDIR/disk2
0be1785a
HH
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
0e9bb3f3
HH
56
57 kernel=$KVERSION
58 # Create what will eventually be our root filesystem onto an overlay
59 (
27fa6044 60 export initdir=$TESTDIR/overlay/source
552ecca6 61 . $basedir/dracut-functions.sh
af119460 62 inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip route \
96d22bd7
HH
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
66 done
af119460 67 inst_multiple -o ${_terminfodir}/l/linux
f0558da5
HH
68 inst "$basedir/modules.d/40network/dhclient-script.sh" "/sbin/dhclient-script"
69 inst "$basedir/modules.d/40network/ifup.sh" "/sbin/ifup"
af119460 70 inst_multiple grep
552ecca6 71 inst ./test-init.sh /sbin/init
af119460 72 find_binary plymouth >/dev/null && inst_multiple plymouth
0e9bb3f3 73 (cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
8a080127 74 cp -a /etc/ld.so.conf* $initdir/etc
07434861 75 mkdir $initdir/run
8a080127 76 sudo ldconfig -r "$initdir"
0e9bb3f3 77 )
3b403b32 78
0e9bb3f3
HH
79 # second, install the files needed to make the root filesystem
80 (
27fa6044 81 export initdir=$TESTDIR/overlay
552ecca6 82 . $basedir/dracut-functions.sh
af119460 83 inst_multiple sfdisk mke2fs poweroff cp umount
0b53ca70 84 inst_hook initqueue 01 ./create-root.sh
778d2ba2 85 inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
0e9bb3f3 86 )
3b403b32 87
0e9bb3f3
HH
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.
552ecca6 91 $basedir/dracut.sh -l -i $TESTDIR/overlay / \
0e9bb3f3 92 -m "dash lvm mdraid dmraid udev-rules base rootfs-block kernel-modules" \
778d2ba2 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" \
0be1785a 94 -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
32bd2fbb 95 rm -rf -- $TESTDIR/overlay
0e9bb3f3 96 # Invoke KVM and/or QEMU to actually create the target filesystem.
0be1785a
HH
97 $testdir/run-qemu \
98 -hda $TESTDIR/root.ext2 \
99 -hdb $TESTDIR/disk1 \
100 -hdc $TESTDIR/disk2 \
101 -m 256M -nographic -net none \
0e9bb3f3 102 -kernel "/boot/vmlinuz-$kernel" \
8eb16b08 103 -append "root=/dev/dracut/root rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \
0be1785a 104 -initrd $TESTDIR/initramfs.makeroot || return 1
021b2fdd 105 grep -F -m 1 -q dracut-root-block-created $TESTDIR/root.ext2 || return 1
0e9bb3f3 106 (
27fa6044 107 export initdir=$TESTDIR/overlay
552ecca6 108 . $basedir/dracut-functions.sh
af119460 109 inst_multiple poweroff shutdown
0b53ca70 110 inst_hook emergency 000 ./hard-off.sh
778d2ba2 111 inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
0e9bb3f3 112 )
552ecca6 113 sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
9c111e59 114 -o "plymouth network" \
0e9bb3f3 115 -a "debug" \
778d2ba2 116 -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
0be1785a 117 -f $TESTDIR/initramfs.testing $KVERSION || return 1
0e9bb3f3
HH
118}
119
120test_cleanup() {
0be1785a 121 return 0
0e9bb3f3
HH
122}
123
124. $testdir/test-functions