From e6096e9716199785a569eaafad1f5b566b97025c Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Tue, 20 Jul 2010 23:58:40 +0200 Subject: [PATCH] test framework: Restore CWD to be able to wipe temporary directory after test --- test/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); -- 2.47.3