git: 2cb39df0a12f - main - tests: Switch sys/kern/sysctl_security_jail_children to execenv=jail

From: Igor Ostapenko <igoro_at_FreeBSD.org>
Date: Tue, 29 Oct 2024 21:30:06 UTC
The branch main has been updated by igoro:

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

commit 2cb39df0a12fcb80a8debaaeabc44006827a70f1
Author:     Igor Ostapenko <igoro@FreeBSD.org>
AuthorDate: 2024-10-29 21:28:02 +0000
Commit:     Igor Ostapenko <igoro@FreeBSD.org>
CommitDate: 2024-10-29 21:28:02 +0000

    tests: Switch sys/kern/sysctl_security_jail_children to execenv=jail
    
    Kyua skips tests based on the jail execution environment if a system is
    built WITHOUT_JAIL. Thus, the test case does not need to handle it.
    
    Reviewed by:    markj
    Approved by:    markj (mentor)
    Differential Revision:  https://reviews.freebsd.org/D47105
---
 tests/sys/kern/Makefile                         | 1 -
 tests/sys/kern/sysctl_security_jail_children.sh | 8 +-------
 2 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/tests/sys/kern/Makefile b/tests/sys/kern/Makefile
index 933c1c9aa10e..b2d133a0457f 100644
--- a/tests/sys/kern/Makefile
+++ b/tests/sys/kern/Makefile
@@ -63,7 +63,6 @@ TEST_METADATA.sonewconn_overflow+=	required_user="root"
 TEST_METADATA.sonewconn_overflow+=	is_exclusive="true"
 ATF_TESTS_SH+=	sendfile_test
 ATF_TESTS_SH+=	sysctl_security_jail_children
-TEST_METADATA.sysctl_security_jail_children+=	is_exclusive="true"
 
 ${PACKAGE}FILES+=	sonewconn_overflow.py
 ${PACKAGE}FILESMODE_sonewconn_overflow.py=0555
diff --git a/tests/sys/kern/sysctl_security_jail_children.sh b/tests/sys/kern/sysctl_security_jail_children.sh
index d4c57915880f..ac990e57ff74 100644
--- a/tests/sys/kern/sysctl_security_jail_children.sh
+++ b/tests/sys/kern/sysctl_security_jail_children.sh
@@ -24,21 +24,15 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 
-#
-# Even being is_exclusive="true" this test does not expect a host to spawn
-# other jails during the test execution.
-#
 atf_test_case "max_cur" "cleanup"
 max_cur_head()
 {
 	atf_set descr 'Test maximum and current number of child jails'
 	atf_set require.user root
+	atf_set execenv jail
 }
 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)