|
Harald Hoyer |
c4a5a0 |
From ef9b54cfe652c19ad38f19bf4fd13a9e7a9705b2 Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
c4a5a0 |
From: Harald Hoyer <harald@redhat.com>
|
|
Harald Hoyer |
c4a5a0 |
Date: Sat, 30 Jun 2012 11:38:24 +0200
|
|
Harald Hoyer |
c4a5a0 |
Subject: [PATCH] new testsuite test TEST-03-USR-MOUNT
|
|
Harald Hoyer |
c4a5a0 |
|
|
Harald Hoyer |
c4a5a0 |
mounts /usr as a btrfs subvolume and should respect "rw" and "ro" kernel
|
|
Harald Hoyer |
c4a5a0 |
command line arguments properly.
|
|
Harald Hoyer |
c4a5a0 |
---
|
|
Harald Hoyer |
c4a5a0 |
test/TEST-03-USR-MOUNT/99-idesymlinks.rules | 8 ++
|
|
Harald Hoyer |
c4a5a0 |
test/TEST-03-USR-MOUNT/Makefile | 10 ++
|
|
Harald Hoyer |
c4a5a0 |
test/TEST-03-USR-MOUNT/create-root.sh | 29 ++++++
|
|
Harald Hoyer |
c4a5a0 |
test/TEST-03-USR-MOUNT/cryptroot-ask.sh | 6 ++
|
|
Harald Hoyer |
c4a5a0 |
test/TEST-03-USR-MOUNT/fstab | 2 +
|
|
Harald Hoyer |
c4a5a0 |
test/TEST-03-USR-MOUNT/hard-off.sh | 3 +
|
|
Harald Hoyer |
c4a5a0 |
test/TEST-03-USR-MOUNT/test-init.sh | 31 +++++++
|
|
Harald Hoyer |
c4a5a0 |
test/TEST-03-USR-MOUNT/test.sh | 132 +++++++++++++++++++++++++++
|
|
Harald Hoyer |
c4a5a0 |
8 files changed, 221 insertions(+)
|
|
Harald Hoyer |
c4a5a0 |
create mode 100644 test/TEST-03-USR-MOUNT/99-idesymlinks.rules
|
|
Harald Hoyer |
c4a5a0 |
create mode 100644 test/TEST-03-USR-MOUNT/Makefile
|
|
Harald Hoyer |
c4a5a0 |
create mode 100755 test/TEST-03-USR-MOUNT/create-root.sh
|
|
Harald Hoyer |
c4a5a0 |
create mode 100755 test/TEST-03-USR-MOUNT/cryptroot-ask.sh
|
|
Harald Hoyer |
c4a5a0 |
create mode 100644 test/TEST-03-USR-MOUNT/fstab
|
|
Harald Hoyer |
c4a5a0 |
create mode 100755 test/TEST-03-USR-MOUNT/hard-off.sh
|
|
Harald Hoyer |
c4a5a0 |
create mode 100755 test/TEST-03-USR-MOUNT/test-init.sh
|
|
Harald Hoyer |
c4a5a0 |
create mode 100755 test/TEST-03-USR-MOUNT/test.sh
|
|
Harald Hoyer |
c4a5a0 |
|
|
Harald Hoyer |
c4a5a0 |
diff --git a/test/TEST-03-USR-MOUNT/99-idesymlinks.rules b/test/TEST-03-USR-MOUNT/99-idesymlinks.rules
|
|
Harald Hoyer |
c4a5a0 |
new file mode 100644
|
|
Harald Hoyer |
c4a5a0 |
index 0000000..d557790
|
|
Harald Hoyer |
c4a5a0 |
--- /dev/null
|
|
Harald Hoyer |
c4a5a0 |
+++ b/test/TEST-03-USR-MOUNT/99-idesymlinks.rules
|
|
Harald Hoyer |
c4a5a0 |
@@ -0,0 +1,8 @@
|
|
Harald Hoyer |
c4a5a0 |
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hda", SYMLINK+="sda"
|
|
Harald Hoyer |
c4a5a0 |
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hda*", SYMLINK+="sda$env{MINOR}"
|
|
Harald Hoyer |
c4a5a0 |
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdb", SYMLINK+="sdb"
|
|
Harald Hoyer |
c4a5a0 |
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdb*", SYMLINK+="sdb$env{MINOR}"
|
|
Harald Hoyer |
c4a5a0 |
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdc", SYMLINK+="sdc"
|
|
Harald Hoyer |
c4a5a0 |
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdc*", SYMLINK+="sdc$env{MINOR}"
|
|
Harald Hoyer |
c4a5a0 |
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdd", SYMLINK+="sdd"
|
|
Harald Hoyer |
c4a5a0 |
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdd*", SYMLINK+="sdd$env{MINOR}"
|
|
Harald Hoyer |
c4a5a0 |
diff --git a/test/TEST-03-USR-MOUNT/Makefile b/test/TEST-03-USR-MOUNT/Makefile
|
|
Harald Hoyer |
c4a5a0 |
new file mode 100644
|
|
Harald Hoyer |
c4a5a0 |
index 0000000..bc0ddb6
|
|
Harald Hoyer |
c4a5a0 |
--- /dev/null
|
|
Harald Hoyer |
c4a5a0 |
+++ b/test/TEST-03-USR-MOUNT/Makefile
|
|
Harald Hoyer |
c4a5a0 |
@@ -0,0 +1,10 @@
|
|
Harald Hoyer |
c4a5a0 |
+all:
|
|
Harald Hoyer |
c4a5a0 |
+ @make -s --no-print-directory -C ../.. all
|
|
Harald Hoyer |
c4a5a0 |
+ @basedir=../.. testdir=../ ./test.sh --all
|
|
Harald Hoyer |
c4a5a0 |
+setup:
|
|
Harald Hoyer |
c4a5a0 |
+ @make --no-print-directory -C ../.. all
|
|
Harald Hoyer |
c4a5a0 |
+ @basedir=../.. testdir=../ ./test.sh --setup
|
|
Harald Hoyer |
c4a5a0 |
+clean:
|
|
Harald Hoyer |
c4a5a0 |
+ @basedir=../.. testdir=../ ./test.sh --clean
|
|
Harald Hoyer |
c4a5a0 |
+run:
|
|
Harald Hoyer |
c4a5a0 |
+ @basedir=../.. testdir=../ ./test.sh --run
|
|
Harald Hoyer |
c4a5a0 |
diff --git a/test/TEST-03-USR-MOUNT/create-root.sh b/test/TEST-03-USR-MOUNT/create-root.sh
|
|
Harald Hoyer |
c4a5a0 |
new file mode 100755
|
|
Harald Hoyer |
c4a5a0 |
index 0000000..6662bca
|
|
Harald Hoyer |
c4a5a0 |
--- /dev/null
|
|
Harald Hoyer |
c4a5a0 |
+++ b/test/TEST-03-USR-MOUNT/create-root.sh
|
|
Harald Hoyer |
c4a5a0 |
@@ -0,0 +1,29 @@
|
|
Harald Hoyer |
c4a5a0 |
+#!/bin/sh
|
|
Harald Hoyer |
c4a5a0 |
+# don't let udev and this script step on eachother's toes
|
|
Harald Hoyer |
c4a5a0 |
+for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
|
|
Harald Hoyer |
c4a5a0 |
+ > "/etc/udev/rules.d/$x"
|
|
Harald Hoyer |
c4a5a0 |
+done
|
|
Harald Hoyer |
c4a5a0 |
+rm /etc/lvm/lvm.conf
|
|
Harald Hoyer |
c4a5a0 |
+udevadm control --reload-rules
|
|
Harald Hoyer |
c4a5a0 |
+set -e
|
|
Harald Hoyer |
c4a5a0 |
+# save a partition at the beginning for future flagging purposes
|
|
Harald Hoyer |
c4a5a0 |
+sfdisk -C 5120 -H 2 -S 32 -L /dev/sda <
|
|
Harald Hoyer |
c4a5a0 |
+,16
|
|
Harald Hoyer |
c4a5a0 |
+,
|
|
Harald Hoyer |
c4a5a0 |
+EOF
|
|
Harald Hoyer |
c4a5a0 |
+
|
|
Harald Hoyer |
c4a5a0 |
+mkfs.btrfs -L dracut /dev/sda2
|
|
Harald Hoyer |
c4a5a0 |
+btrfs device scan /dev/sda2
|
|
Harald Hoyer |
c4a5a0 |
+mkdir -p /root
|
|
Harald Hoyer |
c4a5a0 |
+mount -t btrfs /dev/sda2 /root
|
|
Harald Hoyer |
c4a5a0 |
+btrfs subvolume create /root/usr
|
|
Harald Hoyer |
c4a5a0 |
+[ -d /root/usr ] || mkdir /root/usr
|
|
Harald Hoyer |
c4a5a0 |
+mount -t btrfs -o subvol=usr /dev/sda2 /root/usr
|
|
Harald Hoyer |
c4a5a0 |
+cp -a -t /root /source/*
|
|
Harald Hoyer |
c4a5a0 |
+mkdir -p /root/run
|
|
Harald Hoyer |
c4a5a0 |
+umount /root/usr
|
|
Harald Hoyer |
c4a5a0 |
+umount /root
|
|
Harald Hoyer |
c4a5a0 |
+echo "dracut-root-block-created" >/dev/sda1
|
|
Harald Hoyer |
c4a5a0 |
+sync
|
|
Harald Hoyer |
c4a5a0 |
+poweroff -f
|
|
Harald Hoyer |
c4a5a0 |
+
|
|
Harald Hoyer |
c4a5a0 |
diff --git a/test/TEST-03-USR-MOUNT/cryptroot-ask.sh b/test/TEST-03-USR-MOUNT/cryptroot-ask.sh
|
|
Harald Hoyer |
c4a5a0 |
new file mode 100755
|
|
Harald Hoyer |
c4a5a0 |
index 0000000..db27c5b
|
|
Harald Hoyer |
c4a5a0 |
--- /dev/null
|
|
Harald Hoyer |
c4a5a0 |
+++ b/test/TEST-03-USR-MOUNT/cryptroot-ask.sh
|
|
Harald Hoyer |
c4a5a0 |
@@ -0,0 +1,6 @@
|
|
Harald Hoyer |
c4a5a0 |
+#!/bin/sh
|
|
Harald Hoyer |
c4a5a0 |
+
|
|
Harald Hoyer |
c4a5a0 |
+[ -b /dev/mapper/$2 ] && exit 0
|
|
Harald Hoyer |
c4a5a0 |
+echo -n test >/keyfile
|
|
Harald Hoyer |
c4a5a0 |
+/sbin/cryptsetup luksOpen $1 $2
|
|
Harald Hoyer |
c4a5a0 |
+
|
|
Harald Hoyer |
c4a5a0 |
diff --git a/test/TEST-03-USR-MOUNT/fstab b/test/TEST-03-USR-MOUNT/fstab
|
|
Harald Hoyer |
c4a5a0 |
new file mode 100644
|
|
Harald Hoyer |
c4a5a0 |
index 0000000..0e0a0e0
|
|
Harald Hoyer |
c4a5a0 |
--- /dev/null
|
|
Harald Hoyer |
c4a5a0 |
+++ b/test/TEST-03-USR-MOUNT/fstab
|
|
Harald Hoyer |
c4a5a0 |
@@ -0,0 +1,2 @@
|
|
Harald Hoyer |
c4a5a0 |
+/dev/sda2 / btrfs defaults 0 0
|
|
Harald Hoyer |
c4a5a0 |
+/dev/sda2 /usr btrfs subvol=usr,ro 0 0
|
|
Harald Hoyer |
c4a5a0 |
diff --git a/test/TEST-03-USR-MOUNT/hard-off.sh b/test/TEST-03-USR-MOUNT/hard-off.sh
|
|
Harald Hoyer |
c4a5a0 |
new file mode 100755
|
|
Harald Hoyer |
c4a5a0 |
index 0000000..12c3d5a
|
|
Harald Hoyer |
c4a5a0 |
--- /dev/null
|
|
Harald Hoyer |
c4a5a0 |
+++ b/test/TEST-03-USR-MOUNT/hard-off.sh
|
|
Harald Hoyer |
c4a5a0 |
@@ -0,0 +1,3 @@
|
|
Harald Hoyer |
c4a5a0 |
+#!/bin/sh
|
|
Harald Hoyer |
c4a5a0 |
+getarg rd.shell || poweroff -f
|
|
Harald Hoyer |
c4a5a0 |
+getarg failme && poweroff -f
|
|
Harald Hoyer |
c4a5a0 |
diff --git a/test/TEST-03-USR-MOUNT/test-init.sh b/test/TEST-03-USR-MOUNT/test-init.sh
|
|
Harald Hoyer |
c4a5a0 |
new file mode 100755
|
|
Harald Hoyer |
c4a5a0 |
index 0000000..494313b
|
|
Harald Hoyer |
c4a5a0 |
--- /dev/null
|
|
Harald Hoyer |
c4a5a0 |
+++ b/test/TEST-03-USR-MOUNT/test-init.sh
|
|
Harald Hoyer |
c4a5a0 |
@@ -0,0 +1,31 @@
|
|
Harald Hoyer |
c4a5a0 |
+#!/bin/sh
|
|
Harald Hoyer |
c4a5a0 |
+>/dev/watchdog
|
|
Harald Hoyer |
c4a5a0 |
+export PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
|
Harald Hoyer |
c4a5a0 |
+strstr() { [ "${1#*$2*}" != "$1" ]; }
|
|
Harald Hoyer |
c4a5a0 |
+CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
|
|
Harald Hoyer |
c4a5a0 |
+plymouth --quit
|
|
Harald Hoyer |
c4a5a0 |
+exec </dev/console >/dev/console 2>&1
|
|
Harald Hoyer |
c4a5a0 |
+
|
|
Harald Hoyer |
c4a5a0 |
+ismounted() {
|
|
Harald Hoyer |
c4a5a0 |
+ while read a m a; do
|
|
Harald Hoyer |
c4a5a0 |
+ [ "$m" = "$1" ] && return 0
|
|
Harald Hoyer |
c4a5a0 |
+ done < /proc/mounts
|
|
Harald Hoyer |
c4a5a0 |
+ return 1
|
|
Harald Hoyer |
c4a5a0 |
+}
|
|
Harald Hoyer |
c4a5a0 |
+
|
|
Harald Hoyer |
c4a5a0 |
+if ismounted /usr; then
|
|
Harald Hoyer |
c4a5a0 |
+ echo "dracut-root-block-success" >/dev/sdb
|
|
Harald Hoyer |
c4a5a0 |
+fi
|
|
Harald Hoyer |
c4a5a0 |
+export TERM=linux
|
|
Harald Hoyer |
c4a5a0 |
+export PS1='initramfs-test:\w\$ '
|
|
Harald Hoyer |
c4a5a0 |
+[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab
|
|
Harald Hoyer |
c4a5a0 |
+[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
|
|
Harald Hoyer |
c4a5a0 |
+stty sane
|
|
Harald Hoyer |
c4a5a0 |
+echo "made it to the rootfs!"
|
|
Harald Hoyer |
c4a5a0 |
+if strstr "$CMDLINE" "rd.shell"; then
|
|
Harald Hoyer |
c4a5a0 |
+ strstr "$(setsid --help)" "control" && CTTY="-c"
|
|
Harald Hoyer |
c4a5a0 |
+ setsid $CTTY sh -i
|
|
Harald Hoyer |
c4a5a0 |
+fi
|
|
Harald Hoyer |
c4a5a0 |
+echo "Powering down."
|
|
Harald Hoyer |
c4a5a0 |
+mount -n -o remount,ro /
|
|
Harald Hoyer |
c4a5a0 |
+poweroff -f
|
|
Harald Hoyer |
c4a5a0 |
diff --git a/test/TEST-03-USR-MOUNT/test.sh b/test/TEST-03-USR-MOUNT/test.sh
|
|
Harald Hoyer |
c4a5a0 |
new file mode 100755
|
|
Harald Hoyer |
c4a5a0 |
index 0000000..34a120f
|
|
Harald Hoyer |
c4a5a0 |
--- /dev/null
|
|
Harald Hoyer |
c4a5a0 |
+++ b/test/TEST-03-USR-MOUNT/test.sh
|
|
Harald Hoyer |
c4a5a0 |
@@ -0,0 +1,132 @@
|
|
Harald Hoyer |
c4a5a0 |
+#!/bin/bash
|
|
Harald Hoyer |
c4a5a0 |
+
|
|
Harald Hoyer |
c4a5a0 |
+TEST_DESCRIPTION="root filesystem on a btrfs filesystem with /usr subvolume"
|
|
Harald Hoyer |
c4a5a0 |
+
|
|
Harald Hoyer |
c4a5a0 |
+KVERSION=${KVERSION-$(uname -r)}
|
|
Harald Hoyer |
c4a5a0 |
+
|
|
Harald Hoyer |
c4a5a0 |
+# Uncomment this to debug failures
|
|
Harald Hoyer |
c4a5a0 |
+#DEBUGFAIL="rd.shell rd.break"
|
|
Harald Hoyer |
c4a5a0 |
+
|
|
Harald Hoyer |
c4a5a0 |
+client_run() {
|
|
Harald Hoyer |
c4a5a0 |
+ local test_name="$1"; shift
|
|
Harald Hoyer |
c4a5a0 |
+ local client_opts="$*"
|
|
Harald Hoyer |
c4a5a0 |
+
|
|
Harald Hoyer |
c4a5a0 |
+ echo "CLIENT TEST START: $test_name"
|
|
Harald Hoyer |
c4a5a0 |
+
|
|
Harald Hoyer |
c4a5a0 |
+ dd if=/dev/zero of=$TESTDIR/result bs=1M count=1
|
|
Harald Hoyer |
c4a5a0 |
+ $testdir/run-qemu \
|
|
Harald Hoyer |
c4a5a0 |
+ -hda $TESTDIR/root.btrfs \
|
|
Harald Hoyer |
c4a5a0 |
+ -hdb $TESTDIR/result \
|
|
Harald Hoyer |
c4a5a0 |
+ -m 256M -nographic \
|
|
Harald Hoyer |
c4a5a0 |
+ -net none -kernel /boot/vmlinuz-$KVERSION \
|
|
Harald Hoyer |
c4a5a0 |
+ -watchdog ib700 -watchdog-action poweroff \
|
|
Harald Hoyer |
c4a5a0 |
+ -append "root=LABEL=dracut $client_opts quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL" \
|
|
Harald Hoyer |
c4a5a0 |
+ -initrd $TESTDIR/initramfs.testing
|
|
Harald Hoyer |
c4a5a0 |
+
|
|
Harald Hoyer |
c4a5a0 |
+ if (($? != 0)); then
|
|
Harald Hoyer |
c4a5a0 |
+ echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
|
|
Harald Hoyer |
c4a5a0 |
+ return 1
|
|
Harald Hoyer |
c4a5a0 |
+ fi
|
|
Harald Hoyer |
c4a5a0 |
+
|
|
Harald Hoyer |
c4a5a0 |
+ if ! grep -m 1 -q dracut-root-block-success $TESTDIR/result; then
|
|
Harald Hoyer |
c4a5a0 |
+ echo "CLIENT TEST END: $test_name [FAILED]"
|
|
Harald Hoyer |
c4a5a0 |
+ return 1
|
|
Harald Hoyer |
c4a5a0 |
+ fi
|
|
Harald Hoyer |
c4a5a0 |
+ echo "CLIENT TEST END: $test_name [OK]"
|
|
Harald Hoyer |
c4a5a0 |
+
|
|
Harald Hoyer |
c4a5a0 |
+}
|
|
Harald Hoyer |
c4a5a0 |
+
|
|
Harald Hoyer |
c4a5a0 |
+test_run() {
|
|
Harald Hoyer |
c4a5a0 |
+ client_run "no option specified, should fail" && return 1
|
|
Harald Hoyer |
c4a5a0 |
+ client_run "readonly root" "ro" || return 1
|
|
Harald Hoyer |
c4a5a0 |
+ client_run "writeable root" "rw" || return 1
|
|
Harald Hoyer |
c4a5a0 |
+ return 0
|
|
Harald Hoyer |
c4a5a0 |
+}
|
|
Harald Hoyer |
c4a5a0 |
+
|
|
Harald Hoyer |
c4a5a0 |
+test_setup() {
|
|
Harald Hoyer |
c4a5a0 |
+ rm -f $TESTDIR/root.btrfs
|
|
Harald Hoyer |
c4a5a0 |
+ # Create the blank file to use as a root filesystem
|
|
Harald Hoyer |
c4a5a0 |
+ dd if=/dev/null of=$TESTDIR/root.btrfs bs=1M seek=160
|
|
Harald Hoyer |
c4a5a0 |
+
|
|
Harald Hoyer |
c4a5a0 |
+ kernel=$KVERSION
|
|
Harald Hoyer |
c4a5a0 |
+ # Create what will eventually be our root filesystem onto an overlay
|
|
Harald Hoyer |
c4a5a0 |
+ (
|
|
Harald Hoyer |
c4a5a0 |
+ initdir=$TESTDIR/overlay/source
|
|
Harald Hoyer |
c4a5a0 |
+ mkdir -p $initdir
|
|
Harald Hoyer |
c4a5a0 |
+ . $basedir/dracut-functions.sh
|
|
Harald Hoyer |
c4a5a0 |
+ dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
|
|
Harald Hoyer |
c4a5a0 |
+ mount dmesg ifconfig dhclient mkdir cp ping dhclient \
|
|
Harald Hoyer |
c4a5a0 |
+ umount strace less setsid
|
|
Harald Hoyer |
c4a5a0 |
+ for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
|
|
Harald Hoyer |
c4a5a0 |
+ [ -f ${_terminfodir}/l/linux ] && break
|
|
Harald Hoyer |
c4a5a0 |
+ done
|
|
Harald Hoyer |
c4a5a0 |
+ dracut_install -o ${_terminfodir}/l/linux
|
|
Harald Hoyer |
c4a5a0 |
+ inst "$basedir/modules.d/40network/dhclient-script.sh" "/sbin/dhclient-script"
|
|
Harald Hoyer |
c4a5a0 |
+ inst "$basedir/modules.d/40network/ifup.sh" "/sbin/ifup"
|
|
Harald Hoyer |
c4a5a0 |
+ dracut_install grep
|
|
Harald Hoyer |
c4a5a0 |
+ inst_simple ./fstab /etc/fstab
|
|
Harald Hoyer |
c4a5a0 |
+ inst ./test-init.sh /sbin/init
|
|
Harald Hoyer |
c4a5a0 |
+ find_binary plymouth >/dev/null && dracut_install plymouth
|
|
Harald Hoyer |
c4a5a0 |
+ (cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
|
|
Harald Hoyer |
c4a5a0 |
+ cp -a /etc/ld.so.conf* $initdir/etc
|
|
Harald Hoyer |
c4a5a0 |
+ sudo ldconfig -r "$initdir"
|
|
Harald Hoyer |
c4a5a0 |
+ )
|
|
Harald Hoyer |
c4a5a0 |
+
|
|
Harald Hoyer |
c4a5a0 |
+ # second, install the files needed to make the root filesystem
|
|
Harald Hoyer |
c4a5a0 |
+ (
|
|
Harald Hoyer |
c4a5a0 |
+ initdir=$TESTDIR/overlay
|
|
Harald Hoyer |
c4a5a0 |
+ . $basedir/dracut-functions.sh
|
|
Harald Hoyer |
c4a5a0 |
+ dracut_install sfdisk mkfs.btrfs btrfs poweroff cp umount sync
|
|
Harald Hoyer |
c4a5a0 |
+ inst_hook initqueue 01 ./create-root.sh
|
|
Harald Hoyer |
c4a5a0 |
+ inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
|
|
Harald Hoyer |
c4a5a0 |
+ )
|
|
Harald Hoyer |
c4a5a0 |
+
|
|
Harald Hoyer |
c4a5a0 |
+ # create an initramfs that will create the target root filesystem.
|
|
Harald Hoyer |
c4a5a0 |
+ # We do it this way so that we do not risk trashing the host mdraid
|
|
Harald Hoyer |
c4a5a0 |
+ # devices, volume groups, encrypted partitions, etc.
|
|
Harald Hoyer |
c4a5a0 |
+ $basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
|
Harald Hoyer |
c4a5a0 |
+ -m "dash udev-rules btrfs base rootfs-block kernel-modules" \
|
|
Harald Hoyer |
c4a5a0 |
+ -d "piix ide-gd_mod ata_piix btrfs sd_mod" \
|
|
Harald Hoyer |
c4a5a0 |
+ --nomdadmconf \
|
|
Harald Hoyer |
c4a5a0 |
+ --nohardlink \
|
|
Harald Hoyer |
c4a5a0 |
+ -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
|
|
Harald Hoyer |
c4a5a0 |
+
|
|
Harald Hoyer |
c4a5a0 |
+ # Invoke KVM and/or QEMU to actually create the target filesystem.
|
|
Harald Hoyer |
c4a5a0 |
+
|
|
Harald Hoyer |
c4a5a0 |
+# echo $TESTDIR/overlay
|
|
Harald Hoyer |
c4a5a0 |
+# echo $TESTDIR/initramfs.makeroot
|
|
Harald Hoyer |
c4a5a0 |
+#exit 1
|
|
Harald Hoyer |
c4a5a0 |
+ rm -rf $TESTDIR/overlay
|
|
Harald Hoyer |
c4a5a0 |
+
|
|
Harald Hoyer |
c4a5a0 |
+ $testdir/run-qemu \
|
|
Harald Hoyer |
c4a5a0 |
+ -hda $TESTDIR/root.btrfs \
|
|
Harald Hoyer |
c4a5a0 |
+ -m 256M -nographic -net none \
|
|
Harald Hoyer |
c4a5a0 |
+ -kernel "/boot/vmlinuz-$kernel" \
|
|
Harald Hoyer |
c4a5a0 |
+ -append "root=/dev/dracut/root rw rootfstype=btrfs quiet console=ttyS0,115200n81 selinux=0" \
|
|
Harald Hoyer |
c4a5a0 |
+ -initrd $TESTDIR/initramfs.makeroot || return 1
|
|
Harald Hoyer |
c4a5a0 |
+ grep -m 1 -q dracut-root-block-created $TESTDIR/root.btrfs || return 1
|
|
Harald Hoyer |
c4a5a0 |
+
|
|
Harald Hoyer |
c4a5a0 |
+
|
|
Harald Hoyer |
c4a5a0 |
+ (
|
|
Harald Hoyer |
c4a5a0 |
+ initdir=$TESTDIR/overlay
|
|
Harald Hoyer |
c4a5a0 |
+ . $basedir/dracut-functions.sh
|
|
Harald Hoyer |
c4a5a0 |
+ dracut_install poweroff shutdown
|
|
Harald Hoyer |
c4a5a0 |
+ inst_hook emergency 000 ./hard-off.sh
|
|
Harald Hoyer |
c4a5a0 |
+ inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
|
|
Harald Hoyer |
c4a5a0 |
+ )
|
|
Harald Hoyer |
c4a5a0 |
+ sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
|
Harald Hoyer |
c4a5a0 |
+ -a "debug watchdog" \
|
|
Harald Hoyer |
c4a5a0 |
+ -o "network" \
|
|
Harald Hoyer |
c4a5a0 |
+ -d "piix ide-gd_mod ata_piix btrfs sd_mod ib700wdt" \
|
|
Harald Hoyer |
c4a5a0 |
+ -f $TESTDIR/initramfs.testing $KVERSION || return 1
|
|
Harald Hoyer |
c4a5a0 |
+
|
|
Harald Hoyer |
c4a5a0 |
+ rm -rf $TESTDIR/overlay
|
|
Harald Hoyer |
c4a5a0 |
+
|
|
Harald Hoyer |
c4a5a0 |
+# -o "plymouth network md dmraid multipath fips caps crypt btrfs resume dmsquash-live dm"
|
|
Harald Hoyer |
c4a5a0 |
+}
|
|
Harald Hoyer |
c4a5a0 |
+
|
|
Harald Hoyer |
c4a5a0 |
+test_cleanup() {
|
|
Harald Hoyer |
c4a5a0 |
+ return 0
|
|
Harald Hoyer |
c4a5a0 |
+}
|
|
Harald Hoyer |
c4a5a0 |
+
|
|
Harald Hoyer |
c4a5a0 |
+. $testdir/test-functions
|