miller/c/reg_test
Jordan Torbiak 9545db94ea Fix strptime_local and localtime2sec for times during DST
When parsing a timestamp-string into epoch seconds, first we use
strptime to get a `struct tm` of year, month, day, etc, but strptime is
timezone-naive and doesn't set tm_isdst meaningfully (glibc apparently
doesn't set it at all). Then we ask mktime() to convert a `struct tm` to
epoch seconds, and we can ask it to lookup DST status for the current
timezone by giving it a `struct tm` with tm_isdst set to a negative
value. See the mktime(3) manpage.

With this change, strptime_local and localtime2sec agree with how GNU
`date` parses timestamp-strings, with the exception that `date` refuses
to parse ambiguous timestamp-strings that fall within the "fold"
intervals of DST transitions, saying they're invalid. Since `date` uses
additional libraries to give good timezone support it's capable of
detecting these ambiguous timestamp-strings, but for a tool like miller
it's reasonable to rely directly on libc and have it choose an
epoch-seconds-timestamp that correspond to either the first or second
time-of-day that the timestamp-string represents.

Remove a duplicate test from c/reg_test/run.

Fix #170
2021-07-09 15:45:48 -03:00
..
expected Fix strptime_local and localtime2sec for times during DST 2021-07-09 15:45:48 -03:00
input Before/after options for reorder verb (#510) 2021-05-03 00:26:53 -04:00
dev func-prohibits 2016-09-12 05:15:00 -07:00
Makefile.am fix travis build 2017-03-27 08:46:33 -04:00
Makefile.in autoreconf -fiv 2020-01-26 10:31:43 -05:00
README.md test-reorg iterate 2015-09-25 16:51:12 -04:00
run Fix strptime_local and localtime2sec for times during DST 2021-07-09 15:45:48 -03:00

There are two classes of testing for Miller:

  • C source-file names starting with test_ use MinUnit to unit-test various subsystems of interest. These are separate executables built and run by the build framework.

  • test/run runs the main mlr executable with canned inputs, comparing actual to canned outputs, to regression-test Miller's end-to-end operation.