]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: fix usage of require_ulimit_
authorPádraig Brady <P@draigBrady.com>
Thu, 25 Apr 2013 10:03:22 +0000 (11:03 +0100)
committerPádraig Brady <P@draigBrady.com>
Thu, 25 Apr 2013 10:13:48 +0000 (11:13 +0100)
* init.cfg (require_ulimit_v_): Renamed from require_ulimit_
as this only checks for ulimit -v support.  Other uses of
ulimit -t and ulimit -n in tests shouldn't cause false failures
if not supported.
* cfg.mk (sc_prohibit_test_ulimit_without_require_): A new syntax check
to ensure that require_ulimit_v_() is used iff required.
* tests/misc/head-c.sh: Add missing call to require_ulimit_v_.
* tests/rm/many-dir-entries-vs-OOM.sh: Likewise.
* tests/split/r-chunk.sh: Remove non mandatory require_ulimit_ call.
* tests/misc/sort-merge-fdlimit.sh: Likewise.
* tests/cp/link-heap.sh: Adjust to renamed require_ulimit_v_.
* tests/dd/no-allocate.sh: Likewise.
* tests/misc/csplit-heap.sh: Likewise.
* tests/misc/cut-huge-to-eol-range.sh: Likewise.
* tests/misc/printf-surprise.sh: Likewise.

cfg.mk
init.cfg
tests/cp/link-heap.sh
tests/dd/no-allocate.sh
tests/misc/csplit-heap.sh
tests/misc/cut-huge-to-eol-range.sh
tests/misc/head-c.sh
tests/misc/printf-surprise.sh
tests/misc/sort-merge-fdlimit.sh
tests/rm/many-dir-entries-vs-OOM.sh
tests/split/r-chunk.sh

diff --git a/cfg.mk b/cfg.mk
index 6fa7b1f72848977f7929f2a465f7730f1b32b857..6703dfe33df4ed7e008d70a3905319078ec887f3 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -408,6 +408,13 @@ sc_some_programs_must_avoid_exit_failure:
            && { echo '$(ME): do not use EXIT_FAILURE in the above'     \
                  1>&2; exit 1; } || :
 
+# Ensure that tests call the require_ulimit_v_ function if using ulimit -v
+sc_prohibit_test_ulimit_without_require_:
+       @(git grep -l require_ulimit_v_ tests;                          \
+         git grep -l 'ulimit -v' tests)                                \
+         | sort | uniq -u | grep . && { echo "$(ME): the above test(s)"\
+         " should match require_ulimit_v_ with ulimit -v" 1>&2; exit 1; } || :
+
 # Ensure that tests call the print_ver_ function for programs which are
 # actually used in that test.
 sc_prohibit_test_calls_print_ver_with_irrelevant_argument:
index 33122cc69b6ce0c4a63577092758e509e0ce34b4..c48607c93560aa8715e2e37ee5e9a164f8ff4203 100644 (file)
--- a/init.cfg
+++ b/init.cfg
@@ -112,7 +112,7 @@ require_openat_support_()
   fi
 }
 
-require_ulimit_()
+require_ulimit_v_()
 {
   local ulimit_works=yes
   # Expect to be able to exec a program in 10MiB of virtual memory,
index 62d7de0008f9e8b25369a9630c68368ef93ab502..7de78131d85a5b07285526c97c36ae7e46f3b665 100755 (executable)
@@ -19,7 +19,7 @@
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ cp
 expensive_
-require_ulimit_
+require_ulimit_v_
 
 a=$(printf %031d 0)
 b=$(printf %031d 1)
index e45dd5cf9dfba8e047a2073a25cbcad565fb42df..dd1a7408b7583beb6fe0a403caed63457f7336af 100755 (executable)
@@ -18,7 +18,7 @@
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ dd
-require_ulimit_
+require_ulimit_v_
 
 # count and skip is zero, we don't need to allocate memory
 (ulimit -v 20000; dd  bs=30M count=0) || fail=1
index 82945a78d64dc68624b032d50d93fce0905558de..3c300cec4412a6279b0d868283e5e2fae7686223 100755 (executable)
@@ -19,7 +19,7 @@
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ csplit
 
-require_ulimit_
+require_ulimit_v_
 
 (
  ulimit -v 20000
index 42cecfd797c09098a1a5768de5ab3b5924d5031c..e6abe6ec554eacc866a862e55834bfc1ca8f0126 100755 (executable)
@@ -18,7 +18,7 @@
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ cut
-require_ulimit_
+require_ulimit_v_
 getlimits_
 
 # From coreutils-8.10 through 8.20, this would make cut try to allocate
index eada8d550e3817b9f9fb664ab0589daba9636de0..37a86cea8e7c36e807d2f7e99c4f2f55defd0b3a 100755 (executable)
@@ -18,6 +18,7 @@
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ head
+require_ulimit_v_
 
 # exercise the fix of 2001-08-18, based on test case from Ian Bruce
 echo abc > in || framework_failure_
index 0db6f7b1a9e1e53c6f4e32b2406410e27f790b09..ccd5990f64f7d7113adb367a7cad48eb4f9b2b6b 100755 (executable)
@@ -20,8 +20,7 @@ prog=printf
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ printf
-
-require_ulimit_
+require_ulimit_v_
 
 
 # Up to coreutils-6.9, "printf %.Nf 0" would encounter an ENOMEM internal
index bcd023ae074fce115b0818f795ae75a551de339b..2125f852fb1e8577e5504a72dc278d3f61e1fea8 100755 (executable)
@@ -19,7 +19,6 @@
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ sort
-require_ulimit_
 
 mkdir in err || framework_failure_
 
index c867a46e11ede3407871bf2cc475134d294433b1..a6ecdf67ad780a5f89c2e86a9dce9da21a8dce87 100755 (executable)
@@ -19,6 +19,7 @@
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ rm du chmod
+require_ulimit_v_
 
 expensive_
 
index f4c4fd225cfd3175612e03fc7bb956841e181f2b..9c5b86ed4f4c74451da263e0fa275999a897cedd 100755 (executable)
@@ -19,8 +19,6 @@
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ split
 
-require_ulimit_
-
 # N can be greater than the file size
 # in which case no data is extracted, or empty files are written
 split -n r/10 /dev/null || fail=1