summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrent Eagles <brent@zeroc.com>2007-11-09 16:52:50 -0330
committerBrent Eagles <brent@zeroc.com>2007-11-09 16:52:50 -0330
commitae9051ebad038def297b75ded66dec340934e72f (patch)
treef91ff30663418273180d0efffd1badb620f05733
parent- Fix slicedir macro so it will work if you are using ICE_HOME in a (diff)
downloadice-ae9051ebad038def297b75ded66dec340934e72f.tar.bz2
ice-ae9051ebad038def297b75ded66dec340934e72f.tar.xz
ice-ae9051ebad038def297b75ded66dec340934e72f.zip
- Added a first crack at a root allTests.py file.
- Consolidated basic command line processing to TestUtil.py
-rw-r--r--allTests.py29
-rwxr-xr-xconfig/TestUtil.py255
-rwxr-xr-xcpp/allTests.py120
-rwxr-xr-xcs/allTests.py135
-rwxr-xr-xjava/allTests.py120
-rwxr-xr-xphp/allTests.py120
-rwxr-xr-xpy/allTests.py121
-rwxr-xr-xrb/allTests.py127
8 files changed, 238 insertions, 789 deletions
diff --git a/allTests.py b/allTests.py
new file mode 100644
index 00000000000..89ef1e541d6
--- /dev/null
+++ b/allTests.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys, imp
+
+sys.path.append(os.path.join(os.path.dirname(__file__), "config"))
+import TestUtil
+
+testGroups = []
+
+for d in [ "cpp", "java", "cs", "py", "rb", "php" ]:
+
+ filename = os.path.abspath(os.path.join(os.path.dirname(__file__), d, "allTests.py"))
+ f = file(filename, "r")
+ current_mod = imp.load_module("allTests", f, filename, (".py", "r", imp.PY_SOURCE))
+ f.close()
+
+ tests = TestUtil.getTestSet([ os.path.join(d, "test", x) for x in current_mod.tests ])
+ if len(tests) > 0:
+ testGroups.extend(tests)
+
+TestUtil.rootRun(testGroups)
diff --git a/config/TestUtil.py b/config/TestUtil.py
index 452a3c9ea1e..6808d8bd0bf 100755
--- a/config/TestUtil.py
+++ b/config/TestUtil.py
@@ -21,6 +21,7 @@ threadPerConnection = 0 # Set to 1 to have tests use thread per connecti
host = "127.0.0.1" # Default to loopback.
debug = 0 # Set to 1 to enable test suite debugging.
mono = 0 # Set to 1 to use Mono as the default .NET CLR.
+keepGoing = 0 # Set to 1 to have the tests continue on failure.
javaCmd = "java" # Default java loader
phpCmd = "php" # Name of default php binary (usually php or php5)
@@ -37,9 +38,26 @@ phpCmd = "php" # Name of default php binary (usually php or php
#
defaultMapping = None
+testErrors = []
+
import sys, os, re, errno, getopt, time, StringIO
from threading import Thread
+usageMessage = "usage: " + sys.argv[0] + """
+ --all Run all permutations of the tests."
+ --start=<regex> Start running the tests at the given test."
+ --start-after=<regex> Start running the tests after the given test.
+ --loop Run the tests in a loop.
+ --filter=<regex> Run all the tests that match the given regex.
+ --rfilter=<regex> Run all the tests that do not match the given regex.
+ --debug Display debugging information on each test.
+ --protocol=tcp|ssl Run with the given protocol.
+ --compress Run the tests with protocol compression.
+ --host=host Set --Ice.Default.Host=<host>.
+ --threadPerConnection Run with thread-per-connection concurrency model.
+ --continue Keep running when a test fails
+"""
+
def configurePaths():
toplevel = findTopLevel()
@@ -101,50 +119,88 @@ def isAIX():
def isDarwin():
return sys.platform == "darwin"
-usageMessage = "usage: " + sys.argv[0] + """
- --all Run all permutations of the tests."
- --start=<regex> Start running the tests at the given test."
- --start-after=<regex> Start running the tests after the given test.
- --loop Run the tests in a loop.
- --filter=<regex> Run all the tests that match the given regex.
- --rfilter=<regex> Run all the tests that do not match the given regex.
- --debug Display debugging information on each test.
- --protocol=tcp|ssl Run with the given protocol.
- --compress Run the tests with protocol compression.
- --host=host Set --Ice.Default.Host=<host>.
- --threadPerConnection Run with thread-per-connection concurrency model.
-"""
-
def usage():
global usageMessage
print usageMessage
sys.exit(2)
+def index(l, re):
+ """Find the index of the first item in the list that matches the given re"""
+ for i in range(0, len(l)):
+ if re.search(l[i]):
+ return i
+ return -1
+
+def getTestSet(tests):
+ resultSet = tests[start:]
+ if testFilter != None:
+ if removeFilter:
+ resultSet = [ x for x in tests if not testFilter.search(x) ]
+ else:
+ resultSet = [ x for x in tests if testFilter.search(x) ]
+ return resultSet
+
+def run(tests):
+ global arg
+ testset = getTestSet(tests)
+ args = []
+ if all:
+ for protocol in ["ssl", "tcp"]:
+ for compress in [0, 1]:
+ for threadPerConnection in [0, 1]:
+ testarg = ""
+ if compress:
+ testarg += "--compress"
+ if threadPerConnection:
+ testarg += " --threadPerConnection"
+ testarg += " --protocol %s" % (protocol)
+ args.append(testarg)
+ else:
+ args.append(arg)
+
+ if loop:
+ num = 1
+ while 1:
+ for arg in args:
+ runTests(arg, [ os.path.join(getDefaultMapping(), "test", x) for x in testset ], num)
+ num += 1
+ else:
+ for arg in args:
+ runTests(arg, [ os.path.join(getDefaultMapping(), "test", x) for x in testset ])
+
+ global testErrors
+ if len(testErrors) > 0:
+ print "The following errors occurred:"
+ for x in testErrors:
+ print x
+
+def rootRun(tests):
+ global arg
+ if loop:
+ print "Looping is currently disabled for running all tests from the root!"
+ else:
+ if all:
+ for protocol in ["ssl", "tcp"]:
+ for compress in [0, 1]:
+ for threadPerConnection in [0, 1]:
+ testarg = ""
+ if compress:
+ testarg += "--compress"
+ if threadPerConnection:
+ testarg += " --threadPerConnection"
+ testarg += " --protocol %s" % (protocol)
+ args.append(testarg)
+ else:
+ args.append(arg)
-validShortArgs = "lr:R:"
-validLongArgs = ["start=", "start-after=", "filter=", "rfilter=", "all", "loop", "debug", "protocol=",
- "compress", "host=", "threadPerConnection"]
-
-try:
- opts, args = getopt.getopt(sys.argv[1:], validShortArgs, validLongArgs)
-except getopt.GetoptError:
- usage()
+ for arg in args:
+ runTests(arg, tests)
-for o, a in opts:
- if o == "--debug":
- debug = 1
- if o == "--protocol":
- if a not in ( "tcp", "ssl"):
- usage()
- protocol = a
- if o in ["-m", "--mono"]:
- mono = 1
- if o == "--compress":
- compress = 1
- if o == "--threadPerConnection":
- threadPerConnection = 1
- if o == "--host":
- host = a
+ global testErrors
+ if len(testErrors) > 0:
+ print "The following errors occurred:"
+ for x in testErrors:
+ print x
if not isWin32():
mono = 1
@@ -457,19 +513,15 @@ def commonInit():
def javaInit():
commonInit()
- pass
def cppInit():
commonInit()
- pass
def pythonInit():
commonInit()
- pass
def rubyInit():
commonInit()
- pass
def dotnetInit():
global usageMessage
@@ -484,7 +536,7 @@ def dotnetInit():
commonInit()
def phpInit():
- pass
+ commonInit()
class InvalidSelectorString(Exception):
def __init__(self, value):
@@ -546,8 +598,8 @@ def getDefaultMapping(currentDir = ""):
if p in ["cpp", "cs", "java", "php", "py", "rb", "tmp"]:
return p
- print >>sys.stderr, "Unable to determine default mapping"
- sys.exit(1)
+ # Default to C++
+ return "cpp"
def getTestEnv():
env = {}
@@ -678,16 +730,41 @@ def getCommandLine(exe, config, env = getTestEnv()):
return commandline
-def checkFiles(filelist):
- pass
-#
-# if getDefaultMapping() == "java":
-# # We skip checking for the file in Java since the 'file' is actually a class somewhere in the classpath.
-# return
-# for f in filelist:
-# if not (os.path.exists(f) and os.path.isfile(f)):
-# print >>sys.stderr, "File %s does not exist or is not executable" % f
-# sys.exit(1)
+def runTests(args, tests, num = 0):
+ global testErrors
+ global keepGoing
+
+ #
+ # Run each of the tests.
+ #
+ for i in tests:
+
+ i = os.path.normpath(i)
+ dir = os.path.join(toplevel, i)
+
+ print
+ if num > 0:
+ print "[" + str(num) + "]",
+ print "*** running tests in " + dir,
+ print
+
+ os.chdir(dir)
+
+ if isWin9x():
+ status = os.system("python " + os.path.join(dir, "run.py " + args))
+ else:
+ status = os.system(os.path.join(dir, "run.py " + args))
+
+ if status:
+ if(num > 0):
+ print "[" + str(num) + "]",
+ message = "test in " + os.path.abspath(dir) + " failed with exit status", status,
+ print message
+ if keepGoing == 0:
+ sys.exit(status)
+ else:
+ print " ** Error logged and will be displayed again when suite is completed **"
+ testErrors.append(message)
def getDefaultServerFile():
lang = getDefaultMapping()
@@ -739,8 +816,6 @@ def clientServerTestWithOptionsAndNames(name, additionalServerOptions, additiona
server = os.path.join(testdir, serverName)
client = os.path.join(testdir, clientName)
- checkFiles([server, client])
-
print "starting " + serverName + "...",
serverCfg = DriverConfig("server")
if lang in ["rb", "php"]:
@@ -832,7 +907,6 @@ def mixedClientServerTestWithOptions(name, additionalServerOptions, additionalCl
if lang != "java":
server = os.path.join(testdir, server)
client = os.path.join(testdir, client)
- checkFiles([server, client])
print "starting server...",
serverCmd = getCommandLine(server, DriverConfig("server")) + additionalServerOptions
@@ -874,7 +948,6 @@ def collocatedTestWithOptions(name, additionalOptions):
collocated = getDefaultCollocatedFile()
if lang != "java":
collocated = os.path.join(testdir, collocated)
- checkFiles([collocated])
print "starting collocated...",
command = getCommandLine(collocated, DriverConfig("colloc")) + ' ' + additionalOptions
@@ -933,3 +1006,69 @@ def getBinDir(currentDir):
def getCertsDir(currentDir):
return os.path.abspath(os.path.join(findTopLevel(), "certs"))
+
+validShortArgs = "lr:R:"
+validLongArgs = ["start=", "start-after=", "filter=", "rfilter=", "all", "loop", "debug", "protocol=",
+ "compress", "host=", "threadPerConnection", "continue"]
+
+opts = []
+args = []
+loop = False
+arg = ""
+all = False
+
+try:
+ opts, args = getopt.getopt(sys.argv[1:], validShortArgs, validLongArgs)
+except getopt.GetoptError:
+ usage()
+
+if args:
+ usage()
+
+testFilter = None
+removeFilter = False
+start = 0
+
+for o, a in opts:
+ if o in ["-m", "--mono"]:
+ mono = 1
+ elif o == "--continue":
+ keepGoing = 1
+ elif o == "--compress":
+ compress = 1
+ elif o == "--threadPerConnection":
+ threadPerConnection = 1
+ elif o == "--host":
+ host = a
+ elif o in ("-l", "--loop"):
+ loop = True
+ elif o in ("-r", "-R", "--filter", '--rfilter'):
+ testFilter = re.compile(a)
+ if o in ("--rfilter", "-R"):
+ removeFilter = True
+ elif o == "--all" :
+ all = True
+ elif o in ( "--protocol", "--host", "--debug", "--compress", "--threadPerConnection" ):
+ if o == "--protocol":
+ if a not in ( "ssl", "tcp"):
+ usage()
+ protocol = a
+ arg += " " + o
+
+ if o == "--debug":
+ debug = 1
+
+ if len(a) > 0:
+ arg += " " + a
+ elif o in ('--start', "--start-after"):
+ start = index(tests, re.compile(a))
+ if start == -1:
+ print "test %s not found. no tests to run" % (a)
+ sys.exit(2)
+ if o == "--start-after":
+ start += 1
+ tests = tests[start:]
+
+if all and len(arg) > 0:
+ usage()
+
diff --git a/cpp/allTests.py b/cpp/allTests.py
index 818c5a98ed0..019f7cb67eb 100755
--- a/cpp/allTests.py
+++ b/cpp/allTests.py
@@ -20,32 +20,6 @@ else:
sys.path.append(os.path.join(toplevel, "config"))
import TestUtil
-def runTests(args, tests, num = 0):
- #
- # Run each of the tests.
- #
- for i in tests:
-
- i = os.path.normpath(i)
- dir = os.path.join(toplevel, TestUtil.getDefaultMapping(), "test", i)
-
- print
- if num > 0:
- print "[" + str(num) + "]",
- print "*** running tests in " + dir,
- print
-
- if TestUtil.isWin9x():
- status = os.system("python " + os.path.join(dir, "run.py " + args))
- else:
- status = os.system(os.path.join(dir, "run.py " + args))
-
- if status:
- if(num > 0):
- print "[" + str(num) + "]",
- print "test in " + dir + " failed with exit status", status,
- sys.exit(status)
-
#
# List of all basic tests.
#
@@ -118,95 +92,5 @@ if TestUtil.isCygwin() == 0:
if TestUtil.isWin32():
tests.insert(0, "IceUtil/condvar")
-def usage():
- print "usage: %s " % (sys.argv[0])
- print " --all Run all permutations of the tests."
- print " --start=<regex> Start running the tests at the given test."
- print " --start-after=<regex> Start running the tests after the given test."
- print " --loop Run the tests in a loop."
- print " --filter=<regex> Run all the tests that match the given regex."
- print " --rfilter=<regex> Run all the tests that do not match the given regex."
- print " --debug Display debugging information on each test."
- print " --protocol=tcp|ssl Run with the given protocol."
- print " --compress Run the tests with protocol compression."
- print " --host=host Set --Ice.Default.Host=<host>."
- print " --threadPerConnection Run with thread-per-connection concurrency model."
- sys.exit(2)
-
-try:
- opts, args = getopt.getopt(sys.argv[1:], "lr:R:",
- ["start=", "start-after=", "filter=", "rfilter=", "all", "loop", "debug", "protocol=",
- "compress", "host=", "threadPerConnection"])
-except getopt.GetoptError:
- usage()
-
-# Extra args cause a usage error.
-if args:
- usage()
-
-def index(l, re):
- """Find the index of the first item in the list that matches the given re"""
- for i in range(0, len(l)):
- if re.search(l[i]):
- return i
- return -1
-
-# Process the command line args.
-loop = False
-arg = ""
-all = False
-for o, a in opts:
- if o in ("-l", "--loop"):
- loop = True
- elif o in ("-r", "-R", "--filter", '--rfilter'):
- regexp = re.compile(a)
- if o in ("--rfilter", "-R"):
- tests = [ x for x in tests if not regexp.search(x) ]
- else:
- tests = [ x for x in tests if regexp.search(x) ]
- elif o == "--all" :
- all = True
- elif o in ( "--protocol", "--host", "--debug", "--compress", "--threadPerConnection" ):
- if o == "--protocol":
- if a not in ( "ssl", "tcp"):
- usage()
- arg += " " + o
- if len(a) > 0:
- arg += " " + a
- elif o in ('--start', "--start-after"):
- start = index(tests, re.compile(a))
- if start == -1:
- print "test %s not found. no tests to run" % (a)
- sys.exit(2)
- if o == "--start-after":
- start += 1
- tests = tests[start:]
-
-args = []
-if all and len(arg) > 0:
- usage()
-
-if all:
- for protocol in ["ssl", "tcp"]:
- for compress in [0, 1]:
- for threadPerConnection in [0, 1]:
- arg = ""
- if compress:
- arg += "--compress"
- if threadPerConnection:
- arg += " --threadPerConnection"
- arg += " --protocol %s" % (protocol)
- args.append(arg)
-else:
- args.append(arg)
-
-# Run the tests.
-if loop:
- num = 1
- while 1:
- for arg in args:
- runTests(arg, tests, num)
- num += 1
-else:
- for arg in args:
- runTests(arg, tests)
+if __name__ == "__main__":
+ TestUtil.run(tests)
diff --git a/cs/allTests.py b/cs/allTests.py
index cf94e6680b2..3a828e31bd9 100755
--- a/cs/allTests.py
+++ b/cs/allTests.py
@@ -20,32 +20,6 @@ else:
sys.path.append(os.path.join(toplevel, "config"))
import TestUtil
-def runTests(args, tests, num = 0):
- #
- # Run each of the tests.
- #
- for i in tests:
-
- i = os.path.normpath(i)
- dir = os.path.join(TestUtil.getMappingDir(__file__), "test", i)
-
- print
- if num > 0:
- print "[" + str(num) + "]",
- print "*** running tests in " + dir,
- print
-
- if TestUtil.isWin9x():
- status = os.system("python " + os.path.join(dir, "run.py " + args))
- else:
- status = os.system(os.path.join(dir, "run.py " + args))
-
- if status:
- if(num > 0):
- print "[" + str(num) + "]",
- print "test in " + dir + " failed with exit status", status,
- sys.exit(status)
-
#
# List of all basic tests.
#
@@ -80,110 +54,5 @@ tests = [ \
"IceGrid/simple" \
]
-def usage():
- print "usage: %s " % (sys.argv[0])
- print " --mono Run the tests with mono."
- print " --all Run all permutations of the tests."
- print " --start=<regex> Start running the tests at the given test."
- print " --start-after=<regex> Start running the tests after the given test."
- print " --loop Run the tests in a loop."
- print " --filter=<regex> Run all the tests that match the given regex."
- print " --rfilter=<regex> Run all the tests that do not match the given regex."
- print " --debug Display debugging information on each test."
- print " --protocol=tcp|ssl Run with the given protocol."
- print " --compress Run the tests with protocol compression."
- print " --host=host Set --Ice.Default.Host=<host>."
- print " --threadPerConnection Run with thread-per-connection concurrency model."
- sys.exit(2)
-
-try:
- opts, args = getopt.getopt(sys.argv[1:], "mlr:R:",
- ["start=", "start-after=", "filter=", "rfilter=", "all", "loop", "debug", "protocol=",
- "compress", "host=", "threadPerConnection", "mono"])
-except getopt.GetoptError:
- usage()
-
-# Extra args cause a usage error.
-if args:
- usage()
-
-def index(l, re):
- """Find the index of the first item in the list that matches the given re"""
- for i in range(0, len(l)):
- if re.search(l[i]):
- return i
- return -1
-
-# Process the command line args.
-mono = False
-loop = False
-arg = ""
-all = False
-for o, a in opts:
- if o in ("-l", "--loop"):
- loop = True
- elif o in ("-r", "-R", "--filter", '--rfilter'):
- regexp = re.compile(a)
- if o in ("--rfilter", "-R"):
- tests = [ x for x in tests if not regexp.search(x) ]
- else:
- tests = [ x for x in tests if regexp.search(x) ]
- elif o == "--all" :
- all = True
- elif o in ( "--protocol", "--host", "--debug", "--compress", "--threadPerConnection" ):
- if o == "--protocol":
- if a not in ( "ssl", "tcp"):
- usage()
- arg += " " + o
- if len(a) > 0:
- arg += " " + a
- elif o in ('--start', "--start-after"):
- start = index(tests, re.compile(a))
- if start == -1:
- print "test %s not found. no tests to run" % (a)
- sys.exit(2)
- if o == "--start-after":
- start += 1
- tests = tests[start:]
- elif o in ( "-m", "--mono" ):
- args += " " + o
- mono = True
-
-args = []
-if all and len(arg) > 0:
- usage()
-
-if all:
- for protocol in ["ssl", "tcp"]:
- for compress in [0, 1]:
- for threadPerConnection in [0, 1]:
- arg = ""
- if compress:
- arg += "--compress"
- if threadPerConnection:
- arg += " --threadPerConnection"
- arg += " --protocol %s" % (protocol)
- args.append(arg)
-else:
- args.append(arg)
-
-if not TestUtil.isWin32():
- mono = True
-
-# For mono or vista the IceSSL configuration test is removed.
-if mono or TestUtil.isVista():
- try:
- tests.remove("IceSSL/configuration")
- except ValueError:
- pass
-
-# Run the tests.
-if loop:
- num = 1
- while 1:
- for arg in args:
- runTests(arg, tests, num)
- num += 1
-else:
- for arg in args:
- runTests(arg, tests)
+if __name__ == "__main__":
+ TestUtil.run(tests)
diff --git a/java/allTests.py b/java/allTests.py
index 70bbf35d1af..a8a563a91ed 100755
--- a/java/allTests.py
+++ b/java/allTests.py
@@ -20,32 +20,6 @@ else:
sys.path.append(os.path.join(toplevel, "config"))
import TestUtil
-def runTests(args, tests, num = 0):
- #
- # Run each of the tests.
- #
- for i in tests:
-
- i = os.path.normpath(i)
- dir = os.path.join(toplevel, TestUtil.getDefaultMapping(), "test", i)
-
- print
- if num > 0:
- print "[" + str(num) + "]",
- print "*** running tests in " + dir,
- print
-
- if TestUtil.isWin9x():
- status = os.system("python " + os.path.join(dir, "run.py " + args))
- else:
- status = os.system(os.path.join(dir, "run.py " + args))
-
- if status:
- if(num > 0):
- print "[" + str(num) + "]",
- print "test in " + dir + " failed with exit status", status,
- sys.exit(status)
-
#
# List of all basic tests.
#
@@ -84,95 +58,5 @@ tests = [
"IceSSL/configuration",
]
-def usage():
- print "usage: %s " % (sys.argv[0])
- print " --all Run all permutations of the tests."
- print " --start=<regex> Start running the tests at the given test."
- print " --start-after=<regex> Start running the tests after the given test."
- print " --loop Run the tests in a loop."
- print " --filter=<regex> Run all the tests that match the given regex."
- print " --rfilter=<regex> Run all the tests that do not match the given regex."
- print " --debug Display debugging information on each test."
- print " --protocol=tcp|ssl Run with the given protocol."
- print " --compress Run the tests with protocol compression."
- print " --host=host Set --Ice.Default.Host=<host>."
- print " --threadPerConnection Run with thread-per-connection concurrency model."
- sys.exit(2)
-
-try:
- opts, args = getopt.getopt(sys.argv[1:], "lr:R:",
- ["start=", "start-after=", "filter=", "rfilter=", "all", "loop", "debug", "protocol=",
- "compress", "host=", "threadPerConnection"])
-except getopt.GetoptError:
- usage()
-
-# Extra args cause a usage error.
-if args:
- usage()
-
-def index(l, re):
- """Find the index of the first item in the list that matches the given re"""
- for i in range(0, len(l)):
- if re.search(l[i]):
- return i
- return -1
-
-# Process the command line args.
-loop = False
-arg = ""
-all = False
-for o, a in opts:
- if o in ("-l", "--loop"):
- loop = True
- elif o in ("-r", "-R", "--filter", '--rfilter'):
- regexp = re.compile(a)
- if o in ("--rfilter", "-R"):
- tests = [ x for x in tests if not regexp.search(x) ]
- else:
- tests = [ x for x in tests if regexp.search(x) ]
- elif o == "--all" :
- all = True
- elif o in ( "--protocol", "--host", "--debug", "--compress", "--threadPerConnection" ):
- if o == "--protocol":
- if a not in ( "ssl", "tcp"):
- usage()
- arg += " " + o
- if len(a) > 0:
- arg += " " + a
- elif o in ('--start', "--start-after"):
- start = index(tests, re.compile(a))
- if start == -1:
- print "test %s not found. no tests to run" % (a)
- sys.exit(2)
- if o == "--start-after":
- start += 1
- tests = tests[start:]
-
-args = []
-if all and len(arg) > 0:
- usage()
-
-if all:
- for protocol in ["ssl", "tcp"]:
- for compress in [0, 1]:
- for threadPerConnection in [0, 1]:
- arg = ""
- if compress:
- arg += "--compress"
- if threadPerConnection:
- arg += " --threadPerConnection"
- arg += " --protocol %s" % (protocol)
- args.append(arg)
-else:
- args.append(arg)
-
-# Run the tests.
-if loop:
- num = 1
- while 1:
- for arg in args:
- runTests(arg, tests, num)
- num += 1
-else:
- for arg in args:
- runTests(arg, tests)
+if __name__ == "__main__":
+ TestUtil.run(tests)
diff --git a/php/allTests.py b/php/allTests.py
index e41b9169ac9..8c5ad142610 100755
--- a/php/allTests.py
+++ b/php/allTests.py
@@ -20,32 +20,6 @@ else:
sys.path.append(os.path.join(toplevel, "config"))
import TestUtil
-def runTests(args, tests, num = 0):
- #
- # Run each of the tests.
- #
- for i in tests:
-
- i = os.path.normpath(i)
- dir = os.path.join(toplevel, TestUtil.getDefaultMapping(), "test", i)
-
- print
- if num > 0:
- print "[" + str(num) + "]",
- print "*** running tests in " + dir,
- print
-
- if TestUtil.isWin9x():
- status = os.system("python " + os.path.join(dir, "run.py " + args))
- else:
- status = os.system(os.path.join(dir, "run.py " + args))
-
- if status:
- if(num > 0):
- print "[" + str(num) + "]",
- print "test in " + dir + " failed with exit status", status,
- sys.exit(status)
-
#
# List of all basic tests.
#
@@ -62,95 +36,5 @@ tests = [
"Slice/keyword",
]
-def usage():
- print "usage: %s " % (sys.argv[0])
- print " --all Run all permutations of the tests."
- print " --start=<regex> Start running the tests at the given test."
- print " --start-after=<regex> Start running the tests after the given test."
- print " --loop Run the tests in a loop."
- print " --filter=<regex> Run all the tests that match the given regex."
- print " --rfilter=<regex> Run all the tests that do not match the given regex."
- print " --debug Display debugging information on each test."
- print " --protocol=tcp|ssl Run with the given protocol."
- print " --compress Run the tests with protocol compression."
- print " --host=host Set --Ice.Default.Host=<host>."
- print " --threadPerConnection Run with thread-per-connection concurrency model."
- sys.exit(2)
-
-try:
- opts, args = getopt.getopt(sys.argv[1:], "lr:R:",
- ["start=", "start-after=", "filter=", "rfilter=", "all", "loop", "debug", "protocol=",
- "compress", "host=", "threadPerConnection"])
-except getopt.GetoptError:
- usage()
-
-# Extra args cause a usage error.
-if args:
- usage()
-
-def index(l, re):
- """Find the index of the first item in the list that matches the given re"""
- for i in range(0, len(l)):
- if re.search(l[i]):
- return i
- return -1
-
-# Process the command line args.
-loop = False
-arg = ""
-all = False
-for o, a in opts:
- if o in ("-l", "--loop"):
- loop = True
- elif o in ("-r", "-R", "--filter", '--rfilter'):
- regexp = re.compile(a)
- if o in ("--rfilter", "-R"):
- tests = [ x for x in tests if not regexp.search(x) ]
- else:
- tests = [ x for x in tests if regexp.search(x) ]
- elif o == "--all" :
- all = True
- elif o in ( "--protocol", "--host", "--debug", "--compress", "--threadPerConnection" ):
- if o == "--protocol":
- if a not in ( "ssl", "tcp"):
- usage()
- arg += " " + o
- if len(a) > 0:
- arg += " " + a
- elif o in ('--start', "--start-after"):
- start = index(tests, re.compile(a))
- if start == -1:
- print "test %s not found. no tests to run" % (a)
- sys.exit(2)
- if o == "--start-after":
- start += 1
- tests = tests[start:]
-
-args = []
-if all and len(arg) > 0:
- usage()
-
-if all:
- for protocol in ["ssl", "tcp"]:
- for compress in [0, 1]:
- for threadPerConnection in [0, 1]:
- arg = ""
- if compress:
- arg += "--compress"
- if threadPerConnection:
- arg += " --threadPerConnection"
- arg += " --protocol %s" % (protocol)
- args.append(arg)
-else:
- args.append(arg)
-
-# Run the tests.
-if loop:
- num = 1
- while 1:
- for arg in args:
- runTests(arg, tests, num)
- num += 1
-else:
- for arg in args:
- runTests(arg, tests)
+if __name__ == "__main__":
+ TestUtil.run(tests)
diff --git a/py/allTests.py b/py/allTests.py
index fd254d32a3c..8057515dd66 100755
--- a/py/allTests.py
+++ b/py/allTests.py
@@ -20,33 +20,6 @@ else:
sys.path.append(os.path.join(toplevel, "config"))
import TestUtil
-def runTests(args, tests, num = 0):
- #
- # Run each of the tests.
- #
- for i in tests:
-
- i = os.path.normpath(i)
- dir = os.path.join(toplevel, TestUtil.getDefaultMapping(), "test", i)
-
- print
- if num > 0:
- print "[" + str(num) + "]",
- print "*** running tests in " + dir,
- print
- os.chdir(dir)
-
- if TestUtil.isWin9x():
- status = os.system("python " + os.path.join(dir, "run.py " + args))
- else:
- status = os.system(os.path.join(dir, "run.py " + args))
-
- if status:
- if(num > 0):
- print "[" + str(num) + "]",
- print "test in " + dir + " failed with exit status", status,
- sys.exit(status)
-
#
# List of all basic tests.
#
@@ -72,95 +45,5 @@ tests = [
"Ice/blobject",
]
-def usage():
- print "usage: %s " % (sys.argv[0])
- print " --all Run all permutations of the tests."
- print " --start=<regex> Start running the tests at the given test."
- print " --start-after=<regex> Start running the tests after the given test."
- print " --loop Run the tests in a loop."
- print " --filter=<regex> Run all the tests that match the given regex."
- print " --rfilter=<regex> Run all the tests that do not match the given regex."
- print " --debug Display debugging information on each test."
- print " --protocol=tcp|ssl Run with the given protocol."
- print " --compress Run the tests with protocol compression."
- print " --host=host Set --Ice.Default.Host=<host>."
- print " --threadPerConnection Run with thread-per-connection concurrency model."
- sys.exit(2)
-
-try:
- opts, args = getopt.getopt(sys.argv[1:], "lr:R:",
- ["start=", "start-after=", "filter=", "rfilter=", "all", "loop", "debug", "protocol=",
- "compress", "host=", "threadPerConnection"])
-except getopt.GetoptError:
- usage()
-
-# Extra args cause a usage error.
-if args:
- usage()
-
-def index(l, re):
- """Find the index of the first item in the list that matches the given re"""
- for i in range(0, len(l)):
- if re.search(l[i]):
- return i
- return -1
-
-# Process the command line args.
-loop = False
-arg = ""
-all = False
-for o, a in opts:
- if o in ("-l", "--loop"):
- loop = True
- elif o in ("-r", "-R", "--filter", '--rfilter'):
- regexp = re.compile(a)
- if o in ("--rfilter", "-R"):
- tests = [ x for x in tests if not regexp.search(x) ]
- else:
- tests = [ x for x in tests if regexp.search(x) ]
- elif o == "--all" :
- all = True
- elif o in ( "--protocol", "--host", "--debug", "--compress", "--threadPerConnection" ):
- if o == "--protocol":
- if a not in ( "ssl", "tcp"):
- usage()
- arg += " " + o
- if len(a) > 0:
- arg += " " + a
- elif o in ('--start', "--start-after"):
- start = index(tests, re.compile(a))
- if start == -1:
- print "test %s not found. no tests to run" % (a)
- sys.exit(2)
- if o == "--start-after":
- start += 1
- tests = tests[start:]
-
-args = []
-if all and len(arg) > 0:
- usage()
-
-if all:
- for protocol in ["ssl", "tcp"]:
- for compress in [0, 1]:
- for threadPerConnection in [0, 1]:
- arg = ""
- if compress:
- arg += "--compress"
- if threadPerConnection:
- arg += " --threadPerConnection"
- arg += " --protocol %s" % (protocol)
- args.append(arg)
-else:
- args.append(arg)
-
-# Run the tests.
-if loop:
- num = 1
- while 1:
- for arg in args:
- runTests(arg, tests, num)
- num += 1
-else:
- for arg in args:
- runTests(arg, tests)
+if __name__ == "__main__":
+ TestUtil.run(tests)
diff --git a/rb/allTests.py b/rb/allTests.py
index 7726fc64893..f904e2302d3 100755
--- a/rb/allTests.py
+++ b/rb/allTests.py
@@ -20,32 +20,6 @@ else:
sys.path.append(os.path.join(toplevel, "config"))
import TestUtil
-def runTests(args, tests, num = 0):
- #
- # Run each of the tests.
- #
- for i in tests:
-
- i = os.path.normpath(i)
- dir = os.path.join(TestUtil.getMappingDir(__file__), "test", i)
-
- print
- if num > 0:
- print "[" + str(num) + "]",
- print "*** running tests in " + dir,
- print
-
- if TestUtil.isWin9x():
- status = os.system("python " + os.path.join(dir, "run.py " + args))
- else:
- status = os.system(os.path.join(dir, "run.py " + args))
-
- if status and not (sys.platform.startswith("aix") and status == 256):
- if(num > 0):
- print "[" + str(num) + "]",
- print "test in " + dir + " failed with exit status", status,
- sys.exit(status)
-
#
# List of all basic tests.
#
@@ -66,102 +40,5 @@ tests = [
"Ice/slicing/objects",
]
-def usage():
- print "usage: %s " % (sys.argv[0])
- print " --all Run all permutations of the tests."
- print " --start=<regex> Start running the tests at the given test."
- print " --start-after=<regex> Start running the tests after the given test."
- print " --loop Run the tests in a loop."
- print " --filter=<regex> Run all the tests that match the given regex."
- print " --rfilter=<regex> Run all the tests that do not match the given regex."
- print " --debug Display debugging information on each test."
- print " --protocol=tcp|ssl Run with the given protocol."
- print " --compress Run the tests with protocol compression."
- print " --host=host Set --Ice.Default.Host=<host>."
-
- if not TestUtil.isWin32():
- print " --threadPerConnection Run with thread-per-connection concurrency model."
-
- sys.exit(2)
-
-try:
- validArgs = ["start=", "start-after=", "filter=", "rfilter=", "all", "loop", "debug", "protocol=",
- "compress", "host="]
- if not TestUtil.isWin32():
- validArgs.append("threadPerConnection")
- opts, args = getopt.getopt(sys.argv[1:], "lr:R:", validArgs)
-except getopt.GetoptError:
- usage()
-
-# Extra args cause a usage error.
-if args:
- usage()
-
-def index(l, re):
- """Find the index of the first item in the list that matches the given re"""
- for i in range(0, len(l)):
- if re.search(l[i]):
- return i
- return -1
-
-# Process the command line args.
-loop = False
-arg = ""
-all = False
-for o, a in opts:
- if o in ("-l", "--loop"):
- loop = True
- elif o in ("-r", "-R", "--filter", '--rfilter'):
- regexp = re.compile(a)
- if o in ("--rfilter", "-R"):
- tests = [ x for x in tests if not regexp.search(x) ]
- else:
- tests = [ x for x in tests if regexp.search(x) ]
- elif o == "--all" :
- all = True
- elif o in ( "--protocol", "--host", "--debug", "--compress", "--threadPerConnection" ):
- if o == "--protocol":
- if a not in ( "ssl", "tcp"):
- usage()
- arg += " " + o
- if len(a) > 0:
- arg += " " + a
- elif o in ('--start', "--start-after"):
- start = index(tests, re.compile(a))
- if start == -1:
- print "test %s not found. no tests to run" % (a)
- sys.exit(2)
- if o == "--start-after":
- start += 1
- tests = tests[start:]
-
-args = []
-if all and len(arg) > 0:
- usage()
-
-if all:
- for protocol in ["ssl", "tcp"]:
- for compress in [0, 1]:
- for threadPerConnection in [0, 1]:
- if TestUtil.isWin32() and threadPerConnection == 1:
- continue
- arg = ""
- if compress:
- arg += "--compress"
- if threadPerConnection:
- arg += " --threadPerConnection"
- arg += " --protocol %s" % (protocol)
- args.append(arg)
-else:
- args.append(arg)
-
-# Run the tests.
-if loop:
- num = 1
- while 1:
- for arg in args:
- runTests(arg, tests, num)
- num += 1
-else:
- for arg in args:
- runTests(arg, tests)
+if __name__ == "__main__":
+ TestUtil.run(tests)