X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=tools%2Fccanlint%2Ftests%2Ftests_pass_valgrind.c;h=773a85e66a5a17aca87595bb0ca8f67441158a2e;hb=199023653cd6020218fbc4d0712591fc7ee0c5e1;hp=bf914856845f2a7a42e9cec97d210c9b7c3ef06a;hpb=13911ef769824a0958e1f1ce7292dfc8f23feb18;p=ccan diff --git a/tools/ccanlint/tests/tests_pass_valgrind.c b/tools/ccanlint/tests/tests_pass_valgrind.c index bf914856..773a85e6 100644 --- a/tools/ccanlint/tests/tests_pass_valgrind.c +++ b/tools/ccanlint/tests/tests_pass_valgrind.c @@ -18,9 +18,6 @@ #include #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) { @@ -29,6 +26,20 @@ static const char *can_run_vg(struct manifest *m) return NULL; } +static void do_leakcheck_vg(struct manifest *m, + unsigned int *timeleft, + struct score *score); + +static 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); + + /* Example output: ==2749== Conditional jump or move depends on uninitialised value(s) ==2749== at 0x4026C60: strnlen (mc_replace_strmem.c:263) @@ -146,7 +157,6 @@ static const char *concat(struct score *score, char *bits[]) /* FIXME: Run examples, too! */ static void do_run_tests_vg(struct manifest *m, - bool keep, unsigned int *timeleft, struct score *score) { @@ -170,9 +180,6 @@ static void do_run_tests_vg(struct manifest *m, continue; } - if (keep) - talloc_set_destructor(i->valgrind_log, NULL); - output = grab_file(i, i->valgrind_log, NULL); /* No valgrind errors? */ if (!output || output[0] == '\0') { @@ -191,7 +198,6 @@ static void do_run_tests_vg(struct manifest *m, } static void do_leakcheck_vg(struct manifest *m, - bool keep, unsigned int *timeleft, struct score *score) { @@ -262,12 +268,4 @@ struct ccanlint tests_pass_valgrind = { .takes_options = true, .needs = "tests_pass" }; - -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);