]> git.ozlabs.org Git - ccan/blobdiff - tools/ccanlint/tests/depends_build_without_features.c
tools: don't assume modules are immediately below ccan/ dir.
[ccan] / tools / ccanlint / tests / depends_build_without_features.c
index cf7185be0d80fc2f79aa5cf776663e0b7639eca9..b75ebefd5e18f0f831739a4589ae0680820fc028 100644 (file)
@@ -2,6 +2,7 @@
 #include <tools/tools.h>
 #include <ccan/talloc/talloc.h>
 #include <ccan/str/str.h>
+#include <ccan/foreach/foreach.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -14,7 +15,7 @@
 #include <string.h>
 #include <ctype.h>
 #include "reduce_features.h"
-#include "../compulsory_tests/build.h"
+#include "build.h"
 
 static const char *can_build(struct manifest *m)
 {
@@ -24,25 +25,30 @@ static const char *can_build(struct manifest *m)
 }
 
 static void check_depends_built_without_features(struct manifest *m,
-                                                bool keep,
                                                 unsigned int *timeleft,
                                                 struct score *score)
 {
+       struct list_head *list;
        struct manifest *i;
        char *flags;
 
        flags = talloc_asprintf(score, "%s %s", cflags,
                                REDUCE_FEATURES_FLAGS);
 
-       list_for_each(&m->deps, i, list) {
-               char *errstr = build_submodule(i, flags, COMPILE_NOFEAT);
+       foreach_ptr(list, &m->deps, &m->test_deps) {
+               list_for_each(list, i, list) {
+                       char *errstr = build_submodule(i, flags,
+                                                      COMPILE_NOFEAT);
 
-               if (errstr) {
-                       score->error = talloc_asprintf(score,
-                                                      "Dependency %s"
-                                                      " did not build:\n%s",
-                                                      i->basename, errstr);
-                       return;
+                       if (errstr) {
+                               score->error = talloc_asprintf(score,
+                                                              "Dependency %s"
+                                                              " did not"
+                                                              " build:\n%s",
+                                                              i->modname,
+                                                              errstr);
+                               return;
+                       }
                }
        }
 
@@ -55,7 +61,7 @@ struct ccanlint depends_build_without_features = {
        .name = "Module's CCAN dependencies can be found or built (reduced features)",
        .check = check_depends_built_without_features,
        .can_run = can_build,
-       .needs = "depends_exist"
+       .needs = "depends_build reduce_features"
 };
 
 REGISTER_TEST(depends_build_without_features);