]>
Commit | Line | Data |
---|---|---|
61a02cac HH |
1 | #!/bin/bash |
2 | TEST_DESCRIPTION="root filesystem on LVM PV with thin pool" | |
3 | ||
4 | KVERSION=${KVERSION-$(uname -r)} | |
5 | ||
6 | # Uncomment this to debug failures | |
7 | #DEBUGFAIL="rd.break rd.shell" | |
8 | ||
9 | test_run() { | |
10 | $testdir/run-qemu \ | |
4358ace4 | 11 | -drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 \ |
9b8e6e40 | 12 | -m 512M -smp 2 -nographic \ |
4358ace4 | 13 | -net none \ |
36867f1a HH |
14 | -no-reboot \ |
15 | -append "panic=1 root=/dev/dracut/root rw rd.auto=1 quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug rd.shell=0 $DEBUGFAIL" \ | |
61a02cac HH |
16 | -initrd $TESTDIR/initramfs.testing |
17 | grep -F -m 1 -q dracut-root-block-success $TESTDIR/root.ext2 || return 1 | |
18 | } | |
19 | ||
20 | test_setup() { | |
21 | # Create the blank file to use as a root filesystem | |
22 | dd if=/dev/null of=$TESTDIR/root.ext2 bs=1M seek=80 | |
23 | ||
24 | kernel=$KVERSION | |
25 | # Create what will eventually be our root filesystem onto an overlay | |
26 | ( | |
27 | export initdir=$TESTDIR/overlay/source | |
777f2db0 | 28 | . $basedir/dracut-init.sh |
06853123 HH |
29 | ( |
30 | cd "$initdir" | |
31 | mkdir -p -- dev sys proc etc var/run tmp | |
32 | mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin | |
33 | for i in bin sbin lib lib64; do | |
34 | ln -sfnr usr/$i $i | |
35 | done | |
36 | mkdir -p -- var/lib/nfs/rpc_pipefs | |
37 | ) | |
fd790546 DM |
38 | inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \ |
39 | mount dmesg dhclient mkdir cp ping dhclient | |
61a02cac HH |
40 | for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do |
41 | [ -f ${_terminfodir}/l/linux ] && break | |
42 | done | |
43 | inst_multiple -o ${_terminfodir}/l/linux | |
44 | inst "$basedir/modules.d/40network/dhclient-script.sh" "/sbin/dhclient-script" | |
45 | inst "$basedir/modules.d/40network/ifup.sh" "/sbin/ifup" | |
46 | inst_multiple grep | |
47 | inst_simple /etc/os-release | |
48 | inst ./test-init.sh /sbin/init | |
49 | find_binary plymouth >/dev/null && inst_multiple plymouth | |
61a02cac HH |
50 | cp -a /etc/ld.so.conf* $initdir/etc |
51 | mkdir $initdir/run | |
52 | sudo ldconfig -r "$initdir" | |
53 | ) | |
54 | ||
55 | # second, install the files needed to make the root filesystem | |
56 | ( | |
57 | export initdir=$TESTDIR/overlay | |
777f2db0 | 58 | . $basedir/dracut-init.sh |
61a02cac HH |
59 | inst_multiple sfdisk mke2fs poweroff cp umount |
60 | inst_hook initqueue 01 ./create-root.sh | |
61 | inst_hook initqueue/finished 01 ./finished-false.sh | |
62 | inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules | |
63 | ) | |
64 | ||
65 | # create an initramfs that will create the target root filesystem. | |
66 | # We do it this way so that we do not risk trashing the host mdraid | |
67 | # devices, volume groups, encrypted partitions, etc. | |
68 | $basedir/dracut.sh -l -i $TESTDIR/overlay / \ | |
eda73c0a | 69 | -m "dash lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules" \ |
61a02cac | 70 | -d "piix ide-gd_mod ata_piix ext2 sd_mod" \ |
e3e1f406 | 71 | --no-hostonly-cmdline -N \ |
61a02cac HH |
72 | -f $TESTDIR/initramfs.makeroot $KVERSION || return 1 |
73 | rm -rf -- $TESTDIR/overlay | |
74 | # Invoke KVM and/or QEMU to actually create the target filesystem. | |
9b8e6e40 | 75 | $testdir/run-qemu -drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 -m 512M -smp 2 -nographic -net none \ |
61a02cac HH |
76 | -append "root=/dev/fakeroot rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \ |
77 | -initrd $TESTDIR/initramfs.makeroot || return 1 | |
78 | grep -F -m 1 -q dracut-root-block-created $TESTDIR/root.ext2 || return 1 | |
79 | ( | |
80 | export initdir=$TESTDIR/overlay | |
777f2db0 | 81 | . $basedir/dracut-init.sh |
61a02cac | 82 | inst_multiple poweroff shutdown |
4e882b80 | 83 | inst_hook shutdown-emergency 000 ./hard-off.sh |
781f1971 | 84 | inst_hook emergency 000 ./hard-off.sh |
61a02cac HH |
85 | inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules |
86 | ) | |
87 | sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \ | |
e93d0bea | 88 | -o "plymouth network kernel-network-modules" \ |
61a02cac HH |
89 | -a "debug" -I lvs \ |
90 | -d "piix ide-gd_mod ata_piix ext2 sd_mod" \ | |
e3e1f406 | 91 | --no-hostonly-cmdline -N \ |
61a02cac HH |
92 | -f $TESTDIR/initramfs.testing $KVERSION || return 1 |
93 | } | |
94 | ||
95 | test_cleanup() { | |
96 | return 0 | |
97 | } | |
98 | ||
99 | . $testdir/test-functions |