From: Lucas Meneghel Rodrigues Subject: Re: [Autotest] [KVM-AUTOTEST PATCH 1/6] KVM test: kvm_subprocess: use read_nonblocking(0) instead of read_nonblocking (0.1) Date: Mon, 5 Oct 2009 16:23:27 -0300 Message-ID: <6ac58f4f0910051223x166ca03tccc55e5f3cb4effc@mail.gmail.com> References: <1254254667-19385-1-git-send-email-mgoldish@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: autotest@test.kernel.org, kvm@vger.kernel.org To: Michael Goldish Return-path: Received: from mail-pz0-f177.google.com ([209.85.222.177]:38288 "EHLO mail-pz0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754078AbZJETYE convert rfc822-to-8bit (ORCPT ); Mon, 5 Oct 2009 15:24:04 -0400 Received: by pzk7 with SMTP id 7so3229955pzk.33 for ; Mon, 05 Oct 2009 12:23:27 -0700 (PDT) In-Reply-To: <1254254667-19385-1-git-send-email-mgoldish@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Patchset applied! On Tue, Sep 29, 2009 at 5:04 PM, Michael Goldish = wrote: > In get_command_status_output() and is_responsive() use read_nonblocki= ng(0) to > read the unread output before sending input (e.g. a command). > The timeout is currently 0.1 because theoretically it should help if = the guest > still produces output when the function is called, but in practice th= ere's no > guarantee that a value of 0.1 will suffice. =A0Therefore, it is be th= e user's > responsibility to make sure the guest stopped producing output before > get_command_status_output() is called. =A0This can be guaranteed (in = most cases) > by using get_command_status_output() and friends instead of sendline(= ) to send > commands (because the former waits for the prompt to return, whereas = the latter > returns immediately). > > Signed-off-by: Michael Goldish > --- > =A0client/tests/kvm/kvm_subprocess.py | =A0 =A04 ++-- > =A01 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/client/tests/kvm/kvm_subprocess.py b/client/tests/kvm/kv= m_subprocess.py > index 424c801..730f20e 100755 > --- a/client/tests/kvm/kvm_subprocess.py > +++ b/client/tests/kvm/kvm_subprocess.py > @@ -1028,7 +1028,7 @@ class kvm_shell_session(kvm_expect): > =A0 =A0 =A0 =A0 """ > =A0 =A0 =A0 =A0 # Read all output that's waiting to be read, to make = sure the output > =A0 =A0 =A0 =A0 # we read next is in response to the newline sent > - =A0 =A0 =A0 =A0self.read_nonblocking(timeout=3D0.1) > + =A0 =A0 =A0 =A0self.read_nonblocking(timeout=3D0) > =A0 =A0 =A0 =A0 # Send a newline > =A0 =A0 =A0 =A0 self.sendline() > =A0 =A0 =A0 =A0 # Wait up to timeout seconds for some output from the= child > @@ -1095,7 +1095,7 @@ class kvm_shell_session(kvm_expect): > =A0 =A0 =A0 =A0 logging.debug("Sending command: %s" % command) > > =A0 =A0 =A0 =A0 # Read everything that's waiting to be read > - =A0 =A0 =A0 =A0self.read_nonblocking(0.1) > + =A0 =A0 =A0 =A0self.read_nonblocking(timeout=3D0) > > =A0 =A0 =A0 =A0 # Send the command and get its output > =A0 =A0 =A0 =A0 self.sendline(command) > -- > 1.5.4.1 > > _______________________________________________ > Autotest mailing list > Autotest@test.kernel.org > http://test.kernel.org/cgi-bin/mailman/listinfo/autotest > --=20 Lucas