1 #include <tools/ccanlint/ccanlint.h>
2 #include <tools/tools.h>
3 #include <ccan/talloc/talloc.h>
4 #include <ccan/str/str.h>
17 static const char *can_build(struct manifest *m)
20 return "Safe mode enabled";
24 /* FIXME: recursive ccanlint if they ask for it. */
25 static bool expect_obj_file(const char *dir)
27 struct manifest *dep_man;
30 dep_man = get_manifest(dir, dir);
32 /* If it has C files, we expect an object file built from them. */
33 has_c_files = !list_empty(&dep_man->c_files);
38 static void *check_depends_built(struct manifest *m,
40 unsigned int *timeleft)
46 list_for_each(&m->dep_dirs, i, list) {
47 if (!expect_obj_file(i->fullname))
50 i->compiled = talloc_asprintf(i, "%s.o", i->fullname);
51 if (stat(i->compiled, &st) != 0) {
52 report = talloc_asprintf_append(report,
59 /* We may need libtap for testing, unless we're "tap" */
60 if (!streq(m->basename, "tap")
61 && (!list_empty(&m->run_tests) || !list_empty(&m->api_tests))) {
62 char *tapobj = talloc_asprintf(m, "%s/ccan/tap.o", ccan_dir);
63 if (stat(tapobj, &st) != 0) {
64 report = talloc_asprintf_append(report,
71 return talloc_steal(m, report);
74 static const char *describe_depends_built(struct manifest *m,
77 return talloc_asprintf(check_result,
78 "The following dependencies are not built:\n"
79 "%s", (char *)check_result);
82 struct ccanlint depends_built = {
83 .key = "depends-built",
84 .name = "Module's CCAN dependencies are already built",
86 .check = check_depends_built,
87 .describe = describe_depends_built,
91 REGISTER_TEST(depends_built, &depends_exist, NULL);