Patchwork [2,of,2] run-tests: don't mask errors when a server fails to start

login
register
mail settings
Submitter Matt Harbison
Date Feb. 26, 2018, 3:04 a.m.
Message ID <999316b407a5035d50aa.1519614284@Envy>
Download mbox | patch
Permalink /patch/28356/
State Accepted
Headers show

Comments

Matt Harbison - Feb. 26, 2018, 3:04 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1519610652 18000
#      Sun Feb 25 21:04:12 2018 -0500
# Node ID 999316b407a5035d50aa511199895c83d4047423
# Parent  e373776c800cffaf47934cf688307f5ce8e85d17
run-tests: don't mask errors when a server fails to start

There are sporadic instances of this on Windows.  They seem to happen more
frequently after the test machine is rebooted, although the only way to hit it
on my laptop is to loop certain tests with -j9 for hours.  The problem with
masking out the specific failure is that there's no way to know if it's the same
line in the test that's failing, or if it is random.

The justification for adding this masking in 52e9e63f1495 was that the failures
occur regularly, but that's not the case anymore.  The port number is still
printed, in case that turns out to be useful.
Yuya Nishihara - Feb. 26, 2018, 1:32 p.m.
On Sun, 25 Feb 2018 22:04:44 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1519610652 18000
> #      Sun Feb 25 21:04:12 2018 -0500
> # Node ID 999316b407a5035d50aa511199895c83d4047423
> # Parent  e373776c800cffaf47934cf688307f5ce8e85d17
> run-tests: don't mask errors when a server fails to start

Queued this, thanks.

Patch

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