summaryrefslogtreecommitdiffstats
path: root/test/dtypes.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/dtypes.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/dtypes.c')
-rw-r--r--test/dtypes.c99
1 files changed, 89 insertions, 10 deletions
diff --git a/test/dtypes.c b/test/dtypes.c
index 326294f..984b6c6 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -1789,6 +1789,13 @@ test_compound_9(void)
goto error;
} /* end if */
+ if(H5Dvlen_reclaim(dup_tid, space_id, H5P_DEFAULT, &rdata) < 0) {
+ H5_FAILED(); AT();
+ printf("Can't reclaim read data\n");
+ goto error;
+ } /* end if */
+ rdata.str = NULL;
+
if(H5Dclose(dset_id) < 0)
goto error;
if(H5Tclose(cmpd_tid) < 0)
@@ -1815,6 +1822,12 @@ test_compound_9(void)
goto error;
} /* end if */
+ if((space_id = H5Dget_space(dset_id)) < 0) {
+ H5_FAILED(); AT();
+ printf("Can't get space\n");
+ goto error;
+ } /* end if */
+
if((cmpd_tid = H5Dget_type(dset_id)) < 0) {
H5_FAILED(); AT();
printf("cannot open dataset\n");
@@ -1842,10 +1855,19 @@ test_compound_9(void)
goto error;
} /* end if */
+ if(H5Dvlen_reclaim(dup_tid, space_id, H5P_DEFAULT, &rdata) < 0) {
+ H5_FAILED(); AT();
+ printf("Can't read data\n");
+ goto error;
+ } /* end if */
+ rdata.str = NULL;
+
if(rdata.str) HDfree(rdata.str);
if(H5Dclose(dset_id) < 0)
goto error;
+ if(H5Sclose(space_id) < 0)
+ goto error;
if(H5Tclose(cmpd_tid) < 0)
goto error;
if(H5Tclose(dup_tid) < 0)
@@ -2020,12 +2042,17 @@ test_compound_10(void)
printf("incorrect VL read data\n");
goto error;
}
-
- HDfree(t1);
- HDfree(t2);
- HDfree(wdata[i].str);
- HDfree(rdata[i].str);
} /* end for */
+ if(H5Dvlen_reclaim(arr_tid, space_id, H5P_DEFAULT, &rdata) < 0) {
+ H5_FAILED(); AT();
+ printf("Can't reclaim read data\n");
+ goto error;
+ } /* end if */
+ if(H5Dvlen_reclaim(arr_tid, space_id, H5P_DEFAULT, &wdata) < 0) {
+ H5_FAILED(); AT();
+ printf("Can't reclaim read data\n");
+ goto error;
+ } /* end if */
if(H5Dclose(dset_id) < 0)
goto error;
@@ -2090,6 +2117,8 @@ test_compound_11(void)
hid_t big_tid, little_tid; /* Datatype IDs for type conversion */
hid_t big_tid2, little_tid2; /* Datatype IDs for type conversion */
hid_t opaq_src_tid, opaq_dst_tid; /* Datatype IDs for type conversion */
+ hid_t space_id; /* Dataspace for buffer elements */
+ hsize_t dim[1]; /* Dimensions for dataspace */
void *buf = NULL; /* Conversion buffer */
void *buf_orig = NULL; /* Copy of original conversion buffer */
void *bkg = NULL; /* Background buffer */
@@ -2138,6 +2167,13 @@ test_compound_11(void)
/* Make copy of buffer before conversion */
HDmemcpy(buf_orig,buf,sizeof(big_t)*NTESTELEM);
+ dim[0] = NTESTELEM;
+ if((space_id = H5Screate_simple(1, dim, NULL)) < 0) {
+ H5_FAILED(); AT();
+ printf("Can't create space\n");
+ goto error;
+ } /* end if */
+
/* Make copies of the 'big' and 'little' datatypes, so the type
* conversion routine doesn't use the same ones this time and next time
*/
@@ -2169,8 +2205,12 @@ test_compound_11(void)
(unsigned)u,((big_t *)buf_orig)[u].s1,(unsigned)u,((little_t *)buf)[u].s1);
TEST_ERROR
} /* end if */
- HDfree(((little_t *)buf)[u].s1);
} /* end for */
+ if(H5Dvlen_reclaim(little_tid2, space_id, H5P_DEFAULT, buf) < 0) {
+ H5_FAILED(); AT();
+ printf("Can't reclaim data\n");
+ goto error;
+ } /* end if */
/* Build source and destination types for conversion routine */
if((opaq_src_tid=H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0) TEST_ERROR
@@ -2209,8 +2249,12 @@ test_compound_11(void)
(unsigned)u,((big_t *)buf_orig)[u].s1,(unsigned)u,((little_t *)buf)[u].s1);
TEST_ERROR
} /* end if */
- HDfree(((little_t *)buf)[u].s1);
} /* end for */
+ if(H5Dvlen_reclaim(little_tid, space_id, H5P_DEFAULT, buf) < 0) {
+ H5_FAILED(); AT();
+ printf("Can't reclaim data\n");
+ goto error;
+ } /* end if */
/* Unregister the conversion routine */
if(H5Tunregister(H5T_PERS_HARD, "opaq_test", opaq_src_tid, opaq_dst_tid, convert_opaque) < 0) TEST_ERROR
@@ -2243,12 +2287,17 @@ test_compound_11(void)
(unsigned)u,((big_t *)buf_orig)[u].s1,(unsigned)u,((little_t *)buf)[u].s1);
TEST_ERROR
} /* end if */
- HDfree(((little_t *)buf)[u].s1);
} /* end for */
+ if(H5Dvlen_reclaim(little_tid, space_id, H5P_DEFAULT, buf) < 0) {
+ H5_FAILED(); AT();
+ printf("Can't reclaim data\n");
+ goto error;
+ } /* end if */
/* Free everything */
for(u=0; u<NTESTELEM; u++)
HDfree(((big_t *)buf_orig)[u].s1);
+ if(H5Sclose(space_id) < 0) TEST_ERROR
if(H5Tclose(opaq_dst_tid) < 0) TEST_ERROR
if(H5Tclose(opaq_src_tid) < 0) TEST_ERROR
if(H5Tclose(little_tid2) < 0) TEST_ERROR
@@ -2727,6 +2776,18 @@ test_compound_14(void)
goto error;
} /* end if */
+ if(H5Dvlen_reclaim(cmpd_m1_tid, space_id, H5P_DEFAULT, &rdata1) < 0) {
+ H5_FAILED(); AT();
+ printf("Can't reclaim read data\n");
+ goto error;
+ } /* end if */
+ rdata1.str = NULL;
+ if(H5Dvlen_reclaim(cmpd_m2_tid, space_id, H5P_DEFAULT, &rdata2) < 0) {
+ H5_FAILED(); AT();
+ printf("Can't reclaim read data\n");
+ goto error;
+ } /* end if */
+ rdata2.str = NULL;
if(H5Dclose(dset1_id) < 0)
goto error;
if(H5Dclose(dset2_id) < 0)
@@ -2761,6 +2822,12 @@ test_compound_14(void)
goto error;
} /* end if */
+ if((space_id = H5Dget_space(dset2_id)) < 0) {
+ H5_FAILED(); AT();
+ printf("Can't get space\n");
+ goto error;
+ } /* end if */
+
rdata1.c1 = rdata1.c2 = 0;
if(rdata1.str) HDfree(rdata1.str);
@@ -2796,13 +2863,25 @@ test_compound_14(void)
goto error;
} /* end if */
- if(rdata1.str) HDfree(rdata1.str);
- if(rdata2.str) HDfree(rdata2.str);
+ if(H5Dvlen_reclaim(cmpd_m1_tid, space_id, H5P_DEFAULT, &rdata1) < 0) {
+ H5_FAILED(); AT();
+ printf("Can't reclaim read data\n");
+ goto error;
+ } /* end if */
+ rdata1.str = NULL;
+ if(H5Dvlen_reclaim(cmpd_m2_tid, space_id, H5P_DEFAULT, &rdata2) < 0) {
+ H5_FAILED(); AT();
+ printf("Can't reclaim read data\n");
+ goto error;
+ } /* end if */
+ rdata2.str = NULL;
if(H5Dclose(dset1_id) < 0)
goto error;
if(H5Dclose(dset2_id) < 0)
goto error;
+ if(H5Sclose(space_id) < 0)
+ goto error;
if(H5Tclose(cmpd_m1_tid) < 0)
goto error;
if(H5Tclose(cmpd_m2_tid) < 0)