tests.mk 31.5 KB
Newer Older
G
Graydon Hoare 已提交
1 2 3 4
######################################################################
# Testing variables
######################################################################

5
RPASS_RC := $(wildcard $(S)src/test/run-pass/*.rc)
B
Brian Anderson 已提交
6
RPASS_RS := $(wildcard $(S)src/test/run-pass/*.rs)
7 8
RPASS_FULL_RC := $(wildcard $(S)src/test/run-pass-fulldeps/*.rc)
RPASS_FULL_RS := $(wildcard $(S)src/test/run-pass-fulldeps/*.rs)
9 10 11 12
RFAIL_RC := $(wildcard $(S)src/test/run-fail/*.rc)
RFAIL_RS := $(wildcard $(S)src/test/run-fail/*.rs)
CFAIL_RC := $(wildcard $(S)src/test/compile-fail/*.rc)
CFAIL_RS := $(wildcard $(S)src/test/compile-fail/*.rs)
13 14
BENCH_RS := $(wildcard $(S)src/test/bench/*.rs)
PRETTY_RS := $(wildcard $(S)src/test/pretty/*.rs)
G
Graydon Hoare 已提交
15

16 17 18 19
# perf tests are the same as bench tests only they run under
# a performance monitor.
PERF_RS := $(wildcard $(S)src/test/bench/*.rs)

B
Brian Anderson 已提交
20
RPASS_TESTS := $(RPASS_RC) $(RPASS_RS)
21
RPASS_FULL_TESTS := $(RPASS_FULL_RC) $(RPASS_FULL_RS)
B
Brian Anderson 已提交
22 23
RFAIL_TESTS := $(RFAIL_RC) $(RFAIL_RS)
CFAIL_TESTS := $(CFAIL_RC) $(CFAIL_RS)
24
BENCH_TESTS := $(BENCH_RS)
25
PERF_TESTS := $(PERF_RS)
26
PRETTY_TESTS := $(PRETTY_RS)
G
Graydon Hoare 已提交
27

28 29 30 31
FT := run_pass_stage2
FT_LIB := $(call CFG_LIB_NAME,$(FT))
FT_DRIVER := $(FT)_driver

B
Brian Anderson 已提交
32 33 34 35 36 37 38 39 40 41 42 43 44
# The arguments to all test runners
ifdef TESTNAME
  TESTARGS += $(TESTNAME)
endif

ifdef CHECK_XFAILS
  TESTARGS += --ignored
endif

# Arguments to the cfail/rfail/rpass/bench tests
ifdef CFG_VALGRIND
  CTEST_RUNTOOL = --runtool "$(CFG_VALGRIND)"
endif
45

46 47 48 49 50
# Arguments to the perf tests
ifdef CFG_PERF_TOOL
  CTEST_PERF_RUNTOOL = --runtool "$(CFG_PERF_TOOL)"
endif

B
Brian Anderson 已提交
51
CTEST_TESTARGS := $(TESTARGS)
G
Graydon Hoare 已提交
52

B
Brian Anderson 已提交
53 54 55
ifdef VERBOSE
  CTEST_TESTARGS += --verbose
endif
56

57 58
# Run the compiletest runner itself under valgrind
ifdef CTEST_VALGRIND
59
  CFG_RUN_CTEST=$(call CFG_RUN_TEST,$(2),$(3))
60
else
N
Niko Matsakis 已提交
61
  CFG_RUN_CTEST=$(call CFG_RUN,$(TLIB$(1)_T_$(3)_H_$(3)),$(2))
62
endif
63

64 65 66 67 68 69 70 71
# If we're running perf then set this environment variable
# to put the benchmarks into 'hard mode'
ifeq ($(MAKECMDGOALS),perf)
  RUST_BENCH=1
  export RUST_BENCH
endif


B
Brian Anderson 已提交
72 73 74 75
######################################################################
# Main test targets
######################################################################

76 77
.PHONY: cleantmptestlogs cleantestlibs

78 79
cleantmptestlogs:
	$(Q)rm -f tmp/*.log
80

81 82 83 84 85 86 87 88 89
cleantestlibs:
	$(Q)find $(CFG_HOST_TRIPLE)/test \
         -name '*.[odasS]' -o \
         -name '*.so' -o      \
         -name '*.dylib' -o   \
         -name '*.dll' -o     \
         -name '*.def' -o     \
         -name '*.bc' -o      \
         -name '*.dSYM' -o    \
90
         -name '*.libaux' -o      \
91 92
         -name '*.out' -o     \
         -name '*.err'        \
93
         | xargs rm -rf
94 95

check: cleantestlibs cleantmptestlogs tidy all check-stage2
96 97
	$(Q)$(S)src/etc/check-summary.py tmp/*.log

98 99 100
check-notidy: cleantestlibs cleantmptestlogs all check-stage2
	$(Q)$(S)src/etc/check-summary.py tmp/*.log

101 102
check-full: cleantestlibs cleantmptestlogs tidy \
            all check-stage1 check-stage2 check-stage3
103 104
	$(Q)$(S)src/etc/check-summary.py tmp/*.log

105
check-test: cleantestlibs cleantmptestlogs all check-stage2-rfail
106
	$(Q)$(S)src/etc/check-summary.py tmp/*.log
107

B
Brian Anderson 已提交
108 109 110 111 112
check-lite: cleantestlibs cleantmptestlogs rustc-stage2 \
	check-stage2-core check-stage2-std check-stage2-rpass \
	check-stage2-rfail check-stage2-cfail
	$(Q)$(S)src/etc/check-summary.py tmp/*.log

113
# Run the tidy script in multiple parts to avoid huge 'echo' commands
114
ifdef CFG_NOTIDY
B
Brian Anderson 已提交
115
tidy:
116
else
117 118 119 120 121 122 123

ALL_CS := $(wildcard $(S)src/rt/*.cpp \
                     $(S)src/rt/*/*.cpp \
                     $(S)src/rt/*/*/*.cpp \
                     $(S)srcrustllvm/*.cpp)
ALL_CS := $(filter-out $(S)src/rt/bigint/bigint_ext.cpp \
                       $(S)src/rt/bigint/bigint_int.cpp \
124
                       $(S)src/rt/miniz.cpp \
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
	,$(ALL_CS))
ALL_HS := $(wildcard $(S)src/rt/*.h \
                     $(S)src/rt/*/*.h \
                     $(S)src/rt/*/*/*.h \
                     $(S)srcrustllvm/*.h)
ALL_HS := $(filter-out $(S)src/rt/vg/valgrind.h \
                       $(S)src/rt/vg/memcheck.h \
                       $(S)src/rt/uthash/uthash.h \
                       $(S)src/rt/uthash/utlist.h \
                       $(S)src/rt/msvc/typeof.h \
                       $(S)src/rt/msvc/stdint.h \
                       $(S)src/rt/msvc/inttypes.h \
                       $(S)src/rt/bigint/bigint.h \
	,$(ALL_HS))

140 141
tidy:
		@$(call E, check: formatting)
142
		$(Q)find $(S)src -name '*.r[sc]' \
143
		| grep '^$(S)src/test' -v \
N
Niko Matsakis 已提交
144
		| xargs -n 10 python $(S)src/etc/tidy.py
145
		$(Q)find $(S)src/etc -name '*.py' \
146
		| xargs -n 10 python $(S)src/etc/tidy.py
147
		$(Q)echo $(ALL_CS) \
148
	  	| xargs -n 10 python $(S)src/etc/tidy.py
149
		$(Q)echo $(ALL_HS) \
150 151
	  	| xargs -n 10 python $(S)src/etc/tidy.py

152
endif
153

B
Brian Anderson 已提交
154 155 156 157
######################################################################
# Extracting tests for docs
######################################################################

158
EXTRACT_TESTS := "$(CFG_PYTHON)" $(S)src/etc/extract-tests.py
B
Brian Anderson 已提交
159 160 161 162 163

define DEF_DOC_TEST_HOST

doc-tutorial-extract$(1):
	@$$(call E, extract: tutorial tests)
164
	$$(Q)rm -f $(1)/test/doc-tutorial/*.rs
B
Brian Anderson 已提交
165 166
	$$(Q)$$(EXTRACT_TESTS) $$(S)doc/tutorial.md $(1)/test/doc-tutorial

167 168 169 170 171 172 173 174 175 176 177 178 179 180 181
doc-tutorial-ffi-extract$(1):
	@$$(call E, extract: tutorial-ffi tests)
	$$(Q)rm -f $(1)/test/doc-tutorial-ffi/*.rs
	$$(Q)$$(EXTRACT_TESTS) $$(S)doc/tutorial-ffi.md $(1)/test/doc-tutorial-ffi

doc-tutorial-macros-extract$(1):
	@$$(call E, extract: tutorial-macros tests)
	$$(Q)rm -f $(1)/test/doc-tutorial-macros/*.rs
	$$(Q)$$(EXTRACT_TESTS) $$(S)doc/tutorial-macros.md $(1)/test/doc-tutorial-macros

doc-tutorial-borrowed-ptr-extract$(1):
	@$$(call E, extract: tutorial-borrowed-ptr tests)
	$$(Q)rm -f $(1)/test/doc-tutorial-borrowed-ptr/*.rs
	$$(Q)$$(EXTRACT_TESTS) $$(S)doc/tutorial-borrowed-ptr.md $(1)/test/doc-tutorial-borrowed-ptr

182 183 184 185 186
doc-tutorial-tasks-extract$(1):
	@$$(call E, extract: tutorial-tasks tests)
	$$(Q)rm -f $(1)/test/doc-tutorial-tasks/*.rs
	$$(Q)$$(EXTRACT_TESTS) $$(S)doc/tutorial-tasks.md $(1)/test/doc-tutorial-tasks

187 188 189 190 191
doc-ref-extract$(1):
	@$$(call E, extract: ref tests)
	$$(Q)rm -f $(1)/test/doc-ref/*.rs
	$$(Q)$$(EXTRACT_TESTS) $$(S)doc/rust.md $(1)/test/doc-ref

B
Brian Anderson 已提交
192 193 194 195 196
endef

$(foreach host,$(CFG_TARGET_TRIPLES), \
 $(eval $(call DEF_DOC_TEST_HOST,$(host))))

197
######################################################################
B
Brian Anderson 已提交
198
# Rules for the test runners
199 200
######################################################################

B
Brian Anderson 已提交
201
define TEST_STAGEN
202

B
Brian Anderson 已提交
203
# All the per-stage build rules you might want to call from the
204 205 206
# command line.
#
# $(1) is the stage number
N
Niko Matsakis 已提交
207 208
# $(2) is the target triple to test
# $(3) is the host triple to test
209

210 211 212
# Prerequisites for compiletest tests
TEST_SREQ$(1)_T_$(2)_H_$(3) = \
	$$(HBIN$(1)_H_$(3))/compiletest$$(X) \
B
Brian Anderson 已提交
213
	$$(SREQ$(1)_T_$(2)_H_$(3))
214

215 216 217
# Prerequisites for compiletest tests that have deps on librustc, etc
FULL_TEST_SREQ$(1)_T_$(2)_H_$(3) = \
	$$(HBIN$(1)_H_$(3))/compiletest$$(X) \
B
Brian Anderson 已提交
218
	$$(SREQ$(1)_T_$(2)_H_$(3)) \
219
	$$(TLIBRUSTC_DEFAULT$(1)_T_$(2)_H_$(3))
220

221
check-stage$(1)-T-$(2)-H-$(3):     				\
N
Niko Matsakis 已提交
222
	check-stage$(1)-T-$(2)-H-$(3)-rustc			\
223
	check-stage$(1)-T-$(2)-H-$(3)-core          \
N
Niko Matsakis 已提交
224 225
	check-stage$(1)-T-$(2)-H-$(3)-std			\
	check-stage$(1)-T-$(2)-H-$(3)-rpass			\
226
	check-stage$(1)-T-$(2)-H-$(3)-rpass-full			\
N
Niko Matsakis 已提交
227 228 229
	check-stage$(1)-T-$(2)-H-$(3)-rfail			\
	check-stage$(1)-T-$(2)-H-$(3)-cfail			\
	check-stage$(1)-T-$(2)-H-$(3)-bench			\
230 231
	check-stage$(1)-T-$(2)-H-$(3)-pretty        \
    check-stage$(1)-T-$(2)-H-$(3)-rustdoc       \
B
Brian Anderson 已提交
232
    check-stage$(1)-T-$(2)-H-$(3)-cargo       \
233
    check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial  \
234 235 236
    check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-ffi  \
    check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-macros  \
    check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-borrowed-ptr  \
237
    check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-tasks  \
238
    check-stage$(1)-T-$(2)-H-$(3)-doc-ref
239

240 241 242
check-stage$(1)-T-$(2)-H-$(3)-core:				\
	check-stage$(1)-T-$(2)-H-$(3)-core-dummy

N
Niko Matsakis 已提交
243 244
check-stage$(1)-T-$(2)-H-$(3)-std:				\
	check-stage$(1)-T-$(2)-H-$(3)-std-dummy
245

N
Niko Matsakis 已提交
246 247
check-stage$(1)-T-$(2)-H-$(3)-rustc:				\
	check-stage$(1)-T-$(2)-H-$(3)-rustc-dummy
248

N
Niko Matsakis 已提交
249 250
check-stage$(1)-T-$(2)-H-$(3)-cfail:				\
	check-stage$(1)-T-$(2)-H-$(3)-cfail-dummy
G
Graydon Hoare 已提交
251

N
Niko Matsakis 已提交
252 253
check-stage$(1)-T-$(2)-H-$(3)-rfail:				\
	check-stage$(1)-T-$(2)-H-$(3)-rfail-dummy
254

N
Niko Matsakis 已提交
255 256
check-stage$(1)-T-$(2)-H-$(3)-rpass:				\
	check-stage$(1)-T-$(2)-H-$(3)-rpass-dummy
257

258 259 260
check-stage$(1)-T-$(2)-H-$(3)-rpass-full:				\
	check-stage$(1)-T-$(2)-H-$(3)-rpass-full-dummy

N
Niko Matsakis 已提交
261 262
check-stage$(1)-T-$(2)-H-$(3)-bench:				\
	check-stage$(1)-T-$(2)-H-$(3)-bench-dummy
263

N
Niko Matsakis 已提交
264 265
check-stage$(1)-T-$(2)-H-$(3)-perf:				\
	check-stage$(1)-T-$(2)-H-$(3)-perf-dummy
266

N
Niko Matsakis 已提交
267 268
check-stage$(1)-T-$(2)-H-$(3)-pretty:			\
	check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass	\
269
	check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-full	\
N
Niko Matsakis 已提交
270 271 272
    check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail	\
    check-stage$(1)-T-$(2)-H-$(3)-pretty-bench	\
    check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty
G
Graydon Hoare 已提交
273

N
Niko Matsakis 已提交
274 275
check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass:			\
	check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-dummy
G
Graydon Hoare 已提交
276

277 278 279
check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-full:			\
	check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-full-dummy

N
Niko Matsakis 已提交
280 281
check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail:			\
	check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail-dummy
G
Graydon Hoare 已提交
282

N
Niko Matsakis 已提交
283 284
check-stage$(1)-T-$(2)-H-$(3)-pretty-bench:			\
	check-stage$(1)-T-$(2)-H-$(3)-pretty-bench-dummy
G
Graydon Hoare 已提交
285

N
Niko Matsakis 已提交
286 287
check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty:				\
	check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty-dummy
288

289 290 291
check-stage$(1)-T-$(2)-H-$(3)-rustdoc:				\
	check-stage$(1)-T-$(2)-H-$(3)-rustdoc-dummy

B
Brian Anderson 已提交
292 293 294
check-stage$(1)-T-$(2)-H-$(3)-cargo:				\
	check-stage$(1)-T-$(2)-H-$(3)-cargo-dummy

B
Brian Anderson 已提交
295 296 297
check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial: \
	check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-dummy

298 299 300 301 302 303 304 305 306
check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-ffi: \
	check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-ffi-dummy

check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-macros: \
	check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-macros-dummy

check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-borrowed-ptr: \
	check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-borrowed-ptr-dummy

307 308 309
check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-tasks: \
	check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-tasks-dummy

310 311 312
check-stage$(1)-T-$(2)-H-$(3)-doc-ref: \
	check-stage$(1)-T-$(2)-H-$(3)-doc-ref-dummy

313 314 315 316 317 318
# Rules for the core library test runner

$(3)/test/coretest.stage$(1)-$(2)$$(X):			\
		$$(CORELIB_CRATE) $$(CORELIB_INPUTS)	\
        $$(SREQ$(1)_T_$(2)_H_$(3))
	@$$(call E, compile_and_link: $$@)
319
	$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
320 321 322 323

check-stage$(1)-T-$(2)-H-$(3)-core-dummy:			\
		$(3)/test/coretest.stage$(1)-$(2)$$(X)
	@$$(call E, run: $$<)
324 325
	$$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) $$(TESTARGS)	\
	--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-core.log
326

B
Brian Anderson 已提交
327
# Rules for the standard library test runner
328

N
Niko Matsakis 已提交
329
$(3)/test/stdtest.stage$(1)-$(2)$$(X):			\
330
		$$(STDLIB_CRATE) $$(STDLIB_INPUTS)	\
N
Niko Matsakis 已提交
331
        $$(SREQ$(1)_T_$(2)_H_$(3))
B
Brian Anderson 已提交
332
	@$$(call E, compile_and_link: $$@)
N
Niko Matsakis 已提交
333
	$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
334

N
Niko Matsakis 已提交
335
check-stage$(1)-T-$(2)-H-$(3)-std-dummy:			\
N
Niko Matsakis 已提交
336
		$(3)/test/stdtest.stage$(1)-$(2)$$(X)
B
Brian Anderson 已提交
337
	@$$(call E, run: $$<)
338 339
	$$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) $$(TESTARGS)	\
	--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-std.log
340

B
Brian Anderson 已提交
341
# Rules for the rustc test runner
342

N
Niko Matsakis 已提交
343 344 345 346
$(3)/test/rustctest.stage$(1)-$(2)$$(X):					\
		$$(COMPILER_CRATE)									\
		$$(COMPILER_INPUTS)									\
		$$(SREQ$(1)_T_$(2)_H_$(3))							\
N
Niko Matsakis 已提交
347
		$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUSTLLVM)
B
Brian Anderson 已提交
348
	@$$(call E, compile_and_link: $$@)
N
Niko Matsakis 已提交
349
	$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
350

N
Niko Matsakis 已提交
351
check-stage$(1)-T-$(2)-H-$(3)-rustc-dummy:		\
N
Niko Matsakis 已提交
352
		$(3)/test/rustctest.stage$(1)-$(2)$$(X)
B
Brian Anderson 已提交
353
	@$$(call E, run: $$<)
354 355
	$$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) $$(TESTARGS)   \
	--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-rustc.log
356

357 358 359 360 361 362 363 364 365 366 367 368 369 370
# Rules for the rustdoc test runner

$(3)/test/rustdoctest.stage$(1)-$(2)$$(X):					\
		$$(RUSTDOC_CRATE) $$(RUSTDOC_INPUTS)		\
		$$(TSREQ$(1)_T_$(2)_H_$(3))					\
		$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_CORELIB)  \
		$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB)   \
		$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC)
	@$$(call E, compile_and_link: $$@)
	$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test

check-stage$(1)-T-$(2)-H-$(3)-rustdoc-dummy:		\
		$(3)/test/rustdoctest.stage$(1)-$(2)$$(X)
	@$$(call E, run: $$<)
371 372
	$$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) $$(TESTARGS)	\
	--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-rustdoc.log
373

B
Brian Anderson 已提交
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390
# Rules for the cargo test runner

$(3)/test/cargotest.stage$(1)-$(2)$$(X):					\
		$$(CARGO_CRATE) $$(CARGO_INPUTS)		\
		$$(TSREQ$(1)_T_$(2)_H_$(3))					\
		$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_CORELIB)  \
		$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB)   \
		$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC)
	@$$(call E, compile_and_link: $$@)
	$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test

check-stage$(1)-T-$(2)-H-$(3)-cargo-dummy:		\
		$(3)/test/cargotest.stage$(1)-$(2)$$(X)
	@$$(call E, run: $$<)
	$$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) $$(TESTARGS)	\
	--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-cargo.log

B
Brian Anderson 已提交
391
# Rules for the cfail/rfail/rpass/bench/perf test runner
392

N
Niko Matsakis 已提交
393
CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) :=						\
N
Niko Matsakis 已提交
394 395 396
		--compile-lib-path $$(HLIB$(1)_H_$(3))				\
        --run-lib-path $$(TLIB$(1)_T_$(2)_H_$(3))			\
        --rustc-path $$(HBIN$(1)_H_$(3))/rustc$$(X)			\
397
        --aux-base $$(S)src/test/auxiliary/                 \
N
Niko Matsakis 已提交
398
        --stage-id stage$(1)-$(2)							\
N
Niko Matsakis 已提交
399
        --rustcflags "$$(CFG_RUSTC_FLAGS) --target=$(2)"	\
N
Niko Matsakis 已提交
400 401
        $$(CTEST_TESTARGS)

402
CFAIL_ARGS$(1)-T-$(2)-H-$(3) :=					\
N
Niko Matsakis 已提交
403 404
		$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3))	\
        --src-base $$(S)src/test/compile-fail/	\
405
        --build-base $(3)/test/compile-fail/	\
N
Niko Matsakis 已提交
406 407
        --mode compile-fail

408
RFAIL_ARGS$(1)-T-$(2)-H-$(3) :=					\
N
Niko Matsakis 已提交
409 410
		$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3))	\
        --src-base $$(S)src/test/run-fail/		\
411
        --build-base $(3)/test/run-fail/		\
N
Niko Matsakis 已提交
412
        --mode run-fail							\
N
Niko Matsakis 已提交
413 414
        $$(CTEST_RUNTOOL)

N
Niko Matsakis 已提交
415
RPASS_ARGS$(1)-T-$(2)-H-$(3) :=				\
N
Niko Matsakis 已提交
416 417
		$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3))	\
        --src-base $$(S)src/test/run-pass/		\
418
        --build-base $(3)/test/run-pass/		\
N
Niko Matsakis 已提交
419
        --mode run-pass					\
N
Niko Matsakis 已提交
420 421
        $$(CTEST_RUNTOOL)

422 423 424 425 426 427 428
RPASS_FULL_ARGS$(1)-T-$(2)-H-$(3) :=				\
		$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3))	\
        --src-base $$(S)src/test/run-pass-fulldeps/		\
        --build-base $(3)/test/run-pass-fulldeps/		\
        --mode run-pass					\
        $$(CTEST_RUNTOOL)

N
Niko Matsakis 已提交
429
BENCH_ARGS$(1)-T-$(2)-H-$(3) :=				\
N
Niko Matsakis 已提交
430 431
		$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3))	\
        --src-base $$(S)src/test/bench/			\
432
        --build-base $(3)/test/bench/			\
N
Niko Matsakis 已提交
433
        --mode run-pass					\
N
Niko Matsakis 已提交
434 435
        $$(CTEST_RUNTOOL)

436
PERF_ARGS$(1)-T-$(2)-H-$(3) :=					\
N
Niko Matsakis 已提交
437 438
		$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3))	\
        --src-base $$(S)src/test/bench/			\
439
        --build-base $(3)/test/perf/			\
N
Niko Matsakis 已提交
440
        --mode run-pass							\
N
Niko Matsakis 已提交
441 442
        $$(CTEST_PERF_RUNTOOL)

443
PRETTY_RPASS_ARGS$(1)-T-$(2)-H-$(3) :=			\
N
Niko Matsakis 已提交
444 445
		$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3))	\
        --src-base $$(S)src/test/run-pass/		\
446
        --build-base $(3)/test/run-pass/		\
N
Niko Matsakis 已提交
447 448
        --mode pretty

449 450 451 452 453 454
PRETTY_RPASS_FULL_ARGS$(1)-T-$(2)-H-$(3) :=			\
		$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3))	\
        --src-base $$(S)src/test/run-pass-fulldeps/		\
        --build-base $(3)/test/run-pass-fulldeps/		\
        --mode pretty

455
PRETTY_RFAIL_ARGS$(1)-T-$(2)-H-$(3) :=			\
N
Niko Matsakis 已提交
456 457
		$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3))	\
        --src-base $$(S)src/test/run-fail/		\
458
        --build-base $(3)/test/run-fail/		\
N
Niko Matsakis 已提交
459 460
        --mode pretty

461
PRETTY_BENCH_ARGS$(1)-T-$(2)-H-$(3) :=			\
N
Niko Matsakis 已提交
462 463
		$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3))	\
        --src-base $$(S)src/test/bench/			\
464
        --build-base $(3)/test/bench/			\
N
Niko Matsakis 已提交
465 466
        --mode pretty

467
PRETTY_PRETTY_ARGS$(1)-T-$(2)-H-$(3) :=			\
N
Niko Matsakis 已提交
468 469
		$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3))	\
        --src-base $$(S)src/test/pretty/		\
470
        --build-base $(3)/test/pretty/			\
N
Niko Matsakis 已提交
471 472
        --mode pretty

B
Brian Anderson 已提交
473 474 475 476 477 478
DOC_TUTORIAL_ARGS$(1)-T-$(2)-H-$(3) :=			\
		$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3))	\
        --src-base $(3)/test/doc-tutorial/		\
        --build-base $(3)/test/doc-tutorial/		\
        --mode run-pass

479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496
DOC_TUTORIAL_FFI_ARGS$(1)-T-$(2)-H-$(3) :=		\
		$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3))	\
        --src-base $(3)/test/doc-tutorial-ffi/		\
        --build-base $(3)/test/doc-tutorial-ffi/	\
        --mode run-pass

DOC_TUTORIAL_MACROS_ARGS$(1)-T-$(2)-H-$(3) :=		\
		$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3))	\
        --src-base $(3)/test/doc-tutorial-macros/	\
        --build-base $(3)/test/doc-tutorial-macros/	\
        --mode run-pass

DOC_TUTORIAL_BORROWED_PTR_ARGS$(1)-T-$(2)-H-$(3) :=	\
		$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3))	\
        --src-base $(3)/test/doc-tutorial-borrowed-ptr/	\
        --build-base $(3)/test/doc-tutorial-borrowed-ptr/ \
        --mode run-pass

497 498 499 500 501 502
DOC_TUTORIAL_TASKS_ARGS$(1)-T-$(2)-H-$(3) :=	\
		$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3))	\
        --src-base $(3)/test/doc-tutorial-tasks/	\
        --build-base $(3)/test/doc-tutorial-tasks/ \
        --mode run-pass

503 504 505 506 507 508
DOC_REF_ARGS$(1)-T-$(2)-H-$(3) :=			\
		$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3))	\
        --src-base $(3)/test/doc-ref/			\
        --build-base $(3)/test/doc-ref/			\
        --mode run-pass

N
Niko Matsakis 已提交
509
check-stage$(1)-T-$(2)-H-$(3)-cfail-dummy:		\
510
		$$(TEST_SREQ$(1)_T_$(2)_H_$(3))		\
N
Niko Matsakis 已提交
511
	        $$(CFAIL_TESTS)
N
Niko Matsakis 已提交
512 513
	@$$(call E, run cfail: $$<)
	$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
514 515
		$$(CFAIL_ARGS$(1)-T-$(2)-H-$(3)) \
		--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-cfail.log
516

N
Niko Matsakis 已提交
517
check-stage$(1)-T-$(2)-H-$(3)-rfail-dummy:		\
518
		$$(TEST_SREQ$(1)_T_$(2)_H_$(3))		\
N
Niko Matsakis 已提交
519
		$$(RFAIL_TESTS)
N
Niko Matsakis 已提交
520 521
	@$$(call E, run rfail: $$<)
	$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
522 523
		$$(RFAIL_ARGS$(1)-T-$(2)-H-$(3)) \
		--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-rfail.log
B
Brian Anderson 已提交
524

N
Niko Matsakis 已提交
525
check-stage$(1)-T-$(2)-H-$(3)-rpass-dummy:		\
526
		$$(TEST_SREQ$(1)_T_$(2)_H_$(3))		\
N
Niko Matsakis 已提交
527
	        $$(RPASS_TESTS)
528
	@$$(call E, run rpass-full: $$<)
N
Niko Matsakis 已提交
529
	$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
530 531
		$$(RPASS_ARGS$(1)-T-$(2)-H-$(3)) \
		--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-rpass.log
B
Brian Anderson 已提交
532

533 534 535 536 537 538 539 540
check-stage$(1)-T-$(2)-H-$(3)-rpass-full-dummy:		\
		$$(FULL_TEST_SREQ$(1)_T_$(2)_H_$(3))		\
	        $$(RPASS_FULL_TESTS)
	@$$(call E, run rpass: $$<)
	$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
		$$(RPASS_FULL_ARGS$(1)-T-$(2)-H-$(3)) \
		--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-rpass-full.log

N
Niko Matsakis 已提交
541
check-stage$(1)-T-$(2)-H-$(3)-bench-dummy:		\
542
		$$(TEST_SREQ$(1)_T_$(2)_H_$(3))		\
N
Niko Matsakis 已提交
543
		$$(BENCH_TESTS)
N
Niko Matsakis 已提交
544 545
	@$$(call E, run bench: $$<)
	$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
546 547
		$$(BENCH_ARGS$(1)-T-$(2)-H-$(3)) \
		--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-bench.log
548

N
Niko Matsakis 已提交
549
check-stage$(1)-T-$(2)-H-$(3)-perf-dummy:		\
550
	        $$(TEST_SREQ$(1)_T_$(2)_H_$(3))		\
N
Niko Matsakis 已提交
551
	        $$(BENCH_TESTS)
552
	@$$(call E, perf: $$<)
N
Niko Matsakis 已提交
553
	$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
554 555
		$$(PERF_ARGS$(1)-T-$(2)-H-$(3)) \
		--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-perf.log
556

N
Niko Matsakis 已提交
557
check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-dummy:	\
558
	        $$(TEST_SREQ$(1)_T_$(2)_H_$(3))		\
N
Niko Matsakis 已提交
559
	        $$(RPASS_TESTS)
N
Niko Matsakis 已提交
560 561
	@$$(call E, run pretty-rpass: $$<)
	$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
562 563
		$$(PRETTY_RPASS_ARGS$(1)-T-$(2)-H-$(3)) \
		--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass.log
564

565 566 567 568 569 570 571 572
check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-full-dummy:	\
	        $$(FULL_TEST_SREQ$(1)_T_$(2)_H_$(3))		\
	        $$(RPASS_FULL_TESTS)
	@$$(call E, run pretty-rpass-full: $$<)
	$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
		$$(PRETTY_RPASS_FULL_ARGS$(1)-T-$(2)-H-$(3)) \
		--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-full.log

N
Niko Matsakis 已提交
573
check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail-dummy:	\
574
	        $$(TEST_SREQ$(1)_T_$(2)_H_$(3))		\
N
Niko Matsakis 已提交
575
	        $$(RFAIL_TESTS)
N
Niko Matsakis 已提交
576 577
	@$$(call E, run pretty-rfail: $$<)
	$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
578 579
		$$(PRETTY_RFAIL_ARGS$(1)-T-$(2)-H-$(3)) \
		--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail.log
580

N
Niko Matsakis 已提交
581
check-stage$(1)-T-$(2)-H-$(3)-pretty-bench-dummy:	\
582
		$$(TEST_SREQ$(1)_T_$(2)_H_$(3))		\
N
Niko Matsakis 已提交
583
	        $$(BENCH_TESTS)
N
Niko Matsakis 已提交
584 585
	@$$(call E, run pretty-bench: $$<)
	$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
586 587
		$$(PRETTY_BENCH_ARGS$(1)-T-$(2)-H-$(3)) \
		--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-pretty-bench.log
588

N
Niko Matsakis 已提交
589
check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty-dummy:	\
590
	        $$(TEST_SREQ$(1)_T_$(2)_H_$(3))		\
N
Niko Matsakis 已提交
591
	        $$(PRETTY_TESTS)
N
Niko Matsakis 已提交
592 593
	@$$(call E, run pretty-pretty: $$<)
	$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
594 595
		$$(PRETTY_PRETTY_ARGS$(1)-T-$(2)-H-$(3)) \
		--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty.log
596

B
Brian Anderson 已提交
597
check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-dummy:       \
598
	        $$(TEST_SREQ$(1)_T_$(2)_H_$(3))		\
B
Brian Anderson 已提交
599 600 601
                doc-tutorial-extract$(3)
	@$$(call E, run doc-tutorial: $$<)
	$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
602 603
                $$(DOC_TUTORIAL_ARGS$(1)-T-$(2)-H-$(3)) \
		--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial.log
B
Brian Anderson 已提交
604

605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628
check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-ffi-dummy:       \
	        $$(TEST_SREQ$(1)_T_$(2)_H_$(3))		\
                doc-tutorial-ffi-extract$(3)
	@$$(call E, run doc-tutorial-ffi: $$<)
	$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
                $$(DOC_TUTORIAL_FFI_ARGS$(1)-T-$(2)-H-$(3)) \
		--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-ffi.log

check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-macros-dummy:       \
	        $$(TEST_SREQ$(1)_T_$(2)_H_$(3))		\
                doc-tutorial-macros-extract$(3)
	@$$(call E, run doc-tutorial-macros: $$<)
	$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
                $$(DOC_TUTORIAL_MACROS_ARGS$(1)-T-$(2)-H-$(3)) \
		--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-macros.log

check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-borrowed-ptr-dummy:       \
	        $$(TEST_SREQ$(1)_T_$(2)_H_$(3))		\
                doc-tutorial-borrowed-ptr-extract$(3)
	@$$(call E, run doc-tutorial-borrowed-ptr: $$<)
	$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
                $$(DOC_TUTORIAL_BORROWED_PTR_ARGS$(1)-T-$(2)-H-$(3)) \
		--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-borrowed-ptr.log

629 630 631 632 633 634 635 636
check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-tasks-dummy:       \
	        $$(TEST_SREQ$(1)_T_$(2)_H_$(3))		\
                doc-tutorial-tasks-extract$(3)
	@$$(call E, run doc-tutorial-tasks: $$<)
	$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
                $$(DOC_TUTORIAL_TASKS_ARGS$(1)-T-$(2)-H-$(3)) \
		--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-tasks.log

637
check-stage$(1)-T-$(2)-H-$(3)-doc-ref-dummy:            \
638
	        $$(TEST_SREQ$(1)_T_$(2)_H_$(3))		\
639 640 641
                doc-ref-extract$(3)
	@$$(call E, run doc-ref: $$<)
	$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
642 643
                $$(DOC_REF_ARGS$(1)-T-$(2)-H-$(3)) \
		--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-doc-ref.log
644

B
Brian Anderson 已提交
645
endef
646

647
# Instantiate the template for stage 0, 1, 2, 3
648

N
Niko Matsakis 已提交
649 650 651 652
$(foreach host,$(CFG_TARGET_TRIPLES), \
 $(eval $(foreach target,$(CFG_TARGET_TRIPLES), \
  $(eval $(foreach stage,$(STAGES), \
   $(eval $(call TEST_STAGEN,$(stage),$(target),$(host))))))))
B
Brian Anderson 已提交
653

N
Niko Matsakis 已提交
654 655 656
######################################################################
# Fast-test rules
######################################################################
657

658
GENERATED += tmp/$(FT).rc tmp/$(FT_DRIVER).rs
N
Niko Matsakis 已提交
659

N
Niko Matsakis 已提交
660
tmp/$(FT).rc tmp/$(FT_DRIVER).rs: \
661
		$(RPASS_TESTS) \
N
Niko Matsakis 已提交
662 663 664
		$(S)src/etc/combine-tests.py
	@$(call E, check: building combined stage2 test runner)
	$(Q)$(S)src/etc/combine-tests.py
N
Niko Matsakis 已提交
665 666 667 668 669 670 671 672 673 674

define DEF_CHECK_FAST_FOR_T_H
# $(1) unused
# $(2) target triple
# $(3) host triple

$$(TLIB2_T_$(2)_H_$(3))/$$(FT_LIB): \
		tmp/$$(FT).rc \
		$$(SREQ2_T_$(2)_H_$(3))
	@$$(call E, compile_and_link: $$@)
N
Niko Matsakis 已提交
675
	$$(STAGE2_T_$(2)_H_$(3)) --lib -o $$@ $$<
N
Niko Matsakis 已提交
676

N
Niko Matsakis 已提交
677 678 679 680 681
$(3)/test/$$(FT_DRIVER)-$(2)$$(X): \
		tmp/$$(FT_DRIVER).rs \
		$$(TLIB2_T_$(2)_H_$(3))/$$(FT_LIB) \
		$$(SREQ2_T_$(2)_H_$(3))
	@$$(call E, compile_and_link: $$@ $$<)
682
	$$(STAGE2_T_$(2)_H_$(3)) -o $$@ $$<
N
Niko Matsakis 已提交
683

N
Niko Matsakis 已提交
684 685 686
$(3)/test/$$(FT_DRIVER)-$(2).out: \
		$(3)/test/$$(FT_DRIVER)-$(2)$$(X) \
		$$(SREQ2_T_$(2)_H_$(3))
687 688
	$$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) \
	--logfile tmp/$$(FT_DRIVER)-$(2).log
N
Niko Matsakis 已提交
689

690
check-fast-T-$(2)-H-$(3):     			\
N
Niko Matsakis 已提交
691
	check-stage2-T-$(2)-H-$(3)-rustc	\
692
	check-stage2-T-$(2)-H-$(3)-core		\
N
Niko Matsakis 已提交
693
	check-stage2-T-$(2)-H-$(3)-std		\
N
Niko Matsakis 已提交
694
	$(3)/test/$$(FT_DRIVER)-$(2).out
N
Niko Matsakis 已提交
695 696 697 698 699 700 701 702 703 704 705 706

endef

$(foreach host,$(CFG_TARGET_TRIPLES), \
 $(eval $(foreach target,$(CFG_TARGET_TRIPLES), \
   $(eval $(call DEF_CHECK_FAST_FOR_T_H,,$(target),$(host))))))

######################################################################
# Shortcut rules
######################################################################

define DEF_CHECK_FOR_STAGE_H
707

708 709 710 711 712 713 714 715 716
check-stage$(1)-H-$(2):					\
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-T-$$(target)-H-$(2))
check-stage$(1)-H-$(2)-perf:					\
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-T-$$(target)-H-$(2)-perf)
check-stage$(1)-H-$(2)-rustc:					\
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-T-$$(target)-H-$(2)-rustc)
717 718 719
check-stage$(1)-H-$(2)-core:					\
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-T-$$(target)-H-$(2)-core)
720 721 722 723 724 725
check-stage$(1)-H-$(2)-std:					\
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-T-$$(target)-H-$(2)-std)
check-stage$(1)-H-$(2)-rpass:					\
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-T-$$(target)-H-$(2)-rpass)
726 727 728
check-stage$(1)-H-$(2)-rpass-full:					\
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-T-$$(target)-H-$(2)-rpass-full)
729 730 731 732 733 734 735 736 737
check-stage$(1)-H-$(2)-rfail:					\
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-T-$$(target)-H-$(2)-rfail)
check-stage$(1)-H-$(2)-cfail:					\
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-T-$$(target)-H-$(2)-cfail)
check-stage$(1)-H-$(2)-bench:					\
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-T-$$(target)-H-$(2)-bench)
738 739 740 741 742 743
check-stage$(1)-H-$(2)-pretty:					\
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-T-$$(target)-H-$(2)-pretty)
check-stage$(1)-H-$(2)-pretty-rpass:				\
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-T-$$(target)-H-$(2)-pretty-rpass)
744 745 746
check-stage$(1)-H-$(2)-pretty-rpass-full:				\
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-T-$$(target)-H-$(2)-pretty-rpass-full)
747 748 749 750 751 752 753 754 755
check-stage$(1)-H-$(2)-pretty-rfail:				\
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-T-$$(target)-H-$(2)-pretty-rfail)
check-stage$(1)-H-$(2)-pretty-bench:				\
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-T-$$(target)-H-$(2)-pretty-bench)
check-stage$(1)-H-$(2)-pretty-pretty:				\
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-T-$$(target)-H-$(2)-pretty-pretty)
756 757 758
check-stage$(1)-H-$(2)-rustdoc:					\
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-T-$$(target)-H-$(2)-rustdoc)
B
Brian Anderson 已提交
759 760 761
check-stage$(1)-H-$(2)-cargo:					\
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-T-$$(target)-H-$(2)-cargo)
B
Brian Anderson 已提交
762 763 764
check-stage$(1)-H-$(2)-doc-tutorial:				\
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-T-$$(target)-H-$(2)-doc-tutorial)
765 766 767 768 769 770 771 772 773
check-stage$(1)-H-$(2)-doc-tutorial-ffi:			\
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-T-$$(target)-H-$(2)-doc-tutorial-ffi)
check-stage$(1)-H-$(2)-doc-tutorial-macros:			\
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-T-$$(target)-H-$(2)-doc-tutorial-macros)
check-stage$(1)-H-$(2)-doc-tutorial-borrowed-ptr:		\
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-T-$$(target)-H-$(2)-doc-tutorial-borrowed-ptr)
774 775 776
check-stage$(1)-H-$(2)-doc-tutorial-tasks:		\
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-T-$$(target)-H-$(2)-doc-tutorial-tasks)
777 778 779
check-stage$(1)-H-$(2)-doc-ref:				\
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-T-$$(target)-H-$(2)-doc-ref)
780 781 782

endef

N
Niko Matsakis 已提交
783
$(foreach stage,$(STAGES),					\
N
Niko Matsakis 已提交
784
 $(eval $(foreach target,$(CFG_TARGET_TRIPLES),			\
N
Niko Matsakis 已提交
785 786 787 788 789 790 791
  $(eval $(call DEF_CHECK_FOR_STAGE_H,$(stage),$(target))))))

define DEF_CHECK_FAST_FOR_H

check-fast-H-$(1): 		check-fast-T-$(1)-H-$(1)

endef
N
Niko Matsakis 已提交
792

N
Niko Matsakis 已提交
793 794 795
$(foreach target,$(CFG_TARGET_TRIPLES),			\
 $(eval $(call DEF_CHECK_FAST_FOR_H,$(target))))

796
define DEF_CHECK_ALL_FOR_STAGE
N
Niko Matsakis 已提交
797

798
check-stage$(1)-H-all: \
799 800
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-H-$$(target))
801
check-stage$(1)-H-all-perf: \
802 803
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-H-$$(target)-perf)
804
check-stage$(1)-H-all-rustc: \
805 806
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-H-$$(target)-rustc)
807 808 809
check-stage$(1)-H-all-core: \
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-H-$$(target)-core)
810
check-stage$(1)-H-all-std: \
811 812
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-H-$$(target)-std)
813
check-stage$(1)-H-all-rpass: \
814 815
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-H-$$(target)-rpass)
816 817 818
check-stage$(1)-H-all-rpass-full: \
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-H-$$(target)-rpass-full)
819
check-stage$(1)-H-all-rfail: \
820 821
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-H-$$(target)-rfail)
822
check-stage$(1)-H-all-cfail: \
823 824
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-H-$$(target)-cfail)
825
check-stage$(1)-H-all-bench: \
826 827
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-H-$$(target)-bench)
828 829 830 831 832 833
check-stage$(1)-H-all-pretty: \
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-H-$$(target)-pretty)
check-stage$(1)-H-all-pretty-rpass: \
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-H-$$(target)-pretty-rpass)
834 835 836
check-stage$(1)-H-all-pretty-rpass-full: \
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-H-$$(target)-pretty-rpass-full)
837 838 839 840 841 842 843 844 845
check-stage$(1)-H-all-pretty-rfail: \
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-H-$$(target)-pretty-rfail)
check-stage$(1)-H-all-pretty-bench: \
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-H-$$(target)-pretty-bench)
check-stage$(1)-H-all-pretty-pretty: \
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-H-$$(target)-pretty-pretty)
846 847 848
check-stage$(1)-H-all-rustdoc: \
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-H-$$(target)-rustdoc)
B
Brian Anderson 已提交
849 850 851
check-stage$(1)-H-all-cargo: \
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-H-$$(target)-cargo)
B
Brian Anderson 已提交
852 853 854
check-stage$(1)-H-all-doc-tutorial: \
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-H-$$(target)-doc-tutorial)
855 856 857
check-stage$(1)-H-all-doc-ref: \
	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
	 check-stage$(1)-H-$$(target)-doc-ref)
N
Niko Matsakis 已提交
858 859

endef
860

861
$(foreach stage,$(STAGES),						\
862
 $(eval $(call DEF_CHECK_ALL_FOR_STAGE,$(stage))))
863 864 865 866 867 868

define DEF_CHECK_FOR_STAGE

check-stage$(1): check-stage$(1)-H-$$(CFG_HOST_TRIPLE)
check-stage$(1)-perf: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-perf
check-stage$(1)-rustc: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-rustc
869
check-stage$(1)-core: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-core
870 871
check-stage$(1)-std: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-std
check-stage$(1)-rpass: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-rpass
872
check-stage$(1)-rpass-full: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-rpass-full
873 874 875
check-stage$(1)-rfail: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-rfail
check-stage$(1)-cfail: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-cfail
check-stage$(1)-bench: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-bench
876 877
check-stage$(1)-pretty: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-pretty
check-stage$(1)-pretty-rpass: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-pretty-rpass
878
check-stage$(1)-pretty-rpass-full: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-pretty-rpass-full
879 880 881
check-stage$(1)-pretty-rfail: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-pretty-rfail
check-stage$(1)-pretty-bench: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-pretty-bench
check-stage$(1)-pretty-pretty: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-pretty-pretty
882
check-stage$(1)-rustdoc: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-rustdoc
B
Brian Anderson 已提交
883
check-stage$(1)-cargo: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-cargo
B
Brian Anderson 已提交
884
check-stage$(1)-doc-tutorial: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-doc-tutorial
885 886 887
check-stage$(1)-doc-tutorial-ffi: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-doc-tutorial-ffi
check-stage$(1)-doc-tutorial-macros: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-doc-tutorial-macros
check-stage$(1)-doc-tutorial-borrowed-ptr: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-doc-tutorial-borrowed-ptr
888
check-stage$(1)-doc-tutorial-tasks: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-doc-tutorial-tasks
889
check-stage$(1)-doc-ref: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-doc-ref
890 891 892

endef

N
Niko Matsakis 已提交
893
$(foreach stage,$(STAGES),						\
N
Niko Matsakis 已提交
894
 $(eval $(call DEF_CHECK_FOR_STAGE,$(stage))))
B
Brian Anderson 已提交
895

896
check-fast: tidy check-fast-H-$(CFG_HOST_TRIPLE)