summaryrefslogtreecommitdiff
path: root/java/config/TestUtil.py
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2006-02-01 21:31:28 +0000
committerMark Spruiell <mes@zeroc.com>2006-02-01 21:31:28 +0000
commit388d0b7910a9560ebdbf2b4f2f911bd445d2c3a2 (patch)
tree02d31a1718d9773c1745bacc2d4fbe54167963db /java/config/TestUtil.py
parentFix last fix (diff)
downloadice-388d0b7910a9560ebdbf2b4f2f911bd445d2c3a2.tar.bz2
ice-388d0b7910a9560ebdbf2b4f2f911bd445d2c3a2.tar.xz
ice-388d0b7910a9560ebdbf2b4f2f911bd445d2c3a2.zip
fix for CentOS waitpid bug
Diffstat (limited to 'java/config/TestUtil.py')
-rw-r--r--java/config/TestUtil.py35
1 files changed, 21 insertions, 14 deletions
diff --git a/java/config/TestUtil.py b/java/config/TestUtil.py
index a8b478403ae..b54b86bc0f3 100644
--- a/java/config/TestUtil.py
+++ b/java/config/TestUtil.py
@@ -48,7 +48,7 @@ host = "127.0.0.1"
# Don't change anything below this line!
#
-import sys, os
+import sys, os, errno
def isCygwin():
@@ -127,27 +127,34 @@ def getAdapterReady(serverPipe):
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")):
@@ -263,8 +270,8 @@ def clientServerTestWithOptions(additionalServerOptions, additionalClientOptions
printOutputFromPipe(clientPipe)
- clientStatus = clientPipe.close()
- serverStatus = serverPipe.close()
+ clientStatus = closePipe(clientPipe)
+ serverStatus = closePipe(serverPipe)
if clientStatus or serverStatus:
killServers()
@@ -294,8 +301,8 @@ def clientServerTestWithClasspath(serverClasspath, clientClasspath):
printOutputFromPipe(clientPipe)
- clientStatus = clientPipe.close()
- serverStatus = serverPipe.close()
+ clientStatus = closePipe(clientPipe)
+ serverStatus = closePipe(serverPipe)
if clientStatus or serverStatus:
killServers()
@@ -322,8 +329,8 @@ def mixedClientServerTestWithOptions(additionalServerOptions, additionalClientOp
printOutputFromPipe(clientPipe)
- clientStatus = clientPipe.close()
- serverStatus = serverPipe.close()
+ clientStatus = closePipe(clientPipe)
+ serverStatus = closePipe(serverPipe)
if clientStatus or serverStatus:
killServers()
@@ -343,7 +350,7 @@ def collocatedTestWithOptions(additionalOptions):
printOutputFromPipe(collocatedPipe)
- collocatedStatus = collocatedPipe.close()
+ collocatedStatus = closePipe(collocatedPipe)
if collocatedStatus:
killServers()