]> xenbits.xensource.com Git - xtf.git/commitdiff
Rework the pv-iopl test using variations
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 2 Aug 2016 16:30:41 +0000 (17:30 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 2 Aug 2016 17:33:38 +0000 (18:33 +0100)
The hypercall and vmassist tests are logically separate, and while the
hypercall version has been around for a very long time, vmassist was only
introduced in Xen 4.7.

To be able to sensibly test the hypercall part on older versions of Xen, they
should be treated separately, so the skip from vmassist detection doesn't
influence the results from the hypercall test.

To test them independently, introduce variations which alter the cmdline
passed to the guest.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
tests/pv-iopl/Makefile
tests/pv-iopl/hypercall.cfg.in [new file with mode: 0644]
tests/pv-iopl/main.c
tests/pv-iopl/vmassist.cfg.in [new file with mode: 0644]

index be3e980a2b456b092c166484a5f074880e16024e..ec2f829a9b3070c368f21f09ef1adb34ce6d03aa 100644 (file)
@@ -4,6 +4,8 @@ NAME      := pv-iopl
 CATEGORY  := functional
 TEST-ENVS := $(PV_ENVIRONMENTS)
 
+VARY-CFG  := hypercall vmassist
+
 obj-perenv += main.o asm.o
 
 include $(ROOT)/build/gen.mk
diff --git a/tests/pv-iopl/hypercall.cfg.in b/tests/pv-iopl/hypercall.cfg.in
new file mode 100644 (file)
index 0000000..7212651
--- /dev/null
@@ -0,0 +1 @@
+cmdline="hypercall"
index f3a57f064e49a328b25c37af0364b1a90f427d72..1b620c1e10d2df61fcb3c584d5d0c2832d9c46fc 100644 (file)
@@ -145,6 +145,8 @@ static void run_test(const struct test *t)
 {
     unsigned int i, iopl;
 
+    xtf_exlog_start();
+
     for ( iopl = 0; iopl <= 3; ++iopl )
     {
         /* vIOPL 2 is not interesting to test. */
@@ -169,6 +171,8 @@ static void run_test(const struct test *t)
             check();
         }
     }
+
+    xtf_exlog_stop();
 }
 
 static void hypercall_set_iopl(unsigned int iopl)
@@ -242,21 +246,33 @@ static const struct test vmassist =
 
 void test_main(void)
 {
-    printk("PV IOPL emulation\n");
-
-    xtf_exlog_start();
+    const struct test *test;
 
-    printk("Test: PHYSDEVOP_set_iopl\n");
-    run_test(&hypercall);
+    printk("PV IOPL emulation\n");
 
-    if ( hypercall_vm_assist(VMASST_CMD_enable,
-                             VMASST_TYPE_architectural_iopl) )
-        return xtf_skip("VMASST_TYPE_architectural_iopl not detected\n");
+    /**
+     * @todo Implement better command line infrastructure, but this will do
+     * for now.
+     */
+    if ( !strcmp((char *)start_info->cmd_line, "hypercall") )
+    {
+        printk("Test: PHYSDEVOP_set_iopl\n");
+        test = &hypercall;
+    }
+    else if ( !strcmp((char *)start_info->cmd_line, "vmassist") )
+    {
+        if ( hypercall_vm_assist(VMASST_CMD_enable,
+                                 VMASST_TYPE_architectural_iopl) )
+            return xtf_skip("VMASST_TYPE_architectural_iopl not detected\n");
 
-    printk("Test: VMASST_TYPE_architectural_iopl\n");
-    run_test(&vmassist);
+        printk("Test: VMASST_TYPE_architectural_iopl\n");
+        test = &vmassist;
+    }
+    else
+        return xtf_error("Unknown test to run\n");
 
-    xtf_exlog_stop();
+    /* Run the chosen test. */
+    run_test(test);
     xtf_success(NULL);
 }
 
diff --git a/tests/pv-iopl/vmassist.cfg.in b/tests/pv-iopl/vmassist.cfg.in
new file mode 100644 (file)
index 0000000..7e8287b
--- /dev/null
@@ -0,0 +1 @@
+cmdline="vmassist"