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




commit ac7e1f7a144e3ea220ec5fcdaead4f4e2f45782f
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 | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/glib/tests/test-printf.c b/glib/tests/test-printf.c
index 77eb76a4a..acbba955e 100644
--- a/glib/tests/test-printf.c
+++ b/glib/tests/test-printf.c
@@ -918,11 +918,14 @@ test_vasprintf_va (gchar       **string,
 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 +934,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]