auto merge of #10977 : brson/rust/androidtest, r=brson

#10975

For a while I thought the android test bot was succeeding but it wasn't really testing anything at all.
This commit is contained in:
bors 2013-12-18 20:06:33 -08:00
commit b760ed6573
2 changed files with 93 additions and 116 deletions

View File

@ -133,16 +133,13 @@ $(foreach target,$(CFG_TARGET), \
$(if $(findstring $(target),"arm-linux-androideabi"), \
$(if $(findstring adb,$(CFG_ADB)), \
$(if $(findstring device,$(shell $(CFG_ADB) devices 2>/dev/null | grep -E '^[_A-Za-z0-9-]+[[:blank:]]+device')), \
$(info check: $(target) test enabled \
$(info check: android device attached) \
$(eval $(call DEF_ADB_DEVICE_STATUS, true))), \
$(info check: $(target) test disabled \
$(eval $(call DEF_ADB_DEVICE_STATUS, true)), \
$(info check: android device not attached) \
$(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
$(eval $(call DEF_ADB_DEVICE_STATUS, false)) \
), \
$(info check: $(target) test disabled \
$(info check: adb not found) \
$(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
$(eval $(call DEF_ADB_DEVICE_STATUS, false)) \
), \
) \
)
@ -451,8 +448,8 @@ check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4
$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
$(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
@$$(call E, run: skipped $$< )
@touch $$@
@$$(call E, failing: no device for $$< )
false
endef
$(foreach host,$(CFG_HOST), \

View File

@ -37,6 +37,18 @@ use std::vec;
use extra::test::MetricMap;
pub fn run(config: config, testfile: ~str) {
match config.target {
~"arm-linux-androideabi" => {
if !config.adb_device_status {
fail!("android device not available");
}
}
_=> { }
}
let mut _mm = MetricMap::new();
run_metrics(config, testfile, &mut _mm);
}
@ -99,21 +111,9 @@ fn run_rfail_test(config: &config, props: &TestProps, testfile: &Path) {
fatal_ProcRes(~"run-fail test isn't valgrind-clean!", &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) {
// The value the rust runtime returns on failure
@ -275,7 +275,6 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
let mut ProcArgs;
match config.target {
~"arm-linux-androideabi" => {
if (config.adb_device_status) {
cmds = cmds.replace("run","continue");
@ -290,7 +289,8 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
procsrv::run("", config.adb_path,
[~"push", exe_file.as_str().unwrap().to_owned(), config.adb_test_dir.clone()],
[~"push", exe_file.as_str().unwrap().to_owned(),
config.adb_test_dir.clone()],
~[(~"",~"")], Some(~""))
.expect(format!("failed to exec `{}`", config.adb_path));
@ -304,7 +304,8 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
str::from_utf8(exe_file.filename().unwrap()));
let mut process = procsrv::run_background("", config.adb_path,
[~"shell",adb_arg.clone()],~[(~"",~"")], Some(~""))
[~"shell",adb_arg.clone()],
~[(~"",~"")], Some(~""))
.expect(format!("failed to exec `{}`", config.adb_path));
loop {
//waiting 1 second for gdbserver start
@ -355,7 +356,6 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
cmdline: cmdline};
process.force_destroy();
}
}
_=> {
// write debugger script
@ -662,11 +662,7 @@ fn exec_compiled_test(config: &config, props: &TestProps,
match config.target {
~"arm-linux-androideabi" => {
if (config.adb_device_status) {
_arm_exec_compiled_test(config, props, testfile, env)
} else {
_dummy_exec_compiled_test(config, props, testfile)
}
}
_=> {
@ -710,10 +706,8 @@ fn compose_and_run_compiler(
match config.target {
~"arm-linux-androideabi" => {
if (config.adb_device_status) {
_arm_push_aux_shared_library(config, testfile);
}
}
_=> { }
}
@ -992,20 +986,6 @@ fn _arm_exec_compiled_test(config: &config, props: &TestProps,
}
}
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: process::ExitStatus(101), stdout: ~"",
stderr: ~"", cmdline: cmdline},
_ => ProcRes {status: process::ExitStatus(0), stdout: ~"",
stderr: ~"", cmdline: cmdline}
}
}
fn _arm_push_aux_shared_library(config: &config, testfile: &Path) {
let tdir = aux_output_dir_name(config, testfile);