ccanlint: fix scoring, add score details to --verbose.
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 2 Feb 2010 07:18:15 +0000 (17:48 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 2 Feb 2010 07:18:15 +0000 (17:48 +1030)
tools/ccanlint/ccanlint.c
tools/ccanlint/tests/run_tests_valgrind.c

index 064e40d869d6703da46270ce16e67a95488d3895..330866d15f1f9365ba336893bb7e36382ccb55fa 100644 (file)
@@ -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));
 
index 4f32ed6c630953373ca461f193a55ddf1484896e..47d93c578efd4c69e5d6f3a667271af6c39df813 100644 (file)
@@ -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--;