git: ff88c47e5382 - stable/13 - ping_test: Fix tests ping_46 and ping6_46

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Thu, 10 Nov 2022 17:02:29 UTC
The branch stable/13 has been updated by markj:

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

commit ff88c47e53824e70c284d89d9916612accbba075
Author:     Jose Luis Duran <jlduran@gmail.com>
AuthorDate: 2022-11-02 11:43:40 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-11-10 17:02:01 +0000

    ping_test: Fix tests ping_46 and ping6_46
    
    If no IPv4-host, IPv4-mcast-group or IPv6-host is passed, it will
    display the usage.  The tests are passing because they are just checking
    that the exit code is 1.
    
    Fix the tests by checking the appropriate output message.
    
    While here, change the description to match the output and add the
    missing requirements.
    
    Reviewed by:    markj
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D37250
    
    (cherry picked from commit d481443acb1c77610ac50a226f402e4629a608fb)
---
 sbin/ping/tests/ping_test.sh | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/sbin/ping/tests/ping_test.sh b/sbin/ping/tests/ping_test.sh
index 55456a5c86ba..c79a792d0eb0 100644
--- a/sbin/ping/tests/ping_test.sh
+++ b/sbin/ping/tests/ping_test.sh
@@ -129,20 +129,28 @@ ping6_c1t4_body()
 
 ping_46_head()
 {
-	atf_set "descr" "-4 and -6 may not be used together"
+	atf_set "descr" "-4 and -6 cannot be used simultaneously"
 }
 ping_46_body()
 {
-	atf_check -s exit:1 -e ignore ping -4 -6
+	require_ipv4
+	require_ipv6
+	atf_check -s exit:1 \
+	    -e match:"-4 and -6 cannot be used simultaneously" \
+	    ping -4 -6 localhost
 }
 
 ping6_46_head()
 {
-	atf_set "descr" "-4 and -6 may not be used together"
+	atf_set "descr" "-4 and -6 cannot be used simultaneously"
 }
 ping6_46_body()
 {
-	atf_check -s exit:1 -e ignore ping6 -4 -6
+	require_ipv4
+	require_ipv6
+	atf_check -s exit:1 \
+	    -e match:"-4 and -6 cannot be used simultaneously" \
+	    ping6 -4 -6 localhost
 }
 
 atf_init_test_cases()