compiletest: fix decision rule to run and cleanup
This commit is contained in:
parent
9ecb97ae58
commit
84bdd05acc
3 changed files with 72 additions and 73 deletions
90
mk/tests.mk
90
mk/tests.mk
|
@ -92,48 +92,44 @@ endef
|
||||||
$(foreach target,$(CFG_TARGET_TRIPLES), \
|
$(foreach target,$(CFG_TARGET_TRIPLES), \
|
||||||
$(eval $(call DEF_TARGET_COMMANDS,$(target))))
|
$(eval $(call DEF_TARGET_COMMANDS,$(target))))
|
||||||
|
|
||||||
# Target specific variables
|
# Target platform specific variables
|
||||||
# for arm-linux-androidabi
|
# for arm-linux-androidabi
|
||||||
define DEF_RUNNABLE_STATUS
|
define DEF_ADB_DEVICE_STATUS
|
||||||
CFG_RUNNABLE_$(1)=$(2)
|
CFG_ADB_DEVICE_STATUS=$(1)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(foreach target,$(CFG_TARGET_TRIPLES), \
|
$(foreach target,$(CFG_TARGET_TRIPLES), \
|
||||||
$(if $(findstring $(target),$(CFG_BUILD_TRIPLE)), \
|
$(if $(findstring $(target),"arm-linux-androideabi"), \
|
||||||
$(info check: $(target) test set is runnable \
|
$(if $(findstring adb,$(CFG_ADB)), \
|
||||||
$(eval $(call DEF_RUNNABLE_STATUS,$(target),true))), \
|
$(if $(findstring device,$(shell adb devices 2>/dev/null | grep -E '^[_A-Za-z0-9-]+[[:blank:]]+device')), \
|
||||||
$(if $(findstring $(target),"arm-linux-androideabi"), \
|
$(info check: $(target) test enabled \
|
||||||
$(if $(findstring adb,$(shell which adb)), \
|
$(info check: android device attached) \
|
||||||
$(if $(findstring device,$(shell adb devices 2>/dev/null | grep -E '^[A-Za-z0-9-]+[[:blank:]]+device')), \
|
$(eval $(call DEF_ADB_DEVICE_STATUS, true))), \
|
||||||
$(info check: $(target) test set is runnable \
|
$(info check: $(target) test disabled \
|
||||||
$(info check: adb device attached) \
|
$(info check: android device not attached) \
|
||||||
$(eval $(call DEF_RUNNABLE_STATUS,$(target),true))), \
|
$(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
|
||||||
$(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))) \
|
|
||||||
), \
|
), \
|
||||||
$(info check: $(target) test set is not runnable \
|
$(info check: $(target) test disabled \
|
||||||
$(eval $(call DEF_RUNNABLE_STATUS,$(target),false)) \
|
$(info check: adb not found) \
|
||||||
) \
|
$(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
|
||||||
) \
|
), \
|
||||||
) \
|
) \
|
||||||
)
|
)
|
||||||
|
|
||||||
ifeq ($(CFG_RUNNABLE_arm-linux-androideabi),true)
|
ifeq ($(CFG_ADB_DEVICE_STATUS),true)
|
||||||
CFG_ADB_DEVICE=true
|
CFG_ADB_TEST_DIR=/data/tmp
|
||||||
CFG_ADB_PATH := $(shell which adb)
|
|
||||||
CFG_ADB_TEST_DIR=/system/tmp
|
|
||||||
|
|
||||||
$(info check: device $(CFG_ADB_TEST_DIR) \
|
$(info check: android device test dir $(CFG_ADB_TEST_DIR) ready \
|
||||||
$(shell $(CFG_ADB_PATH) remount 1>/dev/null) \
|
$(shell adb remount 1>/dev/null) \
|
||||||
$(shell $(CFG_ADB_PATH) shell mkdir $(CFG_ADB_TEST_DIR) 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
|
endif
|
||||||
|
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
# Main test targets
|
# 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)): \
|
$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
|
||||||
$(3)/test/$(4)test.stage$(1)-$(2)$$(X_$(2))
|
$(3)/test/$(4)test.stage$(1)-$(2)$$(X_$(2))
|
||||||
@$$(call E, run: $$< via adb)
|
@$$(call E, run: $$< via adb)
|
||||||
@$(CFG_ADB_PATH) push $$< $(CFG_ADB_TEST_DIR)
|
@$(CFG_ADB) push $$< $(CFG_ADB_TEST_DIR)
|
||||||
@$(CFG_ADB_PATH) shell $(CFG_ADB_TEST_DIR)/`echo $$< | sed 's/.*\///'` \
|
@$(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 > \
|
--logfile $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log > \
|
||||||
tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp
|
tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp
|
||||||
@cat 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
|
@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) 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) 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; \
|
@if grep -q "result: ok" tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
|
||||||
then \
|
then \
|
||||||
rm tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
|
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)), \
|
$(if $(findstring $(target),$(CFG_BUILD_TRIPLE)), \
|
||||||
$(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))), \
|
$(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))), \
|
||||||
$(if $(findstring $(target),"arm-linux-androideabi"), \
|
$(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_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_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
|
# Rules for the cfail/rfail/rpass/bench/perf test runner
|
||||||
|
|
||||||
ifeq ($(CFG_ADB_DEVICE),true)
|
|
||||||
|
|
||||||
CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
|
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) \
|
--host $(CFG_BUILD_TRIPLE) \
|
||||||
--target $(2) \
|
--target $(2) \
|
||||||
--adb-path=$(CFG_ADB_PATH) \
|
--adb-path=$(CFG_ADB) \
|
||||||
--adb-test-dir=$(CFG_ADB_TEST_DIR) \
|
--adb-test-dir=$(CFG_ADB_TEST_DIR) \
|
||||||
--rustcflags "$(RUSTC_FLAGS_$(2)) $$(CFG_RUSTC_FLAGS) --target=$(2)" \
|
--rustcflags "$(RUSTC_FLAGS_$(2)) $$(CFG_RUSTC_FLAGS) --target=$(2)" \
|
||||||
$$(CTEST_TESTARGS)
|
$$(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_$(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_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)
|
CTEST_DEPS_rfail_$(1)-T-$(2)-H-$(3) = $$(RFAIL_TESTS)
|
||||||
|
|
|
@ -108,11 +108,13 @@ pub fn parse_config(args: ~[~str]) -> config {
|
||||||
else {
|
else {
|
||||||
match getopts::opt_maybe_str(matches, ~"target") {
|
match getopts::opt_maybe_str(matches, ~"target") {
|
||||||
Some(~"arm-linux-androideabi") => {
|
Some(~"arm-linux-androideabi") => {
|
||||||
if (getopts::opt_maybe_str(matches, ~"adb-path") !=
|
if (opt_str(getopts::opt_maybe_str(matches, ~"adb-test-dir")) !=
|
||||||
option::None) { true }
|
~"(none)" &&
|
||||||
|
opt_str(getopts::opt_maybe_str(matches, ~"adb-test-dir")) !=
|
||||||
|
~"") { true }
|
||||||
else { false }
|
else { false }
|
||||||
}
|
}
|
||||||
_ => { false }
|
_ => { true }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
verbose: getopts::opt_present(matches, ~"verbose")
|
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);
|
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_correct_failure_status(ProcRes);
|
||||||
check_error_patterns(props, testfile, 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),
|
make_run_args(config, props, testfile),
|
||||||
env,
|
env,
|
||||||
config.run_lib_path, None)
|
config.run_lib_path, None)
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
let args = make_run_args(config, props, testfile);
|
let args = make_run_args(config, props, testfile);
|
||||||
let cmdline = make_cmdline(~"", args.prog, args.args);
|
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) {
|
match (config.target, config.flag_runnable) {
|
||||||
|
|
||||||
(~"arm-linux-androideabi", true) => {
|
(~"arm-linux-androideabi", true) => {
|
||||||
|
@ -524,8 +527,8 @@ fn exec_compiled_test(config: config, props: TestProps,
|
||||||
// execute program
|
// execute program
|
||||||
logv(config, fmt!("executing (%s) %s", config.target, cmdline));
|
logv(config, fmt!("executing (%s) %s", config.target, cmdline));
|
||||||
|
|
||||||
// NOTE : adb shell dose not forward to each stdout and stderr of internal result
|
// NOTE: adb shell dose not forward stdout and stderr of internal result
|
||||||
// but forward to stdout only
|
// to stdout and stderr seperately but to stdout only
|
||||||
let mut newargs_out = ~[];
|
let mut newargs_out = ~[];
|
||||||
let mut newargs_err = ~[];
|
let mut newargs_err = ~[];
|
||||||
let subargs = args.args;
|
let subargs = args.args;
|
||||||
|
@ -534,12 +537,11 @@ fn exec_compiled_test(config: config, props: TestProps,
|
||||||
|
|
||||||
let mut newcmd_out = ~"";
|
let mut newcmd_out = ~"";
|
||||||
let mut newcmd_err = ~"";
|
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));
|
config.adb_test_dir, config.adb_test_dir, prog_short));
|
||||||
|
|
||||||
newcmd_err.push_str(fmt!(
|
newcmd_err.push_str(fmt!("LD_LIBRARY_PATH=%s %s/%s",
|
||||||
"LD_LIBRARY_PATH=%s; export LD_LIBRARY_PATH; cd %s; ./%s",
|
|
||||||
config.adb_test_dir, config.adb_test_dir, prog_short));
|
config.adb_test_dir, config.adb_test_dir, prog_short));
|
||||||
|
|
||||||
for vec::each(subargs) |tv| {
|
for vec::each(subargs) |tv| {
|
||||||
|
@ -569,7 +571,22 @@ fn exec_compiled_test(config: config, props: TestProps,
|
||||||
stderr: exe_result_err.out, cmdline: cmdline }
|
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…
Add table
Reference in a new issue