diff options
Diffstat (limited to 'cpp/config/TestUtil.py')
-rw-r--r-- | cpp/config/TestUtil.py | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/cpp/config/TestUtil.py b/cpp/config/TestUtil.py index e1dda31ccf8..2b88b7efce7 100644 --- a/cpp/config/TestUtil.py +++ b/cpp/config/TestUtil.py @@ -46,6 +46,7 @@ host = "127.0.0.1" # import sys, os, re, errno +from threading import Thread def getIceVersion(): @@ -217,6 +218,29 @@ def closePipe(pipe): return status +class ReaderThread(Thread): + def __init__(self, pipe, token): + self.pipe = pipe + self.token = token + Thread.__init__(self) + + def run(self): + + try: + while 1: + line = self.pipe.readline() + if not line: break + # supress object adapter ready messages. + if line[len(line)-7:len(line)] != " ready\n": + print self.token + ": " + line, + except IOError: + pass + + self.status = closePipe(self.pipe) + + def getStatus(self): + return self.status + for toplevel in [".", "..", "../..", "../../..", "../../../.."]: toplevel = os.path.normpath(toplevel) if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): @@ -305,10 +329,14 @@ def clientServerTestWithOptionsAndNames(name, additionalServerOptions, additiona clientPipe = os.popen(clientCmd) print "ok" + serverThread = ReaderThread(serverPipe, "Server") + serverThread.start() printOutputFromPipe(clientPipe) clientStatus = closePipe(clientPipe) - serverStatus = closePipe(serverPipe) + #serverStatus = closePipe(serverPipe) + serverThread.join() + serverStatus = serverThread.getStatus() if clientStatus or serverStatus: killServers() |