]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: make ulimit -v interact better with ASAN
authorPádraig Brady <P@draigBrady.com>
Wed, 17 Jan 2024 23:49:52 +0000 (23:49 +0000)
committerPádraig Brady <P@draigBrady.com>
Wed, 17 Jan 2024 23:59:49 +0000 (23:59 +0000)
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.

tests/cp/link-heap.sh
tests/csplit/csplit-heap.sh
tests/cut/cut-huge-range.sh
tests/dd/no-allocate.sh
tests/head/head-c.sh
tests/printf/printf-surprise.sh
tests/rm/many-dir-entries-vs-OOM.sh
tests/split/line-bytes.sh

index c9c59896ad985f1e0bf753558d00db2e654e8d3c..77b87d9f144d132caee567d9a5fc9b45a6c706e1 100755 (executable)
@@ -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)
index 183f7cb4629296a90ad36339f0f998158124fead..322ca1c70b2c98262ecc0de06b2f0b335e5ef830 100755 (executable)
@@ -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)) \
index 37bd2a66ab4f614d9f8b9281a2dffad54dc28d14..75982b29e017d16f32f3fc1bb7052bf95ba5a084 100755 (executable)
@@ -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,
index 67ced50476768f6017e311928230a8c6f4dd3bdb..9105204155b8164d942426302c75deba004bf78b 100755 (executable)
@@ -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
index efd793cd41fac03fc684d72473e3b2b38d039a34..664e3d56b0830e24da169e4871c2d93d1ce9f122 100755 (executable)
@@ -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
-(ulimit -v $(($vm+8000)) && head --bytes=-$SSIZE_MAX < /dev/null) || fail=1
+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.
 
index 652cb5485094d4d0b414912de4edf9f958016de0..d51ab0678b90d3f733ba8c19897dfe4e00265ae2 100755 (executable)
@@ -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
index f0da2c7959b655580b1a85993d0a6833a1cb051f..68c0066b0988fa5dc6c80ef356d7073df643cefa 100755 (executable)
@@ -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_
index 3f30bd8a5728b5d776b51592af8cbf69a1abe611..6c57ad1a1a7f1615050cd6eaad9f7bde041cb396 100755 (executable)
 . "${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
-(ulimit -v $vm && split -C 'G' /dev/null) || fail=1
+
+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