From: Pádraig Brady Date: Tue, 22 Dec 2015 15:45:56 +0000 (+0000) Subject: strftime-tests: avoid false failure on OS X X-Git-Tag: v1.0~6876 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=81d0a26465c44b2041fcf9a6ec08a0cd43776825;p=gnulib.git 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. --- diff --git a/ChangeLog b/ChangeLog index 4b0eb39b94..525cc0fed5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2015-12-23 Pádraig Brady + + 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 fts: ensure leaf optimization is used for NFS diff --git a/tests/test-strftime.c b/tests/test-strftime.c index 5cd48143f1..efe938edff 100644 --- a/tests/test-strftime.c +++ b/tests/test-strftime.c @@ -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); }