]> Savannah Git Hosting - gnulib.git/commitdiff
strftime-tests: avoid false failure on OS X
authorPádraig Brady <P@draigBrady.com>
Tue, 22 Dec 2015 15:45:56 +0000 (15:45 +0000)
committerPádraig Brady <P@draigBrady.com>
Wed, 23 Dec 2015 00:36:05 +0000 (00:36 +0000)
* tests/test-strftime.c (struct localtime_rz_test): Add an
ahistorical member which is used to warn rather than fail
when tm_isdst isn't set for such entries.  This is the case for
"1970-01-01 13:00:00 +1300 (NZDT)" on Darwin 13/14 at least.

ChangeLog
tests/test-strftime.c

index 4b0eb39b942516c1274ae86a3e121f581eeaee3d..525cc0fed58f7d94855bf56150b3da13f5426d4f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2015-12-23  Pádraig Brady  <P@draigBrady.com>
+
+       strftime-tests: avoid false failure on OS X
+       * tests/test-strftime.c (struct localtime_rz_test): Add an
+       ahistorical member which is used to warn rather than fail
+       when tm_isdst isn't set for such entries.  This is the case for
+       "1970-01-01 13:00:00 +1300 (NZDT)" on Darwin 13/14 at least.
+
 2015-12-20  Kamil Dudka  <kdudka@redhat.com>
 
        fts: ensure leaf optimization is used for NFS
index 5cd48143f1bbe797924788fcc357def48ad67fc3..efe938edff142a08228e2523a2df0375c7f8c0aa 100644 (file)
@@ -107,30 +107,32 @@ struct localtime_rz_test
 
   /* Expected result.  */
   char const *exp;
+
+  /* Determines if an incorrectly unset tm_isdst
+     results in failure or just a warning.  */
+  int ahistorical;
 };
 
-/* Entries marked "!" are ahistorical, but that's OK; we're just
-   testing the API here.  */
 static struct localtime_rz_test LT[] =
   {
-    { TZ+Pacific,          0, "1969-12-31 16:00:00 -0800 (PST)"  },
-    { TZ+Arizona,          0, "1969-12-31 17:00:00 -0700 (MST)"  },
-    { TZ+UTC    ,          0, "1970-01-01 00:00:00 +0000 (UTC)"  },
-    { TZ+CentEur,          0, "1970-01-01 01:00:00 +0100 (CET)"  },
-    { TZ+Japan  ,          0, "1970-01-01 09:00:00 +0900 (JST)"  },
-    { TZ+NZ     ,          0, "1970-01-01 13:00:00 +1300 (NZDT)" }, /* ! */
-    { TZ+Pacific,  500000001, "1985-11-04 16:53:21 -0800 (PST)"  },
-    { TZ+Arizona,  500000001, "1985-11-04 17:53:21 -0700 (MST)"  },
-    { TZ+UTC    ,  500000001, "1985-11-05 00:53:21 +0000 (UTC)"  },
-    { TZ+CentEur,  500000001, "1985-11-05 01:53:21 +0100 (CET)"  }, /* ! */
-    { TZ+Japan  ,  500000001, "1985-11-05 09:53:21 +0900 (JST)"  },
-    { TZ+NZ     ,  500000001, "1985-11-05 13:53:21 +1300 (NZDT)" },
-    { TZ+Pacific, 1000000002, "2001-09-08 18:46:42 -0700 (PDT)"  },
-    { TZ+Arizona, 1000000002, "2001-09-08 18:46:42 -0700 (MST)"  },
-    { TZ+UTC    , 1000000002, "2001-09-09 01:46:42 +0000 (UTC)"  },
-    { TZ+CentEur, 1000000002, "2001-09-09 03:46:42 +0200 (CEST)" },
-    { TZ+Japan  , 1000000002, "2001-09-09 10:46:42 +0900 (JST)"  },
-    { TZ+NZ     , 1000000002, "2001-09-09 13:46:42 +1200 (NZST)" },
+    { TZ+Pacific,          0, "1969-12-31 16:00:00 -0800 (PST)",  0 },
+    { TZ+Arizona,          0, "1969-12-31 17:00:00 -0700 (MST)",  0 },
+    { TZ+UTC    ,          0, "1970-01-01 00:00:00 +0000 (UTC)",  0 },
+    { TZ+CentEur,          0, "1970-01-01 01:00:00 +0100 (CET)",  0 },
+    { TZ+Japan  ,          0, "1970-01-01 09:00:00 +0900 (JST)",  0 },
+    { TZ+NZ     ,          0, "1970-01-01 13:00:00 +1300 (NZDT)", 1 },
+    { TZ+Pacific,  500000001, "1985-11-04 16:53:21 -0800 (PST)",  0 },
+    { TZ+Arizona,  500000001, "1985-11-04 17:53:21 -0700 (MST)",  0 },
+    { TZ+UTC    ,  500000001, "1985-11-05 00:53:21 +0000 (UTC)",  0 },
+    { TZ+CentEur,  500000001, "1985-11-05 01:53:21 +0100 (CET)",  1 },
+    { TZ+Japan  ,  500000001, "1985-11-05 09:53:21 +0900 (JST)",  0 },
+    { TZ+NZ     ,  500000001, "1985-11-05 13:53:21 +1300 (NZDT)", 0 },
+    { TZ+Pacific, 1000000002, "2001-09-08 18:46:42 -0700 (PDT)",  0 },
+    { TZ+Arizona, 1000000002, "2001-09-08 18:46:42 -0700 (MST)",  0 },
+    { TZ+UTC    , 1000000002, "2001-09-09 01:46:42 +0000 (UTC)",  0 },
+    { TZ+CentEur, 1000000002, "2001-09-09 03:46:42 +0200 (CEST)", 0 },
+    { TZ+Japan  , 1000000002, "2001-09-09 10:46:42 +0900 (JST)",  0 },
+    { TZ+NZ     , 1000000002, "2001-09-09 13:46:42 +1200 (NZST)", 0 },
     { 0 }
   };
 
@@ -186,7 +188,10 @@ tzalloc_test (void)
                  && memcmp (buf, LT[i].exp, n - sizeof "(GMT)" + 1) == 0
                  && STREQ (buf + n - sizeof "(GMT)" + 1, "(GMT)"))))
         {
-          fail = 1;
+          /* Don't fail for unhandled dst in ahistorical entries,
+             as gnulib doesn't currently fix that issue, seen on Darwin 14.  */
+          if (!LT[i].ahistorical || tm.tm_isdst)
+            fail = 1;
           printf ("%s: expected \"%s\", got \"%s\"\n",
                   setting, LT[i].exp, buf);
         }