threads / patch / 26400

patchsome test fixes for msysGit

Subject: [PATCH] some test fixes for msysGit

## tl;dr

11 messages between Feb 3, 2011 and Feb 4, 2011. Diffs are folded; open one to read it.

replies: 10people: 3as markdown or json

Pat Thoyts· Feb 3, 2011, 15:31 UTC · lore
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(-)
Pat Thoyts· Feb 3, 2011, 15:31 UTC · re: Pat Thoyts · lore

[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.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
---
 t/t3509-cherry-pick-merge-df.sh |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
Show changes to t/t3509-cherry-pick-merge-df.sh +4 −2
diff --git a/t/t3509-cherry-pick-merge-df.sh b/t/t3509-cherry-pick-merge-df.sh
index 948ca1b..df921d1 100755
--- a/t/t3509-cherry-pick-merge-df.sh
+++ b/t/t3509-cherry-pick-merge-df.sh
@@ -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 &&
-- 
1.7.4.msysgit.0
Pat Thoyts· Feb 3, 2011, 15:31 UTC · re: Pat Thoyts · lore

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

From: Johannes Sixt <j6t@kdbg.org>

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.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
---
 t/t4120-apply-popt.sh |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
Show changes to t/t4120-apply-popt.sh +7 −2
diff --git a/t/t4120-apply-popt.sh b/t/t4120-apply-popt.sh
index 579c9e6..a33d510 100755
--- a/t/t4120-apply-popt.sh
+++ b/t/t4120-apply-popt.sh
@@ -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
 '
 
-- 
1.7.4.msysgit.0
Pat Thoyts· Feb 3, 2011, 15:31 UTC · re: Pat Thoyts · lore

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

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
---
 t/t7407-submodule-foreach.sh |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
Show changes to t/t7407-submodule-foreach.sh +4 −0
diff --git a/t/t7407-submodule-foreach.sh b/t/t7407-submodule-foreach.sh
index 1d67ef5..4c84764 100755
--- a/t/t7407-submodule-foreach.sh
+++ b/t/t7407-submodule-foreach.sh
@@ -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
 '
 
-- 
1.7.4.msysgit.0
Pat Thoyts· Feb 3, 2011, 15:31 UTC · re: Pat Thoyts · lore

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

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(-)
Show changes to t/t5526-fetch-submodules.sh +18 −14
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
Johannes Sixt· Feb 3, 2011, 20:08 UTC · re: Pat Thoyts · lore

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

On Donnerstag, 3. Februar 2011, Pat Thoyts wrote:
> +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
Johannes Schindelin· Feb 3, 2011, 20:26 UTC · re: Johannes Sixt · lore

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

Hi,
On Thu, 3 Feb 2011, Johannes Sixt wrote:
Show 9 quoted lines
> On Donnerstag, 3. Februar 2011, Pat Thoyts wrote:
> > +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

Johannes Sixt· Feb 3, 2011, 20:56 UTC · re: Johannes Schindelin · lore

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

On Donnerstag, 3. Februar 2011, Johannes Schindelin wrote:
Show 6 quoted lines
> On Thu, 3 Feb 2011, Johannes Sixt wrote:
> > 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
Johannes Sixt· Feb 4, 2011, 08:41 UTC · re: Johannes Schindelin · lore

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

From: Johannes Sixt <j6t@kdbg.org>

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.

Debugged-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
Am 2/3/2011 21:26, schrieb Johannes Schindelin:
> 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(-)
Show changes to run-command.c +1 −1
diff --git a/run-command.c b/run-command.c
index 2a1041e..f91e446 100644
--- a/run-command.c
+++ b/run-command.c
@@ -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) {
 		/*
-- 
1.7.4.1253.g00c7
Pat Thoyts· Feb 4, 2011, 11:23 UTC · re: Johannes Sixt · lore

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

Johannes Sixt <j.sixt@viscovery.net> writes:
Show 40 quoted lines
>From: Johannes Sixt <j6t@kdbg.org>
>
>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.
>
>Debugged-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
>Signed-off-by: Johannes Sixt <j6t@kdbg.org>
>---
>Am 2/3/2011 21:26, schrieb Johannes Schindelin:
>> 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(-)
>
>diff --git a/run-command.c b/run-command.c
>index 2a1041e..f91e446 100644
>--- a/run-command.c
>+++ b/run-command.c
>@@ -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) {
> 		/*
This fixes the issue for me on msysGit. Thanks.
-- 
Pat Thoyts                            http://www.patthoyts.tk/
PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD
Johannes Schindelin· Feb 3, 2011, 16:29 UTC · re: Pat Thoyts · lore

Re: [msysGit] [PATCH] some test fixes for msysGit

Hi,
On Thu, 3 Feb 2011, Pat Thoyts wrote:
Show 8 quoted lines
> 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

← back to recent threads