diff options
author | Albert Cheng <acheng@hdfgroup.org> | 2006-01-09 18:17:44 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 2006-01-09 18:17:44 (GMT) |
commit | df8739d8c61206c3e7acb42930efc54a37cf16b7 (patch) | |
tree | c21a4fc34ff52d67914e76399d3ab83092c27f61 /test | |
parent | ef292e862b684c79be37a022c63e56f7f3fc4a2b (diff) | |
download | hdf5-df8739d8c61206c3e7acb42930efc54a37cf16b7.zip hdf5-df8739d8c61206c3e7acb42930efc54a37cf16b7.tar.gz hdf5-df8739d8c61206c3e7acb42930efc54a37cf16b7.tar.bz2 |
[svn-r11875] Purpose:
Bug fix.
Description:
getenv_all, like some implementations of getenv, keeps an internal buffer
for the getenv values. Application must make a copy of the content of the
returned pointer before calling getenv_all again IF it wants to use the
first content later. The previous code violated this rule and caused
error.
Solution:
Did a small revamp of the h5_fixname to fix the above problem by moving
the getenv_all for HDF5_NOCLEANUP eariler to avoid it clashing the
call of getenv_all for HDF5_PARAPREFIX. No a good permenant fix. Need
to really recode this routine.
Platforms tested:
h5committested.
Diffstat (limited to 'test')
-rw-r--r-- | test/h5test.c | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/test/h5test.c b/test/h5test.c index 40d9210..15daf3f 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -272,6 +272,7 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size) char *ptr, last = '\0'; size_t i, j; hid_t driver = -1; + int isppdriver = 0; /* if the driver is MPI parallel */ if (!base_name || !fullname || size < 1) return NULL; @@ -289,8 +290,33 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size) suffix = NULL; } - /* Use different ones depending on parallel or serial driver used. */ - if (H5P_DEFAULT != fapl && (H5FD_MPIO == driver || H5FD_FPHDF5 == driver)) { + /* Must first check fapl is not H5P_DEFAULT (-1) because H5FD_XXX + * could be of value -1 if it is not defined. + */ + isppdriver = H5P_DEFAULT != fapl && + (H5FD_MPIO==driver || H5FD_MPIPOSIX==driver || H5FD_FPHDF5==driver); + + /* Check HDF5_NOCLEANUP environment setting. + * (The #ifdef is needed to prevent compile failure in case MPI is not + * configured.) + */ + if (isppdriver){ +#ifdef H5_HAVE_PARALLEL + if (getenv_all(MPI_COMM_WORLD, 0, "HDF5_NOCLEANUP")) + SetTestNoCleanup(); +#endif /* H5_HAVE_PARALLEL */ + }else{ + if (HDgetenv("HDF5_NOCLEANUP")) + SetTestNoCleanup(); + } + + /* Check what prefix to use for test files. Process HDF5_PARAPREFIX and + * HDF5_PREFIX. + * Use different ones depending on parallel or serial driver used. + * (The #ifdef is needed to prevent compile failure in case MPI is not + * configured.) + */ + if (isppdriver){ #ifdef H5_HAVE_PARALLEL /* * For parallel: @@ -321,11 +347,6 @@ 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 { /* @@ -338,16 +359,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 */ if (prefix && *prefix) { - if (H5P_DEFAULT != fapl && (H5FD_MPIO == driver || H5FD_FPHDF5 == driver)) { + if (isppdriver){ /* This is a parallel system */ char *subdir; |