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