Skip to content

Commit cbe6292

Browse files
committed
mk: Force system python for LLDB tests on OSX
Force usage of /usr/bin/python whenever we run LLDB tests on OSX because it looks like no other Python will work.
1 parent 9db6a41 commit cbe6292

File tree

6 files changed

+38
-8
lines changed

6 files changed

+38
-8
lines changed

configure

+13
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,19 @@ then
819819
fi
820820
fi
821821

822+
# LLDB tests on OSX require /usr/bin/python, not something like Homebrew's
823+
# /usr/local/bin/python. We're loading a compiled module for LLDB tests which is
824+
# only compatible with the system.
825+
case $CFG_BUILD in
826+
*-apple-darwin)
827+
CFG_LLDB_PYTHON=/usr/bin/python
828+
;;
829+
*)
830+
CFG_LLDB_PYTHON=$CFG_PYTHON
831+
;;
832+
esac
833+
putvar CFG_LLDB_PYTHON
834+
822835
step_msg "looking for target specific programs"
823836

824837
probe CFG_ADB adb

mk/tests.mk

+2-1
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,8 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
616616
--stage-id stage$(1)-$(2) \
617617
--target $(2) \
618618
--host $(3) \
619-
--python $$(CFG_PYTHON) \
619+
--docck-python $$(CFG_PYTHON) \
620+
--lldb-python $$(CFG_LLDB_PYTHON) \
620621
--gdb-version="$(CFG_GDB_VERSION)" \
621622
--lldb-version="$(CFG_LLDB_VERSION)" \
622623
--android-cross-path=$(CFG_ANDROID_CROSS_PATH) \

src/bootstrap/build/check.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,19 @@ pub fn compiletest(build: &Build,
8181

8282
// FIXME: needs android support
8383
cmd.arg("--android-cross-path").arg("");
84+
8485
// FIXME: CFG_PYTHON should probably be detected more robustly elsewhere
85-
cmd.arg("--python").arg("python");
86+
let python_default = "python";
87+
cmd.arg("--docck-python").arg(python_default);
88+
89+
if build.config.build.ends_with("apple-darwin") {
90+
// Force /usr/bin/python on OSX for LLDB tests because we're loading the
91+
// LLDB plugin's compiled module which only works with the system python
92+
// (namely not Homebrew-installed python)
93+
cmd.arg("--lldb-python").arg("/usr/bin/python");
94+
} else {
95+
cmd.arg("--lldb-python").arg(python_default);
96+
}
8697

8798
if let Some(ref vers) = build.gdb_version {
8899
cmd.arg("--gdb-version").arg(vers);

src/tools/compiletest/src/common.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,11 @@ pub struct Config {
8383
// The rustdoc executable
8484
pub rustdoc_path: PathBuf,
8585

86-
// The python executable
87-
pub python: String,
86+
// The python executable to use for LLDB
87+
pub lldb_python: String,
88+
89+
// The python executable to use for htmldocck
90+
pub docck_python: String,
8891

8992
// The llvm FileCheck binary path
9093
pub llvm_filecheck: Option<PathBuf>,

src/tools/compiletest/src/main.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ pub fn parse_config(args: Vec<String> ) -> Config {
7070
reqopt("", "run-lib-path", "path to target shared libraries", "PATH"),
7171
reqopt("", "rustc-path", "path to rustc to use for compiling", "PATH"),
7272
reqopt("", "rustdoc-path", "path to rustdoc to use for compiling", "PATH"),
73-
reqopt("", "python", "path to python to use for doc tests", "PATH"),
73+
reqopt("", "lldb-python", "path to python to use for doc tests", "PATH"),
74+
reqopt("", "docck-python", "path to python to use for doc tests", "PATH"),
7475
optopt("", "valgrind-path", "path to Valgrind executable for Valgrind tests", "PROGRAM"),
7576
optflag("", "force-valgrind", "fail if Valgrind tests cannot be run under Valgrind"),
7677
optopt("", "llvm-filecheck", "path to LLVM's FileCheck binary", "DIR"),
@@ -140,7 +141,8 @@ pub fn parse_config(args: Vec<String> ) -> Config {
140141
run_lib_path: make_absolute(opt_path(matches, "run-lib-path")),
141142
rustc_path: opt_path(matches, "rustc-path"),
142143
rustdoc_path: opt_path(matches, "rustdoc-path"),
143-
python: matches.opt_str("python").unwrap(),
144+
lldb_python: matches.opt_str("lldb-python").unwrap(),
145+
docck_python: matches.opt_str("docck-python").unwrap(),
144146
valgrind_path: matches.opt_str("valgrind-path"),
145147
force_valgrind: matches.opt_present("force-valgrind"),
146148
llvm_filecheck: matches.opt_str("llvm-filecheck").map(|s| PathBuf::from(&s)),

src/tools/compiletest/src/runtest.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testpaths: &TestP
776776
let lldb_script_path = rust_src_root.join("src/etc/lldb_batchmode.py");
777777
cmd2procres(config,
778778
testpaths,
779-
Command::new(&config.python)
779+
Command::new(&config.lldb_python)
780780
.arg(&lldb_script_path)
781781
.arg(test_executable)
782782
.arg(debugger_script)
@@ -1901,7 +1901,7 @@ fn run_rustdoc_test(config: &Config, props: &TestProps, testpaths: &TestPaths) {
19011901

19021902
let res = cmd2procres(config,
19031903
testpaths,
1904-
Command::new(&config.python)
1904+
Command::new(&config.docck_python)
19051905
.arg(root.join("src/etc/htmldocck.py"))
19061906
.arg(out_dir)
19071907
.arg(&testpaths.file));

0 commit comments

Comments
 (0)