The current date version in Ubuntu 26.04 has an issue where it drops the
leading zeros in the nanosecond field before truncating it for %3N. This
causes the timestamps of packets to be off for test "IGMP/MLD querier
per-port query fan-out interval cadence".

Issue with "date" is recorded at
https://github.com/uutils/coreutils/issues/15697

Until Ubuntu picks up a version with the fix, pass only the whole
second part of the timestamp to date -d and create the fractional second
manually.

Fixes: e3db589c7eeb ("pinctrl: Fan out multicast querier queries per port.")
Assisted-by: Qwen3.8-27B-FP8, opencode
Acked-by: Xavier Simonart <[email protected]>
Signed-off-by: Jacob Tanenbaum <[email protected]>

----
v2:
    - Corrected spelling issues in the commit message.
    - Corrected issue with comment in the test itself.
    - added the name of the test in the commit message
    - removed "older coreutils" from the comment in tests/ovn.at
    - added acked-by tag
    - changed the subject from "ci: Fix..." to "tests: Fix..."

diff --git a/tests/ovn.at b/tests/ovn.at
index 780149467..7a580187e 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -26422,9 +26422,18 @@ packet_out_ts() {
     dnl Prints the send time (in ms) of the $1-th OFPT_PACKET_OUT
     dnl message in hv1/ovs-vswitchd.log.  The first field of a log
     dnl line is the UTC timestamp with millisecond precision.
+    dnl
+    dnl Only the whole-second part is passed to date(1) and the
+    dnl millisecond field is taken from the timestamp itself.
+    dnl The current version of date(1) shipping with Ubuntu 26.04 drops
+    dnl leading zeros in the nanosecond field before truncating for %3N
+    dnl producing the wrong millisecond value.
     grep "received: OFPT_PACKET_OUT" hv1/ovs-vswitchd.log \
         | awk -F'|' -v n="$1" 'NR==n { print $1 }' \
-        | while read -r ts; do date -d "$ts" +%s%3N; done
+        | while read -r ts; do
+            ms=${ts##*.}; ms=${ms%Z}
+            echo $(( $(date -d "${ts%%.*}Z" +%s) * 1000 + 10#$ms ))
+          done
 }
 round_time() {
     dnl The IGMP query of round $1 is the (2n-1)-th OFPT_PACKET_OUT.
-- 
2.56.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to