[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] tests: avoid FP ulimit failure with valgrind-wrapped tools
From: |
Jim Meyering |
Subject: |
Re: [PATCH] tests: avoid FP ulimit failure with valgrind-wrapped tools |
Date: |
Sat, 04 Aug 2012 12:05:07 +0200 |
Jim Meyering wrote:
> All ulimit-requiring tests would be skipped
> when running against valgrind-wrapped tools.
> This adjusts the heuristic to avoid that:
>
> Subject: [PATCH] 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.
> ---
> tests/init.cfg | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/tests/init.cfg b/tests/init.cfg
> index c1cb92f..6c16fff 100644
> --- a/tests/init.cfg
> +++ b/tests/init.cfg
> @@ -108,12 +108,13 @@ require_openat_support_()
> require_ulimit_()
> {
> ulimit_works=yes
> - # Expect to be able to exec a program in 10MB of virtual memory,
> + # Expect to be able to exec a program in 20MB of virtual memory,
> + # (10MB is usually plenty, but valgrind-wrapped date requires 1900KiB)
> # but not in 20KB. 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 20000; date ) > /dev/null 2>&1 || ulimit_works=no
> ( ulimit -v 20; date ) > /dev/null 2>&1 && ulimit_works=no
I realized that I shouldn't be relaxing this test unconditionally.
Think about it... how often do people test valgrind-wrap tools?
Almost never ;-)
Instead, relax it only when it looks like we're running under valgrind.
Currently I see this added to the environment when run via valgrind:
LD_PRELOAD=/usr/lib64/valgrind/vgpreload_core-amd64-linux.so:/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so
So I'm amending the patch above with the following.
Full patch below.
>From 2ae9e7228c77f326f59c3a125030380a382b5a9b Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sat, 4 Aug 2012 11:31:35 +0200
Subject: [PATCH] maint: init.cfg for ulimit
---
tests/init.cfg | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/tests/init.cfg b/tests/init.cfg
index 6c16fff..506c9b3 100644
--- a/tests/init.cfg
+++ b/tests/init.cfg
@@ -107,15 +107,19 @@ require_openat_support_()
require_ulimit_()
{
- ulimit_works=yes
- # Expect to be able to exec a program in 20MB of virtual memory,
- # (10MB is usually plenty, but valgrind-wrapped date requires 1900KiB)
- # 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 20000; 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"
--
1.7.12.rc1.10.g97c7934
>From 4bee223d96fe34fd5290575ddb6eba7c9c7d7418 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 2 Aug 2012 19:12:18 +0200
Subject: [PATCH] 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 c1cb92f..506c9b3 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"
--
1.7.12.rc1.10.g97c7934