Skip to contentSkip to conversation

some test fixes for msysGit

PATCH In review Pat Thoyts 4 participants 11 messages Jun 15, 2016

lore
Share & tools
lore

Pat Thoyts

author
#0 lore raw

PATCH 1/1 some test fixes for msysGit

The following patches resolve some issues for msysGit running the v1.7.4 tests

 t/t3509-cherry-pick-merge-df.sh |    6 ++++--
 t/t4120-apply-popt.sh           |    9 +++++++--
 t/t5526-fetch-submodules.sh     |   32 ++++++++++++++++++--------------
 t/t7407-submodule-foreach.sh    |    4 ++++
 4 files changed, 33 insertions(+), 18 deletions(-)
author
#1 lore raw

PATCH 1/4 t3509: use unconstrained initial test to setup repository.

The first test did not run on msysGit due to the SYMLINKS constraint and so subsequent tests failed because the test repository was not initialized.

---
 t/t3509-cherry-pick-merge-df.sh |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
t/t3509-cherry-pick-merge-df.sh +4 -2
index 948ca1b..df921d1 100755
@@ -3,12 +3,14 @@
 test_description='Test cherry-pick with directory/file conflicts'
 . ./test-lib.sh
 
-test_expect_success SYMLINKS 'Setup rename across paths each below D/F conflicts' '
+test_expect_success 'Initialize repository' '
 	mkdir a &&
 	>a/f &&
 	git add a &&
-	git commit -m a &&
+	git commit -m a
+'
 
+test_expect_success SYMLINKS 'Setup rename across paths each below D/F conflicts' '
 	mkdir b &&
 	ln -s ../a b/a &&
 	git add b &&
Signature · 1 line
1.7.4.msysgit.0
author
#2 lore raw

PATCH 2/4 t4120-apply-popt: help systems with core.filemode=false

In reply to Pat Thoyts

From: Johannes Sixt <[email protected]>

A test case verifies that filemode-only patches work as expected. Help systems where "test -x" does not work by applying the test patch also to the index, where the effects can be verified even on such systems.

---
 t/t4120-apply-popt.sh |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
t/t4120-apply-popt.sh +7 -2
index 579c9e6..a33d510 100755
@@ -6,6 +6,7 @@
 test_description='git apply -p handling.'
 
 . ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-prereq-FILEMODE.sh
 
 test_expect_success setup '
 	mkdir sub &&
@@ -62,8 +63,12 @@ test_expect_success 'apply (-p2) diff, mode change only' '
 	old mode 100644
 	new mode 100755
 	EOF
-	chmod 644 file1 &&
-	git apply -p2 patch.chmod &&
+	test_chmod -x file1 &&
+	git apply --index -p2 patch.chmod &&
+	case $(git ls-files -s file1) in 100755*) : good;; *) false;; esac
+'
+
+test_expect_success FILEMODE 'file mode was changed' '
 	test -x file1
 '
 
Signature · 1 line
1.7.4.msysgit.0
author
#3 lore raw

PATCH 3/4 t7407: fix line endings for mingw build

In reply to Pat Thoyts
---
 t/t7407-submodule-foreach.sh |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
t/t7407-submodule-foreach.sh +4 -0
index 1d67ef5..4c84764 100755
@@ -254,6 +254,10 @@ test_expect_success 'ensure "status --cached --recursive" preserves the --cached
 		) &&
 		git submodule status --cached --recursive -- nested1 > ../actual
 	) &&
+	if test_have_prereq MINGW
+	then
+		dos2unix actual
+	fi &&
 	test_cmp expect actual
 '
 
Signature · 1 line
1.7.4.msysgit.0
author
#4 lore raw

PATCH 4/4 t5526: avoid dependency on submodule order

In reply to Pat Thoyts

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.

---
 t/t5526-fetch-submodules.sh |   32 ++++++++++++++++++--------------
 1 files changed, 18 insertions(+), 14 deletions(-)
t/t5526-fetch-submodules.sh +18 -14
index 884a5e5..d218845 100755
@@ -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" '
Signature · 1 line
1.7.4.msysgit.0
#5 lore raw

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

t/t5526-fetch-submodules.sh add_upstream_commit() { · line 37

Quoted 3 lines · Pat Thoyts
t/t5526-fetch-submodules.sh +3 -0
+test_cmp_unordered() {
+	grep --line-regexp -f "$@" >&3
+}

I don't think that this is sufficiently portable.

Furthermore, just like Dscho, I'd rather prefer to know why the output is not ordered as expected.

I'm fine with the other patches as well.

A side note regarding SYMLINKS: It's actually possible to remove 70 of the 130 SYMLINKS checks from the test suite:

http://repo.or.cz/w/git/mingw/j6t.git/shortlog/refs/heads/war-on-symlinks

-- Hannes

#6 lore raw

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

Hi,

Quoted 9 lines · Johannes Sixt

t/t5526-fetch-submodules.sh add_upstream_commit() { · line 37

Quoted 3 lines · Pat Thoyts
t/t5526-fetch-submodules.sh +3 -0
+test_cmp_unordered() {
+	grep --line-regexp -f "$@" >&3
+}

I don't think that this is sufficiently portable.

Furthermore, just like Dscho, I'd rather prefer to know why the output is not ordered as expected.

Have you seen my response where I proved that it is a fflush() issue, most likely with mingw_spawn()?

Ciao,
Dscho

#7 lore raw

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

Quoted 6 lines · Johannes Schindelin
Quoted 2 lines · Johannes Sixt

Furthermore, just like Dscho, I'd rather prefer to know why the output is not ordered as expected.

Have you seen my response where I proved that it is a fflush() issue, most likely with mingw_spawn()?

Obviously, I haven't. Good catch!

-- Hannes

#8 lore raw

PATCH 1/1 start_command: flush buffers in the WIN32 code path as well

In reply to Johannes Schindelin

From: Johannes Sixt <[email protected]>

The POSIX code path did The Right Thing already, but we have to do the same on Windows.

This bug caused failures in t5526-fetch-submodules, where the output of 'git fetch --recurse-submodules' was in the wrong order.

---
Am 2/3/2011 21:26, schrieb Johannes Schindelin:

Quoted 2 lines

Have you seen my response where I proved that it is a fflush() issue, most likely with mingw_spawn()?

I think this is the correct fix.

 run-command.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
run-command.c +1 -1
index 2a1041e..f91e446 100644
@@ -194,6 +194,7 @@ fail_pipe:
 	}
 
 	trace_argv_printf(cmd->argv, "trace: run_command:");
+	fflush(NULL);
 
 #ifndef WIN32
 {
@@ -201,7 +202,6 @@ fail_pipe:
 	if (pipe(notify_pipe))
 		notify_pipe[0] = notify_pipe[1] = -1;
 
-	fflush(NULL);
 	cmd->pid = fork();
 	if (!cmd->pid) {
 		/*
Signature · 1 line
1.7.4.1253.g00c7
author
#9 lore raw

Re: [PATCH maint] start_command: flush buffers in the WIN32 code path as well

Quoted 33 lines · Johannes Sixt

From: Johannes Sixt <[email protected]>

The POSIX code path did The Right Thing already, but we have to do the same on Windows.

This bug caused failures in t5526-fetch-submodules, where the output of 'git fetch --recurse-submodules' was in the wrong order.

---
Am 2/3/2011 21:26, schrieb Johannes Schindelin:

Quoted 2 lines

Have you seen my response where I proved that it is a fflush() issue, most likely with mingw_spawn()?

I think this is the correct fix.

run-command.c | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)
run-command.c +1 -0
index 2a1041e..f91e446 100644
@@ -194,6 +194,7 @@ fail_pipe:
 	}
 
 	trace_argv_printf(cmd->argv, "trace: run_command:");
+	fflush(NULL);
 
 #ifndef WIN32
 {

run-command.c fail_pipe: · line 207

Quoted 7 lines
run-command.c +0 -1
@@ -201,7 +202,6 @@ fail_pipe:
 	if (pipe(notify_pipe))
 		notify_pipe[0] = notify_pipe[1] = -1;
 
-	fflush(NULL);
 	cmd->pid = fork();
 	if (!cmd->pid) {
 		/*

This fixes the issue for me on msysGit. Thanks.

Signature · 2 lines
Pat Thoyts                            http://www.patthoyts.tk/
PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD
#10 lore raw
In reply to Pat Thoyts

Hi,

Quoted 8 lines · Pat Thoyts

The following patches resolve some issues for msysGit running the v1.7.4 tests

 t/t3509-cherry-pick-merge-df.sh |    6 ++++--
 t/t4120-apply-popt.sh           |    9 +++++++--
 t/t5526-fetch-submodules.sh     |   32 ++++++++++++++++++--------------
 t/t7407-submodule-foreach.sh    |    4 ++++
 4 files changed, 33 insertions(+), 18 deletions(-)

I looked at the first three and think they are obviously fine.

As I mentioned, I would like to have a fix for the order in git-submodule. If you do not have the time, I will try to push aside some of the work I have to do here and investigate myself.

Ciao,
Dscho