diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-04-05 16:06:22 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-04-05 16:06:22 (GMT) |
commit | 91f73bac581daf979b84ed9bddc78aa47fdeddc3 (patch) | |
tree | 46726ede2d6457598756ec1bd15d8ab984ce4d30 | |
parent | afe489977c1c0f116f7f8703f32cd5ca2c2c9218 (diff) | |
parent | 68a892f3f2eb6601b6254ff90c165c3b6412b97a (diff) | |
download | hdf5-91f73bac581daf979b84ed9bddc78aa47fdeddc3.zip hdf5-91f73bac581daf979b84ed9bddc78aa47fdeddc3.tar.gz hdf5-91f73bac581daf979b84ed9bddc78aa47fdeddc3.tar.bz2 |
Merging in latest from upstream (HDFFV/hdf5:refs/heads/hdf5_1_10)
* commit '68a892f3f2eb6601b6254ff90c165c3b6412b97a':
Remove return statement from void function test_reference_sel_none().
Somehow missed in committing this file for the fix submitted previously.
Fix for HDFFV-11067:incorrect # of selected elements returned from region reference. The H5S_sel_none->deserialize callback should be called for H5S_SEL_NONE selection type.
-rw-r--r-- | src/H5Sselect.c | 2 | ||||
-rw-r--r-- | test/trefer.c | 81 |
2 files changed, 82 insertions, 1 deletions
diff --git a/src/H5Sselect.c b/src/H5Sselect.c index 0b3d0fa..995ae72 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -484,7 +484,7 @@ H5S_select_deserialize(H5S_t **space, const uint8_t **p) break; case H5S_SEL_NONE: /* Nothing selected */ - ret_value = (*H5S_sel_all->deserialize)(space, p); + ret_value = (*H5S_sel_none->deserialize)(space, p); break; default: diff --git a/test/trefer.c b/test/trefer.c index 6b67eb4..4fa2ee4 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -1543,6 +1543,86 @@ test_reference_group(void) CHECK(ret, FAIL, "H5Fclose"); } /* test_reference_group() */ +/**************************************************************** +** +** test_reference_sel_none(): +** Verify the jira issue HDFFV-11067 is fixed: +** -- It was reported that an incorrect number of selected elements +** was returned when dereferenced a region reference which has +** H5Sselect_none() set on the dataspace. +** +****************************************************************/ +static void +test_reference_sel_none(void) +{ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ + hid_t ref_sid = H5I_INVALID_HID; /* Dataspace ID for referenced */ + hid_t did = H5I_INVALID_HID; /* Dataset ID */ + hsize_t dims[1]= {SPACE1_DIM1}; /* Dimension siez ofr dataset */ + int buf[SPACE1_DIM1]; /* Buffer for data */ + hdset_reg_ref_t ref[1]; /* Buffer for reference */ + hssize_t npoints; /* Number of points in selection */ + herr_t status; /* Return status */ + int i; /* Local index variable */ + + /* Iniitialize buffer */ + for (i = 0; i < SPACE1_DIM1; i++) + buf[i] = i; + + /* Create the test file */ + fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); + + /* Create dataspace */ + sid = H5Screate_simple (1, dims, NULL); + CHECK(sid, H5I_INVALID_HID, "H5Screate_simple"); + + /* Create the dataset */ + did = H5Dcreate2(fid, DSETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(did, H5I_INVALID_HID, "H5Dcreate2"); + + /* Write data to the dataset */ + status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL , H5S_ALL, H5P_DEFAULT, buf); + CHECK(status, FAIL, "H5Dwrite"); + + /* Get the number of points in the dataspace selection */ + npoints = H5Sget_select_npoints(sid); + VERIFY(npoints, SPACE1_DIM1, "H5Sget_select_npoints"); + + /* Set selection to include no elements */ + status = H5Sselect_none(sid); + CHECK(status, FAIL, "H5Sselect_none"); + + /* Get the number of points in the dataspace selection */ + npoints = H5Sget_select_npoints(sid); + VERIFY(npoints, 0, "H5Sget_select_npoints"); + + /* Create region reference */ + status = H5Rcreate(&ref[0], fid, DSETNAME, H5R_DATASET_REGION, sid); + CHECK(status, FAIL, "H5Rcreate"); + + /* Dereference the region reference */ + ref_sid = H5Rget_region(did, H5R_DATASET_REGION, ref); + CHECK(status, FAIL, "H5Rget_region"); + + /* Get the # of points in the dataspace */ + npoints = H5Sget_select_npoints(ref_sid); + VERIFY(npoints, 0, "H5Sget_select_npoints"); + + /* Closing */ + status = H5Sclose(sid); + CHECK(status, FAIL, "H5Sclose"); + status = H5Sclose(ref_sid); + CHECK(status, FAIL, "H5Sclose"); + status = H5Dclose(did); + CHECK(status, FAIL, "H5Dclose"); + status = H5Fclose(fid); + CHECK(status, FAIL, "H5Fclose"); + +} /* test_reference_sel_none() */ + + #ifndef H5_NO_DEPRECATED_SYMBOLS /**************************************************************** ** @@ -1868,6 +1948,7 @@ test_reference(void) test_reference_obj_deleted(); /* Test H5R object reference code for deleted objects */ test_reference_group(); /* Test operations on dereferenced groups */ + test_reference_sel_none(); /* Test selected elements on region reference */ #ifndef H5_NO_DEPRECATED_SYMBOLS test_reference_compat(); /* Test operations with old API routines */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ |