git: 161984ade1fa - main - tests: Fixing incomplete atf_skip if missing jail condition
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 23 Feb 2024 12:11:21 UTC
The branch main has been updated by olivier: URL: https://cgit.FreeBSD.org/src/commit/?id=161984ade1fa0638b732dc9c60bc9bb346e60be9 commit 161984ade1fa0638b732dc9c60bc9bb346e60be9 Author: Olivier Cochard <olivier@FreeBSD.org> AuthorDate: 2024-02-23 12:02:40 +0000 Commit: Olivier Cochard <olivier@FreeBSD.org> CommitDate: 2024-02-23 12:08:09 +0000 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 2ad6a1a5c358..a4d4d54bb052 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 6ac6aa904dbc..d4c57915880f 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)