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 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.


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