[PATCH] t4014: remove Message-Id/timestamp before comparing patches

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

 



The test introduced in 787570c (format-patch: ignore ui.color,
2011-09-13) has a race condition: if the two format-patch invocations
do not ask for the current time in the same second, their Message-Id
headers will disagree.

Normally this would be a pretty unlikely occurrence.  However, under
valgrind format-patch runs so slowly that the race triggers every
time, with a time difference of 2-3s on my hardware.

To avoid this problem, replace the contents of the Message-Id header
with a dummy before comparing.

Signed-off-by: Thomas Rast <trast@xxxxxxxxxxxxxxx>
---
 t/t4014-format-patch.sh |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 7e405d7..8700089 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -886,11 +886,18 @@ test_expect_success 'empty subject prefix does not have extra space' '
 	test_cmp expect actual
 '
 
+strip_msgid () {
+	sed 's#\(Message-Id: *\)<[^>]*>#\1<MESSAGE@ID>#' "$1" >"$1+" &&
+	mv "$1+" "$1"
+}
+
 test_expect_success 'format patch ignores color.ui' '
 	test_unconfig color.ui &&
 	git format-patch --stdout -1 >expect &&
+	strip_msgid expect &&
 	test_config color.ui always &&
 	git format-patch --stdout -1 >actual &&
+	strip_msgid actual &&
 	test_cmp expect actual
 '
 
-- 
1.7.7.rc1.366.ge210a6

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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]