From 4bee223d96fe34fd5290575ddb6eba7c9c7d7418 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 2 Aug 2012 19:12:18 +0200 Subject: 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". --- tests/init.cfg | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/init.cfg b/tests/init.cfg index c1cb92fb2..506c9b329 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" -- cgit v1.2.3-70-g09d2