]> git.ozlabs.org Git - ccan/blobdiff - tools/ccanlint/tests/module_links.c
ccanlint: handle nested modules when mentioned in examples.
[ccan] / tools / ccanlint / tests / module_links.c
index 2dda642978f75b8512e3c97b7c3564f12ea49e17..5c25e6126589ebd0cadd01d15b4fd66e8a18e11c 100644 (file)
@@ -43,12 +43,12 @@ static char *obj_list(const struct manifest *m)
 
 static char *lib_list(const struct manifest *m)
 {
-       unsigned int i, num;
-       char **libs = get_libs(m, ".",
-                              &num, &m->info_file->compiled[COMPILE_NORMAL]);
+       unsigned int i;
+       char **libs;
        char *ret = talloc_strdup(m, "");
 
-       for (i = 0; i < num; i++)
+       libs = get_libs(m, m->dir, "depends", get_or_compile_info);
+       for (i = 0; libs[i]; i++)
                ret = talloc_asprintf_append(ret, "-l%s ", libs[i]);
        return ret;
 }
@@ -58,10 +58,9 @@ static void check_use_build(struct manifest *m,
 {
        char *contents;
        char *tmpfile, *cmdout;
-       char *basename = talloc_asprintf(m, "%s/example.c", m->dir);
        int fd;
 
-       tmpfile = temp_file(m, ".c", basename);
+       tmpfile = temp_file(m, ".c", "example.c");
 
        fd = open(tmpfile, O_WRONLY | O_CREAT | O_EXCL, 0600);
        if (fd < 0)
@@ -73,7 +72,7 @@ static void check_use_build(struct manifest *m,
                                   "{\n"
                                   "    return 0;\n"
                                   "}\n",
-                                  m->basename, m->basename);
+                                  m->modname, m->basename);
        if (write(fd, contents, strlen(contents)) != strlen(contents))
                err(1, "Failure writing to temporary file %s", tmpfile);
        close(fd);