Skip to content

Commit fd983d0

Browse files
authored
Auto merge of #37611 - Mark-Simulacrum:tari-nodejs-runner-detect, r=alexcrichton
compile-test: allow overriding nodejs binary location Add a command-line argument to manually specify which nodejs binary should be used, which disables the default search. Original work done by @tari. Fixes #34188.
2 parents 026add5 + c524c50 commit fd983d0

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

src/bootstrap/config.rs

+2
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ struct Build {
129129
submodules: Option<bool>,
130130
gdb: Option<String>,
131131
vendor: Option<bool>,
132+
nodejs: Option<String>,
132133
}
133134

134135
/// TOML representation of how the LLVM build is configured.
@@ -234,6 +235,7 @@ impl Config {
234235
}
235236
config.rustc = build.rustc.map(PathBuf::from);
236237
config.cargo = build.cargo.map(PathBuf::from);
238+
config.nodejs = build.nodejs.map(PathBuf::from);
237239
config.gdb = build.gdb.map(PathBuf::from);
238240
set(&mut config.compiler_docs, build.compiler_docs);
239241
set(&mut config.docs, build.docs);

src/bootstrap/sanity.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,16 @@ pub fn check(build: &mut Build) {
8181

8282
need_cmd("python".as_ref());
8383

84-
// Look for the nodejs command, needed for emscripten testing
85-
if let Some(node) = have_cmd("node".as_ref()) {
86-
build.config.nodejs = Some(node);
87-
} else if let Some(node) = have_cmd("nodejs".as_ref()) {
88-
build.config.nodejs = Some(node);
89-
}
9084

9185
if let Some(ref s) = build.config.nodejs {
9286
need_cmd(s.as_ref());
87+
} else {
88+
// Look for the nodejs command, needed for emscripten testing
89+
if let Some(node) = have_cmd("node".as_ref()) {
90+
build.config.nodejs = Some(node);
91+
} else if let Some(node) = have_cmd("nodejs".as_ref()) {
92+
build.config.nodejs = Some(node);
93+
}
9394
}
9495

9596
if let Some(ref gdb) = build.config.gdb {

src/tools/compiletest/src/runtest.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1456,8 +1456,11 @@ actual:\n\
14561456

14571457
// If this is emscripten, then run tests under nodejs
14581458
if self.config.target.contains("emscripten") {
1459-
let nodejs = self.config.nodejs.clone().unwrap_or("nodejs".to_string());
1460-
args.push(nodejs);
1459+
if let Some(ref p) = self.config.nodejs {
1460+
args.push(p.clone());
1461+
} else {
1462+
self.fatal("no NodeJS binary found (--nodejs)");
1463+
}
14611464
}
14621465

14631466
let exe_file = self.make_exe_name();

0 commit comments

Comments
 (0)