git: 4b990663ff63 - main - libc/tests: fix couple errors for getaddrinfo_test

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Tue, 08 Apr 2025 17:34:54 UTC
The branch main has been updated by glebius:

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

commit 4b990663ff63de8db700dc0e386421c201e43412
Author:     K Rin <rin@sandb0x.tw>
AuthorDate: 2025-04-05 23:54:11 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2025-04-08 16:49:54 +0000

    libc/tests: fix couple errors for getaddrinfo_test
    
    - The reason our test is flaky is its dependence on ip6addrctl_policy.
    - While here, fix shell logic.  When our diff(1) prints a diff it returns
      a nonzero status and this is when we want to atf_fail().
---
 lib/libc/tests/net/getaddrinfo/t_getaddrinfo.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/libc/tests/net/getaddrinfo/t_getaddrinfo.sh b/lib/libc/tests/net/getaddrinfo/t_getaddrinfo.sh
index 94a3c0b2e52c..79997a9a1631 100755
--- a/lib/libc/tests/net/getaddrinfo/t_getaddrinfo.sh
+++ b/lib/libc/tests/net/getaddrinfo/t_getaddrinfo.sh
@@ -55,7 +55,7 @@ check_output()
 	fi
 
 	cmp  -s $(atf_get_srcdir)/data/${exp} out && return
-	diff -u $(atf_get_srcdir)/data/${exp} out && \
+	diff -u $(atf_get_srcdir)/data/${exp} out || \
 	atf_fail "Actual output does not match expected output"
 }
 
@@ -188,6 +188,7 @@ scopeaddr_body()
 
 atf_init_test_cases()
 {
+	service ip6addrctl prefer_ipv6
 	atf_add_test_case basic
 	atf_add_test_case specific
 	atf_add_test_case empty_hostname