Skip to contentSkip to conversation

kvm-xfstests: add virtfs/9p test support

PATCH In review Eryu Guan 2 participants 3 messages Mar 30, 2018 – Apr 2, 2018

lore
Share & tools
lore

Eryu Guan

author
#0 lore raw

PATCH 1/2 kvm-xfstests: add virtfs/9p test support

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.

---
 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(-)
kvm-xfstests/config.kvm +5 -0
index a08236fdc11e..fc20a1497ed5 100644
@@ -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
kvm-xfstests/kvm-xfstests +17 -2
index ccc8ae96fc8e..a02beab80e71 100755
@@ -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 \
kvm-xfstests/test-appliance/files/root/runtests.sh +1 -1
index a44f3893a6a4..0a83c70af853 100755
@@ -282,7 +282,7 @@ do
 	    fi
 	fi
 	case "$TEST_DEV" in
-	    */ovl) ;;
+	    */ovl|9p*) ;;
 	    *:/*) ;;
 	    *)
 		if ! [ -b $TEST_DEV -o -c $TEST_DEV ]; then
kvm-xfstests/util/parse_cli +12 -0
index 11b45758b31b..52f518a5064c 100644
@@ -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
Signature · 1 line
2.14.3
author
#1 lore raw

PATCH 2/2 test-appliance: add virtfs/9p test configs

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

---
 .../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
kvm-xfstests/test-appliance/files/root/fs/9p/cfg/all.list new file +1 -0
new file mode 100644
index 000000000000..4ad96d51599f
@@ -0,0 +1 @@
+default
kvm-xfstests/test-appliance/files/root/fs/9p/cfg/default new file +7 -0
new file mode 100644
index 000000000000..b7d1801b6b04
@@ -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
kvm-xfstests/test-appliance/files/root/fs/9p/config new file +50 -0

50 lines not on this page · raw message

kvm-xfstests/test-appliance/files/root/fs/9p/exclude-opt new file +1 -0
new file mode 100644
index 000000000000..b29665746f8c
@@ -0,0 +1 @@
+-x clone
Signature · 1 line
2.14.3
#2 lore raw

Re: [PATCH 2/2] test-appliance: add virtfs/9p test configs

Quoted 4 lines · Eryu Guan

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

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

- Ted