diff options
Diffstat (limited to 'cpp/allTests.py')
-rwxr-xr-x | cpp/allTests.py | 51 |
1 files changed, 40 insertions, 11 deletions
diff --git a/cpp/allTests.py b/cpp/allTests.py index 45421ac1586..65cac432ce9 100755 --- a/cpp/allTests.py +++ b/cpp/allTests.py @@ -18,10 +18,33 @@ for toplevel in [".", "..", "../..", "../../..", "../../../.."]: else: raise "can't find toplevel directory!" -sys.path.append(os.path.join(toplevel, "config")) -import TestUtil +def isCygwin(): -def runTests(tests, num = 0): + # The substring on sys.platform is required because some cygwin + # versions return variations like "cygwin_nt-4.01". + if sys.platform[:6] == "cygwin": + return 1 + else: + return 0 + +def isWin32(): + + if sys.platform == "win32" or isCygwin(): + return 1 + else: + return 0 + + +def isWin9x(): + + if isWin32(): + if os.environ.has_key("OS") and os.environ["OS"] == "Windows_NT": + return 0 + return 1 + else: + return 0 + +def runTests(args, tests, num = 0): # # Run each of the tests. @@ -37,10 +60,10 @@ def runTests(tests, num = 0): print "*** running tests in " + dir, print - if TestUtil.isWin9x(): - status = os.system("python " + os.path.join(dir, "run.py")) + if isWin9x(): + status = os.system("python " + os.path.join(dir, "run.py " + args)) else: - status = os.system(os.path.join(dir, "run.py")) + status = os.system(os.path.join(dir, "run.py " + args)) if status: if(num > 0): @@ -102,17 +125,18 @@ tests = [ \ # # These tests are currently disabled on cygwin # -if TestUtil.isCygwin() == 0: +if isCygwin() == 0: tests += [ \ ] def usage(): - print "usage: " + sys.argv[0] + " [-l] [-r <regex>] [-R <regex>]" + print "usage: " + sys.argv[0] + " -l -r <regex> -R <regex> --debug --protocol protocol --compress --host host --threadPerConnection" sys.exit(2) try: - opts, args = getopt.getopt(sys.argv[1:], "lr:R:") + opts, args = getopt.getopt(sys.argv[1:], "lr:R:", \ + ["debug", "protocol=", "compress", "host=", "threadPerConnection"]) except getopt.GetoptError: usage() @@ -120,6 +144,7 @@ if(args): usage() loop = 0 +args = "" for o, a in opts: if o == "-l": loop = 1 @@ -131,11 +156,15 @@ for o, a in opts: 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 if loop: num = 1 while 1: - runTests(tests, num) + runTests(args, tests, num) num += 1 else: - runTests(tests) + runTests(args, tests) |