Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Oct 2024 12:46:14 GMT
From:      Mateusz Piotrowski <0mp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 0313a36cb9d6 - stable/13 - rc/tests: Skip oomprotect tests in a jail
Message-ID:  <202410281246.49SCkE6C075807@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by 0mp:

URL: https://cgit.FreeBSD.org/src/commit/?id=0313a36cb9d60c1f2a197bfc186dc4dd6515a71d

commit 0313a36cb9d60c1f2a197bfc186dc4dd6515a71d
Author:     Mateusz Piotrowski <0mp@FreeBSD.org>
AuthorDate: 2024-10-14 10:28:47 +0000
Commit:     Mateusz Piotrowski <0mp@FreeBSD.org>
CommitDate: 2024-10-28 12:46:05 +0000

    rc/tests: Skip oomprotect tests in a jail
    
    oomprotect cannot be used in a jail.
    
    Reviewed by:    bnovkov, christos, markj
    Approved by:    bnovkov (mentor), christos (mentor), markj (mentor)
    MFC after:      1 week
    
    (cherry picked from commit 6fa42b91ca3f481912af98c4d49c44507eb1b8e1)
---
 libexec/rc/tests/rc_subr_test.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libexec/rc/tests/rc_subr_test.sh b/libexec/rc/tests/rc_subr_test.sh
index 0ca790e39a14..4a54f991d72d 100644
--- a/libexec/rc/tests/rc_subr_test.sh
+++ b/libexec/rc/tests/rc_subr_test.sh
@@ -35,6 +35,10 @@ oomprotect_all_head()
 
 oomprotect_all_body()
 {
+	if [ "$(sysctl -n security.jail.jailed)" != 0 ]; then
+		atf_skip "protect(1) cannot be used in a jail"
+	fi
+
 	__name="$(atf_get ident)"
 	__pidfile="$(mktemp -t "${__name}.pid")"
 	__childpidfile="$(mktemp -t "${__name}.childpid")"
@@ -72,6 +76,10 @@ oomprotect_yes_head()
 
 oomprotect_yes_body()
 {
+	if [ "$(sysctl -n security.jail.jailed)" != 0 ]; then
+		atf_skip "protect(1) cannot be used in a jail"
+	fi
+
 	__name="$(atf_get ident)"
 	__pidfile="$(mktemp -t "${__name}.pid")"
 	__script=$(mktemp -t "${__name}.script")



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202410281246.49SCkE6C075807>