Changeset View
Changeset View
Standalone View
Standalone View
libexec/rc/tests/rc_subr_test.sh
Show All 29 Lines | |||||
{ | { | ||||
atf_set "descr" "Verify that \${name}_oomprotect=all protects " \ | atf_set "descr" "Verify that \${name}_oomprotect=all protects " \ | ||||
"the command and all its current and future children" | "the command and all its current and future children" | ||||
atf_set "require.user" "root" # For protect(1). | atf_set "require.user" "root" # For protect(1). | ||||
} | } | ||||
oomprotect_all_body() | 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)" | __name="$(atf_get ident)" | ||||
__pidfile="$(mktemp -t "${__name}.pid")" | __pidfile="$(mktemp -t "${__name}.pid")" | ||||
__childpidfile="$(mktemp -t "${__name}.childpid")" | __childpidfile="$(mktemp -t "${__name}.childpid")" | ||||
__script=$(mktemp -t "${__name}.script") | __script=$(mktemp -t "${__name}.script") | ||||
cat >> "$__script" <<-'LITERAL' | cat >> "$__script" <<-'LITERAL' | ||||
. /etc/rc.subr | . /etc/rc.subr | ||||
name="$1" | name="$1" | ||||
Show All 21 Lines | |||||
{ | { | ||||
atf_set "descr" "Verify that \${name}_oomprotect=yes protects " \ | atf_set "descr" "Verify that \${name}_oomprotect=yes protects " \ | ||||
"the command but not its children" | "the command but not its children" | ||||
atf_set "require.user" "root" # For protect(1). | atf_set "require.user" "root" # For protect(1). | ||||
} | } | ||||
oomprotect_yes_body() | 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)" | __name="$(atf_get ident)" | ||||
__pidfile="$(mktemp -t "${__name}.pid")" | __pidfile="$(mktemp -t "${__name}.pid")" | ||||
__script=$(mktemp -t "${__name}.script") | __script=$(mktemp -t "${__name}.script") | ||||
cat >> "$__script" <<-'LITERAL' | cat >> "$__script" <<-'LITERAL' | ||||
. /etc/rc.subr | . /etc/rc.subr | ||||
name="$1" | name="$1" | ||||
pidfile="$2" | pidfile="$2" | ||||
Show All 21 Lines |