git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] t4014: remove Message-Id/timestamp before comparing patches
@ 2011-09-19  6:45 Thomas Rast
  2011-09-19 17:08 ` Junio C Hamano
  2011-09-19 19:15 ` Jeff King
  0 siblings, 2 replies; 5+ messages in thread
From: Thomas Rast @ 2011-09-19  6:45 UTC (permalink / raw)
  To: Pang Yan Han; +Cc: Jeff King, Junio C Hamano, git

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@student.ethz.ch>
---
 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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-09-20  8:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-19  6:45 [PATCH] t4014: remove Message-Id/timestamp before comparing patches Thomas Rast
2011-09-19 17:08 ` Junio C Hamano
2011-09-19 19:15 ` Jeff King
2011-09-19 20:15   ` Junio C Hamano
2011-09-20  8:43     ` Thomas Rast

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).