[tz] tzcode test suite

Paul Eggert eggert at cs.ucla.edu
Thu Jan 14 17:45:33 UTC 2016


Thanks for doing that! It should be quite helpful. I briefly looked into 
it and have some comments:

* Do you use git? If so, the output of 'git format-patch' makes it 
easier to review proposed changes. The first attached patch attempts to 
be identical to the patch you sent, except in 'git format-patch' format.

* The second attached patch cleans up a few minor problems I noticed 
when building the test suite:

** "make tests" assumed "." was in PATH.

** "make clean" didn't clean up the test suite.

** Missing NEWS item.

** "make CFLAGS='$(GCC_DEBUG_FLAGS)'" complained about a few missing 
attributes and unused variables and so forth.

** TM_ZONE and TM_GMTOFF should be consistent with private.h.

** Symbols that needn't be extern should be static.

** Global variables that aren't modified should be const.

** I prefer "const" after the type it modifies, for consistency with 
types like "int * const *".

** I prefer a function's return type to be on the previous line, so that 
there is room for decorations like "static".


Other comments:

* The test suite fails on my platform (Fedora 23 x86-64). Why would that 
be? The first few lines of error diagnostics are:

./testsuite testcases
testcases, line 1598: localtime: expected 1969-12-31 19:00:00, got 
1969-12-31 20:00:00
testcases, line 1598: localtime: inverse expected 0, got -3600
testcases, line 1599: localtime: expected 1901-12-13 15:45:52, got 
1901-12-13 16:45:52
testcases, line 1599: localtime: inverse expected -2147483648, got 
-2147487248
testcases, line 1604: localtime: expected 1969-12-31 16:00:00, got 
1969-12-31 17:00:00
...

* It should be easier to do the tests with "make tests". Users shouldn't 
need to modify the makefile; it should automatically do the 64-bit tests 
on all platforms, making sure that they do the right thing on 32-bit 
hosts. We can put the expensive tests in a separate target "make 
tests-expensive". Perhaps we should fold this into "make check" (with a 
new rule "make check-expensive") to simplify things further.

* The snprintfs should be fixed to never do silent truncation on any 
platform. The second one can use INT_STRLEN_MAXIMUM to do that.

* The signal handler has undefined behavior. It should just write (not 
printf) to stderr and then _exit (not exit).

* Would you mind if we changed "if(" to "if (", and similarly for other 
keywords, for consistency with the other tz code?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-a-test-suite.patch
Type: text/x-patch
Size: 176210 bytes
Desc: not available
URL: <http://mm.icann.org/pipermail/tz/attachments/20160114/fd67368e/0001-Add-a-test-suite-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Cleanup-of-test-suite.patch
Type: text/x-patch
Size: 8514 bytes
Desc: not available
URL: <http://mm.icann.org/pipermail/tz/attachments/20160114/fd67368e/0002-Cleanup-of-test-suite-0001.patch>


More information about the tz mailing list