From patchwork Wed Dec 3 22:45:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Perkins X-Patchwork-Id: 4062 X-Patchwork-Delegate: vapier@gentoo.org Received: (qmail 11317 invoked by alias); 3 Dec 2014 22:46:42 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 11302 invoked by uid 89); 3 Dec 2014 22:46:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ie0-f173.google.com X-Received: by 10.42.209.196 with SMTP id gh4mr9343605icb.10.1417646798206; Wed, 03 Dec 2014 14:46:38 -0800 (PST) From: James Perkins To: libc-alpha@sourceware.org Subject: [PATCH v3 1/4] [BZ #14161] tst-strptime2.c: add %z minute and range limit tests Date: Wed, 3 Dec 2014 14:45:57 -0800 Message-Id: <1417646760-19563-1-git-send-email-james@loowit.net> This is part of a fix for [BZ #16141] strptime %z offset restriction. Add tests to time/tst-strptime2.c to explicitly test the following areas of strptime's %z input field descriptor: 1) Correct conversion for minutes portion of timezone offset string into seconds part of the timezone offset. * New offsets tested are +1157, +1158, and +1159. * Two of the new offsets fail, showing that strptime incorrectly calculates the seconds from minutes not divisible by 3 (+1158, +1159). * tst-strptime2 failure output is as follows: round 9: tm_gmtoff is 43056 round 10: tm_gmtoff is 43128 2) Validate offset range of -1200 to +1200. * New tests show that strptime validates the current range limits. * New offsets tested are +1200, -1200, +1201, and -1201. * A later patch will remove range limit testing. James 2014-12-03 James Perkins james@loowit.net * time/strptime2.c (tests[]): Add tests for the strptime %z input field descriptor, specifically conversion of minutes to seconds and validation of offset range. --- time/tst-strptime2.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/time/tst-strptime2.c b/time/tst-strptime2.c index bcd6cc8..5f9860a 100644 --- a/time/tst-strptime2.c +++ b/time/tst-strptime2.c @@ -17,6 +17,13 @@ static const struct { "1113472456 -1030", -37800 }, { "1113472456 +0030", 1800 }, { "1113472456 -0030", -1800 }, + { "1113472456 +1157", 43020 }, + { "1113472456 +1158", 43080 }, + { "1113472456 +1159", 43140 }, + { "1113472456 +1200", 43200 }, + { "1113472456 -1200", -43200 }, + { "1113472456 +1201", LONG_MAX }, + { "1113472456 -1201", LONG_MAX }, { "1113472456 -1330", LONG_MAX }, { "1113472456 +1330", LONG_MAX }, { "1113472456 -1060", LONG_MAX },