summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-04-02 13:25:44 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-04-02 13:25:44 (GMT)
commit7e06b76c64e031372eccfd94d271a6e437e4f0be (patch)
tree08654450a51ae0a00af81bd6d978c2edc3aec782
parent196193c18d43d71b6dd8a0727fc59b91c8299341 (diff)
parentbae05235a2d87acb0d6b3a2e1c32f3b6f48cf203 (diff)
downloadhdf5-7e06b76c64e031372eccfd94d271a6e437e4f0be.zip
hdf5-7e06b76c64e031372eccfd94d271a6e437e4f0be.tar.gz
hdf5-7e06b76c64e031372eccfd94d271a6e437e4f0be.tar.bz2
Merging in latest from upstream (HDFFV/hdf5:refs/heads/develop)
* commit 'bae05235a2d87acb0d6b3a2e1c32f3b6f48cf203': Changed default dataset shared struct to initialize hid_t IDs to H5I_INVALID_HID. A fix in the cleaning up code for datatype when datatype initialization via H5D__init_type() fails. This is triggered by the tests for revised references when the libver bounds setting does not allow version 4 datatype message to be created. The test failure is abort core dumped. This is due to the datatype initialization fails before the datatype ID is registered. The datatype cleanup code should provide for the above situation. The code to fix the problem is the same as what is done in H5D__open_oid(). Remove tongue-in-cheek credit for Rusty Shackleford and Dale Alvin Gribble. Follow HDF5 conventions.
-rw-r--r--src/H5Dint.c17
-rw-r--r--src/H5TS.c116
-rw-r--r--test/trefer.c736
3 files changed, 480 insertions, 389 deletions
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 1624f7b..7580505 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -207,6 +207,9 @@ H5D__init_package(void)
/* Reset the "default dataset" information */
HDmemset(&H5D_def_dset, 0, sizeof(H5D_shared_t));
+ H5D_def_dset.type_id = H5I_INVALID_HID;
+ H5D_def_dset.dapl_id = H5I_INVALID_HID;
+ H5D_def_dset.dcpl_id = H5I_INVALID_HID;
/* Get the default dataset creation property list values and initialize the
* default dataset with them.
@@ -1418,8 +1421,18 @@ done:
HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, NULL, "unable to reset external file list info")
if(new_dset->shared->space && H5S_close(new_dset->shared->space) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release dataspace")
- if(new_dset->shared->type && H5I_dec_ref(new_dset->shared->type_id) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release datatype")
+
+ if(new_dset->shared->type) {
+ if(new_dset->shared->type_id > 0) {
+ if(H5I_dec_ref(new_dset->shared->type_id) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype")
+ } /* end if */
+ else {
+ if(H5T_close_real(new_dset->shared->type) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype")
+ } /* end else */
+ } /* end if */
+
if(H5F_addr_defined(new_dset->oloc.addr)) {
if(H5O_dec_rc_by_loc(&(new_dset->oloc)) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement refcount on newly created object")
diff --git a/src/H5TS.c b/src/H5TS.c
index b0cef7f..98eba41 100644
--- a/src/H5TS.c
+++ b/src/H5TS.c
@@ -39,26 +39,26 @@ H5TS_key_t H5TS_cancel_key_g;
#ifndef H5_HAVE_WIN_THREADS
-/* An h5_tid_t is a record of a thread identifier that is
+/* An H5TS_tid_t is a record of a thread identifier that is
* available for reuse.
*/
struct _tid;
-typedef struct _tid h5_tid_t;
+typedef struct _tid H5TS_tid_t;
struct _tid {
- h5_tid_t *next;
+ H5TS_tid_t *next;
uint64_t id;
};
/* Pointer to first free thread ID record or NULL. */
-static h5_tid_t *tid_next_free = NULL;
-static uint64_t tid_next_id = 0;
+static H5TS_tid_t *H5TS_tid_next_free = NULL;
+static uint64_t H5TS_tid_next_id = 0;
-/* Mutual exclusion for access to tid_next_free and tid_next_id. */
-static pthread_mutex_t tid_mtx;
+/* Mutual exclusion for access to H5TS_tid_next_free and H5TS_tid_next_id. */
+static pthread_mutex_t H5TS_tid_mtx;
/* Key for thread-local storage of the thread ID. */
-static H5TS_key_t tid_key;
+static H5TS_key_t H5TS_tid_key;
#endif /* H5_HAVE_WIN_THREADS */
@@ -93,47 +93,85 @@ H5TS_key_destructor(void *key_val)
#ifndef H5_HAVE_WIN_THREADS
-/* When a thread shuts down, put its ID record on the free list. */
+/*--------------------------------------------------------------------------
+ * NAME
+ * H5TS_tid_destructor
+ *
+ * USAGE
+ * H5TS_tid_destructor()
+ *
+ * RETURNS
+ *
+ * DESCRIPTION
+ * When a thread shuts down, put its ID record on the free list.
+ *
+ *--------------------------------------------------------------------------
+ */
static void
-tid_destructor(void *_v)
+H5TS_tid_destructor(void *_v)
{
- h5_tid_t *tid = _v;
+ H5TS_tid_t *tid = _v;
if (tid == NULL)
return;
- /* XXX I can use mutexes in destructors, right? */
/* TBD use an atomic CAS */
- pthread_mutex_lock(&tid_mtx);
- tid->next = tid_next_free;
- tid_next_free = tid;
- pthread_mutex_unlock(&tid_mtx);
+ pthread_mutex_lock(&H5TS_tid_mtx);
+ tid->next = H5TS_tid_next_free;
+ H5TS_tid_next_free = tid;
+ pthread_mutex_unlock(&H5TS_tid_mtx);
}
-/* Initialize for integer thread identifiers. */
+/*--------------------------------------------------------------------------
+ * NAME
+ * H5TS_tid_init
+ *
+ * USAGE
+ * H5TS_tid_init()
+ *
+ * RETURNS
+ *
+ * DESCRIPTION
+ * Initialize for integer thread identifiers.
+ *
+ *--------------------------------------------------------------------------
+ */
static void
-tid_init(void)
+H5TS_tid_init(void)
{
- pthread_mutex_init(&tid_mtx, NULL);
- pthread_key_create(&tid_key, tid_destructor);
+ pthread_mutex_init(&H5TS_tid_mtx, NULL);
+ pthread_key_create(&H5TS_tid_key, H5TS_tid_destructor);
}
-/* Return an integer identifier, ID, for the current thread satisfying the
- * following properties:
+/*--------------------------------------------------------------------------
+ * NAME
+ * H5TS_thread_id
*
- * 1 1 <= ID <= UINT64_MAX
- * 2 ID is constant over the thread's lifetime.
- * 3 No two threads share an ID during their lifetimes.
- * 4 A thread's ID is available for reuse as soon as it is joined.
+ * USAGE
+ * uint64_t id = H5TS_thread_id()
+ *
+ * RETURNS
+ * Return an integer identifier, ID, for the current thread.
+ *
+ * DESCRIPTION
+ * The ID satisfies the following properties:
+ *
+ * 1 1 <= ID <= UINT64_MAX
+ * 2 ID is constant over the thread's lifetime.
+ * 3 No two threads share an ID during their lifetimes.
+ * 4 A thread's ID is available for reuse as soon as it is joined.
*
- * ID 0 is reserved. H5TS_thread_id() returns 0 if the library was not built
- * with thread safety or if an error prevents it from assigning an ID.
+ * ID 0 is reserved. H5TS_thread_id() returns 0 if the library was not
+ * built with thread safety or if an error prevents it from assigning an
+ * ID.
+ *
+ *--------------------------------------------------------------------------
*/
uint64_t
H5TS_thread_id(void)
{
- h5_tid_t *tid = pthread_getspecific(tid_key);
- h5_tid_t proto_tid;
+ H5TS_tid_t *tid = pthread_getspecific(H5TS_tid_key);
+ H5TS_tid_t proto_tid;
/* An ID is already assigned. */
if (tid != NULL)
@@ -146,14 +184,14 @@ H5TS_thread_id(void)
* point `tid` at `proto_tid` if we need to allocate some
* memory.
*/
- pthread_mutex_lock(&tid_mtx);
- if ((tid = tid_next_free) != NULL)
- tid_next_free = tid->next;
- else if (tid_next_id != UINT64_MAX) {
+ pthread_mutex_lock(&H5TS_tid_mtx);
+ if ((tid = H5TS_tid_next_free) != NULL)
+ H5TS_tid_next_free = tid->next;
+ else if (H5TS_tid_next_id != UINT64_MAX) {
tid = &proto_tid;
- tid->id = ++tid_next_id;
+ tid->id = ++H5TS_tid_next_id;
}
- pthread_mutex_unlock(&tid_mtx);
+ pthread_mutex_unlock(&H5TS_tid_mtx);
/* If a prototype ID record was established, copy it to the heap. */
if (tid == &proto_tid) {
@@ -168,8 +206,8 @@ H5TS_thread_id(void)
* to it.
*/
tid->next = NULL;
- if (pthread_setspecific(tid_key, tid) != 0) {
- tid_destructor(tid);
+ if (pthread_setspecific(H5TS_tid_key, tid) != 0) {
+ H5TS_tid_destructor(tid);
return 0;
}
@@ -213,7 +251,7 @@ H5TS_pthread_first_thread_init(void)
H5_g.init_lock.lock_count = 0;
/* Initialize integer thread identifiers. */
- tid_init();
+ H5TS_tid_init();
/* initialize key for thread-specific error stacks */
pthread_key_create(&H5TS_errstk_key_g, H5TS_key_destructor);
diff --git a/test/trefer.c b/test/trefer.c
index 32caf5e..d399fef 100644
--- a/test/trefer.c
+++ b/test/trefer.c
@@ -631,173 +631,179 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
CHECK(sid1, H5I_INVALID_HID, "H5Screate_simple");
/* Create a dataset */
- dset1 = H5Dcreate2(fid1, "Dataset1", H5T_STD_REF, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(dset1, H5I_INVALID_HID, "H5Dcreate2");
+ H5E_BEGIN_TRY {
+ dset1 = H5Dcreate2(fid1, "Dataset1", H5T_STD_REF, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ } H5E_END_TRY;
+
+ if(dset1 < 0) {
+ VERIFY(libver_high <= H5F_LIBVER_V110, TRUE, "H5Dcreate2");
- /* Create references */
+ ret = H5Sclose(sid1);
+ CHECK(ret, FAIL, "H5Sclose");
- /* Select 6x6 hyperslab for first reference */
- start[0] = 2; start[1] = 2;
- stride[0] = 1; stride[1] = 1;
- count[0] = 1; count[1] = 1;
- block[0] = 6; block[1] = 6;
- ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
+ ret = H5Sclose(sid2);
+ CHECK(ret, FAIL, "H5Sclose");
- ret = (int)H5Sget_select_npoints(sid2);
- VERIFY(ret, 36, "H5Sget_select_npoints");
+ ret = H5Pclose(fapl);
+ CHECK(ret, FAIL, "H5Pclose");
- /* Store first dataset region */
- ret = H5Rcreate_region(fid1, "/Dataset2", sid2, H5P_DEFAULT, &wbuf[0]);
- CHECK(ret, FAIL, "H5Rcreate_region");
- ret = H5Rget_obj_type3(&wbuf[0], H5P_DEFAULT, &obj_type);
- CHECK(ret, FAIL, "H5Rget_obj_type3");
- VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
+ ret = H5Fclose(fid1);
+ CHECK(ret, FAIL, "H5Fclose");
+ } else {
- /* Select sequence of ten points for second reference */
- coord1[0][0] = 6; coord1[0][1] = 9;
- coord1[1][0] = 2; coord1[1][1] = 2;
- coord1[2][0] = 8; coord1[2][1] = 4;
- coord1[3][0] = 1; coord1[3][1] = 6;
- coord1[4][0] = 2; coord1[4][1] = 8;
- coord1[5][0] = 3; coord1[5][1] = 2;
- coord1[6][0] = 0; coord1[6][1] = 4;
- coord1[7][0] = 9; coord1[7][1] = 0;
- coord1[8][0] = 7; coord1[8][1] = 1;
- coord1[9][0] = 3; coord1[9][1] = 3;
- ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
- CHECK(ret, FAIL, "H5Sselect_elements");
+ CHECK(dset1, H5I_INVALID_HID, "H5Dcreate2");
- ret = (int)H5Sget_select_npoints(sid2);
- VERIFY(ret, SPACE2_DIM2, "H5Sget_select_npoints");
+ /* Create references */
- /* Store second dataset region */
- ret = H5Rcreate_region(fid1, "/Dataset2", sid2, H5P_DEFAULT, &wbuf[1]);
- CHECK(ret, FAIL, "H5Rcreate_region");
+ /* Select 6x6 hyperslab for first reference */
+ start[0] = 2; start[1] = 2;
+ stride[0] = 1; stride[1] = 1;
+ count[0] = 1; count[1] = 1;
+ block[0] = 6; block[1] = 6;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
- /* Select unlimited hyperslab for third reference */
- start[0] = 1;
- start[1] = 8;
- stride[0] = 4;
- stride[1] = 1;
- count[0] = H5S_UNLIMITED;
- count[1] = 1;
- block[0] = 2;
- block[1] = 2;
- ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
+ ret = (int)H5Sget_select_npoints(sid2);
+ VERIFY(ret, 36, "H5Sget_select_npoints");
- hssize_ret = H5Sget_select_npoints(sid2);
- VERIFY(hssize_ret, (hssize_t)H5S_UNLIMITED, "H5Sget_select_npoints");
+ /* Store first dataset region */
+ ret = H5Rcreate_region(fid1, "/Dataset2", sid2, H5P_DEFAULT, &wbuf[0]);
+ CHECK(ret, FAIL, "H5Rcreate_region");
+ ret = H5Rget_obj_type3(&wbuf[0], H5P_DEFAULT, &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type3");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
- /* Store third dataset region */
- ret = H5Rcreate_region(fid1, "/Dataset2", sid2, H5P_DEFAULT, &wbuf[2]);
- CHECK(ret, FAIL, "H5Rcreate_region");
+ /* Select sequence of ten points for second reference */
+ coord1[0][0] = 6; coord1[0][1] = 9;
+ coord1[1][0] = 2; coord1[1][1] = 2;
+ coord1[2][0] = 8; coord1[2][1] = 4;
+ coord1[3][0] = 1; coord1[3][1] = 6;
+ coord1[4][0] = 2; coord1[4][1] = 8;
+ coord1[5][0] = 3; coord1[5][1] = 2;
+ coord1[6][0] = 0; coord1[6][1] = 4;
+ coord1[7][0] = 9; coord1[7][1] = 0;
+ coord1[8][0] = 7; coord1[8][1] = 1;
+ coord1[9][0] = 3; coord1[9][1] = 3;
+ ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
+ CHECK(ret, FAIL, "H5Sselect_elements");
- ret = H5Rget_obj_type3(&wbuf[2], H5P_DEFAULT, &obj_type);
- CHECK(ret, FAIL, "H5Rget_obj_type3");
- VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
+ ret = (int)H5Sget_select_npoints(sid2);
+ VERIFY(ret, SPACE2_DIM2, "H5Sget_select_npoints");
- /* Store fourth dataset region */
- ret = H5Rcreate_region(fid1, "/Dataset2", sid2, H5P_DEFAULT, &wbuf[3]);
- CHECK(ret, FAIL, "H5Rcreate_region");
+ /* Store second dataset region */
+ ret = H5Rcreate_region(fid1, "/Dataset2", sid2, H5P_DEFAULT, &wbuf[1]);
+ CHECK(ret, FAIL, "H5Rcreate_region");
- /* Write selection to disk */
- H5E_BEGIN_TRY {
- ret = H5Dwrite(dset1, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
- } H5E_END_TRY;
+ /* Select unlimited hyperslab for third reference */
+ start[0] = 1;
+ start[1] = 8;
+ stride[0] = 4;
+ stride[1] = 1;
+ count[0] = H5S_UNLIMITED;
+ count[1] = 1;
+ block[0] = 2;
+ block[1] = 2;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
- if(libver_high < H5F_LIBVER_V110)
- VERIFY(ret, FAIL, "H5Dwrite");
- else
- CHECK(ret, FAIL, "H5Dwrite");
+ hssize_ret = H5Sget_select_npoints(sid2);
+ VERIFY(hssize_ret, (hssize_t)H5S_UNLIMITED, "H5Sget_select_npoints");
- /*
- * Store a dataset region reference which will not get written to disk
- */
+ /* Store third dataset region */
+ ret = H5Rcreate_region(fid1, "/Dataset2", sid2, H5P_DEFAULT, &wbuf[2]);
+ CHECK(ret, FAIL, "H5Rcreate_region");
- /* Create the dataspace of the region references */
- space_NA = H5Screate_simple(1, dims_NA, NULL);
- CHECK(space_NA, H5I_INVALID_HID, "H5Screate_simple");
+ ret = H5Rget_obj_type3(&wbuf[2], H5P_DEFAULT, &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type3");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
- /* Create the dataset and write the region references to it */
- dset_NA = H5Dcreate2(fid1, "DS_NA", H5T_STD_REF, space_NA, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT);
- CHECK(dset_NA, H5I_INVALID_HID, "H5Dcreate");
+ /* Store fourth dataset region */
+ ret = H5Rcreate_region(fid1, "/Dataset2", sid2, H5P_DEFAULT, &wbuf[3]);
+ CHECK(ret, FAIL, "H5Rcreate_region");
- /* Close and release resources for undefined region reference tests */
- ret = H5Dclose(dset_NA);
- CHECK(ret, FAIL, "H5Dclose");
- ret = H5Sclose(space_NA);
- CHECK(ret, FAIL, "H5Sclose");
+ /* Write selection to disk */
+ ret = H5Dwrite(dset1, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
- /* Close disk dataspace */
- ret = H5Sclose(sid1);
- CHECK(ret, FAIL, "H5Sclose");
+ /*
+ * Store a dataset region reference which will not get written to disk
+ */
- /* Close Dataset */
- ret = H5Dclose(dset1);
- CHECK(ret, FAIL, "H5Dclose");
+ /* Create the dataspace of the region references */
+ space_NA = H5Screate_simple(1, dims_NA, NULL);
+ CHECK(space_NA, H5I_INVALID_HID, "H5Screate_simple");
- /* Close uint8 dataset dataspace */
- ret = H5Sclose(sid2);
- CHECK(ret, FAIL, "H5Sclose");
+ /* Create the dataset and write the region references to it */
+ dset_NA = H5Dcreate2(fid1, "DS_NA", H5T_STD_REF, space_NA, H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dset_NA, H5I_INVALID_HID, "H5Dcreate");
- /* Close file */
- ret = H5Fclose(fid1);
- CHECK(ret, FAIL, "H5Fclose");
+ /* Close and release resources for undefined region reference tests */
+ ret = H5Dclose(dset_NA);
+ CHECK(ret, FAIL, "H5Dclose");
+ ret = H5Sclose(space_NA);
+ CHECK(ret, FAIL, "H5Sclose");
- /* Re-open the file */
- fid1 = H5Fopen(FILE_REF_REG, H5F_ACC_RDWR, fapl);
- CHECK(fid1, H5I_INVALID_HID, "H5Fopen");
+ /* Close disk dataspace */
+ ret = H5Sclose(sid1);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close Dataset */
+ ret = H5Dclose(dset1);
+ CHECK(ret, FAIL, "H5Dclose");
- /*
- * Start the test of an undefined reference
- */
+ /* Close uint8 dataset dataspace */
+ ret = H5Sclose(sid2);
+ CHECK(ret, FAIL, "H5Sclose");
- /* Open the dataset of the undefined references */
- dset_NA = H5Dopen2(fid1, "DS_NA", H5P_DEFAULT);
- CHECK(dset_NA, H5I_INVALID_HID, "H5Dopen2");
+ /* Close file */
+ ret = H5Fclose(fid1);
+ CHECK(ret, FAIL, "H5Fclose");
- /* Read the data */
- ret = H5Dread(dset_NA, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata_NA);
- CHECK(ret, FAIL, "H5Dread");
+ /* Re-open the file */
+ fid1 = H5Fopen(FILE_REF_REG, H5F_ACC_RDWR, fapl);
+ CHECK(fid1, H5I_INVALID_HID, "H5Fopen");
- /*
- * Dereference an undefined reference (should fail)
- */
- H5E_BEGIN_TRY {
- dset2 = H5Ropen_object(&rdata_NA[0], H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
- VERIFY(dset2, H5I_INVALID_HID, "H5Ropen_object");
+ /*
+ * Start the test of an undefined reference
+ */
- /* Close and release resources. */
- ret = H5Dclose(dset_NA);
- CHECK(ret, FAIL, "H5Dclose");
+ /* Open the dataset of the undefined references */
+ dset_NA = H5Dopen2(fid1, "DS_NA", H5P_DEFAULT);
+ CHECK(dset_NA, H5I_INVALID_HID, "H5Dopen2");
- /* This close should fail since H5Ropen_object never created
- * the id of the referenced object. */
- H5E_BEGIN_TRY {
- ret = H5Dclose(dset2);
- } H5E_END_TRY;
- VERIFY(ret, FAIL, "H5Dclose");
+ /* Read the data */
+ ret = H5Dread(dset_NA, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata_NA);
+ CHECK(ret, FAIL, "H5Dread");
- /*
- * End the test of an undefined reference
- */
+ /*
+ * Dereference an undefined reference (should fail)
+ */
+ H5E_BEGIN_TRY {
+ dset2 = H5Ropen_object(&rdata_NA[0], H5P_DEFAULT, H5P_DEFAULT);
+ } H5E_END_TRY;
+ VERIFY(dset2, H5I_INVALID_HID, "H5Ropen_object");
- /* Open the dataset */
- dset1 = H5Dopen2(fid1, "/Dataset1", H5P_DEFAULT);
- CHECK(dset1, H5I_INVALID_HID, "H5Dopen2");
+ /* Close and release resources. */
+ ret = H5Dclose(dset_NA);
+ CHECK(ret, FAIL, "H5Dclose");
- /* Read selection from disk */
- H5E_BEGIN_TRY {
- ret = H5Dread(dset1, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
- } H5E_END_TRY;
+ /* This close should fail since H5Ropen_object never created
+ * the id of the referenced object. */
+ H5E_BEGIN_TRY {
+ ret = H5Dclose(dset2);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Dclose");
- if(libver_high < H5F_LIBVER_V110)
- CHECK(ret, FAIL, "H5Dread");
- else {
+ /*
+ * End the test of an undefined reference
+ */
+
+ /* Open the dataset */
+ dset1 = H5Dopen2(fid1, "/Dataset1", H5P_DEFAULT);
+ CHECK(dset1, H5I_INVALID_HID, "H5Dopen2");
+
+ /* Read selection from disk */
+ ret = H5Dread(dset1, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
CHECK(ret, FAIL, "H5Dread");
/* Try to open objects */
@@ -832,7 +838,10 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
VERIFY(ret, 36, "H5Sget_select_npoints");
ret = (int)H5Sget_select_hyper_nblocks(sid2);
VERIFY(ret, 1, "H5Sget_select_hyper_nblocks");
- coords = (hsize_t *)HDmalloc((size_t)ret * SPACE2_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */
+
+ /* allocate space for the hyperslab blocks */
+ coords = (hsize_t *)HDmalloc((size_t)ret * SPACE2_RANK * sizeof(hsize_t) * 2);
+
ret = H5Sget_select_hyper_blocklist(sid2, (hsize_t)0, (hsize_t)ret, coords);
CHECK(ret, FAIL, "H5Sget_select_hyper_blocklist");
VERIFY(coords[0], 2, "Hyperslab Coordinates");
@@ -860,7 +869,10 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
VERIFY(ret, SPACE2_DIM2, "H5Sget_select_npoints");
ret = (int)H5Sget_select_elem_npoints(sid2);
VERIFY(ret, SPACE2_DIM2, "H5Sget_select_elem_npoints");
- coords = (hsize_t *)HDmalloc((size_t)ret * SPACE2_RANK * sizeof(hsize_t)); /* allocate space for the element points */
+
+ /* allocate space for the element points */
+ coords = (hsize_t *)HDmalloc((size_t)ret * SPACE2_RANK * sizeof(hsize_t));
+
ret = H5Sget_select_elem_pointlist(sid2, (hsize_t)0, (hsize_t)ret, coords);
CHECK(ret, FAIL, "H5Sget_select_elem_pointlist");
VERIFY(coords[0], coord1[0][0], "Element Coordinates");
@@ -935,35 +947,34 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
} H5E_END_TRY;
VERIFY(ret, FAIL, "H5Rget_obj_type3");
} /* end for */
- }
- /* Close Dataset */
- ret = H5Dclose(dset1);
- CHECK(ret, FAIL, "H5Dclose");
+ /* Close Dataset */
+ ret = H5Dclose(dset1);
+ CHECK(ret, FAIL, "H5Dclose");
- /* Close dataset access property list */
- ret = H5Pclose(dapl_id);
- CHECK(ret, FAIL, "H5Pclose");
+ /* Close dataset access property list */
+ ret = H5Pclose(dapl_id);
+ CHECK(ret, FAIL, "H5Pclose");
- /* Close file */
- ret = H5Fclose(fid1);
- CHECK(ret, FAIL, "H5Fclose");
+ /* Close file */
+ ret = H5Fclose(fid1);
+ CHECK(ret, FAIL, "H5Fclose");
- /* Destroy references */
- for(j = 0; j < SPACE1_DIM1; j++) {
- ret = H5Rdestroy(&wbuf[j]);
- CHECK(ret, FAIL, "H5Rdestroy");
- if(libver_high >= H5F_LIBVER_V110) {
+ /* Destroy references */
+ for(j = 0; j < SPACE1_DIM1; j++) {
+ ret = H5Rdestroy(&wbuf[j]);
+ CHECK(ret, FAIL, "H5Rdestroy");
ret = H5Rdestroy(&rbuf[j]);
CHECK(ret, FAIL, "H5Rdestroy");
}
- }
- /* Free memory buffers */
- HDfree(wbuf);
- HDfree(rbuf);
- HDfree(dwbuf);
- HDfree(drbuf);
+ /* Free memory buffers */
+ HDfree(wbuf);
+ HDfree(rbuf);
+ HDfree(dwbuf);
+ HDfree(drbuf);
+
+ }
} /* test_reference_region() */
/****************************************************************
@@ -1054,226 +1065,255 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
CHECK(sid1, H5I_INVALID_HID, "H5Screate_simple");
/* Create a dataset */
- dset1 = H5Dcreate2(fid1, "Dataset1", H5T_STD_REF, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Dcreate2");
+ H5E_BEGIN_TRY {
+ dset1 = H5Dcreate2(fid1, "Dataset1", H5T_STD_REF, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ } H5E_END_TRY;
- /* Create references */
+ if(dset1 < 0) {
- /* Select 15 2x1 hyperslabs for first reference */
- start[0] = 2;
- stride[0] = 5;
- count[0] = 15;
- block[0] = 2;
- ret = H5Sselect_hyperslab(sid3, H5S_SELECT_SET, start, stride, count, block);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
+ VERIFY(libver_high <= H5F_LIBVER_V110, TRUE, "H5Dcreate2");
- ret = (int)H5Sget_select_npoints(sid3);
- VERIFY(ret, (block[0] * count[0]), "H5Sget_select_npoints");
+ ret = H5Sclose(sid1);
+ CHECK(ret, FAIL, "H5Sclose");
- /* Store first dataset region */
- ret = H5Rcreate_region(fid1, "/Dataset2", sid3, H5P_DEFAULT, &wbuf[0]);
- CHECK(ret, FAIL, "H5Rcreate_region");
- ret = H5Rget_obj_type3(&wbuf[0], H5P_DEFAULT, &obj_type);
- CHECK(ret, FAIL, "H5Rget_obj_type3");
- VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
+ ret = H5Sclose(sid3);
+ CHECK(ret, FAIL, "H5Sclose");
- /* Select sequence of ten points for second reference */
- coord1[0][0] = 16;
- coord1[1][0] = 22;
- coord1[2][0] = 38;
- coord1[3][0] = 41;
- coord1[4][0] = 52;
- coord1[5][0] = 63;
- coord1[6][0] = 70;
- coord1[7][0] = 89;
- coord1[8][0] = 97;
- coord1[9][0] = 03;
- ret = H5Sselect_elements(sid3, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
- CHECK(ret, FAIL, "H5Sselect_elements");
+ ret = H5Pclose(fapl);
+ CHECK(ret, FAIL, "H5Pclose");
- ret = (int)H5Sget_select_npoints(sid3);
- VERIFY(ret, POINT1_NPOINTS, "H5Sget_select_npoints");
+ ret = H5Fclose(fid1);
+ CHECK(ret, FAIL, "H5Fclose");
- /* Store second dataset region */
- ret = H5Rcreate_region(fid1, "/Dataset2", sid3, H5P_DEFAULT, &wbuf[1]);
- CHECK(ret, FAIL, "H5Rcreate_region");
+ } else {
- /* Write selection to disk */
- ret = H5Dwrite(dset1, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
- CHECK(ret, FAIL, "H5Dwrite");
+ CHECK(ret, FAIL, "H5Dcreate2");
- /* Close disk dataspace */
- ret = H5Sclose(sid1);
- CHECK(ret, FAIL, "H5Sclose");
+ /* Create references */
- /* Close Dataset */
- ret = H5Dclose(dset1);
- CHECK(ret, FAIL, "H5Dclose");
+ /* Select 15 2x1 hyperslabs for first reference */
+ start[0] = 2;
+ stride[0] = 5;
+ count[0] = 15;
+ block[0] = 2;
+ ret = H5Sselect_hyperslab(sid3, H5S_SELECT_SET, start, stride, count, block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
- /* Close uint8 dataset dataspace */
- ret = H5Sclose(sid3);
- CHECK(ret, FAIL, "H5Sclose");
+ ret = (int)H5Sget_select_npoints(sid3);
+ VERIFY(ret, (block[0] * count[0]), "H5Sget_select_npoints");
- /* Close file */
- ret = H5Fclose(fid1);
- CHECK(ret, FAIL, "H5Fclose");
+ /* Store first dataset region */
+ ret = H5Rcreate_region(fid1, "/Dataset2", sid3, H5P_DEFAULT, &wbuf[0]);
+ CHECK(ret, FAIL, "H5Rcreate_region");
+ ret = H5Rget_obj_type3(&wbuf[0], H5P_DEFAULT, &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type3");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
- /* Re-open the file */
- fid1 = H5Fopen(FILE_REF_REG_1D, H5F_ACC_RDWR, fapl);
- CHECK(fid1, H5I_INVALID_HID, "H5Fopen");
+ /* Select sequence of ten points for second reference */
+ coord1[0][0] = 16;
+ coord1[1][0] = 22;
+ coord1[2][0] = 38;
+ coord1[3][0] = 41;
+ coord1[4][0] = 52;
+ coord1[5][0] = 63;
+ coord1[6][0] = 70;
+ coord1[7][0] = 89;
+ coord1[8][0] = 97;
+ coord1[9][0] = 03;
+ ret = H5Sselect_elements(sid3, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
+ CHECK(ret, FAIL, "H5Sselect_elements");
+
+ ret = (int)H5Sget_select_npoints(sid3);
+ VERIFY(ret, POINT1_NPOINTS, "H5Sget_select_npoints");
+
+ /* Store second dataset region */
+ ret = H5Rcreate_region(fid1, "/Dataset2", sid3, H5P_DEFAULT, &wbuf[1]);
+ CHECK(ret, FAIL, "H5Rcreate_region");
- /* Open the dataset */
- dset1 = H5Dopen2(fid1, "/Dataset1", H5P_DEFAULT);
- CHECK(dset1, H5I_INVALID_HID, "H5Dopen2");
+ /* Write selection to disk */
+ ret = H5Dwrite(dset1, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
+ CHECK(ret, FAIL, "H5Dwrite");
- /* Read selection from disk */
- ret = H5Dread(dset1, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
- CHECK(ret, FAIL, "H5Dread");
+ /* Close disk dataspace */
+ ret = H5Sclose(sid1);
+ CHECK(ret, FAIL, "H5Sclose");
- /* Try to open objects */
- dset3 = H5Ropen_object(&rbuf[0], H5P_DEFAULT, dapl_id);
- CHECK(dset3, H5I_INVALID_HID, "H5Ropen_object");
+ /* Close Dataset */
+ ret = H5Dclose(dset1);
+ CHECK(ret, FAIL, "H5Dclose");
- /* Check what H5Rget_obj_type3 function returns */
- ret = H5Rget_obj_type3(&rbuf[0], H5P_DEFAULT, &obj_type);
- CHECK(ret, FAIL, "H5Rget_obj_type3");
- VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
+ /* Close uint8 dataset dataspace */
+ ret = H5Sclose(sid3);
+ CHECK(ret, FAIL, "H5Sclose");
- /* Check information in referenced dataset */
- sid1 = H5Dget_space(dset3);
- CHECK(sid1, H5I_INVALID_HID, "H5Dget_space");
+ /* Close file */
+ ret = H5Fclose(fid1);
+ CHECK(ret, FAIL, "H5Fclose");
- ret = (int)H5Sget_simple_extent_npoints(sid1);
- VERIFY(ret, SPACE3_DIM1, "H5Sget_simple_extent_npoints");
+ /* Re-open the file */
+ fid1 = H5Fopen(FILE_REF_REG_1D, H5F_ACC_RDWR, fapl);
+ CHECK(fid1, H5I_INVALID_HID, "H5Fopen");
- /* Read from disk */
- ret = H5Dread(dset3, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, drbuf);
- CHECK(ret, FAIL, "H5Dread");
+ /* Open the dataset */
+ dset1 = H5Dopen2(fid1, "/Dataset1", H5P_DEFAULT);
+ CHECK(dset1, H5I_INVALID_HID, "H5Dopen2");
- for(tu8 = (uint8_t *)drbuf, i = 0; i < SPACE3_DIM1; i++, tu8++)
- VERIFY(*tu8, (uint8_t)(i * 3), "Data");
-
- /* Get the hyperslab selection */
- sid3 = H5Ropen_region(&rbuf[0], H5P_DEFAULT, H5P_DEFAULT);
- CHECK(sid3, H5I_INVALID_HID, "H5Ropen_region");
-
- /* Verify correct hyperslab selected */
- ret = (int)H5Sget_select_npoints(sid3);
- VERIFY(ret, 30, "H5Sget_select_npoints");
- ret = (int)H5Sget_select_hyper_nblocks(sid3);
- VERIFY(ret, 15, "H5Sget_select_hyper_nblocks");
- coords = (hsize_t *)HDmalloc((size_t)ret * SPACE3_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */
- ret = H5Sget_select_hyper_blocklist(sid3, (hsize_t)0, (hsize_t)ret, coords);
- CHECK(ret, FAIL, "H5Sget_select_hyper_blocklist");
- VERIFY(coords[0], 2, "Hyperslab Coordinates");
- VERIFY(coords[1], 3, "Hyperslab Coordinates");
- VERIFY(coords[2], 7, "Hyperslab Coordinates");
- VERIFY(coords[3], 8, "Hyperslab Coordinates");
- VERIFY(coords[4], 12, "Hyperslab Coordinates");
- VERIFY(coords[5], 13, "Hyperslab Coordinates");
- VERIFY(coords[6], 17, "Hyperslab Coordinates");
- VERIFY(coords[7], 18, "Hyperslab Coordinates");
- VERIFY(coords[8], 22, "Hyperslab Coordinates");
- VERIFY(coords[9], 23, "Hyperslab Coordinates");
- VERIFY(coords[10], 27, "Hyperslab Coordinates");
- VERIFY(coords[11], 28, "Hyperslab Coordinates");
- VERIFY(coords[12], 32, "Hyperslab Coordinates");
- VERIFY(coords[13], 33, "Hyperslab Coordinates");
- VERIFY(coords[14], 37, "Hyperslab Coordinates");
- VERIFY(coords[15], 38, "Hyperslab Coordinates");
- VERIFY(coords[16], 42, "Hyperslab Coordinates");
- VERIFY(coords[17], 43, "Hyperslab Coordinates");
- VERIFY(coords[18], 47, "Hyperslab Coordinates");
- VERIFY(coords[19], 48, "Hyperslab Coordinates");
- VERIFY(coords[20], 52, "Hyperslab Coordinates");
- VERIFY(coords[21], 53, "Hyperslab Coordinates");
- VERIFY(coords[22], 57, "Hyperslab Coordinates");
- VERIFY(coords[23], 58, "Hyperslab Coordinates");
- VERIFY(coords[24], 62, "Hyperslab Coordinates");
- VERIFY(coords[25], 63, "Hyperslab Coordinates");
- VERIFY(coords[26], 67, "Hyperslab Coordinates");
- VERIFY(coords[27], 68, "Hyperslab Coordinates");
- VERIFY(coords[28], 72, "Hyperslab Coordinates");
- VERIFY(coords[29], 73, "Hyperslab Coordinates");
- HDfree(coords);
- ret = H5Sget_select_bounds(sid3, low, high);
- CHECK(ret, FAIL, "H5Sget_select_bounds");
- VERIFY(low[0], 2, "Selection Bounds");
- VERIFY(high[0], 73, "Selection Bounds");
-
- /* Close region space */
- ret = H5Sclose(sid3);
- CHECK(ret, FAIL, "H5Sclose");
+ /* Read selection from disk */
+ ret = H5Dread(dset1, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
+ CHECK(ret, FAIL, "H5Dread");
- /* Get the element selection */
- sid3 = H5Ropen_region(&rbuf[1], H5P_DEFAULT, H5P_DEFAULT);
- CHECK(sid3, H5I_INVALID_HID, "H5Ropen_region");
-
- /* Verify correct elements selected */
- ret = (int)H5Sget_select_npoints(sid3);
- VERIFY(ret, 10, "H5Sget_select_npoints");
- ret = (int)H5Sget_select_elem_npoints(sid3);
- VERIFY(ret, 10, "H5Sget_select_elem_npoints");
- coords = (hsize_t *)HDmalloc((size_t)ret * SPACE3_RANK * sizeof(hsize_t)); /* allocate space for the element points */
- ret = H5Sget_select_elem_pointlist(sid3, (hsize_t)0, (hsize_t)ret, coords);
- CHECK(ret, FAIL, "H5Sget_select_elem_pointlist");
- VERIFY(coords[0], coord1[0][0], "Element Coordinates");
- VERIFY(coords[1], coord1[1][0], "Element Coordinates");
- VERIFY(coords[2], coord1[2][0], "Element Coordinates");
- VERIFY(coords[3], coord1[3][0], "Element Coordinates");
- VERIFY(coords[4], coord1[4][0], "Element Coordinates");
- VERIFY(coords[5], coord1[5][0], "Element Coordinates");
- VERIFY(coords[6], coord1[6][0], "Element Coordinates");
- VERIFY(coords[7], coord1[7][0], "Element Coordinates");
- VERIFY(coords[8], coord1[8][0], "Element Coordinates");
- VERIFY(coords[9], coord1[9][0], "Element Coordinates");
- HDfree(coords);
- ret = H5Sget_select_bounds(sid3, low, high);
- CHECK(ret, FAIL, "H5Sget_select_bounds");
- VERIFY(low[0], 3, "Selection Bounds");
- VERIFY(high[0], 97, "Selection Bounds");
-
- /* Close region space */
- ret = H5Sclose(sid3);
- CHECK(ret, FAIL, "H5Sclose");
+ /* Try to open objects */
+ dset3 = H5Ropen_object(&rbuf[0], H5P_DEFAULT, dapl_id);
+ CHECK(dset3, H5I_INVALID_HID, "H5Ropen_object");
- /* Close first space */
- ret = H5Sclose(sid1);
- CHECK(ret, FAIL, "H5Sclose");
+ /* Check what H5Rget_obj_type3 function returns */
+ ret = H5Rget_obj_type3(&rbuf[0], H5P_DEFAULT, &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type3");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
- /* Close dereferenced Dataset */
- ret = H5Dclose(dset3);
- CHECK(ret, FAIL, "H5Dclose");
+ /* Check information in referenced dataset */
+ sid1 = H5Dget_space(dset3);
+ CHECK(sid1, H5I_INVALID_HID, "H5Dget_space");
- /* Close Dataset */
- ret = H5Dclose(dset1);
- CHECK(ret, FAIL, "H5Dclose");
+ ret = (int)H5Sget_simple_extent_npoints(sid1);
+ VERIFY(ret, SPACE3_DIM1, "H5Sget_simple_extent_npoints");
- /* Close dataset access property list */
- ret = H5Pclose(dapl_id);
- CHECK(ret, FAIL, "H5Pclose");
+ /* Read from disk */
+ ret = H5Dread(dset3, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, drbuf);
+ CHECK(ret, FAIL, "H5Dread");
- /* Close file access property list */
- ret = H5Pclose(fapl);
- CHECK(ret, FAIL, "H5Pclose");
+ for(tu8 = (uint8_t *)drbuf, i = 0; i < SPACE3_DIM1; i++, tu8++)
+ VERIFY(*tu8, (uint8_t)(i * 3), "Data");
- /* Close file */
- ret = H5Fclose(fid1);
- CHECK(ret, FAIL, "H5Fclose");
+ /* Get the hyperslab selection */
+ sid3 = H5Ropen_region(&rbuf[0], H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(sid3, H5I_INVALID_HID, "H5Ropen_region");
- /* Destroy references */
- for(i = 0; i < 2; i++) {
- ret = H5Rdestroy(&wbuf[i]);
- CHECK(ret, FAIL, "H5Rdestroy");
- ret = H5Rdestroy(&rbuf[i]);
- CHECK(ret, FAIL, "H5Rdestroy");
- }
+ /* Verify correct hyperslab selected */
+ ret = (int)H5Sget_select_npoints(sid3);
+ VERIFY(ret, 30, "H5Sget_select_npoints");
+ ret = (int)H5Sget_select_hyper_nblocks(sid3);
+ VERIFY(ret, 15, "H5Sget_select_hyper_nblocks");
- /* Free memory buffers */
- HDfree(wbuf);
- HDfree(rbuf);
- HDfree(dwbuf);
- HDfree(drbuf);
+ /* allocate space for the hyperslab blocks */
+ coords = (hsize_t *)HDmalloc((size_t)ret * SPACE3_RANK * sizeof(hsize_t) * 2);
+
+ ret = H5Sget_select_hyper_blocklist(sid3, (hsize_t)0, (hsize_t)ret, coords);
+ CHECK(ret, FAIL, "H5Sget_select_hyper_blocklist");
+ VERIFY(coords[0], 2, "Hyperslab Coordinates");
+ VERIFY(coords[1], 3, "Hyperslab Coordinates");
+ VERIFY(coords[2], 7, "Hyperslab Coordinates");
+ VERIFY(coords[3], 8, "Hyperslab Coordinates");
+ VERIFY(coords[4], 12, "Hyperslab Coordinates");
+ VERIFY(coords[5], 13, "Hyperslab Coordinates");
+ VERIFY(coords[6], 17, "Hyperslab Coordinates");
+ VERIFY(coords[7], 18, "Hyperslab Coordinates");
+ VERIFY(coords[8], 22, "Hyperslab Coordinates");
+ VERIFY(coords[9], 23, "Hyperslab Coordinates");
+ VERIFY(coords[10], 27, "Hyperslab Coordinates");
+ VERIFY(coords[11], 28, "Hyperslab Coordinates");
+ VERIFY(coords[12], 32, "Hyperslab Coordinates");
+ VERIFY(coords[13], 33, "Hyperslab Coordinates");
+ VERIFY(coords[14], 37, "Hyperslab Coordinates");
+ VERIFY(coords[15], 38, "Hyperslab Coordinates");
+ VERIFY(coords[16], 42, "Hyperslab Coordinates");
+ VERIFY(coords[17], 43, "Hyperslab Coordinates");
+ VERIFY(coords[18], 47, "Hyperslab Coordinates");
+ VERIFY(coords[19], 48, "Hyperslab Coordinates");
+ VERIFY(coords[20], 52, "Hyperslab Coordinates");
+ VERIFY(coords[21], 53, "Hyperslab Coordinates");
+ VERIFY(coords[22], 57, "Hyperslab Coordinates");
+ VERIFY(coords[23], 58, "Hyperslab Coordinates");
+ VERIFY(coords[24], 62, "Hyperslab Coordinates");
+ VERIFY(coords[25], 63, "Hyperslab Coordinates");
+ VERIFY(coords[26], 67, "Hyperslab Coordinates");
+ VERIFY(coords[27], 68, "Hyperslab Coordinates");
+ VERIFY(coords[28], 72, "Hyperslab Coordinates");
+ VERIFY(coords[29], 73, "Hyperslab Coordinates");
+ HDfree(coords);
+ ret = H5Sget_select_bounds(sid3, low, high);
+ CHECK(ret, FAIL, "H5Sget_select_bounds");
+ VERIFY(low[0], 2, "Selection Bounds");
+ VERIFY(high[0], 73, "Selection Bounds");
+
+ /* Close region space */
+ ret = H5Sclose(sid3);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Get the element selection */
+ sid3 = H5Ropen_region(&rbuf[1], H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(sid3, H5I_INVALID_HID, "H5Ropen_region");
+
+ /* Verify correct elements selected */
+ ret = (int)H5Sget_select_npoints(sid3);
+ VERIFY(ret, 10, "H5Sget_select_npoints");
+ ret = (int)H5Sget_select_elem_npoints(sid3);
+ VERIFY(ret, 10, "H5Sget_select_elem_npoints");
+
+ /* allocate space for the element points */
+ coords = (hsize_t *)HDmalloc((size_t)ret * SPACE3_RANK * sizeof(hsize_t));
+
+ ret = H5Sget_select_elem_pointlist(sid3, (hsize_t)0, (hsize_t)ret, coords);
+ CHECK(ret, FAIL, "H5Sget_select_elem_pointlist");
+ VERIFY(coords[0], coord1[0][0], "Element Coordinates");
+ VERIFY(coords[1], coord1[1][0], "Element Coordinates");
+ VERIFY(coords[2], coord1[2][0], "Element Coordinates");
+ VERIFY(coords[3], coord1[3][0], "Element Coordinates");
+ VERIFY(coords[4], coord1[4][0], "Element Coordinates");
+ VERIFY(coords[5], coord1[5][0], "Element Coordinates");
+ VERIFY(coords[6], coord1[6][0], "Element Coordinates");
+ VERIFY(coords[7], coord1[7][0], "Element Coordinates");
+ VERIFY(coords[8], coord1[8][0], "Element Coordinates");
+ VERIFY(coords[9], coord1[9][0], "Element Coordinates");
+ HDfree(coords);
+ ret = H5Sget_select_bounds(sid3, low, high);
+ CHECK(ret, FAIL, "H5Sget_select_bounds");
+ VERIFY(low[0], 3, "Selection Bounds");
+ VERIFY(high[0], 97, "Selection Bounds");
+
+ /* Close region space */
+ ret = H5Sclose(sid3);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close first space */
+ ret = H5Sclose(sid1);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close dereferenced Dataset */
+ ret = H5Dclose(dset3);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Close Dataset */
+ ret = H5Dclose(dset1);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Close dataset access property list */
+ ret = H5Pclose(dapl_id);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Close file access property list */
+ ret = H5Pclose(fapl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Close file */
+ ret = H5Fclose(fid1);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Destroy references */
+ for(i = 0; i < 2; i++) {
+ ret = H5Rdestroy(&wbuf[i]);
+ CHECK(ret, FAIL, "H5Rdestroy");
+ ret = H5Rdestroy(&rbuf[i]);
+ CHECK(ret, FAIL, "H5Rdestroy");
+ }
+
+ /* Free memory buffers */
+ HDfree(wbuf);
+ HDfree(rbuf);
+ HDfree(dwbuf);
+ HDfree(drbuf);
+
+ }
} /* test_reference_region_1D() */
/****************************************************************
@@ -2828,7 +2868,7 @@ test_reference(void)
for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
/* Invalid combinations, just continue */
- if(high <= H5F_LIBVER_V110 || high < low)
+ if(high == H5F_LIBVER_EARLIEST || high < low)
continue;
test_reference_region(low, high); /* Test basic H5R dataset region reference code */