public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] kvm-xfstests: add virtfs/9p test support
@ 2018-03-30  2:10 Eryu Guan
  2018-03-30  2:10 ` [PATCH 2/2] test-appliance: add virtfs/9p test configs Eryu Guan
  0 siblings, 1 reply; 3+ messages in thread
From: Eryu Guan @ 2018-03-30  2:10 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: fstests, Eryu Guan

Add 9p test support, introduce three new configurable variables

- VIRTFS_TEST_PATH: path to be exported to kvm guest as TEST_DEV
- VIRTFS_SCRATCH_PATH: path to be exported to kvm guest as SCRATCH_DEV
- VIRTFS_MODEL: security model, "none" as default

The mount tags in guest are 9ptest and 9pscratch.

Signed-off-by: Eryu Guan <eguan@linux.alibaba.com>
---
 kvm-xfstests/config.kvm                            |  5 +++++
 kvm-xfstests/kvm-xfstests                          | 19 +++++++++++++++++--
 kvm-xfstests/test-appliance/files/root/runtests.sh |  2 +-
 kvm-xfstests/util/parse_cli                        | 12 ++++++++++++
 4 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/kvm-xfstests/config.kvm b/kvm-xfstests/config.kvm
index a08236fdc11e..fc20a1497ed5 100644
--- a/kvm-xfstests/config.kvm
+++ b/kvm-xfstests/config.kvm
@@ -48,3 +48,8 @@ CONSOLE=" -serial mon:stdio"
 # Native AIO is probably better for our goal which is test proofing
 # production systems.
 AIO=",aio=native"
+
+# Exported test/scratch dirs for 9p test in kvm guest, and virtfs security model
+#VIRTFS_TEST_PATH=/tmp/9ptest
+#VIRTFS_SCRATCH_PATH=/tmp/9pscratch
+#VIRTFS_MODEL=mapped
diff --git a/kvm-xfstests/kvm-xfstests b/kvm-xfstests/kvm-xfstests
index ccc8ae96fc8e..a02beab80e71 100755
--- a/kvm-xfstests/kvm-xfstests
+++ b/kvm-xfstests/kvm-xfstests
@@ -78,6 +78,22 @@ fi
 if test -z "$VIRTFS_PATH"; then
     VIRTFS_PATH=/tmp/kvm-xfstests-$USER
 fi
+VIRTFS="-fsdev local,id=v_tmp,path=$VIRTFS_PATH,security_model=none "
+VIRTFS+="-device virtio-9p-pci,fsdev=v_tmp,mount_tag=v_tmp "
+
+if test -z "$VIRTFS_MODEL"; then
+    VIRTFS_MODEL=none
+fi
+if test -n "$VIRTFS_TEST_PATH"; then
+    VIRTFS+="-fsdev local,id=p9test,path=$VIRTFS_TEST_PATH,"
+    VIRTFS+="security_model=$VIRTFS_MODEL "
+    VIRTFS+="-device virtio-9p-pci,fsdev=p9test,mount_tag=9ptest "
+fi
+if test -n "$VIRTFS_SCRATCH_PATH"; then
+    VIRTFS+=" -fsdev local,id=p9scratch,path=$VIRTFS_SCRATCH_PATH,"
+    VIRTFS+="security_model=$VIRTFS_MODEL "
+    VIRTFS+="-device virtio-9p-pci,fsdev=p9scratch,mount_tag=9pscratch "
+fi
 
 VDH=$(mktemp /tmp/kvm-upload.XXXXXXXX)
 trap 'rm -f "$VDH"' 0
@@ -119,8 +135,7 @@ $NO_ACTION $IONICE $QEMU -boot order=c $NET \
 	-drive file=$VDG,cache=none,if=virtio,format=raw$AIO \
 	-drive file=$VDH,if=virtio,format=raw \
 	-vga none -nographic -smp $NR_CPU -m $MEM \
-	-fsdev local,id=v_tmp,path=$VIRTFS_PATH,security_model=none \
-	-device virtio-9p-pci,fsdev=v_tmp,mount_tag=v_tmp \
+	$VIRTFS \
 	$VIRTIO_RNG \
 	$CONSOLE \
 	$MONITOR \
diff --git a/kvm-xfstests/test-appliance/files/root/runtests.sh b/kvm-xfstests/test-appliance/files/root/runtests.sh
index a44f3893a6a4..0a83c70af853 100755
--- a/kvm-xfstests/test-appliance/files/root/runtests.sh
+++ b/kvm-xfstests/test-appliance/files/root/runtests.sh
@@ -282,7 +282,7 @@ do
 	    fi
 	fi
 	case "$TEST_DEV" in
-	    */ovl) ;;
+	    */ovl|9p*) ;;
 	    *:/*) ;;
 	    *)
 		if ! [ -b $TEST_DEV -o -c $TEST_DEV ]; then
diff --git a/kvm-xfstests/util/parse_cli b/kvm-xfstests/util/parse_cli
index 11b45758b31b..52f518a5064c 100644
--- a/kvm-xfstests/util/parse_cli
+++ b/kvm-xfstests/util/parse_cli
@@ -399,6 +399,18 @@ while [ "$1" != "" ]; do
 	    supported_flavors kvm
 	    VIRTFS_PATH="$1"
 	    ;;
+	--virtfs-test) shift
+	    supported_flavors kvm
+	    VIRTFS_TEST_PATH="$1"
+	    ;;
+	--virtfs-scratch) shift
+	    supported_flavors kvm
+	    VIRTFS_SCRATCH_PATH="$1"
+	    ;;
+	--virtfs-model) shift
+	    supported_flavors kvm
+	    VIRTFS_MODEL="$1"
+	    ;;
 	--archive)
 	    supported_flavors kvm
 	    DO_ARCHIVE=1
-- 
2.14.3


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

* [PATCH 2/2] test-appliance: add virtfs/9p test configs
  2018-03-30  2:10 [PATCH 1/2] kvm-xfstests: add virtfs/9p test support Eryu Guan
@ 2018-03-30  2:10 ` Eryu Guan
  2018-04-02  1:15   ` Theodore Y. Ts'o
  0 siblings, 1 reply; 3+ messages in thread
From: Eryu Guan @ 2018-03-30  2:10 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: fstests, Eryu Guan

Currently virtfs/9p has only one default config file, with tests in
clone group excluded.

Signed-off-by: Eryu Guan <eguan@linux.alibaba.com>
---
 .../test-appliance/files/root/fs/9p/cfg/all.list   |  1 +
 .../test-appliance/files/root/fs/9p/cfg/default    |  7 +++
 .../test-appliance/files/root/fs/9p/config         | 50 ++++++++++++++++++++++
 .../test-appliance/files/root/fs/9p/exclude-opt    |  1 +
 4 files changed, 59 insertions(+)
 create mode 100644 kvm-xfstests/test-appliance/files/root/fs/9p/cfg/all.list
 create mode 100644 kvm-xfstests/test-appliance/files/root/fs/9p/cfg/default
 create mode 100644 kvm-xfstests/test-appliance/files/root/fs/9p/config
 create mode 100644 kvm-xfstests/test-appliance/files/root/fs/9p/exclude-opt

diff --git a/kvm-xfstests/test-appliance/files/root/fs/9p/cfg/all.list b/kvm-xfstests/test-appliance/files/root/fs/9p/cfg/all.list
new file mode 100644
index 000000000000..4ad96d51599f
--- /dev/null
+++ b/kvm-xfstests/test-appliance/files/root/fs/9p/cfg/all.list
@@ -0,0 +1 @@
+default
diff --git a/kvm-xfstests/test-appliance/files/root/fs/9p/cfg/default b/kvm-xfstests/test-appliance/files/root/fs/9p/cfg/default
new file mode 100644
index 000000000000..b7d1801b6b04
--- /dev/null
+++ b/kvm-xfstests/test-appliance/files/root/fs/9p/cfg/default
@@ -0,0 +1,7 @@
+export TEST_DEV=9ptest
+export TEST_DIR=/mnt/test
+export SCRATCH_DEV=9pscratch
+export SCRATCH_MNT=/mnt/scratch
+export PLAN9_MOUNT_OPTIONS="-o trans=virtio,version=9p2000.L,posixacl"
+TESTNAME="9pfs"
+mkdir -p /mnt/test /mnt/scratch
diff --git a/kvm-xfstests/test-appliance/files/root/fs/9p/config b/kvm-xfstests/test-appliance/files/root/fs/9p/config
new file mode 100644
index 000000000000..ebd0d349be63
--- /dev/null
+++ b/kvm-xfstests/test-appliance/files/root/fs/9p/config
@@ -0,0 +1,50 @@
+#
+# Configuration file for 9pfs
+#
+
+DEFAULT_MKFS_OPTIONS=""
+
+function check_filesystem()
+{
+	return 0
+}
+
+function format_filesystem()
+{
+	return 0
+}
+
+function setup_mount_opts()
+{
+	if test -z "$PLAN9_MOUNT_OPTIONS" ; then
+		export PLAN9_MOUNT_OPTIONS="-o trans=virtio,version=9p2000.L,posixacl"
+	fi
+	if test -n "$MNTOPTS" ; then
+		export PLAN9_MOUNT_OPTIONS="$PLAN9_MOUNT_OPTIONS,$MNTOPTS"
+	fi
+}
+
+function get_mkfs_opts()
+{
+	return 0
+}
+
+function show_mkfs_opts()
+{
+	return 0
+}
+
+function show_mount_opts()
+{
+	echo PLAN9_MOUNT_OPTIONS: "$PLAN9_MOUNT_OPTIONS"
+}
+
+function test_name_alias()
+{
+	echo "$1"
+}
+
+function reset_vars()
+{
+	unset PLAN9_MOUNT_OPTIONS
+}
diff --git a/kvm-xfstests/test-appliance/files/root/fs/9p/exclude-opt b/kvm-xfstests/test-appliance/files/root/fs/9p/exclude-opt
new file mode 100644
index 000000000000..b29665746f8c
--- /dev/null
+++ b/kvm-xfstests/test-appliance/files/root/fs/9p/exclude-opt
@@ -0,0 +1 @@
+-x clone
-- 
2.14.3


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

* Re: [PATCH 2/2] test-appliance: add virtfs/9p test configs
  2018-03-30  2:10 ` [PATCH 2/2] test-appliance: add virtfs/9p test configs Eryu Guan
@ 2018-04-02  1:15   ` Theodore Y. Ts'o
  0 siblings, 0 replies; 3+ messages in thread
From: Theodore Y. Ts'o @ 2018-04-02  1:15 UTC (permalink / raw)
  To: Eryu Guan; +Cc: fstests

On Fri, Mar 30, 2018 at 10:10:40AM +0800, Eryu Guan wrote:
> Currently virtfs/9p has only one default config file, with tests in
> clone group excluded.
> 
> Signed-off-by: Eryu Guan <eguan@linux.alibaba.com>

Thanks, I've applied both of your patches to the xfstest-bld repo.

	     	     	     	  - Ted

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

end of thread, other threads:[~2018-04-02  1:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-30  2:10 [PATCH 1/2] kvm-xfstests: add virtfs/9p test support Eryu Guan
2018-03-30  2:10 ` [PATCH 2/2] test-appliance: add virtfs/9p test configs Eryu Guan
2018-04-02  1:15   ` Theodore Y. Ts'o

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