- Add 6cf9fe2f16fa49963e47e84f4a6dd9069735062e.patch to fix test

124-tai on some architectures (bsc#1225362).

OBS-URL: https://build.opensuse.org/package/show/network:time/chrony?expand=0&rev=126
This commit is contained in:
Reinhard Max 2024-05-27 15:36:02 +00:00 committed by Git OBS Bridge
parent a482345361
commit 07694b8c6c
3 changed files with 171 additions and 6 deletions

View File

@ -0,0 +1,166 @@
From 6cf9fe2f16fa49963e47e84f4a6dd9069735062e Mon Sep 17 00:00:00 2001
From: Miroslav Lichvar <mlichvar@redhat.com>
Date: Wed, 7 Feb 2024 15:48:43 +0100
Subject: [PATCH] test: improve 113-leapsecond and 124-tai tests
Use leapseclist instead of leapsectz and test also negative leap
seconds. Add a test for leapsectz when the date command indicates
right/UTC is available on the system and mktime() works as expected.
Check TAI offset in the server's log.
---
test/simulation/113-leapsecond | 88 +++++++++++++++++++++++-----------
test/simulation/124-tai | 12 ++++-
2 files changed, 70 insertions(+), 30 deletions(-)
diff --git a/test/simulation/113-leapsecond b/test/simulation/113-leapsecond
index 394440b7..63da734d 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
diff --git a/test/simulation/124-tai b/test/simulation/124-tai
index 97064f7c..0192e10f 100755
--- a/test/simulation/124-tai
+++ b/test/simulation/124-tai
@@ -18,10 +18,18 @@ servers=0
refclock_offset="(+ -34 (equal 0.1 (max (sum 1.0) $leap) $leap))"
client_conf="
refclock SHM 0 dpoll 0 poll 0 tai
-leapsectz right/UTC
+leapseclist tmp/leap.list
leapsecmode ignore
maxchange 1e-3 1 0"
+cat > tmp/leap.list <<-EOF
+ #$ 3676924800
+ #@ 3928521600
+ 3345062400 33 # 1 Jan 2006
+ 3439756800 34 # 1 Jan 2009
+ 3550089600 35 # 1 Jul 2012
+EOF
+
run_test || test_fail
check_chronyd_exit || test_fail
check_source_selection || test_fail
@@ -33,7 +41,7 @@ time_offset=-1000
refclock_offset="(+ -34)"
client_conf="
refclock SHM 0 dpoll 0 poll 0 tai
-leapsectz right/UTC
+leapseclist tmp/leap.list
makestep 1 1
maxchange 1e-3 1 0"

View File

@ -1,7 +1,9 @@
-------------------------------------------------------------------
Mon May 27 14:27:18 UTC 2024 - Reinhard Max <max@suse.com>
Mon May 27 15:34:40 UTC 2024 - Reinhard Max <max@suse.com>
- Update clknetsim to snapshot 0a11a35.
- Add 6cf9fe2f16fa49963e47e84f4a6dd9069735062e.patch to fix test
124-tai on some architectures (bsc#1225362).
-------------------------------------------------------------------
Mon Feb 26 10:33:53 UTC 2024 - Dominique Leuenberger <dimstar@opensuse.org>

View File

@ -70,6 +70,7 @@ Patch2: chrony-logrotate.patch
Patch3: chrony-service-ordering.patch
Patch7: chrony-htonl.patch
Patch8: chrony.nm-dispatcher.dhcp.patch
Patch9: 6cf9fe2f16fa49963e47e84f4a6dd9069735062e.patch
BuildRequires: NetworkManager-devel
BuildRequires: bison
BuildRequires: findutils
@ -181,6 +182,7 @@ e.g. because the servers will be set via DHCP.
%patch -P 3
%patch -P 7
%patch -P 8
%patch -P 9
# Remove pool statements from the default /etc/chrony.conf. They will
# be provided by branding packages in /etc/chrony.d/pool.conf .
@ -297,11 +299,6 @@ find %{buildroot} -type f | xargs sed -i '
export CLKNETSIM_RANDOM_SEED=24501
export CFLAGS="%{optflags}"
make %{?_smp_mflags} -C test/simulation/clknetsim
cd test/simulation
for i in $(seq 50); do
./124-tai &> /dev/null && break
done
exit 1
make %{?_smp_mflags} quickcheck
%endif
%endif