1
0
mirror of https://git.savannah.gnu.org/git/coreutils.git synced 2025-08-10 05:43:02 +03:00

tests: make ulimit -v interact better with ASAN

ulimit -v is generally not supported with ASAN, giving errors like:
  "ReserveShadowMemoryRange failed while trying to map 0x... bytes.
   Perhaps you're using ulimit -v"

* tests/cp/link-heap.sh: Mention ASAN as a possible reason for skipping.
* tests/csplit/csplit-heap.sh: Likewise.
* tests/cut/cut-huge-range.sh: Likewise.
* tests/dd/no-allocate.sh: Likewise.
* tests/printf/printf-surprise.sh: Likewise.
* tests/rm/many-dir-entries-vs-OOM.sh: Likewise.
* tests/head/head-c.sh: Only skip the part of the test needing ulimit.
* tests/split/line-bytes.sh: Likewise.
This commit is contained in:
Pádraig Brady
2024-01-17 23:49:52 +00:00
parent c4c5ed8f4e
commit aa50ea55ea
8 changed files with 13 additions and 14 deletions

View File

@@ -23,7 +23,7 @@ expensive_
# Determine basic amount of memory needed for 'cp -al'.
touch f || framework_failure_
vm=$(get_min_ulimit_v_ cp -al f f2) \
|| skip_ "this shell lacks ulimit support"
|| skip_ 'shell lacks ulimit, or ASAN enabled'
rm f f2 || framework_failure_
a=$(printf %031d 0)

View File

@@ -22,7 +22,7 @@ print_ver_ csplit
# Determine basic amount of memory needed.
{ echo y; echo n; } > f || framework_failure_
vm=$(get_min_ulimit_v_ csplit -z f %n%1) \
|| skip_ "this shell lacks ulimit support"
|| skip_ 'shell lacks ulimit, or ASAN enabled'
(
ulimit -v $(($vm + 4000)) \

View File

@@ -21,7 +21,7 @@ print_ver_ cut
getlimits_
vm=$(get_min_ulimit_v_ returns_ 0 cut -b1 /dev/null) \
|| skip_ "this shell lacks ulimit support"
|| skip_ 'shell lacks ulimit, or ASAN enabled'
# Ensure we can cut up to our sentinel value.
# Don't use expr to subtract one,

View File

@@ -22,7 +22,7 @@ print_ver_ dd
# Determine basic amount of memory needed.
echo . > f || framework_failure_
vm=$(get_min_ulimit_v_ timeout 10 dd if=f of=f2 status=none) \
|| skip_ "this shell lacks ulimit support"
|| skip_ 'shell lacks ulimit, or ASAN enabled'
rm f f2 || framework_failure_
# count and skip are zero, we don't need to allocate memory

View File

@@ -20,9 +20,6 @@
print_ver_ head
getlimits_
vm=$(get_min_ulimit_v_ head -c1 /dev/null) \
|| skip_ "this shell lacks ulimit support"
# exercise the fix of 2001-08-18, based on test case from Ian Bruce
echo abc > in || framework_failure_
(head -c1; head -c1) < in > out || fail=1
@@ -42,7 +39,9 @@ esac
# Only allocate memory as needed.
# Coreutils <= 8.21 would allocate memory up front
# based on the value passed to -c
vm=$(get_min_ulimit_v_ head -c1 /dev/null) && {
(ulimit -v $(($vm+8000)) && head --bytes=-$SSIZE_MAX < /dev/null) || fail=1
}
# Make sure it works on funny files in /proc and /sys.

View File

@@ -22,7 +22,7 @@ prog=printf
print_ver_ printf
vm=$(get_min_ulimit_v_ env $prog %20f 0) \
|| skip_ "this shell lacks ulimit support"
|| skip_ 'shell lacks ulimit, or ASAN enabled'
# Up to coreutils-6.9, "printf %.Nf 0" would encounter an ENOMEM internal
# error from glibc's printf(3) function whenever N was large relative to

View File

@@ -27,7 +27,7 @@ mkdir d2 \
# Restrict memory. Each of these coreutils-8.12 programs would fail
# with a diagnostic like "rm: fts_read failed: Cannot allocate memory".
vm=$(get_min_ulimit_v_ du -sh d2) \
|| skip_ "this shell lacks ulimit support"
|| skip_ 'shell lacks ulimit, or ASAN enabled'
# With many files in a single directory...
mkdir d || framework_failure_

View File

@@ -19,11 +19,11 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ split
vm=$(get_min_ulimit_v_ split -C 'K' /dev/null) \
|| skip_ "this shell lacks ulimit support"
# Ensure memory is not allocated up front
vm=$(get_min_ulimit_v_ split -C 'K' /dev/null) && {
(ulimit -v $vm && split -C 'G' /dev/null) || fail=1
}
# Ensure correct operation with various split and buffer size combinations