coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] tests: fix usage of require_ulimit_


From: Pádraig Brady
Subject: [PATCH] tests: fix usage of require_ulimit_
Date: Thu, 25 Apr 2013 11:15:54 +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                              |    7 +++++++
 init.cfg                            |    2 +-
 tests/cp/link-heap.sh               |    2 +-
 tests/dd/no-allocate.sh             |    2 +-
 tests/misc/csplit-heap.sh           |    2 +-
 tests/misc/cut-huge-to-eol-range.sh |    2 +-
 tests/misc/head-c.sh                |    1 +
 tests/misc/printf-surprise.sh       |    3 +--
 tests/misc/sort-merge-fdlimit.sh    |    1 -
 tests/rm/many-dir-entries-vs-OOM.sh |    1 +
 tests/split/r-chunk.sh              |    2 --
 11 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/cfg.mk b/cfg.mk
index 6fa7b1f..6703dfe 100644
--- 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:
diff --git a/init.cfg b/init.cfg
index 33122cc..c48607c 100644
--- 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,
diff --git a/tests/cp/link-heap.sh b/tests/cp/link-heap.sh
index 62d7de0..7de7813 100755
--- a/tests/cp/link-heap.sh
+++ b/tests/cp/link-heap.sh
@@ -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)
diff --git a/tests/dd/no-allocate.sh b/tests/dd/no-allocate.sh
index e45dd5c..dd1a740 100755
--- a/tests/dd/no-allocate.sh
+++ b/tests/dd/no-allocate.sh
@@ -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
diff --git a/tests/misc/csplit-heap.sh b/tests/misc/csplit-heap.sh
index 82945a7..3c300ce 100755
--- a/tests/misc/csplit-heap.sh
+++ b/tests/misc/csplit-heap.sh
@@ -19,7 +19,7 @@
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ csplit
 
-require_ulimit_
+require_ulimit_v_
 
 (
  ulimit -v 20000
diff --git a/tests/misc/cut-huge-to-eol-range.sh 
b/tests/misc/cut-huge-to-eol-range.sh
index 42cecfd..e6abe6e 100755
--- a/tests/misc/cut-huge-to-eol-range.sh
+++ b/tests/misc/cut-huge-to-eol-range.sh
@@ -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
diff --git a/tests/misc/head-c.sh b/tests/misc/head-c.sh
index eada8d5..37a86ce 100755
--- a/tests/misc/head-c.sh
+++ b/tests/misc/head-c.sh
@@ -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_
diff --git a/tests/misc/printf-surprise.sh b/tests/misc/printf-surprise.sh
index 0db6f7b..ccd5990 100755
--- a/tests/misc/printf-surprise.sh
+++ b/tests/misc/printf-surprise.sh
@@ -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
diff --git a/tests/misc/sort-merge-fdlimit.sh b/tests/misc/sort-merge-fdlimit.sh
index bcd023a..2125f85 100755
--- a/tests/misc/sort-merge-fdlimit.sh
+++ b/tests/misc/sort-merge-fdlimit.sh
@@ -19,7 +19,6 @@
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ sort
-require_ulimit_
 
 mkdir in err || framework_failure_
 
diff --git a/tests/rm/many-dir-entries-vs-OOM.sh 
b/tests/rm/many-dir-entries-vs-OOM.sh
index c867a46..a6ecdf6 100755
--- a/tests/rm/many-dir-entries-vs-OOM.sh
+++ b/tests/rm/many-dir-entries-vs-OOM.sh
@@ -19,6 +19,7 @@
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ rm du chmod
+require_ulimit_v_
 
 expensive_
 
diff --git a/tests/split/r-chunk.sh b/tests/split/r-chunk.sh
index f4c4fd2..9c5b86e 100755
--- a/tests/split/r-chunk.sh
+++ b/tests/split/r-chunk.sh
@@ -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
-- 
1.7.7.6




reply via email to

[Prev in Thread] Current Thread [Next in Thread]