From 4f7350dc6abf66ff8e5ac0ad27e3e45402c080ca Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Thu, 2 Jul 2020 16:26:05 +0100 Subject: [PATCH] MDTest remove testdir if created by MDTest. --- src/mdtest.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mdtest.c b/src/mdtest.c index d2a3e23..c8caa4f 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -1932,6 +1932,7 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * int last = 0; int stride = 1; int iterations = 1; + int created_root_dir = 0; // was the root directory existing or newly created verbose = 0; int no_barriers = 0; @@ -2189,6 +2190,7 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * if (backend->mkdir(testdirpath, DIRMODE, backend_options) != 0) { FAIL("Unable to create test directory path %s", testdirpath); } + created_root_dir = 1; } /* display disk usage */ @@ -2295,6 +2297,10 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * } } + if (created_root_dir && backend->rmdir(testdirpath, backend_options) != 0) { + FAIL("Unable to remote test directory path %s", testdirpath); + } + if(verification_error){ VERBOSE(0, -1, "\nERROR: verifying the data read! Take the performance values with care!\n"); }