1 # Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
2 # file at the top-level directory of this distribution and at
3 # http://rust-lang.org/COPYRIGHT.
5 # Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 # http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 # <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 # option. This file may not be copied, modified, or distributed
9 # except according to those terms.
12 ######################################################################
14 ######################################################################
16 # The names of crates that must be tested
18 # libcore/librustc_unicode tests are in a separate crate
20 $(eval $(call RUST_CRATE,coretest))
22 DEPS_collectionstest :=
23 $(eval $(call RUST_CRATE,collectionstest))
25 TEST_TARGET_CRATES = $(filter-out core rustc_unicode alloc_system libc \
26 alloc_jemalloc panic_unwind \
27 panic_abort,$(TARGET_CRATES)) \
28 collectionstest coretest
29 TEST_DOC_CRATES = $(DOC_CRATES) arena flate fmt_macros getopts graphviz \
30 log rand rbml serialize syntax term test
31 TEST_HOST_CRATES = $(filter-out rustc_typeck rustc_borrowck rustc_resolve \
32 rustc_trans rustc_lint,\
34 TEST_CRATES = $(TEST_TARGET_CRATES) $(TEST_HOST_CRATES)
36 ######################################################################
37 # Environment configuration
38 ######################################################################
40 # The arguments to all test runners
42 TESTARGS += $(TESTNAME)
49 # Arguments to the cfail/rfail/rpass tests
51 CTEST_RUNTOOL = --runtool "$(CFG_VALGRIND)"
54 CTEST_TESTARGS := $(TESTARGS)
56 # --bench is only relevant for crate tests, not for the compile tests
62 CTEST_TESTARGS += --verbose
65 # Setting locale ensures that gdb's output remains consistent.
66 # This prevents tests from failing with some locales (fixes #17423).
69 TEST_LOG_FILE=tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
70 TEST_OK_FILE=tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).ok
72 define DEF_TARGET_COMMANDS
75 CFG_RUN_TEST_$(1)=$$(TARGET_RPATH_VAR$$(2)_T_$$(3)_H_$$(4)) \
76 $$(call CFG_RUN_$(1),,$$(CFG_VALGRIND) $$(1))
79 ifdef CFG_WINDOWSY_$(1)
80 CFG_TESTLIB_$(1)=$$(CFG_BUILD_DIR)$$(2)/$$(strip \
81 $$(if $$(findstring stage0,$$(1)), \
82 stage0/$$(CFG_LIBDIR_RELATIVE), \
83 $$(if $$(findstring stage1,$$(1)), \
84 stage1/$$(CFG_LIBDIR_RELATIVE), \
85 $$(if $$(findstring stage2,$$(1)), \
86 stage2/$$(CFG_LIBDIR_RELATIVE), \
87 $$(if $$(findstring stage3,$$(1)), \
88 stage3/$$(CFG_LIBDIR_RELATIVE), \
89 )))))/rustlib/$$(CFG_BUILD)/lib
90 CFG_RUN_TEST_$(1)=$$(TARGET_RPATH_VAR$$(2)_T_$$(3)_H_$$(4)) \
91 $$(call CFG_RUN_$(1),$$(call CFG_TESTLIB_$(1),$$(1),$$(4)),$$(1))
94 # Run the compiletest runner itself under valgrind
96 CFG_RUN_CTEST_$(1)=$$(RPATH_VAR$$(1)_T_$$(3)_H_$$(3)) \
97 $$(call CFG_RUN_TEST_$$(CFG_BUILD),$$(3),$$(4))
99 CFG_RUN_CTEST_$(1)=$$(RPATH_VAR$$(1)_T_$$(3)_H_$$(3)) \
100 $$(call CFG_RUN_$$(CFG_BUILD),$$(TLIB$$(1)_T_$$(3)_H_$$(3)),$$(2))
105 $(foreach target,$(CFG_TARGET), \
106 $(eval $(call DEF_TARGET_COMMANDS,$(target))))
108 # Target platform specific variables for android
109 define DEF_ADB_DEVICE_STATUS
110 CFG_ADB_DEVICE_STATUS=$(1)
113 $(foreach target,$(CFG_TARGET), \
114 $(if $(findstring android, $(target)), \
115 $(if $(findstring adb,$(CFG_ADB)), \
116 $(if $(findstring device,$(shell $(CFG_ADB) devices 2>/dev/null | grep -E '^[:_A-Za-z0-9-]+[[:blank:]]+device')), \
117 $(info check: android device attached) \
118 $(eval $(call DEF_ADB_DEVICE_STATUS, true)), \
119 $(info check: android device not attached) \
120 $(eval $(call DEF_ADB_DEVICE_STATUS, false)) \
122 $(info check: adb not found) \
123 $(eval $(call DEF_ADB_DEVICE_STATUS, false)) \
128 ifeq ($(CFG_ADB_DEVICE_STATUS),true)
129 CFG_ADB_TEST_DIR=/data/tmp
131 $(info check: android device test dir $(CFG_ADB_TEST_DIR) ready \
132 $(shell $(CFG_ADB) remount 1>/dev/null) \
133 $(shell $(CFG_ADB) shell rm -r $(CFG_ADB_TEST_DIR) >/dev/null) \
134 $(shell $(CFG_ADB) shell mkdir $(CFG_ADB_TEST_DIR)) \
135 $(shell $(CFG_ADB) push $(S)src/etc/adb_run_wrapper.sh $(CFG_ADB_TEST_DIR) 1>/dev/null) \
136 $(foreach target,$(CFG_TARGET), \
137 $(if $(findstring android, $(target)), \
138 $(shell $(CFG_ADB) shell mkdir $(CFG_ADB_TEST_DIR)/$(target)) \
139 $(foreach crate,$(TARGET_CRATES_$(target)), \
140 $(shell $(CFG_ADB) push $(TLIB2_T_$(target)_H_$(CFG_BUILD))/$(call CFG_LIB_GLOB_$(target),$(crate)) \
141 $(CFG_ADB_TEST_DIR)/$(target))), \
147 # $(1) - name of doc test
148 # $(2) - file of the test
150 DOC_NAMES := $$(DOC_NAMES) $(1)
154 $(foreach doc,$(DOCS), \
155 $(eval $(call DOCTEST,md-$(doc),$(S)src/doc/$(doc).md)))
156 $(foreach file,$(wildcard $(S)src/doc/book/*.md), \
157 $(eval $(call DOCTEST,$(file:$(S)src/doc/book/%.md=book-%),$(file))))
158 $(foreach file,$(wildcard $(S)src/doc/nomicon/*.md), \
159 $(eval $(call DOCTEST,$(file:$(S)src/doc/nomicon/%.md=nomicon-%),$(file))))
160 ######################################################################
162 ######################################################################
164 # The main testing target. Tests lots of stuff.
165 check: check-sanitycheck cleantmptestlogs cleantestlibs all check-stage2 tidy
166 $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
168 # As above but don't bother running tidy.
169 check-notidy: check-sanitycheck cleantmptestlogs cleantestlibs all check-stage2
170 $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
172 # A slightly smaller set of tests for smoke testing.
173 check-lite: check-sanitycheck cleantestlibs cleantmptestlogs \
174 $(foreach crate,$(TEST_TARGET_CRATES),check-stage2-$(crate)) \
175 check-stage2-rpass check-stage2-rpass-valgrind \
176 check-stage2-rfail check-stage2-cfail check-stage2-pfail check-stage2-rmake
177 $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
179 # Only check the 'reference' tests: rpass/cfail/rfail/rmake.
180 check-ref: check-sanitycheck cleantestlibs cleantmptestlogs check-stage2-rpass \
181 check-stage2-rpass-valgrind check-stage2-rfail check-stage2-cfail check-stage2-pfail \
183 $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
185 # Only check the docs.
186 check-docs: check-sanitycheck cleantestlibs cleantmptestlogs check-stage2-docs
187 $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
189 # Some less critical tests that are not prone to breakage.
190 # Not run as part of the normal test suite, but tested by bors on checkin.
191 check-secondary: check-build-compiletest check-build-lexer-verifier check-lexer check-pretty
193 .PHONY: check-sanitycheck
196 $(Q)$(CFG_PYTHON) $(S)src/etc/check-sanitycheck.py
198 # check + check-secondary.
200 # Issue #17883: build check-secondary first so hidden dependencies in
201 # e.g. building compiletest are exercised (resolve those by adding
202 # deps to rules that need them; not by putting `check` first here).
203 check-all: check-secondary check
205 # Pretty-printing tests.
206 check-pretty: check-stage2-T-$(CFG_BUILD)-H-$(CFG_BUILD)-pretty-exec
208 define DEF_CHECK_BUILD_COMPILETEST_FOR_STAGE
209 check-stage$(1)-build-compiletest: $$(HBIN$(1)_H_$(CFG_BUILD))/compiletest$$(X_$(CFG_BUILD))
212 $(foreach stage,$(STAGES), \
213 $(eval $(call DEF_CHECK_BUILD_COMPILETEST_FOR_STAGE,$(stage))))
215 check-build-compiletest: \
216 check-stage1-build-compiletest \
217 check-stage2-build-compiletest
219 .PHONY: cleantmptestlogs cleantestlibs
225 $(Q)find $(CFG_BUILD)/test \
226 -name '*.[odasS]' -o \
233 -name '*.libaux' -o \
236 -name '*.debugger.script' \
240 ######################################################################
242 ######################################################################
245 tidy: $(HBIN0_H_$(CFG_BUILD))/tidy$(X_$(CFG_BUILD)) \
246 $(SNAPSHOT_RUSTC_POST_CLEANUP)
247 $(TARGET_RPATH_VAR0_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $< $(S)src
249 $(HBIN0_H_$(CFG_BUILD))/tidy$(X_$(CFG_BUILD)): \
250 $(TSREQ0_T_$(CFG_BUILD)_H_$(CFG_BUILD)) \
251 $(TLIB0_T_$(CFG_BUILD)_H_$(CFG_BUILD))/stamp.std \
252 $(call rwildcard,$(S)src/tools/tidy/src,*.rs) \
253 $(SNAPSHOT_RUSTC_POST_CLEANUP) | \
254 $(TLIB0_T_$(CFG_BUILD)_H_$(CFG_BUILD))
255 $(STAGE0_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $(S)src/tools/tidy/src/main.rs \
256 --out-dir $(@D) --crate-name tidy
258 ######################################################################
260 ######################################################################
264 check-stage$(1)-T-$(2)-H-$(3)-exec: \
265 check-stage$(1)-T-$(2)-H-$(3)-rpass-exec \
266 check-stage$(1)-T-$(2)-H-$(3)-rfail-exec \
267 check-stage$(1)-T-$(2)-H-$(3)-cfail-exec \
268 check-stage$(1)-T-$(2)-H-$(3)-pfail-exec \
269 check-stage$(1)-T-$(2)-H-$(3)-rpass-valgrind-exec \
270 check-stage$(1)-T-$(2)-H-$(3)-rmake-exec \
271 check-stage$(1)-T-$(2)-H-$(3)-rustdocck-exec \
272 check-stage$(1)-T-$(2)-H-$(3)-crates-exec \
273 check-stage$(1)-T-$(2)-H-$(3)-doc-crates-exec \
274 check-stage$(1)-T-$(2)-H-$(3)-debuginfo-gdb-exec \
275 check-stage$(1)-T-$(2)-H-$(3)-debuginfo-lldb-exec \
276 check-stage$(1)-T-$(2)-H-$(3)-incremental-exec \
277 check-stage$(1)-T-$(2)-H-$(3)-ui-exec \
278 check-stage$(1)-T-$(2)-H-$(3)-doc-exec \
279 check-stage$(1)-T-$(2)-H-$(3)-pretty-exec
281 ifndef CFG_DISABLE_CODEGEN_TESTS
282 check-stage$(1)-T-$(2)-H-$(3)-exec: \
283 check-stage$(1)-T-$(2)-H-$(3)-codegen-exec \
284 check-stage$(1)-T-$(2)-H-$(3)-codegen-units-exec
287 # Only test the compiler-dependent crates when the target is
288 # able to build a compiler (when the target triple is in the set of host triples)
289 ifneq ($$(findstring $(2),$$(CFG_HOST)),)
291 check-stage$(1)-T-$(2)-H-$(3)-exec: \
292 check-stage$(1)-T-$(2)-H-$(3)-rpass-full-exec \
293 check-stage$(1)-T-$(2)-H-$(3)-rfail-full-exec \
294 check-stage$(1)-T-$(2)-H-$(3)-cfail-full-exec
296 check-stage$(1)-T-$(2)-H-$(3)-pretty-exec: \
297 check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-full-exec \
298 check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail-full-exec
300 check-stage$(1)-T-$(2)-H-$(3)-crates-exec: \
301 $$(foreach crate,$$(TEST_CRATES), \
302 check-stage$(1)-T-$(2)-H-$(3)-$$(crate)-exec)
306 check-stage$(1)-T-$(2)-H-$(3)-crates-exec: \
307 $$(foreach crate,$$(TEST_TARGET_CRATES), \
308 check-stage$(1)-T-$(2)-H-$(3)-$$(crate)-exec)
312 check-stage$(1)-T-$(2)-H-$(3)-doc-crates-exec: \
313 $$(foreach crate,$$(TEST_DOC_CRATES), \
314 check-stage$(1)-T-$(2)-H-$(3)-doc-crate-$$(crate)-exec)
316 check-stage$(1)-T-$(2)-H-$(3)-doc-exec: \
317 $$(foreach docname,$$(DOC_NAMES), \
318 check-stage$(1)-T-$(2)-H-$(3)-doc-$$(docname)-exec) \
320 check-stage$(1)-T-$(2)-H-$(3)-pretty-exec: \
321 check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-exec \
322 check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-valgrind-exec \
323 check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail-exec \
324 check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty-exec
328 $(foreach host,$(CFG_HOST), \
329 $(foreach target,$(CFG_TARGET), \
330 $(foreach stage,$(STAGES), \
331 $(eval $(call DEF_TEST_SETS,$(stage),$(target),$(host))))))
334 ######################################################################
336 ######################################################################
340 # If NO_REBUILD is set then break the dependencies on everything but
341 # the source files so we can test crates without rebuilding any of the
343 ifeq ($(NO_REBUILD),)
344 TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(SREQ$(1)_T_$(2)_H_$(3)) \
345 $$(foreach crate,$$(TARGET_CRATES_$(2)), \
346 $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)) \
347 $$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4))
350 TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(RSINPUTS_$(4))
353 $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)): CFG_COMPILER_HOST_TRIPLE = $(2)
354 $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)): \
356 $$(TESTDEP_$(1)_$(2)_$(3)_$(4))
357 @$$(call E, rustc: $$@)
358 $(Q)CFG_LLVM_LINKAGE_FILE=$$(LLVM_LINKAGE_PATH_$(2)) \
359 $$(subst @,,$$(STAGE$(1)_T_$(2)_H_$(3))) -o $$@ $$< --test \
360 -Cmetadata="test-crate" -L "$$(RT_OUTPUT_DIR_$(2))" \
361 $$(LLVM_LIBDIR_RUSTFLAGS_$(2)) \
366 $(foreach host,$(CFG_HOST), \
367 $(eval $(foreach target,$(CFG_TARGET), \
368 $(eval $(foreach stage,$(STAGES), \
369 $(eval $(foreach crate,$(TEST_CRATES), \
370 $(eval $(call TEST_RUNNER,$(stage),$(target),$(host),$(crate))))))))))
372 define DEF_TEST_CRATE_RULES
373 check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
375 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
376 $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
377 @$$(call E, run: $$<)
378 $$(Q)touch $$@.start_time
379 $$(Q)$$(call CFG_RUN_TEST_$(2),$$<,$(1),$(2),$(3)) $$(TESTARGS) \
380 --logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
381 $$(call CRATE_TEST_EXTRA_ARGS,$(1),$(2),$(3),$(4)) \
382 && touch -r $$@.start_time $$@ && rm $$@.start_time
385 define DEF_TEST_CRATE_RULES_android
386 check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
388 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
389 $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
390 @$$(call E, run: $$< via adb)
391 $$(Q)touch $$@.start_time
392 $$(Q)$(CFG_ADB) push $$< $(CFG_ADB_TEST_DIR)
393 $$(Q)$(CFG_ADB) shell '(cd $(CFG_ADB_TEST_DIR); LD_LIBRARY_PATH=./$(2) \
395 --logfile $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log \
396 $$(call CRATE_TEST_EXTRA_ARGS,$(1),$(2),$(3),$(4)) $(TESTARGS))' \
397 > tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp
398 $$(Q)cat tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp
399 $$(Q)touch tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
400 $$(Q)$(CFG_ADB) pull $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log tmp/
401 $$(Q)$(CFG_ADB) shell rm $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
402 @if grep -q "result: ok" tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
404 rm tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
405 touch -r $$@.start_time $$@ && rm $$@.start_time; \
407 rm tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
412 define DEF_TEST_CRATE_RULES_null
413 check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
415 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
416 $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
417 @$$(call E, failing: no device for $$< )
421 $(foreach host,$(CFG_HOST), \
422 $(foreach target,$(CFG_TARGET), \
423 $(foreach stage,$(STAGES), \
424 $(foreach crate, $(TEST_CRATES), \
425 $(if $(findstring $(target),$(CFG_BUILD)), \
426 $(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))), \
427 $(if $(findstring android, $(target)), \
428 $(if $(findstring $(CFG_ADB_DEVICE_STATUS),"true"), \
429 $(eval $(call DEF_TEST_CRATE_RULES_android,$(stage),$(target),$(host),$(crate))), \
430 $(eval $(call DEF_TEST_CRATE_RULES_null,$(stage),$(target),$(host),$(crate))) \
432 $(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))) \
435 ######################################################################
436 # Rules for the compiletest tests (rpass, rfail, etc.)
437 ######################################################################
439 RPASS_RS := $(call rwildcard,$(S)src/test/run-pass/,*.rs)
440 RPASS_VALGRIND_RS := $(call rwildcard,$(S)src/test/run-pass-valgrind/,*.rs)
441 RPASS_FULL_RS := $(call rwildcard,$(S)src/test/run-pass-fulldeps/,*.rs)
442 RFAIL_FULL_RS := $(call rwildcard,$(S)src/test/run-fail-fulldeps/,*.rs)
443 CFAIL_FULL_RS := $(call rwildcard,$(S)src/test/compile-fail-fulldeps/,*.rs)
444 RFAIL_RS := $(call rwildcard,$(S)src/test/run-fail/,*.rs)
445 RFAIL_RS := $(call rwildcard,$(S)src/test/run-fail/,*.rs)
446 CFAIL_RS := $(call rwildcard,$(S)src/test/compile-fail/,*.rs)
447 PFAIL_RS := $(call rwildcard,$(S)src/test/parse-fail/,*.rs)
448 PRETTY_RS := $(call rwildcard,$(S)src/test/pretty/,*.rs)
449 DEBUGINFO_GDB_RS := $(call rwildcard,$(S)src/test/debuginfo/,*.rs)
450 DEBUGINFO_LLDB_RS := $(call rwildcard,$(S)src/test/debuginfo/,*.rs)
451 CODEGEN_RS := $(call rwildcard,$(S)src/test/codegen/,*.rs)
452 CODEGEN_CC := $(call rwildcard,$(S)src/test/codegen/,*.cc)
453 CODEGEN_UNITS_RS := $(call rwildcard,$(S)src/test/codegen-units/,*.rs)
454 INCREMENTAL_RS := $(call rwildcard,$(S)src/test/incremental/,*.rs)
455 RMAKE_RS := $(wildcard $(S)src/test/run-make/*/Makefile)
456 UI_RS := $(call rwildcard,$(S)src/test/ui/,*.rs) \
457 $(call rwildcard,$(S)src/test/ui/,*.stdout) \
458 $(call rwildcard,$(S)src/test/ui/,*.stderr)
459 RUSTDOCCK_RS := $(call rwildcard,$(S)src/test/rustdoc/,*.rs)
461 RPASS_TESTS := $(RPASS_RS)
462 RPASS_VALGRIND_TESTS := $(RPASS_VALGRIND_RS)
463 RPASS_FULL_TESTS := $(RPASS_FULL_RS)
464 RFAIL_FULL_TESTS := $(RFAIL_FULL_RS)
465 CFAIL_FULL_TESTS := $(CFAIL_FULL_RS)
466 RFAIL_TESTS := $(RFAIL_RS)
467 CFAIL_TESTS := $(CFAIL_RS)
468 PFAIL_TESTS := $(PFAIL_RS)
469 PRETTY_TESTS := $(PRETTY_RS)
470 DEBUGINFO_GDB_TESTS := $(DEBUGINFO_GDB_RS)
471 DEBUGINFO_LLDB_TESTS := $(DEBUGINFO_LLDB_RS)
472 CODEGEN_TESTS := $(CODEGEN_RS) $(CODEGEN_CC)
473 CODEGEN_UNITS_TESTS := $(CODEGEN_UNITS_RS)
474 INCREMENTAL_TESTS := $(INCREMENTAL_RS)
475 RMAKE_TESTS := $(RMAKE_RS)
477 RUSTDOCCK_TESTS := $(RUSTDOCCK_RS)
479 CTEST_SRC_BASE_rpass = run-pass
480 CTEST_BUILD_BASE_rpass = run-pass
481 CTEST_MODE_rpass = run-pass
482 CTEST_RUNTOOL_rpass = $(CTEST_RUNTOOL)
484 CTEST_SRC_BASE_rpass-valgrind = run-pass-valgrind
485 CTEST_BUILD_BASE_rpass-valgrind = run-pass-valgrind
486 CTEST_MODE_rpass-valgrind = run-pass-valgrind
487 CTEST_RUNTOOL_rpass-valgrind = $(CTEST_RUNTOOL)
489 CTEST_SRC_BASE_rpass-full = run-pass-fulldeps
490 CTEST_BUILD_BASE_rpass-full = run-pass-fulldeps
491 CTEST_MODE_rpass-full = run-pass
492 CTEST_RUNTOOL_rpass-full = $(CTEST_RUNTOOL)
494 CTEST_SRC_BASE_rfail-full = run-fail-fulldeps
495 CTEST_BUILD_BASE_rfail-full = run-fail-fulldeps
496 CTEST_MODE_rfail-full = run-fail
497 CTEST_RUNTOOL_rfail-full = $(CTEST_RUNTOOL)
499 CTEST_SRC_BASE_cfail-full = compile-fail-fulldeps
500 CTEST_BUILD_BASE_cfail-full = compile-fail-fulldeps
501 CTEST_MODE_cfail-full = compile-fail
502 CTEST_RUNTOOL_cfail-full = $(CTEST_RUNTOOL)
504 CTEST_SRC_BASE_rfail = run-fail
505 CTEST_BUILD_BASE_rfail = run-fail
506 CTEST_MODE_rfail = run-fail
507 CTEST_RUNTOOL_rfail = $(CTEST_RUNTOOL)
509 CTEST_SRC_BASE_cfail = compile-fail
510 CTEST_BUILD_BASE_cfail = compile-fail
511 CTEST_MODE_cfail = compile-fail
512 CTEST_RUNTOOL_cfail = $(CTEST_RUNTOOL)
514 CTEST_SRC_BASE_pfail = parse-fail
515 CTEST_BUILD_BASE_pfail = parse-fail
516 CTEST_MODE_pfail = parse-fail
517 CTEST_RUNTOOL_pfail = $(CTEST_RUNTOOL)
519 CTEST_SRC_BASE_debuginfo-gdb = debuginfo
520 CTEST_BUILD_BASE_debuginfo-gdb = debuginfo-gdb
521 CTEST_MODE_debuginfo-gdb = debuginfo-gdb
522 CTEST_RUNTOOL_debuginfo-gdb = $(CTEST_RUNTOOL)
524 CTEST_SRC_BASE_debuginfo-lldb = debuginfo
525 CTEST_BUILD_BASE_debuginfo-lldb = debuginfo-lldb
526 CTEST_MODE_debuginfo-lldb = debuginfo-lldb
527 CTEST_RUNTOOL_debuginfo-lldb = $(CTEST_RUNTOOL)
529 CTEST_SRC_BASE_codegen = codegen
530 CTEST_BUILD_BASE_codegen = codegen
531 CTEST_MODE_codegen = codegen
532 CTEST_RUNTOOL_codegen = $(CTEST_RUNTOOL)
534 CTEST_SRC_BASE_codegen-units = codegen-units
535 CTEST_BUILD_BASE_codegen-units = codegen-units
536 CTEST_MODE_codegen-units = codegen-units
537 CTEST_RUNTOOL_codegen-units = $(CTEST_RUNTOOL)
539 CTEST_SRC_BASE_incremental = incremental
540 CTEST_BUILD_BASE_incremental = incremental
541 CTEST_MODE_incremental = incremental
542 CTEST_RUNTOOL_incremental = $(CTEST_RUNTOOL)
544 CTEST_SRC_BASE_rmake = run-make
545 CTEST_BUILD_BASE_rmake = run-make
546 CTEST_MODE_rmake = run-make
547 CTEST_RUNTOOL_rmake = $(CTEST_RUNTOOL)
549 CTEST_SRC_BASE_ui = ui
550 CTEST_BUILD_BASE_ui = ui
552 CTEST_RUNTOOL_ui = $(CTEST_RUNTOOL)
554 CTEST_SRC_BASE_rustdocck = rustdoc
555 CTEST_BUILD_BASE_rustdocck = rustdoc
556 CTEST_MODE_rustdocck = rustdoc
557 CTEST_RUNTOOL_rustdocck = $(CTEST_RUNTOOL)
559 # CTEST_DISABLE_$(TEST_GROUP), if set, will cause the test group to be
560 # disabled and the associated message to be printed as a warning
561 # during attempts to run those tests.
564 CTEST_DISABLE_debuginfo-gdb = "no gdb found"
568 CTEST_DISABLE_debuginfo-lldb = "no lldb found"
571 ifneq ($(CFG_OSTYPE),apple-darwin)
572 CTEST_DISABLE_debuginfo-lldb = "lldb tests are only run on darwin"
575 ifeq ($(CFG_OSTYPE),apple-darwin)
576 CTEST_DISABLE_debuginfo-gdb = "gdb on darwin needs root"
579 ifeq ($(findstring android, $(CFG_TARGET)), android)
580 CTEST_DISABLE_debuginfo-gdb =
581 CTEST_DISABLE_debuginfo-lldb = "lldb tests are disabled on android"
584 ifeq ($(findstring msvc,$(CFG_TARGET)),msvc)
585 CTEST_DISABLE_debuginfo-gdb = "gdb tests are disabled on MSVC"
588 # CTEST_DISABLE_NONSELFHOST_$(TEST_GROUP), if set, will cause that
589 # test group to be disabled *unless* the target is able to build a
590 # compiler (i.e. when the target triple is in the set of host
591 # triples). The associated message will be printed as a warning
592 # during attempts to run those tests.
594 define DEF_CTEST_VARS
596 # All the per-stage build rules you might want to call from the
599 # $(1) is the stage number
600 # $(2) is the target triple to test
601 # $(3) is the host triple to test
603 # Prerequisites for compiletest tests
604 TEST_SREQ$(1)_T_$(2)_H_$(3) = \
605 $$(HBIN$(1)_H_$(3))/compiletest$$(X_$(3)) \
606 $$(SREQ$(1)_T_$(2)_H_$(3))
608 # Rules for the cfail/rfail/rpass test runner
610 # The tests select when to use debug configuration on their own;
611 # remove directive, if present, from CFG_RUSTC_FLAGS (issue #7898).
612 CTEST_RUSTC_FLAGS := $$(subst -C debug-assertions,,$$(subst -C debug-assertions=on,,$$(CFG_RUSTC_FLAGS)))
614 # The tests cannot be optimized while the rest of the compiler is optimized, so
615 # filter out the optimization (if any) from rustc and then figure out if we need
617 CTEST_RUSTC_FLAGS := $$(subst -O,,$$(CTEST_RUSTC_FLAGS))
618 ifndef CFG_DISABLE_OPTIMIZE_TESTS
619 CTEST_RUSTC_FLAGS += -O
622 # Analogously to the above, whether to pass `-g` when compiling tests
623 # is a separate choice from whether to pass `-g` when building the
624 # compiler and standard library themselves.
625 CTEST_RUSTC_FLAGS := $$(subst -g,,$$(CTEST_RUSTC_FLAGS))
626 ifdef CFG_ENABLE_DEBUGINFO_TESTS
627 CTEST_RUSTC_FLAGS += -g
630 CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) = \
631 --compile-lib-path $$(HLIB$(1)_H_$(3)) \
632 --run-lib-path $$(TLIB$(1)_T_$(2)_H_$(3)) \
633 --rustc-path $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
634 --rustdoc-path $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
635 --llvm-filecheck $(CFG_LLVM_INST_DIR_$(CFG_BUILD))/bin/FileCheck \
636 --stage-id stage$(1)-$(2) \
639 --docck-python $$(CFG_PYTHON) \
640 --lldb-python $$(CFG_LLDB_PYTHON) \
641 --gdb-version="$(CFG_GDB_VERSION)" \
642 --lldb-version="$(CFG_LLDB_VERSION)" \
643 --android-cross-path=$(CFG_ARM_LINUX_ANDROIDEABI_NDK) \
644 --adb-path=$(CFG_ADB) \
645 --adb-test-dir=$(CFG_ADB_TEST_DIR) \
646 --host-rustcflags "$(RUSTC_FLAGS_$(3)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(3))" \
647 --lldb-python-dir=$(CFG_LLDB_PYTHON_DIR) \
648 --target-rustcflags "$(RUSTC_FLAGS_$(2)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(2))" \
649 --cc '$$(call FIND_COMPILER,$$(CC_$(2)))' \
650 --cxx '$$(call FIND_COMPILER,$$(CXX_$(2)))' \
651 --cflags "$$(CFG_GCCISH_CFLAGS_$(2))" \
652 --llvm-components "$$(LLVM_ALL_COMPONENTS_$(2))" \
653 --llvm-cxxflags "$$(LLVM_CXXFLAGS_$(2))" \
656 ifdef CFG_VALGRIND_RPASS
657 ifdef GOOD_VALGRIND_$(2)
658 CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) += --valgrind-path "$(CFG_VALGRIND_RPASS)"
662 ifndef CFG_DISABLE_VALGRIND_RPASS
663 ifdef GOOD_VALGRIND_$(2)
664 CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) += --force-valgrind
668 CTEST_DEPS_rpass_$(1)-T-$(2)-H-$(3) = $$(RPASS_TESTS)
669 CTEST_DEPS_rpass-valgrind_$(1)-T-$(2)-H-$(3) = $$(RPASS_VALGRIND_TESTS)
670 CTEST_DEPS_rpass-full_$(1)-T-$(2)-H-$(3) = $$(RPASS_FULL_TESTS) $$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3))
671 CTEST_DEPS_rfail-full_$(1)-T-$(2)-H-$(3) = $$(RFAIL_FULL_TESTS) $$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3))
672 CTEST_DEPS_cfail-full_$(1)-T-$(2)-H-$(3) = $$(CFAIL_FULL_TESTS) $$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3))
673 CTEST_DEPS_rfail_$(1)-T-$(2)-H-$(3) = $$(RFAIL_TESTS)
674 CTEST_DEPS_cfail_$(1)-T-$(2)-H-$(3) = $$(CFAIL_TESTS)
675 CTEST_DEPS_pfail_$(1)-T-$(2)-H-$(3) = $$(PFAIL_TESTS)
676 CTEST_DEPS_debuginfo-gdb_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_GDB_TESTS)
677 CTEST_DEPS_debuginfo-lldb_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_LLDB_TESTS) \
678 $(S)src/etc/lldb_batchmode.py \
679 $(S)src/etc/lldb_rust_formatters.py
680 CTEST_DEPS_codegen_$(1)-T-$(2)-H-$(3) = $$(CODEGEN_TESTS)
681 CTEST_DEPS_codegen-units_$(1)-T-$(2)-H-$(3) = $$(CODEGEN_UNITS_TESTS)
682 CTEST_DEPS_incremental_$(1)-T-$(2)-H-$(3) = $$(INCREMENTAL_TESTS)
683 CTEST_DEPS_rmake_$(1)-T-$(2)-H-$(3) = $$(RMAKE_TESTS) \
684 $$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3))
685 CTEST_DEPS_ui_$(1)-T-$(2)-H-$(3) = $$(UI_TESTS)
686 CTEST_DEPS_rustdocck_$(1)-T-$(2)-H-$(3) = $$(RUSTDOCCK_TESTS) \
687 $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
688 $(S)src/etc/htmldocck.py
692 $(foreach host,$(CFG_HOST), \
693 $(eval $(foreach target,$(CFG_TARGET), \
694 $(eval $(foreach stage,$(STAGES), \
695 $(eval $(call DEF_CTEST_VARS,$(stage),$(target),$(host))))))))
697 define DEF_RUN_COMPILETEST
699 CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4) = \
700 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
701 --src-base $$(S)src/test/$$(CTEST_SRC_BASE_$(4))/ \
702 --build-base $(3)/test/$$(CTEST_BUILD_BASE_$(4))/ \
703 --mode $$(CTEST_MODE_$(4)) \
704 $$(CTEST_RUNTOOL_$(4))
706 check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
708 # CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4)
709 # Goal: leave this variable as empty string if we should run the test.
710 # Otherwise, set it to the reason we are not running the test.
711 # (Encoded as a separate variable because GNU make does not have a
712 # good way to express OR on ifeq commands)
714 ifneq ($$(CTEST_DISABLE_$(4)),)
715 # Test suite is disabled for all configured targets.
716 CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4) := $$(CTEST_DISABLE_$(4))
718 # else, check if non-self-hosted target (i.e. target not-in hosts) ...
719 ifeq ($$(findstring $(2),$$(CFG_HOST)),)
720 # ... if so, then check if this test suite is disabled for non-selfhosts.
721 ifneq ($$(CTEST_DISABLE_NONSELFHOST_$(4)),)
722 # Test suite is disabled for this target.
723 CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4) := $$(CTEST_DISABLE_NONSELFHOST_$(4))
726 # Neither DISABLE nor DISABLE_NONSELFHOST is set ==> okay, run the test.
729 ifeq ($$(CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4)),)
730 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
731 export INCLUDE := $$(CFG_MSVC_INCLUDE_PATH_$$(HOST_$(3)))
732 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
733 export LIB := $$(CFG_MSVC_LIB_PATH_$$(HOST_$(3)))
734 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
735 $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
736 $$(CTEST_DEPS_$(4)_$(1)-T-$(2)-H-$(3))
737 @$$(call E, run $(4) [$(2)]: $$<)
738 $$(Q)touch $$@.start_time
739 $$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
740 $$(CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
741 --logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
742 && touch -r $$@.start_time $$@ && rm $$@.start_time
746 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)):
747 @$$(call E, run $(4) [$(2)]: $$<)
748 @$$(call E, warning: tests disabled: $$(CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4)))
755 CTEST_NAMES = rpass rpass-valgrind rpass-full rfail-full cfail-full rfail cfail pfail \
756 debuginfo-gdb debuginfo-lldb codegen codegen-units rustdocck incremental \
759 $(foreach host,$(CFG_HOST), \
760 $(eval $(foreach target,$(CFG_TARGET), \
761 $(eval $(foreach stage,$(STAGES), \
762 $(eval $(foreach name,$(CTEST_NAMES), \
763 $(eval $(call DEF_RUN_COMPILETEST,$(stage),$(target),$(host),$(name))))))))))
765 PRETTY_NAMES = pretty-rpass pretty-rpass-valgrind pretty-rpass-full pretty-rfail-full pretty-rfail \
767 PRETTY_DEPS_pretty-rpass = $(RPASS_TESTS)
768 PRETTY_DEPS_pretty-rpass-valgrind = $(RPASS_VALGRIND_TESTS)
769 PRETTY_DEPS_pretty-rpass-full = $(RPASS_FULL_TESTS)
770 PRETTY_DEPS_pretty-rfail-full = $(RFAIL_FULL_TESTS)
771 PRETTY_DEPS_pretty-rfail = $(RFAIL_TESTS)
772 PRETTY_DEPS_pretty-pretty = $(PRETTY_TESTS)
773 PRETTY_DIRNAME_pretty-rpass = run-pass
774 PRETTY_DIRNAME_pretty-rpass-valgrind = run-pass-valgrind
775 PRETTY_DIRNAME_pretty-rpass-full = run-pass-fulldeps
776 PRETTY_DIRNAME_pretty-rfail-full = run-fail-fulldeps
777 PRETTY_DIRNAME_pretty-rfail = run-fail
778 PRETTY_DIRNAME_pretty-pretty = pretty
780 define DEF_PRETTY_FULLDEPS
781 PRETTY_DEPS$(1)_T_$(2)_H_$(3)_pretty-rpass-full = $$(CSREQ$(1)_T_$(3)_H_$(3))
782 PRETTY_DEPS$(1)_T_$(2)_H_$(3)_pretty-rfail-full = $$(CSREQ$(1)_T_$(3)_H_$(3))
785 $(foreach host,$(CFG_HOST), \
786 $(foreach target,$(CFG_TARGET), \
787 $(foreach stage,$(STAGES), \
788 $(eval $(call DEF_PRETTY_FULLDEPS,$(stage),$(target),$(host))))))
790 define DEF_RUN_PRETTY_TEST
792 PRETTY_ARGS$(1)-T-$(2)-H-$(3)-$(4) = \
793 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
794 --src-base $$(S)src/test/$$(PRETTY_DIRNAME_$(4))/ \
795 --build-base $(3)/test/$$(PRETTY_DIRNAME_$(4))/ \
798 check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
800 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
801 $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
802 $$(PRETTY_DEPS_$(4)) \
803 $$(PRETTY_DEPS$(1)_T_$(2)_H_$(3)_$(4))
804 @$$(call E, run pretty-rpass [$(2)]: $$<)
805 $$(Q)touch $$@.start_time
806 $$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
807 $$(PRETTY_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
808 --logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
809 && touch -r $$@.start_time $$@ && rm $$@.start_time
813 $(foreach host,$(CFG_HOST), \
814 $(foreach target,$(CFG_TARGET), \
815 $(foreach stage,$(STAGES), \
816 $(foreach pretty-name,$(PRETTY_NAMES), \
817 $(eval $(call DEF_RUN_PRETTY_TEST,$(stage),$(target),$(host),$(pretty-name)))))))
820 ######################################################################
821 # Crate & freestanding documentation tests
822 ######################################################################
825 RUSTDOC_EXE_$(1)_T_$(2)_H_$(3) := $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3))
826 RUSTDOC_$(1)_T_$(2)_H_$(3) := $$(RPATH_VAR$(1)_T_$(2)_H_$(3)) $$(RUSTDOC_EXE_$(1)_T_$(2)_H_$(3))
829 $(foreach host,$(CFG_HOST), \
830 $(foreach target,$(CFG_TARGET), \
831 $(foreach stage,$(STAGES), \
832 $(eval $(call DEF_RUSTDOC,$(stage),$(target),$(host))))))
838 check-stage$(1)-T-$(2)-H-$(3)-doc-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4))
840 # If NO_REBUILD is set then break the dependencies on everything but
841 # the source files so we can test documentation without rebuilding
843 ifeq ($(NO_REBUILD),)
844 DOCTESTDEP_$(1)_$(2)_$(3)_$(4) = \
846 $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
847 $$(RUSTDOC_EXE_$(1)_T_$(2)_H_$(3))
849 DOCTESTDEP_$(1)_$(2)_$(3)_$(4) = $$(DOCFILE_$(4))
852 ifeq ($(2),$$(CFG_BUILD))
853 $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)): $$(DOCTESTDEP_$(1)_$(2)_$(3)_$(4))
854 @$$(call E, run doc-$(4) [$(2)])
855 $$(Q)touch $$@.start_time
856 $$(Q)$$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --cfg dox --test $$< \
857 --test-args "$$(TESTARGS)" && \
858 touch -r $$@.start_time $$@ && rm $$@.start_time
860 $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)):
865 $(foreach host,$(CFG_HOST), \
866 $(foreach target,$(CFG_TARGET), \
867 $(foreach stage,$(STAGES), \
868 $(foreach docname,$(DOC_NAMES), \
869 $(eval $(call DEF_DOC_TEST,$(stage),$(target),$(host),$(docname)))))))
873 define DEF_CRATE_DOC_TEST
875 # If NO_REBUILD is set then break the dependencies on everything but
876 # the source files so we can test crate documentation without
877 # rebuilding any of the parent crates.
878 ifeq ($(NO_REBUILD),)
879 CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4) = \
880 $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
881 $$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4)) \
882 $$(RUSTDOC_EXE_$(1)_T_$(2)_H_$(3))
884 CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4) = $$(RSINPUTS_$(4))
887 check-stage$(1)-T-$(2)-H-$(3)-doc-crate-$(4)-exec: \
888 $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4))
890 ifeq ($(2),$$(CFG_BUILD))
891 $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4)): $$(CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4))
892 @$$(call E, run doc-crate-$(4) [$(2)])
893 $$(Q)touch $$@.start_time
894 $$(Q)CFG_LLVM_LINKAGE_FILE=$$(LLVM_LINKAGE_PATH_$(2)) \
895 $$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --test --cfg dox \
896 $$(CRATEFILE_$(4)) --test-args "$$(TESTARGS)" && \
897 touch -r $$@.start_time $$@ && rm $$@.start_time
899 $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4)):
905 $(foreach host,$(CFG_HOST), \
906 $(foreach target,$(CFG_TARGET), \
907 $(foreach stage,$(STAGES), \
908 $(foreach crate,$(TEST_DOC_CRATES), \
909 $(eval $(call DEF_CRATE_DOC_TEST,$(stage),$(target),$(host),$(crate)))))))
911 define DEF_DOC_TEST_ERROR_INDEX
913 check-stage$(1)-T-$(2)-H-$(3)-doc-error-index-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-error-index)
915 ifeq ($(2),$$(CFG_BUILD))
916 $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-error-index): \
917 $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
919 $$(Q)touch $$@.start_time
920 $$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --test doc/error-index.md
921 $$(Q)touch -r $$@.start_time $$@ && rm $$@.start_time
923 $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-error-index):
928 $(foreach host,$(CFG_HOST), \
929 $(foreach target,$(CFG_TARGET), \
930 $(foreach stage,$(STAGES), \
931 $(eval $(call DEF_DOC_TEST_ERROR_INDEX,$(stage),$(target),$(host))))))
933 ######################################################################
935 ######################################################################
939 $(foreach crate,$(TEST_CRATES),$(crate)) \
940 $(foreach crate,$(TEST_DOC_CRATES),doc-crate-$(crate)) \
958 $(foreach docname,$(DOC_NAMES),doc-$(docname)) \
961 pretty-rpass-valgrind \
968 define DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST
969 check-stage$(1)-T-$(2)-H-$(3): check-stage$(1)-T-$(2)-H-$(3)-exec
972 $(foreach stage,$(STAGES), \
973 $(foreach target,$(CFG_TARGET), \
974 $(foreach host,$(CFG_HOST), \
975 $(eval $(call DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST,$(stage),$(target),$(host))))))
977 define DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST_AND_GROUP
978 check-stage$(1)-T-$(2)-H-$(3)-$(4): check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec
981 $(foreach stage,$(STAGES), \
982 $(foreach target,$(CFG_TARGET), \
983 $(foreach host,$(CFG_HOST), \
984 $(foreach group,$(TEST_GROUPS), \
985 $(eval $(call DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST_AND_GROUP,$(stage),$(target),$(host),$(group)))))))
987 define DEF_CHECK_FOR_STAGE
988 check-stage$(1): check-stage$(1)-H-$$(CFG_BUILD)
989 check-stage$(1)-H-all: $$(foreach target,$$(CFG_TARGET), \
990 check-stage$(1)-H-$$(target))
993 $(foreach stage,$(STAGES), \
994 $(eval $(call DEF_CHECK_FOR_STAGE,$(stage))))
996 define DEF_CHECK_FOR_STAGE_AND_GROUP
997 check-stage$(1)-$(2): check-stage$(1)-H-$$(CFG_BUILD)-$(2)
998 check-stage$(1)-H-all-$(2): $$(foreach target,$$(CFG_TARGET), \
999 check-stage$(1)-H-$$(target)-$(2))
1002 $(foreach stage,$(STAGES), \
1003 $(foreach group,$(TEST_GROUPS), \
1004 $(eval $(call DEF_CHECK_FOR_STAGE_AND_GROUP,$(stage),$(group)))))
1007 define DEF_CHECK_FOR_STAGE_AND_HOSTS
1008 check-stage$(1)-H-$(2): $$(foreach target,$$(CFG_TARGET), \
1009 check-stage$(1)-T-$$(target)-H-$(2))
1012 $(foreach stage,$(STAGES), \
1013 $(foreach host,$(CFG_HOST), \
1014 $(eval $(call DEF_CHECK_FOR_STAGE_AND_HOSTS,$(stage),$(host)))))
1016 define DEF_CHECK_FOR_STAGE_AND_HOSTS_AND_GROUP
1017 check-stage$(1)-H-$(2)-$(3): $$(foreach target,$$(CFG_TARGET), \
1018 check-stage$(1)-T-$$(target)-H-$(2)-$(3))
1021 $(foreach stage,$(STAGES), \
1022 $(foreach host,$(CFG_HOST), \
1023 $(foreach group,$(TEST_GROUPS), \
1024 $(eval $(call DEF_CHECK_FOR_STAGE_AND_HOSTS_AND_GROUP,$(stage),$(host),$(group))))))
1026 define DEF_CHECK_DOC_FOR_STAGE
1027 check-stage$(1)-docs: $$(foreach docname,$$(DOC_NAMES), \
1028 check-stage$(1)-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-doc-$$(docname)) \
1029 $$(foreach crate,$$(TEST_DOC_CRATES), \
1030 check-stage$(1)-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-doc-crate-$$(crate)) \
1031 check-stage$(1)-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-doc-error-index-exec
1034 $(foreach stage,$(STAGES), \
1035 $(eval $(call DEF_CHECK_DOC_FOR_STAGE,$(stage))))
1037 define DEF_CHECK_CRATE
1038 check-$(1): check-stage2-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-$(1)-exec
1041 $(foreach crate,$(TEST_CRATES), \
1042 $(eval $(call DEF_CHECK_CRATE,$(crate))))