This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH v3 1/4] [BZ #14161] tst-strptime2.c: add %z minute and range limit tests
- From: James Perkins <james at loowit dot net>
- To: libc-alpha at sourceware dot org
- Date: Wed, 3 Dec 2014 14:45:57 -0800
- Subject: [PATCH v3 1/4] [BZ #14161] tst-strptime2.c: add %z minute and range limit tests
- Authentication-results: sourceware.org; auth=none
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 },
--
1.7.9.5