Skip to content

Commit fe62aef

Browse files
committed
---
yaml --- r: 65496 b: refs/heads/master c: fe1dc32 h: refs/heads/master v: v3
1 parent f5a4dae commit fe62aef

File tree

2 files changed

+94
-1
lines changed

2 files changed

+94
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 0ea8274fcaf1585b597f80a3c9d2bbef83549932
2+
refs/heads/master: fe1dc3280f63fe4cec441837ae20020cbe26dc61
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 18e3db7392d2d0697b7e27d6d986139960144d85
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9

trunk/src/compiletest/runtest.rs

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,99 @@ fn _arm_exec_compiled_test(config: &config, props: &TestProps,
753753
copy_result.out, copy_result.err));
754754
}
755755

756+
logv(config, fmt!("executing (%s) %s", config.target, cmdline));
757+
758+
759+
let mut runargs = ~[];
760+
let mut exitcode : int = 1;
761+
let mut maxtry = 10;
762+
763+
// sometimes code generates exit code 1 which is "1 : General unknown error"
764+
// in this case, force to retry
765+
// while exitcode == 1 && maxtry > 0 {
766+
// since adb shell doesnot forward internal result (exit code) and
767+
// distingush stderr and stdout, adb_run_wrapper is used
768+
769+
runargs.push(~"shell");
770+
runargs.push(fmt!("%s/adb_run_wrapper.sh", config.adb_test_dir));
771+
runargs.push(fmt!("%s", prog_short));
772+
773+
for args.args.each |tv| {
774+
runargs.push(tv.to_owned());
775+
}
776+
777+
procsrv::run("", config.adb_path, runargs, ~[(~"",~"")], Some(~""));
778+
779+
// get exitcode of result
780+
runargs = ~[];
781+
782+
runargs.push(~"shell");
783+
runargs.push(~"cat");
784+
runargs.push(fmt!("%s/%s.exitcode", config.adb_test_dir, prog_short));
785+
786+
let procsrv::Result{ out: exitcode_out, err: exitcode_err, status: exitcode_status } =
787+
procsrv::run("", config.adb_path, runargs, ~[(~"",~"")],
788+
Some(~""));
789+
790+
exitcode = 0;
791+
for str::each_char(exitcode_out) |c| {
792+
if !char::is_digit(c) { break; }
793+
exitcode = exitcode * 10 + match c {
794+
'0' .. '9' => c as int - ('0' as int),
795+
_ => 0,
796+
}
797+
}
798+
maxtry = maxtry - 1;
799+
// unsafe { libc::sleep(1); }
800+
// }
801+
802+
// get stdout of result
803+
runargs = ~[];
804+
runargs.push(~"shell");
805+
runargs.push(~"cat");
806+
runargs.push(fmt!("%s/%s.stdout", config.adb_test_dir, prog_short));
807+
808+
let procsrv::Result{ out: stdout_out, err: stdout_err, status: stdout_status } =
809+
procsrv::run("", config.adb_path, runargs, ~[(~"",~"")],
810+
Some(~""));
811+
812+
// get stderr of result
813+
runargs = ~[];
814+
runargs.push(~"shell");
815+
runargs.push(~"cat");
816+
runargs.push(fmt!("%s/%s.stderr", config.adb_test_dir, prog_short));
817+
818+
let procsrv::Result{ out: stderr_out, err: stderr_err, status: stderr_status } =
819+
procsrv::run("", config.adb_path, runargs, ~[(~"",~"")],
820+
Some(~""));
821+
822+
dump_output(config, testfile, stdout_out, stderr_out);
823+
824+
ProcRes {status: exitcode, stdout: stdout_out, stderr: stderr_out, cmdline: cmdline }
825+
}
826+
827+
fn _arm_exec_compiled_test2(config: &config, props: &TestProps,
828+
testfile: &Path) -> ProcRes {
829+
830+
let args = make_run_args(config, props, testfile);
831+
let cmdline = make_cmdline("", args.prog, args.args);
832+
833+
// get bare program string
834+
let mut tvec = ~[];
835+
for str::each_split_char(args.prog, '/') |ts| { tvec.push(ts.to_owned()) }
836+
let prog_short = tvec.pop();
837+
838+
// copy to target
839+
let copy_result = procsrv::run("", config.adb_path,
840+
[~"push", copy args.prog, copy config.adb_test_dir],
841+
~[(~"",~"")], Some(~""));
842+
843+
if config.verbose {
844+
io::stdout().write_str(fmt!("push (%s) %s %s %s",
845+
config.target, args.prog,
846+
copy_result.out, copy_result.err));
847+
}
848+
756849
// execute program
757850
logv(config, fmt!("executing (%s) %s", config.target, cmdline));
758851

0 commit comments

Comments
 (0)