summaryrefslogtreecommitdiffstats
path: root/test/simulation/113-leapsecond
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-12 05:01:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-12 05:01:24 +0000
commit15d5aecc5b2123bab1a374d36420f5752096d081 (patch)
tree5300829fb1e869c2ace0b1b5b8bfc68faaa98472 /test/simulation/113-leapsecond
parentReleasing progress-linux version 4.5-3~progress7.99u1. (diff)
downloadchrony-15d5aecc5b2123bab1a374d36420f5752096d081.tar.xz
chrony-15d5aecc5b2123bab1a374d36420f5752096d081.zip
Merging upstream version 4.6.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/simulation/113-leapsecond')
-rwxr-xr-xtest/simulation/113-leapsecond88
1 files changed, 60 insertions, 28 deletions
diff --git a/test/simulation/113-leapsecond b/test/simulation/113-leapsecond
index 394440b..63da734 100755
--- a/test/simulation/113-leapsecond
+++ b/test/simulation/113-leapsecond
@@ -8,54 +8,86 @@ check_config_h 'FEAT_REFCLOCK 1' || test_skip
export CLKNETSIM_START_DATE=$(TZ=UTC date -d 'Dec 30 2008 0:00:00' +'%s')
-leap=$[2 * 24 * 3600]
limit=$[4 * 24 * 3600]
client_start=$[2 * 3600]
-server_conf="refclock SHM 0 dpoll 10 poll 10
-leapsectz right/UTC"
refclock_jitter=1e-9
-refclock_offset="(* -1.0 (equal 0.1 (max (sum 1.0) $leap) $leap))"
-for leapmode in system step slew; do
- client_conf="leapsecmode $leapmode"
- if [ $leapmode = slew ]; then
- max_sync_time=$[$leap + 12]
- else
- max_sync_time=$[$leap]
- fi
+for dir in "+1" "-1"; do
+ leap=$[2 * 24 * 3600 + 1 + $dir]
+ server_conf="refclock SHM 0 dpoll 10 poll 10
+ leapseclist tmp/leap.list"
+ refclock_offset="(* $dir (equal 0.1 (max (sum 1.0) $leap) $leap))"
+
+ cat > tmp/leap.list <<-EOF
+ #$ 3676924800
+ #@ 3928521600
+ 3345062400 33 # 1 Jan 2006
+ 3439756800 $[33 - $dir] # 1 Jan 2009 $(
+ [ "$dir" = "+1" ] && echo -e "\n3471292800 33\n3502828800 34")
+ 3550089600 35 # 1 Jul 2012
+ EOF
+
+ for leapmode in system step slew; do
+ client_conf="leapsecmode $leapmode"
+ if [ $leapmode = slew ]; then
+ max_sync_time=$[2 * 24 * 3600 + 13]
+ else
+ max_sync_time=$[2 * 24 * 3600 + 1]
+ fi
+ min_sync_time=$[$max_sync_time - 2]
+
+ run_test || test_fail
+ check_chronyd_exit || test_fail
+ check_source_selection || test_fail
+ check_packet_interval || test_fail
+ check_sync || test_fail
+ check_file_messages "System clock TAI offset set to" 1 1 log.1 || test_fail
+ check_file_messages "System clock TAI offset set to 33" 1 1 log.1 || test_fail
+ done
+
+ client_server_options="trust"
+ client_conf="refclock SHM 0 dpoll 10 poll 10 delay 1e-3"
+ min_sync_time=$[$leap - 2]
+ max_sync_time=$[$leap]
run_test || test_fail
check_chronyd_exit || test_fail
check_source_selection || test_fail
check_packet_interval || test_fail
check_sync || test_fail
-done
-client_server_options="trust"
-client_conf="refclock SHM 0 dpoll 10 poll 10 delay 1e-3"
+ client_server_options=""
+ client_conf="leapsecmode system"
+ min_sync_time=230000
+ max_sync_time=240000
-run_test || test_fail
-check_chronyd_exit || test_fail
-check_source_selection || test_fail
-check_packet_interval || test_fail
-check_sync || test_fail
+ for smoothmode in "" "leaponly"; do
+ server_conf="refclock SHM 0 dpoll 10 poll 10
+ leapseclist tmp/leap.list
+ leapsecmode slew
+ smoothtime 400 0.001 $smoothmode"
-client_server_options=""
-client_conf="leapsecmode system"
-min_sync_time=230000
-max_sync_time=240000
+ run_test || test_fail
+ check_chronyd_exit || test_fail
+ check_source_selection || test_fail
+ check_packet_interval || test_fail
+ check_sync || test_fail
+ done
+done
-for smoothmode in "" "leaponly"; do
+if TZ=right/UTC date -d 'Dec 31 2008 23:59:60' 2> /dev/null | grep :60; then
server_conf="refclock SHM 0 dpoll 10 poll 10
- leapsectz right/UTC
- leapsecmode slew
- smoothtime 400 0.001 $smoothmode"
+ leapsectz right/UTC"
+ refclock_offset="(* -1 (equal 0.1 (max (sum 1.0) $leap) $leap))"
+ client_conf="leapsecmode system"
+ min_sync_time=$[$leap - 2]
+ max_sync_time=$[$leap]
run_test || test_fail
check_chronyd_exit || test_fail
check_source_selection || test_fail
check_packet_interval || test_fail
check_sync || test_fail
-done
+fi
test_pass