diff options
| author | Young-il Choi <duddlf.choi@samsung.com> | 2013-06-01 17:27:30 +0900 |
|---|---|---|
| committer | Young-il Choi <duddlf.choi@samsung.com> | 2013-06-01 17:30:22 +0900 |
| commit | 8b24a96e1734d4fc028dfeebf5b13760790a9ac4 (patch) | |
| tree | 4066abb81e3cc378711c7482b47c4261731b3b8d | |
| parent | c28c495414d8d5bec83ca4c7e2781c1a7cc8d489 (diff) | |
| download | rust-8b24a96e1734d4fc028dfeebf5b13760790a9ac4.tar.gz rust-8b24a96e1734d4fc028dfeebf5b13760790a9ac4.zip | |
compiletest: runtest.rs cleanup
| -rw-r--r-- | src/compiletest/runtest.rs | 145 |
1 files changed, 30 insertions, 115 deletions
diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index 0c899b0435d..8ae4f7c3793 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -755,50 +755,38 @@ fn _arm_exec_compiled_test(config: &config, props: &TestProps, logv(config, fmt!("executing (%s) %s", config.target, cmdline)); - let mut runargs = ~[]; - let mut exitcode : int = 1; - let mut maxtry = 10; - - // sometimes code generates exit code 1 which is "1 : General unknown error" - // in this case, force to retry -// while exitcode == 1 && maxtry > 0 { - // since adb shell doesnot forward internal result (exit code) and - // distingush stderr and stdout, adb_run_wrapper is used - - runargs.push(~"shell"); - runargs.push(fmt!("%s/adb_run_wrapper.sh", config.adb_test_dir)); - runargs.push(fmt!("%s", config.adb_test_dir)); - runargs.push(fmt!("%s", prog_short)); - - for args.args.each |tv| { - runargs.push(tv.to_owned()); - } - - procsrv::run("", config.adb_path, runargs, ~[(~"",~"")], Some(~"")); - // get exitcode of result - runargs = ~[]; + // run test via adb_run_wrapper + runargs.push(~"shell"); + runargs.push(fmt!("%s/adb_run_wrapper.sh", config.adb_test_dir)); + runargs.push(fmt!("%s", config.adb_test_dir)); + runargs.push(fmt!("%s", prog_short)); - runargs.push(~"shell"); - runargs.push(~"cat"); - runargs.push(fmt!("%s/%s.exitcode", config.adb_test_dir, prog_short)); + for args.args.each |tv| { + runargs.push(tv.to_owned()); + } - let procsrv::Result{ out: exitcode_out, err: exitcode_err, status: exitcode_status } = - procsrv::run("", config.adb_path, runargs, ~[(~"",~"")], - Some(~"")); + procsrv::run("", config.adb_path, runargs, ~[(~"",~"")], Some(~"")); - exitcode = 0; - for str::each_char(exitcode_out) |c| { - if !char::is_digit(c) { break; } - exitcode = exitcode * 10 + match c { - '0' .. '9' => c as int - ('0' as int), - _ => 0, - } + // get exitcode of result + runargs = ~[]; + runargs.push(~"shell"); + runargs.push(~"cat"); + runargs.push(fmt!("%s/%s.exitcode", config.adb_test_dir, prog_short)); + + let procsrv::Result{ out: exitcode_out, err: _, status: _ } = + procsrv::run("", config.adb_path, runargs, ~[(~"",~"")], + Some(~"")); + + let mut exitcode : int = 0; + for str::each_char(exitcode_out) |c| { + if !char::is_digit(c) { break; } + exitcode = exitcode * 10 + match c { + '0' .. '9' => c as int - ('0' as int), + _ => 101, } -// maxtry = maxtry - 1; -// unsafe { libc::sleep(1); } -// } + } // get stdout of result runargs = ~[]; @@ -806,9 +794,8 @@ fn _arm_exec_compiled_test(config: &config, props: &TestProps, runargs.push(~"cat"); runargs.push(fmt!("%s/%s.stdout", config.adb_test_dir, prog_short)); - let procsrv::Result{ out: stdout_out, err: stdout_err, status: stdout_status } = - procsrv::run("", config.adb_path, runargs, ~[(~"",~"")], - Some(~"")); + let procsrv::Result{ out: stdout_out, err: _, status: _ } = + procsrv::run("", config.adb_path, runargs, ~[(~"",~"")], Some(~"")); // get stderr of result runargs = ~[]; @@ -816,86 +803,14 @@ fn _arm_exec_compiled_test(config: &config, props: &TestProps, runargs.push(~"cat"); runargs.push(fmt!("%s/%s.stderr", config.adb_test_dir, prog_short)); - let procsrv::Result{ out: stderr_out, err: stderr_err, status: stderr_status } = - procsrv::run("", config.adb_path, runargs, ~[(~"",~"")], - Some(~"")); + let procsrv::Result{ out: stderr_out, err: _, status: _ } = + procsrv::run("", config.adb_path, runargs, ~[(~"",~"")], Some(~"")); dump_output(config, testfile, stdout_out, stderr_out); ProcRes {status: exitcode, stdout: stdout_out, stderr: stderr_out, cmdline: cmdline } } -fn _arm_exec_compiled_test2(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 = ~[]; - for str::each_split_char(args.prog, '/') |ts| { tvec.push(ts.to_owned()) } - let prog_short = tvec.pop(); - - // copy to target - let copy_result = procsrv::run("", config.adb_path, - [~"push", copy args.prog, copy 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 separately but to stdout only - let mut newargs_out = ~[]; - let mut newargs_err = ~[]; - 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 args.args.each |tv| { - newcmd_out.push_str(" "); - newcmd_err.push_str(" "); - newcmd_out.push_str(*tv); - newcmd_err.push_str(*tv); - } - - 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 procsrv::Result{ out: out_out, err: _out_err, status: out_status } = - procsrv::run("", config.adb_path, newargs_out, ~[(~"",~"")], - Some(~"")); - let procsrv::Result{ out: err_out, err: _err_err, status: _err_status } = - procsrv::run("", config.adb_path, newargs_err, ~[(~"",~"")], - Some(~"")); - - dump_output(config, testfile, out_out, err_out); - - match err_out { - ~"" => ProcRes {status: out_status, stdout: out_out, - stderr: err_out, cmdline: cmdline }, - _ => ProcRes {status: 101, stdout: out_out, - stderr: err_out, cmdline: cmdline } - } -} - fn _dummy_exec_compiled_test(config: &config, props: &TestProps, testfile: &Path) -> ProcRes { |
