[glib/wip/test_timeval_to_iso8601_overflow-skip-on-32-bit] tests/timer: Skip test_timeval_to_iso8601_overflow if we can't overflow a GTimeVal



commit c7f5cff7d2d552a4b03c0e324097794e94273f86
Author: Iain Lane <iainl gnome org>
Date:   Mon Sep 3 17:40:45 2018 +0100

    tests/timer: Skip test_timeval_to_iso8601_overflow if we can't overflow a GTimeVal
    
    On 32 bit systems, the size of a long might be the same as the size of
    an int. In that case, we won't be able to get an overflow when
    converting from a GTimeVal to a time_t. Skip the test for this in that
    case.

 glib/tests/timer.c | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/glib/tests/timer.c b/glib/tests/timer.c
index 5ee191dd9..05a6b7b75 100644
--- a/glib/tests/timer.c
+++ b/glib/tests/timer.c
@@ -258,6 +258,11 @@ test_timeval_to_iso8601_overflow (void)
   GTimeVal val;
   gchar *out = NULL;
 
+  if ((glong) G_MAXINT == G_MAXLONG) {
+    g_test_skip ("G_MAXINT == G_MAXLONG - we can't make g_time_val_to_iso8601() overflow.");
+    return;
+  }
+
   g_unsetenv ("TZ");
 
   val.tv_sec = G_MAXLONG;


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