| OLD | NEW |
| (Empty) |
| 1 import logging, time, os | |
| 2 from autotest_lib.client.common_lib import error | |
| 3 from autotest_lib.client.common_lib import utils | |
| 4 import kvm_test_utils, kvm_utils | |
| 5 | |
| 6 | |
| 7 def run_clock_getres(test, params, env): | |
| 8 """ | |
| 9 Verify if guests using kvm-clock as the time source have a sane clock | |
| 10 resolution. | |
| 11 | |
| 12 @param test: kvm test object. | |
| 13 @param params: Dictionary with test parameters. | |
| 14 @param env: Dictionary with the test environment. | |
| 15 """ | |
| 16 t_name = "test_clock_getres" | |
| 17 base_dir = "/tmp" | |
| 18 | |
| 19 deps_dir = os.path.join(test.bindir, "deps", t_name) | |
| 20 os.chdir(deps_dir) | |
| 21 try: | |
| 22 utils.system("make clean") | |
| 23 utils.system("make") | |
| 24 except: | |
| 25 raise error.TestError("Failed to compile %s" % t_name) | |
| 26 | |
| 27 test_clock = os.path.join(deps_dir, t_name) | |
| 28 if not os.path.isfile(test_clock): | |
| 29 raise error.TestError("Could not find %s" % t_name) | |
| 30 | |
| 31 vm = kvm_test_utils.get_living_vm(env, params.get("main_vm")) | |
| 32 timeout = int(params.get("login_timeout", 360)) | |
| 33 session = kvm_test_utils.wait_for_login(vm, timeout=timeout) | |
| 34 if not vm.copy_files_to(test_clock, base_dir): | |
| 35 raise error.TestError("Failed to copy %s to VM" % t_name) | |
| 36 session.cmd(os.path.join(base_dir, t_name)) | |
| 37 logging.info("PASS: Guest reported appropriate clock resolution") | |
| 38 logging.info("guest's dmesg:") | |
| 39 session.cmd_output("dmesg") | |
| OLD | NEW |