From 8401e37495e5f0794a8833a385ee7c37cb8cf47e Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Thu, 15 Sep 2016 19:42:26 +0000 Subject: [PATCH] Update bootstrap and compiletest to use the detected nodejs --- src/bootstrap/check.rs | 7 ++++++- src/tools/compiletest/src/common.rs | 1 + src/tools/compiletest/src/main.rs | 2 ++ src/tools/compiletest/src/runtest.rs | 3 ++- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index 0bd9355098f..95c909aef77 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -108,6 +108,10 @@ pub fn compiletest(build: &Build, cmd.arg("--host").arg(compiler.host); cmd.arg("--llvm-filecheck").arg(build.llvm_filecheck(&build.config.build)); + if let Some(nodejs) = build.config.nodejs.as_ref() { + cmd.arg("--nodejs").arg(nodejs); + } + let mut flags = vec!["-Crpath".to_string()]; if build.config.rust_optimize_tests { flags.push("-O".to_string()); @@ -386,7 +390,8 @@ fn krate_emscripten(build: &Build, for test in tests { let test_file_name = test.to_string_lossy().into_owned(); println!("running {}", test_file_name); - let output = Command::new("node") + let nodejs = build.config.nodejs.as_ref().expect("nodejs not configured"); + let output = Command::new(nodejs) .arg(&test_file_name) .stderr(::std::process::Stdio::inherit()) .output(); diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 5d522736089..81cb927f26b 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -183,4 +183,5 @@ pub struct Config { pub cflags: String, pub llvm_components: String, pub llvm_cxxflags: String, + pub nodejs: Option, } diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index 6e92a32cfeb..ff91ab7c70b 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -109,6 +109,7 @@ pub fn parse_config(args: Vec ) -> Config { reqopt("", "cflags", "flags for the C compiler", "FLAGS"), reqopt("", "llvm-components", "list of LLVM components built in", "LIST"), reqopt("", "llvm-cxxflags", "C++ flags for LLVM", "FLAGS"), + optopt("", "nodejs", "the name of nodejs", "PATH"), optflag("h", "help", "show this message")); let (argv0, args_) = args.split_first().unwrap(); @@ -190,6 +191,7 @@ pub fn parse_config(args: Vec ) -> Config { cflags: matches.opt_str("cflags").unwrap(), llvm_components: matches.opt_str("llvm-components").unwrap(), llvm_cxxflags: matches.opt_str("llvm-cxxflags").unwrap(), + nodejs: matches.opt_str("nodejs"), } } diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 5885e464b4f..35b93392baf 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1439,7 +1439,8 @@ actual:\n\ // If this is emscripten, then run tests under nodejs if self.config.target.contains("emscripten") { - args.push("node".to_owned()); + let nodejs = self.config.nodejs.clone().unwrap_or("nodejs".to_string()); + args.push(nodejs); } let exe_file = self.make_exe_name();