mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-08 07:57:40 +00:00
Add emscripten support to compiletest
This commit is contained in:
parent
bd3fe498e5
commit
7afb56f51e
@ -1357,7 +1357,12 @@ fn make_lib_name(config: &Config, auxfile: &Path, testfile: &Path) -> PathBuf {
|
|||||||
|
|
||||||
fn make_exe_name(config: &Config, testfile: &Path) -> PathBuf {
|
fn make_exe_name(config: &Config, testfile: &Path) -> PathBuf {
|
||||||
let mut f = output_base_name(config, testfile);
|
let mut f = output_base_name(config, testfile);
|
||||||
if !env::consts::EXE_SUFFIX.is_empty() {
|
// FIXME: This is using the host architecture exe suffix, not target!
|
||||||
|
if config.target == "asmjs-unknown-emscripten" {
|
||||||
|
let mut fname = f.file_name().unwrap().to_os_string();
|
||||||
|
fname.push(".js");
|
||||||
|
f.set_file_name(&fname);
|
||||||
|
} else if !env::consts::EXE_SUFFIX.is_empty() {
|
||||||
let mut fname = f.file_name().unwrap().to_os_string();
|
let mut fname = f.file_name().unwrap().to_os_string();
|
||||||
fname.push(env::consts::EXE_SUFFIX);
|
fname.push(env::consts::EXE_SUFFIX);
|
||||||
f.set_file_name(&fname);
|
f.set_file_name(&fname);
|
||||||
@ -1370,6 +1375,12 @@ fn make_run_args(config: &Config, props: &TestProps, testfile: &Path)
|
|||||||
// If we've got another tool to run under (valgrind),
|
// If we've got another tool to run under (valgrind),
|
||||||
// then split apart its command
|
// then split apart its command
|
||||||
let mut args = split_maybe_args(&config.runtool);
|
let mut args = split_maybe_args(&config.runtool);
|
||||||
|
|
||||||
|
// If this is emscripten, then run tests under nodejs
|
||||||
|
if config.target == "asmjs-unknown-emscripten" {
|
||||||
|
args.push("nodejs".to_owned());
|
||||||
|
}
|
||||||
|
|
||||||
let exe_file = make_exe_name(config, testfile);
|
let exe_file = make_exe_name(config, testfile);
|
||||||
|
|
||||||
// FIXME (#9639): This needs to handle non-utf8 paths
|
// FIXME (#9639): This needs to handle non-utf8 paths
|
||||||
|
@ -26,6 +26,7 @@ const OS_TABLE: &'static [(&'static str, &'static str)] = &[
|
|||||||
("win32", "windows"),
|
("win32", "windows"),
|
||||||
("windows", "windows"),
|
("windows", "windows"),
|
||||||
("solaris", "solaris"),
|
("solaris", "solaris"),
|
||||||
|
("emscripten", "emscripten"),
|
||||||
];
|
];
|
||||||
|
|
||||||
const ARCH_TABLE: &'static [(&'static str, &'static str)] = &[
|
const ARCH_TABLE: &'static [(&'static str, &'static str)] = &[
|
||||||
@ -44,6 +45,7 @@ const ARCH_TABLE: &'static [(&'static str, &'static str)] = &[
|
|||||||
("sparc", "sparc"),
|
("sparc", "sparc"),
|
||||||
("x86_64", "x86_64"),
|
("x86_64", "x86_64"),
|
||||||
("xcore", "xcore"),
|
("xcore", "xcore"),
|
||||||
|
("asmjs", "asmjs"),
|
||||||
];
|
];
|
||||||
|
|
||||||
pub fn get_os(triple: &str) -> &'static str {
|
pub fn get_os(triple: &str) -> &'static str {
|
||||||
|
Loading…
Reference in New Issue
Block a user