X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fccanlint%2Ftests%2Ftests_compile_coverage.c;h=f41edc0bc6f36588a334a07c923707bbc10421d5;hp=115ae94a15e50a7f4050f2b307e5bdb18295b944;hb=7bb7cd58c2d9df126dd6072e5f3bec1eb4dc916b;hpb=051db34fb275491d4d5dfa5bf7970e8e525766d8 diff --git a/tools/ccanlint/tests/tests_compile_coverage.c b/tools/ccanlint/tests/tests_compile_coverage.c index 115ae94a..f41edc0b 100644 --- a/tools/ccanlint/tests/tests_compile_coverage.c +++ b/tools/ccanlint/tests/tests_compile_coverage.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -114,26 +115,23 @@ static void do_compile_coverage_tests(struct manifest *m, { char *cmdout, *modobjs = NULL; struct ccan_file *i; + struct list_head *h; if (!list_empty(&m->api_tests) && !build_module_objs_with_coverage(m, keep, score, &modobjs)) { - score->error = "Failed to compile module objects with coverage"; + score->error = talloc_strdup(score, + "Failed to compile module objects with coverage"); return; } - list_for_each(&m->run_tests, i, list) { - cmdout = cov_compile(m, m, i, NULL, keep); - if (cmdout) { - score->error = "Failed to compile test with coverage"; - score_file_error(score, i, 0, cmdout); - } - } - - list_for_each(&m->api_tests, i, list) { - cmdout = cov_compile(m, m, i, modobjs, keep); - if (cmdout) { - score->error = "Failed to compile test with coverage"; - score_file_error(score, i, 0, cmdout); + foreach_ptr(h, &m->run_tests, &m->api_tests) { + list_for_each(h, i, list) { + cmdout = cov_compile(m, m, i, NULL, keep); + if (cmdout) { + score_file_error(score, i, 0, + "Failed to compile test with coverage: %s", + cmdout); + } } } if (!score->error) {