Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Unified Diff: client/tests/kvm/tests/guest_test.py

Issue 6246035: Merge remote branch 'cros/upstream' into master (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: patch Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: client/tests/kvm/tests/guest_test.py
diff --git a/client/tests/kvm/tests/guest_test.py b/client/tests/kvm/tests/guest_test.py
index b6bebc7b91307c8ad90b80df4aa2cdfe1a6dd38c..95c6f7fc760bb7d3f75ae86fc3519d6055dd74c3 100644
--- a/client/tests/kvm/tests/guest_test.py
+++ b/client/tests/kvm/tests/guest_test.py
@@ -1,6 +1,5 @@
import os, logging
-from autotest_lib.client.common_lib import error
-import kvm_utils, kvm_test_utils
+import kvm_utils
def run_guest_test(test, params, env):
@@ -19,12 +18,16 @@ def run_guest_test(test, params, env):
login_timeout = int(params.get("login_timeout", 360))
reboot = params.get("reboot", "no")
- vm = kvm_test_utils.get_living_vm(env, params.get("main_vm"))
- session = kvm_test_utils.wait_for_login(vm, timeout=login_timeout)
+ vm = env.get_vm(params["main_vm"])
+ vm.verify_alive()
+ if params.get("serial_login") == "yes":
+ session = vm.wait_for_serial_login(timeout=login_timeout)
+ else:
+ session = vm.wait_for_login(timeout=login_timeout)
if reboot == "yes":
logging.debug("Rebooting guest before test ...")
- session = kvm_test_utils.reboot(vm, session, timeout=login_timeout)
+ session = vm.reboot(session, timeout=login_timeout)
try:
logging.info("Starting script...")
@@ -48,38 +51,29 @@ def run_guest_test(test, params, env):
# Change dir to dst_rsc_dir, and remove the guest script dir there
rm_cmd = "cd %s && (rmdir /s /q %s || del /s /q %s)" % \
(dst_rsc_dir, rsc_dir, rsc_dir)
- if session.get_command_status(rm_cmd, timeout=test_timeout) != 0:
- raise error.TestFail("Remove %s failed." % rsc_dir)
+ session.cmd(rm_cmd, timeout=test_timeout)
logging.debug("Clean directory succeeded.")
# then download the resource.
- rsc_cmd = "cd %s && %s %s" %(dst_rsc_dir, download_cmd, rsc_server)
- if session.get_command_status(rsc_cmd, timeout=test_timeout) != 0:
- raise error.TestFail("Download test resource failed.")
+ rsc_cmd = "cd %s && %s %s" % (dst_rsc_dir, download_cmd, rsc_server)
+ session.cmd(rsc_cmd, timeout=test_timeout)
logging.info("Download resource finished.")
else:
- session.get_command_output("del %s" % dst_rsc_path,
- internal_timeout=0)
+ session.cmd_output("del %s" % dst_rsc_path, internal_timeout=0)
script_path = kvm_utils.get_path(test.bindir, script)
vm.copy_files_to(script_path, dst_rsc_path, timeout=60)
- command = "cmd /c %s %s %s" %(interpreter, dst_rsc_path, script_params)
+ cmd = "%s %s %s" % (interpreter, dst_rsc_path, script_params)
- logging.info("---------------- Script output ----------------")
- status = session.get_command_status(command,
- print_func=logging.info,
- timeout=test_timeout)
- logging.info("---------------- End of script output ----------------")
-
- if status is None:
- raise error.TestFail("Timeout expired before script execution "
- "completed (or something weird happened)")
- if status != 0:
- raise error.TestFail("Script execution failed")
+ try:
+ logging.info("------------ Script output ------------")
+ session.cmd(cmd, print_func=logging.info, timeout=test_timeout)
+ finally:
+ logging.info("------------ End of script output ------------")
if reboot == "yes":
logging.debug("Rebooting guest after test ...")
- session = kvm_test_utils.reboot(vm, session, timeout=login_timeout)
+ session = vm.reboot(session, timeout=login_timeout)
logging.debug("guest test PASSED.")
finally:

Powered by Google App Engine
This is Rietveld 408576698