summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2014-08-01 16:36:39 +0930
committerRusty Russell <rusty@rustcorp.com.au>2014-08-01 16:36:39 +0930
commit79ac0049672b1f27b1a7121d06cc38721f76b8e1 (patch)
tree3d8ce5b892b3f2acbbbecd46dfcb3d8346167908
parent54d5123a56011f805500a8d18e178874300be1f7 (diff)
tools/ccanlint: add global .valgrind_suppressions file.
Seems like my local Ubuntu install is giving bogus warnings. Allow local valgrind overrides. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r--.gitignore1
-rw-r--r--tools/ccanlint/tests/tests_pass.c17
-rw-r--r--tools/ccanlint/tests/tests_pass.h1
-rw-r--r--tools/ccanlint/tests/tests_pass_valgrind.c4
4 files changed, 18 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
index 061c08d0..60886efd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
TAGS
.depends
+.valgrind_suppressions
*.d
*.o
libccan.a
diff --git a/tools/ccanlint/tests/tests_pass.c b/tools/ccanlint/tests/tests_pass.c
index cb093264..af71dbe4 100644
--- a/tools/ccanlint/tests/tests_pass.c
+++ b/tools/ccanlint/tests/tests_pass.c
@@ -3,6 +3,7 @@
#include <ccan/take/take.h>
#include <ccan/str/str.h>
#include <ccan/foreach/foreach.h>
+#include <ccan/tal/path/path.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -17,6 +18,7 @@
#include "tests_pass.h"
bool do_valgrind = false;
+const char *valgrind_suppress = "";
static const char *can_run(struct manifest *m)
{
@@ -27,9 +29,18 @@ static const char *can_run(struct manifest *m)
if (!is_excluded("tests_pass_valgrind")
&& run_command(m, &timeleft, &output,
- "valgrind -q true"))
+ "valgrind -q true")) {
+ const char *sfile;
+
do_valgrind = true;
+ /* Check for suppressions file for all of CCAN. */
+ sfile = path_join(m, ccan_dir, ".valgrind_suppressions");
+ if (path_is_file(sfile))
+ valgrind_suppress = tal_fmt(m, "--suppressions=%s",
+ sfile);
+ }
+
return NULL;
}
@@ -67,9 +78,9 @@ static void run_test(void *ctx,
run_command_async(i, *timeleft,
"valgrind -q"
" --leak-check=full"
- " --log-fd=3 %s %s"
+ " --log-fd=3 %s %s %s"
" 3> %s",
- options,
+ valgrind_suppress, options,
i->compiled[COMPILE_NORMAL],
i->valgrind_log);
return;
diff --git a/tools/ccanlint/tests/tests_pass.h b/tools/ccanlint/tests/tests_pass.h
index bbf2b36f..19a692a0 100644
--- a/tools/ccanlint/tests/tests_pass.h
+++ b/tools/ccanlint/tests/tests_pass.h
@@ -1,4 +1,5 @@
/* Set in tests_pass. */
extern bool do_valgrind;
+extern const char *valgrind_suppress;
extern struct ccanlint tests_pass_valgrind;
diff --git a/tools/ccanlint/tests/tests_pass_valgrind.c b/tools/ccanlint/tests/tests_pass_valgrind.c
index 5b4250bc..2f4df18b 100644
--- a/tools/ccanlint/tests/tests_pass_valgrind.c
+++ b/tools/ccanlint/tests/tests_pass_valgrind.c
@@ -251,10 +251,10 @@ static void run_under_debugger_vg(struct manifest *m, struct score *score)
return;
first = list_top(&score->per_file_errors, struct file_error, list);
- command = tal_fmt(m, "valgrind --leak-check=full --db-attach=yes%s %s",
+ command = tal_fmt(m, "valgrind --leak-check=full --db-attach=yes%s %s %s",
concat(score, per_file_options(&tests_pass_valgrind,
first->file)),
- first->file->compiled[COMPILE_NORMAL]);
+ valgrind_suppress, first->file->compiled[COMPILE_NORMAL]);
if (system(command))
doesnt_matter();
}