X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fccanlint%2Ftests%2Fdepends_accurate.c;h=5549fc13360de3f96735a75622b9cd871ef6fa1f;hp=08760333eafcb6c0d757fc6f5c2e234c0137633a;hb=c3a4f74f5ddedd7fed3f351498a6743d2a1d9ed1;hpb=f0308b852cda745a74f5135971ad6c0747886df1 diff --git a/tools/ccanlint/tests/depends_accurate.c b/tools/ccanlint/tests/depends_accurate.c index 08760333..5549fc13 100644 --- a/tools/ccanlint/tests/depends_accurate.c +++ b/tools/ccanlint/tests/depends_accurate.c @@ -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)) { @@ -47,7 +52,7 @@ static bool check_dep_includes(struct manifest *m, char *mod; if (!tal_strreg(f, lines[i], "^[ \t]*#[ \t]*include[ \t]*[<\"]" - "(ccan/+.+)/+[^/]+\\.h", &mod)) + "(ccan/+.+)/+[^/]+\\.[ch][\">]", &mod)) continue; if (has_dep(m, deps, used, mod)) @@ -137,7 +142,7 @@ struct ccanlint depends_accurate = { .key = "depends_accurate", .name = "Module's CCAN dependencies are the only CCAN files #included", .check = check_depends_accurate, - .needs = "depends_exist test_depends_exist headers_idempotent" + .needs = "depends_exist info_compiles test_depends_exist headers_idempotent" }; REGISTER_TEST(depends_accurate);