Patchwork run-tests: resume raising an exception when a server fails to start

login
register
mail settings
Submitter Matt Harbison
Date Feb. 27, 2018, 5:03 a.m.
Message ID <329a10c33dc1234d8e33.1519707799@Envy>
Download mbox | patch
Permalink /patch/28468/
State Accepted
Headers show

Comments

Matt Harbison - Feb. 27, 2018, 5:03 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1519706069 18000
#      Mon Feb 26 23:34:29 2018 -0500
# Node ID 329a10c33dc1234d8e33b1b06c6c072bf6fe8cce
# Parent  e8d37838f5df94798c035191db172456114029e4
run-tests: resume raising an exception when a server fails to start

Prior to 93228b2a1fc0, this exception was raised before the diff could be
printed.  By raising the exception after printing the diff, the location of the
failure can be identified, but it is also easier to locate test runs where this
occurs.  The test bot maintains a list of failed tests, separate from the wall
of diff output.
Yuya Nishihara - Feb. 28, 2018, 12:47 a.m.
On Tue, 27 Feb 2018 00:03:19 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1519706069 18000
> #      Mon Feb 26 23:34:29 2018 -0500
> # Node ID 329a10c33dc1234d8e33b1b06c6c072bf6fe8cce
> # Parent  e8d37838f5df94798c035191db172456114029e4
> run-tests: resume raising an exception when a server fails to start

Queued, thanks.

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1762,10 +1762,6 @@ 
             else:
                 servefail, lines = getdiff(expected, got,
                                            test.refpath, test.errpath)
-                if servefail:
-                    self.stream.write(
-                        'server failed to start (HGPORT=%s)' % test._startport)
-
                 self.stream.write('\n')
                 for line in lines:
                     line = highlightdiff(line, self.color)
@@ -1777,6 +1773,10 @@ 
                         self.stream.write(line)
                         self.stream.flush()
 
+                if servefail:
+                    raise test.failureException(
+                        'server failed to start (HGPORT=%s)' % test._startport)
+
             # handle interactive prompt without releasing iolock
             if self._options.interactive:
                 if test.readrefout() != expected:
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
@@ -541,7 +541,7 @@ 
   >   $ echo 'abort: child process failed to start blah'
   > EOF
   $ rt test-serve-fail.t
-  server failed to start (HGPORT=*) (glob)
+  
   --- $TESTTMP/test-serve-fail.t
   +++ $TESTTMP/test-serve-fail.t.err
   @@ -1* +1,2 @@ (glob)
@@ -550,7 +550,7 @@ 
   
   ERROR: test-serve-fail.t output changed
   !
-  Failed test-serve-fail.t: output changed
+  Failed test-serve-fail.t: server failed to start (HGPORT=*) (glob)
   # Ran 1 tests, 0 skipped, 1 failed.
   python hash seed: * (glob)
   [1]