X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fccanlint%2Ftests%2Ftests_compile.c;h=13a8f0dbaadfb92c22232a3ccf802d2cbc157e04;hp=4d8686798c0aa12040defb489cd28ebc4d7acd1b;hb=104125b2dd0a044fb3d68f9bc3b1b18c9f32ae2b;hpb=051db34fb275491d4d5dfa5bf7970e8e525766d8 diff --git a/tools/ccanlint/tests/tests_compile.c b/tools/ccanlint/tests/tests_compile.c index 4d868679..13a8f0db 100644 --- a/tools/ccanlint/tests/tests_compile.c +++ b/tools/ccanlint/tests/tests_compile.c @@ -66,10 +66,12 @@ static bool compile(const void *ctx, bool link_with_module, bool keep, char **output) { + char *f = talloc_asprintf(ctx, "%s%s", + fail ? "-DFAIL " : "", cflags); + file->compiled = maybe_temp_file(ctx, "", keep, file->fullname); if (!compile_and_link(ctx, file->fullname, ccan_dir, - obj_list(m, link_with_module), - fail ? "-DFAIL" : "", + obj_list(m, link_with_module), compiler, f, lib_list(m), file->compiled, output)) { talloc_free(file->compiled); return false; @@ -90,12 +92,14 @@ static void do_compile_tests(struct manifest *m, list_for_each(list, i, list) { if (!compile(score, m, i, false, list == &m->api_tests, keep, &cmdout)) { - score->error = "Failed to compile tests"; - score_file_error(score, i, 0, cmdout); + score_file_error(score, i, 0, + "Compile failed:\n%s", + cmdout); errors = true; } else if (!streq(cmdout, "")) { - score->error = "Test compiled with warnings"; - score_file_error(score, i, 0, cmdout); + score_file_error(score, i, 0, + "Compile gave warnings:\n%s", + cmdout); warnings = true; } } @@ -108,19 +112,22 @@ static void do_compile_tests(struct manifest *m, /* For historical reasons, "fail" often means "gives warnings" */ list_for_each(&m->compile_fail_tests, i, list) { if (!compile(score, m, i, false, false, false, &cmdout)) { - score->error = "Failed to compile without -DFAIL"; - score_file_error(score, i, 0, cmdout); + score_file_error(score, i, 0, + "Compile without -DFAIL failed:\n%s", + cmdout); return; } if (!streq(cmdout, "")) { - score->error = "Compile with warnigns without -DFAIL"; - score_file_error(score, i, 0, cmdout); + score_file_error(score, i, 0, + "Compile gave warnings" + " without -DFAIL:\n%s", + cmdout); return; } if (compile(score, m, i, true, false, false, &cmdout) && streq(cmdout, "")) { - score->error = "Compiled successfully with -DFAIL?"; - score_file_error(score, i, 0, NULL); + score_file_error(score, i, 0, + "Compiled successfully with -DFAIL?"); return; } }