From patchwork Tue Sep 29 20:04:23 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Goldish X-Patchwork-Id: 50593 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8TK8Jjf029657 for ; Tue, 29 Sep 2009 20:08:19 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754032AbZI2UIF (ORCPT ); Tue, 29 Sep 2009 16:08:05 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753738AbZI2UIE (ORCPT ); Tue, 29 Sep 2009 16:08:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41357 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752068AbZI2UIB (ORCPT ); Tue, 29 Sep 2009 16:08:01 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8TK84t4021660; Tue, 29 Sep 2009 16:08:05 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n8TK83Rc004848; Tue, 29 Sep 2009 16:08:04 -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 n8TK80NW003847; Tue, 29 Sep 2009 16:08:02 -0400 From: Michael Goldish To: autotest@test.kernel.org, kvm@vger.kernel.org Cc: Michael Goldish Subject: [KVM-AUTOTEST PATCH 2/6] KVM test: AutoIt and Autotest wrappers: use get_command_output() instead of sendline() Date: Tue, 29 Sep 2009 22:04:23 +0200 Message-Id: <1254254667-19385-2-git-send-email-mgoldish@redhat.com> In-Reply-To: <1254254667-19385-1-git-send-email-mgoldish@redhat.com> References: <1254254667-19385-1-git-send-email-mgoldish@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/client/tests/kvm/tests/autoit.py b/client/tests/kvm/tests/autoit.py index fd2a2cb..9435d7c 100644 --- a/client/tests/kvm/tests/autoit.py +++ b/client/tests/kvm/tests/autoit.py @@ -30,18 +30,17 @@ def run_autoit(test, params, env): # Send AutoIt script to guest (this code will be replaced once we # support sending files to Windows guests) - session.sendline("del script.au3") + session.get_command_output("del script.au3", internal_timeout=0) file = open(kvm_utils.get_path(test.bindir, script)) for line in file.readlines(): # Insert a '^' before each character line = "".join("^" + c for c in line.rstrip()) if line: # Append line to the file - session.sendline("echo %s>>script.au3" % line) + session.get_command_output("echo %s>>script.au3" % line, + internal_timeout=0) file.close() - session.read_up_to_prompt() - command = "cmd /c %s script.au3 %s" % (binary, script_params) logging.info("---------------- Script output ----------------") diff --git a/client/tests/kvm/tests/autotest.py b/client/tests/kvm/tests/autotest.py index 5c9b2aa..798217d 100644 --- a/client/tests/kvm/tests/autotest.py +++ b/client/tests/kvm/tests/autotest.py @@ -85,7 +85,7 @@ def run_autotest(test, params, env): extract(vm, "autotest.tar.bz2") # mkdir autotest/tests - session.sendline("mkdir autotest/tests") + session.get_command_output("mkdir autotest/tests") # Extract .tar.bz2 into autotest/tests extract(vm, test_name + ".tar.bz2", "autotest/tests") @@ -99,10 +99,9 @@ def run_autotest(test, params, env): # Run the test logging.info("Running test '%s'..." % test_name) - session.sendline("cd autotest") - session.sendline("rm -f control.state") - session.sendline("rm -rf results/*") - session.read_up_to_prompt() + session.get_command_output("cd autotest") + session.get_command_output("rm -f control.state") + session.get_command_output("rm -rf results/*") logging.info("---------------- Test output ----------------") status = session.get_command_status("bin/autotest control", timeout=test_timeout,