From 0b821764d816843b4dd5f9c95f86d7d892abeaec Mon Sep 17 00:00:00 2001 From: Ryan Saunders Date: Sun, 14 Aug 2022 15:26:17 -0700 Subject: Remove unnecessary escaping from runtest.py --- runtest.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/runtest.py b/runtest.py index c05e1c1..212d0a8 100755 --- a/runtest.py +++ b/runtest.py @@ -22,7 +22,6 @@ performs test discovery and processes tests according to options. import argparse import glob import os -import re import stat import subprocess import sys @@ -311,15 +310,6 @@ if sys.platform == 'win32': return buf.value -_ws = re.compile(r'\s') - -def escape(s): - if _ws.search(s): - s = '"' + s + '"' - s = s.replace('\\', '\\\\') - return s - - if not catch_output: # Without any output suppressed, we let the subprocess # write its stuff freely to stdout/stderr. @@ -784,7 +774,7 @@ def run_test(t, io_lock=None, run_async=True): if args.runner and t.path in unittests: # For example --runner TestUnit.TAPTestRunner command_args.append('--runner ' + args.runner) - t.command_args = [escape(args.python)] + command_args + t.command_args = [args.python] + command_args t.command_str = " ".join(t.command_args) if args.printcommand: if args.print_progress: -- cgit v0.12 From 91fe386aca3460f60f17b9d17f78d09fbd66d2cc Mon Sep 17 00:00:00 2001 From: Ryan Saunders Date: Sun, 14 Aug 2022 15:44:03 -0700 Subject: Update CHANGES.txt --- CHANGES.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index ee49590..cd4d335 100755 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -15,6 +15,8 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER From Flaviu Tamas - Added -fsanitize support to ParseFlags(). This will propagate to CCFLAGS and LINKFLAGS. + From Ryan Saunders + - Fixed runtest.py failure on Windows caused by excessive escaping of the path to python.exe. RELEASE 4.4.0 - Sat, 30 Jul 2022 14:08:29 -0700 -- cgit v0.12 From 3c2458a8be8a2e466620635cf3b3dee022ebe81d Mon Sep 17 00:00:00 2001 From: Ryan Saunders Date: Sun, 14 Aug 2022 23:03:30 -0700 Subject: Fix handling of posix paths containing backslash, and update tests --- runtest.py | 7 +++---- test/runtest/python.py | 10 +--------- testing/framework/TestRuntest.py | 6 +----- 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/runtest.py b/runtest.py index 212d0a8..a2ece7e 100755 --- a/runtest.py +++ b/runtest.py @@ -422,8 +422,7 @@ class PopenExecutor(RuntestBase): A bit of a misnomer as the Popen call is now wrapped by calling subprocess.run (behind the covers uses Popen. - Very similar to SystemExecutor, but uses command_str - instead of command_args, and doesn't allow for not catching + Very similar to SystemExecutor, but doesn't allow for not catching the output). """ # For an explanation of the following 'if ... else' @@ -437,7 +436,7 @@ class PopenExecutor(RuntestBase): tmp_stderr = tempfile.TemporaryFile(mode='w+t') # Start subprocess... cp = subprocess.run( - self.command_str.split(), + self.command_args, stdout=tmp_stdout, stderr=tmp_stderr, shell=False, @@ -460,7 +459,7 @@ class PopenExecutor(RuntestBase): def execute(self, env): cp = subprocess.run( - self.command_str.split(), + self.command_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False, diff --git a/test/runtest/python.py b/test/runtest/python.py index 499ab77..abd4f0c 100644 --- a/test/runtest/python.py +++ b/test/runtest/python.py @@ -50,20 +50,12 @@ pythonflags = TestRuntest.pythonflags # getting called with "/bin/../bin/python" as first argument, e.g. Fedora 17 Desktop. mypython = os.path.normpath(os.path.join(head, dir, os.path.pardir, dir, python)) -def escape(s): - return s.replace('\\', '\\\\') - -if re.search(r'\s', mypython): - mypythonstring = '"%s"' % escape(mypython) -else: - mypythonstring = escape(mypython) - test.subdir('test') test.write_passing_test(['test', 'pass.py']) expect_stdout = """\ -%(mypythonstring)s%(pythonflags)s %(test_pass_py)s +%(mypython)s%(pythonflags)s %(test_pass_py)s PASSING TEST STDOUT """ % locals() diff --git a/testing/framework/TestRuntest.py b/testing/framework/TestRuntest.py index 9368953..378f441 100644 --- a/testing/framework/TestRuntest.py +++ b/testing/framework/TestRuntest.py @@ -51,11 +51,7 @@ __all__.extend( ] ) -if re.search(r'\s', python): - pythonstring = _python_ -else: - pythonstring = python -pythonstring = pythonstring.replace('\\', '\\\\') +pythonstring = python pythonflags = '' failing_test_template = """\ -- cgit v0.12