Re: [PATCH 0/6] svm intercept tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 28, 2010 at 12:25:45PM -0400, Avi Kivity wrote:
> This patchset adds three more svm tests: cr3 read intercept, cr3 read
> intercept (disabled), and cr3 read intercept through the instruction
> emulator.  As usual, 66.7% of the tests pass.

For the next_rip test I added another feature to the test-framework. Can
you apply the attached patch please to it? It will save me from some
rebasing when you write more tests before I finish my two tests :-)

	Joerg


>From 282dafc0d476b016967c91742008ecf21aaf36e1 Mon Sep 17 00:00:00 2001
From: Joerg Roedel <joerg.roedel@xxxxxxx>
Date: Wed, 28 Jul 2010 15:56:32 +0200
Subject: [PATCH] test: Run tests only if supported on the current hardware

Signed-off-by: Joerg Roedel <joerg.roedel@xxxxxxx>
---
 kvm/test/x86/svm.c |   38 +++++++++++++++++++++++++-------------
 1 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/kvm/test/x86/svm.c b/kvm/test/x86/svm.c
index cb26af6..054bd2e 100644
--- a/kvm/test/x86/svm.c
+++ b/kvm/test/x86/svm.c
@@ -58,6 +58,7 @@ static void vmcb_ident(struct vmcb *vmcb)
 
 struct test {
     const char *name;
+    bool (*supported)(void);
     void (*prepare)(struct test *test);
     void (*guest_func)(struct test *test);
     bool (*finished)(struct test *test);
@@ -108,6 +109,11 @@ static bool test_run(struct test *test, struct vmcb *vmcb)
     return success;
 }
 
+static bool default_supported(void)
+{
+    return true;
+}
+
 static void default_prepare(struct test *test)
 {
     vmcb_ident(test->vmcb);
@@ -203,21 +209,24 @@ static void test_cr3_intercept_bypass(struct test *test)
 }
 
 static struct test tests[] = {
-    { "null", default_prepare, null_test, default_finished, null_check },
-    { "vmrun", default_prepare, test_vmrun, default_finished, check_vmrun },
-    { "vmrun intercept check", prepare_no_vmrun_int, null_test,
-      default_finished, check_no_vmrun_int },
-    { "cr3 read intercept", prepare_cr3_intercept, test_cr3_intercept,
+    { "null", default_supported, default_prepare, null_test,
+      default_finished, null_check },
+    { "vmrun", default_supported, default_prepare, test_vmrun,
+       default_finished, check_vmrun },
+    { "vmrun intercept check", default_supported, prepare_no_vmrun_int,
+      null_test, default_finished, check_no_vmrun_int },
+    { "cr3 read intercept", default_supported, prepare_cr3_intercept,
+      test_cr3_intercept, default_finished, check_cr3_intercept },
+    { "cr3 read nointercept", default_supported, default_prepare,
+      test_cr3_intercept, default_finished, check_cr3_nointercept },
+    { "cr3 read intercept emulate", default_supported,
+      prepare_cr3_intercept_bypass, test_cr3_intercept_bypass,
       default_finished, check_cr3_intercept },
-    { "cr3 read nointercept", default_prepare, test_cr3_intercept,
-      default_finished, check_cr3_nointercept },
-    { "cr3 read intercept emulate", prepare_cr3_intercept_bypass,
-      test_cr3_intercept_bypass, default_finished, check_cr3_intercept }
 };
 
 int main(int ac, char **av)
 {
-    int i, nr, passed;
+    int i, nr, passed, done;
     struct vmcb *vmcb;
 
     setup_vm();
@@ -233,11 +242,14 @@ int main(int ac, char **av)
     vmcb = alloc_page();
 
     nr = ARRAY_SIZE(tests);
-    passed = 0;
+    passed = done = 0;
     for (i = 0; i < nr; ++i) {
+        if (!tests[i].supported())
+            continue;
+	done   += 1;
         passed += test_run(&tests[i], vmcb);
     }
 
-    printf("\nSUMMARY: %d TESTS, %d FAILURES\n", nr, (nr - passed));
-    return passed == nr ? 0 : 1;
+    printf("\nSUMMARY: %d TESTS, %d FAILURES\n", done, (done - passed));
+    return passed == done ? 0 : 1;
 }
-- 
1.7.0.4


-- 
Joerg Roedel - AMD Operating System Research Center

Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo, Andrew Bowd
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux