X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fccanlint%2Ftests%2Ftests_compile_coverage.c;h=4e35609913b7374d86847cf7fac01cc29bbc73f7;hp=f41edc0bc6f36588a334a07c923707bbc10421d5;hb=271676fecdb2fb079374b9e3fe03e5c53e7f0f23;hpb=7bb7cd58c2d9df126dd6072e5f3bec1eb4dc916b diff --git a/tools/ccanlint/tests/tests_compile_coverage.c b/tools/ccanlint/tests/tests_compile_coverage.c index f41edc0b..4e356099 100644 --- a/tools/ccanlint/tests/tests_compile_coverage.c +++ b/tools/ccanlint/tests/tests_compile_coverage.c @@ -38,9 +38,9 @@ static bool build_module_objs_with_coverage(struct manifest *m, bool keep, char *fullfile = talloc_asprintf(m, "%s/%s", m->dir, i->name); i->cov_compiled = maybe_temp_file(m, "", keep, fullfile); - if (!compile_object(m, fullfile, ccan_dir, "", + if (!compile_object(m, fullfile, ccan_dir, compiler, cflags, i->cov_compiled, &err)) { - score_file_error(score, i, 0, err); + score_file_error(score, i, 0, "%s", err); talloc_free(i->cov_compiled); i->cov_compiled = NULL; return false; @@ -93,11 +93,12 @@ static char *cov_compile(const void *ctx, bool keep) { char *output; + char *f = talloc_asprintf(ctx, "%s %s", cflags, COVERAGE_CFLAGS); file->cov_compiled = maybe_temp_file(ctx, "", keep, file->fullname); if (!compile_and_link(ctx, file->fullname, ccan_dir, obj_list(m, modobjs), - COVERAGE_CFLAGS, + compiler, f, lib_list(m), file->cov_compiled, &output)) { talloc_free(file->cov_compiled); file->cov_compiled = NULL; @@ -126,7 +127,10 @@ static void do_compile_coverage_tests(struct manifest *m, foreach_ptr(h, &m->run_tests, &m->api_tests) { list_for_each(h, i, list) { - cmdout = cov_compile(m, m, i, NULL, keep); + cmdout = cov_compile(m, m, i, + h == &m->api_tests + ? modobjs : NULL, + keep); if (cmdout) { score_file_error(score, i, 0, "Failed to compile test with coverage: %s",