From 161984ade1fa0638b732dc9c60bc9bb346e60be9 Mon Sep 17 00:00:00 2001 From: Olivier Cochard Date: Fri, 23 Feb 2024 13:02:40 +0100 Subject: [PATCH] tests: Fixing incomplete atf_skip if missing jail condition Testing the scripts outside kyua(1) was a bad idea: It didn't allow me to detect that they were faulty. Sponsored by: Netflix --- bin/hostname/tests/hostname_test.sh | 3 +++ sys/kern/sysctl_security_jail_children.sh | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/hostname/tests/hostname_test.sh b/bin/hostname/tests/hostname_test.sh index 2ad6a1a5c35..a4d4d54bb05 100644 --- a/bin/hostname/tests/hostname_test.sh +++ b/bin/hostname/tests/hostname_test.sh @@ -81,6 +81,9 @@ basic_body() } basic_cleanup() { + if ! which -s jail; then + atf_skip "This test requires jail" + fi recycle } diff --git a/sys/kern/sysctl_security_jail_children.sh b/sys/kern/sysctl_security_jail_children.sh index 6ac6aa904db..d4c57915880 100644 --- a/sys/kern/sysctl_security_jail_children.sh +++ b/sys/kern/sysctl_security_jail_children.sh @@ -33,12 +33,12 @@ max_cur_head() { atf_set descr 'Test maximum and current number of child jails' atf_set require.user root - if ! which -s jail; then - atf_skip "This test requires jail" - fi } max_cur_body() { + if ! which -s jail; then + atf_skip "This test requires jail" + fi origin_max=$(sysctl -n security.jail.children.max) origin_cur=$(sysctl -n security.jail.children.cur) -- 2.45.0