]> git.lizzy.rs Git - rust.git/blob - mk/tests.mk
auto merge of #13832 : alexcrichton/rust/cfail-full, r=brson
[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/hoedown/src/*.c) \
224                        $(wildcard $(S)src/rt/hoedown/bin/*.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/hoedown/src/*.h) \
236                        $(wildcard $(S)src/rt/hoedown/bin/*.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/rt/hoedown' -v \
270                 | grep '^$(S)src/gyp' -v \
271                 | grep '^$(S)src/etc' -v \
272                 | grep '^$(S)src/doc' -v \
273                 | grep '^$(S)src/compiler-rt' -v \
274                 | grep '^$(S)src/libbacktrace' -v \
275                 | xargs $(CFG_PYTHON) $(S)src/etc/check-binaries.py
276
277 endif
278
279
280 ######################################################################
281 # Sets of tests
282 ######################################################################
283
284 define DEF_TEST_SETS
285
286 check-stage$(1)-T-$(2)-H-$(3)-exec:                                     \
287         check-stage$(1)-T-$(2)-H-$(3)-rpass-exec                        \
288         check-stage$(1)-T-$(2)-H-$(3)-rfail-exec                        \
289         check-stage$(1)-T-$(2)-H-$(3)-cfail-exec                        \
290         check-stage$(1)-T-$(2)-H-$(3)-rpass-full-exec                   \
291         check-stage$(1)-T-$(2)-H-$(3)-cfail-full-exec                   \
292         check-stage$(1)-T-$(2)-H-$(3)-rmake-exec                        \
293         check-stage$(1)-T-$(2)-H-$(3)-crates-exec                       \
294         check-stage$(1)-T-$(2)-H-$(3)-doc-crates-exec                   \
295         check-stage$(1)-T-$(2)-H-$(3)-bench-exec                        \
296         check-stage$(1)-T-$(2)-H-$(3)-debuginfo-exec \
297         check-stage$(1)-T-$(2)-H-$(3)-codegen-exec \
298         check-stage$(1)-T-$(2)-H-$(3)-doc-exec \
299         check-stage$(1)-T-$(2)-H-$(3)-pretty-exec
300
301 # Only test the compiler-dependent crates when the target is
302 # able to build a compiler (when the target triple is in the set of host triples)
303 ifneq ($$(findstring $(2),$$(CFG_HOST)),)
304
305 check-stage$(1)-T-$(2)-H-$(3)-crates-exec: \
306         $$(foreach crate,$$(TEST_CRATES), \
307            check-stage$(1)-T-$(2)-H-$(3)-$$(crate)-exec)
308
309 else
310
311 check-stage$(1)-T-$(2)-H-$(3)-crates-exec: \
312         $$(foreach crate,$$(TEST_TARGET_CRATES), \
313            check-stage$(1)-T-$(2)-H-$(3)-$$(crate)-exec)
314
315 endif
316
317 check-stage$(1)-T-$(2)-H-$(3)-doc-crates-exec: \
318         $$(foreach crate,$$(TEST_DOC_CRATES), \
319            check-stage$(1)-T-$(2)-H-$(3)-doc-crate-$$(crate)-exec)
320
321 check-stage$(1)-T-$(2)-H-$(3)-doc-exec: \
322         $$(foreach docname,$$(DOCS), \
323            check-stage$(1)-T-$(2)-H-$(3)-doc-$$(docname)-exec)
324
325 check-stage$(1)-T-$(2)-H-$(3)-pretty-exec: \
326         check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-exec \
327         check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-full-exec    \
328         check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail-exec \
329         check-stage$(1)-T-$(2)-H-$(3)-pretty-bench-exec \
330         check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty-exec
331
332 endef
333
334 $(foreach host,$(CFG_HOST), \
335  $(foreach target,$(CFG_TARGET), \
336   $(foreach stage,$(STAGES), \
337     $(eval $(call DEF_TEST_SETS,$(stage),$(target),$(host))))))
338
339
340 ######################################################################
341 # Crate testing
342 ######################################################################
343
344 define TEST_RUNNER
345
346 # If NO_REBUILD is set then break the dependencies on everything but
347 # the source files so we can test crates without rebuilding any of the
348 # parent crates.
349 ifeq ($(NO_REBUILD),)
350 TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(SREQ$(1)_T_$(2)_H_$(3)) \
351                             $$(foreach crate,$$(TARGET_CRATES),\
352                                 $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)) \
353                                 $$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4))
354
355 # The regex crate depends on the regex_macros crate during testing, but it
356 # notably depend on the *host* regex_macros crate, not the target version.
357 # Additionally, this is not a dependency in stage1, only in stage2.
358 ifeq ($(4),regex)
359 ifneq ($(1),1)
360 TESTDEP_$(1)_$(2)_$(3)_$(4) += $$(TLIB$(1)_T_$(3)_H_$(3))/stamp.regex_macros
361 endif
362 endif
363
364 else
365 TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(RSINPUTS_$(4))
366 endif
367
368 $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)): CFG_COMPILER_HOST_TRIPLE = $(2)
369 $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)):                            \
370                 $$(CRATEFILE_$(4)) \
371                 $$(TESTDEP_$(1)_$(2)_$(3)_$(4))
372         @$$(call E, oxidize: $$@)
373         $$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test   \
374                 -L "$$(RT_OUTPUT_DIR_$(2))"             \
375                 -L "$$(LLVM_LIBDIR_$(2))"
376
377 endef
378
379 $(foreach host,$(CFG_HOST), \
380  $(eval $(foreach target,$(CFG_TARGET), \
381   $(eval $(foreach stage,$(STAGES), \
382    $(eval $(foreach crate,$(TEST_CRATES), \
383     $(eval $(call TEST_RUNNER,$(stage),$(target),$(host),$(crate))))))))))
384
385 define DEF_TEST_CRATE_RULES
386 check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
387
388 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
389                 $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
390         @$$(call E, run: $$<)
391         $$(Q)$$(call CFG_RUN_TEST_$(2),$$<,$(2),$(3)) $$(TESTARGS) \
392             --logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
393             $$(call CRATE_TEST_EXTRA_ARGS,$(1),$(2),$(3),$(4)) \
394             && touch $$@
395 endef
396
397 define DEF_TEST_CRATE_RULES_arm-linux-androideabi
398 check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
399
400 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
401                 $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
402         @$$(call E, run: $$< via adb)
403         $$(Q)$(CFG_ADB) push $$< $(CFG_ADB_TEST_DIR)
404         $$(Q)$(CFG_ADB) shell '(cd $(CFG_ADB_TEST_DIR); LD_LIBRARY_PATH=. \
405                 ./$$(notdir $$<) \
406                 --logfile $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log \
407                 $$(call CRATE_TEST_EXTRA_ARGS,$(1),$(2),$(3),$(4)) $(TESTARGS))' \
408                 > tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp
409         $$(Q)cat tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp
410         $$(Q)touch tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
411         $$(Q)$(CFG_ADB) pull $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log tmp/
412         $$(Q)$(CFG_ADB) shell rm $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
413         $$(Q)$(CFG_ADB) pull $(CFG_ADB_TEST_DIR)/$$(call TEST_RATCHET_FILE,$(1),$(2),$(3),$(4)) tmp/
414         @if grep -q "result: ok" tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
415         then \
416                 rm tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
417                 touch $$@; \
418         else \
419                 rm tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
420                 exit 101; \
421         fi
422 endef
423
424 define DEF_TEST_CRATE_RULES_null
425 check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
426
427 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
428                 $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
429         @$$(call E, failing: no device for $$< )
430         false
431 endef
432
433 $(foreach host,$(CFG_HOST), \
434  $(foreach target,$(CFG_TARGET), \
435   $(foreach stage,$(STAGES), \
436    $(foreach crate, $(TEST_CRATES), \
437     $(if $(findstring $(target),$(CFG_BUILD)), \
438      $(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))), \
439      $(if $(findstring $(target),"arm-linux-androideabi"), \
440       $(if $(findstring $(CFG_ADB_DEVICE_STATUS),"true"), \
441        $(eval $(call DEF_TEST_CRATE_RULES_arm-linux-androideabi,$(stage),$(target),$(host),$(crate))), \
442        $(eval $(call DEF_TEST_CRATE_RULES_null,$(stage),$(target),$(host),$(crate))) \
443       ), \
444       $(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))) \
445      ))))))
446
447 ######################################################################
448 # Rules for the compiletest tests (rpass, rfail, etc.)
449 ######################################################################
450
451 RPASS_RC := $(wildcard $(S)src/test/run-pass/*.rc)
452 RPASS_RS := $(wildcard $(S)src/test/run-pass/*.rs)
453 RPASS_FULL_RC := $(wildcard $(S)src/test/run-pass-fulldeps/*.rc)
454 RPASS_FULL_RS := $(wildcard $(S)src/test/run-pass-fulldeps/*.rs)
455 CFAIL_FULL_RC := $(wildcard $(S)src/test/compile-fail-fulldeps/*.rc)
456 CFAIL_FULL_RS := $(wildcard $(S)src/test/compile-fail-fulldeps/*.rs)
457 RFAIL_RC := $(wildcard $(S)src/test/run-fail/*.rc)
458 RFAIL_RS := $(wildcard $(S)src/test/run-fail/*.rs)
459 CFAIL_RC := $(wildcard $(S)src/test/compile-fail/*.rc)
460 CFAIL_RS := $(wildcard $(S)src/test/compile-fail/*.rs)
461 BENCH_RS := $(wildcard $(S)src/test/bench/*.rs)
462 PRETTY_RS := $(wildcard $(S)src/test/pretty/*.rs)
463 DEBUGINFO_RS := $(wildcard $(S)src/test/debug-info/*.rs)
464 CODEGEN_RS := $(wildcard $(S)src/test/codegen/*.rs)
465 CODEGEN_CC := $(wildcard $(S)src/test/codegen/*.cc)
466
467 # perf tests are the same as bench tests only they run under
468 # a performance monitor.
469 PERF_RS := $(wildcard $(S)src/test/bench/*.rs)
470
471 RPASS_TESTS := $(RPASS_RC) $(RPASS_RS)
472 RPASS_FULL_TESTS := $(RPASS_FULL_RC) $(RPASS_FULL_RS)
473 CFAIL_FULL_TESTS := $(CFAIL_FULL_RC) $(CFAIL_FULL_RS)
474 RFAIL_TESTS := $(RFAIL_RC) $(RFAIL_RS)
475 CFAIL_TESTS := $(CFAIL_RC) $(CFAIL_RS)
476 BENCH_TESTS := $(BENCH_RS)
477 PERF_TESTS := $(PERF_RS)
478 PRETTY_TESTS := $(PRETTY_RS)
479 DEBUGINFO_TESTS := $(DEBUGINFO_RS)
480 CODEGEN_TESTS := $(CODEGEN_RS) $(CODEGEN_CC)
481
482 CTEST_SRC_BASE_rpass = run-pass
483 CTEST_BUILD_BASE_rpass = run-pass
484 CTEST_MODE_rpass = run-pass
485 CTEST_RUNTOOL_rpass = $(CTEST_RUNTOOL)
486
487 CTEST_SRC_BASE_rpass-full = run-pass-fulldeps
488 CTEST_BUILD_BASE_rpass-full = run-pass-fulldeps
489 CTEST_MODE_rpass-full = run-pass
490 CTEST_RUNTOOL_rpass-full = $(CTEST_RUNTOOL)
491
492 CTEST_SRC_BASE_cfail-full = compile-fail-fulldeps
493 CTEST_BUILD_BASE_cfail-full = compile-fail-fulldeps
494 CTEST_MODE_cfail-full = compile-fail
495 CTEST_RUNTOOL_cfail-full = $(CTEST_RUNTOOL)
496
497 CTEST_SRC_BASE_rfail = run-fail
498 CTEST_BUILD_BASE_rfail = run-fail
499 CTEST_MODE_rfail = run-fail
500 CTEST_RUNTOOL_rfail = $(CTEST_RUNTOOL)
501
502 CTEST_SRC_BASE_cfail = compile-fail
503 CTEST_BUILD_BASE_cfail = compile-fail
504 CTEST_MODE_cfail = compile-fail
505 CTEST_RUNTOOL_cfail = $(CTEST_RUNTOOL)
506
507 CTEST_SRC_BASE_bench = bench
508 CTEST_BUILD_BASE_bench = bench
509 CTEST_MODE_bench = run-pass
510 CTEST_RUNTOOL_bench = $(CTEST_RUNTOOL)
511
512 CTEST_SRC_BASE_perf = bench
513 CTEST_BUILD_BASE_perf = perf
514 CTEST_MODE_perf = run-pass
515 CTEST_RUNTOOL_perf = $(CTEST_PERF_RUNTOOL)
516
517 CTEST_SRC_BASE_debuginfo = debug-info
518 CTEST_BUILD_BASE_debuginfo = debug-info
519 CTEST_MODE_debuginfo = debug-info
520 CTEST_RUNTOOL_debuginfo = $(CTEST_RUNTOOL)
521
522 CTEST_SRC_BASE_codegen = codegen
523 CTEST_BUILD_BASE_codegen = codegen
524 CTEST_MODE_codegen = codegen
525 CTEST_RUNTOOL_codegen = $(CTEST_RUNTOOL)
526
527 # CTEST_DISABLE_$(TEST_GROUP), if set, will cause the test group to be
528 # disabled and the associated message to be printed as a warning
529 # during attempts to run those tests.
530
531 ifeq ($(CFG_GDB),)
532 CTEST_DISABLE_debuginfo = "no gdb found"
533 endif
534
535 ifeq ($(CFG_CLANG),)
536 CTEST_DISABLE_codegen = "no clang found"
537 endif
538
539 ifeq ($(CFG_OSTYPE),apple-darwin)
540 CTEST_DISABLE_debuginfo = "gdb on darwing needs root"
541 endif
542
543 # CTEST_DISABLE_NONSELFHOST_$(TEST_GROUP), if set, will cause that
544 # test group to be disabled *unless* the target is able to build a
545 # compiler (i.e. when the target triple is in the set of of host
546 # triples).  The associated message will be printed as a warning
547 # during attempts to run those tests.
548
549 define DEF_CTEST_VARS
550
551 # All the per-stage build rules you might want to call from the
552 # command line.
553 #
554 # $(1) is the stage number
555 # $(2) is the target triple to test
556 # $(3) is the host triple to test
557
558 # Prerequisites for compiletest tests
559 TEST_SREQ$(1)_T_$(2)_H_$(3) = \
560         $$(HBIN$(1)_H_$(3))/compiletest$$(X_$(3)) \
561         $$(SREQ$(1)_T_$(2)_H_$(3))
562
563 # Rules for the cfail/rfail/rpass/bench/perf test runner
564
565 # The tests select when to use debug configuration on their own;
566 # remove directive, if present, from CFG_RUSTC_FLAGS (issue #7898).
567 CTEST_RUSTC_FLAGS := $$(subst --cfg ndebug,,$$(CFG_RUSTC_FLAGS))
568
569 # The tests can not be optimized while the rest of the compiler is optimized, so
570 # filter out the optimization (if any) from rustc and then figure out if we need
571 # to be optimized
572 CTEST_RUSTC_FLAGS := $$(subst -O,,$$(CTEST_RUSTC_FLAGS))
573 ifndef CFG_DISABLE_OPTIMIZE_TESTS
574 CTEST_RUSTC_FLAGS += -O
575 endif
576
577 CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) :=                                          \
578                 --compile-lib-path $$(HLIB$(1)_H_$(3))                          \
579         --run-lib-path $$(TLIB$(1)_T_$(2)_H_$(3))                       \
580         --rustc-path $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3))                        \
581         --clang-path $(if $(CFG_CLANG),$(CFG_CLANG),clang) \
582         --llvm-bin-path $(CFG_LLVM_INST_DIR_$(CFG_BUILD))/bin \
583         --aux-base $$(S)src/test/auxiliary/                 \
584         --stage-id stage$(1)-$(2)                                                       \
585         --target $(2)                                       \
586         --host $(3)                                       \
587         --adb-path=$(CFG_ADB)                          \
588         --adb-test-dir=$(CFG_ADB_TEST_DIR)                  \
589         --host-rustcflags "$(RUSTC_FLAGS_$(3)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(3))" \
590         --target-rustcflags "$(RUSTC_FLAGS_$(2)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(2))" \
591         $$(CTEST_TESTARGS)
592
593 CTEST_DEPS_rpass_$(1)-T-$(2)-H-$(3) = $$(RPASS_TESTS)
594 CTEST_DEPS_rpass-full_$(1)-T-$(2)-H-$(3) = $$(RPASS_FULL_TESTS) $$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3))
595 CTEST_DEPS_cfail-full_$(1)-T-$(2)-H-$(3) = $$(CFAIL_FULL_TESTS) $$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3))
596 CTEST_DEPS_rfail_$(1)-T-$(2)-H-$(3) = $$(RFAIL_TESTS)
597 CTEST_DEPS_cfail_$(1)-T-$(2)-H-$(3) = $$(CFAIL_TESTS)
598 CTEST_DEPS_bench_$(1)-T-$(2)-H-$(3) = $$(BENCH_TESTS)
599 CTEST_DEPS_perf_$(1)-T-$(2)-H-$(3) = $$(PERF_TESTS)
600 CTEST_DEPS_debuginfo_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_TESTS)
601 CTEST_DEPS_codegen_$(1)-T-$(2)-H-$(3) = $$(CODEGEN_TESTS)
602
603 endef
604
605 $(foreach host,$(CFG_HOST), \
606  $(eval $(foreach target,$(CFG_TARGET), \
607   $(eval $(foreach stage,$(STAGES), \
608    $(eval $(call DEF_CTEST_VARS,$(stage),$(target),$(host))))))))
609
610 define DEF_RUN_COMPILETEST
611
612 CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4) := \
613         $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
614         --src-base $$(S)src/test/$$(CTEST_SRC_BASE_$(4))/ \
615         --build-base $(3)/test/$$(CTEST_BUILD_BASE_$(4))/ \
616         --ratchet-metrics $(call TEST_RATCHET_FILE,$(1),$(2),$(3),$(4)) \
617         --mode $$(CTEST_MODE_$(4)) \
618         $$(CTEST_RUNTOOL_$(4))
619
620 check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
621
622 # CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4)
623 # Goal: leave this variable as empty string if we should run the test.
624 # Otherwise, set it to the reason we are not running the test.
625 # (Encoded as a separate variable because GNU make does not have a
626 # good way to express OR on ifeq commands)
627
628 ifneq ($$(CTEST_DISABLE_$(4)),)
629 # Test suite is disabled for all configured targets.
630 CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4) := $$(CTEST_DISABLE_$(4))
631 else
632 # else, check if non-self-hosted target (i.e. target not-in hosts) ...
633 ifeq ($$(findstring $(2),$$(CFG_HOST)),)
634 # ... if so, then check if this test suite is disabled for non-selfhosts.
635 ifneq ($$(CTEST_DISABLE_NONSELFHOST_$(4)),)
636 # Test suite is disabled for this target.
637 CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4) := $$(CTEST_DISABLE_NONSELFHOST_$(4))
638 endif
639 endif
640 # Neither DISABLE nor DISABLE_NONSELFHOST is set ==> okay, run the test.
641 endif
642
643 ifeq ($$(CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4)),)
644 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
645                 $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
646                 $$(CTEST_DEPS_$(4)_$(1)-T-$(2)-H-$(3))
647         @$$(call E, run $(4) [$(2)]: $$<)
648         $$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
649                 $$(CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
650                 --logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
651                 && touch $$@
652
653 else
654
655 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)):
656         @$$(call E, run $(4) [$(2)]: $$<)
657         @$$(call E, warning: tests disabled: $$(CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4)))
658         touch $$@
659
660 endif
661
662 endef
663
664 CTEST_NAMES = rpass rpass-full cfail-full rfail cfail bench perf debuginfo codegen
665
666 $(foreach host,$(CFG_HOST), \
667  $(eval $(foreach target,$(CFG_TARGET), \
668   $(eval $(foreach stage,$(STAGES), \
669    $(eval $(foreach name,$(CTEST_NAMES), \
670    $(eval $(call DEF_RUN_COMPILETEST,$(stage),$(target),$(host),$(name))))))))))
671
672 PRETTY_NAMES = pretty-rpass pretty-rpass-full pretty-rfail pretty-bench pretty-pretty
673 PRETTY_DEPS_pretty-rpass = $(RPASS_TESTS)
674 PRETTY_DEPS_pretty-rpass-full = $(RPASS_FULL_TESTS)
675 PRETTY_DEPS_pretty-rfail = $(RFAIL_TESTS)
676 PRETTY_DEPS_pretty-bench = $(BENCH_TESTS)
677 PRETTY_DEPS_pretty-pretty = $(PRETTY_TESTS)
678 PRETTY_DIRNAME_pretty-rpass = run-pass
679 PRETTY_DIRNAME_pretty-rpass-full = run-pass-fulldeps
680 PRETTY_DIRNAME_pretty-rfail = run-fail
681 PRETTY_DIRNAME_pretty-bench = bench
682 PRETTY_DIRNAME_pretty-pretty = pretty
683
684 define DEF_RUN_PRETTY_TEST
685
686 PRETTY_ARGS$(1)-T-$(2)-H-$(3)-$(4) :=                   \
687                 $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
688         --src-base $$(S)src/test/$$(PRETTY_DIRNAME_$(4))/ \
689         --build-base $(3)/test/$$(PRETTY_DIRNAME_$(4))/ \
690         --mode pretty
691
692 check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
693
694 $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
695                 $$(TEST_SREQ$(1)_T_$(2)_H_$(3))         \
696                 $$(PRETTY_DEPS_$(4))
697         @$$(call E, run pretty-rpass [$(2)]: $$<)
698         $$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
699                 $$(PRETTY_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
700                 --logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
701                 && touch $$@
702
703 endef
704
705 $(foreach host,$(CFG_HOST), \
706  $(foreach target,$(CFG_TARGET), \
707   $(foreach stage,$(STAGES), \
708    $(foreach pretty-name,$(PRETTY_NAMES), \
709     $(eval $(call DEF_RUN_PRETTY_TEST,$(stage),$(target),$(host),$(pretty-name)))))))
710
711
712 ######################################################################
713 # Crate & freestanding documentation tests
714 ######################################################################
715
716 define DEF_RUSTDOC
717 RUSTDOC_EXE_$(1)_T_$(2)_H_$(3) := $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3))
718 RUSTDOC_$(1)_T_$(2)_H_$(3) := $$(RPATH_VAR$(1)_T_$(2)_H_$(3)) $$(RUSTDOC_EXE_$(1)_T_$(2)_H_$(3))
719 endef
720
721 $(foreach host,$(CFG_HOST), \
722  $(foreach target,$(CFG_TARGET), \
723   $(foreach stage,$(STAGES), \
724    $(eval $(call DEF_RUSTDOC,$(stage),$(target),$(host))))))
725
726 # Freestanding
727
728 define DEF_DOC_TEST
729
730 check-stage$(1)-T-$(2)-H-$(3)-doc-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4))
731
732 # If NO_REBUILD is set then break the dependencies on everything but
733 # the source files so we can test documentation without rebuilding
734 # rustdoc etc.
735 ifeq ($(NO_REBUILD),)
736 DOCTESTDEP_$(1)_$(2)_$(3)_$(4) = \
737         $$(D)/$(4).md \
738         $$(TEST_SREQ$(1)_T_$(2)_H_$(3))                         \
739         $$(RUSTDOC_EXE_$(1)_T_$(2)_H_$(3))
740 else
741 DOCTESTDEP_$(1)_$(2)_$(3)_$(4) = $$(D)/$(4).md
742 endif
743
744 ifeq ($(2),$$(CFG_BUILD))
745 $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)): $$(DOCTESTDEP_$(1)_$(2)_$(3)_$(4))
746         @$$(call E, run doc-$(4) [$(2)])
747         $$(Q)$$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --cfg dox --test $$< --test-args "$$(TESTARGS)" && touch $$@
748 else
749 $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)):
750         touch $$@
751 endif
752 endef
753
754 $(foreach host,$(CFG_HOST), \
755  $(foreach target,$(CFG_TARGET), \
756   $(foreach stage,$(STAGES), \
757    $(foreach docname,$(DOCS), \
758     $(eval $(call DEF_DOC_TEST,$(stage),$(target),$(host),$(docname)))))))
759
760 # Crates
761
762 define DEF_CRATE_DOC_TEST
763
764 # If NO_REBUILD is set then break the dependencies on everything but
765 # the source files so we can test crate documentation without
766 # rebuilding any of the parent crates.
767 ifeq ($(NO_REBUILD),)
768 CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4) = \
769         $$(TEST_SREQ$(1)_T_$(2)_H_$(3))                         \
770         $$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4))              \
771         $$(RUSTDOC_EXE_$(1)_T_$(2)_H_$(3))
772 else
773 CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4) = $$(RSINPUTS_$(4))
774 endif
775
776 check-stage$(1)-T-$(2)-H-$(3)-doc-crate-$(4)-exec: \
777         $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4))
778
779 ifeq ($(2),$$(CFG_BUILD))
780 $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4)): $$(CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4))
781         @$$(call E, run doc-crate-$(4) [$(2)])
782         $$(Q)$$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --test \
783                 $$(CRATEFILE_$(4)) --test-args "$$(TESTARGS)" && touch $$@
784 else
785 $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4)):
786         touch $$@
787 endif
788
789 endef
790
791 $(foreach host,$(CFG_HOST), \
792  $(foreach target,$(CFG_TARGET), \
793   $(foreach stage,$(STAGES), \
794    $(foreach crate,$(TEST_DOC_CRATES), \
795     $(eval $(call DEF_CRATE_DOC_TEST,$(stage),$(target),$(host),$(crate)))))))
796
797 ######################################################################
798 # Shortcut rules
799 ######################################################################
800
801 TEST_GROUPS = \
802         crates \
803         $(foreach crate,$(TEST_CRATES),$(crate)) \
804         $(foreach crate,$(TEST_DOC_CRATES),doc-crate-$(crate)) \
805         rpass \
806         rpass-full \
807         cfail-full \
808         rfail \
809         cfail \
810         bench \
811         perf \
812         rmake \
813         debuginfo \
814         codegen \
815         doc \
816         $(foreach docname,$(DOCS),doc-$(docname)) \
817         pretty \
818         pretty-rpass \
819         pretty-rpass-full \
820         pretty-rfail \
821         pretty-bench \
822         pretty-pretty \
823         $(NULL)
824
825 define DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST
826 check-stage$(1)-T-$(2)-H-$(3): check-stage$(1)-T-$(2)-H-$(3)-exec
827 endef
828
829 $(foreach stage,$(STAGES), \
830  $(foreach target,$(CFG_TARGET), \
831   $(foreach host,$(CFG_HOST), \
832    $(eval $(call DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST,$(stage),$(target),$(host))))))
833
834 define DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST_AND_GROUP
835 check-stage$(1)-T-$(2)-H-$(3)-$(4): check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec
836 endef
837
838 $(foreach stage,$(STAGES), \
839  $(foreach target,$(CFG_TARGET), \
840   $(foreach host,$(CFG_HOST), \
841    $(foreach group,$(TEST_GROUPS), \
842     $(eval $(call DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST_AND_GROUP,$(stage),$(target),$(host),$(group)))))))
843
844 define DEF_CHECK_FOR_STAGE
845 check-stage$(1): check-stage$(1)-H-$$(CFG_BUILD)
846 check-stage$(1)-H-all: $$(foreach target,$$(CFG_TARGET), \
847                            check-stage$(1)-H-$$(target))
848 endef
849
850 $(foreach stage,$(STAGES), \
851  $(eval $(call DEF_CHECK_FOR_STAGE,$(stage))))
852
853 define DEF_CHECK_FOR_STAGE_AND_GROUP
854 check-stage$(1)-$(2): check-stage$(1)-H-$$(CFG_BUILD)-$(2)
855 check-stage$(1)-H-all-$(2): $$(foreach target,$$(CFG_TARGET), \
856                                check-stage$(1)-H-$$(target)-$(2))
857 endef
858
859 $(foreach stage,$(STAGES), \
860  $(foreach group,$(TEST_GROUPS), \
861   $(eval $(call DEF_CHECK_FOR_STAGE_AND_GROUP,$(stage),$(group)))))
862
863
864 define DEF_CHECK_FOR_STAGE_AND_HOSTS
865 check-stage$(1)-H-$(2): $$(foreach target,$$(CFG_TARGET), \
866                            check-stage$(1)-T-$$(target)-H-$(2))
867 endef
868
869 $(foreach stage,$(STAGES), \
870  $(foreach host,$(CFG_HOST), \
871   $(eval $(call DEF_CHECK_FOR_STAGE_AND_HOSTS,$(stage),$(host)))))
872
873 define DEF_CHECK_FOR_STAGE_AND_HOSTS_AND_GROUP
874 check-stage$(1)-H-$(2)-$(3): $$(foreach target,$$(CFG_TARGET), \
875                                 check-stage$(1)-T-$$(target)-H-$(2)-$(3))
876 endef
877
878 $(foreach stage,$(STAGES), \
879  $(foreach host,$(CFG_HOST), \
880   $(foreach group,$(TEST_GROUPS), \
881    $(eval $(call DEF_CHECK_FOR_STAGE_AND_HOSTS_AND_GROUP,$(stage),$(host),$(group))))))
882
883 define DEF_CHECK_DOC_FOR_STAGE
884 check-stage$(1)-docs: $$(foreach docname,$$(DOCS),\
885                        check-stage$(1)-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-doc-$$(docname)) \
886                      $$(foreach crate,$$(TEST_DOC_CRATES),\
887                        check-stage$(1)-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-doc-crate-$$(crate))
888 endef
889
890 $(foreach stage,$(STAGES), \
891  $(eval $(call DEF_CHECK_DOC_FOR_STAGE,$(stage))))
892
893 define DEF_CHECK_CRATE
894 check-$(1): check-stage2-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-$(1)-exec
895 endef
896
897 $(foreach crate,$(TEST_CRATES), \
898  $(eval $(call DEF_CHECK_CRATE,$(crate))))
899
900 ######################################################################
901 # RMAKE rules
902 ######################################################################
903
904 RMAKE_TESTS := $(shell ls -d $(S)src/test/run-make/*/)
905 RMAKE_TESTS := $(RMAKE_TESTS:$(S)src/test/run-make/%/=%)
906
907 define DEF_RMAKE_FOR_T_H
908 # $(1) the stage
909 # $(2) target triple
910 # $(3) host triple
911
912
913 ifeq ($(2)$(3),$$(CFG_BUILD)$$(CFG_BUILD))
914 check-stage$(1)-T-$(2)-H-$(3)-rmake-exec: \
915                 $$(call TEST_OK_FILE,$(1),$(2),$(3),rmake)
916
917 $$(call TEST_OK_FILE,$(1),$(2),$(3),rmake): \
918                 $$(RMAKE_TESTS:%=$(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok)
919         @touch $$@
920
921 $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
922                 $(S)src/test/run-make/%/Makefile \
923                 $$(CSREQ$(1)_T_$(2)_H_$(3))
924         @rm -rf $(3)/test/run-make/$$*
925         @mkdir -p $(3)/test/run-make/$$*
926         $$(Q)$$(CFG_PYTHON) $(S)src/etc/maketest.py $$(dir $$<) \
927         $$(MAKE) \
928             $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
929             $(3)/test/run-make/$$* \
930             "$$(CC_$(3)) $$(CFG_GCCISH_CFLAGS_$(3))" \
931             $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
932             "$$(TESTNAME)" \
933             "$$(RPATH_VAR$(1)_T_$(2)_H_$(3))"
934         @touch $$@
935 else
936 # FIXME #11094 - The above rule doesn't work right for multiple targets
937 check-stage$(1)-T-$(2)-H-$(3)-rmake-exec:
938         @true
939
940 endif
941
942
943 endef
944
945 $(foreach stage,$(STAGES), \
946  $(foreach target,$(CFG_TARGET), \
947   $(foreach host,$(CFG_HOST), \
948    $(eval $(call DEF_RMAKE_FOR_T_H,$(stage),$(target),$(host))))))