KVM-Test: Add KVM unit test (kvmctl)
PATCH 1/1 KVM-Test: Add KVM unit test (kvmctl)
From: sshang <[email protected]>
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 older style unit testing, after some consideration we decided to keep the 2 modules separated.
--- client/tests/kvm/tests/unit_test.py | 34 ++++++++++++++++++++++++++++++++ client/tests/kvm/tests_base.cfg.sample | 30 ++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 0 deletions(-) create mode 100644 client/tests/kvm/tests/unit_test.py
client/tests/kvm/tests/unit_test.py new file +34 -0
@@ -0,0 +1,34 @@ +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 function of kvm kernel module. + The output of all unit test 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_list = params.get("case_list").split() + srcdir = params.get("srcdir", test.srcdir) + user_dir = os.path.join(srcdir, "kvm_userspace", "kvm", "user") + os.chdir(user_dir) + fail = 0 + + result_file = (test.outputdir, "%s.flat" % case) + cmd = "./kvmctl test/x86/bootstrap test/x86/ %s" % testfile + results = None + try: + results = utils.system_output(cmd) + except error.CmdError, e: + logging.error("Unit test %s failed", case) + fail += 1 + + if results is not None: + utils.open_write_close(result_file, results) + + if fail: + raise error.TestFail("Unit tests failed: %s", " ".join(test_fail_list))
client/tests/kvm/tests_base.cfg.sample +30 -0
@@ -306,6 +306,36 @@ variants: - ksm_parallel: ksm_mode = "parallel" + - 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 = ''
Signature · 1 line
1.6.6.1
Quoted 4 lines · Lucas Meneghel Rodrigues
From: sshang <[email protected]>
The test use kvm test harness kvmctl load binary test case file to test various functions of the kvm kernel module.
I thought that tool is deprecated (or even broken), and I was about to suggest dropping it from the tree in favor of a simple script like this:
$QEMU -chardev stdio,id=cons -device testdev,chardev=cons -vga none \
-vnc none -kernel $TESTCASE
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux
Quoted 11 lines · Jan Kiszka
Quoted 4 lines · Lucas Meneghel Rodrigues
From: sshang <[email protected]>
The test use kvm test harness kvmctl load binary test case file to test various functions of the kvm kernel module.
I thought that tool is deprecated (or even broken), and I was about to suggest dropping it from the tree in favor of a simple script like this:
$QEMU -chardev stdio,id=cons -device testdev,chardev=cons -vga none \
-vnc none -kernel $TESTCASE
The purpose of the this specific test module is to do the unit testing in older branches of the code (such as RHEL 5.x branch). For upstream we have another module that will use the -kernel option being worked. I plan on calling it unit_test_kernel.
Quoted 9 lines · Lucas Meneghel Rodrigues
Quoted 8 lines · Jan Kiszka
Quoted 4 lines · Lucas Meneghel Rodrigues
From: sshang <[email protected]>
The test use kvm test harness kvmctl load binary test case file to test various functions of the kvm kernel module.
I thought that tool is deprecated (or even broken), and I was about to suggest dropping it from the tree in favor of a simple script like this:
Quoted 7 lines
Quoted 2 lines
$QEMU -chardev stdio,id=cons -device testdev,chardev=cons -vga none \
-vnc none -kernel $TESTCASEThe purpose of the this specific test module is to do the unit testing in older branches of the code (such as RHEL 5.x branch). For upstream we have another module that will use the -kernel option being worked. I plan on calling it
unit_test_kernel.
Ah, see. Thanks for the clarification.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux