changeset 22045:769198c6a62d

run-tests: add #require to abort full test This allows nuking a bunch of ugly hghave || exit 80 lines.
author Matt Mackall <mpm@selenic.com>
date Wed, 06 Aug 2014 10:34:54 -0500
parents a06172e85fd4
children 7a9cbb315d84
files tests/run-tests.py tests/test-run-tests.t
diffstat 2 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Tue Aug 05 21:17:11 2014 -0400
+++ b/tests/run-tests.py	Wed Aug 06 10:34:54 2014 -0500
@@ -810,7 +810,15 @@
         for n, l in enumerate(lines):
             if not l.endswith('\n'):
                 l += '\n'
-            if l.startswith('#if'):
+            if l.startswith('#require'):
+                lsplit = l.split()
+                if len(lsplit) < 2 or lsplit[0] != '#require':
+                    after.setdefault(pos, []).append('  !!! invalid #require\n')
+                if not self._hghave(lsplit[1:]):
+                    script = ["exit 80\n"]
+                    break
+                after.setdefault(pos, []).append(l)
+            elif l.startswith('#if'):
                 lsplit = l.split()
                 if len(lsplit) < 2 or lsplit[0] != '#if':
                     after.setdefault(pos, []).append('  !!! invalid #if\n')
--- a/tests/test-run-tests.t	Tue Aug 05 21:17:11 2014 -0400
+++ b/tests/test-run-tests.t	Wed Aug 06 10:34:54 2014 -0500
@@ -309,7 +309,7 @@
 ================
   $ cat > test-skip.t <<EOF
   >   $ echo xyzzy
-  >   $ exit 80
+  > #require false
   > EOF
   $ $TESTDIR/run-tests.py --with-hg=`which hg` --nodiff
   !.s