rust/mk/tests.mk

855 lines
28 KiB
Makefile
Raw Normal View History

# Copyright 2012 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
# option. This file may not be copied, modified, or distributed
# except according to those terms.
2013-02-06 06:14:58 +08:00
2011-05-02 04:18:52 +08:00
######################################################################
2013-02-06 06:14:58 +08:00
# Test variables
2011-05-02 04:18:52 +08:00
######################################################################
2013-02-06 06:14:58 +08:00
# The names of crates that must be tested
TEST_TARGET_CRATES = std extra
TEST_HOST_CRATES = syntax rustc rustdoc rust rustpkg rusti
TEST_CRATES = $(TEST_TARGET_CRATES) $(TEST_HOST_CRATES)
2011-05-02 04:18:52 +08:00
2013-02-06 06:14:58 +08:00
# Markdown files under doc/ that should have their code extracted and run
DOC_TEST_NAMES = tutorial tutorial-ffi tutorial-macros tutorial-borrowed-ptr tutorial-tasks rust
2013-02-06 06:14:58 +08:00
######################################################################
# Environment configuration
######################################################################
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.
2011-07-13 10:01:09 +08:00
# The arguments to all test runners
ifdef TESTNAME
TESTARGS += $(TESTNAME)
endif
ifdef CHECK_XFAILS
TESTARGS += --ignored
endif
CTEST_BENCH = --bench
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.
2011-07-13 10:01:09 +08:00
# Arguments to the cfail/rfail/rpass/bench tests
ifdef CFG_VALGRIND
CTEST_RUNTOOL = --runtool "$(CFG_VALGRIND)"
CTEST_BENCH =
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.
2011-07-13 10:01:09 +08:00
endif
# Arguments to the perf tests
ifdef CFG_PERF_TOOL
CTEST_PERF_RUNTOOL = --runtool "$(CFG_PERF_TOOL)"
endif
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.
2011-07-13 10:01:09 +08:00
CTEST_TESTARGS := $(TESTARGS)
2011-05-02 04:18:52 +08:00
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.
2011-07-13 10:01:09 +08:00
ifdef VERBOSE
CTEST_TESTARGS += --verbose
endif
# If we're running perf then set this environment variable
# to put the benchmarks into 'hard mode'
ifeq ($(MAKECMDGOALS),perf)
RUST_BENCH=1
export RUST_BENCH
endif
TEST_LOG_FILE=tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
TEST_OK_FILE=tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).ok
TEST_RATCHET_FILE=tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4)-metrics.json
TEST_RATCHET_NOISE_PERCENT=10.0
# Whether to ratchet or merely save benchmarks
ifdef CFG_RATCHET_BENCH
CRATE_TEST_BENCH_ARGS=\
--test $(CTEST_BENCH) \
--ratchet-metrics $(call TEST_RATCHET_FILE,$(1),$(2),$(3),$(4)) \
--ratchet-noise-percent $(TEST_RATCHET_NOISE_PERCENT)
else
CRATE_TEST_BENCH_ARGS=\
--test $(CTEST_BENCH) \
--save-metrics $(call TEST_RATCHET_FILE,$(1),$(2),$(3),$(4))
endif
define DEF_TARGET_COMMANDS
ifdef CFG_UNIXY_$(1)
CFG_RUN_TEST_$(1)=$$(call CFG_RUN_$(1),,$$(CFG_VALGRIND) $$(1))
endif
ifdef CFG_WINDOWSY_$(1)
CFG_TESTLIB_$(1)=$$(CFG_BUILD_DIR)/$$(2)/$$(strip \
$$(if $$(findstring stage0,$$(1)), \
stage0/$$(CFG_LIBDIR), \
$$(if $$(findstring stage1,$$(1)), \
stage1/$$(CFG_LIBDIR), \
$$(if $$(findstring stage2,$$(1)), \
stage2/$$(CFG_LIBDIR), \
$$(if $$(findstring stage3,$$(1)), \
stage3/$$(CFG_LIBDIR), \
)))))/rustc/$$(CFG_BUILD_TRIPLE)/$$(CFG_LIBDIR)
CFG_RUN_TEST_$(1)=$$(call CFG_RUN_$(1),$$(call CFG_TESTLIB_$(1),$$(1),$$(3)),$$(1))
endif
# Run the compiletest runner itself under valgrind
ifdef CTEST_VALGRIND
CFG_RUN_CTEST_$(1)=$$(call CFG_RUN_TEST_$$(CFG_BUILD_TRIPLE),$$(2),$$(3))
else
CFG_RUN_CTEST_$(1)=$$(call CFG_RUN_$$(CFG_BUILD_TRIPLE),$$(TLIB$$(1)_T_$$(3)_H_$$(3)),$$(2))
endif
endef
$(foreach target,$(CFG_TARGET_TRIPLES), \
$(eval $(call DEF_TARGET_COMMANDS,$(target))))
2013-05-07 09:09:34 +08:00
# Target platform specific variables
# for arm-linux-androidabi
define DEF_ADB_DEVICE_STATUS
CFG_ADB_DEVICE_STATUS=$(1)
endef
$(foreach target,$(CFG_TARGET_TRIPLES), \
$(if $(findstring $(target),"arm-linux-androideabi"), \
$(if $(findstring adb,$(CFG_ADB)), \
$(if $(findstring device,$(shell adb devices 2>/dev/null | grep -E '^[_A-Za-z0-9-]+[[:blank:]]+device')), \
$(info check: $(target) test enabled \
$(info check: android device attached) \
$(eval $(call DEF_ADB_DEVICE_STATUS, true))), \
$(info check: $(target) test disabled \
$(info check: android device not attached) \
$(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
), \
$(info check: $(target) test disabled \
$(info check: adb not found) \
$(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
), \
) \
)
ifeq ($(CFG_ADB_DEVICE_STATUS),true)
CFG_ADB_TEST_DIR=/data/tmp
$(info check: android device test dir $(CFG_ADB_TEST_DIR) ready \
$(shell adb remount 1>/dev/null) \
$(shell adb shell mkdir $(CFG_ADB_TEST_DIR) 1>/dev/null) \
$(shell adb shell rm -rf $(CFG_ADB_TEST_DIR)/* 1>/dev/null) \
2013-05-29 15:03:14 +08:00
$(shell adb push $(S)src/etc/adb_run_wrapper.sh $(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) \
2013-05-29 15:03:14 +08:00
$(shell adb push $(TLIB2_T_arm-linux-androideabi_H_$(CFG_BUILD_TRIPLE))/$(CFG_RUNTIME_arm-linux-androideabi) \
$(CFG_ADB_TEST_DIR)) \
$(shell adb push $(TLIB2_T_arm-linux-androideabi_H_$(CFG_BUILD_TRIPLE))/$(STDLIB_GLOB_arm-linux-androideabi) \
$(CFG_ADB_TEST_DIR)) \
$(shell adb push $(TLIB2_T_arm-linux-androideabi_H_$(CFG_BUILD_TRIPLE))/$(EXTRALIB_GLOB_arm-linux-androideabi) \
$(CFG_ADB_TEST_DIR)) \
)
else
CFG_ADB_TEST_DIR=
endif
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.
2011-07-13 10:01:09 +08:00
######################################################################
# Main test targets
######################################################################
2013-02-06 06:14:58 +08:00
check: cleantestlibs cleantmptestlogs tidy all check-stage2
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
check-notidy: cleantestlibs cleantmptestlogs all check-stage2
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
check-full: cleantestlibs cleantmptestlogs tidy \
all check-stage1 check-stage2 check-stage3
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
check-test: cleantestlibs cleantmptestlogs all check-stage2-rfail
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
check-lite: cleantestlibs cleantmptestlogs \
check-stage2-std check-stage2-extra check-stage2-rpass \
check-stage2-rustpkg check-stage2-rusti \
2013-02-06 06:14:58 +08:00
check-stage2-rfail check-stage2-cfail
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
.PHONY: cleantmptestlogs cleantestlibs
cleantmptestlogs:
$(Q)rm -f tmp/*.log
cleantestlibs:
$(Q)find $(CFG_BUILD_TRIPLE)/test \
-name '*.[odasS]' -o \
-name '*.so' -o \
-name '*.dylib' -o \
-name '*.dll' -o \
-name '*.def' -o \
-name '*.bc' -o \
-name '*.dSYM' -o \
-name '*.libaux' -o \
-name '*.out' -o \
2013-02-10 02:09:19 +08:00
-name '*.err' -o \
-name '*.debugger.script' \
| xargs rm -rf
2013-02-06 06:14:58 +08:00
######################################################################
# Tidy
######################################################################
ifdef CFG_NOTIDY
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.
2011-07-13 10:01:09 +08:00
tidy:
else
ALL_CS := $(wildcard $(S)src/rt/*.cpp \
$(S)src/rt/*/*.cpp \
$(S)src/rt/*/*/*.cpp \
$(S)srcrustllvm/*.cpp)
ALL_CS := $(filter-out $(S)src/rt/bigint/bigint_ext.cpp \
$(S)src/rt/bigint/bigint_int.cpp \
$(S)src/rt/miniz.cpp \
$(S)src/rt/linenoise/linenoise.c \
2012-11-05 06:35:04 +08:00
$(S)src/rt/linenoise/utf8.c \
,$(ALL_CS))
ALL_HS := $(wildcard $(S)src/rt/*.h \
$(S)src/rt/*/*.h \
$(S)src/rt/*/*/*.h \
$(S)srcrustllvm/*.h)
ALL_HS := $(filter-out $(S)src/rt/vg/valgrind.h \
$(S)src/rt/vg/memcheck.h \
$(S)src/rt/uthash/uthash.h \
$(S)src/rt/uthash/utlist.h \
$(S)src/rt/msvc/typeof.h \
$(S)src/rt/msvc/stdint.h \
$(S)src/rt/msvc/inttypes.h \
$(S)src/rt/bigint/bigint.h \
$(S)src/rt/linenoise/linenoise.h \
2012-11-05 06:35:04 +08:00
$(S)src/rt/linenoise/utf8.h \
,$(ALL_HS))
2013-02-06 06:14:58 +08:00
# Run the tidy script in multiple parts to avoid huge 'echo' commands
tidy:
@$(call E, check: formatting)
$(Q)find $(S)src -name '*.r[sc]' \
| grep '^$(S)src/test' -v \
| xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py
$(Q)find $(S)src/etc -name '*.py' \
| xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py
$(Q)echo $(ALL_CS) \
| xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py
$(Q)echo $(ALL_HS) \
| xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py
endif
2013-02-06 06:14:58 +08:00
2012-01-21 10:05:07 +08:00
######################################################################
2013-02-06 06:14:58 +08:00
# Sets of tests
2012-01-21 10:05:07 +08:00
######################################################################
2013-02-06 06:14:58 +08:00
define DEF_TEST_SETS
check-stage$(1)-T-$(2)-H-$(3)-exec: \
check-stage$(1)-T-$(2)-H-$(3)-rpass-exec \
check-stage$(1)-T-$(2)-H-$(3)-rfail-exec \
check-stage$(1)-T-$(2)-H-$(3)-cfail-exec \
check-stage$(1)-T-$(2)-H-$(3)-rpass-full-exec \
check-stage$(1)-T-$(2)-H-$(3)-crates-exec \
check-stage$(1)-T-$(2)-H-$(3)-bench-exec \
check-stage$(1)-T-$(2)-H-$(3)-debuginfo-exec \
check-stage$(1)-T-$(2)-H-$(3)-codegen-exec \
2013-02-06 06:14:58 +08:00
check-stage$(1)-T-$(2)-H-$(3)-doc-exec \
check-stage$(1)-T-$(2)-H-$(3)-pretty-exec
# Only test the compiler-dependent crates when the target is
# able to build a compiler (when the target triple is in the set of host triples)
ifneq ($$(findstring $(2),$$(CFG_HOST_TRIPLES)),)
2013-02-06 06:14:58 +08:00
check-stage$(1)-T-$(2)-H-$(3)-crates-exec: \
$$(foreach crate,$$(TEST_CRATES), \
check-stage$(1)-T-$(2)-H-$(3)-$$(crate)-exec)
else
check-stage$(1)-T-$(2)-H-$(3)-crates-exec: \
$$(foreach crate,$$(TEST_TARGET_CRATES), \
check-stage$(1)-T-$(2)-H-$(3)-$$(crate)-exec)
endif
2013-02-06 06:14:58 +08:00
check-stage$(1)-T-$(2)-H-$(3)-doc-exec: \
$$(foreach docname,$$(DOC_TEST_NAMES), \
check-stage$(1)-T-$(2)-H-$(3)-doc-$$(docname)-exec)
check-stage$(1)-T-$(2)-H-$(3)-pretty-exec: \
check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-exec \
check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-full-exec \
check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail-exec \
check-stage$(1)-T-$(2)-H-$(3)-pretty-bench-exec \
check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty-exec
2012-01-21 10:05:07 +08:00
endef
$(foreach host,$(CFG_HOST_TRIPLES), \
2013-02-06 06:14:58 +08:00
$(foreach target,$(CFG_TARGET_TRIPLES), \
$(foreach stage,$(STAGES), \
$(eval $(call DEF_TEST_SETS,$(stage),$(target),$(host))))))
2012-01-21 10:05:07 +08:00
######################################################################
2013-02-06 06:14:58 +08:00
# Crate testing
######################################################################
2013-02-06 06:14:58 +08:00
define TEST_RUNNER
2012-01-18 08:45:22 +08:00
# If NO_REBUILD is set then break the dependencies on extra so we can
# test crates without rebuilding std and extra first
ifeq ($(NO_REBUILD),)
STDTESTDEP_$(1)_$(2)_$(3) = $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_EXTRALIB_$(2))
else
STDTESTDEP_$(1)_$(2)_$(3) =
endif
$(3)/stage$(1)/test/stdtest-$(2)$$(X_$(2)): \
$$(STDLIB_CRATE) $$(STDLIB_INPUTS) \
Add dependence arc from running rustc to its libraries. This commit fixes some oversights in the Makefile where rustc could be invoked without some of its dependencies yet in place. (I encountered the problem in practice; its not just theoretical.) As written in Makefile.in, $(STAGE$(1)_T_$(2)_H_$(3)) is the way one writes an invocation of rustc where $(1) is the stage number $(2) is the target triple $(3) is the host triple. (Other uses of the macro may plug in actual values or different parameters in for those three formal parameters.) When you have invocations of $(STAGE...), you need to make sure that its dependences are satisfied; otherwise, if someone is using `make -jN` for certain (large-ish) `N`, one can encounter situations where GNU make attempts to invoke `rustc` before it has actually copied some of its libraries into place, such as libmorestack.a, which causes a link failure when the rustc invocation attempts to link in those libraries. In this case, the main prerequisite to add is TSREQ$(1)_T_$(2)_H_$(3), which is described in Makefile.in as "Prerequisites for using the stageN compiler to build target artifacts" ---- In addition to adding the extra dependences on TSREQ..., I also replaced occurrences of the pattern: TSREQ$(1)_T_$(2)_H_$(3) $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2)) $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_EXTRALIB_$(2)) with: SREQ$(1)_T_$(2)_H_$(3) which is equivalent to the above, as defined in Makefile.in ---- Finally, for the cases where TSREQ was missing in tests.mk, I went ahead and put in a dependence on SREQ rather than just TSREQ, since it was not clear to me how one could expect to compile those cases without stdlib and extralib. (It could well be that I should have gone ahead and done the same in other cases where I saw TSREQ was missing, and put SREQ in those cases as well. But this seemed like a good measure for now, without needing to tax my understanding of the overall makefile infrastructure much further.)
2013-07-16 14:05:18 +08:00
$$(SREQ$(1)_T_$(2)_H_$(3)) \
$$(STDTESTDEP_$(1)_$(2)_$(3))
2012-01-18 08:45:22 +08:00
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
2012-01-18 08:45:22 +08:00
$(3)/stage$(1)/test/extratest-$(2)$$(X_$(2)): \
$$(EXTRALIB_CRATE) $$(EXTRALIB_INPUTS) \
Add dependence arc from running rustc to its libraries. This commit fixes some oversights in the Makefile where rustc could be invoked without some of its dependencies yet in place. (I encountered the problem in practice; its not just theoretical.) As written in Makefile.in, $(STAGE$(1)_T_$(2)_H_$(3)) is the way one writes an invocation of rustc where $(1) is the stage number $(2) is the target triple $(3) is the host triple. (Other uses of the macro may plug in actual values or different parameters in for those three formal parameters.) When you have invocations of $(STAGE...), you need to make sure that its dependences are satisfied; otherwise, if someone is using `make -jN` for certain (large-ish) `N`, one can encounter situations where GNU make attempts to invoke `rustc` before it has actually copied some of its libraries into place, such as libmorestack.a, which causes a link failure when the rustc invocation attempts to link in those libraries. In this case, the main prerequisite to add is TSREQ$(1)_T_$(2)_H_$(3), which is described in Makefile.in as "Prerequisites for using the stageN compiler to build target artifacts" ---- In addition to adding the extra dependences on TSREQ..., I also replaced occurrences of the pattern: TSREQ$(1)_T_$(2)_H_$(3) $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2)) $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_EXTRALIB_$(2)) with: SREQ$(1)_T_$(2)_H_$(3) which is equivalent to the above, as defined in Makefile.in ---- Finally, for the cases where TSREQ was missing in tests.mk, I went ahead and put in a dependence on SREQ rather than just TSREQ, since it was not clear to me how one could expect to compile those cases without stdlib and extralib. (It could well be that I should have gone ahead and done the same in other cases where I saw TSREQ was missing, and put SREQ in those cases as well. But this seemed like a good measure for now, without needing to tax my understanding of the overall makefile infrastructure much further.)
2013-07-16 14:05:18 +08:00
$$(SREQ$(1)_T_$(2)_H_$(3)) \
$$(STDTESTDEP_$(1)_$(2)_$(3))
2011-10-03 08:37:50 +08:00
@$$(call E, compile_and_link: $$@)
2011-11-22 14:45:14 +08:00
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
$(3)/stage$(1)/test/syntaxtest-$(2)$$(X_$(2)): \
$$(LIBSYNTAX_CRATE) $$(LIBSYNTAX_INPUTS) \
Add dependence arc from running rustc to its libraries. This commit fixes some oversights in the Makefile where rustc could be invoked without some of its dependencies yet in place. (I encountered the problem in practice; its not just theoretical.) As written in Makefile.in, $(STAGE$(1)_T_$(2)_H_$(3)) is the way one writes an invocation of rustc where $(1) is the stage number $(2) is the target triple $(3) is the host triple. (Other uses of the macro may plug in actual values or different parameters in for those three formal parameters.) When you have invocations of $(STAGE...), you need to make sure that its dependences are satisfied; otherwise, if someone is using `make -jN` for certain (large-ish) `N`, one can encounter situations where GNU make attempts to invoke `rustc` before it has actually copied some of its libraries into place, such as libmorestack.a, which causes a link failure when the rustc invocation attempts to link in those libraries. In this case, the main prerequisite to add is TSREQ$(1)_T_$(2)_H_$(3), which is described in Makefile.in as "Prerequisites for using the stageN compiler to build target artifacts" ---- In addition to adding the extra dependences on TSREQ..., I also replaced occurrences of the pattern: TSREQ$(1)_T_$(2)_H_$(3) $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2)) $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_EXTRALIB_$(2)) with: SREQ$(1)_T_$(2)_H_$(3) which is equivalent to the above, as defined in Makefile.in ---- Finally, for the cases where TSREQ was missing in tests.mk, I went ahead and put in a dependence on SREQ rather than just TSREQ, since it was not clear to me how one could expect to compile those cases without stdlib and extralib. (It could well be that I should have gone ahead and done the same in other cases where I saw TSREQ was missing, and put SREQ in those cases as well. But this seemed like a good measure for now, without needing to tax my understanding of the overall makefile infrastructure much further.)
2013-07-16 14:05:18 +08:00
$$(SREQ$(1)_T_$(2)_H_$(3)) \
$$(STDTESTDEP_$(1)_$(2)_$(3))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
$(3)/stage$(1)/test/rustctest-$(2)$$(X_$(2)): CFG_COMPILER_TRIPLE = $(2)
$(3)/stage$(1)/test/rustctest-$(2)$$(X_$(2)): \
2013-02-06 06:14:58 +08:00
$$(COMPILER_CRATE) $$(COMPILER_INPUTS) \
Add dependence arc from running rustc to its libraries. This commit fixes some oversights in the Makefile where rustc could be invoked without some of its dependencies yet in place. (I encountered the problem in practice; its not just theoretical.) As written in Makefile.in, $(STAGE$(1)_T_$(2)_H_$(3)) is the way one writes an invocation of rustc where $(1) is the stage number $(2) is the target triple $(3) is the host triple. (Other uses of the macro may plug in actual values or different parameters in for those three formal parameters.) When you have invocations of $(STAGE...), you need to make sure that its dependences are satisfied; otherwise, if someone is using `make -jN` for certain (large-ish) `N`, one can encounter situations where GNU make attempts to invoke `rustc` before it has actually copied some of its libraries into place, such as libmorestack.a, which causes a link failure when the rustc invocation attempts to link in those libraries. In this case, the main prerequisite to add is TSREQ$(1)_T_$(2)_H_$(3), which is described in Makefile.in as "Prerequisites for using the stageN compiler to build target artifacts" ---- In addition to adding the extra dependences on TSREQ..., I also replaced occurrences of the pattern: TSREQ$(1)_T_$(2)_H_$(3) $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2)) $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_EXTRALIB_$(2)) with: SREQ$(1)_T_$(2)_H_$(3) which is equivalent to the above, as defined in Makefile.in ---- Finally, for the cases where TSREQ was missing in tests.mk, I went ahead and put in a dependence on SREQ rather than just TSREQ, since it was not clear to me how one could expect to compile those cases without stdlib and extralib. (It could well be that I should have gone ahead and done the same in other cases where I saw TSREQ was missing, and put SREQ in those cases as well. But this seemed like a good measure for now, without needing to tax my understanding of the overall makefile infrastructure much further.)
2013-07-16 14:05:18 +08:00
$$(SREQ$(1)_T_$(2)_H_$(3)) \
2013-03-02 07:48:11 +08:00
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUSTLLVM_$(2)) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBSYNTAX_$(2))
2011-10-03 08:37:50 +08:00
@$$(call E, compile_and_link: $$@)
2011-11-22 14:45:14 +08:00
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
$(3)/stage$(1)/test/rustpkgtest-$(2)$$(X_$(2)): \
$$(RUSTPKG_LIB) $$(RUSTPKG_INPUTS) \
Add dependence arc from running rustc to its libraries. This commit fixes some oversights in the Makefile where rustc could be invoked without some of its dependencies yet in place. (I encountered the problem in practice; its not just theoretical.) As written in Makefile.in, $(STAGE$(1)_T_$(2)_H_$(3)) is the way one writes an invocation of rustc where $(1) is the stage number $(2) is the target triple $(3) is the host triple. (Other uses of the macro may plug in actual values or different parameters in for those three formal parameters.) When you have invocations of $(STAGE...), you need to make sure that its dependences are satisfied; otherwise, if someone is using `make -jN` for certain (large-ish) `N`, one can encounter situations where GNU make attempts to invoke `rustc` before it has actually copied some of its libraries into place, such as libmorestack.a, which causes a link failure when the rustc invocation attempts to link in those libraries. In this case, the main prerequisite to add is TSREQ$(1)_T_$(2)_H_$(3), which is described in Makefile.in as "Prerequisites for using the stageN compiler to build target artifacts" ---- In addition to adding the extra dependences on TSREQ..., I also replaced occurrences of the pattern: TSREQ$(1)_T_$(2)_H_$(3) $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2)) $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_EXTRALIB_$(2)) with: SREQ$(1)_T_$(2)_H_$(3) which is equivalent to the above, as defined in Makefile.in ---- Finally, for the cases where TSREQ was missing in tests.mk, I went ahead and put in a dependence on SREQ rather than just TSREQ, since it was not clear to me how one could expect to compile those cases without stdlib and extralib. (It could well be that I should have gone ahead and done the same in other cases where I saw TSREQ was missing, and put SREQ in those cases as well. But this seemed like a good measure for now, without needing to tax my understanding of the overall makefile infrastructure much further.)
2013-07-16 14:05:18 +08:00
$$(SREQ$(1)_T_$(2)_H_$(3)) \
2013-03-02 07:48:11 +08:00
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC_$(2))
2013-02-06 06:14:58 +08:00
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
$(3)/stage$(1)/test/rustitest-$(2)$$(X_$(2)): \
2013-02-06 06:14:58 +08:00
$$(RUSTI_LIB) $$(RUSTI_INPUTS) \
Add dependence arc from running rustc to its libraries. This commit fixes some oversights in the Makefile where rustc could be invoked without some of its dependencies yet in place. (I encountered the problem in practice; its not just theoretical.) As written in Makefile.in, $(STAGE$(1)_T_$(2)_H_$(3)) is the way one writes an invocation of rustc where $(1) is the stage number $(2) is the target triple $(3) is the host triple. (Other uses of the macro may plug in actual values or different parameters in for those three formal parameters.) When you have invocations of $(STAGE...), you need to make sure that its dependences are satisfied; otherwise, if someone is using `make -jN` for certain (large-ish) `N`, one can encounter situations where GNU make attempts to invoke `rustc` before it has actually copied some of its libraries into place, such as libmorestack.a, which causes a link failure when the rustc invocation attempts to link in those libraries. In this case, the main prerequisite to add is TSREQ$(1)_T_$(2)_H_$(3), which is described in Makefile.in as "Prerequisites for using the stageN compiler to build target artifacts" ---- In addition to adding the extra dependences on TSREQ..., I also replaced occurrences of the pattern: TSREQ$(1)_T_$(2)_H_$(3) $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2)) $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_EXTRALIB_$(2)) with: SREQ$(1)_T_$(2)_H_$(3) which is equivalent to the above, as defined in Makefile.in ---- Finally, for the cases where TSREQ was missing in tests.mk, I went ahead and put in a dependence on SREQ rather than just TSREQ, since it was not clear to me how one could expect to compile those cases without stdlib and extralib. (It could well be that I should have gone ahead and done the same in other cases where I saw TSREQ was missing, and put SREQ in those cases as well. But this seemed like a good measure for now, without needing to tax my understanding of the overall makefile infrastructure much further.)
2013-07-16 14:05:18 +08:00
$$(SREQ$(1)_T_$(2)_H_$(3)) \
2013-03-02 07:48:11 +08:00
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC_$(2))
2013-02-06 06:14:58 +08:00
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
2012-01-16 09:34:18 +08:00
$(3)/stage$(1)/test/rusttest-$(2)$$(X_$(2)): \
$$(RUST_LIB) $$(RUST_INPUTS) \
Add dependence arc from running rustc to its libraries. This commit fixes some oversights in the Makefile where rustc could be invoked without some of its dependencies yet in place. (I encountered the problem in practice; its not just theoretical.) As written in Makefile.in, $(STAGE$(1)_T_$(2)_H_$(3)) is the way one writes an invocation of rustc where $(1) is the stage number $(2) is the target triple $(3) is the host triple. (Other uses of the macro may plug in actual values or different parameters in for those three formal parameters.) When you have invocations of $(STAGE...), you need to make sure that its dependences are satisfied; otherwise, if someone is using `make -jN` for certain (large-ish) `N`, one can encounter situations where GNU make attempts to invoke `rustc` before it has actually copied some of its libraries into place, such as libmorestack.a, which causes a link failure when the rustc invocation attempts to link in those libraries. In this case, the main prerequisite to add is TSREQ$(1)_T_$(2)_H_$(3), which is described in Makefile.in as "Prerequisites for using the stageN compiler to build target artifacts" ---- In addition to adding the extra dependences on TSREQ..., I also replaced occurrences of the pattern: TSREQ$(1)_T_$(2)_H_$(3) $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2)) $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_EXTRALIB_$(2)) with: SREQ$(1)_T_$(2)_H_$(3) which is equivalent to the above, as defined in Makefile.in ---- Finally, for the cases where TSREQ was missing in tests.mk, I went ahead and put in a dependence on SREQ rather than just TSREQ, since it was not clear to me how one could expect to compile those cases without stdlib and extralib. (It could well be that I should have gone ahead and done the same in other cases where I saw TSREQ was missing, and put SREQ in those cases as well. But this seemed like a good measure for now, without needing to tax my understanding of the overall makefile infrastructure much further.)
2013-07-16 14:05:18 +08:00
$$(SREQ$(1)_T_$(2)_H_$(3)) \
2013-03-02 07:48:11 +08:00
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC_$(2))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
$(3)/stage$(1)/test/rustdoctest-$(2)$$(X_$(2)): \
$$(RUSTDOC_LIB) $$(RUSTDOC_INPUTS) \
Add dependence arc from running rustc to its libraries. This commit fixes some oversights in the Makefile where rustc could be invoked without some of its dependencies yet in place. (I encountered the problem in practice; its not just theoretical.) As written in Makefile.in, $(STAGE$(1)_T_$(2)_H_$(3)) is the way one writes an invocation of rustc where $(1) is the stage number $(2) is the target triple $(3) is the host triple. (Other uses of the macro may plug in actual values or different parameters in for those three formal parameters.) When you have invocations of $(STAGE...), you need to make sure that its dependences are satisfied; otherwise, if someone is using `make -jN` for certain (large-ish) `N`, one can encounter situations where GNU make attempts to invoke `rustc` before it has actually copied some of its libraries into place, such as libmorestack.a, which causes a link failure when the rustc invocation attempts to link in those libraries. In this case, the main prerequisite to add is TSREQ$(1)_T_$(2)_H_$(3), which is described in Makefile.in as "Prerequisites for using the stageN compiler to build target artifacts" ---- In addition to adding the extra dependences on TSREQ..., I also replaced occurrences of the pattern: TSREQ$(1)_T_$(2)_H_$(3) $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2)) $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_EXTRALIB_$(2)) with: SREQ$(1)_T_$(2)_H_$(3) which is equivalent to the above, as defined in Makefile.in ---- Finally, for the cases where TSREQ was missing in tests.mk, I went ahead and put in a dependence on SREQ rather than just TSREQ, since it was not clear to me how one could expect to compile those cases without stdlib and extralib. (It could well be that I should have gone ahead and done the same in other cases where I saw TSREQ was missing, and put SREQ in those cases as well. But this seemed like a good measure for now, without needing to tax my understanding of the overall makefile infrastructure much further.)
2013-07-16 14:05:18 +08:00
$$(SREQ$(1)_T_$(2)_H_$(3)) \
2013-03-02 07:48:11 +08:00
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC_$(2))
2012-01-16 09:34:18 +08:00
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
2013-02-06 06:14:58 +08:00
endef
$(foreach host,$(CFG_HOST_TRIPLES), \
2013-02-06 06:14:58 +08:00
$(eval $(foreach target,$(CFG_TARGET_TRIPLES), \
$(eval $(foreach stage,$(STAGES), \
$(eval $(call TEST_RUNNER,$(stage),$(target),$(host))))))))
define DEF_TEST_CRATE_RULES
check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
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)): \
$(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
2012-01-16 09:34:18 +08:00
@$$(call E, run: $$<)
$$(Q)$$(call CFG_RUN_TEST_$(2),$$<,$(2),$(3)) $$(TESTARGS) \
--logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
$$(call CRATE_TEST_BENCH_ARGS,$(1),$(2),$(3),$(4)) \
&& touch $$@
2013-02-06 06:14:58 +08:00
endef
2012-01-16 09:34:18 +08:00
define DEF_TEST_CRATE_RULES_arm-linux-androideabi
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)): \
$(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
@$$(call E, run: $$< via adb)
@$(CFG_ADB) push $$< $(CFG_ADB_TEST_DIR)
@$(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 > \
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
@$(CFG_ADB) pull $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log tmp/
@$(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; \
then \
rm tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
touch $$@; \
else \
rm tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
exit 101; \
fi
endef
define DEF_TEST_CRATE_RULES_null
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)): \
$(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
@$$(call E, run: skipped $$< )
@touch $$@
endef
$(foreach host,$(CFG_HOST_TRIPLES), \
2013-02-06 06:14:58 +08:00
$(foreach target,$(CFG_TARGET_TRIPLES), \
$(foreach stage,$(STAGES), \
$(foreach crate, $(TEST_CRATES), \
$(if $(findstring $(target),$(CFG_BUILD_TRIPLE)), \
$(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))), \
$(if $(findstring $(target),"arm-linux-androideabi"), \
$(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_null,$(stage),$(target),$(host),$(crate))) \
), \
$(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))) \
2013-05-07 09:09:34 +08:00
))))))
2013-02-06 06:14:58 +08:00
######################################################################
# Rules for the compiletest tests (rpass, rfail, etc.)
######################################################################
RPASS_RC := $(wildcard $(S)src/test/run-pass/*.rc)
RPASS_RS := $(wildcard $(S)src/test/run-pass/*.rs)
RPASS_FULL_RC := $(wildcard $(S)src/test/run-pass-fulldeps/*.rc)
RPASS_FULL_RS := $(wildcard $(S)src/test/run-pass-fulldeps/*.rs)
RFAIL_RC := $(wildcard $(S)src/test/run-fail/*.rc)
RFAIL_RS := $(wildcard $(S)src/test/run-fail/*.rs)
CFAIL_RC := $(wildcard $(S)src/test/compile-fail/*.rc)
CFAIL_RS := $(wildcard $(S)src/test/compile-fail/*.rs)
BENCH_RS := $(wildcard $(S)src/test/bench/*.rs)
PRETTY_RS := $(wildcard $(S)src/test/pretty/*.rs)
2013-02-11 05:35:20 +08:00
DEBUGINFO_RS := $(wildcard $(S)src/test/debug-info/*.rs)
CODEGEN_RS := $(wildcard $(S)src/test/codegen/*.rs)
CODEGEN_CC := $(wildcard $(S)src/test/codegen/*.cc)
2013-02-06 06:14:58 +08:00
# perf tests are the same as bench tests only they run under
# a performance monitor.
PERF_RS := $(wildcard $(S)src/test/bench/*.rs)
2013-02-06 06:14:58 +08:00
RPASS_TESTS := $(RPASS_RC) $(RPASS_RS)
RPASS_FULL_TESTS := $(RPASS_FULL_RC) $(RPASS_FULL_RS)
RFAIL_TESTS := $(RFAIL_RC) $(RFAIL_RS)
CFAIL_TESTS := $(CFAIL_RC) $(CFAIL_RS)
BENCH_TESTS := $(BENCH_RS)
PERF_TESTS := $(PERF_RS)
PRETTY_TESTS := $(PRETTY_RS)
2013-02-10 02:09:19 +08:00
DEBUGINFO_TESTS := $(DEBUGINFO_RS)
CODEGEN_TESTS := $(CODEGEN_RS) $(CODEGEN_CC)
2012-06-03 12:30:26 +08:00
2013-02-06 06:14:58 +08:00
CTEST_SRC_BASE_rpass = run-pass
CTEST_BUILD_BASE_rpass = run-pass
CTEST_MODE_rpass = run-pass
CTEST_RUNTOOL_rpass = $(CTEST_RUNTOOL)
2012-06-03 12:30:26 +08:00
2013-02-06 06:14:58 +08:00
CTEST_SRC_BASE_rpass-full = run-pass-full
CTEST_BUILD_BASE_rpass-full = run-pass-full
CTEST_MODE_rpass-full = run-pass
CTEST_RUNTOOL_rpass-full = $(CTEST_RUNTOOL)
CTEST_SRC_BASE_rfail = run-fail
CTEST_BUILD_BASE_rfail = run-fail
CTEST_MODE_rfail = run-fail
CTEST_RUNTOOL_rfail = $(CTEST_RUNTOOL)
CTEST_SRC_BASE_cfail = compile-fail
CTEST_BUILD_BASE_cfail = compile-fail
CTEST_MODE_cfail = compile-fail
CTEST_RUNTOOL_cfail = $(CTEST_RUNTOOL)
CTEST_SRC_BASE_bench = bench
CTEST_BUILD_BASE_bench = bench
CTEST_MODE_bench = run-pass
CTEST_RUNTOOL_bench = $(CTEST_RUNTOOL)
CTEST_SRC_BASE_perf = bench
CTEST_BUILD_BASE_perf = perf
CTEST_MODE_perf = run-pass
CTEST_RUNTOOL_perf = $(CTEST_PERF_RUNTOOL)
2013-02-10 02:09:19 +08:00
CTEST_SRC_BASE_debuginfo = debug-info
CTEST_BUILD_BASE_debuginfo = debug-info
CTEST_MODE_debuginfo = debug-info
CTEST_RUNTOOL_debuginfo = $(CTEST_RUNTOOL)
CTEST_SRC_BASE_codegen = codegen
CTEST_BUILD_BASE_codegen = codegen
CTEST_MODE_codegen = codegen
CTEST_RUNTOOL_codegen = $(CTEST_RUNTOOL)
ifeq ($(CFG_GDB),)
CTEST_DISABLE_debuginfo = "no gdb found"
endif
ifeq ($(CFG_CLANG),)
CTEST_DISABLE_codegen = "no clang found"
endif
ifeq ($(CFG_OSTYPE),apple-darwin)
CTEST_DISABLE_debuginfo = "gdb on darwing needs root"
endif
2013-02-06 06:14:58 +08:00
define DEF_CTEST_VARS
# All the per-stage build rules you might want to call from the
# command line.
#
# $(1) is the stage number
# $(2) is the target triple to test
# $(3) is the host triple to test
# Prerequisites for compiletest tests
TEST_SREQ$(1)_T_$(2)_H_$(3) = \
$$(HBIN$(1)_H_$(3))/compiletest$$(X_$(3)) \
2013-02-06 06:14:58 +08:00
$$(SREQ$(1)_T_$(2)_H_$(3))
2012-06-03 12:30:26 +08:00
2011-10-03 08:37:50 +08:00
# Rules for the cfail/rfail/rpass/bench/perf test runner
# The tests select when to use debug configuration on their own;
# remove directive, if present, from CFG_RUSTC_FLAGS (issue #7898).
CTEST_RUSTC_FLAGS = $$(subst --cfg debug,,$$(CFG_RUSTC_FLAGS))
2011-11-22 14:45:14 +08:00
CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
2011-11-22 05:11:40 +08:00
--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)) \
--clang-path $(if $(CFG_CLANG),$(CFG_CLANG),clang) \
--llvm-bin-path $(CFG_LLVM_INST_DIR_$(CFG_BUILD_TRIPLE))/bin \
--aux-base $$(S)src/test/auxiliary/ \
2011-11-22 05:11:40 +08:00
--stage-id stage$(1)-$(2) \
--target $(2) \
--adb-path=$(CFG_ADB) \
--adb-test-dir=$(CFG_ADB_TEST_DIR) \
--rustcflags "$(RUSTC_FLAGS_$(2)) $$(CTEST_RUSTC_FLAGS) --target=$(2)" \
2011-11-22 05:11:40 +08:00
$$(CTEST_TESTARGS)
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_rfail_$(1)-T-$(2)-H-$(3) = $$(RFAIL_TESTS)
CTEST_DEPS_cfail_$(1)-T-$(2)-H-$(3) = $$(CFAIL_TESTS)
CTEST_DEPS_bench_$(1)-T-$(2)-H-$(3) = $$(BENCH_TESTS)
CTEST_DEPS_perf_$(1)-T-$(2)-H-$(3) = $$(PERF_TESTS)
2013-02-10 02:09:19 +08:00
CTEST_DEPS_debuginfo_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_TESTS)
CTEST_DEPS_codegen_$(1)-T-$(2)-H-$(3) = $$(CODEGEN_TESTS)
2011-11-22 05:11:40 +08:00
2013-02-06 06:14:58 +08:00
endef
2011-11-22 05:11:40 +08:00
$(foreach host,$(CFG_HOST_TRIPLES), \
2013-02-06 06:14:58 +08:00
$(eval $(foreach target,$(CFG_TARGET_TRIPLES), \
$(eval $(foreach stage,$(STAGES), \
$(eval $(call DEF_CTEST_VARS,$(stage),$(target),$(host))))))))
2011-11-22 05:11:40 +08:00
2013-02-06 06:14:58 +08:00
define DEF_RUN_COMPILETEST
2013-02-06 06:14:58 +08:00
CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4) := \
$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
--src-base $$(S)src/test/$$(CTEST_SRC_BASE_$(4))/ \
--build-base $(3)/test/$$(CTEST_BUILD_BASE_$(4))/ \
--ratchet-metrics $(call TEST_RATCHET_FILE,$(1),$(2),$(3),$(4)) \
2013-02-06 06:14:58 +08:00
--mode $$(CTEST_MODE_$(4)) \
$$(CTEST_RUNTOOL_$(4))
2011-11-22 05:11:40 +08:00
check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
ifeq ($$(CTEST_DISABLE_$(4)),)
$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
2013-02-06 06:14:58 +08:00
$$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
$$(CTEST_DEPS_$(4)_$(1)-T-$(2)-H-$(3))
@$$(call E, run $(4) [$(2)]: $$<)
$$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
2013-02-06 06:14:58 +08:00
$$(CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
--logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
&& touch $$@
2011-11-22 05:11:40 +08:00
else
$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
$$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
$$(CTEST_DEPS_$(4)_$(1)-T-$(2)-H-$(3))
@$$(call E, run $(4) [$(2)]: $$<)
@$$(call E, warning: tests disabled: $$(CTEST_DISABLE_$(4)))
touch $$@
endif
2013-02-06 06:14:58 +08:00
endef
2011-11-22 14:45:14 +08:00
CTEST_NAMES = rpass rpass-full rfail cfail bench perf debuginfo codegen
$(foreach host,$(CFG_HOST_TRIPLES), \
2013-02-06 06:14:58 +08:00
$(eval $(foreach target,$(CFG_TARGET_TRIPLES), \
$(eval $(foreach stage,$(STAGES), \
$(eval $(foreach name,$(CTEST_NAMES), \
$(eval $(call DEF_RUN_COMPILETEST,$(stage),$(target),$(host),$(name))))))))))
PRETTY_NAMES = pretty-rpass pretty-rpass-full pretty-rfail pretty-bench pretty-pretty
PRETTY_DEPS_pretty-rpass = $(RPASS_TESTS)
PRETTY_DEPS_pretty-rpass-full = $(RPASS_FULL_TESTS)
PRETTY_DEPS_pretty-rfail = $(RFAIL_TESTS)
PRETTY_DEPS_pretty-bench = $(BENCH_TESTS)
PRETTY_DEPS_pretty-pretty = $(PRETTY_TESTS)
PRETTY_DIRNAME_pretty-rpass = run-pass
PRETTY_DIRNAME_pretty-rpass-full = run-pass-full
PRETTY_DIRNAME_pretty-rfail = run-fail
PRETTY_DIRNAME_pretty-bench = bench
PRETTY_DIRNAME_pretty-pretty = pretty
define DEF_RUN_PRETTY_TEST
PRETTY_ARGS$(1)-T-$(2)-H-$(3)-$(4) := \
2011-11-22 14:45:14 +08:00
$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
2013-02-06 06:14:58 +08:00
--src-base $$(S)src/test/$$(PRETTY_DIRNAME_$(4))/ \
--build-base $(3)/test/$$(PRETTY_DIRNAME_$(4))/ \
2011-11-22 14:45:14 +08:00
--mode pretty
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)): \
2013-02-06 06:14:58 +08:00
$$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
$$(PRETTY_DEPS_$(4))
@$$(call E, run pretty-rpass [$(2)]: $$<)
$$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
2013-02-06 06:14:58 +08:00
$$(PRETTY_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
--logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
&& touch $$@
2011-11-22 14:45:14 +08:00
2013-02-06 06:14:58 +08:00
endef
2011-11-22 14:45:14 +08:00
$(foreach host,$(CFG_HOST_TRIPLES), \
2013-02-06 06:14:58 +08:00
$(foreach target,$(CFG_TARGET_TRIPLES), \
$(foreach stage,$(STAGES), \
$(foreach pretty-name,$(PRETTY_NAMES), \
$(eval $(call DEF_RUN_PRETTY_TEST,$(stage),$(target),$(host),$(pretty-name)))))))
2012-01-21 10:05:07 +08:00
2013-02-06 06:14:58 +08:00
define DEF_RUN_DOC_TEST
DOC_TEST_ARGS$(1)-T-$(2)-H-$(3)-doc-$(4) := \
2013-02-06 06:14:58 +08:00
$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
--src-base $(3)/test/doc-$(4)/ \
--build-base $(3)/test/doc-$(4)/ \
--mode run-pass
check-stage$(1)-T-$(2)-H-$(3)-doc-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4))
$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)): \
2013-02-06 06:14:58 +08:00
$$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
doc-$(4)-extract$(3)
@$$(call E, run doc-$(4) [$(2)]: $$<)
$$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
$$(DOC_TEST_ARGS$(1)-T-$(2)-H-$(3)-doc-$(4)) \
--logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),doc-$(4)) \
&& touch $$@
2013-02-06 06:14:58 +08:00
endef
$(foreach host,$(CFG_HOST_TRIPLES), \
2013-02-06 06:14:58 +08:00
$(foreach target,$(CFG_TARGET_TRIPLES), \
$(foreach stage,$(STAGES), \
$(foreach docname,$(DOC_TEST_NAMES), \
$(eval $(call DEF_RUN_DOC_TEST,$(stage),$(target),$(host),$(docname)))))))
2013-02-06 06:14:58 +08:00
######################################################################
# Extracting tests for docs
######################################################################
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.
2011-07-13 10:01:09 +08:00
2013-02-06 06:14:58 +08:00
EXTRACT_TESTS := "$(CFG_PYTHON)" $(S)src/etc/extract-tests.py
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.
2011-07-13 10:01:09 +08:00
2013-02-06 06:14:58 +08:00
define DEF_DOC_TEST_HOST
2013-02-06 06:14:58 +08:00
doc-$(2)-extract$(1):
@$$(call E, extract: $(2) tests)
$$(Q)rm -f $(1)/test/doc-$(2)/*.rs
$$(Q)$$(EXTRACT_TESTS) $$(S)doc/$(2).md $(1)/test/doc-$(2)
2013-02-06 06:14:58 +08:00
endef
$(foreach host,$(CFG_HOST_TRIPLES), \
2013-02-06 06:14:58 +08:00
$(foreach docname,$(DOC_TEST_NAMES), \
$(eval $(call DEF_DOC_TEST_HOST,$(host),$(docname)))))
2013-02-06 06:14:58 +08:00
######################################################################
# Shortcut rules
######################################################################
2013-02-06 06:14:58 +08:00
TEST_GROUPS = \
crates \
$(foreach crate,$(TEST_CRATES),$(crate)) \
rpass \
rpass-full \
rfail \
cfail \
bench \
perf \
2013-02-10 02:09:19 +08:00
debuginfo \
codegen \
2013-02-06 06:14:58 +08:00
doc \
$(foreach docname,$(DOC_TEST_NAMES),doc-$(docname)) \
2013-02-06 06:14:58 +08:00
pretty \
pretty-rpass \
pretty-rpass-full \
pretty-rfail \
pretty-bench \
pretty-pretty \
$(NULL)
define DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST
check-stage$(1)-T-$(2)-H-$(3): check-stage$(1)-T-$(2)-H-$(3)-exec
endef
2013-02-06 06:14:58 +08:00
$(foreach stage,$(STAGES), \
$(foreach target,$(CFG_TARGET_TRIPLES), \
$(foreach host,$(CFG_HOST_TRIPLES), \
2013-02-06 06:14:58 +08:00
$(eval $(call DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST,$(stage),$(target),$(host))))))
2013-02-06 06:14:58 +08:00
define DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST_AND_GROUP
check-stage$(1)-T-$(2)-H-$(3)-$(4): check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec
endef
2012-01-21 10:05:07 +08:00
2013-02-06 06:14:58 +08:00
$(foreach stage,$(STAGES), \
$(foreach target,$(CFG_TARGET_TRIPLES), \
$(foreach host,$(CFG_HOST_TRIPLES), \
2013-02-06 06:14:58 +08:00
$(foreach group,$(TEST_GROUPS), \
$(eval $(call DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST_AND_GROUP,$(stage),$(target),$(host),$(group)))))))
2013-02-06 06:14:58 +08:00
define DEF_CHECK_FOR_STAGE
check-stage$(1): check-stage$(1)-H-$$(CFG_BUILD_TRIPLE)
check-stage$(1)-H-all: $$(foreach target,$$(CFG_TARGET_TRIPLES), \
2013-02-06 06:14:58 +08:00
check-stage$(1)-H-$$(target))
endef
2013-02-06 06:14:58 +08:00
$(foreach stage,$(STAGES), \
$(eval $(call DEF_CHECK_FOR_STAGE,$(stage))))
2013-02-06 06:14:58 +08:00
define DEF_CHECK_FOR_STAGE_AND_GROUP
check-stage$(1)-$(2): check-stage$(1)-H-$$(CFG_BUILD_TRIPLE)-$(2)
check-stage$(1)-H-all-$(2): $$(foreach target,$$(CFG_TARGET_TRIPLES), \
2013-02-06 06:14:58 +08:00
check-stage$(1)-H-$$(target)-$(2))
endef
2013-02-06 06:14:58 +08:00
$(foreach stage,$(STAGES), \
$(foreach group,$(TEST_GROUPS), \
$(eval $(call DEF_CHECK_FOR_STAGE_AND_GROUP,$(stage),$(group)))))
2013-02-06 06:14:58 +08:00
define DEF_CHECK_FOR_STAGE_AND_HOSTS
check-stage$(1)-H-$(2): $$(foreach target,$$(CFG_TARGET_TRIPLES), \
2013-02-06 06:14:58 +08:00
check-stage$(1)-T-$$(target)-H-$(2))
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.
2011-07-13 10:01:09 +08:00
endef
2013-02-06 06:14:58 +08:00
$(foreach stage,$(STAGES), \
$(foreach host,$(CFG_HOST_TRIPLES), \
2013-02-06 06:14:58 +08:00
$(eval $(call DEF_CHECK_FOR_STAGE_AND_HOSTS,$(stage),$(host)))))
define DEF_CHECK_FOR_STAGE_AND_HOSTS_AND_GROUP
check-stage$(1)-H-$(2)-$(3): $$(foreach target,$$(CFG_TARGET_TRIPLES), \
2013-02-06 06:14:58 +08:00
check-stage$(1)-T-$$(target)-H-$(2)-$(3))
endef
$(foreach stage,$(STAGES), \
$(foreach host,$(CFG_HOST_TRIPLES), \
2013-02-06 06:14:58 +08:00
$(foreach group,$(TEST_GROUPS), \
$(eval $(call DEF_CHECK_FOR_STAGE_AND_HOSTS_AND_GROUP,$(stage),$(host),$(group))))))
2011-11-29 23:07:25 +08:00
######################################################################
2013-02-06 06:14:58 +08:00
# check-fast rules
2011-11-29 23:07:25 +08:00
######################################################################
2013-02-06 06:14:58 +08:00
FT := run_pass_stage2
FT_LIB := $(call CFG_LIB_NAME_$(CFG_BUILD_TRIPLE),$(FT))
2013-02-06 06:14:58 +08:00
FT_DRIVER := $(FT)_driver
GENERATED += tmp/$(FT).rc tmp/$(FT_DRIVER).rs
2011-11-29 23:07:25 +08:00
2011-11-30 00:03:22 +08:00
tmp/$(FT).rc tmp/$(FT_DRIVER).rs: \
$(RPASS_TESTS) \
2011-11-30 00:03:22 +08:00
$(S)src/etc/combine-tests.py
@$(call E, check: building combined stage2 test runner)
2013-01-03 15:53:05 +08:00
$(Q)$(CFG_PYTHON) $(S)src/etc/combine-tests.py
2011-11-29 23:07:25 +08:00
define DEF_CHECK_FAST_FOR_T_H
# $(1) unused
# $(2) target triple
# $(3) host triple
$$(TLIB2_T_$(2)_H_$(3))/$$(FT_LIB): \
tmp/$$(FT).rc \
$$(SREQ2_T_$(2)_H_$(3))
@$$(call E, compile_and_link: $$@)
2011-11-30 00:03:22 +08:00
$$(STAGE2_T_$(2)_H_$(3)) --lib -o $$@ $$<
2011-11-29 23:07:25 +08:00
$(3)/test/$$(FT_DRIVER)-$(2)$$(X_$(2)): \
2011-11-30 00:03:22 +08:00
tmp/$$(FT_DRIVER).rs \
$$(TLIB2_T_$(2)_H_$(3))/$$(FT_LIB) \
$$(SREQ2_T_$(2)_H_$(3))
@$$(call E, compile_and_link: $$@ $$<)
2012-04-06 13:24:46 +08:00
$$(STAGE2_T_$(2)_H_$(3)) -o $$@ $$<
2011-11-29 23:07:25 +08:00
2011-11-30 00:03:22 +08:00
$(3)/test/$$(FT_DRIVER)-$(2).out: \
$(3)/test/$$(FT_DRIVER)-$(2)$$(X_$(2)) \
2011-11-30 00:03:22 +08:00
$$(SREQ2_T_$(2)_H_$(3))
$$(Q)$$(call CFG_RUN_TEST_$(2),$$<,$(2),$(3)) \
--logfile tmp/$$(FT_DRIVER)-$(2).log
2011-11-29 23:07:25 +08:00
check-fast-T-$(2)-H-$(3): \
2011-11-30 00:03:22 +08:00
$(3)/test/$$(FT_DRIVER)-$(2).out
2011-11-29 23:07:25 +08:00
endef
$(foreach host,$(CFG_HOST_TRIPLES), \
2011-11-29 23:07:25 +08:00
$(eval $(foreach target,$(CFG_TARGET_TRIPLES), \
$(eval $(call DEF_CHECK_FAST_FOR_T_H,,$(target),$(host))))))
check-fast: tidy check-fast-H-$(CFG_BUILD_TRIPLE)
2011-11-29 23:07:25 +08:00
define DEF_CHECK_FAST_FOR_H
check-fast-H-$(1): check-fast-T-$(1)-H-$(1)
endef
2011-11-22 14:45:14 +08:00
$(foreach host,$(CFG_HOST_TRIPLES), \
$(eval $(call DEF_CHECK_FAST_FOR_H,$(host))))