diff options
author | Neil Fortner <nfortne2@hdfgroup.org> | 2015-06-03 18:00:58 (GMT) |
---|---|---|
committer | Neil Fortner <nfortne2@hdfgroup.org> | 2015-06-03 18:00:58 (GMT) |
commit | 5d12a79db20305b7c08e505a683a4c1e38e9039a (patch) | |
tree | d033bb9898996b35d679bbec64da056d0bd1a444 /test/h5test.c | |
parent | 9a8c664ff0d9884b8ce2bde543685245cb73f6bb (diff) | |
download | hdf5-5d12a79db20305b7c08e505a683a4c1e38e9039a.zip hdf5-5d12a79db20305b7c08e505a683a4c1e38e9039a.tar.gz hdf5-5d12a79db20305b7c08e505a683a4c1e38e9039a.tar.bz2 |
[svn-r27145] Add some testing for printf-style source dataset name resolution.
Various bug fixes, including a temporary fix for printf with FIRST_MISSING view.
Other cleanup.
Tested: ummon
Diffstat (limited to 'test/h5test.c')
-rw-r--r-- | test/h5test.c | 109 |
1 files changed, 67 insertions, 42 deletions
diff --git a/test/h5test.c b/test/h5test.c index 693760c..88a8afa 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -122,69 +122,94 @@ h5_errors(hid_t estack, void UNUSED *client_data) /*------------------------------------------------------------------------- - * Function: h5_cleanup + * Function: h5_close_files * - * Purpose: Cleanup temporary test files. + * Purpose: Cleanup temporary test files (always closes). * base_name contains the list of test file names. - * The file access property list is also closed. * - * Return: Non-zero if cleanup actions were performed; zero otherwise. + * Return: void * - * Programmer: Albert Cheng + * Programmer: Neil Fortner + * June 1, 2015 + * Original: Albert Cheng * May 28, 1998 * *------------------------------------------------------------------------- */ -int -h5_cleanup(const char *base_name[], hid_t fapl) +void +h5_close_files(const char *base_name[], hid_t fapl) { - int retval = 0; + int i; - if(GetTestCleanup()) { - int i; + for(i = 0; base_name[i]; i++) { + char filename[1024]; + char temp[2048]; + hid_t driver; - for(i = 0; base_name[i]; i++) { - char filename[1024]; - char temp[2048]; - hid_t driver; + if(NULL == h5_fixname(base_name[i], fapl, filename, sizeof(filename))) + continue; - if(NULL == h5_fixname(base_name[i], fapl, filename, sizeof(filename))) - continue; + driver = H5Pget_driver(fapl); - driver = H5Pget_driver(fapl); + if(driver == H5FD_FAMILY) { + int j; - if(driver == H5FD_FAMILY) { - int j; + for(j = 0; /*void*/; j++) { + HDsnprintf(temp, sizeof temp, filename, j); - for(j = 0; /*void*/; j++) { - HDsnprintf(temp, sizeof temp, filename, j); + if(HDaccess(temp, F_OK) < 0) + break; - if(HDaccess(temp, F_OK) < 0) - break; + HDremove(temp); + } /* end for */ + } else if(driver == H5FD_CORE) { + hbool_t backing; /* Whether the core file has backing store */ - HDremove(temp); - } /* end for */ - } else if(driver == H5FD_CORE) { - hbool_t backing; /* Whether the core file has backing store */ + H5Pget_fapl_core(fapl, NULL, &backing); - H5Pget_fapl_core(fapl, NULL, &backing); + /* If the file was stored to disk with bacing store, remove it */ + if(backing) + HDremove(filename); + } else if (driver == H5FD_MULTI) { + H5FD_mem_t mt; - /* If the file was stored to disk with bacing store, remove it */ - if(backing) - HDremove(filename); - } else if (driver == H5FD_MULTI) { - H5FD_mem_t mt; + HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES); - HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES); + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) { + HDsnprintf(temp, sizeof temp, "%s-%c.h5", filename, multi_letters[mt]); + HDremove(temp); /*don't care if it fails*/ + } /* end for */ + } else { + HDremove(filename); + } + } /* end for */ - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) { - HDsnprintf(temp, sizeof temp, "%s-%c.h5", filename, multi_letters[mt]); - HDremove(temp); /*don't care if it fails*/ - } /* end for */ - } else { - HDremove(filename); - } - } /* end for */ + return; +} /* end h5_close_files() */ + + +/*------------------------------------------------------------------------- + * Function: h5_cleanup + * + * Purpose: Cleanup temporary test files. + * base_name contains the list of test file names. + * The file access property list is also closed. + * + * Return: Non-zero if cleanup actions were performed; zero otherwise. + * + * Programmer: Albert Cheng + * May 28, 1998 + * + *------------------------------------------------------------------------- + */ +int +h5_cleanup(const char *base_name[], hid_t fapl) +{ + int retval = 0; + + if(GetTestCleanup()) { + /* Close files in base_name */ + h5_close_files(base_name, fapl); retval = 1; } /* end if */ |