git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v3 1/6] t9001: non order-sensitive file comparison

From
TRTom Russello <tom.russello@grenoble-inp.org>
Date
Jun 7, 2016, 14:01 UTC
Message-ID
<20160607140148.23242-2-tom.russello@grenoble-inp.org>
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
Previous: Tom RusselloNext: Junio C Hamano
Message 32 of 96 in “send-email: new --quote-mail option”
  1. 0/2 send-email: new --quote-mail optionTom Russello, May 23, 2016
  2. 1/2 send-email: new option to quote an email and reply toTom Russello, May 23, 2016
  3. Eric WongMay 23, 2016
  4. Matthieu MoyMay 23, 2016
  5. Samuel GROOTMay 23, 2016
  6. Samuel GROOTMay 24, 2016
  7. Matthieu MoyMay 24, 2016
  8. Aaron SchrabMay 24, 2016
  9. Tom RusselloMay 25, 2016
  10. Eric WongMay 24, 2016
  11. Matthieu MoyMay 23, 2016
  12. Samuel GROOTMay 24, 2016
  13. Matthieu MoyMay 25, 2016
  14. Junio C HamanoMay 25, 2016
  15. Matthieu MoyMay 25, 2016
  16. Junio C HamanoMay 25, 2016
  17. Matthieu MoyMay 25, 2016
  18. Samuel GROOTMay 26, 2016
  19. Matthieu MoyMay 27, 2016
  20. 2/2 t9001: adding --quote-mail option testTom Russello, May 23, 2016
  21. Matthieu MoyMay 23, 2016
  22. Matthieu MoyMay 23, 2016
  23. Samuel GROOTMay 23, 2016
  24. 0/2 send-email: new --quote-email optionTom Russello, May 27, 2016
  25. 1/2 send-email: quote-email populates the fieldsTom Russello, May 27, 2016
  26. Matthieu MoyMay 28, 2016
  27. Tom RusselloMay 29, 2016
  28. 2/2 send-email: quote-email quotes the message bodyTom Russello, May 27, 2016
  29. Matthieu MoyMay 28, 2016
  30. Tom RusselloMay 29, 2016
  31. 0/6 send-email: cleaner tests and quote emailTom Russello, Jun 7, 2016
  32. 1/6 t9001: non order-sensitive file comparisonTom Russello, Jun 7, 2016
  33. Junio C HamanoJun 8, 2016
  34. Samuel GROOTJun 8, 2016
  35. Junio C HamanoJun 8, 2016
  36. Samuel GROOTJun 8, 2016
  37. Matthieu MoyJun 9, 2016
  38. Samuel GROOTJun 13, 2016
  39. Matthieu MoyJun 9, 2016
  40. Tom RusselloJun 9, 2016
  41. 2/6 t9001: check email address is in Cc: fieldTom Russello, Jun 7, 2016
  42. Matthieu MoyJun 9, 2016
  43. Samuel GROOTJun 13, 2016
  44. 3/6 t9001: shorten send-email's outputTom Russello, Jun 7, 2016
  45. Eric WongJun 8, 2016
  46. Samuel GROOTJun 8, 2016
  47. Matthieu MoyJun 9, 2016
  48. 4/6 send-email: create email parser subroutineTom Russello, Jun 7, 2016
  49. 5/6 send-email: --in-reply-to=<file> populates the fieldsTom Russello, Jun 7, 2016
  50. 6/6 send-email: add option --cite to quote the message bodyTom Russello, Jun 7, 2016
  51. (unknown)Samuel GROOT, Jun 8, 2016
  52. 1/6 t9001: non order-sensitive file comparisonSamuel GROOT, Jun 8, 2016
  53. Remi Galan AlfonsoJun 8, 2016
  54. Samuel GROOTJun 8, 2016
  55. Junio C HamanoJun 8, 2016
  56. Samuel GROOTJun 8, 2016
  57. Junio C HamanoJun 8, 2016
  58. Samuel GROOTJun 8, 2016
  59. 2/6 t9001: check email address is in Cc: fieldSamuel GROOT, Jun 8, 2016
  60. Junio C HamanoJun 8, 2016
  61. Samuel GROOTJun 8, 2016
  62. 3/6 send-email: shorten send-email's outputSamuel GROOT, Jun 8, 2016
  63. Junio C HamanoJun 8, 2016
  64. Samuel GROOTJun 8, 2016
  65. Junio C HamanoJun 8, 2016
  66. Samuel GROOTJun 8, 2016
  67. Matthieu MoyJun 9, 2016
  68. Samuel GROOTJun 13, 2016
  69. 4/6 send-email: create email parser subroutineSamuel GROOT, Jun 8, 2016
  70. Junio C HamanoJun 8, 2016
  71. Eric SunshineJun 8, 2016
  72. Junio C HamanoJun 8, 2016
  73. Samuel GROOTJun 8, 2016
  74. Junio C HamanoJun 8, 2016
  75. Samuel GROOTJun 8, 2016
  76. Samuel GROOTJun 8, 2016
  77. Eric SunshineJun 8, 2016
  78. Junio C HamanoJun 8, 2016
  79. Samuel GROOTJun 8, 2016
  80. Eric WongJun 9, 2016
  81. Samuel GROOTJun 13, 2016
  82. Eric WongJun 13, 2016
  83. Samuel GROOTJun 14, 2016
  84. Eric SunshineJun 9, 2016
  85. Samuel GROOTJun 13, 2016
  86. Samuel GROOTJun 8, 2016
  87. Eric WongJun 8, 2016
  88. 5/6 send-email: --in-reply-to=<file> populate header fieldsSamuel GROOT, Jun 8, 2016
  89. Junio C HamanoJun 8, 2016
  90. Samuel GROOTJun 14, 2016
  91. Matthieu MoyJun 9, 2016
  92. Samuel GROOTJun 14, 2016
  93. 6/6 send-email: add option --cite to quote the message bodySamuel GROOT, Jun 8, 2016
  94. Matthieu MoyJun 9, 2016
  95. Samuel GROOTJun 14, 2016
  96. Tom RusselloJun 15, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.