Skip to content

Commit 8d66e0f

Browse files
Merge pull request #10811 from swiftlang/charles-zablit/lldb/use-common-pythonhome-to-6.2
🍒 [lldb] make lit use the same PYTHONHOME for building and testing (llvm#143183)
2 parents 5fbc818 + cbac5ec commit 8d66e0f

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

lldb/test/Shell/lit.cfg.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,3 +219,8 @@ def calculate_arch_features(arch_string):
219219
config.available_features.add("ld_new-bug")
220220
except:
221221
pass
222+
223+
# Some shell tests dynamically link with python.dll and need to know the
224+
# location of the Python libraries. This ensures that we use the same
225+
# version of Python that was used to build lldb to run our tests.
226+
config.environment["PYTHONHOME"] = config.python_root_dir

lldb/test/Shell/lit.site.cfg.py.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ config.python_executable = "@Python3_EXECUTABLE@"
1919
config.swiftc = "@LLDB_SWIFTC@"
2020
config.swift_libs_dir = '@LLDB_SWIFT_LIBS@'
2121
config.lldb_enable_swift = @LLDB_ENABLE_SWIFT_SUPPORT@
22+
config.python_root_dir = "@Python3_ROOT_DIR@"
2223
config.have_zlib = @LLVM_ENABLE_ZLIB@
2324
config.objc_gnustep_dir = "@LLDB_TEST_OBJC_GNUSTEP_DIR@"
2425
config.lldb_enable_lzma = @LLDB_ENABLE_LZMA@

lldb/test/Unit/lit.cfg.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
]
3434
)
3535
llvm_config.with_environment("PATH", os.path.dirname(sys.executable), append_path=True)
36+
config.environment["PYTHONHOME"] = config.python_root_dir
3637

3738
# Enable sanitizer runtime flags.
3839
config.environment["ASAN_OPTIONS"] = "detect_stack_use_after_return=1"

lldb/test/Unit/lit.site.cfg.py.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ config.lldb_obj_root = "@LLDB_BINARY_DIR@"
1010
config.lldb_src_root = "@LLDB_SOURCE_DIR@"
1111
config.target_triple = "@LLVM_TARGET_TRIPLE@"
1212
config.python_executable = "@Python3_EXECUTABLE@"
13+
config.python_root_dir = "@Python3_ROOT_DIR@"
1314

1415
import lit.llvm
1516
lit.llvm.initialize(lit_config, config)

0 commit comments

Comments
 (0)