summaryrefslogtreecommitdiffstats
path: root/testpar
diff options
context:
space:
mode:
Diffstat (limited to 'testpar')
-rw-r--r--testpar/CMakeLists.txt1
-rw-r--r--testpar/Makefile.am2
-rw-r--r--testpar/t_oflush.c118
-rw-r--r--testpar/testphdf5.c1
-rw-r--r--testpar/testphdf5.h1
5 files changed, 122 insertions, 1 deletions
diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt
index 32f4a0f..15723c9 100644
--- a/testpar/CMakeLists.txt
+++ b/testpar/CMakeLists.txt
@@ -18,6 +18,7 @@ set (testphdf5_SOURCES
${HDF5_TEST_PAR_SOURCE_DIR}/t_filter_read.c
${HDF5_TEST_PAR_SOURCE_DIR}/t_prop.c
${HDF5_TEST_PAR_SOURCE_DIR}/t_coll_md_read.c
+ ${HDF5_TEST_PAR_SOURCE_DIR}/t_oflush.c
)
#-- Adding test for testhdf5
diff --git a/testpar/Makefile.am b/testpar/Makefile.am
index cbde0c1..ff4a3dd 100644
--- a/testpar/Makefile.am
+++ b/testpar/Makefile.am
@@ -37,7 +37,7 @@ check_PROGRAMS = $(TEST_PROG_PARA) t_pflush1 t_pflush2
testphdf5_SOURCES=testphdf5.c t_dset.c t_file.c t_file_image.c t_mdset.c \
t_ph5basic.c t_coll_chunk.c t_span_tree.c t_chunk_alloc.c t_filter_read.c \
- t_prop.c t_coll_md_read.c
+ t_prop.c t_coll_md_read.c t_oflush.c
# The tests all depend on the hdf5 library and the test library
LDADD = $(LIBH5TEST) $(LIBHDF5)
diff --git a/testpar/t_oflush.c b/testpar/t_oflush.c
new file mode 100644
index 0000000..1a4ee69
--- /dev/null
+++ b/testpar/t_oflush.c
@@ -0,0 +1,118 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* Test for H5Oflush. For the current design, H5Oflush doesn't work correctly
+ * with parallel. It causes an assertion failure in metadata cache during
+ * H5Fclose. This test makes sure H5Oflush fails for dataset, group, and named
+ * datatype properly until the problem is solved. */
+
+#include "testphdf5.h"
+#include "H5Dprivate.h"
+#include "H5private.h"
+
+#define DATASETNAME "IntArray"
+#define NX 5
+#define NY 6
+#define RANK 2
+
+void
+test_oflush(void)
+{
+ int mpi_size, mpi_rank;
+ hid_t file, dataset;
+ hid_t dataspace;
+ hid_t fapl_id;
+ const char *filename;
+ hid_t gid, dtype_flush;
+ hsize_t dimsf[2];
+ herr_t ret;
+ int data[NX][NY];
+ int i, j;
+
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
+ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
+
+ /* Make sure MPIO driver is used */
+ fapl_id = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, FACC_MPIO);
+ VRFY((fapl_id >= 0), "fapl creation succeeded");
+
+ /* Data buffer initialization */
+ for (j = 0; j < NX; j++)
+ for (i = 0; i < NY; i++)
+ data[j][i] = i + j;
+
+ filename = GetTestParameters();
+
+ file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
+ VRFY((file >= 0), "file creation succeeded");
+
+ /* Describe the size of the array and create the data space for fixed
+ * size dataset */
+ dimsf[0] = NX;
+ dimsf[1] = NY;
+
+ dataspace = H5Screate_simple(RANK, dimsf, NULL);
+ VRFY((dataspace >= 0), "data space creation succeeded");
+
+ /* Create a new dataset within the file using defined dataspace and
+ * datatype and default dataset creation properties */
+ dataset = H5Dcreate2(file, DATASETNAME, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ VRFY((dataset >= 0), "dataset creation succeeded");
+
+ /* Write the data to the dataset using default transfer properties */
+ ret = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
+ VRFY((ret >= 0), "dataset creation succeeded");
+
+ /* Make sure H5Oflush fails with dataset */
+ H5E_BEGIN_TRY
+ {
+ ret = H5Oflush(dataset);
+ }
+ H5E_END_TRY
+ VRFY((ret < 0), "H5Oflush should fail as expected");
+
+ H5Sclose(dataspace);
+ H5Dclose(dataset);
+
+ /* Create a group */
+ gid = H5Gcreate(file, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ VRFY((gid >= 0), "group creation succeeded");
+
+ /* Make sure H5Oflush fails with group */
+ H5E_BEGIN_TRY
+ {
+ ret = H5Oflush(gid);
+ }
+ H5E_END_TRY
+ VRFY((ret < 0), "H5Oflush should fail as expected");
+
+ H5Gclose(gid);
+
+ /* Create a named datatype */
+ dtype_flush = H5Tcopy(H5T_NATIVE_INT);
+ H5Tcommit(file, "dtype", dtype_flush, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Make sure H5Oflush fails with named datatype */
+ H5E_BEGIN_TRY
+ {
+ ret = H5Oflush(dtype_flush);
+ }
+ H5E_END_TRY
+ VRFY((ret < 0), "H5Oflush should fail as expected");
+
+ H5Tclose(dtype_flush);
+
+ /* Close and release resources */
+ H5Fclose(file);
+ H5Pclose(fapl_id);
+}
diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c
index d7b5305..0f284f9 100644
--- a/testpar/testphdf5.c
+++ b/testpar/testphdf5.c
@@ -351,6 +351,7 @@ main(int argc, char **argv)
AddTest("mpiodup", test_fapl_mpio_dup, NULL, "fapl_mpio duplicate", NULL);
AddTest("split", test_split_comm_access, NULL, "dataset using split communicators", PARATESTFILE);
+ AddTest("h5oflusherror", test_oflush, NULL, "H5Oflush failure", PARATESTFILE);
#ifdef PB_OUT /* temporary: disable page buffering when parallel */
AddTest("page_buffer", test_page_buffer_access, NULL, "page buffer usage in parallel", PARATESTFILE);
diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h
index 16f45d3..1fbc105 100644
--- a/testpar/testphdf5.h
+++ b/testpar/testphdf5.h
@@ -294,6 +294,7 @@ void test_dense_attr(void);
void test_partial_no_selection_coll_md_read(void);
void test_multi_chunk_io_addrmap_issue(void);
void test_link_chunk_io_sort_chunk_issue(void);
+void test_oflush(void);
/* commonly used prototypes */
hid_t create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type);