Patchwork [v2] run-tests: report missing feature for skipped tests

login
register
mail settings
Submitter timeless@mozdev.org
Date Dec. 28, 2015, 6:48 p.m.
Message ID <f42601ab0f0775ab9ba1.1451328523@waste.org>
Download mbox | patch
Permalink /patch/12370/
State Accepted
Headers show

Comments

timeless@mozdev.org - Dec. 28, 2015, 6:48 p.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1450771203 0
#      Tue Dec 22 08:00:03 2015 +0000
# Node ID f42601ab0f0775ab9ba1c6c214ad586de60d806a
# Parent  23541bdd1610c08af247f9c8719045cf247ce541
run-tests: report missing feature for skipped tests
Augie Fackler - Dec. 29, 2015, 11:13 p.m.
On Mon, Dec 28, 2015 at 12:48:43PM -0600, timeless wrote:
> # HG changeset patch
> # User timeless <timeless@mozdev.org>
> # Date 1450771203 0
> #      Tue Dec 22 08:00:03 2015 +0000
> # Node ID f42601ab0f0775ab9ba1c6c214ad586de60d806a
> # Parent  23541bdd1610c08af247f9c8719045cf247ce541
> run-tests: report missing feature for skipped tests

Queued, thanks!

>
> diff --git a/tests/run-tests.py b/tests/run-tests.py
> --- a/tests/run-tests.py
> +++ b/tests/run-tests.py
> @@ -940,11 +940,11 @@
>              sys.exit(1)
>
>          if ret != 0:
> -            return False
> +            return False, stdout
>
>          if 'slow' in reqs:
>              self._timeout = self._slowtimeout
> -        return True
> +        return True, None
>
>      def _parsetest(self, lines):
>          # We generate a shell script which outputs unique markers to line
> @@ -989,8 +989,9 @@
>                  lsplit = l.split()
>                  if len(lsplit) < 2 or lsplit[0] != b'#require':
>                      after.setdefault(pos, []).append('  !!! invalid #require\n')
> -                if not self._hghave(lsplit[1:]):
> -                    script = [b"exit 80\n"]
> +                haveresult, message = self._hghave(lsplit[1:])
> +                if not haveresult:
> +                    script = [b'echo "%s"\nexit 80\n' % message]
>                      break
>                  after.setdefault(pos, []).append(l)
>              elif l.startswith(b'#if'):
> @@ -999,7 +1000,7 @@
>                      after.setdefault(pos, []).append('  !!! invalid #if\n')
>                  if skipping is not None:
>                      after.setdefault(pos, []).append('  !!! nested #if\n')
> -                skipping = not self._hghave(lsplit[1:])
> +                skipping = not self._hghave(lsplit[1:])[0]
>                  after.setdefault(pos, []).append(l)
>              elif l.startswith(b'#else'):
>                  if skipping is None:
> diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t
> --- a/tests/test-run-tests.t
> +++ b/tests/test-run-tests.t
> @@ -418,7 +418,7 @@
>    > cat test-timeout.t >> test-slow-timeout.t
>    $ rt --timeout=1 --slowtimeout=3 test-timeout.t test-slow-timeout.t
>    st
> -  Skipped test-slow-timeout.t: skipped
> +  Skipped test-slow-timeout.t: missing feature: allow slow tests
>    Failed test-timeout.t: timed out
>    # Ran 1 tests, 1 skipped, 0 warned, 1 failed.
>    python hash seed: * (glob)
> @@ -460,7 +460,7 @@
>    > EOF
>    $ rt --nodiff
>    !.s
> -  Skipped test-skip.t: skipped
> +  Skipped test-skip.t: missing feature: nail clipper
>    Failed test-failure.t: output changed
>    # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
>    python hash seed: * (glob)
> @@ -468,14 +468,14 @@
>
>    $ rt --keyword xyzzy
>    .s
> -  Skipped test-skip.t: skipped
> +  Skipped test-skip.t: missing feature: nail clipper
>    # Ran 2 tests, 2 skipped, 0 warned, 0 failed.
>
>  Skips with xml
>    $ rt --keyword xyzzy \
>    >  --xunit=xunit.xml
>    .s
> -  Skipped test-skip.t: skipped
> +  Skipped test-skip.t: missing feature: nail clipper
>    # Ran 2 tests, 2 skipped, 0 warned, 0 failed.
>    $ cat xunit.xml
>    <?xml version="1.0" encoding="utf-8"?>
> @@ -510,7 +510,7 @@
>
>    ERROR: test-failure.t output changed
>    !.s
> -  Skipped test-skip.t: skipped
> +  Skipped test-skip.t: missing feature: nail clipper
>    Failed test-failure.t: output changed
>    # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
>    python hash seed: * (glob)
> @@ -558,7 +558,7 @@
>     This is a noop statement so that
>     this test is still more bytes than success.
>    Accept this change? [n] ..s
> -  Skipped test-skip.t: skipped
> +  Skipped test-skip.t: missing feature: nail clipper
>    # Ran 2 tests, 1 skipped, 0 warned, 0 failed.
>
>    $ cat report.json
> @@ -673,7 +673,7 @@
>    > EOF
>    $ rt $HGTEST_RUN_TESTS_PURE test-very-slow-test.t
>    s
> -  Skipped test-very-slow-test.t: skipped
> +  Skipped test-very-slow-test.t: missing feature: allow slow tests
>    # Ran 0 tests, 1 skipped, 0 warned, 0 failed.
>    $ rt $HGTEST_RUN_TESTS_PURE --allow-slow-tests test-very-slow-test.t
>    .
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -940,11 +940,11 @@ 
             sys.exit(1)
 
         if ret != 0:
-            return False
+            return False, stdout
 
         if 'slow' in reqs:
             self._timeout = self._slowtimeout
-        return True
+        return True, None
 
     def _parsetest(self, lines):
         # We generate a shell script which outputs unique markers to line
@@ -989,8 +989,9 @@ 
                 lsplit = l.split()
                 if len(lsplit) < 2 or lsplit[0] != b'#require':
                     after.setdefault(pos, []).append('  !!! invalid #require\n')
-                if not self._hghave(lsplit[1:]):
-                    script = [b"exit 80\n"]
+                haveresult, message = self._hghave(lsplit[1:])
+                if not haveresult:
+                    script = [b'echo "%s"\nexit 80\n' % message]
                     break
                 after.setdefault(pos, []).append(l)
             elif l.startswith(b'#if'):
@@ -999,7 +1000,7 @@ 
                     after.setdefault(pos, []).append('  !!! invalid #if\n')
                 if skipping is not None:
                     after.setdefault(pos, []).append('  !!! nested #if\n')
-                skipping = not self._hghave(lsplit[1:])
+                skipping = not self._hghave(lsplit[1:])[0]
                 after.setdefault(pos, []).append(l)
             elif l.startswith(b'#else'):
                 if skipping is None:
diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t
--- a/tests/test-run-tests.t
+++ b/tests/test-run-tests.t
@@ -418,7 +418,7 @@ 
   > cat test-timeout.t >> test-slow-timeout.t
   $ rt --timeout=1 --slowtimeout=3 test-timeout.t test-slow-timeout.t
   st
-  Skipped test-slow-timeout.t: skipped
+  Skipped test-slow-timeout.t: missing feature: allow slow tests
   Failed test-timeout.t: timed out
   # Ran 1 tests, 1 skipped, 0 warned, 1 failed.
   python hash seed: * (glob)
@@ -460,7 +460,7 @@ 
   > EOF
   $ rt --nodiff
   !.s
-  Skipped test-skip.t: skipped
+  Skipped test-skip.t: missing feature: nail clipper
   Failed test-failure.t: output changed
   # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
   python hash seed: * (glob)
@@ -468,14 +468,14 @@ 
 
   $ rt --keyword xyzzy
   .s
-  Skipped test-skip.t: skipped
+  Skipped test-skip.t: missing feature: nail clipper
   # Ran 2 tests, 2 skipped, 0 warned, 0 failed.
 
 Skips with xml
   $ rt --keyword xyzzy \
   >  --xunit=xunit.xml
   .s
-  Skipped test-skip.t: skipped
+  Skipped test-skip.t: missing feature: nail clipper
   # Ran 2 tests, 2 skipped, 0 warned, 0 failed.
   $ cat xunit.xml
   <?xml version="1.0" encoding="utf-8"?>
@@ -510,7 +510,7 @@ 
   
   ERROR: test-failure.t output changed
   !.s
-  Skipped test-skip.t: skipped
+  Skipped test-skip.t: missing feature: nail clipper
   Failed test-failure.t: output changed
   # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
   python hash seed: * (glob)
@@ -558,7 +558,7 @@ 
    This is a noop statement so that
    this test is still more bytes than success.
   Accept this change? [n] ..s
-  Skipped test-skip.t: skipped
+  Skipped test-skip.t: missing feature: nail clipper
   # Ran 2 tests, 1 skipped, 0 warned, 0 failed.
 
   $ cat report.json
@@ -673,7 +673,7 @@ 
   > EOF
   $ rt $HGTEST_RUN_TESTS_PURE test-very-slow-test.t
   s
-  Skipped test-very-slow-test.t: skipped
+  Skipped test-very-slow-test.t: missing feature: allow slow tests
   # Ran 0 tests, 1 skipped, 0 warned, 0 failed.
   $ rt $HGTEST_RUN_TESTS_PURE --allow-slow-tests test-very-slow-test.t
   .