]> git.ozlabs.org Git - ccan/blobdiff - tools/ccanlint/compulsory_tests/depends_exist.c
ccanlint: handle duplicate dependencies in _info
[ccan] / tools / ccanlint / compulsory_tests / depends_exist.c
index c283f2a4b11b7b3919c60504ef452b9daded22da..b1694058b632c18ea54d58a9b028d39768f7ea4e 100644 (file)
@@ -41,10 +41,20 @@ static void check_depends_exist(struct manifest *m,
        unsigned int i;
        char **deps;
        char *updir = talloc_strdup(m, m->dir);
+       bool needs_tap;
 
        if (strrchr(updir, '/'))
                *strrchr(updir, '/') = '\0';
 
+       /* We may need libtap for testing, unless we're "tap" */
+       if (streq(m->basename, "tap")) {
+               needs_tap = false;
+       } else if (list_empty(&m->run_tests) && list_empty(&m->api_tests)) {
+               needs_tap = false;
+       } else {
+               needs_tap = true;
+       }
+
        if (safe_mode)
                deps = get_safe_ccan_deps(m, m->dir, true);
        else
@@ -57,13 +67,14 @@ static void check_depends_exist(struct manifest *m,
 
                if (!add_dep(m, deps[i], score))
                        return;
+
+               if (streq(deps[i], "ccan/tap")) {
+                       needs_tap = false;
+               }
        }
 
-       /* We may need libtap for testing, unless we're "tap" */
-       if (!streq(m->basename, "tap")
-           && (!list_empty(&m->run_tests) || !list_empty(&m->api_tests))) {
-               if (!add_dep(m, "ccan/tap", score))
-                       return;
+       if (needs_tap && !add_dep(m, "ccan/tap", score)) {
+               return;
        }
 
        score->pass = true;