X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=tools%2Fccanlint%2Fcompulsory_tests%2Fcheck_includes_build.c;h=296b0a3961c10b93d2109ada855d21d2a570fddf;hb=2926cafb52b9d95646d9dafa877d53f2368d8b2c;hp=cc5edc4ccaabbf2525b9072a4e64da3ceef6d02f;hpb=7a163ea2dcafc056fdafc8c71ef011e2bfdbeb65;p=ccan diff --git a/tools/ccanlint/compulsory_tests/check_includes_build.c b/tools/ccanlint/compulsory_tests/check_includes_build.c index cc5edc4c..296b0a39 100644 --- a/tools/ccanlint/compulsory_tests/check_includes_build.c +++ b/tools/ccanlint/compulsory_tests/check_includes_build.c @@ -40,7 +40,7 @@ static void check_includes_build(struct manifest *m, unsigned int *timeleft, struct score *score) { char *contents; - char *tmpsrc, *tmpobj; + char *tmpsrc, *tmpobj, *cmdout; int fd; struct ccan_file *mainh = main_header(m); @@ -57,22 +57,22 @@ static void check_includes_build(struct manifest *m, err(1, "writing to temporary file %s", tmpsrc); close(fd); - score->error = compile_object(m, tmpsrc, ccan_dir, "", tmpobj); - if (score->error) { - score->error = talloc_asprintf(score, - "#include of the main header file:\n%s", - score->error); - } else { + if (compile_object(score, tmpsrc, ccan_dir, "", tmpobj, &cmdout)) { score->pass = true; score->score = score->total; + } else { + score->error = talloc_asprintf(score, + "#include of the main header file:\n%s", + cmdout); } } -struct ccanlint includes_build = { - .key = "include-main", +struct ccanlint main_header_compiles = { + .key = "main_header_compiles", .name = "Modules main header compiles", .check = check_includes_build, .can_run = can_build, + .needs = "depends_exist main_header_exists" }; -REGISTER_TEST(includes_build, &depends_exist, &has_main_header, NULL); +REGISTER_TEST(main_header_compiles);