]> git.ozlabs.org Git - ccan/blobdiff - tools/ccanlint/compulsory_tests/check_build.c
ccanlint: Add -k option to keep results.
[ccan] / tools / ccanlint / compulsory_tests / check_build.c
index eb968e11e36d65052ce3d647e88093da16a33c8e..5bdec5533f5920b09f54b42f3197e6fef9cd5bd5 100644 (file)
@@ -27,16 +27,17 @@ static char *obj_list(const struct manifest *m)
        struct ccan_file *i;
 
        /* Other CCAN deps. */
-       list_for_each(&m->dep_objs, i, list)
-               list = talloc_asprintf_append(list, "%s ", i->name);
-
+       list_for_each(&m->dep_dirs, i, list) {
+               if (i->compiled)
+                       list = talloc_asprintf_append(list, "%s ", i->compiled);
+       }
        return list;
 }
 
 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, ".", &num, &m->info_file->compiled);
        char *ret = talloc_strdup(m, "");
 
        for (i = 0; i < num; i++)
@@ -44,10 +45,12 @@ static char *lib_list(const struct manifest *m)
        return ret;
 }
 
-static void *check_use_build(struct manifest *m)
+static void *check_use_build(struct manifest *m,
+                            bool keep,
+                            unsigned int *timeleft)
 {
        char *contents;
-       char *tmpfile, *err;
+       char *tmpfile;
        int fd;
 
        tmpfile = temp_file(m, ".c");
@@ -70,9 +73,8 @@ static void *check_use_build(struct manifest *m)
        }
        close(fd);
 
-       if (!compile_and_link(m, tmpfile, obj_list(m), "", lib_list(m), &err))
-               return err;
-       return NULL;
+       return compile_and_link(m, tmpfile, ccan_dir, obj_list(m), "",
+                               lib_list(m), temp_file(m, ""));
 }
 
 static const char *describe_use_build(struct manifest *m, void *check_result)
@@ -83,7 +85,8 @@ static const char *describe_use_build(struct manifest *m, void *check_result)
 }
 
 struct ccanlint check_build = {
-       .name = "Module can be used",
+       .key = "check-link",
+       .name = "Module can be linked against trivial program",
        .total_score = 1,
        .check = check_use_build,
        .describe = describe_use_build,