Make build timestamp files robust in face of concurrent source modification.
Strategy: If the end goal is to touch e.g. `stamp.std`, then we first touch `stamp.std.start_time` before doing anything else. Then when the receipe finishes, we touch `stamp.std` using the timestamp from `stamp.std.start_time` as the reference time, and remove `stamp.std.start_time`. Fix #6518.
This commit is contained in:
parent
24a840d489
commit
62aa899e3d
@ -56,29 +56,32 @@ define DEF_INSTALL_DEBUGGER_SCRIPTS_HOST
|
||||
tmp/install-debugger-scripts$(1)_H_$(2)-gdb.done: \
|
||||
$$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) \
|
||||
$$(DEBUGGER_BIN_SCRIPTS_GDB_ABS)
|
||||
$(Q)touch $$@.start_time
|
||||
$(Q)mkdir -p $$(HBIN$(1)_H_$(2))
|
||||
$(Q)mkdir -p $$(HLIB$(1)_H_$(2))/rustlib/etc
|
||||
$(Q)install $$(DEBUGGER_BIN_SCRIPTS_GDB_ABS) $$(HBIN$(1)_H_$(2))
|
||||
$(Q)install $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) $$(HLIB$(1)_H_$(2))/rustlib/etc
|
||||
$(Q)touch $$@
|
||||
$(Q)touch -r $$@.start_time $$@ && rm $$@.start_time
|
||||
|
||||
tmp/install-debugger-scripts$(1)_H_$(2)-lldb.done: \
|
||||
$$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS) \
|
||||
$$(DEBUGGER_BIN_SCRIPTS_LLDB_ABS)
|
||||
$(Q)touch $$@.start_time
|
||||
$(Q)mkdir -p $$(HBIN$(1)_H_$(2))
|
||||
$(Q)mkdir -p $$(HLIB$(1)_H_$(2))/rustlib/etc
|
||||
$(Q)install $$(DEBUGGER_BIN_SCRIPTS_LLDB_ABS) $$(HBIN$(1)_H_$(2))
|
||||
$(Q)install $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS) $$(HLIB$(1)_H_$(2))/rustlib/etc
|
||||
$(Q)touch $$@
|
||||
$(Q)touch -r $$@.start_time $$@ && rm $$@.start_time
|
||||
|
||||
tmp/install-debugger-scripts$(1)_H_$(2)-all.done: \
|
||||
$$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS) \
|
||||
$$(DEBUGGER_BIN_SCRIPTS_ALL_ABS)
|
||||
$(Q)touch $$@.start_time
|
||||
$(Q)mkdir -p $$(HBIN$(1)_H_$(2))
|
||||
$(Q)mkdir -p $$(HLIB$(1)_H_$(2))/rustlib/etc
|
||||
$(Q)install $$(DEBUGGER_BIN_SCRIPTS_ALL_ABS) $$(HBIN$(1)_H_$(2))
|
||||
$(Q)install $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS) $$(HLIB$(1)_H_$(2))/rustlib/etc
|
||||
$(Q)touch $$@
|
||||
$(Q)touch -r $$@.start_time $$@ && rm $$@.start_time
|
||||
|
||||
tmp/install-debugger-scripts$(1)_H_$(2)-none.done:
|
||||
$(Q)touch $$@
|
||||
@ -98,29 +101,32 @@ define DEF_INSTALL_DEBUGGER_SCRIPTS_TARGET
|
||||
tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-gdb.done: \
|
||||
$$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) \
|
||||
$$(DEBUGGER_BIN_SCRIPTS_GDB_ABS)
|
||||
$(Q)touch $$@.start_time
|
||||
$(Q)mkdir -p $$(TBIN$(1)_T_$(2)_H_$(3))
|
||||
$(Q)mkdir -p $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
|
||||
$(Q)install $(DEBUGGER_BIN_SCRIPTS_GDB_ABS) $$(TBIN$(1)_T_$(2)_H_$(3))
|
||||
$(Q)install $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
|
||||
$(Q)touch $$@
|
||||
$(Q)touch -r $$@.start_time $$@ && rm $$@.start_time
|
||||
|
||||
tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-lldb.done: \
|
||||
$$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS) \
|
||||
$$(DEBUGGER_BIN_SCRIPTS_LLDB_ABS)
|
||||
$(Q)touch $$@.start_time
|
||||
$(Q)mkdir -p $$(TBIN$(1)_T_$(2)_H_$(3))
|
||||
$(Q)mkdir -p $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
|
||||
$(Q)install $(DEBUGGER_BIN_SCRIPTS_LLDB_ABS) $$(TBIN$(1)_T_$(2)_H_$(3))
|
||||
$(Q)install $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS) $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
|
||||
$(Q)touch $$@
|
||||
$(Q)touch -r $$@.start_time $$@ && rm $$@.start_time
|
||||
|
||||
tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-all.done: \
|
||||
$$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS) \
|
||||
$$(DEBUGGER_BIN_SCRIPTS_ALL_ABS)
|
||||
$(Q)touch $$@.start_time
|
||||
$(Q)mkdir -p $$(TBIN$(1)_T_$(2)_H_$(3))
|
||||
$(Q)mkdir -p $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
|
||||
$(Q)install $(DEBUGGER_BIN_SCRIPTS_ALL_ABS) $$(TBIN$(1)_T_$(2)_H_$(3))
|
||||
$(Q)install $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS) $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
|
||||
$(Q)touch $$@
|
||||
$(Q)touch -r $$@.start_time $$@ && rm $$@.start_time
|
||||
|
||||
tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-none.done:
|
||||
$(Q)touch $$@
|
||||
|
@ -38,9 +38,10 @@ endif
|
||||
# the stamp in the source dir.
|
||||
$$(LLVM_STAMP_$(1)): $(S)src/rustllvm/llvm-auto-clean-trigger
|
||||
@$$(call E, make: cleaning llvm)
|
||||
$(Q)touch $$@.start_time
|
||||
$(Q)$(MAKE) clean-llvm$(1)
|
||||
@$$(call E, make: done cleaning llvm)
|
||||
touch $$@
|
||||
touch -r $$@.start_time $$@ && rm $$@.start_time
|
||||
|
||||
ifeq ($$(CFG_ENABLE_LLVM_STATIC_STDCPP),1)
|
||||
LLVM_STDCPP_LOCATION_$(1) = $$(shell $$(CC_$(1)) $$(CFG_GCCISH_CFLAGS_$(1)) \
|
||||
|
@ -75,6 +75,7 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): \
|
||||
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
|
||||
| $$(TLIB$(1)_T_$(2)_H_$(3))/
|
||||
@$$(call E, rustc: $$(@D)/lib$(4))
|
||||
@touch $$@.start_time
|
||||
$$(call REMOVE_ALL_OLD_GLOB_MATCHES, \
|
||||
$$(dir $$@)$$(call CFG_LIB_GLOB_$(2),$(4)))
|
||||
$$(call REMOVE_ALL_OLD_GLOB_MATCHES, \
|
||||
@ -89,7 +90,7 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): \
|
||||
--out-dir $$(@D) \
|
||||
-C extra-filename=-$$(CFG_FILENAME_EXTRA) \
|
||||
$$<
|
||||
@touch $$@
|
||||
@touch -r $$@.start_time $$@ && rm $$@.start_time
|
||||
$$(call LIST_ALL_OLD_GLOB_MATCHES, \
|
||||
$$(dir $$@)$$(call CFG_LIB_GLOB_$(2),$(4)))
|
||||
$$(call LIST_ALL_OLD_GLOB_MATCHES, \
|
||||
|
23
mk/tests.mk
23
mk/tests.mk
@ -389,10 +389,11 @@ check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4
|
||||
$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
|
||||
$(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
|
||||
@$$(call E, run: $$<)
|
||||
$$(Q)touch $$@.start_time
|
||||
$$(Q)$$(call CFG_RUN_TEST_$(2),$$<,$(1),$(2),$(3)) $$(TESTARGS) \
|
||||
--logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
|
||||
$$(call CRATE_TEST_EXTRA_ARGS,$(1),$(2),$(3),$(4)) \
|
||||
&& touch $$@
|
||||
&& touch -r $$@.start_time $$@ && rm $$@.start_time
|
||||
endef
|
||||
|
||||
define DEF_TEST_CRATE_RULES_android
|
||||
@ -401,6 +402,7 @@ check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4
|
||||
$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
|
||||
$(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
|
||||
@$$(call E, run: $$< via adb)
|
||||
$$(Q)touch $$@.start_time
|
||||
$$(Q)$(CFG_ADB) push $$< $(CFG_ADB_TEST_DIR)
|
||||
$$(Q)$(CFG_ADB) shell '(cd $(CFG_ADB_TEST_DIR); LD_LIBRARY_PATH=./$(2) \
|
||||
./$$(notdir $$<) \
|
||||
@ -414,7 +416,7 @@ $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
|
||||
@if grep -q "result: ok" tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
|
||||
then \
|
||||
rm tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
|
||||
touch $$@; \
|
||||
touch -r $$@.start_time $$@ && rm $$@.start_time; \
|
||||
else \
|
||||
rm tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
|
||||
exit 101; \
|
||||
@ -690,10 +692,11 @@ $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
|
||||
$$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
|
||||
$$(CTEST_DEPS_$(4)_$(1)-T-$(2)-H-$(3))
|
||||
@$$(call E, run $(4) [$(2)]: $$<)
|
||||
$$(Q)touch $$@.start_time
|
||||
$$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
|
||||
$$(CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
|
||||
--logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
|
||||
&& touch $$@
|
||||
&& touch -r $$@.start_time $$@ && rm $$@.start_time
|
||||
|
||||
else
|
||||
|
||||
@ -750,10 +753,11 @@ $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
|
||||
$$(PRETTY_DEPS_$(4)) \
|
||||
$$(PRETTY_DEPS$(1)_H_$(3)_$(4))
|
||||
@$$(call E, run pretty-rpass [$(2)]: $$<)
|
||||
$$(Q)touch $$@.start_time
|
||||
$$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
|
||||
$$(PRETTY_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
|
||||
--logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
|
||||
&& touch $$@
|
||||
&& touch -r $$@.start_time $$@ && rm $$@.start_time
|
||||
|
||||
endef
|
||||
|
||||
@ -799,8 +803,10 @@ endif
|
||||
ifeq ($(2),$$(CFG_BUILD))
|
||||
$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)): $$(DOCTESTDEP_$(1)_$(2)_$(3)_$(4))
|
||||
@$$(call E, run doc-$(4) [$(2)])
|
||||
$$(Q)touch $$@.start_time
|
||||
$$(Q)$$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --cfg dox --test $$< \
|
||||
--test-args "$$(TESTARGS)" && touch $$@
|
||||
--test-args "$$(TESTARGS)" && \
|
||||
touch -r $$@.start_time $$@ && rm $$@.start_time
|
||||
else
|
||||
$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)):
|
||||
touch $$@
|
||||
@ -835,9 +841,11 @@ check-stage$(1)-T-$(2)-H-$(3)-doc-crate-$(4)-exec: \
|
||||
ifeq ($(2),$$(CFG_BUILD))
|
||||
$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4)): $$(CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4))
|
||||
@$$(call E, run doc-crate-$(4) [$(2)])
|
||||
$$(Q)touch $$@.start_time
|
||||
$$(Q)CFG_LLVM_LINKAGE_FILE=$$(LLVM_LINKAGE_PATH_$(3)) \
|
||||
$$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --test --cfg dox \
|
||||
$$(CRATEFILE_$(4)) --test-args "$$(TESTARGS)" && touch $$@
|
||||
$$(CRATEFILE_$(4)) --test-args "$$(TESTARGS)" && \
|
||||
touch -r $$@.start_time $$@ && rm $$@.start_time
|
||||
else
|
||||
$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4)):
|
||||
touch $$@
|
||||
@ -984,6 +992,7 @@ $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
|
||||
$$(CSREQ$(1)_T_$(2)_H_$(3))
|
||||
@rm -rf $(3)/test/run-make/$$*
|
||||
@mkdir -p $(3)/test/run-make/$$*
|
||||
$$(Q)touch $$@.start_time
|
||||
$$(Q)$$(CFG_PYTHON) $(S)src/etc/maketest.py $$(dir $$<) \
|
||||
$$(MAKE) \
|
||||
$$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
|
||||
@ -996,7 +1005,7 @@ $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
|
||||
"$$(LD_LIBRARY_PATH_ENV_TARGETDIR$(1)_T_$(2)_H_$(3))" \
|
||||
$(1) \
|
||||
$$(S)
|
||||
@touch $$@
|
||||
@touch -r $$@.start_time $$@ && rm $$@.start_time
|
||||
else
|
||||
# FIXME #11094 - The above rule doesn't work right for multiple targets
|
||||
check-stage$(1)-T-$(2)-H-$(3)-rmake-exec:
|
||||
|
Loading…
Reference in New Issue
Block a user