>From ac20ac7d0c575da0bd183c7000578caa1e2849c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Tue, 22 Dec 2015 15:45:56 +0000 Subject: [PATCH] strftime-tests: avoid false failure on OS X * tests/test-strftime.c (struct localtime_rz_test): Add an ahistorical member which is used to skip the expected output comparison when tm_isdst is not set. tm_isdst was not set for "1970-01-01 13:00:00 +1300 (NZDT)", on Darwin 13/14 at least. --- ChangeLog | 8 ++++++++ tests/test-strftime.c | 46 ++++++++++++++++++++++++++-------------------- 2 files changed, 34 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4b0eb39..8ad386b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2015-12-22 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 skip the expected output + comparison when tm_isdst is not set. tm_isdst was not set 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 5cd4814..b477517 100644 --- a/tests/test-strftime.c +++ b/tests/test-strftime.c @@ -107,30 +107,33 @@ struct localtime_rz_test /* Expected result. */ char const *exp; + + /* whether we test expected output, + which may not match for ahistorical items + that need tm_isdst set. */ + 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 } }; @@ -181,6 +184,9 @@ tzalloc_test (void) continue; } + if (LT[i].ahistorical && !tm.tm_isdst) + continue; + if (! (STREQ (buf, LT[i].exp) || (!tz && n == strlen (LT[i].exp) && memcmp (buf, LT[i].exp, n - sizeof "(GMT)" + 1) == 0 -- 2.5.0