mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2025-09-10 07:59:52 +02:00
tests: avoid slow ulimit -v behavior
* init.cfg (ulimit_supported_): skip_ if the ulimit -v takes too long, which was seen with bash 5.2 on Solaris 11, where fork() returned EAGAIN under memory constraints, and bash retried for about 16 seconds. (get_min_ulimit_v_): Break early if skipped. * tests/misc/write-errors.sh: Be more conservative and skip on failure to determine min ulimit.
This commit is contained in:
20
init.cfg
20
init.cfg
@@ -178,6 +178,8 @@ ulimit_supported_()
|
||||
v="$1"
|
||||
shift
|
||||
|
||||
local ulimit_start_=$(date +%s) || skip_ 'ulimit: date error'
|
||||
|
||||
(
|
||||
# Try to disable core dumps which may
|
||||
# occur with memory constraints
|
||||
@@ -185,6 +187,16 @@ ulimit_supported_()
|
||||
|
||||
ulimit -v $v && "$@"
|
||||
) >/dev/null 2>&1
|
||||
|
||||
ret=$?
|
||||
|
||||
local ulimit_end_=$(date +%s) || skip_ 'ulimit: date error'
|
||||
|
||||
# This can happen on Solaris 11 at least where fork() can give EAGAIN
|
||||
# and bash will retry for at least 16 seconds
|
||||
test $(($ulimit_end_ - $ulimit_start_)) -ge 10 && skip_ 'ulimit too slow'
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
# Determine the minimum required VM limit to run the given command.
|
||||
@@ -200,11 +212,15 @@ get_min_ulimit_v_()
|
||||
page_size=$(($page_size / 1024))
|
||||
|
||||
for v in $( seq 5000 5000 50000 ); do
|
||||
if ulimit_supported_ $v "$@"; then
|
||||
ulimit_supported_ $v "$@"; ret=$?
|
||||
test $ret = 77 && break;
|
||||
if test $ret = 0; then
|
||||
local prev_v
|
||||
prev_v=$v
|
||||
for v in $( seq $(($prev_v-1000)) -1000 1000 ); do
|
||||
ulimit_supported_ $v "$@" ||
|
||||
ulimit_supported_ $v "$@"; ret=$?
|
||||
test $ret = 77 && break 2;
|
||||
test $ret = 0 ||
|
||||
{
|
||||
ret_v=$((prev_v + $page_size))
|
||||
echo $ret_v
|
||||
|
||||
@@ -62,7 +62,7 @@ while read writer; do
|
||||
cmd=$(printf '%s\n' "$writer" | cut -d ' ' -f1) || framework_failure_
|
||||
base_mem=$(get_min_ulimit_v_ $cmd --version) \
|
||||
&& ulimit="ulimit -v $(($base_mem+8000))" \
|
||||
|| ulimit='true'
|
||||
|| skip_ 'unable to determine ulimit -v'
|
||||
|
||||
# Check /dev/full handling
|
||||
rm -f full.err || framework_failure_
|
||||
|
||||
Reference in New Issue
Block a user