Patchwork [5,of,5] run-tests: make --restart work with output dir

login
register
mail settings
Submitter Siddharth Agarwal
Date June 8, 2017, 4:26 a.m.
Message ID <7157ecbb2426689cd8f1.1496895998@devvm31800.prn1.facebook.com>
Download mbox | patch
Permalink /patch/21240/
State Accepted
Headers show

Comments

Siddharth Agarwal - June 8, 2017, 4:26 a.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1496895444 25200
#      Wed Jun 07 21:17:24 2017 -0700
# Node ID 7157ecbb2426689cd8f1133bf7dde2822d68b6a8
# Parent  1403ca58e0bbd50a9a9287915073516db610b3c2
run-tests: make --restart work with output dir
Pierre-Yves David - June 8, 2017, 1:25 p.m.
On 06/08/2017 05:26 AM, Siddharth Agarwal wrote:
> # HG changeset patch
> # User Siddharth Agarwal <sid0@fb.com>
> # Date 1496895444 25200
> #      Wed Jun 07 21:17:24 2017 -0700
> # Node ID 7157ecbb2426689cd8f1133bf7dde2822d68b6a8
> # Parent  1403ca58e0bbd50a9a9287915073516db610b3c2
> run-tests: make --restart work with output dir

Series looks overall good to me, patch 3 forgot a glob, patch 5 as a 
small unrelated doc changes (and fixing patch 3 mistake)

> diff --git a/tests/run-tests.py b/tests/run-tests.py
> --- a/tests/run-tests.py
> +++ b/tests/run-tests.py
> @@ -2399,10 +2399,12 @@ class TestRunner(object):
>                  orig = list(testdescs)
>                  while testdescs:
>                      desc = testdescs[0]
> +                    # desc['path'] is a relative path

That seems like an unrelated (but welcome documentation update.

>                      if 'case' in desc:
>                          errpath = b'%s.%s.err' % (desc['path'], desc['case'])
>                      else:
>                          errpath = b'%s.err' % desc['path']
> +                    errpath = os.path.join(self._outputdir, errpath)
>                      if os.path.exists(errpath):
>                          break
>                      testdescs.pop(0)
> 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
> @@ -858,7 +858,7 @@ test for --json
>    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: 1138307315
> +  python hash seed: * (glob)

That change is harmless, It revert a lack of glob in patch 3.

Cheers
Yuya Nishihara - June 8, 2017, 2:49 p.m.
On Thu, 8 Jun 2017 14:25:58 +0100, Pierre-Yves David wrote:
> On 06/08/2017 05:26 AM, Siddharth Agarwal wrote:
> > # HG changeset patch
> > # User Siddharth Agarwal <sid0@fb.com>
> > # Date 1496895444 25200
> > #      Wed Jun 07 21:17:24 2017 -0700
> > # Node ID 7157ecbb2426689cd8f1133bf7dde2822d68b6a8
> > # Parent  1403ca58e0bbd50a9a9287915073516db610b3c2
> > run-tests: make --restart work with output dir
> 
> Series looks overall good to me, patch 3 forgot a glob, patch 5 as a 
> small unrelated doc changes (and fixing patch 3 mistake)

Queued these, thanks.

> > --- a/tests/test-run-tests.t
> > +++ b/tests/test-run-tests.t
> > @@ -858,7 +858,7 @@ test for --json
> >    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: 1138307315
> > +  python hash seed: * (glob)
> 
> That change is harmless, It revert a lack of glob in patch 3.

Moved this to patch 3. Thanks for spotting it.

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -2399,10 +2399,12 @@  class TestRunner(object):
                 orig = list(testdescs)
                 while testdescs:
                     desc = testdescs[0]
+                    # desc['path'] is a relative path
                     if 'case' in desc:
                         errpath = b'%s.%s.err' % (desc['path'], desc['case'])
                     else:
                         errpath = b'%s.err' % desc['path']
+                    errpath = os.path.join(self._outputdir, errpath)
                     if os.path.exists(errpath):
                         break
                     testdescs.pop(0)
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
@@ -858,7 +858,7 @@  test for --json
   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: 1138307315
+  python hash seed: * (glob)
   [1]
   $ f report.json
   report.json: file not found
@@ -1183,3 +1183,28 @@  Test cases in .t files
   # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
   python hash seed: * (glob)
   [1]
+
+--restart works with outputdir
+
+  $ mkdir output
+  $ mv test-cases-abc.t.B.err output
+  $ rt --restart --outputdir output
+  
+  --- $TESTTMP/anothertests/cases/test-cases-abc.t
+  +++ $TESTTMP/anothertests/cases/output/test-cases-abc.t.B.err
+  @@ -7,7 +7,7 @@
+     $ V=C
+   #endif
+     $ echo $V | sed 's/A/C/'
+  -  C
+  +  B
+   #if C
+     $ [ $V = C ]
+   #endif
+  
+  ERROR: test-cases-abc.t (case B) output changed
+  !.
+  Failed test-cases-abc.t (case B): output changed
+  # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
+  python hash seed: * (glob)
+  [1]