X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=tools%2Fccanlint%2Fcompulsory_tests%2Fhas_info.c;h=a9a6c1c993a77c532515fe5c92eef282cccafba9;hb=2926cafb52b9d95646d9dafa877d53f2368d8b2c;hp=176b5071b87fbbaad5ce94b032fd15055aa84d4e;hpb=6c579abb882331704795349a7d3c5797bc408562;p=ccan-lca-2011.git diff --git a/tools/ccanlint/compulsory_tests/has_info.c b/tools/ccanlint/compulsory_tests/has_info.c index 176b507..a9a6c1c 100644 --- a/tools/ccanlint/compulsory_tests/has_info.c +++ b/tools/ccanlint/compulsory_tests/has_info.c @@ -12,19 +12,20 @@ #include #include -static void *check_has_info(struct manifest *m, unsigned int *timeleft) +static void check_has_info(struct manifest *m, + bool keep, + unsigned int *timeleft, + struct score *score) { - if (m->info_file) - return NULL; - return m; -} - -static const char *describe_has_info(struct manifest *m, void *check_result) -{ - return "You have no _info file.\n\n" + if (m->info_file) { + score->pass = true; + score->score = score->total; + } else { + score->error = "You have no _info file.\n\n" "The file _info contains the metadata for a ccan package: things\n" "like the dependencies, the documentation for the package as a whole\n" "and license information.\n"; + } } static const char template[] = @@ -53,7 +54,7 @@ static const char template[] = " return 1;\n" "}\n"; -static void create_info_template(struct manifest *m, void *check_result) +static void create_info_template(struct manifest *m, struct score *score) { FILE *info; const char *filename; @@ -73,12 +74,12 @@ static void create_info_template(struct manifest *m, void *check_result) fclose(info); } -struct ccanlint has_info = { - .key = "info", +struct ccanlint info_exists = { + .key = "info_exists", .name = "Module has _info file", .check = check_has_info, - .describe = describe_has_info, .handle = create_info_template, + .needs = "" }; -REGISTER_TEST(has_info, NULL); +REGISTER_TEST(info_exists);