]> git.ozlabs.org Git - ccan/blobdiff - tools/ccanlint/tests/examples_compile.c
ccanlint: make compile commands return output.
[ccan] / tools / ccanlint / tests / examples_compile.c
index 746b47f9a3519ca16ac3ea742bf0057b52d7cc67..1b2360ed52e3820e13f65e24ece05e22a3dfff67 100644 (file)
@@ -103,7 +103,7 @@ static char *obj_list(const struct manifest *m, struct ccan_file *f)
 static char *lib_list(const struct manifest *m)
 {
        unsigned int i, num;
-       char **libs = get_libs(m, ".", &num, &m->info_file->compiled);
+       char **libs = get_libs(m, m->dir, &num, &m->info_file->compiled);
        char *ret = talloc_strdup(m, "");
 
        for (i = 0; i < num; i++)
@@ -119,14 +119,14 @@ static char *compile(const void *ctx,
        char *errmsg;
 
        file->compiled = maybe_temp_file(ctx, "", keep, file->fullname);
-       errmsg = compile_and_link(ctx, file->fullname, ccan_dir,
-                                 obj_list(m, file),
-                                 "", lib_list(m), file->compiled);
-       if (errmsg) {
+       if (!compile_and_link(ctx, file->fullname, ccan_dir,
+                             obj_list(m, file),
+                             "", lib_list(m), file->compiled, &errmsg)) {
                talloc_free(file->compiled);
                file->compiled = NULL;
                return errmsg;
        }
+       talloc_free(errmsg);
        return NULL;
 }
 
@@ -542,4 +542,4 @@ struct ccanlint examples_compile = {
        .can_run = can_run,
 };
 
-REGISTER_TEST(examples_compile, &has_examples, NULL);
+REGISTER_TEST(examples_compile, &has_examples, &build_objs, NULL);