From: Thomas Rast <trast@student.ethz.ch>
To: Pang Yan Han <pangyanhan@gmail.com>
Cc: Jeff King <peff@peff.net>, Junio C Hamano <gitster@pobox.com>,
<git@vger.kernel.org>
Subject: [PATCH] t4014: remove Message-Id/timestamp before comparing patches
Date: Mon, 19 Sep 2011 08:45:43 +0200 [thread overview]
Message-ID: <6b2cb6ebec907342a02d56a36ddc58715efabc00.1316414731.git.trast@student.ethz.ch> (raw)
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
next reply other threads:[~2011-09-19 6:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-19 6:45 Thomas Rast [this message]
2011-09-19 17:08 ` [PATCH] t4014: remove Message-Id/timestamp before comparing patches 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6b2cb6ebec907342a02d56a36ddc58715efabc00.1316414731.git.trast@student.ethz.ch \
--to=trast@student.ethz.ch \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=pangyanhan@gmail.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).