]> git.ozlabs.org Git - ccan/blobdiff - tools/ccanlint/ccanlint.c
ccanlint: make sure we stop on failure of compulsory test.
[ccan] / tools / ccanlint / ccanlint.c
index 17c9f45957ced713dc39b2e36f75cbcb04903865..00d5363ec9997a3d0d46fa881201e71c17a56542 100644 (file)
@@ -150,7 +150,7 @@ static bool run_test(struct ccanlint *i,
        else
                this_score = 0;
 
-       bad = (this_score == 0);
+       bad = (this_score == 0 && i->total_score != 0);
        good = (this_score >= i->total_score);
 
        if (verbose || (bad && !quiet)) {
@@ -185,7 +185,7 @@ static bool run_test(struct ccanlint *i,
                        d->dependent->skip_fail = true;
                }
        }
-       return good;
+       return !bad;
 }
 
 static void register_test(struct list_head *h, struct ccanlint *test, ...)
@@ -237,10 +237,10 @@ static void init_tests(void)
        struct btree *keys, *names;
 
 #undef REGISTER_TEST
-#define REGISTER_TEST(name, ...) register_test(&normal_tests, &name, __VA_ARGS__)
+#define REGISTER_TEST(name, ...) register_test(&normal_tests, &name, __VA_ARGS__, NULL)
 #include "generated-normal-tests"
 #undef REGISTER_TEST
-#define REGISTER_TEST(name, ...) register_test(&compulsory_tests, &name, __VA_ARGS__)
+#define REGISTER_TEST(name, ...) register_test(&compulsory_tests, &name, __VA_ARGS__, NULL)
 #include "generated-compulsory-tests"
 
        /* Self-consistency check: make sure no two tests
@@ -413,6 +413,8 @@ int main(int argc, char *argv[])
        if (optind < argc)
                usage(argv[0]);
 
+       if (verbose >= 2)
+               compile_verbose = true;
        if (verbose >= 3)
                tools_verbose = true;