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: Miroslav Lichvar <mlichvar@xxxxxxxxxx>
- Date: Wed, 7 Feb 2024 11:19:42 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707301186; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=fzBRN5rO0iJw62q5AQUqlQaZlw8EM/DBOILLRjUSZrU=; b=MKtiHb/s64cfp66rnwJvDXDhtmHBEJDA3w7gugGATOQvNJ4nIk90Ap+NYri84jx9xfgVIf aayeal04x4bglBE2mNshECOb3sP8my9cczeDUaHXtIw0mixze2KMmkkhNXIl9ZcNckt1Bg yeNJ9jR7aGhphmdFvlF5qg9QDm1PPag=
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.
> +# 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?
> +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?
--
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.