git: d481443acb1c - main - ping_test: Fix tests ping_46 and ping6_46

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Thu, 03 Nov 2022 14:39:53 UTC
The branch main has been updated by markj:

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

commit d481443acb1c77610ac50a226f402e4629a608fb
Author:     Jose Luis Duran <jlduran@gmail.com>
AuthorDate: 2022-11-02 11:43:40 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-11-03 14:39:32 +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
---
 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()