[libcxx-commits] [libcxx] 5e3f43e - [libcxx] [test] Quote the python executable in the executor (#68208)

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Oct 9 13:19:11 PDT 2023


Author: Martin Storsjö
Date: 2023-10-09T23:19:06+03:00
New Revision: 5e3f43e16ce741a48dee21ddc042c3811a7320ce

URL: https://github.com/llvm/llvm-project/commit/5e3f43e16ce741a48dee21ddc042c3811a7320ce
DIFF: https://github.com/llvm/llvm-project/commit/5e3f43e16ce741a48dee21ddc042c3811a7320ce.diff

LOG: [libcxx] [test] Quote the python executable in the executor (#68208)

This reapplies the change from
c218c80c730a14a1cbcebd588b18220a879702c6, which was lost in the
refactoring in 78d649a417b48cb8a2ba2e755f0e7c8fb8b1bb83.

On Windows, the Python interpreter is by default installed in a path
like "C:\Program Files\Python38\python.exe", which requires quoting when
included in a concatenated command string (as opposed to a command list,
where each argument is a separate element).

This doesn't show up in the CI environments as they use Python installed
in a different directory, like C:\Python.

In addition to the python executable, also quote the path to run.py, if
needed.

Added: 
    

Modified: 
    libcxx/utils/libcxx/test/params.py

Removed: 
    


################################################################################
diff  --git a/libcxx/utils/libcxx/test/params.py b/libcxx/utils/libcxx/test/params.py
index d4e4b722347d623..456794b9b1cce95 100644
--- a/libcxx/utils/libcxx/test/params.py
+++ b/libcxx/utils/libcxx/test/params.py
@@ -7,6 +7,7 @@
 # ===----------------------------------------------------------------------===##
 import sys
 import re
+import shlex
 from pathlib import Path
 
 from libcxx.test.dsl import *
@@ -320,7 +321,7 @@ def getStdFlag(cfg, std):
     Parameter(
         name="executor",
         type=str,
-        default=f"{sys.executable} {Path(__file__).resolve().parent.parent.parent / 'run.py'}",
+        default=f"{shlex.quote(sys.executable)} {shlex.quote(str(Path(__file__).resolve().parent.parent.parent / 'run.py'))}",
         help="Custom executor to use instead of the configured default.",
         actions=lambda executor: [AddSubstitution("%{executor}", executor)],
     )


        


More information about the libcxx-commits mailing list