Skip to content

Commit 8401e37

Browse files
committed
Update bootstrap and compiletest to use the detected nodejs
1 parent a4c3288 commit 8401e37

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

src/bootstrap/check.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ pub fn compiletest(build: &Build,
108108
cmd.arg("--host").arg(compiler.host);
109109
cmd.arg("--llvm-filecheck").arg(build.llvm_filecheck(&build.config.build));
110110

111+
if let Some(nodejs) = build.config.nodejs.as_ref() {
112+
cmd.arg("--nodejs").arg(nodejs);
113+
}
114+
111115
let mut flags = vec!["-Crpath".to_string()];
112116
if build.config.rust_optimize_tests {
113117
flags.push("-O".to_string());
@@ -386,7 +390,8 @@ fn krate_emscripten(build: &Build,
386390
for test in tests {
387391
let test_file_name = test.to_string_lossy().into_owned();
388392
println!("running {}", test_file_name);
389-
let output = Command::new("node")
393+
let nodejs = build.config.nodejs.as_ref().expect("nodejs not configured");
394+
let output = Command::new(nodejs)
390395
.arg(&test_file_name)
391396
.stderr(::std::process::Stdio::inherit())
392397
.output();

src/tools/compiletest/src/common.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,5 @@ pub struct Config {
183183
pub cflags: String,
184184
pub llvm_components: String,
185185
pub llvm_cxxflags: String,
186+
pub nodejs: Option<String>,
186187
}

src/tools/compiletest/src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
109109
reqopt("", "cflags", "flags for the C compiler", "FLAGS"),
110110
reqopt("", "llvm-components", "list of LLVM components built in", "LIST"),
111111
reqopt("", "llvm-cxxflags", "C++ flags for LLVM", "FLAGS"),
112+
optopt("", "nodejs", "the name of nodejs", "PATH"),
112113
optflag("h", "help", "show this message"));
113114

114115
let (argv0, args_) = args.split_first().unwrap();
@@ -190,6 +191,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
190191
cflags: matches.opt_str("cflags").unwrap(),
191192
llvm_components: matches.opt_str("llvm-components").unwrap(),
192193
llvm_cxxflags: matches.opt_str("llvm-cxxflags").unwrap(),
194+
nodejs: matches.opt_str("nodejs"),
193195
}
194196
}
195197

src/tools/compiletest/src/runtest.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1439,7 +1439,8 @@ actual:\n\
14391439

14401440
// If this is emscripten, then run tests under nodejs
14411441
if self.config.target.contains("emscripten") {
1442-
args.push("node".to_owned());
1442+
let nodejs = self.config.nodejs.clone().unwrap_or("nodejs".to_string());
1443+
args.push(nodejs);
14431444
}
14441445

14451446
let exe_file = self.make_exe_name();

0 commit comments

Comments
 (0)