X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=tools%2Fccanlint%2Fccanlint.c;h=d19ede6200e01ac2856c162f42c1c8f7c8936727;hb=b1801a00c945b67d8c218edd9e13dc483a60ac70;hp=78518721ef30726c7baf29bf80bd2e6625c472b1;hpb=a1d06d55999cc5004f4a3c2c8c17638972c6fe50;p=ccan diff --git a/tools/ccanlint/ccanlint.c b/tools/ccanlint/ccanlint.c index 78518721..d19ede62 100644 --- a/tools/ccanlint/ccanlint.c +++ b/tools/ccanlint/ccanlint.c @@ -107,7 +107,7 @@ static bool run_test(struct ccanlint *i, struct manifest *m) { void *result; - unsigned int this_score, timeleft; + unsigned int this_score, max_score, timeleft; const struct dependent *d; const char *skip; bool bad, good; @@ -143,22 +143,25 @@ static bool run_test(struct ccanlint *i, goto skip; } + max_score = i->total_score; + if (!max_score) + max_score = 1; + if (!result) - this_score = i->total_score ? i->total_score : 1; + this_score = max_score; else if (i->score) this_score = i->score(m, result); else this_score = 0; bad = (this_score == 0); - good = (this_score >= i->total_score); + good = (this_score >= max_score); - if (verbose || (bad && !quiet)) { + if (verbose || (!good && !quiet)) { printf(" %s: %s", i->name, bad ? "FAIL" : good ? "PASS" : "PARTIAL"); - if (i->total_score) - printf(" (+%u/%u)", - this_score, i->total_score); + if (max_score > 1) + printf(" (+%u/%u)", this_score, max_score); printf("\n"); } @@ -237,10 +240,10 @@ static void init_tests(void) struct btree *keys, *names; #undef REGISTER_TEST -#define REGISTER_TEST(name, ...) register_test(&normal_tests, &name, __VA_ARGS__) +#define REGISTER_TEST(name, ...) register_test(&normal_tests, &name, __VA_ARGS__, NULL) #include "generated-normal-tests" #undef REGISTER_TEST -#define REGISTER_TEST(name, ...) register_test(&compulsory_tests, &name, __VA_ARGS__) +#define REGISTER_TEST(name, ...) register_test(&compulsory_tests, &name, __VA_ARGS__, NULL) #include "generated-compulsory-tests" /* Self-consistency check: make sure no two tests