mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
compiletest: fix decision rule to run and cleanup
This commit is contained in:
parent
9ecb97ae58
commit
84bdd05acc
90
mk/tests.mk
90
mk/tests.mk
@ -92,48 +92,44 @@ endef
|
||||
$(foreach target,$(CFG_TARGET_TRIPLES), \
|
||||
$(eval $(call DEF_TARGET_COMMANDS,$(target))))
|
||||
|
||||
# Target specific variables
|
||||
# Target platform specific variables
|
||||
# for arm-linux-androidabi
|
||||
define DEF_RUNNABLE_STATUS
|
||||
CFG_RUNNABLE_$(1)=$(2)
|
||||
define DEF_ADB_DEVICE_STATUS
|
||||
CFG_ADB_DEVICE_STATUS=$(1)
|
||||
endef
|
||||
|
||||
$(foreach target,$(CFG_TARGET_TRIPLES), \
|
||||
$(if $(findstring $(target),$(CFG_BUILD_TRIPLE)), \
|
||||
$(info check: $(target) test set is runnable \
|
||||
$(eval $(call DEF_RUNNABLE_STATUS,$(target),true))), \
|
||||
$(if $(findstring $(target),"arm-linux-androideabi"), \
|
||||
$(if $(findstring adb,$(shell which adb)), \
|
||||
$(if $(findstring device,$(shell adb devices 2>/dev/null | grep -E '^[A-Za-z0-9-]+[[:blank:]]+device')), \
|
||||
$(info check: $(target) test set is runnable \
|
||||
$(info check: adb device attached) \
|
||||
$(eval $(call DEF_RUNNABLE_STATUS,$(target),true))), \
|
||||
$(info check: $(target) test set is not runnable \
|
||||
$(info check: adb device not attached) \
|
||||
$(eval $(call DEF_RUNNABLE_STATUS,$(target),false))) \
|
||||
), \
|
||||
$(info check: $(target) test set is not runnable \
|
||||
$(info check: adb not found) \
|
||||
$(eval $(call DEF_RUNNABLE_STATUS,$(target),false))) \
|
||||
$(if $(findstring $(target),"arm-linux-androideabi"), \
|
||||
$(if $(findstring adb,$(CFG_ADB)), \
|
||||
$(if $(findstring device,$(shell 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 \
|
||||
$(info check: android device not attached) \
|
||||
$(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
|
||||
), \
|
||||
$(info check: $(target) test set is not runnable \
|
||||
$(eval $(call DEF_RUNNABLE_STATUS,$(target),false)) \
|
||||
) \
|
||||
) \
|
||||
$(info check: $(target) test disabled \
|
||||
$(info check: adb not found) \
|
||||
$(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
|
||||
), \
|
||||
) \
|
||||
)
|
||||
|
||||
ifeq ($(CFG_RUNNABLE_arm-linux-androideabi),true)
|
||||
CFG_ADB_DEVICE=true
|
||||
CFG_ADB_PATH := $(shell which adb)
|
||||
CFG_ADB_TEST_DIR=/system/tmp
|
||||
ifeq ($(CFG_ADB_DEVICE_STATUS),true)
|
||||
CFG_ADB_TEST_DIR=/data/tmp
|
||||
|
||||
$(info check: device $(CFG_ADB_TEST_DIR) \
|
||||
$(shell $(CFG_ADB_PATH) remount 1>/dev/null) \
|
||||
$(shell $(CFG_ADB_PATH) shell mkdir $(CFG_ADB_TEST_DIR) 1>/dev/null) \
|
||||
$(info check: android device test dir $(CFG_ADB_TEST_DIR) ready \
|
||||
$(shell adb remount 1>/dev/null) \
|
||||
$(shell adb shell mkdir $(CFG_ADB_TEST_DIR) 1>/dev/null) \
|
||||
$(shell adb push $(CFG_ANDROID_CROSS_PATH)/arm-linux-androideabi/lib/armv7-a/libgnustl_shared.so \
|
||||
$(CFG_ADB_TEST_DIR) 1>/dev/null) \
|
||||
)
|
||||
else
|
||||
CFG_ADB_TEST_DIR=
|
||||
endif
|
||||
|
||||
|
||||
######################################################################
|
||||
# Main test targets
|
||||
######################################################################
|
||||
@ -366,14 +362,15 @@ 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)/test/$(4)test.stage$(1)-$(2)$$(X_$(2))
|
||||
@$$(call E, run: $$< via adb)
|
||||
@$(CFG_ADB_PATH) push $$< $(CFG_ADB_TEST_DIR)
|
||||
@$(CFG_ADB_PATH) shell $(CFG_ADB_TEST_DIR)/`echo $$< | sed 's/.*\///'` \
|
||||
@$(CFG_ADB) push $$< $(CFG_ADB_TEST_DIR)
|
||||
@$(CFG_ADB) shell LD_LIBRARY_PATH=$(CFG_ADB_TEST_DIR) \
|
||||
$(CFG_ADB_TEST_DIR)/`echo $$< | sed 's/.*\///'` \
|
||||
--logfile $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log > \
|
||||
tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp
|
||||
@cat tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp
|
||||
@touch tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
|
||||
@$(CFG_ADB_PATH) pull $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log tmp/
|
||||
@$(CFG_ADB_PATH) shell rm $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
|
||||
@$(CFG_ADB) pull $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log tmp/
|
||||
@$(CFG_ADB) shell rm $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
|
||||
@if grep -q "result: ok" tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
|
||||
then \
|
||||
rm tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
|
||||
@ -400,11 +397,11 @@ $(foreach host,$(CFG_HOST_TRIPLES), \
|
||||
$(if $(findstring $(target),$(CFG_BUILD_TRIPLE)), \
|
||||
$(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))), \
|
||||
$(if $(findstring $(target),"arm-linux-androideabi"), \
|
||||
$(if $(findstring $(CFG_RUNNABLE_arm-linux-androideabi),"true"), \
|
||||
$(if $(findstring $(CFG_ADB_DEVICE_STATUS),"true"), \
|
||||
$(eval $(call DEF_TEST_CRATE_RULES_arm-linux-androideabi,$(stage),$(target),$(host),$(crate))), \
|
||||
$(eval $(call DEF_TEST_CRATE_RULES_null,$(stage),$(target),$(host),$(crate))) \
|
||||
), \
|
||||
$(eval $(call DEF_TEST_CRATE_RULES_null,$(stage),$(target),$(host),$(crate))) \
|
||||
$(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))) \
|
||||
))))))
|
||||
|
||||
|
||||
@ -496,36 +493,19 @@ TEST_SREQ$(1)_T_$(2)_H_$(3) = \
|
||||
|
||||
# Rules for the cfail/rfail/rpass/bench/perf test runner
|
||||
|
||||
ifeq ($(CFG_ADB_DEVICE),true)
|
||||
|
||||
CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
|
||||
--compile-lib-path $$(HLIB$(1)_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/ \
|
||||
--stage-id stage$(1)-$(2) \
|
||||
--host $(CFG_BUILD_TRIPLE) \
|
||||
--target $(2) \
|
||||
--adb-path=$(CFG_ADB_PATH) \
|
||||
--adb-path=$(CFG_ADB) \
|
||||
--adb-test-dir=$(CFG_ADB_TEST_DIR) \
|
||||
--rustcflags "$(RUSTC_FLAGS_$(2)) $$(CFG_RUSTC_FLAGS) --target=$(2)" \
|
||||
$$(CTEST_TESTARGS)
|
||||
|
||||
else
|
||||
|
||||
CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
|
||||
--compile-lib-path $$(HLIB$(1)_H_$(3)) \
|
||||
--run-lib-path $$(TLIB$(1)_T_$(2)_H_$(3)) \
|
||||
--rustc-path $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
|
||||
--aux-base $$(S)src/test/auxiliary/ \
|
||||
--stage-id stage$(1)-$(2) \
|
||||
--host $(CFG_BUILD_TRIPLE) \
|
||||
--target $(2) \
|
||||
--rustcflags "$(RUSTC_FLAGS_$(2)) $$(CFG_RUSTC_FLAGS) --target=$(2)" \
|
||||
$$(CTEST_TESTARGS)
|
||||
|
||||
endif
|
||||
|
||||
CTEST_DEPS_rpass_$(1)-T-$(2)-H-$(3) = $$(RPASS_TESTS)
|
||||
CTEST_DEPS_rpass_full_$(1)-T-$(2)-H-$(3) = $$(RPASS_FULL_TESTS) $$(TLIBRUSTC_DEFAULT$(1)_T_$(2)_H_$(3))
|
||||
CTEST_DEPS_rfail_$(1)-T-$(2)-H-$(3) = $$(RFAIL_TESTS)
|
||||
|
@ -108,11 +108,13 @@ pub fn parse_config(args: ~[~str]) -> config {
|
||||
else {
|
||||
match getopts::opt_maybe_str(matches, ~"target") {
|
||||
Some(~"arm-linux-androideabi") => {
|
||||
if (getopts::opt_maybe_str(matches, ~"adb-path") !=
|
||||
option::None) { true }
|
||||
if (opt_str(getopts::opt_maybe_str(matches, ~"adb-test-dir")) !=
|
||||
~"(none)" &&
|
||||
opt_str(getopts::opt_maybe_str(matches, ~"adb-test-dir")) !=
|
||||
~"") { true }
|
||||
else { false }
|
||||
}
|
||||
_ => { false }
|
||||
_ => { true }
|
||||
}
|
||||
},
|
||||
verbose: getopts::opt_present(matches, ~"verbose")
|
||||
|
@ -77,9 +77,18 @@ fn run_rfail_test(config: config, props: TestProps, testfile: &Path) {
|
||||
fatal_ProcRes(~"run-fail test isn't valgrind-clean!", ProcRes);
|
||||
}
|
||||
|
||||
if (config.flag_runnable) {
|
||||
if (config.host == config.target) {
|
||||
check_correct_failure_status(ProcRes);
|
||||
check_error_patterns(props, testfile, ProcRes);
|
||||
} else {
|
||||
match (config.target, config.flag_runnable) {
|
||||
|
||||
(~"arm-linux-androideabi", false) => { }
|
||||
_ => {
|
||||
check_correct_failure_status(ProcRes);
|
||||
check_error_patterns(props, testfile, ProcRes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -490,16 +499,10 @@ fn exec_compiled_test(config: config, props: TestProps,
|
||||
make_run_args(config, props, testfile),
|
||||
env,
|
||||
config.run_lib_path, None)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
let args = make_run_args(config, props, testfile);
|
||||
let cmdline = make_cmdline(~"", args.prog, args.args);
|
||||
|
||||
let defaultRes = match config.mode {
|
||||
mode_run_fail => ProcRes {status: 101, stdout: ~"", stderr: ~"", cmdline: cmdline},
|
||||
_ => ProcRes {status: 0, stdout: ~"", stderr: ~"", cmdline: cmdline}
|
||||
};
|
||||
|
||||
match (config.target, config.flag_runnable) {
|
||||
|
||||
(~"arm-linux-androideabi", true) => {
|
||||
@ -524,8 +527,8 @@ fn exec_compiled_test(config: config, props: TestProps,
|
||||
// execute program
|
||||
logv(config, fmt!("executing (%s) %s", config.target, cmdline));
|
||||
|
||||
// NOTE : adb shell dose not forward to each stdout and stderr of internal result
|
||||
// but forward to stdout only
|
||||
// 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;
|
||||
@ -534,12 +537,11 @@ fn exec_compiled_test(config: config, props: TestProps,
|
||||
|
||||
let mut newcmd_out = ~"";
|
||||
let mut newcmd_err = ~"";
|
||||
newcmd_out.push_str(fmt!(
|
||||
"LD_LIBRARY_PATH=%s; export LD_LIBRARY_PATH; cd %s; ./%s",
|
||||
|
||||
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; export LD_LIBRARY_PATH; cd %s; ./%s",
|
||||
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| {
|
||||
@ -569,7 +571,22 @@ fn exec_compiled_test(config: config, props: TestProps,
|
||||
stderr: exe_result_err.out, cmdline: cmdline }
|
||||
}
|
||||
}
|
||||
_=> defaultRes
|
||||
|
||||
(~"arm-linux-androideabi", false) => {
|
||||
match config.mode {
|
||||
mode_run_fail => ProcRes {status: 101, stdout: ~"",
|
||||
stderr: ~"", cmdline: cmdline},
|
||||
_ => ProcRes {status: 0, stdout: ~"",
|
||||
stderr: ~"", cmdline: cmdline}
|
||||
}
|
||||
}
|
||||
|
||||
_=> {
|
||||
compose_and_run(config, testfile,
|
||||
make_run_args(config, props, testfile),
|
||||
env,
|
||||
config.run_lib_path, None)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user