forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#22997 - pnkfelix:make-timestamps-robust-to-co…
…ncurrent-edits, r=nikomatsakis 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 rust-lang#6518.
- Loading branch information
Showing
4 changed files
with
32 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 [email protected]_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 [email protected]_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 [email protected]_time | ||
else | ||
# FIXME #11094 - The above rule doesn't work right for multiple targets | ||
check-stage$(1)-T-$(2)-H-$(3)-rmake-exec: | ||
|