]> git.ozlabs.org Git - ccan/blobdiff - tools/ccanlint/compulsory_tests/run_tests.c
ccanlint: fix directory issues properly.
[ccan] / tools / ccanlint / compulsory_tests / run_tests.c
index b3c1188de592f4eece24b81cfa45561dc0a83be3..763b54a3e66924e38a8611680992cccec6101c58 100644 (file)
@@ -33,6 +33,15 @@ static void *do_run_tests(struct manifest *m)
        struct run_tests_result *res;
        struct ccan_file *i;
        char *cmdout;
        struct run_tests_result *res;
        struct ccan_file *i;
        char *cmdout;
+       char *olddir;
+
+       /* We run tests in the module directory, so any paths
+        * referenced can all be module-local. */
+       olddir = talloc_getcwd(m);
+       if (!olddir)
+               err(1, "Could not save cwd");
+       if (chdir(m->dir) != 0)
+               err(1, "Could not chdir to %s", m->dir);
 
        list_head_init(list);
 
 
        list_head_init(list);
 
@@ -65,6 +74,9 @@ static void *do_run_tests(struct manifest *m)
                list = NULL;
        }
 
                list = NULL;
        }
 
+       if (chdir(olddir) != 0)
+               err(1, "Could not chdir to %s", olddir);
+
        return list;
 }
 
        return list;
 }