From f105dcc20a8400e4016fb8b5c572f9c27d65d957 Mon Sep 17 00:00:00 2001 From: jhendersonHDF Date: Mon, 3 Apr 2023 13:08:39 -0500 Subject: Synchronize HDF5 tests with VOL tests (#2628) --- test/tarray.c | 6 +- test/tattr.c | 339 ++++++++++++++++++++++++++++++++++++++------------ test/tcoords.c | 6 +- test/tfile.c | 154 ++++++++++++++++++----- test/tgenprop.c | 46 +++++-- test/th5o.c | 24 ++++ test/th5s.c | 28 +++-- test/titerate.c | 8 +- test/tmisc.c | 92 ++++++++------ test/trefer.c | 186 +++++++++++++++++++++------ test/tselect.c | 86 ++++++++++--- test/ttime.c | 6 +- test/tunicode.c | 6 +- test/tvlstr.c | 12 +- test/tvltypes.c | 6 +- testpar/t_bigio.c | 11 +- testpar/t_file.c | 16 +-- testpar/t_shapesame.c | 3 +- 18 files changed, 799 insertions(+), 236 deletions(-) diff --git a/test/tarray.c b/test/tarray.c index c2cc279..06eac90 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -2244,5 +2244,9 @@ test_array(void) void cleanup_array(void) { - HDremove(FILENAME); + H5E_BEGIN_TRY + { + H5Fdelete(FILENAME, H5P_DEFAULT); + } + H5E_END_TRY; } /* end cleanup_array() */ diff --git a/test/tattr.c b/test/tattr.c index f77f793..35b42dd 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -247,7 +247,11 @@ test_attr_basic_write(hid_t fapl) CHECK(attr, FAIL, "H5Acreate2"); /* Try to create the same attribute again (should fail) */ - ret_id = H5Acreate2(dataset, ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret_id = H5Acreate2(dataset, ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret_id, FAIL, "H5Acreate2"); /* Write attribute information */ @@ -388,7 +392,11 @@ test_attr_basic_write(hid_t fapl) VERIFY(attr_size, (ATTR2_DIM1 * ATTR2_DIM2 * sizeof(int)), "H5Aget_storage_size"); /* Try to create the same attribute again (should fail) */ - ret_id = H5Acreate2(group, ATTR2_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret_id = H5Acreate2(group, ATTR2_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret_id, FAIL, "H5Acreate2"); /* Write attribute information */ @@ -541,7 +549,7 @@ test_attr_flush(hid_t fapl) CHECK(att, FAIL, "H5Acreate2"); ret = H5Aread(att, H5T_NATIVE_DOUBLE, &rdata); - CHECK(ret, FAIL, "H5Awrite"); + CHECK(ret, FAIL, "H5Aread"); if (!H5_DBL_ABS_EQUAL(rdata, 0.0)) TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n", rdata, 0.0); @@ -757,7 +765,11 @@ test_attr_compound_write(hid_t fapl) CHECK(attr, FAIL, "H5Acreate2"); /* Try to create the same attribute again (should fail) */ - ret_id = H5Acreate2(dataset, ATTR4_NAME, tid1, sid2, H5P_DEFAULT, H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret_id = H5Acreate2(dataset, ATTR4_NAME, tid1, sid2, H5P_DEFAULT, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret_id, FAIL, "H5Acreate2"); /* Write complex attribute data */ @@ -978,7 +990,11 @@ test_attr_scalar_write(hid_t fapl) CHECK(attr, FAIL, "H5Acreate2"); /* Try to create the same attribute again (should fail) */ - ret_id = H5Acreate2(dataset, ATTR5_NAME, H5T_NATIVE_FLOAT, sid2, H5P_DEFAULT, H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret_id = H5Acreate2(dataset, ATTR5_NAME, H5T_NATIVE_FLOAT, sid2, H5P_DEFAULT, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret_id, FAIL, "H5Acreate2"); /* Write attribute information */ @@ -1121,7 +1137,11 @@ test_attr_mult_write(hid_t fapl) CHECK(attr, FAIL, "H5Acreate2"); /* Try to create the same attribute again (should fail) */ - ret_id = H5Acreate2(dataset, ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret_id = H5Acreate2(dataset, ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret_id, FAIL, "H5Acreate2"); /* Write 1st attribute data */ @@ -1145,7 +1165,11 @@ test_attr_mult_write(hid_t fapl) CHECK(attr, FAIL, "H5Acreate2"); /* Try to create the same attribute again (should fail) */ - ret_id = H5Acreate2(dataset, ATTR2_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret_id = H5Acreate2(dataset, ATTR2_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret_id, FAIL, "H5Acreate2"); /* Write 2nd attribute information */ @@ -1169,7 +1193,11 @@ test_attr_mult_write(hid_t fapl) CHECK(attr, FAIL, "H5Acreate2"); /* Try to create the same attribute again (should fail) */ - ret_id = H5Acreate2(dataset, ATTR3_NAME, H5T_NATIVE_DOUBLE, sid2, H5P_DEFAULT, H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret_id = H5Acreate2(dataset, ATTR3_NAME, H5T_NATIVE_DOUBLE, sid2, H5P_DEFAULT, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret_id, FAIL, "H5Acreate2"); /* Write 3rd attribute information */ @@ -1547,7 +1575,7 @@ test_attr_delete(hid_t fapl) herr_t ret; /* Generic return value */ /* Output message about test being performed */ - MESSAGE(5, ("Testing Basic Attribute Functions\n")); + MESSAGE(5, ("Testing Basic Attribute Deletion Functions\n")); /* Open file */ fid1 = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl); @@ -1563,7 +1591,11 @@ test_attr_delete(hid_t fapl) VERIFY(oinfo.num_attrs, 3, "H5Oget_info3"); /* Try to delete bogus attribute */ - ret = H5Adelete(dataset, "Bogus"); + H5E_BEGIN_TRY + { + ret = H5Adelete(dataset, "Bogus"); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Adelete"); /* Verify the correct number of attributes */ @@ -2254,7 +2286,11 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Attempt to add attribute again, which should fail */ - attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); + H5E_BEGIN_TRY + { + attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(attr, FAIL, "H5Acreate2"); /* Close dataspace */ @@ -4200,7 +4236,11 @@ test_attr_deprec(hid_t fcpl, hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Get number of attributes with bad ID */ - ret = H5Aget_num_attrs((hid_t)-1); + H5E_BEGIN_TRY + { + ret = H5Aget_num_attrs((hid_t)-1); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Aget_num_attrs"); /* Get number of attributes */ @@ -4408,7 +4448,11 @@ test_attr_corder_create_basic(hid_t fcpl, hid_t fapl) VERIFY(crt_order_flags, 0, "H5Pget_attr_creation_order"); /* Setting invalid combination of a attribute order creation order indexing on should fail */ - ret = H5Pset_attr_creation_order(dcpl, H5P_CRT_ORDER_INDEXED); + H5E_BEGIN_TRY + { + ret = H5Pset_attr_creation_order(dcpl, H5P_CRT_ORDER_INDEXED); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Pset_attr_creation_order"); ret = H5Pget_attr_creation_order(dcpl, &crt_order_flags); CHECK(ret, FAIL, "H5Pget_attr_creation_order"); @@ -5886,11 +5930,19 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for query on non-existent attribute */ - ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &ainfo, - H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &ainfo, + H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Aget_info_by_idx"); - ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, - tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, + tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Aget_name_by_idx"); /* Create attributes, up to limit of compact form */ @@ -5923,14 +5975,26 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for out of bound offset queries */ - ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &ainfo, - H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &ainfo, + H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Aget_info_by_idx"); - ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &ainfo, - H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &ainfo, + H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Aget_info_by_idx"); - ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, - tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, + tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Aget_name_by_idx"); /* Create more attributes, to push into dense form */ @@ -5976,14 +6040,26 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end if */ /* Check for out of bound offset queries */ - ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &ainfo, - H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &ainfo, + H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Aget_info_by_idx"); - ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &ainfo, - H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &ainfo, + H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Aget_info_by_idx"); - ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, - tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, + tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Aget_name_by_idx"); } /* end for */ @@ -6267,6 +6343,8 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) unsigned u; /* Local index variable */ herr_t ret; /* Generic return value */ + MESSAGE(5, ("Testing Deleting Attribute By Index\n")) + /* Create dataspace for dataset & attributes */ sid = H5Screate(H5S_SCALAR); CHECK(sid, FAIL, "H5Screate"); @@ -6374,7 +6452,11 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for deleting non-existent attribute */ - ret = H5Adelete_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret = H5Adelete_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Adelete_by_idx"); /* Create attributes, up to limit of compact form */ @@ -6408,7 +6490,11 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for out of bound deletions */ - ret = H5Adelete_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret = H5Adelete_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Adelete_by_idx"); } /* end for */ @@ -6536,7 +6622,11 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end if */ /* Check for out of bound deletion */ - ret = H5Adelete_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret = H5Adelete_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Adelete_by_idx"); } /* end for */ @@ -6600,7 +6690,11 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); /* Check for deletion on empty attribute storage again */ - ret = H5Adelete_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret = H5Adelete_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Adelete_by_idx"); } /* end for */ @@ -6767,7 +6861,11 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); /* Check for deletion on empty attribute storage again */ - ret = H5Adelete_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret = H5Adelete_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Adelete_by_idx"); } /* end for */ @@ -7162,15 +7260,29 @@ attr_iterate_check(hid_t fid, const char *dsetname, hid_t obj_id, H5_index_t idx /* Check for iteration routine indicating failure */ skip = 0; - ret = H5Aiterate2(obj_id, idx_type, order, &skip, attr_iterate2_fail_cb, NULL); + H5E_BEGIN_TRY + { + ret = H5Aiterate2(obj_id, idx_type, order, &skip, attr_iterate2_fail_cb, NULL); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Aiterate2"); skip = 0; - ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, &skip, attr_iterate2_fail_cb, NULL, H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, &skip, attr_iterate2_fail_cb, NULL, + H5P_DEFAULT); + } + H5E_END_TRY; 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); + H5E_BEGIN_TRY + { + ret = + H5Aiterate_by_name(obj_id, ".", idx_type, order, &skip, attr_iterate2_fail_cb, NULL, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Aiterate_by_name"); /* Retrieve current # of errors */ @@ -7373,17 +7485,29 @@ 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); + H5E_BEGIN_TRY + { + ret = H5Aiterate2(my_dataset, idx_type, order, &idx, attr_iterate2_cb, NULL); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Aiterate2"); idx = u; - ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, &idx, attr_iterate2_cb, NULL, - H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, &idx, attr_iterate2_cb, NULL, + H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Aiterate_by_name"); idx = u; - ret = H5Aiterate_by_name(my_dataset, ".", idx_type, order, &idx, attr_iterate2_cb, NULL, - H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret = H5Aiterate_by_name(my_dataset, ".", idx_type, order, &idx, attr_iterate2_cb, + NULL, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Aiterate_by_name"); /* Test iteration over attributes stored compactly */ @@ -7460,17 +7584,29 @@ 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); + H5E_BEGIN_TRY + { + ret = H5Aiterate2(my_dataset, idx_type, order, &idx, attr_iterate2_cb, NULL); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Aiterate2"); idx = u; - ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, &idx, attr_iterate2_cb, NULL, - H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, &idx, attr_iterate2_cb, NULL, + H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Aiterate_by_name"); idx = u; - ret = H5Aiterate_by_name(my_dataset, ".", idx_type, order, &idx, attr_iterate2_cb, NULL, - H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret = H5Aiterate_by_name(my_dataset, ".", idx_type, order, &idx, attr_iterate2_cb, + NULL, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Aiterate_by_name"); /* Test iteration over attributes stored densely */ @@ -7701,8 +7837,12 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for opening an attribute on an object with no attributes */ - ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT, - H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT, + H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret_id, FAIL, "H5Aopen_by_idx"); /* Create attributes, up to limit of compact form */ @@ -7736,8 +7876,12 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for out of bound opening an attribute on an object */ - ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT, - H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT, + H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret_id, FAIL, "H5Aopen_by_idx"); /* Test opening attributes by index stored compactly */ @@ -7810,8 +7954,12 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end if */ /* Check for out of bound opening an attribute on an object */ - ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT, - H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT, + H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret_id, FAIL, "H5Aopen_by_idx"); /* Test opening attributes by index stored compactly */ @@ -8029,13 +8177,25 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for opening a non-existent attribute on an object with no attributes */ - ret_id = H5Aopen(my_dataset, "foo", H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret_id = H5Aopen(my_dataset, "foo", H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret_id, FAIL, "H5Aopen"); - ret_id = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret_id = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret_id, FAIL, "H5Aopen_by_name"); - ret_id = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret_id = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret_id, FAIL, "H5Aopen_by_name"); /* Create attributes, up to limit of compact form */ @@ -8068,13 +8228,25 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for opening a non-existent attribute on an object with compact attribute storage */ - ret_id = H5Aopen(my_dataset, "foo", H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret_id = H5Aopen(my_dataset, "foo", H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret_id, FAIL, "H5Aopen"); - ret_id = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret_id = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret_id, FAIL, "H5Aopen_by_name"); - ret_id = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret_id = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret_id, FAIL, "H5Aopen_by_name"); /* Test opening attributes stored compactly */ @@ -8149,13 +8321,25 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end if */ /* Check for opening a non-existent attribute on an object with dense attribute storage */ - ret_id = H5Aopen(my_dataset, "foo", H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret_id = H5Aopen(my_dataset, "foo", H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret_id, FAIL, "H5Aopen"); - ret_id = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret_id = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret_id, FAIL, "H5Aopen_by_name"); - ret_id = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret_id = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(ret_id, FAIL, "H5Aopen_by_name"); /* Test opening attributes stored compactly */ @@ -10898,8 +11082,8 @@ test_attr_bug8(hid_t fcpl, hid_t fapl) hsize_t dims = 256; /* Attribute dimensions */ H5O_info2_t oinfo; /* Object info */ H5A_info_t ainfo; /* Attribute info */ - haddr_t root_addr; /* Root group address */ - haddr_t link_addr; /* Link (to root group) address */ + H5O_token_t root_token; /* Root group token */ + int cmp_value; /* Result from H5Otoken_cmp */ herr_t ret; /* Generic return status */ /* Output message about test being performed */ @@ -10913,11 +11097,10 @@ test_attr_bug8(hid_t fcpl, hid_t fapl) gid = H5Gcreate2(fid, GROUP1_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(gid, FAIL, "H5Gcreate2"); - /* Get root group address */ + /* Get root group token */ ret = H5Oget_info3(fid, &oinfo, H5O_INFO_BASIC); CHECK(ret, FAIL, "H5Oget_info"); - ret = H5VLnative_token_to_addr(fid, oinfo.token, &root_addr); - CHECK(ret, FAIL, "H5VLnative_token_to_addr"); + root_token = oinfo.token; /* * Create link to root group @@ -10942,11 +11125,9 @@ test_attr_bug8(hid_t fcpl, hid_t fapl) CHECK(oid, FAIL, "H5Oopen"); ret = H5Oget_info3(oid, &oinfo, H5O_INFO_BASIC); CHECK(ret, FAIL, "H5Oget_info"); - ret = H5VLnative_token_to_addr(fid, oinfo.token, &link_addr); - CHECK(ret, FAIL, "H5VLnative_token_to_addr"); - if (link_addr != root_addr) - TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", - (long long unsigned)link_addr, (long long unsigned)root_addr); + ret = H5Otoken_cmp(oid, &oinfo.token, &root_token, &cmp_value); + CHECK(ret, FAIL, "H5Otoken_cmp"); + VERIFY(cmp_value, 0, "H5Otoken_cmp"); /* Close file */ ret = H5Fclose(fid); @@ -10990,11 +11171,9 @@ test_attr_bug8(hid_t fcpl, hid_t fapl) CHECK(oid, FAIL, "H5Oopen"); ret = H5Oget_info3(oid, &oinfo, H5O_INFO_BASIC); CHECK(ret, FAIL, "H5Oget_info"); - ret = H5VLnative_token_to_addr(fid, oinfo.token, &link_addr); - CHECK(ret, FAIL, "H5VLnative_token_to_addr"); - if (link_addr != root_addr) - TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", - (long long unsigned)link_addr, (long long unsigned)root_addr); + ret = H5Otoken_cmp(oid, &oinfo.token, &root_token, &cmp_value); + CHECK(ret, FAIL, "H5Otoken_cmp"); + VERIFY(cmp_value, 0, "H5Otoken_cmp"); ret = H5Aget_info_by_name(gid, ".", ATTR1_NAME, &ainfo, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aget_info_by_name"); if (ainfo.data_size != dims) @@ -11511,5 +11690,9 @@ test_attr(void) void cleanup_attr(void) { - HDremove(FILENAME); + H5E_BEGIN_TRY + { + H5Fdelete(FILENAME, H5P_DEFAULT); + } + H5E_END_TRY; } diff --git a/test/tcoords.c b/test/tcoords.c index cf84aba..f2bad20 100644 --- a/test/tcoords.c +++ b/test/tcoords.c @@ -720,5 +720,9 @@ test_coords(void) void cleanup_coords(void) { - HDremove(FILENAME); + H5E_BEGIN_TRY + { + H5Fdelete(FILENAME, H5P_DEFAULT); + } + H5E_END_TRY; } diff --git a/test/tfile.c b/test/tfile.c index dd72da6..03ade92 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -213,11 +213,13 @@ static void test_rw_noupdate(void); static void test_file_create(void) { - hid_t fid1, fid2, fid3; /* HDF5 File IDs */ - hid_t tmpl1, tmpl2; /* file creation templates */ - hsize_t ublock; /* sizeof userblock */ - size_t parm; /* file-creation parameters */ - size_t parm2; /* file-creation parameters */ + hid_t fid1 = H5I_INVALID_HID; + hid_t fid2 = H5I_INVALID_HID; + hid_t fid3 = H5I_INVALID_HID; /* HDF5 File IDs */ + hid_t tmpl1, tmpl2; /* file creation templates */ + hsize_t ublock; /* sizeof userblock */ + size_t parm; /* file-creation parameters */ + size_t parm2; /* file-creation parameters */ unsigned iparm; unsigned iparm2; herr_t ret; /*generic return value */ @@ -226,10 +228,18 @@ test_file_create(void) MESSAGE(5, ("Testing Low-Level File Creation I/O\n")); /* First ensure the file does not exist */ - HDremove(FILE1); + H5E_BEGIN_TRY + { + H5Fdelete(FILE1, H5P_DEFAULT); + } + H5E_END_TRY; /* Try opening a non-existent file */ - fid1 = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT); + H5E_BEGIN_TRY + { + fid1 = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(fid1, FAIL, "H5Fopen"); /* Test create with various sequences of H5F_ACC_EXCL and */ @@ -243,21 +253,33 @@ test_file_create(void) * try to create the same file with H5F_ACC_TRUNC. This should fail * because fid1 is the same file and is currently open. */ - fid2 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + H5E_BEGIN_TRY + { + fid2 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(fid2, FAIL, "H5Fcreate"); /* Close all files */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); - ret = H5Fclose(fid2); + H5E_BEGIN_TRY + { + ret = H5Fclose(fid2); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Fclose"); /*file should not have been open */ /* * Try again with H5F_ACC_EXCL. This should fail because the file already * exists from the previous steps. */ - fid1 = H5Fcreate(FILE1, H5F_ACC_EXCL, H5P_DEFAULT, H5P_DEFAULT); + H5E_BEGIN_TRY + { + fid1 = H5Fcreate(FILE1, H5F_ACC_EXCL, H5P_DEFAULT, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(fid1, FAIL, "H5Fcreate"); /* Test create with H5F_ACC_TRUNC. This will truncate the existing file. */ @@ -268,14 +290,22 @@ test_file_create(void) * Try to truncate first file again. This should fail because fid1 is the * same file and is currently open. */ - fid2 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + H5E_BEGIN_TRY + { + fid2 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(fid2, FAIL, "H5Fcreate"); /* * Try with H5F_ACC_EXCL. This should fail too because the file already * exists. */ - fid2 = H5Fcreate(FILE1, H5F_ACC_EXCL, H5P_DEFAULT, H5P_DEFAULT); + H5E_BEGIN_TRY + { + fid2 = H5Fcreate(FILE1, H5F_ACC_EXCL, H5P_DEFAULT, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(fid2, FAIL, "H5Fcreate"); /* Get the file-creation template */ @@ -598,11 +628,19 @@ test_file_open(const char *env_h5_drvr) CHECK(ret, FAIL, "H5Fclose"); /* Open file for second time, which should fail. */ - fid2 = H5Fopen(FILE2, H5F_ACC_RDWR, fapl_id); + H5E_BEGIN_TRY + { + fid2 = H5Fopen(FILE2, H5F_ACC_RDWR, fapl_id); + } + H5E_END_TRY; VERIFY(fid2, FAIL, "H5Fopen"); /* Check that the intent fails for an invalid ID */ - ret = H5Fget_intent(fid1, &intent); + H5E_BEGIN_TRY + { + ret = H5Fget_intent(fid1, &intent); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Fget_intent"); /* Close dataset from first open */ @@ -662,7 +700,12 @@ test_file_reopen(void) CHECK(ret, FAIL, "H5Fclose"); ret = H5Fclose(rfid); CHECK(ret, FAIL, "H5Fclose"); - HDremove(REOPEN_FILE); + + H5E_BEGIN_TRY + { + H5Fdelete(REOPEN_FILE, H5P_DEFAULT); + } + H5E_END_TRY; } /* test_file_reopen() */ @@ -681,6 +724,9 @@ test_file_close(void) H5F_close_degree_t fc_degree; herr_t ret; + /* Output message about test being performed */ + MESSAGE(5, ("Testing File Closing with file close degrees\n")); + /* Test behavior while opening file multiple times with different * file close degree value */ @@ -697,7 +743,11 @@ test_file_close(void) VERIFY(fc_degree, H5F_CLOSE_STRONG, "H5Pget_fclose_degree"); /* should fail */ - fid2 = H5Fopen(FILE1, H5F_ACC_RDWR, fapl_id); + H5E_BEGIN_TRY + { + fid2 = H5Fopen(FILE1, H5F_ACC_RDWR, fapl_id); + } + H5E_END_TRY; VERIFY(fid2, FAIL, "H5Fopen"); ret = H5Pset_fclose_degree(fapl_id, H5F_CLOSE_DEFAULT); @@ -751,7 +801,11 @@ test_file_close(void) CHECK(ret, FAIL, "H5Pset_fclose_degree"); /* should fail */ - fid2 = H5Fopen(FILE1, H5F_ACC_RDWR, fapl_id); + H5E_BEGIN_TRY + { + fid2 = H5Fopen(FILE1, H5F_ACC_RDWR, fapl_id); + } + H5E_END_TRY; VERIFY(fid2, FAIL, "H5Fopen"); ret = H5Pset_fclose_degree(fapl_id, H5F_CLOSE_STRONG); @@ -784,7 +838,11 @@ test_file_close(void) CHECK(ret, FAIL, "H5Pset_fclose_degree"); /* should fail */ - fid2 = H5Fopen(FILE1, H5F_ACC_RDWR, fapl_id); + H5E_BEGIN_TRY + { + fid2 = H5Fopen(FILE1, H5F_ACC_RDWR, fapl_id); + } + H5E_END_TRY; VERIFY(fid2, FAIL, "H5Fopen"); ret = H5Pset_fclose_degree(fapl_id, H5F_CLOSE_SEMI); @@ -799,12 +857,20 @@ test_file_close(void) /* Close first open, should fail since it is SEMI and objects are * still open. */ - ret = H5Fclose(fid1); + H5E_BEGIN_TRY + { + ret = H5Fclose(fid1); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Fclose"); /* Close second open, should fail since it is SEMI and objects are * still open. */ - ret = H5Fclose(fid2); + H5E_BEGIN_TRY + { + ret = H5Fclose(fid2); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Fclose"); ret = H5Dclose(dataset_id); @@ -822,11 +888,19 @@ test_file_close(void) /* Close second open, should fail since it is SEMI and one group ID is * still open. */ - ret = H5Fclose(fid2); + H5E_BEGIN_TRY + { + ret = H5Fclose(fid2); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Fclose"); /* Same check with H5Idec_ref() (should fail also) */ - ret = H5Idec_ref(fid2); + H5E_BEGIN_TRY + { + ret = H5Idec_ref(fid2); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Idec_ref"); ret = H5Gclose(group_id3); @@ -848,7 +922,11 @@ test_file_close(void) CHECK(ret, FAIL, "H5Pset_fclose_degree"); /* should fail */ - fid2 = H5Fopen(FILE1, H5F_ACC_RDWR, fapl_id); + H5E_BEGIN_TRY + { + fid2 = H5Fopen(FILE1, H5F_ACC_RDWR, fapl_id); + } + H5E_END_TRY; VERIFY(fid2, FAIL, "H5Fopen"); ret = H5Pset_fclose_degree(fapl_id, H5F_CLOSE_DEFAULT); @@ -897,7 +975,11 @@ test_file_close(void) CHECK(ret, FAIL, "H5Pset_fclose_degree"); /* should fail */ - fid2 = H5Fopen(FILE1, H5F_ACC_RDWR, fapl_id); + H5E_BEGIN_TRY + { + fid2 = H5Fopen(FILE1, H5F_ACC_RDWR, fapl_id); + } + H5E_END_TRY; VERIFY(fid2, FAIL, "H5Fopen"); ret = H5Pset_fclose_degree(fapl_id, H5F_CLOSE_DEFAULT); @@ -1101,6 +1183,8 @@ test_get_obj_ids(void) ssize_t oid_list_size = NDSETS; char gname[64], dname[64]; + MESSAGE(5, ("Testing retrieval of object IDs\n")); + /* Create a new file */ fid = H5Fcreate(FILE7, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fcreate"); @@ -1196,11 +1280,15 @@ test_get_obj_ids(void) /* Get the list of all opened objects */ ret_count = H5Fget_obj_ids((hid_t)H5F_OBJ_ALL, H5F_OBJ_ALL, (size_t)oid_count, oid_list); CHECK(ret_count, FAIL, "H5Fget_obj_ids"); - VERIFY(ret_count, NDSETS, "H5Fget_obj_count"); + VERIFY(ret_count, NDSETS, "H5Fget_obj_ids"); - /* Close all open objects with H5Oclose */ - for (n = 0; n < oid_count; n++) - H5Oclose(oid_list[n]); + H5E_BEGIN_TRY + { + /* Close all open objects with H5Oclose */ + for (n = 0; n < oid_count; n++) + H5Oclose(oid_list[n]); + } + H5E_END_TRY; HDfree(oid_list); } @@ -1220,6 +1308,8 @@ test_get_file_id(void) unsigned intent; herr_t ret; + MESSAGE(5, ("Testing H5Iget_file_id\n")); + /* Create a file */ fid = H5Fcreate(FILE4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fcreate"); @@ -2870,7 +2960,7 @@ test_file_double_datatype_open(void) herr_t ret; /* Generic return value */ /* Output message about test being performed */ - MESSAGE(5, ("Testing double dataset open\n")); + MESSAGE(5, ("Testing double datatype open\n")); file1_id = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(file1_id, FAIL, "H5Fcreate"); @@ -5587,7 +5677,11 @@ test_libver_bounds_copy(void) CHECK(ret, FAIL, "H5Fclose"); /* Remove the destination file */ - HDremove(DST_FILE); + H5E_BEGIN_TRY + { + H5Fdelete(DST_FILE, H5P_DEFAULT); + } + H5E_END_TRY; } /* end test_libver_bounds_copy() */ diff --git a/test/tgenprop.c b/test/tgenprop.c index 9c4495b..46bb0ac 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -194,8 +194,12 @@ test_genprop_basic_class_prop(void) CHECK_I(ret, "H5Pregister2"); /* Try to insert the first property again (should fail) */ - ret = - H5Pregister2(cid1, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + H5E_BEGIN_TRY + { + ret = H5Pregister2(cid1, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, + NULL); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Pregister2"); /* Check the existence of the first property */ @@ -218,8 +222,12 @@ test_genprop_basic_class_prop(void) CHECK_I(ret, "H5Pregister2"); /* Try to insert the second property again (should fail) */ - ret = - H5Pregister2(cid1, PROP2_NAME, PROP2_SIZE, PROP2_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + H5E_BEGIN_TRY + { + ret = H5Pregister2(cid1, PROP2_NAME, PROP2_SIZE, PROP2_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, + NULL); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Pregister2"); /* Check the existence of the second property */ @@ -260,7 +268,11 @@ test_genprop_basic_class_prop(void) CHECK_I(ret, "H5Punregister"); /* Try to check the size of the first property (should fail) */ - ret = H5Pget_size(cid1, PROP1_NAME, &size); + H5E_BEGIN_TRY + { + ret = H5Pget_size(cid1, PROP1_NAME, &size); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Pget_size"); /* Check the number of properties in class */ @@ -1950,7 +1962,11 @@ test_genprop_deprec_class(void) CHECK_I(ret, "H5Pregister1"); /* Try to insert the first property again (should fail) */ - ret = H5Pregister1(cid1, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL); + H5E_BEGIN_TRY + { + ret = H5Pregister1(cid1, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Pregister1"); /* Check the existence of the first property */ @@ -1972,7 +1988,11 @@ test_genprop_deprec_class(void) CHECK_I(ret, "H5Pregister1"); /* Try to insert the second property again (should fail) */ - ret = H5Pregister1(cid1, PROP2_NAME, PROP2_SIZE, PROP2_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL); + H5E_BEGIN_TRY + { + ret = H5Pregister1(cid1, PROP2_NAME, PROP2_SIZE, PROP2_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Pregister1"); /* Check the existence of the second property */ @@ -2012,7 +2032,11 @@ test_genprop_deprec_class(void) CHECK_I(ret, "H5Punregister"); /* Try to check the size of the first property (should fail) */ - ret = H5Pget_size(cid1, PROP1_NAME, &size); + H5E_BEGIN_TRY + { + ret = H5Pget_size(cid1, PROP1_NAME, &size); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Pget_size"); /* Check the number of properties in class */ @@ -2171,5 +2195,9 @@ test_genprop(void) void cleanup_genprop(void) { - HDremove(FILENAME); + H5E_BEGIN_TRY + { + H5Fdelete(FILENAME, H5P_DEFAULT); + } + H5E_END_TRY; } diff --git a/test/th5o.c b/test/th5o.c index 3e7c80a..027445e 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -49,6 +49,9 @@ test_h5o_open(void) H5T_class_t type_class; /* Class of the datatype */ herr_t ret; /* Value returned from API calls */ + /* Output message about test being performed */ + MESSAGE(5, ("Testing H5Oopen\n")); + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); /* Create a new HDF5 file */ @@ -161,6 +164,9 @@ test_h5o_close(void) hsize_t dims[RANK]; herr_t ret; /* Value returned from API calls */ + /* Output message about test being performed */ + MESSAGE(5, ("Testing H5Oclose\n")); + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); /* Create a new HDF5 file */ @@ -413,6 +419,9 @@ test_h5o_open_by_token(void) H5T_class_t type_class; /* Class of the datatype */ herr_t ret; /* Value returned from API calls */ + /* Output message about test being performed */ + MESSAGE(5, ("Testing H5Oopen_by_token\n")); + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); /* Create a new HDF5 file */ @@ -531,6 +540,9 @@ test_h5o_refcount(void) hsize_t dims[RANK]; herr_t ret; /* Value returned from API calls */ + /* Output message about test being performed */ + MESSAGE(5, ("Testing retrieval of object reference count with H5Oget_info\n")); + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); /* Create a new HDF5 file */ @@ -732,6 +744,9 @@ test_h5o_plist(void) unsigned max_compact, min_dense; /* Actual phase change parameters */ herr_t ret; /* Value returned from API calls */ + /* Output message about test being performed */ + MESSAGE(5, ("Testing Object creation properties\n")); + /* Make a FAPL that uses the "use the latest version of the format" flag */ fapl = H5Pcreate(H5P_FILE_ACCESS); CHECK(fapl, FAIL, "H5Pcreate"); @@ -935,6 +950,9 @@ test_h5o_link(void) int i, n; herr_t ret; /* Value returned from API calls */ + /* Output message about test being performed */ + MESSAGE(5, ("Testing H5Olink\n")); + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); /* Allocate memory buffers */ @@ -1422,6 +1440,9 @@ test_h5o_getinfo_same_file(void) H5O_info2_t oinfo1, oinfo2; /* Object info structs */ herr_t ret; /* Value returned from API calls */ + /* Output message about test being performed */ + MESSAGE(5, ("Testing H5Oget_info on objects in same file\n")); + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); /* Create a new HDF5 file */ @@ -1720,6 +1741,9 @@ test_h5o_getinfo_visit(void) int j; /* Local index variable */ herr_t ret; /* Value returned from API calls */ + /* Output message about test being performed */ + MESSAGE(5, ("Testing info returned by H5Oget_info vs H5Ovisit\n")); + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); /* Create an HDF5 file */ diff --git a/test/th5s.c b/test/th5s.c index 77116a6..25ab290 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -214,14 +214,22 @@ test_h5s_basic(void) /* Verify that incorrect dimensions don't work */ dims1[0] = H5S_UNLIMITED; - sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL); + H5E_BEGIN_TRY + { + sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL); + } + H5E_END_TRY; VERIFY(sid1, FAIL, "H5Screate_simple"); dims1[0] = H5S_UNLIMITED; sid1 = H5Screate(H5S_SIMPLE); CHECK(sid1, FAIL, "H5Screate"); - ret = H5Sset_extent_simple(sid1, SPACE1_RANK, dims1, NULL); + H5E_BEGIN_TRY + { + ret = H5Sset_extent_simple(sid1, SPACE1_RANK, dims1, NULL); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Sset_extent_simple"); ret = H5Sclose(sid1); @@ -1626,7 +1634,7 @@ test_h5s_check_encoding(hid_t in_fapl, hid_t in_sid, uint32_t expected_version, /* Allocate the buffer for encoding */ buf = (char *)HDmalloc(buf_size); - CHECK_PTR(buf, "H5Dmalloc"); + CHECK_PTR(buf, "HDmalloc"); /* Encode according to the setting in in_fapl */ ret = H5Sencode2(in_sid, buf, &buf_size, in_fapl); @@ -3506,9 +3514,13 @@ test_h5s(void) void cleanup_h5s(void) { - HDremove(DATAFILE); - HDremove(NULLFILE); - HDremove(BASICFILE); - HDremove(ZEROFILE); - HDremove(VERBFNAME); + H5E_BEGIN_TRY + { + H5Fdelete(DATAFILE, H5P_DEFAULT); + H5Fdelete(NULLFILE, H5P_DEFAULT); + H5Fdelete(BASICFILE, H5P_DEFAULT); + H5Fdelete(ZEROFILE, H5P_DEFAULT); + H5Fdelete(VERBFNAME, H5P_DEFAULT); + } + H5E_END_TRY; } diff --git a/test/titerate.c b/test/titerate.c index 48e0aa9..defed21 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -491,7 +491,7 @@ test_iter_attr(hid_t fapl, hbool_t new_format) 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 */ + /* Test all attributes on dataset, when callback always returns 2 */ /* This also tests the "restarting" ability, because the index changes */ info.command = RET_TWO; i = 0; @@ -1210,5 +1210,9 @@ test_iterate(void) void cleanup_iterate(void) { - HDremove(DATAFILE); + H5E_BEGIN_TRY + { + H5Fdelete(DATAFILE, H5P_DEFAULT); + } + H5E_END_TRY; } diff --git a/test/tmisc.c b/test/tmisc.c index 92b441e..0b04b2c 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -666,7 +666,7 @@ test_misc4(void) herr_t ret; /* Output message about test being performed */ - MESSAGE(5, ("Testing fileno working in H5O_info_t\n")); + MESSAGE(5, ("Testing fileno working in H5O_info2_t\n")); file1 = H5Fcreate(MISC4_FILE_1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(file1, FAIL, "H5Fcreate"); @@ -1412,7 +1412,11 @@ test_misc8(void) /* Create a contiguous dataset, with space allocation late */ /* Should fail */ - did = H5Dcreate2(fid, MISC8_DSETNAME4, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); + H5E_BEGIN_TRY + { + did = H5Dcreate2(fid, MISC8_DSETNAME4, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(did, FAIL, "H5Dcreate2"); /* Set the space allocation time to incremental */ @@ -1421,7 +1425,11 @@ test_misc8(void) /* Create a contiguous dataset, with space allocation incremental */ /* Should fail */ - did = H5Dcreate2(fid, MISC8_DSETNAME4, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); + H5E_BEGIN_TRY + { + did = H5Dcreate2(fid, MISC8_DSETNAME4, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(did, FAIL, "H5Dcreate2"); /* Set the space allocation time to early */ @@ -1762,7 +1770,11 @@ test_misc9(void) ret = H5Pset_fapl_core(fapl, (size_t)1024, 0); CHECK(ret, FAIL, "H5Pset_fapl_core"); - fid = H5Fopen(MISC9_FILE, H5F_ACC_RDWR, fapl); + H5E_BEGIN_TRY + { + fid = H5Fopen(MISC9_FILE, H5F_ACC_RDWR, fapl); + } + H5E_END_TRY; VERIFY(fid, FAIL, "H5Fopen"); ret = H5Pclose(fapl); @@ -6175,42 +6187,46 @@ test_misc(void) void cleanup_misc(void) { - HDremove(MISC1_FILE); - HDremove(MISC2_FILE_1); - HDremove(MISC2_FILE_2); - HDremove(MISC3_FILE); - HDremove(MISC4_FILE_1); - HDremove(MISC4_FILE_2); - HDremove(MISC5_FILE); - HDremove(MISC6_FILE); - HDremove(MISC7_FILE); - HDremove(MISC8_FILE); - HDremove(MISC9_FILE); - HDremove(MISC10_FILE_NEW); - HDremove(MISC11_FILE); - HDremove(MISC12_FILE); - HDremove(MISC13_FILE_1); - HDremove(MISC13_FILE_2); - HDremove(MISC14_FILE); - HDremove(MISC15_FILE); - HDremove(MISC16_FILE); - HDremove(MISC17_FILE); - HDremove(MISC18_FILE); - HDremove(MISC19_FILE); - HDremove(MISC20_FILE); + H5E_BEGIN_TRY + { + H5Fdelete(MISC1_FILE, H5P_DEFAULT); + H5Fdelete(MISC2_FILE_1, H5P_DEFAULT); + H5Fdelete(MISC2_FILE_2, H5P_DEFAULT); + H5Fdelete(MISC3_FILE, H5P_DEFAULT); + H5Fdelete(MISC4_FILE_1, H5P_DEFAULT); + H5Fdelete(MISC4_FILE_2, H5P_DEFAULT); + H5Fdelete(MISC5_FILE, H5P_DEFAULT); + H5Fdelete(MISC6_FILE, H5P_DEFAULT); + H5Fdelete(MISC7_FILE, H5P_DEFAULT); + H5Fdelete(MISC8_FILE, H5P_DEFAULT); + H5Fdelete(MISC9_FILE, H5P_DEFAULT); + H5Fdelete(MISC10_FILE_NEW, H5P_DEFAULT); + H5Fdelete(MISC11_FILE, H5P_DEFAULT); + H5Fdelete(MISC12_FILE, H5P_DEFAULT); + H5Fdelete(MISC13_FILE_1, H5P_DEFAULT); + H5Fdelete(MISC13_FILE_2, H5P_DEFAULT); + H5Fdelete(MISC14_FILE, H5P_DEFAULT); + H5Fdelete(MISC15_FILE, H5P_DEFAULT); + H5Fdelete(MISC16_FILE, H5P_DEFAULT); + H5Fdelete(MISC17_FILE, H5P_DEFAULT); + H5Fdelete(MISC18_FILE, H5P_DEFAULT); + H5Fdelete(MISC19_FILE, H5P_DEFAULT); + H5Fdelete(MISC20_FILE, H5P_DEFAULT); #ifdef H5_HAVE_FILTER_SZIP - HDremove(MISC21_FILE); - HDremove(MISC22_FILE); + H5Fdelete(MISC21_FILE, H5P_DEFAULT); + H5Fdelete(MISC22_FILE, H5P_DEFAULT); #endif /* H5_HAVE_FILTER_SZIP */ - HDremove(MISC23_FILE); - HDremove(MISC24_FILE); - HDremove(MISC25A_FILE); - HDremove(MISC25C_FILE); - HDremove(MISC26_FILE); - HDremove(MISC28_FILE); - HDremove(MISC29_COPY_FILE); - HDremove(MISC30_FILE); + H5Fdelete(MISC23_FILE, H5P_DEFAULT); + H5Fdelete(MISC24_FILE, H5P_DEFAULT); + H5Fdelete(MISC25A_FILE, H5P_DEFAULT); + H5Fdelete(MISC25C_FILE, H5P_DEFAULT); + H5Fdelete(MISC26_FILE, H5P_DEFAULT); + H5Fdelete(MISC28_FILE, H5P_DEFAULT); + H5Fdelete(MISC29_COPY_FILE, H5P_DEFAULT); + H5Fdelete(MISC30_FILE, H5P_DEFAULT); #ifndef H5_NO_DEPRECATED_SYMBOLS - HDremove(MISC31_FILE); + H5Fdelete(MISC31_FILE, H5P_DEFAULT); #endif /* H5_NO_DEPRECATED_SYMBOLS */ + } + H5E_END_TRY; } /* end cleanup_misc() */ diff --git a/test/trefer.c b/test/trefer.c index cc0ee2c..26a883b 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -205,83 +205,187 @@ test_reference_params(void) CHECK(ret, H5I_INVALID_HID, "H5Dcreate2"); /* Test parameters to H5Rcreate_object */ - ret = H5Rcreate_object(fid1, "/Group1/Dataset1", H5P_DEFAULT, NULL); + H5E_BEGIN_TRY + { + ret = H5Rcreate_object(fid1, "/Group1/Dataset1", H5P_DEFAULT, NULL); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Rcreate_object ref"); - ret = H5Rcreate_object(H5I_INVALID_HID, "/Group1/Dataset1", H5P_DEFAULT, &wbuf[0]); + H5E_BEGIN_TRY + { + ret = H5Rcreate_object(H5I_INVALID_HID, "/Group1/Dataset1", H5P_DEFAULT, &wbuf[0]); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Rcreate_object loc_id"); - ret = H5Rcreate_object(fid1, NULL, H5P_DEFAULT, &wbuf[0]); + H5E_BEGIN_TRY + { + ret = H5Rcreate_object(fid1, NULL, H5P_DEFAULT, &wbuf[0]); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Rcreate_object name"); - ret = H5Rcreate_object(fid1, "", H5P_DEFAULT, &wbuf[0]); + H5E_BEGIN_TRY + { + ret = H5Rcreate_object(fid1, "", H5P_DEFAULT, &wbuf[0]); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Rcreate_object null name"); /* Test parameters to H5Rcreate_region */ - ret = H5Rcreate_region(fid1, "/Group1/Dataset1", sid1, H5P_DEFAULT, NULL); + H5E_BEGIN_TRY + { + ret = H5Rcreate_region(fid1, "/Group1/Dataset1", sid1, H5P_DEFAULT, NULL); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Rcreate_region ref"); - ret = H5Rcreate_region(H5I_INVALID_HID, "/Group1/Dataset1", sid1, H5P_DEFAULT, &wbuf[0]); + H5E_BEGIN_TRY + { + ret = H5Rcreate_region(H5I_INVALID_HID, "/Group1/Dataset1", sid1, H5P_DEFAULT, &wbuf[0]); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Rcreate_region loc_id"); - ret = H5Rcreate_region(fid1, NULL, sid1, H5P_DEFAULT, &wbuf[0]); + H5E_BEGIN_TRY + { + ret = H5Rcreate_region(fid1, NULL, sid1, H5P_DEFAULT, &wbuf[0]); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Rcreate_region name"); - ret = H5Rcreate_region(fid1, "/Group1/Dataset1", H5I_INVALID_HID, H5P_DEFAULT, &wbuf[0]); + H5E_BEGIN_TRY + { + ret = H5Rcreate_region(fid1, "/Group1/Dataset1", H5I_INVALID_HID, H5P_DEFAULT, &wbuf[0]); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Rcreate_region dataspace"); /* Test parameters to H5Rcreate_attr */ - ret = H5Rcreate_attr(fid1, "/Group1/Dataset2", "Attr", H5P_DEFAULT, NULL); + H5E_BEGIN_TRY + { + ret = H5Rcreate_attr(fid1, "/Group1/Dataset2", "Attr", H5P_DEFAULT, NULL); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Rcreate_attr ref"); - ret = H5Rcreate_attr(H5I_INVALID_HID, "/Group1/Dataset2", "Attr", H5P_DEFAULT, &wbuf[0]); + H5E_BEGIN_TRY + { + ret = H5Rcreate_attr(H5I_INVALID_HID, "/Group1/Dataset2", "Attr", H5P_DEFAULT, &wbuf[0]); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Rcreate_attr loc_id"); - ret = H5Rcreate_attr(fid1, NULL, "Attr", H5P_DEFAULT, &wbuf[0]); + H5E_BEGIN_TRY + { + ret = H5Rcreate_attr(fid1, NULL, "Attr", H5P_DEFAULT, &wbuf[0]); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Rcreate_attr name"); - ret = H5Rcreate_attr(fid1, "/Group1/Dataset2", NULL, H5P_DEFAULT, &wbuf[0]); + H5E_BEGIN_TRY + { + ret = H5Rcreate_attr(fid1, "/Group1/Dataset2", NULL, H5P_DEFAULT, &wbuf[0]); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Rcreate_attr attr_name"); /* Test parameters to H5Rdestroy */ - ret = H5Rdestroy(NULL); + H5E_BEGIN_TRY + { + ret = H5Rdestroy(NULL); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Rdestroy"); /* Test parameters to H5Rget_type */ - type = H5Rget_type(NULL); + H5E_BEGIN_TRY + { + type = H5Rget_type(NULL); + } + H5E_END_TRY; VERIFY(type, H5R_BADTYPE, "H5Rget_type ref"); /* Test parameters to H5Requal */ - ret = H5Requal(NULL, &rbuf[0]); + H5E_BEGIN_TRY + { + ret = H5Requal(NULL, &rbuf[0]); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Requal ref1"); - ret = H5Requal(&rbuf[0], NULL); + H5E_BEGIN_TRY + { + ret = H5Requal(&rbuf[0], NULL); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Requal ref2"); /* Test parameters to H5Rcopy */ - ret = H5Rcopy(NULL, &wbuf[0]); + H5E_BEGIN_TRY + { + ret = H5Rcopy(NULL, &wbuf[0]); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Rcopy src_ref"); - ret = H5Rcopy(&rbuf[0], NULL); + H5E_BEGIN_TRY + { + ret = H5Rcopy(&rbuf[0], NULL); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Rcopy dest_ref"); /* Test parameters to H5Ropen_object */ - dset2 = H5Ropen_object(&rbuf[0], H5I_INVALID_HID, H5I_INVALID_HID); + H5E_BEGIN_TRY + { + dset2 = H5Ropen_object(&rbuf[0], H5I_INVALID_HID, H5I_INVALID_HID); + } + H5E_END_TRY; VERIFY(dset2, H5I_INVALID_HID, "H5Ropen_object oapl_id"); - dset2 = H5Ropen_object(NULL, H5P_DEFAULT, dapl_id); + H5E_BEGIN_TRY + { + dset2 = H5Ropen_object(NULL, H5P_DEFAULT, dapl_id); + } + H5E_END_TRY; VERIFY(dset2, H5I_INVALID_HID, "H5Ropen_object ref"); /* Test parameters to H5Ropen_region */ - ret_id = H5Ropen_region(NULL, H5I_INVALID_HID, H5I_INVALID_HID); + H5E_BEGIN_TRY + { + ret_id = H5Ropen_region(NULL, H5I_INVALID_HID, H5I_INVALID_HID); + } + H5E_END_TRY; VERIFY(ret_id, H5I_INVALID_HID, "H5Ropen_region ref"); /* Test parameters to H5Ropen_attr */ - ret_id = H5Ropen_attr(NULL, H5P_DEFAULT, aapl_id); + H5E_BEGIN_TRY + { + ret_id = H5Ropen_attr(NULL, H5P_DEFAULT, aapl_id); + } + H5E_END_TRY; VERIFY(ret_id, H5I_INVALID_HID, "H5Ropen_attr ref"); /* Test parameters to H5Rget_obj_type3 */ - ret = H5Rget_obj_type3(NULL, H5P_DEFAULT, NULL); + H5E_BEGIN_TRY + { + ret = H5Rget_obj_type3(NULL, H5P_DEFAULT, NULL); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Rget_obj_type3 ref"); /* Test parameters to H5Rget_file_name */ - name_size = H5Rget_file_name(NULL, NULL, 0); + H5E_BEGIN_TRY + { + name_size = H5Rget_file_name(NULL, NULL, 0); + } + H5E_END_TRY; VERIFY(name_size, (-1), "H5Rget_file_name ref"); /* Test parameters to H5Rget_obj_name */ - name_size = H5Rget_obj_name(NULL, H5P_DEFAULT, NULL, 0); + H5E_BEGIN_TRY + { + name_size = H5Rget_obj_name(NULL, H5P_DEFAULT, NULL, 0); + } + H5E_END_TRY; VERIFY(name_size, (-1), "H5Rget_obj_name ref"); /* Test parameters to H5Rget_attr_name */ - name_size = H5Rget_attr_name(NULL, NULL, 0); + H5E_BEGIN_TRY + { + name_size = H5Rget_attr_name(NULL, NULL, 0); + } + H5E_END_TRY; VERIFY(name_size, (-1), "H5Rget_attr_name ref"); /* Close disk dataspace */ @@ -1920,6 +2024,8 @@ test_reference_obj_deleted(void) H5O_type_t obj_type; /* Object type */ herr_t ret; /* Generic return value */ + MESSAGE(5, ("Testing References to Deleted Objects\n")); + /* Create file */ fid1 = H5Fcreate(FILE_REF_OBJ_DEL, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid1, H5I_INVALID_HID, "H5Fcreate"); @@ -3512,16 +3618,20 @@ test_reference(void) void cleanup_reference(void) { - HDremove(FILE_REF_PARAM); - HDremove(FILE_REF_OBJ); - HDremove(FILE_REF_VL_OBJ); - HDremove(FILE_REF_CMPND_OBJ); - HDremove(FILE_REF_REG); - HDremove(FILE_REF_REG_1D); - HDremove(FILE_REF_OBJ_DEL); - HDremove(FILE_REF_GRP); - HDremove(FILE_REF_ATTR); - HDremove(FILE_REF_EXT1); - HDremove(FILE_REF_EXT2); - HDremove(FILE_REF_COMPAT); + H5E_BEGIN_TRY + { + H5Fdelete(FILE_REF_PARAM, H5P_DEFAULT); + H5Fdelete(FILE_REF_OBJ, H5P_DEFAULT); + H5Fdelete(FILE_REF_VL_OBJ, H5P_DEFAULT); + H5Fdelete(FILE_REF_CMPND_OBJ, H5P_DEFAULT); + H5Fdelete(FILE_REF_REG, H5P_DEFAULT); + H5Fdelete(FILE_REF_REG_1D, H5P_DEFAULT); + H5Fdelete(FILE_REF_OBJ_DEL, H5P_DEFAULT); + H5Fdelete(FILE_REF_GRP, H5P_DEFAULT); + H5Fdelete(FILE_REF_ATTR, H5P_DEFAULT); + H5Fdelete(FILE_REF_EXT1, H5P_DEFAULT); + H5Fdelete(FILE_REF_EXT2, H5P_DEFAULT); + H5Fdelete(FILE_REF_COMPAT, H5P_DEFAULT); + } + H5E_END_TRY; } diff --git a/test/tselect.c b/test/tselect.c index 6b63d2b..3dd739c 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -1025,7 +1025,11 @@ test_select_all_hyper(hid_t xfer_plist) CHECK(ret, FAIL, "H5Sselect_none"); /* Read selection from disk (should fail with no selection defined) */ - ret = H5Dread(dataset, H5T_NATIVE_UCHAR, sid2, sid1, xfer_plist, rbuf); + H5E_BEGIN_TRY + { + ret = H5Dread(dataset, H5T_NATIVE_UCHAR, sid2, sid1, xfer_plist, rbuf); + } + H5E_END_TRY; VERIFY(ret, FAIL, "H5Dread"); /* Select entire 15x26 extent for disk dataset */ @@ -5605,31 +5609,63 @@ test_select_hyper_valid_combination(void) /* Test all the selections created */ /* Test the invalid combinations between point and hyperslab */ - tmp_sid = H5Scombine_select(single_pt_sid, H5S_SELECT_AND, single_hyper_sid); + H5E_BEGIN_TRY + { + tmp_sid = H5Scombine_select(single_pt_sid, H5S_SELECT_AND, single_hyper_sid); + } + H5E_END_TRY; VERIFY(tmp_sid, FAIL, "H5Scombine_select"); - tmp_sid = H5Smodify_select(single_pt_sid, H5S_SELECT_AND, single_hyper_sid); + H5E_BEGIN_TRY + { + tmp_sid = H5Smodify_select(single_pt_sid, H5S_SELECT_AND, single_hyper_sid); + } + H5E_END_TRY; VERIFY(tmp_sid, FAIL, "H5Smodify_select"); /* Test the invalid combination between two hyperslab but of different dimension size */ - tmp_sid = H5Scombine_select(single_hyper_sid, H5S_SELECT_AND, regular_hyper_sid); + H5E_BEGIN_TRY + { + tmp_sid = H5Scombine_select(single_hyper_sid, H5S_SELECT_AND, regular_hyper_sid); + } + H5E_END_TRY; VERIFY(tmp_sid, FAIL, "H5Scombine_select"); - tmp_sid = H5Smodify_select(single_hyper_sid, H5S_SELECT_AND, regular_hyper_sid); + H5E_BEGIN_TRY + { + tmp_sid = H5Smodify_select(single_hyper_sid, H5S_SELECT_AND, regular_hyper_sid); + } + H5E_END_TRY; VERIFY(tmp_sid, FAIL, "H5Smodify_select"); /* Test invalid operation inputs to the two functions */ - tmp_sid = H5Scombine_select(single_hyper_sid, H5S_SELECT_SET, single_hyper_sid); + H5E_BEGIN_TRY + { + tmp_sid = H5Scombine_select(single_hyper_sid, H5S_SELECT_SET, single_hyper_sid); + } + H5E_END_TRY; VERIFY(tmp_sid, FAIL, "H5Scombine_select"); - tmp_sid = H5Smodify_select(single_hyper_sid, H5S_SELECT_SET, single_hyper_sid); + H5E_BEGIN_TRY + { + tmp_sid = H5Smodify_select(single_hyper_sid, H5S_SELECT_SET, single_hyper_sid); + } + H5E_END_TRY; VERIFY(tmp_sid, FAIL, "H5Smodify_select"); /* Test inputs in case of non-existent space ids */ - tmp_sid = H5Scombine_select(single_hyper_sid, H5S_SELECT_AND, non_existent_sid); + H5E_BEGIN_TRY + { + tmp_sid = H5Scombine_select(single_hyper_sid, H5S_SELECT_AND, non_existent_sid); + } + H5E_END_TRY; VERIFY(tmp_sid, FAIL, "H5Scombine_select"); - tmp_sid = H5Smodify_select(single_hyper_sid, H5S_SELECT_AND, non_existent_sid); + H5E_BEGIN_TRY + { + tmp_sid = H5Smodify_select(single_hyper_sid, H5S_SELECT_AND, non_existent_sid); + } + H5E_END_TRY; VERIFY(tmp_sid, FAIL, "H5Smodify_select"); /* Close dataspaces */ @@ -6891,10 +6927,18 @@ test_select_valid(void) MESSAGE(8, ("Case 1 : sub_space is not a valid dataspace\n")); dims[0] = dims[1] = H5S_UNLIMITED; - sub_space = H5Screate_simple(2, dims, NULL); + H5E_BEGIN_TRY + { + sub_space = H5Screate_simple(2, dims, NULL); + } + H5E_END_TRY; VERIFY(sub_space, FAIL, "H5Screate_simple"); - valid = H5Sselect_valid(sub_space); + H5E_BEGIN_TRY + { + valid = H5Sselect_valid(sub_space); + } + H5E_END_TRY; VERIFY(valid, FAIL, "H5Sselect_valid"); /* Set arrays and dataspace for the rest of the cases */ @@ -6911,7 +6955,11 @@ test_select_valid(void) error = H5Sclose(sub_space); CHECK(error, FAIL, "H5Sclose"); - valid = H5Sselect_valid(sub_space); + H5E_BEGIN_TRY + { + valid = H5Sselect_valid(sub_space); + } + H5E_END_TRY; VERIFY(valid, FAIL, "H5Sselect_valid"); MESSAGE(8, ("Case 3 : in the dimensions\nTry offset (4,4) and size(6,6), the original space is of size " @@ -13867,7 +13915,7 @@ test_select_bounds(void) ret = H5Sget_select_bounds(sid, low_bounds, high_bounds); } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Sget_select_bo unds"); + VERIFY(ret, FAIL, "H5Sget_select_bounds"); /* Set point selection */ coord[0][0] = 3; @@ -14650,7 +14698,11 @@ test_hyper_unlim(void) VERIFY(ssize_out, (hssize_t)H5S_UNLIMITED, "H5Sget_select_npoints"); /* Test H5Sget_select_hyper_nblocks() */ - ssize_out = H5Sget_select_hyper_nblocks(sid); + H5E_BEGIN_TRY + { + ssize_out = H5Sget_select_hyper_nblocks(sid); + } + H5E_END_TRY; VERIFY(ssize_out, (hssize_t)H5S_UNLIMITED, "H5Sget_select_hyper_nblocks"); /* Test H5Sget_select_bounds() */ @@ -16211,5 +16263,9 @@ test_select(void) void cleanup_select(void) { - HDremove(FILENAME); + H5E_BEGIN_TRY + { + H5Fdelete(FILENAME, H5P_DEFAULT); + } + H5E_END_TRY; } diff --git a/test/ttime.c b/test/ttime.c index 99f38bc..49ddafd 100644 --- a/test/ttime.c +++ b/test/ttime.c @@ -227,5 +227,9 @@ test_time(void) void cleanup_time(void) { - HDremove(DATAFILE); + H5E_BEGIN_TRY + { + H5Fdelete(DATAFILE, H5P_DEFAULT); + } + H5E_END_TRY; } diff --git a/test/tunicode.c b/test/tunicode.c index bf5f64f..27df42d 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -859,5 +859,9 @@ test_unicode(void) void cleanup_unicode(void) { - HDremove(FILENAME); + H5E_BEGIN_TRY + { + H5Fdelete(FILENAME, H5P_DEFAULT); + } + H5E_END_TRY; } diff --git a/test/tvlstr.c b/test/tvlstr.c index c9204a5..b27b2be 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -880,6 +880,8 @@ test_write_same_element(void) hsize_t coord[SPACE1_RANK][NUMP]; herr_t ret; + MESSAGE(5, ("Testing writing to same element of VL string dataset twice\n")); + file1 = H5Fcreate(DATAFILE3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(file1, FAIL, "H5Fcreate"); @@ -1000,7 +1002,11 @@ test_vlstrings(void) void cleanup_vlstrings(void) { - HDremove(DATAFILE); - HDremove(DATAFILE2); - HDremove(DATAFILE3); + H5E_BEGIN_TRY + { + H5Fdelete(DATAFILE, H5P_DEFAULT); + H5Fdelete(DATAFILE2, H5P_DEFAULT); + H5Fdelete(DATAFILE3, H5P_DEFAULT); + } + H5E_END_TRY; } diff --git a/test/tvltypes.c b/test/tvltypes.c index c791350..d14f70d 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -3261,5 +3261,9 @@ test_vltypes(void) void cleanup_vltypes(void) { - HDremove(FILENAME); + H5E_BEGIN_TRY + { + H5Fdelete(FILENAME, H5P_DEFAULT); + } + H5E_END_TRY; } diff --git a/testpar/t_bigio.c b/testpar/t_bigio.c index 4ecb09e..af65cda 100644 --- a/testpar/t_bigio.c +++ b/testpar/t_bigio.c @@ -26,7 +26,7 @@ const char *FILENAME[3] = {"bigio_test.h5", "single_rank_independent_io.h5", NUL #define DATASET4 "DSET4" #define DXFER_COLLECTIVE_IO 0x1 /* Collective IO*/ #define DXFER_INDEPENDENT_IO 0x2 /* Independent IO collectively */ -#define DXFER_BIGCOUNT (1 < 29) +#define DXFER_BIGCOUNT (1 << 29) #define HYPER 1 #define POINT 2 @@ -1165,9 +1165,16 @@ single_rank_independent_io(void) free(data); H5Sclose(fspace_id); - H5Pclose(fapl_id); H5Dclose(dset_id); H5Fclose(file_id); + + H5E_BEGIN_TRY + { + H5Fdelete(FILENAME[1], fapl_id); + } + H5E_END_TRY; + + H5Pclose(fapl_id); } MPI_Barrier(MPI_COMM_WORLD); } diff --git a/testpar/t_file.c b/testpar/t_file.c index 99ad13c..90ae22d 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -95,19 +95,21 @@ test_split_comm_access(void) fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl); VRFY((fid >= 0), "H5Fcreate succeeded"); - /* Release file-access template */ - ret = H5Pclose(acc_tpl); - VRFY((ret >= 0), ""); - /* close the file */ ret = H5Fclose(fid); VRFY((ret >= 0), ""); /* delete the test file */ - if (sub_mpi_rank == 0) { - mrc = MPI_File_delete(filename, info); - /*VRFY((mrc==MPI_SUCCESS), ""); */ + H5E_BEGIN_TRY + { + ret = H5Fdelete(filename, acc_tpl); } + H5E_END_TRY; + VRFY((ret >= 0), "H5Fdelete succeeded"); + + /* Release file-access template */ + ret = H5Pclose(acc_tpl); + VRFY((ret >= 0), ""); } mrc = MPI_Comm_free(&comm); VRFY((mrc == MPI_SUCCESS), "MPI_Comm_free succeeded"); diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c index cbae5e1..c11f95c 100644 --- a/testpar/t_shapesame.c +++ b/testpar/t_shapesame.c @@ -4305,7 +4305,8 @@ main(int argc, char **argv) * calls. By then, MPI calls may not work. */ if (H5dont_atexit() < 0) { - HDprintf("%d: Failed to turn off atexit processing. Continue.\n", mpi_rank); + if (MAINPROCESS) + HDprintf("%d: Failed to turn off atexit processing. Continue.\n", mpi_rank); }; H5open(); h5_show_hostname(); -- cgit v0.12