Merge with stable
authorChristian Ebert <blacktrash@gmx.net>
Sun, 10 Oct 2010 01:10:13 +0100
changeset 835 d3f66c4952ae
parent 832 1f1db3dc9ddf (current diff)
parent 834 5a6898736b1a (diff)
child 836 53a9228f13de
Merge with stable
--- a/tests/run-tests.py	Sat Oct 09 15:47:19 2010 +0100
+++ b/tests/run-tests.py	Sun Oct 10 01:10:13 2010 +0100
@@ -454,13 +454,6 @@
     vlog("# Running", cmd)
     return run(cmd, options, replacements)
 
-def battest(test, options, replacements):
-    # To reliably get the error code from batch files on WinXP,
-    # the "cmd /c call" prefix is needed. Grrr
-    cmd = 'cmd /c call "%s"' % testpath
-    vlog("# Running", cmd)
-    return run(cmd, options, replacements)
-
 def tsttest(test, options, replacements):
     t = open(test)
     out = []
@@ -664,22 +657,12 @@
 
     if lctest.endswith('.py') or firstline == '#!/usr/bin/env python':
         runner = pytest
-    elif lctest.endswith('.bat'):
-        # do not run batch scripts on non-windows
-        if os.name != 'nt':
-            return skip("batch script")
-        runner = battest
     elif lctest.endswith('.t'):
         runner = tsttest
         ref = testpath
     else:
-        # do not run shell scripts on windows
-        if os.name == 'nt':
-            return skip("shell script")
         # do not try to run non-executable programs
-        if not os.path.exists(testpath):
-            return fail("does not exist")
-        elif not os.access(testpath, os.X_OK):
+        if not os.access(testpath, os.X_OK):
             return skip("not executable")
         runner = shtest
 
@@ -983,6 +966,27 @@
 
         checktools()
 
+    if len(args) == 0:
+        args = os.listdir(".")
+    args.sort()
+
+    tests = []
+    skipped = []
+    for test in args:
+        if (test.startswith("test-") and '~' not in test and
+            ('.' not in test or test.endswith('.py') or
+             test.endswith('.bat') or test.endswith('.t'))):
+            if not os.path.exists(test):
+                skipped.append(test)
+            else:
+                tests.append(test)
+    if not tests:
+        for test in skipped:
+            print 'Skipped %s: does not exist' % test
+        print "# Ran 0 tests, %d skipped, 0 failed." % len(skipped)
+        return
+    tests = tests + skipped
+
     # Reset some environment variables to well-known values so that
     # the tests produce repeatable output.
     os.environ['LANG'] = os.environ['LC_ALL'] = os.environ['LANGUAGE'] = 'C'
@@ -1069,20 +1073,6 @@
 
     COVERAGE_FILE = os.path.join(TESTDIR, ".coverage")
 
-    if len(args) == 0:
-        args = os.listdir(".")
-        args.sort()
-
-    tests = []
-    for test in args:
-        if (test.startswith("test-") and '~' not in test and
-            ('.' not in test or test.endswith('.py') or
-             test.endswith('.bat') or test.endswith('.t'))):
-            tests.append(test)
-    if not tests:
-        print "# Ran 0 tests, 0 skipped, 0 failed."
-        return
-
     vlog("# Using TESTDIR", TESTDIR)
     vlog("# Using HGTMP", HGTMP)
     vlog("# Using PATH", os.environ["PATH"])