X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=tools%2Fccanlint%2Ftests%2Ftests_compile.c;h=73b1cb24aed025c570e766961e965ab6ebf1c92a;hb=aabf300e324f7da5134d7ad45afba11225045c24;hp=911f310caf5e1d9800f37996600c427483c758b8;hpb=af5b1a18948345c5f9f9abf4eda3ab9fe0aa9a9f;p=ccan diff --git a/tools/ccanlint/tests/tests_compile.c b/tools/ccanlint/tests/tests_compile.c index 911f310c..73b1cb24 100644 --- a/tools/ccanlint/tests/tests_compile.c +++ b/tools/ccanlint/tests/tests_compile.c @@ -42,24 +42,31 @@ char *test_obj_list(const struct manifest *m, bool link_with_module, list = talloc_asprintf_append(list, " %s", i->compiled[own_ctype]); - /* Other ccan modules. */ + /* Other ccan modules (normal depends). */ list_for_each(&m->deps, subm, list) { if (subm->compiled[ctype]) list = talloc_asprintf_append(list, " %s", subm->compiled[ctype]); } + /* Other ccan modules (test depends). */ + list_for_each(&m->test_deps, subm, list) { + if (subm->compiled[ctype]) + list = talloc_asprintf_append(list, " %s", + subm->compiled[ctype]); + } + return list; } -char *lib_list(const struct manifest *m, enum compile_type ctype) +char *test_lib_list(const struct manifest *m, enum compile_type ctype) { - unsigned int i, num; - char **libs = get_libs(m, m->dir, &num, - &m->info_file->compiled[ctype]); + unsigned int i; + char **libs; char *ret = talloc_strdup(m, ""); - for (i = 0; i < num; i++) + libs = get_libs(m, m->dir, "testdepends", get_or_compile_info); + for (i = 0; libs[i]; i++) ret = talloc_asprintf_append(ret, "-l%s ", libs[i]); return ret; } @@ -84,7 +91,7 @@ static bool compile(const void *ctx, if (!compile_and_link(ctx, file->fullname, ccan_dir, test_obj_list(m, link_with_module, ctype, ctype), - compiler, flags, lib_list(m, ctype), fname, + compiler, flags, test_lib_list(m, ctype), fname, output)) { talloc_free(fname); return false; @@ -111,7 +118,7 @@ static void compile_async(const void *ctx, compile_and_link_async(file, time_ms, file->fullname, ccan_dir, test_obj_list(m, link_with_module, ctype, ctype), - compiler, flags, lib_list(m, ctype), + compiler, flags, test_lib_list(m, ctype), file->compiled[ctype]); }