]> git.ozlabs.org Git - ccan/commitdiff
ccanlint: depends_accurate: don't detect false dependency when including test files.
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 30 Aug 2016 12:28:13 +0000 (21:58 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 30 Aug 2016 12:28:13 +0000 (21:58 +0930)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
tools/ccanlint/tests/depends_accurate.c

index 9ade3cba071b2b96f2c000b7f9a03e56a8f414f6..5549fc13360de3f96735a75622b9cd871ef6fa1f 100644 (file)
@@ -21,8 +21,13 @@ static bool has_dep(struct manifest *m, char **deps, bool *used,
        unsigned int i;
 
        /* We can include ourselves, of course. */
-       if (streq(depname + strlen("ccan/"), m->modname))
-               return true;
+       if (strstarts(depname + strlen("ccan/"), m->modname)) {
+               const char *p = depname + strlen("ccan/") + strlen(m->modname);
+               /* And our own tests! */
+               if (streq(p, "/test") || streq(p, ""))
+                       return true;
+               /* But not any submodules; they need an explicit dep */
+       }
 
        for (i = 0; deps[i]; i++) {
                if (streq(deps[i], depname)) {