Patchwork D1883: tests: get run-tests to reliably hand shellquote a string and not a bytes

login
register
mail settings
Submitter phabricator
Date Feb. 1, 2018, 8:33 p.m.
Message ID <86d4501e1978a0497e81d2b59bf7c89d@localhost.localdomain>
Download mbox | patch
Permalink /patch/27124/
State Not Applicable
Headers show

Comments

phabricator - Feb. 1, 2018, 8:33 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG435547be7257: tests: get run-tests to reliably hand shellquote a string and not a bytes (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1883?vs=5039&id=5052

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

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS




To: durin42, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1341,7 +1341,11 @@ 
         if os.getenv('MSYSTEM'):
             script.append(b'alias pwd="pwd -W"\n')
         if self._case:
-            script.append(b'TESTCASE=%s\n' % shellquote(self._case))
+            if isinstance(self._case, str):
+                quoted = shellquote(self._case)
+            else:
+                quoted = shellquote(self._case.decode('utf8')).encode('utf8')
+            script.append(b'TESTCASE=%s\n' % quoted)
             script.append(b'export TESTCASE\n')
 
         n = 0