From a128f03b305aebdce6a99a6b027c17ed58a1648e Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 3 Jul 2012 18:21:54 +0200
Subject: [PATCH] TEST-03-USR-MOUNT: change test to use a seperate disk
---
test/TEST-03-USR-MOUNT/create-root.sh | 14 ++++++++++++--
test/TEST-03-USR-MOUNT/fstab | 2 +-
test/TEST-03-USR-MOUNT/test-init.sh | 2 +-
test/TEST-03-USR-MOUNT/test.sh | 8 ++++++--
4 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/test/TEST-03-USR-MOUNT/create-root.sh b/test/TEST-03-USR-MOUNT/create-root.sh
index 6662bca..9a3e561 100755
--- a/test/TEST-03-USR-MOUNT/create-root.sh
+++ b/test/TEST-03-USR-MOUNT/create-root.sh
@@ -12,13 +12,23 @@ sfdisk -C 5120 -H 2 -S 32 -L /dev/sda <<EOF
,
EOF
+sfdisk -C 5120 -H 2 -S 32 -L /dev/sdb <<EOF
+,16
+,
+EOF
+
+
mkfs.btrfs -L dracut /dev/sda2
+mkfs.btrfs -L dracutusr /dev/sdb2
btrfs device scan /dev/sda2
+btrfs device scan /dev/sdb2
mkdir -p /root
mount -t btrfs /dev/sda2 /root
-btrfs subvolume create /root/usr
[ -d /root/usr ] || mkdir /root/usr
-mount -t btrfs -o subvol=usr /dev/sda2 /root/usr
+mount -t btrfs /dev/sdb2 /root/usr
+btrfs subvolume create /root/usr/usr
+umount /root/usr
+mount -t btrfs -o subvol=usr /dev/sdb2 /root/usr
cp -a -t /root /source/*
mkdir -p /root/run
umount /root/usr
diff --git a/test/TEST-03-USR-MOUNT/fstab b/test/TEST-03-USR-MOUNT/fstab
index 0e0a0e0..0cc3370 100644
--- a/test/TEST-03-USR-MOUNT/fstab
+++ b/test/TEST-03-USR-MOUNT/fstab
@@ -1,2 +1,2 @@
/dev/sda2 / btrfs defaults 0 0
-/dev/sda2 /usr btrfs subvol=usr,ro 0 0
+/dev/sdb2 /usr btrfs subvol=usr,ro 0 0
diff --git a/test/TEST-03-USR-MOUNT/test-init.sh b/test/TEST-03-USR-MOUNT/test-init.sh
index 494313b..63520ab 100755
--- a/test/TEST-03-USR-MOUNT/test-init.sh
+++ b/test/TEST-03-USR-MOUNT/test-init.sh
@@ -14,7 +14,7 @@ ismounted() {
}
if ismounted /usr; then
- echo "dracut-root-block-success" >/dev/sdb
+ echo "dracut-root-block-success" >/dev/sdc
fi
export TERM=linux
export PS1='initramfs-test:\w\$ '
diff --git a/test/TEST-03-USR-MOUNT/test.sh b/test/TEST-03-USR-MOUNT/test.sh
index 34a120f..d966c3c 100755
--- a/test/TEST-03-USR-MOUNT/test.sh
+++ b/test/TEST-03-USR-MOUNT/test.sh
@@ -16,7 +16,8 @@ client_run() {
dd if=/dev/zero of=$TESTDIR/result bs=1M count=1
$testdir/run-qemu \
-hda $TESTDIR/root.btrfs \
- -hdb $TESTDIR/result \
+ -hdb $TESTDIR/usr.btrfs \
+ -hdc $TESTDIR/result \
-m 256M -nographic \
-net none -kernel /boot/vmlinuz-$KVERSION \
-watchdog ib700 -watchdog-action poweroff \
@@ -37,7 +38,7 @@ client_run() {
}
test_run() {
- client_run "no option specified, should fail" && return 1
+ client_run "no option specified" || return 1
client_run "readonly root" "ro" || return 1
client_run "writeable root" "rw" || return 1
return 0
@@ -45,8 +46,10 @@ test_run() {
test_setup() {
rm -f $TESTDIR/root.btrfs
+ rm -f $TESTDIR/usr.btrfs
# Create the blank file to use as a root filesystem
dd if=/dev/null of=$TESTDIR/root.btrfs bs=1M seek=160
+ dd if=/dev/null of=$TESTDIR/usr.btrfs bs=1M seek=160
kernel=$KVERSION
# Create what will eventually be our root filesystem onto an overlay
@@ -100,6 +103,7 @@ test_setup() {
$testdir/run-qemu \
-hda $TESTDIR/root.btrfs \
+ -hdb $TESTDIR/usr.btrfs \
-m 256M -nographic -net none \
-kernel "/boot/vmlinuz-$kernel" \
-append "root=/dev/dracut/root rw rootfstype=btrfs quiet console=ttyS0,115200n81 selinux=0" \