3 TEST_DESCRIPTION
="root filesystem on a btrfs filesystem with /usr subvolume"
5 KVERSION
=${KVERSION-$(uname -r)}
7 # Uncomment this to debug failures
8 #DEBUGFAIL="rd.shell rd.break"
11 local test_name
="$1"; shift
12 local client_opts
="$*"
14 echo "CLIENT TEST START: $test_name"
16 dd if=/dev
/zero of
=$TESTDIR/result bs
=1M count
=1
18 -hda $TESTDIR/root.btrfs \
19 -hdb $TESTDIR/usr.btrfs \
20 -hdc $TESTDIR/result \
21 -m 256M
-smp 2 -nographic \
22 -net none
-kernel /boot
/vmlinuz-
$KVERSION \
23 -watchdog i6300esb
-watchdog-action poweroff \
24 -append "root=LABEL=dracut $client_opts quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL" \
25 -initrd $TESTDIR/initramfs.testing
28 echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
32 if ! grep -F -m 1 -q dracut-root-block-success
$TESTDIR/result
; then
33 echo "CLIENT TEST END: $test_name [FAILED]"
36 echo "CLIENT TEST END: $test_name [OK]"
41 client_run
"no option specified" ||
return 1
42 client_run
"readonly root" "ro" ||
return 1
43 client_run
"writeable root" "rw" ||
return 1
48 rm -f -- $TESTDIR/root.btrfs
49 rm -f -- $TESTDIR/usr.btrfs
50 # Create the blank file to use as a root filesystem
51 dd if=/dev
/null of
=$TESTDIR/root.btrfs bs
=1M seek
=160
52 dd if=/dev
/null of
=$TESTDIR/usr.btrfs bs
=1M seek
=160
55 # Create what will eventually be our root filesystem onto an overlay
57 export initdir
=$TESTDIR/overlay
/source
59 .
$basedir/dracut-functions.sh
60 inst_multiple sh df free
ls shutdown poweroff stty
cat ps
ln ip route \
61 mount dmesg ifconfig dhclient mkdir
cp ping dhclient \
62 umount strace
less setsid
63 for _terminfodir
in /lib
/terminfo
/etc
/terminfo
/usr
/share
/terminfo
; do
64 [ -f ${_terminfodir}/l
/linux
] && break
66 inst_multiple
-o ${_terminfodir}/l
/linux
67 inst
"$basedir/modules.d/40network/dhclient-script.sh" "/sbin/dhclient-script"
68 inst
"$basedir/modules.d/40network/ifup.sh" "/sbin/ifup"
70 inst_simple .
/fstab
/etc
/fstab
71 inst_simple
/etc
/os-release
72 inst .
/test-init.sh
/sbin
/init
73 find_binary plymouth
>/dev
/null
&& inst_multiple plymouth
74 (cd "$initdir"; mkdir
-p dev sys proc etc var
/run tmp
)
75 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 export initdir
=$TESTDIR/overlay
82 .
$basedir/dracut-functions.sh
83 inst_multiple sfdisk mkfs.btrfs btrfs poweroff
cp umount sync
84 inst_hook initqueue
01 .
/create-root.sh
85 inst_hook initqueue
/finished
01 .
/finished-false.sh
86 inst_simple .
/99-idesymlinks.rules
/etc
/udev
/rules.d
/99-idesymlinks.rules
89 # create an initramfs that will create the target root filesystem.
90 # We do it this way so that we do not risk trashing the host mdraid
91 # devices, volume groups, encrypted partitions, etc.
92 $basedir/dracut.sh
-l -i $TESTDIR/overlay
/ \
93 -m "dash udev-rules btrfs base rootfs-block kernel-modules" \
94 -d "piix ide-gd_mod ata_piix btrfs sd_mod" \
97 -f $TESTDIR/initramfs.makeroot
$KVERSION ||
return 1
99 # Invoke KVM and/or QEMU to actually create the target filesystem.
101 # echo $TESTDIR/overlay
102 # echo $TESTDIR/initramfs.makeroot
104 rm -rf -- $TESTDIR/overlay
107 -hda $TESTDIR/root.btrfs \
108 -hdb $TESTDIR/usr.btrfs \
109 -m 256M
-smp 2 -nographic -net none \
110 -kernel "/boot/vmlinuz-$kernel" \
111 -append "root=/dev/dracut/root rw rootfstype=btrfs quiet console=ttyS0,115200n81 selinux=0" \
112 -initrd $TESTDIR/initramfs.makeroot ||
return 1
113 grep -F -m 1 -q dracut-root-block-created
$TESTDIR/root.btrfs ||
return 1
117 export initdir
=$TESTDIR/overlay
118 .
$basedir/dracut-functions.sh
119 inst_multiple poweroff shutdown
120 inst_hook emergency
000 .
/hard-off.sh
121 inst_simple .
/99-idesymlinks.rules
/etc
/udev
/rules.d
/99-idesymlinks.rules
123 sudo
$basedir/dracut.sh
-l -i $TESTDIR/overlay
/ \
124 -a "debug watchdog" \
126 -d "piix ide-gd_mod ata_piix btrfs sd_mod i6300esb ib700wdt" \
127 -f $TESTDIR/initramfs.testing
$KVERSION ||
return 1
129 rm -rf -- $TESTDIR/overlay
131 # -o "plymouth network md dmraid multipath fips caps crypt btrfs resume dmsquash-live dm"
138 .
$testdir/test-functions