]> git.lizzy.rs Git - rust.git/blob - mk/tests.mk
37b7f297cc8bcd0644f73bbe72b624bbec2ea67e
[rust.git] / mk / tests.mk
1 ######################################################################
2 # Testing variables
3 ######################################################################
4
5 ALL_TEST_INPUTS = $(wildcard $(S)src/test/*/*.rs   \
6                               $(S)src/test/*/*/*.rs \
7                               $(S)src/test/*/*.rc)
8
9 RPASS_RC := $(wildcard $(S)src/test/run-pass/*.rc)
10 RPASS_RS := $(wildcard $(S)src/test/run-pass/*.rs)
11 RFAIL_RC := $(wildcard $(S)src/test/run-fail/*.rc)
12 RFAIL_RS := $(wildcard $(S)src/test/run-fail/*.rs)
13 CFAIL_RC := $(wildcard $(S)src/test/compile-fail/*.rc)
14 CFAIL_RS := $(wildcard $(S)src/test/compile-fail/*.rs)
15 BENCH_RS := $(wildcard $(S)src/test/bench/*.rs)
16 PRETTY_RS := $(wildcard $(S)src/test/pretty/*.rs)
17
18 # perf tests are the same as bench tests only they run under
19 # a performance monitor.
20 PERF_RS := $(wildcard $(S)src/test/bench/*.rs)
21
22 RPASS_TESTS := $(RPASS_RC) $(RPASS_RS)
23 RFAIL_TESTS := $(RFAIL_RC) $(RFAIL_RS)
24 CFAIL_TESTS := $(CFAIL_RC) $(CFAIL_RS)
25 BENCH_TESTS := $(BENCH_RS)
26 PERF_TESTS := $(PERF_RS)
27 PRETTY_TESTS := $(PRETTY_RS)
28
29 FT := run_pass_stage2
30 FT_LIB := $(call CFG_LIB_NAME,$(FT))
31 FT_DRIVER := $(FT)_driver
32
33 # The arguments to all test runners
34 ifdef TESTNAME
35   TESTARGS += $(TESTNAME)
36 endif
37
38 ifdef CHECK_XFAILS
39   TESTARGS += --ignored
40 endif
41
42 # Arguments to the cfail/rfail/rpass/bench tests
43 ifdef CFG_VALGRIND
44   CTEST_RUNTOOL = --runtool "$(CFG_VALGRIND)"
45 endif
46
47 # Arguments to the perf tests
48 ifdef CFG_PERF_TOOL
49   CTEST_PERF_RUNTOOL = --runtool "$(CFG_PERF_TOOL)"
50 endif
51
52 CTEST_TESTARGS := $(TESTARGS)
53
54 ifdef VERBOSE
55   CTEST_TESTARGS += --verbose
56 endif
57
58 # Run the compiletest runner itself under valgrind
59 ifdef CTEST_VALGRIND
60   CFG_RUN_CTEST=$(call CFG_RUN_TEST,$(2),$(3))
61 else
62   CFG_RUN_CTEST=$(call CFG_RUN,$(TLIB$(1)_T_$(3)_H_$(3)),$(2))
63 endif
64
65 ######################################################################
66 # Main test targets
67 ######################################################################
68
69 check: tidy all check-stage2 \
70
71 check-full: tidy all check-stage1 check-stage2 check-stage3 \
72
73 # Run the tidy script in multiple parts to avoid huge 'echo' commands
74 ifdef CFG_NOTIDY
75 tidy:
76 else
77 tidy:
78                 @$(call E, check: formatting)
79                 $(Q)echo \
80                   $(addprefix $(S)src/, $(RUSTLLVM_LIB_CS) $(RUSTLLVM_OBJS_CS) \
81                   $(RUSTLLVM_HDR) \
82                 $(RUNTIME_CS) $(RUNTIME_HDR) $(RUNTIME_S)) \
83               $(wildcard $(S)src/etc/*.py)  \
84               $(COMPILER_CRATE) \
85               $(COMPILER_INPUTS) \
86               $(CORELIB_CRATE) \
87               $(CORELIB_INPUTS) \
88               $(STDLIB_CRATE) \
89               $(STDLIB_INPUTS) \
90               $(COMPILETEST_CRATE) \
91               $(COMPILETEST_INPUTS) \
92               $(CARGO_CRATE) \
93               $(CARGO_INPUTS) \
94               $(RUSTDOC_CRATE) \
95               $(RUSTDOC_INPUTS) \
96                   | xargs -n 10 python $(S)src/etc/tidy.py
97                 $(Q)echo \
98               $(ALL_TEST_INPUTS) \
99                 | xargs -n 10 python $(S)src/etc/tidy.py
100 endif
101
102
103 ######################################################################
104 # Extracting tests for docs
105 ######################################################################
106
107 EXTRACT_TESTS := "$(CFG_PYTHON)" $(S)src/etc/extract-tests.py
108
109 define DEF_DOC_TEST_HOST
110
111 doc-tutorial-extract$(1):
112         @$$(call E, extract: tutorial tests)
113         $$(Q)rm -f $(1)/test/doc-tutorial/*.rs
114         $$(Q)$$(EXTRACT_TESTS) $$(S)doc/tutorial.md $(1)/test/doc-tutorial
115
116 endef
117
118 $(foreach host,$(CFG_TARGET_TRIPLES), \
119  $(eval $(call DEF_DOC_TEST_HOST,$(host))))
120
121 ######################################################################
122 # Rules for the test runners
123 ######################################################################
124
125 define TEST_STAGEN
126
127 # All the per-stage build rules you might want to call from the
128 # command line.
129 #
130 # $(1) is the stage number
131 # $(2) is the target triple to test
132 # $(3) is the host triple to test
133
134 check-stage$(1)-T-$(2)-H-$(3): tidy                             \
135         check-stage$(1)-T-$(2)-H-$(3)-rustc                     \
136         check-stage$(1)-T-$(2)-H-$(3)-core                      \
137         check-stage$(1)-T-$(2)-H-$(3)-std                       \
138         check-stage$(1)-T-$(2)-H-$(3)-rpass                     \
139         check-stage$(1)-T-$(2)-H-$(3)-rfail                     \
140         check-stage$(1)-T-$(2)-H-$(3)-cfail                     \
141         check-stage$(1)-T-$(2)-H-$(3)-bench                     \
142         check-stage$(1)-T-$(2)-H-$(3)-pretty                    \
143         check-stage$(1)-T-$(2)-H-$(3)-rustdoc                   \
144         check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial
145
146 check-stage$(1)-T-$(2)-H-$(3)-core:                             \
147         check-stage$(1)-T-$(2)-H-$(3)-core-dummy
148
149 check-stage$(1)-T-$(2)-H-$(3)-std:                              \
150         check-stage$(1)-T-$(2)-H-$(3)-std-dummy
151
152 check-stage$(1)-T-$(2)-H-$(3)-rustc:                            \
153         check-stage$(1)-T-$(2)-H-$(3)-rustc-dummy
154
155 check-stage$(1)-T-$(2)-H-$(3)-cfail:                            \
156         check-stage$(1)-T-$(2)-H-$(3)-cfail-dummy
157
158 check-stage$(1)-T-$(2)-H-$(3)-rfail:                            \
159         check-stage$(1)-T-$(2)-H-$(3)-rfail-dummy
160
161 check-stage$(1)-T-$(2)-H-$(3)-rpass:                            \
162         check-stage$(1)-T-$(2)-H-$(3)-rpass-dummy
163
164 check-stage$(1)-T-$(2)-H-$(3)-bench:                            \
165         check-stage$(1)-T-$(2)-H-$(3)-bench-dummy
166
167 check-stage$(1)-T-$(2)-H-$(3)-perf:                             \
168         check-stage$(1)-T-$(2)-H-$(3)-perf-dummy
169
170 check-stage$(1)-T-$(2)-H-$(3)-pretty:                   \
171         check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass      \
172     check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail  \
173     check-stage$(1)-T-$(2)-H-$(3)-pretty-bench  \
174     check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty
175
176 check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass:                     \
177         check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-dummy
178
179 check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail:                     \
180         check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail-dummy
181
182 check-stage$(1)-T-$(2)-H-$(3)-pretty-bench:                     \
183         check-stage$(1)-T-$(2)-H-$(3)-pretty-bench-dummy
184
185 check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty:                            \
186         check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty-dummy
187
188 check-stage$(1)-T-$(2)-H-$(3)-rustdoc:                          \
189         check-stage$(1)-T-$(2)-H-$(3)-rustdoc-dummy
190
191 check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial: \
192         check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-dummy
193
194 # Rules for the core library test runner
195
196 $(3)/test/coretest.stage$(1)-$(2)$$(X):                 \
197                 $$(CORELIB_CRATE) $$(CORELIB_INPUTS)    \
198         $$(SREQ$(1)_T_$(2)_H_$(3))
199         @$$(call E, compile_and_link: $$@)
200         $$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
201
202 check-stage$(1)-T-$(2)-H-$(3)-core-dummy:                       \
203                 $(3)/test/coretest.stage$(1)-$(2)$$(X)
204         @$$(call E, run: $$<)
205         $$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) $$(TESTARGS)
206
207 # Rules for the standard library test runner
208
209 $(3)/test/stdtest.stage$(1)-$(2)$$(X):                  \
210                 $$(STDLIB_CRATE) $$(STDLIB_INPUTS)      \
211         $$(SREQ$(1)_T_$(2)_H_$(3))
212         @$$(call E, compile_and_link: $$@)
213         $$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
214
215 check-stage$(1)-T-$(2)-H-$(3)-std-dummy:                        \
216                 $(3)/test/stdtest.stage$(1)-$(2)$$(X)
217         @$$(call E, run: $$<)
218         $$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) $$(TESTARGS)
219
220 # Rules for the rustc test runner
221
222 $(3)/test/rustctest.stage$(1)-$(2)$$(X):                                        \
223                 $$(COMPILER_CRATE)                                                                      \
224                 $$(COMPILER_INPUTS)                                                                     \
225                 $$(SREQ$(1)_T_$(2)_H_$(3))                                                      \
226                 $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUSTLLVM)
227         @$$(call E, compile_and_link: $$@)
228         $$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
229
230 check-stage$(1)-T-$(2)-H-$(3)-rustc-dummy:              \
231                 $(3)/test/rustctest.stage$(1)-$(2)$$(X)
232         @$$(call E, run: $$<)
233         $$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) $$(TESTARGS)
234
235 # Rules for the rustdoc test runner
236
237 $(3)/test/rustdoctest.stage$(1)-$(2)$$(X):                                      \
238                 $$(RUSTDOC_CRATE) $$(RUSTDOC_INPUTS)            \
239                 $$(TSREQ$(1)_T_$(2)_H_$(3))                                     \
240                 $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_CORELIB)  \
241                 $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB)   \
242                 $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC)
243         @$$(call E, compile_and_link: $$@)
244         $$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
245
246 check-stage$(1)-T-$(2)-H-$(3)-rustdoc-dummy:            \
247                 $(3)/test/rustdoctest.stage$(1)-$(2)$$(X)
248         @$$(call E, run: $$<)
249         $$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) $$(TESTARGS)
250
251 # Rules for the cfail/rfail/rpass/bench/perf test runner
252
253 CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) :=                                          \
254                 --compile-lib-path $$(HLIB$(1)_H_$(3))                          \
255         --run-lib-path $$(TLIB$(1)_T_$(2)_H_$(3))                       \
256         --rustc-path $$(HBIN$(1)_H_$(3))/rustc$$(X)                     \
257         --aux-base $$(S)src/test/auxiliary/                 \
258         --stage-id stage$(1)-$(2)                                                       \
259         --rustcflags "$$(CFG_RUSTC_FLAGS) --target=$(2)"        \
260         $$(CTEST_TESTARGS)
261
262 CFAIL_ARGS$(1)-T-$(2)-H-$(3) :=                                 \
263                 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
264         --src-base $$(S)src/test/compile-fail/  \
265         --build-base $(3)/test/compile-fail/    \
266         --mode compile-fail
267
268 RFAIL_ARGS$(1)-T-$(2)-H-$(3) :=                                 \
269                 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
270         --src-base $$(S)src/test/run-fail/              \
271         --build-base $(3)/test/run-fail/                \
272         --mode run-fail                                                 \
273         $$(CTEST_RUNTOOL)
274
275 RPASS_ARGS$(1)-T-$(2)-H-$(3) :=                         \
276                 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
277         --src-base $$(S)src/test/run-pass/              \
278         --build-base $(3)/test/run-pass/                \
279         --mode run-pass                                 \
280         $$(CTEST_RUNTOOL)
281
282 BENCH_ARGS$(1)-T-$(2)-H-$(3) :=                         \
283                 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
284         --src-base $$(S)src/test/bench/                 \
285         --build-base $(3)/test/bench/                   \
286         --mode run-pass                                 \
287         $$(CTEST_RUNTOOL)
288
289 PERF_ARGS$(1)-T-$(2)-H-$(3) :=                                  \
290                 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
291         --src-base $$(S)src/test/bench/                 \
292         --build-base $(3)/test/perf/                    \
293         --mode run-pass                                                 \
294         $$(CTEST_PERF_RUNTOOL)
295
296 PRETTY_RPASS_ARGS$(1)-T-$(2)-H-$(3) :=                  \
297                 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
298         --src-base $$(S)src/test/run-pass/              \
299         --build-base $(3)/test/run-pass/                \
300         --mode pretty
301
302 PRETTY_RFAIL_ARGS$(1)-T-$(2)-H-$(3) :=                  \
303                 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
304         --src-base $$(S)src/test/run-fail/              \
305         --build-base $(3)/test/run-fail/                \
306         --mode pretty
307
308 PRETTY_BENCH_ARGS$(1)-T-$(2)-H-$(3) :=                  \
309                 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
310         --src-base $$(S)src/test/bench/                 \
311         --build-base $(3)/test/bench/                   \
312         --mode pretty
313
314 PRETTY_PRETTY_ARGS$(1)-T-$(2)-H-$(3) :=                 \
315                 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
316         --src-base $$(S)src/test/pretty/                \
317         --build-base $(3)/test/pretty/                  \
318         --mode pretty
319
320 DOC_TUTORIAL_ARGS$(1)-T-$(2)-H-$(3) :=                  \
321                 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
322         --src-base $(3)/test/doc-tutorial/              \
323         --build-base $(3)/test/doc-tutorial/            \
324         --mode run-pass
325
326 check-stage$(1)-T-$(2)-H-$(3)-cfail-dummy:              \
327                 $$(HBIN$(1)_H_$(3))/compiletest$$(X)    \
328                 $$(SREQ$(1)_T_$(2)_H_$(3))              \
329                 $$(CFAIL_TESTS)
330         @$$(call E, run cfail: $$<)
331         $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
332                 $$(CFAIL_ARGS$(1)-T-$(2)-H-$(3))
333
334 check-stage$(1)-T-$(2)-H-$(3)-rfail-dummy:              \
335                 $$(HBIN$(1)_H_$(3))/compiletest$$(X)    \
336                 $$(SREQ$(1)_T_$(2)_H_$(3))              \
337                 $$(RFAIL_TESTS)
338         @$$(call E, run rfail: $$<)
339         $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
340                 $$(RFAIL_ARGS$(1)-T-$(2)-H-$(3))
341
342 check-stage$(1)-T-$(2)-H-$(3)-rpass-dummy:              \
343                 $$(HBIN$(1)_H_$(3))/compiletest$$(X)    \
344                 $$(SREQ$(1)_T_$(2)_H_$(3))              \
345                 $$(RPASS_TESTS)
346         @$$(call E, run rpass: $$<)
347         $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
348                 $$(RPASS_ARGS$(1)-T-$(2)-H-$(3))
349
350 check-stage$(1)-T-$(2)-H-$(3)-bench-dummy:              \
351                 $$(HBIN$(1)_H_$(3))/compiletest$$(X)    \
352                 $$(SREQ$(1)_T_$(2)_H_$(3))              \
353                 $$(BENCH_TESTS)
354         @$$(call E, run bench: $$<)
355         $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
356                 $$(BENCH_ARGS$(1)-T-$(2)-H-$(3))
357
358 check-stage$(1)-T-$(2)-H-$(3)-perf-dummy:               \
359                 $$(HBIN$(1)_H_$(3))/compiletest$$(X)    \
360                 $$(SREQ$(1)_T_$(2)_H_$(3))              \
361                 $$(BENCH_TESTS)
362         @$$(call E, perf: $$<)
363         $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
364                 $$(PERF_ARGS$(1)-T-$(2)-H-$(3))
365
366 check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-dummy:       \
367                 $$(HBIN$(1)_H_$(3))/compiletest$$(X)    \
368                 $$(SREQ$(1)_T_$(2)_H_$(3))              \
369                 $$(RPASS_TESTS)
370         @$$(call E, run pretty-rpass: $$<)
371         $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
372                 $$(PRETTY_RPASS_ARGS$(1)-T-$(2)-H-$(3))
373
374 check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail-dummy:       \
375                 $$(HBIN$(1)_H_$(3))/compiletest$$(X)    \
376                 $$(SREQ$(1)_T_$(2)_H_$(3))              \
377                 $$(RFAIL_TESTS)
378         @$$(call E, run pretty-rfail: $$<)
379         $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
380                 $$(PRETTY_RFAIL_ARGS$(1)-T-$(2)-H-$(3))
381
382 check-stage$(1)-T-$(2)-H-$(3)-pretty-bench-dummy:       \
383                 $$(HBIN$(1)_H_$(3))/compiletest$$(X)    \
384                 $$(SREQ$(1)_T_$(2)_H_$(3))              \
385                 $$(BENCH_TESTS)
386         @$$(call E, run pretty-bench: $$<)
387         $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
388                 $$(PRETTY_BENCH_ARGS$(1)-T-$(2)-H-$(3))
389
390 check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty-dummy:      \
391                 $$(HBIN$(1)_H_$(3))/compiletest$$(X)    \
392                 $$(SREQ$(1)_T_$(2)_H_$(3))              \
393                 $$(PRETTY_TESTS)
394         @$$(call E, run pretty-pretty: $$<)
395         $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
396                 $$(PRETTY_PRETTY_ARGS$(1)-T-$(2)-H-$(3))
397
398 check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-dummy:       \
399                 $$(HBIN$(1)_H_$(3))/compiletest$$(X)    \
400                 $$(SREQ$(1)_T_$(2)_H_$(3))              \
401                 doc-tutorial-extract$(3)
402         @$$(call E, run doc-tutorial: $$<)
403         $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
404                 $$(DOC_TUTORIAL_ARGS$(1)-T-$(2)-H-$(3))
405
406 endef
407
408 # Instantiate the template for stage 0, 1, 2, 3
409
410 $(foreach host,$(CFG_TARGET_TRIPLES), \
411  $(eval $(foreach target,$(CFG_TARGET_TRIPLES), \
412   $(eval $(foreach stage,$(STAGES), \
413    $(eval $(call TEST_STAGEN,$(stage),$(target),$(host))))))))
414
415 ######################################################################
416 # Fast-test rules
417 ######################################################################
418
419 GENERATED += tmp/$(FT).rc tmp/$(FT_DRIVER).rs
420
421 tmp/$(FT).rc tmp/$(FT_DRIVER).rs: \
422                 $(RPASS_TESTS) \
423                 $(S)src/etc/combine-tests.py
424         @$(call E, check: building combined stage2 test runner)
425         $(Q)$(S)src/etc/combine-tests.py
426
427 define DEF_CHECK_FAST_FOR_T_H
428 # $(1) unused
429 # $(2) target triple
430 # $(3) host triple
431
432 $$(TLIB2_T_$(2)_H_$(3))/$$(FT_LIB): \
433                 tmp/$$(FT).rc \
434                 $$(SREQ2_T_$(2)_H_$(3))
435         @$$(call E, compile_and_link: $$@)
436         $$(STAGE2_T_$(2)_H_$(3)) --lib -o $$@ $$<
437
438 $(3)/test/$$(FT_DRIVER)-$(2)$$(X): \
439                 tmp/$$(FT_DRIVER).rs \
440                 $$(TLIB2_T_$(2)_H_$(3))/$$(FT_LIB) \
441                 $$(SREQ2_T_$(2)_H_$(3))
442         @$$(call E, compile_and_link: $$@ $$<)
443         $$(STAGE2_T_$(2)_H_$(3)) -L $$(TLIB2_T_$(2)_H_$(3)) -o $$@ $$<
444
445 $(3)/test/$$(FT_DRIVER)-$(2).out: \
446                 $(3)/test/$$(FT_DRIVER)-$(2)$$(X) \
447                 $$(SREQ2_T_$(2)_H_$(3))
448         $$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3))
449
450 check-fast-T-$(2)-H-$(3): tidy                  \
451         check-stage2-T-$(2)-H-$(3)-rustc        \
452         check-stage2-T-$(2)-H-$(3)-std          \
453         $(3)/test/$$(FT_DRIVER)-$(2).out
454
455 endef
456
457 $(foreach host,$(CFG_TARGET_TRIPLES), \
458  $(eval $(foreach target,$(CFG_TARGET_TRIPLES), \
459    $(eval $(call DEF_CHECK_FAST_FOR_T_H,,$(target),$(host))))))
460
461 ######################################################################
462 # Shortcut rules
463 ######################################################################
464
465 define DEF_CHECK_FOR_STAGE_H
466
467 check-stage$(1)-H-$(2):                                 \
468         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
469          check-stage$(1)-T-$$(target)-H-$(2))
470 check-stage$(1)-H-$(2)-perf:                                    \
471         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
472          check-stage$(1)-T-$$(target)-H-$(2)-perf)
473 check-stage$(1)-H-$(2)-rustc:                                   \
474         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
475          check-stage$(1)-T-$$(target)-H-$(2)-rustc)
476 check-stage$(1)-H-$(2)-core:                                    \
477         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
478          check-stage$(1)-T-$$(target)-H-$(2)-core)
479 check-stage$(1)-H-$(2)-std:                                     \
480         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
481          check-stage$(1)-T-$$(target)-H-$(2)-std)
482 check-stage$(1)-H-$(2)-rpass:                                   \
483         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
484          check-stage$(1)-T-$$(target)-H-$(2)-rpass)
485 check-stage$(1)-H-$(2)-rfail:                                   \
486         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
487          check-stage$(1)-T-$$(target)-H-$(2)-rfail)
488 check-stage$(1)-H-$(2)-cfail:                                   \
489         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
490          check-stage$(1)-T-$$(target)-H-$(2)-cfail)
491 check-stage$(1)-H-$(2)-bench:                                   \
492         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
493          check-stage$(1)-T-$$(target)-H-$(2)-bench)
494 check-stage$(1)-H-$(2)-pretty:                                  \
495         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
496          check-stage$(1)-T-$$(target)-H-$(2)-pretty)
497 check-stage$(1)-H-$(2)-pretty-rpass:                            \
498         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
499          check-stage$(1)-T-$$(target)-H-$(2)-pretty-rpass)
500 check-stage$(1)-H-$(2)-pretty-rfail:                            \
501         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
502          check-stage$(1)-T-$$(target)-H-$(2)-pretty-rfail)
503 check-stage$(1)-H-$(2)-pretty-bench:                            \
504         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
505          check-stage$(1)-T-$$(target)-H-$(2)-pretty-bench)
506 check-stage$(1)-H-$(2)-pretty-pretty:                           \
507         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
508          check-stage$(1)-T-$$(target)-H-$(2)-pretty-pretty)
509 check-stage$(1)-H-$(2)-rustdoc:                                 \
510         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
511          check-stage$(1)-T-$$(target)-H-$(2)-rustdoc)
512 check-stage$(1)-H-$(2)-doc-tutorial:                            \
513         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
514          check-stage$(1)-T-$$(target)-H-$(2)-doc-tutorial)
515
516 endef
517
518 $(foreach stage,$(STAGES),                                      \
519  $(eval $(foreach target,$(CFG_TARGET_TRIPLES),                 \
520   $(eval $(call DEF_CHECK_FOR_STAGE_H,$(stage),$(target))))))
521
522 define DEF_CHECK_FAST_FOR_H
523
524 check-fast-H-$(1):              check-fast-T-$(1)-H-$(1)
525
526 endef
527
528 $(foreach target,$(CFG_TARGET_TRIPLES),                 \
529  $(eval $(call DEF_CHECK_FAST_FOR_H,$(target))))
530
531 define DEF_CHECK_ALL_FOR_STAGE
532
533 check-stage$(1)-H-all: \
534         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
535          check-stage$(1)-H-$$(target))
536 check-stage$(1)-H-all-perf: \
537         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
538          check-stage$(1)-H-$$(target)-perf)
539 check-stage$(1)-H-all-rustc: \
540         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
541          check-stage$(1)-H-$$(target)-rustc)
542 check-stage$(1)-H-all-core: \
543         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
544          check-stage$(1)-H-$$(target)-core)
545 check-stage$(1)-H-all-std: \
546         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
547          check-stage$(1)-H-$$(target)-std)
548 check-stage$(1)-H-all-rpass: \
549         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
550          check-stage$(1)-H-$$(target)-rpass)
551 check-stage$(1)-H-all-rfail: \
552         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
553          check-stage$(1)-H-$$(target)-rfail)
554 check-stage$(1)-H-all-cfail: \
555         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
556          check-stage$(1)-H-$$(target)-cfail)
557 check-stage$(1)-H-all-bench: \
558         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
559          check-stage$(1)-H-$$(target)-bench)
560 check-stage$(1)-H-all-pretty: \
561         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
562          check-stage$(1)-H-$$(target)-pretty)
563 check-stage$(1)-H-all-pretty-rpass: \
564         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
565          check-stage$(1)-H-$$(target)-pretty-rpass)
566 check-stage$(1)-H-all-pretty-rfail: \
567         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
568          check-stage$(1)-H-$$(target)-pretty-rfail)
569 check-stage$(1)-H-all-pretty-bench: \
570         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
571          check-stage$(1)-H-$$(target)-pretty-bench)
572 check-stage$(1)-H-all-pretty-pretty: \
573         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
574          check-stage$(1)-H-$$(target)-pretty-pretty)
575 check-stage$(1)-H-all-rustdoc: \
576         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
577          check-stage$(1)-H-$$(target)-rustdoc)
578 check-stage$(1)-H-all-doc-tutorial: \
579         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
580          check-stage$(1)-H-$$(target)-doc-tutorial)
581
582 endef
583
584 $(foreach stage,$(STAGES),                                              \
585  $(eval $(call DEF_CHECK_ALL_FOR_STAGE,$(stage))))
586
587 define DEF_CHECK_FOR_STAGE
588
589 check-stage$(1): check-stage$(1)-H-$$(CFG_HOST_TRIPLE)
590 check-stage$(1)-perf: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-perf
591 check-stage$(1)-rustc: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-rustc
592 check-stage$(1)-core: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-core
593 check-stage$(1)-std: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-std
594 check-stage$(1)-rpass: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-rpass
595 check-stage$(1)-rfail: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-rfail
596 check-stage$(1)-cfail: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-cfail
597 check-stage$(1)-bench: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-bench
598 check-stage$(1)-pretty: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-pretty
599 check-stage$(1)-pretty-rpass: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-pretty-rpass
600 check-stage$(1)-pretty-rfail: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-pretty-rfail
601 check-stage$(1)-pretty-bench: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-pretty-bench
602 check-stage$(1)-pretty-pretty: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-pretty-pretty
603 check-stage$(1)-rustdoc: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-rustdoc
604 check-stage$(1)-doc-tutorial: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-doc-tutorial
605
606 endef
607
608 $(foreach stage,$(STAGES),                                              \
609  $(eval $(call DEF_CHECK_FOR_STAGE,$(stage))))
610
611 check-fast: check-fast-H-$(CFG_HOST_TRIPLE)