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

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

Issue 6124004: Revert "Merge remote branch 'cros/upstream' into autotest-rebase" (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: 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
« no previous file with comments | « client/tests/kvm/tests/nic_promisc.py ('k') | client/tests/kvm/tests/pci_hotplug.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/tests/kvm/tests/nicdriver_unload.py
diff --git a/client/tests/kvm/tests/nicdriver_unload.py b/client/tests/kvm/tests/nicdriver_unload.py
index a515d6744b253c0e501f4addc6464d8e91160970..47318ba9c0193d5db8d48bde57167b4b91f98f5d 100644
--- a/client/tests/kvm/tests/nicdriver_unload.py
+++ b/client/tests/kvm/tests/nicdriver_unload.py
@@ -20,12 +20,17 @@ def run_nicdriver_unload(test, params, env):
timeout = int(params.get("login_timeout", 360))
vm = kvm_test_utils.get_living_vm(env, params.get("main_vm"))
session = kvm_test_utils.wait_for_login(vm, timeout=timeout)
- session_serial = kvm_test_utils.wait_for_login(vm, 0, timeout, 0, 2,
- serial=True)
+ logging.info("Trying to log into guest '%s' by serial", vm.name)
+ session2 = kvm_utils.wait_for(lambda: vm.serial_login(),
+ timeout, 0, step=2)
+ if not session2:
+ raise error.TestFail("Could not log into guest '%s'" % vm.name)
ethname = kvm_test_utils.get_linux_ifname(session, vm.get_mac_address(0))
sys_path = "/sys/class/net/%s/device/driver" % (ethname)
- o = session.cmd("readlink -e %s" % sys_path)
+ s, o = session.get_command_status_output('readlink -e %s' % sys_path)
+ if s:
+ raise error.TestError("Could not find driver name")
driver = os.path.basename(o.strip())
logging.info("driver is %s", driver)
@@ -40,8 +45,12 @@ def run_nicdriver_unload(test, params, env):
logging.debug("Failed to transfer file %s", remote_file)
def compare(origin_file, receive_file):
+ cmd = "md5sum %s"
check_sum1 = utils.hash_file(origin_file, method="md5")
- output2 = session.cmd("md5sum %s" % receive_file)
+ s, output2 = session.get_command_status_output(cmd % receive_file)
+ if s != 0:
+ logging.error("Could not get md5sum of receive_file")
+ return False
check_sum2 = output2.strip().split()[0]
logging.debug("original file md5: %s, received file md5: %s",
check_sum1, check_sum2)
@@ -68,11 +77,9 @@ def run_nicdriver_unload(test, params, env):
logging.info("Unload/load NIC driver repeatedly in guest...")
while True:
logging.debug("Try to unload/load nic drive once")
- try:
- session_serial.cmd(unload_load_cmd, timeout=120)
- except:
- session.cmd_output("rm -rf /tmp/Thread-*")
- raise
+ if session2.get_command_status(unload_load_cmd, timeout=120) != 0:
+ session.get_command_output("rm -rf /tmp/Thread-*")
+ raise error.TestFail("Unload/load nic driver failed")
pid, s = os.waitpid(pid, os.WNOHANG)
status = os.WEXITSTATUS(s)
if (pid, status) != (0, 0):
@@ -89,6 +96,7 @@ def run_nicdriver_unload(test, params, env):
t.join(timeout = scp_timeout)
os._exit(0)
+ session2.close()
try:
logging.info("Check MD5 hash for received files in multi-session")
@@ -103,5 +111,5 @@ def run_nicdriver_unload(test, params, env):
raise error.TestFail("Test nic function after load/unload fail")
finally:
- session.cmd_output("rm -rf /tmp/Thread-*")
+ session.get_command_output("rm -rf /tmp/Thread-*")
session.close()
« no previous file with comments | « client/tests/kvm/tests/nic_promisc.py ('k') | client/tests/kvm/tests/pci_hotplug.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698