Re: [chrony-dev] 008-ntpera test failure |
[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-dev Archives ]
Hi, Le 2022-01-11 10:07, Miroslav Lichvar a écrit : > On Mon, Jan 10, 2022 at 03:34:28PM +0100, Vincent Blut wrote: > > SUMMARY: > > TOTAL 1 > > PASSED 0 > > FAILED 1 (008-ntpera) (24505) > > SKIPPED 0 () > > > > Do you have any tips on how to properly debug this? > > On what arch is the test running and what CFLAGS/CPPFLAGS are used for > the build? > > How is NTP_ERA_SPLIT set in the generated config.h file? > > You could compare the bash debug output with a 64-bit system where it > works. My first guess would be wrong calculation of the *START_DATE > variable. > > $ bash -x ./008-ntpera |& grep -o START_DATE=.* > START_DATE=2085977996 > START_DATE=2085977996 > START_DATE=0 > START_DATE=0 > START_DATE=4294957296 > START_DATE=4294957296 > START_DATE=-10000 > START_DATE=-10000 > START_DATE=4294967296 > START_DATE=4294967296 > START_DATE=0 > START_DATE=0 > START_DATE=4294957296 > START_DATE=4294957296 > START_DATE=-10000 > START_DATE=-10000 > START_DATE=4294967296 > START_DATE=4294967296 I finally had some time to work on this. Your comment about the possible wrong calculation of the CLKNETSIM_START_DATE variable reminded me that Debian's default awk interpreter, mawk, prints long integers in scientific notation which led me to the root cause of the 008-ntpera test failure. The attached patch fixes that while ensuring that using GNU Awk does not cause regressions. The following awk invocation would also lead to the same result: awk "BEGIN {OFMT=\"%.0f\"; print $ntp_start + $start_offset}") > -- > Miroslav Lichvar Cheers, Vincent
From 6875cff420e3e48e1cce708f3e84e300c68c2e3b Mon Sep 17 00:00:00 2001 From: Vincent Blut <vincent.debian@xxxxxxx> Date: Wed, 12 Jan 2022 18:08:34 +0100 Subject: [PATCH] test: ensure awk commands in 008-ntpera return an integer Some awk interpreters (e.g. mawk) print long integers in exponential notation skewing the test result. --- test/simulation/008-ntpera | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/simulation/008-ntpera b/test/simulation/008-ntpera index 2a4f332..2eea63b 100755 --- a/test/simulation/008-ntpera +++ b/test/simulation/008-ntpera @@ -29,7 +29,7 @@ echo "$ntp_start" | grep -q '-' && test_skip for time_offset in -1e-1 1e-1; do for start_offset in 0 "2^32 - $limit"; do - export CLKNETSIM_START_DATE=$(awk "BEGIN {print $ntp_start + $start_offset}") + export CLKNETSIM_START_DATE=$(awk "BEGIN {printf \"%.0f\", $ntp_start + $start_offset}") run_test || test_fail check_chronyd_exit || test_fail check_source_selection || test_fail @@ -38,7 +38,7 @@ for time_offset in -1e-1 1e-1; do done for start_offset in -$limit "2^32"; do - export CLKNETSIM_START_DATE=$(awk "BEGIN {print $ntp_start + $start_offset}") + export CLKNETSIM_START_DATE=$(awk "BEGIN {printf \"%.0f\", $ntp_start + $start_offset}") run_test || test_fail check_chronyd_exit || test_fail check_source_selection || test_fail -- 2.34.1
Attachment:
signature.asc
Description: PGP signature
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |