]> git.ozlabs.org Git - ccan/blobdiff - tools/ccanlint/tests/depends_exist.c
tools/ccanlint: make sure _info compiles.
[ccan] / tools / ccanlint / tests / depends_exist.c
index 39015fd58730d9184edc0a295ab127a34005530c..088b1e0cd6472a702bd974c1051b7770eb1b0597 100644 (file)
@@ -57,9 +57,16 @@ static void check_depends_exist(struct manifest *m,
                deps = get_deps(m, m->dir, "depends", true,
                                get_or_compile_info);
 
+       if (!deps) {
+               score->error = tal_fmt(m, "Could not extract dependencies");
+               return;
+       }
+
        for (i = 0; deps[i]; i++) {
-               if (!strstarts(deps[i], "ccan/"))
+               if (!strstarts(deps[i], "ccan/")) {
+                       non_ccan_deps = true;
                        continue;
+               }
 
                if (!add_dep(m, &m->deps, deps[i], score))
                        return;
@@ -96,8 +103,11 @@ static void check_test_depends_exist(struct manifest *m,
                if (!strstarts(deps[i], "ccan/"))
                        continue;
 
-               /* Don't add dependency twice: we can only be on one list! */
+               /* Don't add dependency twice: we can only be on one list!
+                * Also, it's possible to have circular test depends, so drop
+                * self-refs. */
                if (!have_dep(m, deps[i])
+                   && !streq(deps[i] + strlen("ccan/"), m->modname)
                    && !add_dep(m, &m->test_deps, deps[i], score))
                        return;
 
@@ -120,7 +130,7 @@ struct ccanlint depends_exist = {
        .name = "Module's CCAN dependencies can be found",
        .compulsory = true,
        .check = check_depends_exist,
-       .needs = "info_exists"
+       .needs = "info_compiles"
 };
 
 REGISTER_TEST(depends_exist);