def startIceGridNode(testdir): iceGrid = os.path.join(TestUtil.getCppBinDir(), "icegridnode") dataDir = os.path.join(testdir, "db", "node") if not os.path.exists(dataDir): os.mkdir(dataDir) else: cleanDbDir(dataDir) # # Create property overrides from command line options. # overrideOptions = '"' for opt in TestUtil.getCommandLine("", TestUtil.DriverConfig("server")).split(): opt = opt.replace("--", "") if opt.find("=") == -1: opt += "=1" overrideOptions += opt + " " overrideOptions += ' Ice.ServerIdleTime=0 Ice.PrintProcessId=0 Ice.PrintAdapterReady=0"' print "starting icegrid node...", command = r' --nowarn ' + nodeOptions + getDefaultLocatorProperty() + \ r' --IceGrid.Node.Data=' + dataDir + \ r' --IceGrid.Node.Name=localnode' + \ r' --IceGrid.Node.PropertiesOverride=' + overrideOptions driverConfig = TestUtil.DriverConfig("server") driverConfig.lang = "cpp" proc = TestUtil.startServer(iceGrid, command, driverConfig, adapter='node') print "ok" return proc
def cleanup(): if TestUtil.isDarwin(): os.system("rm -rf %s ../certs/keychain" % keychainPath) elif TestUtil.isLinux(): for c in ["cacert1.pem", "cacert2.pem"]: pem = os.path.join(certsPath, c) os.system("rm -f {dir}/`openssl x509 -subject_hash -noout -in {pem}`.0".format(pem=pem, dir=certsPath))
def startIceGridRegistry(port, 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) print "starting icegrid registry...", command = iceGrid + TestUtil.clientServerOptions + ' --nowarn ' + registryOptions + \ r' --IceGrid.Registry.Client.Endpoints="default -p ' + iceGridPort + ' -t 30000" ' + \ r' --IceGrid.Registry.Data=' + dataDir + \ r' --IceGrid.Registry.DefaultTemplates=' + os.path.join(toplevel, "config", "templates.xml") if dynamicRegistration: command += ' --IceGrid.Registry.DynamicRegistration' (stdin, iceGridPipe) = os.popen4(command) TestUtil.getServerPid(iceGridPipe) TestUtil.getAdapterReady(iceGridPipe) TestUtil.getAdapterReady(iceGridPipe) TestUtil.getAdapterReady(iceGridPipe) TestUtil.getAdapterReady(iceGridPipe) print "ok" readerThread = ReaderThread(iceGridPipe, "IceGridRegistry") readerThread.start() return readerThread
def startIceGridNode(testdir): iceGrid = TestUtil.getIceGridNode() dataDir = os.path.join(testdir, "db", "node") if not os.path.exists(dataDir): os.mkdir(dataDir) else: cleanDbDir(dataDir) overrideOptions = '" ' + iceGridNodePropertiesOverride() overrideOptions += ' Ice.ServerIdleTime=0 Ice.PrintProcessId=0 Ice.PrintAdapterReady=0"' sys.stdout.write("starting icegrid node... ") sys.stdout.flush() command = r' --nowarn ' + nodeOptions + getDefaultLocatorProperty() + \ r' --IceGrid.Node.Data="' + dataDir + '"' \ r' --IceGrid.Node.Name=localnode' + \ r' --IceGrid.Node.PropertiesOverride=' + overrideOptions driverConfig = TestUtil.DriverConfig("server") driverConfig.lang = "cpp" proc = TestUtil.startServer(iceGrid, command, driverConfig, adapter='node1') print("ok") return proc
def __init__(self, toplevel, testdir, transient, \ additional = None, dbDir = "db", instanceName=None, port = 12010): IceStormUtil.__init__(self, toplevel, testdir) iceBoxPort = port iceStormPort = port + 1 publisherPort = port + 2 self.iceBoxService = origIceBoxService.format(iceBoxPort) self.iceBoxEndpoints = origIceBoxEndpoints.format(iceBoxPort) self.iceStormService = origIceStormService % (iceStormPort) self.dbDir = dbDir if instanceName: self.iceStormService = self.iceStormService + ' --IceStorm.InstanceName=%s ' % instanceName else: instanceName = "IceStorm" if publisherPort: self.iceStormService = self.iceStormService + ' --IceStorm.Publish.Endpoints="default -p %d:udp -p %d"' % ( publisherPort, publisherPort) else: self.iceStormService = self.iceStormService + ' --IceStorm.Publish.Endpoints="default:udp"' self.transient = transient if self.transient: self.iceStormService = self.iceStormService + " --IceStorm.Transient=1" if additional: self.iceStormService = self.iceStormService + " " + additional self.iceStormProxy = origIceStormProxy % (instanceName, iceStormPort) self.iceStormReference = origIceStormReference % self.iceStormProxy self.dbHome = os.path.join(self.testdir, self.dbDir) TestUtil.cleanDbDir(self.dbHome) self.iceStormDBEnv = ' --IceStorm.LMDB.MapSize=1 --IceStorm.LMDB.Path="%s"' % self.dbHome
def iceGridAdmin(cmd, ignoreFailure = False): iceGridAdmin = os.path.join(toplevel, "bin", "icegridadmin") user = r"admin1" if cmd == "registry shutdown": user = r"shutdown" command = iceGridAdmin + TestUtil.clientOptions + ' ' + getDefaultLocatorProperty() + \ r" --IceGridAdmin.Username="******" --IceGridAdmin.Password=test1 " + \ r' -e "' + cmd + '"' if TestUtil.debug: print "(" + command +")", iceGridAdminPipe = os.popen(command + " 2>&1") output = iceGridAdminPipe.readlines() iceGridAdminStatus = TestUtil.closePipe(iceGridAdminPipe) if not ignoreFailure and iceGridAdminStatus: for line in output: print line TestUtil.killServers() sys.exit(1) return output
def runServer(self, lang, name, protocol, host, current): # If server is still running, terminate it if self.currentServer: try: self.currentServer.terminate() except: pass self.currentServer = None pwd = os.getcwd() try: # Change current directory to the test directory serverdir = os.path.join(TestUtil.toplevel, lang, "test", name) os.chdir(serverdir) serverDesc = os.path.join(lang, "test", name) lang = TestUtil.getDefaultMapping() server = os.path.join(serverdir, TestUtil.getDefaultServerFile()) serverenv = TestUtil.getTestEnv(lang, serverdir) sys.stdout.write("starting " + serverDesc + "... ") sys.stdout.flush() serverCfg = TestUtil.DriverConfig("server") serverCfg.protocol = protocol serverCfg.host = host server = TestUtil.getCommandLine(server, serverCfg) serverProc = TestUtil.spawnServer(server, env = serverenv, lang=serverCfg.lang, mx=serverCfg.mx) print("ok") finally: os.chdir(pwd) self.currentServer = Test.ServerPrx.uncheckedCast(current.adapter.addWithUUID(ServerI(serverDesc, serverProc))) return self.currentServer
def icepatch2Calc(datadir, dirname): icePatch2Calc = os.path.join(toplevel, "bin", "icepatch2calc") commandPipe = os.popen(icePatch2Calc + " " + os.path.join(datadir, dirname) + " 2>&1") TestUtil.printOutputFromPipe(commandPipe) commandStatus = TestUtil.closePipe(commandPipe) if commandStatus: sys.exit(1)
def iceGridTest(name, application, additionalOptions = "", applicationOptions = ""): if not TestUtil.isWin32() and os.getuid() == 0: print print "*** can't run test as root ***" print return testdir = os.path.join(toplevel, "test", name) client = os.path.join(testdir, "client") clientOptions = ' ' + getDefaultLocatorProperty() + ' ' + additionalOptions startIceGridRegistry(testdir) iceGridNodePipe = startIceGridNode(testdir) if application != "": print "adding application...", iceGridAdmin('application add ' + os.path.join(testdir, application) + ' ' + \ '"test.dir=' + testdir + '" "ice.dir=' + toplevel + '" ' + applicationOptions) print "ok" print "starting client...", command = client + TestUtil.clientOptions + " " + clientOptions if TestUtil.debug: print "(" + command +")", clientPipe = os.popen(command + " 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) if application != "": print "remove application...", iceGridAdmin("application remove Test") print "ok" print "shutting down icegrid node...", iceGridAdmin("node shutdown localnode") print "ok" shutdownIceGridRegistry() TestUtil.joinServers() if TestUtil.serverStatus(): sys.exit(1)
def iceGridAdmin(cmd, ignoreFailure = False): iceGridAdmin = TestUtil.getIceGridAdmin() user = r"admin1" if cmd == "registry shutdown": user = r"shutdown" command = getDefaultLocatorProperty() + r" --IceGridAdmin.Username="******" --IceGridAdmin.Password=test1 " + \ r' -e "' + cmd + '"' if TestUtil.appverifier: TestUtil.setAppVerifierSettings([TestUtil.getIceGridAdmin()]) driverConfig = TestUtil.DriverConfig("client") driverConfig.lang = "cpp" proc = TestUtil.startClient(iceGridAdmin, command, driverConfig) status = proc.wait() if TestUtil.appverifier: TestUtil.appVerifierAfterTestEnd([TestUtil.getIceGridAdmin()]) if not ignoreFailure and status: print(proc.buf) sys.exit(1) return proc.buf
def stopServers(p1, p2 = None): global iceBox global iceBoxAdmin global iceBoxEndpoints global iceBoxEndpoints2 print "shutting down icestorm services...", sys.stdout.flush() command = iceBoxAdmin + TestUtil.clientOptions + iceBoxEndpoints + r' shutdown' if TestUtil.debug: print "(" + command + ")", sys.stdout.flush() pipe = os.popen(command + " 2>&1") status = TestUtil.closePipe(pipe) if status or TestUtil.specificServerStatus(p1): TestUtil.killServers() sys.exit(1) if p2: command = iceBoxAdmin + TestUtil.clientOptions + iceBoxEndpoints2 + r' shutdown' if TestUtil.debug: print "(" + command + ")", sys.stdout.flush() pipe = os.popen(command + " 2>&1") status = TestUtil.closePipe(pipe) if status or TestUtil.specificServerStatus(p2): TestUtil.killServers() sys.exit(1) print "ok"
def startServers(): global iceBox global iceBoxEndpoints global iceBoxEndpoints2 global iceStormService global iceStormService2 global iceStormDBEnv global iceStormDBEnv2 print "starting icestorm services...", sys.stdout.flush() # Clear the idle timeout otherwise the IceBox ThreadPool will timeout. command = iceBox + TestUtil.clientServerOptions + iceBoxEndpoints + iceStormService + iceStormDBEnv + ' --Ice.ServerIdleTime=0' if TestUtil.debug: print "(" + command + ")", sys.stdout.flush() iceBoxPipe = os.popen(command + " 2>&1") TestUtil.getServerPid(iceBoxPipe) TestUtil.waitServiceReady(iceBoxPipe, "IceStorm") command = iceBox + TestUtil.clientServerOptions + iceBoxEndpoints2 + iceStormService2 + iceStormDBEnv2 + ' --Ice.ServerIdleTime=0' if TestUtil.debug: print "(" + command + ")", sys.stdout.flush() iceBoxPipe2 = os.popen(command + " 2>&1") TestUtil.getServerPid(iceBoxPipe2) TestUtil.waitServiceReady(iceBoxPipe2, "IceStorm") print "ok" return iceBoxPipe, iceBoxPipe2
def startIceGridRegistry(testdir, dynamicRegistration=False): iceGrid = TestUtil.getIceGridRegistry() command = " --nowarn " + registryOptions if dynamicRegistration: command += r" --IceGrid.Registry.DynamicRegistration" procs = [] i = 0 while i < (nreplicas + 1): if i == 0: name = "registry" else: name = "replica-" + str(i) dataDir = os.path.join(testdir, "db", name) if not os.path.exists(dataDir): os.mkdir(dataDir) else: cleanDbDir(dataDir) sys.stdout.write("starting icegrid " + name + "... ") sys.stdout.flush() cmd = ( command + " " + r" --Ice.ProgramName=" + name + r' --IceGrid.Registry.Client.Endpoints="default -p ' + str(iceGridPort + i) + '" ' + r' --IceGrid.Registry.Data="' + dataDir + '" ' ) if i > 0: cmd += r" --IceGrid.Registry.ReplicaName=" + name + " " + getDefaultLocatorProperty() driverConfig = TestUtil.DriverConfig("server") driverConfig.lang = "cpp" proc = TestUtil.startServer(iceGrid, cmd, driverConfig, count=5) procs.append(proc) print("ok") i = i + 1 return procs
def waitTestSuccess(self, current): if not self.process: return sys.stdout.write("waiting for " + self.name + " to terminate... ") sys.stdout.flush() self.process.waitTestSuccess() self.process = None try: current.adapter.remove(current.id) except: pass # Stop the WatchDog thread since we may not run any more tests # for an extended period of time TestUtil.stopWatchDog() print("ok")
def stopServer(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 "server stop \"' + name + '\\""' + " 2>&1" iceGridAdminPipe = os.popen(command) TestUtil.printOutputFromPipe(iceGridAdminPipe) iceGridAdminStatus = iceGridAdminPipe.close() if iceGridAdminStatus: TestUtil.killServers() sys.exit(1)
def rununsub2(replica=-1, expect=None): if replica == -1: proc = TestUtil.startServer(subscriber2, icestorm.reference(replica) + " --id foo --unsub", count=0) proc.waitTestSuccess() # Else we first subscribe to this replica, then unsub. We # shouldn't get an AlreadySubscribedException. proc = TestUtil.startServer(subscriber2, icestorm.reference(replica) + " --id foo", count=0, echo=False) if expect: proc.expect(expect) proc.wait() return else: proc.waitTestSuccess() proc = TestUtil.startServer(subscriber2, icestorm.reference(replica) + " --id foo --unsub", count=0) proc.waitTestSuccess()
def addApplication(descriptor, options): 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" iceGridAdminPipe = os.popen(command) TestUtil.printOutputFromPipe(iceGridAdminPipe) iceGridAdminStatus = iceGridAdminPipe.close() if iceGridAdminStatus: TestUtil.killServers() sys.exit(1)
def startRouter(): # # Note: we limit the send buffer size with Ice.TCP.SndSize, the # test relies on send() blocking # args = ' --Ice.Warn.Dispatch=0' + \ ' --Ice.Warn.Connections=0' + \ ' --Ice.TCP.SndSize=100000' + \ ' --Ice.ThreadPool.Server.Serialize=1' + \ ' --Ice.ThreadPool.Client.Serialize=1' + \ ' --Glacier2.Filter.Category.Accept="c"' + \ ' --Glacier2.SessionTimeout="30"' + \ ' --Glacier2.Client.Endpoints="default -p 12347"' + \ ' --Glacier2.Server.Endpoints="tcp -h 127.0.0.1"' \ ' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348"' + \ ' --Glacier2.PermissionsVerifier=Glacier2/NullPermissionsVerifier' + \ ' --Glacier2.Client.ForwardContext=1' + \ ' --Glacier2.Client.Trace.Override=0' + \ ' --Glacier2.Client.Trace.Request=0' + \ ' --Glacier2.Server.Trace.Override=0' + \ ' --Glacier2.Server.Trace.Request=0' + \ ' --Ice.Admin.InstanceName="Glacier2"' + \ ' --Glacier2.Client.Buffered=1 --Glacier2.Server.Buffered=1' + \ ' --Glacier2.Client.SleepTime=50 --Glacier2.Server.SleepTime=50' sys.stdout.write("starting router in buffered mode... ") sys.stdout.flush() starterProc = TestUtil.startServer(router, args, count=2) print("ok") return starterProc
def adminWithRef(self, ref, cmd, expect = None): proc = TestUtil.startClient(self.iceStormAdmin, ref + r' -e "%s"' % cmd, echo = False) if expect: proc.expect(expect) proc.wait() else: proc.waitTestSuccess()
def runsub(opt, ref, arg="", echo=False): qos = "" if opt == "twoway": qos = " --twoway" if opt == "ordered": qos = " --ordered" return TestUtil.startServer(subscriber, ref + arg + qos)
def runsub2(replica=-1, expect=None): proc = TestUtil.startServer(subscriber2, icestorm.reference(replica) + " --id foo", count=0, echo=False) if expect: proc.expect(expect) proc.wait() else: proc.waitTestSuccess()
def startRouter(buffered): args = ' --Ice.Warn.Dispatch=0' + \ ' --Ice.Warn.Connections=0' + \ ' --Glacier2.Filter.Category.Accept="c1 c2"' + \ ' --Glacier2.Filter.Category.AcceptUser="******"' + \ ' --Glacier2.SessionTimeout="30"' + \ ' --Glacier2.Client.Endpoints="default -p 12347"' + \ ' --Glacier2.Server.Endpoints="tcp -h 127.0.0.1"' \ ' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348"' + \ ' --Ice.Admin.InstanceName="Glacier2"' + \ ' --Glacier2.CryptPasswords="%s"' % os.path.join(os.getcwd(), "passwords") if buffered: args += ' --Glacier2.Client.Buffered=1 --Glacier2.Server.Buffered=1' sys.stdout.write("starting router in buffered mode... ") sys.stdout.flush() else: args += ' --Glacier2.Client.Buffered=0 --Glacier2.Server.Buffered=0' sys.stdout.write("starting router in unbuffered mode... ") sys.stdout.flush() starterProc = TestUtil.startServer(router, args, count=2) print("ok") return starterProc
def doTest(server1, server2, subOpts, pubOpts): subscriberProcs = [] if type(subOpts) != type([]): subOpts = [ subOpts ] for opts in subOpts: # We don't want the subscribers to time out. proc = TestUtil.startServer(subscriber, ' --Ice.ServerIdleTime=0 ' + opts) subscriberProcs.append(proc) publisherProc = TestUtil.startClient(publisher, server1.reference() + r' ' + pubOpts) publisherProc.waitTestSuccess() for p in subscriberProcs: sys.stdout.flush() p.waitTestSuccess() return 0
def shutdownIceGridNode(): global iceGridPort iceGridAdmin = os.path.join(toplevel, "bin", "icegridadmin") print "shutting down icegrid node...", command = iceGridAdmin + TestUtil.clientOptions + \ r' "--Ice.Default.Locator=IceGrid/Locator:default -p ' + iceGridPort + '" ' + \ r' -e "node shutdown localnode" ' + " 2>&1" iceGridAdminPipe = os.popen(command) TestUtil.printOutputFromPipe(iceGridAdminPipe) iceGridAdminStatus = iceGridAdminPipe.close() if iceGridAdminStatus: TestUtil.killServers() sys.exit(1) print "ok"
def iceGridAdmin(cmd, ignoreFailure = False): iceGridAdmin = os.path.join(TestUtil.getCppBinDir(), "icegridadmin") user = r"admin1" if cmd == "registry shutdown": user = r"shutdown" command = getDefaultLocatorProperty() + r" --IceGridAdmin.Username="******" --IceGridAdmin.Password=test1 " + \ r' -e "' + cmd + '"' driverConfig = TestUtil.DriverConfig("client") driverConfig.lang = "cpp" proc = TestUtil.startClient(iceGridAdmin, command, driverConfig) status = proc.wait() if not ignoreFailure and status: print proc.buf sys.exit(1) return proc.buf
def doTest(icestorm, batch): if batch: name = "batch subscriber" batchOptions = " -b" else: name = "subscriber" batchOptions = "" subscriberProc = TestUtil.startServer(subscriber, batchOptions + icestorm.reference()) # # Start the publisher. This should publish events which eventually # causes subscriber to terminate. # publisherProc = TestUtil.startClient(publisher, icestorm.reference()) subscriberProc.waitTestSuccess() publisherProc.waitTestSuccess()
def runAdmin(cmd, desc = None): global iceStormAdmin global iceStormAdminReference if desc: print desc, sys.stdout.flush() command = iceStormAdmin + TestUtil.clientOptions + adminIceStormReference + \ r' -e "' + cmd + '"' if TestUtil.debug: print "(" + command + ")", sys.stdout.flush() pipe = os.popen(command + " 2>&1") status = TestUtil.closePipe(pipe) if status: TestUtil.killServers() sys.exit(1) if desc: print "ok"
def runAdmin(cmd, desc = None): global iceStormAdmin global iceStormAdminReference if desc: sys.stdout.write(desc + " ") sys.stdout.flush() proc = TestUtil.startClient(iceStormAdmin, adminIceStormReference + r' -e "%s"' % cmd, startReader = True) proc.waitTestSuccess() if desc: print("ok")
def runIceGridRegistry(): iceGrid = TestUtil.getIceGridRegistry() command = ' --nowarn ' + IceGridAdmin.registryOptions dataDir = os.path.join(testdir, "db", "registry") if not os.path.exists(dataDir): os.mkdir(dataDir) cmd = command + ' ' + \ r' --Ice.ProgramName=registry' + \ r' --IceGrid.Registry.Client.Endpoints="default -p ' + str(IceGridAdmin.iceGridPort) + '" ' + \ r' --IceGrid.Registry.LMDB.MapSize=1 --IceGrid.Registry.LMDB.Path="' + dataDir + '"' driverConfig = TestUtil.DriverConfig("server") driverConfig.lang = "cpp" cmd = TestUtil.getCommandLine(iceGrid, driverConfig) + ' ' + cmd proc = TestUtil.spawn(cmd) return proc
def __init__(self, toplevel, testdir): self.toplevel = toplevel self.testdir = testdir self.iceBox = TestUtil.getIceBox() if TestUtil.isBCC2010() or TestUtil.isVC6(): self.iceBoxAdmin = os.path.join(TestUtil.getServiceDir(), "iceboxadmin") self.iceStormAdmin = os.path.join(TestUtil.getServiceDir(), "icestormadmin") else: self.iceBoxAdmin = os.path.join(TestUtil.getCppBinDir(), "iceboxadmin") self.iceStormAdmin = os.path.join(TestUtil.getCppBinDir(), "icestormadmin")
import os, sys 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 RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil server = os.path.join(os.getcwd(), TestUtil.getTestExecutable("server")) client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) router = TestUtil.getGlacier2Router() targets = [] if TestUtil.appverifier: targets = [server, client, router] TestUtil.setAppVerifierSettings(targets) sys.stdout.write("starting server... ") sys.stdout.flush() serverProc = TestUtil.startServer(server) print("ok") args = ' --Ice.Warn.Dispatch=0' + \ ' --Glacier2.AddConnectionContext=1' + \
#!/usr/bin/env python # ********************************************************************** # # Copyright (c) 2003-2015 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. # # ********************************************************************** import os, sys 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 RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil TestUtil.clientServerTest(server='server/server')
#!/usr/bin/env python # ********************************************************************** # # Copyright (c) 2003-2013 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. # # ********************************************************************** import os, sys 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 RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil sys.stdout.write("starting client... ") sys.stdout.flush() clientProc = TestUtil.startClient("Client.py", startReader = False) print("ok") clientProc.startReader() clientProc.waitTestSuccess()
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 RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil hostname = socket.gethostname() fqdn = socket.getfqdn() limitedTests = False router = TestUtil.getGlacier2Router() clientCmd = os.path.join(os.getcwd(), 'client') serverCmd = os.path.join(os.getcwd(), 'server') targets = [] if TestUtil.appverifier: targets = [serverCmd, clientCmd, router] TestUtil.setAppVerifierSettings(targets) # # Try and figure out what tests are reasonable with this host's # configuration. # if fqdn.endswith("localdomain") or fqdn.endswith("local") or fqdn.endswith( "domain"): #
# # Copyright (c) 2003-2015 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. # # ********************************************************************** import os, sys 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 RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil TestUtil.queueClientServerTest( message="Running test with default server thread pool.") TestUtil.queueClientServerTest( configName="custom", message="Running test with custom server thread pool.", server="servercustom") TestUtil.runQueuedTests()
# # Copyright (c) 2003-2015 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. # # ********************************************************************** import os, sys 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 RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil print("tests with regular server.") TestUtil.clientServerTest() print("tests with AMD server.") TestUtil.clientServerTest(server="ServerAMD.py") print("tests with collocated server.") TestUtil.collocatedTest( " --Ice.ThreadPool.Client.SizeMax=2 --Ice.ThreadPool.Client.SizeWarn=0")
#!/usr/bin/env python # -*- coding: utf-8 -*- # ********************************************************************** # # Copyright (c) 2003-2014 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. # # ********************************************************************** import os, sys 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 RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil TestUtil.addPathToEnv( "NODE_PATH", os.path.join(os.path.dirname(__file__), "..", "operations")) TestUtil.clientEchoTest()
# ICE_LICENSE file included in this distribution. # # ********************************************************************** import os, sys 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 RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil TestUtil.queueClientServerTest() TestUtil.queueClientServerTest(configName="amd", localOnly=True, message="Running test with AMD server.", server="test.Ice.servantLocator.AMDServer") TestUtil.queueCollocatedTest() TestUtil.runQueuedTests()
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 RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil, IceStormUtil publisher = os.path.join(os.getcwd(), "publisher") subscriber = os.path.join(os.getcwd(), "subscriber") subscriber2 = os.path.join(os.getcwd(), "sub") targets = [] if TestUtil.appverifier: targets = [TestUtil.getIceBox(), publisher, subscriber, subscriber2, TestUtil.getIceBoxAdmin(), \ TestUtil.getIceStormAdmin()] TestUtil.setAppVerifierSettings(targets, cwd = os.getcwd()) def runsub(opt, ref, arg = "", echo=False): qos = "" if opt == "twoway": qos = " --twoway" if opt == "ordered": qos = " --ordered" return TestUtil.startServer(subscriber, ref + arg + qos) def runpub(ref, arg = "", echo=False): return TestUtil.startClient(publisher, ref + arg) def runtest(opt, ref, subopt="", pubopt=""):
def admin(ref, command): proc = TestUtil.startClient(iceStormAdmin, ref + ' -e "%s"' % command, echo=False) proc.waitTestSuccess() return proc.buf
# ********************************************************************** import os, sys 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 RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil router = os.path.join(TestUtil.getCppBinDir(), "glacier2router") # # Generate the crypt passwords file # TestUtil.hashPasswords(os.path.join(os.getcwd(), "passwords"), {"userid": "abc123"}) args = ' --Ice.Warn.Dispatch=0' + \ ' --Ice.Warn.Connections=0' + \ ' --Glacier2.Filter.Category.Accept="c1 c2"' + \ ' --Glacier2.Filter.Category.AcceptUser="******"' + \ ' --Glacier2.SessionTimeout="30"' + \ ' --Glacier2.Client.Endpoints="default -p 12347"' + \ ' --Glacier2.Server.Endpoints="tcp -h 127.0.0.1"' \ ' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348"' + \ ' --Ice.Admin.InstanceName=Glacier2' + \
import os, sys, time, threading, re 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 RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil, IceStormUtil, Expect iceStormAdmin = os.path.join(TestUtil.getCppBinDir(), "icestormadmin") publisher = os.path.join(os.getcwd(), "publisher") subscriber = os.path.join(os.getcwd(), "subscriber") targets = [] if TestUtil.appverifier: targets = [ TestUtil.getIceBox(), publisher, subscriber, TestUtil.getIceBoxAdmin(), TestUtil.getIceStormAdmin() ] TestUtil.setAppVerifierSettings(targets, cwd=os.getcwd()) def admin(ref, command):
#!/usr/bin/env python # ********************************************************************** # # Copyright (c) 2003-2015 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. # # ********************************************************************** import os, sys 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 RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil client = os.path.join(os.getcwd(), "client") TestUtil.simpleTest(client)
#!/usr/bin/env python # ********************************************************************** # # Copyright (c) 2003-2016 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. # # ********************************************************************** import os, sys 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 RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil TestUtil.queueClientServerTest() TestUtil.queueCollocatedTest() TestUtil.runQueuedTests()
#!/usr/bin/env python # ********************************************************************** # # Copyright (c) 2003-2014 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. # # ********************************************************************** import os, sys 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 RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil TestUtil.clientEchoTest()
if len(path) == 0: raise RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil testdir = os.path.dirname(os.path.abspath(__file__)) if os.path.exists(os.path.join(testdir, "Test1_ice.py")): os.remove(os.path.join(testdir, "Test1_ice.py")) if os.path.exists(os.path.join(testdir, "Test2_ice.py")): os.remove(os.path.join(testdir, "Test2_ice.py")) if os.path.exists(os.path.join(testdir, "Test")): shutil.rmtree(os.path.join(testdir, "Test")) if os.environ.get("USE_BIN_DIST", "no") == "yes": if TestUtil.isDarwin(): slice2py = sys.executable + " /usr/local/bin/slice2py" elif TestUtil.isWin32(): pythonHome = os.path.dirname(sys.executable) slice2py = sys.executable + " " + os.path.join(pythonHome, "Scripts", "slice2py.exe") elif TestUtil.isYocto(): slice2py = os.path.join(TestUtil.getCppBinDir(), "slice2py") else: import slice2py slice2py = sys.executable + " " + os.path.normpath(os.path.join(slice2py.__file__, "..", "..", "..", "..", "bin", "slice2py")) else: if TestUtil.isYocto(): slice2py = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "..", "..", "cpp", "bin", "slice2py") else: slice2py = sys.executable + " " + os.path.join(path[0], "python", "config", "s2py.py")
#!/usr/bin/env python # ********************************************************************** # # Copyright (c) 2003-2016 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. # # ********************************************************************** import os, sys 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 RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil sys.stdout.write("starting client... ") sys.stdout.flush() clientProc = TestUtil.startClient("test.Slice.structure.Client",startReader=False) print("ok") clientProc.startReader() clientProc.waitTestSuccess()
#!/usr/bin/env python # ********************************************************************** # # Copyright (c) 2003-2007 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. # # ********************************************************************** import os, sys for toplevel in [".", "..", "../..", "../../..", "../../../.."]: toplevel = os.path.normpath(toplevel) if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): break else: raise "can't find toplevel directory!" sys.path.append(os.path.join(toplevel, "config")) import TestUtil name = os.path.join("Ice", "hold") TestUtil.clientServerTest(name) sys.exit(0)
import os, sys, re 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 RuntimeError("can't find toplevel os.getcwd()!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil slice2cpp = '"%s"' % TestUtil.getSliceTranslator() regex1 = re.compile("\.ice$", re.IGNORECASE) files = [] for file in os.listdir(os.getcwd()): if (regex1.search(file)): files.append(file) files.sort() for file in files: sys.stdout.write(file + "... ") sys.stdout.flush() if file.find("Underscore") != -1:
# Copyright (c) 2003-2016 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. # # ********************************************************************** import os, sys 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 RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil sys.stdout.write("starting server... ") sys.stdout.flush() server = server = os.path.join(os.getcwd(), TestUtil.getTestExecutable("server")) p = TestUtil.startServer(server) print("ok") sys.stdout.flush() p.waitTestSuccess()
--- cpp/test/Slice/headers/run.py.orig 2019-08-12 19:54:18 UTC +++ cpp/test/Slice/headers/run.py @@ -20,6 +20,9 @@ if len(path) == 0: sys.path.append(os.path.join(path[0], "scripts")) import TestUtil +def execute(cmd): + return TestUtil.runCommand(cmd).wait() + def clean(): for f in ["iceslices", "linktoslices", @@ -28,7 +31,7 @@ def clean(): os.path.join("slices", "dir1", "linktoa3.ice")]: if os.path.exists(f): os.unlink(f) - os.system("rm -rf project1 tmp") + execute("rm -rf project1 tmp") clean() os.symlink("slices", "linktoslices") @@ -44,7 +47,7 @@ slicedir = TestUtil.getSliceDir() os.symlink(slicedir, "iceslices") def runTest(cmd): - os.system(cmd) + execute(cmd) f = open("b.h") if not re.search('#include <dir1\/a1\.h>\n' '#include <linktodir1\/a2\.h>\n' @@ -72,9 +75,9 @@ if os.path.exists("SLICES"):
"../../../../../..", "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ] 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 RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil TestUtil.queueClientServerTest(configName="sliced", message="Running test with sliced format.") TestUtil.queueClientServerTest( configName="1.0", message="Running test with 1.0 encoding.", additionalClientOptions="--Ice.Default.EncodingVersion=1.0", additionalServerOptions="--Ice.Default.EncodingVersion=1.0") TestUtil.queueClientServerTest( configName="slicedAMD", localOnly=True, message="Running test with sliced format and AMD server.", server="test.Ice.slicing.objects.AMDServer") TestUtil.queueClientServerTest( configName="1.0AMD",
import os, sys 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 RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil router = os.path.join(TestUtil.getCppBinDir(), "glacier2router") args = ' --Ice.Warn.Dispatch=0' + \ ' --Ice.Warn.Connections=0' + \ ' --Glacier2.SessionTimeout="30"' + \ ' --Glacier2.Client.Endpoints="default -p 12347"' + \ ' --Glacier2.Server.Endpoints="tcp -h 127.0.0.1"' \ ' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348"' + \ ' --Ice.Admin.InstanceName=Glacier2' + \ ' --Glacier2.CryptPasswords="' + os.path.join(os.getcwd(), "passwords") + '"' sys.stdout.write("starting router... ") sys.stdout.flush() routerConfig = TestUtil.DriverConfig("server") routerConfig.lang = "cpp" starterProc = TestUtil.startServer(router, args, count=2, config=routerConfig)
def __executeTestCase(self, testCase, worksheet,worksheet2, iter=0): discardBefore = testCase.get("discardBefore", False) if discardBefore: responses = self.bot.sendMessage(self.discardMessage, 1) if responses and len(responses) == 1 :# and "discarding the task for now" in responses[0].lower(): iter = 0 pass else: if iter == 0: self.__executeTestCase(testCase, worksheet,worksheet2, iter+1) return worksheet.write('A'+str(self.index),testCase["name"]) check = True for message in testCase["messages"]: outputs = message["outputs"] responses = self.bot.sendMessage(message["input"], len(outputs)) worksheet.write('B'+str(self.index),message["input"]) if check == True: our_message = message["input"] check = False if len(responses) != len(outputs): self.bot = self.__reconnect() if iter == 1: worksheet.write('E'+str(self.index),"Failed", self.format) self.countfail += 1 if check == False: if self.countfail >= 2: self.failed_list += "," self.allUtterances[our_message] = "Fail" self.failed_list += our_message check = True worksheet2.write('B2',self.countfail) worksheet2.write('C2',self.countpass + self.countfail) worksheet.write('C'+str(self.index), str(responses), self.format) worksheet.write('D'+str(self.index),str(outputs), self.format) self.index = self.index + 1 return else: self.__executeTestCase(testCase, worksheet,worksheet2, iter+1) return for i in range(len(responses)) : success = True messageObj = responses[i] response, component = TestUtil.componentToText(messageObj) if isinstance(outputs[i],dict) : eqCondition = False containsObj = outputs[i].get("contains",None) if not containsObj: containsObj = outputs[i].get("equals",None) eqCondition = True if isinstance(containsObj,dict) : containsStr = str(containsObj) allOf = False matches = [] expMatches = containsObj.get("oneOf", None) if not expMatches: expMatches = containsObj.get("allOf", None) allOf = True for expMatch in expMatches: if eqCondition: if expMatch.lower() == response.lower() : pass else: matches.append(False) else: if TestUtil.validateContains(response.lower(), expMatch.lower()) : matches.append(True) else: matches.append(False) if allOf and False in matches: success = False elif True not in matches: success = False else: containsStr = containsObj if not TestUtil.validateContains(response.lower(), containsStr.lower()) : debug.info("User Input::"+message["input"]+",TestCase:"+testCase["name"]+" Failed,Actual: "+response+",Expected: "+containsStr) success = False else: containsStr = outputs[i] if response != outputs[i] : debug.info("else User Input::"+message["input"]+",TestCase:"+testCase["name"]+" Failed,actual:"+response+" expected:"+outputs[i]) success = False if not success: worksheet.write('E'+str(self.index),"Failed", self.format) self.countfail += 1 if check == False: if self.countfail >= 2: self.failed_list += "," self.allUtterances[our_message] = "Fail" self.failed_list += our_message check = True worksheet2.write('B2',self.countfail) worksheet2.write('C2',self.countpass + self.countfail) worksheet.write('C'+str(self.index),response+"", self.format) worksheet.write('D'+str(self.index),containsStr+"", self.format) self.index = self.index + 1 return response = response[:-1] worksheet.write('C'+str(self.index),response+"", self.format) worksheet.write('D'+str(self.index),containsStr+"", self.format) self.index = self.index + 1 worksheet.write('E'+str(self.index-1),"Passed\n") self.countpass += 1 self.passed_list = self.passed_list + "\n" + our_message self.allUtterances[our_message] = "Pass" worksheet2.write('A2',self.countpass) worksheet2.write('C2',self.countpass + self.countfail)
#!/usr/bin/env python # ********************************************************************** # # Copyright (c) 2003-2015 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. # # ********************************************************************** import os, sys 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 RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil print("tests with Blobject server.") TestUtil.clientServerTest() print("tests with BlobjectAsync server.") TestUtil.clientServerTest(additionalServerOptions = "--async")
if len(path) == 0: raise RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil testdir = os.path.dirname(os.path.abspath(__file__)) if os.path.exists(os.path.join(testdir, "Test1_ice.py")): os.remove(os.path.join(testdir, "Test1_ice.py")) if os.path.exists(os.path.join(testdir, "Test2_ice.py")): os.remove(os.path.join(testdir, "Test2_ice.py")) if os.path.exists(os.path.join(testdir, "Test")): shutil.rmtree(os.path.join(testdir, "Test")) if os.environ.get("USE_BIN_DIST", "no") == "yes": if TestUtil.isDarwin(): slice2py = "/usr/local/bin/slice2py" elif TestUtil.isWin32(): pythonHome = os.path.dirname(sys.executable) slice2py = os.path.join(pythonHome, "Scripts", "slice2py.exe") else: import slice2py slice2py = os.path.normpath( os.path.join(slice2py.__file__, '..', '..', '..', '..', 'bin', 'slice2py')) else: slice2py = os.path.join(path[0], "python", "config", "s2py.py") s2p = TestUtil.spawn(sys.executable + " " + slice2py + " Test1.ice") s2p.waitTestSuccess() s2p = TestUtil.spawn(sys.executable + " " + slice2py + " Test2.ice")
def runpub(ref, arg = "", echo=False): return TestUtil.startClient(publisher, ref + arg)
import sys, os, signal 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 RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil, IceGridAdmin if not TestUtil.isWin32() and os.getuid() == 0: sys.stdout.write("\n") sys.stdout.write("*** can't run test as root ***\n") sys.stdout.write("\n") sys.exit(0) testdir = os.getcwd() router = TestUtil.getGlacier2Router() targets = [] if TestUtil.appverifier: targets = [ TestUtil.getIceGridNode(), TestUtil.getIceGridRegistry(), router ] TestUtil.setAppVerifierSettings(targets)
# ICE_LICENSE file included in this distribution. # # ********************************************************************** import os, sys, getopt 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 RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil client = os.path.join(os.getcwd(), "client") sys.stdout.write("starting client...") sys.stdout.flush() clientProc = TestUtil.startClient(client, " --Ice.Warn.Dispatch=0", startReader=False) print("ok") clientProc.startReader() clientProc.waitTestSuccess()
# ********************************************************************** import os, sys import time 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 RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(path[0], "scripts")) import TestUtil, IceStormUtil publisher = os.path.join(os.getcwd(), TestUtil.getTestExecutable("publisher")) subscriber = os.path.join(os.getcwd(), TestUtil.getTestExecutable("subscriber")) targets = [] if TestUtil.appverifier: targets = [TestUtil.getIceBox(), publisher, subscriber, TestUtil.getIceBoxAdmin(), TestUtil.getIceStormAdmin()] TestUtil.setAppVerifierSettings(targets, cwd = os.getcwd()) def doTest(icestorm, batch): if batch: name = "batch subscriber" batchOptions = " -b" else: name = "subscriber" batchOptions = ""