Skip to contentSkip to conversation

kvm-xfstests: fix running tests with non-primary filesystem type

PATCH Applied Eric Biggers 2 participants 2 messages May 1, 2017 – May 2, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvm-xfstests: fix running tests with non-primary filesystem type

From: Eric Biggers <[email protected]>

With kvm-xfstests, the 'setup-fstab' script would add entries for the test devices to /etc/fstab, using $PRIMARY_FSTYPE (default "ext4"). This was apparently intended only as a convenience to allow manually running commands like 'mount /vdb'. However, it was actually always executed because the appliance is configured to automatically start interactive login shells for 'root' on the extra serial ports. This broke running tests with filesystem types other than the "primary", since the wrong fsck program would run.

To fix this, instead use static fstab entries with fstype 'auto'. This makes fsck and mount auto-detect the filesystem type, so both the tests and interactive mounts will work regardless of filesystem type.

---
 kvm-xfstests/test-appliance/files/etc/fstab    |  8 ++++++
 kvm-xfstests/test-appliance/files/root/.bashrc | 10 ++++---
 misc/Makefile.in                               |  3 +--
 misc/setup-fstab                               | 36 --------------------------
 4 files changed, 16 insertions(+), 41 deletions(-)
 delete mode 100755 misc/setup-fstab
kvm-xfstests/test-appliance/files/etc/fstab +8 -0
index 0122c53..66dd392 100644
@@ -6,4 +6,12 @@ tmpfs		/tmp		tmpfs	mode=1777	0	0
 debugfs		/sys/kernel/debug debugfs defaults	0	0
 v_tmp		/vtmp	9p	trans=virtio,version=9p2000.L,noauto	0	0
 /dev/rootfs	/	ext4    noatime 0 1
+
+# Convenience entries for interactive mounting (e.g. 'mount /vdb')
+/dev/vdb	/vdb	auto	defaults,noauto		0	0
+/dev/vdc	/vdc	auto	defaults,noauto		0	0
+/dev/vdd	/vdd	auto	defaults,noauto		0	0
+/dev/vde	/vde	auto	defaults,noauto		0	0
+/dev/vdf	/vdf	auto	defaults,noauto		0	0
+
 /dev/vdg	/results ext4	defaults 0 2
kvm-xfstests/test-appliance/files/root/.bashrc +7 -3
index 780af73..5938444 100644
@@ -4,9 +4,13 @@ if [ "$PS1" ]; then
     . $HOME/test-config
     . $HOME/test-env
     /root/xfstests/bin/resize
-    if test -z "$RUN_ON_GCE"
-    then
-	/root/xfstests/bin/setup-fstab
+    if [ ! -e /dev/vdb ]; then
+	# for interactive mounting using the fstab entries
+	ln -s $PRI_TST_DEV /dev/vdb
+	ln -s $SM_SCR_DEV /dev/vdc
+	ln -s $SM_TST_DEV /dev/vdd
+	[ -n "$LG_SCR_DEV" ] && ln -s $LG_SCR_DEV /dev/vde
+	[ -n "$LG_TST_DEV" ] && ln -s $LG_TST_DEV /dev/vdf
     fi
     dmesg -n 8
 fi
misc/Makefile.in +1 -2
index 572b91c..a71bd6d 100644
@@ -14,8 +14,7 @@ LDFLAGS = @LDFLAGS@
 PROGS= fname_benchmark postmark resize syncfs
 SCRIPTS= encrypt-fname-benchmark \
 	encrypt-smoketest \
-	encrypt-test-revalidate \
-	setup-fstab
+	encrypt-test-revalidate
 
 all: $(PROGS)
 
misc/setup-fstab deleted +0 -36
deleted file mode 100755
index 99011bd..0000000
@@ -1,36 +0,0 @@
-#!/bin/sh
-
-. /root/test-config
-
-if [ ! -e /dev/vdb ]; then
-    ln -s $PRI_TST_DEV /dev/vdb
-    ln -s $SM_SCR_DEV /dev/vdc
-    ln -s $SM_TST_DEV /dev/vdd
-    [ -n "$LG_SCR_DEV" ] && ln -s $LG_SCR_DEV /dev/vde
-    [ -n "$LG_TST_DEV" ] && ln -s $LG_TST_DEV /dev/vdf
-fi
-
-mkdir -p /vdb /vdc /vdd /vde /vdf
-
-if test -z "$FS"
-then
-   FS="$FSTESTTYP"
-fi
-
-if test -z "$FS"
-then
-   FS=ext4
-fi
-
-if ! grep -q /dev/vdb /etc/fstab
-then
-   cat >> /etc/fstab << EOF
-/dev/vdb	/vdb	$FS	defaults 0 2
-/dev/vdc	/vdc	$FS	defaults 0 2
-/dev/vdd	/vdd	$FS	defaults 0 2
-/dev/vde	/vde	$FS	defaults 0 2
-/dev/vdf	/vdf	$FS	defaults 0 2
-EOF
-fi
-
-exit 0
Signature · 1 line
2.13.0.rc0.306.g87b477812d-goog
#1 lore raw
Quoted 11 lines · Eric Biggers

From: Eric Biggers <[email protected]>

With kvm-xfstests, the 'setup-fstab' script would add entries for the test devices to /etc/fstab, using $PRIMARY_FSTYPE (default "ext4"). This was apparently intended only as a convenience to allow manually running commands like 'mount /vdb'. However, it was actually always executed because the appliance is configured to automatically start interactive login shells for 'root' on the extra serial ports. This broke running tests with filesystem types other than the "primary", since the wrong fsck program would run.

Quoted 5 lines

To fix this, instead use static fstab entries with fstype 'auto'. This makes fsck and mount auto-detect the filesystem type, so both the tests and interactive mounts will work regardless of filesystem type.

Thanks, applied.

- Ted