diff options
Diffstat (limited to 'cpp')
77 files changed, 999 insertions, 1922 deletions
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) |