[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] tests: make ulimit -v interact better with ASAN
From: |
Pádraig Brady |
Subject: |
[PATCH] tests: make ulimit -v interact better with ASAN |
Date: |
Wed, 17 Jan 2024 23:58:17 +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 | 2 +-
tests/csplit/csplit-heap.sh | 2 +-
tests/cut/cut-huge-range.sh | 2 +-
tests/dd/no-allocate.sh | 2 +-
tests/head/head-c.sh | 7 +++----
tests/printf/printf-surprise.sh | 2 +-
tests/rm/many-dir-entries-vs-OOM.sh | 2 +-
tests/split/line-bytes.sh | 8 ++++----
8 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/tests/cp/link-heap.sh b/tests/cp/link-heap.sh
index c9c59896a..77b87d9f1 100755
--- a/tests/cp/link-heap.sh
+++ b/tests/cp/link-heap.sh
@@ -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)
diff --git a/tests/csplit/csplit-heap.sh b/tests/csplit/csplit-heap.sh
index 183f7cb46..322ca1c70 100755
--- a/tests/csplit/csplit-heap.sh
+++ b/tests/csplit/csplit-heap.sh
@@ -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)) \
diff --git a/tests/cut/cut-huge-range.sh b/tests/cut/cut-huge-range.sh
index 37bd2a66a..75982b29e 100755
--- a/tests/cut/cut-huge-range.sh
+++ b/tests/cut/cut-huge-range.sh
@@ -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,
diff --git a/tests/dd/no-allocate.sh b/tests/dd/no-allocate.sh
index 67ced5047..910520415 100755
--- a/tests/dd/no-allocate.sh
+++ b/tests/dd/no-allocate.sh
@@ -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
diff --git a/tests/head/head-c.sh b/tests/head/head-c.sh
index efd793cd4..664e3d56b 100755
--- a/tests/head/head-c.sh
+++ b/tests/head/head-c.sh
@@ -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.
diff --git a/tests/printf/printf-surprise.sh b/tests/printf/printf-surprise.sh
index 652cb5485..d51ab0678 100755
--- a/tests/printf/printf-surprise.sh
+++ b/tests/printf/printf-surprise.sh
@@ -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
diff --git a/tests/rm/many-dir-entries-vs-OOM.sh
b/tests/rm/many-dir-entries-vs-OOM.sh
index f0da2c795..68c0066b0 100755
--- a/tests/rm/many-dir-entries-vs-OOM.sh
+++ b/tests/rm/many-dir-entries-vs-OOM.sh
@@ -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_
diff --git a/tests/split/line-bytes.sh b/tests/split/line-bytes.sh
index 3f30bd8a5..6c57ad1a1 100755
--- a/tests/split/line-bytes.sh
+++ b/tests/split/line-bytes.sh
@@ -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
-(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
--
2.43.0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] tests: make ulimit -v interact better with ASAN,
Pádraig Brady <=