about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc_back/target/wasm32_unknown_emscripten.rs2
-rw-r--r--src/tools/compiletest/src/procsrv.rs12
-rw-r--r--src/tools/compiletest/src/runtest.rs13
3 files changed, 24 insertions, 3 deletions
diff --git a/src/librustc_back/target/wasm32_unknown_emscripten.rs b/src/librustc_back/target/wasm32_unknown_emscripten.rs
index f5fb63038e9..c44095df400 100644
--- a/src/librustc_back/target/wasm32_unknown_emscripten.rs
+++ b/src/librustc_back/target/wasm32_unknown_emscripten.rs
@@ -18,6 +18,8 @@ pub fn target() -> Result<Target, String> {
                           vec!["-s".to_string(),
                                "BINARYEN=1".to_string(),
                                "-s".to_string(),
+                               "BINARYEN_METHOD='native-wasm,interpret-binary'".to_string(),
+                               "-s".to_string(),
                                "ERROR_ON_UNDEFINED_SYMBOLS=1".to_string()]);
 
     let opts = TargetOptions {
diff --git a/src/tools/compiletest/src/procsrv.rs b/src/tools/compiletest/src/procsrv.rs
index 35f6ed243fe..0ad52de6175 100644
--- a/src/tools/compiletest/src/procsrv.rs
+++ b/src/tools/compiletest/src/procsrv.rs
@@ -53,7 +53,8 @@ pub fn run(lib_path: &str,
            aux_path: Option<&str>,
            args: &[String],
            env: Vec<(String, String)>,
-           input: Option<String>)
+           input: Option<String>,
+           current_dir: Option<String>)
            -> io::Result<Result> {
 
     let mut cmd = Command::new(prog);
@@ -66,6 +67,9 @@ pub fn run(lib_path: &str,
     for (key, val) in env {
         cmd.env(&key, &val);
     }
+    if let Some(cwd) = current_dir {
+        cmd.current_dir(cwd);
+    }
 
     let mut process = cmd.spawn()?;
     if let Some(input) = input {
@@ -85,7 +89,8 @@ pub fn run_background(lib_path: &str,
                       aux_path: Option<&str>,
                       args: &[String],
                       env: Vec<(String, String)>,
-                      input: Option<String>)
+                      input: Option<String>,
+                      current_dir: Option<String>)
                       -> io::Result<Child> {
 
     let mut cmd = Command::new(prog);
@@ -96,6 +101,9 @@ pub fn run_background(lib_path: &str,
     for (key, val) in env {
         cmd.env(&key, &val);
     }
+    if let Some(cwd) = current_dir {
+        cmd.current_dir(cwd);
+    }
 
     let mut process = cmd.spawn()?;
     if let Some(input) = input {
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 45a733d411a..0664525221f 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -509,6 +509,7 @@ actual:\n\
                                  self.config.adb_test_dir.clone()
                              ],
                              Vec::new(),
+                             None,
                              None)
                     .expect(&format!("failed to exec `{:?}`", self.config.adb_path));
 
@@ -521,6 +522,7 @@ actual:\n\
                                  "tcp:5039".to_owned()
                              ],
                              Vec::new(),
+                             None,
                              None)
                     .expect(&format!("failed to exec `{:?}`", self.config.adb_path));
 
@@ -543,6 +545,7 @@ actual:\n\
                                                               adb_arg.clone()
                                                           ],
                                                           Vec::new(),
+                                                          None,
                                                           None)
                     .expect(&format!("failed to exec `{:?}`", self.config.adb_path));
 
@@ -579,6 +582,7 @@ actual:\n\
                                  None,
                                  &debugger_opts,
                                  Vec::new(),
+                                 None,
                                  None)
                     .expect(&format!("failed to exec `{:?}`", gdb_path));
                 let cmdline = {
@@ -1542,6 +1546,12 @@ actual:\n\
             logv(self.config, format!("executing {}", cmdline));
             cmdline
         };
+        let working_dir = if self.config.target.contains("emscripten") {
+            Some(self.output_base_name().parent().unwrap().to_str().unwrap().to_owned())
+        } else {
+            None
+        };
+
         let procsrv::Result {
             out,
             err,
@@ -1551,7 +1561,8 @@ actual:\n\
                          aux_path,
                          &args,
                          env,
-                         input).expect(&format!("failed to exec `{}`", prog));
+                         input,
+                         working_dir).expect(&format!("failed to exec `{}`", prog));
         self.dump_output(&out, &err);
         ProcRes {
             status: status,