summaryrefslogtreecommitdiffstats
path: root/test/links.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2016-01-01 06:28:04 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2016-01-01 06:28:04 (GMT)
commitf60170dac7c491cc75120a6ebdfe73c13c0bab1d (patch)
tree6adfe7a8ccaa4c7cf6a0ae8aa2b4e7deb0518521 /test/links.c
parent8d8d56d7d1601a88b90524c7bcb78c2515ce770f (diff)
downloadhdf5-f60170dac7c491cc75120a6ebdfe73c13c0bab1d.zip
hdf5-f60170dac7c491cc75120a6ebdfe73c13c0bab1d.tar.gz
hdf5-f60170dac7c491cc75120a6ebdfe73c13c0bab1d.tar.bz2
[svn-r28761] Description:
Clean up many mismatches between malloc/free and H5MM_malloc/H5MM_xfree in the library and tests (and use of H5free_memory and H5Dvlen_reclaim). Also make H5Ocopy use a private version of H5Lexists, which doesn't internally throw (and suppress) errors when an object (or the path to it) isn't found in the destination. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest forthcoming)
Diffstat (limited to 'test/links.c')
-rw-r--r--test/links.c57
1 files changed, 39 insertions, 18 deletions
diff --git a/test/links.c b/test/links.c
index 2886304..c87d2b6 100644
--- a/test/links.c
+++ b/test/links.c
@@ -136,7 +136,7 @@ const char *FILENAME[] = {
#define H5L_DIM1 100
#define H5L_DIM2 100
-#define FILTER_FILESIZE_MAX_FRACTION 0.9F
+#define FILTER_FILESIZE_MAX_FRACTION (double)0.9F
/* Creation order macros */
#define CORDER_GROUP_NAME "corder_group"
@@ -548,8 +548,27 @@ cklinks(hid_t fapl, hbool_t new_format)
HDputs(" expected file location.");
TEST_ERROR
} /* end if */
+ if(H5Lexists(file, "/", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
if(H5Lexists(file, "d1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
if(H5Lexists(file, "grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
+ if(H5Lexists(file, "/grp1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
+ if(H5Lexists(file, "/grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
+ H5E_BEGIN_TRY {
+ status = H5Lexists(file, "no_grp1/hard", H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(status >= 0) {
+ H5_FAILED();
+ HDputs(" H5Lexists() should have failed for a path with missing components.");
+ TEST_ERROR
+ } /* end if */
+ H5E_BEGIN_TRY {
+ status = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(status >= 0) {
+ H5_FAILED();
+ HDputs(" H5Lexists() should have failed for a path with missing components.");
+ TEST_ERROR
+ } /* end if */
/* Symbolic link */
if(H5Oget_info_by_name(file, "grp1/soft", &oinfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
@@ -10985,6 +11004,7 @@ link_info_by_idx(hid_t fapl)
char filename[NAME_BUF_SIZE];/* File name */
char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
unsigned u; /* Local index variable */
+ ssize_t name_len; /* Length of name */
herr_t ret; /* Generic return value */
/* Loop over creating hard or soft links */
@@ -11026,9 +11046,9 @@ link_info_by_idx(hid_t fapl)
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
H5E_BEGIN_TRY {
- ret = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
} H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ if(name_len >= 0) TEST_ERROR
/* Create several links, up to limit of compact form */
for(u = 0; u < max_compact; u++) {
@@ -11068,9 +11088,9 @@ link_info_by_idx(hid_t fapl)
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
H5E_BEGIN_TRY {
- ret = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
} H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ if(name_len >= 0) TEST_ERROR
/* Create more links, to push group into dense form */
for(; u < (max_compact * 2); u++) {
@@ -11110,9 +11130,9 @@ link_info_by_idx(hid_t fapl)
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
H5E_BEGIN_TRY {
- ret = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
} H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ if(name_len >= 0) TEST_ERROR
/* Close the group */
if(H5Gclose(group_id) < 0) TEST_ERROR
@@ -11167,6 +11187,7 @@ link_info_by_idx_old(hid_t fapl)
char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
char tmpval[NAME_BUF_SIZE]; /* Temporary link value */
unsigned u; /* Local index variable */
+ ssize_t name_len; /* Length of name */
herr_t ret; /* Generic return value */
/* Loop over creating hard or soft links */
@@ -11278,9 +11299,9 @@ link_info_by_idx_old(hid_t fapl)
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
H5E_BEGIN_TRY {
- ret = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
} H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ if(name_len >= 0) TEST_ERROR
/* Verify state of group */
if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR
@@ -12038,7 +12059,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
iter_info->order = order;
iter_info->stop = -1;
iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? skip : ((max_links - 1) - skip);
+ iter_info->curr = (int64_t)(order != H5_ITER_DEC ? skip : ((max_links - 1) - skip));
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
if(H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, iter_info) < 0) TEST_ERROR
@@ -12066,11 +12087,11 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Skip over some links in group, with H5Giterate */
- iter_info->nskipped = gskip = max_links / 2;
+ iter_info->nskipped = (unsigned)(gskip = (int)(max_links / 2));
iter_info->order = order;
iter_info->stop = -1;
iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - gskip);
+ iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - (unsigned)gskip);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
if(H5Giterate(group_id, ".", &gskip, group_iterate_cb, iter_info) < 0) TEST_ERROR
@@ -12111,7 +12132,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Iterate over links in group, stopping in the middle, with H5Giterate() */
- iter_info->nskipped = gskip = 0;
+ iter_info->nskipped = (unsigned)(gskip = 0);
iter_info->order = order;
iter_info->stop = 3;
iter_info->ncalled = 0;
@@ -12468,7 +12489,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order,
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Iterate over links in group, with H5Giterate */
- iter_info->nskipped = gskip = 0;
+ iter_info->nskipped = (unsigned)(gskip = 0);
iter_info->order = order;
iter_info->stop = -1;
iter_info->ncalled = 0;
@@ -12488,7 +12509,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order,
iter_info->order = order;
iter_info->stop = -1;
iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? skip : ((max_links - 1) - skip);
+ iter_info->curr = (int64_t)(order != H5_ITER_DEC ? skip : ((max_links - 1) - skip));
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
if(H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info) < 0) TEST_ERROR
@@ -12516,11 +12537,11 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order,
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Skip over some links in group, with H5Giterate */
- iter_info->nskipped = gskip = max_links / 2;
+ iter_info->nskipped = (unsigned)(gskip = (int)(max_links / 2));
iter_info->order = order;
iter_info->stop = -1;
iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - gskip);
+ iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - (unsigned)gskip);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
if(H5Giterate(group_id, ".", &gskip, group_iterate_old_cb, iter_info) < 0) TEST_ERROR
@@ -12561,7 +12582,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order,
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Iterate over links in group, stopping in the middle, with H5Giterate() */
- iter_info->nskipped = gskip = 0;
+ iter_info->nskipped = (unsigned)(gskip = 0);
iter_info->order = order;
iter_info->stop = 3;
iter_info->ncalled = 0;