Re: [PATCH v2 1/2] t7508: add tests capturing racy timestamp handling

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

 



On 05/01/2022 21:59, Junio C Hamano wrote:
From: Marc Strapetz <marc.strapetz@xxxxxxxxxxx>
+test_expect_success 'racy timestamps will be fixed for clean worktree' '
+	echo content >racy-dirty &&
+	echo content >racy-racy &&
+	git add racy* &&
+	git commit -m "racy test files" &&
+	# let status rewrite the index, if necessary; after that we expect
+	# no more index writes unless caused by racy timestamps; note that
+	# timestamps may already be racy now (depending on previous tests)
+	git status &&
+	test-tool chmtime =1234567890 .git/index &&
+	test-tool chmtime --get .git/index >out &&
+	grep ^1234567890 out &&

If file contents were 1234567890999, this will still hit, but I do
not think that is what you wanted to see.  Perhaps

	git status &&
	echo 1234567890 >expect &&
	test-tool chmtime=$(cat expect) .git/index &&
	test-tool chmtime --get .git/index >actual &&
	test_cmp expect actual

or something?  But I think you inherited this bogosity from the
previous test, so I am OK to add a few more copies of the same
bogosity to the test.

Somebody later has to step in and clean them all up, though.  When
that happens, we should document how the magic 1234567890 timestamp
was chosen near its first use.

It seems like this pattern was used only once before my changes, hence I will extract to test-lib-functions.sh and fix the bogosity for the next version of my patch.

-Marc



[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