auto merge of #6150 : yichoi/rust/arm-test-pull, r=brson
Support #5297 install.mk : install-runtime-target added for conveneice automatically push runtime library to android device test.mk : expanded to support android test automation with adb compiletest : expanded to support android test automation with adb
This commit is contained in:
commit
bd5fd6e42a
6 changed files with 344 additions and 12 deletions
|
@ -77,8 +77,20 @@ fn run_rfail_test(config: config, props: TestProps, testfile: &Path) {
|
|||
fatal_ProcRes(~"run-fail test isn't valgrind-clean!", ProcRes);
|
||||
}
|
||||
|
||||
check_correct_failure_status(ProcRes);
|
||||
check_error_patterns(props, testfile, ProcRes);
|
||||
match config.target {
|
||||
|
||||
~"arm-linux-androideabi" => {
|
||||
if (config.adb_device_status) {
|
||||
check_correct_failure_status(ProcRes);
|
||||
check_error_patterns(props, testfile, ProcRes);
|
||||
}
|
||||
}
|
||||
|
||||
_=> {
|
||||
check_correct_failure_status(ProcRes);
|
||||
check_error_patterns(props, testfile, ProcRes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn check_correct_failure_status(ProcRes: ProcRes) {
|
||||
|
@ -483,10 +495,23 @@ fn exec_compiled_test(config: config, props: TestProps,
|
|||
props.exec_env
|
||||
};
|
||||
|
||||
compose_and_run(config, testfile,
|
||||
make_run_args(config, props, testfile),
|
||||
env,
|
||||
config.run_lib_path, None)
|
||||
match config.target {
|
||||
|
||||
~"arm-linux-androideabi" => {
|
||||
if (config.adb_device_status) {
|
||||
_arm_exec_compiled_test(config, props, testfile)
|
||||
} else {
|
||||
_dummy_exec_compiled_test(config, props, testfile)
|
||||
}
|
||||
}
|
||||
|
||||
_=> {
|
||||
compose_and_run(config, testfile,
|
||||
make_run_args(config, props, testfile),
|
||||
env,
|
||||
config.run_lib_path, None)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn compose_and_run_compiler(
|
||||
|
@ -516,6 +541,17 @@ fn compose_and_run_compiler(
|
|||
abs_ab.to_str()),
|
||||
auxres);
|
||||
}
|
||||
|
||||
match config.target {
|
||||
|
||||
~"arm-linux-androideabi" => {
|
||||
if (config.adb_device_status) {
|
||||
_arm_push_aux_shared_library(config, testfile);
|
||||
}
|
||||
}
|
||||
|
||||
_=> { }
|
||||
}
|
||||
}
|
||||
|
||||
compose_and_run(config, testfile, args, ~[],
|
||||
|
@ -700,3 +736,108 @@ stderr:\n\
|
|||
io::stdout().write_str(msg);
|
||||
fail!();
|
||||
}
|
||||
|
||||
fn _arm_exec_compiled_test(config: config, props: TestProps,
|
||||
testfile: &Path) -> ProcRes {
|
||||
|
||||
let args = make_run_args(config, props, testfile);
|
||||
let cmdline = make_cmdline(~"", args.prog, args.args);
|
||||
|
||||
// get bare program string
|
||||
let mut tvec = ~[];
|
||||
let tstr = args.prog;
|
||||
for str::each_split_char(tstr, '/') |ts| { tvec.push(ts.to_owned()) }
|
||||
let prog_short = tvec.pop();
|
||||
|
||||
// copy to target
|
||||
let copy_result = procsrv::run(~"", config.adb_path,
|
||||
~[~"push", args.prog, config.adb_test_dir],
|
||||
~[(~"",~"")], Some(~""));
|
||||
|
||||
if config.verbose {
|
||||
io::stdout().write_str(fmt!("push (%s) %s %s %s",
|
||||
config.target, args.prog,
|
||||
copy_result.out, copy_result.err));
|
||||
}
|
||||
|
||||
// execute program
|
||||
logv(config, fmt!("executing (%s) %s", config.target, cmdline));
|
||||
|
||||
// adb shell dose not forward stdout and stderr of internal result
|
||||
// to stdout and stderr seperately but to stdout only
|
||||
let mut newargs_out = ~[];
|
||||
let mut newargs_err = ~[];
|
||||
let subargs = args.args;
|
||||
newargs_out.push(~"shell");
|
||||
newargs_err.push(~"shell");
|
||||
|
||||
let mut newcmd_out = ~"";
|
||||
let mut newcmd_err = ~"";
|
||||
|
||||
newcmd_out.push_str(fmt!("LD_LIBRARY_PATH=%s %s/%s",
|
||||
config.adb_test_dir, config.adb_test_dir, prog_short));
|
||||
|
||||
newcmd_err.push_str(fmt!("LD_LIBRARY_PATH=%s %s/%s",
|
||||
config.adb_test_dir, config.adb_test_dir, prog_short));
|
||||
|
||||
for vec::each(subargs) |tv| {
|
||||
newcmd_out.push_str(" ");
|
||||
newcmd_err.push_str(" ");
|
||||
newcmd_out.push_str(tv.to_owned());
|
||||
newcmd_err.push_str(tv.to_owned());
|
||||
}
|
||||
|
||||
newcmd_out.push_str(" 2>/dev/null");
|
||||
newcmd_err.push_str(" 1>/dev/null");
|
||||
|
||||
newargs_out.push(newcmd_out);
|
||||
newargs_err.push(newcmd_err);
|
||||
|
||||
let exe_result_out = procsrv::run(~"", config.adb_path,
|
||||
newargs_out, ~[(~"",~"")], Some(~""));
|
||||
let exe_result_err = procsrv::run(~"", config.adb_path,
|
||||
newargs_err, ~[(~"",~"")], Some(~""));
|
||||
|
||||
dump_output(config, testfile, exe_result_out.out, exe_result_err.out);
|
||||
|
||||
match exe_result_err.out {
|
||||
~"" => ProcRes {status: exe_result_out.status, stdout: exe_result_out.out,
|
||||
stderr: exe_result_err.out, cmdline: cmdline },
|
||||
_ => ProcRes {status: 101, stdout: exe_result_out.out,
|
||||
stderr: exe_result_err.out, cmdline: cmdline }
|
||||
}
|
||||
}
|
||||
|
||||
fn _dummy_exec_compiled_test(config: config, props: TestProps,
|
||||
testfile: &Path) -> ProcRes {
|
||||
|
||||
let args = make_run_args(config, props, testfile);
|
||||
let cmdline = make_cmdline(~"", args.prog, args.args);
|
||||
|
||||
match config.mode {
|
||||
mode_run_fail => ProcRes {status: 101, stdout: ~"",
|
||||
stderr: ~"", cmdline: cmdline},
|
||||
_ => ProcRes {status: 0, stdout: ~"",
|
||||
stderr: ~"", cmdline: cmdline}
|
||||
}
|
||||
}
|
||||
|
||||
fn _arm_push_aux_shared_library(config: config, testfile: &Path) {
|
||||
let tstr = aux_output_dir_name(config, testfile).to_str();
|
||||
|
||||
for os::list_dir_path(&Path(tstr)).each |file| {
|
||||
|
||||
if (file.filetype() == Some(~".so")) {
|
||||
|
||||
let copy_result = procsrv::run(~"", config.adb_path,
|
||||
~[~"push", file.to_str(), config.adb_test_dir],
|
||||
~[(~"",~"")], Some(~""));
|
||||
|
||||
if config.verbose {
|
||||
io::stdout().write_str(fmt!("push (%s) %s %s %s",
|
||||
config.target, file.to_str(),
|
||||
copy_result.out, copy_result.err));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue