aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2025-01-15 15:13:00 +0000
committerPádraig Brady <P@draigBrady.com>2025-01-15 17:07:13 +0000
commit61d4935802e706bd32387bf052b89286c754e2ae (patch)
tree29fb67b64eb87d2b0fa16781b6db5fe5a135cab8
parenttests: use more portable timeout presence check (diff)
downloadcoreutils-61d4935802e706bd32387bf052b89286c754e2ae.tar.gz
coreutils-61d4935802e706bd32387bf052b89286c754e2ae.zip
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.
-rw-r--r--init.cfg20
-rwxr-xr-xtests/misc/write-errors.sh2
2 files changed, 19 insertions, 3 deletions
diff --git a/init.cfg b/init.cfg
index ae158c7a3..7e21f96c6 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 78379b542..13e6d11fa 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_