[glib/wip/pwithnall/more-test-fixes: 1/2] tests: Skip vasprintf() placeholder checks on FreeBSD and macOS




commit dbe34687d0f3ed02e249b3ccb98ee51160ea66ed
Author: Philip Withnall <pwithnall endlessos org>
Date:   Mon Mar 14 16:04:29 2022 +0000

    tests: Skip vasprintf() placeholder checks on FreeBSD and macOS
    
    The `vasprintf()` version on those platforms seems to do less rigorous
    checking of format placeholders.
    
    See https://gitlab.gnome.org/GNOME/glib/-/jobs/1890001 and
    https://gitlab.gnome.org/GNOME/glib/-/jobs/1890000.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 glib/tests/test-printf.c | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/glib/tests/test-printf.c b/glib/tests/test-printf.c
index 77eb76a4a..6eadf1e98 100644
--- a/glib/tests/test-printf.c
+++ b/glib/tests/test-printf.c
@@ -895,6 +895,7 @@ test_upper_bound (void)
   g_assert_cmpint (res, ==, 20);
 }
 
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
 static gint test_vasprintf_va (gchar       **string,
                                const gchar  *format,
                                ...) G_GNUC_PRINTF (2, 3);
@@ -914,15 +915,19 @@ test_vasprintf_va (gchar       **string,
 
   return len;
 }
+#endif  /* !defined(__APPLE__) && !defined(__FreeBSD__) */
 
 static void
 test_vasprintf_invalid_format_placeholder (void)
 {
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
   gint len = 0;
   gchar *buf = "some non-null string";
+#endif
 
   g_test_summary ("Test error handling for invalid format placeholder in g_vasprintf()");
 
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wformat"
 #pragma GCC diagnostic ignored "-Wformat-extra-args"
@@ -931,6 +936,9 @@ test_vasprintf_invalid_format_placeholder (void)
 
   g_assert_cmpint (len, ==, -1);
   g_assert_null (buf);
+#else
+  g_test_skip ("vasprintf() placeholder checks on BSDs are less strict");
+#endif
 }
 
 int


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