summaryrefslogtreecommitdiff
path: root/src/test/test-clock.c
AgeCommit message (Collapse)Author
2016-02-29test-clock: fix FILE* leakMartin Pitt
Close the FILE* instead of the underlying fd.
2016-02-29test-clock: fix assertionsMartin Pitt
Use assert_se() to ensure that they don't get optimized away.
2016-02-29test-clock: fix fd "leak"Zbigniew Jędrzejewski-Szmek
CID #1352301.
2016-02-26clock-util: be more tolerant in parsing /etc/adjtimeMartin Pitt
As we default to "hardware clock is in UTC" if /etc/adjtime is not present, it also makes sense to have that default if /etc/adjtime contains only one or two lines. Drop the "gibberish" test case, as this was just EIO because of not containing three lines, which is already contained in other tests. clock_is_localtime() never actually validated the format of the first two lines, and there is little point in doing that. This addresses the reading half of issue #2638.
2016-02-26clock-util: make clock_is_localtime() testable and add initial testsMartin Pitt
Add path argument to clock_is_localtime() and default to "/etc/adjtime" if it's NULL. This makes the function testable. Add test-clock: initial test cases for some scenarios, using a temporary file. This also checks the behaviour with a NULL (i. e. the system's /etc/adjtime) file.