X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=tools%2Fccanlint%2Ftests%2Fheaders_idempotent.c;h=4e41d058d22a60fcf4edf8550aba0586c0d7bd33;hb=932d65dd6537250e617516749f03a00fea3b34f6;hp=59d240e339f1a60477dd12814a47eb833e5db08d;hpb=3b200f895cb7884c72d9e2409f047284027abc68;p=ccan diff --git a/tools/ccanlint/tests/headers_idempotent.c b/tools/ccanlint/tests/headers_idempotent.c index 59d240e3..4e41d058 100644 --- a/tools/ccanlint/tests/headers_idempotent.c +++ b/tools/ccanlint/tests/headers_idempotent.c @@ -46,10 +46,10 @@ static void handle_idem(struct manifest *m, struct score *score) /* Main header gets CCAN_FOO_H, others CCAN_FOO_XXX_H */ if (strstarts(e->file->name, m->basename) || strlen(e->file->name) == strlen(m->basename) + 2) - name = talloc_asprintf(score, "CCAN_%s_H", m->basename); + name = talloc_asprintf(score, "CCAN_%s_H", m->modname); else name = talloc_asprintf(score, "CCAN_%s_%s", - m->basename, e->file->name); + m->modname, e->file->name); fix_name(name); q = talloc_asprintf(score, @@ -58,7 +58,7 @@ static void handle_idem(struct manifest *m, struct score *score) if (!ask(q)) continue; - tmpname = maybe_temp_file(score, ".h", false, e->file->name); + tmpname = temp_file(score, ".h", e->file->name); out = fopen(tmpname, "w"); if (!out) err(1, "Opening %s", tmpname); @@ -174,16 +174,17 @@ static void check_idem(struct ccan_file *f, struct score *score) } static void check_idempotent(struct manifest *m, - bool keep, unsigned int *timeleft, struct score *score) { struct ccan_file *f; + /* We don't fail ccanlint for this. */ + score->pass = true; + list_for_each(&m->h_files, f, list) { check_idem(f, score); } if (!score->error) { - score->pass = true; score->score = score->total; } } @@ -193,7 +194,7 @@ struct ccanlint headers_idempotent = { .name = "Module headers are #ifndef/#define wrapped", .check = check_idempotent, .handle = handle_idem, - .needs = "" + .needs = "info_exists main_header_exists" }; REGISTER_TEST(headers_idempotent);