# Main test targets
######################################################################
-check: tidy all check-stage2 \
+check: tidy all check-stage2
+ $(S)src/etc/check-summary.py tmp/*.log
-check-full: tidy all check-stage1 check-stage2 check-stage3 \
+check-full: tidy all check-stage1 check-stage2 check-stage3
+ $(S)src/etc/check-summary.py tmp/*.log
# Run the tidy script in multiple parts to avoid huge 'echo' commands
ifdef CFG_NOTIDY
| xargs -n 10 python $(S)src/etc/tidy.py
endif
-
######################################################################
# Extracting tests for docs
######################################################################
check-stage$(1)-T-$(2)-H-$(3)-core-dummy: \
$(3)/test/coretest.stage$(1)-$(2)$$(X)
@$$(call E, run: $$<)
- $$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) $$(TESTARGS)
+ $$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) $$(TESTARGS) \
+ --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-core.log
# Rules for the standard library test runner
check-stage$(1)-T-$(2)-H-$(3)-std-dummy: \
$(3)/test/stdtest.stage$(1)-$(2)$$(X)
@$$(call E, run: $$<)
- $$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) $$(TESTARGS)
+ $$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) $$(TESTARGS) \
+ --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-std.log
# Rules for the rustc test runner
check-stage$(1)-T-$(2)-H-$(3)-rustc-dummy: \
$(3)/test/rustctest.stage$(1)-$(2)$$(X)
@$$(call E, run: $$<)
- $$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) $$(TESTARGS)
+ $$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) $$(TESTARGS) \
+ --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-rustc.log
# Rules for the rustdoc test runner
check-stage$(1)-T-$(2)-H-$(3)-rustdoc-dummy: \
$(3)/test/rustdoctest.stage$(1)-$(2)$$(X)
@$$(call E, run: $$<)
- $$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) $$(TESTARGS)
+ $$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) $$(TESTARGS) \
+ --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-rustdoc.log
# Rules for the cfail/rfail/rpass/bench/perf test runner
$$(CFAIL_TESTS)
@$$(call E, run cfail: $$<)
$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
- $$(CFAIL_ARGS$(1)-T-$(2)-H-$(3))
+ $$(CFAIL_ARGS$(1)-T-$(2)-H-$(3)) \
+ --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-cfail.log
check-stage$(1)-T-$(2)-H-$(3)-rfail-dummy: \
$$(HBIN$(1)_H_$(3))/compiletest$$(X) \
$$(RFAIL_TESTS)
@$$(call E, run rfail: $$<)
$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
- $$(RFAIL_ARGS$(1)-T-$(2)-H-$(3))
+ $$(RFAIL_ARGS$(1)-T-$(2)-H-$(3)) \
+ --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-rfail.log
check-stage$(1)-T-$(2)-H-$(3)-rpass-dummy: \
$$(HBIN$(1)_H_$(3))/compiletest$$(X) \
$$(RPASS_TESTS)
@$$(call E, run rpass: $$<)
$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
- $$(RPASS_ARGS$(1)-T-$(2)-H-$(3))
+ $$(RPASS_ARGS$(1)-T-$(2)-H-$(3)) \
+ --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-rpass.log
check-stage$(1)-T-$(2)-H-$(3)-bench-dummy: \
$$(HBIN$(1)_H_$(3))/compiletest$$(X) \
$$(BENCH_TESTS)
@$$(call E, run bench: $$<)
$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
- $$(BENCH_ARGS$(1)-T-$(2)-H-$(3))
+ $$(BENCH_ARGS$(1)-T-$(2)-H-$(3)) \
+ --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-bench.log
check-stage$(1)-T-$(2)-H-$(3)-perf-dummy: \
$$(HBIN$(1)_H_$(3))/compiletest$$(X) \
$$(BENCH_TESTS)
@$$(call E, perf: $$<)
$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
- $$(PERF_ARGS$(1)-T-$(2)-H-$(3))
+ $$(PERF_ARGS$(1)-T-$(2)-H-$(3)) \
+ --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-perf.log
check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-dummy: \
$$(HBIN$(1)_H_$(3))/compiletest$$(X) \
$$(RPASS_TESTS)
@$$(call E, run pretty-rpass: $$<)
$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
- $$(PRETTY_RPASS_ARGS$(1)-T-$(2)-H-$(3))
+ $$(PRETTY_RPASS_ARGS$(1)-T-$(2)-H-$(3)) \
+ --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass.log
check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail-dummy: \
$$(HBIN$(1)_H_$(3))/compiletest$$(X) \
$$(RFAIL_TESTS)
@$$(call E, run pretty-rfail: $$<)
$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
- $$(PRETTY_RFAIL_ARGS$(1)-T-$(2)-H-$(3))
+ $$(PRETTY_RFAIL_ARGS$(1)-T-$(2)-H-$(3)) \
+ --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail.log
check-stage$(1)-T-$(2)-H-$(3)-pretty-bench-dummy: \
$$(HBIN$(1)_H_$(3))/compiletest$$(X) \
$$(BENCH_TESTS)
@$$(call E, run pretty-bench: $$<)
$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
- $$(PRETTY_BENCH_ARGS$(1)-T-$(2)-H-$(3))
+ $$(PRETTY_BENCH_ARGS$(1)-T-$(2)-H-$(3)) \
+ --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-pretty-bench.log
check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty-dummy: \
$$(HBIN$(1)_H_$(3))/compiletest$$(X) \
$$(PRETTY_TESTS)
@$$(call E, run pretty-pretty: $$<)
$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
- $$(PRETTY_PRETTY_ARGS$(1)-T-$(2)-H-$(3))
+ $$(PRETTY_PRETTY_ARGS$(1)-T-$(2)-H-$(3)) \
+ --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty.log
check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-dummy: \
$$(HBIN$(1)_H_$(3))/compiletest$$(X) \
doc-tutorial-extract$(3)
@$$(call E, run doc-tutorial: $$<)
$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
- $$(DOC_TUTORIAL_ARGS$(1)-T-$(2)-H-$(3))
+ $$(DOC_TUTORIAL_ARGS$(1)-T-$(2)-H-$(3)) \
+ --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial.log
check-stage$(1)-T-$(2)-H-$(3)-doc-ref-dummy: \
$$(HBIN$(1)_H_$(3))/compiletest$$(X) \
doc-ref-extract$(3)
@$$(call E, run doc-ref: $$<)
$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
- $$(DOC_REF_ARGS$(1)-T-$(2)-H-$(3))
+ $$(DOC_REF_ARGS$(1)-T-$(2)-H-$(3)) \
+ --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-doc-ref.log
endef
$(3)/test/$$(FT_DRIVER)-$(2).out: \
$(3)/test/$$(FT_DRIVER)-$(2)$$(X) \
$$(SREQ2_T_$(2)_H_$(3))
- $$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3))
+ $$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) \
+ --logfile tmp/$$(FT_DRIVER)-$(2).log
check-fast-T-$(2)-H-$(3): tidy \
check-stage2-T-$(2)-H-$(3)-rustc \
if !run_tests_console(opts, tests) { fail "Some tests failed"; }
}
-type test_opts = {filter: option<str>, run_ignored: bool};
+type test_opts = {filter: option<str>, run_ignored: bool,
+ logfile: option<str>};
type opt_res = either<test_opts, str>;
// Parses command line arguments into test options
fn parse_opts(args: [str]) -> opt_res {
let args_ = vec::tail(args);
- let opts = [getopts::optflag("ignored")];
+ let opts = [getopts::optflag("ignored"), getopts::optopt("logfile")];
let match =
alt getopts::getopts(args_, opts) {
ok(m) { m }
} else { option::none };
let run_ignored = getopts::opt_present(match, "ignored");
+ let logfile = getopts::opt_maybe_str(match, "logfile");
- let test_opts = {filter: filter, run_ignored: run_ignored};
+ let test_opts = {filter: filter, run_ignored: run_ignored,
+ logfile: logfile};
ret either::left(test_opts);
}
type console_test_state =
@{out: io::writer,
+ log_out: option<io::writer>,
use_color: bool,
mut total: uint,
mut passed: uint,
}
te_wait(test) { st.out.write_str(#fmt["test %s ... ", test.name]); }
te_result(test, result) {
+ alt st.log_out {
+ some(f) {
+ write_log(f, result, test);
+ }
+ none {}
+ }
alt result {
tr_ok {
st.passed += 1u;
}
}
+ let log_out = alt opts.logfile {
+ some(path) {
+ alt io::file_writer(path, [io::create, io::truncate]) {
+ result::ok(w) { some(w) }
+ result::err(s) {
+ fail(#fmt("can't open output file: %s", s))
+ }
+ }
+ }
+ none { none }
+ };
+
let st =
@{out: io::stdout(),
+ log_out: log_out,
use_color: use_color(),
mut total: 0u,
mut passed: 0u,
ret success;
+ fn write_log(out: io::writer, result: test_result, test: test_desc) {
+ out.write_line(#fmt("%s %s",
+ alt result {
+ tr_ok { "ok" }
+ tr_failed { "failed" }
+ tr_ignored { "ignored" }
+ }, test.name));
+ }
+
fn write_ok(out: io::writer, use_color: bool) {
write_pretty(out, "ok", term::color_green, use_color);
}
let st =
@{out: writer,
+ log_out: option::none,
use_color: false,
mut total: 0u,
mut passed: 0u,
// When we run ignored tests the test filter should filter out all the
// unignored tests and flip the ignore flag on the rest to false
- let opts = {filter: option::none, run_ignored: true};
+ let opts = {filter: option::none, run_ignored: true,
+ logfile: option::none};
let tests =
[{name: "1", fn: fn~() { }, ignore: true, should_fail: false},
{name: "2", fn: fn~() { }, ignore: false, should_fail: false}];
#[test]
fn sort_tests() {
- let opts = {filter: option::none, run_ignored: false};
+ let opts = {filter: option::none, run_ignored: false,
+ logfile: option::none};
let names =
["sha1::test", "int::test_to_str", "int::test_pow",