]> git.ozlabs.org Git - ccan/commitdiff
ccanlint: Alter meaning of --summary option
authorDavid Gibson <david@gibson.dropbear.id.au>
Wed, 2 Nov 2016 22:34:23 +0000 (09:34 +1100)
committerDavid Gibson <david@gibson.dropbear.id.au>
Mon, 7 Nov 2016 07:54:08 +0000 (18:54 +1100)
--summary (used by make check) causes ccanlint to only ever print a
one-line summary of the results.  When one of the tests fails, this isn't
very useful, because it doesn't say why it failed, or even which test
failed.  This is particularly frustrating for failures in Travis CI builds
where it's not always straightforward to reproduce a similar enough build
environment to check the failure manually for a particular module.

--summary does have one purpose which is vital for make check, though: it
suppresses any attempt to interactively correct / improve the module
printing only results.

This changes --summary to only have the second effect, not the first.  This
won't change the output in the case of passing modules, but will give more
useful information in the case of failing modules.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
tools/ccanlint/ccanlint.c

index 629ffd515485b9d02766e0478ad6aa88a9bbe9e7..0ed969cb868ef8fc5f7f38f61465653244bfc1ed 100644 (file)
@@ -98,7 +98,7 @@ static bool cannot_run(struct dgraph_node *node, void *all UNNEEDED)
 }
 
 struct run_info {
 }
 
 struct run_info {
-       bool quiet;
+       bool noninteractive;
        unsigned int score, total;
        struct manifest *m;
        const char *prefix;
        unsigned int score, total;
        struct manifest *m;
        const char *prefix;
@@ -165,7 +165,7 @@ static bool run_test(struct dgraph_node *n, struct run_info *run)
        }
 
        assert(score->score <= score->total);
        }
 
        assert(score->score <= score->total);
-       if ((!score->pass && !run->quiet)
+       if (!score->pass
            || (score->score < score->total && verbose)
            || verbose > 1) {
                printf("%s%s (%s): %s",
            || (score->score < score->total && verbose)
            || verbose > 1) {
                printf("%s%s (%s): %s",
@@ -176,13 +176,13 @@ static bool run_test(struct dgraph_node *n, struct run_info *run)
                printf("\n");
        }
 
                printf("\n");
        }
 
-       if ((!run->quiet && !score->pass) || verbose) {
+       if (!score->pass || verbose) {
                if (score->error) {
                        printf("%s%s", score->error,
                               strends(score->error, "\n") ? "" : "\n");
                }
        }
                if (score->error) {
                        printf("%s%s", score->error,
                               strends(score->error, "\n") ? "" : "\n");
                }
        }
-       if (!run->quiet && score->score < score->total && i->handle)
+       if (!run->noninteractive && score->score < score->total && i->handle)
                i->handle(run->m, score);
 
        if (!score->pass) {
                i->handle(run->m, score);
 
        if (!score->pass) {
@@ -567,7 +567,7 @@ static bool run_tests(struct dgraph_node *all,
        struct run_info run;
        const char *comment = "";
 
        struct run_info run;
        const char *comment = "";
 
-       run.quiet = summary;
+       run.noninteractive = summary;
        run.m = m;
        run.prefix = prefix;
        run.score = run.total = 0;
        run.m = m;
        run.prefix = prefix;
        run.score = run.total = 0;
@@ -638,7 +638,7 @@ int main(int argc, char *argv[])
        opt_register_noarg("-k|--keep", keep_tests, NULL,
                         "do not delete ccanlint working files");
        opt_register_noarg("--summary|-s", opt_set_bool, &summary,
        opt_register_noarg("-k|--keep", keep_tests, NULL,
                         "do not delete ccanlint working files");
        opt_register_noarg("--summary|-s", opt_set_bool, &summary,
-                          "simply give one line summary");
+                          "give results only, no interactive correction");
        opt_register_arg("-x|--exclude <testname>", exclude_test, NULL, NULL,
                         "exclude <testname> (can be used multiple times)");
        opt_register_arg("--timeout <milleseconds>", opt_set_uintval,
        opt_register_arg("-x|--exclude <testname>", exclude_test, NULL, NULL,
                         "exclude <testname> (can be used multiple times)");
        opt_register_arg("--timeout <milleseconds>", opt_set_uintval,