diff options
Diffstat (limited to 'tests/misc/cut-huge-range.sh')
-rwxr-xr-x | tests/misc/cut-huge-range.sh | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/misc/cut-huge-range.sh b/tests/misc/cut-huge-range.sh index 035d8d087..4df2fc066 100755 --- a/tests/misc/cut-huge-range.sh +++ b/tests/misc/cut-huge-range.sh @@ -18,9 +18,11 @@ . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src print_ver_ cut -require_ulimit_v_ getlimits_ +vm=$(get_min_ulimit_v_ cut -b1 /dev/null) \ + || skip_ "this shell lacks ulimit support" + # sed script to subtract one from the input. # Each input line should consist of a positive decimal number. # Each output line's number is one less than the input's. @@ -49,15 +51,15 @@ CUT_MAX=$(echo $SIZE_MAX | sed "$subtract_one") # From coreutils-8.10 through 8.20, this would make cut try to allocate # a 256MiB bit vector. With a 20MB limit on VM, the following would fail. -(ulimit -v 20000; : | cut -b$CUT_MAX- > err 2>&1) || fail=1 +(ulimit -v $vm && : | cut -b$CUT_MAX- > err 2>&1) || fail=1 # Up to and including coreutils-8.21, cut would allocate possibly needed # memory upfront. Subsequently extra memory is no longer needed. -(ulimit -v 20000; : | cut -b1-$CUT_MAX >> err 2>&1) || fail=1 +(ulimit -v $vm && : | cut -b1-$CUT_MAX >> err 2>&1) || fail=1 # Explicitly disallow values above CUT_MAX -(ulimit -v 20000; : | returns_ 1 cut -b$SIZE_MAX 2>/dev/null) || fail=1 -(ulimit -v 20000; : | returns_ 1 cut -b$SIZE_OFLOW 2>/dev/null) || fail=1 +(ulimit -v $vm && : | returns_ 1 cut -b$SIZE_MAX 2>/dev/null) || fail=1 +(ulimit -v $vm && : | returns_ 1 cut -b$SIZE_OFLOW 2>/dev/null) || fail=1 compare /dev/null err || fail=1 |