diff options
author | jhendersonHDF <jhenderson@hdfgroup.org> | 2023-09-01 04:30:15 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-01 04:30:15 (GMT) |
commit | c33164e2b30ecb98aeef3f7b2e92f11c27faa203 (patch) | |
tree | dfba5eb0d24477f3c0a918a555b8fb67ef4bd1e3 /testpar | |
parent | 14fd7b2bf9c1cf52aff3b99c70822c463e451154 (diff) | |
download | hdf5-c33164e2b30ecb98aeef3f7b2e92f11c27faa203.zip hdf5-c33164e2b30ecb98aeef3f7b2e92f11c27faa203.tar.gz hdf5-c33164e2b30ecb98aeef3f7b2e92f11c27faa203.tar.bz2 |
[1.10 Merge] Fix assertion failure during file close on error (#3460)
Diffstat (limited to 'testpar')
-rw-r--r-- | testpar/t_file.c | 51 | ||||
-rw-r--r-- | testpar/testphdf5.c | 3 | ||||
-rw-r--r-- | testpar/testphdf5.h | 1 |
3 files changed, 55 insertions, 0 deletions
diff --git a/testpar/t_file.c b/testpar/t_file.c index 980784c..302f47d 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -873,3 +873,54 @@ test_file_properties(void) ret = H5Pclose(fapl_id); VRFY((ret >= 0), "H5Pclose succeeded"); } /* end test_file_properties() */ + +/* + * Tests for an assertion failure during file close that used + * to occur when the library fails to create a file in parallel + * due to an invalid library version bounds setting + */ +void +test_invalid_libver_bounds_file_close_assert(void) +{ + const char *filename = NULL; + MPI_Comm comm = MPI_COMM_WORLD; + MPI_Info info = MPI_INFO_NULL; + herr_t ret; + hid_t fid = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; + hid_t fcpl_id = H5I_INVALID_HID; + + filename = (const char *)GetTestParameters(); + + /* set up MPI parameters */ + MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + + /* setup file access plist */ + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + VRFY((fapl_id != H5I_INVALID_HID), "H5Pcreate"); + ret = H5Pset_fapl_mpio(fapl_id, comm, info); + VRFY((SUCCEED == ret), "H5Pset_fapl_mpio"); + ret = H5Pset_libver_bounds(fapl_id, H5F_LIBVER_EARLIEST, H5F_LIBVER_V18); + VRFY((SUCCEED == ret), "H5Pset_libver_bounds"); + + /* setup file creation plist */ + fcpl_id = H5Pcreate(H5P_FILE_CREATE); + VRFY((fcpl_id != H5I_INVALID_HID), "H5Pcreate"); + + ret = H5Pset_file_space_strategy(fcpl_id, H5F_FSPACE_STRATEGY_PAGE, TRUE, 1); + VRFY((SUCCEED == ret), "H5Pset_file_space_strategy"); + + /* create the file */ + H5E_BEGIN_TRY + { + fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id); + } + H5E_END_TRY + VRFY((fid == H5I_INVALID_HID), "H5Fcreate"); + + ret = H5Pclose(fapl_id); + VRFY((SUCCEED == ret), "H5Pclose"); + ret = H5Pclose(fcpl_id); + VRFY((SUCCEED == ret), "H5Pclose"); +} diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index f0c42f6..be6a8ea 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -357,6 +357,9 @@ main(int argc, char **argv) AddTest("props", test_file_properties, NULL, "Coll Metadata file property settings", PARATESTFILE); + AddTest("invlibverassert", test_invalid_libver_bounds_file_close_assert, NULL, + "Invalid libver bounds assertion failure", PARATESTFILE); + AddTest("idsetw", dataset_writeInd, NULL, "dataset independent write", PARATESTFILE); AddTest("idsetr", dataset_readInd, NULL, "dataset independent read", PARATESTFILE); diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h index 9cc41f5..fac29aa 100644 --- a/testpar/testphdf5.h +++ b/testpar/testphdf5.h @@ -230,6 +230,7 @@ extern int dxfer_coll_type; void test_plist_ed(void); void zero_dim_dset(void); void test_file_properties(void); +void test_invalid_libver_bounds_file_close_assert(void); void multiple_dset_write(void); void multiple_group_write(void); void multiple_group_read(void); |