2012-12-11 09:32:48 +08:00
|
|
|
# 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
|
2014-01-25 11:27:22 +08:00
|
|
|
TEST_TARGET_CRATES = $(TARGET_CRATES)
|
|
|
|
TEST_DOC_CRATES = $(DOC_CRATES)
|
|
|
|
TEST_HOST_CRATES = $(HOST_CRATES)
|
2013-02-22 08:15:01 +08:00
|
|
|
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
|
2013-09-28 08:03:34 +08:00
|
|
|
DOC_TEST_NAMES = tutorial guide-ffi guide-macros guide-lifetimes \
|
Remove std::condition
This has been a long time coming. Conditions in rust were initially envisioned
as being a good alternative to error code return pattern. The idea is that all
errors are fatal-by-default, and you can opt-in to handling the error by
registering an error handler.
While sounding nice, conditions ended up having some unforseen shortcomings:
* Actually handling an error has some very awkward syntax:
let mut result = None;
let mut answer = None;
io::io_error::cond.trap(|e| { result = Some(e) }).inside(|| {
answer = Some(some_io_operation());
});
match result {
Some(err) => { /* hit an I/O error */ }
None => {
let answer = answer.unwrap();
/* deal with the result of I/O */
}
}
This pattern can certainly use functions like io::result, but at its core
actually handling conditions is fairly difficult
* The "zero value" of a function is often confusing. One of the main ideas
behind using conditions was to change the signature of I/O functions. Instead
of read_be_u32() returning a result, it returned a u32. Errors were notified
via a condition, and if you caught the condition you understood that the "zero
value" returned is actually a garbage value. These zero values are often
difficult to understand, however.
One case of this is the read_bytes() function. The function takes an integer
length of the amount of bytes to read, and returns an array of that size. The
array may actually be shorter, however, if an error occurred.
Another case is fs::stat(). The theoretical "zero value" is a blank stat
struct, but it's a little awkward to create and return a zero'd out stat
struct on a call to stat().
In general, the return value of functions that can raise error are much more
natural when using a Result as opposed to an always-usable zero-value.
* Conditions impose a necessary runtime requirement on *all* I/O. In theory I/O
is as simple as calling read() and write(), but using conditions imposed the
restriction that a rust local task was required if you wanted to catch errors
with I/O. While certainly an surmountable difficulty, this was always a bit of
a thorn in the side of conditions.
* Functions raising conditions are not always clear that they are raising
conditions. This suffers a similar problem to exceptions where you don't
actually know whether a function raises a condition or not. The documentation
likely explains, but if someone retroactively adds a condition to a function
there's nothing forcing upstream users to acknowledge a new point of task
failure.
* Libaries using I/O are not guaranteed to correctly raise on conditions when an
error occurs. In developing various I/O libraries, it's much easier to just
return `None` from a read rather than raising an error. The silent contract of
"don't raise on EOF" was a little difficult to understand and threw a wrench
into the answer of the question "when do I raise a condition?"
Many of these difficulties can be overcome through documentation, examples, and
general practice. In the end, all of these difficulties added together ended up
being too overwhelming and improving various aspects didn't end up helping that
much.
A result-based I/O error handling strategy also has shortcomings, but the
cognitive burden is much smaller. The tooling necessary to make this strategy as
usable as conditions were is much smaller than the tooling necessary for
conditions.
Perhaps conditions may manifest themselves as a future entity, but for now
we're going to remove them from the standard library.
Closes #9795
Closes #8968
2014-02-05 11:02:10 +08:00
|
|
|
guide-tasks guide-container guide-pointers \
|
2014-01-11 08:34:55 +08:00
|
|
|
complement-cheatsheet guide-runtime \
|
2013-09-28 08:03:34 +08:00
|
|
|
rust
|
2011-09-14 06:06:21 +08:00
|
|
|
|
2013-02-06 06:14:58 +08:00
|
|
|
######################################################################
|
|
|
|
# Environment configuration
|
|
|
|
######################################################################
|
2011-06-30 06:12:02 +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
|
|
|
# The arguments to all test runners
|
|
|
|
ifdef TESTNAME
|
|
|
|
TESTARGS += $(TESTNAME)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef CHECK_XFAILS
|
|
|
|
TESTARGS += --ignored
|
|
|
|
endif
|
|
|
|
|
2013-07-30 03:38:12 +08:00
|
|
|
TEST_BENCH = --bench
|
2013-07-18 02:52:21 +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
|
|
|
# Arguments to the cfail/rfail/rpass/bench tests
|
|
|
|
ifdef CFG_VALGRIND
|
|
|
|
CTEST_RUNTOOL = --runtool "$(CFG_VALGRIND)"
|
2013-07-30 03:38:12 +08:00
|
|
|
TEST_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
|
2011-06-30 06:12:02 +08:00
|
|
|
|
2013-07-30 03:43:45 +08:00
|
|
|
ifdef NO_BENCH
|
|
|
|
TEST_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
|
2011-06-30 06:12:02 +08:00
|
|
|
|
2011-09-14 06:06:21 +08:00
|
|
|
# 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
|
2011-05-05 08:32:05 +08:00
|
|
|
|
2012-05-24 13:53:50 +08:00
|
|
|
# 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
|
|
|
|
|
2013-02-06 12:05:00 +08:00
|
|
|
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
|
2012-05-24 13:53:50 +08:00
|
|
|
|
2013-07-16 09:52:08 +08:00
|
|
|
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
|
2013-08-24 06:30:23 +08:00
|
|
|
CRATE_TEST_EXTRA_ARGS=\
|
2013-07-30 03:38:12 +08:00
|
|
|
--test $(TEST_BENCH) \
|
2013-07-16 09:52:08 +08:00
|
|
|
--ratchet-metrics $(call TEST_RATCHET_FILE,$(1),$(2),$(3),$(4)) \
|
|
|
|
--ratchet-noise-percent $(TEST_RATCHET_NOISE_PERCENT)
|
|
|
|
else
|
2013-08-24 06:30:23 +08:00
|
|
|
CRATE_TEST_EXTRA_ARGS=\
|
2013-07-30 03:38:12 +08:00
|
|
|
--test $(TEST_BENCH) \
|
2013-07-16 09:52:08 +08:00
|
|
|
--save-metrics $(call TEST_RATCHET_FILE,$(1),$(2),$(3),$(4))
|
|
|
|
endif
|
|
|
|
|
2013-08-24 06:30:23 +08:00
|
|
|
# If we're sharding the testsuite between parallel testers,
|
|
|
|
# pass this argument along to the compiletest and crate test
|
|
|
|
# invocations.
|
|
|
|
ifdef TEST_SHARD
|
|
|
|
CTEST_TESTARGS += --test-shard=$(TEST_SHARD)
|
|
|
|
CRATE_TEST_EXTRA_ARGS += --test-shard=$(TEST_SHARD)
|
|
|
|
endif
|
|
|
|
|
2013-03-02 20:25:12 +08:00
|
|
|
define DEF_TARGET_COMMANDS
|
|
|
|
|
|
|
|
ifdef CFG_UNIXY_$(1)
|
|
|
|
CFG_RUN_TEST_$(1)=$$(call CFG_RUN_$(1),,$$(CFG_VALGRIND) $$(1))
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef CFG_WINDOWSY_$(1)
|
2013-11-30 09:09:10 +08:00
|
|
|
CFG_TESTLIB_$(1)=$$(CFG_BUILD_DIR)$$(2)/$$(strip \
|
2013-03-02 20:25:12 +08:00
|
|
|
$$(if $$(findstring stage0,$$(1)), \
|
2014-01-14 08:45:33 +08:00
|
|
|
stage0/$$(CFG_LIBDIR_RELATIVE), \
|
2013-03-02 20:25:12 +08:00
|
|
|
$$(if $$(findstring stage1,$$(1)), \
|
2014-01-14 08:45:33 +08:00
|
|
|
stage1/$$(CFG_LIBDIR_RELATIVE), \
|
2013-03-02 20:25:12 +08:00
|
|
|
$$(if $$(findstring stage2,$$(1)), \
|
2014-01-14 08:45:33 +08:00
|
|
|
stage2/$$(CFG_LIBDIR_RELATIVE), \
|
2013-03-02 20:25:12 +08:00
|
|
|
$$(if $$(findstring stage3,$$(1)), \
|
2014-01-14 08:45:33 +08:00
|
|
|
stage3/$$(CFG_LIBDIR_RELATIVE), \
|
2014-01-08 00:51:15 +08:00
|
|
|
)))))/$$(CFG_RUSTLIBDIR)/$$(CFG_BUILD)/lib
|
2013-03-02 20:25:12 +08:00
|
|
|
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
|
2014-02-08 08:04:57 +08:00
|
|
|
CFG_RUN_CTEST_$(1)=$$(RPATH_VAR$$(1)_T_$$(3)_H_$$(3)) \
|
|
|
|
$$(call CFG_RUN_TEST_$$(CFG_BUILD),$$(2),$$(3))
|
2013-03-02 20:25:12 +08:00
|
|
|
else
|
2014-02-08 08:04:57 +08:00
|
|
|
CFG_RUN_CTEST_$(1)=$$(RPATH_VAR$$(1)_T_$$(3)_H_$$(3)) \
|
|
|
|
$$(call CFG_RUN_$$(CFG_BUILD),$$(TLIB$$(1)_T_$$(3)_H_$$(3)),$$(2))
|
2013-03-02 20:25:12 +08:00
|
|
|
endif
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
2013-10-21 17:18:21 +08:00
|
|
|
$(foreach target,$(CFG_TARGET), \
|
2013-03-02 20:25:12 +08:00
|
|
|
$(eval $(call DEF_TARGET_COMMANDS,$(target))))
|
|
|
|
|
2013-05-07 09:09:34 +08:00
|
|
|
# Target platform specific variables
|
2013-05-01 17:50:23 +08:00
|
|
|
# for arm-linux-androidabi
|
2013-05-03 23:49:18 +08:00
|
|
|
define DEF_ADB_DEVICE_STATUS
|
|
|
|
CFG_ADB_DEVICE_STATUS=$(1)
|
2013-05-01 17:50:23 +08:00
|
|
|
endef
|
|
|
|
|
2013-10-21 17:18:21 +08:00
|
|
|
$(foreach target,$(CFG_TARGET), \
|
2013-05-03 23:49:18 +08:00
|
|
|
$(if $(findstring $(target),"arm-linux-androideabi"), \
|
|
|
|
$(if $(findstring adb,$(CFG_ADB)), \
|
2014-01-04 16:36:02 +08:00
|
|
|
$(if $(findstring device,$(shell $(CFG_ADB) devices 2>/dev/null | grep -E '^[:_A-Za-z0-9-]+[[:blank:]]+device')), \
|
2013-12-15 14:42:01 +08:00
|
|
|
$(info check: android device attached) \
|
|
|
|
$(eval $(call DEF_ADB_DEVICE_STATUS, true)), \
|
|
|
|
$(info check: android device not attached) \
|
|
|
|
$(eval $(call DEF_ADB_DEVICE_STATUS, false)) \
|
2013-05-01 17:50:23 +08:00
|
|
|
), \
|
2013-12-15 14:42:01 +08:00
|
|
|
$(info check: adb not found) \
|
|
|
|
$(eval $(call DEF_ADB_DEVICE_STATUS, false)) \
|
2013-05-03 23:49:18 +08:00
|
|
|
), \
|
2013-05-01 17:50:23 +08:00
|
|
|
) \
|
|
|
|
)
|
|
|
|
|
2013-05-03 23:49:18 +08:00
|
|
|
ifeq ($(CFG_ADB_DEVICE_STATUS),true)
|
|
|
|
CFG_ADB_TEST_DIR=/data/tmp
|
2013-05-01 17:50:23 +08:00
|
|
|
|
2013-05-03 23:49:18 +08:00
|
|
|
$(info check: android device test dir $(CFG_ADB_TEST_DIR) ready \
|
2014-01-04 16:36:02 +08:00
|
|
|
$(shell $(CFG_ADB) remount 1>/dev/null) \
|
|
|
|
$(shell $(CFG_ADB) shell rm -r $(CFG_ADB_TEST_DIR) >/dev/null) \
|
|
|
|
$(shell $(CFG_ADB) shell mkdir $(CFG_ADB_TEST_DIR)) \
|
|
|
|
$(shell $(CFG_ADB) shell mkdir $(CFG_ADB_TEST_DIR)/tmp) \
|
|
|
|
$(shell $(CFG_ADB) push $(S)src/etc/adb_run_wrapper.sh $(CFG_ADB_TEST_DIR) 1>/dev/null) \
|
2014-01-29 15:29:38 +08:00
|
|
|
$(foreach crate,$(TARGET_CRATES),\
|
|
|
|
$(shell $(CFG_ADB) push $(TLIB2_T_arm-linux-androideabi_H_$(CFG_BUILD))/$(call CFG_LIB_GLOB_arm-linux-androideabi,$(crate)) \
|
|
|
|
$(CFG_ADB_TEST_DIR)))\
|
2013-05-01 17:50:23 +08:00
|
|
|
)
|
2013-05-03 23:49:18 +08:00
|
|
|
else
|
|
|
|
CFG_ADB_TEST_DIR=
|
2013-05-01 17:50:23 +08:00
|
|
|
endif
|
2013-03-02 20:25:12 +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
|
|
|
######################################################################
|
|
|
|
# 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 \
|
2014-02-04 07:53:43 +08:00
|
|
|
$(foreach crate,$(TARGET_CRATES),check-stage2-$(crate)) \
|
|
|
|
check-stage2-rpass \
|
2013-11-17 09:07:32 +08:00
|
|
|
check-stage2-rfail check-stage2-cfail check-stage2-rmake
|
2013-02-06 06:14:58 +08:00
|
|
|
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
|
|
|
|
|
2012-04-05 08:57:36 +08:00
|
|
|
.PHONY: cleantmptestlogs cleantestlibs
|
|
|
|
|
2012-04-05 04:40:50 +08:00
|
|
|
cleantmptestlogs:
|
|
|
|
$(Q)rm -f tmp/*.log
|
2011-05-05 08:32:05 +08:00
|
|
|
|
2012-04-05 08:57:36 +08:00
|
|
|
cleantestlibs:
|
2013-10-21 17:18:21 +08:00
|
|
|
$(Q)find $(CFG_BUILD)/test \
|
2012-04-05 08:57:36 +08:00
|
|
|
-name '*.[odasS]' -o \
|
|
|
|
-name '*.so' -o \
|
|
|
|
-name '*.dylib' -o \
|
|
|
|
-name '*.dll' -o \
|
|
|
|
-name '*.def' -o \
|
|
|
|
-name '*.bc' -o \
|
|
|
|
-name '*.dSYM' -o \
|
2012-04-10 13:41:27 +08:00
|
|
|
-name '*.libaux' -o \
|
2012-04-05 08:57:36 +08:00
|
|
|
-name '*.out' -o \
|
2013-02-10 02:09:19 +08:00
|
|
|
-name '*.err' -o \
|
|
|
|
-name '*.debugger.script' \
|
2012-04-05 10:21:09 +08:00
|
|
|
| xargs rm -rf
|
2012-04-05 08:57:36 +08:00
|
|
|
|
2011-05-12 00:37:23 +08:00
|
|
|
|
2013-02-06 06:14:58 +08:00
|
|
|
######################################################################
|
|
|
|
# Tidy
|
|
|
|
######################################################################
|
2012-06-02 03:28:01 +08:00
|
|
|
|
2011-11-19 06:03:11 +08:00
|
|
|
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:
|
2011-11-19 06:03:11 +08:00
|
|
|
else
|
2012-04-01 13:49:11 +08:00
|
|
|
|
|
|
|
ALL_CS := $(wildcard $(S)src/rt/*.cpp \
|
|
|
|
$(S)src/rt/*/*.cpp \
|
|
|
|
$(S)src/rt/*/*/*.cpp \
|
2013-07-30 20:40:52 +08:00
|
|
|
$(S)src/rustllvm/*.cpp)
|
2013-07-30 20:44:34 +08:00
|
|
|
ALL_CS := $(filter-out $(S)src/rt/miniz.cpp \
|
2013-09-24 06:35:09 +08:00
|
|
|
$(wildcard $(S)src/rt/sundown/src/*.c) \
|
|
|
|
$(wildcard $(S)src/rt/sundown/html/*.c) \
|
2012-04-01 13:49:11 +08:00
|
|
|
,$(ALL_CS))
|
|
|
|
ALL_HS := $(wildcard $(S)src/rt/*.h \
|
|
|
|
$(S)src/rt/*/*.h \
|
|
|
|
$(S)src/rt/*/*/*.h \
|
2013-07-30 20:40:52 +08:00
|
|
|
$(S)src/rustllvm/*.h)
|
2012-04-01 13:49:11 +08:00
|
|
|
ALL_HS := $(filter-out $(S)src/rt/vg/valgrind.h \
|
|
|
|
$(S)src/rt/vg/memcheck.h \
|
|
|
|
$(S)src/rt/msvc/typeof.h \
|
|
|
|
$(S)src/rt/msvc/stdint.h \
|
|
|
|
$(S)src/rt/msvc/inttypes.h \
|
2013-09-24 06:35:09 +08:00
|
|
|
$(wildcard $(S)src/rt/sundown/src/*.h) \
|
|
|
|
$(wildcard $(S)src/rt/sundown/html/*.h) \
|
2012-04-01 13:49:11 +08:00
|
|
|
,$(ALL_HS))
|
|
|
|
|
2013-02-06 06:14:58 +08:00
|
|
|
# Run the tidy script in multiple parts to avoid huge 'echo' commands
|
2011-11-19 06:03:11 +08:00
|
|
|
tidy:
|
|
|
|
@$(call E, check: formatting)
|
2012-04-14 02:59:17 +08:00
|
|
|
$(Q)find $(S)src -name '*.r[sc]' \
|
2013-08-23 05:58:06 +08:00
|
|
|
| grep '^$(S)src/libuv' -v \
|
|
|
|
| grep '^$(S)src/llvm' -v \
|
2013-09-06 10:20:30 +08:00
|
|
|
| grep '^$(S)src/gyp' -v \
|
2012-10-30 04:10:54 +08:00
|
|
|
| xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py
|
2012-04-14 02:59:17 +08:00
|
|
|
$(Q)find $(S)src/etc -name '*.py' \
|
2012-10-30 04:10:54 +08:00
|
|
|
| xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py
|
2012-04-14 02:59:17 +08:00
|
|
|
$(Q)echo $(ALL_CS) \
|
2013-05-04 07:25:04 +08:00
|
|
|
| xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py
|
2012-04-14 02:59:17 +08:00
|
|
|
$(Q)echo $(ALL_HS) \
|
2013-05-04 07:25:04 +08:00
|
|
|
| xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py
|
2013-10-01 01:14:40 +08:00
|
|
|
$(Q)find $(S)src -type f -perm +111 \
|
|
|
|
-not -name '*.rs' -and -not -name '*.py' \
|
|
|
|
-and -not -name '*.sh' \
|
|
|
|
| grep '^$(S)src/llvm' -v \
|
|
|
|
| grep '^$(S)src/libuv' -v \
|
|
|
|
| grep '^$(S)src/gyp' -v \
|
|
|
|
| grep '^$(S)src/etc' -v \
|
2014-01-29 06:15:29 +08:00
|
|
|
| grep '^$(S)src/doc' -v \
|
2013-10-01 01:14:40 +08:00
|
|
|
| xargs $(CFG_PYTHON) $(S)src/etc/check-binaries.py
|
2012-04-10 09:04:37 +08:00
|
|
|
|
2011-11-19 06:03:11 +08:00
|
|
|
endif
|
2011-06-30 06:12:02 +08:00
|
|
|
|
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 \
|
2013-11-17 09:07:32 +08:00
|
|
|
check-stage$(1)-T-$(2)-H-$(3)-rmake-exec \
|
|
|
|
check-stage$(1)-T-$(2)-H-$(3)-crates-exec \
|
2013-12-23 05:46:06 +08:00
|
|
|
check-stage$(1)-T-$(2)-H-$(3)-doc-crates-exec \
|
2013-02-06 06:14:58 +08:00
|
|
|
check-stage$(1)-T-$(2)-H-$(3)-bench-exec \
|
2013-02-11 06:17:28 +08:00
|
|
|
check-stage$(1)-T-$(2)-H-$(3)-debuginfo-exec \
|
2013-07-06 16:03:03 +08:00
|
|
|
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
|
|
|
|
|
2013-02-22 08:15:01 +08:00
|
|
|
# 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)
|
2013-10-21 17:18:21 +08:00
|
|
|
ifneq ($$(findstring $(2),$$(CFG_HOST)),)
|
2013-02-22 08:15:01 +08:00
|
|
|
|
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)
|
|
|
|
|
2013-02-22 08:15:01 +08:00
|
|
|
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-12-23 05:46:06 +08:00
|
|
|
check-stage$(1)-T-$(2)-H-$(3)-doc-crates-exec: \
|
|
|
|
$$(foreach crate,$$(TEST_DOC_CRATES), \
|
|
|
|
check-stage$(1)-T-$(2)-H-$(3)-doc-$$(crate)-exec)
|
|
|
|
|
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-03-21 07:49:12 +08:00
|
|
|
|
2012-01-21 10:05:07 +08:00
|
|
|
endef
|
|
|
|
|
2013-10-21 17:18:21 +08:00
|
|
|
$(foreach host,$(CFG_HOST), \
|
|
|
|
$(foreach target,$(CFG_TARGET), \
|
2013-02-06 06:14:58 +08:00
|
|
|
$(foreach stage,$(STAGES), \
|
|
|
|
$(eval $(call DEF_TEST_SETS,$(stage),$(target),$(host))))))
|
|
|
|
|
2012-01-21 10:05:07 +08:00
|
|
|
|
2011-06-30 06:12:02 +08:00
|
|
|
######################################################################
|
2013-02-06 06:14:58 +08:00
|
|
|
# Crate testing
|
2011-06-30 06:12:02 +08:00
|
|
|
######################################################################
|
|
|
|
|
2013-02-06 06:14:58 +08:00
|
|
|
define TEST_RUNNER
|
2012-01-18 08:45:22 +08:00
|
|
|
|
2013-05-18 01:45:09 +08:00
|
|
|
# If NO_REBUILD is set then break the dependencies on extra so we can
|
|
|
|
# test crates without rebuilding std and extra first
|
2013-03-15 06:37:38 +08:00
|
|
|
ifeq ($(NO_REBUILD),)
|
2014-01-25 11:27:22 +08:00
|
|
|
STDTESTDEP_$(1)_$(2)_$(3)_$(4) = $$(SREQ$(1)_T_$(2)_H_$(3)) \
|
2014-01-29 15:29:38 +08:00
|
|
|
$$(foreach crate,$$(TARGET_CRATES),\
|
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate))
|
2013-03-15 06:37:38 +08:00
|
|
|
else
|
2014-01-25 11:27:22 +08:00
|
|
|
STDTESTDEP_$(1)_$(2)_$(3)_$(4) =
|
2013-03-15 06:37:38 +08:00
|
|
|
endif
|
|
|
|
|
2014-01-25 11:27:22 +08:00
|
|
|
$(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)): CFG_COMPILER = $(2)
|
|
|
|
$(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)): \
|
|
|
|
$$(CRATEFILE_$(4)) \
|
|
|
|
$$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4)) \
|
|
|
|
$$(STDTESTDEP_$(1)_$(2)_$(3)_$(4))
|
2012-01-18 08:45:22 +08:00
|
|
|
@$$(call E, compile_and_link: $$@)
|
2014-01-25 11:27:22 +08:00
|
|
|
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test \
|
|
|
|
-L "$$(RT_OUTPUT_DIR_$(2))" \
|
|
|
|
-L "$$(LLVM_LIBDIR_$(2))"
|
2012-01-16 09:34:18 +08:00
|
|
|
|
2013-02-06 06:14:58 +08:00
|
|
|
endef
|
|
|
|
|
2013-10-21 17:18:21 +08:00
|
|
|
$(foreach host,$(CFG_HOST), \
|
|
|
|
$(eval $(foreach target,$(CFG_TARGET), \
|
2013-02-06 06:14:58 +08:00
|
|
|
$(eval $(foreach stage,$(STAGES), \
|
2014-01-25 11:27:22 +08:00
|
|
|
$(eval $(foreach crate,$(TEST_CRATES), \
|
|
|
|
$(eval $(call TEST_RUNNER,$(stage),$(target),$(host),$(crate))))))))))
|
2013-02-06 06:14:58 +08:00
|
|
|
|
|
|
|
define DEF_TEST_CRATE_RULES
|
2013-02-06 12:05:00 +08:00
|
|
|
check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
|
|
|
|
|
2013-07-16 09:52:08 +08:00
|
|
|
check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
|
|
|
|
|
2013-02-06 12:05:00 +08:00
|
|
|
$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
|
2013-05-14 06:19:48 +08:00
|
|
|
$(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
|
2012-01-16 09:34:18 +08:00
|
|
|
@$$(call E, run: $$<)
|
2013-12-13 10:07:23 +08:00
|
|
|
$$(Q)$$(call CFG_RUN_TEST_$(2),$$<,$(2),$(3)) $$(TESTARGS) \
|
|
|
|
--logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
|
|
|
|
$$(call CRATE_TEST_EXTRA_ARGS,$(1),$(2),$(3),$(4)) \
|
|
|
|
&& touch $$@
|
2013-02-06 06:14:58 +08:00
|
|
|
endef
|
2012-01-16 09:34:18 +08:00
|
|
|
|
2013-05-01 17:50:23 +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)): \
|
2013-05-14 06:19:48 +08:00
|
|
|
$(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
|
2013-05-01 17:50:23 +08:00
|
|
|
@$$(call E, run: $$< via adb)
|
2014-01-14 11:44:18 +08:00
|
|
|
$$(Q)$(CFG_ADB) push $$< $(CFG_ADB_TEST_DIR)
|
|
|
|
$$(Q)$(CFG_ADB) shell '(cd $(CFG_ADB_TEST_DIR); LD_LIBRARY_PATH=. \
|
2013-08-20 15:50:45 +08:00
|
|
|
./$$(notdir $$<) \
|
2013-08-20 18:07:36 +08:00
|
|
|
--logfile $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log \
|
2014-01-14 11:44:18 +08:00
|
|
|
$$(call CRATE_TEST_EXTRA_ARGS,$(1),$(2),$(3),$(4)) $(TESTARGS))' \
|
2013-08-20 15:50:45 +08:00
|
|
|
> tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp
|
2014-01-14 11:44:18 +08:00
|
|
|
$$(Q)cat tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp
|
|
|
|
$$(Q)touch tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
|
|
|
|
$$(Q)$(CFG_ADB) pull $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log tmp/
|
|
|
|
$$(Q)$(CFG_ADB) shell rm $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
|
|
|
|
$$(Q)$(CFG_ADB) pull $(CFG_ADB_TEST_DIR)/$$(call TEST_RATCHET_FILE,$(1),$(2),$(3),$(4)) tmp/
|
2013-05-01 17:50:23 +08:00
|
|
|
@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)): \
|
2013-05-14 06:19:48 +08:00
|
|
|
$(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
|
2013-12-15 14:42:01 +08:00
|
|
|
@$$(call E, failing: no device for $$< )
|
|
|
|
false
|
2013-05-01 17:50:23 +08:00
|
|
|
endef
|
|
|
|
|
2013-10-21 17:18:21 +08:00
|
|
|
$(foreach host,$(CFG_HOST), \
|
|
|
|
$(foreach target,$(CFG_TARGET), \
|
2013-02-06 06:14:58 +08:00
|
|
|
$(foreach stage,$(STAGES), \
|
|
|
|
$(foreach crate, $(TEST_CRATES), \
|
2013-10-21 17:18:21 +08:00
|
|
|
$(if $(findstring $(target),$(CFG_BUILD)), \
|
2013-05-01 17:50:23 +08:00
|
|
|
$(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))), \
|
|
|
|
$(if $(findstring $(target),"arm-linux-androideabi"), \
|
2013-05-03 23:49:18 +08:00
|
|
|
$(if $(findstring $(CFG_ADB_DEVICE_STATUS),"true"), \
|
2013-05-01 17:50:23 +08:00
|
|
|
$(eval $(call DEF_TEST_CRATE_RULES_arm-linux-androideabi,$(stage),$(target),$(host),$(crate))), \
|
|
|
|
$(eval $(call DEF_TEST_CRATE_RULES_null,$(stage),$(target),$(host),$(crate))) \
|
|
|
|
), \
|
2013-05-03 23:49:18 +08:00
|
|
|
$(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))) \
|
2013-05-07 09:09:34 +08:00
|
|
|
))))))
|
2012-10-03 09:15:02 +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)
|
2013-08-31 04:17:53 +08:00
|
|
|
BENCH_RS := $(wildcard $(S)src/test/bench/*.rs)
|
2013-02-06 06:14:58 +08:00
|
|
|
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)
|
2013-07-06 16:03:03 +08:00
|
|
|
CODEGEN_RS := $(wildcard $(S)src/test/codegen/*.rs)
|
|
|
|
CODEGEN_CC := $(wildcard $(S)src/test/codegen/*.cc)
|
2012-10-03 09:15:02 +08:00
|
|
|
|
2013-02-06 06:14:58 +08:00
|
|
|
# perf tests are the same as bench tests only they run under
|
|
|
|
# a performance monitor.
|
2013-08-31 04:17:53 +08:00
|
|
|
PERF_RS := $(wildcard $(S)src/test/bench/*.rs)
|
2012-10-30 09:08:36 +08:00
|
|
|
|
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)
|
2013-07-06 16:03:03 +08:00
|
|
|
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-10-26 08:04:37 +08:00
|
|
|
CTEST_SRC_BASE_rpass-full = run-pass-fulldeps
|
|
|
|
CTEST_BUILD_BASE_rpass-full = run-pass-fulldeps
|
2013-02-06 06:14:58 +08:00
|
|
|
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)
|
|
|
|
|
2013-08-31 04:17:29 +08:00
|
|
|
CTEST_SRC_BASE_bench = bench
|
2013-02-06 06:14:58 +08:00
|
|
|
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)
|
|
|
|
|
2013-07-06 16:03:03 +08:00
|
|
|
CTEST_SRC_BASE_codegen = codegen
|
|
|
|
CTEST_BUILD_BASE_codegen = codegen
|
|
|
|
CTEST_MODE_codegen = codegen
|
|
|
|
CTEST_RUNTOOL_codegen = $(CTEST_RUNTOOL)
|
|
|
|
|
2013-02-11 06:17:28 +08:00
|
|
|
ifeq ($(CFG_GDB),)
|
|
|
|
CTEST_DISABLE_debuginfo = "no gdb found"
|
|
|
|
endif
|
|
|
|
|
2013-07-06 16:03:03 +08:00
|
|
|
ifeq ($(CFG_CLANG),)
|
|
|
|
CTEST_DISABLE_codegen = "no clang found"
|
|
|
|
endif
|
|
|
|
|
2013-03-13 02:58:50 +08:00
|
|
|
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) = \
|
2013-03-02 20:25:12 +08:00
|
|
|
$$(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
|
2011-08-02 05:10:59 +08:00
|
|
|
|
2013-07-24 17:26:52 +08:00
|
|
|
# The tests select when to use debug configuration on their own;
|
|
|
|
# remove directive, if present, from CFG_RUSTC_FLAGS (issue #7898).
|
2013-09-18 12:02:11 +08:00
|
|
|
CTEST_RUSTC_FLAGS := $$(subst --cfg ndebug,,$$(CFG_RUSTC_FLAGS))
|
2013-08-11 15:29:45 +08:00
|
|
|
|
Add generation of static libraries to rustc
This commit implements the support necessary for generating both intermediate
and result static rust libraries. This is an implementation of my thoughts in
https://mail.mozilla.org/pipermail/rust-dev/2013-November/006686.html.
When compiling a library, we still retain the "lib" option, although now there
are "rlib", "staticlib", and "dylib" as options for crate_type (and these are
stackable). The idea of "lib" is to generate the "compiler default" instead of
having too choose (although all are interchangeable). For now I have left the
"complier default" to be a dynamic library for size reasons.
Of the rust libraries, lib{std,extra,rustuv} will bootstrap with an
rlib/dylib pair, but lib{rustc,syntax,rustdoc,rustpkg} will only be built as a
dynamic object. I chose this for size reasons, but also because you're probably
not going to be embedding the rustc compiler anywhere any time soon.
Other than the options outlined above, there are a few defaults/preferences that
are now opinionated in the compiler:
* If both a .dylib and .rlib are found for a rust library, the compiler will
prefer the .rlib variant. This is overridable via the -Z prefer-dynamic option
* If generating a "lib", the compiler will generate a dynamic library. This is
overridable by explicitly saying what flavor you'd like (rlib, staticlib,
dylib).
* If no options are passed to the command line, and no crate_type is found in
the destination crate, then an executable is generated
With this change, you can successfully build a rust program with 0 dynamic
dependencies on rust libraries. There is still a dynamic dependency on
librustrt, but I plan on removing that in a subsequent commit.
This change includes no tests just yet. Our current testing
infrastructure/harnesses aren't very amenable to doing flavorful things with
linking, so I'm planning on adding a new mode of testing which I believe belongs
as a separate commit.
Closes #552
2013-11-16 06:03:29 +08:00
|
|
|
# There's no need our entire test suite to take up gigabytes of space on disk
|
|
|
|
# including copies of libstd/libextra all over the place
|
|
|
|
CTEST_RUSTC_FLAGS := $$(CTEST_RUSTC_FLAGS) -Z prefer-dynamic
|
|
|
|
|
2013-08-11 15:29:45 +08:00
|
|
|
# The tests can not be optimized while the rest of the compiler is optimized, so
|
|
|
|
# filter out the optimization (if any) from rustc and then figure out if we need
|
|
|
|
# to be optimized
|
|
|
|
CTEST_RUSTC_FLAGS := $$(subst -O,,$$(CTEST_RUSTC_FLAGS))
|
|
|
|
ifndef CFG_DISABLE_OPTIMIZE_TESTS
|
|
|
|
CTEST_RUSTC_FLAGS += -O
|
|
|
|
endif
|
2013-07-24 17:26:52 +08:00
|
|
|
|
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)) \
|
2013-03-02 20:25:12 +08:00
|
|
|
--rustc-path $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
|
2013-07-06 16:03:03 +08:00
|
|
|
--clang-path $(if $(CFG_CLANG),$(CFG_CLANG),clang) \
|
2013-10-21 17:18:21 +08:00
|
|
|
--llvm-bin-path $(CFG_LLVM_INST_DIR_$(CFG_BUILD))/bin \
|
2012-02-28 22:45:33 +08:00
|
|
|
--aux-base $$(S)src/test/auxiliary/ \
|
2011-11-22 05:11:40 +08:00
|
|
|
--stage-id stage$(1)-$(2) \
|
2013-05-01 17:50:23 +08:00
|
|
|
--target $(2) \
|
2014-01-18 02:18:02 +08:00
|
|
|
--host $(3) \
|
2013-05-03 23:49:18 +08:00
|
|
|
--adb-path=$(CFG_ADB) \
|
2013-05-02 12:16:01 +08:00
|
|
|
--adb-test-dir=$(CFG_ADB_TEST_DIR) \
|
2014-01-25 11:27:22 +08:00
|
|
|
--rustcflags "$(RUSTC_FLAGS_$(2)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(2))" \
|
2011-11-22 05:11:40 +08:00
|
|
|
$$(CTEST_TESTARGS)
|
|
|
|
|
2013-02-06 12:05:00 +08:00
|
|
|
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)
|
2013-07-06 16:03:03 +08:00
|
|
|
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
|
|
|
|
2013-10-21 17:18:21 +08:00
|
|
|
$(foreach host,$(CFG_HOST), \
|
|
|
|
$(eval $(foreach target,$(CFG_TARGET), \
|
2013-02-06 06:14:58 +08:00
|
|
|
$(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
|
2012-06-02 07:01:53 +08:00
|
|
|
|
2013-02-06 06:14:58 +08:00
|
|
|
CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4) := \
|
|
|
|
$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
|
2013-08-31 04:17:29 +08:00
|
|
|
--src-base $$(S)src/test/$$(CTEST_SRC_BASE_$(4))/ \
|
2013-02-06 06:14:58 +08:00
|
|
|
--build-base $(3)/test/$$(CTEST_BUILD_BASE_$(4))/ \
|
2013-07-16 09:52:08 +08:00
|
|
|
--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
|
|
|
|
2013-02-06 12:05:00 +08:00
|
|
|
check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
|
|
|
|
|
2013-02-11 06:17:28 +08:00
|
|
|
ifeq ($$(CTEST_DISABLE_$(4)),)
|
|
|
|
|
2013-02-06 12:05:00 +08:00
|
|
|
$$(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))
|
2013-05-01 17:50:23 +08:00
|
|
|
@$$(call E, run $(4) [$(2)]: $$<)
|
2013-03-02 20:25:12 +08:00
|
|
|
$$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
|
2013-02-06 06:14:58 +08:00
|
|
|
$$(CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
|
2013-02-06 12:05:00 +08:00
|
|
|
--logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
|
|
|
|
&& touch $$@
|
2011-11-22 05:11:40 +08:00
|
|
|
|
2013-02-11 06:17:28 +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))
|
2013-05-01 17:50:23 +08:00
|
|
|
@$$(call E, run $(4) [$(2)]: $$<)
|
2013-02-11 06:17:28 +08:00
|
|
|
@$$(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
|
|
|
|
2013-07-06 16:03:03 +08:00
|
|
|
CTEST_NAMES = rpass rpass-full rfail cfail bench perf debuginfo codegen
|
2012-06-02 07:01:53 +08:00
|
|
|
|
2013-10-21 17:18:21 +08:00
|
|
|
$(foreach host,$(CFG_HOST), \
|
|
|
|
$(eval $(foreach target,$(CFG_TARGET), \
|
2013-02-06 06:14:58 +08:00
|
|
|
$(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
|
2013-10-26 08:04:37 +08:00
|
|
|
PRETTY_DIRNAME_pretty-rpass-full = run-pass-fulldeps
|
2013-02-06 06:14:58 +08:00
|
|
|
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
|
|
|
|
|
2013-02-06 12:05:00 +08:00
|
|
|
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))
|
2013-05-01 17:50:23 +08:00
|
|
|
@$$(call E, run pretty-rpass [$(2)]: $$<)
|
2013-03-02 20:25:12 +08:00
|
|
|
$$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
|
2013-02-06 06:14:58 +08:00
|
|
|
$$(PRETTY_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
|
2013-02-06 12:05:00 +08:00
|
|
|
--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
|
|
|
|
2013-10-21 17:18:21 +08:00
|
|
|
$(foreach host,$(CFG_HOST), \
|
|
|
|
$(foreach target,$(CFG_TARGET), \
|
2013-02-06 06:14:58 +08:00
|
|
|
$(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
|
2012-09-16 09:06:20 +08:00
|
|
|
|
2013-02-19 09:08:03 +08:00
|
|
|
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)/ \
|
2012-09-16 09:06:20 +08:00
|
|
|
--mode run-pass
|
|
|
|
|
2013-02-19 09:08:03 +08:00
|
|
|
check-stage$(1)-T-$(2)-H-$(3)-doc-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4))
|
2013-02-06 12:05:00 +08:00
|
|
|
|
2013-02-19 09:08:03 +08:00
|
|
|
$$(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)
|
2013-05-01 17:50:23 +08:00
|
|
|
@$$(call E, run doc-$(4) [$(2)]: $$<)
|
2013-03-02 20:25:12 +08:00
|
|
|
$$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
|
2013-02-19 09:08:03 +08:00
|
|
|
$$(DOC_TEST_ARGS$(1)-T-$(2)-H-$(3)-doc-$(4)) \
|
2013-02-06 12:05:00 +08:00
|
|
|
--logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),doc-$(4)) \
|
|
|
|
&& touch $$@
|
2012-09-16 09:06:20 +08:00
|
|
|
|
2013-02-06 06:14:58 +08:00
|
|
|
endef
|
2012-09-23 06:33:50 +08:00
|
|
|
|
2013-10-21 17:18:21 +08:00
|
|
|
$(foreach host,$(CFG_HOST), \
|
|
|
|
$(foreach target,$(CFG_TARGET), \
|
2013-02-06 06:14:58 +08:00
|
|
|
$(foreach stage,$(STAGES), \
|
|
|
|
$(foreach docname,$(DOC_TEST_NAMES), \
|
|
|
|
$(eval $(call DEF_RUN_DOC_TEST,$(stage),$(target),$(host),$(docname)))))))
|
2012-03-21 07:49:12 +08:00
|
|
|
|
2013-12-23 05:46:06 +08:00
|
|
|
define DEF_CRATE_DOC_TEST
|
|
|
|
|
2013-12-25 14:59:38 +08:00
|
|
|
check-stage$(1)-T-$(2)-H-$(3)-doc-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4))
|
2013-12-23 05:46:06 +08:00
|
|
|
|
2013-12-25 14:59:38 +08:00
|
|
|
ifeq ($(2),$$(CFG_BUILD))
|
2014-01-25 11:27:22 +08:00
|
|
|
$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)): \
|
|
|
|
$$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
|
|
|
|
$$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4)) \
|
2013-12-25 14:59:38 +08:00
|
|
|
$$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3))
|
|
|
|
@$$(call E, run doc-$(4) [$(2)])
|
|
|
|
$$(Q)$$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) --test \
|
2014-01-25 11:27:22 +08:00
|
|
|
$$(CRATEFILE_$(4)) --test-args "$$(TESTARGS)" && touch $$@
|
2013-12-25 14:59:38 +08:00
|
|
|
else
|
|
|
|
$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)):
|
|
|
|
touch $$@
|
|
|
|
endif
|
2013-12-23 05:46:06 +08:00
|
|
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach host,$(CFG_HOST), \
|
2013-12-25 14:59:38 +08:00
|
|
|
$(foreach target,$(CFG_TARGET), \
|
|
|
|
$(foreach stage,$(STAGES), \
|
|
|
|
$(foreach crate,$(TEST_DOC_CRATES), \
|
|
|
|
$(eval $(call DEF_CRATE_DOC_TEST,$(stage),$(target),$(host),$(crate)))))))
|
2011-07-13 06:27:00 +08:00
|
|
|
|
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
|
2012-06-02 07:01:53 +08:00
|
|
|
|
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
|
2014-01-29 06:15:29 +08:00
|
|
|
$$(Q)$$(EXTRACT_TESTS) $$(D)/$(2).md $(1)/test/doc-$(2)
|
2011-07-13 06:27:00 +08:00
|
|
|
|
2013-02-06 06:14:58 +08:00
|
|
|
endef
|
2011-09-14 06:06:21 +08:00
|
|
|
|
2013-10-21 17:18:21 +08:00
|
|
|
$(foreach host,$(CFG_HOST), \
|
2013-02-06 06:14:58 +08:00
|
|
|
$(foreach docname,$(DOC_TEST_NAMES), \
|
|
|
|
$(eval $(call DEF_DOC_TEST_HOST,$(host),$(docname)))))
|
2011-08-02 02:57:05 +08:00
|
|
|
|
2012-06-02 07:01:53 +08:00
|
|
|
|
2013-02-06 06:14:58 +08:00
|
|
|
######################################################################
|
|
|
|
# Shortcut rules
|
|
|
|
######################################################################
|
2011-08-02 02:57:05 +08:00
|
|
|
|
2013-02-06 06:14:58 +08:00
|
|
|
TEST_GROUPS = \
|
|
|
|
crates \
|
|
|
|
$(foreach crate,$(TEST_CRATES),$(crate)) \
|
2013-12-23 05:46:06 +08:00
|
|
|
$(foreach crate,$(TEST_DOC_CRATES),doc-$(crate)) \
|
2013-02-06 06:14:58 +08:00
|
|
|
rpass \
|
|
|
|
rpass-full \
|
|
|
|
rfail \
|
|
|
|
cfail \
|
|
|
|
bench \
|
|
|
|
perf \
|
2013-11-17 09:07:32 +08:00
|
|
|
rmake \
|
2013-02-10 02:09:19 +08:00
|
|
|
debuginfo \
|
2013-07-06 16:03:03 +08:00
|
|
|
codegen \
|
2013-02-06 06:14:58 +08:00
|
|
|
doc \
|
2013-05-23 07:17:37 +08:00
|
|
|
$(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
|
2011-08-03 05:37:03 +08:00
|
|
|
|
2013-02-06 06:14:58 +08:00
|
|
|
$(foreach stage,$(STAGES), \
|
2013-10-21 17:18:21 +08:00
|
|
|
$(foreach target,$(CFG_TARGET), \
|
|
|
|
$(foreach host,$(CFG_HOST), \
|
2013-02-06 06:14:58 +08:00
|
|
|
$(eval $(call DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST,$(stage),$(target),$(host))))))
|
2011-07-31 12:44:30 +08:00
|
|
|
|
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), \
|
2013-10-21 17:18:21 +08:00
|
|
|
$(foreach target,$(CFG_TARGET), \
|
|
|
|
$(foreach host,$(CFG_HOST), \
|
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)))))))
|
2012-09-16 09:06:20 +08:00
|
|
|
|
2013-02-06 06:14:58 +08:00
|
|
|
define DEF_CHECK_FOR_STAGE
|
2013-10-21 17:18:21 +08:00
|
|
|
check-stage$(1): check-stage$(1)-H-$$(CFG_BUILD)
|
|
|
|
check-stage$(1)-H-all: $$(foreach target,$$(CFG_TARGET), \
|
2013-02-06 06:14:58 +08:00
|
|
|
check-stage$(1)-H-$$(target))
|
|
|
|
endef
|
2012-09-16 09:06:20 +08:00
|
|
|
|
2013-02-06 06:14:58 +08:00
|
|
|
$(foreach stage,$(STAGES), \
|
|
|
|
$(eval $(call DEF_CHECK_FOR_STAGE,$(stage))))
|
2012-09-16 09:06:20 +08:00
|
|
|
|
2013-02-06 06:14:58 +08:00
|
|
|
define DEF_CHECK_FOR_STAGE_AND_GROUP
|
2013-10-21 17:18:21 +08:00
|
|
|
check-stage$(1)-$(2): check-stage$(1)-H-$$(CFG_BUILD)-$(2)
|
|
|
|
check-stage$(1)-H-all-$(2): $$(foreach target,$$(CFG_TARGET), \
|
2013-02-06 06:14:58 +08:00
|
|
|
check-stage$(1)-H-$$(target)-$(2))
|
|
|
|
endef
|
2012-09-23 06:33:50 +08:00
|
|
|
|
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)))))
|
2012-03-21 07:49:12 +08:00
|
|
|
|
2013-02-06 06:14:58 +08:00
|
|
|
|
|
|
|
define DEF_CHECK_FOR_STAGE_AND_HOSTS
|
2013-10-21 17:18:21 +08:00
|
|
|
check-stage$(1)-H-$(2): $$(foreach target,$$(CFG_TARGET), \
|
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
|
2011-07-13 06:27:00 +08:00
|
|
|
|
2013-02-06 06:14:58 +08:00
|
|
|
$(foreach stage,$(STAGES), \
|
2013-10-21 17:18:21 +08:00
|
|
|
$(foreach host,$(CFG_HOST), \
|
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
|
2013-10-21 17:18:21 +08:00
|
|
|
check-stage$(1)-H-$(2)-$(3): $$(foreach target,$$(CFG_TARGET), \
|
2013-02-06 06:14:58 +08:00
|
|
|
check-stage$(1)-T-$$(target)-H-$(2)-$(3))
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach stage,$(STAGES), \
|
2013-10-21 17:18:21 +08:00
|
|
|
$(foreach host,$(CFG_HOST), \
|
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-07-13 06:27:00 +08:00
|
|
|
|
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
|
|
|
######################################################################
|
2011-11-18 04:04:37 +08:00
|
|
|
|
2013-02-06 06:14:58 +08:00
|
|
|
FT := run_pass_stage2
|
2013-10-21 17:18:21 +08:00
|
|
|
FT_LIB := $(call CFG_LIB_NAME_$(CFG_BUILD),$(FT))
|
2013-02-06 06:14:58 +08:00
|
|
|
FT_DRIVER := $(FT)_driver
|
|
|
|
|
2012-02-18 05:38:19 +08:00
|
|
|
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: \
|
2012-02-18 05:38:19 +08:00
|
|
|
$(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: $$@)
|
Redesign output flags for rustc
This commit removes the -c, --emit-llvm, -s, --rlib, --dylib, --staticlib,
--lib, and --bin flags from rustc, adding the following flags:
* --emit=[asm,ir,bc,obj,link]
* --crate-type=[dylib,rlib,staticlib,bin,lib]
The -o option has also been redefined to be used for *all* flavors of outputs.
This means that we no longer ignore it for libraries. The --out-dir remains the
same as before.
The new logic for files that rustc emits is as follows:
1. Output types are dictated by the --emit flag. The default value is
--emit=link, and this option can be passed multiple times and have all
options stacked on one another.
2. Crate types are dictated by the --crate-type flag and the #[crate_type]
attribute. The flags can be passed many times and stack with the crate
attribute.
3. If the -o flag is specified, and only one output type is specified, the
output will be emitted at this location. If more than one output type is
specified, then the filename of -o is ignored, and all output goes in the
directory that -o specifies. The -o option always ignores the --out-dir
option.
4. If the --out-dir flag is specified, all output goes in this directory.
5. If -o and --out-dir are both not present, all output goes in the current
directory of the process.
6. When multiple output types are specified, the filestem of all output is the
same as the name of the CrateId (derived from a crate attribute or from the
filestem of the crate file).
Closes #7791
Closes #11056
Closes #11667
2014-02-04 07:27:54 +08:00
|
|
|
$$(STAGE2_T_$(2)_H_$(3)) --crate-type=dylib --out-dir $$(@D) $$< \
|
2014-01-25 13:00:31 +08:00
|
|
|
-L "$$(RT_OUTPUT_DIR_$(2))"
|
2011-11-29 23:07:25 +08:00
|
|
|
|
2013-03-02 20:25:12 +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: $$@ $$<)
|
2014-01-25 13:00:31 +08:00
|
|
|
$$(STAGE2_T_$(2)_H_$(3)) -o $$@ $$< \
|
|
|
|
-L "$$(RT_OUTPUT_DIR_$(2))"
|
2011-11-29 23:07:25 +08:00
|
|
|
|
2011-11-30 00:03:22 +08:00
|
|
|
$(3)/test/$$(FT_DRIVER)-$(2).out: \
|
2013-03-02 20:25:12 +08:00
|
|
|
$(3)/test/$$(FT_DRIVER)-$(2)$$(X_$(2)) \
|
2011-11-30 00:03:22 +08:00
|
|
|
$$(SREQ2_T_$(2)_H_$(3))
|
2013-03-02 20:25:12 +08:00
|
|
|
$$(Q)$$(call CFG_RUN_TEST_$(2),$$<,$(2),$(3)) \
|
2012-04-03 23:27:51 +08:00
|
|
|
--logfile tmp/$$(FT_DRIVER)-$(2).log
|
2011-11-29 23:07:25 +08:00
|
|
|
|
2012-08-30 05:32:54 +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
|
|
|
|
|
2013-10-21 17:18:21 +08:00
|
|
|
$(foreach host,$(CFG_HOST), \
|
|
|
|
$(eval $(foreach target,$(CFG_TARGET), \
|
2011-11-29 23:07:25 +08:00
|
|
|
$(eval $(call DEF_CHECK_FAST_FOR_T_H,,$(target),$(host))))))
|
|
|
|
|
2014-02-04 07:53:43 +08:00
|
|
|
check-fast: tidy check-fast-H-$(CFG_BUILD) \
|
|
|
|
$(foreach crate,$(TARGET_CRATES),check-stage2-$(crate))
|
2013-08-28 16:39:29 +08:00
|
|
|
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
|
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
|
|
|
|
2013-10-21 17:18:21 +08:00
|
|
|
$(foreach host,$(CFG_HOST), \
|
2013-02-22 08:15:01 +08:00
|
|
|
$(eval $(call DEF_CHECK_FAST_FOR_H,$(host))))
|
2013-11-17 09:07:32 +08:00
|
|
|
|
|
|
|
RMAKE_TESTS := $(shell ls -d $(S)src/test/run-make/*/)
|
|
|
|
RMAKE_TESTS := $(RMAKE_TESTS:$(S)src/test/run-make/%/=%)
|
|
|
|
|
|
|
|
define DEF_RMAKE_FOR_T_H
|
|
|
|
# $(1) the stage
|
|
|
|
# $(2) target triple
|
|
|
|
# $(3) host triple
|
|
|
|
|
2013-12-21 10:06:12 +08:00
|
|
|
|
|
|
|
ifeq ($(2)$(3),$$(CFG_BUILD)$$(CFG_BUILD))
|
2013-11-17 09:07:32 +08:00
|
|
|
check-stage$(1)-T-$(2)-H-$(3)-rmake-exec: \
|
|
|
|
$$(call TEST_OK_FILE,$(1),$(2),$(3),rmake)
|
|
|
|
|
|
|
|
$$(call TEST_OK_FILE,$(1),$(2),$(3),rmake): \
|
|
|
|
$$(RMAKE_TESTS:%=$(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok)
|
|
|
|
@touch $$@
|
|
|
|
|
|
|
|
$(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
|
|
|
|
$(S)src/test/run-make/%/Makefile \
|
2013-12-18 01:05:36 +08:00
|
|
|
$$(CSREQ$(1)_T_$(2)_H_$(3))
|
2013-11-17 09:07:32 +08:00
|
|
|
@rm -rf $(3)/test/run-make/$$*
|
|
|
|
@mkdir -p $(3)/test/run-make/$$*
|
2013-12-03 06:51:47 +08:00
|
|
|
$$(Q)$$(CFG_PYTHON) $(S)src/etc/maketest.py $$(dir $$<) \
|
2013-11-17 09:07:32 +08:00
|
|
|
$$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
|
2013-11-29 10:03:38 +08:00
|
|
|
$(3)/test/run-make/$$* \
|
2013-12-18 01:05:36 +08:00
|
|
|
"$$(CC_$(3)) $$(CFG_GCCISH_CFLAGS_$(3))" \
|
2014-01-04 03:16:52 +08:00
|
|
|
$$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
|
|
|
|
"$$(TESTNAME)"
|
2013-11-17 09:07:32 +08:00
|
|
|
@touch $$@
|
2013-12-21 10:06:12 +08:00
|
|
|
else
|
|
|
|
# FIXME #11094 - The above rule doesn't work right for multiple targets
|
|
|
|
check-stage$(1)-T-$(2)-H-$(3)-rmake-exec:
|
|
|
|
@true
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
2013-11-17 09:07:32 +08:00
|
|
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach stage,$(STAGES), \
|
|
|
|
$(foreach target,$(CFG_TARGET), \
|
|
|
|
$(foreach host,$(CFG_HOST), \
|
|
|
|
$(eval $(call DEF_RMAKE_FOR_T_H,$(stage),$(target),$(host))))))
|