summaryrefslogtreecommitdiff
path: root/cpp/config/IcePackAdmin.py
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2004-02-19 16:24:46 +0000
committerBenoit Foucher <benoit@zeroc.com>2004-02-19 16:24:46 +0000
commit46b7c3565ff6785144f1807782276edbc29e5b9d (patch)
treeff73ec6c2cebd4a05ffb1d7527debb9704744bcb /cpp/config/IcePackAdmin.py
parentfix (diff)
downloadice-46b7c3565ff6785144f1807782276edbc29e5b9d.tar.bz2
ice-46b7c3565ff6785144f1807782276edbc29e5b9d.tar.xz
ice-46b7c3565ff6785144f1807782276edbc29e5b9d.zip
IcePack fixes
Diffstat (limited to 'cpp/config/IcePackAdmin.py')
-rw-r--r--cpp/config/IcePackAdmin.py54
1 files changed, 41 insertions, 13 deletions
diff --git a/cpp/config/IcePackAdmin.py b/cpp/config/IcePackAdmin.py
index 9f5d25deba0..9503725e74c 100644
--- a/cpp/config/IcePackAdmin.py
+++ b/cpp/config/IcePackAdmin.py
@@ -15,6 +15,7 @@
import sys, os, TestUtil
import time
+from threading import Thread
for toplevel in [".", "..", "../..", "../../..", "../../../.."]:
toplevel = os.path.normpath(toplevel)
@@ -25,6 +26,27 @@ else:
icePackPort = "0";
+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
+ print self.token + ": " + line,
+ except IOError:
+ pass
+
+ try:
+ self.pipe.close()
+ except IOError:
+ pass
+
def startIcePackRegistry(port, testdir):
global icePackPort
@@ -51,14 +73,17 @@ def startIcePackRegistry(port, testdir):
r' --IcePack.Registry.Trace.NodeRegistry=0' + \
r' --Ice.ProgramName=icepackregistry'
- icePackPipe = os.popen(command)
+ (stdin, icePackPipe) = os.popen4(command)
TestUtil.getServerPid(icePackPipe)
TestUtil.getAdapterReady(icePackPipe)
TestUtil.getAdapterReady(icePackPipe)
TestUtil.getAdapterReady(icePackPipe)
TestUtil.getAdapterReady(icePackPipe)
print "ok"
- return icePackPipe
+
+ readerThread = ReaderThread(icePackPipe, "IcePackRegistry")
+ readerThread.start()
+ return readerThread
def startIcePackNode(testdir):
@@ -68,7 +93,8 @@ def startIcePackNode(testdir):
if not os.path.exists(dataDir):
os.mkdir(dataDir)
- overrideOptions = '"' + TestUtil.clientServerOptions.replace("--", "") + '"'
+ overrideOptions = '"' + TestUtil.clientServerOptions.replace("--", "") + \
+ ' Ice.PrintProcessId=0 Ice.PrintAdapterReady=0' + '"'
print "starting icepack node...",
command = icePack + TestUtil.clientServerOptions + ' --nowarn ' + \
@@ -83,15 +109,18 @@ def startIcePackNode(testdir):
r' --IcePack.Node.Trace.Server=0' + \
r' --IcePack.Node.PrintServersReady=node'
- icePackPipe = os.popen(command)
+ (stdin, icePackPipe) = os.popen4(command)
TestUtil.getServerPid(icePackPipe)
TestUtil.getAdapterReady(icePackPipe)
TestUtil.waitServiceReady(icePackPipe, 'node')
print "ok"
- return icePackPipe
-def shutdownIcePackRegistry(icePackPipe):
+ readerThread = ReaderThread(icePackPipe, "IcePackNode")
+ readerThread.start()
+ return readerThread
+
+def shutdownIcePackRegistry():
global icePackPort
icePackAdmin = os.path.join(toplevel, "bin", "icepackadmin")
@@ -102,15 +131,14 @@ def shutdownIcePackRegistry(icePackPipe):
r' -e "shutdown" '
icePackAdminPipe = os.popen(command)
+ TestUtil.printOutputFromPipe(icePackAdminPipe)
icePackAdminStatus = icePackAdminPipe.close()
- icePackPipe.close()
- print "ok"
-
if icePackAdminStatus:
TestUtil.killServers()
sys.exit(1)
+ print "ok"
-def shutdownIcePackNode(icePackPipe):
+def shutdownIcePackNode():
global icePackPort
icePackAdmin = os.path.join(toplevel, "bin", "icepackadmin")
@@ -121,13 +149,12 @@ def shutdownIcePackNode(icePackPipe):
r' -e "node shutdown localnode" '
icePackAdminPipe = os.popen(command)
+ TestUtil.printOutputFromPipe(icePackAdminPipe)
icePackAdminStatus = icePackAdminPipe.close()
- icePackPipe.close()
- print "ok"
-
if icePackAdminStatus:
TestUtil.killServers()
sys.exit(1)
+ print "ok"
def addApplication(descriptor, targets):
@@ -156,6 +183,7 @@ def removeApplication(descriptor):
r' -e "application remove \"' + descriptor + '\\" \"'
icePackAdminPipe = os.popen(command)
+ TestUtil.printOutputFromPipe(icePackAdminPipe)
icePackAdminStatus = icePackAdminPipe.close()
if icePackAdminStatus:
TestUtil.killServers()