ccanlint: handle circular test-depends.
authorRusty Russell <rusty@rustcorp.com.au>
Thu, 18 Jun 2015 03:30:01 +0000 (13:00 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Thu, 18 Jun 2015 03:32:09 +0000 (13:02 +0930)
eg. asort depends on order, but order testdepends on asort.

Probably not the greatest thing to do, but don't barf because of it.

Reported-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
tools/ccanlint/tests/depends_exist.c

index 09c187e98f54ccefb01c6072be479fce72784d93..f4d1e964634c8210cbf8fb6893ef5f4a4b2403ef 100644 (file)
@@ -103,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;