From: Joel Rosdahl Date: Tue, 20 Jul 2010 21:58:40 +0000 (+0200) Subject: test framework: Restore CWD to be able to wipe temporary directory after test X-Git-Tag: v3.1~139 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e6096e9716199785a569eaafad1f5b566b97025c;p=thirdparty%2Fccache.git test framework: Restore CWD to be able to wipe temporary directory after test --- diff --git a/test/main.c b/test/main.c index 283c88d06..ff2ad9315 100644 --- a/test/main.c +++ b/test/main.c @@ -45,7 +45,7 @@ int main(int argc, char **argv) }; int verbose = 0; int c; - char *testdir; + char *testdir, *dir_before; int result; while ((c = getopt_long(argc, argv, "hv", options, NULL)) != -1) { @@ -78,9 +78,11 @@ int main(int argc, char **argv) testdir = format("testdir.%d", (int)getpid()); cct_create_fresh_dir(testdir); + dir_before = gnu_getcwd(); cct_chdir(testdir); result = cct_run(suites, verbose); if (result == 0) { + cct_chdir(dir_before); cct_wipe(testdir); } free(testdir);