diff options
Diffstat (limited to 'java/test')
53 files changed, 424 insertions, 1106 deletions
diff --git a/java/test/Freeze/complex/run.py b/java/test/Freeze/complex/run.py index bcb9ba442dd..9b13db269d1 100755 --- a/java/test/Freeze/complex/run.py +++ b/java/test/Freeze/complex/run.py @@ -10,49 +10,32 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" +sys.path.append(os.path.join(path[0])) +from scripts import * -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Freeze", "complex") -testdir = os.path.join(toplevel, "test", name) -testdir = os.path.dirname(os.path.abspath(__file__)) -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + os.pathsep + os.getenv("CLASSPATH", "") +TestUtil.addClasspath(os.path.join(os.getcwd(), "classes")) # # Clean the contents of the database directory. # -dbdir = os.path.join(testdir, "db") +dbdir = os.path.join(os.getcwd(), "db") TestUtil.cleanDbDir(dbdir) - print "starting populate...", -populatePipe = TestUtil.startClient("Client", " --dbdir " + testdir + " populate" + " 2>&1") +populateProc = TestUtil.startClient("Client", " --dbdir %s populate" % os.getcwd()) print "ok" -TestUtil.printOutputFromPipe(populatePipe) - -populateStatus = TestUtil.closePipe(populatePipe) - -if populateStatus: - sys.exit(1) +populateProc.waitTestSuccess() print "starting verification client...", -clientPipe = TestUtil.startClient("Client", " --dbdir " + testdir + " validate" + " 2>&1") -print "ok" +clientProc = TestUtil.startClient("Client", " --dbdir %s validate" % os.getcwd()) -TestUtil.printOutputFromPipe(clientPipe) - -clientStatus = TestUtil.closePipe(clientPipe) - -if clientStatus: - sys.exit(1) - -sys.exit(0) +print "ok" +clientProc.waitTestSuccess() diff --git a/java/test/Freeze/dbmap/run.py b/java/test/Freeze/dbmap/run.py index a304c10eac4..f016eb71efd 100755 --- a/java/test/Freeze/dbmap/run.py +++ b/java/test/Freeze/dbmap/run.py @@ -10,34 +10,22 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" +sys.path.append(os.path.join(path[0])) +from scripts import * -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() +TestUtil.addClasspath(os.path.join(os.getcwd(), "classes")) -name = os.path.join("Freeze", "dbmap") -testdir = os.path.join(toplevel, "test", name) -testdir = os.path.dirname(os.path.abspath(__file__)) -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + os.pathsep + os.getenv("CLASSPATH", "") - -dbdir = os.path.join(testdir, "db") +dbdir = os.path.join(os.getcwd(), "db") TestUtil.cleanDbDir(dbdir) print "starting client...", -clientPipe = TestUtil.startClient("Client", testdir + " 2>&1") +clientProc = TestUtil.startClient("Client", os.getcwd()) print "ok" - -TestUtil.printOutputFromPipe(clientPipe) - -clientStatus = TestUtil.closePipe(clientPipe) - -if clientStatus: - sys.exit(1) - -sys.exit(0) +clientProc.waitTestSuccess() diff --git a/java/test/Freeze/evictor/run.py b/java/test/Freeze/evictor/run.py index ad872902b86..263bf0c1a1b 100755 --- a/java/test/Freeze/evictor/run.py +++ b/java/test/Freeze/evictor/run.py @@ -10,25 +10,19 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" +sys.path.append(os.path.join(path[0])) +from scripts import * -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Freeze", "evictor") -testdir = os.path.dirname(os.path.abspath(__file__)) -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + os.pathsep + os.getenv("CLASSPATH", "") - -dbdir = os.path.join(testdir, "db") +dbdir = os.path.join(os.getcwd(), "db") TestUtil.cleanDbDir(dbdir) -testOptions = " --Freeze.Warn.Deadlocks=0 --Freeze.DbEnv.db.DbHome=" + testdir + "/db" + " --Ice.Config=" + testdir + "/config "; +testOptions = " --Freeze.Warn.Deadlocks=0 --Freeze.DbEnv.db.DbHome=%s/db --Ice.Config=%s/config " % (os.getcwd(), os.getcwd()) -TestUtil.clientServerTestWithOptions(testdir, testOptions, testOptions) -sys.exit(0) +TestUtil.clientServerTest(testOptions, testOptions) diff --git a/java/test/Freeze/oldevictor/run.py b/java/test/Freeze/oldevictor/run.py index daa73970fd6..82956957755 100755 --- a/java/test/Freeze/oldevictor/run.py +++ b/java/test/Freeze/oldevictor/run.py @@ -10,25 +10,19 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" +sys.path.append(os.path.join(path[0])) +from scripts import * -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Freeze", "oldevictor") -testdir = os.path.dirname(os.path.abspath(__file__)) -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + os.pathsep + os.getenv("CLASSPATH", "") - -dbdir = os.path.join(testdir, "db") +dbdir = os.path.join(os.getcwd(), "db") TestUtil.cleanDbDir(dbdir) -testOptions = " --Freeze.DbEnv.db.DbHome=" + testdir + "/db" + " --Ice.Config=" + testdir + "/config "; +testOptions = " --Freeze.DbEnv.db.DbHome=%s --Ice.Config=%s" % (dbdir, os.path.join(os.getcwd(), "config")) -TestUtil.clientServerTestWithOptions(testdir, testOptions, testOptions) -sys.exit(0) +TestUtil.clientServerTest(testOptions, testOptions) diff --git a/java/test/Glacier2/attack/AttackClient.java b/java/test/Glacier2/attack/AttackClient.java deleted file mode 100644 index 1a93f058ae4..00000000000 --- a/java/test/Glacier2/attack/AttackClient.java +++ /dev/null @@ -1,138 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2008 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 Test.*; - -class AttackClient extends Ice.Application -{ - public int - run(String[] args) - { - System.out.print("getting router... "); - System.out.flush(); - Ice.ObjectPrx routerBase = communicator().stringToProxy("Glacier2/router:default -p 12347 -t 10000"); - Glacier2.RouterPrx router = Glacier2.RouterPrxHelper.checkedCast(routerBase); - test(router != null); - System.out.println("ok"); - - System.out.print("creating session... "); - System.out.flush(); - try - { - Glacier2.SessionPrx session = router.createSession("userid", "abc123"); - } - catch(Glacier2.PermissionDeniedException ex) - { - assert(false); - } - catch(Glacier2.CannotCreateSessionException ex) - { - assert(false); - } - communicator().setDefaultRouter(router); - System.out.println("ok"); - - System.out.print("making thousands of invocations on proxies... "); - System.out.flush(); - Ice.ObjectPrx backendBase = communicator().stringToProxy("dummy:tcp -p 12010 -t 10000"); - BackendPrx backend = BackendPrxHelper.uncheckedCast(backendBase); - backend.ice_ping(); - - java.util.Map<BackendPrx, BackendPrx> backends = new java.util.HashMap<BackendPrx, BackendPrx>(); - java.util.Random rand = new java.util.Random(); - - String msg = ""; - for(int i = 1; i <= 10000; ++i) - { - if(i % 100 == 0) - { - for(int j = 0; j < msg.length(); ++j) - { - System.out.print('\b'); - } - - msg = "" + i; - System.out.print(i); - System.out.flush(); - } - - Ice.Identity ident = new Ice.Identity(); - - StringBuffer name = new StringBuffer(); - name.append((char)('A' + rand.nextInt(26))); - ident.name = name.toString(); - - StringBuffer category = new StringBuffer(); - int len = rand.nextInt(2); - for(int j = 0; j < len; ++j) - { - category.append((char)('a' + rand.nextInt(26))); - } - ident.category = category.toString(); - - BackendPrx newBackend = BackendPrxHelper.uncheckedCast(backendBase.ice_identity(ident)); - - if(!backends.containsKey(newBackend)) - { - backends.put(newBackend, newBackend); - backend = newBackend; - } - else - { - backend = backends.get(newBackend); - } - - backend.ice_ping(); - } - - for(int j = 0; j < msg.length(); ++j) - { - System.out.print('\b'); - } - for(int j = 0; j < msg.length(); ++j) - { - System.out.print(' '); - } - for(int j = 0; j < msg.length(); ++j) - { - System.out.print('\b'); - } - System.out.println("ok"); - - System.out.print("testing server and router shutdown... "); - System.out.flush(); - backend.shutdown(); - communicator().setDefaultRouter(null); - Ice.ObjectPrx processBase = - communicator().stringToProxy("Glacier2/admin -f Process:tcp -h 127.0.0.1 -p 12348 -t 10000"); - Ice.ProcessPrx process = Ice.ProcessPrxHelper.checkedCast(processBase); - test(process != null); - process.shutdown(); - try - { - process.ice_ping(); - test(false); - } - catch(Ice.LocalException ex) - { - System.out.println("ok"); - } - - return 0; - } - - private static void - test(boolean b) - { - if(!b) - { - throw new RuntimeException(); - } - } -} diff --git a/java/test/Glacier2/attack/Backend.ice b/java/test/Glacier2/attack/Backend.ice deleted file mode 100644 index 5e93560db7c..00000000000 --- a/java/test/Glacier2/attack/Backend.ice +++ /dev/null @@ -1,23 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2008 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. -// -// ********************************************************************** - -#ifndef BACKEND_ICE -#define BACKEND_ICE - -module Test -{ - -interface Backend -{ - void shutdown(); -}; - -}; - -#endif diff --git a/java/test/Glacier2/attack/BackendI.java b/java/test/Glacier2/attack/BackendI.java deleted file mode 100644 index d0830936069..00000000000 --- a/java/test/Glacier2/attack/BackendI.java +++ /dev/null @@ -1,23 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2008 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 Test.*; - -final class BackendI extends _BackendDisp -{ - BackendI() - { - } - - public void - shutdown(Ice.Current current) - { - current.adapter.getCommunicator().shutdown(); - } -} diff --git a/java/test/Glacier2/attack/BackendServer.java b/java/test/Glacier2/attack/BackendServer.java deleted file mode 100644 index 8e839bcdec6..00000000000 --- a/java/test/Glacier2/attack/BackendServer.java +++ /dev/null @@ -1,24 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2008 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 Test.*; - -class BackendServer extends Ice.Application -{ - public int - run(String[] args) - { - communicator().getProperties().setProperty("BackendAdapter.Endpoints", "tcp -p 12010 -t 10000"); - Ice.ObjectAdapter adapter = communicator().createObjectAdapter("BackendAdapter"); - adapter.addServantLocator(new ServantLocatorI(), ""); - adapter.activate(); - communicator().waitForShutdown(); - return 0; - } -} diff --git a/java/test/Glacier2/attack/Client.java b/java/test/Glacier2/attack/Client.java deleted file mode 100644 index bc876194eb3..00000000000 --- a/java/test/Glacier2/attack/Client.java +++ /dev/null @@ -1,29 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2008 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. -// -// ********************************************************************** - -public class Client -{ - public static void - main(String[] args) - { - // - // We want to check whether the client retries for evicted - // proxies, even with regular retries disabled. - // - Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args); - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(argsH); - initData.properties.setProperty("Ice.RetryIntervals", "-1"); - - AttackClient app = new AttackClient(); - int status = app.main("Client", argsH.value, initData); - System.gc(); - System.exit(status); - } -} diff --git a/java/test/Glacier2/attack/ServantLocatorI.java b/java/test/Glacier2/attack/ServantLocatorI.java deleted file mode 100644 index 5661f24428f..00000000000 --- a/java/test/Glacier2/attack/ServantLocatorI.java +++ /dev/null @@ -1,33 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2008 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 Test.*; - -public final class ServantLocatorI implements Ice.ServantLocator -{ - ServantLocatorI() - { - _backend = new BackendI(); - } - - public Ice.Object locate(Ice.Current curr, Ice.LocalObjectHolder cookie) - { - return _backend; - } - - public void finished(Ice.Current curr, Ice.Object servant, java.lang.Object cookie) - { - } - - public void deactivate(String category) - { - } - - private Backend _backend; -} diff --git a/java/test/Glacier2/attack/Server.java b/java/test/Glacier2/attack/Server.java deleted file mode 100644 index a6ccfd7c61c..00000000000 --- a/java/test/Glacier2/attack/Server.java +++ /dev/null @@ -1,20 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2008 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. -// -// ********************************************************************** - -public class Server -{ - public static void - main(String[] args) - { - BackendServer app = new BackendServer(); - int status = app.main("Server", args); - System.gc(); - System.exit(status); - } -} diff --git a/java/test/Glacier2/attack/build.xml b/java/test/Glacier2/attack/build.xml deleted file mode 100644 index 24877fb4192..00000000000 --- a/java/test/Glacier2/attack/build.xml +++ /dev/null @@ -1,48 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2008 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. - - ********************************************************************** ---> - -<project name="test_Glacier2_attack" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <fileset dir="." includes="Backend.ice"/> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/Glacier2/attack/passwords b/java/test/Glacier2/attack/passwords deleted file mode 100644 index a1527dec2b9..00000000000 --- a/java/test/Glacier2/attack/passwords +++ /dev/null @@ -1 +0,0 @@ -userid xxMqsnnDcK8tw
\ No newline at end of file diff --git a/java/test/Glacier2/attack/run.py b/java/test/Glacier2/attack/run.py deleted file mode 100755 index c12be9e5baf..00000000000 --- a/java/test/Glacier2/attack/run.py +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2008 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 -TestUtil.processCmdLine() - -testdir = os.path.dirname(os.path.abspath(__file__)) - -router = os.path.join(TestUtil.getCppBinDir(), "glacier2router") - -args = r' --Ice.PrintProcessId' \ - r' --Glacier2.RoutingTable.MaxSize=10' + \ - r' --Glacier2.Client.Endpoints="default -p 12347 -t 10000"' + \ - r' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348 -t 10000"' + \ - r' --Ice.Admin.InstanceName=Glacier2' + \ - r' --Glacier2.CryptPasswords="' + os.path.join(testdir, "passwords") + '"' - -print "starting router...", -routerConfig = TestUtil.DriverConfig("server") -routerConfig.lang = "cpp" -starterPipe = TestUtil.startServer(router, args + " 2>&1", routerConfig) -TestUtil.getServerPid(starterPipe) -TestUtil.getAdapterReady(starterPipe, True, 2) -print "ok" - -name = os.path.join("Glacier2", "attack") -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + os.pathsep + os.getenv("CLASSPATH", "") - -TestUtil.clientServerTest(name) - -if TestUtil.serverStatus(): - sys.exit(1) - -sys.exit(0) diff --git a/java/test/Glacier2/build.xml b/java/test/Glacier2/build.xml index b670c262eff..ac9aa933090 100644 --- a/java/test/Glacier2/build.xml +++ b/java/test/Glacier2/build.xml @@ -12,12 +12,10 @@ <project name="test_Glacier2" default="all" basedir="."> <target name="all"> - <ant dir="attack"/> <ant dir="router"/> </target> <target name="clean"> - <ant dir="attack" target="clean"/> <ant dir="router" target="clean"/> </target> diff --git a/java/test/Glacier2/router/run.py b/java/test/Glacier2/router/run.py index 7da23613f11..aa07761924c 100755 --- a/java/test/Glacier2/router/run.py +++ b/java/test/Glacier2/router/run.py @@ -10,62 +10,37 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" - -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -testdir = os.path.dirname(os.path.abspath(__file__)) +sys.path.append(os.path.join(path[0])) +from scripts import * router = os.path.join(TestUtil.getCppBinDir(), "glacier2router") -args = r' --Ice.Warn.Dispatch=0' + \ - r' --Ice.Warn.Connections=0' + \ - r' --Glacier2.Filter.Category.Accept="c1 c2"' + \ - r' --Glacier2.Filter.Category.AcceptUser="2"' + \ - r' --Glacier2.SessionTimeout="30"' + \ - r' --Glacier2.Client.Endpoints="default -p 12347 -t 10000"' + \ - r' --Glacier2.Server.Endpoints="tcp -h 127.0.0.1 -t 10000"' \ - r' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348 -t 10000"' + \ - r' --Ice.Admin.InstanceName=Glacier2' + \ - r' --Glacier2.CryptPasswords="' + os.path.join(testdir, "passwords") + '"' +args = ' --Ice.Warn.Dispatch=0' + \ + ' --Ice.Warn.Connections=0' + \ + ' --Glacier2.Filter.Category.Accept="c1 c2"' + \ + ' --Glacier2.Filter.Category.AcceptUser="2"' + \ + ' --Glacier2.SessionTimeout="30"' + \ + ' --Glacier2.Client.Endpoints="default -p 12347 -t 10000"' + \ + ' --Glacier2.Server.Endpoints="tcp -h 127.0.0.1 -t 10000"' \ + ' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348 -t 10000"' + \ + ' --Ice.Admin.InstanceName=Glacier2' + \ + ' --Glacier2.CryptPasswords="' + os.path.join(os.getcwd(), "passwords") + '"' print "starting router...", routerConfig = TestUtil.DriverConfig("server") routerConfig.lang = "cpp" -starterPipe = TestUtil.startServer(router, args + " 2>&1", routerConfig) -TestUtil.getServerPid(starterPipe) -# -# For this test we don't want to add the router to the server threads -# since we want the the router to run over two calls to -# mixedClientServerTest -# -TestUtil.getAdapterReady(starterPipe, False, 2) +starterProc = TestUtil.startServer(router, args, count=2, config=routerConfig) print "ok" -starterThread = TestUtil.ReaderThread(starterPipe); -starterThread.start() - -name = os.path.join("Glacier2", "router") -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + os.pathsep + os.getenv("CLASSPATH", "") - -TestUtil.mixedClientServerTest(name) - -# -# We run the test again, to check whether the glacier router can -# handle multiple clients. Also, when we run for the second time, we -# want the client to shutdown the router after running the tests. -# -TestUtil.mixedClientServerTestWithOptions(name, "", " --shutdown") +TestUtil.clientServerTest() -starterThread.join() -if starterThread.getStatus(): - sys.exit(1) +TestUtil.clientServerTest(additionalClientOptions=" --shutdown") -sys.exit(0) +starterProc.waitTestSuccess() diff --git a/java/test/Ice/adapterDeactivation/run.py b/java/test/Ice/adapterDeactivation/run.py index 2846cef184e..dcb8454ad37 100755 --- a/java/test/Ice/adapterDeactivation/run.py +++ b/java/test/Ice/adapterDeactivation/run.py @@ -10,26 +10,15 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" +sys.path.append(os.path.join(path[0])) +from scripts import * -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "adapterDeactivation") -testdir = os.path.dirname(os.path.abspath(__file__)) -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + os.pathsep + os.getenv("CLASSPATH", "") - -# -# We need to use mixedClientServerTest so that, when using SSL, the -# server-side SSL configuration properties are defined. This is -# necessary because the client creates object adapters. -# -TestUtil.mixedClientServerTest(name) -TestUtil.collocatedTest(name) -sys.exit(0) +TestUtil.clientServerTest() +TestUtil.collocatedTest() diff --git a/java/test/Ice/background/run.py b/java/test/Ice/background/run.py index bc7d8cec1a6..2a3d5ec3417 100755 --- a/java/test/Ice/background/run.py +++ b/java/test/Ice/background/run.py @@ -10,21 +10,14 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" +sys.path.append(os.path.join(path[0])) +from scripts import * -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "background") -testdir = os.path.dirname(os.path.abspath(__file__)) - -classpath = os.getenv("CLASSPATH", "") -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + os.pathsep + classpath -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/java/test/Ice/binding/run.py b/java/test/Ice/binding/run.py index a6692f5fb4f..2a3d5ec3417 100755 --- a/java/test/Ice/binding/run.py +++ b/java/test/Ice/binding/run.py @@ -10,20 +10,14 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" +sys.path.append(os.path.join(path[0])) +from scripts import * -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "binding") -testdir = os.path.dirname(os.path.abspath(__file__)) -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + os.pathsep + os.getenv("CLASSPATH", "") - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/java/test/Ice/checksum/client/AllTests.java b/java/test/Ice/checksum/AllTests.java index a3eba83c210..a3eba83c210 100644 --- a/java/test/Ice/checksum/client/AllTests.java +++ b/java/test/Ice/checksum/AllTests.java diff --git a/java/test/Ice/checksum/client/Client.java b/java/test/Ice/checksum/Client.java index b3a0bf1d99d..b3a0bf1d99d 100644 --- a/java/test/Ice/checksum/client/Client.java +++ b/java/test/Ice/checksum/Client.java diff --git a/java/test/Ice/checksum/client/Test.ice b/java/test/Ice/checksum/Test.ice index 24e8f7c957b..24e8f7c957b 100644 --- a/java/test/Ice/checksum/client/Test.ice +++ b/java/test/Ice/checksum/Test.ice diff --git a/java/test/Ice/checksum/client/Types.ice b/java/test/Ice/checksum/Types.ice index ea5e644a755..ea5e644a755 100644 --- a/java/test/Ice/checksum/client/Types.ice +++ b/java/test/Ice/checksum/Types.ice diff --git a/java/test/Ice/checksum/build.xml b/java/test/Ice/checksum/build.xml index ea17875ab09..634c57e3216 100644 --- a/java/test/Ice/checksum/build.xml +++ b/java/test/Ice/checksum/build.xml @@ -11,14 +11,44 @@ <project name="test_Ice_checksum" default="all" basedir="."> - <target name="all"> - <ant dir="client"/> - <ant dir="server"/> + <!-- set global properties for this build --> + <property name="top.dir" value="../../.."/> + + <!-- import common definitions --> + <import file="${top.dir}/config/common.xml"/> + + <target name="generate" depends="init"> + <!-- Create the output directory for generated code --> + <mkdir dir="${generated.dir}"/> + <slice2java outputdir="${generated.dir}" checksum="SliceChecksums"> + <meta value="${java2metadata}"/> + <fileset dir="." includes="Test.ice Types.ice"/> + <includepath> + <pathelement path="${slice.dir}" /> + </includepath> + </slice2java> + </target> + + <target name="compile" depends="generate"> + <mkdir dir="${class.dir}"/> + <javac srcdir="${generated.dir}" destdir="${class.dir}" classpathref="ice.classpath" + debug="${debug}"> + <compilerarg value="${javac.lint}"/> + </javac> + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**,server/**" + debug="${debug}"> + <compilerarg value="${javac.lint}"/> + </javac> + </target> + + <target name="all" depends="compile"> + <ant dir="server" inheritAll="false"/> </target> <target name="clean"> - <ant dir="client" target="clean"/> - <ant dir="server" target="clean"/> + <delete dir="${generated.dir}"/> + <delete dir="${class.dir}"/> + <ant dir="server" target="clean" inheritAll="false"/> </target> </project> diff --git a/java/test/Ice/checksum/client/build.xml b/java/test/Ice/checksum/client/build.xml deleted file mode 100644 index b7364c8cc52..00000000000 --- a/java/test/Ice/checksum/client/build.xml +++ /dev/null @@ -1,51 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2008 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. - - ********************************************************************** ---> - -<project name="test_Ice_checksum_client" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}" checksum="SliceChecksums"> - <meta value="${java2metadata}"/> - <fileset dir="." includes="Test.ice Types.ice"/> - <includepath> - <pathelement path="${slice.dir}" /> - </includepath> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" classpathref="ice.classpath" - debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" - debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/checksum/run.py b/java/test/Ice/checksum/run.py index b3506b44cfa..3f14ac0472d 100755 --- a/java/test/Ice/checksum/run.py +++ b/java/test/Ice/checksum/run.py @@ -10,22 +10,18 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" +sys.path.append(os.path.join(path[0])) +from scripts import * -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() +import copy +serverenv = copy.deepcopy(os.environ) +TestUtil.addClasspath(os.path.join(os.getcwd(), "server", "classes"), serverenv) -name = os.path.join("Ice", "checksum") -testdir = os.path.dirname(os.path.abspath(__file__)) - -TestUtil.clientServerTestWithClasspath(name, - os.path.join(testdir, "server", "classes"), - os.path.join(testdir, "client", "classes")) - -sys.exit(0) +TestUtil.clientServerTest(serverenv = serverenv) diff --git a/java/test/Ice/custom/run.py b/java/test/Ice/custom/run.py index 6f12a4ff810..dcb8454ad37 100755 --- a/java/test/Ice/custom/run.py +++ b/java/test/Ice/custom/run.py @@ -10,21 +10,15 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" +sys.path.append(os.path.join(path[0])) +from scripts import * -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "custom") -testdir = os.path.dirname(os.path.abspath(__file__)) -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + os.pathsep + os.getenv("CLASSPATH", "") - -TestUtil.clientServerTest(name) -TestUtil.collocatedTest(name) -sys.exit(0) +TestUtil.clientServerTest() +TestUtil.collocatedTest() diff --git a/java/test/Ice/exceptions/run.py b/java/test/Ice/exceptions/run.py index e346442d91f..50e2f7879a3 100755 --- a/java/test/Ice/exceptions/run.py +++ b/java/test/Ice/exceptions/run.py @@ -10,32 +10,24 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" - -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "exceptions") -testdir = os.path.dirname(os.path.abspath(__file__)) -nameAMD = os.path.join("Ice", "exceptionsAMD") -testdirAMD = testdir + "AMD" +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -classpath = os.getenv("CLASSPATH", "") -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + os.pathsep + classpath -TestUtil.clientServerTest(name) +TestUtil.clientServerTest() print "tests with AMD server." -TestUtil.clientServerTestWithClasspath(name,\ - os.path.join(testdirAMD, "classes") + os.pathsep + classpath, \ - os.path.join(testdir, "classes") + os.pathsep + classpath) +import copy +amdenv = copy.deepcopy(os.environ) +TestUtil.addClasspath(os.path.join(os.getcwd(), "..", "exceptionsAMD", "classes"), amdenv) +TestUtil.clientServerTest(serverenv = amdenv) print "tests with collocated server." -TestUtil.collocatedTest(name) -sys.exit(0) +TestUtil.collocatedTest() diff --git a/java/test/Ice/facets/run.py b/java/test/Ice/facets/run.py index 2e620209daf..dcb8454ad37 100755 --- a/java/test/Ice/facets/run.py +++ b/java/test/Ice/facets/run.py @@ -10,21 +10,15 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" +sys.path.append(os.path.join(path[0])) +from scripts import * -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "facets") -testdir = os.path.dirname(os.path.abspath(__file__)) -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + os.pathsep + os.getenv("CLASSPATH", "") - -TestUtil.clientServerTest(name) -TestUtil.collocatedTest(name) -sys.exit(0) +TestUtil.clientServerTest() +TestUtil.collocatedTest() diff --git a/java/test/Ice/faultTolerance/run.py b/java/test/Ice/faultTolerance/run.py index dc00f62f71e..1d0d6dfac02 100755 --- a/java/test/Ice/faultTolerance/run.py +++ b/java/test/Ice/faultTolerance/run.py @@ -10,42 +10,34 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" +sys.path.append(os.path.join(path[0])) +from scripts import * -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "faultTolerance") -testdir = os.path.dirname(os.path.abspath(__file__)) -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + os.pathsep + os.getenv("CLASSPATH", "") +TestUtil.addClasspath(os.path.join(os.getcwd(), "classes")) num = 12 base = 12340 +serverProc = [] for i in range(0, num): print "starting server #%d..." % (i + 1), - serverPipe = TestUtil.startServer("Server", " %d" % (base + i) + " 2>&1") - TestUtil.getAdapterReady(serverPipe) + serverProc.append(TestUtil.startServer("Server", " %d" % (base + i))) print "ok" ports = "" for i in range(0, num): ports = "%s %d" % (ports, base + i) print "starting client...", -clientPipe = TestUtil.startClient("Client", ports + " 2>&1") +clientProc = TestUtil.startClient("Client", ports) print "ok" -TestUtil.printOutputFromPipe(clientPipe) - -clientStatus = TestUtil.closePipe(clientPipe) - -if clientStatus or TestUtil.serverStatus(): - sys.exit(1) - -sys.exit(0) +clientProc.waitTestSuccess() +for p in serverProc: + p.waitTestSuccess() diff --git a/java/test/Ice/hold/run.py b/java/test/Ice/hold/run.py index 3aad16bf8fe..2a3d5ec3417 100755 --- a/java/test/Ice/hold/run.py +++ b/java/test/Ice/hold/run.py @@ -10,20 +10,14 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" +sys.path.append(os.path.join(path[0])) +from scripts import * -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "hold") -testdir = os.path.dirname(os.path.abspath(__file__)) -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + os.pathsep + os.getenv("CLASSPATH", "") - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/java/test/Ice/inheritance/run.py b/java/test/Ice/inheritance/run.py index 9ec103a4045..dcb8454ad37 100755 --- a/java/test/Ice/inheritance/run.py +++ b/java/test/Ice/inheritance/run.py @@ -10,21 +10,15 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" +sys.path.append(os.path.join(path[0])) +from scripts import * -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "inheritance") -testdir = os.path.dirname(os.path.abspath(__file__)) -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + os.pathsep + os.getenv("CLASSPATH", "") - -TestUtil.clientServerTest(name) -TestUtil.collocatedTest(name) -sys.exit(0) +TestUtil.clientServerTest() +TestUtil.collocatedTest() diff --git a/java/test/Ice/interceptor/run.py b/java/test/Ice/interceptor/run.py index 432b50875e2..6737820836f 100755 --- a/java/test/Ice/interceptor/run.py +++ b/java/test/Ice/interceptor/run.py @@ -10,30 +10,20 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" +sys.path.append(os.path.join(path[0])) +from scripts import * -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "interceptor") -testdir = os.path.dirname(os.path.abspath(__file__)) -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + os.pathsep + os.getenv("CLASSPATH", "") +TestUtil.addClasspath(os.path.join(os.getcwd(), "classes")) print "starting client...", -clientPipe = TestUtil.startClient("Client", "--Ice.Warn.Dispatch=0") +clientProc = TestUtil.startClient("Client", "--Ice.Warn.Dispatch=0") print "ok" -TestUtil.printOutputFromPipe(clientPipe) - -clientStatus = TestUtil.closePipe(clientPipe) - -if clientStatus: - sys.exit(1) - -sys.exit(0) +clientProc.waitTestSuccess() diff --git a/java/test/Ice/location/run.py b/java/test/Ice/location/run.py index b2271b88770..2a3d5ec3417 100755 --- a/java/test/Ice/location/run.py +++ b/java/test/Ice/location/run.py @@ -10,20 +10,14 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" +sys.path.append(os.path.join(path[0])) +from scripts import * -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "location") -testdir = os.path.dirname(os.path.abspath(__file__)) -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + os.pathsep + os.getenv("CLASSPATH", "") - -TestUtil.mixedClientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/java/test/Ice/objects/run.py b/java/test/Ice/objects/run.py index ec17ac79ecf..dcb8454ad37 100755 --- a/java/test/Ice/objects/run.py +++ b/java/test/Ice/objects/run.py @@ -10,21 +10,15 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" +sys.path.append(os.path.join(path[0])) +from scripts import * -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "objects") -testdir = os.path.dirname(os.path.abspath(__file__)) -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + os.pathsep + os.getenv("CLASSPATH", "") - -TestUtil.clientServerTest(name) -TestUtil.collocatedTest(name) -sys.exit(0) +TestUtil.clientServerTest() +TestUtil.collocatedTest() diff --git a/java/test/Ice/operations/run.py b/java/test/Ice/operations/run.py index 84cccf81362..26ccab807dc 100755 --- a/java/test/Ice/operations/run.py +++ b/java/test/Ice/operations/run.py @@ -10,33 +10,24 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" - -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "operations") -testdir = os.path.dirname(os.path.abspath(__file__)) -nameAMD = os.path.join("Ice", "operationsAMD") -testdirAMD = testdir + "AMD" +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -classpath = os.getenv("CLASSPATH", "") -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + os.pathsep + classpath -TestUtil.clientServerTest(name) +TestUtil.clientServerTest() print "tests with AMD server." -TestUtil.clientServerTestWithClasspath(name, \ - os.path.join(testdirAMD, "classes") + os.pathsep + classpath,\ - os.path.join(testdir, "classes") + os.pathsep + classpath) +import copy +amdenv = copy.deepcopy(os.environ) +TestUtil.addClasspath(os.path.join(os.getcwd(), "..", "operationsAMD", "classes"), amdenv) +TestUtil.clientServerTest(serverenv = amdenv) print "tests with collocated server." -TestUtil.collocatedTest(name) - -sys.exit(0) +TestUtil.collocatedTest() diff --git a/java/test/Ice/package/run.py b/java/test/Ice/package/run.py index f72ab158050..2a3d5ec3417 100755 --- a/java/test/Ice/package/run.py +++ b/java/test/Ice/package/run.py @@ -10,20 +10,14 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" +sys.path.append(os.path.join(path[0])) +from scripts import * -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "package") -testdir = os.path.dirname(os.path.abspath(__file__)) -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + os.pathsep + os.getenv("CLASSPATH", "") - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/java/test/Ice/proxy/run.py b/java/test/Ice/proxy/run.py index 26c6aba7ca0..e28c83a5f39 100755 --- a/java/test/Ice/proxy/run.py +++ b/java/test/Ice/proxy/run.py @@ -10,33 +10,24 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" - -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "proxy") -testdir = os.path.dirname(os.path.abspath(__file__)) -nameAMD = os.path.join("Ice", "proxyAMD") -testdirAMD = testdir + "AMD" +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -classpath = os.getenv("CLASSPATH", "") -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + os.pathsep + classpath -TestUtil.clientServerTest(name) +TestUtil.clientServerTest() print "tests with AMD server." -TestUtil.clientServerTestWithClasspath(name,\ - os.path.join(testdirAMD, "classes") + os.pathsep + classpath,\ - os.path.join(testdir, "classes") + os.pathsep + classpath) +import copy +amdenv = copy.deepcopy(os.environ) +TestUtil.addClasspath(os.path.join(os.getcwd(), "..", "proxyAMD", "classes"), amdenv) +TestUtil.clientServerTest(serverenv = amdenv) print "tests with collocated server." -TestUtil.collocatedTest(name) - -sys.exit(0) +TestUtil.collocatedTest() diff --git a/java/test/Ice/retry/run.py b/java/test/Ice/retry/run.py index 245f4dd2f87..2a3d5ec3417 100755 --- a/java/test/Ice/retry/run.py +++ b/java/test/Ice/retry/run.py @@ -10,21 +10,14 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" +sys.path.append(os.path.join(path[0])) +from scripts import * -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "retry") -testdir = os.path.dirname(os.path.abspath(__file__)) - -classpath = os.getenv("CLASSPATH", "") -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + os.pathsep + classpath -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/java/test/Ice/servantLocator/run.py b/java/test/Ice/servantLocator/run.py index a337928b7e3..693b0efe6fd 100755 --- a/java/test/Ice/servantLocator/run.py +++ b/java/test/Ice/servantLocator/run.py @@ -10,38 +10,24 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" +sys.path.append(os.path.join(path[0])) +from scripts import * -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "servantLocator") -nameAMD = os.path.join("Ice", "servantLocatorAMD") -testdir = os.path.dirname(os.path.abspath(__file__)) -testdirAMD = testdir + "AMD" -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + os.pathsep + os.getenv("CLASSPATH", "") - -# -# We need to use mixedClientServerTest so that, when using SSL, the -# server-side SSL configuration properties are defined. This is -# necessary because the client creates object adapters. -# print "tests with regular server." -classpath = os.getenv("CLASSPATH", "") -TestUtil.mixedClientServerTest(name) +TestUtil.clientServerTest() print "tests with AMD server." -TestUtil.clientServerTestWithClasspath(name, \ - os.path.join(testdirAMD, "classes") + os.pathsep + classpath,\ - os.path.join(testdir, "classes") + os.pathsep + classpath) +import copy +amdenv = copy.deepcopy(os.environ) +TestUtil.addClasspath(os.path.join(os.getcwd(), "..", "servantLocatorAMD", "classes"), amdenv) +TestUtil.clientServerTest(serverenv = amdenv) print "tests with collocated server." -TestUtil.collocatedTest(name) - -sys.exit(0) +TestUtil.collocatedTest() diff --git a/java/test/Ice/slicing/exceptions/build.xml b/java/test/Ice/slicing/exceptions/build.xml index 94bcd591be3..dd42b096db0 100644 --- a/java/test/Ice/slicing/exceptions/build.xml +++ b/java/test/Ice/slicing/exceptions/build.xml @@ -17,9 +17,9 @@ <!-- import common definitions --> <import file="${top.dir}/config/common.xml"/> - <property name="cclass.dir" value="cclasses"/> + <property name="cclass.dir" value="classes"/> <property name="sclass.dir" value="sclasses"/> - <property name="cgen.dir" value="cgenerated"/> + <property name="cgen.dir" value="generated"/> <property name="sgen.dir" value="sgenerated"/> <property name="csrc.dir" value="csrc"/> <property name="ssrc.dir" value="ssrc"/> diff --git a/java/test/Ice/slicing/exceptions/run.py b/java/test/Ice/slicing/exceptions/run.py index 237610d7a45..2e73cdacd63 100755 --- a/java/test/Ice/slicing/exceptions/run.py +++ b/java/test/Ice/slicing/exceptions/run.py @@ -10,26 +10,24 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" - -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "slicing", "exceptions") -testdir = os.path.dirname(os.path.abspath(__file__)) -nameAMD = os.path.join("Ice", "slicing", "exceptionsAMD") -testdirAMD = testdir + "AMD" +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -TestUtil.clientServerTestWithClasspath(name, os.path.join(testdir, "sclasses"), os.path.join(testdir, "cclasses")) +import copy +serverenv = copy.deepcopy(os.environ) +TestUtil.addClasspath(os.path.join(os.getcwd(), "sclasses"), serverenv) +TestUtil.clientServerTest(serverenv = serverenv) print "tests with AMD server." -TestUtil.clientServerTestWithClasspath(name, os.path.join(testdirAMD, "classes"), os.path.join(testdir, "cclasses")) - -sys.exit(0) +import copy +amdenv = copy.deepcopy(os.environ) +TestUtil.addClasspath(os.path.join(os.getcwd(), "..", "exceptionsAMD", "classes"), amdenv) +TestUtil.clientServerTest(serverenv = amdenv) diff --git a/java/test/Ice/slicing/objects/build.xml b/java/test/Ice/slicing/objects/build.xml index 4a0ae963e61..c134d0ea470 100644 --- a/java/test/Ice/slicing/objects/build.xml +++ b/java/test/Ice/slicing/objects/build.xml @@ -17,9 +17,9 @@ <!-- import common definitions --> <import file="${top.dir}/config/common.xml"/> - <property name="cclass.dir" value="cclasses"/> + <property name="cclass.dir" value="classes"/> <property name="sclass.dir" value="sclasses"/> - <property name="cgen.dir" value="cgenerated"/> + <property name="cgen.dir" value="generated"/> <property name="sgen.dir" value="sgenerated"/> <property name="csrc.dir" value="csrc"/> <property name="ssrc.dir" value="ssrc"/> diff --git a/java/test/Ice/slicing/objects/csrc/AllTests.java b/java/test/Ice/slicing/objects/csrc/AllTests.java index aae82d50ccf..9ec8abc335d 100644 --- a/java/test/Ice/slicing/objects/csrc/AllTests.java +++ b/java/test/Ice/slicing/objects/csrc/AllTests.java @@ -1471,8 +1471,8 @@ public class AllTests System.out.print("return value identity for input params known first... "); System.out.flush(); { - try - { + //try + //{ D1 d1 = new D1(); d1.sb = "D1.sb"; d1.sd1 = "D1.sd1"; @@ -1512,11 +1512,11 @@ public class AllTests test(b1 != d3); test(b2 != d1); test(b2 != d3); - } - catch(Exception ex) - { - test(false); - } + //} + //catch(Exception ex) + //{ + //test(false); + //} } System.out.println("ok"); diff --git a/java/test/Ice/slicing/objects/run.py b/java/test/Ice/slicing/objects/run.py index 5b834e189ff..17ea0ad7b25 100755 --- a/java/test/Ice/slicing/objects/run.py +++ b/java/test/Ice/slicing/objects/run.py @@ -10,26 +10,27 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" +sys.path.append(os.path.join(path[0])) +from scripts import * -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "slicing", "objects") -testdir = os.path.dirname(os.path.abspath(__file__)) -nameAMD = os.path.join("Ice", "slicing", "objectsAMD") -testdirAMD = testdir + "AMD" +testdir = os.getcwd() +testdirAMD = os.path.join(testdir, "..", "objectsAMD", "classes") print "tests with regular server." -TestUtil.clientServerTestWithClasspath(name, os.path.join(testdir, "sclasses"), os.path.join(testdir, "cclasses")) +import copy +serverenv = copy.deepcopy(os.environ) +TestUtil.addClasspath(os.path.join(os.getcwd(), "sclasses"), serverenv) +TestUtil.clientServerTest(serverenv = serverenv) print "tests with AMD server." -TestUtil.clientServerTestWithClasspath(name, os.path.join(testdirAMD, "classes"), os.path.join(testdir, "cclasses")) - -sys.exit(0) +import copy +amdenv = copy.deepcopy(os.environ) +TestUtil.addClasspath(os.path.join(os.getcwd(), "..", "objectsAMD", "classes"), amdenv) +TestUtil.clientServerTest(serverenv = amdenv) diff --git a/java/test/Ice/stream/run.py b/java/test/Ice/stream/run.py index 09be18dd69f..d508e8c0c8c 100755 --- a/java/test/Ice/stream/run.py +++ b/java/test/Ice/stream/run.py @@ -10,31 +10,20 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" +sys.path.append(os.path.join(path[0])) +from scripts import * -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "stream") -testdir = os.path.dirname(os.path.abspath(__file__)) -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + os.pathsep + os.getenv("CLASSPATH", "") +TestUtil.addClasspath(os.path.join(os.getcwd(), "classes")) print "starting test...", -clientPipe = TestUtil.startClient("Client"," 2>&1") +clientProc = TestUtil.startClient("Client") print "ok" -TestUtil.printOutputFromPipe(clientPipe) - -clientStatus = TestUtil.closePipe(clientPipe) - -if clientStatus: - TestUtil.killServers() - sys.exit(1) - -sys.exit(0) +clientProc.waitTestSuccess() diff --git a/java/test/Ice/timeout/run.py b/java/test/Ice/timeout/run.py index 57729b5145a..2a3d5ec3417 100755 --- a/java/test/Ice/timeout/run.py +++ b/java/test/Ice/timeout/run.py @@ -10,21 +10,14 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" +sys.path.append(os.path.join(path[0])) +from scripts import * -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "timeout") -testdir = os.path.dirname(os.path.abspath(__file__)) - -classpath = os.getenv("CLASSPATH", "") -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + os.pathsep + classpath -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/java/test/IceBox/configuration/run.py b/java/test/IceBox/configuration/run.py index 5b921e2ba2b..7b8f169b98e 100755 --- a/java/test/IceBox/configuration/run.py +++ b/java/test/IceBox/configuration/run.py @@ -10,30 +10,17 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" +sys.path.append(os.path.join(path[0])) +from scripts import * -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() -import IceGridAdmin - -name = os.path.join("IceBox", "configuration") -testdir = os.path.dirname(os.path.abspath(__file__)) -icebox = TestUtil.getIceBox(testdir); - -cwd = os.getcwd() -os.chdir(testdir) - -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + os.pathsep + os.getenv("CLASSPATH", "") - -TestUtil.clientServerTestWithOptionsAndNames(name, "--Ice.Config=config.icebox", "", icebox, "Client") -TestUtil.clientServerTestWithOptionsAndNames(name, "--Ice.Config=config.icebox2", "", icebox, "Client") - -os.chdir(cwd) - -sys.exit(0) +TestUtil.clientServerTest(additionalServerOptions="--Ice.Config=%s" % os.path.join(os.getcwd(), "config.icebox"), + server=TestUtil.getIceBox()) +TestUtil.clientServerTest(additionalServerOptions="--Ice.Config=%s" % os.path.join(os.getcwd(), "config.icebox2"), + server=TestUtil.getIceBox()) diff --git a/java/test/IceGrid/simple/run.py b/java/test/IceGrid/simple/run.py index 38b267460bc..0da9b34fbb8 100755 --- a/java/test/IceGrid/simple/run.py +++ b/java/test/IceGrid/simple/run.py @@ -10,31 +10,22 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" - -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() -import IceGridAdmin - -testdir = os.path.dirname(os.path.abspath(__file__)) - -name = os.path.join("IceGrid", "simple") -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + os.pathsep + os.getenv("CLASSPATH", "") +sys.path.append(os.path.join(path[0])) +from scripts import * # # Test client/server without on demand activation. # -IceGridAdmin.iceGridClientServerTest(testdir, name, "", "--TestAdapter.Endpoints=default" + \ - " --TestAdapter.AdapterId=TestAdapter") +IceGridAdmin.iceGridClientServerTest("", "--TestAdapter.Endpoints=default --TestAdapter.AdapterId=TestAdapter") # # Test client/server with on demand activation. # -IceGridAdmin.iceGridTest(testdir, name, "simple_server.xml", "--with-deploy") -sys.exit(0) +IceGridAdmin.iceGridTest("simple_server.xml", "--with-deploy") diff --git a/java/test/IceSSL/certs/makecerts.py b/java/test/IceSSL/certs/makecerts.py index d1c474ca07f..33037439925 100755 --- a/java/test/IceSSL/certs/makecerts.py +++ b/java/test/IceSSL/certs/makecerts.py @@ -18,7 +18,7 @@ else: raise "can't find toplevel directory!" sys.path.append(os.path.join(toplevel, "config")) -import TestUtil +from scripts import * # # Show usage information. diff --git a/java/test/IceSSL/configuration/run.py b/java/test/IceSSL/configuration/run.py index 0c45d6d34d8..50834a30234 100755 --- a/java/test/IceSSL/configuration/run.py +++ b/java/test/IceSSL/configuration/run.py @@ -10,21 +10,16 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" +sys.path.append(os.path.join(path[0])) +from scripts import * -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() +testdir = os.getcwd() -name = os.path.join("IceSSL", "configuration") -testdir = os.path.dirname(os.path.abspath(__file__)) - -classpath = os.getenv("CLASSPATH", "") -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + os.pathsep + classpath -TestUtil.clientServerTestWithOptions(name, "", " " + testdir) -sys.exit(0) +TestUtil.clientServerTest(additionalClientOptions=testdir) diff --git a/java/test/IceUtil/inputUtil/run.py b/java/test/IceUtil/inputUtil/run.py index 6e33ce61269..40087477f07 100755 --- a/java/test/IceUtil/inputUtil/run.py +++ b/java/test/IceUtil/inputUtil/run.py @@ -10,30 +10,19 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" +sys.path.append(os.path.join(path[0])) +from scripts import * -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("IceUtil", "inputUtil") -testdir = os.path.dirname(os.path.abspath(__file__)) -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + os.pathsep + os.getenv("CLASSPATH", "") +TestUtil.addClasspath(os.path.join(os.getcwd(), "classes")) print "starting client...", -clientPipe = TestUtil.startClient("Client", " 2>&1") +clientProc = TestUtil.startClient("Client") print "ok" - -TestUtil.printOutputFromPipe(clientPipe) - -clientStatus = TestUtil.closePipe(clientPipe) - -if clientStatus: - sys.exit(1) - -sys.exit(0) +clientProc.waitTestSuccess() diff --git a/java/test/Slice/keyword/run.py b/java/test/Slice/keyword/run.py index 95c29eed3c1..40087477f07 100755 --- a/java/test/Slice/keyword/run.py +++ b/java/test/Slice/keyword/run.py @@ -10,30 +10,19 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" +sys.path.append(os.path.join(path[0])) +from scripts import * -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Slice", "keyword") -testdir = os.path.dirname(os.path.abspath(__file__)) -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + os.pathsep + os.getenv("CLASSPATH", "") +TestUtil.addClasspath(os.path.join(os.getcwd(), "classes")) print "starting client...", -clientPipe = os.popen("java -ea Client 2>&1") +clientProc = TestUtil.startClient("Client") print "ok" - -TestUtil.printOutputFromPipe(clientPipe) - -clientStatus = TestUtil.closePipe(clientPipe) - -if clientStatus: - sys.exit(1) - -sys.exit(0) +clientProc.waitTestSuccess() |