From patchwork Tue Oct 26 16:49:43 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Goldish X-Patchwork-Id: 283072 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o9QHeeDX003123 for ; Tue, 26 Oct 2010 17:40:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754823Ab0JZRkd (ORCPT ); Tue, 26 Oct 2010 13:40:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36309 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933274Ab0JZRk2 (ORCPT ); Tue, 26 Oct 2010 13:40:28 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o9QHeLC2003698 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 26 Oct 2010 13:40:27 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id o9QGnqLL022581; Tue, 26 Oct 2010 12:49:52 -0400 Received: from localhost.localdomain (dhcp-1-188.tlv.redhat.com [10.35.1.188]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o9QGnjvH022482; Tue, 26 Oct 2010 12:49:50 -0400 From: Michael Goldish To: autotest@test.kernel.org, kvm@vger.kernel.org Cc: Michael Goldish Subject: [KVM-AUTOTEST PATCH 4/5] KVM test: kvm_subprocess: rename get_command_status_output() and friends Date: Tue, 26 Oct 2010 18:49:43 +0200 Message-Id: <1288111784-10188-4-git-send-email-mgoldish@redhat.com> In-Reply-To: <1288111784-10188-3-git-send-email-mgoldish@redhat.com> References: <1288111784-10188-1-git-send-email-mgoldish@redhat.com> <1288111784-10188-2-git-send-email-mgoldish@redhat.com> <1288111784-10188-3-git-send-email-mgoldish@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Tue, 26 Oct 2010 17:40:40 +0000 (UTC) diff --git a/client/tests/kvm/kvm_subprocess.py b/client/tests/kvm/kvm_subprocess.py index c92910c..c8caab2 100755 --- a/client/tests/kvm/kvm_subprocess.py +++ b/client/tests/kvm/kvm_subprocess.py @@ -1103,7 +1103,7 @@ class kvm_shell_session(kvm_expect): @param prompt: Regular expression describing the shell's prompt line. @param status_test_command: Command to be used for getting the last exit status of commands run inside the shell (used by - get_command_status_output() and friends). + cmd_status_output() and friends). """ # Init the superclass kvm_expect.__init__(self, command, id, auto_close, echo, linesep, @@ -1193,8 +1193,8 @@ class kvm_shell_session(kvm_expect): return o - def get_command_output(self, cmd, timeout=30.0, internal_timeout=None, - print_func=None): + def cmd_output(self, cmd, timeout=30.0, internal_timeout=None, + print_func=None): """ Send a command and return its output. @@ -1237,8 +1237,8 @@ class kvm_shell_session(kvm_expect): return remove_last_nonempty_line(remove_command_echo(o, cmd)) - def get_command_status_output(self, cmd, timeout=30.0, - internal_timeout=None, print_func=None): + def cmd_status_output(self, cmd, timeout=30.0, internal_timeout=None, + print_func=None): """ Send a command and return its exit status and output. @@ -1257,11 +1257,10 @@ class kvm_shell_session(kvm_expect): @raise ShellStatusError: Raised if the exit status cannot be obtained @raise ShellError: Raised if an unknown error occurs """ - o = self.get_command_output(cmd, timeout, internal_timeout, print_func) + o = self.cmd_output(cmd, timeout, internal_timeout, print_func) try: # Send the 'echo $?' (or equivalent) command to get the exit status - s = self.get_command_output(self.status_test_command, 10, - internal_timeout) + s = self.cmd_output(self.status_test_command, 10, internal_timeout) except ShellError: raise ShellStatusError(cmd, o) @@ -1273,8 +1272,8 @@ class kvm_shell_session(kvm_expect): raise ShellStatusError(cmd, o) - def get_command_status(self, cmd, timeout=30.0, internal_timeout=None, - print_func=None): + def cmd_status(self, cmd, timeout=30.0, internal_timeout=None, + print_func=None): """ Send a command and return its exit status. @@ -1292,8 +1291,8 @@ class kvm_shell_session(kvm_expect): @raise ShellStatusError: Raised if the exit status cannot be obtained @raise ShellError: Raised if an unknown error occurs """ - s, o = self.get_command_status_output(cmd, timeout, internal_timeout, - print_func) + s, o = self.cmd_status_output(cmd, timeout, internal_timeout, + print_func) return s @@ -1319,8 +1318,8 @@ class kvm_shell_session(kvm_expect): @raise ShellError: Raised if an unknown error occurs @raise ShellCmdError: Raised if the exit status is nonzero """ - s, o = self.get_command_status_output(cmd, timeout, internal_timeout, - print_func) + s, o = self.cmd_status_output(cmd, timeout, internal_timeout, + print_func) if s != 0: raise ShellCmdError(cmd, s, o) return o diff --git a/client/tests/kvm/kvm_test_utils.py b/client/tests/kvm/kvm_test_utils.py index 8d287b2..26d5164 100644 --- a/client/tests/kvm/kvm_test_utils.py +++ b/client/tests/kvm/kvm_test_utils.py @@ -252,7 +252,7 @@ def stop_windows_service(session, service, timeout=120): """ end_time = time.time() + timeout while time.time() < end_time: - o = session.get_command_output("sc stop %s" % service, timeout=60) + o = session.cmd_output("sc stop %s" % service, timeout=60) # FAILED 1060 means the service isn't installed. # FAILED 1062 means the service hasn't been started. if re.search(r"\bFAILED (1060|1062)\b", o, re.I): @@ -274,7 +274,7 @@ def start_windows_service(session, service, timeout=120): """ end_time = time.time() + timeout while time.time() < end_time: - o = session.get_command_output("sc start %s" % service, timeout=60) + o = session.cmd_output("sc start %s" % service, timeout=60) # FAILED 1060 means the service isn't installed. if re.search(r"\bFAILED 1060\b", o, re.I): raise error.TestError("Could not start service '%s' " @@ -306,7 +306,7 @@ def get_time(session, time_command, time_filter_re, time_format): """ if len(re.findall("ntpdate|w32tm", time_command)) == 0: host_time = time.time() - s = session.get_command_output(time_command) + s = session.cmd_output(time_command) try: s = re.findall(time_filter_re, s)[0] @@ -398,7 +398,7 @@ def run_autotest(vm, session, control_path, timeout, outputdir): copy = False local_hash = utils.hash_file(local_path) basename = os.path.basename(local_path) - output = session.get_command_output("md5sum %s" % remote_path) + output = session.cmd_output("md5sum %s" % remote_path) if "such file" in output: remote_hash = "0" elif output: @@ -451,7 +451,7 @@ def run_autotest(vm, session, control_path, timeout, outputdir): Get the status of the tests that were executed on the host and close the session where autotest was being executed. """ - output = session.get_command_output("cat results/*/status") + output = session.cmd_output("cat results/*/status") try: results = scan_results.parse_results(output) # Report test results @@ -509,8 +509,8 @@ def run_autotest(vm, session, control_path, timeout, outputdir): try: try: logging.info("---------------- Test output ----------------") - session.get_command_output("bin/autotest control", timeout=timeout, - print_func=logging.info) + session.cmd_output("bin/autotest control", timeout=timeout, + print_func=logging.info) finally: logging.info("------------- End of test output ------------") except kvm_subprocess.ShellTimeoutError: @@ -588,8 +588,8 @@ def raw_ping(command, timeout, session, output_func): return status, output else: try: - output = session.get_command_output(command, timeout=timeout, - print_func=output_func) + output = session.cmd_output(command, timeout=timeout, + print_func=output_func) except kvm_subprocess.ShellTimeoutError: # Send ctrl+c (SIGINT) through ssh session session.send("\003") @@ -671,7 +671,7 @@ def get_linux_ifname(session, mac_address): @mac_address: the macaddress of nic """ - output = session.get_command_output("ifconfig -a") + output = session.cmd_output("ifconfig -a") try: ethname = re.findall("(\w+)\s+Link.*%s" % mac_address, output, diff --git a/client/tests/kvm/tests/ethtool.py b/client/tests/kvm/tests/ethtool.py index b93c5a1..b839963 100644 --- a/client/tests/kvm/tests/ethtool.py +++ b/client/tests/kvm/tests/ethtool.py @@ -51,7 +51,7 @@ def run_ethtool(test, params, env): return False cmd = "ethtool -K %s %s %s" % (ethname, type, status) if ethtool_get(type) != status: - return session.get_command_status(cmd) == 0 + return session.cmd_status(cmd) == 0 if ethtool_get(type) != status: logging.error("Fail to set %s %s" % (type, status)) return False @@ -74,7 +74,7 @@ def run_ethtool(test, params, env): logging.info("Compare md5sum of the files on guest and host") host_result = utils.hash_file(name, method="md5") try: - o = session.get_command_output("md5sum %s" % name) + o = session.cmd_output("md5sum %s" % name) guest_result = re.findall("\w+", o)[0] except IndexError: logging.error("Could not get file md5sum in guest") @@ -92,13 +92,13 @@ def run_ethtool(test, params, env): @param src: Source host of transfer file @return: Tuple (status, error msg/tcpdump result) """ - session2.get_command_output("rm -rf %s" % filename) + session2.cmd_output("rm -rf %s" % filename) dd_cmd = ("dd if=/dev/urandom of=%s bs=1M count=%s" % (filename, params.get("filesize"))) logging.info("Creat file in source host, cmd: %s" % dd_cmd) tcpdump_cmd = "tcpdump -lep -s 0 tcp -vv port ssh" if src == "guest": - session.get_command_output(dd_cmd, timeout=360) + session.cmd_output(dd_cmd, timeout=360) tcpdump_cmd += " and src %s" % guest_ip copy_files_fun = vm.copy_files_from else: @@ -115,15 +115,15 @@ def run_ethtool(test, params, env): tcpdump_cmd += " and not port %s" % i logging.debug("Listen by command: %s" % tcpdump_cmd) session2.sendline(tcpdump_cmd) - if not kvm_utils.wait_for(lambda: session.get_command_status( - "pgrep tcpdump") == 0, 30): + cmd = "pgrep tcpdump" + if not kvm_utils.wait_for(lambda: session.cmd_status(cmd) == 0, 30): return (False, "Tcpdump process wasn't launched") logging.info("Start to transfer file") if not copy_files_fun(filename, filename): return (False, "Child process transfer file failed") logging.info("Transfer file completed") - if session.get_command_status("killall tcpdump") != 0: + if session.cmd_status("killall tcpdump") != 0: return (False, "Could not kill all tcpdump process") try: tcpdump_string = session2.read_up_to_prompt(timeout=60) @@ -174,7 +174,7 @@ def run_ethtool(test, params, env): session = kvm_test_utils.wait_for_login(vm, timeout=int(params.get("login_timeout", 360))) # Let's just error the test if we identify that there's no ethtool installed - if session.get_command_status("ethtool -h"): + if session.cmd_status("ethtool -h"): raise error.TestError("Command ethtool not installed on guest") session2 = kvm_test_utils.wait_for_login(vm, timeout=int(params.get("login_timeout", 360))) diff --git a/client/tests/kvm/tests/guest_s4.py b/client/tests/kvm/tests/guest_s4.py index 2eb035b..2c38013 100644 --- a/client/tests/kvm/tests/guest_s4.py +++ b/client/tests/kvm/tests/guest_s4.py @@ -16,7 +16,7 @@ def run_guest_s4(test, params, env): session = kvm_test_utils.wait_for_login(vm, timeout=timeout) logging.info("Checking whether guest OS supports suspend to disk (S4)...") - s, o = session.get_command_status_output(params.get("check_s4_support_cmd")) + s, o = session.cmd_status_output(params.get("check_s4_support_cmd")) if "not enough space" in o: raise error.TestError("Check S4 support failed: %s" % o) elif s != 0: @@ -36,7 +36,7 @@ def run_guest_s4(test, params, env): # Make sure the background program is running as expected check_s4_cmd = params.get("check_s4_cmd") - if session2.get_command_status(check_s4_cmd) != 0: + if session2.cmd_status(check_s4_cmd) != 0: raise error.TestError("Failed to launch '%s' as a background process" % test_s4_cmd) logging.info("Launched background command in guest: %s" % test_s4_cmd) @@ -68,11 +68,11 @@ def run_guest_s4(test, params, env): # Check whether the test command is still alive logging.info("Checking if background command is still alive...") - if session2.get_command_status(check_s4_cmd) != 0: + if session2.cmd_status(check_s4_cmd) != 0: raise error.TestFail("Background command '%s' stopped running. S4 " "failed." % test_s4_cmd) logging.info("VM resumed successfuly after suspend to disk") - session2.get_command_output(params.get("kill_test_s4_cmd")) + session2.cmd_output(params.get("kill_test_s4_cmd")) session.close() session2.close() diff --git a/client/tests/kvm/tests/guest_test.py b/client/tests/kvm/tests/guest_test.py index da38afd..bdc5366 100644 --- a/client/tests/kvm/tests/guest_test.py +++ b/client/tests/kvm/tests/guest_test.py @@ -56,8 +56,7 @@ def run_guest_test(test, params, env): 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) diff --git a/client/tests/kvm/tests/iofuzz.py b/client/tests/kvm/tests/iofuzz.py index 77f4761..e77540e 100644 --- a/client/tests/kvm/tests/iofuzz.py +++ b/client/tests/kvm/tests/iofuzz.py @@ -98,7 +98,7 @@ def run_iofuzz(test, params, env): r = random.SystemRandom() logging.info("Enumerate guest devices through /proc/ioports") - ioports = session.get_command_output("cat /proc/ioports") + ioports = session.cmd_output("cat /proc/ioports") logging.debug(ioports) devices = re.findall("(\w+)-(\w+)\ : (.*)", ioports) diff --git a/client/tests/kvm/tests/ioquit.py b/client/tests/kvm/tests/ioquit.py index bdccd78..f8c8956 100644 --- a/client/tests/kvm/tests/ioquit.py +++ b/client/tests/kvm/tests/ioquit.py @@ -20,13 +20,13 @@ def run_ioquit(test, params, env): try: bg_cmd = params.get("background_cmd") logging.info("Add IO workload for guest OS.") - session.get_command_output(bg_cmd, timeout=60) + session.cmd_output(bg_cmd, timeout=60) check_cmd = params.get("check_cmd") session2.cmd(check_cmd, timeout=60) logging.info("Sleep for a while") time.sleep(random.randrange(30,100)) - if session2.get_command_status(check_cmd, timeout=60) != 0: + if session2.cmd_status(check_cmd, timeout=60) != 0: logging.info("IO workload finished before the VM was killed") logging.info("Kill the virtual machine") vm.process.close() diff --git a/client/tests/kvm/tests/iozone_windows.py b/client/tests/kvm/tests/iozone_windows.py index a96fdfc..febf898 100644 --- a/client/tests/kvm/tests/iozone_windows.py +++ b/client/tests/kvm/tests/iozone_windows.py @@ -28,8 +28,8 @@ def run_iozone_windows(test, params, env): c = params.get("iozone_cmd") t = int(params.get("iozone_timeout")) logging.info("Running IOzone command on guest, timeout %ss", t) - results = session.get_command_output(command=c, timeout=t, - print_func=logging.debug) + results = session.cmd_output(command=c, timeout=t, + print_func=logging.debug) utils.open_write_close(results_path, results) # Postprocess the results using the IOzone postprocessing module diff --git a/client/tests/kvm/tests/ksm_overcommit.py b/client/tests/kvm/tests/ksm_overcommit.py index dbd05dc..f60929e 100644 --- a/client/tests/kvm/tests/ksm_overcommit.py +++ b/client/tests/kvm/tests/ksm_overcommit.py @@ -230,7 +230,7 @@ def run_ksm_overcommit(test, params, env): (mem / 200 * 50 * perf_ratio)) logging.debug(kvm_test_utils.get_memory_info([lvms[last_vm]])) - lsessions[i].get_command_output("die()", 20) + lsessions[i].cmd_output("die()", 20) lvms[last_vm].destroy(gracefully = False) logging.info("Phase 3b: PASS") @@ -356,7 +356,7 @@ def run_ksm_overcommit(test, params, env): logging.debug("Cleaning up...") for i in range(0, max_alloc): - lsessions[i].get_command_output("die()", 20) + lsessions[i].cmd_output("die()", 20) session.close() vm.destroy(gracefully = False) diff --git a/client/tests/kvm/tests/linux_s3.py b/client/tests/kvm/tests/linux_s3.py index 55acea3..3baf660 100644 --- a/client/tests/kvm/tests/linux_s3.py +++ b/client/tests/kvm/tests/linux_s3.py @@ -16,13 +16,13 @@ def run_linux_s3(test, params, env): session = kvm_test_utils.wait_for_login(vm, timeout=timeout) logging.info("Checking that VM supports S3") - if session.get_command_status("grep -q mem /sys/power/state") != 0: + if session.cmd_status("grep -q mem /sys/power/state") != 0: raise error.TestFail("Guest does not support S3") logging.info("Waiting for a while for X to start") time.sleep(10) - src_tty = session.get_command_output("fgconsole").strip() + src_tty = session.cmd_output("fgconsole").strip() logging.info("Current virtual terminal is %s" % src_tty) if src_tty not in map(str, range(1,10)): raise error.TestFail("Got a strange current vt (%s)" % src_tty) diff --git a/client/tests/kvm/tests/migration.py b/client/tests/kvm/tests/migration.py index 513b500..e883838 100644 --- a/client/tests/kvm/tests/migration.py +++ b/client/tests/kvm/tests/migration.py @@ -29,7 +29,7 @@ def run_migration(test, params, env): # Get the output of migration_test_command test_command = params.get("migration_test_command") - reference_output = session.get_command_output(test_command) + reference_output = session.cmd_output(test_command) # Start some process in the background (and leave the session open) background_command = params.get("migration_bg_command", "") @@ -60,7 +60,7 @@ def run_migration(test, params, env): session2.cmd(check_command, timeout=30) # Get the output of migration_test_command - output = session2.get_command_output(test_command) + output = session2.cmd_output(test_command) # Compare output to reference output if output != reference_output: @@ -77,8 +77,7 @@ def run_migration(test, params, env): finally: # Kill the background process if session2 and session2.is_alive(): - session2.get_command_output(params.get("migration_bg_kill_command", - "")) + session2.cmd_output(params.get("migration_bg_kill_command", "")) session2.close() session.close() diff --git a/client/tests/kvm/tests/multicast.py b/client/tests/kvm/tests/multicast.py index 4a1b4f5..2a12b4f 100644 --- a/client/tests/kvm/tests/multicast.py +++ b/client/tests/kvm/tests/multicast.py @@ -56,8 +56,8 @@ def run_multicast(test, params, env): mcast_path = os.path.join(test.bindir, "scripts/join_mcast.py") if not vm.copy_files_to(mcast_path, "/tmp"): raise error.TestError("Fail to copy %s to guest" % mcast_path) - output = session.get_command_output("python /tmp/join_mcast.py %d %s %d" % - (mgroup_count, prefix, suffix)) + output = session.cmd_output("python /tmp/join_mcast.py %d %s %d" % + (mgroup_count, prefix, suffix)) # if success to join multicast, the process will be paused, and return PID. try: @@ -86,6 +86,6 @@ def run_multicast(test, params, env): (s, o)) finally: - logging.debug(session.get_command_output("ipmaddr show")) - session.get_command_output("kill -s SIGCONT %s" % pid) + logging.debug(session.cmd_output("ipmaddr show")) + session.cmd_output("kill -s SIGCONT %s" % pid) session.close() diff --git a/client/tests/kvm/tests/netperf.py b/client/tests/kvm/tests/netperf.py index 64ff4c6..7e39f6a 100644 --- a/client/tests/kvm/tests/netperf.py +++ b/client/tests/kvm/tests/netperf.py @@ -26,7 +26,7 @@ def run_netperf(test, params, env): result_file = os.path.join(test.resultsdir, "output_%s" % test.iteration) firewall_flush = "iptables -F" - session.get_command_output(firewall_flush) + session.cmd_output(firewall_flush) for i in params.get("netperf_files").split(): if not vm.copy_files_to(os.path.join(netperf_dir, i), "/tmp"): @@ -65,5 +65,5 @@ def run_netperf(test, params, env): ", ".join(list_fail)) finally: - session.get_command_output("killall netserver") + session.cmd_output("killall netserver") session.close() diff --git a/client/tests/kvm/tests/nic_promisc.py b/client/tests/kvm/tests/nic_promisc.py index 95f43ec..080fe94 100644 --- a/client/tests/kvm/tests/nic_promisc.py +++ b/client/tests/kvm/tests/nic_promisc.py @@ -82,12 +82,12 @@ def run_nic_promisc(test, params, env): logging.info("Clean temporary files") cmd = "rm -f %s" % filename utils.run(cmd) - session.get_command_output(cmd) + session.cmd_output(cmd) finally: logging.info("Restore the %s to the nonpromisc mode", ethname) session2.close() - session.get_command_output("ip link set %s promisc off" % ethname) + session.cmd_output("ip link set %s promisc off" % ethname) session.close() if success_counter != 2 * len(file_size): diff --git a/client/tests/kvm/tests/nicdriver_unload.py b/client/tests/kvm/tests/nicdriver_unload.py index cc0879c..3dacbfa 100644 --- a/client/tests/kvm/tests/nicdriver_unload.py +++ b/client/tests/kvm/tests/nicdriver_unload.py @@ -74,7 +74,7 @@ def run_nicdriver_unload(test, params, env): try: session2.cmd(unload_load_cmd, timeout=120) except: - session.get_command_output("rm -rf /tmp/Thread-*") + session.cmd_output("rm -rf /tmp/Thread-*") raise pid, s = os.waitpid(pid, os.WNOHANG) status = os.WEXITSTATUS(s) @@ -107,5 +107,5 @@ def run_nicdriver_unload(test, params, env): raise error.TestFail("Test nic function after load/unload fail") finally: - session.get_command_output("rm -rf /tmp/Thread-*") + session.cmd_output("rm -rf /tmp/Thread-*") session.close() diff --git a/client/tests/kvm/tests/pci_hotplug.py b/client/tests/kvm/tests/pci_hotplug.py index 1b38927..3f07bda 100644 --- a/client/tests/kvm/tests/pci_hotplug.py +++ b/client/tests/kvm/tests/pci_hotplug.py @@ -32,7 +32,7 @@ def run_pci_hotplug(test, params, env): info_pci_ref = vm.monitor.info("pci") # Get output of command as reference - reference = session.get_command_output(params.get("reference_cmd")) + reference = session.cmd_output(params.get("reference_cmd")) tested_model = params.get("pci_model") test_type = params.get("pci_type") @@ -130,7 +130,7 @@ def run_pci_hotplug(test, params, env): # Define a helper function to compare the output def new_shown(): - o = session.get_command_output(params.get("reference_cmd")) + o = session.cmd_output(params.get("reference_cmd")) return o != reference secs = int(params.get("wait_secs_for_hook_up")) @@ -141,7 +141,7 @@ def run_pci_hotplug(test, params, env): # Define a helper function to catch PCI device string def find_pci(): - o = session.get_command_output(params.get("find_pci_cmd")) + o = session.cmd_output(params.get("find_pci_cmd")) return params.get("match_string") in o if not kvm_utils.wait_for(find_pci, 30, 3, 3): diff --git a/client/tests/kvm/tests/physical_resources_check.py b/client/tests/kvm/tests/physical_resources_check.py index 682c7b2..0630ac8 100644 --- a/client/tests/kvm/tests/physical_resources_check.py +++ b/client/tests/kvm/tests/physical_resources_check.py @@ -135,7 +135,7 @@ def run_physical_resources_check(test, params, env): def verify_device(expect, name, verify_cmd): f_fail = 0 if verify_cmd: - actual = session.get_command_output(verify_cmd) + actual = session.cmd_output(verify_cmd) if not string.upper(expect) in actual: f_fail += 1 logging.error("%s mismatch:") diff --git a/client/tests/kvm/tests/timedrift.py b/client/tests/kvm/tests/timedrift.py index a6d3076..e5aa316 100644 --- a/client/tests/kvm/tests/timedrift.py +++ b/client/tests/kvm/tests/timedrift.py @@ -146,7 +146,7 @@ def run_timedrift(test, params, env): restore_cpu_affinity(prev_affinity) # Stop the guest load if guest_load_stop_command: - session.get_command_output(guest_load_stop_command) + session.cmd_output(guest_load_stop_command) # Close all load shell sessions for load_session in guest_load_sessions: load_session.close() diff --git a/client/tests/kvm/tests/vlan.py b/client/tests/kvm/tests/vlan.py index 8641c23..dfaf9d3 100644 --- a/client/tests/kvm/tests/vlan.py +++ b/client/tests/kvm/tests/vlan.py @@ -48,8 +48,7 @@ def run_vlan(test, params, env): def rem_vlan(session, id, iface="eth0"): rem_vlan_cmd = "if [[ -e /proc/net/vlan/%s ]];then vconfig rem %s;fi" iface = "%s.%s" % (iface, id) - s = session.get_command_status(rem_vlan_cmd % (iface, iface)) - return s + return session.cmd_status(rem_vlan_cmd % (iface, iface)) def nc_transfer(src, dst): nc_port = kvm_utils.find_free_port(1025, 5334, vm_ip[dst]) @@ -62,7 +61,7 @@ def run_vlan(test, params, env): time.sleep(2) #send file from src to dst send_cmd = send_cmd % (vlan_ip[dst], str(nc_port), "file") - if session[src].get_command_status(send_cmd, timeout=60) != 0: + if session[src].cmd_status(send_cmd, timeout=60) != 0: raise error.TestFail ("Fail to send file" " from vm%s to vm%s" % (src+1, dst+1)) try: @@ -71,7 +70,7 @@ def run_vlan(test, params, env): raise error.TestFail ("Fail to receive file" " from vm%s to vm%s" % (src+1, dst+1)) #check MD5 message digest of receive file in dst - output = session[dst].get_command_output("md5sum receive").strip() + output = session[dst].cmd_output("md5sum receive").strip() digest_receive = re.findall(r'(\w+)', output)[0] if digest_receive == digest_origin[src]: logging.info("file succeed received in vm %s" % vlan_ip[dst]) @@ -79,7 +78,7 @@ def run_vlan(test, params, env): logging.info("digest_origin is %s" % digest_origin[src]) logging.info("digest_receive is %s" % digest_receive) raise error.TestFail("File transfered differ from origin") - session[dst].get_command_output("rm -f receive") + session[dst].cmd_output("rm -f receive") for i in range(2): session.append(kvm_test_utils.wait_for_login(vm[i], @@ -101,7 +100,7 @@ def run_vlan(test, params, env): digest_origin.append(re.findall(r'(\w+)', output)[0]) #stop firewall in vm - session[i].get_command_output("/etc/init.d/iptables stop") + session[i].cmd_output("/etc/init.d/iptables stop") #load 8021q module for vconfig session[i].cmd("modprobe 8021q") diff --git a/client/tests/kvm/tests/whql_client_install.py b/client/tests/kvm/tests/whql_client_install.py index 52daa31..1c3f1c8 100644 --- a/client/tests/kvm/tests/whql_client_install.py +++ b/client/tests/kvm/tests/whql_client_install.py @@ -54,14 +54,14 @@ def run_whql_client_install(test, params, env): # Get server and client information cmd = "echo %computername%" - server_name = server_session.get_command_output(cmd).strip() - client_name = session.get_command_output(cmd).strip() + server_name = server_session.cmd_output(cmd).strip() + client_name = session.cmd_output(cmd).strip() cmd = "wmic computersystem get domain" - server_workgroup = server_session.get_command_output(cmd).strip() + server_workgroup = server_session.cmd_output(cmd).strip() server_workgroup = server_workgroup.splitlines()[-1] regkey = r"HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" cmd = "reg query %s /v Domain" % regkey - o = server_session.get_command_output(cmd).strip().splitlines()[-1] + o = server_session.cmd_output(cmd).strip().splitlines()[-1] try: server_dns_suffix = o.split(None, 2)[2] except IndexError: @@ -101,7 +101,7 @@ def run_whql_client_install(test, params, env): server_password) end_time = time.time() + 120 while time.time() < end_time: - if session.get_command_status(cmd) == 0: + if session.cmd_status(cmd) == 0: break time.sleep(5) else: diff --git a/client/tests/kvm/tests/whql_submission.py b/client/tests/kvm/tests/whql_submission.py index 3930954..b1b7f25 100644 --- a/client/tests/kvm/tests/whql_submission.py +++ b/client/tests/kvm/tests/whql_submission.py @@ -54,8 +54,8 @@ def run_whql_submission(test, params, env): # Get the computer names of the server and client cmd = "echo %computername%" - server_name = server_session.get_command_output(cmd).strip() - client_name = session.get_command_output(cmd).strip() + server_name = server_session.cmd_output(cmd).strip() + client_name = session.cmd_output(cmd).strip() session.close() # Run the automation program on the server