Patchwork run-tests: more accurate/helpful message than "diff generation failed"

login
register
mail settings
Submitter Kyle Lippincott
Date Oct. 10, 2014, 12:22 a.m.
Message ID <b5ceffcc0e92bc9cd22c.1412900575@dragonair.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/6172/
State Accepted
Headers show

Comments

Kyle Lippincott - Oct. 10, 2014, 12:22 a.m.
# HG changeset patch
# User Kyle Lippincott <spectral@google.com>
# Date 1412899229 25200
#      Thu Oct 09 17:00:29 2014 -0700
# Node ID b5ceffcc0e92bc9cd22ce2c67148bd8e1118d53e
# Parent  6e9e1deb1152d7282c08ba3675d2414feb234bf0
run-tests: more accurate/helpful message than "diff generation failed"

Diff generation didn't really fail, it recognized that an hg serve server has
failed to start, and thus skipped the diff generation intentionally.

The most common reason for a server to fail to start is that the port was
already in use, so output HGPORT as well, to help finding it (since pgrep -f
'hg serve' is not sufficient, if the command line is something like 'hg -R main
serve')
Augie Fackler - Oct. 10, 2014, 1:30 p.m.
On Thu, Oct 09, 2014 at 05:22:55PM -0700, Kyle Lippincott wrote:
> # HG changeset patch
> # User Kyle Lippincott <spectral@google.com>
> # Date 1412899229 25200
> #      Thu Oct 09 17:00:29 2014 -0700
> # Node ID b5ceffcc0e92bc9cd22ce2c67148bd8e1118d53e
> # Parent  6e9e1deb1152d7282c08ba3675d2414feb234bf0
> run-tests: more accurate/helpful message than "diff generation failed"

I've been meaning to investigate that. Queued, thanks.

>
> Diff generation didn't really fail, it recognized that an hg serve server has
> failed to start, and thus skipped the diff generation intentionally.
>
> The most common reason for a server to fail to start is that the port was
> already in use, so output HGPORT as well, to help finding it (since pgrep -f
> 'hg serve' is not sufficient, if the command line is something like 'hg -R main
> serve')
>
> diff -r 6e9e1deb1152 -r b5ceffcc0e92 tests/run-tests.py
> --- a/tests/run-tests.py	Mon Oct 06 14:52:19 2014 -0700
> +++ b/tests/run-tests.py	Thu Oct 09 17:00:29 2014 -0700
> @@ -1235,10 +1235,12 @@
>              os.system("%s %s %s" %
>                        (self._options.view, test.refpath, test.errpath))
>          else:
> -            failed, lines = getdiff(expected, got,
> -                                    test.refpath, test.errpath)
> -            if failed:
> -                self.addFailure(test, 'diff generation failed')
> +            servefail, lines = getdiff(expected, got,
> +                                       test.refpath, test.errpath)
> +            if servefail:
> +                self.addFailure(
> +                    test,
> +                    'server failed to start (HGPORT=%s)' % test._startport)
>              else:
>                  self.stream.write('\n')
>                  for line in lines:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff -r 6e9e1deb1152 -r b5ceffcc0e92 tests/run-tests.py
--- a/tests/run-tests.py	Mon Oct 06 14:52:19 2014 -0700
+++ b/tests/run-tests.py	Thu Oct 09 17:00:29 2014 -0700
@@ -1235,10 +1235,12 @@ 
             os.system("%s %s %s" %
                       (self._options.view, test.refpath, test.errpath))
         else:
-            failed, lines = getdiff(expected, got,
-                                    test.refpath, test.errpath)
-            if failed:
-                self.addFailure(test, 'diff generation failed')
+            servefail, lines = getdiff(expected, got,
+                                       test.refpath, test.errpath)
+            if servefail:
+                self.addFailure(
+                    test,
+                    'server failed to start (HGPORT=%s)' % test._startport)
             else:
                 self.stream.write('\n')
                 for line in lines: