コード例 #1
0
ファイル: IceGridAdmin.py プロジェクト: glockwork/dfu
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
コード例 #2
0
ファイル: run.py プロジェクト: 465060874/ice
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))
コード例 #3
0
ファイル: IceGridAdmin.py プロジェクト: wuhua988/icm
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
コード例 #4
0
ファイル: IceGridAdmin.py プロジェクト: 2008hatake/zeroc-ice
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
コード例 #5
0
ファイル: IceStormUtil.py プロジェクト: chenbk85/ice
    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
コード例 #6
0
ファイル: IceGridAdmin.py プロジェクト: updowndown/myffff
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
コード例 #7
0
ファイル: run.py プロジェクト: dayongxie/zeroc-ice-androidndk
    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
コード例 #8
0
ファイル: run.py プロジェクト: updowndown/myffff
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)
コード例 #9
0
ファイル: IceGridAdmin.py プロジェクト: updowndown/myffff
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)                
コード例 #10
0
ファイル: IceGridAdmin.py プロジェクト: 2008hatake/zeroc-ice
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
コード例 #11
0
ファイル: run.py プロジェクト: updowndown/myffff
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"
コード例 #12
0
ファイル: run.py プロジェクト: updowndown/myffff
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
コード例 #13
0
ファイル: IceGridAdmin.py プロジェクト: pedia/zeroc-ice
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
コード例 #14
0
ファイル: run.py プロジェクト: pedia/zeroc-ice
 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")
コード例 #15
0
ファイル: IceGridAdmin.py プロジェクト: wuhua988/icm
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)
コード例 #16
0
ファイル: run.py プロジェクト: oceanwavechina/ice
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()
コード例 #17
0
ファイル: IceGridAdmin.py プロジェクト: wuhua988/icm
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)
コード例 #18
0
ファイル: run.py プロジェクト: pedia/zeroc-ice
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
コード例 #19
0
ファイル: IceStormUtil.py プロジェクト: chenbk85/ice
 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()
コード例 #20
0
ファイル: run.py プロジェクト: oceanwavechina/ice
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)
コード例 #21
0
ファイル: run.py プロジェクト: oceanwavechina/ice
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()
コード例 #22
0
ファイル: run.py プロジェクト: dayongxie/zeroc-ice-androidndk
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
コード例 #23
0
ファイル: run.py プロジェクト: 2008hatake/zeroc-ice
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
コード例 #24
0
ファイル: IceGridAdmin.py プロジェクト: wuhua988/icm
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"
コード例 #25
0
ファイル: IceGridAdmin.py プロジェクト: glockwork/dfu
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
コード例 #26
0
ファイル: run.py プロジェクト: Jonavin/ice
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()
コード例 #27
0
ファイル: run.py プロジェクト: updowndown/myffff
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"
コード例 #28
0
ファイル: run.py プロジェクト: 2008hatake/zeroc-ice
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")
コード例 #29
0
ファイル: run.py プロジェクト: chenbk85/ice
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
コード例 #30
0
ファイル: IceStormUtil.py プロジェクト: bholl/zeroc-ice
 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")
コード例 #31
0
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' + \
コード例 #32
0
ファイル: run.py プロジェクト: sk163/ice-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')

コード例 #33
0
ファイル: run.py プロジェクト: stick/zeroc-ice
#!/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()
コード例 #34
0
ファイル: run.py プロジェクト: stick/zeroc-ice
    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"):
    #
コード例 #35
0
ファイル: run.py プロジェクト: yecao007/ice
#
# 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()
コード例 #36
0
ファイル: run.py プロジェクト: sk163/ice-1
#
# 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")
コード例 #37
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()
コード例 #38
0
# 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()
コード例 #39
0
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=""):
コード例 #40
0
def admin(ref, command):
    proc = TestUtil.startClient(iceStormAdmin,
                                ref + ' -e "%s"' % command,
                                echo=False)
    proc.waitTestSuccess()
    return proc.buf
コード例 #41
0
ファイル: run.py プロジェクト: sk163/ice-1
# **********************************************************************

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' + \
コード例 #42
0
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):
コード例 #43
0
ファイル: run.py プロジェクト: sk163/ice-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

client = os.path.join(os.getcwd(), "client")
TestUtil.simpleTest(client)
コード例 #44
0
#!/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()
コード例 #45
0
ファイル: run.py プロジェクト: martin-ly/zeroc-ice-androidndk
#!/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()
コード例 #46
0
ファイル: run.py プロジェクト: zhakui/ice
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")
コード例 #47
0
#!/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()
コード例 #48
0
ファイル: run.py プロジェクト: chizon/myffff
#!/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)
コード例 #49
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:
コード例 #50
0
# 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()
コード例 #51
0
--- 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"):
コード例 #52
0
ファイル: run.py プロジェクト: zhoushiyi/ice
    "../../../../../..", "../../../../../../..", "../../../../../../../..",
    "../../../../../../../../.."
]
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",
コード例 #53
0
ファイル: run.py プロジェクト: stick/zeroc-ice
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)
コード例 #54
0
	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)
コード例 #55
0
#!/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")
コード例 #56
0
ファイル: run.py プロジェクト: zhangtianshan/ice
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")
コード例 #57
0
def runpub(ref, arg = "", echo=False):
    return TestUtil.startClient(publisher, ref + arg)
コード例 #58
0
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)
コード例 #59
0
ファイル: run.py プロジェクト: zhoushiyi/ice
# 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()
コード例 #60
0
# **********************************************************************

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 = ""