From: Madhuri Appana <[email protected]>

Signed-off-by: Madhuri Appana <[email protected]>
---
 client/tests/kvm/subtests.cfg.sample       |   12 ++++++
 client/tests/kvm/tests/9p.py               |   57 ++++++++++++++++++++++++++++
 client/virt/autotest_control/9p-ci.control |   24 ++++++++++++
 3 files changed, 93 insertions(+), 0 deletions(-)
 create mode 100644 client/tests/kvm/tests/9p.py
 create mode 100644 client/virt/autotest_control/9p-ci.control

diff --git a/client/tests/kvm/subtests.cfg.sample 
b/client/tests/kvm/subtests.cfg.sample
index 3d47fb4..cf6aa39 100644
--- a/client/tests/kvm/subtests.cfg.sample
+++ b/client/tests/kvm/subtests.cfg.sample
@@ -1381,3 +1381,15 @@ variants:
         shutdown_method = shell
         kill_vm = yes
         kill_vm_gracefully = no
+
+    - 9p: install setup image_copy unattended_install.cdrom
+        only Linux
+        type = 9p
+        9p_mount_dir = /root/mount1
+        9p_posix_acl = yes
+        9p_guest_cache = yes
+        9p_proto_version = 9p2000.L
+        test_timeout = 1800
+        variants:
+            - 9p_ci:
+                test_control_file = 9p-ci.control
+                test_timeout = 1800
diff --git a/client/tests/kvm/tests/9p.py b/client/tests/kvm/tests/9p.py
new file mode 100644
index 0000000..2156da5
--- /dev/null
+++ b/client/tests/kvm/tests/9p.py
@@ -0,0 +1,57 @@
+import os,logging
+from autotest_lib.client.common_lib import error
+from autotest_lib.client.virt import virt_test_utils
+
+
+def run_9p(test, params, env):
+    """
+    Run an autotest test inside a guest.
+
+    @param test: kvm test object.
+    @param params: Dictionary with test parameters.
+    @param env: Dictionary with the test environment.
+    """
+    vm = env.get_vm(params["main_vm"])
+    vm.verify_alive()
+    timeout = int(params.get("login_timeout", 360))
+    session = vm.wait_for_login(timeout=timeout)
+
+    mount_dir = params.get("9p_mount_dir")
+
+    if mount_dir is None:
+        logging.info("User Variable for mount dir is not set")
+    else:
+        mkdir = session.get_command_output("mkdir -p %s" % mount_dir)
+
+        mount_option = " trans=virtio"
+
+        p9_proto_version = params.get("9p_proto_version")
+        if not p9_proto_version:
+            p9_proto_version = "9p2000.L"
+
+        mount_option += ",version=" + p9_proto_version
+
+        guest_cache = params.get("9p_guest_cache")
+        if guest_cache == "yes":
+            mount_option += ",cache=loose"
+
+        posix_acl = params.get("9p_posix_acl")
+        if posix_acl == "yes":
+            mount_option += ",posixacl"
+
+        logging.info("Mounting 9p mount point with options %s" % mount_option)
+        mount_status = session.get_command_status("mount -t 9p -o %s 
autotest_tag %s" % (mount_option, mount_dir) )
+
+        if (mount_status != 0):
+            logging.error("mount failed")
+            raise error.TestFail('mount failed.')
+
+        # Collect test parameters
+        timeout = int(params.get("test_timeout", 14400))
+        control_path = os.path.join(test.virtdir, "autotest_control",
+                                    params.get("test_control_file"))
+
+        outputdir = test.outputdir
+
+        virt_test_utils.run_autotest(vm, session, control_path,
+                                     timeout, outputdir, params)
diff --git a/client/virt/autotest_control/9p-ci.control 
b/client/virt/autotest_control/9p-ci.control
new file mode 100644
index 0000000..6e31297
--- /dev/null
+++ b/client/virt/autotest_control/9p-ci.control
@@ -0,0 +1,24 @@
+TIME="SHORT"
+AUTHOR = "Faizan Husain <[email protected]>"
+DOC = """
+9p CI is one of our standard kernel tests.
+"""
+NAME = '9p-ci'
+TEST_CLASS = 'kernel'
+TEST_CATEGORY = 'Functional'
+TEST_TYPE = 'client'
+
+import os
+
+#FIXME: Using hardcoded mount dir here,that can be changed with user defined 
mount path.
+mount_dir = "/root/mount1/"
+test_dir  = mount_dir + "/9p_test/"
+if not os.path.exists(test_dir):
+   os.mkdir(test_dir)
+
+job.run_test('dbench', dir = test_dir, seconds = 600)
+job.run_test('fsstress', testdir = test_dir, nprocs = 10, nops = 10)
+job.run_test('connectathon', testdir = test_dir, args = "-b -t", tag = "bt")
+job.run_test('connectathon', testdir = test_dir, args = "-g -f", tag = "gf")
+job.run_test('connectathon', testdir = test_dir, args = "-s -f", tag = "sf")
+job.run_test('connectathon', testdir = test_dir, args = "-l -f", tag = "lf")
-- 
1.7.6.4

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to