Re: [PATCH] t9129: Prevent test failure if no UTF-8 locale

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

 



applehq <theappleman@xxxxxxxxx> writes:

> Commit 16fc08e2d86dad152194829d21bc55b2ef0c8fb1 introduced a
> test that failed if the en_US.UTF-8 locale was not installed.
>
> Make the test find a UTF-8 locale, and expect failure.

NAK on the latter one.

test_expect_failure does not mean "This might, and it is Ok to, fail", as
you seem to think.  It means "This should succeed if our software is not
buggy, but there is a known breakage to cause it to fail, so this test is
marked as such until the bug is fixed."

Skipping the test on a platform that lacks necessary locale is fine, but
if you run the test, they should expect success.  Otherwise you cannot
tell if it is a platform issue (i.e. not having any UTF-8 locale) or
a bug in the software (i.e. git-svn not working as expected).

> Signed-off-by: applehq <theappleman@xxxxxxxxx>

Sign off with an unreal name, hmm..., what good would that give us...?

> @@ -15,8 +15,9 @@ compare_git_head_with () {
>  }
>  
>  compare_svn_head_with () {
> -	LC_ALL=en_US.UTF-8 svn log --limit 1 `git svn info --url` | \
> -		sed -e 1,3d -e "/^-\{1,\}\$/d" >current &&
> +	LC_ALL=`locale -a | grep -i utf | head -1` \
> +		svn log --limit 1 `git svn info --url` | \
> +			sed -e 1,3d -e "/^-\{1,\}\$/d" >current &&

I think what this part tries to do is good, in that we do not care if it
is en_US UTF-8 or any other UTF-8.  But cramming that logic all in one
pipeline (and an inefficient one at that) makes it harder to read.

Do something like this upfront:

	a_utf8_locale=$(locale -a | sed -ne '/[Uu][Tt][Ff]-*8/{
        	p
                q
	'})

and if that variable is empty then skip the test that relies on having a
UTF-8 locale on the platform.  Then the function can say:

	LC_ALL="$a_utf8_locale" svn log --limit 1 ...
--
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]

  Powered by Linux