]> git.lizzy.rs Git - rust.git/blob - mk/tests.mk
rusti: Remove linenoise module, add to rt, remove core::rl
[rust.git] / mk / tests.mk
1 ######################################################################
2 # Testing variables
3 ######################################################################
4
5 RPASS_RC := $(wildcard $(S)src/test/run-pass/*.rc)
6 RPASS_RS := $(wildcard $(S)src/test/run-pass/*.rs)
7 RPASS_FULL_RC := $(wildcard $(S)src/test/run-pass-fulldeps/*.rc)
8 RPASS_FULL_RS := $(wildcard $(S)src/test/run-pass-fulldeps/*.rs)
9 RFAIL_RC := $(wildcard $(S)src/test/run-fail/*.rc)
10 RFAIL_RS := $(wildcard $(S)src/test/run-fail/*.rs)
11 CFAIL_RC := $(wildcard $(S)src/test/compile-fail/*.rc)
12 CFAIL_RS := $(wildcard $(S)src/test/compile-fail/*.rs)
13 BENCH_RS := $(wildcard $(S)src/test/bench/*.rs)
14 PRETTY_RS := $(wildcard $(S)src/test/pretty/*.rs)
15
16 # perf tests are the same as bench tests only they run under
17 # a performance monitor.
18 PERF_RS := $(wildcard $(S)src/test/bench/*.rs)
19
20 RPASS_TESTS := $(RPASS_RC) $(RPASS_RS)
21 RPASS_FULL_TESTS := $(RPASS_FULL_RC) $(RPASS_FULL_RS)
22 RFAIL_TESTS := $(RFAIL_RC) $(RFAIL_RS)
23 CFAIL_TESTS := $(CFAIL_RC) $(CFAIL_RS)
24 BENCH_TESTS := $(BENCH_RS)
25 PERF_TESTS := $(PERF_RS)
26 PRETTY_TESTS := $(PRETTY_RS)
27
28 FT := run_pass_stage2
29 FT_LIB := $(call CFG_LIB_NAME,$(FT))
30 FT_DRIVER := $(FT)_driver
31
32 # The arguments to all test runners
33 ifdef TESTNAME
34   TESTARGS += $(TESTNAME)
35 endif
36
37 ifdef CHECK_XFAILS
38   TESTARGS += --ignored
39 endif
40
41 # Arguments to the cfail/rfail/rpass/bench tests
42 ifdef CFG_VALGRIND
43   CTEST_RUNTOOL = --runtool "$(CFG_VALGRIND)"
44 endif
45
46 # Arguments to the perf tests
47 ifdef CFG_PERF_TOOL
48   CTEST_PERF_RUNTOOL = --runtool "$(CFG_PERF_TOOL)"
49 endif
50
51 CTEST_TESTARGS := $(TESTARGS)
52
53 ifdef VERBOSE
54   CTEST_TESTARGS += --verbose
55 endif
56
57 # Run the compiletest runner itself under valgrind
58 ifdef CTEST_VALGRIND
59   CFG_RUN_CTEST=$(call CFG_RUN_TEST,$(2),$(3))
60 else
61   CFG_RUN_CTEST=$(call CFG_RUN,$(TLIB$(1)_T_$(3)_H_$(3)),$(2))
62 endif
63
64 # If we're running perf then set this environment variable
65 # to put the benchmarks into 'hard mode'
66 ifeq ($(MAKECMDGOALS),perf)
67   RUST_BENCH=1
68   export RUST_BENCH
69 endif
70
71
72 ######################################################################
73 # Main test targets
74 ######################################################################
75
76 .PHONY: cleantmptestlogs cleantestlibs
77
78 cleantmptestlogs:
79         $(Q)rm -f tmp/*.log
80
81 cleantestlibs:
82         $(Q)find $(CFG_HOST_TRIPLE)/test \
83          -name '*.[odasS]' -o \
84          -name '*.so' -o      \
85          -name '*.dylib' -o   \
86          -name '*.dll' -o     \
87          -name '*.def' -o     \
88          -name '*.bc' -o      \
89          -name '*.dSYM' -o    \
90          -name '*.libaux' -o      \
91          -name '*.out' -o     \
92          -name '*.err'        \
93          | xargs rm -rf
94
95 check: cleantestlibs cleantmptestlogs tidy all check-stage2
96         $(Q)$(S)src/etc/check-summary.py tmp/*.log
97
98 check-notidy: cleantestlibs cleantmptestlogs all check-stage2
99         $(Q)$(S)src/etc/check-summary.py tmp/*.log
100
101 check-full: cleantestlibs cleantmptestlogs tidy \
102             all check-stage1 check-stage2 check-stage3
103         $(Q)$(S)src/etc/check-summary.py tmp/*.log
104
105 check-test: cleantestlibs cleantmptestlogs all check-stage2-rfail
106         $(Q)$(S)src/etc/check-summary.py tmp/*.log
107
108 check-lite: cleantestlibs cleantmptestlogs rustc-stage2 \
109         check-stage2-core check-stage2-std check-stage2-rpass \
110         check-stage2-rfail check-stage2-cfail
111         $(Q)$(S)src/etc/check-summary.py tmp/*.log
112
113 # Run the tidy script in multiple parts to avoid huge 'echo' commands
114 ifdef CFG_NOTIDY
115 tidy:
116 else
117
118 ALL_CS := $(wildcard $(S)src/rt/*.cpp \
119                      $(S)src/rt/*/*.cpp \
120                      $(S)src/rt/*/*/*.cpp \
121                      $(S)srcrustllvm/*.cpp)
122 ALL_CS := $(filter-out $(S)src/rt/bigint/bigint_ext.cpp \
123                        $(S)src/rt/bigint/bigint_int.cpp \
124                        $(S)src/rt/miniz.cpp \
125         ,$(ALL_CS))
126 ALL_HS := $(wildcard $(S)src/rt/*.h \
127                      $(S)src/rt/*/*.h \
128                      $(S)src/rt/*/*/*.h \
129                      $(S)srcrustllvm/*.h)
130 ALL_HS := $(filter-out $(S)src/rt/vg/valgrind.h \
131                        $(S)src/rt/vg/memcheck.h \
132                        $(S)src/rt/uthash/uthash.h \
133                        $(S)src/rt/uthash/utlist.h \
134                        $(S)src/rt/msvc/typeof.h \
135                        $(S)src/rt/msvc/stdint.h \
136                        $(S)src/rt/msvc/inttypes.h \
137                        $(S)src/rt/bigint/bigint.h \
138         ,$(ALL_HS))
139
140 tidy:
141                 @$(call E, check: formatting)
142                 $(Q)find $(S)src -name '*.r[sc]' \
143                 | grep '^$(S)src/test' -v \
144                 | xargs -n 10 python $(S)src/etc/tidy.py
145                 $(Q)find $(S)src/etc -name '*.py' \
146                 | xargs -n 10 python $(S)src/etc/tidy.py
147                 $(Q)echo $(ALL_CS) \
148                 | xargs -n 10 python $(S)src/etc/tidy.py
149                 $(Q)echo $(ALL_HS) \
150                 | xargs -n 10 python $(S)src/etc/tidy.py
151
152 endif
153
154 ######################################################################
155 # Extracting tests for docs
156 ######################################################################
157
158 EXTRACT_TESTS := "$(CFG_PYTHON)" $(S)src/etc/extract-tests.py
159
160 define DEF_DOC_TEST_HOST
161
162 doc-tutorial-extract$(1):
163         @$$(call E, extract: tutorial tests)
164         $$(Q)rm -f $(1)/test/doc-tutorial/*.rs
165         $$(Q)$$(EXTRACT_TESTS) $$(S)doc/tutorial.md $(1)/test/doc-tutorial
166
167 doc-tutorial-ffi-extract$(1):
168         @$$(call E, extract: tutorial-ffi tests)
169         $$(Q)rm -f $(1)/test/doc-tutorial-ffi/*.rs
170         $$(Q)$$(EXTRACT_TESTS) $$(S)doc/tutorial-ffi.md $(1)/test/doc-tutorial-ffi
171
172 doc-tutorial-macros-extract$(1):
173         @$$(call E, extract: tutorial-macros tests)
174         $$(Q)rm -f $(1)/test/doc-tutorial-macros/*.rs
175         $$(Q)$$(EXTRACT_TESTS) $$(S)doc/tutorial-macros.md $(1)/test/doc-tutorial-macros
176
177 doc-tutorial-borrowed-ptr-extract$(1):
178         @$$(call E, extract: tutorial-borrowed-ptr tests)
179         $$(Q)rm -f $(1)/test/doc-tutorial-borrowed-ptr/*.rs
180         $$(Q)$$(EXTRACT_TESTS) $$(S)doc/tutorial-borrowed-ptr.md $(1)/test/doc-tutorial-borrowed-ptr
181
182 doc-tutorial-tasks-extract$(1):
183         @$$(call E, extract: tutorial-tasks tests)
184         $$(Q)rm -f $(1)/test/doc-tutorial-tasks/*.rs
185         $$(Q)$$(EXTRACT_TESTS) $$(S)doc/tutorial-tasks.md $(1)/test/doc-tutorial-tasks
186
187 doc-ref-extract$(1):
188         @$$(call E, extract: ref tests)
189         $$(Q)rm -f $(1)/test/doc-ref/*.rs
190         $$(Q)$$(EXTRACT_TESTS) $$(S)doc/rust.md $(1)/test/doc-ref
191
192 endef
193
194 $(foreach host,$(CFG_TARGET_TRIPLES), \
195  $(eval $(call DEF_DOC_TEST_HOST,$(host))))
196
197 ######################################################################
198 # Rules for the test runners
199 ######################################################################
200
201 define TEST_STAGEN
202
203 # All the per-stage build rules you might want to call from the
204 # command line.
205 #
206 # $(1) is the stage number
207 # $(2) is the target triple to test
208 # $(3) is the host triple to test
209
210 # Prerequisites for compiletest tests
211 TEST_SREQ$(1)_T_$(2)_H_$(3) = \
212         $$(HBIN$(1)_H_$(3))/compiletest$$(X) \
213         $$(SREQ$(1)_T_$(2)_H_$(3))
214
215 # Prerequisites for compiletest tests that have deps on librustc, etc
216 FULL_TEST_SREQ$(1)_T_$(2)_H_$(3) = \
217         $$(HBIN$(1)_H_$(3))/compiletest$$(X) \
218         $$(SREQ$(1)_T_$(2)_H_$(3)) \
219         $$(TLIBRUSTC_DEFAULT$(1)_T_$(2)_H_$(3))
220
221 check-stage$(1)-T-$(2)-H-$(3):                                  \
222         check-stage$(1)-T-$(2)-H-$(3)-rustc                     \
223         check-stage$(1)-T-$(2)-H-$(3)-core          \
224         check-stage$(1)-T-$(2)-H-$(3)-std                       \
225         check-stage$(1)-T-$(2)-H-$(3)-rpass                     \
226         check-stage$(1)-T-$(2)-H-$(3)-rpass-full                        \
227         check-stage$(1)-T-$(2)-H-$(3)-rfail                     \
228         check-stage$(1)-T-$(2)-H-$(3)-cfail                     \
229         check-stage$(1)-T-$(2)-H-$(3)-bench                     \
230         check-stage$(1)-T-$(2)-H-$(3)-pretty        \
231     check-stage$(1)-T-$(2)-H-$(3)-rustdoc       \
232     check-stage$(1)-T-$(2)-H-$(3)-rusti       \
233     check-stage$(1)-T-$(2)-H-$(3)-cargo       \
234     check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial  \
235     check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-ffi  \
236     check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-macros  \
237     check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-borrowed-ptr  \
238     check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-tasks  \
239     check-stage$(1)-T-$(2)-H-$(3)-doc-ref
240
241 check-stage$(1)-T-$(2)-H-$(3)-core:                             \
242         check-stage$(1)-T-$(2)-H-$(3)-core-dummy
243
244 check-stage$(1)-T-$(2)-H-$(3)-std:                              \
245         check-stage$(1)-T-$(2)-H-$(3)-std-dummy
246
247 check-stage$(1)-T-$(2)-H-$(3)-rustc:                            \
248         check-stage$(1)-T-$(2)-H-$(3)-rustc-dummy
249
250 check-stage$(1)-T-$(2)-H-$(3)-cfail:                            \
251         check-stage$(1)-T-$(2)-H-$(3)-cfail-dummy
252
253 check-stage$(1)-T-$(2)-H-$(3)-rfail:                            \
254         check-stage$(1)-T-$(2)-H-$(3)-rfail-dummy
255
256 check-stage$(1)-T-$(2)-H-$(3)-rpass:                            \
257         check-stage$(1)-T-$(2)-H-$(3)-rpass-dummy
258
259 check-stage$(1)-T-$(2)-H-$(3)-rpass-full:                               \
260         check-stage$(1)-T-$(2)-H-$(3)-rpass-full-dummy
261
262 check-stage$(1)-T-$(2)-H-$(3)-bench:                            \
263         check-stage$(1)-T-$(2)-H-$(3)-bench-dummy
264
265 check-stage$(1)-T-$(2)-H-$(3)-perf:                             \
266         check-stage$(1)-T-$(2)-H-$(3)-perf-dummy
267
268 check-stage$(1)-T-$(2)-H-$(3)-pretty:                   \
269         check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass      \
270         check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-full \
271     check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail  \
272     check-stage$(1)-T-$(2)-H-$(3)-pretty-bench  \
273     check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty
274
275 check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass:                     \
276         check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-dummy
277
278 check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-full:                        \
279         check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-full-dummy
280
281 check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail:                     \
282         check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail-dummy
283
284 check-stage$(1)-T-$(2)-H-$(3)-pretty-bench:                     \
285         check-stage$(1)-T-$(2)-H-$(3)-pretty-bench-dummy
286
287 check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty:                            \
288         check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty-dummy
289
290 check-stage$(1)-T-$(2)-H-$(3)-rustdoc:                          \
291         check-stage$(1)-T-$(2)-H-$(3)-rustdoc-dummy
292
293 check-stage$(1)-T-$(2)-H-$(3)-rusti:                            \
294         check-stage$(1)-T-$(2)-H-$(3)-rusti-dummy
295
296 check-stage$(1)-T-$(2)-H-$(3)-cargo:                            \
297         check-stage$(1)-T-$(2)-H-$(3)-cargo-dummy
298
299 check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial: \
300         check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-dummy
301
302 check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-ffi: \
303         check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-ffi-dummy
304
305 check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-macros: \
306         check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-macros-dummy
307
308 check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-borrowed-ptr: \
309         check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-borrowed-ptr-dummy
310
311 check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-tasks: \
312         check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-tasks-dummy
313
314 check-stage$(1)-T-$(2)-H-$(3)-doc-ref: \
315         check-stage$(1)-T-$(2)-H-$(3)-doc-ref-dummy
316
317 # Rules for the core library test runner
318
319 $(3)/test/coretest.stage$(1)-$(2)$$(X):                 \
320                 $$(CORELIB_CRATE) $$(CORELIB_INPUTS)    \
321         $$(SREQ$(1)_T_$(2)_H_$(3))
322         @$$(call E, compile_and_link: $$@)
323         $$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
324
325 check-stage$(1)-T-$(2)-H-$(3)-core-dummy:                       \
326                 $(3)/test/coretest.stage$(1)-$(2)$$(X)
327         @$$(call E, run: $$<)
328         $$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) $$(TESTARGS)   \
329         --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-core.log
330
331 # Rules for the standard library test runner
332
333 $(3)/test/stdtest.stage$(1)-$(2)$$(X):                  \
334                 $$(STDLIB_CRATE) $$(STDLIB_INPUTS)      \
335         $$(SREQ$(1)_T_$(2)_H_$(3))
336         @$$(call E, compile_and_link: $$@)
337         $$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
338
339 check-stage$(1)-T-$(2)-H-$(3)-std-dummy:                        \
340                 $(3)/test/stdtest.stage$(1)-$(2)$$(X)
341         @$$(call E, run: $$<)
342         $$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) $$(TESTARGS)   \
343         --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-std.log
344
345 # Rules for the rustc test runner
346
347 $(3)/test/rustctest.stage$(1)-$(2)$$(X):                                        \
348                 $$(COMPILER_CRATE)                                                                      \
349                 $$(COMPILER_INPUTS)                                                                     \
350                 $$(SREQ$(1)_T_$(2)_H_$(3))                                                      \
351                 $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUSTLLVM)
352         @$$(call E, compile_and_link: $$@)
353         $$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
354
355 check-stage$(1)-T-$(2)-H-$(3)-rustc-dummy:              \
356                 $(3)/test/rustctest.stage$(1)-$(2)$$(X)
357         @$$(call E, run: $$<)
358         $$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) $$(TESTARGS)   \
359         --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-rustc.log
360
361 # Rules for the rustdoc test runner
362
363 $(3)/test/rustdoctest.stage$(1)-$(2)$$(X):                                      \
364                 $$(RUSTDOC_CRATE) $$(RUSTDOC_INPUTS)            \
365                 $$(TSREQ$(1)_T_$(2)_H_$(3))                                     \
366                 $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_CORELIB)  \
367                 $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB)   \
368                 $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC)
369         @$$(call E, compile_and_link: $$@)
370         $$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
371
372 check-stage$(1)-T-$(2)-H-$(3)-rustdoc-dummy:            \
373                 $(3)/test/rustdoctest.stage$(1)-$(2)$$(X)
374         @$$(call E, run: $$<)
375         $$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) $$(TESTARGS)   \
376         --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-rustdoc.log
377
378 # Rules for the rusti test runner
379
380 $(3)/test/rustitest.stage$(1)-$(2)$$(X):                                        \
381                 $$(RUSTI_CRATE) $$(RUSTI_INPUTS)                \
382                 $$(TSREQ$(1)_T_$(2)_H_$(3))                                     \
383                 $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_CORELIB)  \
384                 $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB)   \
385                 $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC)
386         @$$(call E, compile_and_link: $$@)
387         $$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
388
389 check-stage$(1)-T-$(2)-H-$(3)-rusti-dummy:              \
390                 $(3)/test/rustitest.stage$(1)-$(2)$$(X)
391         @$$(call E, run: $$<)
392         $$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) $$(TESTARGS)   \
393         --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-rusti.log
394
395
396 # Rules for the cargo test runner
397
398 $(3)/test/cargotest.stage$(1)-$(2)$$(X):                                        \
399                 $$(CARGO_CRATE) $$(CARGO_INPUTS)                \
400                 $$(TSREQ$(1)_T_$(2)_H_$(3))                                     \
401                 $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_CORELIB)  \
402                 $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB)   \
403                 $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC)
404         @$$(call E, compile_and_link: $$@)
405         $$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
406
407 check-stage$(1)-T-$(2)-H-$(3)-cargo-dummy:              \
408                 $(3)/test/cargotest.stage$(1)-$(2)$$(X)
409         @$$(call E, run: $$<)
410         $$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) $$(TESTARGS)   \
411         --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-cargo.log
412
413 # Rules for the cfail/rfail/rpass/bench/perf test runner
414
415 CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) :=                                          \
416                 --compile-lib-path $$(HLIB$(1)_H_$(3))                          \
417         --run-lib-path $$(TLIB$(1)_T_$(2)_H_$(3))                       \
418         --rustc-path $$(HBIN$(1)_H_$(3))/rustc$$(X)                     \
419         --aux-base $$(S)src/test/auxiliary/                 \
420         --stage-id stage$(1)-$(2)                                                       \
421         --rustcflags "$$(CFG_RUSTC_FLAGS) --target=$(2)"        \
422         $$(CTEST_TESTARGS)
423
424 CFAIL_ARGS$(1)-T-$(2)-H-$(3) :=                                 \
425                 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
426         --src-base $$(S)src/test/compile-fail/  \
427         --build-base $(3)/test/compile-fail/    \
428         --mode compile-fail
429
430 RFAIL_ARGS$(1)-T-$(2)-H-$(3) :=                                 \
431                 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
432         --src-base $$(S)src/test/run-fail/              \
433         --build-base $(3)/test/run-fail/                \
434         --mode run-fail                                                 \
435         $$(CTEST_RUNTOOL)
436
437 RPASS_ARGS$(1)-T-$(2)-H-$(3) :=                         \
438                 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
439         --src-base $$(S)src/test/run-pass/              \
440         --build-base $(3)/test/run-pass/                \
441         --mode run-pass                                 \
442         $$(CTEST_RUNTOOL)
443
444 RPASS_FULL_ARGS$(1)-T-$(2)-H-$(3) :=                            \
445                 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
446         --src-base $$(S)src/test/run-pass-fulldeps/             \
447         --build-base $(3)/test/run-pass-fulldeps/               \
448         --mode run-pass                                 \
449         $$(CTEST_RUNTOOL)
450
451 BENCH_ARGS$(1)-T-$(2)-H-$(3) :=                         \
452                 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
453         --src-base $$(S)src/test/bench/                 \
454         --build-base $(3)/test/bench/                   \
455         --mode run-pass                                 \
456         $$(CTEST_RUNTOOL)
457
458 PERF_ARGS$(1)-T-$(2)-H-$(3) :=                                  \
459                 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
460         --src-base $$(S)src/test/bench/                 \
461         --build-base $(3)/test/perf/                    \
462         --mode run-pass                                                 \
463         $$(CTEST_PERF_RUNTOOL)
464
465 PRETTY_RPASS_ARGS$(1)-T-$(2)-H-$(3) :=                  \
466                 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
467         --src-base $$(S)src/test/run-pass/              \
468         --build-base $(3)/test/run-pass/                \
469         --mode pretty
470
471 PRETTY_RPASS_FULL_ARGS$(1)-T-$(2)-H-$(3) :=                     \
472                 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
473         --src-base $$(S)src/test/run-pass-fulldeps/             \
474         --build-base $(3)/test/run-pass-fulldeps/               \
475         --mode pretty
476
477 PRETTY_RFAIL_ARGS$(1)-T-$(2)-H-$(3) :=                  \
478                 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
479         --src-base $$(S)src/test/run-fail/              \
480         --build-base $(3)/test/run-fail/                \
481         --mode pretty
482
483 PRETTY_BENCH_ARGS$(1)-T-$(2)-H-$(3) :=                  \
484                 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
485         --src-base $$(S)src/test/bench/                 \
486         --build-base $(3)/test/bench/                   \
487         --mode pretty
488
489 PRETTY_PRETTY_ARGS$(1)-T-$(2)-H-$(3) :=                 \
490                 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
491         --src-base $$(S)src/test/pretty/                \
492         --build-base $(3)/test/pretty/                  \
493         --mode pretty
494
495 DOC_TUTORIAL_ARGS$(1)-T-$(2)-H-$(3) :=                  \
496                 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
497         --src-base $(3)/test/doc-tutorial/              \
498         --build-base $(3)/test/doc-tutorial/            \
499         --mode run-pass
500
501 DOC_TUTORIAL_FFI_ARGS$(1)-T-$(2)-H-$(3) :=              \
502                 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
503         --src-base $(3)/test/doc-tutorial-ffi/          \
504         --build-base $(3)/test/doc-tutorial-ffi/        \
505         --mode run-pass
506
507 DOC_TUTORIAL_MACROS_ARGS$(1)-T-$(2)-H-$(3) :=           \
508                 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
509         --src-base $(3)/test/doc-tutorial-macros/       \
510         --build-base $(3)/test/doc-tutorial-macros/     \
511         --mode run-pass
512
513 DOC_TUTORIAL_BORROWED_PTR_ARGS$(1)-T-$(2)-H-$(3) :=     \
514                 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
515         --src-base $(3)/test/doc-tutorial-borrowed-ptr/ \
516         --build-base $(3)/test/doc-tutorial-borrowed-ptr/ \
517         --mode run-pass
518
519 DOC_TUTORIAL_TASKS_ARGS$(1)-T-$(2)-H-$(3) :=    \
520                 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
521         --src-base $(3)/test/doc-tutorial-tasks/        \
522         --build-base $(3)/test/doc-tutorial-tasks/ \
523         --mode run-pass
524
525 DOC_REF_ARGS$(1)-T-$(2)-H-$(3) :=                       \
526                 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
527         --src-base $(3)/test/doc-ref/                   \
528         --build-base $(3)/test/doc-ref/                 \
529         --mode run-pass
530
531 check-stage$(1)-T-$(2)-H-$(3)-cfail-dummy:              \
532                 $$(TEST_SREQ$(1)_T_$(2)_H_$(3))         \
533                 $$(CFAIL_TESTS)
534         @$$(call E, run cfail: $$<)
535         $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
536                 $$(CFAIL_ARGS$(1)-T-$(2)-H-$(3)) \
537                 --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-cfail.log
538
539 check-stage$(1)-T-$(2)-H-$(3)-rfail-dummy:              \
540                 $$(TEST_SREQ$(1)_T_$(2)_H_$(3))         \
541                 $$(RFAIL_TESTS)
542         @$$(call E, run rfail: $$<)
543         $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
544                 $$(RFAIL_ARGS$(1)-T-$(2)-H-$(3)) \
545                 --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-rfail.log
546
547 check-stage$(1)-T-$(2)-H-$(3)-rpass-dummy:              \
548                 $$(TEST_SREQ$(1)_T_$(2)_H_$(3))         \
549                 $$(RPASS_TESTS)
550         @$$(call E, run rpass-full: $$<)
551         $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
552                 $$(RPASS_ARGS$(1)-T-$(2)-H-$(3)) \
553                 --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-rpass.log
554
555 check-stage$(1)-T-$(2)-H-$(3)-rpass-full-dummy:         \
556                 $$(FULL_TEST_SREQ$(1)_T_$(2)_H_$(3))            \
557                 $$(RPASS_FULL_TESTS)
558         @$$(call E, run rpass: $$<)
559         $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
560                 $$(RPASS_FULL_ARGS$(1)-T-$(2)-H-$(3)) \
561                 --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-rpass-full.log
562
563 check-stage$(1)-T-$(2)-H-$(3)-bench-dummy:              \
564                 $$(TEST_SREQ$(1)_T_$(2)_H_$(3))         \
565                 $$(BENCH_TESTS)
566         @$$(call E, run bench: $$<)
567         $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
568                 $$(BENCH_ARGS$(1)-T-$(2)-H-$(3)) \
569                 --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-bench.log
570
571 check-stage$(1)-T-$(2)-H-$(3)-perf-dummy:               \
572                 $$(TEST_SREQ$(1)_T_$(2)_H_$(3))         \
573                 $$(BENCH_TESTS)
574         @$$(call E, perf: $$<)
575         $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
576                 $$(PERF_ARGS$(1)-T-$(2)-H-$(3)) \
577                 --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-perf.log
578
579 check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-dummy:       \
580                 $$(TEST_SREQ$(1)_T_$(2)_H_$(3))         \
581                 $$(RPASS_TESTS)
582         @$$(call E, run pretty-rpass: $$<)
583         $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
584                 $$(PRETTY_RPASS_ARGS$(1)-T-$(2)-H-$(3)) \
585                 --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass.log
586
587 check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-full-dummy:  \
588                 $$(FULL_TEST_SREQ$(1)_T_$(2)_H_$(3))            \
589                 $$(RPASS_FULL_TESTS)
590         @$$(call E, run pretty-rpass-full: $$<)
591         $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
592                 $$(PRETTY_RPASS_FULL_ARGS$(1)-T-$(2)-H-$(3)) \
593                 --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-full.log
594
595 check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail-dummy:       \
596                 $$(TEST_SREQ$(1)_T_$(2)_H_$(3))         \
597                 $$(RFAIL_TESTS)
598         @$$(call E, run pretty-rfail: $$<)
599         $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
600                 $$(PRETTY_RFAIL_ARGS$(1)-T-$(2)-H-$(3)) \
601                 --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail.log
602
603 check-stage$(1)-T-$(2)-H-$(3)-pretty-bench-dummy:       \
604                 $$(TEST_SREQ$(1)_T_$(2)_H_$(3))         \
605                 $$(BENCH_TESTS)
606         @$$(call E, run pretty-bench: $$<)
607         $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
608                 $$(PRETTY_BENCH_ARGS$(1)-T-$(2)-H-$(3)) \
609                 --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-pretty-bench.log
610
611 check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty-dummy:      \
612                 $$(TEST_SREQ$(1)_T_$(2)_H_$(3))         \
613                 $$(PRETTY_TESTS)
614         @$$(call E, run pretty-pretty: $$<)
615         $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
616                 $$(PRETTY_PRETTY_ARGS$(1)-T-$(2)-H-$(3)) \
617                 --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty.log
618
619 check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-dummy:       \
620                 $$(TEST_SREQ$(1)_T_$(2)_H_$(3))         \
621                 doc-tutorial-extract$(3)
622         @$$(call E, run doc-tutorial: $$<)
623         $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
624                 $$(DOC_TUTORIAL_ARGS$(1)-T-$(2)-H-$(3)) \
625                 --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial.log
626
627 check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-ffi-dummy:       \
628                 $$(TEST_SREQ$(1)_T_$(2)_H_$(3))         \
629                 doc-tutorial-ffi-extract$(3)
630         @$$(call E, run doc-tutorial-ffi: $$<)
631         $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
632                 $$(DOC_TUTORIAL_FFI_ARGS$(1)-T-$(2)-H-$(3)) \
633                 --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-ffi.log
634
635 check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-macros-dummy:       \
636                 $$(TEST_SREQ$(1)_T_$(2)_H_$(3))         \
637                 doc-tutorial-macros-extract$(3)
638         @$$(call E, run doc-tutorial-macros: $$<)
639         $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
640                 $$(DOC_TUTORIAL_MACROS_ARGS$(1)-T-$(2)-H-$(3)) \
641                 --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-macros.log
642
643 check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-borrowed-ptr-dummy:       \
644                 $$(TEST_SREQ$(1)_T_$(2)_H_$(3))         \
645                 doc-tutorial-borrowed-ptr-extract$(3)
646         @$$(call E, run doc-tutorial-borrowed-ptr: $$<)
647         $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
648                 $$(DOC_TUTORIAL_BORROWED_PTR_ARGS$(1)-T-$(2)-H-$(3)) \
649                 --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-borrowed-ptr.log
650
651 check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-tasks-dummy:       \
652                 $$(TEST_SREQ$(1)_T_$(2)_H_$(3))         \
653                 doc-tutorial-tasks-extract$(3)
654         @$$(call E, run doc-tutorial-tasks: $$<)
655         $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
656                 $$(DOC_TUTORIAL_TASKS_ARGS$(1)-T-$(2)-H-$(3)) \
657                 --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-tasks.log
658
659 check-stage$(1)-T-$(2)-H-$(3)-doc-ref-dummy:            \
660                 $$(TEST_SREQ$(1)_T_$(2)_H_$(3))         \
661                 doc-ref-extract$(3)
662         @$$(call E, run doc-ref: $$<)
663         $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
664                 $$(DOC_REF_ARGS$(1)-T-$(2)-H-$(3)) \
665                 --logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-doc-ref.log
666
667 endef
668
669 # Instantiate the template for stage 0, 1, 2, 3
670
671 $(foreach host,$(CFG_TARGET_TRIPLES), \
672  $(eval $(foreach target,$(CFG_TARGET_TRIPLES), \
673   $(eval $(foreach stage,$(STAGES), \
674    $(eval $(call TEST_STAGEN,$(stage),$(target),$(host))))))))
675
676 ######################################################################
677 # Fast-test rules
678 ######################################################################
679
680 GENERATED += tmp/$(FT).rc tmp/$(FT_DRIVER).rs
681
682 tmp/$(FT).rc tmp/$(FT_DRIVER).rs: \
683                 $(RPASS_TESTS) \
684                 $(S)src/etc/combine-tests.py
685         @$(call E, check: building combined stage2 test runner)
686         $(Q)$(S)src/etc/combine-tests.py
687
688 define DEF_CHECK_FAST_FOR_T_H
689 # $(1) unused
690 # $(2) target triple
691 # $(3) host triple
692
693 $$(TLIB2_T_$(2)_H_$(3))/$$(FT_LIB): \
694                 tmp/$$(FT).rc \
695                 $$(SREQ2_T_$(2)_H_$(3))
696         @$$(call E, compile_and_link: $$@)
697         $$(STAGE2_T_$(2)_H_$(3)) --lib -o $$@ $$<
698
699 $(3)/test/$$(FT_DRIVER)-$(2)$$(X): \
700                 tmp/$$(FT_DRIVER).rs \
701                 $$(TLIB2_T_$(2)_H_$(3))/$$(FT_LIB) \
702                 $$(SREQ2_T_$(2)_H_$(3))
703         @$$(call E, compile_and_link: $$@ $$<)
704         $$(STAGE2_T_$(2)_H_$(3)) -o $$@ $$<
705
706 $(3)/test/$$(FT_DRIVER)-$(2).out: \
707                 $(3)/test/$$(FT_DRIVER)-$(2)$$(X) \
708                 $$(SREQ2_T_$(2)_H_$(3))
709         $$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) \
710         --logfile tmp/$$(FT_DRIVER)-$(2).log
711
712 check-fast-T-$(2)-H-$(3):                       \
713         check-stage2-T-$(2)-H-$(3)-rustc        \
714         check-stage2-T-$(2)-H-$(3)-core         \
715         check-stage2-T-$(2)-H-$(3)-std          \
716         $(3)/test/$$(FT_DRIVER)-$(2).out
717
718 endef
719
720 $(foreach host,$(CFG_TARGET_TRIPLES), \
721  $(eval $(foreach target,$(CFG_TARGET_TRIPLES), \
722    $(eval $(call DEF_CHECK_FAST_FOR_T_H,,$(target),$(host))))))
723
724 ######################################################################
725 # Shortcut rules
726 ######################################################################
727
728 define DEF_CHECK_FOR_STAGE_H
729
730 check-stage$(1)-H-$(2):                                 \
731         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
732          check-stage$(1)-T-$$(target)-H-$(2))
733 check-stage$(1)-H-$(2)-perf:                                    \
734         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
735          check-stage$(1)-T-$$(target)-H-$(2)-perf)
736 check-stage$(1)-H-$(2)-rustc:                                   \
737         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
738          check-stage$(1)-T-$$(target)-H-$(2)-rustc)
739 check-stage$(1)-H-$(2)-core:                                    \
740         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
741          check-stage$(1)-T-$$(target)-H-$(2)-core)
742 check-stage$(1)-H-$(2)-std:                                     \
743         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
744          check-stage$(1)-T-$$(target)-H-$(2)-std)
745 check-stage$(1)-H-$(2)-rpass:                                   \
746         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
747          check-stage$(1)-T-$$(target)-H-$(2)-rpass)
748 check-stage$(1)-H-$(2)-rpass-full:                                      \
749         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
750          check-stage$(1)-T-$$(target)-H-$(2)-rpass-full)
751 check-stage$(1)-H-$(2)-rfail:                                   \
752         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
753          check-stage$(1)-T-$$(target)-H-$(2)-rfail)
754 check-stage$(1)-H-$(2)-cfail:                                   \
755         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
756          check-stage$(1)-T-$$(target)-H-$(2)-cfail)
757 check-stage$(1)-H-$(2)-bench:                                   \
758         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
759          check-stage$(1)-T-$$(target)-H-$(2)-bench)
760 check-stage$(1)-H-$(2)-pretty:                                  \
761         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
762          check-stage$(1)-T-$$(target)-H-$(2)-pretty)
763 check-stage$(1)-H-$(2)-pretty-rpass:                            \
764         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
765          check-stage$(1)-T-$$(target)-H-$(2)-pretty-rpass)
766 check-stage$(1)-H-$(2)-pretty-rpass-full:                               \
767         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
768          check-stage$(1)-T-$$(target)-H-$(2)-pretty-rpass-full)
769 check-stage$(1)-H-$(2)-pretty-rfail:                            \
770         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
771          check-stage$(1)-T-$$(target)-H-$(2)-pretty-rfail)
772 check-stage$(1)-H-$(2)-pretty-bench:                            \
773         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
774          check-stage$(1)-T-$$(target)-H-$(2)-pretty-bench)
775 check-stage$(1)-H-$(2)-pretty-pretty:                           \
776         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
777          check-stage$(1)-T-$$(target)-H-$(2)-pretty-pretty)
778 check-stage$(1)-H-$(2)-rustdoc:                                 \
779         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
780          check-stage$(1)-T-$$(target)-H-$(2)-rustdoc)
781 check-stage$(1)-H-$(2)-rusti:                                   \
782         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
783          check-stage$(1)-T-$$(target)-H-$(2)-rusti)
784 check-stage$(1)-H-$(2)-cargo:                                   \
785         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
786          check-stage$(1)-T-$$(target)-H-$(2)-cargo)
787 check-stage$(1)-H-$(2)-doc-tutorial:                            \
788         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
789          check-stage$(1)-T-$$(target)-H-$(2)-doc-tutorial)
790 check-stage$(1)-H-$(2)-doc-tutorial-ffi:                        \
791         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
792          check-stage$(1)-T-$$(target)-H-$(2)-doc-tutorial-ffi)
793 check-stage$(1)-H-$(2)-doc-tutorial-macros:                     \
794         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
795          check-stage$(1)-T-$$(target)-H-$(2)-doc-tutorial-macros)
796 check-stage$(1)-H-$(2)-doc-tutorial-borrowed-ptr:               \
797         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
798          check-stage$(1)-T-$$(target)-H-$(2)-doc-tutorial-borrowed-ptr)
799 check-stage$(1)-H-$(2)-doc-tutorial-tasks:              \
800         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
801          check-stage$(1)-T-$$(target)-H-$(2)-doc-tutorial-tasks)
802 check-stage$(1)-H-$(2)-doc-ref:                         \
803         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
804          check-stage$(1)-T-$$(target)-H-$(2)-doc-ref)
805
806 endef
807
808 $(foreach stage,$(STAGES),                                      \
809  $(eval $(foreach target,$(CFG_TARGET_TRIPLES),                 \
810   $(eval $(call DEF_CHECK_FOR_STAGE_H,$(stage),$(target))))))
811
812 define DEF_CHECK_FAST_FOR_H
813
814 check-fast-H-$(1):              check-fast-T-$(1)-H-$(1)
815
816 endef
817
818 $(foreach target,$(CFG_TARGET_TRIPLES),                 \
819  $(eval $(call DEF_CHECK_FAST_FOR_H,$(target))))
820
821 define DEF_CHECK_ALL_FOR_STAGE
822
823 check-stage$(1)-H-all: \
824         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
825          check-stage$(1)-H-$$(target))
826 check-stage$(1)-H-all-perf: \
827         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
828          check-stage$(1)-H-$$(target)-perf)
829 check-stage$(1)-H-all-rustc: \
830         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
831          check-stage$(1)-H-$$(target)-rustc)
832 check-stage$(1)-H-all-core: \
833         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
834          check-stage$(1)-H-$$(target)-core)
835 check-stage$(1)-H-all-std: \
836         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
837          check-stage$(1)-H-$$(target)-std)
838 check-stage$(1)-H-all-rpass: \
839         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
840          check-stage$(1)-H-$$(target)-rpass)
841 check-stage$(1)-H-all-rpass-full: \
842         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
843          check-stage$(1)-H-$$(target)-rpass-full)
844 check-stage$(1)-H-all-rfail: \
845         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
846          check-stage$(1)-H-$$(target)-rfail)
847 check-stage$(1)-H-all-cfail: \
848         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
849          check-stage$(1)-H-$$(target)-cfail)
850 check-stage$(1)-H-all-bench: \
851         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
852          check-stage$(1)-H-$$(target)-bench)
853 check-stage$(1)-H-all-pretty: \
854         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
855          check-stage$(1)-H-$$(target)-pretty)
856 check-stage$(1)-H-all-pretty-rpass: \
857         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
858          check-stage$(1)-H-$$(target)-pretty-rpass)
859 check-stage$(1)-H-all-pretty-rpass-full: \
860         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
861          check-stage$(1)-H-$$(target)-pretty-rpass-full)
862 check-stage$(1)-H-all-pretty-rfail: \
863         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
864          check-stage$(1)-H-$$(target)-pretty-rfail)
865 check-stage$(1)-H-all-pretty-bench: \
866         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
867          check-stage$(1)-H-$$(target)-pretty-bench)
868 check-stage$(1)-H-all-pretty-pretty: \
869         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
870          check-stage$(1)-H-$$(target)-pretty-pretty)
871 check-stage$(1)-H-all-rustdoc: \
872         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
873          check-stage$(1)-H-$$(target)-rustdoc)
874 check-stage$(1)-H-all-cargo: \
875         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
876          check-stage$(1)-H-$$(target)-cargo)
877 check-stage$(1)-H-all-doc-tutorial: \
878         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
879          check-stage$(1)-H-$$(target)-doc-tutorial)
880 check-stage$(1)-H-all-doc-ref: \
881         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
882          check-stage$(1)-H-$$(target)-doc-ref)
883
884 endef
885
886 $(foreach stage,$(STAGES),                                              \
887  $(eval $(call DEF_CHECK_ALL_FOR_STAGE,$(stage))))
888
889 define DEF_CHECK_FOR_STAGE
890
891 check-stage$(1): check-stage$(1)-H-$$(CFG_HOST_TRIPLE)
892 check-stage$(1)-perf: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-perf
893 check-stage$(1)-rustc: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-rustc
894 check-stage$(1)-core: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-core
895 check-stage$(1)-std: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-std
896 check-stage$(1)-rpass: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-rpass
897 check-stage$(1)-rpass-full: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-rpass-full
898 check-stage$(1)-rfail: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-rfail
899 check-stage$(1)-cfail: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-cfail
900 check-stage$(1)-bench: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-bench
901 check-stage$(1)-pretty: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-pretty
902 check-stage$(1)-pretty-rpass: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-pretty-rpass
903 check-stage$(1)-pretty-rpass-full: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-pretty-rpass-full
904 check-stage$(1)-pretty-rfail: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-pretty-rfail
905 check-stage$(1)-pretty-bench: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-pretty-bench
906 check-stage$(1)-pretty-pretty: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-pretty-pretty
907 check-stage$(1)-rustdoc: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-rustdoc
908 check-stage$(1)-cargo: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-cargo
909 check-stage$(1)-doc-tutorial: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-doc-tutorial
910 check-stage$(1)-doc-tutorial-ffi: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-doc-tutorial-ffi
911 check-stage$(1)-doc-tutorial-macros: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-doc-tutorial-macros
912 check-stage$(1)-doc-tutorial-borrowed-ptr: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-doc-tutorial-borrowed-ptr
913 check-stage$(1)-doc-tutorial-tasks: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-doc-tutorial-tasks
914 check-stage$(1)-doc-ref: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-doc-ref
915
916 endef
917
918 $(foreach stage,$(STAGES),                                              \
919  $(eval $(call DEF_CHECK_FOR_STAGE,$(stage))))
920
921 check-fast: tidy check-fast-H-$(CFG_HOST_TRIPLE)