Re: [chrony-dev] [PATCH v4 5/5] test/unit: add leapdb test |
[ Thread Index |
Date Index
| More chrony.tuxfamily.org/chrony-dev Archives
]
- To: chrony-dev@xxxxxxxxxxxxxxxxxxxx
- Subject: Re: [chrony-dev] [PATCH v4 5/5] test/unit: add leapdb test
- From: Patrick Oppenlander <patrick.oppenlander@xxxxxxxxx>
- Date: Thu, 8 Feb 2024 10:38:06 +1100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707349113; x=1707953913; darn=chrony.tuxfamily.org; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=f1EgWM9ObNIAxq/6ec5R4v1dc0IU6uoona45dzB9wKw=; b=Lc1ijRBf0fkYttBd+Tusbk8lPQDS/r6GqqNFlERtxxBeLwYDpUx6bMWmSmJGji3BPa eb+wgSWYF++BFfG18Zvr85jE/uUCuvcf12QNR/o3YOmdGnwqR1hxujHKrx+ZoGcrngdZ 7jUC6hBn9VYEU5qeMS3R9Bzb5X/D8EBQMqF3wi2MpGDEMEk00A9YRX05evKZRxpWjHF1 WZ+h4ePbkU/Yfl84zhaDCY9L3YWvGgGqo7Pjc7pAj+TOJUX/ou09nq6iB7SLXplruoNt gsGxpzRmzdRXzb8ug39mX0WL9EKKK/EZ49LQFcV4U1khjShiSt1Zi+mlEDphGAgXOOoC jt4Q==
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.