diff options
Diffstat (limited to 'cpp/test/Glacier2/router/run.py')
-rwxr-xr-x | cpp/test/Glacier2/router/run.py | 74 |
1 files changed, 28 insertions, 46 deletions
diff --git a/cpp/test/Glacier2/router/run.py b/cpp/test/Glacier2/router/run.py index b8843334466..9fb9a8e2240 100755 --- a/cpp/test/Glacier2/router/run.py +++ b/cpp/test/Glacier2/router/run.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # ********************************************************************** # -# Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved. +# Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. # # This copy of Ice is licensed to you under the terms described in the # ICE_LICENSE file included in this distribution. @@ -10,31 +10,30 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" - -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() +sys.path.append(os.path.join(path[0])) +from scripts import * router = os.path.join(TestUtil.getCppBinDir(), "glacier2router") def startRouter(buffered): - args = r' --Ice.Warn.Dispatch=0' + \ - r' --Ice.Warn.Connections=0' + \ - r' --Glacier2.Filter.Category.Accept="c1 c2"' + \ - r' --Glacier2.Filter.Category.AcceptUser="2"' + \ - r' --Glacier2.SessionTimeout="30"' + \ - r' --Glacier2.Client.Endpoints="default -p 12347 -t 10000"' + \ - r' --Glacier2.Server.Endpoints="tcp -h 127.0.0.1 -t 10000"' \ - r' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348 -t 10000"' + \ - r' --Ice.Admin.InstanceName="Glacier2"' + \ - r' --Glacier2.CryptPasswords="' + TestUtil.getMappingDir(__file__) + r'/test/Glacier2/router/passwords"' + args = ' --Ice.Warn.Dispatch=0' + \ + ' --Ice.Warn.Connections=0' + \ + ' --Glacier2.Filter.Category.Accept="c1 c2"' + \ + ' --Glacier2.Filter.Category.AcceptUser="2"' + \ + ' --Glacier2.SessionTimeout="30"' + \ + ' --Glacier2.Client.Endpoints="default -p 12347 -t 10000"' + \ + ' --Glacier2.Server.Endpoints="tcp -h 127.0.0.1 -t 10000"' \ + ' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348 -t 10000"' + \ + ' --Ice.Admin.InstanceName="Glacier2"' + \ + ' --Glacier2.CryptPasswords="%s"' % os.path.join(os.getcwd(), "passwords") if buffered: args += ' --Glacier2.Client.Buffered=1 --Glacier2.Server.Buffered=1' @@ -43,48 +42,31 @@ def startRouter(buffered): args += ' --Glacier2.Client.Buffered=0 --Glacier2.Server.Buffered=0' print "starting router in unbuffered mode...", - starterPipe = TestUtil.startServer(router, args + " 2>&1") - TestUtil.getServerPid(starterPipe) + starterProc = TestUtil.startServer(router, args, count=2) - # - # For this test we don't want to add the router to the server threads - # since we want the the router to run over two calls to - # mixedClientServerTest - # - TestUtil.getAdapterReady(starterPipe, False, 2) print "ok" - - routerThread = TestUtil.ReaderThread(starterPipe); - routerThread.start() - - return routerThread + return starterProc name = os.path.join("Glacier2", "router") # # We first run the test with unbuffered mode. # -routerThread = startRouter(False) -TestUtil.mixedClientServerTestWithOptions(name, "", " --shutdown") -routerThread.join() -if routerThread.getStatus(): - sys.exit(1) +starterProc = startRouter(False) +TestUtil.clientServerTest(name, additionalClientOptions = " --shutdown") +starterProc.waitTestSuccess() # # Then we run the test in buffered mode. # -routerThread = startRouter(True) -TestUtil.mixedClientServerTest(name) +starterProc = startRouter(True) +TestUtil.clientServerTest() # # We run the test again, to check whether the glacier router can # handle multiple clients. Also, when we run for the second time, we # want the client to shutdown the router after running the tests. # -TestUtil.mixedClientServerTestWithOptions(name, "", " --shutdown") - -routerThread.join() -if routerThread.getStatus(): - sys.exit(1) +TestUtil.clientServerTest(name, additionalClientOptions = " --shutdown") -sys.exit(0) +starterProc.waitTestSuccess() |