diff mbox

KVM-Test: Add kvm userspace unit test

Message ID 1267770155-12900-1-git-send-email-sshang@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

sshang March 5, 2010, 6:22 a.m. UTC
None
diff mbox

Patch

diff --git a/client/tests/kvm/tests/unit_test.py b/client/tests/kvm/tests/unit_test.py
new file mode 100644
index 0000000..9bc7441
--- /dev/null
+++ b/client/tests/kvm/tests/unit_test.py
@@ -0,0 +1,29 @@ 
+import os
+from autotest_lib.client.bin import utils
+from autotest_lib.client.common_lib import error
+
+def run_unit_test(test, params, env):
+    """
+    This is kvm userspace unit test, use kvm test harness kvmctl load binary
+    test case file to test various function of kvm kernel module.
+    The output of all unit test can be found in the test result dir.
+    """
+
+    case_list = params.get("case_list","access apic emulator hypercall irq"\
+              " port80 realmode sieve smptest tsc stringio vmexit").split()    
+    srcdir = params.get("srcdir",test.srcdir)
+    user_dir = os.path.join(srcdir,"kvm_userspace/kvm/user")
+    os.chdir(user_dir)
+    test_fail_list = []
+
+    for i in case_list:
+        result_file = test.outputdir + "/" + i
+        testfile = i + ".flat"
+        results = utils.system("./kvmctl test/x86/bootstrap test/x86/" + \
+                     testfile + " > " + result_file,ignore_status=True)
+        if results != 0:
+            test_fail_list.append(i)
+
+    if test_fail_list:
+        raise error.TestFail("< " + " ".join(test_fail_list) + \
+                                   " >")
diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
index 040d0c3..0918c26 100644
--- a/client/tests/kvm/tests_base.cfg.sample
+++ b/client/tests/kvm/tests_base.cfg.sample
@@ -300,6 +300,13 @@  variants:
         shutdown_method = shell
         kill_vm = yes
         kill_vm_gracefully = no
+
+    - unit_test:
+        type = unit_test
+        case_list = access apic emulator hypercall msr port80 realmode sieve smptest tsc stringio vmexit
+        #srcdir should be same as build.cfg
+        srcdir = 
+        vms = ''
     # Do not define test variants below shutdown