Skip to content

Commit dfbf26b

Browse files
committed
testenv: handle if ulimit -l returns string "unlimited"
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
1 parent e147306 commit dfbf26b

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

testenv/testenv.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ die()
5454

5555
check_prereq()
5656
{
57+
local max_locked_mem=$(ulimit -l)
58+
5759
for t in $NEEDED_TOOLS; do
5860
which "$t" > /dev/null || die "Missing required tools: $t"
5961
done
@@ -64,7 +66,11 @@ check_prereq()
6466

6567
[ -d "$STATEDIR" ] || mkdir -p "$STATEDIR" || die "Unable to create state dir $STATEDIR"
6668

67-
[ "$(ulimit -l)" -ge "$MIN_ULIMIT_L" ] || ulimit -l "$MIN_ULIMIT_L" || die "Unable to set ulimit"
69+
if [ "$max_locked_mem" != "unlimited" ]; then
70+
if [ "$max_locked_mem" -ge "$MIN_ULIMIT_L" ]; then
71+
ulimit -l "$MIN_ULIMIT_L" || die "Unable to set ulimit"
72+
fi
73+
fi
6874
}
6975

7076
get_nsname()

0 commit comments

Comments
 (0)