]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 2745] ntpd -x steps clock on leap second
authorJuergen Perlinger <perlinger@ntp.org>
Thu, 7 May 2015 21:55:59 +0000 (23:55 +0200)
committerJuergen Perlinger <perlinger@ntp.org>
Thu, 7 May 2015 21:55:59 +0000 (23:55 +0200)
  provide test case for empty table lookup with real leap second
  don't step with '-x' or if step min. step > 1sec

bk: 554bdf6fipDZo-gvwPskov3bWibvbw

ChangeLog
tests/ntpd/leapsec.cpp

index 76e44110e65a2e54dde5508fc33d9b9800a109dc..15bfe2f2bf41d1c26f9fa769849673c63d0340e6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,5 @@
 ---
 
-* [Bug 2745] ntpd -x steps clock on leap second 
-   Do leap second stepping only of the step adjustment is beyond the
-   proper jump distance limit and step correction is allowed at all. 
 * CID 1295478: Quiet a pedantic potential error from the fix for Bug 2776.
 * CID 1296235: Fix refclock_jjy.c and correcting type of the driver40-ja.html
 * CID 1269537: Clean up a line of dead code in getShmTime().
@@ -10,6 +7,9 @@
 * [Bug 2612] restrict: Warn when 'monitor' can't be disabled because
   of 'limited'.
 * [Bug 2650] fix includefile processing.
+* [Bug 2745] ntpd -x steps clock on leap second
+   Do leap second stepping only of the step adjustment is beyond the
+   proper jump distance limit and step correction is allowed at all.
 * [Bug 2776] Improve ntpq's 'help keytype'.
 * [Bug 2782] Refactor refclock_shm.c, add memory barrier protection.
 * [Bug 2794] Clean up kernel clock status reports.
index 6ae0cee34c31e63e2a60ab2d9689e22b4fa8b8a6..47eb06956cd1c87649d4432dda190c5a8ef2539a 100644 (file)
@@ -899,3 +899,46 @@ TEST_F(leapsecTest, ls2012seqInsDumb) {
        EXPECT_EQ(LSPROX_NOWARN, qr.proximity);
 }
 
+// ----------------------------------------------------------------------
+// test repeated query on empty table in dumb mode
+TEST_F(leapsecTest, lsEmptyTableDumb) {
+       int            rc;
+       leap_result_t  qr;
+
+       const time_t   pivot(lsec2012); 
+       const uint32_t t0   (lsec2012 - 10);
+       const uint32_t tE   (lsec2012 + 10);
+
+       leapsec_electric(0);
+       EXPECT_EQ(0, leapsec_electric(-1));
+
+       leapsec_clear(leapsec_get_table(FALSE));
+       for (uint32_t t = t0; t != tE; ++t) {
+               rc = leapsec_query(&qr, t, &pivot);
+               EXPECT_EQ(FALSE, rc);
+               EXPECT_EQ(0,             qr.warped   );
+               EXPECT_EQ(LSPROX_NOWARN, qr.proximity);
+       }
+}
+
+// ----------------------------------------------------------------------
+// test repeated query on empty table in electric mode
+TEST_F(leapsecTest, lsEmptyTableElectric) {
+       int            rc;
+       leap_result_t  qr;
+       
+       leapsec_electric(1);
+       EXPECT_EQ(1, leapsec_electric(-1));
+
+       const time_t   pivot(lsec2012); 
+       const uint32_t t0   (lsec2012 - 10);
+       const uint32_t tE   (lsec2012 + 10);
+
+       leapsec_clear(leapsec_get_table(FALSE));
+       for (time_t t = t0; t != tE; ++t) {
+               rc = leapsec_query(&qr, t, &pivot);
+               EXPECT_EQ(FALSE, rc);
+               EXPECT_EQ(0,             qr.warped   );
+               EXPECT_EQ(LSPROX_NOWARN, qr.proximity);
+       }
+}