X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fccanlint%2Fcompulsory_tests%2Fbuild_objs.c;h=77f0a70cd832da52fb47921c2b70acce4c79b00d;hp=0768bc6fb70ec685b93e07430e076e582b6648b2;hb=03a596908b779bbb4b7c2f739c5e238f8c5d6390;hpb=f952b88b36e3803370825fb43385f1a42aa24b64 diff --git a/tools/ccanlint/compulsory_tests/build_objs.c b/tools/ccanlint/compulsory_tests/build_objs.c index 0768bc6f..77f0a70c 100644 --- a/tools/ccanlint/compulsory_tests/build_objs.c +++ b/tools/ccanlint/compulsory_tests/build_objs.c @@ -21,39 +21,38 @@ static const char *can_build(struct manifest *m) return NULL; } -static void *check_objs_build(struct manifest *m) +static void check_objs_build(struct manifest *m, + bool keep, + unsigned int *timeleft, struct score *score) { - char *report = NULL; struct ccan_file *i; + if (list_empty(&m->c_files)) + score->total = 0; + list_for_each(&m->c_files, i, list) { - char *err; + char *output; char *fullfile = talloc_asprintf(m, "%s/%s", m->dir, i->name); - /* One point for each obj file. */ - build_objs.total_score++; - - i->compiled = compile_object(m, fullfile, ccan_dir, &err); - if (!i->compiled) { - if (report) - report = talloc_append_string(report, err); - else - report = err; + i->compiled = maybe_temp_file(m, "", keep, fullfile); + if (!compile_object(m, fullfile, ccan_dir, "", i->compiled, + &output)) { + talloc_free(i->compiled); + score->error = "Compiling object files"; + score_file_error(score, i, 0, output); } + talloc_free(output); + } + if (!score->error) { + score->pass = true; + score->score = score->total; } - return report; -} - -static const char *describe_objs_build(struct manifest *m, void *check_result) -{ - return check_result; } struct ccanlint build_objs = { - .key = "build-objs", + .key = "build-objects", .name = "Module object files can be built", .check = check_objs_build, - .describe = describe_objs_build, .can_run = can_build, };