X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=tools%2Fccanlint%2Fcompulsory_tests%2Fbuild_objs.c;h=13d34a14e041fb90b2fcbba7df020c06805aec31;hb=2926cafb52b9d95646d9dafa877d53f2368d8b2c;hp=aa8e7b36a5ebce098d9967d359eb86147395cf8e;hpb=7a163ea2dcafc056fdafc8c71ef011e2bfdbeb65;p=ccan-lca-2011.git diff --git a/tools/ccanlint/compulsory_tests/build_objs.c b/tools/ccanlint/compulsory_tests/build_objs.c index aa8e7b3..13d34a1 100644 --- a/tools/ccanlint/compulsory_tests/build_objs.c +++ b/tools/ccanlint/compulsory_tests/build_objs.c @@ -26,33 +26,43 @@ static void check_objs_build(struct manifest *m, unsigned int *timeleft, struct score *score) { struct ccan_file *i; + bool errors = false, warnings = false; if (list_empty(&m->c_files)) score->total = 0; + else + score->total = 2; list_for_each(&m->c_files, i, list) { - char *err; + char *output; char *fullfile = talloc_asprintf(m, "%s/%s", m->dir, i->name); i->compiled = maybe_temp_file(m, "", keep, fullfile); - err = compile_object(m, fullfile, ccan_dir, "", i->compiled); - if (err) { + if (!compile_object(score, fullfile, ccan_dir, "", i->compiled, + &output)) { talloc_free(i->compiled); score->error = "Compiling object files"; - score_file_error(score, i, 0, err); + score_file_error(score, i, 0, output); + errors = true; + } else if (!streq(output, "")) { + score->error = "Compiling object files gave warnings"; + score_file_error(score, i, 0, output); + warnings = true; } } - if (!score->error) { + + if (!errors) { score->pass = true; - score->score = score->total; + score->score = score->total - warnings; } } -struct ccanlint build_objs = { - .key = "build-objects", +struct ccanlint objects_build = { + .key = "objects_build", .name = "Module object files can be built", .check = check_objs_build, .can_run = can_build, + .needs = "depends_exist" }; -REGISTER_TEST(build_objs, &depends_exist, NULL); +REGISTER_TEST(objects_build);