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

Side by Side Diff: client/virt/tests/guest_test.py

Issue 6883246: Merge autotest upstream from @5318 ~ @5336 (Closed) Base URL: ssh://gitrw.chromium.org:9222/autotest.git@master
Patch Set: patch Created 9 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « client/virt/tests/guest_s4.py ('k') | client/virt/tests/image_copy.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 import os, logging 1 import os, logging
2 import kvm_utils 2 from autotest_lib.client.virt import virt_utils
3 3
4 4
5 def run_guest_test(test, params, env): 5 def run_guest_test(test, params, env):
6 """ 6 """
7 A wrapper for running customized tests in guests. 7 A wrapper for running customized tests in guests.
8 8
9 1) Log into a guest. 9 1) Log into a guest.
10 2) Run script. 10 2) Run script.
11 3) Wait for script execution to complete. 11 3) Wait for script execution to complete.
12 4) Pass/fail according to exit status of script. 12 4) Pass/fail according to exit status of script.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 (dst_rsc_dir, rsc_dir, rsc_dir) 53 (dst_rsc_dir, rsc_dir, rsc_dir)
54 session.cmd(rm_cmd, timeout=test_timeout) 54 session.cmd(rm_cmd, timeout=test_timeout)
55 logging.debug("Clean directory succeeded.") 55 logging.debug("Clean directory succeeded.")
56 56
57 # then download the resource. 57 # then download the resource.
58 rsc_cmd = "cd %s && %s %s" % (dst_rsc_dir, download_cmd, rsc_server) 58 rsc_cmd = "cd %s && %s %s" % (dst_rsc_dir, download_cmd, rsc_server)
59 session.cmd(rsc_cmd, timeout=test_timeout) 59 session.cmd(rsc_cmd, timeout=test_timeout)
60 logging.info("Download resource finished.") 60 logging.info("Download resource finished.")
61 else: 61 else:
62 session.cmd_output("del %s" % dst_rsc_path, internal_timeout=0) 62 session.cmd_output("del %s" % dst_rsc_path, internal_timeout=0)
63 script_path = kvm_utils.get_path(test.bindir, script) 63 script_path = virt_utils.get_path(test.bindir, script)
64 vm.copy_files_to(script_path, dst_rsc_path, timeout=60) 64 vm.copy_files_to(script_path, dst_rsc_path, timeout=60)
65 65
66 cmd = "%s %s %s" % (interpreter, dst_rsc_path, script_params) 66 cmd = "%s %s %s" % (interpreter, dst_rsc_path, script_params)
67 67
68 try: 68 try:
69 logging.info("------------ Script output ------------") 69 logging.info("------------ Script output ------------")
70 session.cmd(cmd, print_func=logging.info, timeout=test_timeout) 70 session.cmd(cmd, print_func=logging.info, timeout=test_timeout)
71 finally: 71 finally:
72 logging.info("------------ End of script output ------------") 72 logging.info("------------ End of script output ------------")
73 73
74 if reboot == "yes": 74 if reboot == "yes":
75 logging.debug("Rebooting guest after test ...") 75 logging.debug("Rebooting guest after test ...")
76 session = vm.reboot(session, timeout=login_timeout) 76 session = vm.reboot(session, timeout=login_timeout)
77 77
78 logging.debug("guest test PASSED.") 78 logging.debug("guest test PASSED.")
79 finally: 79 finally:
80 session.close() 80 session.close()
OLDNEW
« no previous file with comments | « client/virt/tests/guest_s4.py ('k') | client/virt/tests/image_copy.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698