summaryrefslogtreecommitdiff
path: root/php/allTests.py
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2007-09-05 15:43:14 +0800
committerMatthew Newhook <matthew@zeroc.com>2007-09-05 15:43:14 +0800
commit82beb10402185498b2e4ac5e4a90887be2685201 (patch)
tree351829e1b3b8976c840c15e76124634a270a754f /php/allTests.py
parentfixed error with keyword Makefile.mak (diff)
downloadice-82beb10402185498b2e4ac5e4a90887be2685201.tar.bz2
ice-82beb10402185498b2e4ac5e4a90887be2685201.tar.xz
ice-82beb10402185498b2e4ac5e4a90887be2685201.zip
General cleanup of the allTests.py and allDemos.py scripts.
* Improved usage message * Added --filter|--rfilter aliases for the -r|-R command line options * Added --start|--start-after to allTests.py * Added --start-after to allDemos.py * Added --all to allTests.py * General cleanup of the code. Fixed an import error with the ruby keyword test.
Diffstat (limited to 'php/allTests.py')
-rwxr-xr-xphp/allTests.py143
1 files changed, 107 insertions, 36 deletions
diff --git a/php/allTests.py b/php/allTests.py
index ea467833b03..935d13cfd7c 100755
--- a/php/allTests.py
+++ b/php/allTests.py
@@ -8,8 +8,7 @@
#
# **********************************************************************
-import os, sys
-import getopt
+import os, sys, re, getopt
for toplevel in [".", "..", "../..", "../../..", "../../../.."]:
toplevel = os.path.normpath(toplevel)
@@ -18,8 +17,24 @@ for toplevel in [".", "..", "../..", "../../..", "../../../.."]:
else:
raise "can't find toplevel directory!"
-def runTests(args, tests, num = 0):
+def isCygwin():
+
+ # The substring on sys.platform is required because some cygwin
+ # versions return variations like "cygwin_nt-4.01".
+ return sys.platform[:6] == "cygwin"
+
+def isWin32():
+
+ return sys.platform == "win32" or isCygwin()
+def isWin9x():
+
+ if isWin32():
+ return not (os.environ.has_key("OS") and os.environ["OS"] == "Windows_NT")
+ else:
+ return 0
+
+def runTests(args, tests, num = 0):
#
# Run each of the tests.
#
@@ -29,12 +44,15 @@ def runTests(args, tests, num = 0):
dir = os.path.join(toplevel, "test", i)
print
- if(num > 0):
+ if num > 0:
print "[" + str(num) + "]",
print "*** running tests in " + dir,
print
- status = os.system("python " + os.path.join(dir, "run.py " + args))
+ 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 and not (sys.platform.startswith("aix") and status == 256):
if(num > 0):
@@ -45,54 +63,107 @@ def runTests(args, tests, num = 0):
#
# List of all basic tests.
#
-tests = [ \
- "Ice/proxy", \
- "Ice/operations", \
- "Ice/exceptions", \
- "Ice/inheritance", \
- "Ice/binding", \
- "Ice/facets", \
- "Ice/objects", \
- "Ice/slicing/exceptions", \
- "Ice/slicing/objects", \
+tests = [
+ "Ice/proxy",
+ "Ice/operations",
+ "Ice/exceptions",
+ "Ice/inheritance",
+ "Ice/binding",
+ "Ice/facets",
+ "Ice/objects",
+ "Ice/slicing/exceptions",
+ "Ice/slicing/objects",
]
def usage():
- print "usage: " + sys.argv[0] + " -l -r <regex> -R <regex> --debug --protocol protocol --compress --host host --threadPerConnection"
+ 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:", \
- ["debug", "protocol=", "compress", "host=", "threadPerConnection"])
+ 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()
-if(args):
+# Extra args cause a usage error.
+if args:
usage()
-loop = 0
-args = ""
+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 == "-l":
- loop = 1
- if o == "-r" or o == '-R':
- import re
+ if o in ("-l", "--loop"):
+ loop = True
+ elif o in ("-r", "-R", "--filter", '--rfilter'):
regexp = re.compile(a)
- if o == '-r':
- def rematch(x): return regexp.search(x)
+ if o in ("--rfilter", "-R"):
+ tests = [ x for x in tests if not regexp.search(x) ]
else:
- def rematch(x): return not regexp.search(x)
- tests = filter(rematch, tests)
- if o in ( "--protocol", "--host" ):
- args += " " + o + " " + a
- if o in ( "--debug", "--compress", "--threadPerConnection" ):
- args += " " + o
-
+ 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:
- runTests(args, tests, num)
+ for arg in args:
+ runTests(arg, tests, num)
num += 1
else:
- runTests(args, tests)
+ for arg in args:
+ runTests(arg, tests)