wintest: check netcats exitstatus instead of output
authorBjörn Baumbach <bb@sernet.de>
Tue, 12 Jun 2012 17:45:51 +0000 (19:45 +0200)
committerKai Blin <kai@samba.org>
Thu, 21 Jun 2012 19:55:20 +0000 (21:55 +0200)
There are many netcat implementations with different output messages.

Signed-off-by: Kai Blin <kai@samba.org>
wintest/wintest.py

index 94d54de1500e4332d253ebf0976ea504f18879e3..93da47a6a622befa0d8c881a5a894b8564edf4e3 100644 (file)
@@ -492,9 +492,12 @@ options {
 
         while retries > 0:
             child = self.pexpect_spawn("nc -v -z -w 1 %s %u" % (hostname, port), crlf=False, timeout=1)
-            i = child.expect(['succeeded', 'failed', pexpect.EOF, pexpect.TIMEOUT])
+            child.expect([pexpect.EOF, pexpect.TIMEOUT])
+            child.close()
+            i = child.exitstatus
             if wait_for_fail:
-                if i > 0:
+                #wait for timeout or fail
+                if i == None or i > 0:
                     return
             else:
                 if i == 0: