[PATCH 1 of 2 v2] run-tests: report path for tests outside current directory

timeless timeless at mozdev.org
Tue Mar 22 01:05:42 EDT 2016


# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1456431250 0
#      Thu Feb 25 20:14:10 2016 +0000
# Node ID 432352f451d0eb4ece052ffebdf3c18b02cc89ec
# Parent  78e4e558fa74aa4489609953328cbcecf1a8a428
run-tests: report path for tests outside current directory

Followup for 2836a43c7722

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -450,7 +450,11 @@
     # Status code reserved for skipped tests (used by hghave).
     SKIPPED_STATUS = 80
 
-    def __init__(self, path, tmpdir, keeptmpdir=False,
+    def __init__(self,
+                 path,
+                 relpath,
+                 tmpdir,
+                 keeptmpdir=False,
                  debug=False,
                  timeout=defaults['timeout'],
                  startport=defaults['port'], extraconfigopts=None,
@@ -487,6 +491,7 @@
         shell is the shell to execute tests in.
         """
         self.path = path
+        self.relpath = relpath
         self.bname = os.path.basename(path)
         self.name = _strpath(self.bname)
         self._testdir = os.path.dirname(path)
@@ -1713,13 +1718,13 @@
 
             if not self._runner.options.noskips:
                 for test, msg in result.skipped:
-                    self.stream.writeln('Skipped %s: %s' % (test.name, msg))
+                    self.stream.writeln('Skipped %s: %s' % (test.relpath, msg))
             for test, msg in result.warned:
-                self.stream.writeln('Warned %s: %s' % (test.name, msg))
+                self.stream.writeln('Warned %s: %s' % (test.relpath, msg))
             for test, msg in result.failures:
-                self.stream.writeln('Failed %s: %s' % (test.name, msg))
+                self.stream.writeln('Failed %s: %s' % (test.relpath, msg))
             for test, msg in result.errors:
-                self.stream.writeln('Errored %s: %s' % (test.name, msg))
+                self.stream.writeln('Errored %s: %s' % (test.relpath, msg))
 
             if self._runner.options.xunit:
                 with open(self._runner.options.xunit, 'wb') as xuf:
@@ -2159,7 +2164,9 @@
         refpath = os.path.join(self._testdir, test)
         tmpdir = os.path.join(self._hgtmp, b'child%d' % count)
 
-        t = testcls(refpath, tmpdir,
+        t = testcls(refpath,
+                    test,
+                    tmpdir,
                     keeptmpdir=self.options.keep_tmpdir,
                     debug=self.options.debug,
                     timeout=self.options.timeout,
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
@@ -103,8 +103,8 @@
   
   ERROR: test-failure-unicode.t output changed
   !
-  Failed test-failure.t: output changed
-  Failed test-failure-unicode.t: output changed
+  Failed $TESTTMP/test-failure.t: output changed
+  Failed $TESTTMP/test-failure-unicode.t: output changed
   # Ran 3 tests, 0 skipped, 0 warned, 2 failed.
   python hash seed: * (glob)
   [1]
@@ -133,8 +133,8 @@
   
   ERROR: test-failure-unicode.t output changed
   !
-  Failed test-failure.t: output changed
-  Failed test-failure-unicode.t: output changed
+  Failed $TESTTMP/test-failure.t: output changed
+  Failed $TESTTMP/test-failure-unicode.t: output changed
   # Ran 3 tests, 0 skipped, 0 warned, 2 failed.
   python hash seed: * (glob)
   [1]
@@ -182,7 +182,7 @@
   
   ERROR: test-failure.t output changed
   !
-  Failed test-failure.t: output changed
+  Failed $TESTTMP/test-failure.t: output changed
   # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
   python hash seed: * (glob)
   [1]
@@ -217,7 +217,7 @@
   
   ERROR: test-failure.t output changed
   !
-  Failed test-failure.t: output changed
+  Failed $TESTTMP/test-failure.t: output changed
   # Ran 1 tests, 0 skipped, 0 warned, 1 failed.
   python hash seed: * (glob)
   [1]
@@ -237,7 +237,7 @@
   
   ERROR: test-failure.t output changed
   !
-  Failed test-failure.t: output changed
+  Failed $TESTTMP/test-failure.t: output changed
   # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
   python hash seed: * (glob)
   [1]
@@ -252,7 +252,7 @@
   
   ERROR: test-serve-fail.t output changed
   !
-  Failed test-serve-fail.t: server failed to start (HGPORT=*) (glob)
+  Failed $TESTTMP/test-serve-fail.t: server failed to start (HGPORT=*) (glob)
   # Ran 1 tests, 0 skipped, 0 warned, 1 failed.
   python hash seed: * (glob)
   [1]
@@ -309,8 +309,8 @@
 
   $ rt --jobs 2 test-failure*.t -n
   !!
-  Failed test-failure*.t: output changed (glob)
-  Failed test-failure*.t: output changed (glob)
+  Failed $TESTTMP/test-failure*.t: output changed (glob)
+  Failed $TESTTMP/test-failure*.t: output changed (glob)
   # Ran 2 tests, 0 skipped, 0 warned, 2 failed.
   python hash seed: * (glob)
   [1]
@@ -331,8 +331,8 @@
    this test is still more bytes than success.
    pad pad pad pad............................................................
   
-  Failed test-failure*.t: output changed (glob)
-  Failed test-nothing.t: output changed
+  Failed $TESTTMP/test-failure*.t: output changed (glob)
+  Failed $TESTTMP/test-nothing.t: output changed
   # Ran 2 tests, 0 skipped, 0 warned, 2 failed.
   python hash seed: * (glob)
   [1]
@@ -364,7 +364,7 @@
   Accept this change? [n] 
   ERROR: test-failure.t output changed
   !.
-  Failed test-failure.t: output changed
+  Failed $TESTTMP/test-failure.t: output changed
   # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
   python hash seed: * (glob)
   [1]
@@ -384,7 +384,7 @@
   Accept this change? [n]* (glob)
   ERROR: test-failure.t output changed
   !.
-  Failed test-failure.t: output changed
+  Failed $TESTTMP/test-failure.t: output changed
   # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
   python hash seed: * (glob)
   [1]
@@ -396,7 +396,7 @@
   
   ERROR: test-failure.t output changed
   !.
-  Failed test-failure.t: output changed
+  Failed $TESTTMP/test-failure.t: output changed
   # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
   python hash seed: * (glob)
   [1]
@@ -452,7 +452,7 @@
 
   $ rt --nodiff
   !.
-  Failed test-failure.t: output changed
+  Failed $TESTTMP/test-failure.t: output changed
   # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
   python hash seed: * (glob)
   [1]
@@ -476,15 +476,15 @@
   > 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: missing feature: allow slow tests
-  Failed test-timeout.t: timed out
+  Skipped $TESTTMP/test-slow-timeout.t: missing feature: allow slow tests
+  Failed $TESTTMP/test-timeout.t: timed out
   # Ran 1 tests, 1 skipped, 0 warned, 1 failed.
   python hash seed: * (glob)
   [1]
   $ rt --timeout=1 --slowtimeout=3 \
   > test-timeout.t test-slow-timeout.t --allow-slow-tests
   .t
-  Failed test-timeout.t: timed out
+  Failed $TESTTMP/test-timeout.t: timed out
   # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
   python hash seed: * (glob)
   [1]
@@ -518,22 +518,22 @@
   > EOF
   $ rt --nodiff
   !.s
-  Skipped test-skip.t: missing feature: nail clipper
-  Failed test-failure.t: output changed
+  Skipped $TESTTMP/test-skip.t: missing feature: nail clipper
+  Failed $TESTTMP/test-failure.t: output changed
   # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
   python hash seed: * (glob)
   [1]
 
   $ rt --keyword xyzzy
   .s
-  Skipped test-skip.t: missing feature: nail clipper
+  Skipped $TESTTMP/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: missing feature: nail clipper
+  Skipped $TESTTMP/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"?>
@@ -575,8 +575,8 @@
   
   ERROR: test-failure.t output changed
   !.s
-  Skipped test-skip.t: missing feature: nail clipper
-  Failed test-failure.t: output changed
+  Skipped $TESTTMP/test-skip.t: missing feature: nail clipper
+  Failed $TESTTMP/test-failure.t: output changed
   # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
   python hash seed: * (glob)
   [1]
@@ -627,7 +627,7 @@
    this test is still more bytes than success.
    pad pad pad pad............................................................
   Accept this change? [n] ..s
-  Skipped test-skip.t: missing feature: nail clipper
+  Skipped $TESTTMP/test-skip.t: missing feature: nail clipper
   # Ran 2 tests, 1 skipped, 0 warned, 0 failed.
 
   $ cat report.json
@@ -743,7 +743,7 @@
   > EOF
   $ rt $HGTEST_RUN_TESTS_PURE test-very-slow-test.t
   s
-  Skipped test-very-slow-test.t: missing feature: allow slow tests
+  Skipped $TESTTMP/anothertests/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
   .


More information about the Mercurial-devel mailing list