From: Rusty Russell Date: Tue, 2 Feb 2010 07:18:15 +0000 (+1030) Subject: ccanlint: fix scoring, add score details to --verbose. X-Git-Url: http://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=39323f37b0209c24f5be4b4c7f119d6019912541 ccanlint: fix scoring, add score details to --verbose. --- diff --git a/tools/ccanlint/ccanlint.c b/tools/ccanlint/ccanlint.c index 064e40d8..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)); diff --git a/tools/ccanlint/tests/run_tests_valgrind.c b/tools/ccanlint/tests/run_tests_valgrind.c index 4f32ed6c..47d93c57 100644 --- a/tools/ccanlint/tests/run_tests_valgrind.c +++ b/tools/ccanlint/tests/run_tests_valgrind.c @@ -49,7 +49,7 @@ static void *do_run_tests_vg(struct manifest *m) list_head_init(list); list_for_each(&m->run_tests, i, list) { - run_tests.total_score++; + run_tests_vg.total_score++; /* FIXME: timeout here */ cmdout = run_command(m, "valgrind -q %s", i->compiled); if (cmdout) { @@ -61,7 +61,7 @@ static void *do_run_tests_vg(struct manifest *m) } list_for_each(&m->api_tests, i, list) { - run_tests.total_score++; + run_tests_vg.total_score++; /* FIXME: timeout here */ cmdout = run_command(m, "valgrind -q %s", i->compiled); if (cmdout) { @@ -87,7 +87,7 @@ static unsigned int score_run_tests_vg(struct manifest *m, void *check_result) { struct list_head *list = check_result; struct run_tests_result *i; - unsigned int score = run_tests.total_score; + unsigned int score = run_tests_vg.total_score; list_for_each(list, i, list) score--;