threads / patch / 46532

patcht3700: fix broken test under !POSIXPERM

Subject: [PATCH] t3700: fix broken test under !POSIXPERM

## tl;dr

4 messages between Aug 7, 2017 and Aug 8, 2017. Diffs are folded; open one to read it.

replies: 3people: 2as markdown or json

René Scharfe· Aug 7, 2017, 19:53 UTC · lore

76e368c378 (t3700: fix broken test under !SANITY) explains that the test 'git add --chmod=[+-]x changes index with already added file' can fail if xfoo3 is still present as a symlink from a previous test and deletes it with rm(1). That still leaves it present in the index, which causes the test to fail if POSIXPERM is not defined. Get rid of it by calling "git reset --hard" instead, as 76e368c378 already mentioned in passing.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
---
 t/t3700-add.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to t/t3700-add.sh +1 −1
diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index f3a4b4a913..4111fa3b7a 100755
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
@@ -355,7 +355,7 @@ test_expect_success POSIXPERM,SYMLINKS 'git add --chmod=+x with symlinks' '
 '
 
 test_expect_success 'git add --chmod=[+-]x changes index with already added file' '
-	rm -f foo3 xfoo3 &&
+	git reset --hard &&
 	echo foo >foo3 &&
 	git add foo3 &&
 	git add --chmod=+x foo3 &&
-- 
2.14.0
René Scharfe· Aug 8, 2017, 19:21 UTC · re: René Scharfe · lore

[PATCH v2] t3700: fix broken test under !POSIXPERM

76e368c378 (t3700: fix broken test under !SANITY) explains that the test 'git add --chmod=[+-]x changes index with already added file' can fail if xfoo3 is still present as a symlink from a previous test and deletes it with rm(1). That still leaves it present in the index, which causes the test to fail if POSIXPERM is not defined. Get rid of it by calling "git reset --hard" as well, as 76e368c378 already mentioned in passing.

Helped-by: Adam Dinwoodie <adam@dinwoodie.org>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
---
Change since v1: Keep the rm(1) call to avoid a problem on Cygwin.
 t/t3700-add.sh | 1 +
 1 file changed, 1 insertion(+)
Show changes to t/t3700-add.sh +1 −0
diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index f3a4b4a913..0aae21d698 100755
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
@@ -356,6 +356,7 @@ test_expect_success POSIXPERM,SYMLINKS 'git add --chmod=+x with symlinks' '
 
 test_expect_success 'git add --chmod=[+-]x changes index with already added file' '
 	rm -f foo3 xfoo3 &&
+	git reset --hard &&
 	echo foo >foo3 &&
 	git add foo3 &&
 	git add --chmod=+x foo3 &&
-- 
2.14.0
Ramsay Jones· Aug 8, 2017, 19:32 UTC · re: René Scharfe · lore

Re: [PATCH v2] t3700: fix broken test under !POSIXPERM

On 08/08/17 20:21, René Scharfe wrote:
Show 6 quoted lines
> 76e368c378 (t3700: fix broken test under !SANITY) explains that the test
> 'git add --chmod=[+-]x changes index with already added file' can fail
> if xfoo3 is still present as a symlink from a previous test and deletes
> it with rm(1).  That still leaves it present in the index, which causes
> the test to fail if POSIXPERM is not defined.  Get rid of it by calling
> "git reset --hard" as well, as 76e368c378 already mentioned in passing.

Hmm, I don't think its POSIXPERM (which is defined on cygwin) but the lack of SANITY that is the problem. The test would fail on Linux as well, if it skipped the prior tests marked with SANITY (they get rid of the xfoo3->xfoo2 symlinks, among others).

Ack, this fixes it for me.

ATB, Ramsay Jones

Show 22 quoted lines
> 
> Helped-by: Adam Dinwoodie <adam@dinwoodie.org>
> Signed-off-by: Rene Scharfe <l.s.r@web.de>
> ---
> Change since v1: Keep the rm(1) call to avoid a problem on Cygwin.
> 
>  t/t3700-add.sh | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/t/t3700-add.sh b/t/t3700-add.sh
> index f3a4b4a913..0aae21d698 100755
> --- a/t/t3700-add.sh
> +++ b/t/t3700-add.sh
> @@ -356,6 +356,7 @@ test_expect_success POSIXPERM,SYMLINKS 'git add --chmod=+x with symlinks' '
>  
>  test_expect_success 'git add --chmod=[+-]x changes index with already added file' '
>  	rm -f foo3 xfoo3 &&
> +	git reset --hard &&
>  	echo foo >foo3 &&
>  	git add foo3 &&
>  	git add --chmod=+x foo3 &&
> 
Ramsay Jones· Aug 8, 2017, 19:39 UTC · re: Ramsay Jones · lore

Re: [PATCH v2] t3700: fix broken test under !POSIXPERM

On 08/08/17 20:32, Ramsay Jones wrote:
Show 14 quoted lines
> 
> 
> On 08/08/17 20:21, René Scharfe wrote:
>> 76e368c378 (t3700: fix broken test under !SANITY) explains that the test
>> 'git add --chmod=[+-]x changes index with already added file' can fail
>> if xfoo3 is still present as a symlink from a previous test and deletes
>> it with rm(1).  That still leaves it present in the index, which causes
>> the test to fail if POSIXPERM is not defined.  Get rid of it by calling
>> "git reset --hard" as well, as 76e368c378 already mentioned in passing.
> 
> Hmm, I don't think its POSIXPERM (which is defined on cygwin) but
> the lack of SANITY that is the problem. The test would fail on Linux
> as well, if it skipped the prior tests marked with SANITY (they get
> rid of the xfoo3->xfoo2 symlinks, among others).
Yep, I didn't read the commit message properly! ;-)
Show 29 quoted lines
> 
> Ack, this fixes it for me.
> 
> ATB,
> Ramsay Jones
> 
>>
>> Helped-by: Adam Dinwoodie <adam@dinwoodie.org>
>> Signed-off-by: Rene Scharfe <l.s.r@web.de>
>> ---
>> Change since v1: Keep the rm(1) call to avoid a problem on Cygwin.
>>
>>  t/t3700-add.sh | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/t/t3700-add.sh b/t/t3700-add.sh
>> index f3a4b4a913..0aae21d698 100755
>> --- a/t/t3700-add.sh
>> +++ b/t/t3700-add.sh
>> @@ -356,6 +356,7 @@ test_expect_success POSIXPERM,SYMLINKS 'git add --chmod=+x with symlinks' '
>>  
>>  test_expect_success 'git add --chmod=[+-]x changes index with already added file' '
>>  	rm -f foo3 xfoo3 &&
>> +	git reset --hard &&
>>  	echo foo >foo3 &&
>>  	git add foo3 &&
>>  	git add --chmod=+x foo3 &&
>>
> 

← back to recent threads