Index: client/tests/kvm/tests/clock_getres.py |
diff --git a/client/tests/kvm/tests/clock_getres.py b/client/tests/kvm/tests/clock_getres.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d1baf88b38689b82e44fdae07aed3b6a87d57dec |
--- /dev/null |
+++ b/client/tests/kvm/tests/clock_getres.py |
@@ -0,0 +1,37 @@ |
+import logging, os |
+from autotest_lib.client.common_lib import error |
+from autotest_lib.client.bin import utils |
+ |
+ |
+def run_clock_getres(test, params, env): |
+ """ |
+ Verify if guests using kvm-clock as the time source have a sane clock |
+ resolution. |
+ |
+ @param test: kvm test object. |
+ @param params: Dictionary with test parameters. |
+ @param env: Dictionary with the test environment. |
+ """ |
+ t_name = "test_clock_getres" |
+ base_dir = "/tmp" |
+ |
+ deps_dir = os.path.join(test.bindir, "deps", t_name) |
+ os.chdir(deps_dir) |
+ try: |
+ utils.system("make clean") |
+ utils.system("make") |
+ except: |
+ raise error.TestError("Failed to compile %s" % t_name) |
+ |
+ test_clock = os.path.join(deps_dir, t_name) |
+ if not os.path.isfile(test_clock): |
+ raise error.TestError("Could not find %s" % t_name) |
+ |
+ vm = env.get_vm(params["main_vm"]) |
+ vm.verify_alive() |
+ timeout = int(params.get("login_timeout", 360)) |
+ session = vm.wait_for_login(timeout=timeout) |
+ vm.copy_files_to(test_clock, base_dir) |
+ session.cmd(os.path.join(base_dir, t_name)) |
+ logging.info("PASS: Guest reported appropriate clock resolution") |
+ logging.info("Guest's dmesg:\n%s", session.cmd_output("dmesg").strip()) |