X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fccanlint%2Fccanlint.c;h=81f9614739b2242410bb7524634101ddb1e191da;hp=291a151842e0ce0d1126ae8ce6250ad68dc8dc48;hb=aa6b7489835d9bca43049ab6dc7f79d460539345;hpb=caf366998b97b7cc29bc1f33c285feb2f5d33bff diff --git a/tools/ccanlint/ccanlint.c b/tools/ccanlint/ccanlint.c index 291a1518..81f96147 100644 --- a/tools/ccanlint/ccanlint.c +++ b/tools/ccanlint/ccanlint.c @@ -161,9 +161,9 @@ static bool run_test(struct ccanlint *i, printf("%s%s", score->error, strends(score->error, "\n") ? "" : "\n"); } - if (!quiet && !score->pass && i->handle) - i->handle(m, score); } + if (!quiet && score->score < score->total && i->handle) + i->handle(m, score); *running_score += score->score; *running_total += score->total; @@ -285,19 +285,24 @@ static void init_tests(void) } btree_delete(keys); btree_delete(names); +} - if (!verbose) - return; +static void print_test_depends(void) +{ + struct list_head *list; foreach_ptr(list, &compulsory_tests, &normal_tests) { + struct ccanlint *c; printf("\%s Tests\n", list == &compulsory_tests ? "Compulsory" : "Normal"); - if (!list_empty(&c->dependencies)) { - const struct dependent *d; - printf("These depend on us:\n"); - list_for_each(&c->dependencies, d, node) - printf("\t%s\n", d->dependent->name); + list_for_each(list, c, list) { + if (!list_empty(&c->dependencies)) { + const struct dependent *d; + printf("These depend on %s:\n", c->key); + list_for_each(&c->dependencies, d, node) + printf("\t%s\n", d->dependent->key); + } } } } @@ -584,7 +589,7 @@ static char *opt_set_const_charp(const char *arg, const char **p) int main(int argc, char *argv[]) { - bool summary = false; + bool summary = false, pass = true; unsigned int score = 0, total_score = 0; struct manifest *m; struct ccanlint *i; @@ -640,8 +645,10 @@ int main(int argc, char *argv[]) dir[strlen(dir)-1] = '\0'; if (dir != base_dir) prefix = talloc_append_string(talloc_basename(NULL, dir), ": "); - if (verbose >= 3) + if (verbose >= 3) { compile_verbose = true; + print_test_depends(); + } if (verbose >= 4) tools_verbose = true; @@ -675,8 +682,8 @@ int main(int argc, char *argv[]) add_info_options(m->info_file, !target); while ((i = get_next_test(&normal_tests)) != NULL) - run_test(i, summary, &score, &total_score, m); + pass &= run_test(i, summary, &score, &total_score, m); printf("%sTotal score: %u/%u\n", prefix, score, total_score); - return 0; + return pass ? 0 : 1; }