Accepting request 774112 from home:marxin:branches:network:time

- Backport test-fix-util-unit-test-for-NTP-era-split.patch.

OBS-URL: https://build.opensuse.org/request/show/774112
OBS-URL: https://build.opensuse.org/package/show/network:time/chrony?expand=0&rev=79
This commit is contained in:
Martin Pluskal 2020-02-13 09:38:25 +00:00 committed by Git OBS Bridge
parent 2bd3254192
commit 965d6fca99
3 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,41 @@
From 2d9eb5b6fa5225a7300c8eed95712969249900fb Mon Sep 17 00:00:00 2001
From: Miroslav Lichvar <mlichvar@redhat.com>
Date: Fri, 3 Jan 2020 11:25:55 +0100
Subject: [PATCH] test: fix util unit test for NTP era split
The current default NTP era split passed the Unix epoch (~50 years ago),
which means the epoch converted to an NTP timestamp and back ends up in
the next NTP era (year 2106).
Fix the test to take into account the era split.
---
test/unit/util.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/test/unit/util.c b/test/unit/util.c
index f4d9f33..af9e90c 100644
--- a/test/unit/util.c
+++ b/test/unit/util.c
@@ -100,11 +100,19 @@ void test_unit(void) {
ntp_ts.hi = htonl(JAN_1970);
ntp_ts.lo = 0xffffffff;
UTI_Ntp64ToTimespec(&ntp_ts, &ts);
+#if defined(HAVE_LONG_TIME_T) && NTP_ERA_SPLIT > 0
+ TEST_CHECK(ts.tv_sec == 0x100000000LL * (1 + (NTP_ERA_SPLIT - 1) / 0x100000000LL));
+#else
TEST_CHECK(ts.tv_sec == 0);
+#endif
TEST_CHECK(ts.tv_nsec == 999999999);
UTI_AddDoubleToTimespec(&ts, 1e-9, &ts);
+#if defined(HAVE_LONG_TIME_T) && NTP_ERA_SPLIT > 0
+ TEST_CHECK(ts.tv_sec == 1 + 0x100000000LL * (1 + (NTP_ERA_SPLIT - 1) / 0x100000000LL));
+#else
TEST_CHECK(ts.tv_sec == 1);
+#endif
TEST_CHECK(ts.tv_nsec == 0);
ntp_fuzz.hi = 0;
--
2.25.0

View File

@ -2,6 +2,7 @@
Wed Feb 12 09:24:24 UTC 2020 - Martin Liška <mliska@suse.cz>
- Update clknetsim to version 79ffe44 (fixes boo#1162964).
- Backport test-fix-util-unit-test-for-NTP-era-split.patch.
-------------------------------------------------------------------
Sat Oct 26 10:39:29 UTC 2019 - Arjen de Korte <suse+build@de-korte.org>

View File

@ -46,6 +46,7 @@ Patch0: chrony-config.patch
Patch1: chrony-service-helper.patch
Patch2: chrony-logrotate.patch
Patch3: chrony-service-ordering.patch
Patch4: chrony-test-fix-util-unit-test-for-NTP-era-split.patch
BuildRequires: NetworkManager-devel
BuildRequires: bison
BuildRequires: gcc-c++
@ -98,6 +99,7 @@ or a different computer.
%patch1 -p1
%patch2 -p1
%patch3
%patch4 -p1
# If this is an openSUSE build, use our vendor zone
# (2.*pool.ntp.org names include IPv6 addresses). If not