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,$(TARGET_CRATES)) \
27 collectionstest coretest
28 TEST_DOC_CRATES = $(DOC_CRATES) arena flate fmt_macros getopts graphviz \
29 log rand rbml serialize syntax term test
30 TEST_HOST_CRATES = $(filter-out rustc_typeck rustc_borrowck rustc_resolve \
31 rustc_trans rustc_lint,\
33 TEST_CRATES = $(TEST_TARGET_CRATES) $(TEST_HOST_CRATES)
35 ######################################################################
36 # Environment configuration
37 ######################################################################
39 # The arguments to all test runners
41 TESTARGS += $(TESTNAME)
48 # Arguments to the cfail/rfail/rpass tests
50 CTEST_RUNTOOL = --runtool "$(CFG_VALGRIND)"
53 CTEST_TESTARGS := $(TESTARGS)
55 # --bench is only relevant for crate tests, not for the compile tests
61 CTEST_TESTARGS += --verbose
64 # Setting locale ensures that gdb's output remains consistent.
65 # This prevents tests from failing with some locales (fixes #17423).
68 TEST_LOG_FILE=tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
69 TEST_OK_FILE=tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).ok
71 define DEF_TARGET_COMMANDS
74 CFG_RUN_TEST_$(1)=$$(TARGET_RPATH_VAR$$(2)_T_$$(3)_H_$$(4)) \
75 $$(call CFG_RUN_$(1),,$$(CFG_VALGRIND) $$(1))
78 ifdef CFG_WINDOWSY_$(1)
79 CFG_TESTLIB_$(1)=$$(CFG_BUILD_DIR)$$(2)/$$(strip \
80 $$(if $$(findstring stage0,$$(1)), \
81 stage0/$$(CFG_LIBDIR_RELATIVE), \
82 $$(if $$(findstring stage1,$$(1)), \
83 stage1/$$(CFG_LIBDIR_RELATIVE), \
84 $$(if $$(findstring stage2,$$(1)), \
85 stage2/$$(CFG_LIBDIR_RELATIVE), \
86 $$(if $$(findstring stage3,$$(1)), \
87 stage3/$$(CFG_LIBDIR_RELATIVE), \
88 )))))/rustlib/$$(CFG_BUILD)/lib
89 CFG_RUN_TEST_$(1)=$$(TARGET_RPATH_VAR$$(2)_T_$$(3)_H_$$(4)) \
90 $$(call CFG_RUN_$(1),$$(call CFG_TESTLIB_$(1),$$(1),$$(4)),$$(1))
93 # Run the compiletest runner itself under valgrind
95 CFG_RUN_CTEST_$(1)=$$(RPATH_VAR$$(1)_T_$$(3)_H_$$(3)) \
96 $$(call CFG_RUN_TEST_$$(CFG_BUILD),$$(3),$$(4))
98 CFG_RUN_CTEST_$(1)=$$(RPATH_VAR$$(1)_T_$$(3)_H_$$(3)) \
99 $$(call CFG_RUN_$$(CFG_BUILD),$$(TLIB$$(1)_T_$$(3)_H_$$(3)),$$(2))
104 $(foreach target,$(CFG_TARGET), \
105 $(eval $(call DEF_TARGET_COMMANDS,$(target))))
107 # Target platform specific variables for android
108 define DEF_ADB_DEVICE_STATUS
109 CFG_ADB_DEVICE_STATUS=$(1)
112 $(foreach target,$(CFG_TARGET), \
113 $(if $(findstring android, $(target)), \
114 $(if $(findstring adb,$(CFG_ADB)), \
115 $(if $(findstring device,$(shell $(CFG_ADB) devices 2>/dev/null | grep -E '^[:_A-Za-z0-9-]+[[:blank:]]+device')), \
116 $(info check: android device attached) \
117 $(eval $(call DEF_ADB_DEVICE_STATUS, true)), \
118 $(info check: android device not attached) \
119 $(eval $(call DEF_ADB_DEVICE_STATUS, false)) \
121 $(info check: adb not found) \
122 $(eval $(call DEF_ADB_DEVICE_STATUS, false)) \
127 ifeq ($(CFG_ADB_DEVICE_STATUS),true)
128 CFG_ADB_TEST_DIR=/data/tmp
130 $(info check: android device test dir $(CFG_ADB_TEST_DIR) ready \
131 $(shell $(CFG_ADB) remount 1>/dev/null) \
132 $(shell $(CFG_ADB) shell rm -r $(CFG_ADB_TEST_DIR) >/dev/null) \
133 $(shell $(CFG_ADB) shell mkdir $(CFG_ADB_TEST_DIR)) \
134 $(shell $(CFG_ADB) push $(S)src/etc/adb_run_wrapper.sh $(CFG_ADB_TEST_DIR) 1>/dev/null) \
135 $(foreach target,$(CFG_TARGET), \
136 $(if $(findstring android, $(target)), \
137 $(shell $(CFG_ADB) shell mkdir $(CFG_ADB_TEST_DIR)/$(target)) \
138 $(foreach crate,$(TARGET_CRATES), \
139 $(shell $(CFG_ADB) push $(TLIB2_T_$(target)_H_$(CFG_BUILD))/$(call CFG_LIB_GLOB_$(target),$(crate)) \
140 $(CFG_ADB_TEST_DIR)/$(target))), \
146 # $(1) - name of doc test
147 # $(2) - file of the test
149 DOC_NAMES := $$(DOC_NAMES) $(1)
153 $(foreach doc,$(DOCS), \
154 $(eval $(call DOCTEST,md-$(doc),$(S)src/doc/$(doc).md)))
155 $(foreach file,$(wildcard $(S)src/doc/book/*.md), \
156 $(eval $(call DOCTEST,$(file:$(S)src/doc/book/%.md=book-%),$(file))))
157 $(foreach file,$(wildcard $(S)src/doc/nomicon/*.md), \
158 $(eval $(call DOCTEST,$(file:$(S)src/doc/nomicon/%.md=nomicon-%),$(file))))
159 ######################################################################
161 ######################################################################
163 # The main testing target. Tests lots of stuff.
164 check: check-sanitycheck cleantmptestlogs cleantestlibs all check-stage2 tidy
165 $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
167 # As above but don't bother running tidy.
168 check-notidy: check-sanitycheck cleantmptestlogs cleantestlibs all check-stage2
169 $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
171 # A slightly smaller set of tests for smoke testing.
172 check-lite: check-sanitycheck cleantestlibs cleantmptestlogs \
173 $(foreach crate,$(TEST_TARGET_CRATES),check-stage2-$(crate)) \
174 check-stage2-rpass check-stage2-rpass-valgrind \
175 check-stage2-rfail check-stage2-cfail check-stage2-pfail check-stage2-rmake
176 $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
178 # Only check the 'reference' tests: rpass/cfail/rfail/rmake.
179 check-ref: check-sanitycheck cleantestlibs cleantmptestlogs check-stage2-rpass \
180 check-stage2-rpass-valgrind check-stage2-rfail check-stage2-cfail check-stage2-pfail \
182 $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
184 # Only check the docs.
185 check-docs: check-sanitycheck cleantestlibs cleantmptestlogs check-stage2-docs
186 $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
188 # Some less critical tests that are not prone to breakage.
189 # Not run as part of the normal test suite, but tested by bors on checkin.
190 check-secondary: check-build-compiletest check-build-lexer-verifier check-lexer check-pretty
192 .PHONY: check-sanitycheck
195 $(Q)$(CFG_PYTHON) $(S)src/etc/check-sanitycheck.py
197 # check + check-secondary.
199 # Issue #17883: build check-secondary first so hidden dependencies in
200 # e.g. building compiletest are exercised (resolve those by adding
201 # deps to rules that need them; not by putting `check` first here).
202 check-all: check-secondary check
204 # Pretty-printing tests.
205 check-pretty: check-stage2-T-$(CFG_BUILD)-H-$(CFG_BUILD)-pretty-exec
207 define DEF_CHECK_BUILD_COMPILETEST_FOR_STAGE
208 check-stage$(1)-build-compiletest: $$(HBIN$(1)_H_$(CFG_BUILD))/compiletest$$(X_$(CFG_BUILD))
211 $(foreach stage,$(STAGES), \
212 $(eval $(call DEF_CHECK_BUILD_COMPILETEST_FOR_STAGE,$(stage))))
214 check-build-compiletest: \
215 check-stage1-build-compiletest \
216 check-stage2-build-compiletest
218 .PHONY: cleantmptestlogs cleantestlibs
224 $(Q)find $(CFG_BUILD)/test \
225 -name '*.[odasS]' -o \
232 -name '*.libaux' -o \
235 -name '*.debugger.script' \
239 ######################################################################
241 ######################################################################
248 # Run the tidy script in multiple parts to avoid huge 'echo' commands
250 tidy: tidy-basic tidy-binaries tidy-errors tidy-features
256 @$(call E, check: formatting)
257 $(Q) $(CFG_PYTHON) $(S)src/etc/tidy.py $(S)src/
259 .PHONY: tidy-binaries
261 @$(call E, check: binaries)
262 $(Q)find $(S)src -type f \
263 \( -perm -u+x -or -perm -g+x -or -perm -o+x \) \
264 -not -name '*.rs' -and -not -name '*.py' \
265 -and -not -name '*.sh' -and -not -name '*.pp' \
266 | grep '^$(S)src/jemalloc' -v \
267 | grep '^$(S)src/libuv' -v \
268 | grep '^$(S)src/llvm' -v \
269 | grep '^$(S)src/rt/hoedown' -v \
270 | grep '^$(S)src/gyp' -v \
271 | grep '^$(S)src/etc' -v \
272 | grep '^$(S)src/doc' -v \
273 | grep '^$(S)src/compiler-rt' -v \
274 | grep '^$(S)src/libbacktrace' -v \
275 | grep '^$(S)src/rust-installer' -v \
276 | grep '^$(S)src/liblibc' -v \
277 | xargs $(CFG_PYTHON) $(S)src/etc/check-binaries.py
281 @$(call E, check: extended errors)
282 $(Q) $(CFG_PYTHON) $(S)src/etc/errorck.py $(S)src/
284 .PHONY: tidy-features
286 @$(call E, check: feature sanity)
287 $(Q) $(CFG_PYTHON) $(S)src/etc/featureck.py $(S)src/
290 ######################################################################
292 ######################################################################
296 check-stage$(1)-T-$(2)-H-$(3)-exec: \
297 check-stage$(1)-T-$(2)-H-$(3)-rpass-exec \
298 check-stage$(1)-T-$(2)-H-$(3)-rfail-exec \
299 check-stage$(1)-T-$(2)-H-$(3)-cfail-exec \
300 check-stage$(1)-T-$(2)-H-$(3)-pfail-exec \
301 check-stage$(1)-T-$(2)-H-$(3)-rpass-valgrind-exec \
302 check-stage$(1)-T-$(2)-H-$(3)-rpass-full-exec \
303 check-stage$(1)-T-$(2)-H-$(3)-rfail-full-exec \
304 check-stage$(1)-T-$(2)-H-$(3)-cfail-full-exec \
305 check-stage$(1)-T-$(2)-H-$(3)-rmake-exec \
306 check-stage$(1)-T-$(2)-H-$(3)-rustdocck-exec \
307 check-stage$(1)-T-$(2)-H-$(3)-crates-exec \
308 check-stage$(1)-T-$(2)-H-$(3)-doc-crates-exec \
309 check-stage$(1)-T-$(2)-H-$(3)-debuginfo-gdb-exec \
310 check-stage$(1)-T-$(2)-H-$(3)-debuginfo-lldb-exec \
311 check-stage$(1)-T-$(2)-H-$(3)-codegen-exec \
312 check-stage$(1)-T-$(2)-H-$(3)-codegen-units-exec \
313 check-stage$(1)-T-$(2)-H-$(3)-doc-exec \
314 check-stage$(1)-T-$(2)-H-$(3)-pretty-exec
316 # Only test the compiler-dependent crates when the target is
317 # able to build a compiler (when the target triple is in the set of host triples)
318 ifneq ($$(findstring $(2),$$(CFG_HOST)),)
320 check-stage$(1)-T-$(2)-H-$(3)-crates-exec: \
321 $$(foreach crate,$$(TEST_CRATES), \
322 check-stage$(1)-T-$(2)-H-$(3)-$$(crate)-exec)
326 check-stage$(1)-T-$(2)-H-$(3)-crates-exec: \
327 $$(foreach crate,$$(TEST_TARGET_CRATES), \
328 check-stage$(1)-T-$(2)-H-$(3)-$$(crate)-exec)
332 check-stage$(1)-T-$(2)-H-$(3)-doc-crates-exec: \
333 $$(foreach crate,$$(TEST_DOC_CRATES), \
334 check-stage$(1)-T-$(2)-H-$(3)-doc-crate-$$(crate)-exec)
336 check-stage$(1)-T-$(2)-H-$(3)-doc-exec: \
337 $$(foreach docname,$$(DOC_NAMES), \
338 check-stage$(1)-T-$(2)-H-$(3)-doc-$$(docname)-exec) \
340 check-stage$(1)-T-$(2)-H-$(3)-pretty-exec: \
341 check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-exec \
342 check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-valgrind-exec \
343 check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-full-exec \
344 check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail-exec \
345 check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail-full-exec \
346 check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty-exec
350 $(foreach host,$(CFG_HOST), \
351 $(foreach target,$(CFG_TARGET), \
352 $(foreach stage,$(STAGES), \
353 $(eval $(call DEF_TEST_SETS,$(stage),$(target),$(host))))))
356 ######################################################################
358 ######################################################################
362 # If NO_REBUILD is set then break the dependencies on everything but
363 # the source files so we can test crates without rebuilding any of the
365 ifeq ($(NO_REBUILD),)
366 TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(SREQ$(1)_T_$(2)_H_$(3)) \
367 $$(foreach crate,$$(TARGET_CRATES), \
368 $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)) \
369 $$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4))
372 TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(RSINPUTS_$(4))
375 $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)): CFG_COMPILER_HOST_TRIPLE = $(2)
376 $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)): \
378 $$(TESTDEP_$(1)_$(2)_$(3)_$(4))
379 @$$(call E, rustc: $$@)
380 $(Q)CFG_LLVM_LINKAGE_FILE=$$(LLVM_LINKAGE_PATH_$(2)) \
381 $$(subst @,,$$(STAGE$(1)_T_$(2)_H_$(3))) -o $$@ $$< --test \
382 -L "$$(RT_OUTPUT_DIR_$(2))" \
383 $$(LLVM_LIBDIR_RUSTFLAGS_$(2)) \
388 $(foreach host,$(CFG_HOST), \
389 $(eval $(foreach target,$(CFG_TARGET), \
390 $(eval $(foreach stage,$(STAGES), \
391 $(eval $(foreach crate,$(TEST_CRATES), \
392 $(eval $(call TEST_RUNNER,$(stage),$(target),$(host),$(crate))))))))))
394 define DEF_TEST_CRATE_RULES
395 check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
397 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
398 $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
399 @$$(call E, run: $$<)
400 $$(Q)touch $$@.start_time
401 $$(Q)$$(call CFG_RUN_TEST_$(2),$$<,$(1),$(2),$(3)) $$(TESTARGS) \
402 --logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
403 $$(call CRATE_TEST_EXTRA_ARGS,$(1),$(2),$(3),$(4)) \
404 && touch -r $$@.start_time $$@ && rm $$@.start_time
407 define DEF_TEST_CRATE_RULES_android
408 check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
410 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
411 $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
412 @$$(call E, run: $$< via adb)
413 $$(Q)touch $$@.start_time
414 $$(Q)$(CFG_ADB) push $$< $(CFG_ADB_TEST_DIR)
415 $$(Q)$(CFG_ADB) shell '(cd $(CFG_ADB_TEST_DIR); LD_LIBRARY_PATH=./$(2) \
417 --logfile $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log \
418 $$(call CRATE_TEST_EXTRA_ARGS,$(1),$(2),$(3),$(4)) $(TESTARGS))' \
419 > tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp
420 $$(Q)cat tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp
421 $$(Q)touch tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
422 $$(Q)$(CFG_ADB) pull $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log tmp/
423 $$(Q)$(CFG_ADB) shell rm $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
424 @if grep -q "result: ok" tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
426 rm tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
427 touch -r $$@.start_time $$@ && rm $$@.start_time; \
429 rm tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
434 define DEF_TEST_CRATE_RULES_null
435 check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
437 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
438 $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
439 @$$(call E, failing: no device for $$< )
443 $(foreach host,$(CFG_HOST), \
444 $(foreach target,$(CFG_TARGET), \
445 $(foreach stage,$(STAGES), \
446 $(foreach crate, $(TEST_CRATES), \
447 $(if $(findstring $(target),$(CFG_BUILD)), \
448 $(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))), \
449 $(if $(findstring android, $(target)), \
450 $(if $(findstring $(CFG_ADB_DEVICE_STATUS),"true"), \
451 $(eval $(call DEF_TEST_CRATE_RULES_android,$(stage),$(target),$(host),$(crate))), \
452 $(eval $(call DEF_TEST_CRATE_RULES_null,$(stage),$(target),$(host),$(crate))) \
454 $(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))) \
457 ######################################################################
458 # Rules for the compiletest tests (rpass, rfail, etc.)
459 ######################################################################
461 RPASS_RS := $(wildcard $(S)src/test/run-pass/*.rs)
462 RPASS_VALGRIND_RS := $(wildcard $(S)src/test/run-pass-valgrind/*.rs)
463 RPASS_FULL_RS := $(wildcard $(S)src/test/run-pass-fulldeps/*.rs)
464 RFAIL_FULL_RS := $(wildcard $(S)src/test/run-fail-fulldeps/*.rs)
465 CFAIL_FULL_RS := $(wildcard $(S)src/test/compile-fail-fulldeps/*.rs)
466 RFAIL_RS := $(wildcard $(S)src/test/run-fail/*.rs)
467 CFAIL_RS := $(wildcard $(S)src/test/compile-fail/*.rs)
468 PFAIL_RS := $(wildcard $(S)src/test/parse-fail/*.rs)
469 PRETTY_RS := $(wildcard $(S)src/test/pretty/*.rs)
470 DEBUGINFO_GDB_RS := $(wildcard $(S)src/test/debuginfo/*.rs)
471 DEBUGINFO_LLDB_RS := $(wildcard $(S)src/test/debuginfo/*.rs)
472 CODEGEN_RS := $(wildcard $(S)src/test/codegen/*.rs)
473 CODEGEN_CC := $(wildcard $(S)src/test/codegen/*.cc)
474 CODEGEN_UNITS_RS := $(wildcard $(S)src/test/codegen-units/*.rs)
475 RUSTDOCCK_RS := $(wildcard $(S)src/test/rustdoc/*.rs)
477 RPASS_TESTS := $(RPASS_RS)
478 RPASS_VALGRIND_TESTS := $(RPASS_VALGRIND_RS)
479 RPASS_FULL_TESTS := $(RPASS_FULL_RS)
480 RFAIL_FULL_TESTS := $(RFAIL_FULL_RS)
481 CFAIL_FULL_TESTS := $(CFAIL_FULL_RS)
482 RFAIL_TESTS := $(RFAIL_RS)
483 CFAIL_TESTS := $(CFAIL_RS)
484 PFAIL_TESTS := $(PFAIL_RS)
485 PRETTY_TESTS := $(PRETTY_RS)
486 DEBUGINFO_GDB_TESTS := $(DEBUGINFO_GDB_RS)
487 DEBUGINFO_LLDB_TESTS := $(DEBUGINFO_LLDB_RS)
488 CODEGEN_TESTS := $(CODEGEN_RS) $(CODEGEN_CC)
489 CODEGEN_UNITS_TESTS := $(CODEGEN_UNITS_RS)
490 RUSTDOCCK_TESTS := $(RUSTDOCCK_RS)
492 CTEST_SRC_BASE_rpass = run-pass
493 CTEST_BUILD_BASE_rpass = run-pass
494 CTEST_MODE_rpass = run-pass
495 CTEST_RUNTOOL_rpass = $(CTEST_RUNTOOL)
497 CTEST_SRC_BASE_rpass-valgrind = run-pass-valgrind
498 CTEST_BUILD_BASE_rpass-valgrind = run-pass-valgrind
499 CTEST_MODE_rpass-valgrind = run-pass-valgrind
500 CTEST_RUNTOOL_rpass-valgrind = $(CTEST_RUNTOOL)
502 CTEST_SRC_BASE_rpass-full = run-pass-fulldeps
503 CTEST_BUILD_BASE_rpass-full = run-pass-fulldeps
504 CTEST_MODE_rpass-full = run-pass
505 CTEST_RUNTOOL_rpass-full = $(CTEST_RUNTOOL)
507 CTEST_SRC_BASE_rfail-full = run-fail-fulldeps
508 CTEST_BUILD_BASE_rfail-full = run-fail-fulldeps
509 CTEST_MODE_rfail-full = run-fail
510 CTEST_RUNTOOL_rfail-full = $(CTEST_RUNTOOL)
512 CTEST_SRC_BASE_cfail-full = compile-fail-fulldeps
513 CTEST_BUILD_BASE_cfail-full = compile-fail-fulldeps
514 CTEST_MODE_cfail-full = compile-fail
515 CTEST_RUNTOOL_cfail-full = $(CTEST_RUNTOOL)
517 CTEST_SRC_BASE_rfail = run-fail
518 CTEST_BUILD_BASE_rfail = run-fail
519 CTEST_MODE_rfail = run-fail
520 CTEST_RUNTOOL_rfail = $(CTEST_RUNTOOL)
522 CTEST_SRC_BASE_cfail = compile-fail
523 CTEST_BUILD_BASE_cfail = compile-fail
524 CTEST_MODE_cfail = compile-fail
525 CTEST_RUNTOOL_cfail = $(CTEST_RUNTOOL)
527 CTEST_SRC_BASE_pfail = parse-fail
528 CTEST_BUILD_BASE_pfail = parse-fail
529 CTEST_MODE_pfail = parse-fail
530 CTEST_RUNTOOL_pfail = $(CTEST_RUNTOOL)
532 CTEST_SRC_BASE_debuginfo-gdb = debuginfo
533 CTEST_BUILD_BASE_debuginfo-gdb = debuginfo-gdb
534 CTEST_MODE_debuginfo-gdb = debuginfo-gdb
535 CTEST_RUNTOOL_debuginfo-gdb = $(CTEST_RUNTOOL)
537 CTEST_SRC_BASE_debuginfo-lldb = debuginfo
538 CTEST_BUILD_BASE_debuginfo-lldb = debuginfo-lldb
539 CTEST_MODE_debuginfo-lldb = debuginfo-lldb
540 CTEST_RUNTOOL_debuginfo-lldb = $(CTEST_RUNTOOL)
542 CTEST_SRC_BASE_codegen = codegen
543 CTEST_BUILD_BASE_codegen = codegen
544 CTEST_MODE_codegen = codegen
545 CTEST_RUNTOOL_codegen = $(CTEST_RUNTOOL)
547 CTEST_SRC_BASE_codegen-units = codegen-units
548 CTEST_BUILD_BASE_codegen-units = codegen-units
549 CTEST_MODE_codegen-units = codegen-units
550 CTEST_RUNTOOL_codegen-units = $(CTEST_RUNTOOL)
552 CTEST_SRC_BASE_rustdocck = rustdoc
553 CTEST_BUILD_BASE_rustdocck = rustdoc
554 CTEST_MODE_rustdocck = rustdoc
555 CTEST_RUNTOOL_rustdocck = $(CTEST_RUNTOOL)
557 # CTEST_DISABLE_$(TEST_GROUP), if set, will cause the test group to be
558 # disabled and the associated message to be printed as a warning
559 # during attempts to run those tests.
562 CTEST_DISABLE_debuginfo-gdb = "no gdb found"
566 CTEST_DISABLE_debuginfo-lldb = "no lldb found"
569 ifneq ($(CFG_OSTYPE),apple-darwin)
570 CTEST_DISABLE_debuginfo-lldb = "lldb tests are only run on darwin"
573 ifeq ($(CFG_OSTYPE),apple-darwin)
574 CTEST_DISABLE_debuginfo-gdb = "gdb on darwin needs root"
577 ifeq ($(findstring android, $(CFG_TARGET)), android)
578 CTEST_DISABLE_debuginfo-gdb =
579 CTEST_DISABLE_debuginfo-lldb = "lldb tests are disabled on android"
582 ifeq ($(findstring msvc,$(CFG_TARGET)),msvc)
583 CTEST_DISABLE_debuginfo-gdb = "gdb tests are disabled on MSVC"
586 # CTEST_DISABLE_NONSELFHOST_$(TEST_GROUP), if set, will cause that
587 # test group to be disabled *unless* the target is able to build a
588 # compiler (i.e. when the target triple is in the set of host
589 # triples). The associated message will be printed as a warning
590 # during attempts to run those tests.
592 define DEF_CTEST_VARS
594 # All the per-stage build rules you might want to call from the
597 # $(1) is the stage number
598 # $(2) is the target triple to test
599 # $(3) is the host triple to test
601 # Prerequisites for compiletest tests
602 TEST_SREQ$(1)_T_$(2)_H_$(3) = \
603 $$(HBIN$(1)_H_$(3))/compiletest$$(X_$(3)) \
604 $$(SREQ$(1)_T_$(2)_H_$(3))
606 # Rules for the cfail/rfail/rpass test runner
608 # The tests select when to use debug configuration on their own;
609 # remove directive, if present, from CFG_RUSTC_FLAGS (issue #7898).
610 CTEST_RUSTC_FLAGS := $$(subst -C debug-assertions,,$$(subst -C debug-assertions=on,,$$(CFG_RUSTC_FLAGS)))
612 # The tests cannot be optimized while the rest of the compiler is optimized, so
613 # filter out the optimization (if any) from rustc and then figure out if we need
615 CTEST_RUSTC_FLAGS := $$(subst -O,,$$(CTEST_RUSTC_FLAGS))
616 ifndef CFG_DISABLE_OPTIMIZE_TESTS
617 CTEST_RUSTC_FLAGS += -O
620 # Analogously to the above, whether to pass `-g` when compiling tests
621 # is a separate choice from whether to pass `-g` when building the
622 # compiler and standard library themselves.
623 CTEST_RUSTC_FLAGS := $$(subst -g,,$$(CTEST_RUSTC_FLAGS))
624 ifdef CFG_ENABLE_DEBUGINFO_TESTS
625 CTEST_RUSTC_FLAGS += -g
628 CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
629 --compile-lib-path $$(HLIB$(1)_H_$(3)) \
630 --run-lib-path $$(TLIB$(1)_T_$(2)_H_$(3)) \
631 --rustc-path $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
632 --rustdoc-path $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
633 --llvm-bin-path $(CFG_LLVM_INST_DIR_$(CFG_BUILD))/bin \
634 --aux-base $$(S)src/test/auxiliary/ \
635 --stage-id stage$(1)-$(2) \
638 --python $$(CFG_PYTHON) \
639 --gdb-version="$(CFG_GDB_VERSION)" \
640 --lldb-version="$(CFG_LLDB_VERSION)" \
641 --android-cross-path=$(CFG_ANDROID_CROSS_PATH) \
642 --adb-path=$(CFG_ADB) \
643 --adb-test-dir=$(CFG_ADB_TEST_DIR) \
644 --host-rustcflags "$(RUSTC_FLAGS_$(3)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(3))" \
645 --lldb-python-dir=$(CFG_LLDB_PYTHON_DIR) \
646 --target-rustcflags "$(RUSTC_FLAGS_$(2)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(2))" \
649 ifdef CFG_VALGRIND_RPASS
650 ifdef GOOD_VALGRIND_$(2)
651 CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) += --valgrind-path "$(CFG_VALGRIND_RPASS)"
655 ifndef CFG_DISABLE_VALGRIND_RPASS
656 ifdef GOOD_VALGRIND_$(2)
657 CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) += --force-valgrind
661 CTEST_DEPS_rpass_$(1)-T-$(2)-H-$(3) = $$(RPASS_TESTS)
662 CTEST_DEPS_rpass-valgrind_$(1)-T-$(2)-H-$(3) = $$(RPASS_VALGRIND_TESTS)
663 CTEST_DEPS_rpass-full_$(1)-T-$(2)-H-$(3) = $$(RPASS_FULL_TESTS) $$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3))
664 CTEST_DEPS_rfail-full_$(1)-T-$(2)-H-$(3) = $$(RFAIL_FULL_TESTS) $$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3))
665 CTEST_DEPS_cfail-full_$(1)-T-$(2)-H-$(3) = $$(CFAIL_FULL_TESTS) $$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3))
666 CTEST_DEPS_rfail_$(1)-T-$(2)-H-$(3) = $$(RFAIL_TESTS)
667 CTEST_DEPS_cfail_$(1)-T-$(2)-H-$(3) = $$(CFAIL_TESTS)
668 CTEST_DEPS_pfail_$(1)-T-$(2)-H-$(3) = $$(PFAIL_TESTS)
669 CTEST_DEPS_debuginfo-gdb_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_GDB_TESTS)
670 CTEST_DEPS_debuginfo-lldb_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_LLDB_TESTS) \
671 $(S)src/etc/lldb_batchmode.py \
672 $(S)src/etc/lldb_rust_formatters.py
673 CTEST_DEPS_codegen_$(1)-T-$(2)-H-$(3) = $$(CODEGEN_TESTS)
674 CTEST_DEPS_codegen-units_$(1)-T-$(2)-H-$(3) = $$(CODEGEN_UNITS_TESTS)
675 CTEST_DEPS_rustdocck_$(1)-T-$(2)-H-$(3) = $$(RUSTDOCCK_TESTS) \
676 $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
677 $(S)src/etc/htmldocck.py
681 $(foreach host,$(CFG_HOST), \
682 $(eval $(foreach target,$(CFG_TARGET), \
683 $(eval $(foreach stage,$(STAGES), \
684 $(eval $(call DEF_CTEST_VARS,$(stage),$(target),$(host))))))))
686 define DEF_RUN_COMPILETEST
688 CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4) := \
689 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
690 --src-base $$(S)src/test/$$(CTEST_SRC_BASE_$(4))/ \
691 --build-base $(3)/test/$$(CTEST_BUILD_BASE_$(4))/ \
692 --mode $$(CTEST_MODE_$(4)) \
693 $$(CTEST_RUNTOOL_$(4))
695 check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
697 # CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4)
698 # Goal: leave this variable as empty string if we should run the test.
699 # Otherwise, set it to the reason we are not running the test.
700 # (Encoded as a separate variable because GNU make does not have a
701 # good way to express OR on ifeq commands)
703 ifneq ($$(CTEST_DISABLE_$(4)),)
704 # Test suite is disabled for all configured targets.
705 CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4) := $$(CTEST_DISABLE_$(4))
707 # else, check if non-self-hosted target (i.e. target not-in hosts) ...
708 ifeq ($$(findstring $(2),$$(CFG_HOST)),)
709 # ... if so, then check if this test suite is disabled for non-selfhosts.
710 ifneq ($$(CTEST_DISABLE_NONSELFHOST_$(4)),)
711 # Test suite is disabled for this target.
712 CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4) := $$(CTEST_DISABLE_NONSELFHOST_$(4))
715 # Neither DISABLE nor DISABLE_NONSELFHOST is set ==> okay, run the test.
718 ifeq ($$(CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4)),)
719 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
720 $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
721 $$(CTEST_DEPS_$(4)_$(1)-T-$(2)-H-$(3))
722 @$$(call E, run $(4) [$(2)]: $$<)
723 $$(Q)touch $$@.start_time
724 $$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
725 $$(CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
726 --logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
727 && touch -r $$@.start_time $$@ && rm $$@.start_time
731 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)):
732 @$$(call E, run $(4) [$(2)]: $$<)
733 @$$(call E, warning: tests disabled: $$(CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4)))
740 CTEST_NAMES = rpass rpass-valgrind rpass-full rfail-full cfail-full rfail cfail pfail \
741 debuginfo-gdb debuginfo-lldb codegen codegen-units rustdocck
743 $(foreach host,$(CFG_HOST), \
744 $(eval $(foreach target,$(CFG_TARGET), \
745 $(eval $(foreach stage,$(STAGES), \
746 $(eval $(foreach name,$(CTEST_NAMES), \
747 $(eval $(call DEF_RUN_COMPILETEST,$(stage),$(target),$(host),$(name))))))))))
749 PRETTY_NAMES = pretty-rpass pretty-rpass-valgrind pretty-rpass-full pretty-rfail-full pretty-rfail \
751 PRETTY_DEPS_pretty-rpass = $(RPASS_TESTS)
752 PRETTY_DEPS_pretty-rpass-valgrind = $(RPASS_VALGRIND_TESTS)
753 PRETTY_DEPS_pretty-rpass-full = $(RPASS_FULL_TESTS)
754 PRETTY_DEPS_pretty-rfail-full = $(RFAIL_FULL_TESTS)
755 PRETTY_DEPS_pretty-rfail = $(RFAIL_TESTS)
756 PRETTY_DEPS_pretty-pretty = $(PRETTY_TESTS)
757 PRETTY_DIRNAME_pretty-rpass = run-pass
758 PRETTY_DIRNAME_pretty-rpass-valgrind = run-pass-valgrind
759 PRETTY_DIRNAME_pretty-rpass-full = run-pass-fulldeps
760 PRETTY_DIRNAME_pretty-rfail-full = run-fail-fulldeps
761 PRETTY_DIRNAME_pretty-rfail = run-fail
762 PRETTY_DIRNAME_pretty-pretty = pretty
764 define DEF_PRETTY_FULLDEPS
765 PRETTY_DEPS$(1)_T_$(2)_H_$(3)_pretty-rpass-full = $$(CSREQ$(1)_T_$(3)_H_$(3))
766 PRETTY_DEPS$(1)_T_$(2)_H_$(3)_pretty-rfail-full = $$(CSREQ$(1)_T_$(3)_H_$(3))
769 $(foreach host,$(CFG_HOST), \
770 $(foreach target,$(CFG_TARGET), \
771 $(foreach stage,$(STAGES), \
772 $(eval $(call DEF_PRETTY_FULLDEPS,$(stage),$(target),$(host))))))
774 define DEF_RUN_PRETTY_TEST
776 PRETTY_ARGS$(1)-T-$(2)-H-$(3)-$(4) := \
777 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
778 --src-base $$(S)src/test/$$(PRETTY_DIRNAME_$(4))/ \
779 --build-base $(3)/test/$$(PRETTY_DIRNAME_$(4))/ \
782 check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
784 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
785 $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
786 $$(PRETTY_DEPS_$(4)) \
787 $$(PRETTY_DEPS$(1)_T_$(2)_H_$(3)_$(4))
788 @$$(call E, run pretty-rpass [$(2)]: $$<)
789 $$(Q)touch $$@.start_time
790 $$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
791 $$(PRETTY_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
792 --logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
793 && touch -r $$@.start_time $$@ && rm $$@.start_time
797 $(foreach host,$(CFG_HOST), \
798 $(foreach target,$(CFG_TARGET), \
799 $(foreach stage,$(STAGES), \
800 $(foreach pretty-name,$(PRETTY_NAMES), \
801 $(eval $(call DEF_RUN_PRETTY_TEST,$(stage),$(target),$(host),$(pretty-name)))))))
804 ######################################################################
805 # Crate & freestanding documentation tests
806 ######################################################################
809 RUSTDOC_EXE_$(1)_T_$(2)_H_$(3) := $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3))
810 RUSTDOC_$(1)_T_$(2)_H_$(3) := $$(RPATH_VAR$(1)_T_$(2)_H_$(3)) $$(RUSTDOC_EXE_$(1)_T_$(2)_H_$(3))
813 $(foreach host,$(CFG_HOST), \
814 $(foreach target,$(CFG_TARGET), \
815 $(foreach stage,$(STAGES), \
816 $(eval $(call DEF_RUSTDOC,$(stage),$(target),$(host))))))
822 check-stage$(1)-T-$(2)-H-$(3)-doc-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4))
824 # If NO_REBUILD is set then break the dependencies on everything but
825 # the source files so we can test documentation without rebuilding
827 ifeq ($(NO_REBUILD),)
828 DOCTESTDEP_$(1)_$(2)_$(3)_$(4) = \
830 $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
831 $$(RUSTDOC_EXE_$(1)_T_$(2)_H_$(3))
833 DOCTESTDEP_$(1)_$(2)_$(3)_$(4) = $$(DOCFILE_$(4))
836 ifeq ($(2),$$(CFG_BUILD))
837 $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)): $$(DOCTESTDEP_$(1)_$(2)_$(3)_$(4))
838 @$$(call E, run doc-$(4) [$(2)])
839 $$(Q)touch $$@.start_time
840 $$(Q)$$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --cfg dox --test $$< \
841 --test-args "$$(TESTARGS)" && \
842 touch -r $$@.start_time $$@ && rm $$@.start_time
844 $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)):
849 $(foreach host,$(CFG_HOST), \
850 $(foreach target,$(CFG_TARGET), \
851 $(foreach stage,$(STAGES), \
852 $(foreach docname,$(DOC_NAMES), \
853 $(eval $(call DEF_DOC_TEST,$(stage),$(target),$(host),$(docname)))))))
857 define DEF_CRATE_DOC_TEST
859 # If NO_REBUILD is set then break the dependencies on everything but
860 # the source files so we can test crate documentation without
861 # rebuilding any of the parent crates.
862 ifeq ($(NO_REBUILD),)
863 CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4) = \
864 $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
865 $$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4)) \
866 $$(RUSTDOC_EXE_$(1)_T_$(2)_H_$(3))
868 CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4) = $$(RSINPUTS_$(4))
871 check-stage$(1)-T-$(2)-H-$(3)-doc-crate-$(4)-exec: \
872 $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4))
874 ifeq ($(2),$$(CFG_BUILD))
875 $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4)): $$(CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4))
876 @$$(call E, run doc-crate-$(4) [$(2)])
877 $$(Q)touch $$@.start_time
878 $$(Q)CFG_LLVM_LINKAGE_FILE=$$(LLVM_LINKAGE_PATH_$(2)) \
879 $$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --test --cfg dox \
880 $$(CRATEFILE_$(4)) --test-args "$$(TESTARGS)" && \
881 touch -r $$@.start_time $$@ && rm $$@.start_time
883 $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4)):
889 $(foreach host,$(CFG_HOST), \
890 $(foreach target,$(CFG_TARGET), \
891 $(foreach stage,$(STAGES), \
892 $(foreach crate,$(TEST_DOC_CRATES), \
893 $(eval $(call DEF_CRATE_DOC_TEST,$(stage),$(target),$(host),$(crate)))))))
895 define DEF_DOC_TEST_ERROR_INDEX
897 check-stage$(1)-T-$(2)-H-$(3)-doc-error-index-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-error-index)
899 ifeq ($(2),$$(CFG_BUILD))
900 $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-error-index): \
901 $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
903 $$(Q)touch $$@.start_time
904 $$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --test doc/error-index.md
905 $$(Q)touch -r $$@.start_time $$@ && rm $$@.start_time
907 $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-error-index):
912 $(foreach host,$(CFG_HOST), \
913 $(foreach target,$(CFG_TARGET), \
914 $(foreach stage,$(STAGES), \
915 $(eval $(call DEF_DOC_TEST_ERROR_INDEX,$(stage),$(target),$(host))))))
917 ######################################################################
919 ######################################################################
923 $(foreach crate,$(TEST_CRATES),$(crate)) \
924 $(foreach crate,$(TEST_DOC_CRATES),doc-crate-$(crate)) \
940 $(foreach docname,$(DOC_NAMES),doc-$(docname)) \
943 pretty-rpass-valgrind \
950 define DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST
951 check-stage$(1)-T-$(2)-H-$(3): check-stage$(1)-T-$(2)-H-$(3)-exec
954 $(foreach stage,$(STAGES), \
955 $(foreach target,$(CFG_TARGET), \
956 $(foreach host,$(CFG_HOST), \
957 $(eval $(call DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST,$(stage),$(target),$(host))))))
959 define DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST_AND_GROUP
960 check-stage$(1)-T-$(2)-H-$(3)-$(4): check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec
963 $(foreach stage,$(STAGES), \
964 $(foreach target,$(CFG_TARGET), \
965 $(foreach host,$(CFG_HOST), \
966 $(foreach group,$(TEST_GROUPS), \
967 $(eval $(call DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST_AND_GROUP,$(stage),$(target),$(host),$(group)))))))
969 define DEF_CHECK_FOR_STAGE
970 check-stage$(1): check-stage$(1)-H-$$(CFG_BUILD)
971 check-stage$(1)-H-all: $$(foreach target,$$(CFG_TARGET), \
972 check-stage$(1)-H-$$(target))
975 $(foreach stage,$(STAGES), \
976 $(eval $(call DEF_CHECK_FOR_STAGE,$(stage))))
978 define DEF_CHECK_FOR_STAGE_AND_GROUP
979 check-stage$(1)-$(2): check-stage$(1)-H-$$(CFG_BUILD)-$(2)
980 check-stage$(1)-H-all-$(2): $$(foreach target,$$(CFG_TARGET), \
981 check-stage$(1)-H-$$(target)-$(2))
984 $(foreach stage,$(STAGES), \
985 $(foreach group,$(TEST_GROUPS), \
986 $(eval $(call DEF_CHECK_FOR_STAGE_AND_GROUP,$(stage),$(group)))))
989 define DEF_CHECK_FOR_STAGE_AND_HOSTS
990 check-stage$(1)-H-$(2): $$(foreach target,$$(CFG_TARGET), \
991 check-stage$(1)-T-$$(target)-H-$(2))
994 $(foreach stage,$(STAGES), \
995 $(foreach host,$(CFG_HOST), \
996 $(eval $(call DEF_CHECK_FOR_STAGE_AND_HOSTS,$(stage),$(host)))))
998 define DEF_CHECK_FOR_STAGE_AND_HOSTS_AND_GROUP
999 check-stage$(1)-H-$(2)-$(3): $$(foreach target,$$(CFG_TARGET), \
1000 check-stage$(1)-T-$$(target)-H-$(2)-$(3))
1003 $(foreach stage,$(STAGES), \
1004 $(foreach host,$(CFG_HOST), \
1005 $(foreach group,$(TEST_GROUPS), \
1006 $(eval $(call DEF_CHECK_FOR_STAGE_AND_HOSTS_AND_GROUP,$(stage),$(host),$(group))))))
1008 define DEF_CHECK_DOC_FOR_STAGE
1009 check-stage$(1)-docs: $$(foreach docname,$$(DOC_NAMES), \
1010 check-stage$(1)-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-doc-$$(docname)) \
1011 $$(foreach crate,$$(TEST_DOC_CRATES), \
1012 check-stage$(1)-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-doc-crate-$$(crate)) \
1013 check-stage$(1)-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-doc-error-index-exec
1016 $(foreach stage,$(STAGES), \
1017 $(eval $(call DEF_CHECK_DOC_FOR_STAGE,$(stage))))
1019 define DEF_CHECK_CRATE
1020 check-$(1): check-stage2-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-$(1)-exec
1023 $(foreach crate,$(TEST_CRATES), \
1024 $(eval $(call DEF_CHECK_CRATE,$(crate))))
1026 ######################################################################
1028 ######################################################################
1030 RMAKE_TESTS := $(shell ls -d $(S)src/test/run-make/*/)
1031 RMAKE_TESTS := $(RMAKE_TESTS:$(S)src/test/run-make/%/=%)
1033 define DEF_RMAKE_FOR_T_H
1035 # $(2) target triple
1039 ifeq ($(2)$(3),$$(CFG_BUILD)$$(CFG_BUILD))
1040 check-stage$(1)-T-$(2)-H-$(3)-rmake-exec: \
1041 $$(call TEST_OK_FILE,$(1),$(2),$(3),rmake)
1043 $$(call TEST_OK_FILE,$(1),$(2),$(3),rmake): \
1044 $$(RMAKE_TESTS:%=$(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok)
1047 $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
1048 export INCLUDE := $$(CFG_MSVC_INCLUDE_PATH_$$(HOST_$(3)))
1049 $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
1050 export LIB := $$(CFG_MSVC_LIB_PATH_$$(HOST_$(3)))
1051 $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
1052 export MSVC_LIB := "$$(CFG_MSVC_LIB_$$(HOST_$(3)))"
1053 $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
1054 $(S)src/test/run-make/%/Makefile \
1055 $$(CSREQ$(1)_T_$(2)_H_$(3))
1056 @rm -rf $(3)/test/run-make/$$*
1057 @mkdir -p $(3)/test/run-make/$$*
1058 $$(Q)touch $$@.start_time
1059 $$(Q)$$(CFG_PYTHON) $(S)src/etc/maketest.py $$(dir $$<) \
1061 $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
1062 $(3)/test/run-make/$$* \
1064 "$$(CFG_GCCISH_CFLAGS_$(3))" \
1065 $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
1067 $$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3)) \
1068 "$$(LD_LIBRARY_PATH_ENV_HOSTDIR$(1)_T_$(2)_H_$(3))" \
1069 "$$(LD_LIBRARY_PATH_ENV_TARGETDIR$(1)_T_$(2)_H_$(3))" \
1073 "$$(LLVM_LIBDIR_RUSTFLAGS_$(3))" \
1074 "$$(LLVM_ALL_COMPONENTS_$(3))" \
1075 "$$(LLVM_CXXFLAGS_$(3))"
1076 @touch -r $$@.start_time $$@ && rm $$@.start_time
1078 # FIXME #11094 - The above rule doesn't work right for multiple targets
1079 check-stage$(1)-T-$(2)-H-$(3)-rmake-exec:
1087 $(foreach stage,$(STAGES), \
1088 $(foreach target,$(CFG_TARGET), \
1089 $(foreach host,$(CFG_HOST), \
1090 $(eval $(call DEF_RMAKE_FOR_T_H,$(stage),$(target),$(host))))))