PageRenderTime 62ms CodeModel.GetById 22ms app.highlight 35ms RepoModel.GetById 1ms app.codeStats 0ms

/mk/tests.mk

http://github.com/jruderman/rust
Makefile | 787 lines | 610 code | 132 blank | 45 comment | 0 complexity | 79e856476c206a91152419f8d042ec50 MD5 | raw file
  1######################################################################
  2# Testing variables
  3######################################################################
  4
  5RPASS_RC := $(wildcard $(S)src/test/run-pass/*.rc)
  6RPASS_RS := $(wildcard $(S)src/test/run-pass/*.rs)
  7RPASS_FULL_RC := $(wildcard $(S)src/test/run-pass-fulldeps/*.rc)
  8RPASS_FULL_RS := $(wildcard $(S)src/test/run-pass-fulldeps/*.rs)
  9RFAIL_RC := $(wildcard $(S)src/test/run-fail/*.rc)
 10RFAIL_RS := $(wildcard $(S)src/test/run-fail/*.rs)
 11CFAIL_RC := $(wildcard $(S)src/test/compile-fail/*.rc)
 12CFAIL_RS := $(wildcard $(S)src/test/compile-fail/*.rs)
 13BENCH_RS := $(wildcard $(S)src/test/bench/*.rs)
 14PRETTY_RS := $(wildcard $(S)src/test/pretty/*.rs)
 15
 16# perf tests are the same as bench tests only they run under
 17# a performance monitor.
 18PERF_RS := $(wildcard $(S)src/test/bench/*.rs)
 19
 20RPASS_TESTS := $(RPASS_RC) $(RPASS_RS)
 21RPASS_FULL_TESTS := $(RPASS_FULL_RC) $(RPASS_FULL_RS)
 22RFAIL_TESTS := $(RFAIL_RC) $(RFAIL_RS)
 23CFAIL_TESTS := $(CFAIL_RC) $(CFAIL_RS)
 24BENCH_TESTS := $(BENCH_RS)
 25PERF_TESTS := $(PERF_RS)
 26PRETTY_TESTS := $(PRETTY_RS)
 27
 28FT := run_pass_stage2
 29FT_LIB := $(call CFG_LIB_NAME,$(FT))
 30FT_DRIVER := $(FT)_driver
 31
 32# The arguments to all test runners
 33ifdef TESTNAME
 34  TESTARGS += $(TESTNAME)
 35endif
 36
 37ifdef CHECK_XFAILS
 38  TESTARGS += --ignored
 39endif
 40
 41# Arguments to the cfail/rfail/rpass/bench tests
 42ifdef CFG_VALGRIND
 43  CTEST_RUNTOOL = --runtool "$(CFG_VALGRIND)"
 44endif
 45
 46# Arguments to the perf tests
 47ifdef CFG_PERF_TOOL
 48  CTEST_PERF_RUNTOOL = --runtool "$(CFG_PERF_TOOL)"
 49endif
 50
 51CTEST_TESTARGS := $(TESTARGS)
 52
 53ifdef VERBOSE
 54  CTEST_TESTARGS += --verbose
 55endif
 56
 57# Run the compiletest runner itself under valgrind
 58ifdef CTEST_VALGRIND
 59  CFG_RUN_CTEST=$(call CFG_RUN_TEST,$(2),$(3))
 60else
 61  CFG_RUN_CTEST=$(call CFG_RUN,$(TLIB$(1)_T_$(3)_H_$(3)),$(2))
 62endif
 63
 64# If we're running perf then set this environment variable
 65# to put the benchmarks into 'hard mode'
 66ifeq ($(MAKECMDGOALS),perf)
 67  RUST_BENCH=1
 68  export RUST_BENCH
 69endif
 70
 71
 72######################################################################
 73# Main test targets
 74######################################################################
 75
 76.PHONY: cleantmptestlogs cleantestlibs
 77
 78cleantmptestlogs:
 79	$(Q)rm -f tmp/*.log
 80
 81cleantestlibs:
 82	$(Q)find $(CFG_HOST_TRIPLE)/test \
 83         -name '*.[odasS]' -o \
 84         -name '*.so' -o      \
 85         -name '*.dylib' -o   \
 86         -name '*.dll' -o     \
 87         -name '*.def' -o     \
 88         -name '*.bc' -o      \
 89         -name '*.dSYM' -o    \
 90         -name '*.libaux' -o      \
 91         -name '*.out' -o     \
 92         -name '*.err'        \
 93         | xargs rm -rf
 94
 95check: cleantestlibs cleantmptestlogs tidy all check-stage2
 96	$(Q)$(S)src/etc/check-summary.py tmp/*.log
 97
 98check-notidy: cleantestlibs cleantmptestlogs all check-stage2
 99	$(Q)$(S)src/etc/check-summary.py tmp/*.log
100
101check-full: cleantestlibs cleantmptestlogs tidy \
102            all check-stage1 check-stage2 check-stage3
103	$(Q)$(S)src/etc/check-summary.py tmp/*.log
104
105check-test: cleantestlibs cleantmptestlogs all check-stage2-rfail
106	$(Q)$(S)src/etc/check-summary.py tmp/*.log
107
108check-lite: cleantestlibs cleantmptestlogs rustc-stage2 \
109	check-stage2-core check-stage2-std check-stage2-rpass \
110	check-stage2-rfail check-stage2-cfail
111	$(Q)$(S)src/etc/check-summary.py tmp/*.log
112
113# Run the tidy script in multiple parts to avoid huge 'echo' commands
114ifdef CFG_NOTIDY
115tidy:
116else
117
118ALL_CS := $(wildcard $(S)src/rt/*.cpp \
119                     $(S)src/rt/*/*.cpp \
120                     $(S)src/rt/*/*/*.cpp \
121                     $(S)srcrustllvm/*.cpp)
122ALL_CS := $(filter-out $(S)src/rt/bigint/bigint_ext.cpp \
123                       $(S)src/rt/bigint/bigint_int.cpp \
124	,$(ALL_CS))
125ALL_HS := $(wildcard $(S)src/rt/*.h \
126                     $(S)src/rt/*/*.h \
127                     $(S)src/rt/*/*/*.h \
128                     $(S)srcrustllvm/*.h)
129ALL_HS := $(filter-out $(S)src/rt/vg/valgrind.h \
130                       $(S)src/rt/vg/memcheck.h \
131                       $(S)src/rt/uthash/uthash.h \
132                       $(S)src/rt/uthash/utlist.h \
133                       $(S)src/rt/msvc/typeof.h \
134                       $(S)src/rt/msvc/stdint.h \
135                       $(S)src/rt/msvc/inttypes.h \
136                       $(S)src/rt/bigint/bigint.h \
137	,$(ALL_HS))
138
139tidy:
140		@$(call E, check: formatting)
141		$(Q)find $(S)src -name '*.r[sc]' \
142		| grep '^$(S)src/test' -v \
143		| xargs -n 10 python $(S)src/etc/tidy.py
144		$(Q)find $(S)src/etc -name '*.py' \
145		| xargs -n 10 python $(S)src/etc/tidy.py
146		$(Q)echo $(ALL_CS) \
147	  	| xargs -n 10 python $(S)src/etc/tidy.py
148		$(Q)echo $(ALL_HS) \
149	  	| xargs -n 10 python $(S)src/etc/tidy.py
150
151endif
152
153######################################################################
154# Extracting tests for docs
155######################################################################
156
157EXTRACT_TESTS := "$(CFG_PYTHON)" $(S)src/etc/extract-tests.py
158
159define DEF_DOC_TEST_HOST
160
161doc-tutorial-extract$(1):
162	@$$(call E, extract: tutorial tests)
163	$$(Q)rm -f $(1)/test/doc-tutorial/*.rs
164	$$(Q)$$(EXTRACT_TESTS) $$(S)doc/tutorial.md $(1)/test/doc-tutorial
165
166doc-ref-extract$(1):
167	@$$(call E, extract: ref tests)
168	$$(Q)rm -f $(1)/test/doc-ref/*.rs
169	$$(Q)$$(EXTRACT_TESTS) $$(S)doc/rust.md $(1)/test/doc-ref
170
171endef
172
173$(foreach host,$(CFG_TARGET_TRIPLES), \
174 $(eval $(call DEF_DOC_TEST_HOST,$(host))))
175
176######################################################################
177# Rules for the test runners
178######################################################################
179
180define TEST_STAGEN
181
182# All the per-stage build rules you might want to call from the
183# command line.
184#
185# $(1) is the stage number
186# $(2) is the target triple to test
187# $(3) is the host triple to test
188
189# Prerequisites for compiletest tests
190TEST_SREQ$(1)_T_$(2)_H_$(3) = \
191	$$(HBIN$(1)_H_$(3))/compiletest$$(X) \
192	$$(SREQ$(1)_T_$(2)_H_$(3))
193
194# Prerequisites for compiletest tests that have deps on librustc, etc
195FULL_TEST_SREQ$(1)_T_$(2)_H_$(3) = \
196	$$(HBIN$(1)_H_$(3))/compiletest$$(X) \
197	$$(SREQ$(1)_T_$(2)_H_$(3)) \
198	$$(TLIBRUSTC_DEFAULT$(1)_T_$(2)_H_$(3))
199
200check-stage$(1)-T-$(2)-H-$(3): tidy				\
201	check-stage$(1)-T-$(2)-H-$(3)-rustc			\
202	check-stage$(1)-T-$(2)-H-$(3)-core          \
203	check-stage$(1)-T-$(2)-H-$(3)-std			\
204	check-stage$(1)-T-$(2)-H-$(3)-rpass			\
205	check-stage$(1)-T-$(2)-H-$(3)-rpass-full			\
206	check-stage$(1)-T-$(2)-H-$(3)-rfail			\
207	check-stage$(1)-T-$(2)-H-$(3)-cfail			\
208	check-stage$(1)-T-$(2)-H-$(3)-bench			\
209	check-stage$(1)-T-$(2)-H-$(3)-pretty        \
210    check-stage$(1)-T-$(2)-H-$(3)-rustdoc       \
211    check-stage$(1)-T-$(2)-H-$(3)-cargo       \
212    check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial  \
213    check-stage$(1)-T-$(2)-H-$(3)-doc-ref
214
215check-stage$(1)-T-$(2)-H-$(3)-core:				\
216	check-stage$(1)-T-$(2)-H-$(3)-core-dummy
217
218check-stage$(1)-T-$(2)-H-$(3)-std:				\
219	check-stage$(1)-T-$(2)-H-$(3)-std-dummy
220
221check-stage$(1)-T-$(2)-H-$(3)-rustc:				\
222	check-stage$(1)-T-$(2)-H-$(3)-rustc-dummy
223
224check-stage$(1)-T-$(2)-H-$(3)-cfail:				\
225	check-stage$(1)-T-$(2)-H-$(3)-cfail-dummy
226
227check-stage$(1)-T-$(2)-H-$(3)-rfail:				\
228	check-stage$(1)-T-$(2)-H-$(3)-rfail-dummy
229
230check-stage$(1)-T-$(2)-H-$(3)-rpass:				\
231	check-stage$(1)-T-$(2)-H-$(3)-rpass-dummy
232
233check-stage$(1)-T-$(2)-H-$(3)-rpass-full:				\
234	check-stage$(1)-T-$(2)-H-$(3)-rpass-full-dummy
235
236check-stage$(1)-T-$(2)-H-$(3)-bench:				\
237	check-stage$(1)-T-$(2)-H-$(3)-bench-dummy
238
239check-stage$(1)-T-$(2)-H-$(3)-perf:				\
240	check-stage$(1)-T-$(2)-H-$(3)-perf-dummy
241
242check-stage$(1)-T-$(2)-H-$(3)-pretty:			\
243	check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass	\
244	check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-full	\
245    check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail	\
246    check-stage$(1)-T-$(2)-H-$(3)-pretty-bench	\
247    check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty
248
249check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass:			\
250	check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-dummy
251
252check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-full:			\
253	check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-full-dummy
254
255check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail:			\
256	check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail-dummy
257
258check-stage$(1)-T-$(2)-H-$(3)-pretty-bench:			\
259	check-stage$(1)-T-$(2)-H-$(3)-pretty-bench-dummy
260
261check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty:				\
262	check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty-dummy
263
264check-stage$(1)-T-$(2)-H-$(3)-rustdoc:				\
265	check-stage$(1)-T-$(2)-H-$(3)-rustdoc-dummy
266
267check-stage$(1)-T-$(2)-H-$(3)-cargo:				\
268	check-stage$(1)-T-$(2)-H-$(3)-cargo-dummy
269
270check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial: \
271	check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-dummy
272
273check-stage$(1)-T-$(2)-H-$(3)-doc-ref: \
274	check-stage$(1)-T-$(2)-H-$(3)-doc-ref-dummy
275
276# Rules for the core library test runner
277
278$(3)/test/coretest.stage$(1)-$(2)$$(X):			\
279		$$(CORELIB_CRATE) $$(CORELIB_INPUTS)	\
280        $$(SREQ$(1)_T_$(2)_H_$(3))
281	@$$(call E, compile_and_link: $$@)
282	$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
283
284check-stage$(1)-T-$(2)-H-$(3)-core-dummy:			\
285		$(3)/test/coretest.stage$(1)-$(2)$$(X)
286	@$$(call E, run: $$<)
287	$$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) $$(TESTARGS)	\
288	--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-core.log
289
290# Rules for the standard library test runner
291
292$(3)/test/stdtest.stage$(1)-$(2)$$(X):			\
293		$$(STDLIB_CRATE) $$(STDLIB_INPUTS)	\
294        $$(SREQ$(1)_T_$(2)_H_$(3))
295	@$$(call E, compile_and_link: $$@)
296	$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
297
298check-stage$(1)-T-$(2)-H-$(3)-std-dummy:			\
299		$(3)/test/stdtest.stage$(1)-$(2)$$(X)
300	@$$(call E, run: $$<)
301	$$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) $$(TESTARGS)	\
302	--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-std.log
303
304# Rules for the rustc test runner
305
306$(3)/test/rustctest.stage$(1)-$(2)$$(X):					\
307		$$(COMPILER_CRATE)									\
308		$$(COMPILER_INPUTS)									\
309		$$(SREQ$(1)_T_$(2)_H_$(3))							\
310		$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUSTLLVM)
311	@$$(call E, compile_and_link: $$@)
312	$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
313
314check-stage$(1)-T-$(2)-H-$(3)-rustc-dummy:		\
315		$(3)/test/rustctest.stage$(1)-$(2)$$(X)
316	@$$(call E, run: $$<)
317	$$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) $$(TESTARGS)   \
318	--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-rustc.log
319
320# Rules for the rustdoc test runner
321
322$(3)/test/rustdoctest.stage$(1)-$(2)$$(X):					\
323		$$(RUSTDOC_CRATE) $$(RUSTDOC_INPUTS)		\
324		$$(TSREQ$(1)_T_$(2)_H_$(3))					\
325		$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_CORELIB)  \
326		$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB)   \
327		$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC)
328	@$$(call E, compile_and_link: $$@)
329	$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
330
331check-stage$(1)-T-$(2)-H-$(3)-rustdoc-dummy:		\
332		$(3)/test/rustdoctest.stage$(1)-$(2)$$(X)
333	@$$(call E, run: $$<)
334	$$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) $$(TESTARGS)	\
335	--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-rustdoc.log
336
337# Rules for the cargo test runner
338
339$(3)/test/cargotest.stage$(1)-$(2)$$(X):					\
340		$$(CARGO_CRATE) $$(CARGO_INPUTS)		\
341		$$(TSREQ$(1)_T_$(2)_H_$(3))					\
342		$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_CORELIB)  \
343		$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB)   \
344		$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC)
345	@$$(call E, compile_and_link: $$@)
346	$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
347
348check-stage$(1)-T-$(2)-H-$(3)-cargo-dummy:		\
349		$(3)/test/cargotest.stage$(1)-$(2)$$(X)
350	@$$(call E, run: $$<)
351	$$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) $$(TESTARGS)	\
352	--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-cargo.log
353
354# Rules for the cfail/rfail/rpass/bench/perf test runner
355
356CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) :=						\
357		--compile-lib-path $$(HLIB$(1)_H_$(3))				\
358        --run-lib-path $$(TLIB$(1)_T_$(2)_H_$(3))			\
359        --rustc-path $$(HBIN$(1)_H_$(3))/rustc$$(X)			\
360        --aux-base $$(S)src/test/auxiliary/                 \
361        --stage-id stage$(1)-$(2)							\
362        --rustcflags "$$(CFG_RUSTC_FLAGS) --target=$(2)"	\
363        $$(CTEST_TESTARGS)
364
365CFAIL_ARGS$(1)-T-$(2)-H-$(3) :=					\
366		$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3))	\
367        --src-base $$(S)src/test/compile-fail/	\
368        --build-base $(3)/test/compile-fail/	\
369        --mode compile-fail
370
371RFAIL_ARGS$(1)-T-$(2)-H-$(3) :=					\
372		$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3))	\
373        --src-base $$(S)src/test/run-fail/		\
374        --build-base $(3)/test/run-fail/		\
375        --mode run-fail							\
376        $$(CTEST_RUNTOOL)
377
378RPASS_ARGS$(1)-T-$(2)-H-$(3) :=				\
379		$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3))	\
380        --src-base $$(S)src/test/run-pass/		\
381        --build-base $(3)/test/run-pass/		\
382        --mode run-pass					\
383        $$(CTEST_RUNTOOL)
384
385RPASS_FULL_ARGS$(1)-T-$(2)-H-$(3) :=				\
386		$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3))	\
387        --src-base $$(S)src/test/run-pass-fulldeps/		\
388        --build-base $(3)/test/run-pass-fulldeps/		\
389        --mode run-pass					\
390        $$(CTEST_RUNTOOL)
391
392BENCH_ARGS$(1)-T-$(2)-H-$(3) :=				\
393		$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3))	\
394        --src-base $$(S)src/test/bench/			\
395        --build-base $(3)/test/bench/			\
396        --mode run-pass					\
397        $$(CTEST_RUNTOOL)
398
399PERF_ARGS$(1)-T-$(2)-H-$(3) :=					\
400		$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3))	\
401        --src-base $$(S)src/test/bench/			\
402        --build-base $(3)/test/perf/			\
403        --mode run-pass							\
404        $$(CTEST_PERF_RUNTOOL)
405
406PRETTY_RPASS_ARGS$(1)-T-$(2)-H-$(3) :=			\
407		$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3))	\
408        --src-base $$(S)src/test/run-pass/		\
409        --build-base $(3)/test/run-pass/		\
410        --mode pretty
411
412PRETTY_RPASS_FULL_ARGS$(1)-T-$(2)-H-$(3) :=			\
413		$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3))	\
414        --src-base $$(S)src/test/run-pass-fulldeps/		\
415        --build-base $(3)/test/run-pass-fulldeps/		\
416        --mode pretty
417
418PRETTY_RFAIL_ARGS$(1)-T-$(2)-H-$(3) :=			\
419		$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3))	\
420        --src-base $$(S)src/test/run-fail/		\
421        --build-base $(3)/test/run-fail/		\
422        --mode pretty
423
424PRETTY_BENCH_ARGS$(1)-T-$(2)-H-$(3) :=			\
425		$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3))	\
426        --src-base $$(S)src/test/bench/			\
427        --build-base $(3)/test/bench/			\
428        --mode pretty
429
430PRETTY_PRETTY_ARGS$(1)-T-$(2)-H-$(3) :=			\
431		$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3))	\
432        --src-base $$(S)src/test/pretty/		\
433        --build-base $(3)/test/pretty/			\
434        --mode pretty
435
436DOC_TUTORIAL_ARGS$(1)-T-$(2)-H-$(3) :=			\
437		$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3))	\
438        --src-base $(3)/test/doc-tutorial/		\
439        --build-base $(3)/test/doc-tutorial/		\
440        --mode run-pass
441
442DOC_REF_ARGS$(1)-T-$(2)-H-$(3) :=			\
443		$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3))	\
444        --src-base $(3)/test/doc-ref/			\
445        --build-base $(3)/test/doc-ref/			\
446        --mode run-pass
447
448check-stage$(1)-T-$(2)-H-$(3)-cfail-dummy:		\
449		$$(TEST_SREQ$(1)_T_$(2)_H_$(3))		\
450	        $$(CFAIL_TESTS)
451	@$$(call E, run cfail: $$<)
452	$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
453		$$(CFAIL_ARGS$(1)-T-$(2)-H-$(3)) \
454		--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-cfail.log
455
456check-stage$(1)-T-$(2)-H-$(3)-rfail-dummy:		\
457		$$(TEST_SREQ$(1)_T_$(2)_H_$(3))		\
458		$$(RFAIL_TESTS)
459	@$$(call E, run rfail: $$<)
460	$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
461		$$(RFAIL_ARGS$(1)-T-$(2)-H-$(3)) \
462		--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-rfail.log
463
464check-stage$(1)-T-$(2)-H-$(3)-rpass-dummy:		\
465		$$(TEST_SREQ$(1)_T_$(2)_H_$(3))		\
466	        $$(RPASS_TESTS)
467	@$$(call E, run rpass-full: $$<)
468	$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
469		$$(RPASS_ARGS$(1)-T-$(2)-H-$(3)) \
470		--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-rpass.log
471
472check-stage$(1)-T-$(2)-H-$(3)-rpass-full-dummy:		\
473		$$(FULL_TEST_SREQ$(1)_T_$(2)_H_$(3))		\
474	        $$(RPASS_FULL_TESTS)
475	@$$(call E, run rpass: $$<)
476	$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
477		$$(RPASS_FULL_ARGS$(1)-T-$(2)-H-$(3)) \
478		--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-rpass-full.log
479
480check-stage$(1)-T-$(2)-H-$(3)-bench-dummy:		\
481		$$(TEST_SREQ$(1)_T_$(2)_H_$(3))		\
482		$$(BENCH_TESTS)
483	@$$(call E, run bench: $$<)
484	$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
485		$$(BENCH_ARGS$(1)-T-$(2)-H-$(3)) \
486		--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-bench.log
487
488check-stage$(1)-T-$(2)-H-$(3)-perf-dummy:		\
489	        $$(TEST_SREQ$(1)_T_$(2)_H_$(3))		\
490	        $$(BENCH_TESTS)
491	@$$(call E, perf: $$<)
492	$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
493		$$(PERF_ARGS$(1)-T-$(2)-H-$(3)) \
494		--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-perf.log
495
496check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-dummy:	\
497	        $$(TEST_SREQ$(1)_T_$(2)_H_$(3))		\
498	        $$(RPASS_TESTS)
499	@$$(call E, run pretty-rpass: $$<)
500	$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
501		$$(PRETTY_RPASS_ARGS$(1)-T-$(2)-H-$(3)) \
502		--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass.log
503
504check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-full-dummy:	\
505	        $$(FULL_TEST_SREQ$(1)_T_$(2)_H_$(3))		\
506	        $$(RPASS_FULL_TESTS)
507	@$$(call E, run pretty-rpass-full: $$<)
508	$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
509		$$(PRETTY_RPASS_FULL_ARGS$(1)-T-$(2)-H-$(3)) \
510		--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-full.log
511
512check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail-dummy:	\
513	        $$(TEST_SREQ$(1)_T_$(2)_H_$(3))		\
514	        $$(RFAIL_TESTS)
515	@$$(call E, run pretty-rfail: $$<)
516	$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
517		$$(PRETTY_RFAIL_ARGS$(1)-T-$(2)-H-$(3)) \
518		--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail.log
519
520check-stage$(1)-T-$(2)-H-$(3)-pretty-bench-dummy:	\
521		$$(TEST_SREQ$(1)_T_$(2)_H_$(3))		\
522	        $$(BENCH_TESTS)
523	@$$(call E, run pretty-bench: $$<)
524	$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
525		$$(PRETTY_BENCH_ARGS$(1)-T-$(2)-H-$(3)) \
526		--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-pretty-bench.log
527
528check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty-dummy:	\
529	        $$(TEST_SREQ$(1)_T_$(2)_H_$(3))		\
530	        $$(PRETTY_TESTS)
531	@$$(call E, run pretty-pretty: $$<)
532	$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
533		$$(PRETTY_PRETTY_ARGS$(1)-T-$(2)-H-$(3)) \
534		--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty.log
535
536check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial-dummy:       \
537	        $$(TEST_SREQ$(1)_T_$(2)_H_$(3))		\
538                doc-tutorial-extract$(3)
539	@$$(call E, run doc-tutorial: $$<)
540	$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
541                $$(DOC_TUTORIAL_ARGS$(1)-T-$(2)-H-$(3)) \
542		--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-doc-tutorial.log
543
544check-stage$(1)-T-$(2)-H-$(3)-doc-ref-dummy:            \
545	        $$(TEST_SREQ$(1)_T_$(2)_H_$(3))		\
546                doc-ref-extract$(3)
547	@$$(call E, run doc-ref: $$<)
548	$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
549                $$(DOC_REF_ARGS$(1)-T-$(2)-H-$(3)) \
550		--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-doc-ref.log
551
552endef
553
554# Instantiate the template for stage 0, 1, 2, 3
555
556$(foreach host,$(CFG_TARGET_TRIPLES), \
557 $(eval $(foreach target,$(CFG_TARGET_TRIPLES), \
558  $(eval $(foreach stage,$(STAGES), \
559   $(eval $(call TEST_STAGEN,$(stage),$(target),$(host))))))))
560
561######################################################################
562# Fast-test rules
563######################################################################
564
565GENERATED += tmp/$(FT).rc tmp/$(FT_DRIVER).rs
566
567tmp/$(FT).rc tmp/$(FT_DRIVER).rs: \
568		$(RPASS_TESTS) \
569		$(S)src/etc/combine-tests.py
570	@$(call E, check: building combined stage2 test runner)
571	$(Q)$(S)src/etc/combine-tests.py
572
573define DEF_CHECK_FAST_FOR_T_H
574# $(1) unused
575# $(2) target triple
576# $(3) host triple
577
578$$(TLIB2_T_$(2)_H_$(3))/$$(FT_LIB): \
579		tmp/$$(FT).rc \
580		$$(SREQ2_T_$(2)_H_$(3))
581	@$$(call E, compile_and_link: $$@)
582	$$(STAGE2_T_$(2)_H_$(3)) --lib -o $$@ $$<
583
584$(3)/test/$$(FT_DRIVER)-$(2)$$(X): \
585		tmp/$$(FT_DRIVER).rs \
586		$$(TLIB2_T_$(2)_H_$(3))/$$(FT_LIB) \
587		$$(SREQ2_T_$(2)_H_$(3))
588	@$$(call E, compile_and_link: $$@ $$<)
589	$$(STAGE2_T_$(2)_H_$(3)) -o $$@ $$<
590
591$(3)/test/$$(FT_DRIVER)-$(2).out: \
592		$(3)/test/$$(FT_DRIVER)-$(2)$$(X) \
593		$$(SREQ2_T_$(2)_H_$(3))
594	$$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) \
595	--logfile tmp/$$(FT_DRIVER)-$(2).log
596
597check-fast-T-$(2)-H-$(3): tidy			\
598	check-stage2-T-$(2)-H-$(3)-rustc	\
599	check-stage2-T-$(2)-H-$(3)-core		\
600	check-stage2-T-$(2)-H-$(3)-std		\
601	$(3)/test/$$(FT_DRIVER)-$(2).out
602
603endef
604
605$(foreach host,$(CFG_TARGET_TRIPLES), \
606 $(eval $(foreach target,$(CFG_TARGET_TRIPLES), \
607   $(eval $(call DEF_CHECK_FAST_FOR_T_H,,$(target),$(host))))))
608
609######################################################################
610# Shortcut rules
611######################################################################
612
613define DEF_CHECK_FOR_STAGE_H
614
615check-stage$(1)-H-$(2):					\
616	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
617	 check-stage$(1)-T-$$(target)-H-$(2))
618check-stage$(1)-H-$(2)-perf:					\
619	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
620	 check-stage$(1)-T-$$(target)-H-$(2)-perf)
621check-stage$(1)-H-$(2)-rustc:					\
622	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
623	 check-stage$(1)-T-$$(target)-H-$(2)-rustc)
624check-stage$(1)-H-$(2)-core:					\
625	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
626	 check-stage$(1)-T-$$(target)-H-$(2)-core)
627check-stage$(1)-H-$(2)-std:					\
628	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
629	 check-stage$(1)-T-$$(target)-H-$(2)-std)
630check-stage$(1)-H-$(2)-rpass:					\
631	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
632	 check-stage$(1)-T-$$(target)-H-$(2)-rpass)
633check-stage$(1)-H-$(2)-rpass-full:					\
634	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
635	 check-stage$(1)-T-$$(target)-H-$(2)-rpass-full)
636check-stage$(1)-H-$(2)-rfail:					\
637	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
638	 check-stage$(1)-T-$$(target)-H-$(2)-rfail)
639check-stage$(1)-H-$(2)-cfail:					\
640	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
641	 check-stage$(1)-T-$$(target)-H-$(2)-cfail)
642check-stage$(1)-H-$(2)-bench:					\
643	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
644	 check-stage$(1)-T-$$(target)-H-$(2)-bench)
645check-stage$(1)-H-$(2)-pretty:					\
646	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
647	 check-stage$(1)-T-$$(target)-H-$(2)-pretty)
648check-stage$(1)-H-$(2)-pretty-rpass:				\
649	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
650	 check-stage$(1)-T-$$(target)-H-$(2)-pretty-rpass)
651check-stage$(1)-H-$(2)-pretty-rpass-full:				\
652	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
653	 check-stage$(1)-T-$$(target)-H-$(2)-pretty-rpass-full)
654check-stage$(1)-H-$(2)-pretty-rfail:				\
655	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
656	 check-stage$(1)-T-$$(target)-H-$(2)-pretty-rfail)
657check-stage$(1)-H-$(2)-pretty-bench:				\
658	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
659	 check-stage$(1)-T-$$(target)-H-$(2)-pretty-bench)
660check-stage$(1)-H-$(2)-pretty-pretty:				\
661	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
662	 check-stage$(1)-T-$$(target)-H-$(2)-pretty-pretty)
663check-stage$(1)-H-$(2)-rustdoc:					\
664	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
665	 check-stage$(1)-T-$$(target)-H-$(2)-rustdoc)
666check-stage$(1)-H-$(2)-cargo:					\
667	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
668	 check-stage$(1)-T-$$(target)-H-$(2)-cargo)
669check-stage$(1)-H-$(2)-doc-tutorial:				\
670	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
671	 check-stage$(1)-T-$$(target)-H-$(2)-doc-tutorial)
672check-stage$(1)-H-$(2)-doc-ref:				\
673	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
674	 check-stage$(1)-T-$$(target)-H-$(2)-doc-ref)
675
676endef
677
678$(foreach stage,$(STAGES),					\
679 $(eval $(foreach target,$(CFG_TARGET_TRIPLES),			\
680  $(eval $(call DEF_CHECK_FOR_STAGE_H,$(stage),$(target))))))
681
682define DEF_CHECK_FAST_FOR_H
683
684check-fast-H-$(1): 		check-fast-T-$(1)-H-$(1)
685
686endef
687
688$(foreach target,$(CFG_TARGET_TRIPLES),			\
689 $(eval $(call DEF_CHECK_FAST_FOR_H,$(target))))
690
691define DEF_CHECK_ALL_FOR_STAGE
692
693check-stage$(1)-H-all: \
694	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
695	 check-stage$(1)-H-$$(target))
696check-stage$(1)-H-all-perf: \
697	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
698	 check-stage$(1)-H-$$(target)-perf)
699check-stage$(1)-H-all-rustc: \
700	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
701	 check-stage$(1)-H-$$(target)-rustc)
702check-stage$(1)-H-all-core: \
703	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
704	 check-stage$(1)-H-$$(target)-core)
705check-stage$(1)-H-all-std: \
706	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
707	 check-stage$(1)-H-$$(target)-std)
708check-stage$(1)-H-all-rpass: \
709	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
710	 check-stage$(1)-H-$$(target)-rpass)
711check-stage$(1)-H-all-rpass-full: \
712	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
713	 check-stage$(1)-H-$$(target)-rpass-full)
714check-stage$(1)-H-all-rfail: \
715	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
716	 check-stage$(1)-H-$$(target)-rfail)
717check-stage$(1)-H-all-cfail: \
718	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
719	 check-stage$(1)-H-$$(target)-cfail)
720check-stage$(1)-H-all-bench: \
721	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
722	 check-stage$(1)-H-$$(target)-bench)
723check-stage$(1)-H-all-pretty: \
724	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
725	 check-stage$(1)-H-$$(target)-pretty)
726check-stage$(1)-H-all-pretty-rpass: \
727	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
728	 check-stage$(1)-H-$$(target)-pretty-rpass)
729check-stage$(1)-H-all-pretty-rpass-full: \
730	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
731	 check-stage$(1)-H-$$(target)-pretty-rpass-full)
732check-stage$(1)-H-all-pretty-rfail: \
733	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
734	 check-stage$(1)-H-$$(target)-pretty-rfail)
735check-stage$(1)-H-all-pretty-bench: \
736	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
737	 check-stage$(1)-H-$$(target)-pretty-bench)
738check-stage$(1)-H-all-pretty-pretty: \
739	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
740	 check-stage$(1)-H-$$(target)-pretty-pretty)
741check-stage$(1)-H-all-rustdoc: \
742	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
743	 check-stage$(1)-H-$$(target)-rustdoc)
744check-stage$(1)-H-all-cargo: \
745	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
746	 check-stage$(1)-H-$$(target)-cargo)
747check-stage$(1)-H-all-doc-tutorial: \
748	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
749	 check-stage$(1)-H-$$(target)-doc-tutorial)
750check-stage$(1)-H-all-doc-ref: \
751	$$(foreach target,$$(CFG_TARGET_TRIPLES),	\
752	 check-stage$(1)-H-$$(target)-doc-ref)
753
754endef
755
756$(foreach stage,$(STAGES),						\
757 $(eval $(call DEF_CHECK_ALL_FOR_STAGE,$(stage))))
758
759define DEF_CHECK_FOR_STAGE
760
761check-stage$(1): check-stage$(1)-H-$$(CFG_HOST_TRIPLE)
762check-stage$(1)-perf: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-perf
763check-stage$(1)-rustc: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-rustc
764check-stage$(1)-core: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-core
765check-stage$(1)-std: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-std
766check-stage$(1)-rpass: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-rpass
767check-stage$(1)-rpass-full: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-rpass-full
768check-stage$(1)-rfail: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-rfail
769check-stage$(1)-cfail: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-cfail
770check-stage$(1)-bench: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-bench
771check-stage$(1)-pretty: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-pretty
772check-stage$(1)-pretty-rpass: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-pretty-rpass
773check-stage$(1)-pretty-rpass-full: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-pretty-rpass-full
774check-stage$(1)-pretty-rfail: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-pretty-rfail
775check-stage$(1)-pretty-bench: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-pretty-bench
776check-stage$(1)-pretty-pretty: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-pretty-pretty
777check-stage$(1)-rustdoc: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-rustdoc
778check-stage$(1)-cargo: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-cargo
779check-stage$(1)-doc-tutorial: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-doc-tutorial
780check-stage$(1)-doc-ref: check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-doc-ref
781
782endef
783
784$(foreach stage,$(STAGES),						\
785 $(eval $(call DEF_CHECK_FOR_STAGE,$(stage))))
786
787check-fast: check-fast-H-$(CFG_HOST_TRIPLE)