-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[lldb] make lit use the same Python executable for building and testing #143756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lldb] make lit use the same Python executable for building and testing #143756
Conversation
@llvm/pr-subscribers-lldb Author: Charles Zablit (charles-zablit) ChangesWhen testing LLDB, we want to make sure to use the same Python as the one we used to build it. This patch uses the CMake variable Please see swiftlang/swift#82063 for the original issue. This is a continuation of swiftlang/swift#82063. Full diff: https://github.com/llvm/llvm-project/pull/143756.diff 2 Files Affected:
diff --git a/lldb/test/Shell/lit.cfg.py b/lldb/test/Shell/lit.cfg.py
index ab6113767187a..a48d43251c988 100644
--- a/lldb/test/Shell/lit.cfg.py
+++ b/lldb/test/Shell/lit.cfg.py
@@ -203,3 +203,6 @@ def calculate_arch_features(arch_string):
# location of the Python libraries. This ensures that we use the same
# version of Python that was used to build lldb to run our tests.
config.environment["PYTHONHOME"] = config.python_root_dir
+config.environment["PATH"] = os.path.pathsep.join(
+ config.python_root_dir, config.environment.get("PATH", "")
+)
diff --git a/lldb/test/Unit/lit.cfg.py b/lldb/test/Unit/lit.cfg.py
index 681e3b19dce34..38ab821e5ee16 100644
--- a/lldb/test/Unit/lit.cfg.py
+++ b/lldb/test/Unit/lit.cfg.py
@@ -34,6 +34,9 @@
)
llvm_config.with_environment("PATH", os.path.dirname(sys.executable), append_path=True)
config.environment["PYTHONHOME"] = config.python_root_dir
+config.environment["PATH"] = os.path.pathsep.join(
+ config.python_root_dir, config.environment.get("PATH", "")
+)
# Enable sanitizer runtime flags.
if config.llvm_use_sanitizer:
|
Makes sense for the shell test (we could also make it an alias and resolve the path ourselves, that would be a bit more reliable) but why is this necessary for the unit tests? |
+1 for %python |
On Windows,
It is not, after testing it does not impact the tests. However, python39.dll being in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for explaining. LGTM.
…ng (llvm#143756) When testing LLDB, we want to make sure to use the same Python as the one we used to build it. This patch uses the CMake variable `Python3_ROOT_DIR` to add the correct Python to the `PATH` in LLDB lit tests, in order to ensure of this. Please see swiftlang/swift#82063 for the original issue. This is a continuation of swiftlang/swift#82063.
…ng (llvm#143756) When testing LLDB, we want to make sure to use the same Python as the one we used to build it. This patch uses the CMake variable `Python3_ROOT_DIR` to add the correct Python to the `PATH` in LLDB lit tests, in order to ensure of this. Please see swiftlang/swift#82063 for the original issue. This is a continuation of swiftlang/swift#82063.
When testing LLDB, we want to make sure to use the same Python as the one we used to build it.
This patch uses the CMake variable
Python3_ROOT_DIR
to add the correct Python to thePATH
in LLDB lit tests, in order to ensure of this.Please see swiftlang/swift#82063 for the original issue.
This is a continuation of swiftlang/swift#82063.