Skip to content

Commit b72069f

Browse files
committed
mk: Add output files to tests so they don't rerun unnecessarily
1 parent 1970c9c commit b72069f

File tree

2 files changed

+29
-15
lines changed

2 files changed

+29
-15
lines changed

mk/clean.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ clean-misc:
4848
$(Q)rm -f $(RUSTLLVM_LIB_OBJS) $(RUSTLLVM_OBJS_OBJS) $(RUSTLLVM_DEF)
4949
$(Q)rm -Rf $(DOCS)
5050
$(Q)rm -Rf $(GENERATED)
51-
$(Q)rm -f tmp/*.log tmp/*.rc tmp/*.rs
51+
$(Q)rm -f tmp/*.log tmp/*.rc tmp/*.rs tmp/*.ok
5252
$(Q)rm -Rf rust-stage0-*.tar.bz2 $(PKG_NAME)-*.tar.gz dist
5353
$(Q)rm -Rf $(foreach ext, \
5454
html aux cp fn ky log pdf pg toc tp vr cps, \

mk/tests.mk

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ ifeq ($(MAKECMDGOALS),perf)
6262
export RUST_BENCH
6363
endif
6464

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
6567

6668
######################################################################
6769
# Main test targets
@@ -251,11 +253,14 @@ $(foreach host,$(CFG_TARGET_TRIPLES), \
251253
$(eval $(call TEST_RUNNER,$(stage),$(target),$(host))))))))
252254

253255
define DEF_TEST_CRATE_RULES
254-
check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: \
256+
check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
257+
258+
$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
255259
$(3)/test/$(4)test.stage$(1)-$(2)$$(X)
256260
@$$(call E, run: $$<)
257261
$$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) $$(TESTARGS) \
258-
--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
262+
--logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
263+
&& touch $$@
259264
endef
260265

261266
$(foreach host,$(CFG_TARGET_TRIPLES), \
@@ -347,12 +352,12 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
347352
--rustcflags "$$(CFG_RUSTC_FLAGS) --target=$(2)" \
348353
$$(CTEST_TESTARGS)
349354

350-
CTEST_DEPS_rpass_$(1)-T-$(2)-H-$(3) = $((RPASS_TESTS))
351-
CTEST_DEPS_rpass_full_$(1)-T-$(2)-H-$(3) = $((RPASS_FULL_TESTS)) $$(TLIBRUSTC_DEFAULT$(1)_T_$(2)_H_$(3))
352-
CTEST_DEPS_rfail_$(1)-T-$(2)-H-$(3) = $((RFAIL_TESTS))
353-
CTEST_DEPS_cfail_$(1)-T-$(2)-H-$(3) = $((CFAIL_TESTS))
354-
CTEST_DEPS_bench_$(1)-T-$(2)-H-$(3) = $((BENCH_TESTS))
355-
CTEST_DEPS_perf_$(1)-T-$(2)-H-$(3) = $((PERF_TESTS))
355+
CTEST_DEPS_rpass_$(1)-T-$(2)-H-$(3) = $$(RPASS_TESTS)
356+
CTEST_DEPS_rpass_full_$(1)-T-$(2)-H-$(3) = $$(RPASS_FULL_TESTS) $$(TLIBRUSTC_DEFAULT$(1)_T_$(2)_H_$(3))
357+
CTEST_DEPS_rfail_$(1)-T-$(2)-H-$(3) = $$(RFAIL_TESTS)
358+
CTEST_DEPS_cfail_$(1)-T-$(2)-H-$(3) = $$(CFAIL_TESTS)
359+
CTEST_DEPS_bench_$(1)-T-$(2)-H-$(3) = $$(BENCH_TESTS)
360+
CTEST_DEPS_perf_$(1)-T-$(2)-H-$(3) = $$(PERF_TESTS)
356361

357362
endef
358363

@@ -370,13 +375,16 @@ CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4) := \
370375
--mode $$(CTEST_MODE_$(4)) \
371376
$$(CTEST_RUNTOOL_$(4))
372377

373-
check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: \
378+
check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
379+
380+
$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
374381
$$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
375382
$$(CTEST_DEPS_$(4)_$(1)-T-$(2)-H-$(3))
376383
@$$(call E, run $(4): $$<)
377384
$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
378385
$$(CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
379-
--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
386+
--logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
387+
&& touch $$@
380388

381389
endef
382390

@@ -408,13 +416,16 @@ PRETTY_ARGS$(1)-T-$(2)-H-$(3)-$(4) := \
408416
--build-base $(3)/test/$$(PRETTY_DIRNAME_$(4))/ \
409417
--mode pretty
410418

411-
check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: \
419+
check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
420+
421+
$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
412422
$$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
413423
$$(PRETTY_DEPS_$(4))
414424
@$$(call E, run pretty-rpass: $$<)
415425
$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
416426
$$(PRETTY_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
417-
--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
427+
--logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
428+
&& touch $$@
418429

419430
endef
420431

@@ -432,13 +443,16 @@ DOC_TEST_ARGS$(1)-T-$(2)-H-$(3)-$(4) := \
432443
--build-base $(3)/test/doc-$(4)/ \
433444
--mode run-pass
434445

435-
check-stage$(1)-T-$(2)-H-$(3)-doc-$(4)-exec: \
446+
check-stage$(1)-T-$(2)-H-$(3)-doc-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
447+
448+
$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
436449
$$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
437450
doc-$(4)-extract$(3)
438451
@$$(call E, run doc-$(4): $$<)
439452
$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
440453
$$(DOC_TEST_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
441-
--logfile tmp/check-stage$(1)-T-$(2)-H-$(3)-doc-$(4).log
454+
--logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),doc-$(4)) \
455+
&& touch $$@
442456

443457
endef
444458

0 commit comments

Comments
 (0)