From patchwork Fri Mar 5 06:22:35 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sshang X-Patchwork-Id: 83720 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o256ItGK026075 for ; Fri, 5 Mar 2010 06:18:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753148Ab0CEGSc (ORCPT ); Fri, 5 Mar 2010 01:18:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:25497 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753470Ab0CEGSb (ORCPT ); Fri, 5 Mar 2010 01:18:31 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o256ITXL003728 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 5 Mar 2010 01:18:29 -0500 Received: from localhost.localdomain ([10.66.91.194]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o256IQtQ022416; Fri, 5 Mar 2010 01:18:27 -0500 From: sshang To: lmr@redhat.com Cc: autotest@test.kernel.org, kvm@vger.kernel.org, sshang Subject: [PATCH] KVM-Test: Add kvm userspace unit test Date: Fri, 5 Mar 2010 14:22:35 +0800 Message-Id: <1267770155-12900-1-git-send-email-sshang@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 05 Mar 2010 06:18:55 +0000 (UTC) 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