diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2021-05-05 22:07:40 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2021-05-05 22:07:40 (GMT) |
commit | 8d4873173fe95ffd8a274c9d9a6c1e8b5e017957 (patch) | |
tree | 10a135eaa95a0dfd54925af438504179c439de17 /testpar | |
parent | 54c202e4ec4bc9c7e45543cea5b51868a091b3e9 (diff) | |
download | hdf5-8d4873173fe95ffd8a274c9d9a6c1e8b5e017957.zip hdf5-8d4873173fe95ffd8a274c9d9a6c1e8b5e017957.tar.gz hdf5-8d4873173fe95ffd8a274c9d9a6c1e8b5e017957.tar.bz2 |
Brings native H5Fdelete implementation from develop
Diffstat (limited to 'testpar')
-rw-r--r-- | testpar/t_file.c | 55 | ||||
-rw-r--r-- | testpar/testphdf5.c | 2 | ||||
-rw-r--r-- | testpar/testphdf5.h | 1 |
3 files changed, 58 insertions, 0 deletions
diff --git a/testpar/t_file.c b/testpar/t_file.c index ec8726f..d749978 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -950,3 +950,58 @@ test_file_properties(void) VRFY((mpi_ret >= 0), "MPI_Info_free succeeded"); } /* end test_file_properties() */ + +void +test_delete(void) +{ + hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ + hid_t fapl_id = H5I_INVALID_HID; /* File access plist */ + hbool_t is_coll; + const char *filename = NULL; + MPI_Comm comm = MPI_COMM_WORLD; + MPI_Info info = MPI_INFO_NULL; + htri_t is_hdf5 = FAIL; /* Whether a file is an HDF5 file */ + herr_t ret; /* Generic return value */ + + 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"); + + /* create the file */ + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); + VRFY((fid != H5I_INVALID_HID), "H5Fcreate"); + + /* close the file */ + ret = H5Fclose(fid); + VRFY((SUCCEED == ret), "H5Fclose"); + + /* Verify that the file is an HDF5 file */ + is_hdf5 = H5Fis_accessible(filename, fapl_id); + VRFY((TRUE == is_hdf5), "H5Fis_accessible"); + + /* Delete the file */ + ret = H5Fdelete(filename, fapl_id); + VRFY((SUCCEED == ret), "H5Fdelete"); + + /* Verify that the file is NO LONGER an HDF5 file */ + /* This should fail since there is no file */ + H5E_BEGIN_TRY + { + is_hdf5 = H5Fis_accessible(filename, fapl_id); + } + H5E_END_TRY; + VRFY((is_hdf5 != SUCCEED), "H5Fis_accessible"); + + /* Release file-access plist */ + ret = H5Pclose(fapl_id); + VRFY((SUCCEED == ret), "H5Pclose"); + +} /* end test_delete() */ diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index e693bc0..cce8aff 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -353,6 +353,8 @@ main(int argc, char **argv) AddTest("props", test_file_properties, NULL, "Coll Metadata file property settings", PARATESTFILE); + AddTest("delete", test_delete, NULL, "MPI-IO VFD file delete", 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 d1469df..56b966d 100644 --- a/testpar/testphdf5.h +++ b/testpar/testphdf5.h @@ -237,6 +237,7 @@ extern int dxfer_coll_type; void test_plist_ed(void); void zero_dim_dset(void); void test_file_properties(void); +void test_delete(void); void multiple_dset_write(void); void multiple_group_write(void); void multiple_group_read(void); |