Re: [chrony-dev] [PATCH v3 5/5] test/unit: add leapdb test
On Mon, Jan 29, 2024 at 04:29:00PM +0100, Miroslav Lichvar wrote: > On Thu, Dec 07, 2023 at 01:17:16PM +1100, [email protected] wrote: > > +void > > +test_unit(void) > > +{ > > + char conf[][100] = { > > +"leapsectz right/UTC", > > +"leapseclist /usr/share/zoneinfo/leap-seconds.list" > > + }; > > The test should not fail on non-glibc systems and when the list file is > missing. It should skip instead. For testing the list parsing, maybe it's best to include a cut-down list with only few entries and few lines of comment (not the full 10KB file) as leapdb.list directly in the unit test directory, similarly to the ntp_core.keys file. -- Miroslav Lichvar -- To unsubscribe email [email protected] with "unsubscribe" in the subject. For help email [email protected] with "help" in the subject. Trouble? Email [email protected].
Re: [chrony-dev] [PATCH v3 5/5] test/unit: add leapdb test
On Thu, Dec 07, 2023 at 01:17:16PM +1100, [email protected] wrote: > diff --git a/test/unit/leapdb.c b/test/unit/leapdb.c > +struct test_vector { > + time_t when; > + int tai_offset; > + NTP_Leap leap; > +} tests[] = { > + /* From leap-seconds.list */ > + {2272060800, 10, LEAP_Normal}, // 1 Jan 1972 Please use the classic C comment syntax /* */. > +void > +test_unit(void) > +{ > + char conf[][100] = { > +"leapsectz right/UTC", > +"leapseclist /usr/share/zoneinfo/leap-seconds.list" > + }; The test should not fail on non-glibc systems and when the list file is missing. It should skip instead. -- Miroslav Lichvar -- To unsubscribe email [email protected] with "unsubscribe" in the subject. For help email [email protected] with "help" in the subject. Trouble? Email [email protected].
