X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=tools%2Fccanlint%2Fccanlint.c;h=330866d15f1f9365ba336893bb7e36382ccb55fa;hb=729fc5b931c8eb26f192399d8aa7064f9af058df;hp=4590ba8c34de081fdd909d381c4a3d2d0b106548;hpb=655f0a840a92b10960ee942884548a4ef8f397d6;p=ccan diff --git a/tools/ccanlint/ccanlint.c b/tools/ccanlint/ccanlint.c index 4590ba8c..330866d1 100644 --- a/tools/ccanlint/ccanlint.c +++ b/tools/ccanlint/ccanlint.c @@ -119,8 +119,13 @@ static bool run_test(struct ccanlint *i, result = i->check(m); if (!result) { - if (verbose) - printf(" %s: OK\n", i->name); + if (verbose) { + printf(" %s: OK", i->name); + if (i->total_score) + printf(" (+%u/%u)", + i->total_score, i->total_score); + printf("\n"); + } if (i->total_score) { *score += i->total_score; *total_score += i->total_score; @@ -141,6 +146,10 @@ static bool run_test(struct ccanlint *i, *total_score += i->total_score; *score += this_score; + if (verbose) { + printf(" %s: FAIL (+%u/%u)\n", + i->name, this_score, i->total_score); + } if (!quiet) { printf("%s\n", i->describe(m, result)); @@ -241,21 +250,20 @@ int main(int argc, char *argv[]) { int c; bool summary = false; - unsigned int score, total_score; + unsigned int score = 0, total_score = 0; struct manifest *m; struct ccanlint *i; - const char *prefix = ""; + const char *prefix = "", *dir = "."; /* I'd love to use long options, but that's not standard. */ /* FIXME: getopt_long ccan package? */ while ((c = getopt(argc, argv, "sd:vn")) != -1) { switch (c) { case 'd': + dir = optarg; prefix = talloc_append_string(talloc_basename(NULL, optarg), ": "); - if (chdir(optarg) != 0) - err(1, "Changing into directory '%s'", optarg); break; case 's': summary = true; @@ -274,7 +282,7 @@ int main(int argc, char *argv[]) if (optind < argc) usage(argv[0]); - m = get_manifest(talloc_autofree_context()); + m = get_manifest(talloc_autofree_context(), dir); init_tests(); @@ -290,7 +298,6 @@ int main(int argc, char *argv[]) if (verbose) printf("\nNormal tests:\n"); - score = total_score = 0; while ((i = get_next_test(&normal_tests)) != NULL) run_test(i, summary, &score, &total_score, m);