From patchwork Tue Jan 11 04:17:18 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Meneghel Rodrigues X-Patchwork-Id: 470191 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 p0B4HXiR032355 for ; Tue, 11 Jan 2011 04:17:33 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755381Ab1AKER0 (ORCPT ); Mon, 10 Jan 2011 23:17:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45297 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755368Ab1AKERX (ORCPT ); Mon, 10 Jan 2011 23:17:23 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0B4HM4Q011919 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 10 Jan 2011 23:17:22 -0500 Received: from freedom.redhat.com (vpn-9-142.rdu.redhat.com [10.11.9.142]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p0B4HKY7022942; Mon, 10 Jan 2011 23:17:21 -0500 From: Lucas Meneghel Rodrigues To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, Lucas Meneghel Rodrigues , Amos Kong Subject: [PATCH] KVM test: ethtool subtest: Check failure on dd executed on guest Date: Tue, 11 Jan 2011 02:17:18 -0200 Message-Id: <1294719438-16520-1-git-send-email-lmr@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 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.6 (demeter1.kernel.org [140.211.167.41]); Tue, 11 Jan 2011 04:17:33 +0000 (UTC) diff --git a/client/tests/kvm/tests/ethtool.py b/client/tests/kvm/tests/ethtool.py index 9708497..2d5b0fc 100644 --- a/client/tests/kvm/tests/ethtool.py +++ b/client/tests/kvm/tests/ethtool.py @@ -1,4 +1,4 @@ -import logging, commands, re +import logging, re from autotest_lib.client.common_lib import error from autotest_lib.client.bin import utils import kvm_test_utils, kvm_utils, kvm_subprocess @@ -99,18 +99,23 @@ def run_ethtool(test, params, env): 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) + failure = (False, "Failed to create file using dd, cmd: %s" % dd_cmd) + logging.info("Creating file in source host, cmd: %s" % dd_cmd) tcpdump_cmd = "tcpdump -lep -s 0 tcp -vv port ssh" if src == "guest": - session.cmd_output(dd_cmd, timeout=360) tcpdump_cmd += " and src %s" % guest_ip copy_files_from = vm.copy_files_from + try: + session.cmd_output(dd_cmd, timeout=360) + except kvm_subprocess.ShellCmdError, e: + return failure else: - s, o = commands.getstatusoutput(dd_cmd) tcpdump_cmd += " and dst %s" % guest_ip copy_files_from = vm.copy_files_to - if s != 0: - return (False, "Fail to create file by dd, cmd: %s" % dd_cmd) + try: + utils.system(dd_cmd) + except error.CmdError, e: + return failure # only capture the new tcp port after offload setup original_tcp_ports = re.findall("tcp.*:(\d+).*%s" % guest_ip,