git: 3562b7b1eb80 - main - hostname(1): skip test if jail binary is missing

From: Olivier Cochard <olivier_at_FreeBSD.org>
Date: Fri, 23 Feb 2024 09:48:42 UTC
The branch main has been updated by olivier:

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

commit 3562b7b1eb80107fe2832bf5a2bfa1a03888db1c
Author:     Olivier Cochard <olivier@FreeBSD.org>
AuthorDate: 2024-02-23 09:46:34 +0000
Commit:     Olivier Cochard <olivier@FreeBSD.org>
CommitDate: 2024-02-23 09:46:34 +0000

    hostname(1): skip test if jail binary is missing
    
    Approved by:    lwhsu
    Sponsored by:   Netflix
    Differential Revision:  https://reviews.freebsd.org/D44005
---
 bin/hostname/tests/hostname_test.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/bin/hostname/tests/hostname_test.sh b/bin/hostname/tests/hostname_test.sh
index 57517821f7f1..2ad6a1a5c358 100644
--- a/bin/hostname/tests/hostname_test.sh
+++ b/bin/hostname/tests/hostname_test.sh
@@ -42,6 +42,9 @@ test_jail_conf='%%test_jail_name%% {
 
 init()
 {
+    if ! which -s jail; then
+        atf_skip "This test requires jail"
+    fi
     echo "${test_jail_conf}" | \
 	    sed -e "s/%%test_jail_name%%/${test_jail_name}/" > "./jail.conf"
     jail -f "./jail.conf" -c ${test_jail_name}