From c3a4f74f5ddedd7fed3f351498a6743d2a1d9ed1 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 30 Aug 2016 21:58:13 +0930 Subject: [PATCH] ccanlint: depends_accurate: don't detect false dependency when including test files. Signed-off-by: Rusty Russell --- tools/ccanlint/tests/depends_accurate.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/ccanlint/tests/depends_accurate.c b/tools/ccanlint/tests/depends_accurate.c index 9ade3cba..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)) { -- 2.39.2