[svn-r27546] Add tests for H5O__dset_bh_info (H5Oget_info) and unlimited selections in a

region reference.

Tested: ummon
This commit is contained in:
Neil Fortner 2015-08-21 14:57:29 -05:00
parent 1821b64d49
commit 32bf83f1cf
4 changed files with 73 additions and 13 deletions

View File

@ -401,9 +401,7 @@ H5O__dset_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
else if(layout.type == H5D_VIRTUAL
&& (layout.storage.u.virt.serial_list_hobjid.addr != HADDR_UNDEF)) {
size_t virtual_heap_size;
/* Need to write a test for this. No assert here for now because the
* code is reached by h5_verify_cached_stabs() but it is not properly
* tested. VDSINC */
/* Get size of global heap object for virtual dataset */
if(H5HG_get_obj_size(f, dxpl_id, &(layout.storage.u.virt.serial_list_hobjid), &virtual_heap_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get global heap size for virtual dataset mapping")

View File

@ -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");

View File

@ -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");

View File

@ -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 */