about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMark-Simulacrum <mark.simulacrum@gmail.com>2016-11-10 16:04:53 -0700
committerMark-Simulacrum <mark.simulacrum@gmail.com>2016-11-10 18:37:41 -0700
commitc524c50edf85b3489734beb6b6619082307de116 (patch)
treea5c2511d2989104cf680520949c02898375f7ee3
parent3dced6f71e6e8cf8f59e3614194a61427a3a408b (diff)
downloadrust-c524c50edf85b3489734beb6b6619082307de116.tar.gz
rust-c524c50edf85b3489734beb6b6619082307de116.zip
compiletest: detect nodejs binary, allow override
Allow passing a custom nodejs directory in configure.
-rw-r--r--src/bootstrap/config.rs2
-rw-r--r--src/bootstrap/sanity.rs13
-rw-r--r--src/tools/compiletest/src/runtest.rs7
3 files changed, 14 insertions, 8 deletions
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index 9a939fee43e..f88bb04fb10 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -128,6 +128,7 @@ struct Build {
     submodules: Option<bool>,
     gdb: Option<String>,
     vendor: Option<bool>,
+    nodejs: Option<String>,
 }
 
 /// TOML representation of how the LLVM build is configured.
@@ -232,6 +233,7 @@ impl Config {
         }
         config.rustc = build.rustc.map(PathBuf::from);
         config.cargo = build.cargo.map(PathBuf::from);
+        config.nodejs = build.nodejs.map(PathBuf::from);
         config.gdb = build.gdb.map(PathBuf::from);
         set(&mut config.compiler_docs, build.compiler_docs);
         set(&mut config.docs, build.docs);
diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs
index cc1b7136d47..a541ba0b2f3 100644
--- a/src/bootstrap/sanity.rs
+++ b/src/bootstrap/sanity.rs
@@ -81,15 +81,16 @@ pub fn check(build: &mut Build) {
 
     need_cmd("python".as_ref());
 
-    // Look for the nodejs command, needed for emscripten testing
-    if let Some(node) = have_cmd("node".as_ref()) {
-        build.config.nodejs = Some(node);
-    } else if let Some(node) = have_cmd("nodejs".as_ref()) {
-        build.config.nodejs = Some(node);
-    }
 
     if let Some(ref s) = build.config.nodejs {
         need_cmd(s.as_ref());
+    } else {
+        // Look for the nodejs command, needed for emscripten testing
+        if let Some(node) = have_cmd("node".as_ref()) {
+            build.config.nodejs = Some(node);
+        } else if let Some(node) = have_cmd("nodejs".as_ref()) {
+            build.config.nodejs = Some(node);
+        }
     }
 
     if let Some(ref gdb) = build.config.gdb {
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 8cb2e3b1c2d..4c024434e17 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -1456,8 +1456,11 @@ actual:\n\
 
         // If this is emscripten, then run tests under nodejs
         if self.config.target.contains("emscripten") {
-            let nodejs = self.config.nodejs.clone().unwrap_or("nodejs".to_string());
-            args.push(nodejs);
+            if let Some(ref p) = self.config.nodejs {
+                args.push(p.clone());
+            } else {
+                self.fatal("no NodeJS binary found (--nodejs)");
+            }
         }
 
         let exe_file = self.make_exe_name();