[KVM-AUTOTEST PATCH 1/6] KVM test: kvm_subprocess: use read_nonblocking(0) instead of read_nonblocking (0.1)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 client/tests/kvm/kvm_subprocess.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

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 @@ class kvm_shell_session(kvm_expect):
         """
         # 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 @@ class kvm_shell_session(kvm_expect):
         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)
-- 
1.5.4.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux