mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-21 17:52:12 +03:00
Introduce pretty-print testing mode to compiletest. Issue #789
This commit is contained in:
+13
@@ -142,6 +142,8 @@ check-stage$(2)-rpass: test/run-pass.stage$(2).out \
|
||||
|
||||
check-stage$(2)-bench: test/bench.stage$(2).out \
|
||||
|
||||
check-stage$(2)-pretty: test/pretty.stage$(2).out \
|
||||
|
||||
CTEST_COMMON_ARGS$(2) := --compile-lib-path stage$(2) \
|
||||
--run-lib-path stage$(2)/lib \
|
||||
--rustc-path stage$(2)/rustc$$(X) \
|
||||
@@ -172,6 +174,11 @@ BENCH_ARGS$(2) := $$(CTEST_COMMON_ARGS$(2)) \
|
||||
--mode run-pass \
|
||||
$$(CTEST_RUNTOOL) \
|
||||
|
||||
PRETTY_ARGS$(2) := $$(CTEST_COMMON_ARGS$(2)) \
|
||||
--src-base $$(S)src/test/run-pass/ \
|
||||
--build-base test/run-pass/ \
|
||||
--mode pretty \
|
||||
|
||||
test/compiletest.stage$(2)$$(X): $$(COMPILETEST_CRATE) \
|
||||
$$(COMPILETEST_INPUTS) \
|
||||
$$(SREQ$(2))
|
||||
@@ -202,6 +209,12 @@ test/bench.stage$(2).out.tmp: test/compiletest.stage$(2)$$(X) \
|
||||
$$(Q)$$(call CFG_RUN_TEST,$$<) $$(BENCH_ARGS$(2))
|
||||
$$(Q)touch $$@
|
||||
|
||||
test/pretty.stage$(2).out.tmp: test/compiletest.stage$(2)$$(X) \
|
||||
$$(RPASS_TESTS)
|
||||
@$$(call E, run: $$<)
|
||||
$$(Q)$$(call CFG_RUN_TEST,$$<) $$(PRETTY_ARGS$(2))
|
||||
$$(Q)touch $$@
|
||||
|
||||
endef
|
||||
|
||||
# Instantiate the template for stage 0, 1, 2, 3
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import std::option;
|
||||
|
||||
tag mode { mode_compile_fail; mode_run_fail; mode_run_pass; }
|
||||
tag mode {
|
||||
mode_compile_fail;
|
||||
mode_run_fail;
|
||||
mode_run_pass;
|
||||
mode_pretty;
|
||||
}
|
||||
|
||||
type config = {
|
||||
// The library paths required for running the compiler
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
import common::mode_run_pass;
|
||||
import common::mode_run_fail;
|
||||
import common::mode_compile_fail;
|
||||
import common::mode_pretty;
|
||||
import common::mode;
|
||||
import util::logv;
|
||||
|
||||
@@ -89,6 +90,7 @@ fn str_mode(s: str) -> mode {
|
||||
"compile-fail" { mode_compile_fail }
|
||||
"run-fail" { mode_run_fail }
|
||||
"run-pass" { mode_run_pass }
|
||||
"pretty" { mode_pretty }
|
||||
_ { fail "invalid mode" }
|
||||
}
|
||||
}
|
||||
@@ -98,6 +100,7 @@ fn mode_str(mode: mode) -> str {
|
||||
mode_compile_fail. { "compile-fail" }
|
||||
mode_run_fail. { "run-fail" }
|
||||
mode_run_pass. { "run-pass" }
|
||||
mode_pretty. { "pretty" }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,11 +139,15 @@ fn is_test(testfile: &str) -> bool {
|
||||
|
||||
fn make_test(cx: &cx, testfile: &str, configport: &port[str]) ->
|
||||
test::test_desc {
|
||||
{name: testfile,
|
||||
{name: make_test_name(cx.config, testfile),
|
||||
fn: make_test_closure(testfile, chan(configport)),
|
||||
ignore: header::is_test_ignored(cx.config.stage_id, testfile)}
|
||||
}
|
||||
|
||||
fn make_test_name(config: &config, testfile: &str) -> str {
|
||||
#fmt("[%s] %s", mode_str(config.mode), testfile)
|
||||
}
|
||||
|
||||
/*
|
||||
So this is kind of crappy:
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
import common::mode_run_pass;
|
||||
import common::mode_run_fail;
|
||||
import common::mode_compile_fail;
|
||||
import common::mode_pretty;
|
||||
import common::cx;
|
||||
import common::config;
|
||||
import header::load_props;
|
||||
@@ -30,6 +31,7 @@ fn run(cx: &cx, testfile: &str) {
|
||||
mode_compile_fail. { run_cfail_test(cx, props, testfile); }
|
||||
mode_run_fail. { run_rfail_test(cx, props, testfile); }
|
||||
mode_run_pass. { run_rpass_test(cx, props, testfile); }
|
||||
mode_pretty. { run_pretty_test(cx, props, testfile); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,6 +74,9 @@ fn run_rpass_test(cx: &cx, props: &test_props, testfile: &str) {
|
||||
if procres.status != 0 { fatal_procres("test run failed!", procres); }
|
||||
}
|
||||
|
||||
fn run_pretty_test(cx: &cx, props: &test_props, testfile: &str) {
|
||||
}
|
||||
|
||||
fn check_error_patterns(props: &test_props, testfile: &str,
|
||||
procres: &procres) {
|
||||
if ivec::is_empty(props.error_patterns) {
|
||||
|
||||
Reference in New Issue
Block a user