FS/XFS testing framework
 help / color / mirror / Atom feed
* [PATCH] kvm-xfstests: fix running tests with non-primary filesystem type
@ 2017-05-01 17:03 Eric Biggers
  2017-05-02  4:41 ` Theodore Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Biggers @ 2017-05-01 17:03 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: fstests, Eric Biggers

From: Eric Biggers <ebiggers@google.com>

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.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 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

diff --git a/kvm-xfstests/test-appliance/files/etc/fstab b/kvm-xfstests/test-appliance/files/etc/fstab
index 0122c53..66dd392 100644
--- a/kvm-xfstests/test-appliance/files/etc/fstab
+++ b/kvm-xfstests/test-appliance/files/etc/fstab
@@ -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
diff --git a/kvm-xfstests/test-appliance/files/root/.bashrc b/kvm-xfstests/test-appliance/files/root/.bashrc
index 780af73..5938444 100644
--- a/kvm-xfstests/test-appliance/files/root/.bashrc
+++ b/kvm-xfstests/test-appliance/files/root/.bashrc
@@ -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
diff --git a/misc/Makefile.in b/misc/Makefile.in
index 572b91c..a71bd6d 100644
--- a/misc/Makefile.in
+++ b/misc/Makefile.in
@@ -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)
 
diff --git a/misc/setup-fstab b/misc/setup-fstab
deleted file mode 100755
index 99011bd..0000000
--- a/misc/setup-fstab
+++ /dev/null
@@ -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
-- 
2.13.0.rc0.306.g87b477812d-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] kvm-xfstests: fix running tests with non-primary filesystem type
  2017-05-01 17:03 [PATCH] kvm-xfstests: fix running tests with non-primary filesystem type Eric Biggers
@ 2017-05-02  4:41 ` Theodore Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2017-05-02  4:41 UTC (permalink / raw)
  To: Eric Biggers; +Cc: fstests, Eric Biggers

On Mon, May 01, 2017 at 10:03:58AM -0700, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> 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.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>

Thanks, applied.

					- Ted

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-05-02  4:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-01 17:03 [PATCH] kvm-xfstests: fix running tests with non-primary filesystem type Eric Biggers
2017-05-02  4:41 ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox