]> git.lizzy.rs Git - rust.git/blob - mk/tests.mk
049b41ab204d7951326c462b1c0adf0115595e7a
[rust.git] / mk / tests.mk
1 # Copyright 2012 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.
4 #
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.
10
11
12 ######################################################################
13 # Test variables
14 ######################################################################
15
16 # The names of crates that must be tested
17 TEST_TARGET_CRATES = $(TARGET_CRATES)
18 TEST_DOC_CRATES = $(DOC_CRATES)
19 TEST_HOST_CRATES = $(HOST_CRATES)
20 TEST_CRATES = $(TEST_TARGET_CRATES) $(TEST_HOST_CRATES)
21
22 # Markdown files under doc/ that should have their code extracted and run
23 DOC_TEST_NAMES = tutorial guide-ffi guide-macros guide-lifetimes \
24                  guide-tasks guide-container guide-pointers \
25                  complement-cheatsheet guide-runtime \
26                  rust
27
28 ######################################################################
29 # Environment configuration
30 ######################################################################
31
32 # The arguments to all test runners
33 ifdef TESTNAME
34   TESTARGS += $(TESTNAME)
35 endif
36
37 ifdef CHECK_IGNORED
38   TESTARGS += --ignored
39 endif
40
41 TEST_BENCH = --bench
42
43 # Arguments to the cfail/rfail/rpass/bench tests
44 ifdef CFG_VALGRIND
45   CTEST_RUNTOOL = --runtool "$(CFG_VALGRIND)"
46   TEST_BENCH =
47 endif
48
49 ifdef NO_BENCH
50   TEST_BENCH =
51 endif
52
53 # Arguments to the perf tests
54 ifdef CFG_PERF_TOOL
55   CTEST_PERF_RUNTOOL = --runtool "$(CFG_PERF_TOOL)"
56 endif
57
58 CTEST_TESTARGS := $(TESTARGS)
59
60 ifdef VERBOSE
61   CTEST_TESTARGS += --verbose
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 TEST_LOG_FILE=tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
72 TEST_OK_FILE=tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).ok
73
74 TEST_RATCHET_FILE=tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4)-metrics.json
75 TEST_RATCHET_NOISE_PERCENT=10.0
76
77 # Whether to ratchet or merely save benchmarks
78 ifdef CFG_RATCHET_BENCH
79 CRATE_TEST_EXTRA_ARGS=\
80   --test $(TEST_BENCH) \
81   --ratchet-metrics $(call TEST_RATCHET_FILE,$(1),$(2),$(3),$(4)) \
82   --ratchet-noise-percent $(TEST_RATCHET_NOISE_PERCENT)
83 else
84 CRATE_TEST_EXTRA_ARGS=\
85   --test $(TEST_BENCH) \
86   --save-metrics $(call TEST_RATCHET_FILE,$(1),$(2),$(3),$(4))
87 endif
88
89 # If we're sharding the testsuite between parallel testers,
90 # pass this argument along to the compiletest and crate test
91 # invocations.
92 ifdef TEST_SHARD
93   CTEST_TESTARGS += --test-shard=$(TEST_SHARD)
94   CRATE_TEST_EXTRA_ARGS += --test-shard=$(TEST_SHARD)
95 endif
96
97 define DEF_TARGET_COMMANDS
98
99 ifdef CFG_UNIXY_$(1)
100   CFG_RUN_TEST_$(1)=$$(call CFG_RUN_$(1),,$$(CFG_VALGRIND) $$(1))
101 endif
102
103 ifdef CFG_WINDOWSY_$(1)
104   CFG_TESTLIB_$(1)=$$(CFG_BUILD_DIR)$$(2)/$$(strip \
105    $$(if $$(findstring stage0,$$(1)), \
106        stage0/$$(CFG_LIBDIR_RELATIVE), \
107       $$(if $$(findstring stage1,$$(1)), \
108            stage1/$$(CFG_LIBDIR_RELATIVE), \
109           $$(if $$(findstring stage2,$$(1)), \
110                stage2/$$(CFG_LIBDIR_RELATIVE), \
111                $$(if $$(findstring stage3,$$(1)), \
112                     stage3/$$(CFG_LIBDIR_RELATIVE), \
113                )))))/$$(CFG_RUSTLIBDIR)/$$(CFG_BUILD)/lib
114   CFG_RUN_TEST_$(1)=$$(call CFG_RUN_$(1),$$(call CFG_TESTLIB_$(1),$$(1),$$(3)),$$(1))
115 endif
116
117 # Run the compiletest runner itself under valgrind
118 ifdef CTEST_VALGRIND
119 CFG_RUN_CTEST_$(1)=$$(RPATH_VAR$$(1)_T_$$(3)_H_$$(3)) \
120       $$(call CFG_RUN_TEST_$$(CFG_BUILD),$$(2),$$(3))
121 else
122 CFG_RUN_CTEST_$(1)=$$(RPATH_VAR$$(1)_T_$$(3)_H_$$(3)) \
123       $$(call CFG_RUN_$$(CFG_BUILD),$$(TLIB$$(1)_T_$$(3)_H_$$(3)),$$(2))
124 endif
125
126 endef
127
128 $(foreach target,$(CFG_TARGET), \
129   $(eval $(call DEF_TARGET_COMMANDS,$(target))))
130
131 # Target platform specific variables
132 # for arm-linux-androidabi
133 define DEF_ADB_DEVICE_STATUS
134 CFG_ADB_DEVICE_STATUS=$(1)
135 endef
136
137 $(foreach target,$(CFG_TARGET), \
138   $(if $(findstring $(target),"arm-linux-androideabi"), \
139     $(if $(findstring adb,$(CFG_ADB)), \
140       $(if $(findstring device,$(shell $(CFG_ADB) devices 2>/dev/null | grep -E '^[:_A-Za-z0-9-]+[[:blank:]]+device')), \
141         $(info check: android device attached) \
142         $(eval $(call DEF_ADB_DEVICE_STATUS, true)), \
143         $(info check: android device not attached) \
144         $(eval $(call DEF_ADB_DEVICE_STATUS, false)) \
145       ), \
146       $(info check: adb not found) \
147       $(eval $(call DEF_ADB_DEVICE_STATUS, false)) \
148     ), \
149   ) \
150 )
151
152 ifeq ($(CFG_ADB_DEVICE_STATUS),true)
153 CFG_ADB_TEST_DIR=/data/tmp
154
155 $(info check: android device test dir $(CFG_ADB_TEST_DIR) ready \
156  $(shell $(CFG_ADB) remount 1>/dev/null) \
157  $(shell $(CFG_ADB) shell rm -r $(CFG_ADB_TEST_DIR) >/dev/null) \
158  $(shell $(CFG_ADB) shell mkdir $(CFG_ADB_TEST_DIR)) \
159  $(shell $(CFG_ADB) shell mkdir $(CFG_ADB_TEST_DIR)/tmp) \
160  $(shell $(CFG_ADB) push $(S)src/etc/adb_run_wrapper.sh $(CFG_ADB_TEST_DIR) 1>/dev/null) \
161  $(foreach crate,$(TARGET_CRATES),\
162     $(shell $(CFG_ADB) push $(TLIB2_T_arm-linux-androideabi_H_$(CFG_BUILD))/$(call CFG_LIB_GLOB_arm-linux-androideabi,$(crate)) \
163                     $(CFG_ADB_TEST_DIR)))\
164  )
165 else
166 CFG_ADB_TEST_DIR=
167 endif
168
169
170 ######################################################################
171 # Main test targets
172 ######################################################################
173
174 check: cleantestlibs cleantmptestlogs tidy all check-stage2
175         $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
176
177 check-notidy: cleantestlibs cleantmptestlogs all check-stage2
178         $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
179
180 check-full: cleantestlibs cleantmptestlogs tidy \
181             all check-stage1 check-stage2 check-stage3
182         $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
183
184 check-test: cleantestlibs cleantmptestlogs all check-stage2-rfail
185         $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
186
187 check-lite: cleantestlibs cleantmptestlogs \
188         $(foreach crate,$(TARGET_CRATES),check-stage2-$(crate)) \
189         check-stage2-rpass \
190         check-stage2-rfail check-stage2-cfail check-stage2-rmake
191         $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
192
193 check-ref: cleantestlibs cleantmptestlogs check-stage2-rpass \
194         check-stage2-rfail check-stage2-cfail check-stage2-rmake
195         $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
196
197 .PHONY: cleantmptestlogs cleantestlibs
198
199 cleantmptestlogs:
200         $(Q)rm -f tmp/*.log
201
202 cleantestlibs:
203         $(Q)find $(CFG_BUILD)/test \
204          -name '*.[odasS]' -o \
205          -name '*.so' -o      \
206          -name '*.dylib' -o   \
207          -name '*.dll' -o     \
208          -name '*.def' -o     \
209          -name '*.bc' -o      \
210          -name '*.dSYM' -o    \
211          -name '*.libaux' -o      \
212          -name '*.out' -o     \
213          -name '*.err' -o     \
214          -name '*.debugger.script' \
215          | xargs rm -rf
216
217
218 ######################################################################
219 # Tidy
220 ######################################################################
221
222 ifdef CFG_NOTIDY
223 tidy:
224 else
225
226 ALL_CS := $(wildcard $(S)src/rt/*.cpp \
227                      $(S)src/rt/*/*.cpp \
228                      $(S)src/rt/*/*/*.cpp \
229                      $(S)src/rustllvm/*.cpp)
230 ALL_CS := $(filter-out $(S)src/rt/miniz.cpp \
231                        $(wildcard $(S)src/rt/sundown/src/*.c) \
232                        $(wildcard $(S)src/rt/sundown/html/*.c) \
233         ,$(ALL_CS))
234 ALL_HS := $(wildcard $(S)src/rt/*.h \
235                      $(S)src/rt/*/*.h \
236                      $(S)src/rt/*/*/*.h \
237                      $(S)src/rustllvm/*.h)
238 ALL_HS := $(filter-out $(S)src/rt/vg/valgrind.h \
239                        $(S)src/rt/vg/memcheck.h \
240                        $(S)src/rt/msvc/typeof.h \
241                        $(S)src/rt/msvc/stdint.h \
242                        $(S)src/rt/msvc/inttypes.h \
243                        $(wildcard $(S)src/rt/sundown/src/*.h) \
244                        $(wildcard $(S)src/rt/sundown/html/*.h) \
245         ,$(ALL_HS))
246
247 # Run the tidy script in multiple parts to avoid huge 'echo' commands
248 tidy:
249                 @$(call E, check: formatting)
250                 $(Q)find $(S)src -name '*.r[sc]' \
251                 | grep '^$(S)src/libuv' -v \
252                 | grep '^$(S)src/llvm' -v \
253                 | grep '^$(S)src/gyp' -v \
254                 | xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py
255                 $(Q)find $(S)src/etc -name '*.py' \
256                 | xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py
257                 $(Q)echo $(ALL_CS) \
258                 | xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py
259                 $(Q)echo $(ALL_HS) \
260                 | xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py
261                 $(Q)find $(S)src -type f -perm +111 \
262                     -not -name '*.rs' -and -not -name '*.py' \
263                     -and -not -name '*.sh' \
264                 | grep '^$(S)src/llvm' -v \
265                 | grep '^$(S)src/libuv' -v \
266                 | grep '^$(S)src/gyp' -v \
267                 | grep '^$(S)src/etc' -v \
268                 | grep '^$(S)src/doc' -v \
269                 | grep '^$(S)src/compiler-rt' -v \
270                 | xargs $(CFG_PYTHON) $(S)src/etc/check-binaries.py
271
272 endif
273
274
275 ######################################################################
276 # Sets of tests
277 ######################################################################
278
279 define DEF_TEST_SETS
280
281 check-stage$(1)-T-$(2)-H-$(3)-exec:                                     \
282         check-stage$(1)-T-$(2)-H-$(3)-rpass-exec                        \
283         check-stage$(1)-T-$(2)-H-$(3)-rfail-exec                        \
284         check-stage$(1)-T-$(2)-H-$(3)-cfail-exec                        \
285         check-stage$(1)-T-$(2)-H-$(3)-rpass-full-exec                   \
286         check-stage$(1)-T-$(2)-H-$(3)-rmake-exec                        \
287         check-stage$(1)-T-$(2)-H-$(3)-crates-exec                       \
288         check-stage$(1)-T-$(2)-H-$(3)-doc-crates-exec                   \
289         check-stage$(1)-T-$(2)-H-$(3)-bench-exec                        \
290         check-stage$(1)-T-$(2)-H-$(3)-debuginfo-exec \
291         check-stage$(1)-T-$(2)-H-$(3)-codegen-exec \
292         check-stage$(1)-T-$(2)-H-$(3)-doc-exec \
293         check-stage$(1)-T-$(2)-H-$(3)-pretty-exec
294
295 # Only test the compiler-dependent crates when the target is
296 # able to build a compiler (when the target triple is in the set of host triples)
297 ifneq ($$(findstring $(2),$$(CFG_HOST)),)
298
299 check-stage$(1)-T-$(2)-H-$(3)-crates-exec: \
300         $$(foreach crate,$$(TEST_CRATES), \
301            check-stage$(1)-T-$(2)-H-$(3)-$$(crate)-exec)
302
303 else
304
305 check-stage$(1)-T-$(2)-H-$(3)-crates-exec: \
306         $$(foreach crate,$$(TEST_TARGET_CRATES), \
307            check-stage$(1)-T-$(2)-H-$(3)-$$(crate)-exec)
308
309 endif
310
311 check-stage$(1)-T-$(2)-H-$(3)-doc-crates-exec: \
312         $$(foreach crate,$$(TEST_DOC_CRATES), \
313            check-stage$(1)-T-$(2)-H-$(3)-doc-$$(crate)-exec)
314
315 check-stage$(1)-T-$(2)-H-$(3)-doc-exec: \
316         $$(foreach docname,$$(DOC_TEST_NAMES), \
317            check-stage$(1)-T-$(2)-H-$(3)-doc-$$(docname)-exec)
318
319 check-stage$(1)-T-$(2)-H-$(3)-pretty-exec: \
320         check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-exec \
321         check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-full-exec    \
322         check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail-exec \
323         check-stage$(1)-T-$(2)-H-$(3)-pretty-bench-exec \
324         check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty-exec
325
326 endef
327
328 $(foreach host,$(CFG_HOST), \
329  $(foreach target,$(CFG_TARGET), \
330   $(foreach stage,$(STAGES), \
331     $(eval $(call DEF_TEST_SETS,$(stage),$(target),$(host))))))
332
333
334 ######################################################################
335 # Crate testing
336 ######################################################################
337
338 define TEST_RUNNER
339
340 # If NO_REBUILD is set then break the dependencies on everything but
341 # the source files so we can test crates without rebuilding any of the
342 # parent crates.
343 ifeq ($(NO_REBUILD),)
344 TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(SREQ$(1)_T_$(2)_H_$(3)) \
345                             $$(foreach crate,$$(TARGET_CRATES),\
346                                 $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)) \
347                                 $$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4))
348 else
349 TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(RSINPUTS_$(4))
350 endif
351
352 $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)): CFG_COMPILER = $(2)
353 $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)):                            \
354                 $$(CRATEFILE_$(4)) \
355                 $$(TESTDEP_$(1)_$(2)_$(3)_$(4))
356         @$$(call E, oxidize: $$@)
357         $$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test   \
358                 -L "$$(RT_OUTPUT_DIR_$(2))"             \
359                 -L "$$(LLVM_LIBDIR_$(2))"
360
361 endef
362
363 $(foreach host,$(CFG_HOST), \
364  $(eval $(foreach target,$(CFG_TARGET), \
365   $(eval $(foreach stage,$(STAGES), \
366    $(eval $(foreach crate,$(TEST_CRATES), \
367     $(eval $(call TEST_RUNNER,$(stage),$(target),$(host),$(crate))))))))))
368
369 define DEF_TEST_CRATE_RULES
370 check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
371
372 check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
373
374 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
375                 $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
376         @$$(call E, run: $$<)
377         $$(Q)$$(call CFG_RUN_TEST_$(2),$$<,$(2),$(3)) $$(TESTARGS) \
378             --logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
379             $$(call CRATE_TEST_EXTRA_ARGS,$(1),$(2),$(3),$(4)) \
380             && touch $$@
381 endef
382
383 define DEF_TEST_CRATE_RULES_arm-linux-androideabi
384 check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
385
386 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
387                 $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
388         @$$(call E, run: $$< via adb)
389         $$(Q)$(CFG_ADB) push $$< $(CFG_ADB_TEST_DIR)
390         $$(Q)$(CFG_ADB) shell '(cd $(CFG_ADB_TEST_DIR); LD_LIBRARY_PATH=. \
391                 ./$$(notdir $$<) \
392                 --logfile $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log \
393                 $$(call CRATE_TEST_EXTRA_ARGS,$(1),$(2),$(3),$(4)) $(TESTARGS))' \
394                 > tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp
395         $$(Q)cat tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp
396         $$(Q)touch tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
397         $$(Q)$(CFG_ADB) pull $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log tmp/
398         $$(Q)$(CFG_ADB) shell rm $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
399         $$(Q)$(CFG_ADB) pull $(CFG_ADB_TEST_DIR)/$$(call TEST_RATCHET_FILE,$(1),$(2),$(3),$(4)) tmp/
400         @if grep -q "result: ok" tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
401         then \
402                 rm tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
403                 touch $$@; \
404         else \
405                 rm tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
406                 exit 101; \
407         fi
408 endef
409
410 define DEF_TEST_CRATE_RULES_null
411 check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
412
413 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
414                 $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
415         @$$(call E, failing: no device for $$< )
416         false
417 endef
418
419 $(foreach host,$(CFG_HOST), \
420  $(foreach target,$(CFG_TARGET), \
421   $(foreach stage,$(STAGES), \
422    $(foreach crate, $(TEST_CRATES), \
423     $(if $(findstring $(target),$(CFG_BUILD)), \
424      $(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))), \
425      $(if $(findstring $(target),"arm-linux-androideabi"), \
426       $(if $(findstring $(CFG_ADB_DEVICE_STATUS),"true"), \
427        $(eval $(call DEF_TEST_CRATE_RULES_arm-linux-androideabi,$(stage),$(target),$(host),$(crate))), \
428        $(eval $(call DEF_TEST_CRATE_RULES_null,$(stage),$(target),$(host),$(crate))) \
429       ), \
430       $(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))) \
431      ))))))
432
433 ######################################################################
434 # Rules for the compiletest tests (rpass, rfail, etc.)
435 ######################################################################
436
437 RPASS_RC := $(wildcard $(S)src/test/run-pass/*.rc)
438 RPASS_RS := $(wildcard $(S)src/test/run-pass/*.rs)
439 RPASS_FULL_RC := $(wildcard $(S)src/test/run-pass-fulldeps/*.rc)
440 RPASS_FULL_RS := $(wildcard $(S)src/test/run-pass-fulldeps/*.rs)
441 RFAIL_RC := $(wildcard $(S)src/test/run-fail/*.rc)
442 RFAIL_RS := $(wildcard $(S)src/test/run-fail/*.rs)
443 CFAIL_RC := $(wildcard $(S)src/test/compile-fail/*.rc)
444 CFAIL_RS := $(wildcard $(S)src/test/compile-fail/*.rs)
445 BENCH_RS := $(wildcard $(S)src/test/bench/*.rs)
446 PRETTY_RS := $(wildcard $(S)src/test/pretty/*.rs)
447 DEBUGINFO_RS := $(wildcard $(S)src/test/debug-info/*.rs)
448 CODEGEN_RS := $(wildcard $(S)src/test/codegen/*.rs)
449 CODEGEN_CC := $(wildcard $(S)src/test/codegen/*.cc)
450
451 # perf tests are the same as bench tests only they run under
452 # a performance monitor.
453 PERF_RS := $(wildcard $(S)src/test/bench/*.rs)
454
455 RPASS_TESTS := $(RPASS_RC) $(RPASS_RS)
456 RPASS_FULL_TESTS := $(RPASS_FULL_RC) $(RPASS_FULL_RS)
457 RFAIL_TESTS := $(RFAIL_RC) $(RFAIL_RS)
458 CFAIL_TESTS := $(CFAIL_RC) $(CFAIL_RS)
459 BENCH_TESTS := $(BENCH_RS)
460 PERF_TESTS := $(PERF_RS)
461 PRETTY_TESTS := $(PRETTY_RS)
462 DEBUGINFO_TESTS := $(DEBUGINFO_RS)
463 CODEGEN_TESTS := $(CODEGEN_RS) $(CODEGEN_CC)
464
465 CTEST_SRC_BASE_rpass = run-pass
466 CTEST_BUILD_BASE_rpass = run-pass
467 CTEST_MODE_rpass = run-pass
468 CTEST_RUNTOOL_rpass = $(CTEST_RUNTOOL)
469
470 CTEST_SRC_BASE_rpass-full = run-pass-fulldeps
471 CTEST_BUILD_BASE_rpass-full = run-pass-fulldeps
472 CTEST_MODE_rpass-full = run-pass
473 CTEST_RUNTOOL_rpass-full = $(CTEST_RUNTOOL)
474
475 CTEST_SRC_BASE_rfail = run-fail
476 CTEST_BUILD_BASE_rfail = run-fail
477 CTEST_MODE_rfail = run-fail
478 CTEST_RUNTOOL_rfail = $(CTEST_RUNTOOL)
479
480 CTEST_SRC_BASE_cfail = compile-fail
481 CTEST_BUILD_BASE_cfail = compile-fail
482 CTEST_MODE_cfail = compile-fail
483 CTEST_RUNTOOL_cfail = $(CTEST_RUNTOOL)
484
485 CTEST_SRC_BASE_bench = bench
486 CTEST_BUILD_BASE_bench = bench
487 CTEST_MODE_bench = run-pass
488 CTEST_RUNTOOL_bench = $(CTEST_RUNTOOL)
489
490 CTEST_SRC_BASE_perf = bench
491 CTEST_BUILD_BASE_perf = perf
492 CTEST_MODE_perf = run-pass
493 CTEST_RUNTOOL_perf = $(CTEST_PERF_RUNTOOL)
494
495 CTEST_SRC_BASE_debuginfo = debug-info
496 CTEST_BUILD_BASE_debuginfo = debug-info
497 CTEST_MODE_debuginfo = debug-info
498 CTEST_RUNTOOL_debuginfo = $(CTEST_RUNTOOL)
499
500 CTEST_SRC_BASE_codegen = codegen
501 CTEST_BUILD_BASE_codegen = codegen
502 CTEST_MODE_codegen = codegen
503 CTEST_RUNTOOL_codegen = $(CTEST_RUNTOOL)
504
505 ifeq ($(CFG_GDB),)
506 CTEST_DISABLE_debuginfo = "no gdb found"
507 endif
508
509 ifeq ($(CFG_CLANG),)
510 CTEST_DISABLE_codegen = "no clang found"
511 endif
512
513 ifeq ($(CFG_OSTYPE),apple-darwin)
514 CTEST_DISABLE_debuginfo = "gdb on darwing needs root"
515 endif
516
517 define DEF_CTEST_VARS
518
519 # All the per-stage build rules you might want to call from the
520 # command line.
521 #
522 # $(1) is the stage number
523 # $(2) is the target triple to test
524 # $(3) is the host triple to test
525
526 # Prerequisites for compiletest tests
527 TEST_SREQ$(1)_T_$(2)_H_$(3) = \
528         $$(HBIN$(1)_H_$(3))/compiletest$$(X_$(3)) \
529         $$(SREQ$(1)_T_$(2)_H_$(3))
530
531 # Rules for the cfail/rfail/rpass/bench/perf test runner
532
533 # The tests select when to use debug configuration on their own;
534 # remove directive, if present, from CFG_RUSTC_FLAGS (issue #7898).
535 CTEST_RUSTC_FLAGS := $$(subst --cfg ndebug,,$$(CFG_RUSTC_FLAGS))
536
537 # There's no need our entire test suite to take up gigabytes of space on disk
538 # including copies of libstd/libextra all over the place
539 CTEST_RUSTC_FLAGS := $$(CTEST_RUSTC_FLAGS) -C prefer-dynamic
540
541 # The tests can not be optimized while the rest of the compiler is optimized, so
542 # filter out the optimization (if any) from rustc and then figure out if we need
543 # to be optimized
544 CTEST_RUSTC_FLAGS := $$(subst -O,,$$(CTEST_RUSTC_FLAGS))
545 ifndef CFG_DISABLE_OPTIMIZE_TESTS
546 CTEST_RUSTC_FLAGS += -O
547 endif
548
549 CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) :=                                          \
550                 --compile-lib-path $$(HLIB$(1)_H_$(3))                          \
551         --run-lib-path $$(TLIB$(1)_T_$(2)_H_$(3))                       \
552         --rustc-path $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3))                        \
553         --clang-path $(if $(CFG_CLANG),$(CFG_CLANG),clang) \
554         --llvm-bin-path $(CFG_LLVM_INST_DIR_$(CFG_BUILD))/bin \
555         --aux-base $$(S)src/test/auxiliary/                 \
556         --stage-id stage$(1)-$(2)                                                       \
557         --target $(2)                                       \
558         --host $(3)                                       \
559         --adb-path=$(CFG_ADB)                          \
560         --adb-test-dir=$(CFG_ADB_TEST_DIR)                  \
561         --host-rustcflags "$(RUSTC_FLAGS_$(3)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(2))" \
562         --target-rustcflags "$(RUSTC_FLAGS_$(2)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(2))" \
563         $$(CTEST_TESTARGS)
564
565 CTEST_DEPS_rpass_$(1)-T-$(2)-H-$(3) = $$(RPASS_TESTS)
566 CTEST_DEPS_rpass_full_$(1)-T-$(2)-H-$(3) = $$(RPASS_FULL_TESTS) $$(TLIBRUSTC_DEFAULT$(1)_T_$(2)_H_$(3))
567 CTEST_DEPS_rfail_$(1)-T-$(2)-H-$(3) = $$(RFAIL_TESTS)
568 CTEST_DEPS_cfail_$(1)-T-$(2)-H-$(3) = $$(CFAIL_TESTS)
569 CTEST_DEPS_bench_$(1)-T-$(2)-H-$(3) = $$(BENCH_TESTS)
570 CTEST_DEPS_perf_$(1)-T-$(2)-H-$(3) = $$(PERF_TESTS)
571 CTEST_DEPS_debuginfo_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_TESTS)
572 CTEST_DEPS_codegen_$(1)-T-$(2)-H-$(3) = $$(CODEGEN_TESTS)
573
574 endef
575
576 $(foreach host,$(CFG_HOST), \
577  $(eval $(foreach target,$(CFG_TARGET), \
578   $(eval $(foreach stage,$(STAGES), \
579    $(eval $(call DEF_CTEST_VARS,$(stage),$(target),$(host))))))))
580
581 define DEF_RUN_COMPILETEST
582
583 CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4) := \
584         $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
585         --src-base $$(S)src/test/$$(CTEST_SRC_BASE_$(4))/ \
586         --build-base $(3)/test/$$(CTEST_BUILD_BASE_$(4))/ \
587         --ratchet-metrics $(call TEST_RATCHET_FILE,$(1),$(2),$(3),$(4)) \
588         --mode $$(CTEST_MODE_$(4)) \
589         $$(CTEST_RUNTOOL_$(4))
590
591 check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
592
593 ifeq ($$(CTEST_DISABLE_$(4)),)
594
595 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
596                 $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
597                 $$(CTEST_DEPS_$(4)_$(1)-T-$(2)-H-$(3))
598         @$$(call E, run $(4) [$(2)]: $$<)
599         $$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
600                 $$(CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
601                 --logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
602                 && touch $$@
603
604 else
605
606 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
607                 $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
608                 $$(CTEST_DEPS_$(4)_$(1)-T-$(2)-H-$(3))
609         @$$(call E, run $(4) [$(2)]: $$<)
610         @$$(call E, warning: tests disabled: $$(CTEST_DISABLE_$(4)))
611         touch $$@
612
613 endif
614
615 endef
616
617 CTEST_NAMES = rpass rpass-full rfail cfail bench perf debuginfo codegen
618
619 $(foreach host,$(CFG_HOST), \
620  $(eval $(foreach target,$(CFG_TARGET), \
621   $(eval $(foreach stage,$(STAGES), \
622    $(eval $(foreach name,$(CTEST_NAMES), \
623    $(eval $(call DEF_RUN_COMPILETEST,$(stage),$(target),$(host),$(name))))))))))
624
625 PRETTY_NAMES = pretty-rpass pretty-rpass-full pretty-rfail pretty-bench pretty-pretty
626 PRETTY_DEPS_pretty-rpass = $(RPASS_TESTS)
627 PRETTY_DEPS_pretty-rpass-full = $(RPASS_FULL_TESTS)
628 PRETTY_DEPS_pretty-rfail = $(RFAIL_TESTS)
629 PRETTY_DEPS_pretty-bench = $(BENCH_TESTS)
630 PRETTY_DEPS_pretty-pretty = $(PRETTY_TESTS)
631 PRETTY_DIRNAME_pretty-rpass = run-pass
632 PRETTY_DIRNAME_pretty-rpass-full = run-pass-fulldeps
633 PRETTY_DIRNAME_pretty-rfail = run-fail
634 PRETTY_DIRNAME_pretty-bench = bench
635 PRETTY_DIRNAME_pretty-pretty = pretty
636
637 define DEF_RUN_PRETTY_TEST
638
639 PRETTY_ARGS$(1)-T-$(2)-H-$(3)-$(4) :=                   \
640                 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
641         --src-base $$(S)src/test/$$(PRETTY_DIRNAME_$(4))/ \
642         --build-base $(3)/test/$$(PRETTY_DIRNAME_$(4))/ \
643         --mode pretty
644
645 check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
646
647 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
648                 $$(TEST_SREQ$(1)_T_$(2)_H_$(3))         \
649                 $$(PRETTY_DEPS_$(4))
650         @$$(call E, run pretty-rpass [$(2)]: $$<)
651         $$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
652                 $$(PRETTY_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
653                 --logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
654                 && touch $$@
655
656 endef
657
658 $(foreach host,$(CFG_HOST), \
659  $(foreach target,$(CFG_TARGET), \
660   $(foreach stage,$(STAGES), \
661    $(foreach pretty-name,$(PRETTY_NAMES), \
662     $(eval $(call DEF_RUN_PRETTY_TEST,$(stage),$(target),$(host),$(pretty-name)))))))
663
664 define DEF_RUN_DOC_TEST
665
666 DOC_TEST_ARGS$(1)-T-$(2)-H-$(3)-doc-$(4) := \
667         $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
668         --src-base $(3)/test/doc-$(4)/  \
669         --build-base $(3)/test/doc-$(4)/        \
670         --mode run-pass
671
672 check-stage$(1)-T-$(2)-H-$(3)-doc-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4))
673
674 $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)): \
675                 $$(TEST_SREQ$(1)_T_$(2)_H_$(3))         \
676                 doc-$(4)-extract$(3)
677         @$$(call E, run doc-$(4) [$(2)]: $$<)
678         $$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
679                 $$(DOC_TEST_ARGS$(1)-T-$(2)-H-$(3)-doc-$(4)) \
680                 --logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),doc-$(4)) \
681                 && touch $$@
682
683 endef
684
685 $(foreach host,$(CFG_HOST), \
686  $(foreach target,$(CFG_TARGET), \
687   $(foreach stage,$(STAGES), \
688    $(foreach docname,$(DOC_TEST_NAMES), \
689     $(eval $(call DEF_RUN_DOC_TEST,$(stage),$(target),$(host),$(docname)))))))
690
691 define DEF_CRATE_DOC_TEST
692
693 # If NO_REBUILD is set then break the dependencies on everything but
694 # the source files so we can test crate documentation without
695 # rebuilding any of the parent crates.
696 ifeq ($(NO_REBUILD),)
697 DOCTESTDEP_$(1)_$(2)_$(3)_$(4) = \
698         $$(TEST_SREQ$(1)_T_$(2)_H_$(3))                         \
699         $$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4))              \
700         $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3))
701 else
702 DOCTESTDEP_$(1)_$(2)_$(3)_$(4) = $$(RSINPUTS_$(4))
703 endif
704
705 check-stage$(1)-T-$(2)-H-$(3)-doc-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4))
706
707 ifeq ($(2),$$(CFG_BUILD))
708 $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)): $$(DOCTESTDEP_$(1)_$(2)_$(3)_$(4))
709         @$$(call E, run doc-$(4) [$(2)])
710         $$(Q)$$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) --test \
711             $$(CRATEFILE_$(4)) --test-args "$$(TESTARGS)" && touch $$@
712 else
713 $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)):
714         touch $$@
715 endif
716
717 endef
718
719 $(foreach host,$(CFG_HOST), \
720  $(foreach target,$(CFG_TARGET), \
721   $(foreach stage,$(STAGES), \
722    $(foreach crate,$(TEST_DOC_CRATES), \
723     $(eval $(call DEF_CRATE_DOC_TEST,$(stage),$(target),$(host),$(crate)))))))
724
725 ######################################################################
726 # Extracting tests for docs
727 ######################################################################
728
729 EXTRACT_TESTS := "$(CFG_PYTHON)" $(S)src/etc/extract-tests.py
730
731 define DEF_DOC_TEST_HOST
732
733 doc-$(2)-extract$(1):
734         @$$(call E, extract: $(2) tests)
735         $$(Q)rm -f $(1)/test/doc-$(2)/*.rs
736         $$(Q)$$(EXTRACT_TESTS) $$(D)/$(2).md $(1)/test/doc-$(2)
737
738 endef
739
740 $(foreach host,$(CFG_HOST), \
741  $(foreach docname,$(DOC_TEST_NAMES), \
742   $(eval $(call DEF_DOC_TEST_HOST,$(host),$(docname)))))
743
744
745 ######################################################################
746 # Shortcut rules
747 ######################################################################
748
749 TEST_GROUPS = \
750         crates \
751         $(foreach crate,$(TEST_CRATES),$(crate)) \
752         $(foreach crate,$(TEST_DOC_CRATES),doc-$(crate)) \
753         rpass \
754         rpass-full \
755         rfail \
756         cfail \
757         bench \
758         perf \
759         rmake \
760         debuginfo \
761         codegen \
762         doc \
763         $(foreach docname,$(DOC_TEST_NAMES),doc-$(docname)) \
764         pretty \
765         pretty-rpass \
766         pretty-rpass-full \
767         pretty-rfail \
768         pretty-bench \
769         pretty-pretty \
770         $(NULL)
771
772 define DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST
773 check-stage$(1)-T-$(2)-H-$(3): check-stage$(1)-T-$(2)-H-$(3)-exec
774 endef
775
776 $(foreach stage,$(STAGES), \
777  $(foreach target,$(CFG_TARGET), \
778   $(foreach host,$(CFG_HOST), \
779    $(eval $(call DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST,$(stage),$(target),$(host))))))
780
781 define DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST_AND_GROUP
782 check-stage$(1)-T-$(2)-H-$(3)-$(4): check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec
783 endef
784
785 $(foreach stage,$(STAGES), \
786  $(foreach target,$(CFG_TARGET), \
787   $(foreach host,$(CFG_HOST), \
788    $(foreach group,$(TEST_GROUPS), \
789     $(eval $(call DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST_AND_GROUP,$(stage),$(target),$(host),$(group)))))))
790
791 define DEF_CHECK_FOR_STAGE
792 check-stage$(1): check-stage$(1)-H-$$(CFG_BUILD)
793 check-stage$(1)-H-all: $$(foreach target,$$(CFG_TARGET), \
794                            check-stage$(1)-H-$$(target))
795 endef
796
797 $(foreach stage,$(STAGES), \
798  $(eval $(call DEF_CHECK_FOR_STAGE,$(stage))))
799
800 define DEF_CHECK_FOR_STAGE_AND_GROUP
801 check-stage$(1)-$(2): check-stage$(1)-H-$$(CFG_BUILD)-$(2)
802 check-stage$(1)-H-all-$(2): $$(foreach target,$$(CFG_TARGET), \
803                                check-stage$(1)-H-$$(target)-$(2))
804 endef
805
806 $(foreach stage,$(STAGES), \
807  $(foreach group,$(TEST_GROUPS), \
808   $(eval $(call DEF_CHECK_FOR_STAGE_AND_GROUP,$(stage),$(group)))))
809
810
811 define DEF_CHECK_FOR_STAGE_AND_HOSTS
812 check-stage$(1)-H-$(2): $$(foreach target,$$(CFG_TARGET), \
813                            check-stage$(1)-T-$$(target)-H-$(2))
814 endef
815
816 $(foreach stage,$(STAGES), \
817  $(foreach host,$(CFG_HOST), \
818   $(eval $(call DEF_CHECK_FOR_STAGE_AND_HOSTS,$(stage),$(host)))))
819
820 define DEF_CHECK_FOR_STAGE_AND_HOSTS_AND_GROUP
821 check-stage$(1)-H-$(2)-$(3): $$(foreach target,$$(CFG_TARGET), \
822                                 check-stage$(1)-T-$$(target)-H-$(2)-$(3))
823 endef
824
825 $(foreach stage,$(STAGES), \
826  $(foreach host,$(CFG_HOST), \
827   $(foreach group,$(TEST_GROUPS), \
828    $(eval $(call DEF_CHECK_FOR_STAGE_AND_HOSTS_AND_GROUP,$(stage),$(host),$(group))))))
829
830 ######################################################################
831 # check-fast rules
832 ######################################################################
833
834 FT := run_pass_stage2
835 FT_LIB := $(call CFG_LIB_NAME_$(CFG_BUILD),$(FT))
836 FT_DRIVER := $(FT)_driver
837
838 GENERATED += tmp/$(FT).rc tmp/$(FT_DRIVER).rs
839
840 tmp/$(FT).rc tmp/$(FT_DRIVER).rs: \
841                 $(RPASS_TESTS) \
842                 $(S)src/etc/combine-tests.py
843         @$(call E, check: building combined stage2 test runner)
844         $(Q)$(CFG_PYTHON) $(S)src/etc/combine-tests.py
845
846 define DEF_CHECK_FAST_FOR_T_H
847 # $(1) unused
848 # $(2) target triple
849 # $(3) host triple
850
851 $$(TLIB2_T_$(2)_H_$(3))/$$(FT_LIB): \
852                 tmp/$$(FT).rc \
853                 $$(SREQ2_T_$(2)_H_$(3))
854         @$$(call E, oxidize: $$@)
855         $$(STAGE2_T_$(2)_H_$(3)) --crate-type=dylib --out-dir $$(@D) $$< \
856           -L "$$(RT_OUTPUT_DIR_$(2))"
857
858 $(3)/test/$$(FT_DRIVER)-$(2)$$(X_$(2)): \
859                 tmp/$$(FT_DRIVER).rs \
860                 $$(TLIB2_T_$(2)_H_$(3))/$$(FT_LIB) \
861                 $$(SREQ2_T_$(2)_H_$(3))
862         @$$(call E, oxidize: $$@ $$<)
863         $$(STAGE2_T_$(2)_H_$(3)) -o $$@ $$< \
864           -L "$$(RT_OUTPUT_DIR_$(2))"
865
866 $(3)/test/$$(FT_DRIVER)-$(2).out: \
867                 $(3)/test/$$(FT_DRIVER)-$(2)$$(X_$(2)) \
868                 $$(SREQ2_T_$(2)_H_$(3))
869         $$(Q)$$(call CFG_RUN_TEST_$(2),$$<,$(2),$(3)) \
870         --logfile tmp/$$(FT_DRIVER)-$(2).log
871
872 check-fast-T-$(2)-H-$(3):                       \
873         $(3)/test/$$(FT_DRIVER)-$(2).out
874
875 endef
876
877 $(foreach host,$(CFG_HOST), \
878  $(eval $(foreach target,$(CFG_TARGET), \
879    $(eval $(call DEF_CHECK_FAST_FOR_T_H,,$(target),$(host))))))
880
881 check-fast: tidy check-fast-H-$(CFG_BUILD) \
882             $(foreach crate,$(TARGET_CRATES),check-stage2-$(crate))
883         $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
884
885 define DEF_CHECK_FAST_FOR_H
886
887 check-fast-H-$(1):              check-fast-T-$(1)-H-$(1)
888
889 endef
890
891 $(foreach host,$(CFG_HOST),                     \
892  $(eval $(call DEF_CHECK_FAST_FOR_H,$(host))))
893
894 RMAKE_TESTS := $(shell ls -d $(S)src/test/run-make/*/)
895 RMAKE_TESTS := $(RMAKE_TESTS:$(S)src/test/run-make/%/=%)
896
897 define DEF_RMAKE_FOR_T_H
898 # $(1) the stage
899 # $(2) target triple
900 # $(3) host triple
901
902
903 ifeq ($(2)$(3),$$(CFG_BUILD)$$(CFG_BUILD))
904 check-stage$(1)-T-$(2)-H-$(3)-rmake-exec: \
905                 $$(call TEST_OK_FILE,$(1),$(2),$(3),rmake)
906
907 $$(call TEST_OK_FILE,$(1),$(2),$(3),rmake): \
908                 $$(RMAKE_TESTS:%=$(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok)
909         @touch $$@
910
911 $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
912                 $(S)src/test/run-make/%/Makefile \
913                 $$(CSREQ$(1)_T_$(2)_H_$(3))
914         @rm -rf $(3)/test/run-make/$$*
915         @mkdir -p $(3)/test/run-make/$$*
916         $$(Q)$$(CFG_PYTHON) $(S)src/etc/maketest.py $$(dir $$<) \
917             $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
918             $(3)/test/run-make/$$* \
919             "$$(CC_$(3)) $$(CFG_GCCISH_CFLAGS_$(3))" \
920             $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
921             "$$(TESTNAME)"
922         @touch $$@
923 else
924 # FIXME #11094 - The above rule doesn't work right for multiple targets
925 check-stage$(1)-T-$(2)-H-$(3)-rmake-exec:
926         @true
927
928 endif
929
930
931 endef
932
933 $(foreach stage,$(STAGES), \
934  $(foreach target,$(CFG_TARGET), \
935   $(foreach host,$(CFG_HOST), \
936    $(eval $(call DEF_RMAKE_FOR_T_H,$(stage),$(target),$(host))))))