git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] t: use user-specific utf-8 locale for testing

From
Jeff King <peff@peff.net>
Date
Jun 3, 2021, 19:27 UTC
Message-ID
<YLktKeMXoZ/6wHqT@coredump.intra.peff.net>
In-Reply-To
<20210602114646.17463-1-congdanhqx@gmail.com>
On Wed, Jun 02, 2021 at 06:46:46PM +0700, Đoàn Trần Công Danh wrote:
Show 12 quoted lines
> In some test-cases, utf-8 locale is required. To find such locale,
> we're using the first available UTF-8 locale that returned by
> "locale -a".
> 
> Despite being required by POSIX, locale(1) is unavailable in some
> systems, e.g. Linux with musl libc.  Some of those systems support
> utf-8 locale out of the box.
> 
> However, without "locale -a", we can't guess provided UTF-8 locale.
> 
> Let's give users of those systems an option to have better test
> coverage.

That makes sense. At first I thought this was fixing a test breakage, and wondered if we should simply be skipping the tests. But after reading more carefully, we already are doing that, and this is just allowing those tests to run in more places (you even said so in the last sentence above, but I missed it, so I am calling it out).

I kind of wonder if trying "C.UTF-8" would be a reasonable fallback so that people don't even have to set this extra Makefile knob. But I'm not sure if we have a good way of testing if that locale works (if we can't find the "locale" binary). So this is probably a reasonable medium ground.

Show 7 quoted lines
> ---
>  Makefile                                 |  6 ++++++
>  t/lib-git-svn.sh                         | 15 +++++++++------
>  t/t9100-git-svn-basic.sh                 | 14 +++-----------
>  t/t9115-git-svn-dcommit-funky-renames.sh |  6 +++---
>  t/t9129-git-svn-i18n-commitencoding.sh   |  4 ++--
>  5 files changed, 23 insertions(+), 22 deletions(-)
I think we test musl in our ci builds; should we do something like:
diff --git a/ci/lib.sh b/ci/lib.sh
index d848c036c5..ec67398c18 100755
--- a/ci/lib.sh
+++ b/ci/lib.sh
@@ -229,6 +229,7 @@ linux-musl)
 	CC=gcc
 	MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=/usr/bin/python3 USE_LIBPCRE2=Yes"
 	MAKEFLAGS="$MAKEFLAGS NO_REGEX=Yes ICONV_OMITS_BOM=Yes"
+	MAKEFLAGS="$MAKEFLAGS GIT_TEST_UTF8_LOCALE=something.UTF-8?"
 	;;
 esac
 

here, too (I don't know what the correct "something" is here; maybe
"C")?

-Peff
Previous: Ævar Arnfjörð BjarmasonNext: Bagas Sanjaya
Message 4 of 19 in “t: use user-specific utf-8 locale for testing”
  1. t: use user-specific utf-8 locale for testingĐoàn Trần Công Danh, Jun 2, 2021
  2. Taylor BlauJun 2, 2021
  3. Ævar Arnfjörð BjarmasonJun 8, 2021
  4. Jeff KingJun 3, 2021
  5. Bagas SanjayaJun 4, 2021
  6. Đoàn Trần Công DanhJun 4, 2021
  7. t: use user-specific utf-8 locale for testingĐoàn Trần Công Danh, Jun 6, 2021
  8. Torsten BögershausenJun 6, 2021
  9. Junio C HamanoJun 7, 2021
  10. t: use pre-defined utf-8 locale for testing svnĐoàn Trần Công Danh, Jun 7, 2021
  11. Junio C HamanoJun 7, 2021
  12. Torsten BögershausenJun 7, 2021
  13. Đoàn Trần Công DanhJun 7, 2021
  14. Jeff KingJun 8, 2021
  15. Đoàn Trần Công DanhJun 8, 2021
  16. t: use user-specified utf-8 locale for testing svnĐoàn Trần Công Danh, Jun 7, 2021
  17. Jeff KingJun 8, 2021
  18. t: use user-specified utf-8 locale for testing svnĐoàn Trần Công Danh, Jun 8, 2021
  19. Jeff KingJun 8, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.