Skip to content

Commit ad9184c

Browse files
rschulmanbrson
authored andcommitted
Adapting bootstrap to run tests on asmjs.
1 parent c62d8b1 commit ad9184c

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

src/bootstrap/check.rs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,9 @@ pub fn krate(build: &Build,
323323
if target.contains("android") {
324324
build.run(cargo.arg("--no-run"));
325325
krate_android(build, compiler, target, mode);
326+
} else if target.contains("asmjs") {
327+
build.run(cargo.arg("--no-run"));
328+
krate_asmjs(build, compiler, target, mode);
326329
} else {
327330
cargo.args(&build.flags.args);
328331
build.run(&mut cargo);
@@ -371,6 +374,23 @@ fn krate_android(build: &Build,
371374
}
372375
}
373376

377+
fn krate_asmjs(build: &Build,
378+
compiler: &Compiler,
379+
target: &str,
380+
mode: Mode) {
381+
let mut tests = Vec::new();
382+
let out_dir = build.cargo_out(compiler, mode, target);
383+
find_tests(&out_dir, target, &mut tests);
384+
find_tests(&out_dir.join("deps"), target, &mut tests);
385+
386+
for test in tests {
387+
let test_file_name = test.to_string_lossy().into_owned();
388+
let output = output(Command::new("node").arg(&test_file_name));
389+
println!("{}", output);
390+
}
391+
}
392+
393+
374394
fn find_tests(dir: &Path,
375395
target: &str,
376396
dst: &mut Vec<PathBuf>) {
@@ -381,7 +401,8 @@ fn find_tests(dir: &Path,
381401
}
382402
let filename = e.file_name().into_string().unwrap();
383403
if (target.contains("windows") && filename.ends_with(".exe")) ||
384-
(!target.contains("windows") && !filename.contains(".")) {
404+
(!target.contains("windows") && !filename.contains(".")) ||
405+
(target.contains("asmjs") && filename.contains(".js")){
385406
dst.push(e.path());
386407
}
387408
}

0 commit comments

Comments
 (0)