Permalink
Browse files

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.
  • Loading branch information...
1 parent e6e53af commit 2573fe7026eb696841acbba8f3d1c09e2224acf0 @brson brson committed Jul 13, 2011
Showing with 958 additions and 742 deletions.
  1. +1 −2 configure
  2. +1 −0 mk/clean.mk
  3. +18 −14 mk/platform.mk
  4. +166 −325 mk/tests.mk
  5. +3 −2 src/lib/test.rs
  6. 0 src/test/bench/{99-bottles → }/99bob-iter.rs
  7. 0 src/test/bench/{99-bottles → }/99bob-pattern.rs
  8. 0 src/test/bench/{99-bottles → }/99bob-simple.rs
  9. 0 src/test/bench/{99-bottles → }/99bob-tail.rs
  10. 0 src/test/bench/{shootout/ackermann.rs → shootout-ackermann.rs}
  11. 0 src/test/bench/{shootout/binarytrees.rs → shootout-binarytrees.rs}
  12. 0 src/test/bench/{shootout/fannkuchredux.rs → shootout-fannkuchredux.rs}
  13. 0 src/test/bench/{shootout/fasta.rs → shootout-fasta.rs}
  14. 0 src/test/bench/{shootout/fibo.rs → shootout-fibo.rs}
  15. 0 src/test/bench/{shootout/nbody.rs → shootout-nbody.rs}
  16. +0 −2 src/test/bench/{task-perf/pfib.rs → shootout-pfib.rs}
  17. +0 −69 src/test/bench/shootout/pfib.rs
  18. +3 −0 src/test/bench/{task-perf/word-count.rs → task-perf-word-count.rs}
  19. +1 −1 src/test/compile-fail/attr-bad-meta.rs
  20. +1 −1 src/test/compile-fail/binop-bitxor-str.rs
  21. +1 −1 src/test/compile-fail/binop-shift-port.rs
  22. +1 −1 src/test/compile-fail/binop-sub-obj.rs
  23. +1 −1 src/test/compile-fail/ext-after-attrib.rs
  24. +8 −0 src/test/compile-fail/type-mismatch-multiple.rs
  25. +1 −1 src/test/compile-fail/vec-field.rs
  26. +11 −0 src/test/compiletest/compiletest.rc
  27. +529 −0 src/test/compiletest/compiletest.rs
  28. +0 −28 src/test/run-pass/lib-int.rs
  29. +0 −4 src/test/run-pass/lib-option.rs
  30. +0 −90 src/test/run-pass/lib-sha1.rs
  31. +10 −0 src/test/run-pass/test-runner-hides-main.rs
  32. +6 −8 src/test/{run-pass/lib-bitv.rs → stdtest/bitv.rs}
  33. +2 −1 src/test/{run-pass/lib-box.rs → stdtest/box.rs}
  34. +3 −5 src/test/{run-pass/lib-deque.rs → stdtest/deque.rs}
  35. +12 −17 src/test/{run-pass/lib-either.rs → stdtest/either.rs}
  36. +2 −4 src/test/{run-pass/lib-fs.rs → stdtest/fs.rs}
  37. +35 −37 src/test/{run-pass/lib-getopts.rs → stdtest/getopts.rs}
  38. +2 −0 src/test/stdtest/int.rs
  39. +3 −4 src/test/{run-pass/lib-io.rs → stdtest/io.rs}
  40. +18 −33 src/test/{run-pass/lib-ivec.rs → stdtest/ivec.rs}
  41. +6 −8 src/test/{run-pass/lib-list.rs → stdtest/list.rs}
  42. +5 −8 src/test/{run-pass/lib-map.rs → stdtest/map.rs}
  43. +5 −0 src/test/stdtest/option.rs
  44. +0 −10 src/test/{run-pass/lib-os.rs → stdtest/os.rs}
  45. +2 −2 src/test/{run-pass/lib-path.rs → stdtest/path.rs}
  46. +2 −3 src/test/{run-pass/lib-ptr.rs → stdtest/ptr.rs}
  47. +24 −1 src/test/{run-pass/lib-qsort.rs → stdtest/qsort.rs}
  48. +2 −1 src/test/{run-pass/lib-qsort3.rs → stdtest/qsort3.rs}
  49. +2 −1 src/test/{run-pass/lib-rand.rs → stdtest/rand.rs}
  50. +4 −8 src/test/{run-pass/lib-run.rs → stdtest/run.rs}
  51. +5 −0 src/test/stdtest/sha1.rs
  52. +2 −1 src/test/{run-pass/lib-sort.rs → stdtest/sort.rs}
  53. +2 −2 src/test/{run-pass/lib-sort-ivec.rs → stdtest/sort_ivec.rs}
  54. +28 −1 src/test/stdtest/stdtest.rc
  55. +13 −19 src/test/{run-pass/lib-str.rs → stdtest/str.rs}
  56. +2 −1 src/test/{run-pass/lib-str-buf.rs → stdtest/str_buf.rs}
  57. +4 −11 src/test/{run-pass/lib-task.rs → stdtest/task.rs}
  58. +2 −1 src/test/{run-pass/lib-uint.rs → stdtest/uint.rs}
  59. +8 −11 src/test/{run-pass/lib-vec.rs → stdtest/vec.rs}
  60. +1 −2 src/test/{run-pass/lib-vec-str-conversions.rs → stdtest/vec_str_conversions.rs}
View
@@ -182,8 +182,7 @@ for i in \
rustllvm \
dl stage0 stage1 stage2 stage3 \
stage0/lib stage1/lib stage2/lib stage3/lib \
- test/run-pass test/run-fail test/compile-fail \
- test/bench/99-bottles test/bench/shootout test/bench/task-perf
+ test/run-pass test/run-fail test/compile-fail test/bench
do
make_dir $i
done
View
@@ -38,6 +38,7 @@ clean:
$(Q)rm -f rt/$(CFG_RUNTIME)
$(Q)rm -f rt/main.o
$(Q)rm -f rt/main.ll
+ $(Q)rm -f test/run_pass_stage2.rc test/run_pass_stage2_driver.rs
$(Q)rm -Rf $(PKG_NAME)-*.tar.gz dist
$(Q)rm -f $(foreach ext,o a d bc s exe,$(wildcard stage*/*.$(ext)))
$(Q)rm -Rf $(foreach ext,out out.tmp \
View
@@ -63,24 +63,27 @@ ifneq ($(findstring MINGW,$(CFG_OSTYPE)),)
CFG_WINDOWSY := 1
endif
-CFG_TESTLIB=$(CFG_BUILD_DIR)/$(strip \
- $(if $(findstring stage0,$(1)), \
- stage0/lib, \
- $(if $(findstring stage1,$(1)), \
- stage1/lib, \
- $(if $(findstring stage2,$(1)),\
- stage2/lib, \
- ))))
+CFG_TESTLIB=$(CFG_BUILD_DIR)/$(strip \
+ $(if $(findstring stage0,$(1)), \
+ stage0/lib, \
+ $(if $(findstring stage1,$(1)), \
+ stage1/lib, \
+ $(if $(findstring stage2,$(1)), \
+ stage2/lib, \
+ $(if $(findstring stage3,$(1)), \
+ stage3/lib, \
+ )))))
ifdef CFG_UNIXY
CFG_INFO := $(info cfg: unix-y environment)
CFG_PATH_MUNGE := true
CFG_EXE_SUFFIX :=
- CFG_RUN_TARG=$(CFG_LDENV)=$(CFG_BUILD_DIR)/$(1) $(2)
- CFG_RUN_TEST=\
- $(CFG_LDENV)=$(call CFG_TESTLIB,$(1)) \
- $(CFG_VALGRIND) $(1)
+ CFG_LDPATH :=
+ CFG_RUN=$(CFG_LDENV)=$(1) $(2)
+ CFG_RUN_TARG=$(call CFG_RUN,$(CFG_BUILD_DIR)/$(1),$(2))
+ CFG_RUN_TEST=$(call CFG_RUN,$(call CFG_TESTLIB,$(1)),\
+ $(CFG_VALGRIND) $(1))
ifdef CFG_ENABLE_MINGW_CROSS
CFG_WINDOWSY := 1
@@ -117,8 +120,9 @@ ifdef CFG_WINDOWSY
CFG_DEF_SUFFIX := .def
CFG_LDPATH :=$(CFG_LLVM_BINDIR)
CFG_LDPATH :=$(CFG_LDPATH):$$PATH
- CFG_RUN_TEST=PATH="$(CFG_LDPATH):$(call CFG_TESTLIB,$(1))" $(1)
- CFG_RUN_TARG=PATH="$(CFG_LDPATH)" $(2)
+ CFG_RUN=PATH="$(CFG_LDPATH):$(1)" $(2)
+ CFG_RUN_TARG=$(call CFG_RUN,,$(2))
+ CFG_RUN_TEST=$(call CFG_RUN,$(call CFG_TESTLIB,$(1)),$(1))
ifndef CFG_ENABLE_MINGW_CROSS
CFG_PATH_MUNGE := $(strip perl -i.bak -p \
Oops, something went wrong.

0 comments on commit 2573fe7

Please sign in to comment.