From: Jim Meyering Date: Thu, 2 Aug 2012 17:12:18 +0000 (+0200) Subject: tests: avoid FP ulimit failure with valgrind-wrapped tools X-Git-Tag: v8.18~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4bee223d96fe34fd5290575ddb6eba7c9c7d7418;p=thirdparty%2Fcoreutils.git tests: avoid FP ulimit failure with valgrind-wrapped tools * tests/init.cfg (require_ulimit_): Raise VM limit from 10MiB to 20MiB, to accommodate overhead of a valgrind-wrapped date program. Also declare this function's local variables "local". --- diff --git a/tests/init.cfg b/tests/init.cfg index c1cb92fb28..506c9b3295 100644 --- a/tests/init.cfg +++ b/tests/init.cfg @@ -107,14 +107,19 @@ require_openat_support_() require_ulimit_() { - ulimit_works=yes - # Expect to be able to exec a program in 10MB of virtual memory, - # but not in 20KB. I chose "date". It must not be a shell built-in + local ulimit_works=yes + # Expect to be able to exec a program in 10MiB of virtual memory, + # (10MiB is usually plenty, but valgrind-wrapped date requires 19000KiB, + # so allow more in that case) + # but not in 20KiB. I chose "date". It must not be a shell built-in # function, so you can't use echo, printf, true, etc. # Of course, in coreutils, I could use $top_builddir/src/true, # but this should be able to work for other projects, too. - ( ulimit -v 10000; date ) > /dev/null 2>&1 || ulimit_works=no - ( ulimit -v 20; date ) > /dev/null 2>&1 && ulimit_works=no + local vm + case $(printenv LD_PRELOAD) in */valgrind/*) vm=22000;; *) vm=10000;; esac + + ( ulimit -v $vm; date ) > /dev/null 2>&1 || ulimit_works=no + ( ulimit -v 20; date ) > /dev/null 2>&1 && ulimit_works=no test $ulimit_works = no \ && skip_ "this shell lacks ulimit support"