From: Bruno Haible Date: Sat, 25 May 2024 10:27:44 +0000 (+0200) Subject: mcel tests: Avoid test failures due to broken GB18030 converter. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=28a8b2a301663259864e026015cff3896e441be3;p=gnulib.git mcel tests: Avoid test failures due to broken GB18030 converter. * tests/test-mcel.c (main): Skip most GB18030 tests on platforms where the GB18030 converter is known to be broken. --- diff --git a/ChangeLog b/ChangeLog index cc5ed40c95..244121361a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2024-05-25 Bruno Haible + + mcel tests: Avoid test failures due to broken GB18030 converter. + * tests/test-mcel.c (main): Skip most GB18030 tests on platforms where + the GB18030 converter is known to be broken. + 2024-05-25 Bruno Haible mcel tests: Fix typo. diff --git a/tests/test-mcel.c b/tests/test-mcel.c index ab6b7dd8d3..e0e9f87814 100644 --- a/tests/test-mcel.c +++ b/tests/test-mcel.c @@ -44,7 +44,7 @@ test_mcel_vs_mbrtoc32 (unsigned char uc, mcel_t c, size_t n, char32_t ch) } int -main (void) +main (int argc, char *argv[]) { /* configure should already have checked that the locale is supported. */ if (setlocale (LC_ALL, "") == NULL) @@ -75,6 +75,18 @@ main (void) if (ch == CHAR_MAX) break; } + + if (argc > 1 && argv[1][0] == '5') + { + /* Locale encoding is GB18030. */ + if (test_exit_status != EXIT_SUCCESS) + return test_exit_status; + #if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun)) + fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr); + return 77; + #endif + } + for (int ch = 0x80; ch < 0x200; ch++) { mcel_t c = mcel_ch (ch, 2);