diff options
author | Mark Spruiell <mes@zeroc.com> | 2006-02-01 21:31:28 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2006-02-01 21:31:28 +0000 |
commit | 388d0b7910a9560ebdbf2b4f2f911bd445d2c3a2 (patch) | |
tree | 02d31a1718d9773c1745bacc2d4fbe54167963db /cpp/config/TestUtil.py | |
parent | Fix last fix (diff) | |
download | ice-388d0b7910a9560ebdbf2b4f2f911bd445d2c3a2.tar.bz2 ice-388d0b7910a9560ebdbf2b4f2f911bd445d2c3a2.tar.xz ice-388d0b7910a9560ebdbf2b4f2f911bd445d2c3a2.zip |
fix for CentOS waitpid bug
Diffstat (limited to 'cpp/config/TestUtil.py')
-rw-r--r-- | cpp/config/TestUtil.py | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/cpp/config/TestUtil.py b/cpp/config/TestUtil.py index dfcd35e66bd..b6a7e073eac 100644 --- a/cpp/config/TestUtil.py +++ b/cpp/config/TestUtil.py @@ -45,7 +45,7 @@ host = "127.0.0.1" # Don't change anything below this line! # -import sys, os, re +import sys, os, re, errno def getIceVersion(): @@ -189,27 +189,34 @@ def getIceBox(testdir): def waitServiceReady(pipe, token): while 1: - output = pipe.readline().strip() - if not output: print "failed!" sys.exit(1) - if output == token + " ready": break def printOutputFromPipe(pipe): while 1: - c = pipe.read(1) - if c == "": break - os.write(1, c) +def closePipe(pipe): + + try: + status = pipe.close() + except IOError, ex: + # TODO: There's a waitpid problem on CentOS, so we have to ignore ECHILD. + if ex.errno == errno.ECHILD: + status = 0 + else: + raise + + return status + for toplevel in [".", "..", "../..", "../../..", "../../../.."]: toplevel = os.path.normpath(toplevel) if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): @@ -296,8 +303,8 @@ def clientServerTestWithOptionsAndNames(name, additionalServerOptions, additiona printOutputFromPipe(clientPipe) - clientStatus = clientPipe.close() - serverStatus = serverPipe.close() + clientStatus = closePipe(clientPipe) + serverStatus = closePipe(serverPipe) if clientStatus or serverStatus: killServers() @@ -331,8 +338,8 @@ def mixedClientServerTestWithOptions(name, additionalServerOptions, additionalCl printOutputFromPipe(clientPipe) - clientStatus = clientPipe.close() - serverStatus = serverPipe.close() + clientStatus = closePipe(clientPipe) + serverStatus = closePipe(serverPipe) if clientStatus or serverStatus: killServers() @@ -353,7 +360,7 @@ def collocatedTestWithOptions(name, additionalOptions): printOutputFromPipe(collocatedPipe) - collocatedStatus = collocatedPipe.close() + collocatedStatus = closePipe(collocatedPipe) if collocatedStatus: killServers() |