Skip to content

Commit c524c50

Browse files
compiletest: detect nodejs binary, allow override
Allow passing a custom nodejs directory in configure.
1 parent 3dced6f commit c524c50

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

src/bootstrap/config.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ struct Build {
128128
submodules: Option<bool>,
129129
gdb: Option<String>,
130130
vendor: Option<bool>,
131+
nodejs: Option<String>,
131132
}
132133

133134
/// TOML representation of how the LLVM build is configured.
@@ -232,6 +233,7 @@ impl Config {
232233
}
233234
config.rustc = build.rustc.map(PathBuf::from);
234235
config.cargo = build.cargo.map(PathBuf::from);
236+
config.nodejs = build.nodejs.map(PathBuf::from);
235237
config.gdb = build.gdb.map(PathBuf::from);
236238
set(&mut config.compiler_docs, build.compiler_docs);
237239
set(&mut config.docs, build.docs);

src/bootstrap/sanity.rs

Lines changed: 7 additions & 6 deletions
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

Lines changed: 5 additions & 2 deletions
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)