Patchwork D10693: run-tests: fix whitelist/blacklist with directories on Windows

login
register
mail settings
Submitter phabricator
Date May 7, 2021, 4:02 a.m.
Message ID <differential-rev-PHID-DREV-sfhiuiusuls2t67zgsny-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49013/
State New
Headers show

Comments

phabricator - May 7, 2021, 4:02 a.m.
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The file name is resolved with `os.path.relpath()` in the `Test` constructor,
  which yields `\` on Windows.  That doesn't match the `/` separator when using
  MSYS tools to build the list, and it isn't obvious that this is the problem
  because directory separators can mostly be used interchangeably.  The
  `--test-list` argument already seems to be properly handled.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D10693

AFFECTED FILES
  tests/run-tests.py
  tests/test-run-tests.t

CHANGE DETAILS




To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

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
@@ -1116,15 +1116,17 @@ 
   </testsuite>
 
 Missing skips or blacklisted skips don't count as executed:
-  $ echo test-failure.t > blacklist
+  $ mkdir tests
+  $ echo tests/test-failure.t > blacklist
+  $ cp test-failure.t tests
   $ rt --blacklist=blacklist --json\
-  >   test-failure.t test-bogus.t
+  >   tests/test-failure.t tests/test-bogus.t
   running 2 tests using 1 parallel processes 
   ss
   Skipped test-bogus.t: Doesn't exist
   Skipped test-failure.t: blacklisted
   # Ran 0 tests, 2 skipped, 0 failed.
-  $ cat report.json
+  $ cat tests/report.json
   testreport ={
       "test-bogus.t": {
           "result": "skip"
@@ -1133,6 +1135,8 @@ 
           "result": "skip"
       }
   } (no-eol)
+  $ rm -r tests
+  $ echo test-failure.t > blacklist
 
 Whitelist trumps blacklist
   $ echo test-failure.t > whitelist
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -361,7 +361,8 @@ 
         for line in f.readlines():
             line = line.split(b'#', 1)[0].strip()
             if line:
-                entries[line] = filename
+                # Ensure path entries are compatible with os.path.relpath()
+                entries[os.path.normpath(line)] = filename
 
         f.close()
     return entries