[KVM-AUTOTEST PATCH] KVM test: kvm_subprocess: fix a problem that arises with Python 2.6

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

 



After launching the server the client waits for it to finish initializing.
This is done by waiting for a line of output from the server's STDOUT.
Currently, the client assumes that the first line of output coming from the
server indicates that it's done initializing.  With Python 2.4 this used to be
true, but Python 2.6 prints deprecation warnings for certain standard modules
as soon as they are imported.  This makes the client think the server is ready
when in fact it isn't.

This patch fixes the problem by waiting for a certain unique output line from
the server instead of just waiting for the first line.

Signed-off-by: Michael Goldish <mgoldish@xxxxxxxxxx>
---
 client/tests/kvm/kvm_subprocess.py |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/client/tests/kvm/kvm_subprocess.py b/client/tests/kvm/kvm_subprocess.py
index 413bdaa..c15e779 100644
--- a/client/tests/kvm/kvm_subprocess.py
+++ b/client/tests/kvm/kvm_subprocess.py
@@ -212,7 +212,8 @@ class kvm_spawn:
             sub.stdin.write("%s\n" % ",".join(self.readers))
             sub.stdin.write("%s\n" % command)
             # Wait for the server to complete its initialization
-            sub.stdout.readline()
+            while not "Server %s ready" % self.id in sub.stdout.readline():
+                pass
 
         # Open the reading pipes
         self.reader_fds = {}
@@ -1081,7 +1082,7 @@ def _server_main():
         file.close()
 
         # Print something to stdout so the client can start working
-        print "hello"
+        print "Server %s ready" % id
         sys.stdout.flush()
 
         # Initialize buffers
-- 
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