From 4786b6edb824262957bfd5e7cff74c1e3983a9c9 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 24 Aug 2011 12:52:54 +0930 Subject: [PATCH] ccanlint: tests_pass_valgrind_noleaks: handle FAIL option on tests. Now we can mark test files as FAIL and not be bothered by them. --- tools/ccanlint/tests/tests_pass_valgrind.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tools/ccanlint/tests/tests_pass_valgrind.c b/tools/ccanlint/tests/tests_pass_valgrind.c index d248aaa8..2a227c88 100644 --- a/tools/ccanlint/tests/tests_pass_valgrind.c +++ b/tools/ccanlint/tests/tests_pass_valgrind.c @@ -18,6 +18,7 @@ #include REGISTER_TEST(tests_pass_valgrind); +REGISTER_TEST(tests_pass_valgrind_noleaks); /* Note: we already test safe_mode in run_tests.c */ static const char *can_run_vg(struct manifest *m) @@ -217,10 +218,22 @@ static void do_leakcheck_vg(struct manifest *m, { struct ccan_file *i; struct list_head *list; + char **options; bool leaks = false; foreach_ptr(list, &m->run_tests, &m->api_tests) { list_for_each(list, i, list) { + options = per_file_options(&tests_pass_valgrind_noleaks, + i); + if (options[0]) { + if (streq(options[0], "FAIL")) { + leaks = true; + continue; + } + errx(1, "Unknown leakcheck options '%s'", + options[0]); + } + if (i->leak_info) { score_file_error(score, i, 0, "%s", i->leak_info); @@ -275,7 +288,7 @@ struct ccanlint tests_pass_valgrind_noleaks = { .key = "tests_pass_valgrind_noleaks", .name = "Module's run and api tests have no memory leaks", .check = do_leakcheck_vg, + .takes_options = true, .needs = "tests_pass_valgrind" }; -REGISTER_TEST(tests_pass_valgrind_noleaks); -- 2.39.2