diff options
author | Mark Wielaard <mark@klomp.org> | 2020-10-29 16:43:14 +0100 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2020-10-31 00:49:42 +0100 |
commit | 70717f8c1fdef3ba5e83508bd3956b2479536534 (patch) | |
tree | 3cae2adf11d80ec118b1cba194c7fcbb0119a860 /tests/dwfl-bug-fd-leak.c | |
parent | b256093ad9a8b4972ae02bece266adad8a3c6dbd (diff) | |
download | elfutils-70717f8c1fdef3ba5e83508bd3956b2479536534.tar.gz |
tests: Run valgrind also on binary tests.
When configuring with --enable-valgrind we were only running valgrind
on tests with a shell wrapper script. This patch makes sure to also run
valgrind on "pure" binary tests. This found one small issue in libasm
where we could be writing some uninitialized padding to an ELF file.
And there were a couple tests that didn't clean up all the resources
they used. Both issues are also fixed with this patch.
Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'tests/dwfl-bug-fd-leak.c')
-rw-r--r-- | tests/dwfl-bug-fd-leak.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/dwfl-bug-fd-leak.c b/tests/dwfl-bug-fd-leak.c index ee3a916b..b0913361 100644 --- a/tests/dwfl-bug-fd-leak.c +++ b/tests/dwfl-bug-fd-leak.c @@ -101,7 +101,14 @@ main (void) /* Set locale. */ (void) setlocale (LC_ALL, ""); - struct rlimit fd_limit = { .rlim_cur = 32, .rlim_max = 32 }; + /* Get both the soft and hard limits first. The soft limit is what + will be enforced against the process. The hard limit is the max + that can be set for the soft limit. We don't want to lower it + because we might not be able to (under valgrind). */ + struct rlimit fd_limit; + if (getrlimit (RLIMIT_NOFILE, &fd_limit) < 0) + error (2, errno, "getrlimit"); + fd_limit.rlim_cur = 32; if (setrlimit (RLIMIT_NOFILE, &fd_limit) < 0) error (2, errno, "setrlimit"); |