]> Savannah Git Hosting - gnulib.git/commitdiff
mcel tests: Avoid test failures due to broken GB18030 converter.
authorBruno Haible <bruno@clisp.org>
Sat, 25 May 2024 10:27:44 +0000 (12:27 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 25 May 2024 10:27:44 +0000 (12:27 +0200)
* tests/test-mcel.c (main): Skip most GB18030 tests on platforms where
the GB18030 converter is known to be broken.

ChangeLog
tests/test-mcel.c

index cc5ed40c95048ad5e292e59c540668096f2d34e0..244121361a23a0e2303f8d7beb4430bff8743c4d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-05-25  Bruno Haible  <bruno@clisp.org>
+
+       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  <bruno@clisp.org>
 
        mcel tests: Fix typo.
index ab6b7dd8d3051df863a9e937edb23b305fdc6ee8..e0e9f87814d3032251f521e1c70df21358118e22 100644 (file)
@@ -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);