[v3,1/4,BZ,#14161] tst-strptime2.c: add %z minute and range limit tests
Commit Message
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(+)
Comments
On 03 Dec 2014 14:45, James Perkins wrote:
> * Two of the new offsets fail, showing that strptime incorrectly
> calculates the seconds from minutes not divisible by 3 (+1158, +1159).
these are good datasets to have as they show the bug exists before your fix, but
generally we don't add tests to the tree that fail right away. for example,
this makes bisecting harder. instead you should merge the test updates with the
code fix so there is only one patch.
> 2014-12-03 James Perkins james@loowit.net
your email address should have angle brackets like <foo@com>
> * time/strptime2.c (tests[]): Add tests for the strptime %z
when fixing bugzilla bugs, the ChangeLog should have a line above it here:
[BZ #12345]
when scoping the changelog entry, we just use the name, not its type.
i.e. drop the [] so you have "(tests)".
also, your subject line seems to have a typo -- you want #16141, not #14161.
-mike
@@ -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 },