X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fccanlint%2Fcompulsory_tests%2Frun_tests.c;h=763b54a3e66924e38a8611680992cccec6101c58;hp=b3c1188de592f4eece24b81cfa45561dc0a83be3;hb=747a69435d9f83c0968d9689c4951bc0233ffc5e;hpb=5f44c8ca0eb66503db51e0df1b65ff173eb42f57 diff --git a/tools/ccanlint/compulsory_tests/run_tests.c b/tools/ccanlint/compulsory_tests/run_tests.c index b3c1188d..763b54a3 100644 --- a/tools/ccanlint/compulsory_tests/run_tests.c +++ b/tools/ccanlint/compulsory_tests/run_tests.c @@ -33,6 +33,15 @@ static void *do_run_tests(struct manifest *m) 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); @@ -65,6 +74,9 @@ static void *do_run_tests(struct manifest *m) list = NULL; } + if (chdir(olddir) != 0) + err(1, "Could not chdir to %s", olddir); + return list; }