]> git.ozlabs.org Git - ccan/blobdiff - tools/ccanlint/tests/depends_build.c
ccanlint: add testdepends support.
[ccan] / tools / ccanlint / tests / depends_build.c
index e6300a19502559fc3a69effa3e6b6218cae75c2b..b578d4b597b7f5b62d98dc5d6d5218b6be89a85b 100644 (file)
@@ -1,6 +1,7 @@
 #include <tools/ccanlint/ccanlint.h>
 #include <tools/tools.h>
 #include <ccan/talloc/talloc.h>
+#include <ccan/foreach/foreach.h>
 #include <ccan/str/str.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -79,17 +80,24 @@ char *build_submodule(struct manifest *m, const char *flags,
 static void check_depends_built(struct manifest *m,
                                unsigned int *timeleft, struct score *score)
 {
-       struct manifest *i;
-
-       list_for_each(&m->deps, i, list) {
-               char *errstr = build_submodule(i, cflags, COMPILE_NORMAL);
-
-               if (errstr) {
-                       score->error = talloc_asprintf(score,
-                                                      "Dependency %s"
-                                                      " did not build:\n%s",
-                                                      i->basename, errstr);
-                       return;
+       struct list_head *list;
+
+       foreach_ptr(list, &m->deps, &m->test_deps) {
+               struct manifest *i;
+               list_for_each(list, i, list) {
+                       char *errstr;
+
+                       errstr = build_submodule(i, cflags, COMPILE_NORMAL);
+
+                       if (errstr) {
+                               score->error = talloc_asprintf(score,
+                                                              "Dependency %s"
+                                                              " did not"
+                                                              " build:\n%s",
+                                                              i->basename,
+                                                              errstr);
+                               return;
+                       }
                }
        }
 
@@ -102,7 +110,7 @@ struct ccanlint depends_build = {
        .name = "Module's CCAN dependencies can be found or built",
        .check = check_depends_built,
        .can_run = can_build,
-       .needs = "depends_exist"
+       .needs = "depends_exist test_depends_exist"
 };
 
 REGISTER_TEST(depends_build);