summaryrefslogtreecommitdiffstats
path: root/test/trefer.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/trefer.c')
-rw-r--r--test/trefer.c128
1 files changed, 101 insertions, 27 deletions
diff --git a/test/trefer.c b/test/trefer.c
index 4ab3fba..dbecc53 100644
--- a/test/trefer.c
+++ b/test/trefer.c
@@ -75,6 +75,7 @@ test_reference_params(void)
hid_t group; /* Group ID */
hid_t sid1; /* Dataspace ID */
hid_t tid1; /* Datatype ID */
+ hid_t dapl_id; /* Dataset access property list */
hsize_t dims1[] = {SPACE1_DIM1};
hobj_ref_t *wbuf, /* buffer to write to disk */
*rbuf, /* buffer read from disk */
@@ -101,6 +102,10 @@ test_reference_params(void)
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
CHECK(sid1, FAIL, "H5Screate_simple");
+ /* Create dataset access property list */
+ dapl_id = H5Pcreate(H5P_DATASET_ACCESS);
+ CHECK(dapl_id, FAIL, "H5Pcreate");
+
/* Create a group */
group = H5Gcreate2(fid1, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(group, FAIL, "H5Gcreate2");
@@ -179,11 +184,11 @@ test_reference_params(void)
VERIFY(ret, FAIL, "H5Rcreate space");
/* Test parameters to H5Rdereference */
- dset2 = H5Rdereference(-1, H5R_OBJECT, &rbuf[0]);
+ dset2 = H5Rdereference2(-1, H5P_DATASET_ACCESS_DEFAULT, H5R_OBJECT, &rbuf[0]);
VERIFY(dset2, FAIL, "H5Rdereference loc_id");
- dset2 = H5Rdereference(dataset, H5R_OBJECT, NULL);
+ dset2 = H5Rdereference2(dataset, dapl_id, H5R_OBJECT, NULL);
VERIFY(dset2, FAIL, "H5Rdereference ref");
- dset2 = H5Rdereference(dataset, H5R_MAXTYPE, &rbuf[0]);
+ dset2 = H5Rdereference2(dataset, dapl_id, H5R_MAXTYPE, &rbuf[0]);
VERIFY(dset2, FAIL, "H5Rdereference type");
/* Test parameters to H5Rget_obj_type2 */
@@ -214,6 +219,10 @@ test_reference_params(void)
ret = H5Sclose(sid1);
CHECK(ret, FAIL, "H5Sclose");
+ /* Close dataset access property list */
+ ret = H5Pclose(dapl_id);
+ CHECK(ret, FAIL, "H5Pclose");
+
/* Close Dataset */
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
@@ -237,23 +246,24 @@ test_reference_params(void)
static void
test_reference_obj(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset, /* Dataset ID */
- dset2; /* Dereferenced dataset ID */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset, /* Dataset ID */
+ dset2; /* Dereferenced dataset ID */
hid_t group; /* Group ID */
hid_t sid1; /* Dataspace ID */
hid_t tid1; /* Datatype ID */
hsize_t dims1[] = {SPACE1_DIM1};
- hobj_ref_t *wbuf, /* buffer to write to disk */
- *rbuf, /* buffer read from disk */
- *tbuf; /* temp. buffer read from disk */
+ hid_t dapl_id; /* Dataset access property list */
+ hobj_ref_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf; /* temp. buffer read from disk */
hobj_ref_t nvrbuf[3]={0,101,1000000000}; /* buffer with non-valid refs */
- unsigned *tu32; /* Temporary pointer to uint32 data */
- int i, j; /* counting variables */
+ unsigned *tu32; /* Temporary pointer to uint32 data */
+ int i, j; /* counting variables */
const char *write_comment="Foo!"; /* Comments for group */
char read_comment[10];
- H5O_type_t obj_type; /* Object type */
- herr_t ret; /* Generic return value */
+ H5O_type_t obj_type; /* Object type */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Object Reference Functions\n"));
@@ -271,6 +281,10 @@ test_reference_obj(void)
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
CHECK(sid1, FAIL, "H5Screate_simple");
+ /* Create dataset access property list */
+ dapl_id = H5Pcreate(H5P_DATASET_ACCESS);
+ CHECK(dapl_id, FAIL, "H5Pcreate");
+
/* Create a group */
group = H5Gcreate2(fid1, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(group, FAIL, "H5Gcreate2");
@@ -389,7 +403,7 @@ test_reference_obj(void)
CHECK(ret, FAIL, "H5Dread");
/* Open dataset object */
- dset2 = H5Rdereference(dataset, H5R_OBJECT, &rbuf[0]);
+ dset2 = H5Rdereference2(dataset, dapl_id, H5R_OBJECT, &rbuf[0]);
CHECK(dset2, FAIL, "H5Rdereference");
/* Check information in referenced dataset */
@@ -410,8 +424,8 @@ test_reference_obj(void)
ret = H5Dclose(dset2);
CHECK(ret, FAIL, "H5Dclose");
- /* Open group object */
- group = H5Rdereference(dataset, H5R_OBJECT, &rbuf[2]);
+ /* Open group object. GAPL isn't supported yet. But it's harmless to pass in */
+ group = H5Rdereference2(dataset, H5P_GROUP_ACCESS_DEFAULT, H5R_OBJECT, &rbuf[2]);
CHECK(group, FAIL, "H5Rdereference");
/* Get group's comment */
@@ -426,8 +440,8 @@ test_reference_obj(void)
ret = H5Gclose(group);
CHECK(ret, FAIL, "H5Gclose");
- /* Open datatype object */
- tid1 = H5Rdereference(dataset, H5R_OBJECT, &rbuf[3]);
+ /* Open datatype object. TAPL isn't supported yet. But it's harmless to pass in */
+ tid1 = H5Rdereference2(dataset, H5P_DATATYPE_ACCESS_DEFAULT, H5R_OBJECT, &rbuf[3]);
CHECK(tid1, FAIL, "H5Rdereference");
/* Verify correct datatype */
@@ -457,6 +471,10 @@ test_reference_obj(void)
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
+ /* Close dataset access property list */
+ ret = H5Pclose(dapl_id);
+ CHECK(ret, FAIL, "H5Pclose");
+
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
@@ -481,6 +499,7 @@ test_reference_region(void)
dset2; /* Dereferenced dataset ID */
hid_t sid1, /* Dataspace ID #1 */
sid2; /* Dataspace ID #2 */
+ hid_t dapl_id; /* Dataset access property list */
hsize_t dims1[] = {SPACE1_DIM1},
dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
@@ -518,6 +537,10 @@ test_reference_region(void)
sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL);
CHECK(sid2, FAIL, "H5Screate_simple");
+ /* Create dataset access property list */
+ dapl_id = H5Pcreate(H5P_DATASET_ACCESS);
+ CHECK(dapl_id, FAIL, "H5Pcreate");
+
/* Create a dataset */
dset2 = H5Dcreate2(fid1, "Dataset2", H5T_STD_U8LE, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dset2, FAIL, "H5Dcreate2");
@@ -615,7 +638,7 @@ test_reference_region(void)
CHECK(ret, FAIL, "H5Dread");
/* Try to open objects */
- dset2 = H5Rdereference(dset1, H5R_DATASET_REGION, &rbuf[0]);
+ dset2 = H5Rdereference2(dset1, dapl_id, H5R_DATASET_REGION, &rbuf[0]);
CHECK(dset2, FAIL, "H5Rdereference");
/* Check what H5Rget_obj_type2 function returns */
@@ -729,6 +752,10 @@ test_reference_region(void)
ret = H5Dclose(dset1);
CHECK(ret, FAIL, "H5Dclose");
+ /* Close dataset access property list */
+ ret = H5Pclose(dapl_id);
+ CHECK(ret, FAIL, "H5Pclose");
+
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
@@ -754,6 +781,7 @@ test_reference_region_1D(void)
dset3; /* Dereferenced dataset ID */
hid_t sid1, /* Dataspace ID #1 */
sid3; /* Dataspace ID #3 */
+ hid_t dapl_id; /* Dataset access property list */
hsize_t dims1[] = {SPACE1_DIM1},
dims3[] = {SPACE3_DIM1};
hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */
@@ -790,6 +818,10 @@ test_reference_region_1D(void)
sid3 = H5Screate_simple(SPACE3_RANK, dims3, NULL);
CHECK(sid3, FAIL, "H5Screate_simple");
+ /* Create dataset access property list */
+ dapl_id = H5Pcreate(H5P_DATASET_ACCESS);
+ CHECK(dapl_id, FAIL, "H5Pcreate");
+
/* Create a dataset */
dset3 = H5Dcreate2(fid1, "Dataset2", H5T_STD_U8LE, sid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dset3, FAIL, "H5Dcreate2");
@@ -887,7 +919,7 @@ test_reference_region_1D(void)
CHECK(ret, FAIL, "H5Dread");
/* Try to open objects */
- dset3 = H5Rdereference(dset1, H5R_DATASET_REGION, &rbuf[0]);
+ dset3 = H5Rdereference2(dset1, dapl_id, H5R_DATASET_REGION, &rbuf[0]);
CHECK(dset3, FAIL, "H5Rdereference");
/* Check what H5Rget_obj_type2 function returns */
@@ -1005,6 +1037,10 @@ test_reference_region_1D(void)
ret = H5Dclose(dset1);
CHECK(ret, FAIL, "H5Dclose");
+ /* Close dataset access property list */
+ ret = H5Pclose(dapl_id);
+ CHECK(ret, FAIL, "H5Pclose");
+
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
@@ -1094,12 +1130,12 @@ test_reference_obj_deleted(void)
CHECK(ret, FAIL, "H5Dread");
/* Open deleted dataset object */
- dset2 = H5Rdereference(dataset, H5R_OBJECT, &oref);
+ dset2 = H5Rdereference2(dataset, H5P_DATASET_ACCESS_DEFAULT, H5R_OBJECT, &oref);
VERIFY(dset2, FAIL, "H5Rdereference");
/* Open nonsense reference */
HDmemset(&oref, 0, sizeof(hobj_ref_t));
- dset2 = H5Rdereference(dataset, H5R_OBJECT, &oref);
+ dset2 = H5Rdereference2(dataset, H5P_DATASET_ACCESS_DEFAULT, H5R_OBJECT, &oref);
VERIFY(dset2, FAIL, "H5Rdereference");
/* Close Dataset */
@@ -1238,7 +1274,7 @@ test_reference_group(void)
CHECK(ret, FAIL, "H5Dread");
/* Dereference to get the group */
- gid = H5Rdereference(did, H5R_OBJECT, &rref);
+ gid = H5Rdereference2(did, H5P_GROUP_ACCESS_DEFAULT, H5R_OBJECT, &rref);
CHECK(gid, FAIL, "H5Rdereference");
/* Iterate through objects in dereferenced group */
@@ -1286,11 +1322,11 @@ static void
test_reference_compat(void)
{
hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t group; /* Group ID */
+ hid_t dataset, dset2; /* Dataset ID */
+ hid_t group, group2; /* Group ID */
hid_t sid1, /* Dataspace IDs */
sid2;
- hid_t tid1; /* Datatype ID */
+ hid_t tid1, tid2; /* Datatype ID */
hsize_t dims1[] = {SPACE1_DIM1},
dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
@@ -1485,6 +1521,32 @@ test_reference_compat(void)
CHECK(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1");
VERIFY(obj_type, H5G_TYPE, "H5Rget_obj_type1");
+
+ /* Make sure the referenced objects can be opened */
+ dset2 = H5Rdereference1(dataset, H5R_OBJECT, &rbuf_obj[0]);
+ CHECK(dset2, FAIL, "H5Rdereference1");
+
+ ret = H5Dclose(dset2);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ dset2 = H5Rdereference1(dataset, H5R_OBJECT, &rbuf_obj[1]);
+ CHECK(dset2, FAIL, "H5Rdereference1");
+
+ ret = H5Dclose(dset2);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ group2 = H5Rdereference1(dataset, H5R_OBJECT, &rbuf_obj[2]);
+ CHECK(group2, FAIL, "H5Rdereference1");
+
+ ret = H5Gclose(group2);
+ CHECK(ret, FAIL, "H5Gclose");
+
+ tid2 = H5Rdereference1(dataset, H5R_OBJECT, &rbuf_obj[3]);
+ CHECK(tid2, FAIL, "H5Rdereference1");
+
+ ret = H5Tclose(tid2);
+ CHECK(ret, FAIL, "H5Tclose");
+
/* Close Dataset */
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
@@ -1513,11 +1575,23 @@ test_reference_compat(void)
obj_type = H5Rget_obj_type1(dataset, H5R_DATASET_REGION, &rbuf_reg[3]);
VERIFY(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1");
+ /* Make sure the referenced objects can be opened */
+ dset2 = H5Rdereference1(dataset, H5R_DATASET_REGION, &rbuf_reg[0]);
+ CHECK(dset2, FAIL, "H5Rdereference1");
+
+ ret = H5Dclose(dset2);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ dset2 = H5Rdereference1(dataset, H5R_DATASET_REGION, &rbuf_reg[1]);
+ CHECK(dset2, FAIL, "H5Rdereference1");
+
+ ret = H5Dclose(dset2);
+ CHECK(ret, FAIL, "H5Dclose");
+
/* Close Dataset */
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
-
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");