From: Pádraig Brady
Date: Wed, 15 Jan 2025 15:13:00 +0000 (+0000) Subject: tests: avoid slow ulimit -v behavior X-Git-Tag: v9.6~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=61d4935802e706bd32387bf052b89286c754e2ae;p=thirdparty%2Fcoreutils.git 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. --- diff --git a/init.cfg b/init.cfg index ae158c7a3b..7e21f96c6a 100644 --- a/init.cfg +++ b/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 diff --git a/tests/misc/write-errors.sh b/tests/misc/write-errors.sh index 78379b542c..13e6d11fab 100755 --- a/tests/misc/write-errors.sh +++ b/tests/misc/write-errors.sh @@ -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_