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,$(TARGET_CRATES)) \
26 collectionstest coretest
27 TEST_DOC_CRATES = $(DOC_CRATES)
28 TEST_HOST_CRATES = $(filter-out rustc_typeck rustc_borrowck rustc_resolve \
29 rustc_trans rustc_lint,\
31 TEST_CRATES = $(TEST_TARGET_CRATES) $(TEST_HOST_CRATES)
33 ######################################################################
34 # Environment configuration
35 ######################################################################
37 # The arguments to all test runners
39 TESTARGS += $(TESTNAME)
46 # Arguments to the cfail/rfail/rpass/bench tests
48 CTEST_RUNTOOL = --runtool "$(CFG_VALGRIND)"
51 # Arguments to the perf tests
53 CTEST_PERF_RUNTOOL = --runtool "$(CFG_PERF_TOOL)"
56 CTEST_TESTARGS := $(TESTARGS)
58 # --bench is only relevant for crate tests, not for the compile tests
64 CTEST_TESTARGS += --verbose
67 # Setting locale ensures that gdb's output remains consistent.
68 # This prevents tests from failing with some locales (fixes #17423).
71 # If we're running perf then set this environment variable
72 # to put the benchmarks into 'hard mode'
73 ifeq ($(MAKECMDGOALS),perf)
77 TEST_LOG_FILE=tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
78 TEST_OK_FILE=tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).ok
80 define DEF_TARGET_COMMANDS
83 CFG_RUN_TEST_$(1)=$$(TARGET_RPATH_VAR$$(2)_T_$$(3)_H_$$(4)) \
84 $$(call CFG_RUN_$(1),,$$(CFG_VALGRIND) $$(1))
87 ifdef CFG_WINDOWSY_$(1)
88 CFG_TESTLIB_$(1)=$$(CFG_BUILD_DIR)$$(2)/$$(strip \
89 $$(if $$(findstring stage0,$$(1)), \
90 stage0/$$(CFG_LIBDIR_RELATIVE), \
91 $$(if $$(findstring stage1,$$(1)), \
92 stage1/$$(CFG_LIBDIR_RELATIVE), \
93 $$(if $$(findstring stage2,$$(1)), \
94 stage2/$$(CFG_LIBDIR_RELATIVE), \
95 $$(if $$(findstring stage3,$$(1)), \
96 stage3/$$(CFG_LIBDIR_RELATIVE), \
97 )))))/rustlib/$$(CFG_BUILD)/lib
98 CFG_RUN_TEST_$(1)=$$(call CFG_RUN_$(1),$$(call CFG_TESTLIB_$(1),$$(1),$$(4)),$$(1))
101 # Run the compiletest runner itself under valgrind
103 CFG_RUN_CTEST_$(1)=$$(RPATH_VAR$$(1)_T_$$(3)_H_$$(3)) \
104 $$(call CFG_RUN_TEST_$$(CFG_BUILD),$$(3),$$(4))
106 CFG_RUN_CTEST_$(1)=$$(RPATH_VAR$$(1)_T_$$(3)_H_$$(3)) \
107 $$(call CFG_RUN_$$(CFG_BUILD),$$(TLIB$$(1)_T_$$(3)_H_$$(3)),$$(2))
112 $(foreach target,$(CFG_TARGET), \
113 $(eval $(call DEF_TARGET_COMMANDS,$(target))))
115 # Target platform specific variables for android
116 define DEF_ADB_DEVICE_STATUS
117 CFG_ADB_DEVICE_STATUS=$(1)
120 $(foreach target,$(CFG_TARGET), \
121 $(if $(findstring android, $(target)), \
122 $(if $(findstring adb,$(CFG_ADB)), \
123 $(if $(findstring device,$(shell $(CFG_ADB) devices 2>/dev/null | grep -E '^[:_A-Za-z0-9-]+[[:blank:]]+device')), \
124 $(info check: android device attached) \
125 $(eval $(call DEF_ADB_DEVICE_STATUS, true)), \
126 $(info check: android device not attached) \
127 $(eval $(call DEF_ADB_DEVICE_STATUS, false)) \
129 $(info check: adb not found) \
130 $(eval $(call DEF_ADB_DEVICE_STATUS, false)) \
135 ifeq ($(CFG_ADB_DEVICE_STATUS),true)
136 CFG_ADB_TEST_DIR=/data/tmp
138 $(info check: android device test dir $(CFG_ADB_TEST_DIR) ready \
139 $(shell $(CFG_ADB) remount 1>/dev/null) \
140 $(shell $(CFG_ADB) shell rm -r $(CFG_ADB_TEST_DIR) >/dev/null) \
141 $(shell $(CFG_ADB) shell mkdir $(CFG_ADB_TEST_DIR)) \
142 $(shell $(CFG_ADB) push $(S)src/etc/adb_run_wrapper.sh $(CFG_ADB_TEST_DIR) 1>/dev/null) \
143 $(foreach target,$(CFG_TARGET), \
144 $(if $(findstring android, $(target)), \
145 $(shell $(CFG_ADB) shell mkdir $(CFG_ADB_TEST_DIR)/$(target)) \
146 $(foreach crate,$(TARGET_CRATES), \
147 $(shell $(CFG_ADB) push $(TLIB2_T_$(target)_H_$(CFG_BUILD))/$(call CFG_LIB_GLOB_$(target),$(crate)) \
148 $(CFG_ADB_TEST_DIR)/$(target))), \
154 # $(1) - name of doc test
155 # $(2) - file of the test
157 DOC_NAMES := $$(DOC_NAMES) $(1)
161 $(foreach doc,$(DOCS), \
162 $(eval $(call DOCTEST,md-$(doc),$(S)src/doc/$(doc).md)))
163 $(foreach file,$(wildcard $(S)src/doc/trpl/*.md), \
164 $(eval $(call DOCTEST,$(file:$(S)src/doc/trpl/%.md=trpl-%),$(file))))
165 $(foreach file,$(wildcard $(S)src/doc/nomicon/*.md), \
166 $(eval $(call DOCTEST,$(file:$(S)src/doc/nomicon/%.md=nomicon-%),$(file))))
167 ######################################################################
169 ######################################################################
171 # The main testing target. Tests lots of stuff.
172 check: check-sanitycheck cleantmptestlogs cleantestlibs all check-stage2 tidy
173 $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
175 # As above but don't bother running tidy.
176 check-notidy: check-sanitycheck cleantmptestlogs cleantestlibs all check-stage2
177 $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
179 # A slightly smaller set of tests for smoke testing.
180 check-lite: check-sanitycheck cleantestlibs cleantmptestlogs \
181 $(foreach crate,$(TEST_TARGET_CRATES),check-stage2-$(crate)) \
182 check-stage2-rpass check-stage2-rpass-valgrind \
183 check-stage2-rfail check-stage2-cfail check-stage2-pfail check-stage2-rmake
184 $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
186 # Only check the 'reference' tests: rpass/cfail/rfail/rmake.
187 check-ref: check-sanitycheck cleantestlibs cleantmptestlogs check-stage2-rpass \
188 check-stage2-rpass-valgrind check-stage2-rfail check-stage2-cfail check-stage2-pfail \
190 $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
192 # Only check the docs.
193 check-docs: check-sanitycheck cleantestlibs cleantmptestlogs check-stage2-docs
194 $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
196 # Some less critical tests that are not prone to breakage.
197 # Not run as part of the normal test suite, but tested by bors on checkin.
198 check-secondary: check-build-compiletest check-build-lexer-verifier check-lexer check-pretty
200 .PHONY: check-sanitycheck
203 $(Q)$(CFG_PYTHON) $(S)src/etc/check-sanitycheck.py
205 # check + check-secondary.
207 # Issue #17883: build check-secondary first so hidden dependencies in
208 # e.g. building compiletest are exercised (resolve those by adding
209 # deps to rules that need them; not by putting `check` first here).
210 check-all: check-secondary check
212 # Pretty-printing tests.
213 check-pretty: check-stage2-T-$(CFG_BUILD)-H-$(CFG_BUILD)-pretty-exec
215 define DEF_CHECK_BUILD_COMPILETEST_FOR_STAGE
216 check-stage$(1)-build-compiletest: $$(HBIN$(1)_H_$(CFG_BUILD))/compiletest$$(X_$(CFG_BUILD))
219 $(foreach stage,$(STAGES), \
220 $(eval $(call DEF_CHECK_BUILD_COMPILETEST_FOR_STAGE,$(stage))))
222 check-build-compiletest: \
223 check-stage1-build-compiletest \
224 check-stage2-build-compiletest
226 .PHONY: cleantmptestlogs cleantestlibs
232 $(Q)find $(CFG_BUILD)/test \
233 -name '*.[odasS]' -o \
240 -name '*.libaux' -o \
243 -name '*.debugger.script' \
247 ######################################################################
249 ######################################################################
256 # Run the tidy script in multiple parts to avoid huge 'echo' commands
258 tidy: tidy-basic tidy-binaries tidy-errors tidy-features
264 @$(call E, check: formatting)
265 $(Q) $(CFG_PYTHON) $(S)src/etc/tidy.py $(S)src/
267 .PHONY: tidy-binaries
269 @$(call E, check: binaries)
270 $(Q)find $(S)src -type f \
271 \( -perm -u+x -or -perm -g+x -or -perm -o+x \) \
272 -not -name '*.rs' -and -not -name '*.py' \
273 -and -not -name '*.sh' -and -not -name '*.pp' \
274 | grep '^$(S)src/jemalloc' -v \
275 | grep '^$(S)src/libuv' -v \
276 | grep '^$(S)src/llvm' -v \
277 | grep '^$(S)src/rt/hoedown' -v \
278 | grep '^$(S)src/gyp' -v \
279 | grep '^$(S)src/etc' -v \
280 | grep '^$(S)src/doc' -v \
281 | grep '^$(S)src/compiler-rt' -v \
282 | grep '^$(S)src/libbacktrace' -v \
283 | grep '^$(S)src/rust-installer' -v \
284 | xargs $(CFG_PYTHON) $(S)src/etc/check-binaries.py
288 @$(call E, check: extended errors)
289 $(Q) $(CFG_PYTHON) $(S)src/etc/errorck.py $(S)src/
291 .PHONY: tidy-features
293 @$(call E, check: feature sanity)
294 $(Q) $(CFG_PYTHON) $(S)src/etc/featureck.py $(S)src/
297 ######################################################################
299 ######################################################################
303 check-stage$(1)-T-$(2)-H-$(3)-exec: \
304 check-stage$(1)-T-$(2)-H-$(3)-rpass-exec \
305 check-stage$(1)-T-$(2)-H-$(3)-rfail-exec \
306 check-stage$(1)-T-$(2)-H-$(3)-cfail-exec \
307 check-stage$(1)-T-$(2)-H-$(3)-pfail-exec \
308 check-stage$(1)-T-$(2)-H-$(3)-rpass-valgrind-exec \
309 check-stage$(1)-T-$(2)-H-$(3)-rpass-full-exec \
310 check-stage$(1)-T-$(2)-H-$(3)-rfail-full-exec \
311 check-stage$(1)-T-$(2)-H-$(3)-cfail-full-exec \
312 check-stage$(1)-T-$(2)-H-$(3)-rmake-exec \
313 check-stage$(1)-T-$(2)-H-$(3)-rustdocck-exec \
314 check-stage$(1)-T-$(2)-H-$(3)-crates-exec \
315 check-stage$(1)-T-$(2)-H-$(3)-doc-crates-exec \
316 check-stage$(1)-T-$(2)-H-$(3)-bench-exec \
317 check-stage$(1)-T-$(2)-H-$(3)-debuginfo-gdb-exec \
318 check-stage$(1)-T-$(2)-H-$(3)-debuginfo-lldb-exec \
319 check-stage$(1)-T-$(2)-H-$(3)-codegen-exec \
320 check-stage$(1)-T-$(2)-H-$(3)-doc-exec \
321 check-stage$(1)-T-$(2)-H-$(3)-pretty-exec
323 # Only test the compiler-dependent crates when the target is
324 # able to build a compiler (when the target triple is in the set of host triples)
325 ifneq ($$(findstring $(2),$$(CFG_HOST)),)
327 check-stage$(1)-T-$(2)-H-$(3)-crates-exec: \
328 $$(foreach crate,$$(TEST_CRATES), \
329 check-stage$(1)-T-$(2)-H-$(3)-$$(crate)-exec)
333 check-stage$(1)-T-$(2)-H-$(3)-crates-exec: \
334 $$(foreach crate,$$(TEST_TARGET_CRATES), \
335 check-stage$(1)-T-$(2)-H-$(3)-$$(crate)-exec)
339 check-stage$(1)-T-$(2)-H-$(3)-doc-crates-exec: \
340 $$(foreach crate,$$(TEST_DOC_CRATES), \
341 check-stage$(1)-T-$(2)-H-$(3)-doc-crate-$$(crate)-exec)
343 check-stage$(1)-T-$(2)-H-$(3)-doc-exec: \
344 $$(foreach docname,$$(DOC_NAMES), \
345 check-stage$(1)-T-$(2)-H-$(3)-doc-$$(docname)-exec) \
347 check-stage$(1)-T-$(2)-H-$(3)-pretty-exec: \
348 check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-exec \
349 check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-valgrind-exec \
350 check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-full-exec \
351 check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail-exec \
352 check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail-full-exec \
353 check-stage$(1)-T-$(2)-H-$(3)-pretty-bench-exec \
354 check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty-exec
358 $(foreach host,$(CFG_HOST), \
359 $(foreach target,$(CFG_TARGET), \
360 $(foreach stage,$(STAGES), \
361 $(eval $(call DEF_TEST_SETS,$(stage),$(target),$(host))))))
364 ######################################################################
366 ######################################################################
370 # If NO_REBUILD is set then break the dependencies on everything but
371 # the source files so we can test crates without rebuilding any of the
373 ifeq ($(NO_REBUILD),)
374 TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(SREQ$(1)_T_$(2)_H_$(3)) \
375 $$(foreach crate,$$(TARGET_CRATES), \
376 $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)) \
377 $$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4))
380 TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(RSINPUTS_$(4))
383 $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)): CFG_COMPILER_HOST_TRIPLE = $(2)
384 $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)): \
386 $$(TESTDEP_$(1)_$(2)_$(3)_$(4))
387 @$$(call E, rustc: $$@)
388 $(Q)CFG_LLVM_LINKAGE_FILE=$$(LLVM_LINKAGE_PATH_$(2)) \
389 $$(subst @,,$$(STAGE$(1)_T_$(2)_H_$(3))) -o $$@ $$< --test \
390 -L "$$(RT_OUTPUT_DIR_$(2))" \
391 $$(LLVM_LIBDIR_RUSTFLAGS_$(2)) \
396 $(foreach host,$(CFG_HOST), \
397 $(eval $(foreach target,$(CFG_TARGET), \
398 $(eval $(foreach stage,$(STAGES), \
399 $(eval $(foreach crate,$(TEST_CRATES), \
400 $(eval $(call TEST_RUNNER,$(stage),$(target),$(host),$(crate))))))))))
402 define DEF_TEST_CRATE_RULES
403 check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
405 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
406 $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
407 @$$(call E, run: $$<)
408 $$(Q)touch $$@.start_time
409 $$(Q)$$(call CFG_RUN_TEST_$(2),$$<,$(1),$(2),$(3)) $$(TESTARGS) \
410 --logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
411 $$(call CRATE_TEST_EXTRA_ARGS,$(1),$(2),$(3),$(4)) \
412 && touch -r $$@.start_time $$@ && rm $$@.start_time
415 define DEF_TEST_CRATE_RULES_android
416 check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
418 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
419 $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
420 @$$(call E, run: $$< via adb)
421 $$(Q)touch $$@.start_time
422 $$(Q)$(CFG_ADB) push $$< $(CFG_ADB_TEST_DIR)
423 $$(Q)$(CFG_ADB) shell '(cd $(CFG_ADB_TEST_DIR); LD_LIBRARY_PATH=./$(2) \
425 --logfile $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log \
426 $$(call CRATE_TEST_EXTRA_ARGS,$(1),$(2),$(3),$(4)) $(TESTARGS))' \
427 > tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp
428 $$(Q)cat tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp
429 $$(Q)touch tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
430 $$(Q)$(CFG_ADB) pull $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log tmp/
431 $$(Q)$(CFG_ADB) shell rm $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
432 @if grep -q "result: ok" tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
434 rm tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
435 touch -r $$@.start_time $$@ && rm $$@.start_time; \
437 rm tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
442 define DEF_TEST_CRATE_RULES_null
443 check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
445 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
446 $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
447 @$$(call E, failing: no device for $$< )
451 $(foreach host,$(CFG_HOST), \
452 $(foreach target,$(CFG_TARGET), \
453 $(foreach stage,$(STAGES), \
454 $(foreach crate, $(TEST_CRATES), \
455 $(if $(findstring $(target),$(CFG_BUILD)), \
456 $(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))), \
457 $(if $(findstring android, $(target)), \
458 $(if $(findstring $(CFG_ADB_DEVICE_STATUS),"true"), \
459 $(eval $(call DEF_TEST_CRATE_RULES_android,$(stage),$(target),$(host),$(crate))), \
460 $(eval $(call DEF_TEST_CRATE_RULES_null,$(stage),$(target),$(host),$(crate))) \
462 $(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))) \
465 ######################################################################
466 # Rules for the compiletest tests (rpass, rfail, etc.)
467 ######################################################################
469 RPASS_RS := $(wildcard $(S)src/test/run-pass/*.rs)
470 RPASS_VALGRIND_RS := $(wildcard $(S)src/test/run-pass-valgrind/*.rs)
471 RPASS_FULL_RS := $(wildcard $(S)src/test/run-pass-fulldeps/*.rs)
472 RFAIL_FULL_RS := $(wildcard $(S)src/test/run-fail-fulldeps/*.rs)
473 CFAIL_FULL_RS := $(wildcard $(S)src/test/compile-fail-fulldeps/*.rs)
474 RFAIL_RS := $(wildcard $(S)src/test/run-fail/*.rs)
475 CFAIL_RS := $(wildcard $(S)src/test/compile-fail/*.rs)
476 PFAIL_RS := $(wildcard $(S)src/test/parse-fail/*.rs)
477 BENCH_RS := $(wildcard $(S)src/test/bench/*.rs)
478 PRETTY_RS := $(wildcard $(S)src/test/pretty/*.rs)
479 DEBUGINFO_GDB_RS := $(wildcard $(S)src/test/debuginfo/*.rs)
480 DEBUGINFO_LLDB_RS := $(wildcard $(S)src/test/debuginfo/*.rs)
481 CODEGEN_RS := $(wildcard $(S)src/test/codegen/*.rs)
482 CODEGEN_CC := $(wildcard $(S)src/test/codegen/*.cc)
483 RUSTDOCCK_RS := $(wildcard $(S)src/test/rustdoc/*.rs)
485 # perf tests are the same as bench tests only they run under
486 # a performance monitor.
487 PERF_RS := $(wildcard $(S)src/test/bench/*.rs)
489 RPASS_TESTS := $(RPASS_RS)
490 RPASS_VALGRIND_TESTS := $(RPASS_VALGRIND_RS)
491 RPASS_FULL_TESTS := $(RPASS_FULL_RS)
492 RFAIL_FULL_TESTS := $(RFAIL_FULL_RS)
493 CFAIL_FULL_TESTS := $(CFAIL_FULL_RS)
494 RFAIL_TESTS := $(RFAIL_RS)
495 CFAIL_TESTS := $(CFAIL_RS)
496 PFAIL_TESTS := $(PFAIL_RS)
497 BENCH_TESTS := $(BENCH_RS)
498 PERF_TESTS := $(PERF_RS)
499 PRETTY_TESTS := $(PRETTY_RS)
500 DEBUGINFO_GDB_TESTS := $(DEBUGINFO_GDB_RS)
501 DEBUGINFO_LLDB_TESTS := $(DEBUGINFO_LLDB_RS)
502 CODEGEN_TESTS := $(CODEGEN_RS) $(CODEGEN_CC)
503 RUSTDOCCK_TESTS := $(RUSTDOCCK_RS)
505 CTEST_SRC_BASE_rpass = run-pass
506 CTEST_BUILD_BASE_rpass = run-pass
507 CTEST_MODE_rpass = run-pass
508 CTEST_RUNTOOL_rpass = $(CTEST_RUNTOOL)
510 CTEST_SRC_BASE_rpass-valgrind = run-pass-valgrind
511 CTEST_BUILD_BASE_rpass-valgrind = run-pass-valgrind
512 CTEST_MODE_rpass-valgrind = run-pass-valgrind
513 CTEST_RUNTOOL_rpass-valgrind = $(CTEST_RUNTOOL)
515 CTEST_SRC_BASE_rpass-full = run-pass-fulldeps
516 CTEST_BUILD_BASE_rpass-full = run-pass-fulldeps
517 CTEST_MODE_rpass-full = run-pass
518 CTEST_RUNTOOL_rpass-full = $(CTEST_RUNTOOL)
520 CTEST_SRC_BASE_rfail-full = run-fail-fulldeps
521 CTEST_BUILD_BASE_rfail-full = run-fail-fulldeps
522 CTEST_MODE_rfail-full = run-fail
523 CTEST_RUNTOOL_rfail-full = $(CTEST_RUNTOOL)
525 CTEST_SRC_BASE_cfail-full = compile-fail-fulldeps
526 CTEST_BUILD_BASE_cfail-full = compile-fail-fulldeps
527 CTEST_MODE_cfail-full = compile-fail
528 CTEST_RUNTOOL_cfail-full = $(CTEST_RUNTOOL)
530 CTEST_SRC_BASE_rfail = run-fail
531 CTEST_BUILD_BASE_rfail = run-fail
532 CTEST_MODE_rfail = run-fail
533 CTEST_RUNTOOL_rfail = $(CTEST_RUNTOOL)
535 CTEST_SRC_BASE_cfail = compile-fail
536 CTEST_BUILD_BASE_cfail = compile-fail
537 CTEST_MODE_cfail = compile-fail
538 CTEST_RUNTOOL_cfail = $(CTEST_RUNTOOL)
540 CTEST_SRC_BASE_pfail = parse-fail
541 CTEST_BUILD_BASE_pfail = parse-fail
542 CTEST_MODE_pfail = parse-fail
543 CTEST_RUNTOOL_pfail = $(CTEST_RUNTOOL)
545 CTEST_SRC_BASE_bench = bench
546 CTEST_BUILD_BASE_bench = bench
547 CTEST_MODE_bench = run-pass
548 CTEST_RUNTOOL_bench = $(CTEST_RUNTOOL)
550 CTEST_SRC_BASE_perf = bench
551 CTEST_BUILD_BASE_perf = perf
552 CTEST_MODE_perf = run-pass
553 CTEST_RUNTOOL_perf = $(CTEST_PERF_RUNTOOL)
555 CTEST_SRC_BASE_debuginfo-gdb = debuginfo
556 CTEST_BUILD_BASE_debuginfo-gdb = debuginfo-gdb
557 CTEST_MODE_debuginfo-gdb = debuginfo-gdb
558 CTEST_RUNTOOL_debuginfo-gdb = $(CTEST_RUNTOOL)
560 CTEST_SRC_BASE_debuginfo-lldb = debuginfo
561 CTEST_BUILD_BASE_debuginfo-lldb = debuginfo-lldb
562 CTEST_MODE_debuginfo-lldb = debuginfo-lldb
563 CTEST_RUNTOOL_debuginfo-lldb = $(CTEST_RUNTOOL)
565 CTEST_SRC_BASE_codegen = codegen
566 CTEST_BUILD_BASE_codegen = codegen
567 CTEST_MODE_codegen = codegen
568 CTEST_RUNTOOL_codegen = $(CTEST_RUNTOOL)
570 CTEST_SRC_BASE_rustdocck = rustdoc
571 CTEST_BUILD_BASE_rustdocck = rustdoc
572 CTEST_MODE_rustdocck = rustdoc
573 CTEST_RUNTOOL_rustdocck = $(CTEST_RUNTOOL)
575 # CTEST_DISABLE_$(TEST_GROUP), if set, will cause the test group to be
576 # disabled and the associated message to be printed as a warning
577 # during attempts to run those tests.
580 CTEST_DISABLE_debuginfo-gdb = "no gdb found"
584 CTEST_DISABLE_debuginfo-lldb = "no lldb found"
587 ifneq ($(CFG_OSTYPE),apple-darwin)
588 CTEST_DISABLE_debuginfo-lldb = "lldb tests are only run on darwin"
591 ifeq ($(CFG_OSTYPE),apple-darwin)
592 CTEST_DISABLE_debuginfo-gdb = "gdb on darwin needs root"
595 ifeq ($(findstring android, $(CFG_TARGET)), android)
596 CTEST_DISABLE_debuginfo-gdb =
597 CTEST_DISABLE_debuginfo-lldb = "lldb tests are disabled on android"
600 # CTEST_DISABLE_NONSELFHOST_$(TEST_GROUP), if set, will cause that
601 # test group to be disabled *unless* the target is able to build a
602 # compiler (i.e. when the target triple is in the set of of host
603 # triples). The associated message will be printed as a warning
604 # during attempts to run those tests.
606 define DEF_CTEST_VARS
608 # All the per-stage build rules you might want to call from the
611 # $(1) is the stage number
612 # $(2) is the target triple to test
613 # $(3) is the host triple to test
615 # Prerequisites for compiletest tests
616 TEST_SREQ$(1)_T_$(2)_H_$(3) = \
617 $$(HBIN$(1)_H_$(3))/compiletest$$(X_$(3)) \
618 $$(SREQ$(1)_T_$(2)_H_$(3))
620 # Rules for the cfail/rfail/rpass/bench/perf test runner
622 # The tests select when to use debug configuration on their own;
623 # remove directive, if present, from CFG_RUSTC_FLAGS (issue #7898).
624 CTEST_RUSTC_FLAGS := $$(subst -C debug-assertions,,$$(subst -C debug-assertions=on,,$$(CFG_RUSTC_FLAGS)))
626 # The tests cannot be optimized while the rest of the compiler is optimized, so
627 # filter out the optimization (if any) from rustc and then figure out if we need
629 CTEST_RUSTC_FLAGS := $$(subst -O,,$$(CTEST_RUSTC_FLAGS))
630 ifndef CFG_DISABLE_OPTIMIZE_TESTS
631 CTEST_RUSTC_FLAGS += -O
634 # Analogously to the above, whether to pass `-g` when compiling tests
635 # is a separate choice from whether to pass `-g` when building the
636 # compiler and standard library themselves.
637 CTEST_RUSTC_FLAGS := $$(subst -g,,$$(CTEST_RUSTC_FLAGS))
638 ifdef CFG_ENABLE_DEBUGINFO_TESTS
639 CTEST_RUSTC_FLAGS += -g
642 CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
643 --compile-lib-path $$(HLIB$(1)_H_$(3)) \
644 --run-lib-path $$(TLIB$(1)_T_$(2)_H_$(3)) \
645 --rustc-path $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
646 --rustdoc-path $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
647 --llvm-bin-path $(CFG_LLVM_INST_DIR_$(CFG_BUILD))/bin \
648 --aux-base $$(S)src/test/auxiliary/ \
649 --stage-id stage$(1)-$(2) \
652 --python $$(CFG_PYTHON) \
653 --gdb-version="$(CFG_GDB_VERSION)" \
654 --lldb-version="$(CFG_LLDB_VERSION)" \
655 --android-cross-path=$(CFG_ANDROID_CROSS_PATH) \
656 --adb-path=$(CFG_ADB) \
657 --adb-test-dir=$(CFG_ADB_TEST_DIR) \
658 --host-rustcflags "$(RUSTC_FLAGS_$(3)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(3))" \
659 --lldb-python-dir=$(CFG_LLDB_PYTHON_DIR) \
660 --target-rustcflags "$(RUSTC_FLAGS_$(2)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(2))" \
663 ifdef CFG_VALGRIND_RPASS
664 ifdef GOOD_VALGRIND_$(2)
665 CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) += --valgrind-path "$(CFG_VALGRIND_RPASS)"
669 ifndef CFG_DISABLE_VALGRIND_RPASS
670 ifdef GOOD_VALGRIND_$(2)
671 CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) += --force-valgrind
675 CTEST_DEPS_rpass_$(1)-T-$(2)-H-$(3) = $$(RPASS_TESTS)
676 CTEST_DEPS_rpass-valgrind_$(1)-T-$(2)-H-$(3) = $$(RPASS_VALGRIND_TESTS)
677 CTEST_DEPS_rpass-full_$(1)-T-$(2)-H-$(3) = $$(RPASS_FULL_TESTS) $$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3))
678 CTEST_DEPS_rfail-full_$(1)-T-$(2)-H-$(3) = $$(RFAIL_FULL_TESTS) $$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3))
679 CTEST_DEPS_cfail-full_$(1)-T-$(2)-H-$(3) = $$(CFAIL_FULL_TESTS) $$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3))
680 CTEST_DEPS_rfail_$(1)-T-$(2)-H-$(3) = $$(RFAIL_TESTS)
681 CTEST_DEPS_cfail_$(1)-T-$(2)-H-$(3) = $$(CFAIL_TESTS)
682 CTEST_DEPS_pfail_$(1)-T-$(2)-H-$(3) = $$(PFAIL_TESTS)
683 CTEST_DEPS_bench_$(1)-T-$(2)-H-$(3) = $$(BENCH_TESTS)
684 CTEST_DEPS_perf_$(1)-T-$(2)-H-$(3) = $$(PERF_TESTS)
685 CTEST_DEPS_debuginfo-gdb_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_GDB_TESTS)
686 CTEST_DEPS_debuginfo-lldb_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_LLDB_TESTS) \
687 $(S)src/etc/lldb_batchmode.py \
688 $(S)src/etc/lldb_rust_formatters.py
689 CTEST_DEPS_codegen_$(1)-T-$(2)-H-$(3) = $$(CODEGEN_TESTS)
690 CTEST_DEPS_rustdocck_$(1)-T-$(2)-H-$(3) = $$(RUSTDOCCK_TESTS) \
691 $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
692 $(S)src/etc/htmldocck.py
696 $(foreach host,$(CFG_HOST), \
697 $(eval $(foreach target,$(CFG_TARGET), \
698 $(eval $(foreach stage,$(STAGES), \
699 $(eval $(call DEF_CTEST_VARS,$(stage),$(target),$(host))))))))
701 define DEF_RUN_COMPILETEST
703 CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4) := \
704 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
705 --src-base $$(S)src/test/$$(CTEST_SRC_BASE_$(4))/ \
706 --build-base $(3)/test/$$(CTEST_BUILD_BASE_$(4))/ \
707 --mode $$(CTEST_MODE_$(4)) \
708 $$(CTEST_RUNTOOL_$(4))
710 check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
712 # CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4)
713 # Goal: leave this variable as empty string if we should run the test.
714 # Otherwise, set it to the reason we are not running the test.
715 # (Encoded as a separate variable because GNU make does not have a
716 # good way to express OR on ifeq commands)
718 ifneq ($$(CTEST_DISABLE_$(4)),)
719 # Test suite is disabled for all configured targets.
720 CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4) := $$(CTEST_DISABLE_$(4))
722 # else, check if non-self-hosted target (i.e. target not-in hosts) ...
723 ifeq ($$(findstring $(2),$$(CFG_HOST)),)
724 # ... if so, then check if this test suite is disabled for non-selfhosts.
725 ifneq ($$(CTEST_DISABLE_NONSELFHOST_$(4)),)
726 # Test suite is disabled for this target.
727 CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4) := $$(CTEST_DISABLE_NONSELFHOST_$(4))
730 # Neither DISABLE nor DISABLE_NONSELFHOST is set ==> okay, run the test.
733 ifeq ($$(CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4)),)
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 bench perf debuginfo-gdb debuginfo-lldb codegen rustdocck
758 $(foreach host,$(CFG_HOST), \
759 $(eval $(foreach target,$(CFG_TARGET), \
760 $(eval $(foreach stage,$(STAGES), \
761 $(eval $(foreach name,$(CTEST_NAMES), \
762 $(eval $(call DEF_RUN_COMPILETEST,$(stage),$(target),$(host),$(name))))))))))
764 PRETTY_NAMES = pretty-rpass pretty-rpass-valgrind pretty-rpass-full pretty-rfail-full pretty-rfail \
765 pretty-bench pretty-pretty
766 PRETTY_DEPS_pretty-rpass = $(RPASS_TESTS)
767 PRETTY_DEPS_pretty-rpass-valgrind = $(RPASS_VALGRIND_TESTS)
768 PRETTY_DEPS_pretty-rpass-full = $(RPASS_FULL_TESTS)
769 PRETTY_DEPS_pretty-rfail-full = $(RFAIL_FULL_TESTS)
770 PRETTY_DEPS_pretty-rfail = $(RFAIL_TESTS)
771 PRETTY_DEPS_pretty-bench = $(BENCH_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-bench = bench
779 PRETTY_DIRNAME_pretty-pretty = pretty
781 define DEF_PRETTY_FULLDEPS
782 PRETTY_DEPS$(1)_T_$(2)_H_$(3)_pretty-rpass-full = $$(CSREQ$(1)_T_$(3)_H_$(3))
783 PRETTY_DEPS$(1)_T_$(2)_H_$(3)_pretty-rfail-full = $$(CSREQ$(1)_T_$(3)_H_$(3))
786 $(foreach host,$(CFG_HOST), \
787 $(foreach target,$(CFG_TARGET), \
788 $(foreach stage,$(STAGES), \
789 $(eval $(call DEF_PRETTY_FULLDEPS,$(stage),$(target),$(host))))))
791 define DEF_RUN_PRETTY_TEST
793 PRETTY_ARGS$(1)-T-$(2)-H-$(3)-$(4) := \
794 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
795 --src-base $$(S)src/test/$$(PRETTY_DIRNAME_$(4))/ \
796 --build-base $(3)/test/$$(PRETTY_DIRNAME_$(4))/ \
799 check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
801 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
802 $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
803 $$(PRETTY_DEPS_$(4)) \
804 $$(PRETTY_DEPS$(1)_T_$(2)_H_$(3)_$(4))
805 @$$(call E, run pretty-rpass [$(2)]: $$<)
806 $$(Q)touch $$@.start_time
807 $$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
808 $$(PRETTY_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
809 --logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
810 && touch -r $$@.start_time $$@ && rm $$@.start_time
814 $(foreach host,$(CFG_HOST), \
815 $(foreach target,$(CFG_TARGET), \
816 $(foreach stage,$(STAGES), \
817 $(foreach pretty-name,$(PRETTY_NAMES), \
818 $(eval $(call DEF_RUN_PRETTY_TEST,$(stage),$(target),$(host),$(pretty-name)))))))
821 ######################################################################
822 # Crate & freestanding documentation tests
823 ######################################################################
826 RUSTDOC_EXE_$(1)_T_$(2)_H_$(3) := $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3))
827 RUSTDOC_$(1)_T_$(2)_H_$(3) := $$(RPATH_VAR$(1)_T_$(2)_H_$(3)) $$(RUSTDOC_EXE_$(1)_T_$(2)_H_$(3))
830 $(foreach host,$(CFG_HOST), \
831 $(foreach target,$(CFG_TARGET), \
832 $(foreach stage,$(STAGES), \
833 $(eval $(call DEF_RUSTDOC,$(stage),$(target),$(host))))))
839 check-stage$(1)-T-$(2)-H-$(3)-doc-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4))
841 # If NO_REBUILD is set then break the dependencies on everything but
842 # the source files so we can test documentation without rebuilding
844 ifeq ($(NO_REBUILD),)
845 DOCTESTDEP_$(1)_$(2)_$(3)_$(4) = \
847 $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
848 $$(RUSTDOC_EXE_$(1)_T_$(2)_H_$(3))
850 DOCTESTDEP_$(1)_$(2)_$(3)_$(4) = $$(DOCFILE_$(4))
853 ifeq ($(2),$$(CFG_BUILD))
854 $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)): $$(DOCTESTDEP_$(1)_$(2)_$(3)_$(4))
855 @$$(call E, run doc-$(4) [$(2)])
856 $$(Q)touch $$@.start_time
857 $$(Q)$$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --cfg dox --test $$< \
858 --test-args "$$(TESTARGS)" && \
859 touch -r $$@.start_time $$@ && rm $$@.start_time
861 $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)):
866 $(foreach host,$(CFG_HOST), \
867 $(foreach target,$(CFG_TARGET), \
868 $(foreach stage,$(STAGES), \
869 $(foreach docname,$(DOC_NAMES), \
870 $(eval $(call DEF_DOC_TEST,$(stage),$(target),$(host),$(docname)))))))
874 define DEF_CRATE_DOC_TEST
876 # If NO_REBUILD is set then break the dependencies on everything but
877 # the source files so we can test crate documentation without
878 # rebuilding any of the parent crates.
879 ifeq ($(NO_REBUILD),)
880 CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4) = \
881 $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
882 $$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4)) \
883 $$(RUSTDOC_EXE_$(1)_T_$(2)_H_$(3))
885 CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4) = $$(RSINPUTS_$(4))
888 check-stage$(1)-T-$(2)-H-$(3)-doc-crate-$(4)-exec: \
889 $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4))
891 ifeq ($(2),$$(CFG_BUILD))
892 $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4)): $$(CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4))
893 @$$(call E, run doc-crate-$(4) [$(2)])
894 $$(Q)touch $$@.start_time
895 $$(Q)CFG_LLVM_LINKAGE_FILE=$$(LLVM_LINKAGE_PATH_$(2)) \
896 $$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --test --cfg dox \
897 $$(CRATEFILE_$(4)) --test-args "$$(TESTARGS)" && \
898 touch -r $$@.start_time $$@ && rm $$@.start_time
900 $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4)):
906 $(foreach host,$(CFG_HOST), \
907 $(foreach target,$(CFG_TARGET), \
908 $(foreach stage,$(STAGES), \
909 $(foreach crate,$(TEST_DOC_CRATES), \
910 $(eval $(call DEF_CRATE_DOC_TEST,$(stage),$(target),$(host),$(crate)))))))
912 ######################################################################
914 ######################################################################
918 $(foreach crate,$(TEST_CRATES),$(crate)) \
919 $(foreach crate,$(TEST_DOC_CRATES),doc-crate-$(crate)) \
936 $(foreach docname,$(DOC_NAMES),doc-$(docname)) \
939 pretty-rpass-valgrind \
947 define DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST
948 check-stage$(1)-T-$(2)-H-$(3): check-stage$(1)-T-$(2)-H-$(3)-exec
951 $(foreach stage,$(STAGES), \
952 $(foreach target,$(CFG_TARGET), \
953 $(foreach host,$(CFG_HOST), \
954 $(eval $(call DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST,$(stage),$(target),$(host))))))
956 define DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST_AND_GROUP
957 check-stage$(1)-T-$(2)-H-$(3)-$(4): check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec
960 $(foreach stage,$(STAGES), \
961 $(foreach target,$(CFG_TARGET), \
962 $(foreach host,$(CFG_HOST), \
963 $(foreach group,$(TEST_GROUPS), \
964 $(eval $(call DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST_AND_GROUP,$(stage),$(target),$(host),$(group)))))))
966 define DEF_CHECK_FOR_STAGE
967 check-stage$(1): check-stage$(1)-H-$$(CFG_BUILD)
968 check-stage$(1)-H-all: $$(foreach target,$$(CFG_TARGET), \
969 check-stage$(1)-H-$$(target))
972 $(foreach stage,$(STAGES), \
973 $(eval $(call DEF_CHECK_FOR_STAGE,$(stage))))
975 define DEF_CHECK_FOR_STAGE_AND_GROUP
976 check-stage$(1)-$(2): check-stage$(1)-H-$$(CFG_BUILD)-$(2)
977 check-stage$(1)-H-all-$(2): $$(foreach target,$$(CFG_TARGET), \
978 check-stage$(1)-H-$$(target)-$(2))
981 $(foreach stage,$(STAGES), \
982 $(foreach group,$(TEST_GROUPS), \
983 $(eval $(call DEF_CHECK_FOR_STAGE_AND_GROUP,$(stage),$(group)))))
986 define DEF_CHECK_FOR_STAGE_AND_HOSTS
987 check-stage$(1)-H-$(2): $$(foreach target,$$(CFG_TARGET), \
988 check-stage$(1)-T-$$(target)-H-$(2))
991 $(foreach stage,$(STAGES), \
992 $(foreach host,$(CFG_HOST), \
993 $(eval $(call DEF_CHECK_FOR_STAGE_AND_HOSTS,$(stage),$(host)))))
995 define DEF_CHECK_FOR_STAGE_AND_HOSTS_AND_GROUP
996 check-stage$(1)-H-$(2)-$(3): $$(foreach target,$$(CFG_TARGET), \
997 check-stage$(1)-T-$$(target)-H-$(2)-$(3))
1000 $(foreach stage,$(STAGES), \
1001 $(foreach host,$(CFG_HOST), \
1002 $(foreach group,$(TEST_GROUPS), \
1003 $(eval $(call DEF_CHECK_FOR_STAGE_AND_HOSTS_AND_GROUP,$(stage),$(host),$(group))))))
1005 define DEF_CHECK_DOC_FOR_STAGE
1006 check-stage$(1)-docs: $$(foreach docname,$$(DOC_NAMES), \
1007 check-stage$(1)-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-doc-$$(docname)) \
1008 $$(foreach crate,$$(TEST_DOC_CRATES), \
1009 check-stage$(1)-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-doc-crate-$$(crate))
1012 $(foreach stage,$(STAGES), \
1013 $(eval $(call DEF_CHECK_DOC_FOR_STAGE,$(stage))))
1015 define DEF_CHECK_CRATE
1016 check-$(1): check-stage2-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-$(1)-exec
1019 $(foreach crate,$(TEST_CRATES), \
1020 $(eval $(call DEF_CHECK_CRATE,$(crate))))
1022 ######################################################################
1024 ######################################################################
1026 RMAKE_TESTS := $(shell ls -d $(S)src/test/run-make/*/)
1027 RMAKE_TESTS := $(RMAKE_TESTS:$(S)src/test/run-make/%/=%)
1029 define DEF_RMAKE_FOR_T_H
1031 # $(2) target triple
1035 ifeq ($(2)$(3),$$(CFG_BUILD)$$(CFG_BUILD))
1036 check-stage$(1)-T-$(2)-H-$(3)-rmake-exec: \
1037 $$(call TEST_OK_FILE,$(1),$(2),$(3),rmake)
1039 $$(call TEST_OK_FILE,$(1),$(2),$(3),rmake): \
1040 $$(RMAKE_TESTS:%=$(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok)
1043 $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
1044 $(S)src/test/run-make/%/Makefile \
1045 $$(CSREQ$(1)_T_$(2)_H_$(3))
1046 @rm -rf $(3)/test/run-make/$$*
1047 @mkdir -p $(3)/test/run-make/$$*
1048 $$(Q)touch $$@.start_time
1049 $$(Q)$$(CFG_PYTHON) $(S)src/etc/maketest.py $$(dir $$<) \
1051 $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
1052 $(3)/test/run-make/$$* \
1053 "$$(CC_$(3)) $$(CFG_GCCISH_CFLAGS_$(3))" \
1054 $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
1056 $$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3)) \
1057 "$$(LD_LIBRARY_PATH_ENV_HOSTDIR$(1)_T_$(2)_H_$(3))" \
1058 "$$(LD_LIBRARY_PATH_ENV_TARGETDIR$(1)_T_$(2)_H_$(3))" \
1061 @touch -r $$@.start_time $$@ && rm $$@.start_time
1063 # FIXME #11094 - The above rule doesn't work right for multiple targets
1064 check-stage$(1)-T-$(2)-H-$(3)-rmake-exec:
1072 $(foreach stage,$(STAGES), \
1073 $(foreach target,$(CFG_TARGET), \
1074 $(foreach host,$(CFG_HOST), \
1075 $(eval $(call DEF_RMAKE_FOR_T_H,$(stage),$(target),$(host))))))