summaryrefslogtreecommitdiff
path: root/cpp/config/TestUtil.py
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/config/TestUtil.py')
-rw-r--r--cpp/config/TestUtil.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/cpp/config/TestUtil.py b/cpp/config/TestUtil.py
index aa170d6e37e..f50b090a411 100644
--- a/cpp/config/TestUtil.py
+++ b/cpp/config/TestUtil.py
@@ -175,6 +175,9 @@ class ReaderThread(Thread):
self.status = closePipe(self.pipe)
+ def getPipe(self):
+ return self.pipe
+
def getStatus(self):
return self.status
@@ -190,6 +193,8 @@ def joinServers():
allServerThreads.append(t)
serverThreads = []
+# This joins with all servers and if any of them failed then
+# it returns the failure status.
def serverStatus():
global allServerThreads
joinServers()
@@ -199,6 +204,19 @@ def serverStatus():
return status
return 0
+# This joins with a specific server (the one started with the given pipe)
+# returns its exit status. If the server cannot be found an exception
+# is raised.
+def specificServerStatus(pipe):
+ global serverThreads
+ for t in serverThreads:
+ if t.getPipe() == pipe:
+ serverThreads.remove(t)
+ t.join()
+ status = t.getStatus()
+ return status
+ raise "can't find server with pipe: " + str(pipe)
+
def killServers():
global serverPids