Make compiletest set cwd before running js tests

This commit is contained in:
Richard Dodd 2017-05-17 16:15:28 +01:00
parent 5803f99bd4
commit f4e329f178
3 changed files with 24 additions and 3 deletions

View File

@ -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 {

View File

@ -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 {

View File

@ -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,