Merge with stable
authorChristian Ebert <blacktrash@gmx.net>
Mon, 14 Apr 2014 13:21:25 +0100
changeset 1371 3b0bcc658eef
parent 1367 b3bee8727631 (current diff)
parent 1370 d6cab997a43e (diff)
child 1373 7e193663b0d6
Merge with stable
--- a/tests/run-tests.py	Sat Apr 12 18:13:57 2014 +0100
+++ b/tests/run-tests.py	Mon Apr 14 13:21:25 2014 +0100
@@ -149,7 +149,7 @@
         help="print a test coverage report")
     parser.add_option("-d", "--debug", action="store_true",
         help="debug mode: write output of test scripts to console"
-             " rather than capturing and diff'ing it (disables timeout)")
+             " rather than capturing and diffing it (disables timeout)")
     parser.add_option("-f", "--first", action="store_true",
         help="exit on the first test failure")
     parser.add_option("-H", "--htmlcov", action="store_true",
@@ -304,8 +304,14 @@
 
 def showdiff(expected, output, ref, err):
     print
+    servefail = False
     for line in difflib.unified_diff(expected, output, ref, err):
         sys.stdout.write(line)
+        if not servefail and line.startswith(
+                             '+  abort: child process failed to start'):
+            servefail = True
+    return {'servefail': servefail}
+
 
 verbose = False
 def vlog(*msg):
@@ -600,7 +606,7 @@
 
 def globmatch(el, l):
     # The only supported special characters are * and ? plus / which also
-    # matches \ on windows. Escaping of these caracters is supported.
+    # matches \ on windows. Escaping of these characters is supported.
     if el + '\n' == l:
         if os.altsep:
             # matching on "/" is not needed for this line
@@ -658,7 +664,7 @@
     after = {}
     pos = prepos = -1
 
-    # Expected shellscript output
+    # Expected shell script output
     expected = {}
 
     # We keep track of whether or not we're in a Python block so we
@@ -696,9 +702,12 @@
         if not l.endswith('\n'):
             l += '\n'
         if l.startswith('#if'):
+            lsplit = l.split()
+            if len(lsplit) < 2 or lsplit[0] != '#if':
+                after.setdefault(pos, []).append('  !!! invalid #if\n')
             if skipping is not None:
                 after.setdefault(pos, []).append('  !!! nested #if\n')
-            skipping = not hghave(l.split()[1:])
+            skipping = not hghave(lsplit[1:])
             after.setdefault(pos, []).append(l)
         elif l.startswith('#else'):
             if skipping is None:
@@ -1028,17 +1037,21 @@
     elif ret == 'timeout':
         result = fail("timed out", ret)
     elif out != refout:
+        info = {}
         if not options.nodiff:
             iolock.acquire()
             if options.view:
                 os.system("%s %s %s" % (options.view, ref, err))
             else:
-                showdiff(refout, out, ref, err)
+                info = showdiff(refout, out, ref, err)
             iolock.release()
+        msg = ""
+        if info.get('servefail'): msg += "serve failed and "
         if ret:
-            result = fail("output changed and " + describe(ret), ret)
+            msg += "output changed and " + describe(ret)
         else:
-            result = fail("output changed", ret)
+            msg += "output changed"
+        result = fail(msg, ret)
     elif ret:
         result = fail(describe(ret), ret)
     else: