X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=tools%2Fccanlint%2Fcompulsory_tests%2Fcheck_build.c;h=83b1c780e067046cc715fc479f7e79c64e22cdda;hb=2926cafb52b9d95646d9dafa877d53f2368d8b2c;hp=9175b91835f5bb2271f6e645d9040038030c8663;hpb=a40b318e7a07a452ae7456053727bd11b2fa49b4;p=ccan-lca-2011.git diff --git a/tools/ccanlint/compulsory_tests/check_build.c b/tools/ccanlint/compulsory_tests/check_build.c index 9175b91..83b1c78 100644 --- a/tools/ccanlint/compulsory_tests/check_build.c +++ b/tools/ccanlint/compulsory_tests/check_build.c @@ -24,12 +24,13 @@ static const char *can_build(struct manifest *m) static char *obj_list(const struct manifest *m) { char *list = talloc_strdup(m, ""); - struct ccan_file *i; + struct manifest *i; /* Other CCAN deps. */ - list_for_each(&m->dep_dirs, i, list) { + list_for_each(&m->deps, i, list) { if (i->compiled) - list = talloc_asprintf_append(list, "%s ", i->compiled); + list = talloc_asprintf_append(list, "%s ", + i->compiled); } return list; } @@ -50,7 +51,7 @@ static void check_use_build(struct manifest *m, unsigned int *timeleft, struct score *score) { char *contents; - char *tmpfile; + char *tmpfile, *cmdout; char *basename = talloc_asprintf(m, "%s/example.c", m->dir); int fd; @@ -71,20 +72,23 @@ static void check_use_build(struct manifest *m, err(1, "Failure writing to temporary file %s", tmpfile); close(fd); - score->error = compile_and_link(m, tmpfile, ccan_dir, obj_list(m), "", - lib_list(m), - maybe_temp_file(m, "", keep, tmpfile)); - if (!score->error) { + if (compile_and_link(score, tmpfile, ccan_dir, obj_list(m), "", + lib_list(m), + maybe_temp_file(m, "", keep, tmpfile), + &cmdout)) { score->pass = true; score->score = score->total; + } else { + score->error = cmdout; } } -struct ccanlint check_build = { - .key = "check-link", +struct ccanlint module_links = { + .key = "module_links", .name = "Module can be linked against trivial program", .check = check_use_build, .can_run = can_build, + .needs = "module_builds depends_build" }; -REGISTER_TEST(check_build, &build, NULL); +REGISTER_TEST(module_links);