git: c6ed84f27bec - stable/15 - ping: Fix bell char ordering in -A test cases

From: Dag-Erling Smørgrav <des_at_FreeBSD.org>
Date: Tue, 07 Jul 2026 20:57:50 UTC
The branch stable/15 has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=c6ed84f27bec74b54bfc1548f8225687bfd9646c

commit c6ed84f27bec74b54bfc1548f8225687bfd9646c
Author:     Siva Mahadevan <siva@FreeBSD.org>
AuthorDate: 2026-06-26 12:22:57 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-07-07 07:07:04 +0000

    ping: Fix bell char ordering in -A test cases
    
    Previously, these tests expected the bell chars to arrive
    before the initial status line. This appeared to be ok because
    ping(8) incorrectly mixed unbuffered and buffered writes by using
    printf(3) calls for the initial status, but direct write(2) calls
    for the bell chars. 141bb85798 revealed that the test's assertions
    only passed because the buffered writes did not get flushed before
    the direct writes in the test runs.
    
    8bda488114f3 fixed ping(8) to use POSIX stdio buffered writes
    in all cases and guarantee a deterministic output ordering to stdout
    observers. This patch fixes the test to match the correct ordering.
    
    Reviewed by:    des
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 7ac9995a062ff9f78b634fe403e6a313f5637945)
    (cherry picked from commit 5b8c28adb829b50fb8ac065637fa99f717858bab)
    (cherry picked from commit f7f916d755fe5b48a2a68a937beea770b7bafa95)
---
 sbin/ping/tests/test_ping.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sbin/ping/tests/test_ping.py b/sbin/ping/tests/test_ping.py
index fdf9c875329c..88164c2ab816 100644
--- a/sbin/ping/tests/test_ping.py
+++ b/sbin/ping/tests/test_ping.py
@@ -431,8 +431,8 @@ round-trip min/avg/max/stddev = /// ms
                 "args": "ping -A -c3 192.0.2.2",
                 "returncode": 2,
                 "stdout": """\
-\x07\x07PING 192.0.2.2 (192.0.2.2): 56 data bytes
-
+PING 192.0.2.2 (192.0.2.2): 56 data bytes
+\x07\x07
 --- 192.0.2.2 ping statistics ---
 3 packets transmitted, 0 packets received, 100.0% packet loss
 """,
@@ -463,8 +463,8 @@ round-trip min/avg/max/stddev = /// ms
                 "args": "ping -A -c3 2001:db8::2",
                 "returncode": 2,
                 "stdout": """\
-\x07\x07PING(56=40+8+8 bytes) 2001:db8::1 --> 2001:db8::2
-
+PING(56=40+8+8 bytes) 2001:db8::1 --> 2001:db8::2
+\x07\x07
 --- 2001:db8::2 ping statistics ---
 3 packets transmitted, 0 packets received, 100.0% packet loss
 """,