X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fccanlint%2Fccanlint.c;h=ee8c8b78634aab7e5eb3dfb9fb5374b07014e88d;hp=85f68a3d21a540c939dbe250831cbe717cef7a22;hb=218c9c2322fb2e8aaac2e5c400cb5a0aa2b7f1e3;hpb=f952b88b36e3803370825fb43385f1a42aa24b64 diff --git a/tools/ccanlint/ccanlint.c b/tools/ccanlint/ccanlint.c index 85f68a3d..ee8c8b78 100644 --- a/tools/ccanlint/ccanlint.c +++ b/tools/ccanlint/ccanlint.c @@ -275,34 +275,26 @@ static void init_tests(void) } } -static void print_test(const struct ccanlint *i) +static void print_tests(struct list_head *tests, const char *type) { - int space = 25 - strlen(i->key); - - if (space >= 2) { - printf(" %s", i->key); - while (space--) - putchar(' '); - } else { - printf(" %s ", i->key); + struct ccanlint *i; + + printf("%s tests:\n", type); + /* This makes them print in topological order. */ + while ((i = get_next_test(tests)) != NULL) { + const struct dependent *d; + printf(" %-25s %s\n", i->key, i->name); + list_del(&i->list); + list_for_each(&i->dependencies, d, node) + d->dependent->num_depends--; } - - printf("%s\n", i->name); } static void list_tests(void) { - const struct ccanlint *i; - init_tests(); - - printf("Compulsory tests:\n"); - list_for_each(&compulsory_tests, i, list) - print_test(i); - printf("Normal tests:\n"); - list_for_each(&normal_tests, i, list) - print_test(i); - + print_tests(&compulsory_tests, "Compulsory"); + print_tests(&normal_tests, "Normal"); exit(0); }