summaryrefslogtreecommitdiffstats
path: root/test/direct_chunk.c
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2019-12-24 21:12:08 (GMT)
committerLarry Knox <lrknox@hdfgroup.org>2019-12-24 21:12:08 (GMT)
commit5b9cf732caab9daa6ed1e00f2df4f5a792340196 (patch)
tree4c01c9bd71ba5e7d8d11b474f6896e6ffbf0416d /test/direct_chunk.c
parent646fc294078f560fc9bef784cb1c4e27cdc51f5b (diff)
parente0fa36bfe008c03365ce8ea94d705f8fdebccdf0 (diff)
downloadhdf5-5b9cf732caab9daa6ed1e00f2df4f5a792340196.zip
hdf5-5b9cf732caab9daa6ed1e00f2df4f5a792340196.tar.gz
hdf5-5b9cf732caab9daa6ed1e00f2df4f5a792340196.tar.bz2
Merge pull request #2203 in HDFFV/hdf5 from ~LRKNOX/hdf5_lrk:1.10/master to 1.10/masterhdf5-1_10_6
* commit 'e0fa36bfe008c03365ce8ea94d705f8fdebccdf0': (166 commits) Update release date strings in README.txt and release_docs/RELEASE.txt Add release note about using ompio instead of romio when collective writes fail with OpenMPI. Fixed typos, grammatical errors, etc. Expanded entry for S3 and HDFS VFDs. Moved Mac 10.11 and 10.12 from Supported Platforms to More Platforms Tested. Add qualification to RELEASE.txt regarding performance improvements Standalone doesn't use h5test implementation. Add missing note Update COPYING file with new HDF5 license. Update bin/config.guess and config.sub to current version available from git.savannah.gnu.org. Fix include to correct memory calls - big-endian issue. Revert BLDLIBDIR value in junit.sh.in. Corrections to CMake functions Update version for HDF5 1.10.6 release. Remove autom4te.cache directory that shouldn't have been added. Remove duplicate instance Fix merge issue HDFFV-10979 - fix global name clash Correct clang search and java include Latest date first in RELEASE.txt Update RELEASE.txt with performance improvements and Steven Varga's bugfix. Update version numbers for shared lib files according to api compatibility report. Created hdf5_1_10_6 branch for HDF5 1.10.6 release preparation. Set version to 1.10.6-pre1. Switched default maintainer mode to disabled and default build mode to production. Added files produced by autogen.sh to commit except for src/H5config.h.in~ and src/H5public.h~. ...
Diffstat (limited to 'test/direct_chunk.c')
-rw-r--r--test/direct_chunk.c131
1 files changed, 106 insertions, 25 deletions
diff --git a/test/direct_chunk.c b/test/direct_chunk.c
index 1c5862d..7b17043 100644
--- a/test/direct_chunk.c
+++ b/test/direct_chunk.c
@@ -58,6 +58,14 @@
#define OVERWRITE_CHUNK_NY 2
#define OVERWRITE_VALUE 42
+/* Test configurations */
+#define CONFIG_LATEST 0x01
+#define CONFIG_REOPEN_FILE 0x02
+#define CONFIG_REOPEN_DSET 0x04
+#define CONFIG_DIRECT_WRITE 0x08
+#define CONFIG_DIRECT_READ 0x10
+#define CONFIG_END 0x20
+
/* Defines used in test_single_chunk_latest() */
#define FILE "single_latest.h5"
#define DATASET "dataset"
@@ -1973,7 +1981,7 @@ error:
} /* test_read_unallocated_chunk() */
/*-------------------------------------------------------------------------
- * Function: test_single_chunk_latest
+ * Function: test_single_chunk
*
* Purpose: This is to verify the fix for jira issue HDFFV-10425.
* The problem was due to a bug in the internal ilbrary routine
@@ -1989,27 +1997,31 @@ error:
* index for the dataset.
* Verify that the data read is the same as the written data.
*
+ * Since expanded to test multiple combinations of cases
+ * involving a single chunk
+ *
* Return: Success: 0
* Failure: 1
*
*-------------------------------------------------------------------------
*/
static int
-test_single_chunk_latest(void)
+test_single_chunk(unsigned config)
{
- hid_t fid; /* File ID */
- hid_t fapl; /* File access property list ID */
- hid_t sid; /* Dataspace ID */
- hid_t did; /* Dataset ID */
- hid_t dcpl; /* Dataset creation property list */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ hid_t fapl = H5I_INVALID_HID; /* File access property list ID */
+ hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t did = H5I_INVALID_HID; /* Dataset ID */
+ hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */
hsize_t dims[2] = {DIM0, DIM1}; /* Dimension sizes */
hsize_t chunk[2] = {CHUNK0, CHUNK1}; /* Chunk dimension sizes */
hsize_t offset[2] = {0,0}; /* Offset for writing */
+ uint32_t filters; /* Filter mask out */
int wdata[DIM0][DIM1]; /* Write buffer */
int rdata[DIM0][DIM1]; /* Read buffer */
int i, j; /* Local index variable */
- TESTING("H5Dwrite_chunk with single chunk and latest format");
+ TESTING("Single chunk I/O");
/* Initialize data */
for (i=0; i<DIM0; i++) {
@@ -2020,8 +2032,9 @@ test_single_chunk_latest(void)
/* Create a new file with the latest format */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
goto error;
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
- goto error;
+ if(config & CONFIG_LATEST)
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ goto error;
if((fid = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
@@ -2039,37 +2052,57 @@ test_single_chunk_latest(void)
if((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
- /* Write the data directly to the dataset */
- if(H5Dwrite_chunk(did, H5P_DEFAULT, 0, offset, CHUNK0*CHUNK1*4, (void *)wdata) < 0)
- goto error;
+ if(config & CONFIG_DIRECT_WRITE) {
+ /* Write the data directly to the dataset */
+ if(H5Dwrite_chunk(did, H5P_DEFAULT, 0, offset, CHUNK0*CHUNK1*4, (void *)wdata) < 0)
+ goto error;
+ } /* end if */
+ else
+ /* Write the data to the dataset */
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *)wdata) < 0)
+ goto error;
/*
* Close and release resources.
*/
if(H5Pclose(dcpl) < 0)
goto error;
- if(H5Dclose(did) < 0)
- goto error;
+ if(config & CONFIG_REOPEN_DSET)
+ if(H5Dclose(did) < 0)
+ goto error;
if(H5Sclose(sid) < 0)
goto error;
if(H5Pclose(fapl) < 0)
goto error;
- if(H5Fclose(fid) < 0)
- goto error;
+ if(config & CONFIG_REOPEN_FILE)
+ if(H5Fclose(fid) < 0)
+ goto error;
/* Open the file and dataset with default properties */
- if((fid = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
- goto error;
- if((did = H5Dopen2(fid, DATASET, H5P_DEFAULT)) < 0)
- goto error;
+ if(config & CONFIG_REOPEN_FILE)
+ if((fid = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ goto error;
+ if(config & CONFIG_REOPEN_DSET)
+ if((did = H5Dopen2(fid, DATASET, H5P_DEFAULT)) < 0)
+ goto error;
/* Retrieve dataset creation property list */
if((dcpl = H5Dget_create_plist(did)) < 0)
goto error;
- /* Read the data */
- if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0)
- goto error;
+ if(config & CONFIG_DIRECT_READ) {
+ /* Read the data directly */
+ if(H5Dread_chunk(did, H5P_DEFAULT, offset, &filters, rdata) < 0)
+ goto error;
+
+ /* Verify returned filter mask */
+ if(filters != 0)
+ goto error;
+ } /* end if */
+ else
+ /* Read the data */
+ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0)
+ goto error;
/* Verify that the data read was correct. */
for (i = 0; i < DIM0; i++) {
@@ -2122,6 +2155,7 @@ error:
int main( void )
{
hid_t file_id;
+ unsigned config;
int nerrors=0;
/*
@@ -2149,7 +2183,53 @@ int main( void )
nerrors += test_read_unfiltered_dset(file_id);
nerrors += test_read_unallocated_chunk(file_id);
- nerrors += test_single_chunk_latest();
+ /* Loop over test configurations */
+ for(config = 0; config < CONFIG_END; config++) {
+ hbool_t need_comma = FALSE;
+
+ /* Check for invalid combinations */
+ if((config & CONFIG_REOPEN_FILE) && !(config & CONFIG_REOPEN_DSET))
+ continue;
+
+ /* Print configuration */
+ HDprintf("Configuration: ");
+ if(config == 0)
+ HDprintf("<empty>");
+ if(config & CONFIG_LATEST) {
+ if(need_comma)
+ HDprintf(", ");
+ HDprintf("latest format");
+ need_comma = TRUE;
+ } /* end if */
+ if(config & CONFIG_REOPEN_FILE) {
+ if(need_comma)
+ HDprintf(", ");
+ HDprintf("reopen file");
+ need_comma = TRUE;
+ } /* end if */
+ else if(config & CONFIG_REOPEN_DSET) {
+ if(need_comma)
+ HDprintf(", ");
+ HDprintf("reopen dataset");
+ need_comma = TRUE;
+ } /* end if */
+ if(config & CONFIG_DIRECT_WRITE) {
+ if(need_comma)
+ HDprintf(", ");
+ HDprintf("direct write");
+ need_comma = TRUE;
+ } /* end if */
+ if(config & CONFIG_DIRECT_READ) {
+ if(need_comma)
+ HDprintf(", ");
+ HDprintf("direct read");
+ need_comma = TRUE;
+ } /* end if */
+ HDprintf(":\n");
+ fflush(stdout);
+
+ nerrors += test_single_chunk(config);
+ } /* end for */
if(H5Fclose(file_id) < 0)
goto error;
@@ -2165,3 +2245,4 @@ error:
HDputs("*** TESTS FAILED ***");
return EXIT_FAILURE;
}
+