X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fccanlint%2Ftests%2Ftests_compile.c;h=db5ea33e4f7467e9c9266674541625d71b8d1903;hp=8a833053e9d3c9e698aa573a228fb41a20bdf507;hb=6b7c3c840eafbec211b9f58751c5ff754302a68e;hpb=b931f4765272d68de3b5e35d70c1933c27bcdea4 diff --git a/tools/ccanlint/tests/tests_compile.c b/tools/ccanlint/tests/tests_compile.c index 8a833053..db5ea33e 100644 --- a/tools/ccanlint/tests/tests_compile.c +++ b/tools/ccanlint/tests/tests_compile.c @@ -15,6 +15,7 @@ #include #include #include "reduce_features.h" +#include "tests_compile.h" static const char *can_build(struct manifest *m) { @@ -23,8 +24,8 @@ static const char *can_build(struct manifest *m) return NULL; } -static char *obj_list(const struct manifest *m, bool link_with_module, - enum compile_type ctype) +char *test_obj_list(const struct manifest *m, bool link_with_module, + enum compile_type ctype, enum compile_type own_ctype) { char *list = talloc_strdup(m, ""); struct ccan_file *i; @@ -39,7 +40,7 @@ static char *obj_list(const struct manifest *m, bool link_with_module, if (link_with_module) list_for_each(&m->c_files, i, list) list = talloc_asprintf_append(list, " %s", - i->compiled[ctype]); + i->compiled[own_ctype]); /* Other ccan modules. */ list_for_each(&m->deps, subm, list) { @@ -51,7 +52,7 @@ static char *obj_list(const struct manifest *m, bool link_with_module, return list; } -static char *lib_list(const struct manifest *m, enum compile_type ctype) +char *lib_list(const struct manifest *m, enum compile_type ctype) { unsigned int i, num; char **libs = get_libs(m, m->dir, &num, @@ -77,12 +78,15 @@ static bool compile(const void *ctx, flags = talloc_asprintf(ctx, "%s%s%s", fail ? "-DFAIL " : "", cflags, - ctype == COMPILE_NOFEAT ? " -I." : ""); + ctype == COMPILE_NOFEAT + ? " "REDUCE_FEATURES_FLAGS : ""); fname = maybe_temp_file(ctx, "", keep, file->fullname); if (!compile_and_link(ctx, file->fullname, ccan_dir, - obj_list(m, link_with_module, ctype), compiler, - flags, lib_list(m, ctype), fname, output)) { + test_obj_list(m, link_with_module, + ctype, ctype), + compiler, flags, lib_list(m, ctype), fname, + output)) { talloc_free(fname); return false; } @@ -189,6 +193,6 @@ struct ccanlint tests_compile_without_features = { .name = "Module tests compile (without features)", .check = do_compile_tests_without_features, .can_run = features_reduced, - .needs = "tests_helpers_compile_without_features reduce_features" + .needs = "tests_helpers_compile_without_features objects_build_without_features" }; REGISTER_TEST(tests_compile_without_features);