From 6cda54bdec4071715935b8195a259237285813b0 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Mon, 9 Jan 2006 00:14:54 -0500 Subject: [svn-r11871] Purpose: Bug fix. Description: getenv_all will be called even when it is NOT an MPI application. Solution: Moved the use of getenv_all("HDF5_NOCLEANUP") to fix_name so that it will be invoked only if a parallel driver is used. Platforms tested: hand tested in copper. --- test/h5test.c | 18 +++++++++++------- test/h5test.h | 1 + test/testframe.c | 15 ++++++++++++++- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/test/h5test.c b/test/h5test.c index aeeb58f..40d9210 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -145,13 +145,7 @@ h5_cleanup(const char *base_name[], hid_t fapl) int retval=0; hid_t driver; - if (GetTestCleanup() && -#ifdef H5_HAVE_PARALLEL - !getenv_all(MPI_COMM_WORLD, 0, "HDF5_NOCLEANUP") -#else - !HDgetenv("HDF5_NOCLEANUP") -#endif - ){ + if (GetTestCleanup()){ for (i = 0; base_name[i]; i++) { if (h5_fixname(base_name[i], fapl, filename, sizeof(filename)) == NULL) continue; @@ -327,6 +321,11 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size) prefix = HDF5_PARAPREFIX; #endif /* HDF5_PARAPREFIX */ } + + /* check NOCLEANUP environment setting. */ + if (getenv_all(MPI_COMM_WORLD, 0, "HDF5_NOCLEANUP")){ + SetTestNoCleanup(); + } #endif /* H5_HAVE_PARALLEL */ } else { /* @@ -339,6 +338,11 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size) if (!prefix) prefix = HDF5_PREFIX; #endif /* HDF5_PREFIX */ + + /* check NOCLEANUP environment setting. */ + if (HDgetenv("HDF5_NOCLEANUP")){ + SetTestNoCleanup(); + } } /* Prepend the prefix value to the base name */ diff --git a/test/h5test.h b/test/h5test.h index d9800a0..fc5c772 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -146,6 +146,7 @@ H5TEST_DLL int GetTestVerbosity(void); H5TEST_DLL int SetTestVerbosity(int newval); H5TEST_DLL int GetTestSummary(void); H5TEST_DLL int GetTestCleanup(void); +H5TEST_DLL int SetTestNoCleanup(void); H5TEST_DLL void ParseTestVerbosity(char *argv); H5TEST_DLL int GetTestNumErrs(void); H5TEST_DLL void IncTestNumErrs(void); diff --git a/test/testframe.c b/test/testframe.c index 4478cb4..f4c19c2 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -266,7 +266,7 @@ void TestParseCmdLine(int argc, char *argv[]) exit(0); } else if ((HDstrcmp(*argv, "-cleanoff") == 0) || (HDstrcmp(*argv, "-c") == 0)) - CleanUp = 0; + SetTestNoCleanup(); else { /* non-standard option. Break out. */ break; @@ -394,6 +394,19 @@ int GetTestCleanup(void) } /* + * Set cleanup to no. + * Return previous cleanup value. + */ +int SetTestNoCleanup(void) +{ + int oldval; + + oldval = CleanUp; + CleanUp = 0; + return(oldval); +} + +/* * Parse an argument string for verbosity level and set it. */ void ParseTestVerbosity(char *argv) -- cgit v0.12