summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/cache_common.h4
-rw-r--r--test/dtypes.c8
-rw-r--r--test/tattr.c189
-rw-r--r--test/titerate.c10
4 files changed, 186 insertions, 25 deletions
diff --git a/test/cache_common.h b/test/cache_common.h
index ed3b857..23832dc 100644
--- a/test/cache_common.h
+++ b/test/cache_common.h
@@ -486,8 +486,8 @@ extern const char * entry_type_names[NUMBER_OF_ENTRY_TYPES];
/* call back function declarations: */
-herr_t check_write_permitted(const H5F_t UNUSED * f,
- hid_t UNUSED dxpl_id,
+herr_t check_write_permitted(const H5F_t * f,
+ hid_t dxpl_id,
hbool_t * write_permitted_ptr);
herr_t pico_clear(H5F_t * f, void * thing, hbool_t dest);
diff --git a/test/dtypes.c b/test/dtypes.c
index ea56056..15f2b92 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -94,11 +94,11 @@ typedef enum dtype_t {
static int num_opaque_conversions_g = 0;
static int opaque_check(int tag_it);
-static herr_t convert_opaque(hid_t UNUSED st, hid_t UNUSED dt,
+static herr_t convert_opaque(hid_t st, hid_t dt,
H5T_cdata_t *cdata,
- size_t UNUSED nelmts, size_t UNUSED buf_stride,
- size_t UNUSED bkg_stride, void UNUSED *_buf,
- void UNUSED *bkg, hid_t UNUSED dset_xfer_plid);
+ size_t nelmts, size_t buf_stride,
+ size_t bkg_stride, void *_buf,
+ void *bkg, hid_t dset_xfer_plid);
static int opaque_long(void);
static int opaque_funcs(void);
diff --git a/test/tattr.c b/test/tattr.c
index 5bf24f4..201989a 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -1448,7 +1448,7 @@ test_attr_iterate(hid_t fapl)
/* Iterate over attributes on dataset */
count = 0;
- ret = H5Aiterate2(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, attr_op1, &count, H5P_DEFAULT);
+ ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, NULL, attr_op1, &count);
VERIFY(ret, 0, "H5Aiterate2");
/* Close dataset */
@@ -1466,7 +1466,7 @@ test_attr_iterate(hid_t fapl)
/* Iterate over attributes on dataset */
count = 0;
- ret = H5Aiterate2(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, attr_op1, &count, H5P_DEFAULT);
+ ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, NULL, attr_op1, &count);
VERIFY(ret, 0, "H5Aiterate2");
/* Close dataset */
@@ -5694,8 +5694,9 @@ attr_iterate2_fail_cb(hid_t UNUSED group_id, const char UNUSED *attr_name,
*-------------------------------------------------------------------------
*/
static int
-attr_iterate_check(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
- unsigned max_attrs, attr_iter_info_t *iter_info)
+attr_iterate_check(hid_t fid, const char *dsetname, hid_t obj_id,
+ H5_index_t idx_type, H5_iter_order_t order, unsigned max_attrs,
+ attr_iter_info_t *iter_info)
{
unsigned v; /* Local index variable */
hsize_t skip; /* # of attributes to skip on object */
@@ -5715,7 +5716,7 @@ attr_iterate_check(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
iter_info->ncalled = 0;
iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- ret = H5Aiterate2(obj_id, ".", idx_type, order, &skip, attr_iterate2_cb, iter_info, H5P_DEFAULT);
+ ret = H5Aiterate2(obj_id, idx_type, order, &skip, attr_iterate2_cb, iter_info);
CHECK(ret, FAIL, "H5Aiterate2");
/* Verify that we visited all the attributes */
@@ -5724,6 +5725,38 @@ attr_iterate_check(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
VERIFY(iter_info->visited[v], TRUE, "H5Aiterate2");
+ /* Iterate over attributes on object */
+ iter_info->nskipped = (unsigned)(skip = 0);
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1);
+ HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
+ ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, &skip, attr_iterate2_cb, iter_info, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Aiterate_by_name");
+
+ /* Verify that we visited all the attributes */
+ VERIFY(skip, max_attrs, "H5Aiterate_by_name");
+ for(v = 0; v < max_attrs; v++)
+ VERIFY(iter_info->visited[v], TRUE, "H5Aiterate_by_name");
+
+
+ /* Iterate over attributes on object */
+ iter_info->nskipped = (unsigned)(skip = 0);
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1);
+ HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
+ ret = H5Aiterate_by_name(obj_id, ".", idx_type, order, &skip, attr_iterate2_cb, iter_info, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Aiterate_by_name");
+
+ /* Verify that we visited all the attributes */
+ VERIFY(skip, max_attrs, "H5Aiterate_by_name");
+ for(v = 0; v < max_attrs; v++)
+ VERIFY(iter_info->visited[v], TRUE, "H5Aiterate_by_name");
+
+
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Iterate over attributes on object, with H5Aiterate1 */
iter_info->nskipped = oskip = 0;
@@ -5749,7 +5782,7 @@ attr_iterate_check(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
iter_info->ncalled = 0;
iter_info->curr = order != H5_ITER_DEC ? skip : ((max_attrs - 1) - skip);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- ret = H5Aiterate2(obj_id, ".", idx_type, order, &skip, attr_iterate2_cb, iter_info, H5P_DEFAULT);
+ ret = H5Aiterate2(obj_id, idx_type, order, &skip, attr_iterate2_cb, iter_info);
CHECK(ret, FAIL, "H5Aiterate2");
/* Verify that we visited all the attributes */
@@ -5774,6 +5807,70 @@ attr_iterate_check(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
} /* end else */
+ /* Skip over some attributes on object */
+ iter_info->nskipped = (unsigned)(skip = max_attrs / 2);
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? skip : ((max_attrs - 1) - skip);
+ HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
+ ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, &skip, attr_iterate2_cb, iter_info, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Aiterate_by_name");
+
+ /* Verify that we visited all the attributes */
+ VERIFY(skip, max_attrs, "H5Aiterate_by_name");
+ if(order == H5_ITER_INC) {
+ for(v = 0; v < (max_attrs / 2); v++)
+ VERIFY(iter_info->visited[v + (max_attrs / 2)], TRUE, "H5Aiterate_by_name");
+ } /* end if */
+ else if(order == H5_ITER_DEC) {
+ for(v = 0; v < (max_attrs / 2); v++)
+ VERIFY(iter_info->visited[v], TRUE, "H5Aiterate_by_name");
+ } /* end if */
+ else {
+ unsigned nvisit = 0; /* # of links visited */
+
+ HDassert(order == H5_ITER_NATIVE);
+ for(v = 0; v < max_attrs; v++)
+ if(iter_info->visited[v] == TRUE)
+ nvisit++;
+
+ VERIFY(skip, (max_attrs / 2), "H5Aiterate_by_name");
+ } /* end else */
+
+
+ /* Skip over some attributes on object */
+ iter_info->nskipped = (unsigned)(skip = max_attrs / 2);
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? skip : ((max_attrs - 1) - skip);
+ HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
+ ret = H5Aiterate_by_name(obj_id, ".", idx_type, order, &skip, attr_iterate2_cb, iter_info, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Aiterate_by_name");
+
+ /* Verify that we visited all the attributes */
+ VERIFY(skip, max_attrs, "H5Aiterate_by_name");
+ if(order == H5_ITER_INC) {
+ for(v = 0; v < (max_attrs / 2); v++)
+ VERIFY(iter_info->visited[v + (max_attrs / 2)], TRUE, "H5Aiterate_by_name");
+ } /* end if */
+ else if(order == H5_ITER_DEC) {
+ for(v = 0; v < (max_attrs / 2); v++)
+ VERIFY(iter_info->visited[v], TRUE, "H5Aiterate_by_name");
+ } /* end if */
+ else {
+ unsigned nvisit = 0; /* # of links visited */
+
+ HDassert(order == H5_ITER_NATIVE);
+ for(v = 0; v < max_attrs; v++)
+ if(iter_info->visited[v] == TRUE)
+ nvisit++;
+
+ VERIFY(skip, (max_attrs / 2), "H5Aiterate_by_name");
+ } /* end else */
+
+
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Skip over some attributes on object, with H5Aiterate1 */
iter_info->nskipped = oskip = max_attrs / 2;
@@ -5815,12 +5912,38 @@ attr_iterate_check(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
iter_info->ncalled = 0;
iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- ret = H5Aiterate2(obj_id, ".", idx_type, order, &skip, attr_iterate2_cb, iter_info, H5P_DEFAULT);
+ ret = H5Aiterate2(obj_id, idx_type, order, &skip, attr_iterate2_cb, iter_info);
CHECK(ret, FAIL, "H5Aiterate2");
VERIFY(ret, CORDER_ITER_STOP, "H5Aiterate2");
VERIFY(iter_info->ncalled, 3, "H5Aiterate2");
+ /* Iterate over attributes on object, stopping in the middle */
+ iter_info->nskipped = (unsigned)(skip = 0);
+ iter_info->order = order;
+ iter_info->stop = 3;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1);
+ HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
+ ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, &skip, attr_iterate2_cb, iter_info, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Aiterate_by_name");
+ VERIFY(ret, CORDER_ITER_STOP, "H5Aiterate_by_name");
+ VERIFY(iter_info->ncalled, 3, "H5Aiterate_by_name");
+
+
+ /* Iterate over attributes on object, stopping in the middle */
+ iter_info->nskipped = (unsigned)(skip = 0);
+ iter_info->order = order;
+ iter_info->stop = 3;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1);
+ HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
+ ret = H5Aiterate_by_name(obj_id, ".", idx_type, order, &skip, attr_iterate2_cb, iter_info, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Aiterate_by_name");
+ VERIFY(ret, CORDER_ITER_STOP, "H5Aiterate_by_name");
+ VERIFY(iter_info->ncalled, 3, "H5Aiterate_by_name");
+
+
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Iterate over attributes on object, stopping in the middle, with H5Aiterate1() */
iter_info->nskipped = oskip = 0;
@@ -5838,9 +5961,17 @@ attr_iterate_check(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
/* Check for iteration routine indicating failure */
skip = 0;
- ret = H5Aiterate2(obj_id, ".", idx_type, order, &skip, attr_iterate2_fail_cb, NULL, H5P_DEFAULT);
+ ret = H5Aiterate2(obj_id, idx_type, order, &skip, attr_iterate2_fail_cb, NULL);
VERIFY(ret, FAIL, "H5Aiterate2");
+ skip = 0;
+ ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, &skip, attr_iterate2_fail_cb, NULL, H5P_DEFAULT);
+ VERIFY(ret, FAIL, "H5Aiterate_by_name");
+
+ skip = 0;
+ ret = H5Aiterate_by_name(obj_id, ".", idx_type, order, &skip, attr_iterate2_fail_cb, NULL, H5P_DEFAULT);
+ VERIFY(ret, FAIL, "H5Aiterate_by_name");
+
/* Retrieve current # of errors */
if(old_nerrs == GetTestNumErrs())
return(0);
@@ -5877,6 +6008,7 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
hbool_t *visited = NULL; /* Array of flags for visiting links */
hsize_t idx; /* Start index for iteration */
hbool_t use_index; /* Use index on creation order values */
+ const char *dsetname; /* Name of dataset for attributes */
char attrname[NAME_BUF_SIZE]; /* Name of attribute */
unsigned curr_dset; /* Current dataset to work on */
unsigned u; /* Local index variable */
@@ -5959,14 +6091,17 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
switch(curr_dset) {
case 0:
my_dataset = dset1;
+ dsetname = DSET1_NAME;
break;
case 1:
my_dataset = dset2;
+ dsetname = DSET2_NAME;
break;
case 2:
my_dataset = dset3;
+ dsetname = DSET3_NAME;
break;
default:
@@ -5980,9 +6115,15 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test");
/* Check for iterating over object with no attributes (should be OK) */
- ret = H5Aiterate2(my_dataset, ".", idx_type, order, NULL, attr_iterate2_cb, NULL, H5P_DEFAULT);
+ ret = H5Aiterate2(my_dataset, idx_type, order, NULL, attr_iterate2_cb, NULL);
CHECK(ret, FAIL, "H5Aiterate2");
+ ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, NULL, attr_iterate2_cb, NULL, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Aiterate_by_name");
+
+ ret = H5Aiterate_by_name(my_dataset, ".", idx_type, order, NULL, attr_iterate2_cb, NULL, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Aiterate_by_name");
+
/* Create attributes, up to limit of compact form */
for(u = 0; u < max_compact; u++) {
/* Create attribute */
@@ -6014,11 +6155,19 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Check for out of bound iteration */
idx = u;
- ret = H5Aiterate2(my_dataset, ".", idx_type, order, &idx, attr_iterate2_cb, NULL, H5P_DEFAULT);
+ ret = H5Aiterate2(my_dataset, idx_type, order, &idx, attr_iterate2_cb, NULL);
VERIFY(ret, FAIL, "H5Aiterate2");
+ idx = u;
+ ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, &idx, attr_iterate2_cb, NULL, H5P_DEFAULT);
+ VERIFY(ret, FAIL, "H5Aiterate_by_name");
+
+ idx = u;
+ ret = H5Aiterate_by_name(my_dataset, ".", idx_type, order, &idx, attr_iterate2_cb, NULL, H5P_DEFAULT);
+ VERIFY(ret, FAIL, "H5Aiterate_by_name");
+
/* Test iteration over attributes stored compactly */
- ret = attr_iterate_check(my_dataset, idx_type, order, u, &iter_info);
+ ret = attr_iterate_check(fid, dsetname, my_dataset, idx_type, order, u, &iter_info);
CHECK(ret, FAIL, "attr_iterate_check");
} /* end for */
@@ -6028,14 +6177,17 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
switch(curr_dset) {
case 0:
my_dataset = dset1;
+ dsetname = DSET1_NAME;
break;
case 1:
my_dataset = dset2;
+ dsetname = DSET2_NAME;
break;
case 2:
my_dataset = dset3;
+ dsetname = DSET3_NAME;
break;
default:
@@ -6088,11 +6240,19 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Check for out of bound iteration */
idx = u;
- ret = H5Aiterate2(my_dataset, ".", idx_type, order, &idx, attr_iterate2_cb, NULL, H5P_DEFAULT);
+ ret = H5Aiterate2(my_dataset, idx_type, order, &idx, attr_iterate2_cb, NULL);
VERIFY(ret, FAIL, "H5Aiterate2");
+ idx = u;
+ ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, &idx, attr_iterate2_cb, NULL, H5P_DEFAULT);
+ VERIFY(ret, FAIL, "H5Aiterate_by_name");
+
+ idx = u;
+ ret = H5Aiterate_by_name(my_dataset, ".", idx_type, order, &idx, attr_iterate2_cb, NULL, H5P_DEFAULT);
+ VERIFY(ret, FAIL, "H5Aiterate_by_name");
+
/* Test iteration over attributes stored densely */
- ret = attr_iterate_check(my_dataset, idx_type, order, u, &iter_info);
+ ret = attr_iterate_check(fid, dsetname, my_dataset, idx_type, order, u, &iter_info);
CHECK(ret, FAIL, "attr_iterate_check");
} /* end for */
@@ -6459,7 +6619,8 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
*-------------------------------------------------------------------------
*/
static int
-attr_open_check(hid_t fid, const char *dsetname, hid_t obj_id, unsigned max_attrs)
+attr_open_check(hid_t fid, const char *dsetname, hid_t obj_id,
+ unsigned max_attrs)
{
hid_t attr_id; /* ID of attribute to test */
H5A_info_t ainfo; /* Attribute info */
diff --git a/test/titerate.c b/test/titerate.c
index 0579123..5b354ce 100644
--- a/test/titerate.c
+++ b/test/titerate.c
@@ -443,28 +443,28 @@ static void test_iter_attr(hid_t fapl, hbool_t new_format)
/* Test skipping exactly as many attributes as there are */
idx = NATTR;
H5E_BEGIN_TRY {
- ret = H5Aiterate2(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info, H5P_DEFAULT);
+ ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info);
} H5E_END_TRY;
VERIFY(ret, FAIL, "H5Aiterate2");
/* Test skipping more attributes than there are */
idx = NATTR + 1;
H5E_BEGIN_TRY {
- ret = H5Aiterate2(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info, H5P_DEFAULT);
+ ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info);
} H5E_END_TRY;
VERIFY(ret, FAIL, "H5Aiterate2");
/* Test all attributes on dataset, when callback always returns 0 */
info.command = RET_ZERO;
idx = 0;
- if((ret = H5Aiterate2(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info, H5P_DEFAULT)) > 0)
+ if((ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info)) > 0)
TestErrPrintf("Attribute iteration function didn't return zero correctly!\n");
/* Test all attributes on dataset, when callback always returns 1 */
/* This also tests the "restarting" ability, because the index changes */
info.command = RET_TWO;
idx = i = 0;
- while((ret = H5Aiterate2(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info, H5P_DEFAULT)) > 0) {
+ while((ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info)) > 0) {
/* Verify return value from iterator gets propagated correctly */
VERIFY(ret, 2, "H5Aiterate2");
@@ -490,7 +490,7 @@ static void test_iter_attr(hid_t fapl, hbool_t new_format)
/* This also tests the "restarting" ability, because the index changes */
info.command = new_format ? RET_CHANGE2 : RET_CHANGE;
idx = i = 0;
- while((ret = H5Aiterate2(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info, H5P_DEFAULT)) > 0) {
+ while((ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info)) > 0) {
/* Verify return value from iterator gets propagated correctly */
VERIFY(ret, 1, "H5Aiterate2");