bug-gnulib
[Top][All Lists]
Advanced

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

*sprintf tests: Avoid test failures on mingw 10


From: Bruno Haible
Subject: *sprintf tests: Avoid test failures on mingw 10
Date: Mon, 24 Apr 2023 10:59:26 +0200

On mingw 10.0.0, I see these test failures:

FAIL: test-snprintf-posix
=========================

../../gltests/test-snprintf-posix.h:3193: assertion 'strcmp (result, 
"00000000000303c 33") == 0' failed
FAIL test-snprintf-posix.exe (exit status: 3)

FAIL: test-sprintf-posix
========================

../../gltests/test-sprintf-posix.h:3169: assertion 'strcmp (result, 
"00000000000303c 33") == 0' failed
FAIL test-sprintf-posix.exe (exit status: 3)

FAIL: test-vasnprintf-posix
===========================

../../gltests/test-vasnprintf-posix.c:4151: assertion 'strcmp (result, 
"00000000000303c 33") == 0' failed
FAIL test-vasnprintf-posix.exe (exit status: 3)

FAIL: test-vasprintf-posix
==========================

../../gltests/test-vasprintf-posix.c:4092: assertion 'strcmp (result, 
"00000000000303c 33") == 0' failed
FAIL test-vasprintf-posix.exe (exit status: 3)

FAIL: test-vsnprintf-posix
==========================

../../gltests/test-snprintf-posix.h:3193: assertion 'strcmp (result, 
"00000000000303c 33") == 0' failed
FAIL test-vsnprintf-posix.exe (exit status: 3)

FAIL: test-vsprintf-posix
=========================

../../gltests/test-sprintf-posix.h:3169: assertion 'strcmp (result, 
"00000000000303c 33") == 0' failed
FAIL test-vsprintf-posix.exe (exit status: 3)

This patch fixes it.


2023-04-24  Bruno Haible  <bruno@clisp.org>

        *sprintf tests: Avoid test failures on mingw 10.
        * tests/test-vasnprintf-posix.c (test_function): On newer mingw, expect
        the de-facto standard result.
        * tests/test-vasprintf-posix.c (test_function): Likewise.
        * tests/test-snprintf-posix.h (test_function): Likewise.
        * tests/test-sprintf-posix.h (test_function): Likewise.

diff --git a/tests/test-snprintf-posix.h b/tests/test-snprintf-posix.h
index 90fcf61c5a..5b81910ec3 100644
--- a/tests/test-snprintf-posix.h
+++ b/tests/test-snprintf-posix.h
@@ -3190,7 +3190,8 @@ test_function (int (*my_snprintf) (char *, size_t, const 
char *, ...))
     /* Neither ISO C nor POSIX specify that the '0' flag is ignored when a 
width
        and a precision are both present.  But most implementations do so.  */
     #ifdef __MINGW32__
-    ASSERT (strcmp (result, "00000000000303c 33") == 0);
+    ASSERT (strcmp (result, "00000000000303c 33") == 0 /* mingw 5 */
+            || strcmp (result, "     000000303c 33") == 0 /* mingw 10 */);
     #else
     ASSERT (strcmp (result, "     000000303c 33") == 0);
     #endif
@@ -3252,7 +3253,8 @@ test_function (int (*my_snprintf) (char *, size_t, const 
char *, ...))
     /* Neither ISO C nor POSIX specify that the '0' flag is ignored when a 
width
        and a precision are both present.  But most implementations do so.  */
     #ifdef __MINGW32__
-    ASSERT (strcmp (result, "0x000000000303c 33") == 0);
+    ASSERT (strcmp (result, "0x000000000303c 33") == 0 /* mingw 5 */
+            || strcmp (result, "   0x000000303c 33") == 0 /* mingw 10 */);
     #else
     ASSERT (strcmp (result, "   0x000000303c 33") == 0);
     #endif
diff --git a/tests/test-sprintf-posix.h b/tests/test-sprintf-posix.h
index 6ea2052186..a0b5eb3391 100644
--- a/tests/test-sprintf-posix.h
+++ b/tests/test-sprintf-posix.h
@@ -3166,7 +3166,8 @@ test_function (int (*my_sprintf) (char *, const char *, 
...))
     /* Neither ISO C nor POSIX specify that the '0' flag is ignored when a 
width
        and a precision are both present.  But most implementations do so.  */
     #ifdef __MINGW32__
-    ASSERT (strcmp (result, "00000000000303c 33") == 0);
+    ASSERT (strcmp (result, "00000000000303c 33") == 0 /* mingw 5 */
+            || strcmp (result, "     000000303c 33") == 0 /* mingw 10 */);
     #else
     ASSERT (strcmp (result, "     000000303c 33") == 0);
     #endif
@@ -3228,7 +3229,8 @@ test_function (int (*my_sprintf) (char *, const char *, 
...))
     /* Neither ISO C nor POSIX specify that the '0' flag is ignored when a 
width
        and a precision are both present.  But most implementations do so.  */
     #ifdef __MINGW32__
-    ASSERT (strcmp (result, "0x000000000303c 33") == 0);
+    ASSERT (strcmp (result, "0x000000000303c 33") == 0 /* mingw 5 */
+            || strcmp (result, "   0x000000303c 33") == 0 /* mingw 10 */);
     #else
     ASSERT (strcmp (result, "   0x000000303c 33") == 0);
     #endif
diff --git a/tests/test-vasnprintf-posix.c b/tests/test-vasnprintf-posix.c
index 9eb042c552..51b1d26a33 100644
--- a/tests/test-vasnprintf-posix.c
+++ b/tests/test-vasnprintf-posix.c
@@ -4148,7 +4148,8 @@ test_function (char * (*my_asnprintf) (char *, size_t *, 
const char *, ...))
     /* Neither ISO C nor POSIX specify that the '0' flag is ignored when a 
width
        and a precision are both present.  But most implementations do so.  */
     #ifdef __MINGW32__
-    ASSERT (strcmp (result, "00000000000303c 33") == 0);
+    ASSERT (strcmp (result, "00000000000303c 33") == 0 /* mingw 5 */
+            || strcmp (result, "     000000303c 33") == 0 /* mingw 10 */);
     #else
     ASSERT (strcmp (result, "     000000303c 33") == 0);
     #endif
@@ -4234,7 +4235,8 @@ test_function (char * (*my_asnprintf) (char *, size_t *, 
const char *, ...))
     /* Neither ISO C nor POSIX specify that the '0' flag is ignored when a 
width
        and a precision are both present.  But most implementations do so.  */
     #ifdef __MINGW32__
-    ASSERT (strcmp (result, "0x000000000303c 33") == 0);
+    ASSERT (strcmp (result, "0x000000000303c 33") == 0 /* mingw 5 */
+            || strcmp (result, "   0x000000303c 33") == 0 /* mingw 10 */);
     #else
     ASSERT (strcmp (result, "   0x000000303c 33") == 0);
     #endif
diff --git a/tests/test-vasprintf-posix.c b/tests/test-vasprintf-posix.c
index e4cc0fb983..858a477a43 100644
--- a/tests/test-vasprintf-posix.c
+++ b/tests/test-vasprintf-posix.c
@@ -4089,7 +4089,8 @@ test_function (int (*my_asprintf) (char **, const char *, 
...))
     /* Neither ISO C nor POSIX specify that the '0' flag is ignored when a 
width
        and a precision are both present.  But most implementations do so.  */
     #ifdef __MINGW32__
-    ASSERT (strcmp (result, "00000000000303c 33") == 0);
+    ASSERT (strcmp (result, "00000000000303c 33") == 0 /* mingw 5 */
+            || strcmp (result, "     000000303c 33") == 0 /* mingw 10 */);
     #else
     ASSERT (strcmp (result, "     000000303c 33") == 0);
     #endif
@@ -4175,7 +4176,8 @@ test_function (int (*my_asprintf) (char **, const char *, 
...))
     /* Neither ISO C nor POSIX specify that the '0' flag is ignored when a 
width
        and a precision are both present.  But most implementations do so.  */
     #ifdef __MINGW32__
-    ASSERT (strcmp (result, "0x000000000303c 33") == 0);
+    ASSERT (strcmp (result, "0x000000000303c 33") == 0 /* mingw 5 */
+            || strcmp (result, "   0x000000303c 33") == 0 /* mingw 10 */);
     #else
     ASSERT (strcmp (result, "   0x000000303c 33") == 0);
     #endif






reply via email to

[Prev in Thread] Current Thread [Next in Thread]