Re: [PATCH] t1304,t2007: quell output to stdout and stderr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jonathan Nieder venit, vidit, dixit 21.04.2010 16:45:
> Hi Michael,
> 
> Michael J Gruber wrote:
> 
>> --- a/t/t1304-default-acl.sh
>> +++ b/t/t1304-default-acl.sh
>> @@ -15,7 +15,7 @@ umask 077
>>  # is a good candidate: exists on all unices, and it has permission
>>  # anyway, so we don't create a security hole running the testsuite.
>>  
>> -if ! setfacl -m u:root:rwx .; then
>> +if ! setfacl -m u:root:rwx . 2>/dev/null; then
>>      say "Skipping ACL tests: unable to use setfacl"
>>      test_done
>>  fi
> [and a similar suppression of ‘git checkout’ output]
> 
> In the spirit of commit 4a45f7d (Use test_expect_success for test
> setups, 2010-03-20), might it make sense to turn these into tests?

In principle yes, of course, I've done this in other cases. But note
that here, on both occasions, the test script wants to exit if
prerequisites are not met. I don't think it's OK to exit or test_done
from within test_expect_something, is it?

> I am imagining something like this.
> 
> diff --git a/t/t1304-default-acl.sh b/t/t1304-default-acl.sh
> index b26d2e8..8b3ff7a 100755
> --- a/t/t1304-default-acl.sh
> +++ b/t/t1304-default-acl.sh
> @@ -15,7 +15,15 @@ umask 077
>  # is a good candidate: exists on all unices, and it has permission
>  # anyway, so we don't create a security hole running the testsuite.
>  
> -if ! setfacl -m u:root:rwx . 2>/dev/null; then
> +test_expect_success 'Setup: try to set an ACL' '
> +	if setfacl -m u:root:rwx .
> +	then
> +		test_set_prereq ACL
> +	fi
> +'
> +
> +if ! test_have_prereq ACL
> +then
>      say "Skipping ACL tests: unable to use setfacl"
>      test_done
>  fi
> diff --git a/t/t2007-checkout-symlink.sh b/t/t2007-checkout-symlink.sh
> index fc5db05..f8f40e5 100755
> --- a/t/t2007-checkout-symlink.sh
> +++ b/t/t2007-checkout-symlink.sh
> @@ -44,11 +44,12 @@ test_expect_success 'switch from symlink to dir' '
>  
>  '
>  
> -rm -fr frotz xyzzy nitfol &&
> -git checkout -q -f master || exit
> -
>  test_expect_success 'switch from dir to symlink' '
>  
> +	rm -fr frotz xyzzy nitfol &&
> +	git rm -fr . &&
> +	git checkout -f master &&
> +
>  	git checkout side
>  
>  '
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]