Yo Hal!
> --enable-leap-testing to waf configure
> allows leaps at other than 1st day of a month
I'm not a fan of needing configuration changes for testing.
Is there another way to do this?
This way the test will be rarely run, and for people that enable
this test their ntpd may now emit leap seconds on wrong days.
It also make it not possible to test that the 1st day check can not
be tested.
A lot of the current NTP tests link into the library and then
call the library functions with test data. If you do that then
no config option needed, you can test for the lockout and that
valid dates work.
RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
g...@rellim.com Tel:+1 541 382 8588
Veritas liberabit vos. -- Quid est veritas?
"If you can’t measure it, you can’t improve it." - Lord Kelvin
Title:
GitLab
Hal Murray pushed to branch master
at NTPsec / ntpsec
Commits:
-
9e4d6438
by Hal Murray
at 2017-03-17T23:39:36-07:00
Setup to help testing leap seconds
contrib/make-leap-seconds.py makes valid leap second files
default is to leap at midnight.
--enable-leap-testing to waf configure
allows leaps at other than 1st day of a month
3 changed files:
Changes:
ntpd/ntp_leapsec.c
... |
... |
@@ -783,13 +783,14 @@ leapsec_add( |
783
|
783
|
/* To guard against dangling leap flags: do not accept leap
|
784
|
784
|
* second request on the 1st hour of the 1st day of the month.
|
785
|
785
|
*/
|
|
786
|
+#ifndef ENABLE_LEAP_TESTING
|
786
|
787
|
if (fts.tm_mday == 1 && fts.tm_hour == 0) {
|
787
|
788
|
errno = EINVAL;
|
788
|
789
|
return false;
|
789
|
790
|
}
|
|
791
|
+#endif
|
790
|
792
|
|
791
|
793
|
/* Ok, do the remaining calculations */
|
792
|
|
- fts.tm_mday = 1;
|
793
|
794
|
fts.tm_hour = 0;
|
794
|
795
|
fts.tm_min = 0;
|
795
|
796
|
fts.tm_sec = 0;
|
... |
... |
@@ -831,11 +832,13 @@ leapsec_raw( |
831
|
832
|
}
|
832
|
833
|
|
833
|
834
|
gmtime_r(&ttime, &fts);
|
|
835
|
+#ifndef ENABLE_LEAP_TESTING
|
834
|
836
|
/* If this does not match the exact month start, bail out. */
|
835
|
837
|
if (fts.tm_mday != 1 || fts.tm_hour || fts.tm_min || fts.tm_sec) {
|
836
|
838
|
errno = EINVAL;
|
837
|
839
|
return false;
|
838
|
840
|
}
|
|
841
|
+#endif
|
839
|
842
|
/* Start 28 days earler. Avoids month arithmetic. */
|
840
|
843
|
starttime = ttime - 28*SECSPERDAY;
|
841
|
844
|
li.ttime = ttime;
|
wafhelpers/configure.py
... |
... |
@@ -222,6 +222,13 @@ def cmd_configure(ctx, config): |
222
|
222
|
if ctx.check_endianness() == "big":
|
223
|
223
|
ctx.define("WORDS_BIGENDIAN", 1)
|
224
|
224
|
|
|
225
|
+ if ctx.options.enable_leap_testing:
|
|
226
|
+ ctx.define("ENABLE_LEAP_TESTING", 1,
|
|
227
|
+ comment="Enable leap seconds on other than 1st of month.")
|
|
228
|
+ if ctx.options.enable_leap_smear:
|
|
229
|
+ ctx.define("ENABLE_LEAP_SMEAR", 1,
|
|
230
|
+ comment="Enable experimental leap smearing code")
|
|
231
|
+
|
225
|
232
|
cc_test_flags = [
|
226
|
233
|
('PIC', '-fPIC'),
|
227
|
234
|
('PIE', '-pie -fPIE'),
|
wafhelpers/options.py
... |
... |
@@ -48,6 +48,8 @@ def options_cmd(ctx, config): |
48
|
48
|
grp = ctx.add_option_group("NTP configure features")
|
49
|
49
|
grp.add_option('--enable-leap-smear', action='store_true',
|
50
|
50
|
default=False, help="Enable Leap Smearing.")
|
|
51
|
+ grp.add_option('--enable-leap-testing', action='store_true',
|
|
52
|
+ default=False, help="Enable leaps on other than 1st of month.")
|
51
|
53
|
grp.add_option('--enable-mssntp', action='store_true',
|
52
|
54
|
default=False, help="Enable Samba MS SNTP support.")
|
53
|
55
|
grp.add_option('--enable-lockclock', action='store_true',
|
_______________________________________________
vc mailing list
v...@ntpsec.org
http://lists.ntpsec.org/mailman/listinfo/vc
pgpm8sTuKe3Oo.pgp
Description: OpenPGP digital signature
_______________________________________________
devel mailing list
devel@ntpsec.org
http://lists.ntpsec.org/mailman/listinfo/devel