summaryrefslogtreecommitdiff
path: root/py/config/TestUtil.py
diff options
context:
space:
mode:
Diffstat (limited to 'py/config/TestUtil.py')
-rw-r--r--py/config/TestUtil.py134
1 files changed, 67 insertions, 67 deletions
diff --git a/py/config/TestUtil.py b/py/config/TestUtil.py
index 8b3993cd799..ef33313665b 100644
--- a/py/config/TestUtil.py
+++ b/py/config/TestUtil.py
@@ -66,17 +66,17 @@ except getopt.GetoptError:
for o, a in opts:
if o == "--debug":
- debug = 1
+ debug = 1
if o == "--protocol":
- if a not in ( "tcp", "ssl"):
- usage()
- protocol = a
+ if a not in ( "tcp", "ssl"):
+ usage()
+ protocol = a
if o == "--compress":
- compress = 1
+ compress = 1
if o == "--threadPerConnection":
- threadPerConnection = 1
+ threadPerConnection = 1
if o == "--host":
- host = a
+ host = a
def isCygwin():
@@ -133,13 +133,13 @@ def isDarwin():
def closePipe(pipe):
try:
- status = pipe.close()
+ 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
+ # 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
@@ -152,22 +152,22 @@ class ReaderThread(Thread):
def run(self):
- #print "started: " + str(self) + ": " + str(thread.get_ident())
+ #print "started: " + str(self) + ": " + str(thread.get_ident())
try:
while 1:
line = self.pipe.readline()
if not line: break
- # Suppress "adapter ready" messages. Under windows the eol isn't \n.
- if not line.endswith(" ready\n") and not line.endswith(" ready\r\n"):
- print "server: " + line,
+ # Suppress "adapter ready" messages. Under windows the eol isn't \n.
+ if not line.endswith(" ready\n") and not line.endswith(" ready\r\n"):
+ print "server: " + line,
except IOError:
pass
- self.status = closePipe(self.pipe)
- #print "terminating: " + str(self)
+ self.status = closePipe(self.pipe)
+ #print "terminating: " + str(self)
def getStatus(self):
- return self.status
+ return self.status
serverPids = []
serverThreads = []
@@ -177,18 +177,18 @@ def joinServers():
global serverThreads
global allServerThreads
for t in serverThreads:
- t.join()
- allServerThreads.append(t)
+ t.join()
+ allServerThreads.append(t)
serverThreads = []
def serverStatus():
global allServerThreads
joinServers()
for t in allServerThreads:
- status = t.getStatus()
- if status:
- print "server " + str(t) + " status: " + str(status)
- return status
+ status = t.getStatus()
+ if status:
+ print "server " + str(t) + " status: " + str(status)
+ return status
return 0
def killServers():
@@ -226,32 +226,32 @@ def getServerPid(pipe):
global serverThreads
while 1:
- output = pipe.readline().strip()
- if not output:
- print "failed!"
- killServers()
- sys.exit(1)
- if output.startswith("warning: "):
- continue
- break
+ output = pipe.readline().strip()
+ if not output:
+ print "failed!"
+ killServers()
+ sys.exit(1)
+ if output.startswith("warning: "):
+ continue
+ break
try:
- serverPids.append(int(output))
+ serverPids.append(int(output))
except ValueError:
- print "Output is not a PID: " + output
- raise
+ print "Output is not a PID: " + output
+ raise
def ignorePid(pipe):
while 1:
- output = pipe.readline().strip()
- if not output:
- print "failed!"
- killServers()
- sys.exit(1)
- if output.startswith("warning: "):
- continue
- break
+ output = pipe.readline().strip()
+ if not output:
+ print "failed!"
+ killServers()
+ sys.exit(1)
+ if output.startswith("warning: "):
+ continue
+ break
def getAdapterReady(pipe, createThread = True):
global serverThreads
@@ -265,9 +265,9 @@ def getAdapterReady(pipe, createThread = True):
# Start a thread for this server.
if createThread:
- serverThread = ReaderThread(pipe)
- serverThread.start()
- serverThreads.append(serverThread)
+ serverThread = ReaderThread(pipe)
+ serverThread.start()
+ serverThreads.append(serverThread)
def waitServiceReady(pipe, token, createThread = True):
global serverThreads
@@ -282,9 +282,9 @@ def waitServiceReady(pipe, token, createThread = True):
# Start a thread for this server.
if createThread:
- serverThread = ReaderThread(pipe)
- serverThread.start()
- serverThreads.append(serverThread)
+ serverThread = ReaderThread(pipe)
+ serverThread.start()
+ serverThreads.append(serverThread)
def printOutputFromPipe(pipe):
@@ -303,9 +303,9 @@ else:
if isWin32():
if isCygwin():
- os.environ["PATH"] = os.path.join(toplevel, "bin") + ":" + os.getenv("PATH", "")
+ os.environ["PATH"] = os.path.join(toplevel, "bin") + ":" + os.getenv("PATH", "")
else:
- os.environ["PATH"] = os.path.join(toplevel, "bin") + ";" + os.getenv("PATH", "")
+ os.environ["PATH"] = os.path.join(toplevel, "bin") + ";" + os.getenv("PATH", "")
elif isHpUx():
os.environ["SHLIB_PATH"] = os.path.join(toplevel, "lib") + ":" + os.getenv("SHLIB_PATH", "")
elif isDarwin():
@@ -317,8 +317,8 @@ else:
os.environ["LD_LIBRARY_PATH_64"] = os.path.join(toplevel, "lib") + ":" + os.getenv("LD_LIBRARY_PATH_64", "")
if protocol == "ssl":
- certs = os.path.abspath(os.path.join(toplevel, "certs"))
- plugin = " --Ice.Plugin.IceSSL=IceSSL:createIceSSL"
+ certs = os.path.abspath(os.path.join(toplevel, "certs"))
+ plugin = " --Ice.Plugin.IceSSL=IceSSL:createIceSSL"
clientProtocol = plugin + " --Ice.Default.Protocol=ssl" + \
" --IceSSL.DefaultDir=" + certs + \
" --IceSSL.CertFile=c_rsa1024_pub.pem" + \
@@ -358,7 +358,7 @@ commonServerOptions = " --Ice.PrintProcessId --Ice.PrintAdapterReady --Ice.NullH
" --Ice.ThreadPool.Server.SizeWarn=0"
commonCollocatedOptions = " --Ice.ThreadPool.Server.Size=1 --Ice.ThreadPool.Server.SizeMax=3" + \
- " --Ice.ThreadPool.Server.SizeWarn=0"
+ " --Ice.ThreadPool.Server.SizeWarn=0"
clientOptions = clientProtocol + defaultHost + commonClientOptions
serverOptions = serverProtocol + defaultHost + commonServerOptions
@@ -378,7 +378,7 @@ def clientServerTestWithOptionsAndNames(name, additionalServerOptions, additiona
print "starting " + serverName + "...",
serverCmd = "python " + server + serverOptions + additionalServerOptions
if debug:
- print "(" + serverCmd + ")",
+ print "(" + serverCmd + ")",
serverPipe = os.popen(serverCmd + " 2>&1")
getServerPid(serverPipe)
getAdapterReady(serverPipe)
@@ -387,7 +387,7 @@ def clientServerTestWithOptionsAndNames(name, additionalServerOptions, additiona
print "starting " + clientName + "...",
clientCmd = "python " + client + clientOptions + additionalClientOptions
if debug:
- print "(" + clientCmd + ")",
+ print "(" + clientCmd + ")",
clientPipe = os.popen(clientCmd + " 2>&1")
print "ok"
@@ -395,10 +395,10 @@ def clientServerTestWithOptionsAndNames(name, additionalServerOptions, additiona
clientStatus = closePipe(clientPipe)
if clientStatus:
- killServers()
+ killServers()
if clientStatus or serverStatus():
- sys.exit(1)
+ sys.exit(1)
os.chdir(cwd)
@@ -423,7 +423,7 @@ def mixedClientServerTestWithOptions(name, additionalServerOptions, additionalCl
print "starting server...",
serverCmd = "python " + server + clientServerOptions + additionalServerOptions
if debug:
- print "(" + serverCmd + ")",
+ print "(" + serverCmd + ")",
serverPipe = os.popen(serverCmd + " 2>&1")
getServerPid(serverPipe)
getAdapterReady(serverPipe)
@@ -432,7 +432,7 @@ def mixedClientServerTestWithOptions(name, additionalServerOptions, additionalCl
print "starting client...",
clientCmd = "python " + client + clientServerOptions + additionalClientOptions
if debug:
- print "(" + clientCmd + ")",
+ print "(" + clientCmd + ")",
clientPipe = os.popen(clientCmd + " 2>&1")
ignorePid(clientPipe)
getAdapterReady(clientPipe, False)
@@ -442,10 +442,10 @@ def mixedClientServerTestWithOptions(name, additionalServerOptions, additionalCl
clientStatus = closePipe(clientPipe)
if clientStatus:
- killServers()
+ killServers()
if clientStatus or serverStatus():
- sys.exit(1)
+ sys.exit(1)
os.chdir(cwd)
@@ -464,7 +464,7 @@ def collocatedTestWithOptions(name, additionalOptions):
print "starting collocated...",
command = "python " + collocated + collocatedOptions + additionalOptions
if debug:
- print "(" + command + ")",
+ print "(" + command + ")",
collocatedPipe = os.popen(command + " 2>&1")
print "ok"
@@ -473,8 +473,8 @@ def collocatedTestWithOptions(name, additionalOptions):
collocatedStatus = closePipe(collocatedPipe)
if collocatedStatus:
- killServers()
- sys.exit(1)
+ killServers()
+ sys.exit(1)
os.chdir(cwd)