diff options
author | Benoit Foucher <benoit@zeroc.com> | 2006-06-12 12:45:52 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2006-06-12 12:45:52 +0000 |
commit | 55f29175971c6a15532f22a25ed1243eccfd32da (patch) | |
tree | 2810200df3dc15a24ef6fe1b14b04a2159703944 /cpp | |
parent | Fixed bug 1045 (diff) | |
download | ice-55f29175971c6a15532f22a25ed1243eccfd32da.tar.bz2 ice-55f29175971c6a15532f22a25ed1243eccfd32da.tar.xz ice-55f29175971c6a15532f22a25ed1243eccfd32da.zip |
Fixed IceGrid python scripts
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/all.dsw | 48 | ||||
-rwxr-xr-x | cpp/allTests.py | 1 | ||||
-rw-r--r-- | cpp/config/IceGridAdmin.py | 147 | ||||
-rw-r--r-- | cpp/config/TestUtil.py | 6 | ||||
-rw-r--r-- | cpp/src/IceGrid/DescriptorParser.cpp | 11 | ||||
-rw-r--r-- | cpp/src/IceGrid/Makefile | 7 | ||||
-rw-r--r-- | cpp/test/IceGrid/activation/AllTests.cpp | 6 | ||||
-rwxr-xr-x | cpp/test/IceGrid/activation/run.py | 55 | ||||
-rwxr-xr-x | cpp/test/IceGrid/allocation/run.py | 46 | ||||
-rw-r--r-- | cpp/test/IceGrid/deployer/AllTests.cpp | 2 | ||||
-rw-r--r-- | cpp/test/IceGrid/deployer/application.xml | 2 | ||||
-rwxr-xr-x | cpp/test/IceGrid/deployer/run.py | 81 | ||||
-rw-r--r-- | cpp/test/IceGrid/replication/AllTests.cpp | 4 | ||||
-rw-r--r-- | cpp/test/IceGrid/replication/application.xml | 2 | ||||
-rwxr-xr-x | cpp/test/IceGrid/replication/icegridreplicationSvc.dsp | 6 | ||||
-rwxr-xr-x | cpp/test/IceGrid/replication/run.py | 42 | ||||
-rw-r--r-- | cpp/test/IceGrid/session/AllTests.cpp | 2 | ||||
-rwxr-xr-x | cpp/test/IceGrid/session/run.py | 54 | ||||
-rwxr-xr-x | cpp/test/IceGrid/simple/run.py | 69 | ||||
-rwxr-xr-x | cpp/test/IceGrid/update/run.py | 48 |
20 files changed, 197 insertions, 442 deletions
diff --git a/cpp/all.dsw b/cpp/all.dsw index eef7e5d94b2..ac536568bb2 100644 --- a/cpp/all.dsw +++ b/cpp/all.dsw @@ -2102,6 +2102,51 @@ Package=<4> Begin Project Dependency
Project_Dep_Name glacier2
End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name icepatch2
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "icegridallocationC"=.\test\IceGrid\allocation\icegridallocationC.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name ice
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name icegrid
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name iceutil
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name glacier2
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "icegridallocationS"=.\test\IceGrid\allocation\icegridallocationS.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name ice
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name iceutil
+ End Project Dependency
}}}
###############################################################################
@@ -2261,6 +2306,9 @@ Package=<4> Begin Project Dependency
Project_Dep_Name icessl
End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name icepatch2
+ End Project Dependency
}}}
###############################################################################
diff --git a/cpp/allTests.py b/cpp/allTests.py index e58a97b133e..349bca47766 100755 --- a/cpp/allTests.py +++ b/cpp/allTests.py @@ -90,6 +90,7 @@ tests = [ \ "IceGrid/update", \ "IceGrid/activation", \ "IceGrid/replication", \ + "IceGrid/allocation", \ "Glacier2/router", \ "Glacier2/attack", \ "Glacier2/addressFilter", \ diff --git a/cpp/config/IceGridAdmin.py b/cpp/config/IceGridAdmin.py index 80978ce2d95..a19e36e662d 100644 --- a/cpp/config/IceGridAdmin.py +++ b/cpp/config/IceGridAdmin.py @@ -9,7 +9,6 @@ # ********************************************************************** import sys, os, TestUtil -import time from threading import Thread for toplevel in [".", "..", "../..", "../../..", "../../../.."]: @@ -19,7 +18,7 @@ for toplevel in [".", "..", "../..", "../../..", "../../../.."]: else: raise "can't find toplevel directory!" -iceGridPort = "0"; +iceGridPort = "12010"; nodeOptions = r' --Ice.Warn.Connections=0' + \ r' --IceGrid.Node.Endpoints=default' + \ @@ -49,38 +48,17 @@ registryOptions = r' --Ice.Warn.Connections=0' + \ r' --IceGrid.Registry.Trace.Locator=0' + \ r' --Ice.ThreadPool.Server.Size=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 startIceGridRegistry(port, testdir, dynamicRegistration): +def startIceGridRegistry(testdir, dynamicRegistration): global iceGridPort - iceGridPort = port - iceGrid = os.path.join(toplevel, "bin", "icegridregistry") dataDir = os.path.join(testdir, "db", "registry") if not os.path.exists(dataDir): os.mkdir(dataDir) + else: + cleanDbDir(dataDir) print "starting icegrid registry...", command = iceGrid + TestUtil.clientServerOptions + ' --nowarn ' + registryOptions + \ @@ -93,15 +71,10 @@ def startIceGridRegistry(port, testdir, dynamicRegistration): (stdin, iceGridPipe) = os.popen4(command) TestUtil.getServerPid(iceGridPipe) - TestUtil.getAdapterReady(iceGridPipe, False) - TestUtil.getAdapterReady(iceGridPipe, False) - TestUtil.getAdapterReady(iceGridPipe, False) - TestUtil.getAdapterReady(iceGridPipe, False) + TestUtil.getAdapterReady(iceGridPipe, True, 4) print "ok" - readerThread = ReaderThread(iceGridPipe, "IceGridRegistry") - readerThread.start() - return readerThread + return iceGridPipe def startIceGridNode(testdir): @@ -110,6 +83,8 @@ def startIceGridNode(testdir): dataDir = os.path.join(testdir, "db", "node") if not os.path.exists(dataDir): os.mkdir(dataDir) + else: + cleanDbDir(dataDir) overrideOptions = '"' + TestUtil.clientServerOptions.replace("--", "") + \ ' Ice.ServerIdleTime=0 Ice.PrintProcessId=0 Ice.PrintAdapterReady=0 ' + \ @@ -125,13 +100,11 @@ def startIceGridNode(testdir): (stdin, iceGridPipe) = os.popen4(command) TestUtil.getServerPid(iceGridPipe) TestUtil.getAdapterReady(iceGridPipe, False) - TestUtil.waitServiceReady(iceGridPipe, 'node', False) + TestUtil.waitServiceReady(iceGridPipe, 'node') print "ok" - readerThread = ReaderThread(iceGridPipe, "IceGridNode") - readerThread.start() - return readerThread + return iceGridPipe def shutdownIceGridRegistry(): @@ -169,82 +142,80 @@ def shutdownIceGridNode(): sys.exit(1) print "ok" -def addApplication(descriptor, options): +def iceGridAdmin(cmd, ignoreFailure = False): global iceGridPort iceGridAdmin = os.path.join(toplevel, "bin", "icegridadmin") - descriptor = descriptor.replace("\\", "/") command = iceGridAdmin + TestUtil.clientOptions + \ - r' "--Ice.Default.Locator=IceGrid/Locator:default -p ' + iceGridPort + '" ' + \ - r' -e "application add \"' + descriptor + '\\" ' + options + ' \"' + " 2>&1" + r' --Ice.Default.Locator="IceGrid/Locator:default -p ' + iceGridPort + '" ' + \ + r' -e "' + cmd + '" 2>&1' iceGridAdminPipe = os.popen(command) - TestUtil.printOutputFromPipe(iceGridAdminPipe) - iceGridAdminStatus = iceGridAdminPipe.close() - if iceGridAdminStatus: - TestUtil.killServers() - sys.exit(1) - -def removeApplication(name): - - global iceGridPort - iceGridAdmin = os.path.join(toplevel, "bin", "icegridadmin") - - command = iceGridAdmin + TestUtil.clientOptions + \ - r' "--Ice.Default.Locator=IceGrid/Locator:default -p ' + iceGridPort + '" ' + \ - r' -e "application remove \"' + name + '\\" \"' + " 2>&1" - iceGridAdminPipe = os.popen(command) - TestUtil.printOutputFromPipe(iceGridAdminPipe) + output = iceGridAdminPipe.readlines() + iceGridAdminStatus = iceGridAdminPipe.close() - if iceGridAdminStatus: + if not ignoreFailure and iceGridAdminStatus: + print "icegridadmin command failed: " + cmd TestUtil.killServers() sys.exit(1) -def startServer(name): - + return output + +def killNodeServers(): + global iceGridPort - iceGridAdmin = os.path.join(toplevel, "bin", "icegridadmin") + + for server in iceGridAdmin("server list"): + server = server.strip() + iceGridAdmin("server disable " + server, True) + iceGridAdmin("server signal " + server + " SIGKILL", True) - command = iceGridAdmin + TestUtil.clientOptions + \ - r' "--Ice.Default.Locator=IceGrid/Locator:default -p ' + iceGridPort + '" ' + \ - r' -e "server start \"' + name + '\\""' + " 2>&1" +def iceGridTest(name, application, additionalOptions = "", applicationOptions = ""): - iceGridAdminPipe = os.popen(command) - TestUtil.printOutputFromPipe(iceGridAdminPipe) - iceGridAdminStatus = iceGridAdminPipe.close() - if iceGridAdminStatus: - TestUtil.killServers() - sys.exit(1) + testdir = os.path.join(toplevel, "test", name) + client = os.path.join(testdir, "client") -def stopServer(name): + clientOptions = " --Ice.Default.Locator=\"IceGrid/Locator:default -p " + iceGridPort + "\" " + additionalOptions - global iceGridPort - iceGridAdmin = os.path.join(toplevel, "bin", "icegridadmin") + iceGridRegistryPipe = startIceGridRegistry(testdir, 0) + iceGridNodePipe = startIceGridNode(testdir) - command = iceGridAdmin + TestUtil.clientOptions + \ - r' "--Ice.Default.Locator=IceGrid/Locator:default -p ' + iceGridPort + '" ' + \ - r' -e "server stop \"' + name + '\\""' + " 2>&1" + if application != "": + print "adding application...", + iceGridAdmin('application add ' + os.path.join(testdir, application) + ' ' + \ + '"test.dir=' + testdir + '" "ice.dir=' + toplevel + '" ' + applicationOptions) + print "ok" - iceGridAdminPipe = os.popen(command) - TestUtil.printOutputFromPipe(iceGridAdminPipe) - iceGridAdminStatus = iceGridAdminPipe.close() - if iceGridAdminStatus: + print "starting client...", + clientPipe = os.popen(client + TestUtil.clientOptions + clientOptions + " 2>&1") + print "ok" + + TestUtil.printOutputFromPipe(clientPipe) + + clientStatus = TestUtil.closePipe(clientPipe) + if clientStatus: + killNodeServers() + if application != "": + print "remove application...", + iceGridAdmin("application remove Test", True) + print "ok" TestUtil.killServers() sys.exit(1) -def listAdapters(): + if application != "": + print "remove application...", + iceGridAdmin("application remove Test") + print "ok" - global iceGridPort - iceGridAdmin = os.path.join(toplevel, "bin", "icegridadmin") + shutdownIceGridNode() + shutdownIceGridRegistry() - command = iceGridAdmin + TestUtil.clientOptions + \ - r' "--Ice.Default.Locator=IceGrid/Locator:default -p ' + iceGridPort + '" ' + \ - r' -e "adapter list"' + " 2>&1" + TestUtil.joinServers() - iceGridAdminPipe = os.popen(command) - return iceGridAdminPipe + if TestUtil.serverStatus(): + sys.exit(1) def cleanDbDir(path): diff --git a/cpp/config/TestUtil.py b/cpp/config/TestUtil.py index 865df2b44bd..d5e2eacea3f 100644 --- a/cpp/config/TestUtil.py +++ b/cpp/config/TestUtil.py @@ -222,10 +222,12 @@ def ignorePid(pipe): killServers() sys.exit(1) -def getAdapterReady(pipe, createThread = True): +def getAdapterReady(pipe, createThread = True, count = 1): global serverThreads - output = pipe.readline().strip() + while count > 0: + output = pipe.readline().strip() + count = count - 1 if not output: print "failed!" diff --git a/cpp/src/IceGrid/DescriptorParser.cpp b/cpp/src/IceGrid/DescriptorParser.cpp index 8e7768b23d7..8d1b715cad6 100644 --- a/cpp/src/IceGrid/DescriptorParser.cpp +++ b/cpp/src/IceGrid/DescriptorParser.cpp @@ -9,6 +9,7 @@ #include <Ice/Ice.h> #include <IceXML/Parser.h> +#include <IcePatch2/Util.h> #include <IceGrid/Admin.h> #include <IceGrid/DescriptorParser.h> #include <IceGrid/DescriptorBuilder.h> @@ -856,17 +857,19 @@ DescriptorParser::parseDescriptor(const string& descriptor, const Ice::CommunicatorPtr& communicator, const IceGrid::AdminPrx& admin) { - DescriptorHandler handler(descriptor, communicator); + string filename = IcePatch2::simplify(descriptor); + DescriptorHandler handler(filename, communicator); handler.setAdmin(admin); handler.setVariables(variables, targets); - IceXML::Parser::parse(descriptor, handler); + IceXML::Parser::parse(filename, handler); return handler.getApplicationDescriptor(); } ApplicationDescriptor DescriptorParser::parseDescriptor(const string& descriptor, const Ice::CommunicatorPtr& communicator) { - DescriptorHandler handler(descriptor, communicator); - IceXML::Parser::parse(descriptor, handler); + string filename = IcePatch2::simplify(descriptor); + DescriptorHandler handler(filename, communicator); + IceXML::Parser::parse(filename, handler); return handler.getApplicationDescriptor(); } diff --git a/cpp/src/IceGrid/Makefile b/cpp/src/IceGrid/Makefile index ac1efca9084..fae55ccf30c 100644 --- a/cpp/src/IceGrid/Makefile +++ b/cpp/src/IceGrid/Makefile @@ -135,12 +135,13 @@ $(libdir)/$(LIBNAME): $(libdir)/$(SONAME) $(ADMIN): $(ADMIN_OBJS) $(LIBTARGETS) rm -f $@ - $(CXX) $(LDFLAGS) -o $@ $(ADMIN_OBJS) -lGlacier2 $(EXPAT_RPATH_LINK) -lIceXML -lIceGrid $(LIBS) $(READLINE_LIBS) + $(CXX) $(LDFLAGS) -o $@ $(ADMIN_OBJS) -lGlacier2 $(EXPAT_RPATH_LINK) -lIceXML -lIceGrid -lIcePatch2 \ + $(LIBS) $(READLINE_LIBS) $(REGISTRY_SERVER): $(REGISTRY_SVR_OBJS) $(LIBTARGETS) rm -f $@ - $(CXX) $(LDFLAGS) -o $@ $(REGISTRY_SVR_OBJS) -lIceGrid -lIceStormService -lGlacier2 $(DB_RPATH_LINK) -lFreeze \ - -lIceBox $(EXPAT_RPATH_LINK) -lIceXML -lIceSSL $(OPENSSL_LIBS) $(LIBS) + $(CXX) $(LDFLAGS) -o $@ $(REGISTRY_SVR_OBJS) -lIceGrid -lIceStormService -lGlacier2 -lIcePatch2 \ + $(DB_RPATH_LINK) -lFreeze -lIceBox $(EXPAT_RPATH_LINK) -lIceXML -lIceSSL $(OPENSSL_LIBS) $(LIBS) $(NODE_SERVER): $(NODE_SVR_OBJS) $(LIBTARGETS) rm -f $@ diff --git a/cpp/test/IceGrid/activation/AllTests.cpp b/cpp/test/IceGrid/activation/AllTests.cpp index a98b94dd836..949a18e2e5c 100644 --- a/cpp/test/IceGrid/activation/AllTests.cpp +++ b/cpp/test/IceGrid/activation/AllTests.cpp @@ -86,6 +86,9 @@ allTests(const Ice::CommunicatorPtr& communicator) IceGrid::AdminPrx admin = IceGrid::AdminPrx::checkedCast(communicator->stringToProxy("IceGrid/Admin")); IceGrid::RegistryPrx registry = IceGrid::RegistryPrx::checkedCast(communicator->stringToProxy("IceGrid/Registry")); + admin->startServer("node-1"); + admin->startServer("node-2"); + cout << "testing on-demand activation... " << flush; try { @@ -531,5 +534,8 @@ allTests(const Ice::CommunicatorPtr& communicator) test(false); } cout << "ok" << endl; + + admin->stopServer("node-1"); + admin->stopServer("node-2"); } diff --git a/cpp/test/IceGrid/activation/run.py b/cpp/test/IceGrid/activation/run.py index 6a798035464..c2f76f66645 100755 --- a/cpp/test/IceGrid/activation/run.py +++ b/cpp/test/IceGrid/activation/run.py @@ -22,56 +22,7 @@ import TestUtil import IceGridAdmin name = os.path.join("IceGrid", "activation") -testdir = os.path.join(toplevel, "test", name) -# -# Add locator options for the client and server. Since the server -# invokes on the locator it's also considered to be a client. -# -additionalOptions = " --Ice.Default.Locator=\"IceGrid/Locator:default -p 12010\"" - -IceGridAdmin.cleanDbDir(os.path.join(testdir, "db")) - -# -# Start IceGrid registry and a node. -# -iceGridRegistryThread = IceGridAdmin.startIceGridRegistry("12010", testdir, 0) -iceGridNodeThread = IceGridAdmin.startIceGridNode(testdir) - -# -# Test client/server with on demand activation. -# -server = os.path.join(testdir, "server") -client = os.path.join(testdir, "client") - -print "registering server with icegrid...", -IceGridAdmin.addApplication(os.path.join(testdir, "application.xml"), - "test.dir=" + testdir + " ice.dir=" + toplevel + \ - " \\\"properties-override=" + TestUtil.clientServerOptions.replace("--", "") + "\\\"") -IceGridAdmin.startServer("node-1") -IceGridAdmin.startServer("node-2") -print "ok" - -print "starting client...", -clientPipe = os.popen(client + TestUtil.clientOptions + additionalOptions + " --with-deploy" + " 2>&1") -print "ok" - -TestUtil.printOutputFromPipe(clientPipe) - -clientStatus = TestUtil.closePipe(clientPipe) - -print "unregister server with icegrid...", -IceGridAdmin.stopServer("node-1") -IceGridAdmin.stopServer("node-2") -IceGridAdmin.removeApplication("Test") -print "ok" - -IceGridAdmin.shutdownIceGridNode() -iceGridNodeThread.join() -IceGridAdmin.shutdownIceGridRegistry() -iceGridRegistryThread.join() - -if clientStatus: - sys.exit(1) -else: - sys.exit(0) +IceGridAdmin.iceGridTest(name, "application.xml", "", \ + ' \\"properties-override=' + TestUtil.clientServerOptions.replace("--", "") + '\\"') +sys.exit(0) diff --git a/cpp/test/IceGrid/allocation/run.py b/cpp/test/IceGrid/allocation/run.py index 34900817a5c..963388aaf35 100755 --- a/cpp/test/IceGrid/allocation/run.py +++ b/cpp/test/IceGrid/allocation/run.py @@ -22,48 +22,6 @@ import TestUtil import IceGridAdmin name = os.path.join("IceGrid", "allocation") -testdir = os.path.join(toplevel, "test", name) -client = os.path.join(testdir, "client") -# -# Add locator options for the client and server. Since the server -# invokes on the locator it's also considered to be a client. -# -additionalOptions = " --Ice.Default.Locator=\"IceGrid/Locator:default -p 12010\" " + \ - "--Ice.PrintAdapterReady=0 --Ice.PrintProcessId=0 --IceDir=\"" + toplevel + "\" --TestDir=\"" + testdir + "\"" - -IceGridAdmin.cleanDbDir(os.path.join(testdir, "db")) -iceGridRegistryThread = IceGridAdmin.startIceGridRegistry("12010", testdir, 0) -iceGridNodeThread = IceGridAdmin.startIceGridNode(testdir) - -# -# Deploy the application, run the client and remove the application. -# -print "deploying application...", -IceGridAdmin.addApplication(os.path.join(testdir, "application.xml"), "ice.dir=" + toplevel + " test.dir=" + testdir) -print "ok" - -print "starting client...", -clientPipe = os.popen(client + TestUtil.clientServerOptions + additionalOptions + " 2>&1") -print "ok" - -try: - TestUtil.printOutputFromPipe(clientPipe) -except: - pass - -clientStatus = TestUtil.closePipe(clientPipe) - -print "removing application...", -IceGridAdmin.removeApplication("Test") -print "ok" - -IceGridAdmin.shutdownIceGridNode() -iceGridNodeThread.join() -IceGridAdmin.shutdownIceGridRegistry() -iceGridRegistryThread.join() - -if clientStatus: - sys.exit(1) -else: - sys.exit(0) +IceGridAdmin.iceGridTest(name, "application.xml") +sys.exit(0) diff --git a/cpp/test/IceGrid/deployer/AllTests.cpp b/cpp/test/IceGrid/deployer/AllTests.cpp index a14210d6f81..a8036ab2a58 100644 --- a/cpp/test/IceGrid/deployer/AllTests.cpp +++ b/cpp/test/IceGrid/deployer/AllTests.cpp @@ -184,7 +184,7 @@ allTests(const Ice::CommunicatorPtr& comm) { test((*p)->getProperty("AppVarProp") == "AppVar"); test((*p)->getProperty("NodeVarProp") == "NodeVar"); - test((*p)->getProperty("RecursiveAppVarProp") == "test"); + test((*p)->getProperty("RecursiveAppVarProp") == "Test"); test((*p)->getProperty("AppVarOverridedProp") == "OverridedInNode"); test((*p)->getProperty("AppVarDefinedInNodeProp") == "localnode"); test((*p)->getProperty("EscapedAppVarProp") == "${escaped}"); diff --git a/cpp/test/IceGrid/deployer/application.xml b/cpp/test/IceGrid/deployer/application.xml index efdbddb5e84..6ddf2a66c9f 100644 --- a/cpp/test/IceGrid/deployer/application.xml +++ b/cpp/test/IceGrid/deployer/application.xml @@ -1,6 +1,6 @@ <icegrid> - <application name="test" import-default-templates="true"> + <application name="Test" import-default-templates="true"> <description>APP ${AppVar}</description> diff --git a/cpp/test/IceGrid/deployer/run.py b/cpp/test/IceGrid/deployer/run.py index 891911c447e..866d6e928f8 100755 --- a/cpp/test/IceGrid/deployer/run.py +++ b/cpp/test/IceGrid/deployer/run.py @@ -34,80 +34,11 @@ else: iceBox = TestUtil.getIceBox(testdir) -# -# Start the client. -# -def startClient(options): - - global testdir - - fullClientOptions = TestUtil.clientOptions + \ - " --Ice.Default.Locator=\"IceGrid/Locator:default -p 12010\" " + \ - options - - print "starting client...", - clientPipe = os.popen(os.path.join(testdir, "client") + fullClientOptions + " 2>&1") - print "ok" - - TestUtil.printOutputFromPipe(clientPipe) - - clientStatus = TestUtil.closePipe(clientPipe) - return clientStatus - -# -# Start IceGrid. -# -IceGridAdmin.cleanDbDir(os.path.join(testdir, "db")) -iceGridRegistryThread = IceGridAdmin.startIceGridRegistry("12010", testdir, 0) -iceGridNodeThread = IceGridAdmin.startIceGridNode(testdir) - -# -# Deploy the application, run the client and remove the application. -# -print "deploying application...", -IceGridAdmin.addApplication(os.path.join(testdir, "application.xml"), \ - "ice.dir=" + toplevel + " test.dir=" + testdir + " icebox.exe=" + iceBox) -print "ok" +IceGridAdmin.iceGridTest(name, "application.xml", "", '"icebox.exe=' + TestUtil.getIceBox(testdir) + '"') -status = startClient("") +# Tests with targets +IceGridAdmin.iceGridTest(name, "application.xml", "-t", \ + "icebox.exe=" + TestUtil.getIceBox(testdir) + \ + " moreservers moreservices moreproperties") -print "removing application...", -IceGridAdmin.removeApplication("test") -print "ok" - -if status: - IceGridAdmin.shutdownIceGridNode() - iceGridNodeThread.join() - IceGridAdmin.shutdownIceGridRegistry() - iceGridRegistryThread.join() - sys.exit(1) - - -# -# Deploy the application with some targets to test targets, run the -# client to test targets (-t options) and remove the application. -# -print "deploying application with target...", -IceGridAdmin.addApplication(os.path.join(testdir, "application.xml"), \ - "moreservers moreservices moreproperties ice.dir=" + toplevel + " test.dir=" + testdir + \ - " icebox.exe=" + iceBox) -print "ok" - -status = startClient("-t") - -print "removing application...", -IceGridAdmin.removeApplication("test") -print "ok" - -# -# Shutdown IceGrid. -# -IceGridAdmin.shutdownIceGridNode() -iceGridNodeThread.join() -IceGridAdmin.shutdownIceGridRegistry() -iceGridRegistryThread.join() - -if status: - sys.exit(1) -else: - sys.exit(0) +sys.exit(0) diff --git a/cpp/test/IceGrid/replication/AllTests.cpp b/cpp/test/IceGrid/replication/AllTests.cpp index 0008b57fa98..0e9765e28b7 100644 --- a/cpp/test/IceGrid/replication/AllTests.cpp +++ b/cpp/test/IceGrid/replication/AllTests.cpp @@ -29,7 +29,7 @@ instantiateServer(const AdminPrx& admin, const string& templ, const map<string, nodeUpdate.name = "localnode"; nodeUpdate.serverInstances.push_back(desc); ApplicationUpdateDescriptor update; - update.name = "test"; + update.name = "Test"; update.nodes.push_back(nodeUpdate); try { @@ -62,7 +62,7 @@ removeServer(const AdminPrx& admin, const string& id) nodeUpdate.name = "localnode"; nodeUpdate.removeServers.push_back(id); ApplicationUpdateDescriptor update; - update.name = "test"; + update.name = "Test"; update.nodes.push_back(nodeUpdate); try { diff --git a/cpp/test/IceGrid/replication/application.xml b/cpp/test/IceGrid/replication/application.xml index a027f447019..6cfe4daa356 100644 --- a/cpp/test/IceGrid/replication/application.xml +++ b/cpp/test/IceGrid/replication/application.xml @@ -1,6 +1,6 @@ <icegrid> - <application name="test"> + <application name="Test"> <replica-group id="Default"> <object identity="Default" type="::Test::TestIntf"/> diff --git a/cpp/test/IceGrid/replication/icegridreplicationSvc.dsp b/cpp/test/IceGrid/replication/icegridreplicationSvc.dsp index c43df03fd40..7cc1afa9f76 100755 --- a/cpp/test/IceGrid/replication/icegridreplicationSvc.dsp +++ b/cpp/test/IceGrid/replication/icegridreplicationSvc.dsp @@ -44,7 +44,7 @@ RSC=rc.exe # PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBRARY_EXPORTS" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /WX /GR /GX /O2 /I "." /I "../../../include" /D "_USRDLL" /D "NDEBUG" /D "_CONSOLE" /FD /c
-# SUBTRACT CPP /Z<none> /Fr /YX
+# SUBTRACT CPP /Fr /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
@@ -59,7 +59,7 @@ LINK32=link.exe # Begin Special Build Tool
OutDir=.\Release
SOURCE="$(InputPath)"
-PostBuild_Cmds=copy $(OutDir)\testservice.* .
+PostBuild_Cmds=copy $(OutDir)\testservice.* . echo release > build.txt
# End Special Build Tool
!ELSEIF "$(CFG)" == "icegridreplicationSvc - Win32 Debug"
@@ -92,7 +92,7 @@ LINK32=link.exe # Begin Special Build Tool
OutDir=.\Debug
SOURCE="$(InputPath)"
-PostBuild_Cmds=copy $(OutDir)\testserviced.* .
+PostBuild_Cmds=copy $(OutDir)\testserviced.* . echo debug > build.txt
# End Special Build Tool
!ENDIF
diff --git a/cpp/test/IceGrid/replication/run.py b/cpp/test/IceGrid/replication/run.py index 02c2bf1e3b7..e6b53250a08 100755 --- a/cpp/test/IceGrid/replication/run.py +++ b/cpp/test/IceGrid/replication/run.py @@ -23,7 +23,6 @@ import IceGridAdmin name = os.path.join("IceGrid", "replication") testdir = os.path.join(toplevel, "test", name) -client = os.path.join(testdir, "client") if TestUtil.isWin32(): os.environ["PATH"] = testdir + ";" + os.getenv("PATH", "") @@ -33,11 +32,6 @@ else: os.environ["LD_LIBRARY_PATH"] = testdir + ":" + os.getenv("LD_LIBRARY_PATH", "") os.environ["LD_LIBRARY_PATH_64"] = testdir + ":" + os.getenv("LD_LIBRARY_PATH_64", "") -if TestUtil.isWin32() and os.path.exists(os.path.join(toplevel, "bin", "iceboxd.exe")): - iceBox = os.path.join(toplevel, "bin", "iceboxd") -else: - iceBox = os.path.join(toplevel, "bin", "icebox") - # # Add locator options for the client and server. Since the server # invokes on the locator it's also considered to be a client. @@ -51,36 +45,6 @@ else: additionalOptions = " --Ice.Default.Locator=\"IceGrid/Locator:default -p 12010\"" + \ " --Ice.PrintAdapterReady=0 --Ice.PrintProcessId=0 --Ice.RetryIntervals=\"0 50 100 250\"" -IceGridAdmin.cleanDbDir(os.path.join(testdir, "db")) -iceGridRegistryThread = IceGridAdmin.startIceGridRegistry("12010", testdir, 0) -iceGridNodeThread = IceGridAdmin.startIceGridNode(testdir) - -print "registering application with icegrid...", -IceGridAdmin.addApplication(os.path.join(testdir, "application.xml"), - "ice.dir=" + toplevel + " " + "test.dir=" + testdir + " icebox.exe=" + iceBox) -print "ok" - -print "starting client...", -clientPipe = os.popen(client + TestUtil.clientServerOptions + additionalOptions + " 2>&1") -print "ok" - -try: - TestUtil.printOutputFromPipe(clientPipe) -except: - pass - -clientStatus = TestUtil.closePipe(clientPipe) - -print "unregister application with icegrid...", -IceGridAdmin.removeApplication("test") -print "ok" - -IceGridAdmin.shutdownIceGridNode() -iceGridNodeThread.join() -IceGridAdmin.shutdownIceGridRegistry() -iceGridRegistryThread.join() - -if clientStatus: - sys.exit(1) -else: - sys.exit(0) +IceGridAdmin.iceGridTest(name, "application.xml", "--Ice.RetryIntervals=\"0 50 100 250\"", \ + "icebox.exe=" + TestUtil.getIceBox(testdir)) +sys.exit(0) diff --git a/cpp/test/IceGrid/session/AllTests.cpp b/cpp/test/IceGrid/session/AllTests.cpp index 2e4fc659ded..bbecb409710 100644 --- a/cpp/test/IceGrid/session/AllTests.cpp +++ b/cpp/test/IceGrid/session/AllTests.cpp @@ -263,6 +263,7 @@ public: if(!timedWait(IceUtil::Time::seconds(10))) { cerr << "timeout: " << file << ":" << line << endl; + ObserverStackTracer::printStack(); test(false); // Timeout } } @@ -453,6 +454,7 @@ public: if(!timedWait(IceUtil::Time::seconds(10))) { cerr << "timeout: " << file << ":" << line << endl; + ObserverStackTracer::printStack(); test(false); // Timeout } } diff --git a/cpp/test/IceGrid/session/run.py b/cpp/test/IceGrid/session/run.py index 481e56b66f0..6d35360c54e 100755 --- a/cpp/test/IceGrid/session/run.py +++ b/cpp/test/IceGrid/session/run.py @@ -23,55 +23,21 @@ import IceGridAdmin name = os.path.join("IceGrid", "session") testdir = os.path.join(toplevel, "test", name) -client = os.path.join(testdir, "client") -# -# Add locator options for the client and server. Since the server -# invokes on the locator it's also considered to be a client. -# -additionalOptions = " --Ice.Default.Locator=\"IceGrid/Locator:default -p 12010\" " + \ - "--Ice.PrintAdapterReady=0 --Ice.PrintProcessId=0 --IceDir=\"" + toplevel + "\" --TestDir=\"" + testdir + "\"" +node1Dir = os.path.join(testdir, "db", "node-1") +if not os.path.exists(node1Dir): + os.mkdir(node1Dir) +else: + IceGridAdmin.cleanDbDir(node1Dir) IceGridAdmin.registryOptions += \ + r' --IceGrid.Registry.DynamicRegistration' + \ r' --IceGrid.Registry.PermissionsVerifier="ClientPermissionsVerifier"' + \ r' --IceGrid.Registry.AdminPermissionsVerifier="AdminPermissionsVerifier"' + \ r' --IceGrid.Registry.SSLPermissionsVerifier="SSLPermissionsVerifier"' + \ r' --IceGrid.Registry.AdminSSLPermissionsVerifier="SSLPermissionsVerifier"' -IceGridAdmin.cleanDbDir(os.path.join(testdir, "db")) -iceGridRegistryThread = IceGridAdmin.startIceGridRegistry("12010", testdir, 1) -iceGridNodeThread = IceGridAdmin.startIceGridNode(testdir) - -node1Dir = os.path.join(testdir, "db", "node-1") -os.mkdir(node1Dir) - -print "deploying application...", -IceGridAdmin.addApplication(os.path.join(testdir, "application.xml"), - "ice.dir=" + toplevel + " test.dir=" + testdir + \ - " \\\"properties-override=" + TestUtil.clientServerOptions.replace("--", "") + "\\\"") -print "ok" - -print "starting client...", -clientPipe = os.popen(client + TestUtil.clientServerOptions + additionalOptions + " 2>&1") -print "ok" - -try: - TestUtil.printOutputFromPipe(clientPipe) -except: - pass - -clientStatus = TestUtil.closePipe(clientPipe) - -print "removing application...", -IceGridAdmin.removeApplication("Test") -print "ok" - -IceGridAdmin.shutdownIceGridNode() -iceGridNodeThread.join() -IceGridAdmin.shutdownIceGridRegistry() -iceGridRegistryThread.join() - -if clientStatus: - sys.exit(1) -else: - sys.exit(0) +IceGridAdmin.iceGridTest(name, "application.xml", \ + "--IceDir=\"" + toplevel + "\" --TestDir=\"" + testdir + "\"", \ + '\\"properties-override=' + TestUtil.clientServerOptions.replace("--", "") + '\\"') +sys.exit(0) diff --git a/cpp/test/IceGrid/simple/run.py b/cpp/test/IceGrid/simple/run.py index 0c0e85162aa..2137048f0c0 100755 --- a/cpp/test/IceGrid/simple/run.py +++ b/cpp/test/IceGrid/simple/run.py @@ -23,68 +23,41 @@ import IceGridAdmin name = os.path.join("IceGrid", "simple") testdir = os.path.join(toplevel, "test", name) +server = os.path.join(testdir, "server") +client = os.path.join(testdir, "client") -# -# Add locator options for the client and server. Since the server -# invokes on the locator it's also considered to be a client. -# additionalOptions = " --Ice.Default.Locator=\"IceGrid/Locator:default -p 12010\"" - -IceGridAdmin.cleanDbDir(os.path.join(testdir, "db")) - -# -# Start IceGrid registry. -# -iceGridRegistryThread = IceGridAdmin.startIceGridRegistry("12010", testdir, 1) - -# -# Test client/server without on demand activation. -# additionalServerOptions=" --TestAdapter.Endpoints=default --TestAdapter.AdapterId=TestAdapter " + additionalOptions -TestUtil.mixedClientServerTestWithOptions(name, additionalServerOptions, additionalOptions) -# -# Shutdown the registry. -# -IceGridAdmin.shutdownIceGridRegistry() -iceGridRegistryThread.join() - -IceGridAdmin.cleanDbDir(os.path.join(testdir, "db")) - -# -# Start IceGrid registry and a node. -# -iceGridRegistryThread = IceGridAdmin.startIceGridRegistry("12010", testdir, 0) -iceGridNodeThread = IceGridAdmin.startIceGridNode(testdir) +iceGridRegistryPipe = IceGridAdmin.startIceGridRegistry(testdir, 1) # -# Test client/server with on demand activation. +# Test client/server without on demand activation. # -server = os.path.join(testdir, "server") -client = os.path.join(testdir, "client") - -print "registering server with icegrid...", -IceGridAdmin.addApplication(os.path.join(testdir, "simple_server.xml"), "test.dir=" + testdir) +print "starting sever...", +serverPipe = os.popen(server + TestUtil.serverOptions + additionalServerOptions + " 2>&1") +TestUtil.getServerPid(serverPipe) +TestUtil.getAdapterReady(serverPipe) print "ok" - + print "starting client...", -clientPipe = os.popen(client + TestUtil.clientOptions + additionalOptions + " --with-deploy" + " 2>&1") +clientPipe = os.popen(client + TestUtil.clientOptions + additionalOptions + " 2>&1") print "ok" TestUtil.printOutputFromPipe(clientPipe) - + clientStatus = TestUtil.closePipe(clientPipe) - -print "unregister server with icegrid...", -IceGridAdmin.removeApplication("Test") -print "ok" +if clientStatus: + killServers() -IceGridAdmin.shutdownIceGridNode() -iceGridNodeThread.join() IceGridAdmin.shutdownIceGridRegistry() -iceGridRegistryThread.join() +TestUtil.joinServers() -if clientStatus: +if clientStatus or TestUtil.serverStatus(): sys.exit(1) -else: - sys.exit(0) + +# +# Test client/server with on demand activation. +# +IceGridAdmin.iceGridTest(name, "simple_server.xml", "--with-deploy") +sys.exit(0) diff --git a/cpp/test/IceGrid/update/run.py b/cpp/test/IceGrid/update/run.py index cb2cb079ddd..1e78f2859cd 100755 --- a/cpp/test/IceGrid/update/run.py +++ b/cpp/test/IceGrid/update/run.py @@ -23,45 +23,23 @@ import IceGridAdmin name = os.path.join("IceGrid", "update") testdir = os.path.join(toplevel, "test", name) -client = os.path.join(testdir, "client") - -# -# Add locator options for the client and server. Since the server -# invokes on the locator it's also considered to be a client. -# -additionalOptions = " --Ice.Default.Locator=\"IceGrid/Locator:default -p 12010\" " + \ - "--Ice.PrintAdapterReady=0 --Ice.PrintProcessId=0 --IceDir=\"" + toplevel + "\" --TestDir=\"" + testdir + "\"" - -IceGridAdmin.cleanDbDir(os.path.join(testdir, "db")) -iceGridRegistryThread = IceGridAdmin.startIceGridRegistry("12010", testdir, 0) -iceGridNodeThread = IceGridAdmin.startIceGridNode(testdir) node1Dir = os.path.join(testdir, "db", "node-1") -os.mkdir(node1Dir) +if not os.path.exists(node1Dir): + os.mkdir(node1Dir) +else: + IceGridAdmin.cleanDbDir(node1Dir) node2Dir = os.path.join(testdir, "db", "node-2") -os.mkdir(node2Dir) +if not os.path.exists(node2Dir): + os.mkdir(node2Dir) +else: + IceGridAdmin.cleanDbDir(node2Dir) -nodeOverrideOptions = ' --NodePropertiesOverride="' + TestUtil.clientServerOptions.replace("--", "") + \ +nodeOverrideOptions = "--IceDir=\"" + toplevel + "\" --TestDir=\"" + testdir + "\"" + \ + ' --NodePropertiesOverride="' + \ + TestUtil.clientServerOptions.replace("--", "") + \ ' Ice.ServerIdleTime=0 Ice.PrintProcessId=0 Ice.PrintAdapterReady=0' + '"' -print "starting client...", -clientPipe = os.popen(client + TestUtil.clientServerOptions + additionalOptions + nodeOverrideOptions + " 2>&1") -print "ok" - -try: - TestUtil.printOutputFromPipe(clientPipe) -except: - pass - -clientStatus = TestUtil.closePipe(clientPipe) - -IceGridAdmin.shutdownIceGridNode() -iceGridNodeThread.join() -IceGridAdmin.shutdownIceGridRegistry() -iceGridRegistryThread.join() - -if clientStatus: - sys.exit(1) -else: - sys.exit(0) +IceGridAdmin.iceGridTest(name, "", nodeOverrideOptions) +sys.exit(0) |