git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Tom Russello <tom.russello@grenoble-inp.org>
To: git@vger.kernel.org
Cc: erwan.mathoniere@grenoble-inp.org, samuel.groot@grenoble-inp.org,
	jordan.de-gea@grenoble-inp.org, matthieu.moy@grenoble-inp.fr,
	e@80x24.org, aaron@schrab.com, gitster@pobox.com,
	Tom RUSSELLO <tom.russello@grenoble-inp.org>
Subject: [PATCH v3 1/6] t9001: non order-sensitive file comparison
Date: Tue,  7 Jun 2016 16:01:43 +0200	[thread overview]
Message-ID: <20160607140148.23242-2-tom.russello@grenoble-inp.org> (raw)
In-Reply-To: <20160607140148.23242-1-tom.russello@grenoble-inp.org>

Tests might fail if lines compared in text files don't have the same order.

Signed-off-by: Samuel GROOT <samuel.groot@grenoble-inp.org>
Signed-off-by: Tom RUSSELLO <tom.russello@grenoble-inp.org>
Signed-off-by: Matthieu MOY <matthieu.moy@grenoble-inp.fr>
---
 t/t9001-send-email.sh | 61 ++++++++++++++++++++++++++++-----------------------
 1 file changed, 34 insertions(+), 27 deletions(-)

diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index b3355d2..4558e0f 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -54,6 +54,13 @@ test_no_confirm () {
 		>no_confirm_okay
 }
 
+# Check if two files have the same content, non-order sensitive
+test_cmp_noorder () {
+	sort $1 >$1;
+	sort $2 >$2;
+	return $(test_cmp $1 $2)
+}
+
 # Exit immediately to prevent hang if a no-confirm test fails
 check_no_confirm () {
 	if ! test -f no_confirm_okay
@@ -97,7 +104,7 @@ test_expect_success $PREREQ 'setup expect' '
 '
 
 test_expect_success $PREREQ 'Verify commandline' '
-	test_cmp expected commandline1
+	test_cmp_noorder expected commandline1
 '
 
 test_expect_success $PREREQ 'Send patches with --envelope-sender' '
@@ -117,7 +124,7 @@ test_expect_success $PREREQ 'setup expect' '
 '
 
 test_expect_success $PREREQ 'Verify commandline' '
-	test_cmp expected commandline1
+	test_cmp_noorder expected commandline1
 '
 
 test_expect_success $PREREQ 'Send patches with --envelope-sender=auto' '
@@ -137,7 +144,7 @@ test_expect_success $PREREQ 'setup expect' '
 '
 
 test_expect_success $PREREQ 'Verify commandline' '
-	test_cmp expected commandline1
+	test_cmp_noorder expected commandline1
 '
 
 test_expect_success $PREREQ 'setup expect' "
@@ -196,7 +203,7 @@ test_suppress_self () {
 	>"expected-no-cc-$3" &&
 
 	(grep '^Cc:' msghdr1-$3 >"actual-no-cc-$3";
-	 test_cmp expected-no-cc-$3 actual-no-cc-$3)
+	 test_cmp_noorder expected-no-cc-$3 actual-no-cc-$3)
 }
 
 test_suppress_self_unquoted () {
@@ -269,7 +276,7 @@ test_expect_success $PREREQ 'Show all headers' '
 		-e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \
 		-e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \
 		>actual-show-all-headers &&
-	test_cmp expected-show-all-headers actual-show-all-headers
+	test_cmp_noorder expected-show-all-headers actual-show-all-headers
 '
 
 test_expect_success $PREREQ 'Prompting works' '
@@ -436,13 +443,13 @@ test_expect_success $PREREQ 'In-Reply-To without --chain-reply-to' '
 		2>errors &&
 	# The first message is a reply to --in-reply-to
 	sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt1 >actual &&
-	test_cmp expect actual &&
+	test_cmp_noorder expect actual &&
 	# Second and subsequent messages are replies to the first one
 	sed -n -e "s/^Message-Id: *\(.*\)/\1/p" msgtxt1 >expect &&
 	sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt2 >actual &&
-	test_cmp expect actual &&
+	test_cmp_noorder expect actual &&
 	sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt3 >actual &&
-	test_cmp expect actual
+	test_cmp_noorder expect actual
 '
 
 test_expect_success $PREREQ 'In-Reply-To with --chain-reply-to' '
@@ -457,13 +464,13 @@ test_expect_success $PREREQ 'In-Reply-To with --chain-reply-to' '
 		$patches $patches $patches \
 		2>errors &&
 	sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt1 >actual &&
-	test_cmp expect actual &&
+	test_cmp_noorder expect actual &&
 	sed -n -e "s/^Message-Id: *\(.*\)/\1/p" msgtxt1 >expect &&
 	sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt2 >actual &&
-	test_cmp expect actual &&
+	test_cmp_noorder expect actual &&
 	sed -n -e "s/^Message-Id: *\(.*\)/\1/p" msgtxt2 >expect &&
 	sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt3 >actual &&
-	test_cmp expect actual
+	test_cmp_noorder expect actual
 '
 
 test_expect_success $PREREQ 'setup fake editor' '
@@ -537,7 +544,7 @@ test_suppression () {
 		--smtp-server relay.example.com \
 		$patches | replace_variable_fields \
 		>actual-suppress-$1${2+"-$2"} &&
-	test_cmp expected-suppress-$1${2+"-$2"} actual-suppress-$1${2+"-$2"}
+	test_cmp_noorder expected-suppress-$1${2+"-$2"} actual-suppress-$1${2+"-$2"}
 }
 
 test_expect_success $PREREQ 'sendemail.cc set' '
@@ -1213,7 +1220,7 @@ test_expect_success $PREREQ 'ASCII subject is not RFC2047 quoted' '
 			--8bit-encoding=UTF-8 \
 			email-using-8bit >stdout &&
 	grep "Subject" msgtxt1 >actual &&
-	test_cmp expected actual
+	test_cmp_noorder expected actual
 '
 
 test_expect_success $PREREQ 'setup expect' '
@@ -1234,7 +1241,7 @@ test_expect_success $PREREQ 'asks about and fixes 8bit encodings' '
 	grep email-using-8bit stdout &&
 	grep "Which 8bit encoding" stdout &&
 	egrep "Content|MIME" msgtxt1 >actual &&
-	test_cmp actual content-type-decl
+	test_cmp_noorder actual content-type-decl
 '
 
 test_expect_success $PREREQ 'sendemail.8bitEncoding works' '
@@ -1245,7 +1252,7 @@ test_expect_success $PREREQ 'sendemail.8bitEncoding works' '
 			--smtp-server="$(pwd)/fake.sendmail" \
 			email-using-8bit >stdout &&
 	egrep "Content|MIME" msgtxt1 >actual &&
-	test_cmp actual content-type-decl
+	test_cmp_noorder actual content-type-decl
 '
 
 test_expect_success $PREREQ '--8bit-encoding overrides sendemail.8bitEncoding' '
@@ -1257,7 +1264,7 @@ test_expect_success $PREREQ '--8bit-encoding overrides sendemail.8bitEncoding' '
 			--8bit-encoding=UTF-8 \
 			email-using-8bit >stdout &&
 	egrep "Content|MIME" msgtxt1 >actual &&
-	test_cmp actual content-type-decl
+	test_cmp_noorder actual content-type-decl
 '
 
 test_expect_success $PREREQ 'setup expect' '
@@ -1286,7 +1293,7 @@ test_expect_success $PREREQ '--8bit-encoding also treats subject' '
 			--8bit-encoding=UTF-8 \
 			email-using-8bit >stdout &&
 	grep "Subject" msgtxt1 >actual &&
-	test_cmp expected actual
+	test_cmp_noorder expected actual
 '
 
 test_expect_success $PREREQ 'setup expect' '
@@ -1335,7 +1342,7 @@ test_expect_success $PREREQ 'sendemail.transferencoding=8bit' '
 		2>errors >out &&
 	sed '1,/^$/d' msgtxt1 >actual &&
 	sed '1,/^$/d' email-using-8bit >expected &&
-	test_cmp expected actual
+	test_cmp_noorder expected actual
 '
 
 test_expect_success $PREREQ 'setup expect' '
@@ -1352,7 +1359,7 @@ test_expect_success $PREREQ '8-bit and sendemail.transferencoding=quoted-printab
 		email-using-8bit \
 		2>errors >out &&
 	sed '1,/^$/d' msgtxt1 >actual &&
-	test_cmp expected actual
+	test_cmp_noorder expected actual
 '
 
 test_expect_success $PREREQ 'setup expect' '
@@ -1369,7 +1376,7 @@ test_expect_success $PREREQ '8-bit and sendemail.transferencoding=base64' '
 		email-using-8bit \
 		2>errors >out &&
 	sed '1,/^$/d' msgtxt1 >actual &&
-	test_cmp expected actual
+	test_cmp_noorder expected actual
 '
 
 test_expect_success $PREREQ 'setup expect' '
@@ -1395,7 +1402,7 @@ test_expect_success $PREREQ 'convert from quoted-printable to base64' '
 		email-using-qp \
 		2>errors >out &&
 	sed '1,/^$/d' msgtxt1 >actual &&
-	test_cmp expected actual
+	test_cmp_noorder expected actual
 '
 
 test_expect_success $PREREQ 'setup expect' "
@@ -1425,7 +1432,7 @@ test_expect_success $PREREQ 'CRLF and sendemail.transferencoding=quoted-printabl
 		email-using-crlf \
 		2>errors >out &&
 	sed '1,/^$/d' msgtxt1 >actual &&
-	test_cmp expected actual
+	test_cmp_noorder expected actual
 '
 
 test_expect_success $PREREQ 'setup expect' '
@@ -1442,7 +1449,7 @@ test_expect_success $PREREQ 'CRLF and sendemail.transferencoding=base64' '
 		email-using-crlf \
 		2>errors >out &&
 	sed '1,/^$/d' msgtxt1 >actual &&
-	test_cmp expected actual
+	test_cmp_noorder expected actual
 '
 
 
@@ -1582,7 +1589,7 @@ test_dump_aliases () {
 			"$(pwd)/.tmp-email-aliases" &&
 		git config sendemail.aliasfiletype "$filetype" &&
 		git send-email --dump-aliases 2>errors >actual &&
-		test_cmp expect actual
+		test_cmp_noorder expect actual
 	'
 }
 
@@ -1842,7 +1849,7 @@ test_expect_success $PREREQ 'use email list in --cc --to and --bcc' '
 	--bcc="bcc1@example.com, bcc2@example.com" \
 	0001-add-master.patch | replace_variable_fields \
 	>actual-list &&
-	test_cmp expected-list actual-list
+	test_cmp_noorder expected-list actual-list
 '
 
 test_expect_success $PREREQ 'aliases work with email list' '
@@ -1858,7 +1865,7 @@ test_expect_success $PREREQ 'aliases work with email list' '
 	--bcc="bcc1@example.com, bcc2@example.com" \
 	0001-add-master.patch | replace_variable_fields \
 	>actual-list &&
-	test_cmp expected-list actual-list
+	test_cmp_noorder expected-list actual-list
 '
 
 test_expect_success $PREREQ 'leading and trailing whitespaces are removed' '
@@ -1882,7 +1889,7 @@ test_expect_success $PREREQ 'leading and trailing whitespaces are removed' '
 	--bcc="bcc2@example.com" \
 	0001-add-master.patch | replace_variable_fields \
 	>actual-list &&
-	test_cmp expected-list actual-list
+	test_cmp_noorder expected-list actual-list
 '
 
 test_done
-- 
2.8.3

  reply	other threads:[~2016-06-07 14:02 UTC|newest]

Thread overview: 96+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-23 19:30 [RFC-PATCH 0/2] send-email: new --quote-mail option Tom Russello
2016-05-23 19:30 ` [RFC-PATCH 1/2] send-email: new option to quote an email and reply to Tom Russello
2016-05-23 19:55   ` Eric Wong
2016-05-23 20:07     ` Matthieu Moy
2016-05-23 22:10       ` Samuel GROOT
2016-05-24 12:43     ` Samuel GROOT
2016-05-24 12:49       ` Matthieu Moy
2016-05-24 22:30         ` Aaron Schrab
2016-05-25  0:04           ` Tom Russello
2016-05-24 21:23       ` Eric Wong
2016-05-23 20:00   ` Matthieu Moy
2016-05-24 23:31     ` Samuel GROOT
2016-05-25  6:29       ` Matthieu Moy
2016-05-25 15:40         ` Junio C Hamano
2016-05-25 16:56           ` Matthieu Moy
2016-05-25 18:15             ` Junio C Hamano
2016-05-25 18:31               ` Matthieu Moy
2016-05-26  0:08                 ` Samuel GROOT
2016-05-27  9:06                   ` Matthieu Moy
2016-05-23 19:30 ` [RFC-PATCH 2/2] t9001: adding --quote-mail option test Tom Russello
2016-05-23 20:05   ` Matthieu Moy
2016-05-23 19:38 ` [RFC-PATCH 0/2] send-email: new --quote-mail option Matthieu Moy
2016-05-23 19:56   ` Samuel GROOT
2016-05-27 17:11 ` [RFC-PATCH v2 0/2] send-email: new --quote-email option Tom Russello
2016-05-27 17:11   ` [RFC-PATCH v2 1/2] send-email: quote-email populates the fields Tom Russello
2016-05-28 14:35     ` Matthieu Moy
2016-05-29 23:38       ` Tom Russello
2016-05-27 17:11   ` [RFC-PATCH v2 2/2] send-email: quote-email quotes the message body Tom Russello
2016-05-28 15:01     ` Matthieu Moy
2016-05-29 11:41       ` Tom Russello
2016-06-07 14:01   ` [PATCH v3 0/6] send-email: cleaner tests and quote email Tom Russello
2016-06-07 14:01     ` Tom Russello [this message]
2016-06-08  1:07       ` [PATCH v3 1/6] t9001: non order-sensitive file comparison Junio C Hamano
2016-06-08  8:23         ` Samuel GROOT
2016-06-08 16:09           ` Junio C Hamano
2016-06-08 16:46             ` Samuel GROOT
2016-06-09  6:01               ` Matthieu Moy
2016-06-13 22:21                 ` Samuel GROOT
2016-06-09  5:51         ` Matthieu Moy
2016-06-09  8:15           ` Tom Russello
2016-06-07 14:01     ` [PATCH v3 2/6] t9001: check email address is in Cc: field Tom Russello
2016-06-09  5:55       ` Matthieu Moy
2016-06-13 22:23         ` Samuel GROOT
2016-06-07 14:01     ` [PATCH v3 3/6] t9001: shorten send-email's output Tom Russello
2016-06-08  8:36       ` Eric Wong
2016-06-08  9:30         ` Samuel GROOT
2016-06-09  6:03       ` Matthieu Moy
2016-06-07 14:01     ` [PATCH v3 4/6] send-email: create email parser subroutine Tom Russello
2016-06-07 14:05       ` [PATCH v3 5/6] send-email: --in-reply-to=<file> populates the fields Tom Russello
2016-06-07 14:05         ` [PATCH v3 6/6] send-email: add option --cite to quote the message body Tom Russello
2016-06-08 13:01     ` (unknown), Samuel GROOT
2016-06-08 13:01       ` [PATCH v4 1/6] t9001: non order-sensitive file comparison Samuel GROOT
2016-06-08 14:22         ` Remi Galan Alfonso
2016-06-08 14:29           ` Samuel GROOT
2016-06-08 16:56         ` Junio C Hamano
2016-06-08 19:21           ` Samuel GROOT
2016-06-08 17:17         ` Junio C Hamano
2016-06-08 19:19           ` Samuel GROOT
2016-06-08 13:01       ` [PATCH v4 2/6] t9001: check email address is in Cc: field Samuel GROOT
2016-06-08 17:34         ` Junio C Hamano
2016-06-08 19:23           ` Samuel GROOT
2016-06-08 13:01       ` [PATCH v4 3/6] send-email: shorten send-email's output Samuel GROOT
2016-06-08 17:37         ` Junio C Hamano
2016-06-08 19:18           ` Samuel GROOT
2016-06-08 19:33             ` Junio C Hamano
2016-06-08 19:40               ` Samuel GROOT
2016-06-09  6:17         ` Matthieu Moy
2016-06-13 22:19           ` Samuel GROOT
2016-06-08 13:01       ` [PATCH v4 4/6] send-email: create email parser subroutine Samuel GROOT
2016-06-08 17:58         ` Junio C Hamano
2016-06-08 18:12           ` Eric Sunshine
2016-06-08 18:32             ` Junio C Hamano
2016-06-08 19:26               ` Samuel GROOT
2016-06-08 19:31                 ` Junio C Hamano
2016-06-08 19:42                   ` Samuel GROOT
2016-06-08 19:30             ` Samuel GROOT
2016-06-08 20:13               ` Eric Sunshine
2016-06-08 20:17                 ` Junio C Hamano
2016-06-08 23:54                   ` Samuel GROOT
2016-06-09  0:21                     ` Eric Wong
2016-06-13 22:18                       ` Samuel GROOT
2016-06-13 22:47                         ` Eric Wong
2016-06-14 22:18                           ` Samuel GROOT
2016-06-09  6:51                     ` Eric Sunshine
2016-06-13 22:15                       ` Samuel GROOT
2016-06-08 19:36           ` Samuel GROOT
2016-06-08 20:38         ` Eric Wong
2016-06-08 13:07       ` [PATCH v4 5/6] send-email: --in-reply-to=<file> populate header fields Samuel GROOT
2016-06-08 18:23         ` Junio C Hamano
2016-06-14 22:26           ` Samuel GROOT
2016-06-09  9:45         ` Matthieu Moy
2016-06-14 22:35           ` Samuel GROOT
2016-06-08 13:08       ` [PATCH v4 6/6] send-email: add option --cite to quote the message body Samuel GROOT
2016-06-09 11:49         ` Matthieu Moy
2016-06-14 22:53           ` Samuel GROOT
2016-06-15 22:21           ` Tom Russello

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160607140148.23242-2-tom.russello@grenoble-inp.org \
    --to=tom.russello@grenoble-inp.org \
    --cc=aaron@schrab.com \
    --cc=e@80x24.org \
    --cc=erwan.mathoniere@grenoble-inp.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jordan.de-gea@grenoble-inp.org \
    --cc=matthieu.moy@grenoble-inp.fr \
    --cc=samuel.groot@grenoble-inp.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).