Skip to content

Commit 2573fe7

Browse files
committed
The Big Test Suite Overhaul
This replaces the make-based test runner with a set of Rust-based test runners. I believe that all existing functionality has been preserved. The primary objective is to dogfood the Rust test framework. A few main things happen here: 1) The run-pass/lib-* tests are all moved into src/test/stdtest. This is a standalone test crate intended for all standard library tests. It compiles to build/test/stdtest.stageN. 2) rustc now compiles into yet another build artifact, this one a test runner that runs any tests contained directly in the rustc crate. This allows much more fine-grained unit testing of the compiler. It compiles to build/test/rustctest.stageN. 3) There is a new custom test runner crate at src/test/compiletest that reproduces all the functionality for running the compile-fail, run-fail, run-pass and bench tests while integrating with Rust's test framework. It compiles to build/test/compiletest.stageN. 4) The build rules have been completely changed to use the new test runners, while also being less redundant, following the example of the recent stageN.mk rewrite. It adds two new features to the cfail/rfail/rpass/bench tests: 1) Tests can specify multiple 'error-pattern' directives which must be satisfied in order. 2) Tests can specify a 'compile-flags' directive which will make the test runner provide additional command line arguments to rustc. There are some downsides, the primary being that Rust has to be functioning pretty well just to run _any_ tests, which I imagine will be the source of some frustration when the entire test suite breaks. Will also cause some headaches during porting. Not having individual make rules, each rpass, etc test no longer remembers between runs whether it completed successfully. As a result, it's not possible to incrementally fix multiple tests by just running 'make check', fixing a test, and repeating without re-running all the tests contained in the test runner. Instead you can filter just the tests you want to run by using the TESTNAME environment variable. This also dispenses with the ability to run stage0 tests, but they tended to be broken more often than not anyway.
1 parent e6e53af commit 2573fe7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+958
-742
lines changed

configure

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,7 @@ for i in \
182182
rustllvm \
183183
dl stage0 stage1 stage2 stage3 \
184184
stage0/lib stage1/lib stage2/lib stage3/lib \
185-
test/run-pass test/run-fail test/compile-fail \
186-
test/bench/99-bottles test/bench/shootout test/bench/task-perf
185+
test/run-pass test/run-fail test/compile-fail test/bench
187186
do
188187
make_dir $i
189188
done

mk/clean.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ clean:
3838
$(Q)rm -f rt/$(CFG_RUNTIME)
3939
$(Q)rm -f rt/main.o
4040
$(Q)rm -f rt/main.ll
41+
$(Q)rm -f test/run_pass_stage2.rc test/run_pass_stage2_driver.rs
4142
$(Q)rm -Rf $(PKG_NAME)-*.tar.gz dist
4243
$(Q)rm -f $(foreach ext,o a d bc s exe,$(wildcard stage*/*.$(ext)))
4344
$(Q)rm -Rf $(foreach ext,out out.tmp \

mk/platform.mk

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,24 +63,27 @@ ifneq ($(findstring MINGW,$(CFG_OSTYPE)),)
6363
CFG_WINDOWSY := 1
6464
endif
6565

66-
CFG_TESTLIB=$(CFG_BUILD_DIR)/$(strip \
67-
$(if $(findstring stage0,$(1)), \
68-
stage0/lib, \
69-
$(if $(findstring stage1,$(1)), \
70-
stage1/lib, \
71-
$(if $(findstring stage2,$(1)),\
72-
stage2/lib, \
73-
))))
66+
CFG_TESTLIB=$(CFG_BUILD_DIR)/$(strip \
67+
$(if $(findstring stage0,$(1)), \
68+
stage0/lib, \
69+
$(if $(findstring stage1,$(1)), \
70+
stage1/lib, \
71+
$(if $(findstring stage2,$(1)), \
72+
stage2/lib, \
73+
$(if $(findstring stage3,$(1)), \
74+
stage3/lib, \
75+
)))))
7476

7577
ifdef CFG_UNIXY
7678
CFG_INFO := $(info cfg: unix-y environment)
7779

7880
CFG_PATH_MUNGE := true
7981
CFG_EXE_SUFFIX :=
80-
CFG_RUN_TARG=$(CFG_LDENV)=$(CFG_BUILD_DIR)/$(1) $(2)
81-
CFG_RUN_TEST=\
82-
$(CFG_LDENV)=$(call CFG_TESTLIB,$(1)) \
83-
$(CFG_VALGRIND) $(1)
82+
CFG_LDPATH :=
83+
CFG_RUN=$(CFG_LDENV)=$(1) $(2)
84+
CFG_RUN_TARG=$(call CFG_RUN,$(CFG_BUILD_DIR)/$(1),$(2))
85+
CFG_RUN_TEST=$(call CFG_RUN,$(call CFG_TESTLIB,$(1)),\
86+
$(CFG_VALGRIND) $(1))
8487

8588
ifdef CFG_ENABLE_MINGW_CROSS
8689
CFG_WINDOWSY := 1
@@ -117,8 +120,9 @@ ifdef CFG_WINDOWSY
117120
CFG_DEF_SUFFIX := .def
118121
CFG_LDPATH :=$(CFG_LLVM_BINDIR)
119122
CFG_LDPATH :=$(CFG_LDPATH):$$PATH
120-
CFG_RUN_TEST=PATH="$(CFG_LDPATH):$(call CFG_TESTLIB,$(1))" $(1)
121-
CFG_RUN_TARG=PATH="$(CFG_LDPATH)" $(2)
123+
CFG_RUN=PATH="$(CFG_LDPATH):$(1)" $(2)
124+
CFG_RUN_TARG=$(call CFG_RUN,,$(2))
125+
CFG_RUN_TEST=$(call CFG_RUN,$(call CFG_TESTLIB,$(1)),$(1))
122126

123127
ifndef CFG_ENABLE_MINGW_CROSS
124128
CFG_PATH_MUNGE := $(strip perl -i.bak -p \

0 commit comments

Comments
 (0)