Re: [chrony-dev] [PATCH v4 5/5] test/unit: add leapdb test

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-dev Archives ]


On Wed, Feb 7, 2024 at 9:19 PM Miroslav Lichvar <mlichvar@xxxxxxxxxx> wrote:
>
> On Wed, Feb 07, 2024 at 04:29:44PM +1100, patrick.oppenlander@xxxxxxxxx wrote:
> > +void
> > +test_unit(void)
> > +{
> > +  char conf[][100] = {
> > +    "leapsectz right/UTC",
> > +    "leapseclist leapdb.list"
> > +  };
> > +
> > +  CNF_Initialise(0, 0);
> > +  for (int i = 0; i < sizeof conf / sizeof conf[0]; i++)
> > +    CNF_ParseLine(NULL, i + 1, conf[i]);
> > +  LDB_Initialise();
> > +
> > +  DEBUG_LOG("testing get_tz_leap");
> > +  test_leap_source(get_tz_leap);
>
> This still seems to fail on a system which doesn't have the right/UTC
> timezone, or where mktime() doesn't do the expected thing. Unit tests
> need to pass on all supported systems. If there is no simple solution,
> I think not testing get_tz_leap here would be acceptable. The
> functionality is already covered in the 113-leapsecond test.

Oops, I overlooked this. Will propose a fix.

> > +# Blank lines need to be ignored, so include a few for testing.
> > +# Whitespace errors on non-blank lines below are copied from the original file.
> > +#
> > +
> > +#    Leap second data update time
> > +#$    3676924800
> > +#
> > +#    File update time
> > +#@   3928521600
> > +
>
> The white space in the blank line above is intentional?

leap-seconds.list says "A blank line should be ignored", but doesn't
specify what blank is. I intentionally added some whitespace errors on
a couple of blank lines to make sure we correctly skip them. I can
clean them up if you would prefer not to test this?

Interestingly, the comment block in leap-seconds.list is completely
different between the 2023d-1 and 2024a-1 packages on Arch. Only the
older one mentions blank lines.

> > +3439756800   34      # 1 Jan 2009
> > +3550089600   35      # 1 Jul 2012
> > +3644697600   36      # 1 Jul 2015
> > +3692217600   37      # 1 Jan 2017
>
> How about adding and testing a negative leap second?

Will do.

Patrick

> --
> Miroslav Lichvar
>
>
> --
> To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
> For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
> Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.
>

--
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/