From 1e08a7985f751602cea62f5cb2b3e6cb42b9991f Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 25 May 2024 12:27:44 +0200 Subject: [PATCH] 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. --- ChangeLog | 6 ++++++ tests/test-mcel.c | 12 +++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1862d1d498..5e3e5fab4b 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 22ec6c3850..bd5949a1f2 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,16 @@ main (void) if (ch == CHAR_MAX) break; } + + if (argc > 1 && argv[1][0] == '5') + { + /* Locale encoding is GB18030. */ + #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); -- 2.39.5