summaryrefslogtreecommitdiffstats
path: root/testpar
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2021-04-16 18:47:32 (GMT)
committerGitHub <noreply@github.com>2021-04-16 18:47:32 (GMT)
commitd5c449248f74886529b9fad09473dd73d60a34fd (patch)
treeca3495dbf738c1561ad6501920a9d54680251664 /testpar
parente21f7aaac4a4d34a8a5aa1330fb2ed6814532cfb (diff)
downloadhdf5-d5c449248f74886529b9fad09473dd73d60a34fd.zip
hdf5-d5c449248f74886529b9fad09473dd73d60a34fd.tar.gz
hdf5-d5c449248f74886529b9fad09473dd73d60a34fd.tar.bz2
Brings the native implementation of H5Fdelete() from Bitbucket (#524)
* Committing clang-format changes * Brings the native VFD H5Fdelete() implementation from Bitbucket Only brings the 'del' callbacks, not the 'open/close' scheme. * Formatter changes * Committing clang-format changes * Fixes direct VFD callback name * Removes UNUSED macro from family API call * Adds barrier and rank 0 check to MPI-I/O VFD delete * Revert "Adds barrier and rank 0 check to MPI-I/O VFD delete" This reverts commit 909765f759d9d96e84f4b8b1cc14f7d2b3ac8143. * Revert "Revert "Adds barrier and rank 0 check to MPI-I/O VFD delete"" This reverts commit 9b04bef1157853fc79fcb8fcc3e8ba1371091702. * Adds a second barrier after the delete in MPI-I/O VFD * Only delete files in the core VFD when the backing store flag is set * Fixes string issues in multi VFD Also, h5test.c cleanup code now uses H5Fdelete(). * Formatted source * Rework fapl checks for MPI-I/O VFD delete callback Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'testpar')
-rw-r--r--testpar/t_file.c55
-rw-r--r--testpar/testphdf5.c2
-rw-r--r--testpar/testphdf5.h1
3 files changed, 58 insertions, 0 deletions
diff --git a/testpar/t_file.c b/testpar/t_file.c
index 629c24c..8dea120 100644
--- a/testpar/t_file.c
+++ b/testpar/t_file.c
@@ -948,3 +948,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 e24e1e4..1ead1b8 100644
--- a/testpar/testphdf5.c
+++ b/testpar/testphdf5.c
@@ -350,6 +350,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 007fac0..10e3027 100644
--- a/testpar/testphdf5.h
+++ b/testpar/testphdf5.h
@@ -236,6 +236,7 @@ void test_plist_ed(void);
void external_links(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);