summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2015-08-21 19:57:29 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2015-08-21 19:57:29 (GMT)
commit32bf83f1cf00df5079d8a5e2f16422a28d1fa53d (patch)
tree482f580ff8909e18ebeba05807b2a219de6813b3 /test
parent1821b64d49521335c4b364d8504e57782120419b (diff)
downloadhdf5-32bf83f1cf00df5079d8a5e2f16422a28d1fa53d.zip
hdf5-32bf83f1cf00df5079d8a5e2f16422a28d1fa53d.tar.gz
hdf5-32bf83f1cf00df5079d8a5e2f16422a28d1fa53d.tar.bz2
[svn-r27546] Add tests for H5O__dset_bh_info (H5Oget_info) and unlimited selections in a
region reference. Tested: ummon
Diffstat (limited to 'test')
-rw-r--r--test/trefer.c45
-rw-r--r--test/tselect.c2
-rw-r--r--test/vds.c35
3 files changed, 72 insertions, 10 deletions
diff --git a/test/trefer.c b/test/trefer.c
index 203b602..4b1f36b 100644
--- a/test/trefer.c
+++ b/test/trefer.c
@@ -521,6 +521,8 @@ test_reference_region(void)
uint8_t *tu8; /* Temporary pointer to uint8 data */
H5O_type_t obj_type; /* Type of object */
int i, j; /* counting variables */
+ hssize_t hssize_ret; /* hssize_t return value */
+ htri_t tri_ret; /* htri_t return value */
herr_t ret; /* Generic return value */
haddr_t addr = HADDR_UNDEF; /* test for undefined reference */
hid_t dset_NA; /* Dataset id for undefined reference */
@@ -614,6 +616,24 @@ test_reference_region(void)
ret = H5Rcreate(&wbuf[1], fid1, "/Dataset2", H5R_DATASET_REGION, sid2);
CHECK(ret, FAIL, "H5Rcreate");
+ /* 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");
+
+ hssize_ret = H5Sget_select_npoints(sid2);
+ VERIFY(hssize_ret, (hssize_t)H5S_UNLIMITED, "H5Sget_select_npoints");
+
+ /* Store third dataset region */
+ ret = H5Rcreate(&wbuf[2], fid1, "/Dataset2", H5R_DATASET_REGION, sid2);
+ CHECK(ret, FAIL, "H5Rcreate");
+ ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &wbuf[0], &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type2");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
+
/* Write selection to disk */
ret = H5Dwrite(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
@@ -805,6 +825,31 @@ test_reference_region(void)
ret = H5Sclose(sid2);
CHECK(ret, FAIL, "H5Sclose");
+ /* Get the unlimited selection */
+ sid2 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf[2]);
+ CHECK(sid2, FAIL, "H5Rget_region");
+
+ /* Verify correct hyperslab selected */
+ hssize_ret = H5Sget_select_npoints(sid2);
+ VERIFY(hssize_ret, (hssize_t)H5S_UNLIMITED, "H5Sget_select_npoints");
+ tri_ret = H5Sis_regular_hyperslab(sid2);
+ CHECK(tri_ret, FAIL, "H5Sis_regular_hyperslab");
+ VERIFY(tri_ret, TRUE, "H5Sis_regular_hyperslab Result");
+ ret = H5Sget_regular_hyperslab(sid2, start, stride, count, block);
+ CHECK(ret, FAIL, "H5Sget_regular_hyperslab");
+ VERIFY(start[0], (hsize_t)1, "Hyperslab Coordinates");
+ VERIFY(start[1], (hsize_t)8, "Hyperslab Coordinates");
+ VERIFY(stride[0], (hsize_t)4, "Hyperslab Coordinates");
+ VERIFY(stride[1], (hsize_t)1, "Hyperslab Coordinates");
+ VERIFY(count[0], H5S_UNLIMITED, "Hyperslab Coordinates");
+ VERIFY(count[1], (hsize_t)1, "Hyperslab Coordinates");
+ VERIFY(block[0], (hsize_t)2, "Hyperslab Coordinates");
+ VERIFY(block[1], (hsize_t)2, "Hyperslab Coordinates");
+
+ /* Close region space */
+ ret = H5Sclose(sid2);
+ CHECK(ret, FAIL, "H5Sclose");
+
/* Close first space */
ret = H5Sclose(sid1);
CHECK(ret, FAIL, "H5Sclose");
diff --git a/test/tselect.c b/test/tselect.c
index 2a975d0..2062e73 100644
--- a/test/tselect.c
+++ b/test/tselect.c
@@ -13656,8 +13656,6 @@ test_hyper_unlim(void)
VERIFY(count2[1], H5S_UNLIMITED, "H5Sget_select_bounds");
VERIFY(count2[2], start[2] + (stride[2] * (count[2] - (hsize_t)1)) + block[2] - (hsize_t)1, "H5Sget_select_bounds");
- //VDSINC write test saving unlim selection to file as region reference
-
/* Close the dataspace */
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
diff --git a/test/vds.c b/test/vds.c
index 1a86708..5cdcef4 100644
--- a/test/vds.c
+++ b/test/vds.c
@@ -327,11 +327,12 @@ error:
/* Helper function to get DCPL for examination depending on config */
static int
test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl,
- hid_t *ex_dcpl, hid_t vspace, char *filename)
+ hid_t *ex_dcpl, hid_t vspace, char *filename, hsize_t exp_meta_size)
{
hid_t file = -1; /* File */
hid_t dset = -1; /* Virtual dataset */
void *plist_buf = NULL; /* Serialized property list buffer */
+ H5O_info_t oinfo; /* Object info struct */
htri_t tri_ret;
HDassert((config >= TEST_API_BASIC) && (config < TEST_API_NTESTS));
@@ -379,6 +380,24 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl,
if(HADDR_UNDEF != H5Dget_offset(dset))
TEST_ERROR
+ /* Test H5Oget_info returns correct metadata size */
+ if(H5Oget_info(dset, &oinfo) < 0)
+ TEST_ERROR
+ if(oinfo.meta_size.obj.index_size != (hsize_t)0)
+ TEST_ERROR
+ if(config == TEST_API_REOPEN_FILE) {
+ if(oinfo.meta_size.obj.heap_size != exp_meta_size) { printf("%llu\n", (long long unsigned)oinfo.meta_size.obj.heap_size);
+ TEST_ERROR }
+ } /* end if */
+ else
+ if((oinfo.meta_size.obj.heap_size != exp_meta_size)
+ && (oinfo.meta_size.obj.heap_size != (hsize_t)0))
+ TEST_ERROR
+ if(oinfo.meta_size.attr.index_size != (hsize_t)0)
+ TEST_ERROR
+ if(oinfo.meta_size.attr.index_size != (hsize_t)0)
+ TEST_ERROR
+
/* Close dataset */
if(H5Dclose(dset) < 0)
TEST_ERROR
@@ -531,7 +550,7 @@ test_api(test_api_config_t config, hid_t fapl)
TEST_ERROR
/* Get examination DCPL */
- if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename) < 0)
+ if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)68) < 0)
TEST_ERROR
/* Test H5Pget_virtual_count */
@@ -602,7 +621,7 @@ test_api(test_api_config_t config, hid_t fapl)
TEST_ERROR
/* Get examination DCPL */
- if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename) < 0)
+ if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)212) < 0)
TEST_ERROR
/* Test H5Pget_virtual_count */
@@ -676,7 +695,7 @@ test_api(test_api_config_t config, hid_t fapl)
TEST_ERROR
/* Get examination DCPL */
- if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename) < 0)
+ if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)0) < 0)
TEST_ERROR
/* Test H5Pget_virtual_count */
@@ -745,7 +764,7 @@ test_api(test_api_config_t config, hid_t fapl)
TEST_ERROR
/* Get examination DCPL */
- if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename) < 0)
+ if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)0) < 0)
TEST_ERROR
/* Test H5Pget_virtual_count */
@@ -878,7 +897,7 @@ test_api(test_api_config_t config, hid_t fapl)
TEST_ERROR
/* Get examination DCPL */
- if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename) < 0)
+ if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)0) < 0)
TEST_ERROR
/* Test H5Pget_virtual_count */
@@ -1009,7 +1028,7 @@ test_api(test_api_config_t config, hid_t fapl)
} /* end if */
/* Get examination DCPL */
- if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename) < 0)
+ if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)696) < 0)
TEST_ERROR
/* Test H5Pget_virtual_count */
@@ -1063,7 +1082,7 @@ test_api(test_api_config_t config, hid_t fapl)
TEST_ERROR
/* Get examination DCPL */
- if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename) < 0)
+ if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)0) < 0)
TEST_ERROR
/* Test H5Pget_virtual_count */