From: sshang <sshang@xxxxxxxxxx> The test use kvm test harness kvmctl load binary test case file to test various functions of the kvm kernel module. This test is for unit testing on older KVM branches, after some consideration we decided to keep the modules for upstream and branches that use kvmctl separated. Changes from v1: * Fixed some bugs * Renamed the test file * Made code shorter Signed-off-by: Shuxi Shang <sshang@xxxxxxxxxx> --- client/tests/kvm/tests/unit_test_kvmctl.py | 28 ++++++++++++++++++++++++ client/tests/kvm/tests_base.cfg.sample | 32 ++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 0 deletions(-) create mode 100644 client/tests/kvm/tests/unit_test_kvmctl.py diff --git a/client/tests/kvm/tests/unit_test_kvmctl.py b/client/tests/kvm/tests/unit_test_kvmctl.py new file mode 100644 index 0000000..a5b88b6 --- /dev/null +++ b/client/tests/kvm/tests/unit_test_kvmctl.py @@ -0,0 +1,28 @@ +import os +from autotest_lib.client.bin import utils +from autotest_lib.client.common_lib import error + + +def run_unit_test_kvmctl(test, params, env): + """ + This is kvm userspace unit test, use kvm test harness kvmctl load binary + test case file to test various functions of the kvm kernel module. + The output of all unit tests can be found in the test result dir. + + @param test: KVM test object. + @param params: Dictionary with the test parameters. + @param env: Dictionary with test environment. + """ + case = params.get("case") + srcdir = params.get("srcdir", test.srcdir) + unit_dir = os.path.join(srcdir, "kvm_userspace", "kvm", "user") + os.chdir(unit_dir) + + cmd = "./kvmctl test/x86/bootstrap test/x86/%s.flat" % case + try: + results = utils.system_output(cmd) + except error.CmdError, e: + raise error.TestFail("Unit test %s failed" % case) + + result_file = os.path.join(test.resultsdir, case) + utils.open_write_close(result_file, results) diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample index e73ba44..9f82ffb 100644 --- a/client/tests/kvm/tests_base.cfg.sample +++ b/client/tests/kvm/tests_base.cfg.sample @@ -306,6 +306,38 @@ variants: - ksm_parallel: ksm_mode = "parallel" + # This unit test module is for older branches of KVM that use the + # kvmctl test harness (such as the code shipped with RHEL 5.x) + - unit_test_kvmctl: + type = unit_test + vms = '' + profilers = '' + variants: + - access: + case = access + - apic: + case = apic + - emulator: + case = emulator + - hypercall: + case = hypercall + - msr: + case = msr + - port80: + case = port80 + - realmode: + case = realmode + - sieve: + case = sieve + - smptest: + case = smptest + - tsc: + case = tsc + - stringio: + case = stringio + - vmexit: + case = vmexit + - qemu_img: type = qemu_img vms = '' -- 1.6.6.1 -- 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