]> git.lizzy.rs Git - rust.git/commitdiff
Add emscripten support to compiletest
authorBrian Anderson <banderson@mozilla.com>
Wed, 6 Jan 2016 19:21:28 +0000 (19:21 +0000)
committerBrian Anderson <banderson@mozilla.com>
Sat, 6 Feb 2016 20:56:31 +0000 (20:56 +0000)
src/compiletest/runtest.rs
src/compiletest/util.rs

index 4abc4cce7273b077d41f3edbf1d05f6e2f3aada9..ada6ea200d1d567f92a4ceff0e8c89f6b6b9bb87 100644 (file)
@@ -1357,7 +1357,12 @@ fn make_lib_name(config: &Config, auxfile: &Path, testfile: &Path) -> PathBuf {
 
 fn make_exe_name(config: &Config, testfile: &Path) -> PathBuf {
     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();
         fname.push(env::consts::EXE_SUFFIX);
         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),
     // then split apart its command
     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);
 
     // FIXME (#9639): This needs to handle non-utf8 paths
index 027d56103802f1e6c73722fdb3c2ebed68bc4f2b..69b839c5b7d9d0e94cdf58623574ef3ecd8e9dc3 100644 (file)
@@ -26,6 +26,7 @@
     ("win32", "windows"),
     ("windows", "windows"),
     ("solaris", "solaris"),
+    ("emscripten", "emscripten"),
 ];
 
 const ARCH_TABLE: &'static [(&'static str, &'static str)] = &[
@@ -44,6 +45,7 @@
     ("sparc", "sparc"),
     ("x86_64", "x86_64"),
     ("xcore", "xcore"),
+    ("asmjs", "asmjs"),
 ];
 
 pub fn get_os(triple: &str) -> &'static str {