compiletest: remove --host and cleanup
This commit is contained in:
parent
84bdd05acc
commit
5681571f6c
|
@ -497,9 +497,8 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
|
||||||
--compile-lib-path $$(HLIB$(1)_H_$(3)) \
|
--compile-lib-path $$(HLIB$(1)_H_$(3)) \
|
||||||
--run-lib-path $$(TLIB$(1)_T_$(2)_H_$(3)) \
|
--run-lib-path $$(TLIB$(1)_T_$(2)_H_$(3)) \
|
||||||
--rustc-path $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
|
--rustc-path $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
|
||||||
--aux-base $$(S)src/test/auxiliary/ \
|
--aux-base $$(S)src/test/auxiliary/ \
|
||||||
--stage-id stage$(1)-$(2) \
|
--stage-id stage$(1)-$(2) \
|
||||||
--host $(CFG_BUILD_TRIPLE) \
|
|
||||||
--target $(2) \
|
--target $(2) \
|
||||||
--adb-path=$(CFG_ADB) \
|
--adb-path=$(CFG_ADB) \
|
||||||
--adb-test-dir=$(CFG_ADB_TEST_DIR) \
|
--adb-test-dir=$(CFG_ADB_TEST_DIR) \
|
||||||
|
|
|
@ -64,10 +64,7 @@ pub struct config {
|
||||||
// Run tests using the new runtime
|
// Run tests using the new runtime
|
||||||
newrt: bool,
|
newrt: bool,
|
||||||
|
|
||||||
// Host System to be built
|
// Target system to be tested
|
||||||
host: ~str,
|
|
||||||
|
|
||||||
// Target System to be executed
|
|
||||||
target: ~str,
|
target: ~str,
|
||||||
|
|
||||||
// Extra parameter to run adb on arm-linux-androideabi
|
// Extra parameter to run adb on arm-linux-androideabi
|
||||||
|
@ -76,8 +73,8 @@ pub struct config {
|
||||||
// Extra parameter to run test sute on arm-linux-androideabi
|
// Extra parameter to run test sute on arm-linux-androideabi
|
||||||
adb_test_dir: ~str,
|
adb_test_dir: ~str,
|
||||||
|
|
||||||
// check if can be run or not
|
// status whether android device available or not
|
||||||
flag_runnable: bool,
|
adb_device_status: bool,
|
||||||
|
|
||||||
// Explain what's going on
|
// Explain what's going on
|
||||||
verbose: bool
|
verbose: bool
|
||||||
|
|
|
@ -61,7 +61,6 @@ pub fn parse_config(args: ~[~str]) -> config {
|
||||||
getopts::optopt(~"logfile"),
|
getopts::optopt(~"logfile"),
|
||||||
getopts::optflag(~"jit"),
|
getopts::optflag(~"jit"),
|
||||||
getopts::optflag(~"newrt"),
|
getopts::optflag(~"newrt"),
|
||||||
getopts::optopt(~"host"),
|
|
||||||
getopts::optopt(~"target"),
|
getopts::optopt(~"target"),
|
||||||
getopts::optopt(~"adb-path"),
|
getopts::optopt(~"adb-path"),
|
||||||
getopts::optopt(~"adb-test-dir")
|
getopts::optopt(~"adb-test-dir")
|
||||||
|
@ -98,25 +97,18 @@ pub fn parse_config(args: ~[~str]) -> config {
|
||||||
rustcflags: getopts::opt_maybe_str(matches, ~"rustcflags"),
|
rustcflags: getopts::opt_maybe_str(matches, ~"rustcflags"),
|
||||||
jit: getopts::opt_present(matches, ~"jit"),
|
jit: getopts::opt_present(matches, ~"jit"),
|
||||||
newrt: getopts::opt_present(matches, ~"newrt"),
|
newrt: getopts::opt_present(matches, ~"newrt"),
|
||||||
host: opt_str(getopts::opt_maybe_str(matches, ~"host")),
|
|
||||||
target: opt_str(getopts::opt_maybe_str(matches, ~"target")),
|
target: opt_str(getopts::opt_maybe_str(matches, ~"target")),
|
||||||
adb_path: opt_str(getopts::opt_maybe_str(matches, ~"adb-path")),
|
adb_path: opt_str(getopts::opt_maybe_str(matches, ~"adb-path")),
|
||||||
adb_test_dir: opt_str(getopts::opt_maybe_str(matches, ~"adb-test-dir")),
|
adb_test_dir: opt_str(getopts::opt_maybe_str(matches, ~"adb-test-dir")),
|
||||||
flag_runnable:
|
adb_device_status:
|
||||||
if (getopts::opt_maybe_str(matches, ~"host") ==
|
if (opt_str(getopts::opt_maybe_str(matches, ~"target")) ==
|
||||||
getopts::opt_maybe_str(matches, ~"target")) { true }
|
~"arm-linux-androideabi") {
|
||||||
else {
|
if (opt_str(getopts::opt_maybe_str(matches, ~"adb-test-dir")) !=
|
||||||
match getopts::opt_maybe_str(matches, ~"target") {
|
~"(none)" &&
|
||||||
Some(~"arm-linux-androideabi") => {
|
opt_str(getopts::opt_maybe_str(matches, ~"adb-test-dir")) !=
|
||||||
if (opt_str(getopts::opt_maybe_str(matches, ~"adb-test-dir")) !=
|
~"") { true }
|
||||||
~"(none)" &&
|
else { false }
|
||||||
opt_str(getopts::opt_maybe_str(matches, ~"adb-test-dir")) !=
|
} else { false },
|
||||||
~"") { true }
|
|
||||||
else { false }
|
|
||||||
}
|
|
||||||
_ => { true }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
verbose: getopts::opt_present(matches, ~"verbose")
|
verbose: getopts::opt_present(matches, ~"verbose")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,11 +129,10 @@ pub fn log_config(config: config) {
|
||||||
logv(c, fmt!("rustcflags: %s", opt_str(config.rustcflags)));
|
logv(c, fmt!("rustcflags: %s", opt_str(config.rustcflags)));
|
||||||
logv(c, fmt!("jit: %b", config.jit));
|
logv(c, fmt!("jit: %b", config.jit));
|
||||||
logv(c, fmt!("newrt: %b", config.newrt));
|
logv(c, fmt!("newrt: %b", config.newrt));
|
||||||
logv(c, fmt!("host: %s", config.host));
|
|
||||||
logv(c, fmt!("target: %s", config.target));
|
logv(c, fmt!("target: %s", config.target));
|
||||||
logv(c, fmt!("adb_path: %s", config.adb_path));
|
logv(c, fmt!("adb_path: %s", config.adb_path));
|
||||||
logv(c, fmt!("adb_test_dir: %s", config.adb_test_dir));
|
logv(c, fmt!("adb_test_dir: %s", config.adb_test_dir));
|
||||||
logv(c, fmt!("flag_runnable: %b", config.flag_runnable));
|
logv(c, fmt!("adb_device_status: %b", config.adb_device_status));
|
||||||
logv(c, fmt!("verbose: %b", config.verbose));
|
logv(c, fmt!("verbose: %b", config.verbose));
|
||||||
logv(c, fmt!("\n"));
|
logv(c, fmt!("\n"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,18 +77,19 @@ fn run_rfail_test(config: config, props: TestProps, testfile: &Path) {
|
||||||
fatal_ProcRes(~"run-fail test isn't valgrind-clean!", ProcRes);
|
fatal_ProcRes(~"run-fail test isn't valgrind-clean!", ProcRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.host == config.target) {
|
match config.target {
|
||||||
check_correct_failure_status(ProcRes);
|
|
||||||
check_error_patterns(props, testfile, ProcRes);
|
|
||||||
} else {
|
|
||||||
match (config.target, config.flag_runnable) {
|
|
||||||
|
|
||||||
(~"arm-linux-androideabi", false) => { }
|
~"arm-linux-androideabi" => {
|
||||||
_ => {
|
if (config.adb_device_status) {
|
||||||
check_correct_failure_status(ProcRes);
|
check_correct_failure_status(ProcRes);
|
||||||
check_error_patterns(props, testfile, ProcRes);
|
check_error_patterns(props, testfile, ProcRes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_=> {
|
||||||
|
check_correct_failure_status(ProcRes);
|
||||||
|
check_error_patterns(props, testfile, ProcRes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -494,99 +495,21 @@ fn exec_compiled_test(config: config, props: TestProps,
|
||||||
props.exec_env
|
props.exec_env
|
||||||
};
|
};
|
||||||
|
|
||||||
if (config.host == config.target) {
|
match config.target {
|
||||||
compose_and_run(config, testfile,
|
|
||||||
make_run_args(config, props, testfile),
|
|
||||||
env,
|
|
||||||
config.run_lib_path, None)
|
|
||||||
} else {
|
|
||||||
let args = make_run_args(config, props, testfile);
|
|
||||||
let cmdline = make_cmdline(~"", args.prog, args.args);
|
|
||||||
|
|
||||||
match (config.target, config.flag_runnable) {
|
~"arm-linux-androideabi" => {
|
||||||
|
if (config.adb_device_status) {
|
||||||
(~"arm-linux-androideabi", true) => {
|
_arm_exec_compiled_test(config, props, testfile)
|
||||||
|
} else {
|
||||||
// get bare program string
|
_dummy_exec_compiled_test(config, props, testfile)
|
||||||
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));
|
|
||||||
|
|
||||||
// NOTE: 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 }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
(~"arm-linux-androideabi", false) => {
|
_=> {
|
||||||
match config.mode {
|
compose_and_run(config, testfile,
|
||||||
mode_run_fail => ProcRes {status: 101, stdout: ~"",
|
make_run_args(config, props, testfile),
|
||||||
stderr: ~"", cmdline: cmdline},
|
env,
|
||||||
_ => ProcRes {status: 0, stdout: ~"",
|
config.run_lib_path, None)
|
||||||
stderr: ~"", cmdline: cmdline}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_=> {
|
|
||||||
compose_and_run(config, testfile,
|
|
||||||
make_run_args(config, props, testfile),
|
|
||||||
env,
|
|
||||||
config.run_lib_path, None)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -618,32 +541,16 @@ fn compose_and_run_compiler(
|
||||||
abs_ab.to_str()),
|
abs_ab.to_str()),
|
||||||
auxres);
|
auxres);
|
||||||
}
|
}
|
||||||
if (config.host != config.target)
|
|
||||||
{
|
|
||||||
match (config.target, config.flag_runnable) {
|
|
||||||
|
|
||||||
(~"arm-linux-androideabi", true) => {
|
match config.target {
|
||||||
|
|
||||||
let tstr = aux_output_dir_name(config, testfile).to_str();
|
~"arm-linux-androideabi" => {
|
||||||
|
if (config.adb_device_status) {
|
||||||
for os::list_dir_path(&Path(tstr)).each |file| {
|
_arm_push_aux_shared_library(config, testfile);
|
||||||
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_=> ()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_=> { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -829,3 +736,108 @@ stderr:\n\
|
||||||
io::stdout().write_str(msg);
|
io::stdout().write_str(msg);
|
||||||
fail!();
|
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…
Reference in New Issue