about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-04-23 01:18:03 -0700
committerbors <bors@rust-lang.org>2016-04-23 01:18:03 -0700
commitef57fb714402286532932371b667abda5fe874f3 (patch)
treea6ce649cc14a16d5cc7bb1b2c0f293d9833661b9
parentbb4b0d894364409c64087c622fdb173b52ad1005 (diff)
parentcbe6292c58feb643917c0959f95173a3c312fbd4 (diff)
downloadrust-ef57fb714402286532932371b667abda5fe874f3.tar.gz
rust-ef57fb714402286532932371b667abda5fe874f3.zip
Auto merge of #33084 - alexcrichton:osx-python-sanity, r=michaelwoerister
Sanity check Python on OSX for LLDB tests

Two primary changes:

* Don't get past the configure stage if `python` isn't coming from `/usr/bin`
* Call `debugger.Terminate()` to prevent segfaults on newer versions of LLDB.

Closes #32994
-rwxr-xr-xconfigure13
-rw-r--r--mk/tests.mk3
-rw-r--r--src/bootstrap/build/check.rs13
-rw-r--r--src/etc/lldb_batchmode.py1
-rw-r--r--src/tools/compiletest/src/common.rs7
-rw-r--r--src/tools/compiletest/src/main.rs6
-rw-r--r--src/tools/compiletest/src/runtest.rs4
7 files changed, 39 insertions, 8 deletions
diff --git a/configure b/configure
index db3ca2eecbb..5273e4c03e7 100755
--- a/configure
+++ b/configure
@@ -823,6 +823,19 @@ then
     fi
 fi
 
+# LLDB tests on OSX require /usr/bin/python, not something like Homebrew's
+# /usr/local/bin/python. We're loading a compiled module for LLDB tests which is
+# only compatible with the system.
+case $CFG_BUILD in
+    *-apple-darwin)
+        CFG_LLDB_PYTHON=/usr/bin/python
+        ;;
+    *)
+        CFG_LLDB_PYTHON=$CFG_PYTHON
+        ;;
+esac
+putvar CFG_LLDB_PYTHON
+
 step_msg "looking for target specific programs"
 
 probe CFG_ADB        adb
diff --git a/mk/tests.mk b/mk/tests.mk
index dc7f9416a7c..1c65a09cbc4 100644
--- a/mk/tests.mk
+++ b/mk/tests.mk
@@ -619,7 +619,8 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
         --stage-id stage$(1)-$(2) \
         --target $(2) \
         --host $(3) \
-	--python $$(CFG_PYTHON) \
+	--docck-python $$(CFG_PYTHON) \
+	--lldb-python $$(CFG_LLDB_PYTHON) \
         --gdb-version="$(CFG_GDB_VERSION)" \
         --lldb-version="$(CFG_LLDB_VERSION)" \
         --android-cross-path=$(CFG_ANDROID_CROSS_PATH) \
diff --git a/src/bootstrap/build/check.rs b/src/bootstrap/build/check.rs
index f145a7149fb..ec97ebcc832 100644
--- a/src/bootstrap/build/check.rs
+++ b/src/bootstrap/build/check.rs
@@ -81,8 +81,19 @@ pub fn compiletest(build: &Build,
 
     // FIXME: needs android support
     cmd.arg("--android-cross-path").arg("");
+
     // FIXME: CFG_PYTHON should probably be detected more robustly elsewhere
-    cmd.arg("--python").arg("python");
+    let python_default = "python";
+    cmd.arg("--docck-python").arg(python_default);
+
+    if build.config.build.ends_with("apple-darwin") {
+        // Force /usr/bin/python on OSX for LLDB tests because we're loading the
+        // LLDB plugin's compiled module which only works with the system python
+        // (namely not Homebrew-installed python)
+        cmd.arg("--lldb-python").arg("/usr/bin/python");
+    } else {
+        cmd.arg("--lldb-python").arg(python_default);
+    }
 
     if let Some(ref vers) = build.gdb_version {
         cmd.arg("--gdb-version").arg(vers);
diff --git a/src/etc/lldb_batchmode.py b/src/etc/lldb_batchmode.py
index b1506285b3a..7bbb3577f8d 100644
--- a/src/etc/lldb_batchmode.py
+++ b/src/etc/lldb_batchmode.py
@@ -216,4 +216,5 @@ except IOError as e:
     print("Aborting.", file=sys.stderr)
     sys.exit(1)
 finally:
+    debugger.Terminate()
     script_file.close()
diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs
index 6ffc1e9ea11..81265f6ccaf 100644
--- a/src/tools/compiletest/src/common.rs
+++ b/src/tools/compiletest/src/common.rs
@@ -83,8 +83,11 @@ pub struct Config {
     // The rustdoc executable
     pub rustdoc_path: PathBuf,
 
-    // The python executable
-    pub python: String,
+    // The python executable to use for LLDB
+    pub lldb_python: String,
+
+    // The python executable to use for htmldocck
+    pub docck_python: String,
 
     // The llvm FileCheck binary path
     pub llvm_filecheck: Option<PathBuf>,
diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs
index 8e999139a24..a9810099dbf 100644
--- a/src/tools/compiletest/src/main.rs
+++ b/src/tools/compiletest/src/main.rs
@@ -72,7 +72,8 @@ pub fn parse_config(args: Vec<String> ) -> Config {
           reqopt("", "run-lib-path", "path to target shared libraries", "PATH"),
           reqopt("", "rustc-path", "path to rustc to use for compiling", "PATH"),
           reqopt("", "rustdoc-path", "path to rustdoc to use for compiling", "PATH"),
-          reqopt("", "python", "path to python to use for doc tests", "PATH"),
+          reqopt("", "lldb-python", "path to python to use for doc tests", "PATH"),
+          reqopt("", "docck-python", "path to python to use for doc tests", "PATH"),
           optopt("", "valgrind-path", "path to Valgrind executable for Valgrind tests", "PROGRAM"),
           optflag("", "force-valgrind", "fail if Valgrind tests cannot be run under Valgrind"),
           optopt("", "llvm-filecheck", "path to LLVM's FileCheck binary", "DIR"),
@@ -142,7 +143,8 @@ pub fn parse_config(args: Vec<String> ) -> Config {
         run_lib_path: make_absolute(opt_path(matches, "run-lib-path")),
         rustc_path: opt_path(matches, "rustc-path"),
         rustdoc_path: opt_path(matches, "rustdoc-path"),
-        python: matches.opt_str("python").unwrap(),
+        lldb_python: matches.opt_str("lldb-python").unwrap(),
+        docck_python: matches.opt_str("docck-python").unwrap(),
         valgrind_path: matches.opt_str("valgrind-path"),
         force_valgrind: matches.opt_present("force-valgrind"),
         llvm_filecheck: matches.opt_str("llvm-filecheck").map(|s| PathBuf::from(&s)),
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 8770d4b1f42..e0abf8200a0 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -777,7 +777,7 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testpaths: &TestP
         let lldb_script_path = rust_src_root.join("src/etc/lldb_batchmode.py");
         cmd2procres(config,
                     testpaths,
-                    Command::new(&config.python)
+                    Command::new(&config.lldb_python)
                             .arg(&lldb_script_path)
                             .arg(test_executable)
                             .arg(debugger_script)
@@ -1835,7 +1835,7 @@ fn run_rustdoc_test(config: &Config, props: &TestProps, testpaths: &TestPaths) {
 
     let res = cmd2procres(config,
                           testpaths,
-                          Command::new(&config.python)
+                          Command::new(&config.docck_python)
                                   .arg(root.join("src/etc/htmldocck.py"))
                                   .arg(out_dir)
                                   .arg(&testpaths.file));