From 3460418c419dfcc84316ad65497b0a00950480b9 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 8 Sep 2009 21:21:18 +0930 Subject: [PATCH] Don't run dependent tests if one fails. --- tools/ccanlint/ccanlint.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/tools/ccanlint/ccanlint.c b/tools/ccanlint/ccanlint.c index 9b252735..f88b58dc 100644 --- a/tools/ccanlint/ccanlint.c +++ b/tools/ccanlint/ccanlint.c @@ -100,6 +100,9 @@ static bool run_test(struct ccanlint *i, else this_score = 0; + list_del(&i->list); + list_add_tail(&finished_tests, &i->list); + *score += this_score; if (summary) { printf("%s FAILED (%u/%u)\n", @@ -107,17 +110,22 @@ static bool run_test(struct ccanlint *i, if (verbose) indent_print(i->describe(m, result)); - list_del(&i->list); - list_add_tail(&finished_tests, &i->list); - return false; + } else { + printf("%s\n", i->describe(m, result)); + + if (i->handle) + i->handle(m, result); } - printf("%s\n", i->describe(m, result)); + /* Skip any tests which depend on this one. */ + list_for_each(&i->dependencies, d, node) { + list_del(&d->dependent->list); + list_add(&finished_tests, &d->dependent->list); + if (verbose) + printf(" -> skipping %s\n", d->dependent->name); + *total_score += d->dependent->total_score; + } - if (i->handle) - i->handle(m, result); - list_del(&i->list); - list_add_tail(&finished_tests, &i->list); return false; } -- 2.39.2