[PATCH 1/3] Add a second's delay to t7519 for untracked cache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Tao Klerks <tao@xxxxxxxxxx>

In t7519 there is a test that writes files to disk, and immediately
writes the untracked index. Because of mtime-comparison logic
that uses a 1-second resolution, this means the cached entries
are not trusted/used under some circumstances (see
read-cache.c#is_racy_stat()).

Untracked cache tests in t7063 use a 1-second delay to avoid
this issue. We should do the same here.

This change doesn't actually affect the outcome of the test,
but does enhance its validity, and becomes relevant after
later changes

Signed-off-by: Tao Klerks <tao@xxxxxxxxxx>
---
 t/t7519-status-fsmonitor.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/t/t7519-status-fsmonitor.sh b/t/t7519-status-fsmonitor.sh
index 637391c6ce4..1209fa93499 100755
--- a/t/t7519-status-fsmonitor.sh
+++ b/t/t7519-status-fsmonitor.sh
@@ -13,6 +13,10 @@ clean_repo () {
 	git clean -fd
 }
 
+avoid_racy() {
+	sleep 1
+}
+
 dirty_repo () {
 	: >untracked &&
 	: >dir1/untracked &&
@@ -332,6 +336,7 @@ test_expect_success UNTRACKED_CACHE 'ignore .git changes when invalidating UNTR'
 		: >dir2/modified &&
 		write_integration_script &&
 		git config core.fsmonitor .git/hooks/fsmonitor-test &&
+		avoid_racy &&
 		git update-index --untracked-cache &&
 		git update-index --fsmonitor &&
 		GIT_TRACE2_PERF="$TRASH_DIRECTORY/trace-before" \
-- 
gitgitgadget




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux