KVM test: kvm_subprocess: use read_nonblocking(0) instead of read_nonblocking (0.1)
In get_command_status_output() and is_responsive() use read_nonblocking(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 there's no
guarantee that a value of 0.1 will suffice. Therefore, it is be the user's
responsibility to make sure the guest stopped producing output before
get_command_status_output() is called. This 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 <mgoldish@redhat.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@3793 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/tests/kvm/kvm_subprocess.py b/client/tests/kvm/kvm_subprocess.py
index 424c801..730f20e 100755
--- a/client/tests/kvm/kvm_subprocess.py
+++ b/client/tests/kvm/kvm_subprocess.py
@@ -1028,7 +1028,7 @@
"""
# Read all output that's waiting to be read, to make sure the output
# we read next is in response to the newline sent
- self.read_nonblocking(timeout=0.1)
+ self.read_nonblocking(timeout=0)
# Send a newline
self.sendline()
# Wait up to timeout seconds for some output from the child
@@ -1095,7 +1095,7 @@
logging.debug("Sending command: %s" % command)
# Read everything that's waiting to be read
- self.read_nonblocking(0.1)
+ self.read_nonblocking(timeout=0)
# Send the command and get its output
self.sendline(command)