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

[PATCH 4/4] t5526: avoid dependency on submodule order

From
Pat Thoyts <patthoyts@users.sourceforge.net>
Date
Feb 3, 2011, 15:31 UTC
Message-ID
<1296747105-1663-5-git-send-email-patthoyts@users.sourceforge.net>
In-Reply-To
<1296747105-1663-1-git-send-email-patthoyts@users.sourceforge.net>

When running tests on msysGit the actual results appear in the reverse order. Added a test_cmp_unordered to test that each expected line is present in the output without depending upon the order of lines.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
---
 t/t5526-fetch-submodules.sh |   32 ++++++++++++++++++--------------
 1 files changed, 18 insertions(+), 14 deletions(-)
diff --git a/t/t5526-fetch-submodules.sh b/t/t5526-fetch-submodules.sh
index 884a5e5..d218845 100755
--- a/t/t5526-fetch-submodules.sh
+++ b/t/t5526-fetch-submodules.sh
@@ -32,6 +32,10 @@ add_upstream_commit() {
 	)
 }
 
+test_cmp_unordered() {
+	grep --line-regexp -f "$@" >&3
+}
+
 test_expect_success setup '
 	mkdir deepsubmodule &&
 	(
@@ -67,8 +71,8 @@ test_expect_success "fetch --recurse-submodules recurses into submodules" '
 		cd downstream &&
 		git fetch --recurse-submodules >../actual.out 2>../actual.err
 	) &&
-	test_cmp expect.out actual.out &&
-	test_cmp expect.err actual.err
+	test_cmp_unordered expect.out actual.out &&
+	test_cmp_unordered expect.err actual.err
 '
 
 test_expect_success "fetch alone only fetches superproject" '
@@ -96,8 +100,8 @@ test_expect_success "using fetchRecurseSubmodules=true in .gitmodules recurses i
 		git config -f .gitmodules submodule.submodule.fetchRecurseSubmodules true &&
 		git fetch >../actual.out 2>../actual.err
 	) &&
-	test_cmp expect.out actual.out &&
-	test_cmp expect.err actual.err
+	test_cmp_unordered expect.out actual.out &&
+	test_cmp_unordered expect.err actual.err
 '
 
 test_expect_success "--no-recurse-submodules overrides .gitmodules config" '
@@ -127,8 +131,8 @@ test_expect_success "--recurse-submodules overrides fetchRecurseSubmodules setti
 		git config -f --unset .gitmodules submodule.submodule.fetchRecurseSubmodules true &&
 		git config --unset submodule.submodule.fetchRecurseSubmodules
 	) &&
-	test_cmp expect.out actual.out &&
-	test_cmp expect.err actual.err
+	test_cmp_unordered expect.out actual.out &&
+	test_cmp_unordered expect.err actual.err
 '
 
 test_expect_success "--quiet propagates to submodules" '
@@ -146,14 +150,14 @@ test_expect_success "--dry-run propagates to submodules" '
 		cd downstream &&
 		git fetch --recurse-submodules --dry-run >../actual.out 2>../actual.err
 	) &&
-	test_cmp expect.out actual.out &&
-	test_cmp expect.err actual.err &&
+	test_cmp_unordered expect.out actual.out &&
+	test_cmp_unordered expect.err actual.err &&
 	(
 		cd downstream &&
 		git fetch --recurse-submodules >../actual.out 2>../actual.err
 	) &&
-	test_cmp expect.out actual.out &&
-	test_cmp expect.err actual.err
+	test_cmp_unordered expect.out actual.out &&
+	test_cmp_unordered expect.err actual.err
 '
 
 test_expect_success "recurseSubmodules=true propagates into submodules" '
@@ -163,8 +167,8 @@ test_expect_success "recurseSubmodules=true propagates into submodules" '
 		git config fetch.recurseSubmodules true
 		git fetch >../actual.out 2>../actual.err
 	) &&
-	test_cmp expect.out actual.out &&
-	test_cmp expect.err actual.err
+	test_cmp_unordered expect.out actual.out &&
+	test_cmp_unordered expect.err actual.err
 '
 
 test_expect_success "--recurse-submodules overrides config in submodule" '
@@ -177,8 +181,8 @@ test_expect_success "--recurse-submodules overrides config in submodule" '
 		) &&
 		git fetch --recurse-submodules >../actual.out 2>../actual.err
 	) &&
-	test_cmp expect.out actual.out &&
-	test_cmp expect.err actual.err
+	test_cmp_unordered expect.out actual.out &&
+	test_cmp_unordered expect.err actual.err
 '
 
 test_expect_success "--no-recurse-submodules overrides config setting" '
-- 
1.7.4.msysgit.0
Previous: Pat ThoytsNext: Johannes Sixt
Message 5 of 11 in “some test fixes for msysGit”
  1. some test fixes for msysGitPat Thoyts, Feb 3, 2011
  2. 1/4 t3509: use unconstrained initial test to setup repository.Pat Thoyts, Feb 3, 2011
  3. 2/4 t4120-apply-popt: help systems with core.filemode=falsePat Thoyts, Feb 3, 2011
  4. 3/4 t7407: fix line endings for mingw buildPat Thoyts, Feb 3, 2011
  5. 4/4 t5526: avoid dependency on submodule orderPat Thoyts, Feb 3, 2011
  6. Johannes SixtFeb 3, 2011
  7. Johannes SchindelinFeb 3, 2011
  8. Johannes SixtFeb 3, 2011
  9. start_command: flush buffers in the WIN32 code path as wellJohannes Sixt, Feb 4, 2011
  10. Pat ThoytsFeb 4, 2011
  11. Johannes SchindelinFeb 3, 2011

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.