X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fccanlint%2Fcompulsory_tests%2Fcheck_depends_built.c;h=a3e42f267e1bb076d5a889d6870501d9ba41ad53;hp=1392be910a3400c04d83744843c109023f1f3e96;hb=357700fd05c2cf25563a0058fd68f2ffea827e74;hpb=5f44c8ca0eb66503db51e0df1b65ff173eb42f57 diff --git a/tools/ccanlint/compulsory_tests/check_depends_built.c b/tools/ccanlint/compulsory_tests/check_depends_built.c index 1392be91..a3e42f26 100644 --- a/tools/ccanlint/compulsory_tests/check_depends_built.c +++ b/tools/ccanlint/compulsory_tests/check_depends_built.c @@ -24,22 +24,10 @@ static const char *can_build(struct manifest *m) /* FIXME: recursive ccanlint if they ask for it. */ static bool expect_obj_file(const char *dir) { - char *olddir; struct manifest *dep_man; bool has_c_files; - olddir = talloc_getcwd(dir); - if (!olddir) - err(1, "Getting current directory"); - - /* We will fail below if this doesn't exist. */ - if (chdir(dir) != 0) - return false; - - dep_man = get_manifest(dir); - if (chdir(olddir) != 0) - err(1, "Returning to original directory '%s'", olddir); - talloc_free(olddir); + dep_man = get_manifest(dir, dir); /* If it has C files, we expect an object file built from them. */ has_c_files = !list_empty(&dep_man->c_files); @@ -56,16 +44,16 @@ static void *check_depends_built(struct manifest *m) list_for_each(&m->dep_dirs, i, list) { char *objfile; - if (!expect_obj_file(i->name)) + if (!expect_obj_file(i->fullname)) continue; - objfile = talloc_asprintf(m, "%s.o", i->name); + objfile = talloc_asprintf(m, "%s.o", i->fullname); if (stat(objfile, &st) != 0) { report = talloc_asprintf_append(report, "object file %s\n", objfile); } else { - struct ccan_file *f = new_ccan_file(m, objfile); + struct ccan_file *f = new_ccan_file(m, "", objfile); list_add_tail(&m->dep_objs, &f->list); } @@ -74,10 +62,12 @@ static void *check_depends_built(struct manifest *m) /* We may need libtap for testing, unless we're "tap" */ if (!streq(m->basename, "tap") && (!list_empty(&m->run_tests) || !list_empty(&m->api_tests))) { - if (stat("../tap.o", &st) != 0) { + char *tapobj = talloc_asprintf(m, "%s/ccan/tap.o", ccan_dir); + if (stat(tapobj, &st) != 0) { report = talloc_asprintf_append(report, - "object file ../tap.o" - " (for tests)\n"); + "object file %s" + " (for tests)\n", + tapobj); } } @@ -93,7 +83,8 @@ static const char *describe_depends_built(struct manifest *m, } struct ccanlint depends_built = { - .name = "CCAN dependencies are built", + .key = "depends-built", + .name = "Module's CCAN dependencies are already built", .total_score = 1, .check = check_depends_built, .describe = describe_depends_built,