Skip to content

Commit 64ae589

Browse files
committed
---
yaml --- r: 5655 b: refs/heads/master c: 9be0dc1 h: refs/heads/master i: 5653: ccb02d0 5651: 37fe870 5647: 4396837 v: v3
1 parent 4f71b00 commit 64ae589

File tree

2 files changed

+82
-107
lines changed

2 files changed

+82
-107
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 3a6f3cf275061c03c8169ce50779efbda0faa845
2+
refs/heads/master: 9be0dc1250aaf657d9c50d4f98aacb73a9aa832c

trunk/mk/tests.mk

Lines changed: 81 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -88,217 +88,192 @@ tidy:
8888
$(S)src/etc/%, $(PKG_FILES)) \
8989
| xargs -n 10 python $(S)src/etc/tidy.py
9090

91-
# Cancel the implicit .out rule in GNU make
92-
%.out: %
93-
94-
%.out: %.out.tmp
95-
$(Q)mv $< $@
96-
9791

9892
######################################################################
9993
# Rules for the test runners
10094
######################################################################
10195

102-
# StageN template: to stay consistent with stageN.mk, arge 2 is the
103-
# stage being tested, arg 1 is stage N-1
104-
10596
define TEST_STAGEN
10697

107-
# FIXME: These rules are complicated by a scheme to produce .out files
108-
# for each test, with the idea that if the targets produce actual
109-
# output, subsequent "make check's" will just exit successfully
110-
# without re-running the tests. Unfortunately this scheme is currently
111-
# broken and the tests rerun with every invocation of "make check"
112-
# anyway. Nobody seems to have noticed, so it would be simpler to just
113-
# remove all the code here involved with producing .out files.
98+
# All the per-stage build rules you might want to call from the
99+
# command line
114100

115-
check-stage$(2): tidy \
116-
check-stage$(2)-rustc \
117-
check-stage$(2)-std \
118-
check-stage$(2)-rpass \
119-
check-stage$(2)-rfail \
120-
check-stage$(2)-cfail \
121-
check-stage$(2)-bench \
122-
check-stage$(2)-pretty \
101+
check-stage$(1): tidy \
102+
check-stage$(1)-rustc \
103+
check-stage$(1)-std \
104+
check-stage$(1)-rpass \
105+
check-stage$(1)-rfail \
106+
check-stage$(1)-cfail \
107+
check-stage$(1)-bench \
108+
check-stage$(1)-pretty
123109

110+
check-stage$(1)-std: check-stage$(1)-std-dummy
124111

125-
# Rules for the standard library test runner
112+
check-stage$(1)-rustc: check-stage$(1)-rustc-dummy
126113

127-
check-stage$(2)-std: test/stdtest.stage$(2).out \
114+
check-stage$(1)-cfail: check-stage$(1)-cfail-dummy
128115

129-
test/stdtest.stage$(2)$$(X): $$(STDTEST_CRATE) $$(STDTEST_INPUTS) \
130-
$$(SREQ$(2)$$(CFG_HOST_TRIPLE))
131-
@$$(call E, compile_and_link: $$@)
132-
$$(STAGE$(2)) -o $$@ $$< --test
116+
check-stage$(1)-rfail: check-stage$(1)-rfail-dummy
133117

134-
test/stdtest.stage$(2).out.tmp: test/stdtest.stage$(2)$$(X)
135-
@$$(call E, run: $$<)
136-
$$(Q)$$(call CFG_RUN_TEST,$$<) $$(TESTARGS)
137-
$$(Q)touch $$@
118+
check-stage$(1)-rpass: check-stage$(1)-rpass-dummy
138119

120+
check-stage$(1)-bench: check-stage$(1)-bench-dummy
139121

140-
# Rules for the rustc test runner
122+
check-stage$(1)-perf: check-stage$(1)-perf-dummy
141123

142-
check-stage$(2)-rustc: test/rustctest.stage$(2).out \
124+
check-stage$(1)-pretty: check-stage$(1)-pretty-rpass \
125+
check-stage$(1)-pretty-rfail \
126+
check-stage$(1)-pretty-bench \
127+
check-stage$(1)-pretty-pretty
143128

144-
test/rustctest.stage$(2)$$(X): $$(COMPILER_CRATE) $$(COMPILER_INPUTS) \
145-
$$(HOST_LIB$(2))/$$(CFG_RUNTIME) \
146-
$$(HOST_STDLIB_DEFAULT$(2)) \
147-
$$(HOST_LIB$(2))/$$(CFG_RUSTLLVM) \
148-
$$(SREQ$(1)$$(CFG_HOST_TRIPLE))
149-
@$$(call E, compile_and_link: $$@)
150-
$$(STAGE$(1)) -L $$(HOST_LIB$(2)) -o $$@ $$< --test
129+
check-stage$(1)-pretty-rpass: check-stage$(1)-pretty-rpass-dummy
151130

152-
test/rustctest.stage$(2).out.tmp: test/rustctest.stage$(2)$$(X)
153-
@$$(call E, run: $$<)
154-
$$(Q)$$(call CFG_RUN,$$(HOST_LIB$(2)),$$(CFG_VALGRIND) $$<) \
155-
$$(TESTARGS)
156-
$$(Q)touch $$@
131+
check-stage$(1)-pretty-rfail: check-stage$(1)-pretty-rfail-dummy
157132

133+
check-stage$(1)-pretty-bench: check-stage$(1)-pretty-bench-dummy
158134

159-
# Rules for the cfail/rfail/rpass/bench/perf test runner
135+
check-stage$(1)-pretty-pretty: check-stage$(1)-pretty-pretty-dummy
160136

161-
check-stage$(2)-cfail: test/compile-fail.stage$(2).out \
162137

163-
check-stage$(2)-rfail: test/run-fail.stage$(2).out \
138+
# Rules for the standard library test runner
164139

165-
check-stage$(2)-rpass: test/run-pass.stage$(2).out \
140+
test/stdtest.stage$(1)$$(X): $$(STDTEST_CRATE) $$(STDTEST_INPUTS) \
141+
$$(SREQ$(1)$$(CFG_HOST_TRIPLE))
142+
@$$(call E, compile_and_link: $$@)
143+
$$(STAGE$(1)) -o $$@ $$< --test
166144

167-
check-stage$(2)-bench: test/bench.stage$(2).out \
145+
check-stage$(1)-std-dummy: test/stdtest.stage$(1)$$(X)
146+
@$$(call E, run: $$<)
147+
$$(Q)$$(call CFG_RUN_TEST,$$<) $$(TESTARGS)
168148

169-
check-stage$(2)-perf: test/perf.stage$(2).out \
170149

171-
check-stage$(2)-pretty-rpass: test/pretty-rpass.stage$(2).out \
150+
# Rules for the rustc test runner
172151

173-
check-stage$(2)-pretty-rfail: test/pretty-rfail.stage$(2).out \
152+
test/rustctest.stage$(1)$$(X): \
153+
$$(COMPILER_CRATE) $$(COMPILER_INPUTS) \
154+
$$(TARGET_SREQ$(1)$$(CFG_HOST_TRPILE)) \
155+
$$(HOST_LIB$(1))/$$(CFG_RUSTLLVM) \
156+
$$(TARGET_LIB$(1)$$(CFG_HOST_TRIPLE))/$$(CFG_RUSTLLVM)
157+
@$$(call E, compile_and_link: $$@)
158+
$$(STAGE$(1)) -o $$@ $$< --test
174159

175-
check-stage$(2)-pretty-bench: test/pretty-bench.stage$(2).out \
160+
check-stage$(1)-rustc-dummy: test/rustctest.stage$(1)$$(X)
161+
@$$(call E, run: $$<)
162+
$$(Q)$$(call CFG_RUN,$$(HOST_LIB$(1)),$$(CFG_VALGRIND) $$<) \
163+
$$(TESTARGS)
176164

177-
check-stage$(2)-pretty-pretty: test/pretty-pretty.stage$(2).out \
178165

179-
check-stage$(2)-pretty: check-stage$(2)-pretty-rpass \
180-
check-stage$(2)-pretty-rfail \
181-
check-stage$(2)-pretty-bench \
182-
check-stage$(2)-pretty-pretty \
166+
# Rules for the cfail/rfail/rpass/bench/perf test runner
183167

184-
CTEST_COMMON_ARGS$(2) := --compile-lib-path $$(HOST_LIB$(2)) \
185-
--run-lib-path $$(TARGET_LIB$(2)$$(CFG_HOST_TRIPLE)) \
186-
--rustc-path $$(HOST_BIN$(2))/rustc$$(X) \
187-
--stage-id stage$(2) \
168+
CTEST_COMMON_ARGS$(1) := --compile-lib-path $$(HOST_LIB$(1)) \
169+
--run-lib-path $$(TARGET_LIB$(1)$$(CFG_HOST_TRIPLE)) \
170+
--rustc-path $$(HOST_BIN$(1))/rustc$$(X) \
171+
--stage-id stage$(1) \
188172
--rustcflags "$$(CFG_RUSTC_FLAGS)" \
189173
$$(CTEST_TESTARGS) \
190174

191-
CFAIL_ARGS$(2) := $$(CTEST_COMMON_ARGS$(2)) \
175+
CFAIL_ARGS$(1) := $$(CTEST_COMMON_ARGS$(1)) \
192176
--src-base $$(S)src/test/compile-fail/ \
193177
--build-base test/compile-fail/ \
194178
--mode compile-fail \
195179

196-
RFAIL_ARGS$(2) := $$(CTEST_COMMON_ARGS$(2)) \
180+
RFAIL_ARGS$(1) := $$(CTEST_COMMON_ARGS$(1)) \
197181
--src-base $$(S)src/test/run-fail/ \
198182
--build-base test/run-fail/ \
199183
--mode run-fail \
200184
$$(CTEST_RUNTOOL) \
201185

202-
RPASS_ARGS$(2) := $$(CTEST_COMMON_ARGS$(2)) \
186+
RPASS_ARGS$(1) := $$(CTEST_COMMON_ARGS$(1)) \
203187
--src-base $$(S)src/test/run-pass/ \
204188
--build-base test/run-pass/ \
205189
--mode run-pass \
206190
$$(CTEST_RUNTOOL) \
207191

208-
BENCH_ARGS$(2) := $$(CTEST_COMMON_ARGS$(2)) \
192+
BENCH_ARGS$(1) := $$(CTEST_COMMON_ARGS$(1)) \
209193
--src-base $$(S)src/test/bench/ \
210194
--build-base test/bench/ \
211195
--mode run-pass \
212196
$$(CTEST_RUNTOOL) \
213197

214-
PERF_ARGS$(2) := $$(CTEST_COMMON_ARGS$(2)) \
198+
PERF_ARGS$(1) := $$(CTEST_COMMON_ARGS$(1)) \
215199
--src-base $$(S)src/test/bench/ \
216200
--build-base test/perf/ \
217201
--mode run-pass \
218202
$$(CTEST_PERF_RUNTOOL) \
219203

220-
PRETTY_RPASS_ARGS$(2) := $$(CTEST_COMMON_ARGS$(2)) \
204+
PRETTY_RPASS_ARGS$(1) := $$(CTEST_COMMON_ARGS$(1)) \
221205
--src-base $$(S)src/test/run-pass/ \
222206
--build-base test/run-pass/ \
223207
--mode pretty \
224208

225-
PRETTY_RFAIL_ARGS$(2) := $$(CTEST_COMMON_ARGS$(2)) \
209+
PRETTY_RFAIL_ARGS$(1) := $$(CTEST_COMMON_ARGS$(1)) \
226210
--src-base $$(S)src/test/run-fail/ \
227211
--build-base test/run-fail/ \
228212
--mode pretty \
229213

230-
PRETTY_BENCH_ARGS$(2) := $$(CTEST_COMMON_ARGS$(2)) \
214+
PRETTY_BENCH_ARGS$(1) := $$(CTEST_COMMON_ARGS$(1)) \
231215
--src-base $$(S)src/test/bench/ \
232216
--build-base test/bench/ \
233217
--mode pretty \
234218

235-
PRETTY_PRETTY_ARGS$(2) := $$(CTEST_COMMON_ARGS$(2)) \
219+
PRETTY_PRETTY_ARGS$(1) := $$(CTEST_COMMON_ARGS$(1)) \
236220
--src-base $$(S)src/test/pretty/ \
237221
--build-base test/pretty/ \
238222
--mode pretty \
239223

240-
test/compile-fail.stage$(2).out.tmp: $$(HOST_BIN$(2))/compiletest$$(X) \
224+
check-stage$(1)-cfail-dummy: $$(HOST_BIN$(1))/compiletest$$(X) \
241225
$$(CFAIL_TESTS)
242226
@$$(call E, run: $$<)
243-
$$(Q)$$(call CFG_RUN_CTEST,$(2),$$<) $$(CFAIL_ARGS$(2))
244-
$$(Q)touch $$@
227+
$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<) $$(CFAIL_ARGS$(1))
245228

246-
test/run-fail.stage$(2).out.tmp: $$(HOST_BIN$(2))/compiletest$$(X) \
229+
check-stage$(1)-rfail-dummy: $$(HOST_BIN$(1))/compiletest$$(X) \
247230
$$(RFAIL_TESTS)
248231
@$$(call E, run: $$<)
249-
$$(Q)$$(call CFG_RUN_CTEST,$(2),$$<) $$(RFAIL_ARGS$(2))
250-
$$(Q)touch $$@
232+
$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<) $$(RFAIL_ARGS$(1))
251233

252-
test/run-pass.stage$(2).out.tmp: $$(HOST_BIN$(2))/compiletest$$(X) \
234+
check-stage$(1)-rpass-dummy: $$(HOST_BIN$(1))/compiletest$$(X) \
253235
$$(RPASS_TESTS)
254236
@$$(call E, run: $$<)
255-
$$(Q)$$(call CFG_RUN_CTEST,$(2),$$<) $$(RPASS_ARGS$(2))
256-
$$(Q)touch $$@
237+
$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<) $$(RPASS_ARGS$(1))
257238

258-
test/bench.stage$(2).out.tmp: $$(HOST_BIN$(2))/compiletest$$(X) \
239+
check-stage$(1)-bench-dummy: $$(HOST_BIN$(1))/compiletest$$(X) \
259240
$$(BENCH_TESTS)
260241
@$$(call E, run: $$<)
261-
$$(Q)$$(call CFG_RUN_CTEST,$(2),$$<) $$(BENCH_ARGS$(2))
262-
$$(Q)touch $$@
242+
$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<) $$(BENCH_ARGS$(1))
263243

264-
test/perf.stage$(2).out.tmp: $$(HOST_BIN$(2))/compiletest$$(X) \
244+
check-stage$(1)-perf-dummy: $$(HOST_BIN$(1))/compiletest$$(X) \
265245
$$(BENCH_TESTS)
266246
@$$(call E, perf: $$<)
267-
$$(Q)$$(call CFG_RUN_CTEST,$(2),$$<) $$(PERF_ARGS$(2))
268-
$$(Q)touch $$@
247+
$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<) $$(PERF_ARGS$(1))
269248

270-
test/pretty-rpass.stage$(2).out.tmp: $$(HOST_BIN$(2))/compiletest$$(X) \
249+
check-stage$(1)-pretty-rpass-dummy: $$(HOST_BIN$(1))/compiletest$$(X) \
271250
$$(RPASS_TESTS)
272251
@$$(call E, run: $$<)
273-
$$(Q)$$(call CFG_RUN_CTEST,$(2),$$<) $$(PRETTY_RPASS_ARGS$(2))
274-
$$(Q)touch $$@
252+
$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<) $$(PRETTY_RPASS_ARGS$(1))
275253

276-
test/pretty-rfail.stage$(2).out.tmp: $$(HOST_BIN$(2))/compiletest$$(X) \
254+
check-stage$(1)-pretty-rfail-dummy: $$(HOST_BIN$(1))/compiletest$$(X) \
277255
$$(RFAIL_TESTS)
278256
@$$(call E, run: $$<)
279-
$$(Q)$$(call CFG_RUN_CTEST,$(2),$$<) $$(PRETTY_RFAIL_ARGS$(2))
280-
$$(Q)touch $$@
257+
$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<) $$(PRETTY_RFAIL_ARGS$(1))
281258

282-
test/pretty-bench.stage$(2).out.tmp: $$(HOST_BIN$(2))/compiletest$$(X) \
259+
check-stage$(1)-pretty-bench-dummy: $$(HOST_BIN$(1))/compiletest$$(X) \
283260
$$(BENCH_TESTS)
284261
@$$(call E, run: $$<)
285-
$$(Q)$$(call CFG_RUN_CTEST,$(2),$$<) $$(PRETTY_BENCH_ARGS$(2))
286-
$$(Q)touch $$@
262+
$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<) $$(PRETTY_BENCH_ARGS$(1))
287263

288-
test/pretty-pretty.stage$(2).out.tmp: $$(HOST_BIN$(2))/compiletest$$(X) \
264+
check-stage$(1)-pretty-pretty-dummy: $$(HOST_BIN$(1))/compiletest$$(X) \
289265
$$(PRETTY_TESTS)
290266
@$$(call E, run: $$<)
291-
$$(Q)$$(call CFG_RUN_CTEST,$(2),$$<) $$(PRETTY_PRETTY_ARGS$(2))
292-
$$(Q)touch $$@
267+
$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<) $$(PRETTY_PRETTY_ARGS$(1))
293268

294269
endef
295270

296271
# Instantiate the template for stage 0, 1, 2, 3
297272

298-
$(eval $(call TEST_STAGEN,0,0))
299-
$(eval $(call TEST_STAGEN,0,1))
300-
$(eval $(call TEST_STAGEN,1,2))
301-
$(eval $(call TEST_STAGEN,2,3))
273+
$(eval $(call TEST_STAGEN,0))
274+
$(eval $(call TEST_STAGEN,1))
275+
$(eval $(call TEST_STAGEN,2))
276+
$(eval $(call TEST_STAGEN,3))
302277

303278

304279
######################################################################

0 commit comments

Comments
 (0)