diff options
author | Matthew Newhook <matthew@zeroc.com> | 2008-08-04 19:18:45 -0230 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2008-08-04 19:18:45 -0230 |
commit | d9c568300c2aed6ab736026ea116b3f1a72fbe43 (patch) | |
tree | 27191ba2b0d1ef43256561da01462b98c7bd696d | |
parent | Merge branch 'R3_3_branch' of ssh://cvs.zeroc.com/home/git/ice into R3_3_branch (diff) | |
download | ice-d9c568300c2aed6ab736026ea116b3f1a72fbe43.tar.bz2 ice-d9c568300c2aed6ab736026ea116b3f1a72fbe43.tar.xz ice-d9c568300c2aed6ab736026ea116b3f1a72fbe43.zip |
Numerous cleanups to the test suite and expect scripts.
Conflicts:
cpp/test/Glacier2/staticFiltering/run.py
273 files changed, 2911 insertions, 5446 deletions
diff --git a/allTests.py b/allTests.py index 7cdc8cc6de3..86fa290a7a1 100755 --- a/allTests.py +++ b/allTests.py @@ -10,8 +10,8 @@ import os, sys, imp -sys.path.append(os.path.join(os.path.dirname(__file__), "config")) -import TestUtil +sys.path.append(os.path.join(os.path.dirname(__file__))) +from scripts import * testGroups = [] diff --git a/cpp/allDemos.py b/cpp/allDemos.py index 0fe6c8f2991..8f75138d691 100755 --- a/cpp/allDemos.py +++ b/cpp/allDemos.py @@ -17,8 +17,8 @@ for toplevel in [".", "..", "../..", "../../..", "../../../.."]: else: raise "can't find toplevel directory!" -sys.path.append(os.path.join(toplevel, "demoscript")) -import Util +sys.path.append(os.path.join(toplevel)) +from demoscript import Util # # List of all basic demos. diff --git a/cpp/allTests.py b/cpp/allTests.py index 55eb3da068f..0fbfff424f2 100755 --- a/cpp/allTests.py +++ b/cpp/allTests.py @@ -12,13 +12,13 @@ import os, sys, re, getopt for toplevel in [".", "..", "../..", "../../..", "../../../.."]: toplevel = os.path.abspath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): + if os.path.exists(os.path.join(toplevel, "scripts", "TestUtil.py")): break else: raise "can't find toplevel directory!" -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil +sys.path.append(os.path.join(toplevel)) +from scripts import * # # List of all basic tests. diff --git a/cpp/demo/IceBox/hello/expect.py b/cpp/demo/IceBox/hello/expect.py index 061669fb69b..c659b7f87af 100755 --- a/cpp/demo/IceBox/hello/expect.py +++ b/cpp/demo/IceBox/hello/expect.py @@ -28,8 +28,7 @@ if Util.defaultHost: else: args = '' -directory = os.path.dirname(os.path.abspath(__file__)) -Util.addLdPath(directory) +Util.addLdPath(os.getcwd()) server = Util.spawn('%s --Ice.Config=config.icebox --Ice.PrintAdapterReady %s' % (Util.getIceBox(), args)) server.expect('.* ready') diff --git a/cpp/demo/IceGrid/icebox/expect.py b/cpp/demo/IceGrid/icebox/expect.py index 9cfbc351353..e8d1cbbd055 100755 --- a/cpp/demo/IceGrid/icebox/expect.py +++ b/cpp/demo/IceGrid/icebox/expect.py @@ -23,7 +23,7 @@ from demoscript import * from demoscript.IceGrid import icebox desc = 'application.xml' -if Util.getBuild() == 'debug': +if Util.isDebugBuild(): fi = open(desc, "r") desc = 'tmp_application.xml' fo = open(desc, "w") @@ -34,7 +34,6 @@ if Util.getBuild() == 'debug': fi.close() fo.close() -directory = os.path.dirname(os.path.abspath(__file__)) -Util.addLdPath(directory) +Util.addLdPath(os.getcwd()) icebox.run('./client', desc[0:len(desc)-4]) diff --git a/cpp/demo/IceStorm/replicated/expect.py b/cpp/demo/IceStorm/replicated/expect.py index 91646d035ef..70768e4259b 100755 --- a/cpp/demo/IceStorm/replicated/expect.py +++ b/cpp/demo/IceStorm/replicated/expect.py @@ -23,7 +23,7 @@ from demoscript import * import time, signal desc = 'application.xml' -if Util.getBuild() == 'debug': +if Util.isDebugBuild(): fi = open(desc, "r") desc = 'tmp_application.xml' fo = open(desc, "w") diff --git a/cpp/test/Freeze/complex/run.py b/cpp/test/Freeze/complex/run.py index 19395e6cc75..f2ec576ad27 100755 --- a/cpp/test/Freeze/complex/run.py +++ b/cpp/test/Freeze/complex/run.py @@ -8,49 +8,34 @@ # # ********************************************************************** -import os, sys, os.path - -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +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 "can't find toplevel directory!" - -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() +sys.path.append(os.path.join(path[0])) +from scripts import * testdir = os.path.dirname(os.path.abspath(__file__)) # # Clean the contents of the database directory. # -dbdir = os.path.join(testdir, "db") +dbdir = os.path.join(os.getcwd(), "db") TestUtil.cleanDbDir(dbdir) -client = os.path.join(testdir, "client") +client = os.path.join(os.getcwd(), "client") 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") +clientProc = TestUtil.startClient(client, " --dbdir %s validate" % os.getcwd()) print "ok" - -TestUtil.printOutputFromPipe(clientPipe) - -clientStatus = TestUtil.closePipe(clientPipe) - -if clientStatus: - sys.exit(1) - -sys.exit(0) +clientProc.waitTestSuccess() diff --git a/cpp/test/Freeze/dbmap/run.py b/cpp/test/Freeze/dbmap/run.py index 294171da26c..bdce0c97426 100755 --- a/cpp/test/Freeze/dbmap/run.py +++ b/cpp/test/Freeze/dbmap/run.py @@ -10,34 +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() - -testdir = os.path.dirname(os.path.abspath(__file__)) - -dbdir = os.path.join(testdir, "db") +dbdir = os.path.join(os.getcwd(), "db") TestUtil.cleanDbDir(dbdir) -client = os.path.join(testdir, "client") - -print "starting client...", -clientPipe = os.popen(TestUtil.getCommandLine(client, TestUtil.DriverConfig("client")) + " --Freeze.Warn.Rollback=0 " + - testdir + " 2>&1") -print "ok" - -TestUtil.printOutputFromPipe(clientPipe) - -clientStatus = TestUtil.closePipe(clientPipe) - -if clientStatus: - sys.exit(1) +client = os.path.join(os.getcwd(), "client") -sys.exit(0) +clientProc = TestUtil.startClient(client, " --Freeze.Warn.Rollback=0 %s" % os.getcwd()) +clientProc.waitTestSuccess() diff --git a/cpp/test/Freeze/evictor/run.py b/cpp/test/Freeze/evictor/run.py index 9f1f6bf50f4..f7b7751571a 100755 --- a/cpp/test/Freeze/evictor/run.py +++ b/cpp/test/Freeze/evictor/run.py @@ -10,24 +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__)) - -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(name, testOptions, testOptions) -sys.exit(0) +TestUtil.clientServerTest(additionalServerOptions= testOptions, additionalClientOptions= testOptions) diff --git a/cpp/test/Freeze/oldevictor/run.py b/cpp/test/Freeze/oldevictor/run.py index 64ef39f758a..3a95465793d 100755 --- a/cpp/test/Freeze/oldevictor/run.py +++ b/cpp/test/Freeze/oldevictor/run.py @@ -10,24 +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__)) - -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(name, testOptions, testOptions) -sys.exit(0) +TestUtil.clientServerTest(additionalServerOptions = testOptions, additionalClientOptions = testOptions) diff --git a/cpp/test/FreezeScript/dbmap/run.py b/cpp/test/FreezeScript/dbmap/run.py index ff66087b358..8e4fd9462c8 100755 --- a/cpp/test/FreezeScript/dbmap/run.py +++ b/cpp/test/FreezeScript/dbmap/run.py @@ -10,41 +10,39 @@ import os, sys, re, shutil -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() - -directory = os.path.dirname(os.path.abspath(__file__)) transformdb = os.path.join(TestUtil.getCppBinDir(), "transformdb") -dbdir = os.path.join(directory, "db") +dbdir = os.path.join(os.getcwd(), "db") TestUtil.cleanDbDir(dbdir) -init_dbdir = os.path.join(directory, "db_init") +init_dbdir = os.path.join(os.getcwd(), "db_init") if os.path.exists(init_dbdir): shutil.rmtree(init_dbdir) os.mkdir(init_dbdir) -check_dbdir = os.path.join(directory, "db_check") +check_dbdir = os.path.join(os.getcwd(), "db_check") if os.path.exists(check_dbdir): shutil.rmtree(check_dbdir) os.mkdir(check_dbdir) -tmp_dbdir = os.path.join(directory, "db_tmp") +tmp_dbdir = os.path.join(os.getcwd(), "db_tmp") if os.path.exists(tmp_dbdir): shutil.rmtree(tmp_dbdir) os.mkdir(tmp_dbdir) regex1 = re.compile(r"_old\.ice$", re.IGNORECASE) files = [] -for file in os.listdir(os.path.join(directory, "fail")): +for file in os.listdir(os.path.join(os.getcwd(), "fail")): if(regex1.search(file)): files.append(file) @@ -65,15 +63,15 @@ for oldfile in files: else: value = "int" - command = transformdb + " --old " + os.path.join(directory, "fail", oldfile) + " --new " + \ - os.path.join(directory, "fail", newfile) + " -o tmp.xml --key string --value " + value + command = transformdb + " --old " + os.path.join(os.getcwd(), "fail", oldfile) + " --new " + \ + os.path.join(os.getcwd(), "fail", newfile) + " -o tmp.xml --key string --value " + value if TestUtil.debug: print command stdin, stdout, stderr = os.popen3(command) lines1 = stderr.readlines() - lines2 = open(os.path.join(directory, "fail", oldfile.replace("_old.ice", ".err")), "r").readlines() + lines2 = open(os.path.join(os.getcwd(), "fail", oldfile.replace("_old.ice", ".err")), "r").readlines() if len(lines1) != len(lines2): print "failed! (1)" sys.exit(1) @@ -94,18 +92,15 @@ print "ok" print "creating test database...", sys.stdout.flush() -makedb = os.path.join(directory, "makedb") + " " + directory -if TestUtil.debug: - print "(" + makedb + ")", -if os.system(makedb) != 0: - sys.exit(1) - +makedb = os.path.join(os.getcwd(), "makedb") + " " + os.getcwd() +proc = TestUtil.spawn(makedb) +proc.waitTestSuccess() print "ok" -testold = os.path.join(directory, "TestOld.ice") -testnew = os.path.join(directory, "TestNew.ice") -initxml = os.path.join(directory, "init.xml") -checkxml = os.path.join(directory, "check.xml") +testold = os.path.join(os.getcwd(), "TestOld.ice") +testnew = os.path.join(os.getcwd(), "TestNew.ice") +initxml = os.path.join(os.getcwd(), "init.xml") +checkxml = os.path.join(os.getcwd(), "check.xml") print "initializing test database...", sys.stdout.flush() @@ -142,5 +137,3 @@ if os.system(command) != 0: sys.exit(1) print "ok" - -sys.exit(0) diff --git a/cpp/test/FreezeScript/evictor/run.py b/cpp/test/FreezeScript/evictor/run.py index c758e6dba4a..0a8f374b694 100755 --- a/cpp/test/FreezeScript/evictor/run.py +++ b/cpp/test/FreezeScript/evictor/run.py @@ -10,29 +10,27 @@ import os, sys, re, shutil -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!" +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 os.getcwd()!" +sys.path.append(os.path.join(path[0])) +from scripts import * -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -directory = os.path.dirname(os.path.abspath(__file__)) transformdb = os.path.join(TestUtil.getCppBinDir(), "transformdb") -dbdir = os.path.join(directory, "db") +dbdir = os.path.join(os.getcwd(), "db") TestUtil.cleanDbDir(dbdir) -check_dbdir = os.path.join(directory, "db_check") +check_dbdir = os.path.join(os.getcwd(), "db_check") if os.path.exists(check_dbdir): shutil.rmtree(check_dbdir) os.mkdir(check_dbdir) -tmp_dbdir = os.path.join(directory, "db_tmp") +tmp_dbdir = os.path.join(os.getcwd(), "db_tmp") if os.path.exists(tmp_dbdir): shutil.rmtree(tmp_dbdir) os.mkdir(tmp_dbdir) @@ -40,49 +38,30 @@ os.mkdir(tmp_dbdir) print "creating test database...", sys.stdout.flush() -makedb = os.path.join(directory, "makedb") + " " + directory -if TestUtil.debug: - print "(" + makedb + ")", -if os.system(makedb) != 0: - sys.exit(1) - +makedb = os.path.join(os.getcwd(), "makedb") + " " + os.getcwd() +proc = TestUtil.spawn(makedb) +proc.waitTestSuccess() print "ok" -testold = os.path.join(directory, "TestOld.ice") -testnew = os.path.join(directory, "TestNew.ice") -transformxml = os.path.join(directory, "transform.xml") -checkxml = os.path.join(directory, "check.xml") +testold = os.path.join(os.getcwd(), "TestOld.ice") +testnew = os.path.join(os.getcwd(), "TestNew.ice") +transformxml = os.path.join(os.getcwd(), "transform.xml") +checkxml = os.path.join(os.getcwd(), "check.xml") print "executing evictor transformations...", sys.stdout.flush() command = transformdb + " -e -p --old " + testold + " --new " + testnew + " -f " + transformxml + " " + dbdir + \ " evictor.db " + check_dbdir -if TestUtil.debug: - print "(" + command + ")", -#stdin, stdout, stderr = os.popen3(command) -#stderr.readlines() - -pipe = os.popen(command + " 2>&1") +proc = TestUtil.spawn(command) +proc.waitTestSuccess() print "ok" -#TestUtil.printOutputFromPipe(pipe) - -clientStatus = TestUtil.closePipe(pipe) -if clientStatus: - print "failed!" - sys.exit(1) - print "validating database...", sys.stdout.flush() command = transformdb + " -e --old " + testnew + " --new " + testnew + " -f " + checkxml + " " + check_dbdir + \ " evictor.db " + tmp_dbdir -if TestUtil.debug: - print "(" + command + ")", -if os.system(command) != 0: - sys.exit(1) - +proc = TestUtil.spawn(command) +proc.waitTestSuccess() print "ok" - -sys.exit(0) diff --git a/cpp/test/Glacier2/attack/run.py b/cpp/test/Glacier2/attack/run.py index 6c483400c4c..3669b385297 100755 --- a/cpp/test/Glacier2/attack/run.py +++ b/cpp/test/Glacier2/attack/run.py @@ -10,34 +10,29 @@ 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() router = os.path.join(TestUtil.getCppBinDir(), "glacier2router") -args = 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="' + TestUtil.getMappingDir(__file__) + \ - r'/test/Glacier2/attack/passwords" 2>&1' +args = ' --Glacier2.RoutingTable.MaxSize=10' + \ + ' --Glacier2.Client.Endpoints="default -p 12347 -t 10000"' + \ + ' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348 -t 10000"' + \ + ' --Ice.Admin.InstanceName=Glacier2' + \ + ' --Glacier2.CryptPasswords="' + os.path.join(testdir, "passwords") + '"' print "starting router...", -starterPipe = TestUtil.startServer(router, args) -TestUtil.getServerPid(starterPipe) -TestUtil.getAdapterReady(starterPipe, True, 2) +starterProc = TestUtil.startServer(router, args, count=2) print "ok" -name = os.path.join("Glacier2", "attack") - -TestUtil.mixedClientServerTest(name) +TestUtil.clientServerTest() -sys.exit(0) +starterProc.waitTestSuccess() diff --git a/cpp/test/Glacier2/dynamicFiltering/run.py b/cpp/test/Glacier2/dynamicFiltering/run.py index 4ec9f4404bd..d71add63afc 100755 --- a/cpp/test/Glacier2/dynamicFiltering/run.py +++ b/cpp/test/Glacier2/dynamicFiltering/run.py @@ -10,25 +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() - -testdir = os.path.dirname(os.path.abspath(__file__)) - -server = os.path.join(testdir, "server") +server = os.path.join(os.getcwd(), "server") print "starting server...", -serverPipe = TestUtil.startServer(server, "") -TestUtil.getServerPid(serverPipe) -TestUtil.getAdapterReady(serverPipe, True, 3) +serverProc = TestUtil.startServer(server, count=3) print "ok" router = os.path.join(TestUtil.getCppBinDir(), "glacier2router") @@ -42,26 +37,15 @@ args = r' --Glacier2.Client.Endpoints="default -p 12347 -t 10000"' + \ r' --Ice.Default.Locator="locator:default -p 12012 -t 10000"' print "starting router...", -starterPipe = TestUtil.startServer(router, args) -TestUtil.getServerPid(starterPipe) -TestUtil.getAdapterReady(starterPipe, True, 2) +starterProc = TestUtil.startServer(router, args, count=2) print "ok" -client = os.path.join(testdir, "client") +client = os.path.join(os.getcwd(), "client") print "starting client...", -clientPipe = TestUtil.startClient(client, " 2>&1") -TestUtil.ignorePid(clientPipe) +proc = TestUtil.startClient(client) print "ok" +proc.waitTestSuccess() -TestUtil.printOutputFromPipe(clientPipe) -clientStatus = TestUtil.closePipe(clientPipe) -if clientStatus: - TestUtil.killServers() - -if clientStatus or TestUtil.serverStatus(): - print >>sys.stderr, "Client status:", clientStatus - print >>sys.stderr, "Server status:", TestUtil.serverStatus() - sys.exit(1) - -sys.exit(0) +serverProc.waitTestSuccess() +starterProc.waitTestSuccess() diff --git a/cpp/test/Glacier2/router/run.py b/cpp/test/Glacier2/router/run.py index b8843334466..8848259c201 100755 --- a/cpp/test/Glacier2/router/run.py +++ b/cpp/test/Glacier2/router/run.py @@ -10,31 +10,30 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" - -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() +sys.path.append(os.path.join(path[0])) +from scripts import * router = os.path.join(TestUtil.getCppBinDir(), "glacier2router") def startRouter(buffered): - args = r' --Ice.Warn.Dispatch=0' + \ - r' --Ice.Warn.Connections=0' + \ - r' --Glacier2.Filter.Category.Accept="c1 c2"' + \ - r' --Glacier2.Filter.Category.AcceptUser="2"' + \ - r' --Glacier2.SessionTimeout="30"' + \ - r' --Glacier2.Client.Endpoints="default -p 12347 -t 10000"' + \ - r' --Glacier2.Server.Endpoints="tcp -h 127.0.0.1 -t 10000"' \ - r' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348 -t 10000"' + \ - r' --Ice.Admin.InstanceName="Glacier2"' + \ - r' --Glacier2.CryptPasswords="' + TestUtil.getMappingDir(__file__) + r'/test/Glacier2/router/passwords"' + args = ' --Ice.Warn.Dispatch=0' + \ + ' --Ice.Warn.Connections=0' + \ + ' --Glacier2.Filter.Category.Accept="c1 c2"' + \ + ' --Glacier2.Filter.Category.AcceptUser="2"' + \ + ' --Glacier2.SessionTimeout="30"' + \ + ' --Glacier2.Client.Endpoints="default -p 12347 -t 10000"' + \ + ' --Glacier2.Server.Endpoints="tcp -h 127.0.0.1 -t 10000"' \ + ' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348 -t 10000"' + \ + ' --Ice.Admin.InstanceName="Glacier2"' + \ + ' --Glacier2.CryptPasswords="%s"' % os.path.join(os.getcwd(), "passwords") if buffered: args += ' --Glacier2.Client.Buffered=1 --Glacier2.Server.Buffered=1' @@ -43,48 +42,31 @@ def startRouter(buffered): args += ' --Glacier2.Client.Buffered=0 --Glacier2.Server.Buffered=0' print "starting router in unbuffered mode...", - starterPipe = TestUtil.startServer(router, args + " 2>&1") - TestUtil.getServerPid(starterPipe) + starterProc = TestUtil.startServer(router, args, count=2) - # - # For this test we don't want to add the router to the server threads - # since we want the the router to run over two calls to - # mixedClientServerTest - # - TestUtil.getAdapterReady(starterPipe, False, 2) print "ok" - - routerThread = TestUtil.ReaderThread(starterPipe); - routerThread.start() - - return routerThread + return starterProc name = os.path.join("Glacier2", "router") # # We first run the test with unbuffered mode. # -routerThread = startRouter(False) -TestUtil.mixedClientServerTestWithOptions(name, "", " --shutdown") -routerThread.join() -if routerThread.getStatus(): - sys.exit(1) +starterProc = startRouter(False) +TestUtil.clientServerTest(name, additionalClientOptions = " --shutdown") +starterProc.waitTestSuccess() # # Then we run the test in buffered mode. # -routerThread = startRouter(True) -TestUtil.mixedClientServerTest(name) +starterProc = startRouter(True) +TestUtil.clientServerTest() # # We run the test again, to check whether the glacier router can # handle multiple clients. Also, when we run for the second time, we # want the client to shutdown the router after running the tests. # -TestUtil.mixedClientServerTestWithOptions(name, "", " --shutdown") - -routerThread.join() -if routerThread.getStatus(): - sys.exit(1) +TestUtil.clientServerTest(name, additionalClientOptions = " --shutdown") -sys.exit(0) +starterProc.waitTestSuccess() diff --git a/cpp/test/Glacier2/sessionControl/run.py b/cpp/test/Glacier2/sessionControl/run.py index 790b71662a5..8b28a57ec0d 100755 --- a/cpp/test/Glacier2/sessionControl/run.py +++ b/cpp/test/Glacier2/sessionControl/run.py @@ -10,44 +10,36 @@ import os, sys, time -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("Glacier2", "sessionControl") -testdir = os.path.dirname(os.path.abspath(__file__)) - -server = os.path.join(testdir, "server") +server = os.path.join(os.getcwd(), "server") print "starting server...", -serverPipe = TestUtil.startServer(server, " 2>&1") -TestUtil.getServerPid(serverPipe) -TestUtil.getAdapterReady(serverPipe) +serverProc = TestUtil.startServer(server) print "ok" router = os.path.join(TestUtil.getCppBinDir(), "glacier2router") -args = r' --Glacier2.Client.Endpoints="default -p 12347 -t 10000"' + \ - r' --Ice.Admin.Endpoints="tcp -p 12348 -t 10000"' + \ - r' --Ice.Admin.InstanceName=Glacier2' + \ - r' --Glacier2.Server.Endpoints="default -p 12349 -t 10000"' + \ - r' --Glacier2.SessionManager="SessionManager:tcp -p 12010 -t 10000"' \ - r' --Glacier2.PermissionsVerifier="Glacier2/NullPermissionsVerifier" 2>&1' +args = ' --Glacier2.Client.Endpoints="default -p 12347 -t 10000"' + \ + ' --Ice.Admin.Endpoints="tcp -p 12348 -t 10000"' + \ + ' --Ice.Admin.InstanceName=Glacier2' + \ + ' --Glacier2.Server.Endpoints="default -p 12349 -t 10000"' + \ + ' --Glacier2.SessionManager="SessionManager:tcp -p 12010 -t 10000"' \ + ' --Glacier2.PermissionsVerifier="Glacier2/NullPermissionsVerifier"' print "starting router...", -starterPipe = TestUtil.startServer(router, args) -TestUtil.getServerPid(starterPipe) -TestUtil.getAdapterReady(starterPipe, True, 2) +starterProc = TestUtil.startServer(router, args, count = 2) print "ok" -client = os.path.join(testdir, "client") +client = os.path.join(os.getcwd(), "client") # # The test may sporadically fail without this slight pause. @@ -55,16 +47,9 @@ client = os.path.join(testdir, "client") time.sleep(1) print "starting client...", -clientPipe = TestUtil.startClient(client, " 2>&1") -#TestUtil.getServerPid(clientPipe) +clientProc = TestUtil.startClient(client) print "ok" -TestUtil.printOutputFromPipe(clientPipe) -clientStatus = TestUtil.closePipe(clientPipe) -if clientStatus: - TestUtil.killServers() - -if clientStatus or TestUtil.serverStatus(): - sys.exit(1) - -sys.exit(0) +clientProc.waitTestSuccess() +serverProc.waitTestSuccess() +starterProc.waitTestSuccess() diff --git a/cpp/test/Glacier2/ssl/run.py b/cpp/test/Glacier2/ssl/run.py index 2c39f0d3e09..0b5b77d2dcd 100755 --- a/cpp/test/Glacier2/ssl/run.py +++ b/cpp/test/Glacier2/ssl/run.py @@ -10,63 +10,48 @@ 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("Glacier2", "ssl") - -testdir = os.path.dirname(os.path.abspath(__file__)) -server = os.path.join(testdir, "server") +server = os.path.join(os.getcwd(), "server") print "starting server...", -serverPipe = TestUtil.startServer(server, " 2>&1") -TestUtil.getServerPid(serverPipe) -TestUtil.getAdapterReady(serverPipe) +serverProc = TestUtil.startServer(server) print "ok" router = os.path.join(TestUtil.getCppBinDir(), "glacier2router") -args = r' --Ice.Warn.Dispatch=0' + \ - r' --Glacier2.AddSSLContext=1' + \ - r' --Glacier2.Client.Endpoints="tcp -h 127.0.0.1 -p 12347 -t 10000:ssl -h 127.0.0.1 -p 12348 -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 12349 -t 10000"' + \ - r' --Ice.Admin.InstanceName=Glacier2' + \ - r' --Glacier2.SessionManager="sessionmanager:tcp -h 127.0.0.1 -p 12350 -t 10000"' + \ - r' --Glacier2.PermissionsVerifier="Glacier2/NullPermissionsVerifier"' + \ - r' --Glacier2.SSLSessionManager="sslsessionmanager:tcp -h 127.0.0.1 -p 12350 -t 10000"' + \ - r' --Glacier2.SSLPermissionsVerifier="sslverifier:tcp -h 127.0.0.1 -p 12350 -t 10000"' +args = ' --Ice.Warn.Dispatch=0' + \ + ' --Glacier2.AddSSLContext=1' + \ + ' --Glacier2.Client.Endpoints="tcp -h 127.0.0.1 -p 12347 -t 10000:ssl -h 127.0.0.1 -p 12348 -t 10000"' + \ + ' --Glacier2.Server.Endpoints="tcp -h 127.0.0.1 -t 10000"' \ + ' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12349 -t 10000"' + \ + ' --Ice.Admin.InstanceName=Glacier2' + \ + ' --Glacier2.SessionManager="sessionmanager:tcp -h 127.0.0.1 -p 12350 -t 10000"' + \ + ' --Glacier2.PermissionsVerifier="Glacier2/NullPermissionsVerifier"' + \ + ' --Glacier2.SSLSessionManager="sslsessionmanager:tcp -h 127.0.0.1 -p 12350 -t 10000"' + \ + ' --Glacier2.SSLPermissionsVerifier="sslverifier:tcp -h 127.0.0.1 -p 12350 -t 10000"' routerCfg = TestUtil.DriverConfig("server") routerCfg.protocol = "ssl" print "starting router...", -starterPipe = TestUtil.startServer(router, args + " 2>&1", routerCfg) -TestUtil.getServerPid(starterPipe) -TestUtil.getAdapterReady(starterPipe, True, 2) +starterProc = TestUtil.startServer(router, args, routerCfg, count = 2) print "ok" clientCfg = TestUtil.DriverConfig("client") clientCfg.protocol = "ssl" -client = os.path.join(testdir, "client") +client = os.path.join(os.getcwd(), "client") print "starting client...", -clientPipe = TestUtil.startClient(client, "", clientCfg) +clientProc = TestUtil.startClient(client, "", clientCfg) print "ok" -TestUtil.printOutputFromPipe(clientPipe) - -clientStatus = TestUtil.closePipe(clientPipe) -if clientStatus: - TestUtil.killServers() - -if clientStatus or TestUtil.serverStatus(): - sys.exit(1) - -sys.exit(0) +clientProc.waitTestSuccess() +serverProc.waitTestSuccess() +starterProc.waitTestSuccess() diff --git a/cpp/test/Glacier2/staticFiltering/run.py b/cpp/test/Glacier2/staticFiltering/run.py index b3e7b9d7501..d30e00bdb63 100755 --- a/cpp/test/Glacier2/staticFiltering/run.py +++ b/cpp/test/Glacier2/staticFiltering/run.py @@ -10,16 +10,15 @@ import os, sys, time, socket -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" - -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() +sys.path.append(os.path.join(path[0])) +from scripts import * hostname = socket.gethostname() fqdn = socket.getfqdn() @@ -159,13 +158,13 @@ testcases = [ if not limitedTests: testcases.extend([ ('testing reject all', - (r'', r'*', r'', '', '', ''), + ('', '*', '', '', '', ''), [(False, 'helloA:tcp -h %s -p 12010' % fqdn), (False, 'helloB:tcp -h %s -p 12010' % hostname), (False, 'helloC:tcp -h 127.0.0.1 -p 12010'), (True, 'bar @ foo')], []), ('testing loopback only rule', - (r'127.0.0.1 localhost', r'', r'', '', '', ''), + ('127.0.0.1 localhost', '', '', '', '', ''), [(False, 'hello:tcp -h %s -p 12010' % fqdn), (False, 'hello:tcp -h %s -p 12010' % hostname), (False, '127.0.0.1:tcp -h %s -p 12010' % hostname), @@ -173,44 +172,44 @@ if not limitedTests: (False, 'localhost/127.0.0.1:tcp -h %s -p 12010' % hostname), (True, 'localhost:tcp -h 127.0.0.1 -p 12010'), (True, 'localhost/127.0.0.1:tcp -h localhost -p 12010'), - (True, r'hello:tcp -h 127.0.0.1 -p 12010'), - (True, r'hello/somecat:tcp -h localhost -p 12010')], []), + (True, 'hello:tcp -h 127.0.0.1 -p 12010'), + (True, 'hello/somecat:tcp -h localhost -p 12010')], []), ('testing port filter rule', - (r'127.0.0.1:12010 localhost:12010', r'', r'', '', '', ''), - [(False, r'hello1:tcp -h 127.0.0.1 -p 12011'), - (False, r'hello2:tcp -h localhost -p 12011'), - (False, r'hello5:tcp -h %s -p 12010' % hostname), - (True, r'hello3:tcp -h 127.0.0.1 -p 12010'), - (True, r'hello4:tcp -h localhost -p 12010')], []), + ('127.0.0.1:12010 localhost:12010', '', '', '', '', ''), + [(False, 'hello1:tcp -h 127.0.0.1 -p 12011'), + (False, 'hello2:tcp -h localhost -p 12011'), + (False, 'hello5:tcp -h %s -p 12010' % hostname), + (True, 'hello3:tcp -h 127.0.0.1 -p 12010'), + (True, 'hello4:tcp -h localhost -p 12010')], []), ('testing reject port filter rule', - (r'', r'127.0.0.1:[0-12009,12011-65535] localhost:[0-12009,12011-65535]', r'', '', '', ''), - [(False, r'hello1:tcp -h 127.0.0.1 -p 12011'), - (False, r'hello2:tcp -h localhost -p 12011'), - (True, r'hello5:tcp -h %s -p 12010' % hostname), - (True, r'hello3:tcp -h 127.0.0.1 -p 12010'), - (True, r'hello4:tcp -h localhost -p 12010')], []), + ('', '127.0.0.1:[0-12009,12011-65535] localhost:[0-12009,12011-65535]', '', '', '', ''), + [(False, 'hello1:tcp -h 127.0.0.1 -p 12011'), + (False, 'hello2:tcp -h localhost -p 12011'), + (True, 'hello5:tcp -h %s -p 12010' % hostname), + (True, 'hello3:tcp -h 127.0.0.1 -p 12010'), + (True, 'hello4:tcp -h localhost -p 12010')], []), ('testing port filter rule with wildcard address rule', - (r'*:12010', r'', r'', '', '', ''), - [(False, r'hello1:tcp -h 127.0.0.1 -p 12011'), - (False, r'hello2:tcp -h localhost -p 12011'), - (True, r'hello5:tcp -h %s -p 12010' % hostname), - (True, r'hello3:tcp -h 127.0.0.1 -p 12010'), - (True, r'hello4:tcp -h localhost -p 12010')], []), + ('*:12010', '', '', '', '', ''), + [(False, 'hello1:tcp -h 127.0.0.1 -p 12011'), + (False, 'hello2:tcp -h localhost -p 12011'), + (True, 'hello5:tcp -h %s -p 12010' % hostname), + (True, 'hello3:tcp -h 127.0.0.1 -p 12010'), + (True, 'hello4:tcp -h localhost -p 12010')], []), ('testing domain filter rule (accept)', - ("*" + domainname, r'', r'', '', '', ''), + ("*" + domainname, '', '', '', '', ''), [(True, 'hello:tcp -h %s -p 12010' % fqdn), (False, 'hello:tcp -h %s -p 12010' % hostname)], []), ('testing domain filter rule (reject)', - (r'', "*" + domainname, r'', '', '', ''), + ('', "*" + domainname, '', '', '', ''), [(False, 'hello:tcp -h %s -p 12010' % fqdn), (True, 'hello:tcp -h %s -p 12010' % hostname), (True, 'bar:tcp -h 127.0.0.1 -p 12010')], []), ('testing domain filter rule (mixed)', - ("127.0.0.1", fqdn, r'', '', '', ''), + ("127.0.0.1", fqdn, '', '', '', ''), [(False, 'hello:tcp -h %s -p 12010:tcp -h 127.0.0.1 -p 12010' % fqdn), (True, 'bar:tcp -h 127.0.0.1 -p 12010')], []), ('testing maximum proxy length rule', - (r'', r'', r'40', '', '', ''), + ('', '', '40', '', '', ''), [(True, 'hello:tcp -h 127.0.0.1 -p 12010'), (False, '012345678901234567890123456789012345678901234567890123456789:tcp -h 127.0.0.1 -p 12010')], []), ]) @@ -233,13 +232,12 @@ def pingProgress(): for testcase in testcases: description, args, attacks, xtraConfig = testcase acceptFilter, rejectFilter, maxEndpoints, categoryFilter, idFilter, adapterFilter = args - testdir = os.path.dirname(os.path.abspath(__file__)) # # The test client performs multiple tests during one 'run'. We could # use command line arguments to pass the test cases in, but a # configuration file is easier. # - attackcfg = file(os.path.join(testdir, 'attack.cfg'), 'w') + attackcfg = file(os.path.join(os.getcwd(), 'attack.cfg'), 'w') accepts=0 rejects=0 sys.stdout.write(description) @@ -259,30 +257,28 @@ for testcase in testcases: hostArg = "" if limitedTests: hostArg = " --Ice.Default.Host=127.0.0.1" - - # # This test causes connections to be terminated which will cause # warnings if we use the default test flags. So we need to define # our own. # - commonClientOptions = " --Ice.NullHandleAbort=1 --Ice.PrintProcessId=1 --Ice.Warn.Connections=0 " + hostArg - commonServerOptions = r' --Ice.PrintProcessId --Ice.PrintAdapterReady --Ice.NullHandleAbort=1' + \ - r' --Ice.ServerIdleTime=600 --Ice.ThreadPool.Server.Size=2 --Ice.ThreadPool.Server.SizeMax=10' + \ - r' --Glacier2.RoutingTable.MaxSize=10 --Ice.Warn.Connections=0 ' + hostArg + commonClientOptions = " --Ice.NullHandleAbort=1 --Ice.Warn.Connections=0 " + hostArg + commonServerOptions = ' --Ice.PrintAdapterReady --Ice.NullHandleAbort=1' + \ + ' --Ice.ServerIdleTime=600 --Ice.ThreadPool.Server.Size=2 --Ice.ThreadPool.Server.SizeMax=10' + \ + ' --Glacier2.RoutingTable.MaxSize=10 --Ice.Warn.Connections=0 ' + hostArg # # We cannot use the TestUtil options because they use localhost as the default host which doesn't really work for # these tests. # - routerArgs = " --Ice.Config=" + os.path.join(testdir, "router.cfg") + \ - r' --Glacier2.Client.Endpoints="default -p 12347 -t 60000"' + \ - r' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348 -t 60000"' + \ - r' --Ice.Admin.InstanceName=Glacier2' + \ - r' --Glacier2.CryptPasswords="' + os.path.dirname(os.path.abspath(__file__)) + r'/passwords"' + routerArgs = " --Ice.Config=" + os.path.join(os.getcwd(), "router.cfg") + \ + ' --Glacier2.Client.Endpoints="default -p 12347 -t 60000"' + \ + ' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348 -t 60000"' + \ + ' --Ice.Admin.InstanceName=Glacier2' + \ + ' --Glacier2.CryptPasswords="' + os.path.join(os.getcwd(), "passwords") + '"' - routerConfig = file(os.path.join(testdir, "router.cfg"), "w") + routerConfig = file(os.path.join(os.getcwd(), "router.cfg"), "w") routerConfig.write("Ice.Default.Locator=locator:tcp -h %s -p 12010\n" % hostname) routerConfig.write("Glacier2.Client.Trace.Reject=0\n") @@ -320,27 +316,23 @@ for testcase in testcases: routerDriver.host = None routerDriver.overrides = commonServerOptions + routerArgs - starterPipe = TestUtil.startServer(router, " 2>&1", routerDriver) - TestUtil.getServerPid(starterPipe) - TestUtil.getAdapterReady(starterPipe, True, 2) + starterProc = TestUtil.startServer(router, config=routerDriver, count=2) pingProgress() if TestUtil.protocol != "ssl": - serverConfig = file(os.path.join(testdir, "server.cfg"), "w") - serverOptions = ' --Ice.Config=' + os.path.join(testdir, "server.cfg") + " " + serverConfig = file(os.path.join(os.getcwd(), "server.cfg"), "w") + serverOptions = ' --Ice.Config=' + os.path.join(os.getcwd(), "server.cfg") + " " serverConfig.write("BackendAdapter.Endpoints=tcp -p 12010 -t 20000\n") serverConfig.close() else: serverOptions = "" - serverCmd = os.path.join(testdir, 'server') + serverCmd = os.path.join(os.getcwd(), 'server') serverDriver = TestUtil.DriverConfig("server") if serverDriver.host == "127.0.0.1": serverDriver.host = None serverDriver.overrides = commonServerOptions - serverPipe = TestUtil.startServer(serverCmd, serverOptions + " 2>&1", serverDriver) - TestUtil.getServerPid(serverPipe) - TestUtil.getAdapterReady(serverPipe) + serverProc = TestUtil.startServer(serverCmd, serverOptions, serverDriver) pingProgress() sys.stdout.write(' ') @@ -350,22 +342,13 @@ for testcase in testcases: # The client is responsible for reporting success or failure. A test # failure will result in an assertion and the test will abort. # - clientCmd = os.path.join(testdir, 'client') + clientCmd = os.path.join(os.getcwd(), 'client') clientDriver = TestUtil.DriverConfig("client") if clientDriver.host == "127.0.0.1": clientDriver.host = None clientDriver.host = commonClientOptions - clientArgs = " --Ice.Config=" + os.path.join(testdir, 'attack.cfg') + " " - clientPipe = TestUtil.startClient(clientCmd, clientArgs + " 2>&1", clientDriver) - TestUtil.ignorePid(clientPipe) - - TestUtil.printOutputFromPipe(clientPipe) - - clientStatus = TestUtil.closePipe(clientPipe) - if clientStatus: - TestUtil.killServers() - - if clientStatus or TestUtil.serverStatus(): - sys.exit(1) - -sys.exit(0) + clientArgs = " --Ice.Config=" + os.path.join(os.getcwd(), 'attack.cfg') + " " + clientProc = TestUtil.startClient(clientCmd, clientArgs, clientDriver) + clientProc.waitTestSuccess() + serverProc.waitTestSuccess() + starterProc.waitTestSuccess() diff --git a/cpp/test/Ice/adapterDeactivation/run.py b/cpp/test/Ice/adapterDeactivation/run.py index 789ff1b7f41..dcb8454ad37 100755 --- a/cpp/test/Ice/adapterDeactivation/run.py +++ b/cpp/test/Ice/adapterDeactivation/run.py @@ -10,19 +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") - -TestUtil.clientServerTest(name) -TestUtil.collocatedTest(name) -sys.exit(0) +TestUtil.clientServerTest() +TestUtil.collocatedTest() diff --git a/cpp/test/Ice/background/run.py b/cpp/test/Ice/background/run.py index ffa6acdbc2b..2a3d5ec3417 100755 --- a/cpp/test/Ice/background/run.py +++ b/cpp/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__)) - -TestUtil.addLdPath(testdir) - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/cpp/test/Ice/binding/run.py b/cpp/test/Ice/binding/run.py index 02f04424efa..2a3d5ec3417 100755 --- a/cpp/test/Ice/binding/run.py +++ b/cpp/test/Ice/binding/run.py @@ -10,18 +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") - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/cpp/test/Ice/checksum/client/.depend b/cpp/test/Ice/checksum/.depend index 42e582646ee..6c6cf6a29ce 100644 --- a/cpp/test/Ice/checksum/client/.depend +++ b/cpp/test/Ice/checksum/.depend @@ -1,7 +1,7 @@ -Test$(OBJEXT): Test.cpp ./Test.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Outgoing.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StringConverter.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/SliceChecksums.h $(includedir)/IceUtil/Iterator.h $(includedir)/IceUtil/ScopedArray.h -Types$(OBJEXT): Types.cpp ./Types.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Outgoing.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StringConverter.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/FactoryTable.h $(includedir)/Ice/FactoryTableDef.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactoryF.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/SliceChecksums.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceUtil/Iterator.h $(includedir)/IceUtil/ScopedArray.h -Client$(OBJEXT): Client.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/Stream.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/FactoryTable.h $(includedir)/Ice/FactoryTableDef.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactoryF.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/IconvStringConverter.h ../../../include/TestCommon.h ./Test.h $(includedir)/Ice/SliceChecksumDict.h -AllTests$(OBJEXT): AllTests.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/Stream.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/FactoryTable.h $(includedir)/Ice/FactoryTableDef.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactoryF.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/IconvStringConverter.h $(includedir)/Ice/SliceChecksums.h $(includedir)/Ice/SliceChecksumDict.h ../../../include/TestCommon.h ./Test.h +Test$(OBJEXT): Test.cpp ./Test.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Outgoing.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/LoggerF.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/SliceChecksums.h $(includedir)/IceUtil/Iterator.h $(includedir)/IceUtil/ScopedArray.h +Types$(OBJEXT): Types.cpp ./Types.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Outgoing.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/LoggerF.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/FactoryTable.h $(includedir)/Ice/FactoryTableDef.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactoryF.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/SliceChecksums.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceUtil/Iterator.h $(includedir)/IceUtil/ScopedArray.h +Client$(OBJEXT): Client.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/Stream.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/FactoryTable.h $(includedir)/Ice/FactoryTableDef.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactoryF.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h ../../include/TestCommon.h ./Test.h $(includedir)/Ice/SliceChecksumDict.h +AllTests$(OBJEXT): AllTests.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/Stream.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/FactoryTable.h $(includedir)/Ice/FactoryTableDef.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactoryF.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h $(includedir)/Ice/SliceChecksums.h $(includedir)/Ice/SliceChecksumDict.h ../../include/TestCommon.h ./Test.h Test.cpp: Test.ice $(slicedir)/Ice/SliceChecksumDict.ice Types.cpp: Types.ice Test.ice: $(SLICE2CPP) $(SLICEPARSERLIB) diff --git a/cpp/test/Ice/checksum/client/AllTests.cpp b/cpp/test/Ice/checksum/AllTests.cpp index 775874b3b9d..775874b3b9d 100644 --- a/cpp/test/Ice/checksum/client/AllTests.cpp +++ b/cpp/test/Ice/checksum/AllTests.cpp diff --git a/cpp/test/Ice/checksum/client/Client.cpp b/cpp/test/Ice/checksum/Client.cpp index ef9abc94e5b..ef9abc94e5b 100644 --- a/cpp/test/Ice/checksum/client/Client.cpp +++ b/cpp/test/Ice/checksum/Client.cpp diff --git a/cpp/test/Ice/checksum/Makefile b/cpp/test/Ice/checksum/Makefile index 1d6613575cd..69655428996 100644 --- a/cpp/test/Ice/checksum/Makefile +++ b/cpp/test/Ice/checksum/Makefile @@ -9,10 +9,30 @@ top_srcdir = ../../.. +CLIENT = client + +TARGETS = $(CLIENT) + +COBJS = Test.o \ + Types.o \ + Client.o \ + AllTests.o + +SRCS = $(COBJS:.o=.cpp) + +SLICE_SRCS = Test.ice Types.ice + include $(top_srcdir)/config/Make.rules -SUBDIRS = client \ - server +CPPFLAGS := -I. -I../../include $(CPPFLAGS) + +SLICE2CPPFLAGS := --checksum $(SLICE2CPPFLAGS) + +$(CLIENT): $(COBJS) + rm -f $@ + $(CXX) $(LDFLAGS) -o $@ $(COBJS) $(LIBS) + +SUBDIRS = server $(EVERYTHING):: @for subdir in $(SUBDIRS); \ @@ -20,3 +40,6 @@ $(EVERYTHING):: echo "making $@ in $$subdir"; \ ( cd $$subdir && $(MAKE) $@ ) || exit 1; \ done + + +include .depend diff --git a/cpp/test/Ice/checksum/Makefile.mak b/cpp/test/Ice/checksum/Makefile.mak index 27ee90aab10..ad91d8a8d6c 100644 --- a/cpp/test/Ice/checksum/Makefile.mak +++ b/cpp/test/Ice/checksum/Makefile.mak @@ -9,12 +9,40 @@ top_srcdir = ..\..\..
-!include $(top_srcdir)\config\Make.rules.mak
+CLIENT = client.exe
-SUBDIRS = client \
- server
+TARGETS = $(CLIENT)
+
+COBJS = Test.obj \
+ Types.obj \
+ Client.obj \
+ AllTests.obj
+
+SRCS = $(COBJS:.obj=.cpp)
+
+!include $(top_srcdir)/config/Make.rules.mak
+
+SLICE2CPPFLAGS = --checksum $(SLICE2CPPFLAGS)
+CPPFLAGS = -I. -I../../include $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
+
+!if "$(GENERATE_PDB)" == "yes"
+PDBFLAGS = /pdb:$(CLIENT:.exe=.pdb)
+!endif
+
+$(CLIENT): $(COBJS)
+ $(LINK) $(LD_EXEFLAGS) $(PDBFLAGS) $(SETARGV) $(COBJS) $(PREOUT)$@ $(PRELIBS)$(LIBS)
+ @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \
+ $(MT) -nologo -manifest $@.manifest -outputresource:$@;#1 && del /q $@.manifest
+
+clean::
+ del /q Test.cpp Test.h
+ del /q Types.cpp Types.h
+
+SUBDIRS = server
$(EVERYTHING)::
@for %i in ( $(SUBDIRS) ) do \
@echo "making $@ in %i" && \
cmd /c "cd %i && $(MAKE) -nologo -f Makefile.mak $@" || exit 1
+
+!include .depend
diff --git a/cpp/test/Ice/checksum/client/Test.ice b/cpp/test/Ice/checksum/Test.ice index 254b497efe0..254b497efe0 100644 --- a/cpp/test/Ice/checksum/client/Test.ice +++ b/cpp/test/Ice/checksum/Test.ice diff --git a/cpp/test/Ice/checksum/client/Types.ice b/cpp/test/Ice/checksum/Types.ice index ea5e644a755..ea5e644a755 100644 --- a/cpp/test/Ice/checksum/client/Types.ice +++ b/cpp/test/Ice/checksum/Types.ice diff --git a/cpp/test/Ice/checksum/client/.gitignore b/cpp/test/Ice/checksum/client/.gitignore deleted file mode 100644 index 02593a09c8e..00000000000 --- a/cpp/test/Ice/checksum/client/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -// Generated by makegitignore.py - -// IMPORTANT: Do not edit this file -- any edits made here will be lost! -client -Test.cpp -Types.cpp -Test.h -Types.h diff --git a/cpp/test/Ice/checksum/client/Makefile b/cpp/test/Ice/checksum/client/Makefile deleted file mode 100644 index 0991485cef6..00000000000 --- a/cpp/test/Ice/checksum/client/Makefile +++ /dev/null @@ -1,35 +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. -# -# ********************************************************************** - -top_srcdir = ../../../.. - -CLIENT = client - -TARGETS = $(CLIENT) - -COBJS = Test.o \ - Types.o \ - Client.o \ - AllTests.o - -SRCS = $(COBJS:.o=.cpp) - -SLICE_SRCS = Test.ice Types.ice - -include $(top_srcdir)/config/Make.rules - -CPPFLAGS := -I. -I../../../include $(CPPFLAGS) - -SLICE2CPPFLAGS := --checksum $(SLICE2CPPFLAGS) - -$(CLIENT): $(COBJS) - rm -f $@ - $(CXX) $(LDFLAGS) -o $@ $(COBJS) $(LIBS) - -include .depend diff --git a/cpp/test/Ice/checksum/client/Makefile.mak b/cpp/test/Ice/checksum/client/Makefile.mak deleted file mode 100644 index 2bc99fedede..00000000000 --- a/cpp/test/Ice/checksum/client/Makefile.mak +++ /dev/null @@ -1,41 +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.
-#
-# **********************************************************************
-
-top_srcdir = ..\..\..\..
-
-CLIENT = client.exe
-
-TARGETS = $(CLIENT)
-
-COBJS = Test.obj \
- Types.obj \
- Client.obj \
- AllTests.obj
-
-SRCS = $(COBJS:.obj=.cpp)
-
-!include $(top_srcdir)/config/Make.rules.mak
-
-SLICE2CPPFLAGS = --checksum $(SLICE2CPPFLAGS)
-CPPFLAGS = -I. -I../../../include $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
-
-!if "$(GENERATE_PDB)" == "yes"
-PDBFLAGS = /pdb:$(CLIENT:.exe=.pdb)
-!endif
-
-$(CLIENT): $(COBJS)
- $(LINK) $(LD_EXEFLAGS) $(PDBFLAGS) $(SETARGV) $(COBJS) $(PREOUT)$@ $(PRELIBS)$(LIBS)
- @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \
- $(MT) -nologo -manifest $@.manifest -outputresource:$@;#1 && del /q $@.manifest
-
-clean::
- del /q Test.cpp Test.h
- del /q Types.cpp Types.h
-
-!include .depend
diff --git a/cpp/test/Ice/checksum/run.py b/cpp/test/Ice/checksum/run.py index 97845fd0f6d..b30fed3a9e9 100755 --- a/cpp/test/Ice/checksum/run.py +++ b/cpp/test/Ice/checksum/run.py @@ -10,20 +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", "checksum") - -server = os.path.join("server", "server") -client = os.path.join("client", "client") -TestUtil.clientServerTestWithOptionsAndNames(name, "", "", server, client) -sys.exit(0) +server = os.path.join(os.getcwd(), "server", "server") +TestUtil.clientServerTest(server = server) diff --git a/cpp/test/Ice/checksum/server/.depend b/cpp/test/Ice/checksum/server/.depend index 61546153aaf..33046eb19dd 100644 --- a/cpp/test/Ice/checksum/server/.depend +++ b/cpp/test/Ice/checksum/server/.depend @@ -1,7 +1,7 @@ -Test$(OBJEXT): Test.cpp ./Test.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Outgoing.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StringConverter.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/SliceChecksums.h $(includedir)/IceUtil/Iterator.h $(includedir)/IceUtil/ScopedArray.h -Types$(OBJEXT): Types.cpp ./Types.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Outgoing.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StringConverter.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/FactoryTable.h $(includedir)/Ice/FactoryTableDef.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactoryF.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/SliceChecksums.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceUtil/Iterator.h $(includedir)/IceUtil/ScopedArray.h -TestI$(OBJEXT): TestI.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/Stream.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/FactoryTable.h $(includedir)/Ice/FactoryTableDef.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactoryF.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/IconvStringConverter.h $(includedir)/Ice/SliceChecksums.h $(includedir)/Ice/SliceChecksumDict.h ./TestI.h ./Test.h -Server$(OBJEXT): Server.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/Stream.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/FactoryTable.h $(includedir)/Ice/FactoryTableDef.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactoryF.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/IconvStringConverter.h ./TestI.h ./Test.h $(includedir)/Ice/SliceChecksumDict.h +Test$(OBJEXT): Test.cpp ./Test.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Outgoing.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/LoggerF.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/SliceChecksums.h $(includedir)/IceUtil/Iterator.h $(includedir)/IceUtil/ScopedArray.h +Types$(OBJEXT): Types.cpp ./Types.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Outgoing.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/LoggerF.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/FactoryTable.h $(includedir)/Ice/FactoryTableDef.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactoryF.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/SliceChecksums.h $(includedir)/Ice/SliceChecksumDict.h $(includedir)/IceUtil/Iterator.h $(includedir)/IceUtil/ScopedArray.h +TestI$(OBJEXT): TestI.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/Stream.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/FactoryTable.h $(includedir)/Ice/FactoryTableDef.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactoryF.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h $(includedir)/Ice/SliceChecksums.h $(includedir)/Ice/SliceChecksumDict.h ./TestI.h ./Test.h +Server$(OBJEXT): Server.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/Stream.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/FactoryTable.h $(includedir)/Ice/FactoryTableDef.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactoryF.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h ./TestI.h ./Test.h $(includedir)/Ice/SliceChecksumDict.h Test.cpp: Test.ice $(slicedir)/Ice/SliceChecksumDict.ice Types.cpp: Types.ice Test.ice: $(SLICE2CPP) $(SLICEPARSERLIB) diff --git a/cpp/test/Ice/custom/run.py b/cpp/test/Ice/custom/run.py index e3615b0dd26..7a6571b96fb 100755 --- a/cpp/test/Ice/custom/run.py +++ b/cpp/test/Ice/custom/run.py @@ -10,23 +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(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "custom") +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -TestUtil.clientServerTest(name) +TestUtil.clientServerTest() print "tests with AMD server." -TestUtil.clientServerTestWithOptionsAndNames(name, "", "", "serveramd", "client") +TestUtil.clientServerTest(server = "serveramd") print "tests with collocated server." -TestUtil.collocatedTest(name) -sys.exit(0) +TestUtil.collocatedTest() diff --git a/cpp/test/Ice/exceptions/run.py b/cpp/test/Ice/exceptions/run.py index 1fe8ff8f01d..7a6571b96fb 100755 --- a/cpp/test/Ice/exceptions/run.py +++ b/cpp/test/Ice/exceptions/run.py @@ -10,23 +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(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "exceptions") +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -TestUtil.clientServerTest(name) +TestUtil.clientServerTest() print "tests with AMD server." -TestUtil.clientServerTestWithOptionsAndNames(name, "", "", "serveramd", "client") +TestUtil.clientServerTest(server = "serveramd") print "tests with collocated server." -TestUtil.collocatedTest(name) -sys.exit(0) +TestUtil.collocatedTest() diff --git a/cpp/test/Ice/facets/run.py b/cpp/test/Ice/facets/run.py index b3afa6aeb5f..dcb8454ad37 100755 --- a/cpp/test/Ice/facets/run.py +++ b/cpp/test/Ice/facets/run.py @@ -10,19 +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") - -TestUtil.clientServerTest(name) -TestUtil.collocatedTest(name) -sys.exit(0) +TestUtil.clientServerTest() +TestUtil.collocatedTest() diff --git a/cpp/test/Ice/faultTolerance/run.py b/cpp/test/Ice/faultTolerance/run.py index 5b579189936..a1daf4cd8c6 100755 --- a/cpp/test/Ice/faultTolerance/run.py +++ b/cpp/test/Ice/faultTolerance/run.py @@ -10,32 +10,26 @@ 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__)) - -server = os.path.join(testdir, "server") -client = os.path.join(testdir, "client") +server = os.path.join(os.getcwd(), "server") +client = os.path.join(os.getcwd(), "client") num = 12 base = 12340 +serverProc = [] for i in range(0, num): print "starting server #%d..." % (i + 1), - serverPipe = TestUtil.startServer(server, "%d" % (base + i)) - TestUtil.getServerPid(serverPipe) - TestUtil.getAdapterReady(serverPipe) + serverProc.append(TestUtil.startServer(server, "%d" % (base + i))) print "ok" ports = "" @@ -43,15 +37,9 @@ for i in range(0, num): ports = "%s %d" % (ports, base + i) print "starting client...", -clientPipe = TestUtil.startClient(client, ports) +clientProc = TestUtil.startClient(client, ports) print "ok" -TestUtil.printOutputFromPipe(clientPipe) -clientStatus = TestUtil.closePipe(clientPipe) -if clientStatus: - TestUtil.killServers() - -if clientStatus or TestUtil.serverStatus(): - sys.exit(1) - -sys.exit(0) +clientProc.waitTestSuccess() +for p in serverProc: + p.waitTestSuccess() diff --git a/cpp/test/Ice/gc/run.py b/cpp/test/Ice/gc/run.py index bef91a20641..eadf5ac6359 100755 --- a/cpp/test/Ice/gc/run.py +++ b/cpp/test/Ice/gc/run.py @@ -10,34 +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() +client = os.path.join(os.getcwd(), "client") -name = os.path.join("Ice", "gc") -testdir = os.path.dirname(os.path.abspath(__file__)) - -client = os.path.join(testdir, "client") - -print "starting client...", -seedfile = testdir + "/seed" -clientPipe = TestUtil.startClient(client, seedfile) -print "ok" - -TestUtil.printOutputFromPipe(clientPipe) - -clientStatus = TestUtil.closePipe(clientPipe) - -if clientStatus: - sys.exit(1) +seedfile = os.path.join(os.getcwd(), "seed") +TestUtil.simpleTest(client, seedfile) +TestUtil.startClient(client, seedfile) os.remove(seedfile) - -sys.exit(0) diff --git a/cpp/test/Ice/hold/run.py b/cpp/test/Ice/hold/run.py index e67fb9482ac..2a3d5ec3417 100755 --- a/cpp/test/Ice/hold/run.py +++ b/cpp/test/Ice/hold/run.py @@ -10,18 +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") - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/cpp/test/Ice/inheritance/run.py b/cpp/test/Ice/inheritance/run.py index 7ecff0e5ae5..dcb8454ad37 100755 --- a/cpp/test/Ice/inheritance/run.py +++ b/cpp/test/Ice/inheritance/run.py @@ -10,19 +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") - -TestUtil.clientServerTest(name) -TestUtil.collocatedTest(name) -sys.exit(0) +TestUtil.clientServerTest() +TestUtil.collocatedTest() diff --git a/cpp/test/Ice/interceptor/run.py b/cpp/test/Ice/interceptor/run.py index 60ee1442e7b..c4dd7cac8ef 100755 --- a/cpp/test/Ice/interceptor/run.py +++ b/cpp/test/Ice/interceptor/run.py @@ -10,30 +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() +client = os.path.join(os.getcwd(), "client") -testdir = os.path.dirname(os.path.abspath(__file__)) - -client = os.path.join(testdir, "client") - -print "starting client...", -clientPipe = TestUtil.startClient(client, " --Ice.Warn.Dispatch=0") -print "ok" - -TestUtil.printOutputFromPipe(clientPipe); - -clientStatus = TestUtil.closePipe(clientPipe) - -if clientStatus: - sys.exit(1) - -sys.exit(0) +TestUtil.simpleTest(client, " --Ice.Warn.Dispatch=0") diff --git a/cpp/test/Ice/location/run.py b/cpp/test/Ice/location/run.py index 177ebe2fb41..2a3d5ec3417 100755 --- a/cpp/test/Ice/location/run.py +++ b/cpp/test/Ice/location/run.py @@ -10,18 +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") - -TestUtil.mixedClientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/cpp/test/Ice/objects/run.py b/cpp/test/Ice/objects/run.py index 81b178ba4f4..dcb8454ad37 100755 --- a/cpp/test/Ice/objects/run.py +++ b/cpp/test/Ice/objects/run.py @@ -10,19 +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") - -TestUtil.clientServerTest(name) -TestUtil.collocatedTest(name) -sys.exit(0) +TestUtil.clientServerTest() +TestUtil.collocatedTest() diff --git a/cpp/test/Ice/operations/run.py b/cpp/test/Ice/operations/run.py index 04d358c2981..7a6571b96fb 100755 --- a/cpp/test/Ice/operations/run.py +++ b/cpp/test/Ice/operations/run.py @@ -10,23 +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(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "operations") +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -TestUtil.clientServerTest(name) +TestUtil.clientServerTest() print "tests with AMD server." -TestUtil.clientServerTestWithOptionsAndNames(name, "", "", "serveramd", "client") +TestUtil.clientServerTest(server = "serveramd") print "tests with collocated server." -TestUtil.collocatedTest(name) -sys.exit(0) +TestUtil.collocatedTest() diff --git a/cpp/test/Ice/proxy/run.py b/cpp/test/Ice/proxy/run.py index f991276d917..7a6571b96fb 100755 --- a/cpp/test/Ice/proxy/run.py +++ b/cpp/test/Ice/proxy/run.py @@ -10,23 +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(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "proxy") +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -TestUtil.clientServerTest(name) +TestUtil.clientServerTest() print "tests with AMD server." -TestUtil.clientServerTestWithOptionsAndNames(name, "", "", "serveramd", "client") +TestUtil.clientServerTest(server = "serveramd") print "tests with collocated server." -TestUtil.collocatedTest(name) -sys.exit(0) +TestUtil.collocatedTest() diff --git a/cpp/test/Ice/retry/run.py b/cpp/test/Ice/retry/run.py index f0bc8d57120..2a3d5ec3417 100755 --- a/cpp/test/Ice/retry/run.py +++ b/cpp/test/Ice/retry/run.py @@ -10,18 +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") - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/cpp/test/Ice/servantLocator/run.py b/cpp/test/Ice/servantLocator/run.py index 527b3b391e9..7a6571b96fb 100755 --- a/cpp/test/Ice/servantLocator/run.py +++ b/cpp/test/Ice/servantLocator/run.py @@ -10,23 +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(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "servantLocator") +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -TestUtil.clientServerTest(name) +TestUtil.clientServerTest() print "tests with AMD server." -TestUtil.clientServerTestWithOptionsAndNames(name, "", "", "serveramd", "client") +TestUtil.clientServerTest(server = "serveramd") print "tests with collocated server." -TestUtil.collocatedTest(name) -sys.exit(0) +TestUtil.collocatedTest() diff --git a/cpp/test/Ice/slicing/exceptions/run.py b/cpp/test/Ice/slicing/exceptions/run.py index e5effa1c47e..06cad1cbbaf 100755 --- a/cpp/test/Ice/slicing/exceptions/run.py +++ b/cpp/test/Ice/slicing/exceptions/run.py @@ -10,21 +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(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "slicing", "exceptions") +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -TestUtil.clientServerTest(name) +TestUtil.clientServerTest() print "tests with AMD server." -TestUtil.clientServerTestWithOptionsAndNames(name, "", "", "serveramd", "client") -sys.exit(0) +TestUtil.clientServerTest(server = "serveramd") diff --git a/cpp/test/Ice/slicing/objects/run.py b/cpp/test/Ice/slicing/objects/run.py index 11ef0384e8f..724e3a442d8 100755 --- a/cpp/test/Ice/slicing/objects/run.py +++ b/cpp/test/Ice/slicing/objects/run.py @@ -10,21 +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(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "slicing", "objects") +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -TestUtil.clientServerTest(name) +TestUtil.clientServerTest() print "tests with AMD server." -TestUtil.clientServerTestWithOptionsAndNames(name, "", "", "serveramd", "client") -sys.exit(0) +TestUtil.clientServerTest(server = "serveramd") diff --git a/cpp/test/Ice/stream/run.py b/cpp/test/Ice/stream/run.py index 05426ad10cc..77ac29f681b 100755 --- a/cpp/test/Ice/stream/run.py +++ b/cpp/test/Ice/stream/run.py @@ -10,29 +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() - -client = os.path.join(os.path.dirname(os.path.abspath(__file__)), "client") - -print "starting test...", -clientPipe = TestUtil.startClient(client, "") -print "ok" - -TestUtil.printOutputFromPipe(clientPipe) - -clientStatus = TestUtil.closePipe(clientPipe) - -if clientStatus: - TestUtil.killServers() - sys.exit(1) - -sys.exit(0) +client = os.path.join(os.getcwd(), "client") +TestUtil.simpleTest(client) diff --git a/cpp/test/Ice/stringConverter/run.py b/cpp/test/Ice/stringConverter/run.py index 2625cd6ad55..9f8771562c1 100755 --- a/cpp/test/Ice/stringConverter/run.py +++ b/cpp/test/Ice/stringConverter/run.py @@ -10,30 +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() +client = os.path.join(os.getcwd(), "client") -testdir = os.path.dirname(os.path.abspath(__file__)) - -client = os.path.join(testdir, "client") - -print "starting client...", -clientPipe = TestUtil.startClient(client, "") -print "ok" - -TestUtil.printOutputFromPipe(clientPipe); - -clientStatus = TestUtil.closePipe(clientPipe) - -if clientStatus: - sys.exit(1) - -sys.exit(0) +TestUtil.simpleTest(client) diff --git a/cpp/test/Ice/timeout/run.py b/cpp/test/Ice/timeout/run.py index f04e73b903a..2a3d5ec3417 100755 --- a/cpp/test/Ice/timeout/run.py +++ b/cpp/test/Ice/timeout/run.py @@ -10,18 +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") - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/cpp/test/IceBox/configuration/run.py b/cpp/test/IceBox/configuration/run.py index 2b8faa2881a..8f185089727 100755 --- a/cpp/test/IceBox/configuration/run.py +++ b/cpp/test/IceBox/configuration/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() -import IceGridAdmin +icebox = TestUtil.getIceBox() -name = os.path.join("IceBox", "configuration") -testdir = os.path.dirname(os.path.abspath(__file__)) -icebox = TestUtil.getIceBox(testdir); +config = os.path.join(os.getcwd(), "config.icebox") +config2 = os.path.join(os.getcwd(), "config.icebox2") -TestUtil.addLdPath(testdir) - -cwd = os.getcwd() -os.chdir(testdir) - -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" % config, server = icebox) +TestUtil.clientServerTest(additionalServerOptions= "--Ice.Config=%s" % config2, server = icebox) diff --git a/cpp/test/IceGrid/activation/run.py b/cpp/test/IceGrid/activation/run.py index e1ed94de1f6..9c610f62b73 100755 --- a/cpp/test/IceGrid/activation/run.py +++ b/cpp/test/IceGrid/activation/run.py @@ -10,22 +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() -import IceGridAdmin - -name = os.path.join("IceGrid", "activation") - - -IceGridAdmin.iceGridTest(os.path.dirname(os.path.abspath(__file__)), name, "application.xml", "", \ - ' \'properties-override=' + \ - TestUtil.getCommandLine("", TestUtil.DriverConfig("colloc")).replace("--", "") + '\'') -sys.exit(0) +IceGridAdmin.iceGridTest("application.xml", "", + " 'properties-override=%s'" % TestUtil.getCommandLine("", TestUtil.DriverConfig("colloc")).replace("--", "")) diff --git a/cpp/test/IceGrid/allocation/run.py b/cpp/test/IceGrid/allocation/run.py index 36e87f4808f..6cd0ff45c47 100755 --- a/cpp/test/IceGrid/allocation/run.py +++ b/cpp/test/IceGrid/allocation/run.py @@ -10,19 +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() -import IceGridAdmin - -name = os.path.join("IceGrid", "allocation") - -IceGridAdmin.iceGridTest(os.path.dirname(os.path.abspath(__file__)), name, "application.xml") -sys.exit(0) +IceGridAdmin.iceGridTest("application.xml") diff --git a/cpp/test/IceGrid/deployer/run.py b/cpp/test/IceGrid/deployer/run.py index 62d8f8d6523..a8bd1a543c7 100755 --- a/cpp/test/IceGrid/deployer/run.py +++ b/cpp/test/IceGrid/deployer/run.py @@ -10,31 +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 IceGridAdmin - -name = os.path.join("IceGrid", "deployer") -testdir = os.path.dirname(os.path.abspath(__file__)) - -TestUtil.addLdPath(testdir) - -iceBox = TestUtil.getIceBox(testdir) - -IceGridAdmin.iceGridTest(testdir, name, "application.xml", "--TestDir=\"" + testdir + "\"", \ - '"icebox.exe=' + TestUtil.getIceBox(testdir) + '"') +IceGridAdmin.iceGridTest("application.xml", '--TestDir="%s"' % os.getcwd(), '"icebox.exe=%s"' % TestUtil.getIceBox()) # Tests with targets -IceGridAdmin.iceGridTest(testdir, name, "application.xml", "-t --TestDir=\"" + testdir + "\"", \ - "icebox.exe=" + TestUtil.getIceBox(testdir) + \ - " moreservers moreservices moreproperties") - -sys.exit(0) +IceGridAdmin.iceGridTest("application.xml", '-t --TestDir="%s"' % os.getcwd(), + "icebox.exe=%s moreservers moreservices moreproperties" % TestUtil.getIceBox()) diff --git a/cpp/test/IceGrid/distribution/run.py b/cpp/test/IceGrid/distribution/run.py index 086147b34cd..5be7fe4cbad 100755 --- a/cpp/test/IceGrid/distribution/run.py +++ b/cpp/test/IceGrid/distribution/run.py @@ -10,35 +10,25 @@ 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 +sys.path.append(os.path.join(path[0])) +from scripts import * def icepatch2Calc(datadir, dirname): icePatch2Calc = os.path.join(TestUtil.getCppBinDir(), "icepatch2calc") - commandPipe = os.popen(icePatch2Calc + " " + os.path.join(datadir, dirname) + " 2>&1") - - TestUtil.printOutputFromPipe(commandPipe) - - commandStatus = TestUtil.closePipe(commandPipe) - if commandStatus: - sys.exit(1) + commandProc = TestUtil.spawn(icePatch2Calc + " " + os.path.join(datadir, dirname)) + commandProc.waitTestSuccess() -name = os.path.join("IceGrid", "distribution") - -testdir = os.path.dirname(os.path.abspath(__file__)) -datadir = os.path.join(testdir, "data") +datadir = os.path.join(os.getcwd(), "data") -files = [ \ +files = [ [ "original/rootfile", "rootfile" ], [ "original/dir1/file1", "dummy-file1"], [ "original/dir1/file2", "dummy-file2"], @@ -68,9 +58,7 @@ icepatch2Calc(datadir, "original") icepatch2Calc(datadir, "updated") print "ok" -IceGridAdmin.iceGridTest(testdir, name, "application.xml", "") +IceGridAdmin.iceGridTest("application.xml") IceGridAdmin.cleanDbDir(datadir) os.rmdir(datadir) - -sys.exit(0) diff --git a/cpp/test/IceGrid/replicaGroup/run.py b/cpp/test/IceGrid/replicaGroup/run.py index d5fa8c36514..da462144db3 100755 --- a/cpp/test/IceGrid/replicaGroup/run.py +++ b/cpp/test/IceGrid/replicaGroup/run.py @@ -10,23 +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() -import IceGridAdmin - -name = os.path.join("IceGrid", "replicaGroup") -testdir = os.path.dirname(os.path.abspath(__file__)) - -TestUtil.addLdPath(testdir) - -IceGridAdmin.iceGridTest(testdir, name, "application.xml", "--Ice.RetryIntervals=\"0 50 100 250\"", \ - "icebox.exe=" + TestUtil.getIceBox(testdir)) -sys.exit(0) +IceGridAdmin.iceGridTest("application.xml", "--Ice.RetryIntervals=\"0 50 100 250\"", + "icebox.exe=%s" % TestUtil.getIceBox()) diff --git a/cpp/test/IceGrid/replication/run.py b/cpp/test/IceGrid/replication/run.py index ff0420899dc..1311d8675ff 100755 --- a/cpp/test/IceGrid/replication/run.py +++ b/cpp/test/IceGrid/replication/run.py @@ -10,24 +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 +TestUtil.addLdPath(os.getcwd()) -name = os.path.join("IceGrid", "replication") -testdir = os.path.dirname(os.path.abspath(__file__)) - -TestUtil.addLdPath(testdir) - -IceGridAdmin.iceGridTest(testdir, name, "application.xml", "--IceDir=\"" + toplevel + "\" --TestDir=\"" + testdir + "\"", \ - ' \'properties-override=' + \ - TestUtil.getCommandLine("", TestUtil.DriverConfig("server")).replace("--", "") + '\'') -sys.exit(0) +IceGridAdmin.iceGridTest("application.xml", '--IceDir="%s" --TestDir="%s"' % (TestUtil.toplevel, os.getcwd()), + ' \'properties-override=\'%s\'' % TestUtil.getCommandLine("", TestUtil.DriverConfig("server")).replace("--", "")) diff --git a/cpp/test/IceGrid/session/run.py b/cpp/test/IceGrid/session/run.py index 540c86f7294..8d0237620c0 100755 --- a/cpp/test/IceGrid/session/run.py +++ b/cpp/test/IceGrid/session/run.py @@ -10,17 +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(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() -import IceGridAdmin +sys.path.append(os.path.join(path[0])) +from scripts import * if not TestUtil.isWin32() and os.getuid() == 0: print @@ -29,18 +27,15 @@ if not TestUtil.isWin32() and os.getuid() == 0: sys.exit(0) name = os.path.join("IceGrid", "session") -testdir = os.path.dirname(os.path.abspath(__file__)) -node1Dir = os.path.join(testdir, "db", "node-1") +node1Dir = os.path.join(os.getcwd(), "db", "node-1") if not os.path.exists(node1Dir): os.mkdir(node1Dir) else: IceGridAdmin.cleanDbDir(node1Dir) print "starting admin permissions verifier...", -verifierPipe = TestUtil.startServer(os.path.join(testdir, "verifier"), " 2>&1", TestUtil.DriverConfig("server")) -TestUtil.getServerPid(verifierPipe) -TestUtil.getAdapterReady(verifierPipe) +verifierProc = TestUtil.startServer(os.path.join(os.getcwd(), "verifier"), config=TestUtil.DriverConfig("server")) print "ok" IceGridAdmin.registryOptions += \ @@ -51,11 +46,8 @@ IceGridAdmin.registryOptions += \ r' --IceGrid.Registry.AdminPermissionsVerifier="AdminPermissionsVerifier:tcp -p 12002"'+ \ r' --IceGrid.Registry.SSLPermissionsVerifier="SSLPermissionsVerifier"' -IceGridAdmin.iceGridTest(testdir, name, "application.xml", \ - "--IceBinDir=\"" + TestUtil.getCppBinDir() + "\" --TestDir=\"" + testdir + "\"", \ - '\\"properties-override=' + \ - TestUtil.getCommandLine("", TestUtil.DriverConfig("server")).replace("--", "") + '\\"') - -status = TestUtil.closePipe(verifierPipe) +IceGridAdmin.iceGridTest("application.xml", + '--IceBinDir="%s" --TestDir="%s"' % (TestUtil.getCppBinDir(), os.getcwd()), + '\\"properties-override=%s\\"' % TestUtil.getCommandLine("", TestUtil.DriverConfig("server")).replace("--", "")) -sys.exit(0) +verifierProc.waitTestSuccess() diff --git a/cpp/test/IceGrid/simple/run.py b/cpp/test/IceGrid/simple/run.py index b42a2ce003a..0da9b34fbb8 100755 --- a/cpp/test/IceGrid/simple/run.py +++ b/cpp/test/IceGrid/simple/run.py @@ -10,29 +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 - -name = os.path.join("IceGrid", "simple") -testdir = os.path.dirname(os.path.abspath(__file__)) +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/cpp/test/IceGrid/update/run.py b/cpp/test/IceGrid/update/run.py index 72d34fe748b..38284add9c2 100755 --- a/cpp/test/IceGrid/update/run.py +++ b/cpp/test/IceGrid/update/run.py @@ -10,37 +10,33 @@ 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 +sys.path.append(os.path.join(path[0])) +from scripts import * name = os.path.join("IceGrid", "update") -testdir = os.path.dirname(os.path.abspath(__file__)) -node1Dir = os.path.join(testdir, "db", "node-1") +node1Dir = os.path.join(os.getcwd(), "db", "node-1") if not os.path.exists(node1Dir): os.mkdir(node1Dir) else: IceGridAdmin.cleanDbDir(node1Dir) -node2Dir = os.path.join(testdir, "db", "node-2") +node2Dir = os.path.join(os.getcwd(), "db", "node-2") if not os.path.exists(node2Dir): os.mkdir(node2Dir) else: IceGridAdmin.cleanDbDir(node2Dir) -nodeOverrideOptions = "--IceBinDir=\"" + TestUtil.getCppBinDir() + "\" --TestDir=\"" + testdir + "\"" + \ - ' --NodePropertiesOverride="' + \ - TestUtil.getCommandLine("", TestUtil.DriverConfig("server")).replace("--", "") + \ - ' Ice.ServerIdleTime=0 Ice.PrintProcessId=0 Ice.PrintAdapterReady=0' + '"' +nodeOverrideOptions = '--IceBinDir="%s" --TestDir="%s" --NodePropertiesOverride="%s Ice.ServerIdleTime=0 Ice.PrintProcessId=0 Ice.PrintAdapterReady=0"' % ( + TestUtil.getCppBinDir(), + os.getcwd(), + TestUtil.getCommandLine("", TestUtil.DriverConfig("server")).replace("--", "")) -IceGridAdmin.iceGridTest(testdir, name, "", nodeOverrideOptions) -sys.exit(0) +IceGridAdmin.iceGridTest("", nodeOverrideOptions) diff --git a/cpp/test/IceSSL/configuration/run.py b/cpp/test/IceSSL/configuration/run.py index 9831ce15e62..ea03f6d3458 100755 --- a/cpp/test/IceSSL/configuration/run.py +++ b/cpp/test/IceSSL/configuration/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("IceSSL", "configuration") - -testdir = os.path.dirname(os.path.abspath(__file__)) - -TestUtil.clientServerTestWithOptions(name, "", " " + testdir) -sys.exit(0) +TestUtil.clientServerTest(additionalClientOptions = os.getcwd()) diff --git a/cpp/test/IceStorm/federation/run.py b/cpp/test/IceStorm/federation/run.py index 90bae2f31eb..0ac696e5d81 100755 --- a/cpp/test/IceStorm/federation/run.py +++ b/cpp/test/IceStorm/federation/run.py @@ -11,26 +11,20 @@ import os, sys import time -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("IceStorm", "federation") -testdir = os.path.dirname(os.path.abspath(__file__)) - -import IceStormUtil +sys.path.append(os.path.join(path[0])) +from scripts import * def doTest(icestorm, batch): - publisher = os.path.join(testdir, "publisher") - subscriber = os.path.join(testdir, "subscriber") + publisher = os.path.join(os.getcwd(), "publisher") + subscriber = os.path.join(os.getcwd(), "subscriber") if batch: name = "batch subscriber" @@ -39,25 +33,18 @@ def doTest(icestorm, batch): name = "subscriber" batchOptions = "" - subscriberPipe = TestUtil.startServer(subscriber, batchOptions + icestorm.reference() + " 2>&1") - TestUtil.getServerPid(subscriberPipe) - TestUtil.getAdapterReady(subscriberPipe) + subscriberProc = TestUtil.startServer(subscriber, batchOptions + icestorm.reference()) # # Start the publisher. This should publish events which eventually # causes subscriber to terminate. # - publisherPipe = TestUtil.startClient(publisher, icestorm.reference() + " 2>&1") - - TestUtil.printOutputFromPipe(publisherPipe) - - subscriberStatus = TestUtil.specificServerStatus(subscriberPipe, 30) - publisherStatus = TestUtil.closePipe(publisherPipe) - - return subscriberStatus or publisherStatus + publisherProc = TestUtil.startClient(publisher, icestorm.reference()) + subscriberProc.waitTestSuccess() + publisherProc.waitTestSuccess() def runtest(type, **args): - icestorm = IceStormUtil.init(toplevel, testdir, type, **args) + icestorm = IceStormUtil.init(TestUtil.toplevel, os.getcwd(), type, **args) icestorm.start() @@ -71,7 +58,7 @@ def runtest(type, **args): # print "testing oneway subscribers...", sys.stdout.flush() - onewayStatus = doTest(icestorm, 0) + doTest(icestorm, 0) print "ok" # @@ -79,7 +66,7 @@ def runtest(type, **args): # print "testing batch subscribers...", sys.stdout.flush() - batchStatus = doTest(icestorm, 1) + doTest(icestorm, 1) print "ok" # @@ -94,13 +81,7 @@ def runtest(type, **args): # icestorm.stop() - if TestUtil.serverStatus() or onewayStatus or batchStatus: - TestUtil.killServers() - sys.exit(1) - runtest("persistent") runtest("transient") runtest("replicated", replicatedPublisher = False) runtest("replicated", replicatedPublisher = True) - -sys.exit(0) diff --git a/cpp/test/IceStorm/federation2/run.py b/cpp/test/IceStorm/federation2/run.py index f8cc85ac932..55d931c2e65 100755 --- a/cpp/test/IceStorm/federation2/run.py +++ b/cpp/test/IceStorm/federation2/run.py @@ -10,63 +10,29 @@ import os, sys, time, threading, re -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("IceStorm", "federation2") -testdir = os.path.dirname(os.path.abspath(__file__)) - -import IceStormUtil - -iceBox = TestUtil.getIceBox(testdir) -iceBoxAdmin = os.path.join(TestUtil.getCppBinDir(), "iceboxadmin") iceStormAdmin = os.path.join(TestUtil.getCppBinDir(), "icestormadmin") -publisher = os.path.join(testdir, "publisher") -subscriber = os.path.join(testdir, "subscriber") +publisher = os.path.join(os.getcwd(), "publisher") +subscriber = os.path.join(os.getcwd(), "subscriber") def admin(ref, command): - pipe = TestUtil.startClient(iceStormAdmin, ref + r' -e "%s"' % command) - all = "" - while True: - line = pipe.readline(); - if not line: - break - all = all + line - status = TestUtil.closePipe(pipe) - if status: - TestUtil.killServers() - sys.exit(1) - return all - -def printOutput(pipe): - try: - while True: - line = pipe.readline() - if not line: - break - print line, - sys.stdout.flush() - except IOError: - pass + proc = TestUtil.startClient(iceStormAdmin, ref + ' -e "%s"' % command, echo = False) + proc.waitTestSuccess() + return proc.buf def runPublisher(icestorm1, opt = ""): - publisherPipe = TestUtil.startClient(publisher, opt + icestorm1.reference()) - - printOutput(publisherPipe) - - publisherStatus = TestUtil.closePipe(publisherPipe) - if publisherStatus: - TestUtil.killServers() - sys.exit(1) + proc = TestUtil.startClient(publisher, opt + icestorm1.reference()) + proc.waitTestSuccess() def doTest(icestorm1, icestorm2, batch, subscriberRef = None): if batch: @@ -79,9 +45,7 @@ def doTest(icestorm1, icestorm2, batch, subscriberRef = None): if subscriberRef == None: subscriberRef = icestorm2.reference() - subscriberPipe = TestUtil.startServer(subscriber, batchOptions + subscriberRef) - TestUtil.getServerPid(subscriberPipe) - TestUtil.getAdapterReady(subscriberPipe) + subscriberProc = TestUtil.startServer(subscriber, batchOptions + subscriberRef) # # Start the publisher. This should publish events which eventually @@ -89,8 +53,7 @@ def doTest(icestorm1, icestorm2, batch, subscriberRef = None): # runPublisher(icestorm1) - subscriberStatus = TestUtil.specificServerStatus(subscriberPipe, 30) - return subscriberStatus + subscriberProc.waitTestSuccess(timeout=30) # # Test #1: @@ -99,10 +62,10 @@ def doTest(icestorm1, icestorm2, batch, subscriberRef = None): # published between them correctly. # def runtest(type, **args): - icestorm1 = IceStormUtil.init(toplevel, testdir, type, additional = '--IceStorm.Discard.Interval=2', + icestorm1 = IceStormUtil.init(TestUtil.toplevel, os.getcwd(), type, additional = '--IceStorm.Discard.Interval=2', dbDir = "db", instanceName = "TestIceStorm1", port = 12000, **args) icestorm1.start() - icestorm2 = IceStormUtil.init(toplevel, testdir, type, additional = '--IceStorm.Discard.Interval=2', + icestorm2 = IceStormUtil.init(TestUtil.toplevel, os.getcwd(), type, additional = '--IceStorm.Discard.Interval=2', dbDir = "db2", instanceName = "TestIceStorm2", port = 12500, **args) icestorm2.start() @@ -119,7 +82,7 @@ def runtest(type, **args): # print "testing federation with oneway subscribers...", sys.stdout.flush() - onewayStatus = doTest(icestorm1, icestorm2, 0) + doTest(icestorm1, icestorm2, 0) print "ok" # @@ -127,13 +90,9 @@ def runtest(type, **args): # print "testing federation with batch subscribers...", sys.stdout.flush() - batchStatus = doTest(icestorm1, icestorm2, 1) + doTest(icestorm1, icestorm2, 1) print "ok" - if onewayStatus or batchStatus: - TestUtil.killServers() - sys.exit(1) - # # Test #2: # @@ -158,7 +117,7 @@ def runtest(type, **args): # print "retesting federation with oneway subscribers... ", sys.stdout.flush() - onewayStatus = doTest(icestorm1, icestorm2, 0) + doTest(icestorm1, icestorm2, 0) print "ok" # @@ -166,13 +125,9 @@ def runtest(type, **args): # print "retesting federation with batch subscribers... ", sys.stdout.flush() - batchStatus = doTest(icestorm1, icestorm2, 1) + doTest(icestorm1, icestorm2, 1) print "ok" - if onewayStatus or batchStatus: - TestUtil.killServers() - sys.exit(1) - # # Shutdown icestorm. # @@ -180,61 +135,6 @@ def runtest(type, **args): icestorm2.stop() # - # This is used by the below test to confirm that the link warning is - # emitted. This class conforms with the TestUtil.ReaderThread protocol. - # - class ExpectorThread(threading.Thread): - def __init__(self, pipe): - self.mutex = threading.Lock() - self.pipe = pipe - # Suppress "adapter ready" messages. Under windows the eol isn't \n. - self.re = [ [ re.compile(" ready\r?\n$"), 0 ] ] - threading.Thread.__init__(self) - - def run(self): - try: - while 1: - line = self.pipe.readline() - if not line: break - found = False - self.mutex.acquire() - for item in self.re: - if item[0].search(line): - found = True - item[1] = item[1] + 1 - break - self.mutex.release() - if not found: - print line, - except IOError: - pass - - self.status = TestUtil.closePipe(self.pipe) - - # To comply with the ReaderThread protocol. - def getPipe(self): - return self.pipe - - # To comply with the ReaderThread protocol. - def getStatus(self): - return self.status - - def matches(self, index): - self.mutex.acquire() - m = self.re[index][1] - self.mutex.release() - return m - - def expect(self, r): - self.mutex.acquire() - self.re.append([r, 0]) - l = len(self.re)-1 - self.mutex.release() - return l - - # - # Test #3: - # # Restart the first server and publish some events. Attach a # subscriber to the channel and make sure the events are received. # @@ -244,14 +144,10 @@ def runtest(type, **args): if type != "replicated": print "restarting only one IceStorm server...", sys.stdout.flush() - pipe = icestorm1.start(echo=False, createThread = False) - expectorThread = ExpectorThread(pipe) - expectorThread.start() - global serverThreads - - TestUtil.serverThreads.append(expectorThread) - index = expectorThread.expect(re.compile("topic.fed1.*subscriber offline")) - expectorThread.expect(re.compile("connection refused")) + proc = icestorm1.start(echo=False) + + #proc.expect("topic.fed1.*subscriber offline") + #proc.expect("connection refused") print "ok" # @@ -259,14 +155,12 @@ def runtest(type, **args): # print "testing that the federation link reports an error...", sys.stdout.flush() - onewayStatus = doTest(icestorm1, icestorm2, 0, icestorm1.reference()) + doTest(icestorm1, icestorm2, 0, icestorm1.reference()) # Give some time for the output to be sent. time.sleep(2) - if onewayStatus or expectorThread.matches(index) != 1: - TestUtil.killServers() - sys.exit(1) + proc.expect("topic.fed1.*subscriber offline") print "ok" print "starting downstream icestorm server...", @@ -284,12 +178,14 @@ def runtest(type, **args): # print "testing link is reestablished...", sys.stdout.flush() - onewayStatus = doTest(icestorm1, icestorm2, 0) + doTest(icestorm1, icestorm2, 0) print "ok" - if onewayStatus or expectorThread.matches(index) != 1: - TestUtil.killServers() - sys.exit(1) + try: + proc.expect("topic.fed1.*subscriber offline") + assert False + except Expect.TIMEOUT: + pass icestorm1.stop() icestorm2.stop() @@ -316,7 +212,6 @@ def runtest(type, **args): line = admin(adminIceStormReference, "links TestIceStorm1") if not re.compile("fed1 with cost 0").search(line): print line - TestUtil.killServers() sys.exit(1) print "ok" diff --git a/cpp/test/IceStorm/rep1/run.py b/cpp/test/IceStorm/rep1/run.py index 37cbfa6a857..0e11a8602c9 100755 --- a/cpp/test/IceStorm/rep1/run.py +++ b/cpp/test/IceStorm/rep1/run.py @@ -10,45 +10,19 @@ import os, sys, time, re -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("IceStorm", "rep1") -testdir = os.path.dirname(os.path.abspath(__file__)) -publisher = os.path.join(testdir, "publisher") -subscriber = os.path.join(testdir, "subscriber") -subscriber2 = os.path.join(testdir, "sub") - -def printOutput(pipe): - try: - while True: - line = pipe.readline() - if not line: - break - print line, - sys.stdout.flush() - except IOError: - pass - -def captureOutput(pipe): - out = "" - try: - while True: - line = pipe.readline() - if not line: - break - out = out + line - except IOError: - pass - return out +publisher = os.path.join(os.getcwd(), "publisher") +subscriber = os.path.join(os.getcwd(), "subscriber") +subscriber2 = os.path.join(os.getcwd(), "sub") def runsub(opt, ref, arg = "", echo=False): qos = "" @@ -56,53 +30,42 @@ def runsub(opt, ref, arg = "", echo=False): qos = " --twoway" if opt == "ordered": qos = " --ordered" - pipe = TestUtil.startServer(subscriber, ref + arg + qos) - TestUtil.getServerPid(pipe) - TestUtil.getAdapterReady(pipe, True) - return pipe + 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=""): - subscriberPipe = runsub(opt, ref, subopt) - publisherPipe = runpub(ref, pubopt) - printOutput(publisherPipe) - publisherStatus = TestUtil.closePipe(publisherPipe) - subscriberStatus = TestUtil.specificServerStatus(subscriberPipe, 30) - if subscriberStatus or publisherStatus: - print "FAILED!" - while True: - import time - time.sleep(1000) - TestUtil.killServers() - sys.exit(1) - -def runsub2(replica = -1, cmd = "", terminateOnError=True): - pipe = TestUtil.startServer(subscriber2, icestorm.reference(replica) + ' --id foo' + cmd) - TestUtil.getServerPid(pipe) - #TestUtil.getAdapterReady(pipe, True) - out = captureOutput(pipe) - status = TestUtil.closePipe(pipe) - if terminateOnError and status: - print "status: %d out: '%s'" % (status, out) - TestUtil.killServers() - sys.exit(1) - return status, out.strip() - -def rununsub2(replica = -1, terminateOnError=True): + subscriberProc = runsub(opt, ref, subopt) + publisherProc = runpub(ref, pubopt) + publisherProc.waitTestSuccess() + subscriberProc.waitTestSuccess(timeout=30) + +def runsub2(replica = -1, expect = None): + proc = TestUtil.startServer(subscriber2, icestorm.reference(replica) + ' --id foo', count=0) + if expect: + proc.expect(expect) + proc.wait() + else: + proc.waitTestSuccess() + +def rununsub2(replica = -1, expect = None): if replica == -1: - runsub2(replica, " --unsub", terminateOnError) + 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. - status, out = runsub2(replica, terminateOnError=terminateOnError) - if status: - return status, out - return runsub2(replica, " --unsub", terminateOnError=terminateOnError) - -import IceStormUtil - -icestorm = IceStormUtil.init(toplevel, testdir, "replicated", replicatedPublisher=True, additional = + proc = TestUtil.startServer(subscriber2, icestorm.reference(replica) + ' --id foo', count=0) + 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() + +icestorm = IceStormUtil.init(TestUtil.toplevel, os.getcwd(), "replicated", replicatedPublisher=True, additional = ' --IceStorm.Election.MasterTimeout=2' + ' --IceStorm.Election.ElectionTimeout=2' + ' --IceStorm.Election.ResponseTimeout=2') @@ -113,10 +76,7 @@ sys.stdout.flush() icestorm.admin("create single") for replica in range(0, 3): - status, out = icestorm.adminForReplica(replica, "create single", terminateOnError=False) - if out != "error: topic `single' exists": - TestUtil.killServers() - sys.exit(1) + icestorm.adminForReplica(replica, "create single", "error: topic `single' exists") print "ok" print "testing topic destruction across replicas...", @@ -124,10 +84,7 @@ sys.stdout.flush() icestorm.admin("destroy single") for replica in range(0, 3): - status, out = icestorm.adminForReplica(replica, "destroy single", terminateOnError=False) - if out != "error: couldn't find topic `single'": - TestUtil.killServers() - sys.exit(1) + icestorm.adminForReplica(replica, "destroy single", "error: couldn't find topic `single'") print "ok" print "testing topic creation without replica...", @@ -137,22 +94,13 @@ icestorm.stopReplica(0) icestorm.admin("create single") for replica in range(1, 3): - status, out = icestorm.adminForReplica(replica, "create single", terminateOnError=False) - if out != "error: topic `single' exists": - TestUtil.killServers() - sys.exit(1) + icestorm.adminForReplica(replica, "create single", "error: topic `single' exists") -status, out = icestorm.adminForReplica(0, "create single", terminateOnError=False) -if not re.search("ConnectionRefused", out): - TestUtil.killServers() - sys.exit(1) +icestorm.adminForReplica(0, "create single", "ConnectionRefused") icestorm.startReplica(0, echo=False) -status, out = icestorm.adminForReplica(0, "create single", terminateOnError=False) -if out != "error: topic `single' exists": - TestUtil.killServers() - sys.exit(1) +icestorm.adminForReplica(0, "create single", "error: topic `single' exists") print "ok" icestorm.admin("destroy single") @@ -164,22 +112,13 @@ icestorm.stopReplica(2) icestorm.admin("create single") for replica in range(0, 2): - status, out = icestorm.adminForReplica(replica, "create single", terminateOnError=False) - if out != "error: topic `single' exists": - TestUtil.killServers() - sys.exit(1) + icestorm.adminForReplica(replica, "create single", "error: topic `single' exists") -status, out = icestorm.adminForReplica(2, "create single", terminateOnError=False) -if not re.search("ConnectionRefused", out): - TestUtil.killServers() - sys.exit(1) +icestorm.adminForReplica(2, "create single", "ConnectionRefused") icestorm.startReplica(2, echo=False) -status, out = icestorm.adminForReplica(2, "create single", terminateOnError=False) -if out != "error: topic `single' exists": - TestUtil.killServers() - sys.exit(1) +icestorm.adminForReplica(2, "create single", "error: topic `single' exists") print "ok" # All replicas are running @@ -191,23 +130,13 @@ icestorm.stopReplica(0) icestorm.admin("destroy single") for replica in range(1, 3): - status, out = icestorm.adminForReplica(replica, "destroy single", terminateOnError=False) - if out != "error: couldn't find topic `single'": - TestUtil.killServers() - sys.exit(1) + icestorm.adminForReplica(replica, "destroy single", "error: couldn't find topic `single'") -status, out = icestorm.adminForReplica(0, "destroy single", terminateOnError=False) -if not re.search("ConnectionRefused", out): - TestUtil.killServers() - sys.exit(1) +icestorm.adminForReplica(0, "destroy single", "ConnectionRefused") icestorm.startReplica(0, echo=False) -status, out = icestorm.adminForReplica(0, "destroy single", terminateOnError=False) -if out != "error: couldn't find topic `single'": - print out - TestUtil.killServers() - sys.exit(1) +icestorm.adminForReplica(0, "destroy single", "error: couldn't find topic `single'") print "ok" print "testing topic destruction without master...", @@ -219,22 +148,13 @@ icestorm.stopReplica(2) icestorm.admin("destroy single") for replica in range(0, 2): - status, out = icestorm.adminForReplica(replica, "destroy single", terminateOnError=False) - if out != "error: couldn't find topic `single'": - TestUtil.killServers() - sys.exit(1) + icestorm.adminForReplica(replica, "destroy single", "error: couldn't find topic `single'") -status, out = icestorm.adminForReplica(2, "destroy single", terminateOnError=False) -if not re.search("ConnectionRefused", out): - TestUtil.killServers() - sys.exit(1) +icestorm.adminForReplica(2, "destroy single", "ConnectionRefused") icestorm.startReplica(2, echo=False) -status, out = icestorm.adminForReplica(2, "destroy single", terminateOnError=False) -if out != "error: couldn't find topic `single'": - TestUtil.killServers() - sys.exit(1) +icestorm.adminForReplica(2, "destroy single", "error: couldn't find topic `single'") print "ok" # Now test subscription/unsubscription on all replicas. @@ -246,11 +166,7 @@ sys.stdout.flush() runsub2() for replica in range(0, 3): - status, out = runsub2(replica, terminateOnError=False) - if out != "IceStorm::AlreadySubscribed": - print out - TestUtil.killServers() - sys.exit(1) + runsub2(replica, "IceStorm::AlreadySubscribed") print "ok" print "testing unsubscription across replicas...", @@ -258,7 +174,7 @@ sys.stdout.flush() rununsub2() for replica in range(0, 3): - rununsub2(replica, terminateOnError=False) + rununsub2(replica) print "ok" print "testing subscription without master...", @@ -268,22 +184,13 @@ icestorm.stopReplica(2) runsub2() for replica in range(0, 2): - status, out = runsub2(replica, terminateOnError=False) - if out != "IceStorm::AlreadySubscribed": - TestUtil.killServers() - sys.exit(1) + runsub2(replica, "IceStorm::AlreadySubscribed") -status, out = runsub2(2, terminateOnError=False) -if not re.search("ConnectionRefused", out): - TestUtil.killServers() - sys.exit(1) +runsub2(2, "ConnectionRefused") icestorm.startReplica(2, echo=False) -status, out = runsub2(2, terminateOnError=False) -if out != "IceStorm::AlreadySubscribed": - TestUtil.killServers() - sys.exit(1) +runsub2(2, "IceStorm::AlreadySubscribed") print "ok" print "testing unsubscription without master...", @@ -293,12 +200,9 @@ icestorm.stopReplica(2) rununsub2() for replica in range(0, 2): - rununsub2(replica, terminateOnError=False) + rununsub2(replica) -status, out = rununsub2(2, terminateOnError=False) -if not re.search("ConnectionRefused", out): - TestUtil.killServers() - sys.exit(1) +rununsub2(2, "ConnectionRefused") icestorm.startReplica(2, echo=False) @@ -312,22 +216,13 @@ icestorm.stopReplica(0) runsub2() for replica in range(1, 3): - status, out = runsub2(replica, terminateOnError=False) - if out != "IceStorm::AlreadySubscribed": - TestUtil.killServers() - sys.exit(1) + runsub2(replica, "IceStorm::AlreadySubscribed") -status, out = runsub2(0, terminateOnError=False) -if not re.search("ConnectionRefused", out): - TestUtil.killServers() - sys.exit(1) +runsub2(0, "ConnectionRefused") icestorm.startReplica(0, echo=False) -status, out = runsub2(0, terminateOnError=False) -if out != "IceStorm::AlreadySubscribed": - TestUtil.killServers() - sys.exit(1) +runsub2(0, "IceStorm::AlreadySubscribed") print "ok" print "testing unsubscription without replica...", @@ -337,12 +232,9 @@ icestorm.stopReplica(0) rununsub2() for replica in range(1, 3): - rununsub2(replica, terminateOnError=False) + rununsub2(replica) -status, out = rununsub2(0, terminateOnError=False) -if not re.search("ConnectionRefused", out): - TestUtil.killServers() - sys.exit(1) +rununsub2(0, "ConnectionRefused") icestorm.startReplica(0, echo=False) @@ -389,9 +281,3 @@ print "stopping replicas...", sys.stdout.flush() icestorm.stop() print "ok" - -if TestUtil.serverStatus(): - TestUtil.killServers() - sys.exit(1) - -sys.exit(0) diff --git a/cpp/test/IceStorm/repgrid/run.py b/cpp/test/IceStorm/repgrid/run.py index 1d37f4df3f7..6ced5c5ff9d 100755 --- a/cpp/test/IceStorm/repgrid/run.py +++ b/cpp/test/IceStorm/repgrid/run.py @@ -10,23 +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(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() -import IceGridAdmin - -name = os.path.join("IceStorm", "repgrid") -testdir = os.path.dirname(os.path.abspath(__file__)) +sys.path.append(os.path.join(path[0])) +from scripts import * # # Test client/server without on demand activation. # -IceGridAdmin.iceGridTest(testdir, name, "application.xml", "", '"icebox.exe=' + TestUtil.getIceBox(testdir) + '"') -sys.exit(0) +IceGridAdmin.iceGridTest("application.xml", "", '"icebox.exe=%s"' % TestUtil.getIceBox()) diff --git a/cpp/test/IceStorm/repstress/run.py b/cpp/test/IceStorm/repstress/run.py index 9f2b311725d..0174c7a28af 100755 --- a/cpp/test/IceStorm/repstress/run.py +++ b/cpp/test/IceStorm/repstress/run.py @@ -10,55 +10,25 @@ import os, sys, time, re -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() -from threading import Thread - -name = os.path.join("IceStorm", "repstress") -testdir = os.path.dirname(os.path.abspath(__file__)) -publisher = os.path.join(testdir, "publisher") -subscriber = os.path.join(testdir, "subscriber") -control = os.path.join(testdir, "control") - -def printOutput(pipe): - try: - while True: - line = pipe.readline() - if not line: - break - print line, - sys.stdout.flush() - except IOError: - pass - -def captureOutput(pipe): - out = "" - try: - while True: - line = pipe.readline() - if not line: - break - out = out + line - except IOError: - pass - return out +publisher = os.path.join(os.getcwd(), "publisher") +subscriber = os.path.join(os.getcwd(), "subscriber") +control = os.path.join(os.getcwd(), "control") def runcontrol(proxy): - pipe = TestUtil.startClient(control, ' "' + proxy + '"') - printOutput(pipe) - return TestUtil.closePipe(pipe) + proc = TestUtil.startClient(control, ' "%s"' % proxy) + proc.waitTestSuccess() -import IceStormUtil - -icestorm = IceStormUtil.init(toplevel, testdir, "replicated", replicatedPublisher=True, additional = +icestorm = IceStormUtil.init(TestUtil.toplevel, os.getcwd(), "replicated", replicatedPublisher=True, additional = ' --IceStorm.Election.MasterTimeout=2' + ' --IceStorm.Election.ElectionTimeout=2' + ' --IceStorm.Election.ResponseTimeout=2') @@ -71,18 +41,16 @@ print "ok" print "running subscriber...", sys.stdout.flush() -subscriberPipe = TestUtil.startServer(subscriber, ' --Ice.ServerIdleTime=0 ' + icestorm.reference()) -TestUtil.getServerPid(subscriberPipe) -TestUtil.getAdapterReady(subscriberPipe, False) -subControl = subscriberPipe.readline().strip() +subscriberProc = TestUtil.startServer(subscriber, ' --Ice.ServerIdleTime=0 ' + icestorm.reference()) +subscriberProc.expect("([^\n]+)\n") +subControl = subscriberProc.match.group(1) print "ok" print "running publisher...", sys.stdout.flush() -publisherPipe = TestUtil.startServer(publisher, ' --Ice.ServerIdleTime=0 ' + icestorm.reference()) -TestUtil.getServerPid(publisherPipe) -TestUtil.getAdapterReady(publisherPipe, False) -pubControl = publisherPipe.readline().strip() +publisherProc = TestUtil.startServer(publisher, ' --Ice.ServerIdleTime=0 ' + icestorm.reference()) +publisherProc.expect("([^\n]+)\n") +pubControl = publisherProc.match.group(1) print "ok" time.sleep(2) @@ -126,14 +94,10 @@ for i in range(0, 3): print "stopping publisher...", sys.stdout.flush() -if runcontrol(pubControl): - printOutput(publisherPipe) - TestUtil.killServers() - sys.exit(1) -publisherCount = publisherPipe.readline().strip() -if TestUtil.closePipe(publisherPipe): - TestUtil.killServers() - sys.exit(1) +runcontrol(pubControl) +publisherProc.expect("([^\n]+)\n") +publisherCount = publisherProc.match.group(1) +publisherProc.waitTestSuccess() print "ok" print "stopping replicas...", @@ -143,26 +107,10 @@ print "ok" print "stopping subscriber...", sys.stdout.flush() -if runcontrol(subControl): - printOutput(subscriberPipe) - TestUtil.killServers() - sys.exit(1) -subscriberCount = subscriberPipe.readline().strip() -if TestUtil.closePipe(subscriberPipe): - TestUtil.killServers() - sys.exit(1) +runcontrol(subControl) +subscriberProc.expect("([^\n]+)\n") +subscriberCount = subscriberProc.match.group(1) +subscriberProc.waitTestSuccess() print "ok" print "publisher published %s events, subscriber received %s events" % (publisherCount, subscriberCount) -#print "comparing counts...", -#sys.stdout.flush() -#if publisherCount != subscriberCount: - #TestUtil.killServers() - #sys.exit(1) -#print "ok" - -if TestUtil.serverStatus(): - TestUtil.killServers() - sys.exit(1) - -sys.exit(0) diff --git a/cpp/test/IceStorm/single/run.py b/cpp/test/IceStorm/single/run.py index f0f585f44d8..6b0a07d4a1a 100755 --- a/cpp/test/IceStorm/single/run.py +++ b/cpp/test/IceStorm/single/run.py @@ -11,24 +11,18 @@ import os, sys import time -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("IceStorm", "single") -testdir = os.path.dirname(os.path.abspath(__file__)) - -import IceStormUtil +sys.path.append(os.path.join(path[0])) +from scripts import * def dotest(type): - icestorm = IceStormUtil.init(toplevel, testdir, type) + icestorm = IceStormUtil.init(TestUtil.toplevel, os.getcwd(), type) icestorm.start() @@ -37,14 +31,12 @@ def dotest(type): icestorm.admin("create single") print "ok" - publisher = os.path.join(testdir, "publisher") - subscriber = os.path.join(testdir, "subscriber") + publisher = os.path.join(os.getcwd(), "publisher") + subscriber = os.path.join(os.getcwd(), "subscriber") print "starting subscriber...", sys.stdout.flush() - subscriberPipe = TestUtil.startServer(subscriber, icestorm.reference()) - TestUtil.getServerPid(subscriberPipe) - TestUtil.getAdapterReady(subscriberPipe, True, 5) + subscriberProc = TestUtil.startServer(subscriber, icestorm.reference(), count = 5) print "ok" # @@ -53,11 +45,11 @@ def dotest(type): # print "starting publisher...", sys.stdout.flush() - publisherPipe = TestUtil.startClient(publisher, icestorm.reference()) + publisherProc = TestUtil.startClient(publisher, icestorm.reference()) print "ok" - subscriberStatus = TestUtil.specificServerStatus(subscriberPipe, 30) - publisherStatus = TestUtil.closePipe(publisherPipe) + subscriberProc.waitTestSuccess() + publisherProc.waitTestSuccess() # # Destroy the topic. @@ -72,10 +64,6 @@ def dotest(type): # icestorm.stop() - if TestUtil.serverStatus() or subscriberStatus or publisherStatus: - TestUtil.killServers() - sys.exit(1) - dotest("persistent") dotest("transient") dotest("replicated") diff --git a/cpp/test/IceStorm/stress/run.py b/cpp/test/IceStorm/stress/run.py index 1f1c15f2357..39915064c8e 100755 --- a/cpp/test/IceStorm/stress/run.py +++ b/cpp/test/IceStorm/stress/run.py @@ -10,60 +10,35 @@ import os, sys, time, threading, re -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("IceStorm", "stress") -testdir = os.path.dirname(os.path.abspath(__file__)) - -iceBox = TestUtil.getIceBox(testdir) -iceBoxAdmin = os.path.join(TestUtil.getCppBinDir(), "iceboxadmin") iceStormAdmin = os.path.join(TestUtil.getCppBinDir(), "icestormadmin") -import IceStormUtil - def doTest(server1, server2, subOpts, pubOpts): - global testdir - - publisher = os.path.join(testdir, "publisher") - subscriber = os.path.join(testdir, "subscriber") + publisher = os.path.join(os.getcwd(), "publisher") + subscriber = os.path.join(os.getcwd(), "subscriber") - subscriberPipes = [] + subscriberProcs = [] if type(subOpts) != type([]): subOpts = [ subOpts ] for opts in subOpts: # We don't want the subscribers to time out. - pipe = TestUtil.startServer(subscriber, r' --Ice.ServerIdleTime=0 ' + opts) - TestUtil.getServerPid(pipe) - TestUtil.getAdapterReady(pipe) - subscriberPipes.append(pipe) - - publisherPipe = TestUtil.startClient(publisher, server1.reference() + r' ' + pubOpts) - - TestUtil.printOutputFromPipe(publisherPipe) - - publisherStatus = TestUtil.closePipe(publisherPipe) - if publisherStatus: - print "(publisher failed)", - return publisherStatus - for p in subscriberPipes: - try: - sys.stdout.flush() - subscriberStatus = TestUtil.specificServerStatus(p) - except: - print "(subscriber failed)", - return 1 - if subscriberStatus: - print "(subscriber failed)", - return subscriberStatus + 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 @@ -73,18 +48,17 @@ def runAdmin(cmd, desc = None): if desc: print desc, sys.stdout.flush() - pipe = TestUtil.startClient(iceStormAdmin, adminIceStormReference + r' -e "' + cmd + '"') - status = TestUtil.closePipe(pipe) - if status: - TestUtil.killServers() - sys.exit(1) + proc = TestUtil.startClient(iceStormAdmin, adminIceStormReference + r' -e "%s"' % cmd) + proc.waitTestSuccess() if desc: print "ok" def runtest(type): # Clear the idle timeout otherwise the IceBox ThreadPool will timeout. - server1 = IceStormUtil.init(toplevel, testdir, type, dbDir = "db", instanceName = "TestIceStorm1", port = 12000) - server2 = IceStormUtil.init(toplevel, testdir, type, dbDir = "db2", instanceName = "TestIceStorm2", port = 12500) + server1 = IceStormUtil.init(TestUtil.toplevel, os.getcwd(), type, dbDir = "db", instanceName = "TestIceStorm1", + port = 12000) + server2 = IceStormUtil.init(TestUtil.toplevel, os.getcwd(), type, dbDir = "db2", instanceName = "TestIceStorm2", + port = 12500) global adminIceStormReference adminIceStormReference = ' --IceStormAdmin.TopicManager.Proxy="%s" --IceStormAdmin.TopicManager.Proxy2="%s"' % ( server1.proxy(), server2.proxy()) @@ -99,76 +73,47 @@ def runtest(type): print "Sending 5000 ordered events... ", sys.stdout.flush() - status = doTest(server1, server2, '--events 5000 --qos "reliability,ordered" ' + server1.reference(), '--events 5000') - if status: - print "failed!" - TestUtil.killServers() - sys.exit(1) + doTest(server1, server2, '--events 5000 --qos "reliability,ordered" ' + server1.reference(), '--events 5000') print "ok" runAdmin("link TestIceStorm1/fed1 TestIceStorm2/fed1") print "Sending 5000 ordered events across a link... ", sys.stdout.flush() - status = doTest(server1, server2, '--events 5000 --qos "reliability,ordered" ' + server2.reference(), '--events 5000') - if status: - TestUtil.killServers() - sys.exit(1) + doTest(server1, server2, '--events 5000 --qos "reliability,ordered" ' + server2.reference(), '--events 5000') print "ok" runAdmin("unlink TestIceStorm1/fed1 TestIceStorm2/fed1") print "Sending 20000 unordered events... ", sys.stdout.flush() - status = doTest(server1, server2, '--events 20000 ' + server1.reference(), '--events 20000 --oneway') - if status: - print "failed!" - TestUtil.killServers() - sys.exit(1) + doTest(server1, server2, '--events 20000 ' + server1.reference(), '--events 20000 --oneway') print "ok" runAdmin("link TestIceStorm1/fed1 TestIceStorm2/fed1") print "Sending 20000 unordered events across a link... ", sys.stdout.flush() - status = doTest(server1, server2, '--events 20000 ' + server2.reference(), '--events 20000 --oneway') - if status: - TestUtil.killServers() - sys.exit(1) + doTest(server1, server2, '--events 20000 ' + server2.reference(), '--events 20000 --oneway') print "ok" runAdmin("unlink TestIceStorm1/fed1 TestIceStorm2/fed1") print "Sending 20000 unordered batch events... ", sys.stdout.flush() - status = doTest(server1, server2, '--events 20000 --qos "reliability,batch" ' + server1.reference(), '--events 20000 --oneway') - if status: - print "failed!" - TestUtil.killServers() - sys.exit(1) + doTest(server1, server2, '--events 20000 --qos "reliability,batch" ' + server1.reference(), '--events 20000 --oneway') print "ok" runAdmin("link TestIceStorm1/fed1 TestIceStorm2/fed1") print "Sending 20000 unordered batch events across a link... ", sys.stdout.flush() - status = doTest(server1, server2, '--events 20000 --qos "reliability,batch" ' + server2.reference(), '--events 20000 --oneway') - if status: - TestUtil.killServers() - sys.exit(1) + doTest(server1, server2, '--events 20000 --qos "reliability,batch" ' + server2.reference(), '--events 20000 --oneway') print "ok" runAdmin("unlink TestIceStorm1/fed1 TestIceStorm2/fed1") print "Sending 20000 unordered events with slow subscriber... ", - status = doTest(server1, server2, ['--events 2 --slow ' + server1.reference(), '--events 20000 ' + server1.reference()], '--events 20000 --oneway') - if status: - print "failed!" - TestUtil.killServers() - sys.exit(1) + doTest(server1, server2, ['--events 2 --slow ' + server1.reference(), '--events 20000 ' + server1.reference()], '--events 20000 --oneway') print "ok" runAdmin("link TestIceStorm1/fed1 TestIceStorm2/fed1") print "Sending 20000 unordered events with slow subscriber & link... ", - status = doTest(server1, server2, ['--events 2 --slow' + server1.reference(), '--events 20000' + server1.reference(), '--events 2 --slow' + server2.reference(), '--events 20000' + server2.reference()], '--events 20000 --oneway') - if status: - print "failed!" - TestUtil.killServers() - sys.exit(1) + doTest(server1, server2, ['--events 2 --slow' + server1.reference(), '--events 20000' + server1.reference(), '--events 2 --slow' + server2.reference(), '--events 20000' + server2.reference()], '--events 20000 --oneway') print "ok" @@ -193,32 +138,24 @@ def runtest(type): print "Sending 20000 unordered events with erratic subscriber... ", sys.stdout.flush() - status = doTest(server1, server2, \ - [ '--erratic 5 --qos "reliability,ordered" --events 20000' + server1.reference(), \ - '--erratic 5 --events 20000' + server1.reference(), \ - '--events 20000' + server1.reference()], \ + doTest(server1, server2, + [ '--erratic 5 --qos "reliability,ordered" --events 20000' + server1.reference(), + '--erratic 5 --events 20000' + server1.reference(), + '--events 20000' + server1.reference()], '--events 20000 --oneway') - if status: - print "failed!" - TestUtil.killServers() - sys.exit(1) print "ok" runAdmin("link TestIceStorm1/fed1 TestIceStorm2/fed1") print "Sending 20000 unordered events with erratic subscriber across a link... ", sys.stdout.flush() - status = doTest(server1, server2, \ - [ '--events 20000' + server1.reference(), \ - '--erratic 5 --qos "reliability,ordered" --events 20000 ' + server1.reference(), \ - '--erratic 5 --events 20000 ' + server1.reference(), \ - '--events 20000' + server2.reference(), \ - '--erratic 5 --qos "reliability,ordered" --events 20000 ' + server2.reference(), \ - '--erratic 5 --events 20000 ' + server2.reference()], \ + doTest(server1, server2, + [ '--events 20000' + server1.reference(), + '--erratic 5 --qos "reliability,ordered" --events 20000 ' + server1.reference(), + '--erratic 5 --events 20000 ' + server1.reference(), + '--events 20000' + server2.reference(), + '--erratic 5 --qos "reliability,ordered" --events 20000 ' + server2.reference(), + '--erratic 5 --events 20000 ' + server2.reference()], '--events 20000 --oneway ') - if status: - print "failed!" - TestUtil.killServers() - sys.exit(1) print "ok" # @@ -230,11 +167,5 @@ def runtest(type): server2.stop() print "ok" - if TestUtil.serverStatus(): - TestUtil.killServers() - sys.exit(1) - runtest("persistent") runtest("replicated") - -sys.exit(0) diff --git a/cpp/test/IceUtil/condvar/run.py b/cpp/test/IceUtil/condvar/run.py index ad44a80d148..8940c1613ad 100755 --- a/cpp/test/IceUtil/condvar/run.py +++ b/cpp/test/IceUtil/condvar/run.py @@ -10,56 +10,31 @@ 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.path.dirname(os.path.abspath(__file__)) - -workqueue = os.path.join(testdir, "workqueue") +workqueue = os.path.join(os.getcwd(), "workqueue") print "starting workqueue...", -if TestUtil.debug: - print "(" + workqueue + ")", -workqueuePipe = os.popen(workqueue + " 2>&1") +client = TestUtil.spawnClient(workqueue) print "ok" +client.waitTestSuccess() -TestUtil.printOutputFromPipe(workqueuePipe) - -workqueueStatus = TestUtil.closePipe(workqueuePipe) - -if workqueueStatus: - sys.exit(1) - -match = os.path.join(testdir, "match") +match = os.path.join(os.getcwd(), "match") print "starting signal match...", -matchPipe = os.popen(match + " 2>&1") +client = TestUtil.spawnClient(match) print "ok" - -TestUtil.printOutputFromPipe(matchPipe) - -matchStatus = TestUtil.closePipe(matchPipe) - -if matchStatus: - sys.exit(1) +client.waitTestSuccess() print "starting broadcast match...", -matchPipe = os.popen(match + " -b" + " 2>&1") +client = TestUtil.spawnClient(match + " -b") print "ok" - -TestUtil.printOutputFromPipe(matchPipe) - -matchStatus = TestUtil.closePipe(matchPipe) - -if matchStatus: - sys.exit(1) - -sys.exit(0) +client.waitTestSuccess() diff --git a/cpp/test/IceUtil/inputUtil/run.py b/cpp/test/IceUtil/inputUtil/run.py index 2fb0e96c3e5..5057a52340d 100755 --- a/cpp/test/IceUtil/inputUtil/run.py +++ b/cpp/test/IceUtil/inputUtil/run.py @@ -10,31 +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() - -testdir = os.path.dirname(os.path.abspath(__file__)) - -client = os.path.join(testdir, "client") -clientOptions = ' ' + testdir; - -print "starting client...", -clientPipe = os.popen(client + clientOptions + " 2>&1") -print "ok" - -TestUtil.printOutputFromPipe(clientPipe); - -clientStatus = TestUtil.closePipe(clientPipe) - -if clientStatus: - sys.exit(1) - -sys.exit(0) +client = os.path.join(os.getcwd(), "client") +TestUtil.simpleTest(client, os.getcwd()) diff --git a/cpp/test/IceUtil/thread/run.py b/cpp/test/IceUtil/thread/run.py index 6d4273abdea..06250626150 100755 --- a/cpp/test/IceUtil/thread/run.py +++ b/cpp/test/IceUtil/thread/run.py @@ -10,34 +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() +client = os.path.join(os.getcwd(), "client") -testdir = os.path.dirname(os.path.abspath(__file__)) - -client = os.path.join(testdir, "client") -clientOptions = ' ' + testdir - -print "starting client...", -command = client + clientOptions -if TestUtil.debug: - print "(" + command + ")", -clientPipe = os.popen(command + " 2>&1") -print "ok" - -TestUtil.printOutputFromPipe(clientPipe) - -clientStatus = TestUtil.closePipe(clientPipe) - -if clientStatus: - sys.exit(1) - -sys.exit(0) +TestUtil.simpleTest(client, os.getcwd()) diff --git a/cpp/test/IceUtil/timer/run.py b/cpp/test/IceUtil/timer/run.py index 1e05abd1220..77ac29f681b 100755 --- a/cpp/test/IceUtil/timer/run.py +++ b/cpp/test/IceUtil/timer/run.py @@ -10,30 +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() - -testdir = os.path.dirname(os.path.abspath(__file__)) - -client = os.path.join(testdir, "client") - -print "starting client...", -clientPipe = os.popen(client + " 2>&1") -print "ok" - -TestUtil.printOutputFromPipe(clientPipe); - -clientStatus = TestUtil.closePipe(clientPipe) - -if clientStatus: - sys.exit(1) - -sys.exit(0) +client = os.path.join(os.getcwd(), "client") +TestUtil.simpleTest(client) diff --git a/cpp/test/IceUtil/unicode/run.py b/cpp/test/IceUtil/unicode/run.py index e004f5eb142..06250626150 100755 --- a/cpp/test/IceUtil/unicode/run.py +++ b/cpp/test/IceUtil/unicode/run.py @@ -10,31 +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() +client = os.path.join(os.getcwd(), "client") -testdir = os.path.dirname(os.path.abspath(__file__)) - -client = os.path.join(testdir, "client") -clientOptions = ' ' + testdir; - -print "starting client...", -clientPipe = os.popen(client + clientOptions + " 2>&1") -print "ok" - -TestUtil.printOutputFromPipe(clientPipe); - -clientStatus = TestUtil.closePipe(clientPipe) - -if clientStatus: - sys.exit(1) - -sys.exit(0) +TestUtil.simpleTest(client, os.getcwd()) diff --git a/cpp/test/IceUtil/uuid/run.py b/cpp/test/IceUtil/uuid/run.py index 0c8912bde72..77ac29f681b 100755 --- a/cpp/test/IceUtil/uuid/run.py +++ b/cpp/test/IceUtil/uuid/run.py @@ -10,32 +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() - -testdir = os.path.dirname(os.path.abspath(__file__)) - -client = os.path.join(testdir, "client") - -print "starting client...", -if TestUtil.debug: - print "(" + client + ")", -clientPipe = os.popen(client + " 2>&1") -print "ok" - -TestUtil.printOutputFromPipe(clientPipe); - -clientStatus = TestUtil.closePipe(clientPipe) - -if clientStatus: - sys.exit(1) - -sys.exit(0) +client = os.path.join(os.getcwd(), "client") +TestUtil.simpleTest(client) diff --git a/cpp/test/Slice/errorDetection/run.py b/cpp/test/Slice/errorDetection/run.py index abd3b0053b6..cd4f11068ef 100755 --- a/cpp/test/Slice/errorDetection/run.py +++ b/cpp/test/Slice/errorDetection/run.py @@ -10,26 +10,21 @@ import os, sys, re -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!" +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 os.getcwd()!" +sys.path.append(os.path.join(path[0])) +from scripts import * -# -# For LD_LIBRARY_PATH and similar env variables -# -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -directory = os.path.dirname(os.path.abspath(__file__)) slice2cpp = os.path.join(TestUtil.getCppBinDir(), "slice2cpp") -regex1 = re.compile(r"\.ice$", re.IGNORECASE) +regex1 = re.compile("\.ice$", re.IGNORECASE) files = [] -for file in os.listdir(directory): +for file in os.listdir(os.getcwd()): if(regex1.search(file)): files.append(file) @@ -40,17 +35,17 @@ for file in files: print file + "...", if file == "CaseSensitive.ice": - command = slice2cpp + " --case-sensitive -I. " + os.path.join(directory, file); + command = slice2cpp + " --case-sensitive -I. " + os.path.join(os.getcwd(), file); else: - command = slice2cpp + " -I. " + os.path.join(directory, file); + command = slice2cpp + " -I. " + os.path.join(os.getcwd(), file); stdin, stdout, stderr = os.popen3(command) lines1 = stdout.readlines() - lines2 = open(os.path.join(directory, regex1.sub(".err", file)), "r").readlines() + lines2 = open(os.path.join(os.getcwd(), regex1.sub(".err", file)), "r").readlines() if len(lines1) != len(lines2): print "failed!" sys.exit(1) - regex2 = re.compile(r"^.*(?=" + file + ")") + regex2 = re.compile("^.*(?=" + file + ")") i = 0 while i < len(lines1): line1 = regex2.sub("", lines1[i]).strip() diff --git a/cpp/test/Slice/keyword/run.py b/cpp/test/Slice/keyword/run.py index 4863f077175..77ac29f681b 100755 --- a/cpp/test/Slice/keyword/run.py +++ b/cpp/test/Slice/keyword/run.py @@ -10,31 +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("Slice", "keyword") -testdir = os.path.dirname(os.path.abspath(__file__)) - -client = os.path.join(testdir, "client") - -print "starting client...", -clientPipe = TestUtil.startClient(client, " 2>&1") -print "ok" - -TestUtil.printOutputFromPipe(clientPipe); - -clientStatus = TestUtil.closePipe(clientPipe) - -if clientStatus: - sys.exit(1) - -sys.exit(0) +client = os.path.join(os.getcwd(), "client") +TestUtil.simpleTest(client) diff --git a/cs/allDemos.py b/cs/allDemos.py index b095525d278..c339a454617 100755 --- a/cs/allDemos.py +++ b/cs/allDemos.py @@ -17,8 +17,8 @@ for toplevel in [".", "..", "../..", "../../..", "../../../.."]: else: raise "can't find toplevel directory!" -sys.path.append(os.path.join(toplevel, "demoscript")) -import Util +sys.path.append(os.path.join(toplevel)) +from demoscript import Util # # List of all basic demos. diff --git a/cs/allTests.py b/cs/allTests.py index cbe4e1b744f..9bdaa8db496 100755 --- a/cs/allTests.py +++ b/cs/allTests.py @@ -12,13 +12,13 @@ import os, sys, re, getopt for toplevel in [".", "..", "../..", "../../..", "../../../.."]: toplevel = os.path.abspath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): + if os.path.exists(os.path.join(toplevel, "scripts", "TestUtil.py")): break else: raise "can't find toplevel directory!" -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil +sys.path.append(os.path.join(toplevel)) +from scripts import * # # List of all basic tests. @@ -50,7 +50,6 @@ tests = [ ("Ice/background", ["core"]), ("IceBox/configuration", ["core", "noipv6"]), ("Glacier2/router", ["service"]), - ("Glacier2/attack", ["service"]), ("IceGrid/simple", ["service"]), ("IceSSL/configuration", ["once", "novista", "nomono"]), ] diff --git a/cs/test/Glacier2/Makefile b/cs/test/Glacier2/Makefile index f76037ef9bb..e0fb5d9d2da 100644 --- a/cs/test/Glacier2/Makefile +++ b/cs/test/Glacier2/Makefile @@ -11,7 +11,7 @@ top_srcdir = ../.. include $(top_srcdir)/config/Make.rules.cs -SUBDIRS = router attack +SUBDIRS = router $(EVERYTHING):: @for subdir in $(SUBDIRS); \ diff --git a/cs/test/Glacier2/Makefile.mak b/cs/test/Glacier2/Makefile.mak index 3637a390d37..aa785aa0138 100644 --- a/cs/test/Glacier2/Makefile.mak +++ b/cs/test/Glacier2/Makefile.mak @@ -11,7 +11,7 @@ top_srcdir = ..\.. !include $(top_srcdir)\config\Make.rules.mak.cs
-SUBDIRS = router attack
+SUBDIRS = router
$(EVERYTHING)::
@for %i in ( $(SUBDIRS) ) do \
diff --git a/cs/test/Glacier2/attack/.depend b/cs/test/Glacier2/attack/.depend deleted file mode 100644 index 65d12dffbe6..00000000000 --- a/cs/test/Glacier2/attack/.depend +++ /dev/null @@ -1 +0,0 @@ -Backend.cs: ./Backend.ice diff --git a/cs/test/Glacier2/attack/Backend.ice b/cs/test/Glacier2/attack/Backend.ice deleted file mode 100644 index 5e93560db7c..00000000000 --- a/cs/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/cs/test/Glacier2/attack/BackendI.cs b/cs/test/Glacier2/attack/BackendI.cs deleted file mode 100644 index bc4e3196344..00000000000 --- a/cs/test/Glacier2/attack/BackendI.cs +++ /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. -// -// ********************************************************************** - -using Test; - -public sealed class BackendI : BackendDisp_ -{ - public BackendI() - { - } - - public override void - shutdown(Ice.Current current) - { - current.adapter.getCommunicator().shutdown(); - } -} diff --git a/cs/test/Glacier2/attack/Client.cs b/cs/test/Glacier2/attack/Client.cs deleted file mode 100644 index 82ac0bb5cdf..00000000000 --- a/cs/test/Glacier2/attack/Client.cs +++ /dev/null @@ -1,155 +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. -// -// ********************************************************************** - -using Test; -using System; -using System.Collections; -using System.Diagnostics; -using System.Reflection; - -[assembly: CLSCompliant(true)] - -[assembly: AssemblyTitle("IceTest")] -[assembly: AssemblyDescription("Ice test")] -[assembly: AssemblyCompany("ZeroC, Inc.")] - -public class Client -{ - public class App : Ice.Application - { - public override int run(string[] args) - { - Console.Out.Write("getting router... "); - Console.Out.Flush(); - Ice.ObjectPrx routerBase = communicator().stringToProxy("Glacier2/router:default -p 12347 -t 10000"); - Glacier2.RouterPrx router = Glacier2.RouterPrxHelper.checkedCast(routerBase); - test(router != null); - Console.Out.WriteLine("ok"); - - Console.Out.Write("creating session... "); - Console.Out.Flush(); - router.createSession("userid", "abc123"); - communicator().setDefaultRouter(router); - Console.Out.WriteLine("ok"); - - Console.Out.Write("making thousands of invocations on proxies... "); - Console.Out.Flush(); - Ice.ObjectPrx backendBase = communicator().stringToProxy("dummy:tcp -p 12010 -t 10000"); - BackendPrx backend = BackendPrxHelper.uncheckedCast(backendBase); - backend.ice_ping(); - - Hashtable backends = new Hashtable(); - Random rand = new Random(unchecked((int)DateTime.Now.Ticks)); - - String msg = ""; - for(int i = 1; i <= 10000; ++i) - { - if(i % 100 == 0) - { - for(int j = 0; j < msg.Length; ++j) - { - Console.Out.Write('\b'); - } - - msg = "" + i; - Console.Out.Write(i); - Console.Out.Flush(); - } - - Ice.Identity ident = new Ice.Identity("", ""); - ident.name += (char)('A' + rand.Next() % 26); - - int len = rand.Next() % 2; - for(int j = 0; j < len; ++j) - { - ident.category += (char)('a' + rand.Next() % 26); - } - - BackendPrx newBackend = BackendPrxHelper.uncheckedCast(backendBase.ice_identity(ident)); - - if(!backends.ContainsKey(newBackend)) - { - backends.Add(newBackend, newBackend); - backend = newBackend; - } - else - { - backend = (BackendPrx)backends[newBackend]; - } - - backend.ice_ping(); - } - - for(int j = 0; j < msg.Length; ++j) - { - Console.Out.Write('\b'); - } - for(int j = 0; j < msg.Length; ++j) - { - Console.Out.Write(' '); - } - for(int j = 0; j < msg.Length; ++j) - { - Console.Out.Write('\b'); - } - Console.Out.WriteLine("ok"); - - Console.Out.Write("testing server and router shutdown... "); - Console.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) - { - Console.Out.WriteLine("ok"); - } - - return 0; - } - - private static void - test(bool b) - { - if(!b) - { - throw new Exception(); - } - } - } - - public static void Main(string[] args) - { - Debug.Listeners.Add(new ConsoleTraceListener()); - - // - // We want to check whether the client retries for evicted - // proxies, even with regular retries disabled. - // - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.properties.setProperty("Ice.RetryIntervals", "-1"); - - App app = new App(); - int status = app.main(args, initData); - - if(status != 0) - { - Environment.Exit(status); - } - } -} diff --git a/cs/test/Glacier2/attack/Makefile b/cs/test/Glacier2/attack/Makefile deleted file mode 100644 index e9a50c8eb6c..00000000000 --- a/cs/test/Glacier2/attack/Makefile +++ /dev/null @@ -1,35 +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. -# -# ********************************************************************** - -top_srcdir = ../../.. - -TARGETS = client.exe server.exe - -C_SRCS = Client.cs generated/Backend.cs -S_SRCS = Server.cs generated/Backend.cs BackendI.cs - -SLICE_SRCS = $(SDIR)/Backend.ice - -SDIR = . - -GDIR = generated - -include $(top_srcdir)/config/Make.rules.cs - -MCSFLAGS := $(MCSFLAGS) -target:exe - -SLICE2CSFLAGS := $(SLICE2CSFLAGS) --ice -I. -I$(slicedir) - -client.exe: $(C_SRCS) $(GEN_SRCS) - $(MCS) $(MCSFLAGS) -out:$@ $(call ref,Ice) $(call ref,Glacier2) $(subst /,$(DSEP),$^) - -server.exe: $(S_SRCS) $(GEN_SRCS) - $(MCS) $(MCSFLAGS) -out:$@ $(call ref,Ice) $(call ref,Glacier2) $(subst /,$(DSEP),$^) - -include .depend diff --git a/cs/test/Glacier2/attack/Makefile.mak b/cs/test/Glacier2/attack/Makefile.mak deleted file mode 100644 index c8b06eb0039..00000000000 --- a/cs/test/Glacier2/attack/Makefile.mak +++ /dev/null @@ -1,36 +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.
-#
-# **********************************************************************
-
-top_srcdir = ..\..\..
-
-TARGETS = client.exe server.exe
-TARGETS_CONFIG = $(TARGETS:.exe=.exe.config)
-
-C_SRCS = Client.cs
-S_SRCS = Server.cs BackendI.cs
-
-GEN_SRCS = $(GDIR)\Backend.cs
-
-SDIR = .
-
-GDIR = generated
-
-!include $(top_srcdir)\config\Make.rules.mak.cs
-
-MCSFLAGS = $(MCSFLAGS) -target:exe
-
-SLICE2CSFLAGS = $(SLICE2CSFLAGS) --ice -I. -I$(slicedir)
-
-client.exe: $(C_SRCS) $(GEN_SRCS)
- $(MCS) $(MCSFLAGS) -out:$@ -r:$(refdir)\Ice.dll -r:$(refdir)\Glacier2.dll $(C_SRCS) $(GEN_SRCS)
-
-server.exe: $(S_SRCS) $(GEN_SRCS)
- $(MCS) $(MCSFLAGS) -out:$@ -r:$(refdir)\Ice.dll -r:$(refdir)\Glacier2.dll $(S_SRCS) $(GEN_SRCS)
-
-!include .depend
diff --git a/cs/test/Glacier2/attack/Server.cs b/cs/test/Glacier2/attack/Server.cs deleted file mode 100644 index 5869d2c89d6..00000000000 --- a/cs/test/Glacier2/attack/Server.cs +++ /dev/null @@ -1,71 +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. -// -// ********************************************************************** - -using Test; -using System; -using System.Diagnostics; -using System.Reflection; - -[assembly: CLSCompliant(true)] - -[assembly: AssemblyTitle("IceTest")] -[assembly: AssemblyDescription("Ice test")] -[assembly: AssemblyCompany("ZeroC, Inc.")] - -class Server -{ - sealed class ServantLocatorI : Ice.ServantLocator - { - public ServantLocatorI() - { - _backend = new BackendI(); - } - - public Ice.Object locate(Ice.Current curr, out System.Object cookie) - { - cookie = null; - return _backend; - } - - public void finished(Ice.Current curr, Ice.Object servant, System.Object cookie) - { - } - - public void deactivate(string category) - { - } - - private Backend _backend; - } - - class App : Ice.Application - { - public override 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; - } - } - - public static void Main(string[] args) - { - Debug.Listeners.Add(new ConsoleTraceListener()); - - App app = new App(); - int status = app.main(args); - if(status != 0) - { - System.Environment.Exit(status); - } - } -} diff --git a/cs/test/Glacier2/attack/passwords b/cs/test/Glacier2/attack/passwords deleted file mode 100644 index a1527dec2b9..00000000000 --- a/cs/test/Glacier2/attack/passwords +++ /dev/null @@ -1 +0,0 @@ -userid xxMqsnnDcK8tw
\ No newline at end of file diff --git a/cs/test/Glacier2/attack/run.py b/cs/test/Glacier2/attack/run.py deleted file mode 100755 index e3494e44d50..00000000000 --- a/cs/test/Glacier2/attack/run.py +++ /dev/null @@ -1,50 +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, getopt - -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() - -router = os.path.join(TestUtil.getCppBinDir(), "glacier2router") -name = os.path.join("Glacier2", "router") -testdir = os.path.dirname(os.path.abspath(__file__)) - -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...", -routerCfg = TestUtil.DriverConfig("server") -routerCfg.lang = "cpp" -starterPipe = TestUtil.startServer(router, args, routerCfg) -TestUtil.getServerPid(starterPipe) -TestUtil.getAdapterReady(starterPipe, True, 2) -print "ok" - -name = os.path.join("Glacier2", "attack") - -TestUtil.clientServerTest(name) - -if TestUtil.serverStatus(): - sys.exit(0) - -sys.exit(0) diff --git a/cs/test/Glacier2/router/run.py b/cs/test/Glacier2/router/run.py index 73cc7da6a36..e001c93be45 100755 --- a/cs/test/Glacier2/router/run.py +++ b/cs/test/Glacier2/router/run.py @@ -10,60 +10,42 @@ import os, sys, getopt -for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break -else: +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: raise "can't find toplevel directory!" - -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() +sys.path.append(os.path.join(path[0])) +from scripts import * router = os.path.join(TestUtil.getCppBinDir(), "glacier2router") -name = os.path.join("Glacier2", "router") -testdir = os.path.dirname(os.path.abspath(__file__)) -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, 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() -TestUtil.mixedClientServerTest(name) +TestUtil.clientServerTest() # # We run the test again, to check whether the glacier router can # handle multiple clients. Also, when we run for the second time, we # want the client to shutdown the router after running the tests. # -TestUtil.mixedClientServerTestWithOptions(name, "", " --shutdown") - -starterStatus = TestUtil.closePipe(starterPipe) - -starterThread.join() -if starterThread.getStatus(): - sys.exit(1) +TestUtil.clientServerTest(additionalClientOptions=" --shutdown") -sys.exit(0) +starterProc.waitTestSuccess() diff --git a/cs/test/Ice/adapterDeactivation/run.py b/cs/test/Ice/adapterDeactivation/run.py index d6b3157dd2e..9e81c2864e3 100755 --- a/cs/test/Ice/adapterDeactivation/run.py +++ b/cs/test/Ice/adapterDeactivation/run.py @@ -10,19 +10,15 @@ import os, sys, getopt -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") - -TestUtil.clientServerTest(name) -TestUtil.collocatedTest(name) -sys.exit(0) +TestUtil.clientServerTest() +TestUtil.collocatedTest() diff --git a/cs/test/Ice/background/run.py b/cs/test/Ice/background/run.py index 9e6678eb11c..1fb76bfd115 100755 --- a/cs/test/Ice/background/run.py +++ b/cs/test/Ice/background/run.py @@ -10,18 +10,14 @@ import os, sys, getopt -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") - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/cs/test/Ice/binding/run.py b/cs/test/Ice/binding/run.py index b1435679753..1fb76bfd115 100755 --- a/cs/test/Ice/binding/run.py +++ b/cs/test/Ice/binding/run.py @@ -10,18 +10,14 @@ import os, sys, getopt -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") - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/cs/test/Ice/checksum/client/.depend b/cs/test/Ice/checksum/.depend index d9813471586..d9813471586 100644 --- a/cs/test/Ice/checksum/client/.depend +++ b/cs/test/Ice/checksum/.depend diff --git a/cs/test/Ice/checksum/client/AllTests.cs b/cs/test/Ice/checksum/AllTests.cs index de48e691029..de48e691029 100644 --- a/cs/test/Ice/checksum/client/AllTests.cs +++ b/cs/test/Ice/checksum/AllTests.cs diff --git a/cs/test/Ice/checksum/client/Client.cs b/cs/test/Ice/checksum/Client.cs index d69a8e30562..d69a8e30562 100644 --- a/cs/test/Ice/checksum/client/Client.cs +++ b/cs/test/Ice/checksum/Client.cs diff --git a/cs/test/Ice/checksum/Makefile b/cs/test/Ice/checksum/Makefile index cf078f7693b..22c9de7d639 100644 --- a/cs/test/Ice/checksum/Makefile +++ b/cs/test/Ice/checksum/Makefile @@ -9,9 +9,26 @@ top_srcdir = ../../.. +TARGETS = client.exe + +C_SRCS = AllTests.cs Client.cs + +SLICE_SRCS = $(SDIR)/Test.ice $(SDIR)/Types.ice + +SDIR = . + +GDIR = generated + include $(top_srcdir)/config/Make.rules.cs -SUBDIRS = client server +MCSFLAGS := $(MCSFLAGS) -target:exe + +SLICE2CSFLAGS := $(SLICE2CSFLAGS) --checksum --ice -I. -I$(slicedir) + +client.exe: $(C_SRCS) $(GEN_SRCS) + $(MCS) $(MCSFLAGS) -out:$@ $(call ref,Ice) $(subst /,$(DSEP),$^) + +SUBDIRS = server $(EVERYTHING):: @for subdir in $(SUBDIRS); \ @@ -22,3 +39,5 @@ $(EVERYTHING):: test:: @python $(top_srcdir)/allTests.py + +include .depend diff --git a/cs/test/Ice/checksum/Makefile.mak b/cs/test/Ice/checksum/Makefile.mak index f74af5e6607..cb76b6d8e41 100644 --- a/cs/test/Ice/checksum/Makefile.mak +++ b/cs/test/Ice/checksum/Makefile.mak @@ -9,9 +9,32 @@ top_srcdir = ..\..\..
+TARGETS = client.exe
+TARGETS_CONFIG = $(TARGETS:.exe=.exe.config)
+
+C_SRCS = AllTests.cs Client.cs
+
+SLICE_SRCS = $(SDIR)\Test.ice \
+ $(SDIR)\Types.ice
+
+GEN_SRCS = $(GDIR)\Test.cs \
+ $(GDIR)\Types.cs
+
+SDIR = .
+
+GDIR = generated
+
!include $(top_srcdir)\config\Make.rules.mak.cs
-SUBDIRS = client server
+MCSFLAGS = $(MCSFLAGS) -target:exe
+
+SLICE2CSFLAGS = $(SLICE2CSFLAGS) --checksum --ice -I. -I$(slicedir)
+
+client.exe: $(C_SRCS) $(GEN_SRCS)
+ $(MCS) $(MCSFLAGS) -out:$@ -r:$(refdir)\Ice.dll $(C_SRCS) $(GEN_SRCS)
+
+
+SUBDIRS = server
$(EVERYTHING)::
@for %i in ( $(SUBDIRS) ) do \
@@ -20,3 +43,5 @@ $(EVERYTHING):: test::
@python $(top_srcdir)/allTests.py
+
+!include .depend
diff --git a/cs/test/Ice/checksum/client/Test.ice b/cs/test/Ice/checksum/Test.ice index 24e8f7c957b..24e8f7c957b 100644 --- a/cs/test/Ice/checksum/client/Test.ice +++ b/cs/test/Ice/checksum/Test.ice diff --git a/cs/test/Ice/checksum/client/Types.ice b/cs/test/Ice/checksum/Types.ice index ea5e644a755..ea5e644a755 100644 --- a/cs/test/Ice/checksum/client/Types.ice +++ b/cs/test/Ice/checksum/Types.ice diff --git a/cs/test/Ice/checksum/client/Makefile b/cs/test/Ice/checksum/client/Makefile deleted file mode 100644 index bcaeb151d23..00000000000 --- a/cs/test/Ice/checksum/client/Makefile +++ /dev/null @@ -1,31 +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. -# -# ********************************************************************** - -top_srcdir = ../../../.. - -TARGETS = client.exe - -C_SRCS = AllTests.cs Client.cs - -SLICE_SRCS = $(SDIR)/Test.ice $(SDIR)/Types.ice - -SDIR = . - -GDIR = generated - -include $(top_srcdir)/config/Make.rules.cs - -MCSFLAGS := $(MCSFLAGS) -target:exe - -SLICE2CSFLAGS := $(SLICE2CSFLAGS) --checksum --ice -I. -I$(slicedir) - -client.exe: $(C_SRCS) $(GEN_SRCS) - $(MCS) $(MCSFLAGS) -out:$@ $(call ref,Ice) $(subst /,$(DSEP),$^) - -include .depend diff --git a/cs/test/Ice/checksum/client/Makefile.mak b/cs/test/Ice/checksum/client/Makefile.mak deleted file mode 100644 index bcdd1557b6b..00000000000 --- a/cs/test/Ice/checksum/client/Makefile.mak +++ /dev/null @@ -1,36 +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.
-#
-# **********************************************************************
-
-top_srcdir = ..\..\..\..
-
-TARGETS = client.exe
-TARGETS_CONFIG = $(TARGETS:.exe=.exe.config)
-
-C_SRCS = AllTests.cs Client.cs
-
-SLICE_SRCS = $(SDIR)\Test.ice \
- $(SDIR)\Types.ice
-
-GEN_SRCS = $(GDIR)\Test.cs \
- $(GDIR)\Types.cs
-
-SDIR = .
-
-GDIR = generated
-
-!include $(top_srcdir)\config\Make.rules.mak.cs
-
-MCSFLAGS = $(MCSFLAGS) -target:exe
-
-SLICE2CSFLAGS = $(SLICE2CSFLAGS) --checksum --ice -I. -I$(slicedir)
-
-client.exe: $(C_SRCS) $(GEN_SRCS)
- $(MCS) $(MCSFLAGS) -out:$@ -r:$(refdir)\Ice.dll $(C_SRCS) $(GEN_SRCS)
-
-!include .depend
diff --git a/cs/test/Ice/checksum/client/generated/.gitignore b/cs/test/Ice/checksum/client/generated/.gitignore deleted file mode 100644 index 39af5887579..00000000000 --- a/cs/test/Ice/checksum/client/generated/.gitignore +++ /dev/null @@ -1 +0,0 @@ -# Dummy file, so that git retains this otherwise empty directory. diff --git a/cs/test/Glacier2/attack/generated/.gitignore b/cs/test/Ice/checksum/generated/.gitignore index 39af5887579..39af5887579 100644 --- a/cs/test/Glacier2/attack/generated/.gitignore +++ b/cs/test/Ice/checksum/generated/.gitignore diff --git a/cs/test/Ice/checksum/run.py b/cs/test/Ice/checksum/run.py index ede7e1a4419..0e432407d13 100755 --- a/cs/test/Ice/checksum/run.py +++ b/cs/test/Ice/checksum/run.py @@ -10,19 +10,14 @@ import os, sys, getopt -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", "checksum") - -TestUtil.clientServerTestWithOptionsAndNames(name, "", "", os.path.join("server", "server"), \ - os.path.join("client", "client")) -sys.exit(0) +TestUtil.clientServerTest(server = os.path.join(os.getcwd(), "server", "server")) diff --git a/cs/test/Ice/dictMapping/run.py b/cs/test/Ice/dictMapping/run.py index 281e64cc767..270916a4d37 100755 --- a/cs/test/Ice/dictMapping/run.py +++ b/cs/test/Ice/dictMapping/run.py @@ -10,23 +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(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "dictMapping") +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -TestUtil.clientServerTest(name) +TestUtil.clientServerTest() print "tests with AMD server." -TestUtil.clientServerTestWithOptionsAndNames(name, "", "", "serveramd", "client") +TestUtil.clientServerTest(server="serveramd") print "tests with collocated server." -TestUtil.collocatedTest(name) -sys.exit(0) +TestUtil.collocatedTest() diff --git a/cs/test/Ice/exceptions/ThrowerAMDI.cs b/cs/test/Ice/exceptions/ThrowerAMDI.cs index 5f632360ea8..0f596cda49a 100644 --- a/cs/test/Ice/exceptions/ThrowerAMDI.cs +++ b/cs/test/Ice/exceptions/ThrowerAMDI.cs @@ -30,7 +30,7 @@ public class ThrowerI : ThrowerDisp_ public override void supportsAssertException_async(AMD_Thrower_supportsAssertException cb, Ice.Current current) { - cb.ice_response(true); + cb.ice_response(false); } public override void throwAasA_async(AMD_Thrower_throwAasA cb, int a, Ice.Current current) diff --git a/cs/test/Ice/exceptions/run.py b/cs/test/Ice/exceptions/run.py index ba86355a237..c1823e7efb6 100755 --- a/cs/test/Ice/exceptions/run.py +++ b/cs/test/Ice/exceptions/run.py @@ -10,23 +10,19 @@ import os, sys, getopt -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") +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -TestUtil.clientServerTestWithOptions(name, "", " --Ice.Warn.Connections=0") +TestUtil.clientServerTest(additionalClientOptions=" --Ice.Warn.Connections=0") print "tests with AMD server." -TestUtil.clientServerTestWithOptionsAndNames(name, "", "", "serveramd", "client") +TestUtil.clientServerTest(server="serveramd") print "tests with collocated server." -TestUtil.collocatedTest(name) -sys.exit(0) +TestUtil.collocatedTest() diff --git a/cs/test/Ice/facets/run.py b/cs/test/Ice/facets/run.py index 3c4d1ec1b78..9e81c2864e3 100755 --- a/cs/test/Ice/facets/run.py +++ b/cs/test/Ice/facets/run.py @@ -10,19 +10,15 @@ import os, sys, getopt -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") - -TestUtil.clientServerTest(name) -TestUtil.collocatedTest(name) -sys.exit(0) +TestUtil.clientServerTest() +TestUtil.collocatedTest() diff --git a/cs/test/Ice/faultTolerance/run.py b/cs/test/Ice/faultTolerance/run.py index a9aa8a52d88..930d4227201 100755 --- a/cs/test/Ice/faultTolerance/run.py +++ b/cs/test/Ice/faultTolerance/run.py @@ -10,22 +10,18 @@ import os, sys, getopt -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__)) - -server = os.path.join(testdir, "server") -client = os.path.join(testdir, "client") +server = os.path.join(os.getcwd(), "server") +client = os.path.join(os.getcwd(), "client") if TestUtil.isCygwin(): print "\nYou may get spurious \"Signal 127\" messages during this test run." @@ -34,11 +30,10 @@ if TestUtil.isCygwin(): num = 12 base = 12340 +serverProc = [] for i in range(0, num): print "starting server #%d..." % (i + 1), - serverPipe = TestUtil.startServer(server, " %d" % (base + i)) - TestUtil.getServerPid(serverPipe) - TestUtil.getAdapterReady(serverPipe) + serverProc.append(TestUtil.startServer(server, " %d" % (base + i))) print "ok" ports = "" @@ -46,22 +41,12 @@ for i in range(0, num): ports = "%s %d" % (ports, base + i) print "starting client...", -clientPipe = TestUtil.startClient(client, ports) +clientProc = TestUtil.startClient(client, ports) print "ok" -TestUtil.printOutputFromPipe(clientPipe) - -clientStatus = TestUtil.closePipe(clientPipe) - -if clientStatus: - sys.exit(1) - -# -# We simuluate the abort of the server by calling Process.Kill(). However, this -# results in a non-zero exit status. Therefore we ignore the status. -# -#if TestUtil.serverStatus(): - #sys.exit(1) -TestUtil.joinServers() - -sys.exit(0) +clientProc.waitTestSuccess() +for p in serverProc: + #p.waitTestSuccess() + # We simuluate the abort of the server by calling Process.Kill(). However, this + # results in a non-zero exit status. Therefore we ignore the status. + p.wait() diff --git a/cs/test/Ice/hold/run.py b/cs/test/Ice/hold/run.py index b70138f8bf5..1fb76bfd115 100755 --- a/cs/test/Ice/hold/run.py +++ b/cs/test/Ice/hold/run.py @@ -10,18 +10,14 @@ import os, sys, getopt -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") - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/cs/test/Ice/inheritance/run.py b/cs/test/Ice/inheritance/run.py index f535ac5d996..9e81c2864e3 100755 --- a/cs/test/Ice/inheritance/run.py +++ b/cs/test/Ice/inheritance/run.py @@ -10,19 +10,15 @@ import os, sys, getopt -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") - -TestUtil.clientServerTest(name) -TestUtil.collocatedTest(name) -sys.exit(0) +TestUtil.clientServerTest() +TestUtil.collocatedTest() diff --git a/cs/test/Ice/interceptor/run.py b/cs/test/Ice/interceptor/run.py index 285eb6f81cf..46da84aae90 100755 --- a/cs/test/Ice/interceptor/run.py +++ b/cs/test/Ice/interceptor/run.py @@ -10,31 +10,20 @@ import os, sys, getopt -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__)) - -client = os.path.join(testdir, "client") +client = os.path.join(os.getcwd(), "client") 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/cs/test/Ice/location/run.py b/cs/test/Ice/location/run.py index cccad85b373..1fb76bfd115 100755 --- a/cs/test/Ice/location/run.py +++ b/cs/test/Ice/location/run.py @@ -10,18 +10,14 @@ import os, sys, getopt -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") - -TestUtil.mixedClientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/cs/test/Ice/objects/run.py b/cs/test/Ice/objects/run.py index adced32c9ce..9e81c2864e3 100755 --- a/cs/test/Ice/objects/run.py +++ b/cs/test/Ice/objects/run.py @@ -10,19 +10,15 @@ import os, sys, getopt -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") - -TestUtil.clientServerTest(name) -TestUtil.collocatedTest(name) -sys.exit(0) +TestUtil.clientServerTest() +TestUtil.collocatedTest() diff --git a/cs/test/Ice/operations/run.py b/cs/test/Ice/operations/run.py index 397721ba8b5..270916a4d37 100755 --- a/cs/test/Ice/operations/run.py +++ b/cs/test/Ice/operations/run.py @@ -10,23 +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(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "operations") +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -TestUtil.clientServerTest(name) +TestUtil.clientServerTest() print "tests with AMD server." -TestUtil.clientServerTestWithOptionsAndNames(name, "", "", "serveramd", "client") +TestUtil.clientServerTest(server="serveramd") print "tests with collocated server." -TestUtil.collocatedTest(name) -sys.exit(0) +TestUtil.collocatedTest() diff --git a/cs/test/Ice/proxy/run.py b/cs/test/Ice/proxy/run.py index 9fd10bc4cd0..270916a4d37 100755 --- a/cs/test/Ice/proxy/run.py +++ b/cs/test/Ice/proxy/run.py @@ -10,23 +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(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "proxy") +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -TestUtil.clientServerTest(name) +TestUtil.clientServerTest() print "tests with AMD server." -TestUtil.clientServerTestWithOptionsAndNames(name, "", "", "serveramd", "client") +TestUtil.clientServerTest(server="serveramd") print "tests with collocated server." -TestUtil.collocatedTest(name) -sys.exit(0) +TestUtil.collocatedTest() diff --git a/cs/test/Ice/retry/run.py b/cs/test/Ice/retry/run.py index e6355dc1f5b..1fb76bfd115 100755 --- a/cs/test/Ice/retry/run.py +++ b/cs/test/Ice/retry/run.py @@ -10,18 +10,14 @@ import os, sys, getopt -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") - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/cs/test/Ice/seqMapping/run.py b/cs/test/Ice/seqMapping/run.py index 33346c7072b..270916a4d37 100755 --- a/cs/test/Ice/seqMapping/run.py +++ b/cs/test/Ice/seqMapping/run.py @@ -10,23 +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(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "seqMapping") +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -TestUtil.clientServerTest(name) +TestUtil.clientServerTest() print "tests with AMD server." -TestUtil.clientServerTestWithOptionsAndNames(name, "", "", "serveramd", "client") +TestUtil.clientServerTest(server="serveramd") print "tests with collocated server." -TestUtil.collocatedTest(name) -sys.exit(0) +TestUtil.collocatedTest() diff --git a/cs/test/Ice/servantLocator/run.py b/cs/test/Ice/servantLocator/run.py index 819e942f21a..a421e404d38 100755 --- a/cs/test/Ice/servantLocator/run.py +++ b/cs/test/Ice/servantLocator/run.py @@ -10,24 +10,19 @@ import os, sys, getopt -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", "servantLocator") +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -TestUtil.clientServerTest(name) +TestUtil.clientServerTest() print "tests with AMD server." -TestUtil.clientServerTestWithOptionsAndNames(name, "", "", "serveramd", "client") +TestUtil.clientServerTest(server="serveramd") print "tests with collocated server." -TestUtil.collocatedTest(name) - -sys.exit(0) +TestUtil.collocatedTest() diff --git a/cs/test/Ice/slicing/exceptions/run.py b/cs/test/Ice/slicing/exceptions/run.py index 62a35c4ad8e..70e5e6cdd98 100755 --- a/cs/test/Ice/slicing/exceptions/run.py +++ b/cs/test/Ice/slicing/exceptions/run.py @@ -10,21 +10,17 @@ import os, sys, getopt -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") +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -TestUtil.clientServerTest(name) +TestUtil.clientServerTest() print "tests with AMD server." -TestUtil.clientServerTestWithOptionsAndNames(name, "", "", "serveramd", "client") -sys.exit(0) +TestUtil.clientServerTest(server="serveramd") diff --git a/cs/test/Ice/slicing/objects/run.py b/cs/test/Ice/slicing/objects/run.py index 132196d0d54..70e5e6cdd98 100755 --- a/cs/test/Ice/slicing/objects/run.py +++ b/cs/test/Ice/slicing/objects/run.py @@ -10,21 +10,17 @@ import os, sys, getopt -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", "objects") +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -TestUtil.clientServerTest(name) +TestUtil.clientServerTest() print "tests with AMD server." -TestUtil.clientServerTestWithOptionsAndNames(name, "", "", "serveramd", "client") -sys.exit(0) +TestUtil.clientServerTest(server="serveramd") diff --git a/cs/test/Ice/stream/run.py b/cs/test/Ice/stream/run.py index 314b43e19c6..3e99ca72ae3 100755 --- a/cs/test/Ice/stream/run.py +++ b/cs/test/Ice/stream/run.py @@ -10,32 +10,19 @@ import os, sys, getopt -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__)) - -client = os.path.join(testdir, "client") +client = os.path.join(os.getcwd(), "client") print "starting client...", -clientPipe = TestUtil.startClient(client, " --Ice.Warn.Dispatch=0 2>&1") +clientProc = TestUtil.startClient(client, " --Ice.Warn.Dispatch=0 2>&1") print "ok" - -TestUtil.printOutputFromPipe(clientPipe); - -clientStatus = TestUtil.closePipe(clientPipe) - -if clientStatus: - sys.exit(1) - -sys.exit(0) +clientProc.waitTestSuccess() diff --git a/cs/test/Ice/timeout/run.py b/cs/test/Ice/timeout/run.py index 21b55b1ce7f..1fb76bfd115 100755 --- a/cs/test/Ice/timeout/run.py +++ b/cs/test/Ice/timeout/run.py @@ -10,18 +10,14 @@ import os, sys, getopt -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") - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/cs/test/IceBox/configuration/run.py b/cs/test/IceBox/configuration/run.py index 2314437bacb..524c73a13a6 100755 --- a/cs/test/IceBox/configuration/run.py +++ b/cs/test/IceBox/configuration/run.py @@ -10,28 +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() -import IceGridAdmin +icebox = TestUtil.getIceBox() -name = os.path.join("IceBox", "configuration") -testdir = os.path.dirname(os.path.abspath(__file__)) -icebox = TestUtil.getIceBox(testdir); - -cwd = os.getcwd() -os.chdir(testdir) - -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=icebox) +TestUtil.clientServerTest(additionalServerOptions="--Ice.Config=%s" % os.path.join(os.getcwd(), "config.icebox2"), + server=icebox) diff --git a/cs/test/IceGrid/simple/run.py b/cs/test/IceGrid/simple/run.py index aae28fc00e8..515701871ea 100755 --- a/cs/test/IceGrid/simple/run.py +++ b/cs/test/IceGrid/simple/run.py @@ -10,32 +10,25 @@ import os, sys, getopt -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 - -name = os.path.join("IceGrid", "simple") -testdir = os.path.dirname(os.path.abspath(__file__)) +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. # if TestUtil.mono: - IceGridAdmin.iceGridTest(testdir, name, "simple_mono_server.xml", "--with-deploy") + IceGridAdmin.iceGridTest("simple_mono_server.xml", "--with-deploy") else: - IceGridAdmin.iceGridTest(testdir, name, "simple_server.xml", "--with-deploy") -sys.exit(0) + IceGridAdmin.iceGridTest("simple_server.xml", "--with-deploy") diff --git a/cs/test/IceSSL/certs/makecerts.py b/cs/test/IceSSL/certs/makecerts.py index 9664cc7ec32..d8714567182 100755 --- a/cs/test/IceSSL/certs/makecerts.py +++ b/cs/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/cs/test/IceSSL/configuration/run.py b/cs/test/IceSSL/configuration/run.py index a21f6a11f0e..e9ab6598ce1 100755 --- a/cs/test/IceSSL/configuration/run.py +++ b/cs/test/IceSSL/configuration/run.py @@ -10,24 +10,18 @@ import os, sys, getopt -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("IceSSL", "configuration") - -testdir = os.path.dirname(os.path.abspath(__file__)) +sys.path.append(os.path.join(path[0])) +from scripts import * # # The drive letter needs to be removed on Windows or loading the SSL # plugin will not work. # -TestUtil.clientServerTestWithOptions(name, "", " " + os.path.splitdrive(testdir)[1]) -sys.exit(0) +TestUtil.clientServerTest(additionalClientOptions=os.path.splitdrive(os.getcwd())[1]) diff --git a/cs/test/IceUtil/inputUtil/run.py b/cs/test/IceUtil/inputUtil/run.py index be190ef14ad..223bd364614 100755 --- a/cs/test/IceUtil/inputUtil/run.py +++ b/cs/test/IceUtil/inputUtil/run.py @@ -10,29 +10,19 @@ import os, sys, getopt -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__)) -client = os.path.join(testdir, "client") +client = os.path.join(os.getcwd(), "client") print "starting client...", -clientPipe = TestUtil.startClient(client, "") +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/cs/test/Slice/keyword/run.py b/cs/test/Slice/keyword/run.py index 93c2ae5a686..ecef61f616a 100755 --- a/cs/test/Slice/keyword/run.py +++ b/cs/test/Slice/keyword/run.py @@ -10,29 +10,19 @@ import os, sys, getopt -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__)) -client = os.path.join(testdir, "client") +client = os.path.join(os.getcwd(), "client") print "starting client...", -clientPipe = TestUtil.startClient(client, "") +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/demoscript/Freeze/library.py b/demoscript/Freeze/library.py index 578b990a38b..10838888f23 100755 --- a/demoscript/Freeze/library.py +++ b/demoscript/Freeze/library.py @@ -9,7 +9,7 @@ # ********************************************************************** import sys -import demoscript.Expect as Expect +from scripts import Expect def dequote(s): cur = 0 diff --git a/demoscript/Freeze/phonebook.py b/demoscript/Freeze/phonebook.py index aa8927adabd..bc78bf9839b 100755 --- a/demoscript/Freeze/phonebook.py +++ b/demoscript/Freeze/phonebook.py @@ -9,7 +9,7 @@ # ********************************************************************** import sys -import demoscript.Expect as Expect +from scripts import Expect def dequote(s): cur = 0 diff --git a/demoscript/Freeze/transform.py b/demoscript/Freeze/transform.py index 5bd8568dd0a..ae2fb0178d0 100755 --- a/demoscript/Freeze/transform.py +++ b/demoscript/Freeze/transform.py @@ -9,7 +9,7 @@ # ********************************************************************** import sys, demoscript, time -import demoscript.Expect as Expect +from scripts import Expect def run(createCmd, recreateCmd, readCmd, readnewCmd): print "cleaning databases...", diff --git a/demoscript/Glacier2/callback.py b/demoscript/Glacier2/callback.py index 6bd8230e1b8..afe70688c13 100755 --- a/demoscript/Glacier2/callback.py +++ b/demoscript/Glacier2/callback.py @@ -9,7 +9,7 @@ # ********************************************************************** import sys, time, signal -import demoscript.Expect as Expect +from scripts import Expect def run(client, server, sessionserver, glacier2): print "testing ", diff --git a/demoscript/Ice/__init__.py b/demoscript/Ice/__init__.py index 399e651aea7..399e651aea7 100755..100644 --- a/demoscript/Ice/__init__.py +++ b/demoscript/Ice/__init__.py diff --git a/demoscript/Ice/async.py b/demoscript/Ice/async.py index 10c6b48ac63..7f10f323cd4 100755..100644 --- a/demoscript/Ice/async.py +++ b/demoscript/Ice/async.py @@ -10,6 +10,7 @@ import sys from demoscript import * +from scripts import Expect def run(client, server): print "testing client... ", diff --git a/demoscript/Ice/bidir.py b/demoscript/Ice/bidir.py index 7a8ab56a1de..773996d86c7 100755..100644 --- a/demoscript/Ice/bidir.py +++ b/demoscript/Ice/bidir.py @@ -10,6 +10,7 @@ import sys, signal from demoscript import * +from scripts import Expect def run(clientStr, server): print "adding client 1... ", diff --git a/demoscript/Ice/callback.py b/demoscript/Ice/callback.py index 59facf278e9..3ded68df764 100755..100644 --- a/demoscript/Ice/callback.py +++ b/demoscript/Ice/callback.py @@ -10,6 +10,7 @@ import sys from demoscript import * +from scripts import Expect def runtests(client, server, secure): print "testing twoway", diff --git a/demoscript/Ice/hello.py b/demoscript/Ice/hello.py index aa6b7bb0d32..967a024587a 100755..100644 --- a/demoscript/Ice/hello.py +++ b/demoscript/Ice/hello.py @@ -10,6 +10,7 @@ import sys from demoscript import * +from scripts import Expect def runtests(client, server, secure): print "testing twoway", diff --git a/demoscript/Ice/invoke.py b/demoscript/Ice/invoke.py index be7ad5424ed..a6ae0569cf5 100755..100644 --- a/demoscript/Ice/invoke.py +++ b/demoscript/Ice/invoke.py @@ -8,8 +8,9 @@ # # ********************************************************************** -import sys, demoscript +import sys from demoscript import * +from scripts import Expect def run(client, server): print "testing...", diff --git a/demoscript/Ice/multicast.py b/demoscript/Ice/multicast.py index a1f0c3a04e3..9a189bf5c82 100755..100644 --- a/demoscript/Ice/multicast.py +++ b/demoscript/Ice/multicast.py @@ -10,6 +10,7 @@ import sys, signal from demoscript import * +from scripts import Expect def runClient(clientCmd, server1, server2): client = Util.spawn(clientCmd) diff --git a/demoscript/Ice/nested.py b/demoscript/Ice/nested.py index 4c67f7e346b..7c3f728d446 100755..100644 --- a/demoscript/Ice/nested.py +++ b/demoscript/Ice/nested.py @@ -10,6 +10,7 @@ import sys, signal from demoscript import * +from scripts import Expect def run(client, server): print "testing nested...", diff --git a/demoscript/Ice/session.py b/demoscript/Ice/session.py index 1d9ae3992eb..3c33d57b1af 100755..100644 --- a/demoscript/Ice/session.py +++ b/demoscript/Ice/session.py @@ -10,6 +10,7 @@ import sys from demoscript import * +from scripts import Expect def run(clientStr, server): client = Util.spawn(clientStr) diff --git a/demoscript/Ice/throughput.py b/demoscript/Ice/throughput.py index 5b812b439d0..1fef2aa7607 100755..100644 --- a/demoscript/Ice/throughput.py +++ b/demoscript/Ice/throughput.py @@ -10,6 +10,7 @@ import sys from demoscript import * +from scripts import Expect def runseries(client): client.expect('==> ', timeout=240) diff --git a/demoscript/Ice/value.py b/demoscript/Ice/value.py index 7db2275e7ee..430c629d3bd 100755..100644 --- a/demoscript/Ice/value.py +++ b/demoscript/Ice/value.py @@ -10,6 +10,7 @@ import sys from demoscript import * +from scripts import Expect def run(client, server, ruby = False): print "testing...", diff --git a/demoscript/IceBox/hello.py b/demoscript/IceBox/hello.py index 11cf23a206c..4f611174de9 100755 --- a/demoscript/IceBox/hello.py +++ b/demoscript/IceBox/hello.py @@ -9,7 +9,7 @@ # ********************************************************************** import sys, demoscript -import demoscript.Expect as Expect +from scripts import Expect def runtests(client, server, secure): print "testing twoway", diff --git a/demoscript/IceGrid/allocate.py b/demoscript/IceGrid/allocate.py index 89c7e2975db..9493c63b9ae 100755 --- a/demoscript/IceGrid/allocate.py +++ b/demoscript/IceGrid/allocate.py @@ -10,6 +10,7 @@ import sys, os from demoscript import * +from scripts import Expect def run(clientCmd): print "cleaning databases...", diff --git a/demoscript/IceGrid/icebox.py b/demoscript/IceGrid/icebox.py index edd2f581fc9..117a8cc6c3b 100755 --- a/demoscript/IceGrid/icebox.py +++ b/demoscript/IceGrid/icebox.py @@ -10,6 +10,7 @@ import sys, time, os from demoscript import * +from scripts import Expect def run(clientStr, desc = 'application'): print "cleaning databases...", diff --git a/demoscript/IceGrid/sessionActivation.py b/demoscript/IceGrid/sessionActivation.py index d6b2f93bef2..00af6e41346 100755 --- a/demoscript/IceGrid/sessionActivation.py +++ b/demoscript/IceGrid/sessionActivation.py @@ -10,6 +10,7 @@ import sys, os from demoscript import * +from scripts import Expect def run(clientCmd): print "cleaning databases...", diff --git a/demoscript/IceGrid/simple.py b/demoscript/IceGrid/simple.py index c13b143998d..62400215c06 100755 --- a/demoscript/IceGrid/simple.py +++ b/demoscript/IceGrid/simple.py @@ -10,6 +10,7 @@ import sys, time, os from demoscript import * +from scripts import Expect def run(clientStr, desc = 'application'): print "cleaning databases...", diff --git a/demoscript/IceStorm/clock.py b/demoscript/IceStorm/clock.py index 607a3b37c89..1409b850d4a 100755 --- a/demoscript/IceStorm/clock.py +++ b/demoscript/IceStorm/clock.py @@ -10,6 +10,7 @@ import sys, time, signal from demoscript import * +from scripts import Expect def runtest(icestorm, subCmd, subargs, pubCmd, pubargs): print "testing pub%s/sub%s..." % (pubargs, subargs), diff --git a/demoscript/Util.py b/demoscript/Util.py index 55d1d555f7c..3f1839bc6bb 100755..100644 --- a/demoscript/Util.py +++ b/demoscript/Util.py @@ -14,12 +14,25 @@ import re import os import signal import time -import Expect + +# Locate the top level directory of the demo dist (or the top of the +# source tree for a source dist). +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, "demoscript")) ] +toplevel = path[0] +if os.path.isdir(os.path.join(toplevel, "cpp")): + sourcedist = True +else: + sourcedist = False + +from scripts import Expect keepGoing = False iceHome = None x64 = False -toplevel = None demoErrors = [] # @@ -32,18 +45,6 @@ host = "127.0.0.1" # debug = False -# Locate the top level directory of the demo dist (or the top of the -# source tree for a source dist). -path = [ ".", "..", "../..", "../../..", "../../../.." ] -head, tail = os.path.split(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, "demoscript")) ] -toplevel = path[0] -if os.path.isdir(os.path.join(toplevel, "cpp")): - sourcedist = True -else: - sourcedist = False origenv = {} def dumpenv(): @@ -408,29 +409,28 @@ def guessBuildModeForDir(cwd): return None def guessBuildMode(): - m = guessBuildModeForDir(".") - if m is None and not iceHome and sourcedist: + if not iceHome and sourcedist: m = guessBuildModeForDir(os.path.join(toplevel, "cpp", "bin")) + else: + m = guessBuildModeForDir(".") if m is None: raise "cannot guess debug or release mode" return m -def getBuild(): +def isDebugBuild(): global buildmode # Guess the mode, if not set on the command line. + if not isWin32(): + return False if buildmode is None: buildmode = guessBuildMode() print "(guessed build mode %s)" % buildmode - return buildmode + return buildmode == "debug" def getIceBox(mapping = "cpp"): if mapping == "cpp": - if isWin32(): - mode = getBuild() - if mode == 'release': - return "icebox" - else: - return "iceboxd" + if isWin32() and isDebugBuild(): + return "iceboxd" return "icebox" elif mapping == "cs": if isMono(): # Mono cannot locate icebox in the PATH. diff --git a/demoscript/__init__.py b/demoscript/__init__.py index 3cc5d18355e..e207a485a13 100755..100644 --- a/demoscript/__init__.py +++ b/demoscript/__init__.py @@ -7,4 +7,4 @@ # # ********************************************************************** -__all__ = ["Expect", "Util" ] +__all__ = [ "Util" ] diff --git a/java/allDemos.py b/java/allDemos.py index 4af21249881..654e56c6d9b 100755 --- a/java/allDemos.py +++ b/java/allDemos.py @@ -17,8 +17,8 @@ for toplevel in [".", "..", "../..", "../../..", "../../../.."]: else: raise "can't find toplevel directory!" -sys.path.append(os.path.join(toplevel, "demoscript")) -import Util +sys.path.append(os.path.join(toplevel)) +from demoscript import Util # # List of all basic demos. diff --git a/java/allTests.py b/java/allTests.py index fef48b08121..65dc7854728 100755 --- a/java/allTests.py +++ b/java/allTests.py @@ -12,13 +12,13 @@ import os, sys, re, getopt for toplevel in [".", "..", "../..", "../../..", "../../../.."]: toplevel = os.path.abspath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): + if os.path.exists(os.path.join(toplevel, "scripts", "TestUtil.py")): break else: raise "can't find toplevel directory!" -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil +sys.path.append(os.path.join(toplevel)) +from scripts import * # # List of all basic tests. @@ -54,7 +54,6 @@ tests = [ ("Freeze/evictor", ["core"]), ("Freeze/oldevictor", ["core"]), ("Glacier2/router", ["service"]), - ("Glacier2/attack", ["service"]), ("IceGrid/simple", ["service"]), ("IceSSL/configuration", ["once"]), ] 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() diff --git a/makedist.py b/makedist.py index 4f86db0c5ba..5e77891bd77 100755 --- a/makedist.py +++ b/makedist.py @@ -25,6 +25,7 @@ includeSubDirs = [ \ "vb", \ "rb", \ "config", \ + "scripts", \ "certs", \ "slice", \ "distribution", \ @@ -225,6 +226,7 @@ for d in ["", "cpp", "java", "cs"]: copy(os.path.join(distFilesDir, "src", "common", "Make.rules"), os.path.join(demoDir, "config"), False) copy(os.path.join(distFilesDir, "src", "common", "Make.rules.cs"), os.path.join(demoDir, "config"), False) copy(os.path.join(distFilesDir, "src", "common", "build.properties"), os.path.join(demoDir, "config"), False) +copy(os.path.join(srcDir, "scripts"), os.path.join(demoscriptDir, "scripts")) # Consolidate demoscript and demo distribution with files from each language mapping for d in os.listdir('.'): diff --git a/perf/printIcePerf.py b/perf/printIcePerf.py index 3f19c8f725b..5fdbb47b983 100755 --- a/perf/printIcePerf.py +++ b/perf/printIcePerf.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 * def usage(): print "usage: " + sys.argv[0] + " [-h|--help] [-n|-hostname HOSTNAME] FILENAME ..." diff --git a/perf/printIceStormPerf.py b/perf/printIceStormPerf.py index a3971c5de46..9293d6119c5 100755 --- a/perf/printIceStormPerf.py +++ b/perf/printIceStormPerf.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 * def usage(): print "usage: " + sys.argv[0] + " [-h|--help] [-n|-hostname HOSTNAME] FILENAME ..." diff --git a/perf/runIcePerf.py b/perf/runIcePerf.py index abdb3d1b4f9..57489ed7bea 100755 --- a/perf/runIcePerf.py +++ b/perf/runIcePerf.py @@ -25,7 +25,7 @@ else: raise "can't find toplevel directory!" sys.path.append(os.path.join(toplevel, "config")) -import TestUtil +from scripts import * def usage(): print "usage: " + sys.argv[0] + " [-h|--help] [-i|--iter N] [-n|--hostname HOSTNAME] [-o|--output FILENAME]" diff --git a/perf/runIceStormPerf.py b/perf/runIceStormPerf.py index 658f126a656..5ee84991ea3 100755 --- a/perf/runIceStormPerf.py +++ b/perf/runIceStormPerf.py @@ -24,7 +24,7 @@ else: raise "can't find toplevel directory!" sys.path.append(os.path.join(toplevel, "config")) -import TestUtil +from scripts import * latencyRepetitions = 10000 throughputRepetitions = 30000 diff --git a/php/allTests.py b/php/allTests.py index 19221ac2976..b0be0d0e0af 100755 --- a/php/allTests.py +++ b/php/allTests.py @@ -12,13 +12,13 @@ import os, sys, re, getopt for toplevel in [".", "..", "../..", "../../..", "../../../.."]: toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): + if os.path.exists(os.path.join(toplevel, "scripts", "TestUtil.py")): break else: raise "can't find toplevel directory!" -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil +sys.path.append(os.path.join(toplevel)) +from scripts import * # # List of all basic tests. diff --git a/php/test/Ice/binding/run.py b/php/test/Ice/binding/run.py index 02f04424efa..2a3d5ec3417 100755 --- a/php/test/Ice/binding/run.py +++ b/php/test/Ice/binding/run.py @@ -10,18 +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") - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/php/test/Ice/exceptions/run.py b/php/test/Ice/exceptions/run.py index aeab22f3a0a..cf6e0e3ee0e 100755 --- a/php/test/Ice/exceptions/run.py +++ b/php/test/Ice/exceptions/run.py @@ -10,21 +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(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "exceptions") +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -TestUtil.clientServerTest(name) +TestUtil.clientServerTest() print "tests with AMD server." -TestUtil.clientServerTestWithOptionsAndNames(name, "", "", "serveramd", "Client.php") -sys.exit(0) +TestUtil.clientServerTest(server="serveramd") diff --git a/php/test/Ice/facets/run.py b/php/test/Ice/facets/run.py index 2eef80e9011..2a3d5ec3417 100755 --- a/php/test/Ice/facets/run.py +++ b/php/test/Ice/facets/run.py @@ -10,18 +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", "facets") - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/php/test/Ice/inheritance/run.py b/php/test/Ice/inheritance/run.py index 74a707fc96b..2a3d5ec3417 100755 --- a/php/test/Ice/inheritance/run.py +++ b/php/test/Ice/inheritance/run.py @@ -10,18 +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", "inheritance") - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/php/test/Ice/objects/run.py b/php/test/Ice/objects/run.py index 6a961a01ef6..2a3d5ec3417 100755 --- a/php/test/Ice/objects/run.py +++ b/php/test/Ice/objects/run.py @@ -10,18 +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", "objects") - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/php/test/Ice/operations/run.py b/php/test/Ice/operations/run.py index e9e27457d59..cf6e0e3ee0e 100755 --- a/php/test/Ice/operations/run.py +++ b/php/test/Ice/operations/run.py @@ -10,21 +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(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "operations") +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -TestUtil.clientServerTest(name) +TestUtil.clientServerTest() print "tests with AMD server." -TestUtil.clientServerTestWithOptionsAndNames(name, "", "", "serveramd", "Client.php") -sys.exit(0) +TestUtil.clientServerTest(server="serveramd") diff --git a/php/test/Ice/proxy/run.py b/php/test/Ice/proxy/run.py index ff506c96978..cf6e0e3ee0e 100755 --- a/php/test/Ice/proxy/run.py +++ b/php/test/Ice/proxy/run.py @@ -10,21 +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(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "proxy") +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -TestUtil.clientServerTest(name) +TestUtil.clientServerTest() print "tests with AMD server." -TestUtil.clientServerTestWithOptionsAndNames(name, "", "", "serveramd", "Client.php") -sys.exit(0) +TestUtil.clientServerTest(server="serveramd") diff --git a/php/test/Ice/slicing/exceptions/run.py b/php/test/Ice/slicing/exceptions/run.py index 7716a243f26..febb64b1e51 100755 --- a/php/test/Ice/slicing/exceptions/run.py +++ b/php/test/Ice/slicing/exceptions/run.py @@ -10,18 +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", "slicing", "exceptions") - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/php/test/Ice/slicing/objects/run.py b/php/test/Ice/slicing/objects/run.py index de3773f6762..febb64b1e51 100755 --- a/php/test/Ice/slicing/objects/run.py +++ b/php/test/Ice/slicing/objects/run.py @@ -10,18 +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", "slicing", "objects") - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/php/test/Slice/keyword/run.py b/php/test/Slice/keyword/run.py index a92a5a7d39b..ea8b3a46bd5 100755 --- a/php/test/Slice/keyword/run.py +++ b/php/test/Slice/keyword/run.py @@ -10,35 +10,21 @@ 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__)) +testdir = os.getcwd() client = os.path.join(testdir, "Client.php") print "starting client...", -clientPipe = TestUtil.startClient(client, "") +clientProc = TestUtil.startClient(client) print "ok" - -TestUtil.printOutputFromPipe(clientPipe) - -clientStatus = TestUtil.closePipe(clientPipe) - -if os.path.exists("tmp.ini"): - os.remove("tmp.ini") - -if clientStatus: - sys.exit(1) - -sys.exit(0) +clientProc.waitTestSuccess() diff --git a/py/allDemos.py b/py/allDemos.py index b8b3855bdc6..a10fe77ffef 100755 --- a/py/allDemos.py +++ b/py/allDemos.py @@ -17,8 +17,8 @@ for toplevel in [".", "..", "../..", "../../..", "../../../.."]: else: raise "can't find toplevel directory!" -sys.path.append(os.path.join(toplevel, "demoscript")) -import Util +sys.path.append(os.path.join(toplevel)) +from demoscript import Util # # List of all basic demos. diff --git a/py/allTests.py b/py/allTests.py index b603ffae41d..945d04d6aea 100755 --- a/py/allTests.py +++ b/py/allTests.py @@ -12,13 +12,13 @@ import os, sys, re, getopt for toplevel in [".", "..", "../..", "../../..", "../../../.."]: toplevel = os.path.abspath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): + if os.path.exists(os.path.join(toplevel, "scripts", "TestUtil.py")): break else: raise "can't find toplevel directory!" -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil +sys.path.append(os.path.join(toplevel)) +from scripts import * # # List of all basic tests. diff --git a/py/test/Ice/adapterDeactivation/run.py b/py/test/Ice/adapterDeactivation/run.py index a094c546746..dcb8454ad37 100755 --- a/py/test/Ice/adapterDeactivation/run.py +++ b/py/test/Ice/adapterDeactivation/run.py @@ -10,19 +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") - -TestUtil.clientServerTest(name) -TestUtil.collocatedTest(name) -sys.exit(0) +TestUtil.clientServerTest() +TestUtil.collocatedTest() diff --git a/py/test/Ice/binding/run.py b/py/test/Ice/binding/run.py index a0304394366..2a3d5ec3417 100755 --- a/py/test/Ice/binding/run.py +++ b/py/test/Ice/binding/run.py @@ -10,23 +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") - -# -# Need to use mixedClientServerTest instead of clientServerTest, because the -# server makes an invocation on a local object and therefore requires the -# client-side SSL configuration. -# -TestUtil.mixedClientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/py/test/Ice/blobject/run.py b/py/test/Ice/blobject/run.py index aac96096db2..b31660e7e4c 100755 --- a/py/test/Ice/blobject/run.py +++ b/py/test/Ice/blobject/run.py @@ -15,18 +15,14 @@ if sys.version_info[1] == 3 and sys.platform != 'darwin': print "Test skipped due to python 2.3" sys.exit(0) -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", "blobject") - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/py/test/Ice/checksum/run.py b/py/test/Ice/checksum/run.py index 65fc9c9621b..2a3d5ec3417 100755 --- a/py/test/Ice/checksum/run.py +++ b/py/test/Ice/checksum/run.py @@ -10,18 +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", "checksum") - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/py/test/Ice/custom/run.py b/py/test/Ice/custom/run.py index c22501a2c9b..2a3d5ec3417 100755 --- a/py/test/Ice/custom/run.py +++ b/py/test/Ice/custom/run.py @@ -10,18 +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", "custom") - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/py/test/Ice/exceptions/run.py b/py/test/Ice/exceptions/run.py index f5153ac8666..2de58587328 100755 --- a/py/test/Ice/exceptions/run.py +++ b/py/test/Ice/exceptions/run.py @@ -10,23 +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(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "exceptions") +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -TestUtil.clientServerTest(name) +TestUtil.clientServerTest() print "tests with AMD server." -TestUtil.clientServerTestWithOptionsAndNames(name, "", "", "ServerAMD.py", "Client.py") +TestUtil.clientServerTest(server="ServerAMD.py") print "tests with collocated server." -TestUtil.collocatedTest(name) -sys.exit(0) +TestUtil.collocatedTest() diff --git a/py/test/Ice/facets/run.py b/py/test/Ice/facets/run.py index b3afa6aeb5f..dcb8454ad37 100755 --- a/py/test/Ice/facets/run.py +++ b/py/test/Ice/facets/run.py @@ -10,19 +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") - -TestUtil.clientServerTest(name) -TestUtil.collocatedTest(name) -sys.exit(0) +TestUtil.clientServerTest() +TestUtil.collocatedTest() diff --git a/py/test/Ice/faultTolerance/run.py b/py/test/Ice/faultTolerance/run.py index 5191ac0b503..444473efb53 100755 --- a/py/test/Ice/faultTolerance/run.py +++ b/py/test/Ice/faultTolerance/run.py @@ -10,50 +10,36 @@ 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.join(toplevel, "py", "test", name) - -cwd = os.getcwd() -os.chdir(testdir) - -server = "Server.py" -client = "Client.py" +server = os.path.join(os.getcwd(), "Server.py") +client = os.path.join(os.getcwd(), "Client.py") num = 12 base = 12340 +serverProc = [] for i in range(0, num): print "starting server #%d..." % (i + 1), sys.stdout.flush() - serverPipe = TestUtil.startServer(server, "%d" % (base + i)) - TestUtil.getServerPid(serverPipe) - 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) +clientProc = TestUtil.startClient(client, ports) print "ok" -TestUtil.printOutputFromPipe(clientPipe) -clientStatus = TestUtil.closePipe(clientPipe) -if clientStatus: - TestUtil.killServers() - -if clientStatus or TestUtil.serverStatus(): - sys.exit(1) - -sys.exit(0) +clientProc.waitTestSuccess() +for p in serverProc: + p.waitTestSuccess() diff --git a/py/test/Ice/inheritance/run.py b/py/test/Ice/inheritance/run.py index 7ecff0e5ae5..dcb8454ad37 100755 --- a/py/test/Ice/inheritance/run.py +++ b/py/test/Ice/inheritance/run.py @@ -10,19 +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") - -TestUtil.clientServerTest(name) -TestUtil.collocatedTest(name) -sys.exit(0) +TestUtil.clientServerTest() +TestUtil.collocatedTest() diff --git a/py/test/Ice/location/run.py b/py/test/Ice/location/run.py index 177ebe2fb41..2a3d5ec3417 100755 --- a/py/test/Ice/location/run.py +++ b/py/test/Ice/location/run.py @@ -10,18 +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") - -TestUtil.mixedClientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/py/test/Ice/objects/run.py b/py/test/Ice/objects/run.py index 81b178ba4f4..dcb8454ad37 100755 --- a/py/test/Ice/objects/run.py +++ b/py/test/Ice/objects/run.py @@ -10,19 +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") - -TestUtil.clientServerTest(name) -TestUtil.collocatedTest(name) -sys.exit(0) +TestUtil.clientServerTest() +TestUtil.collocatedTest() diff --git a/py/test/Ice/operations/Client.py b/py/test/Ice/operations/Client.py index e4a3fd608f4..dca3994a058 100755 --- a/py/test/Ice/operations/Client.py +++ b/py/test/Ice/operations/Client.py @@ -9,6 +9,7 @@ # ********************************************************************** import os, sys, traceback +import Ice import Ice slice_dir = Ice.getSliceDir() diff --git a/py/test/Ice/operations/run.py b/py/test/Ice/operations/run.py index 39ed6740919..3a25c7c894e 100755 --- a/py/test/Ice/operations/run.py +++ b/py/test/Ice/operations/run.py @@ -10,23 +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(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "operations") +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -TestUtil.clientServerTest(name) +TestUtil.clientServerTest() print "tests with AMD server." -TestUtil.clientServerTestWithOptionsAndNames(name, "", "", "ServerAMD.py", "Client.py") +TestUtil.clientServerTest(server="ServerAMD.py") print "tests with collocated server." -TestUtil.collocatedTestWithOptions(name, " --Ice.ThreadPool.Client.SizeMax=2 --Ice.ThreadPool.Client.SizeWarn=0") -sys.exit(0) +TestUtil.collocatedTest(" --Ice.ThreadPool.Client.SizeMax=2 --Ice.ThreadPool.Client.SizeWarn=0") diff --git a/py/test/Ice/proxy/run.py b/py/test/Ice/proxy/run.py index 2aa17f08bd3..3a25c7c894e 100755 --- a/py/test/Ice/proxy/run.py +++ b/py/test/Ice/proxy/run.py @@ -10,23 +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(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "proxy") +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -TestUtil.clientServerTest(name) +TestUtil.clientServerTest() print "tests with AMD server." -TestUtil.clientServerTestWithOptionsAndNames(name, "", "", "ServerAMD.py", "Client.py") +TestUtil.clientServerTest(server="ServerAMD.py") print "tests with collocated server." -TestUtil.collocatedTestWithOptions(name, " --Ice.ThreadPool.Client.SizeMax=2 --Ice.ThreadPool.Client.SizeWarn=0") -sys.exit(0) +TestUtil.collocatedTest(" --Ice.ThreadPool.Client.SizeMax=2 --Ice.ThreadPool.Client.SizeWarn=0") diff --git a/py/test/Ice/retry/run.py b/py/test/Ice/retry/run.py index f0bc8d57120..2a3d5ec3417 100755 --- a/py/test/Ice/retry/run.py +++ b/py/test/Ice/retry/run.py @@ -10,18 +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") - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/py/test/Ice/servantLocator/run.py b/py/test/Ice/servantLocator/run.py index d8d4a2e1c73..3a25c7c894e 100755 --- a/py/test/Ice/servantLocator/run.py +++ b/py/test/Ice/servantLocator/run.py @@ -10,23 +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(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "servantLocator") +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -TestUtil.clientServerTest(name) +TestUtil.clientServerTest() print "tests with AMD server." -TestUtil.clientServerTestWithOptionsAndNames(name, "", "", "ServerAMD.py", "Client.py") +TestUtil.clientServerTest(server="ServerAMD.py") print "tests with collocated server." -TestUtil.collocatedTestWithOptions(name, " --Ice.ThreadPool.Client.SizeMax=2 --Ice.ThreadPool.Client.SizeWarn=0") -sys.exit(0) +TestUtil.collocatedTest(" --Ice.ThreadPool.Client.SizeMax=2 --Ice.ThreadPool.Client.SizeWarn=0") diff --git a/py/test/Ice/slicing/exceptions/run.py b/py/test/Ice/slicing/exceptions/run.py index fd8cccc1533..0914250c192 100755 --- a/py/test/Ice/slicing/exceptions/run.py +++ b/py/test/Ice/slicing/exceptions/run.py @@ -10,21 +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(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "slicing", "exceptions") +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -TestUtil.clientServerTest(name) +TestUtil.clientServerTest() print "tests with AMD server." -TestUtil.clientServerTestWithOptionsAndNames(name, "", "", "ServerAMD.py", "Client.py") -sys.exit(0) +TestUtil.clientServerTest(server="ServerAMD.py") diff --git a/py/test/Ice/slicing/objects/run.py b/py/test/Ice/slicing/objects/run.py index 65f973cda48..0914250c192 100755 --- a/py/test/Ice/slicing/objects/run.py +++ b/py/test/Ice/slicing/objects/run.py @@ -10,21 +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(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "slicing", "objects") +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -TestUtil.clientServerTest(name) +TestUtil.clientServerTest() print "tests with AMD server." -TestUtil.clientServerTestWithOptionsAndNames(name, "", "", "ServerAMD.py", "Client.py") -sys.exit(0) +TestUtil.clientServerTest(server="ServerAMD.py") diff --git a/py/test/Ice/timeout/run.py b/py/test/Ice/timeout/run.py index f04e73b903a..2a3d5ec3417 100755 --- a/py/test/Ice/timeout/run.py +++ b/py/test/Ice/timeout/run.py @@ -10,18 +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") - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/py/test/Slice/keyword/run.py b/py/test/Slice/keyword/run.py index 1e8824ce002..9864d605819 100755 --- a/py/test/Slice/keyword/run.py +++ b/py/test/Slice/keyword/run.py @@ -10,31 +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(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -testdir = os.path.dirname(os.path.abspath(__file__)) - -cwd = os.getcwd() -os.chdir(testdir) +sys.path.append(os.path.join(path[0])) +from scripts import * print "starting client...", -clientPipe = os.popen("python Client.py --Ice.Default.Host=127.0.0.1 2>&1") +clientProc = TestUtil.startClient("Client.py", "--Ice.Default.Host=127.0.0.1") print "ok" - -TestUtil.printOutputFromPipe(clientPipe); - -clientStatus = TestUtil.closePipe(clientPipe) - -if clientStatus: - sys.exit(1) - -sys.exit(0) +clientProc.waitTestSuccess() diff --git a/rb/allDemos.py b/rb/allDemos.py index 428bb0998e3..57f36bfc9c9 100755 --- a/rb/allDemos.py +++ b/rb/allDemos.py @@ -17,8 +17,8 @@ for toplevel in [".", "..", "../..", "../../..", "../../../.."]: else: raise "can't find toplevel directory!" -sys.path.append(os.path.join(toplevel, "demoscript")) -import Util +sys.path.append(os.path.join(toplevel)) +from demoscript import Util # # List of all basic demos. diff --git a/rb/allTests.py b/rb/allTests.py index 10e469f7678..9360bf00ebe 100755 --- a/rb/allTests.py +++ b/rb/allTests.py @@ -12,13 +12,13 @@ import os, sys, re, getopt for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: toplevel = os.path.abspath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): + if os.path.exists(os.path.join(toplevel, "scripts", "TestUtil.py")): break else: raise "can't find toplevel directory!" -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil +sys.path.append(os.path.join(toplevel)) +from scripts import * # # List of all basic tests. diff --git a/rb/ruby/Ice.rb b/rb/ruby/Ice.rb index 0d30fb74e13..2f60ab2e593 100644 --- a/rb/ruby/Ice.rb +++ b/rb/ruby/Ice.rb @@ -55,6 +55,7 @@ module Ice return nil end + # # Exceptions. # diff --git a/rb/test/Ice/binding/run.py b/rb/test/Ice/binding/run.py index 4be3edf8978..2a3d5ec3417 100755 --- a/rb/test/Ice/binding/run.py +++ b/rb/test/Ice/binding/run.py @@ -10,18 +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") - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/rb/test/Ice/checksum/run.py b/rb/test/Ice/checksum/run.py index 3f26f43dab1..25ae655217e 100755 --- a/rb/test/Ice/checksum/run.py +++ b/rb/test/Ice/checksum/run.py @@ -10,18 +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", "checksum") - -TestUtil.clientServerTestWithOptionsAndNames(name, '', '', 'server/server', 'Client.rb') -sys.exit(0) +TestUtil.clientServerTest(server='server/server') diff --git a/rb/test/Ice/exceptions/run.py b/rb/test/Ice/exceptions/run.py index 0b589e39bde..622e4e2954a 100755 --- a/rb/test/Ice/exceptions/run.py +++ b/rb/test/Ice/exceptions/run.py @@ -10,21 +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(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "exceptions") +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -TestUtil.clientServerTest(name) +TestUtil.clientServerTest() print "tests with AMD server." -TestUtil.clientServerTestWithOptionsAndNames(name, "", "", "serveramd", "Client.rb") +TestUtil.clientServerTest(server="serveramd") sys.exit(0) diff --git a/rb/test/Ice/facets/run.py b/rb/test/Ice/facets/run.py index fc927877498..2a3d5ec3417 100755 --- a/rb/test/Ice/facets/run.py +++ b/rb/test/Ice/facets/run.py @@ -10,18 +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", "facets") - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/rb/test/Ice/inheritance/run.py b/rb/test/Ice/inheritance/run.py index 338e3cfc4e3..2a3d5ec3417 100755 --- a/rb/test/Ice/inheritance/run.py +++ b/rb/test/Ice/inheritance/run.py @@ -10,18 +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", "inheritance") - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/rb/test/Ice/location/run.py b/rb/test/Ice/location/run.py index 29cba96aa87..2a3d5ec3417 100755 --- a/rb/test/Ice/location/run.py +++ b/rb/test/Ice/location/run.py @@ -10,18 +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") - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/rb/test/Ice/objects/run.py b/rb/test/Ice/objects/run.py index 38f7d8c91b8..2a3d5ec3417 100755 --- a/rb/test/Ice/objects/run.py +++ b/rb/test/Ice/objects/run.py @@ -10,18 +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", "objects") - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/rb/test/Ice/operations/run.py b/rb/test/Ice/operations/run.py index 9e6c1ca4fc6..cf6e0e3ee0e 100755 --- a/rb/test/Ice/operations/run.py +++ b/rb/test/Ice/operations/run.py @@ -10,21 +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(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "operations") +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -TestUtil.clientServerTest(name) +TestUtil.clientServerTest() print "tests with AMD server." -TestUtil.clientServerTestWithOptionsAndNames(name, "", "", "serveramd", "Client.rb") -sys.exit(0) +TestUtil.clientServerTest(server="serveramd") diff --git a/rb/test/Ice/proxy/run.py b/rb/test/Ice/proxy/run.py index 765901ef2b8..622e4e2954a 100755 --- a/rb/test/Ice/proxy/run.py +++ b/rb/test/Ice/proxy/run.py @@ -10,21 +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(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "proxy") +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -TestUtil.clientServerTest(name) +TestUtil.clientServerTest() print "tests with AMD server." -TestUtil.clientServerTestWithOptionsAndNames(name, "", "", "serveramd", "Client.rb") +TestUtil.clientServerTest(server="serveramd") sys.exit(0) diff --git a/rb/test/Ice/retry/Client.rb b/rb/test/Ice/retry/Client.rb index 9eb83694976..ed039184494 100755 --- a/rb/test/Ice/retry/Client.rb +++ b/rb/test/Ice/retry/Client.rb @@ -10,10 +10,6 @@ require 'pathname' require 'Ice' -# The tests shouldn't use ICE_HOME unless USE_BIN_DIST=yes is set. -if ENV::has_key?("ICE_HOME") and ENV["USE_BIN_DIST"] != "yes" - ENV.delete("ICE_HOME") -end slice_dir = Ice.getSliceDir if not slice_dir: fail "Slice directory not found" diff --git a/rb/test/Ice/retry/run.py b/rb/test/Ice/retry/run.py index 68c7cc3dc5e..2a3d5ec3417 100755 --- a/rb/test/Ice/retry/run.py +++ b/rb/test/Ice/retry/run.py @@ -10,18 +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") - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/rb/test/Ice/slicing/exceptions/run.py b/rb/test/Ice/slicing/exceptions/run.py index 7716a243f26..febb64b1e51 100755 --- a/rb/test/Ice/slicing/exceptions/run.py +++ b/rb/test/Ice/slicing/exceptions/run.py @@ -10,18 +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", "slicing", "exceptions") - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/rb/test/Ice/slicing/objects/run.py b/rb/test/Ice/slicing/objects/run.py index de3773f6762..febb64b1e51 100755 --- a/rb/test/Ice/slicing/objects/run.py +++ b/rb/test/Ice/slicing/objects/run.py @@ -10,18 +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", "slicing", "objects") - -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/rb/test/Ice/timeout/run.py b/rb/test/Ice/timeout/run.py index 37bb863ea8e..a70ca1dbc9e 100755 --- a/rb/test/Ice/timeout/run.py +++ b/rb/test/Ice/timeout/run.py @@ -10,19 +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(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -name = os.path.join("Ice", "timeout") +sys.path.append(os.path.join(path[0])) +from scripts import * print "tests with regular server." -TestUtil.clientServerTest(name) -sys.exit(0) +TestUtil.clientServerTest() diff --git a/rb/test/Slice/keyword/run.py b/rb/test/Slice/keyword/run.py index 1ad9e674838..7d414779290 100755 --- a/rb/test/Slice/keyword/run.py +++ b/rb/test/Slice/keyword/run.py @@ -10,31 +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(toplevel, "config")) -import TestUtil -TestUtil.processCmdLine() - -testdir = os.path.dirname(os.path.abspath(__file__)) - -cwd = os.getcwd() -os.chdir(testdir) +sys.path.append(os.path.join(path[0])) +from scripts import * print "starting client...", -clientPipe = os.popen("ruby Client.rb --Ice.Default.Host=127.0.0.1 2>&1") +clientProc = TestUtil.startClient("Client.rb", "--Ice.Default.Host=127.0.0.1") print "ok" - -TestUtil.printOutputFromPipe(clientPipe); - -clientStatus = TestUtil.closePipe(clientPipe) - -if clientStatus: - sys.exit(1) - -sys.exit(0) +clientProc.waitTestSuccess() diff --git a/demoscript/Expect.py b/scripts/Expect.py index c97ef8fad51..76515bc1759 100755 --- a/demoscript/Expect.py +++ b/scripts/Expect.py @@ -76,6 +76,9 @@ class reader(threading.Thread): self.buf = StringIO.StringIO() self.cv = threading.Condition() self.p = p + self._trace = False + self._tbuf = StringIO.StringIO() + self._tracesupress = None self.logfile = logfile threading.Thread.__init__(self) @@ -88,6 +91,7 @@ class reader(threading.Thread): self.cv.acquire() try: + self.trace(c) self.buf.write(c) self.cv.notify() finally: @@ -95,6 +99,32 @@ class reader(threading.Thread): except IOError, e: print e + def trace(self, c): + if self._trace: + self._tbuf.write(c) + if c == '\n': + content = self._tbuf.getvalue() + supress = False + if self._tracesupress: + for p in self._tracesupress: + if p.search(content): + supress = True + break + if not supress: + sys.stdout.write(content) + self._tbuf.truncate(0) + + def enabletrace(self, supress = None): + self.cv.acquire() + try: + if not self._trace: + self._trace = True + self._tracesupress = supress + for c in self.buf.getvalue(): + self.trace(c) + finally: + self.cv.release() + def getbuf(self): self.cv.acquire() try: @@ -205,7 +235,7 @@ class reader(threading.Thread): self.cv.release() class Expect (object): - def __init__(self, command, timeout=30, logfile=None, mapping = None, desc = None, cwd = None): + def __init__(self, command, timeout=30, logfile=None, mapping = None, desc = None, cwd = None, env = None): self.buf = "" # The part before the match self.before = "" # The part before the match self.after = "" # The part after the match @@ -227,11 +257,11 @@ class Expect (object): #import win32process #creationflags = win32process.CREATE_NEW_PROCESS_GROUP) CREATE_NEW_PROCESS_GROUP = 512 - self.p = subprocess.Popen(command, cwd = cwd, shell=False, bufsize=0, stdin=subprocess.PIPE, + self.p = subprocess.Popen(command, env = env, cwd = cwd, shell=False, bufsize=0, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, creationflags = 512) # CREATE_NEW_PROCESS_GROUP else: - self.p = subprocess.Popen(command, cwd = cwd, shell=True, bufsize=0, stdin=subprocess.PIPE, + self.p = subprocess.Popen(command, env = env, cwd = cwd, shell=True, bufsize=0, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) self.r = reader(desc, self.p, logfile) @@ -333,8 +363,7 @@ class Expect (object): # A Windows application with a negative exit status means # killed by CTRL_BREAK. Fudge the exit status. - if win32 and self.exitstatus < 0: - assert self.killed is not None + if win32 and self.exitstatus < 0 and self.killed is not None: self.exitstatus = -self.killed self.p = None self.r.join() @@ -438,6 +467,9 @@ class Expect (object): else: test(self.exitstatus, exitstatus) + def trace(self, supress = None): + self.r.enabletrace(supress) + def hasInterruptSupport(self): """Return True if the application gracefully terminated, False otherwise.""" if win32 and self.mapping == "java": diff --git a/config/IceGridAdmin.py b/scripts/IceGridAdmin.py index 27717ddb02e..f69f0b082e6 100644 --- a/config/IceGridAdmin.py +++ b/scripts/IceGridAdmin.py @@ -17,13 +17,6 @@ from threading import Thread #nreplicas=0 nreplicas=1 -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!" - iceGridPort = 12010; nodeOptions = r' --Ice.Warn.Connections=0' + \ @@ -38,7 +31,7 @@ nodeOptions = r' --Ice.Warn.Connections=0' + \ r' --IceGrid.Node.PrintServersReady=node' + \ r' --Ice.NullHandleAbort' + \ r' --Ice.ThreadPool.Server.Size=0' + \ - r' --Ice.ServerIdleTime=0'; + r' --Ice.ServerIdleTime=0' registryOptions = r' --Ice.Warn.Connections=0' + \ r' --IceGrid.Registry.PermissionsVerifier=IceGrid/NullPermissionsVerifier' + \ @@ -62,7 +55,7 @@ registryOptions = r' --Ice.Warn.Connections=0' + \ r' --IceGrid.Registry.Client.ThreadPool.SizeWarn=0' + \ r' --Ice.ServerIdleTime=0' + \ r' --IceGrid.Registry.DefaultTemplates=' + \ - os.path.abspath(os.path.join(TestUtil.findTopLevel(), "cpp", "config", "templates.xml")) + os.path.abspath(os.path.join(TestUtil.toplevel, "cpp", "config", "templates.xml")) def getDefaultLocatorProperty(): @@ -83,6 +76,7 @@ def startIceGridRegistry(testdir, dynamicRegistration = False): if dynamicRegistration: command += r' --IceGrid.Registry.DynamicRegistration' + procs = [] i = 0 while i < (nreplicas + 1): @@ -108,15 +102,14 @@ def startIceGridRegistry(testdir, dynamicRegistration = False): driverConfig = TestUtil.DriverConfig("server") driverConfig.lang = "cpp" - pipe = TestUtil.startServer(iceGrid, cmd + " 2>&1", driverConfig) - if TestUtil.getDefaultMapping() != "java": - TestUtil.getServerPid(pipe) - TestUtil.getAdapterReady(pipe, True, 4) + proc = TestUtil.startServer(iceGrid, cmd, driverConfig, count = 4) + procs.append(proc) print "ok" i = i + 1 + return procs -def shutdownIceGridRegistry(): +def shutdownIceGridRegistry(procs): i = nreplicas while i > 0: @@ -129,6 +122,9 @@ def shutdownIceGridRegistry(): iceGridAdmin("registry shutdown") print "ok" + for p in procs: + p.waitTestSuccess() + def startIceGridNode(testdir): iceGrid = os.path.join(TestUtil.getCppBinDir(), "icegridnode") @@ -158,15 +154,11 @@ def startIceGridNode(testdir): driverConfig = TestUtil.DriverConfig("server") driverConfig.lang = "cpp" - iceGridPipe = TestUtil.startServer(iceGrid, command + " 2>&1", driverConfig) - if TestUtil.getDefaultMapping() != "java": - TestUtil.getServerPid(iceGridPipe) - TestUtil.getAdapterReady(iceGridPipe, False) - TestUtil.waitServiceReady(iceGridPipe, 'node') + proc = TestUtil.startServer(iceGrid, command, driverConfig, adapter='node') print "ok" - return iceGridPipe + return proc def iceGridAdmin(cmd, ignoreFailure = False): @@ -180,17 +172,12 @@ def iceGridAdmin(cmd, ignoreFailure = False): driverConfig = TestUtil.DriverConfig("client") driverConfig.lang = "cpp" - iceGridAdminPipe = TestUtil.startClient(iceGridAdmin, command + " 2>&1", driverConfig) - - output = iceGridAdminPipe.readlines() - iceGridAdminStatus = TestUtil.closePipe(iceGridAdminPipe) - if not ignoreFailure and iceGridAdminStatus: - for line in output: - print line - TestUtil.killServers() + proc = TestUtil.startClient(iceGridAdmin, command, driverConfig) + status = proc.wait() + if not ignoreFailure and status: + print proc.buf sys.exit(1) - - return output + return proc.buf def killNodeServers(): @@ -199,22 +186,26 @@ def killNodeServers(): iceGridAdmin("server disable " + server, True) iceGridAdmin("server signal " + server + " SIGKILL", True) -def iceGridTest(testdir, name, application, additionalOptions = "", applicationOptions = ""): +def iceGridTest(application, additionalOptions = "", applicationOptions = ""): + testdir = os.getcwd() if not TestUtil.isWin32() and os.getuid() == 0: print print "*** can't run test as root ***" print return + if TestUtil.getDefaultMapping() == "java": + os.environ['CLASSPATH'] = os.path.join(os.getcwd(), "classes") + os.pathsep + os.environ.get("CLASSPATH", "") + client = TestUtil.getDefaultClientFile() if TestUtil.getDefaultMapping() != "java": client = os.path.join(testdir, client) clientOptions = ' ' + getDefaultLocatorProperty() + ' ' + additionalOptions - startIceGridRegistry(testdir) - iceGridNodePipe = startIceGridNode(testdir) + registryProcs = startIceGridRegistry(testdir) + iceGridNodeProc = startIceGridNode(testdir) if application != "": print "adding application...", @@ -223,20 +214,10 @@ def iceGridTest(testdir, name, application, additionalOptions = "", applicationO print "ok" print "starting client...", - clientPipe = TestUtil.startClient(client, clientOptions + " 2>&1", TestUtil.DriverConfig("client")) + clientProc = TestUtil.startClient(client, clientOptions, TestUtil.DriverConfig("client")) 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) + clientProc.waitTestSuccess() if application != "": print "remove application...", @@ -246,50 +227,38 @@ def iceGridTest(testdir, name, application, additionalOptions = "", applicationO print "shutting down icegrid node...", iceGridAdmin("node shutdown localnode") print "ok" - shutdownIceGridRegistry() - - TestUtil.joinServers() + shutdownIceGridRegistry(registryProcs) + iceGridNodeProc.waitTestSuccess() - if TestUtil.serverStatus(): - sys.exit(1) - -def iceGridClientServerTest(testdir, name, additionalClientOptions, additionalServerOptions): +def iceGridClientServerTest(additionalClientOptions, additionalServerOptions): + testdir = os.getcwd() server = TestUtil.getDefaultServerFile() client = TestUtil.getDefaultClientFile() if TestUtil.getDefaultMapping() != "java": server = os.path.join(testdir, server) client = os.path.join(testdir, client) + if TestUtil.getDefaultMapping() == "java": + os.environ['CLASSPATH'] = os.path.join(os.getcwd(), "classes") + os.pathsep + os.environ.get("CLASSPATH", "") + clientOptions = getDefaultLocatorProperty() + ' ' + additionalClientOptions serverOptions = getDefaultLocatorProperty() + ' ' + additionalServerOptions - startIceGridRegistry(testdir, True) + registryProcs = startIceGridRegistry(testdir, True) print "starting server...", - serverPipe = TestUtil.startServer(server, serverOptions + " 2>&1", TestUtil.DriverConfig("server")) - if TestUtil.getDefaultMapping() != "java": - TestUtil.getServerPid(serverPipe) - TestUtil.getAdapterReady(serverPipe) + serverProc= TestUtil.startServer(server, serverOptions, TestUtil.DriverConfig("server")) print "ok" print "starting client...", - clientPipe = TestUtil.startClient(client, clientOptions + " 2>&1", TestUtil.DriverConfig("client")) + clientProc = TestUtil.startClient(client, clientOptions, TestUtil.DriverConfig("client")) print "ok" - TestUtil.printOutputFromPipe(clientPipe) - - clientStatus = TestUtil.closePipe(clientPipe) - if clientStatus: - TestUtil.killServers() - sys.exit(1) - - shutdownIceGridRegistry() + clientProc.waitTestSuccess() + serverProc.waitTestSuccess() - TestUtil.joinServers() - - if TestUtil.serverStatus(): - sys.exit(1) + shutdownIceGridRegistry(registryProcs) def cleanDbDir(path): for filename in [ os.path.join(path, f) for f in os.listdir(path) if f != ".gitignore"]: diff --git a/config/IceStormUtil.py b/scripts/IceStormUtil.py index e4d154a14bb..86b7706c2b7 100644 --- a/config/IceStormUtil.py +++ b/scripts/IceStormUtil.py @@ -9,8 +9,8 @@ # # ********************************************************************** -import TestUtil import os, sys +import TestUtil global testdir global toplevel @@ -28,60 +28,29 @@ origIceStormService = ' --IceBox.Service.IceStorm=IceStormService,' + TestUtil.g origIceStormProxy = '%s/TopicManager:default -p %d' origIceStormReference = ' --IceStormAdmin.TopicManager.Default="%s"' -def printOutput(pipe): - try: - while True: - line = pipe.readline() - if not line: - break - print line, - except IOError: - pass - -def captureOutput(pipe): - out = "" - try: - while True: - line = pipe.readline() - if not line: - break - out = out + line - except IOError: - pass - return out - class IceStormUtil(object): def __init__(self, toplevel, testdir): self.toplevel = toplevel self.testdir = testdir - self.iceBox = TestUtil.getIceBox(testdir) + self.iceBox = TestUtil.getIceBox() self.iceBoxAdmin = os.path.join(TestUtil.getCppBinDir(), "iceboxadmin") self.iceStormAdmin = os.path.join(TestUtil.getCppBinDir(), "icestormadmin") def runIceBoxAdmin(self, endpts, command): - clientCfg = TestUtil.DriverConfig("client") - pipe = TestUtil.startClient(self.iceBoxAdmin, endpts + " " + command) - out = captureOutput(pipe) - status = TestUtil.closePipe(pipe) - if status: - print "non-zero status! %d" % status - print out - TestUtil.killServers() - sys.exit(1) - return out + proc = TestUtil.startClient(self.iceBoxAdmin, endpts + " " + command, echo = False) + proc.waitTestSuccess() + return proc.buf def admin(self, cmd, **args): - return self.adminWithRef(self.iceStormReference, cmd, **args) + self.adminWithRef(self.iceStormReference, cmd, **args) - def adminWithRef(self, ref, cmd, terminateOnError=True): - pipe = TestUtil.startClient(self.iceStormAdmin, ref + r' -e "%s"' % cmd) - out = captureOutput(pipe) - status = TestUtil.closePipe(pipe) - if terminateOnError and status: - print "failed!" - TestUtil.killServers() - sys.exit(1) - return status, out.strip() + def adminWithRef(self, ref, cmd, expect = None): + proc = TestUtil.startClient(self.iceStormAdmin, ref + r' -e "%s"' % cmd, echo = False) + if expect: + proc.expect(expect) + proc.wait() + else: + proc.waitTestSuccess() def reference(self): return self.iceStormReference @@ -95,7 +64,7 @@ class Replicated(IceStormUtil): dbDir = "db", instanceName="IceStorm", port = 12010): IceStormUtil.__init__(self, toplevel, testdir) - self.pipes = [] + self.procs = [] self.nendpoints = [] # Node endpoints self.instanceName = instanceName self.ibendpoints = [] # IceBox endpoints @@ -130,7 +99,7 @@ class Replicated(IceStormUtil): self.replicaProperties = [] self.dbHome= [] self.iceStormDBEnv= [] - self.pipes = [] + self.procs = [] for replica in range(0, 3): self.iceBoxEndpoints.append(origIceBoxEndpoints % self.ibendpoints[replica]) service = origIceStormService % self.isendpoints[replica] @@ -152,17 +121,17 @@ class Replicated(IceStormUtil): self.dbHome.append(dbHome) TestUtil.cleanDbDir(dbHome) self.iceStormDBEnv.append(" --Freeze.DbEnv.IceStorm.DbHome=%s" % dbHome) - self.pipes.append(None) + self.procs.append(None) topicReplicaProxy = '%s/TopicManager:%s' % (instanceName, replicaTopicManagerEndpoints) self.iceStormProxy = topicReplicaProxy self.iceStormReference = ' --IceStormAdmin.TopicManager.Default="%s"' % topicReplicaProxy - def adminForReplica(self, replica, cmd, **args): + def adminForReplica(self, replica, cmd, expect = None, **args): ep = self.isendpoints[replica] proxy = origIceStormProxy % (self.instanceName, self.isendpoints[replica]) ref = origIceStormReference % proxy - return self.adminWithRef(ref, cmd, **args) + self.adminWithRef(ref, cmd, expect, **args) def clean(self): for replica in range(0, 3): @@ -181,21 +150,20 @@ class Replicated(IceStormUtil): if echo: print "ok" - def startReplica(self, replica, echo = True, additionalOptions = "", createThread = True): + def startReplica(self, replica, echo = True, additionalOptions = ""): if echo: print "starting icestorm replica %d..." % replica, sys.stdout.flush() - pipe = TestUtil.startServer(self.iceBox, + proc = TestUtil.startServer(self.iceBox, self.iceBoxEndpoints[replica] + self.iceStormEndpoints[replica] + self.replicaProperties[replica] + self.iceStormDBEnv[replica] + - additionalOptions) - self.pipes.append(pipe) - TestUtil.getServerPid(pipe) - TestUtil.waitServiceReady(pipe, "IceStorm") - self.pipes[replica] = pipe + additionalOptions, + adapter = "IceStorm", + echo = False) + self.procs[replica] = proc if echo: print "ok" @@ -204,13 +172,10 @@ class Replicated(IceStormUtil): self.stopReplica(replica) def stopReplica(self, replica): - if self.pipes[replica]: + if self.procs[replica]: self.runIceBoxAdmin(self.iceBoxEndpoints[replica], "shutdown") - if TestUtil.specificServerStatus(self.pipes[replica]): - print "failed!" - TestUtil.killServers() - sys.exit(1) - self.pipes[replica] = None + self.procs[replica].waitTestSuccess() + self.procs[replica] = None def reference(self, replica=-1): if replica == -1: @@ -255,7 +220,7 @@ class NonReplicated(IceStormUtil): def clean(self): TestUtil.cleanDbDir(self.dbHome) - def start(self, echo = True, additionalOptions = "", createThread = True): + def start(self, echo = True, additionalOptions = ""): if echo: if self.transient: print "starting transient icestorm service...", @@ -263,23 +228,19 @@ class NonReplicated(IceStormUtil): print "starting icestorm service...", sys.stdout.flush() - self.pipe = TestUtil.startServer(self.iceBox, + self.proc = TestUtil.startServer(self.iceBox, self.iceBoxEndpoints + self.iceStormService + self.iceStormDBEnv + - additionalOptions) - TestUtil.getServerPid(self.pipe) - TestUtil.waitServiceReady(self.pipe, "IceStorm", createThread) + additionalOptions, adapter = "IceStorm", + echo = False) if echo: print "ok" - return self.pipe + return self.proc def stop(self): self.runIceBoxAdmin(self.iceBoxEndpoints, "shutdown") - if TestUtil.specificServerStatus(self.pipe): - print "failed!" - TestUtil.killServers() - sys.exit(1) + self.proc.waitTestSuccess() def init(toplevel, testdir, type, **args): if type == "replicated": diff --git a/config/TestUtil.py b/scripts/TestUtil.py index 0711d5662a3..b8b1fda0f0b 100755 --- a/config/TestUtil.py +++ b/scripts/TestUtil.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # ********************************************************************** # # Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved. @@ -8,7 +7,7 @@ # # ********************************************************************** -import sys, os, re, errno, getopt, time, StringIO, string +import sys, os, re, errno, getopt, time, StringIO, string, copy from threading import Thread # Global flags and their default values. @@ -20,10 +19,53 @@ debug = False # Set to True to enable test suite debugging. mono = False # Set to True when not on Windows keepGoing = False # Set to True to have the tests continue on failure. ipv6 = False # Default to use IPv4 only -ice_home = None # Binary distribution to use (None to use binaries from source distribution) +iceHome = None # Binary distribution to use (None to use binaries from source distribution) x64 = False # Binary distribution is 64-bit javaCmd = "java" # Default java loader valgrind = False # Set to True to use valgrind for C++ executables. +tracefile = None +cross = [] + +def isCygwin(): + # The substring on sys.platform is required because some cygwin + # versions return variations like "cygwin_nt-4.01". + return sys.platform[:6] == "cygwin" + +def isWin32(): + return sys.platform == "win32" or isCygwin() + +def isVista(): + return isWin32() and sys.getwindowsversion()[0] == 6 + +def isWin9x(): + if isWin32(): + return not (os.environ.has_key("OS") and os.environ["OS"] == "Windows_NT") + else: + return 0 + +def isSolaris(): + return sys.platform == "sunos5" + +def isSparc(): + p = os.popen("uname -m") + l = p.readline().strip() + p.close() + if l == "sun4u": + return True + else: + return False + +def isHpUx(): + return sys.platform == "hp-ux11" + +def isAIX(): + return sys.platform in ['aix4', 'aix5'] + +def isDarwin(): + return sys.platform == "darwin" + +def isLinux(): + return sys.platform.startswith("linux") # # The PHP interpreter is called "php5" on some platforms (e.g., SLES). @@ -47,59 +89,64 @@ defaultMapping = None testErrors = [] -def configurePaths(): - toplevel = findTopLevel() +toplevel = None - if ice_home: - print "*** using Ice installation from " + ice_home, +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!" +toplevel = path[0] + +def sanitize(cp): + np = "" + for p in cp.split(os.pathsep): + if p == "classes": + continue + if len(np) > 0: + np = np + os.pathsep + np = np + p + return np + +def configurePaths(): + if iceHome: + print "*** using Ice installation from " + iceHome, if x64: print "(64bit)", print + # First sanitize the environment. + os.environ["CLASSPATH"] = sanitize(os.getenv("CLASSPATH", "")) + # # If Ice is installed from RPMs, just set the CLASSPATH for Java. # - if ice_home == "/usr": + if iceHome == "/usr": javaDir = os.path.join("/", "usr", "share", "java") - os.environ["CLASSPATH"] = os.path.join(javaDir, "Ice.jar") + os.pathsep + os.getenv("CLASSPATH", "") + addClasspath(os.path.join(javaDir, "Ice.jar")) return # That's it, we're done! if isWin32(): - os.environ["PATH"] = getCppBinDir() + os.pathsep + os.getenv("PATH", "") + libDir = getCppBinDir() else: libDir = os.path.join(getIceDir("cpp"), "lib") - if isHpUx(): - if x64: - if ice_home: - libDir = os.path.join(libDir, "pa20_64") - os.environ["LD_LIBRARY_PATH"] = libDir + os.pathsep + os.getenv("LD_LIBRARY_PATH", "") - else: - os.environ["SHLIB_PATH"] = libDir + os.pathsep + os.getenv("SHLIB_PATH", "") - elif isDarwin(): - os.environ["DYLD_LIBRARY_PATH"] = libDir + os.pathsep + os.getenv("DYLD_LIBRARY_PATH", "") - elif isAIX(): - os.environ["LIBPATH"] = libDir + os.pathsep + os.getenv("LIBPATH", "") - elif isSolaris(): - if x64: - if ice_home: - if isSparc(): - libDir = os.path.join(libDir, "sparcv9") - else: - libDir = os.path.join(libDir, "amd64") - os.environ["LD_LIBRARY_PATH_64"] = libDir + os.pathsep + os.getenv("LD_LIBRARY_PATH_64", "") - else: - os.environ["LD_LIBRARY_PATH"] = libDir + os.pathsep + os.getenv("LD_LIBRARY_PATH", "") - else: - if x64: - if ice_home: - libDir = libDir + "64" - os.environ["LD_LIBRARY_PATH_64"] = libDir + os.pathsep + os.getenv("LD_LIBRARY_PATH_64", "") - else: - os.environ["LD_LIBRARY_PATH"] = libDir + os.pathsep + os.getenv("LD_LIBRARY_PATH", "") + if iceHome and x64: + if isHpUx(): + libDir = os.path.join(libDir, "pa20_64") + elif isSolaris(): + if isSparc(): + libDir = os.path.join(libDir, "sparcv9") + else: + libDir = os.path.join(libDir, "amd64") + else: + libDir = libDir + "64" + addLdPath(libDir) javaDir = os.path.join(getIceDir("java"), "lib") - os.environ["CLASSPATH"] = os.path.join(javaDir, "Ice.jar") + os.pathsep + os.getenv("CLASSPATH", "") - os.environ["CLASSPATH"] = os.path.join(javaDir) + os.pathsep + os.getenv("CLASSPATH", "") + addClasspath(os.path.join(javaDir, "Ice.jar")) + addClasspath(os.path.join(javaDir)) # # On Windows, C# assemblies are found thanks to the .exe.config files. @@ -119,72 +166,56 @@ def configurePaths(): rubyDir = os.path.join(getIceDir("rb"), "ruby") os.environ["RUBYLIB"] = rubyDir + os.pathsep + os.getenv("RUBYLIB", "") -def addLdPath(libpath): +def addLdPath(libpath, env = None): + if env is None: + env = os.environ if isWin32(): - os.environ["PATH"] = libpath + os.pathsep + os.getenv("PATH", "") + env["PATH"] = libpath + os.pathsep + env.get("PATH", "") elif isHpUx(): - os.environ["SHLIB_PATH"] = libpath + os.pathsep + os.getenv("SHLIB_PATH", "") - os.environ["LD_LIBRARY_PATH"] = libpath + os.pathsep + os.getenv("LD_LIBRARY_PATH", "") + env["SHLIB_PATH"] = libpath + os.pathsep + env.get("SHLIB_PATH", "") + env["LD_LIBRARY_PATH"] = libpath + os.pathsep + env.get("LD_LIBRARY_PATH", "") elif isDarwin(): - os.environ["DYLD_LIBRARY_PATH"] = libpath + os.pathsep + os.getenv("DYLD_LIBRARY_PATH", "") + env["DYLD_LIBRARY_PATH"] = libpath + os.pathsep + env.get("DYLD_LIBRARY_PATH", "") elif isAIX(): - os.environ["LIBPATH"] = libpath + os.pathsep + os.getenv("LIBPATH", "") + env["LIBPATH"] = libpath + os.pathsep + env.get("LIBPATH", "") else: - os.environ["LD_LIBRARY_PATH"] = libpath + os.pathsep + os.getenv("LD_LIBRARY_PATH", "") - os.environ["LD_LIBRARY_PATH_64"] = libpath + os.pathsep + os.getenv("LD_LIBRARY_PATH_64", "") + env["LD_LIBRARY_PATH"] = libpath + os.pathsep + env.get("LD_LIBRARY_PATH", "") + env["LD_LIBRARY_PATH_64"] = libpath + os.pathsep + env.get("LD_LIBRARY_PATH_64", "") + return env + +def addClasspath(dir, env = None): + if env is None: + env = os.environ + env["CLASSPATH"] = dir + os.pathsep + env.get("CLASSPATH", "") + return env + +# List of supported cross languages test. +crossTests = [ + "Ice/adapterDeactivation", + "Ice/background", + "Ice/binding", + "Ice/checksum", + #"Ice/custom", + "Ice/exceptions", + "Ice/facets", + "Ice/hold", + "Ice/inheritance", + "Ice/location", + "Ice/objects", + "Ice/operations", + "Ice/proxy", + "Ice/retry", + #"Ice/servantLocator", + "Ice/timeout", + "Ice/slicing/exceptions", + "Ice/slicing/objects", + ] -def isCygwin(): - # The substring on sys.platform is required because some cygwin - # versions return variations like "cygwin_nt-4.01". - return sys.platform[:6] == "cygwin" - -def isWin32(): - return sys.platform == "win32" or isCygwin() - -def isVista(): - return isWin32() and sys.getwindowsversion()[0] == 6 - -def isWin9x(): - if isWin32(): - return not (os.environ.has_key("OS") and os.environ["OS"] == "Windows_NT") - else: - return 0 - -def isSolaris(): - return sys.platform == "sunos5" - -def isSparc(): - p = os.popen("uname -m") - l = p.readline().strip() - p.close() - if l == "sun4u": - return True - else: - return False - -def isHpUx(): - return sys.platform == "hp-ux11" - -def isAIX(): - return sys.platform in ['aix4', 'aix5'] - -def isDarwin(): - return sys.platform == "darwin" - -def isLinux(): - return sys.platform.startswith("linux") - -def index(l, re): - """Find the index of the first item in the list that matches the given re""" - for i in range(0, len(l)): - if re.search(l[i]): - return i - return -1 - def run(tests, root = False): def usage(): print "usage: " + sys.argv[0] + """ --all Run all sensible permutations of the tests. + --all-cross Run all sensible permutations of cross language tests. --start=index Start running the tests at the given index. --loop Run the tests in a loop. --filter=<regex> Run all the tests that match the given regex. @@ -199,15 +230,16 @@ def run(tests, root = False): --ipv6 Use IPv6 addresses. --ice-home=<path> Use the binary distribution from the given path. --x64 Binary distribution is 64-bit. + --cross=lang Run cross language test. --script Generate a script to run the tests. """ sys.exit(2) try: opts, args = getopt.getopt(sys.argv[1:], "lr:R:", - ["start=", "start-after=", "filter=", "rfilter=", "all", "loop", "debug", - "protocol=", "compress", "valgrind", "host=", "serialize", "continue", "ipv6", - "ice-home=", "x64", "script"]) + ["start=", "start-after=", "filter=", "rfilter=", "all", "all-cross", "loop", + "debug", "protocol=", "compress", "valgrind", "host=", "serialize", "continue", + "ipv6", "ice-home=", "cross=", "x64", "script"]) except getopt.GetoptError: usage() @@ -217,12 +249,14 @@ def run(tests, root = False): start = 0 loop = False all = False + allCross = False arg = "" script = False filters = [] for o, a in opts: if o == "--continue": + global keepGoing keepGoing = True elif o in ("-l", "--loop"): loop = True @@ -232,8 +266,16 @@ def run(tests, root = False): filters.append((testFilter, True)) else: filters.append((testFilter, False)) + elif o == "--cross": + global cross + if not a in ["cpp", "java", "cs", "py", "rb" ]: + print "cross must be one of cpp, java, cs, py or rb" + sys.exit(1) + cross.append(a) elif o == "--all" : all = True + elif o == "--all-cross" : + allCross = True elif o in '--start': start = int(a) elif o == "--script": @@ -245,18 +287,12 @@ def run(tests, root = False): print "SSL is not supported with mono" sys.exit(1) - if o in ( "--protocol", "--host", "--debug", "--compress", "--valgrind", "--serialize", "--ipv6", \ + if o in ( "--cross", "--protocol", "--host", "--debug", "--compress", "--valgrind", "--serialize", "--ipv6", \ "--ice-home", "--x64"): arg += " " + o if len(a) > 0: arg += " " + a - for testFilter, removeFilter in filters: - if removeFilter: - tests = [ (x, y) for x,y in tests if not testFilter.search(x) ] - else: - tests = [ (x, y) for x,y in tests if testFilter.search(x) ] - if not root: tests = [ (os.path.join(getDefaultMapping(), "test", x), y) for x, y in tests ] @@ -288,9 +324,42 @@ def run(tests, root = False): a = "--protocol=tcp --serialize %s" % arg expanded.append([ (test, a, config) for test,config in tests if "stress" in config]) - else: + elif not allCross: expanded.append([ (test, arg, config) for test,config in tests]) + if allCross: + if len(cross) == 0: + cross = ["cpp", "java", "cs" ] + if root: + allLang = ["cpp", "java", "cs" ] + else: + allLang = [ getDefaultMapping() ] + for lang in allLang: + # This is all other languages than the current mapping. + crossLang = [ l for l in cross if lang != l ] + # This is all eligible cross tests for the current mapping. + # Now expand out the tests. We run only tcp for most cross tests. + for c in crossLang: + a = "--cross=%s --protocol=tcp" % c + expanded.append([ ( "%s/test/%s" % (lang, test), a, []) for test in crossTests if not (test == "Ice/background" and (lang == "cs" or c == "cs"))]) + + # Add ssl & compress for the operations test. + if mono and c == "cs": # Don't add the ssl tests for mono. + continue + a = "--cross=%s --protocol=ssl --compress" % c + expanded.append([("%s/test/Ice/operations" % lang, a, [])]) + + # Apply filters after expanding. + if len(filters) > 0: + for testFilter, removeFilter in filters: + nexpanded = [] + for tests in expanded: + if removeFilter: + nexpanded.append([ (x, a, y) for x,a,y in tests if not testFilter.search(x) ]) + else: + nexpanded.append([ (x, a, y) for x,a,y in tests if testFilter.search(x) ]) + expanded = nexpanded + if loop: num = 1 while 1: @@ -307,43 +376,19 @@ def run(tests, root = False): if not isWin32(): mono = True - -toplevel = None - -def findTopLevel(): - global toplevel - - if toplevel != None: - return toplevel - - for toplevel in [".", "..", "../..", "../../..", "../../../..", "../../../../.."]: - toplevel = os.path.abspath(toplevel) - if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): - break - else: - toplevel = None - raise "can't find toplevel directory!" - - return toplevel def getIceDir(subdir = None): # # If ICE_HOME is set we're running the test against a binary distribution. Otherwise, # we're running the test against a source distribution. # - global ice_home - if ice_home: - return ice_home + global iceHome + if iceHome: + return iceHome elif subdir: - return os.path.join(findTopLevel(), subdir) + return os.path.join(toplevel, subdir) else: - return findTopLevel() - -findTopLevel() - -serverPids = [] -serverThreads = [] -allServerThreads = [] + return toplevel def writePhpIni(src, dst): extDir = None @@ -363,8 +408,8 @@ def writePhpIni(src, dst): extDir = os.path.abspath(os.path.join(getIceDir("php"), "bin")) else: ext = "IcePHP.so" - if not ice_home: - extDir = os.path.abspath(os.path.join(findTopLevel(), "php", "lib")) + if not iceHome: + extDir = os.path.abspath(os.path.join(toplevel, "php", "lib")) else: # # If ICE_HOME points to the installation directory of a source build, the @@ -373,12 +418,12 @@ def writePhpIni(src, dst): # We could also execute "php -m" and check if the output includes "ice". # if x64: - extDir = os.path.join(ice_home, "lib64") + extDir = os.path.join(iceHome, "lib64") else: - extDir = os.path.join(ice_home, "lib") + extDir = os.path.join(iceHome, "lib") if not os.path.exists(os.path.join(extDir, ext)): - if ice_home == "/usr": + if iceHome == "/usr": extDir = None # Assume PHP is already configured to load the extension. else: print "unable to find IcePHP extension!" @@ -386,7 +431,7 @@ def writePhpIni(src, dst): ini = open(src, "r").readlines() for i in range(0, len(ini)): - ini[i] = ini[i].replace("ICE_HOME", os.path.join(findTopLevel())) + ini[i] = ini[i].replace("ICE_HOME", os.path.join(toplevel)) tmpini = open(dst, "w") tmpini.writelines(ini) if extDir: @@ -396,7 +441,7 @@ def writePhpIni(src, dst): def getIceSoVersion(): - config = open(os.path.join(findTopLevel(), "cpp", "include", "IceUtil", "Config.h"), "r") + config = open(os.path.join(toplevel, "cpp", "include", "IceUtil", "Config.h"), "r") intVersion = int(re.search("ICE_INT_VERSION ([0-9]*)", config.read()).group(1)) majorVersion = intVersion / 10000 minorVersion = intVersion / 100 - 100 * majorVersion @@ -435,167 +480,7 @@ def getJdkVersion(): javaPipeOut.close() return version -def closePipe(pipe): - try: - status = pipe.close() - except IOError, ex: - # TODO: There's a waitpid problem on CentOS, so we have to ignore ECHILD. - if ex.errno == errno.ECHILD: - status = 0 - # This happens with the test/IceGrid/simple test on AIX, and the - # C# fault tolerance test. - elif ex.errno == 0: - status = 0 - else: - raise - return status - -class ReaderThread(Thread): - def __init__(self, pipe): - self.pipe = pipe - Thread.__init__(self) - - def run(self): - - try: - while 1: - line = self.pipe.readline() - if not line: break - # Suppress "adapter ready" messages. Under windows the eol isn't \n. - if not line.endswith(" ready\n") and not line.endswith(" ready\r\n"): - sys.stdout.flush() - print line, - except IOError: - pass - - self.status = closePipe(self.pipe) - - def getPipe(self): - return self.pipe - - def getStatus(self): - return self.status - -def joinServers(): - global serverThreads - global allServerThreads - for t in serverThreads: - t.join() - allServerThreads.append(t) - serverThreads = [] - -# This joins with all servers and if any of them failed then -# it returns the failure status. -def serverStatus(): - global allServerThreads - joinServers() - for t in allServerThreads: - status = t.getStatus() - if status: - print "server ", str(t), " status: ", str(status) - return status - return 0 - -# This joins with a specific server (the one started with the given pipe) -# returns its exit status. If the server cannot be found an exception -# is raised. -def specificServerStatus(pipe, timeout = None): - global serverThreads - for t in serverThreads: - if t.getPipe() == pipe: - serverThreads.remove(t) - if isWin32() and timeout != None: - # - # BUGFIX: On Windows x64 with python 2.5 join with - # a timeout doesn't work (it hangs for the duration - # of the timeout if the thread is alive at the time - # of the join call). - # - while timeout >= 0 and t.isAlive(): - time.sleep(1) - timeout -= 1 - if not t.isAlive(): - t.join() - else: - t.join(timeout) - if t.isAlive(): - raise "server with pipe " + str(pipe) + " did not exit within the timeout period." - status = t.getStatus() - return status - raise "can't find server with pipe: " + str(pipe) - -def killServers(): - global serverPids - global serverThreads - - for pid in serverPids: - - if isWin32(): - try: - import win32api - handle = win32api.OpenProcess(1, 0, pid) - win32api.TerminateProcess(handle, 0) - except ImportError, ex: - print "Sorry: you must install the win32all package for killServers to work." - return - except: - pass # Ignore errors, such as non-existing processes. - else: - try: - os.kill(pid, 9) - except: - pass # Ignore errors, such as non-existing processes. - - serverPids = [] - - # - # Now join with all the threads - # - joinServers() - -def getServerPid(pipe): - global serverPids - global serverThreads - - output = ignorePid(pipe) - - try: - serverPids.append(int(output)) - except ValueError: - print "Output is not a PID: " + output - raise - -def ignorePid(pipe): - while 1: - output = pipe.readline().strip() - if not output: - print "failed!" - killServers() - sys.exit(1) - if output.startswith("warning: "): - continue - return output - -def getAdapterReady(pipe, createThread = True, count = 1): - global serverThreads - - while count > 0: - output = pipe.readline().strip() - count = count - 1 - - if not output: - print "failed!" - killServers() - sys.exit(1) - - # Start a thread for this server. - if createThread: - serverThread = ReaderThread(pipe) - serverThread.start() - serverThreads.append(serverThread) - -def getIceBox(testdir): - +def getIceBox(): # # Get and return the path of the IceBox executable # @@ -608,7 +493,7 @@ def getIceBox(testdir): # how the IceBox service was built ("debug" vs. "release") and # decide which icebox executable to use. # - build = open(os.path.join(testdir, "build.txt"), "r") + build = open(os.path.join(os.getcwd(), "build.txt"), "r") type = build.read().strip() if type == "debug": iceBox = os.path.join(getCppBinDir(), "iceboxd.exe") @@ -629,31 +514,7 @@ def getIceBox(testdir): print "couldn't find icebox executable to run the test" sys.exit(0) - return iceBox; - -def waitServiceReady(pipe, token, createThread = True): - global serverThreads - - while 1: - output = pipe.readline().strip() - if not output: - print "failed!" - sys.exit(1) - if output == token + " ready": - break - - # Start a thread for this server. - if createThread: - serverThread = ReaderThread(pipe) - serverThread.start() - serverThreads.append(serverThread) - -def printOutputFromPipe(pipe): - while 1: - c = pipe.read(1) - if c == "": - break - os.write(1, c) + return iceBox class InvalidSelectorString(Exception): def __init__(self, value): @@ -688,35 +549,21 @@ sslConfigTree["py"] = sslConfigTree["cpp"] sslConfigTree["rb"] = sslConfigTree["cpp"] sslConfigTree["php"] = sslConfigTree["cpp"] -def getDefaultMapping(currentDir = ""): +def getDefaultMapping(): """Try and guess the language mapping out of the current path""" - if currentDir != "": - # Caller has specified the current path to use as a base. - scriptPath = os.path.abspath(currentDir).split(os.sep) - scriptPath.reverse() - for p in scriptPath: - if p in ["cpp", "cs", "java", "php", "py", "rb", "tmp"]: - return p - - scriptPath = os.path.abspath(sys.argv[0]).split(os.sep) - scriptPath.reverse() - for p in scriptPath: - if p in ["cpp", "cs", "java", "php", "py", "rb", "tmp"]: - return p - - scriptPath = os.path.abspath(os.getcwd()).split(os.sep) - scriptPath.reverse() - for p in scriptPath: - if p in ["cpp", "cs", "java", "php", "py", "rb", "tmp"]: - return p - - # Default to C++ - return "cpp" + here = os.getcwd() + while len(here) > 0: + current = os.path.basename(here) + here = os.path.dirname(here) + if current in ["cpp", "cs", "java", "php", "py", "rb", "tmp"]: + return current + else: + raise "cannot determine mapping" def getTestEnv(): env = {} - env["certsdir"] = os.path.abspath(os.path.join(findTopLevel(), "certs")) + env["certsdir"] = os.path.abspath(os.path.join(toplevel, "certs")) return env class DriverConfig: @@ -806,7 +653,7 @@ def getCommandLine(exe, config, env=None): components.append("--Ice.ThreadPool.Server.Size=1 --Ice.ThreadPool.Server.SizeMax=3 --Ice.ThreadPool.Server.SizeWarn=0") if config.type == "server": - components.append("--Ice.PrintProcessId=1 --Ice.PrintAdapterReady=1 --Ice.ServerIdleTime=30") + components.append("--Ice.PrintAdapterReady=1 --Ice.ServerIdleTime=30") if config.ipv6: components.append("--Ice.Default.Host=0:0:0:0:0:0:0:1 --Ice.IPv6=1") @@ -850,7 +697,7 @@ def getCommandLine(exe, config, env=None): # --child-silent-after-fork=yes is required for the IceGrid/activator test where the node # forks a process with execv failing (invalid exe name). print >>output, "valgrind -q --child-silent-after-fork=yes --leak-check=full ", - print >>output, "--suppressions=" + os.path.join(findTopLevel(), "config", "valgrind.sup"), exe, + print >>output, "--suppressions=" + os.path.join(toplevel, "config", "valgrind.sup"), exe, else: print >>output, exe, @@ -861,103 +708,6 @@ def getCommandLine(exe, config, env=None): return commandline -def runTests(start, expanded, num = 0, script = False): - total = 0 - for tests in expanded: - for i, args, config in tests: - total = total + 1 - # - # The configs argument is a list containing one or more test configurations. - # - index = 0 - for tests in expanded: - for i, args, config in tests: - index = index + 1 - if index < start: - continue - i = os.path.normpath(i) - dir = os.path.join(toplevel, i) - - print - if num > 0: - print "[" + str(num) + "]", - if script: - prefix = "echo \"" - suffix = "\"" - else: - prefix = "" - suffix = "" - - print "%s*** running tests %d/%d in %s%s" % (prefix, index, total, dir, suffix) - print "%s*** configuration:" % prefix, - if len(args.strip()) == 0: - print "Default", - else: - print args.strip(), - print suffix - - # - # Skip tests not supported with IPv6 if necessary - # - if args.find("ipv6") != -1 and "noipv6" in config: - print "%s*** test not supported with IPv6%s" % (prefix, suffix) - continue - - if isVista() and "novista" in config: - print "%s*** test not supported under Vista%s" % (prefix, suffix) - continue - - if not isWin32() and "win32only" in config: - print "%s*** test only supported under Win32%s" % (prefix, suffix) - continue - - # If this is mono and we're running ssl protocol tests - # then skip. This occurs when using --all. - if mono and ("nomono" in config or (i.find(os.path.join("cs","test")) != -1 and args.find("ssl") != -1)): - print "%s*** test not supported with mono%s" % (prefix, suffix) - continue - - # If this is java and we're running ipv6 under windows then skip. - if isWin32() and i.find(os.path.join("java","test")) != -1 and args.find("ipv6") != -1: - print "%s*** test not supported under windows%s" % (prefix, suffix) - continue - - # Skip tests not supported by valgrind - if args.find("valgrind") and ("novalgrind" in config or args.find("ssl") != -1): - print "%s*** test not supported with valgrind%s" % (prefix, suffix) - continue - - if script: - print "echo \"*** test started: `date`\"" - print "cd %s" % dir - else: - print "*** test started:", time.strftime("%x %X") - sys.stdout.flush() - - os.chdir(dir) - - global keepGoing - if script: - print "if ! python %s %s; then" % (os.path.join(dir, "run.py"), args) - print " echo 'test in %s failed'" % os.path.abspath(dir) - if not keepGoing: - print " exit 1" - print "fi" - else: - status = os.system("python " + os.path.join(dir, "run.py " + args)) - - if status: - if(num > 0): - print "[" + str(num) + "]", - message = "test in " + os.path.abspath(dir) + " failed with exit status", status, - print message - if not keepGoing: - sys.exit(status) - else: - print " ** Error logged and will be displayed again when suite is completed **" - global testErrors - testErrors.append(message) - def getDefaultServerFile(): lang = getDefaultMapping() if lang in ["rb", "php", "cpp", "cs"]: @@ -967,8 +717,9 @@ def getDefaultServerFile(): if lang == "java": return "Server" -def getDefaultClientFile(): - lang = getDefaultMapping() +def getDefaultClientFile(lang = None): + if lang is None: + lang = getDefaultMapping() if lang == "rb": return "Client.rb" if lang == "php": @@ -996,204 +747,186 @@ def getDefaultCollocatedFile(): def isDebug(): return debug -def clientServerTestWithOptionsAndNames(name, additionalServerOptions, additionalClientOptions, \ - serverName, clientName): - lang = getDefaultMapping() - testdir = os.path.join(findTopLevel(), lang, "test", name) - - server = serverName - client = clientName - - if lang != "java": - if lang in ["rb", "php"]: - server = os.path.join(findTopLevel(), "cpp", "test", name, serverName) - else: - server = os.path.join(testdir, serverName) - client = os.path.join(testdir, clientName) - - print "starting " + serverName + "...", - serverCfg = DriverConfig("server") - if lang in ["rb", "php"]: - serverCfg.lang = "cpp" - serverCmd = getCommandLine(server, serverCfg) + " " + additionalServerOptions +import Expect +def spawn(cmd, env = None, cwd = None): if debug: - print "(" + serverCmd + ")", - serverPipe = os.popen(serverCmd + " 2>&1") - if lang != "java": - getServerPid(serverPipe) - getAdapterReady(serverPipe) - print "ok" - - cwd = os.getcwd() - os.chdir(testdir) - - if lang == "php": - writePhpIni("php.ini", "tmp.ini") - - print "starting " + clientName + "...", - clientCmd = getCommandLine(client, DriverConfig("client")) + " " + additionalClientOptions - if debug: - print "(" + clientCmd + ")", - clientPipe = os.popen(clientCmd + " 2>&1") - print "ok" - - printOutputFromPipe(clientPipe) - - clientStatus = closePipe(clientPipe) - if clientStatus: - killServers() - - joinServers() - - if lang == "php": - os.remove("tmp.ini") - - os.chdir(cwd) - - if clientStatus or serverStatus(): - sys.exit(1) - -def clientServerTestWithOptions(name, additionalServerOptions, additionalClientOptions): - - clientServerTestWithOptionsAndNames(name, additionalServerOptions, additionalClientOptions, getDefaultServerFile(), - getDefaultClientFile()) - -def clientServerTest(name): - - clientServerTestWithOptions(name, "", "") - -def clientServerTestWithClasspath(name, serverClasspath, clientClasspath): - - cp = os.getenv("CLASSPATH", "") - scp = serverClasspath + os.pathsep + cp - ccp = clientClasspath + os.pathsep + cp - - print "starting server...", - os.environ["CLASSPATH"] = scp - serverPipe = startServer(getDefaultServerFile(), "") - os.environ["CLASSPATH"] = cp - - getAdapterReady(serverPipe) - print "ok" - - print "starting client...", - os.environ["CLASSPATH"] = ccp - clientPipe = startClient(getDefaultClientFile(), "") - os.environ["CLASSPATH"] = cp - print "ok" + print "(%s)" % cmd, + return Expect.Expect(cmd, env = env, logfile=tracefile, cwd = cwd) + +def spawnClient(cmd, env = None, cwd = None, echo = True): + client = spawn(cmd, env, cwd) + if echo: + client.trace() + return client + +def spawnServer(cmd, env = None, cwd = None, count = 1, adapter = None, echo = True): + server = spawn(cmd, env, cwd) + if adapter: + server.expect("%s ready\n" % adapter) + else: + while count > 0: + server.expect("[^\n]+ ready\n") + count = count -1 + if echo: + server.trace([re.compile("[^\n]+ ready")]) + return server + +def getMirrorDir(base, mapping): + """Get the mirror directory for the current test in the given mapping.""" + lang = getDefaultMapping() + after = [] + before = base + while len(before) > 0: + current = os.path.basename(before) + before = os.path.dirname(before) + if current == lang: + break + after.insert(0, current) + else: + raise "cannot find language dir" + return os.path.join(before, mapping, *after) - printOutputFromPipe(clientPipe) - clientStatus = closePipe(clientPipe) - if clientStatus or serverStatus(): - killServers() - sys.exit(1) +def clientServerTest(additionalServerOptions = "", additionalClientOptions = "", + server = None, client = None, serverenv = None, clientenv = None): + if server is None: + server = getDefaultServerFile() + if client is None: + client = getDefaultClientFile() + serverDesc = server + clientDesc = client -def mixedClientServerTestWithOptions(name, additionalServerOptions, additionalClientOptions): - - testdir = os.path.join(findTopLevel(), getDefaultMapping(), "test", name) lang = getDefaultMapping() - server = getDefaultServerFile() - client = getDefaultClientFile() - if lang != "java": - server = os.path.join(testdir, server) - client = os.path.join(testdir, client) + testdir = os.getcwd() - print "starting server...", - serverCmd = getCommandLine(server, DriverConfig("server")) + ' ' + additionalServerOptions - if debug: - print "(" + serverCmd + ")", - serverPipe = os.popen(serverCmd + " 2>&1") + # Setup the server. + if lang in ["rb", "php"]: + serverdir = getMirrorDir(testdir, "cpp") + else: + serverdir = testdir if lang != "java": - getServerPid(serverPipe) - getAdapterReady(serverPipe) - print "ok" - - print "starting client...", - clientCmd = getCommandLine(client, DriverConfig("client")) + ' ' + additionalClientOptions - if debug: - print "(" + clientCmd + ")", - clientPipe = os.popen(clientCmd + " 2>&1") - ignorePid(clientPipe) - getAdapterReady(clientPipe, False) - print "ok" + server = os.path.join(serverdir, server) + + if serverenv is None: + serverenv = copy.deepcopy(os.environ) + if lang == "cpp": + addLdPath(os.path.join(serverdir), serverenv) + elif lang == "java": + addClasspath(os.path.join(serverdir, "classes"), serverenv) + + global cross + if len(cross) == 0: + cross.append(lang) + + for clientLang in cross: + clientCfg = DriverConfig("client") + if clientLang != lang: + if clientDesc != getDefaultClientFile(): + print "** skipping cross test" + return - printOutputFromPipe(clientPipe) + clientCfg.lang = clientLang + client = getDefaultClientFile(clientLang) + clientdir = getMirrorDir(testdir, clientLang) + print clientdir + if not os.path.exists(clientdir): + print "** no matching test for %s" % clientLang + return + else: + clientdir = testdir - clientStatus = closePipe(clientPipe) + if clientLang != "java": + client = os.path.join(clientdir, client) - if clientStatus: - killServers() + if clientenv is None: + clientenv = copy.deepcopy(os.environ) + if clientLang == "cpp": + addLdPath(os.path.join(clientdir), clientenv) + elif clientLang == "java": + addClasspath(os.path.join(clientdir, "classes"), clientenv) - if clientStatus or serverStatus(): - sys.exit(1) + print "starting " + serverDesc + "...", + serverCfg = DriverConfig("server") + if lang in ["rb", "php"]: + serverCfg.lang = "cpp" + server = getCommandLine(server, serverCfg) + " " + additionalServerOptions + serverProc = spawnServer(server, env = serverenv) + print "ok" -def mixedClientServerTest(name): + if lang == "php": + writePhpIni("php.ini", "tmp.ini") - mixedClientServerTestWithOptions(name, "", "") + if clientLang == lang: + print "starting %s..." % clientDesc, + else: + print "starting %s %s ..." % (clientLang, clientDesc), + client = getCommandLine(client, clientCfg) + " " + additionalClientOptions + clientProc = spawnClient(client, env = clientenv) + print "ok" -def collocatedTestWithOptions(name, additionalOptions): + clientProc.waitTestSuccess() + serverProc.waitTestSuccess() - testdir = os.path.join(findTopLevel(), getDefaultMapping(), "test", name) +def collocatedTest(additionalOptions = ""): lang = getDefaultMapping() + if len(cross) > 1 or cross[0] != lang: + print "** skipping cross test" + return + testdir = os.getcwd() + collocated = getDefaultCollocatedFile() if lang != "java": collocated = os.path.join(testdir, collocated) + if lang == "cpp": + env = copy.deepcopy(os.environ) + addLdPath(os.path.join(testdir), env) + else: + env = None + else: + env = copy.deepcopy(os.environ) + addClasspath(os.path.join(testdir, "classes"), env) print "starting collocated...", - command = getCommandLine(collocated, DriverConfig("colloc")) + ' ' + additionalOptions - if debug: - print "(" + command + ")", - collocatedPipe = os.popen(command + " 2>&1") + collocated = getCommandLine(collocated, DriverConfig("colloc")) + ' ' + additionalOptions + collocatedProc = spawnClient(collocated, env = env) print "ok" - - printOutputFromPipe(collocatedPipe) - - collocatedStatus = closePipe(collocatedPipe) - - if collocatedStatus: - sys.exit(1) - -def collocatedTest(name): - - collocatedTestWithOptions(name, "") + collocatedProc.waitTestSuccess() def cleanDbDir(path): for filename in [ os.path.join(path, f) for f in os.listdir(path) if f != ".gitignore" and f != "DB_CONFIG" ]: os.remove(filename) -def startClient(exe, args, config=None, env=None): +def startClient(exe, args = "", config=None, env=None, echo = True): if config == None: config = DriverConfig("client") - if debug: - print "(" + getCommandLine(exe, config, env) + ' ' + args + ")", - + cmd = getCommandLine(exe, config, env) + ' ' + args if config.lang == "php": - os.chdir(os.path.dirname(os.path.abspath(exe))) writePhpIni("php.ini", "tmp.ini") - return os.popen(getCommandLine(exe, config, env) + ' ' + args + " 2>&1") + return spawnClient(cmd, echo = echo) -def startServer(exe, args, config=None, env=None): +def startServer(exe, args = "", config=None, env=None, adapter = None, count = 1, echo = False): if config == None: config = DriverConfig("server") - if debug: - print "(" + getCommandLine(exe, config, env) + ' ' + args + ")", - return os.popen(getCommandLine(exe, config, env) + ' ' +args + " 2>&1") + cmd = getCommandLine(exe, config, env) + ' ' + args + return spawnServer(cmd, adapter = adapter, count = count, echo = echo) def startColloc(exe, args, config=None, env=None): if config == None: config = DriverConfig("colloc") - if debug: - print "(" + getCommandLine(exe, config, env) + ' ' + args + ")", - return os.popen(getCommandLine(exe, config, env) + ' ' + args + " 2>&1") + cmd = getCommandLine(exe, config, env) + ' ' + args + return spawnClient(cmd) -def getMappingDir(currentDir): - return os.path.abspath(os.path.join(findTopLevel(), getDefaultMapping(currentDir))) +def simpleTest(exe, options = ""): + print "starting client...", + command = exe + ' ' + options + client = spawnClient(command) + print "ok" + client.waitTestSuccess() def getCppBinDir(): binDir = os.path.join(getIceDir("cpp"), "bin") - if ice_home and x64: + if iceHome and x64: if isHpUx(): binDir = os.path.join(binDir, "pa20_64") elif isSolaris(): @@ -1205,10 +938,25 @@ def getCppBinDir(): binDir = os.path.join(binDir, "x64") return binDir +def getTestName(): + lang = getDefaultMapping() + here = os.getcwd().split(os.sep) + here.reverse() + for i in range(0, len(here)): + if here[i] == lang: + break + else: + raise "cannot find language dir" + here = here[:i-1] + here.reverse() + # The crossTests list is in UNIX format. + return os.path.join(*here).replace(os.sep, '/') + def processCmdLine(): def usage(): print "usage: " + sys.argv[0] + """ --debug Display debugging information on each test. + --trace=<file> Display tracing. --protocol=tcp|ssl Run with the given protocol. --compress Run the tests with protocol compression. --valgrind Run the tests with valgrind. @@ -1217,13 +965,14 @@ def processCmdLine(): --ipv6 Use IPv6 addresses. --ice-home=<path> Use the binary distribution from the given path. --x64 Binary distribution is 64-bit. + --cross=lang Run cross language test. """ sys.exit(2) try: opts, args = getopt.getopt( - sys.argv[1:], "", ["debug", "protocol=", "compress", "valgrind", "host=", "serialize", "ipv6", \ - "ice-home=", "x64"]) + sys.argv[1:], "", ["debug", "trace=", "protocol=", "compress", "valgrind", "host=", "serialize", "ipv6", \ + "ice-home=", "x64", "cross="]) except getopt.GetoptError: usage() @@ -1232,8 +981,26 @@ def processCmdLine(): for o, a in opts: if o == "--ice-home": - global ice_home - ice_home = a + global iceHome + iceHome = a + elif o == "--cross": + global cross + #testName = getTestName() + #if testName == "Ice/custom": + #if getTestName() not in crossTests: + cross.append(a) + if not a in ["cpp", "java", "cs", "py", "rb" ]: + print "cross must be one of cpp, java, cs, py or rb" + sys.exit(1) + if getTestName() not in crossTests: + print "*** This test does not support cross language testing" + sys.exit(0) + # Temporary. + lang = getDefaultMapping() + if getTestName() == "Ice/background" and (lang == "cs" or cross == "cs"): + print "*** This test does not support cross language testing" + sys.exit(0) + elif o == "--x64": global x64 x64 = True @@ -1252,6 +1019,12 @@ def processCmdLine(): elif o == "--ipv6": global ipv6 ipv6 = True + if o == "--trace": + global tracefile + if a == "stdout": + tracefile = sys.stdout + else: + tracefile = open(a, "w") elif o == "--debug": global debug debug = True @@ -1269,16 +1042,139 @@ def processCmdLine(): usage() # Only use binary distribution from ICE_HOME environment variable if USE_BIN_DIST=yes - if not ice_home and os.environ.get("USE_BIN_DIST", "no") == "yes": + if not iceHome and os.environ.get("USE_BIN_DIST", "no") == "yes": if os.environ.get("ICE_HOME", "") != "": - ice_home = os.environ["ICE_HOME"] + iceHome = os.environ["ICE_HOME"] elif isLinux(): - ice_home = "/usr" + iceHome = "/usr" if not x64: x64 = isWin32() and os.environ.get("XTARGET") == "x64" or os.environ.get("LP64") == "yes" configurePaths() +def runTests(start, expanded, num = 0, script = False): + total = 0 + for tests in expanded: + for i, args, config in tests: + total = total + 1 + # + # The configs argument is a list containing one or more test configurations. + # + index = 0 + for tests in expanded: + for i, args, config in tests: + index = index + 1 + if index < start: + continue + i = os.path.normpath(i) + dir = os.path.join(toplevel, i) + + print + if num > 0: + print "[" + str(num) + "]", + if script: + prefix = "echo \"" + suffix = "\"" + else: + prefix = "" + suffix = "" + + print "%s*** running tests %d/%d in %s%s" % (prefix, index, total, dir, suffix) + print "%s*** configuration:" % prefix, + if len(args.strip()) == 0: + print "Default", + else: + print args.strip(), + print suffix + + if args.find("cross") != -1: + test = os.path.join(*i.split(os.sep)[2:]) + # The crossTests list is in UNIX format. + test = test.replace(os.sep, '/') + if not test in crossTests: + print "%s*** test does not support cross testing%s" % (prefix, suffix) + continue + + # + # Skip tests not supported with IPv6 if necessary + # + if args.find("ipv6") != -1 and "noipv6" in config: + print "%s*** test not supported with IPv6%s" % (prefix, suffix) + continue + + if isVista() and "novista" in config: + print "%s*** test not supported under Vista%s" % (prefix, suffix) + continue + + if not isWin32() and "win32only" in config: + print "%s*** test only supported under Win32%s" % (prefix, suffix) + continue + + # If this is mono and we're running ssl protocol tests + # then skip. This occurs when using --all. + if mono and ("nomono" in config or (i.find(os.path.join("cs","test")) != -1 and args.find("ssl") != -1)): + print "%s*** test not supported with mono%s" % (prefix, suffix) + continue + + # If this is java and we're running ipv6 under windows then skip. + if isWin32() and i.find(os.path.join("java","test")) != -1 and args.find("ipv6") != -1: + print "%s*** test not supported under windows%s" % (prefix, suffix) + continue + + # Skip tests not supported by valgrind + if args.find("valgrind") != -1 and ("novalgrind" in config or args.find("ssl") != -1): + print "%s*** test not supported with valgrind%s" % (prefix, suffix) + continue + + if script: + print "echo \"*** test started: `date`\"" + print "cd %s" % dir + else: + print "*** test started:", time.strftime("%x %X") + sys.stdout.flush() + + os.chdir(dir) + + global keepGoing + if script: + print "if ! python %s %s; then" % (os.path.join(dir, "run.py"), args) + print " echo 'test in %s failed'" % os.path.abspath(dir) + if not keepGoing: + print " exit 1" + print "fi" + else: + status = os.system("python " + os.path.join(dir, "run.py " + args)) + + if status: + if(num > 0): + print "[" + str(num) + "]", + message = "test in " + os.path.abspath(dir) + " failed with exit status", status, + print message + if not keepGoing: + sys.exit(status) + else: + print " ** Error logged and will be displayed again when suite is completed **" + global testErrors + testErrors.append(message) + + if os.environ.has_key("ICE_CONFIG"): os.unsetenv("ICE_CONFIG") + +import inspect +frame = inspect.currentframe() +# Move to the top-most frame in the callback. +while frame.f_back is not None: + frame = frame.f_back +if os.path.split(frame.f_code.co_filename)[1] == "run.py": + # If we're not in the test directory, chdir to the correct + # location. + if not os.path.isabs(sys.argv[0]): + d = os.path.join(os.getcwd(), sys.argv[0]) + else: + d = sys.argv[0] + d = os.path.split(d)[0] + if os.path.normpath(d) != os.getcwd(): + os.chdir(d) + processCmdLine() diff --git a/scripts/__init__.py b/scripts/__init__.py new file mode 100644 index 00000000000..573cba74b62 --- /dev/null +++ b/scripts/__init__.py @@ -0,0 +1,10 @@ +# ********************************************************************** +# +# 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. +# +# ********************************************************************** + +__all__ = [ "Expect", "IceGridAdmin", "IceStormUtil", "TestUtil", "subprocess" ] diff --git a/demoscript/subprocess.py b/scripts/subprocess.py index aeca23d1a5d..aeca23d1a5d 100644 --- a/demoscript/subprocess.py +++ b/scripts/subprocess.py diff --git a/vb/allDemos.py b/vb/allDemos.py index 1ffacaf9adf..c45b8b9fc6d 100755 --- a/vb/allDemos.py +++ b/vb/allDemos.py @@ -17,8 +17,8 @@ for toplevel in [".", "..", "../..", "../../..", "../../../.."]: else: raise "can't find toplevel directory!" -sys.path.append(os.path.join(toplevel, "demoscript")) -import Util +sys.path.append(os.path.join(toplevel)) +from demoscript import Util # # List of all basic demos. |