diff options
author | kmu <kmu@hdfgroup.org> | 2020-01-21 03:11:32 (GMT) |
---|---|---|
committer | kmu <kmu@hdfgroup.org> | 2020-01-21 03:11:32 (GMT) |
commit | 9be5b2842e307f5f5b67c7e42217ddff67b0bf61 (patch) | |
tree | b23156eec2d83f8755971dd5cc746c28ea7c338a /test | |
parent | 628d267162895adef5a73e1cd5810030cc98335a (diff) | |
parent | a95b5b1e056e171702ad41b69cb796da0cbb91eb (diff) | |
download | hdf5-9be5b2842e307f5f5b67c7e42217ddff67b0bf61.zip hdf5-9be5b2842e307f5f5b67c7e42217ddff67b0bf61.tar.gz hdf5-9be5b2842e307f5f5b67c7e42217ddff67b0bf61.tar.bz2 |
merge and fix
Diffstat (limited to 'test')
40 files changed, 7403 insertions, 1992 deletions
diff --git a/test/cache_tagging.c b/test/cache_tagging.c index b77a198..cf0cd8d 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -24,6 +24,7 @@ #include "H5CXprivate.h" /* API Contexts */ #include "H5HLprivate.h" +#include "H5VLnative_private.h" /* Native VOL connector */ /* ============ */ /* Test Defines */ @@ -374,14 +375,15 @@ error: static int get_object_header_tag(hid_t loc_id, haddr_t *tag) { - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ /* Retrieve the info for the object */ - if(H5Oget_info2(loc_id, &oinfo, H5O_INFO_ALL) < 0) + if(H5Oget_info3(loc_id, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR; /* Set the tag to return */ - *tag = oinfo.addr; + if(H5VLnative_token_to_addr(loc_id, oinfo.token, tag) < 0) + TEST_ERROR; return 0; @@ -441,7 +443,7 @@ check_file_creation_tags(hid_t fcpl_id, int type) hid_t fid = -1; /* File Identifier */ #ifndef NDEBUG int verbose = FALSE; /* verbose test outout */ -#endif +#endif /* NDEBUG */ /* end debugging functions */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t sbe_tag = 0; @@ -530,7 +532,7 @@ check_file_open_tags(hid_t fcpl, int type) hid_t fid = -1; /* File Identifier */ #ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ -#endif +#endif /* NDEBUG */ /* end debugging functions */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag; /* Root Group Tag */ haddr_t sbe_tag; /* Sblock Extension Tag */ @@ -645,7 +647,7 @@ check_group_creation_tags(void) hid_t gid = -1; /* Group Identifier */ #ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ -#endif +#endif /* NDEBUG */ /* end debugging functions */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = HADDR_UNDEF; /* Root Group Tag */ haddr_t g_tag; /* Group Tag */ @@ -748,7 +750,7 @@ check_multi_group_creation_tags(void) hid_t gid = -1; /* Group Identifier */ #ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ -#endif +#endif /* NDEBUG */ /* end debugging functions */ char gname[16]; /* group name buffer */ int i = 0; /* iterator */ hid_t fapl = -1; /* File access prop list */ @@ -879,7 +881,7 @@ check_link_iteration_tags(void) hid_t did = -1; /* Group Identifier */ #ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ -#endif +#endif /* NDEBUG */ /* end debugging functions */ int i = 0; /* iterator */ haddr_t root_tag = 0; /* Root Group Tag Value */ char dsetname[500]; /* Name of dataset */ @@ -1001,7 +1003,7 @@ check_dense_attribute_tags(void) hid_t dcpl = -1; /* Group Identifier */ #ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ -#endif +#endif /* NDEBUG */ /* end debugging functions */ int i = 0; /* iterator */ hid_t fapl = -1; /* File access property list */ haddr_t d_tag = 0; /* Dataset tag value */ @@ -1185,7 +1187,7 @@ check_group_open_tags(void) hid_t gid = -1; /* Group Identifier */ #ifndef NDEBUG int verbose = FALSE; /* verbose file output */ -#endif +#endif /* NDEBUG */ /* end debugging functions */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = HADDR_UNDEF; haddr_t g_tag; @@ -1296,7 +1298,7 @@ check_attribute_creation_tags(hid_t fcpl, int type) hid_t sid = -1; /* Dataspace Identifier */ #ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ -#endif +#endif /* NDEBUG */ /* end debugging functions */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; /* Root group tag */ haddr_t g_tag = 0; @@ -1432,7 +1434,7 @@ check_attribute_open_tags(hid_t fcpl, int type) hid_t sid = -1; /* Dataspace Identifier */ #ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ -#endif +#endif /* NDEBUG */ /* end debugging functions */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t g_tag = 0; @@ -1571,7 +1573,7 @@ check_attribute_rename_tags(hid_t fcpl, int type) hid_t sid = -1; /* Dataset Identifier */ #ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ -#endif +#endif /* NDEBUG */ /* end debugging functions */ int *data = NULL; /* data buffer */ int i,j,k = 0; /* iterators */ hid_t fapl = -1; /* File access prop list */ @@ -1748,7 +1750,7 @@ check_attribute_delete_tags(hid_t fcpl, int type) hid_t sid = -1; /* Dataset Identifier */ #ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ -#endif +#endif /* NDEBUG */ /* end debugging functions */ int *data = NULL; /* data buffer */ int i,j,k = 0; /* iterators */ hid_t fapl = -1; /* File access prop list */ @@ -1916,7 +1918,7 @@ check_dataset_creation_tags(hid_t fcpl, int type) hid_t sid = -1; /* Dataspace Identifier */ #ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ -#endif +#endif /* NDEBUG */ /* end debugging functions */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; @@ -2051,7 +2053,7 @@ check_dataset_creation_earlyalloc_tags(hid_t fcpl, int type) hid_t sid = -1; /* Dataspace Identifier */ #ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ -#endif +#endif /* NDEBUG */ /* end debugging functions */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; @@ -2190,7 +2192,7 @@ check_dataset_open_tags(void) hid_t sid = -1; /* Dataspace Identifier */ #ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ -#endif +#endif /* NDEBUG */ /* end debugging functions */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; @@ -2318,7 +2320,7 @@ check_dataset_write_tags(void) hid_t sid = -1; /* Dataspace Identifier */ #ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ -#endif +#endif /* NDEBUG */ /* end debugging functions */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; @@ -2462,7 +2464,7 @@ check_attribute_write_tags(hid_t fcpl, int type) hid_t sid = -1; /* Dataset Identifier */ #ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ -#endif +#endif /* NDEBUG */ /* end debugging functions */ int *data = NULL; /* data buffer */ int i,j,k = 0; /* iterators */ hid_t fapl = -1; /* File access prop list */ @@ -2617,7 +2619,7 @@ check_dataset_read_tags(void) hid_t sid = -1; /* Dataspace Identifier */ #ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ -#endif +#endif /* NDEBUG */ /* end debugging functions */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; @@ -2756,7 +2758,7 @@ check_dataset_size_retrieval(void) hid_t sid = -1; /* Dataspace Identifier */ #ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ -#endif +#endif /* NDEBUG */ /* end debugging functions */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; @@ -2897,7 +2899,7 @@ check_dataset_extend_tags(void) hid_t sid = -1; /* Dataspace Identifier */ #ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ -#endif +#endif /* NDEBUG */ /* end debugging functions */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; @@ -3036,11 +3038,11 @@ check_object_info_tags(void) hid_t gid = -1; /* Group Identifier */ #ifndef NDEBUG int verbose = FALSE; /* verbose file output */ -#endif +#endif /* NDEBUG */ /* end debugging functions */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = HADDR_UNDEF; haddr_t g_tag; - H5O_info_t oinfo; /* Object info struct */ + H5O_native_info_t ninfo; /* Native object info struct */ /* Testing Macro */ TESTING("tag application during object info retrieval"); @@ -3080,7 +3082,10 @@ check_object_info_tags(void) /* Get information on an object by name */ /* ===================================== */ - if ( H5Oget_info_by_name2(fid, GROUPNAME, &oinfo, H5O_INFO_ALL, H5P_DEFAULT) < 0 ) TEST_ERROR; + /* Even though we do nothing with this, touching the internal + * data structures is needed for the test to pass. + */ + if ( H5Oget_native_info_by_name(fid, GROUPNAME, &ninfo, H5O_NATIVE_INFO_ALL, H5P_DEFAULT) < 0 ) TEST_ERROR; /* =================================== */ /* Verification of Metadata Tag Values */ @@ -3147,7 +3152,7 @@ check_object_copy_tags(void) hid_t gid = -1; /* Group Identifier */ #ifndef NDEBUG int verbose = FALSE; /* verbose file output */ -#endif +#endif /* NDEBUG */ /* end debugging functions */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = HADDR_UNDEF; haddr_t g_tag; @@ -3270,7 +3275,7 @@ check_link_removal_tags(hid_t fcpl, int type) hid_t gid = -1; /* Dataspace Identifier */ #ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ -#endif +#endif /* NDEBUG */ /* end debugging functions */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; @@ -3431,7 +3436,7 @@ check_link_getname_tags(void) hid_t gid = -1; /* Dataspace Identifier */ #ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ -#endif +#endif /* NDEBUG */ /* end debugging functions */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; @@ -3582,7 +3587,7 @@ check_external_link_creation_tags(void) hid_t gid = -1; /* Dataspace Identifier */ #ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ -#endif +#endif /* NDEBUG */ /* end debugging functions */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; @@ -3690,7 +3695,8 @@ check_external_link_open_tags(void) hid_t xid = -1; /* Dataspace Identifier */ #ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ -#endif +#endif /* NDEBUG */ /* end debugging functions */ + H5O_native_info_t ninfo; /* Native object info struct */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t root2_tag = 0; @@ -3744,6 +3750,11 @@ check_external_link_open_tags(void) if ( (fid2 = H5Iget_file_id(xid)) < 0) TEST_ERROR; if ( get_object_header_tag(xid, &link_tag) < 0 ) TEST_ERROR; + /* Even though we do nothing with this, touching the internal + * data structures is needed for the test to pass. + */ + if ( H5Oget_native_info(xid, &ninfo, H5O_NATIVE_INFO_ALL) < 0 ) TEST_ERROR; + /* =================================== */ /* Verification of Metadata Tag Values */ /* =================================== */ diff --git a/test/chunk_info.c b/test/chunk_info.c index 057991c..0afff66 100644 --- a/test/chunk_info.c +++ b/test/chunk_info.c @@ -119,7 +119,7 @@ const char *FILENAME[] = { #define INVALID_CHK_INDEX 5 /* For compressed data */ -#define DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s))*1.001)+12) +#define DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s))*1.001)+12.0) /* For use in error reporting */ #define MSG_CHK_ADDR "Chunk address should not be HADDR_UNDEF because of H5D_ALLOC_TIME_EARLY." diff --git a/test/cork.c b/test/cork.c index 78b6b01..125c53e 100644 --- a/test/cork.c +++ b/test/cork.c @@ -102,7 +102,7 @@ verify_old_dset_cork(void) int **buf = NULL; /* Data bufer (pointers to fake 2D array) */ int *buf_data = NULL; /* Data buffer (actual data) */ int i = 0, j = 0; /* Local index variables */ - H5O_info_t oinfo, oinfo2, oinfo3; /* Object metadata information */ + H5O_info2_t oinfo, oinfo2, oinfo3; /* Object metadata information */ hsize_t dims2[2] = {8, 16}; /* Dataset dimension sizes */ /* Testing Macro */ @@ -127,7 +127,7 @@ verify_old_dset_cork(void) TEST_ERROR /* Get dataset object header address: DSET_BT1 */ - if(H5Oget_info2(did, &oinfo, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET_BT1 */ @@ -135,7 +135,7 @@ verify_old_dset_cork(void) TEST_ERROR /* Verify cork status */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0) TEST_ERROR /* Set up data array */ @@ -156,7 +156,7 @@ verify_old_dset_cork(void) TEST_ERROR /* Verify the cork status for DSET_BT1 */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0) TEST_ERROR /* Create compact dataset: DSET_COMPACT */ @@ -172,7 +172,7 @@ verify_old_dset_cork(void) FAIL_STACK_ERROR /* Get dataset object address */ - if(H5Oget_info2(did2, &oinfo2, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET_COMPACT */ @@ -180,7 +180,7 @@ verify_old_dset_cork(void) TEST_ERROR /* Verify cork status */ - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0) TEST_ERROR /* Closing */ @@ -220,7 +220,7 @@ verify_old_dset_cork(void) FAIL_STACK_ERROR /* Get dataset object address: DSET_CONTIG */ - if(H5Oget_info2(did3, &oinfo3, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did3, &oinfo3, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET_CONTIG */ @@ -228,11 +228,11 @@ verify_old_dset_cork(void) TEST_ERROR /* Verify the cork status for DSET_CONTIG */ - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0) TEST_ERROR /* Verify the cork status for DSET_BT1 */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0) TEST_ERROR /* Un-cork the dataset: DSET_CONTIG */ @@ -240,7 +240,7 @@ verify_old_dset_cork(void) TEST_ERROR /* Verify the cork status for DSET_CONTIG */ - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, FALSE) < 0) TEST_ERROR /* Closing */ @@ -307,7 +307,7 @@ verify_obj_dset_cork(hbool_t swmr) int i = 0; /* Local index variable */ hsize_t dim[1] = {100}; /* Dataset dimension size */ hsize_t chunk_dim[1] = {7}; /* Dataset chunk dimension size */ - H5O_info_t oinfo, oinfo2; /* Object metadata information */ + H5O_info2_t oinfo, oinfo2; /* Object metadata information */ char attrname[500]; /* Name of attribute */ unsigned flags; /* File access flags */ @@ -340,11 +340,11 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Get dataset object header address */ - if(H5Oget_info2(did, &oinfo, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR /* Verify cork status of the dataset: DSET */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0) TEST_ERROR /* Cork the dataset: DSET */ @@ -356,7 +356,7 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the dataset: DSET */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0) TEST_ERROR /* Close the attribute */ @@ -364,7 +364,7 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the dataset: DSET */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0) TEST_ERROR /* Create dcpl */ @@ -383,7 +383,7 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Get dataset object header address */ - if(H5Oget_info2(did2, &oinfo2, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET_NONE */ @@ -402,7 +402,7 @@ verify_obj_dset_cork(hbool_t swmr) } /* end for */ /* Verify cork status of the dataset: DSET_NONE */ - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0) TEST_ERROR /* Closing */ @@ -431,7 +431,7 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the dataset: DSET */ - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, FALSE) < 0) TEST_ERROR /* Open the attribute attached to the dataset object: DSET_NONE */ @@ -443,7 +443,7 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the dataset: DSET_NONE */ - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0) TEST_ERROR /* Close the attribute */ @@ -451,7 +451,7 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the dataset: DSET */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0) TEST_ERROR /* Closing */ @@ -510,8 +510,8 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) int **buf = NULL; /* Data bufer (pointers to fake 2D array) */ int *buf_data = NULL; /* Data buffer (actual data) */ int i = 0, j = 0; /* Local index variables */ - H5O_info_t oinfo, oinfo2, oinfo3; /* Object metadata information */ - unsigned flags; /* File access flags */ + H5O_info2_t oinfo, oinfo2, oinfo3; /* Object metadata information */ + unsigned flags; /* File access flags */ /* Testing Macro */ if(swmr) { @@ -559,7 +559,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Get dataset object header address: DSET_EA */ - if(H5Oget_info2(did, &oinfo, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET_EA */ @@ -567,7 +567,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Verify cork status */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0) TEST_ERROR /* Create chunked dataset with fixed array indexing: DSET_FA */ @@ -577,7 +577,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Get dataset object header address: DSET_FA */ - if(H5Oget_info2(did2, &oinfo2, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET_FA */ @@ -589,11 +589,11 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Verify the cork status for DSET_FA */ - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0) TEST_ERROR /* Verify the cork status for DSET_EA */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0) TEST_ERROR /* Create chunked dataset with v2-Btree indexing */ @@ -604,7 +604,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Get dataset object header address: DSET_BT2 */ - if(H5Oget_info2(did3, &oinfo3, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did3, &oinfo3, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET_BT2 */ @@ -612,7 +612,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Verify the cork status for DSET_BT2 */ - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0) TEST_ERROR /* Closing */ @@ -663,7 +663,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Verify the cork status for DSET_EA */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0) TEST_ERROR /* Open and write to the dataset: DSET_FA */ @@ -677,7 +677,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Verify the cork status for DSET_FA */ - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0) TEST_ERROR /* Open and write to the dataset: DSET_BT2 */ @@ -687,7 +687,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Verify the cork status for DSET_BT2 */ - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, FALSE) < 0) TEST_ERROR /* Cork the dataset: DSET_BT2 */ @@ -695,7 +695,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Verify the cork status for DSET_BT2 */ - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0) TEST_ERROR /* Closing */ @@ -757,11 +757,11 @@ verify_group_cork(hbool_t swmr) hid_t fid = -1; /* File ID */ hid_t fapl = -1; /* File access property list */ hid_t gid = -1, gid2 = -1, gid3 = -1; /* Group IDs */ - H5O_info_t oinfo, oinfo2, oinfo3; /* Object metadata information */ - hid_t aid; /* Attribute ID */ - hid_t sid; /* Dataspace ID */ + H5O_info2_t oinfo, oinfo2, oinfo3; /* Object metadata information */ + hid_t aid; /* Attribute ID */ + hid_t sid; /* Dataspace ID */ char attrname[500]; /* Name of attribute */ - unsigned flags; /* File access flags */ + unsigned flags; /* File access flags */ int i = 0; /* Local index variable */ /* Testing Macro */ @@ -798,19 +798,19 @@ verify_group_cork(hbool_t swmr) TEST_ERROR /* Get group object header addresses */ - if(H5Oget_info2(gid, &oinfo, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(gid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(gid2, &oinfo2, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(gid2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(gid3, &oinfo3, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(gid3, &oinfo3, H5O_INFO_BASIC) < 0) TEST_ERROR /* Verify cork status of the groups */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, FALSE) < 0) TEST_ERROR /* Close the second group: GRP2 */ @@ -822,7 +822,7 @@ verify_group_cork(hbool_t swmr) FAIL_STACK_ERROR /* Verify cork status of the second group: GRP2 */ - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, FALSE) < 0) TEST_ERROR /* Closing */ @@ -863,7 +863,7 @@ verify_group_cork(hbool_t swmr) if(i == 3) { if(H5Odisable_mdc_flushes(gid3) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0) TEST_ERROR } if(H5Aclose(aid) < 0) @@ -871,7 +871,7 @@ verify_group_cork(hbool_t swmr) } /* end for */ /* Verify cork status of the third group: GRP3 */ - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0) TEST_ERROR /* Closing */ @@ -925,12 +925,12 @@ verify_named_cork(hbool_t swmr) hid_t fapl = -1; /* File access property list */ hid_t tid = -1, tid2 = -1, tid3 = -1; /* Datatype IDs */ hid_t gid = -1, gid2 = -1; /* Group IDs */ - H5O_info_t oinfo, oinfo2, oinfo3, oinfo4; /* Object metadata information */ - hid_t aid = -1; /* Attribute ID */ - hid_t sid; /* Dataspace ID */ - hid_t did; /* Dataset ID */ + H5O_info2_t oinfo, oinfo2, oinfo3, oinfo4; /* Object metadata information */ + hid_t aid = -1; /* Attribute ID */ + hid_t sid; /* Dataspace ID */ + hid_t did; /* Dataset ID */ char attrname[500]; /* Name of attribute */ - unsigned flags; /* File access flags */ + unsigned flags; /* File access flags */ int i = 0; /* Local index variable */ /* Testing Macro */ @@ -987,19 +987,19 @@ verify_named_cork(hbool_t swmr) TEST_ERROR /* Get named datatype object header addresses */ - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(tid2, &oinfo2, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(tid2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(tid3, &oinfo3, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(tid3, &oinfo3, H5O_INFO_BASIC) < 0) TEST_ERROR /* Verify cork status of the named datatypes */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, FALSE) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0) TEST_ERROR /* Close the datatypes */ @@ -1019,11 +1019,11 @@ verify_named_cork(hbool_t swmr) FAIL_STACK_ERROR /* Verify cork status of the named datatypes */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, FALSE) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, FALSE) < 0) TEST_ERROR /* Closing */ @@ -1079,7 +1079,7 @@ verify_named_cork(hbool_t swmr) if(i == 3) { if(H5Odisable_mdc_flushes(tid3) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0) TEST_ERROR } if(H5Aclose(aid) < 0) @@ -1091,7 +1091,7 @@ verify_named_cork(hbool_t swmr) FAIL_STACK_ERROR /* Get dataset object header address */ - if(H5Oget_info2(did, &oinfo4, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did, &oinfo4, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET */ @@ -1099,20 +1099,20 @@ verify_named_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the datatype: DT */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0) TEST_ERROR /* Verify cork status of the datatype: DT2 */ - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0) TEST_ERROR /* Verify cork status of the datatype: DT3 */ - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0) TEST_ERROR /* Un-cork the datatype: DT3 */ if(H5Oenable_mdc_flushes(tid3) < 0) TEST_ERROR /* Verify cork status of the datatype: DT3 */ - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, FALSE) < 0) TEST_ERROR /* Cork the datatype: DT */ @@ -1120,14 +1120,14 @@ verify_named_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the datatype: DT */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0) TEST_ERROR /* Verify cork status of the datatype: DT2 */ - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0) TEST_ERROR /* Verify cork status of the dataset: DSET */ - if(H5C__verify_cork_tag_test(fid, oinfo4.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo4.token, TRUE) < 0) TEST_ERROR /* Close the dataset */ @@ -1135,11 +1135,11 @@ verify_named_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the datatype: DT */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0) TEST_ERROR /* Verify cork status of the dataset: DSET */ - if(H5C__verify_cork_tag_test(fid, oinfo4.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo4.token, FALSE) < 0) TEST_ERROR /* Closing */ @@ -1206,10 +1206,10 @@ verify_multiple_cork(hbool_t swmr) hid_t aidd1 = -1, aidd2 = -1; /* Attribute ID */ hid_t aidt1 = -1, aidt2 = -1; /* Attribute ID */ hid_t sid = -1; /* Dataspace ID */ - H5O_info_t oinfo1, oinfo2, oinfo3; /* Object metadata information */ - hsize_t dim[1] = {5}; /* Dimension sizes */ - unsigned flags; /* File access flags */ - hbool_t corked; /* Cork status */ + H5O_info2_t oinfo1, oinfo2, oinfo3; /* Object metadata information */ + hsize_t dim[1] = {5}; /* Dimension sizes */ + unsigned flags; /* File access flags */ + hbool_t corked; /* Cork status */ herr_t ret; /* Return value */ /* Testing Macro */ @@ -1305,9 +1305,9 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the group: gid2 */ - if(H5Oget_info2(gid2, &oinfo1, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(gid2, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid2, oinfo1.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid2, oinfo1.token, TRUE) < 0) TEST_ERROR /* Check cork status of the group: gid1 */ @@ -1333,9 +1333,9 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the dataset: did1 */ - if(H5Oget_info2(did1, &oinfo2, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did1, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid1, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid1, oinfo2.token, TRUE) < 0) TEST_ERROR /* Check cork status of the dataset: did2 */ @@ -1361,9 +1361,9 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the datatype: tid2 */ - if(H5Oget_info2(tid2, &oinfo3, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(tid2, &oinfo3, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid2, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid2, oinfo3.token, TRUE) < 0) TEST_ERROR /* Check cork status of the datatype: tid1 */ @@ -1377,9 +1377,9 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the group: gid1 */ - if(H5Oget_info2(gid1, &oinfo1, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(gid1, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid1, oinfo1.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid1, oinfo1.token, FALSE) < 0) TEST_ERROR /* Check cork status of the group: gid2 */ @@ -1399,7 +1399,7 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the group: gid1 */ - if(H5C__verify_cork_tag_test(fid1, oinfo1.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid1, oinfo1.token, FALSE) < 0) TEST_ERROR /* Close the group: gid1 */ @@ -1411,9 +1411,9 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the dataset: did2 */ - if(H5Oget_info2(did2, &oinfo2, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid2, oinfo2.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid2, oinfo2.token, FALSE) < 0) TEST_ERROR /* Check cork status of the dataset: did1 */ @@ -1433,7 +1433,7 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the dataset: did1 */ - if(H5C__verify_cork_tag_test(fid1, oinfo2.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid1, oinfo2.token, FALSE) < 0) TEST_ERROR /* Close the dataset: did1 */ diff --git a/test/direct_chunk.c b/test/direct_chunk.c index 7b17043..6cf27c8 100644 --- a/test/direct_chunk.c +++ b/test/direct_chunk.c @@ -661,20 +661,20 @@ filter_bogus1(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts, size_t *buf_size, void **buf) { int *int_ptr=(int *)*buf; /* Pointer to the data values */ - ssize_t buf_left=(ssize_t)*buf_size; /* Amount of data buffer left to process */ + size_t buf_left=*buf_size; /* Amount of data buffer left to process */ if(flags & H5Z_FLAG_REVERSE) { /* read */ /* Substract the "add on" value to all the data values */ while(buf_left>0) { *int_ptr++ -= (int)ADD_ON; - buf_left -= (ssize_t)sizeof(int); + buf_left -= sizeof(int); } /* end while */ } /* end if */ else { /* write */ /* Add the "add on" value to all the data values */ while(buf_left>0) { *int_ptr++ += (int)ADD_ON; - buf_left -= (ssize_t)sizeof(int); + buf_left -= sizeof(int); } /* end while */ } /* end else */ @@ -698,20 +698,20 @@ filter_bogus2(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts, size_t *buf_size, void **buf) { int *int_ptr=(int *)*buf; /* Pointer to the data values */ - ssize_t buf_left=(ssize_t)*buf_size; /* Amount of data buffer left to process */ + size_t buf_left=*buf_size; /* Amount of data buffer left to process */ if(flags & H5Z_FLAG_REVERSE) { /* read */ /* Substract the "add on" value to all the data values */ while(buf_left>0) { *int_ptr++ /= (int)FACTOR; - buf_left -= (ssize_t)sizeof(int); + buf_left -= sizeof(int); } /* end while */ } /* end if */ else { /* write */ /* Add the "add on" value to all the data values */ while(buf_left>0) { *int_ptr++ *= (int)FACTOR; - buf_left -= (ssize_t)sizeof(int); + buf_left -= sizeof(int); } /* end while */ } /* end else */ diff --git a/test/dsets.c b/test/dsets.c index 8b797f6..061642a 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -147,10 +147,12 @@ const char *FILENAME[] = { #define DSET_COPY_DCPL_NAME_1 "copy_dcpl_1" #define DSET_COPY_DCPL_NAME_2 "copy_dcpl_2" #define COPY_DCPL_EXTFILE_NAME "ext_file" +#ifndef H5_NO_DEPRECATED_SYMBOLS #define DSET_DEPREC_NAME "deprecated" #define DSET_DEPREC_NAME_CHUNKED "deprecated_chunked" #define DSET_DEPREC_NAME_COMPACT "deprecated_compact" #define DSET_DEPREC_NAME_FILTER "deprecated_filter" +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Dataset names for testing Fixed Array Indexing */ #define DSET_FIXED_MAX "DSET_FIXED_MAX" @@ -176,7 +178,9 @@ const char *FILENAME[] = { #define H5Z_FILTER_CORRUPT 306 #define H5Z_FILTER_CAN_APPLY_TEST 307 #define H5Z_FILTER_SET_LOCAL_TEST 308 +#ifndef H5_NO_DEPRECATED_SYMBOLS #define H5Z_FILTER_DEPREC 309 +#endif /* H5_NO_DEPRECATED_SYMBOLS */ #define H5Z_FILTER_EXPAND 310 #define H5Z_FILTER_CAN_APPLY_TEST2 311 #define H5Z_FILTER_COUNT 312 @@ -272,10 +276,16 @@ const char *FILENAME[] = { /* Shared global arrays */ #define DSET_DIM1 100 #define DSET_DIM2 200 -int points[DSET_DIM1][DSET_DIM2], check[DSET_DIM1][DSET_DIM2]; -double points_dbl[DSET_DIM1][DSET_DIM2], check_dbl[DSET_DIM1][DSET_DIM2]; -size_t count_nbytes_read = 0; -size_t count_nbytes_written = 0; +int **points = NULL; +int *points_data = NULL; +double **points_dbl = NULL; +double *points_dbl_data = NULL; +int **check = NULL; +int *check_data = NULL; +double **check_dbl = NULL; +double *check_dbl_data = NULL; +size_t count_nbytes_read = 0; +size_t count_nbytes_written = 0; /* Temporary buffer dimensions */ #define DSET_TMP_DIM1 50 @@ -511,7 +521,8 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) void *tconv_buf = NULL; int f = -1; haddr_t offset; - int rdata[DSET_DIM1][DSET_DIM2]; + int **rdata = NULL; + int *rdata_bytes = NULL; TESTING("simple I/O"); @@ -519,6 +530,14 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")) { h5_fixname(FILENAME[4], fapl, filename, sizeof filename); + /* Set up data array */ + if(NULL == (rdata_bytes = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int)))) + TEST_ERROR; + if(NULL == (rdata = (int **)HDcalloc(DSET_DIM1, sizeof(rdata_bytes)))) + TEST_ERROR; + for (i = 0; i < DSET_DIM1; i++) + rdata[i] = rdata_bytes + (i * DSET_DIM2); + /* Initialize the dataset */ for(i = n = 0; i < DSET_DIM1; i++) for(j = 0; j < DSET_DIM2; j++) @@ -548,7 +567,7 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) if(H5Dget_offset(dataset) != HADDR_UNDEF) goto error; /* Write the data to the dataset */ - if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer, points) < 0) + if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer, points_data) < 0) goto error; /* Test dataset address in file. Open the same file as a C file, seek @@ -557,7 +576,7 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) if((offset=H5Dget_offset(dataset))==HADDR_UNDEF) goto error; /* Read the dataset back */ - if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer, check) < 0) + if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer, check_data) < 0) goto error; /* Check that the values read are the same as the values written */ @@ -581,7 +600,7 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) f = HDopen(filename, O_RDONLY); HDlseek(f, (off_t)offset, SEEK_SET); - if(HDread(f, rdata, sizeof(int)*DSET_DIM1*DSET_DIM2) < 0) + if(HDread(f, rdata_bytes, sizeof(int)*DSET_DIM1*DSET_DIM2) < 0) goto error; /* Check that the values read are the same as the values written */ @@ -600,6 +619,9 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) f = -1; HDfree(tconv_buf); + HDfree(rdata_bytes); + HDfree(rdata); + PASSED(); } /* end if */ else { @@ -620,8 +642,11 @@ error: if(H5Fclose(file) < 0) TEST_ERROR if(f > 0) HDclose(f); - if(tconv_buf) - HDfree(tconv_buf); + + HDfree(tconv_buf); + HDfree(rdata_bytes); + HDfree(rdata); + return FAIL; } /* end test_simple_io() */ @@ -644,7 +669,8 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) hsize_t dims[2]; int f = -1; haddr_t offset; - int rdata[DSET_DIM1][DSET_DIM2]; + int **rdata = NULL; + int *rdata_bytes = NULL; TESTING("dataset offset with user block"); @@ -652,6 +678,14 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")) { h5_fixname(FILENAME[2], fapl, filename, sizeof filename); + /* Set up data array */ + if(NULL == (rdata_bytes = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int)))) + TEST_ERROR; + if(NULL == (rdata = (int **)HDcalloc(DSET_DIM1, sizeof(rdata_bytes)))) + TEST_ERROR; + for (i = 0; i < DSET_DIM1; i++) + rdata[i] = rdata_bytes + (i * DSET_DIM2); + if((fcpl=H5Pcreate(H5P_FILE_CREATE)) < 0) goto error; if(H5Pset_userblock(fcpl, (hsize_t)USER_BLOCK) < 0) goto error; if(new_format) @@ -675,7 +709,7 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) space = -1; /* Write the data to the dataset */ - if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) + if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0) goto error; /* Test dataset address in file. Open the same file as a C file, seek @@ -690,7 +724,7 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) f = HDopen(filename, O_RDONLY); HDlseek(f, (off_t)offset, SEEK_SET); - if(HDread(f, rdata, sizeof(int)*DSET_DIM1*DSET_DIM2) < 0) + if(HDread(f, rdata_bytes, sizeof(int)*DSET_DIM1*DSET_DIM2) < 0) goto error; /* Check that the values read are the same as the values written */ @@ -708,6 +742,9 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) HDclose(f); f = -1; + HDfree(rdata_bytes); + HDfree(rdata); + PASSED(); } /* end if */ else { @@ -728,6 +765,10 @@ error: if(H5Fclose(file) < 0) TEST_ERROR if(f > 0) HDclose(f); + + HDfree(rdata_bytes); + HDfree(rdata); + return FAIL; } /* end test_userblock_offset() */ @@ -1786,7 +1827,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, */ TESTING(" filters (uninitialized read)"); - if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) + if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0) TEST_ERROR; for(i=0; i<(size_t)size[0]; i++) { @@ -1815,7 +1856,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, } } - if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points) < 0) + if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points_data) < 0) TEST_ERROR; if((*dset_size=H5Dget_storage_size(dataset))==0) TEST_ERROR; @@ -1833,25 +1874,25 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, /* Default behavior is failure when data is corrupted. */ /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); + status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); } H5E_END_TRY; if(status>=0) TEST_ERROR; /* Callback decides to continue inspite data is corrupted. */ if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL) < 0) TEST_ERROR; - if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) + if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0) TEST_ERROR; /* Callback decides to fail when data is corrupted. */ if(H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL) < 0) TEST_ERROR; /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); + status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); } H5E_END_TRY; if(status>=0) TEST_ERROR; } else { - if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) + if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ @@ -1885,33 +1926,33 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, points[i][j] = (int)HDrandom (); } } - if(H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points) < 0) + if(H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points_data) < 0) TEST_ERROR; if(corrupted) { /* Default behavior is failure when data is corrupted. */ /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); + status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); } H5E_END_TRY; if(status>=0) TEST_ERROR; /* Callback decides to continue inspite data is corrupted. */ if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL) < 0) TEST_ERROR; - if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) + if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0) TEST_ERROR; /* Callback decides to fail when data is corrupted. */ if(H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL) < 0) TEST_ERROR; /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); + status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); } H5E_END_TRY; if(status>=0) TEST_ERROR; } else { /* Read the dataset back and check it */ - if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) + if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ @@ -1946,13 +1987,13 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, /* Default behavior is failure when data is corrupted. */ /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); + status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); } H5E_END_TRY; if(status >= 0) TEST_ERROR; /* Callback decides to continue inspite data is corrupted. */ if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL) < 0) TEST_ERROR; - if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) + if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0) TEST_ERROR; /* Callback decides to fail when data is corrupted. */ @@ -1960,12 +2001,12 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); + status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); } H5E_END_TRY; if(status >= 0) TEST_ERROR; } /* end if */ else { - if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) + if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ @@ -1999,32 +2040,32 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) TEST_ERROR; /* (Use the "read" DXPL because partial I/O on corrupted data test needs to ignore errors during writing) */ - if(H5Dwrite (dataset, H5T_NATIVE_INT, sid, sid, dxpl, points) < 0) + if(H5Dwrite (dataset, H5T_NATIVE_INT, sid, sid, dxpl, points_data) < 0) TEST_ERROR; if(corrupted) { /* Default behavior is failure when data is corrupted. */ /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); + status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); } H5E_END_TRY; if(status>=0) TEST_ERROR; /* Callback decides to continue inspite data is corrupted. */ if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL) < 0) TEST_ERROR; - if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) + if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0) TEST_ERROR; /* Callback decides to fail when data is corrupted. */ if(H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL) < 0) TEST_ERROR; /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); + status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); } H5E_END_TRY; if(status>=0) TEST_ERROR; } else { - if(H5Dread (dataset, H5T_NATIVE_INT, sid, sid, dxpl, check) < 0) + if(H5Dread (dataset, H5T_NATIVE_INT, sid, sid, dxpl, check_data) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ @@ -2629,7 +2670,7 @@ test_missing_filter(hid_t file) } /* end if */ /* Write data */ - if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) { + if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0) { H5_FAILED(); HDprintf(" Line %d: Error writing dataset data\n",__LINE__); goto error; @@ -2658,7 +2699,7 @@ test_missing_filter(hid_t file) } /* end if */ /* Read data */ - if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) { + if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data) < 0) { H5_FAILED(); HDprintf(" Line %d: Error reading dataset data\n",__LINE__); goto error; @@ -2719,7 +2760,7 @@ test_missing_filter(hid_t file) /* Read data (should fail, since deflate filter is missing) */ H5E_BEGIN_TRY { - ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check); + ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data); } H5E_END_TRY; if(ret>=0) { H5_FAILED(); @@ -4127,149 +4168,164 @@ test_nbit_int_size(hid_t file) hid_t dataspace, dataset, datatype, mem_datatype, dset_create_props; hsize_t dims[2], chunk_size[2]; hsize_t dset_size = 0; - int orig_data[DSET_DIM1][DSET_DIM2]; + int **orig = NULL; + int *orig_data = NULL; double power; int i, j; size_t precision, offset; TESTING(" nbit integer dataset size"); - /* Define dataset datatype (integer), and set precision, offset */ - if((datatype = H5Tcopy(H5T_NATIVE_INT)) < 0) { - H5_FAILED(); - HDprintf(" line %d: H5Tcopy failed\n",__LINE__); - goto error; - } /* end if */ + /* Set up data array */ + if(NULL == (orig_data = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int)))) + TEST_ERROR; + if(NULL == (orig = (int **)HDcalloc(DSET_DIM1, sizeof(orig_data)))) + TEST_ERROR; + for (i = 0; i < DSET_DIM1; i++) + orig[i] = orig_data + (i * DSET_DIM2); - precision = 16; /* precision includes sign bit */ - if(H5Tset_precision(datatype,precision)<0) { - H5_FAILED(); - HDprintf(" line %d: H5Pset_precision failed\n",__LINE__); - goto error; - } /* end if */ + /* Define dataset datatype (integer), and set precision, offset */ + if((datatype = H5Tcopy(H5T_NATIVE_INT)) < 0) { + H5_FAILED(); + HDprintf(" line %d: H5Tcopy failed\n",__LINE__); + goto error; + } - offset = 8; - if(H5Tset_offset(datatype,offset)<0) { - H5_FAILED(); - HDprintf(" line %d: H5Tset_offset failed\n",__LINE__); - goto error; - } /* end if */ + precision = 16; /* precision includes sign bit */ + if(H5Tset_precision(datatype,precision)<0) { + H5_FAILED(); + HDprintf(" line %d: H5Pset_precision failed\n",__LINE__); + goto error; + } - /* Copy to memory datatype */ - if((mem_datatype = H5Tcopy(datatype)) < 0) { - H5_FAILED(); - HDprintf(" line %d: H5Tcopy failed\n",__LINE__); - goto error; - } /* end if */ + offset = 8; + if(H5Tset_offset(datatype,offset)<0) { + H5_FAILED(); + HDprintf(" line %d: H5Tset_offset failed\n",__LINE__); + goto error; + } - /* Set order of dataset datatype */ - if(H5Tset_order(datatype, H5T_ORDER_BE)<0) { + /* Copy to memory datatype */ + if((mem_datatype = H5Tcopy(datatype)) < 0) { H5_FAILED(); - HDprintf(" line %d: H5Pset_order failed\n",__LINE__); - goto error; - } /* end if */ + HDprintf(" line %d: H5Tcopy failed\n",__LINE__); + goto error; + } - if(H5Tset_size(datatype, 4)<0) { - H5_FAILED(); - HDprintf(" line %d: H5Pset_size failed\n",__LINE__); - goto error; - } /* end if */ + /* Set order of dataset datatype */ + if(H5Tset_order(datatype, H5T_ORDER_BE)<0) { + H5_FAILED(); + HDprintf(" line %d: H5Pset_order failed\n",__LINE__); + goto error; + } - /* Initiliaze data buffer with random data within correct range - * corresponding to the memory datatype's precision and offset. - */ - for (i=0; i < DSET_DIM1; i++) - for (j=0; j < DSET_DIM2; j++) { - power = HDpow(2.0F, (double)(precision-1)); - orig_data[i][j] = HDrandom() % (int)power << offset; - } /* end for */ + if(H5Tset_size(datatype, 4)<0) { + H5_FAILED(); + HDprintf(" line %d: H5Pset_size failed\n",__LINE__); + goto error; + } + /* Initiliaze data buffer with random data within correct range + * corresponding to the memory datatype's precision and offset. + */ + for (i=0; i < DSET_DIM1; i++) + for (j=0; j < DSET_DIM2; j++) { + power = HDpow(2.0F, (double)(precision-1)); + orig[i][j] = HDrandom() % (int)power << offset; + } - /* Describe the dataspace. */ - dims[0] = DSET_DIM1; - dims[1] = DSET_DIM2; - if((dataspace = H5Screate_simple (2, dims, NULL))<0) { - H5_FAILED(); - HDprintf(" line %d: H5Pcreate failed\n",__LINE__); - goto error; - } /* end if */ - /* - * Set the dataset creation property list to specify the chunks - */ - chunk_size[0] = DSET_DIM1/10; - chunk_size[1] = DSET_DIM2/10; - if((dset_create_props = H5Pcreate (H5P_DATASET_CREATE))<0) { - H5_FAILED(); - HDprintf(" line %d: H5Pcreate failed\n",__LINE__); - goto error; - } /* end if */ + /* Describe the dataspace. */ + dims[0] = DSET_DIM1; + dims[1] = DSET_DIM2; + if((dataspace = H5Screate_simple(2, dims, NULL))<0) { + H5_FAILED(); + HDprintf(" line %d: H5Pcreate failed\n",__LINE__); + goto error; + } - if(H5Pset_chunk (dset_create_props, 2, chunk_size)<0) { - H5_FAILED(); - HDprintf(" line %d: H5Pset_chunk failed\n",__LINE__); - goto error; - } /* end if */ + /* + * Set the dataset creation property list to specify the chunks + */ + chunk_size[0] = DSET_DIM1/10; + chunk_size[1] = DSET_DIM2/10; + if((dset_create_props = H5Pcreate(H5P_DATASET_CREATE))<0) { + H5_FAILED(); + HDprintf(" line %d: H5Pcreate failed\n",__LINE__); + goto error; + } - /* - * Set for n-bit compression - */ - if(H5Pset_nbit (dset_create_props)<0) { - H5_FAILED(); - HDprintf(" line %d: H5Pset_nbit failed\n",__LINE__); - goto error; - } /* end if */ + if(H5Pset_chunk(dset_create_props, 2, chunk_size)<0) { + H5_FAILED(); + HDprintf(" line %d: H5Pset_chunk failed\n",__LINE__); + goto error; + } - /* - * Create a new dataset within the file. - */ - if((dataset = H5Dcreate2 (file, DSET_NBIT_INT_SIZE_NAME, datatype, + /* + * Set for n-bit compression + */ + if(H5Pset_nbit(dset_create_props)<0) { + H5_FAILED(); + HDprintf(" line %d: H5Pset_nbit failed\n",__LINE__); + goto error; + } + + /* + * Create a new dataset within the file. + */ + if((dataset = H5Dcreate2(file, DSET_NBIT_INT_SIZE_NAME, datatype, dataspace, H5P_DEFAULT, dset_create_props, H5P_DEFAULT))<0) { - H5_FAILED(); - HDprintf(" line %d: H5dwrite failed\n",__LINE__); - goto error; - } /* end if */ + H5_FAILED(); + HDprintf(" line %d: H5dwrite failed\n",__LINE__); + goto error; + } - /* - * Write the array to the file. - */ - if(H5Dwrite (dataset, mem_datatype, H5S_ALL, H5S_ALL, - H5P_DEFAULT, orig_data)<0) { - H5_FAILED(); - HDprintf(" Line %d: H5Dwrite failed\n",__LINE__); - goto error; - } /* end if */ + /* + * Write the array to the file. + */ + if(H5Dwrite(dataset, mem_datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data)<0) { + H5_FAILED(); + HDprintf(" Line %d: H5Dwrite failed\n",__LINE__); + goto error; + } - /* - * Get the precision of the data type - */ - if((precision = H5Tget_precision(datatype)) == 0) { - H5_FAILED(); - HDprintf(" Line %d: wrong precision size: %zu\n",__LINE__, precision); - goto error; - } /* end if */ + /* + * Get the precision of the data type + */ + if((precision = H5Tget_precision(datatype)) == 0) { + H5_FAILED(); + HDprintf(" Line %d: wrong precision size: %zu\n",__LINE__, precision); + goto error; + } - /* - * The size of the dataset after compression should around 2 * DSET_DIM1 * DSET_DIM2 - */ - if((dset_size = H5Dget_storage_size(dataset)) < DSET_DIM1*DSET_DIM2*(precision/8) || - dset_size > DSET_DIM1*DSET_DIM2*(precision/8) + 1*KB) { - H5_FAILED(); - HDfprintf(stdout, " Line %d: wrong dataset size: %Hu\n",__LINE__, dset_size); - goto error; - } /* end if */ + /* + * The size of the dataset after compression should around 2 * DSET_DIM1 * DSET_DIM2 + */ + if((dset_size = H5Dget_storage_size(dataset)) < DSET_DIM1*DSET_DIM2*(precision/8) || + dset_size > DSET_DIM1*DSET_DIM2*(precision/8) + 1*KB) { + H5_FAILED(); + HDfprintf(stdout, " Line %d: wrong dataset size: %Hu\n",__LINE__, dset_size); + goto error; + } - H5Tclose (datatype); - H5Tclose (mem_datatype); - H5Dclose (dataset); - H5Sclose (dataspace); - H5Pclose (dset_create_props); + H5Tclose(datatype); + H5Tclose(mem_datatype); + H5Dclose(dataset); + H5Sclose(dataspace); + H5Pclose(dset_create_props); + + HDfree(orig); + HDfree(orig_data); PASSED(); - return SUCCEED; + return SUCCEED; + error: + HDfree(orig); + HDfree(orig_data); + return FAIL; } /* end test_nbit_int_size() */ @@ -4295,13 +4351,22 @@ test_nbit_flt_size(hid_t file) hid_t dataspace, dataset, datatype, dset_create_props; hsize_t dims[2], chunk_size[2]; hsize_t dset_size = 0; - float orig_data[DSET_DIM1][DSET_DIM2]; + float **orig = NULL; + float *orig_data = NULL; int i, j; size_t precision, offset; size_t spos, epos, esize, mpos, msize; TESTING(" nbit floating-number dataset size"); + /* Set up data array */ + if(NULL == (orig_data = (float *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(float)))) + TEST_ERROR; + if(NULL == (orig = (float **)HDcalloc(DSET_DIM1, sizeof(orig_data)))) + TEST_ERROR; + for (i = 0; i < DSET_DIM1; i++) + orig[i] = orig_data + (i * DSET_DIM2); + /* Define floating-point type for dataset *------------------------------------------------------------------- * size=4 byte, precision=16 bits, offset=8 bits, @@ -4380,7 +4445,7 @@ test_nbit_flt_size(hid_t file) */ for (i=0; i < DSET_DIM1; i++) for (j=0; j < DSET_DIM2; j++) - orig_data[i][j] = (float)(HDrandom() % 1234567) / 2; + orig[i][j] = (float)(HDrandom() % 1234567) / 2; /* Describe the dataspace. */ @@ -4465,8 +4530,14 @@ test_nbit_flt_size(hid_t file) PASSED(); + HDfree(orig); + HDfree(orig_data); + return SUCCEED; error: + HDfree(orig); + HDfree(orig_data); + return FAIL; } /* end test_nbit_flt_size() */ @@ -5460,7 +5531,7 @@ test_can_apply(hid_t file) } /* end if */ /* Write data */ - if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) { + if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0) { H5_FAILED(); HDprintf(" Line %d: Error writing dataset data\n",__LINE__); goto error; @@ -5488,7 +5559,7 @@ test_can_apply(hid_t file) } /* end if */ /* Read data */ - if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) { + if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data) < 0) { H5_FAILED(); HDprintf(" Line %d: Error reading dataset data\n",__LINE__); goto error; @@ -5619,7 +5690,7 @@ test_can_apply2(hid_t file) } /* end if */ /* Write data */ - if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) { + if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0) { H5_FAILED(); HDprintf(" Line %d: Error writing dataset data\n",__LINE__); goto error; @@ -5647,7 +5718,7 @@ test_can_apply2(hid_t file) } /* end if */ /* Read data */ - if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) { + if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data) < 0) { H5_FAILED(); HDprintf(" Line %d: Error reading dataset data\n",__LINE__); goto error; @@ -5988,7 +6059,7 @@ test_set_local(hid_t fapl) } /* end if */ /* Write data */ - if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) { + if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0) { H5_FAILED(); HDprintf(" Line %d: Error writing dataset data\n",__LINE__); goto error; @@ -6010,7 +6081,7 @@ test_set_local(hid_t fapl) } /* end if */ /* Write data */ - if(H5Dwrite(dsid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_dbl) < 0) { + if(H5Dwrite(dsid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_dbl_data) < 0) { H5_FAILED(); HDprintf(" Line %d: Error writing dataset data\n",__LINE__); goto error; @@ -6073,7 +6144,7 @@ test_set_local(hid_t fapl) } /* end if */ /* Read data */ - if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) { + if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data) < 0) { H5_FAILED(); HDprintf(" Line %d: Error reading dataset data\n", __LINE__); goto error; @@ -6123,7 +6194,7 @@ test_set_local(hid_t fapl) } /* end if */ /* Read data */ - if(H5Dread(dsid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_dbl) < 0) { + if(H5Dread(dsid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_dbl_data) < 0) { H5_FAILED(); HDprintf(" Line %d: Error reading dataset data\n", __LINE__); goto error; @@ -6856,10 +6927,12 @@ test_missing_chunk(hid_t file) hsize_t hs_start2[2], hs_stride2[2], hs_count2[2], hs_block2[2];/* Hyperslab setting */ /* Buffers for reading/writing dataset */ - int wdata[MISSING_CHUNK_DIM], - rdata[MISSING_CHUNK_DIM]; - int wdata2[MISSING_CHUNK_DIM][MISSING_CHUNK_DIM], - rdata2[MISSING_CHUNK_DIM][MISSING_CHUNK_DIM]; + int *wdata = NULL; + int *rdata = NULL; + int **wdata2 = NULL; + int **rdata2 = NULL; + int *wdata2_bytes = NULL; + int *rdata2_bytes = NULL; /* Setting for 1-D dataset */ hsize_t dsize=100, dmax=H5S_UNLIMITED; @@ -6876,6 +6949,26 @@ test_missing_chunk(hid_t file) TESTING("Read dataset with unwritten chunk & undefined fill value"); + /* Set up data arrays */ + if(NULL == (wdata = (int *)HDcalloc(MISSING_CHUNK_DIM, sizeof(int)))) + TEST_ERROR; + if(NULL == (rdata = (int *)HDcalloc(MISSING_CHUNK_DIM, sizeof(int)))) + TEST_ERROR; + + if(NULL == (wdata2_bytes = (int *)HDcalloc(MISSING_CHUNK_DIM * MISSING_CHUNK_DIM, sizeof(int)))) + TEST_ERROR; + if(NULL == (wdata2 = (int **)HDcalloc(MISSING_CHUNK_DIM, sizeof(wdata2_bytes)))) + TEST_ERROR; + for (i = 0; i < MISSING_CHUNK_DIM; i++) + wdata2[i] = wdata2_bytes + (i * MISSING_CHUNK_DIM); + + if(NULL == (rdata2_bytes = (int *)HDcalloc(MISSING_CHUNK_DIM * MISSING_CHUNK_DIM, sizeof(int)))) + TEST_ERROR; + if(NULL == (rdata2 = (int **)HDcalloc(MISSING_CHUNK_DIM, sizeof(rdata2_bytes)))) + TEST_ERROR; + for (i = 0; i < MISSING_CHUNK_DIM; i++) + rdata2[i] = rdata2_bytes + (i * MISSING_CHUNK_DIM); + /* Get the file's file access property list */ if((fapl = H5Fget_access_plist(file)) < 0) TEST_ERROR; @@ -6893,10 +6986,10 @@ test_missing_chunk(hid_t file) /* Initialize data for 2-D dataset */ for(i = 0; i < MISSING_CHUNK_DIM; i++) { - for(j = 0; j < MISSING_CHUNK_DIM; j++) { - wdata2[i][j] = (int)(j + (i * MISSING_CHUNK_DIM)); - rdata2[i][j] = 911; - } + for(j = 0; j < MISSING_CHUNK_DIM; j++) { + wdata2[i][j] = (int)(j + (i * MISSING_CHUNK_DIM)); + rdata2[i][j] = 911; + } } /* end for */ /* Create dataspace */ @@ -6954,11 +7047,11 @@ test_missing_chunk(hid_t file) /* Write selected data to the datasets */ if(H5Dwrite(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, wdata) < 0) TEST_ERROR; - if(H5Dwrite(did2, H5T_NATIVE_INT, sid2, sid2, H5P_DEFAULT, wdata2) < 0) TEST_ERROR; + if(H5Dwrite(did2, H5T_NATIVE_INT, sid2, sid2, H5P_DEFAULT, wdata2_bytes) < 0) TEST_ERROR; /* Read all data from the datasets */ if(H5Dread(d, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0) TEST_ERROR; - if(H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata2) < 0) TEST_ERROR; + if(H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata2_bytes) < 0) TEST_ERROR; /* Validata values read for the 1-D dataset */ for(u=0; u<MISSING_CHUNK_DIM; u++) { @@ -7005,6 +7098,13 @@ test_missing_chunk(hid_t file) if(H5Dclose(d) < 0) TEST_ERROR; if(H5Dclose(did2) < 0) TEST_ERROR; + HDfree(rdata); + HDfree(wdata); + HDfree(rdata2); + HDfree(wdata2); + HDfree(rdata2_bytes); + HDfree(wdata2_bytes); + PASSED(); return SUCCEED; @@ -7019,6 +7119,14 @@ error: H5Sclose(s); H5Sclose(sid2); } H5E_END_TRY; + + HDfree(rdata); + HDfree(wdata); + HDfree(rdata2); + HDfree(wdata2); + HDfree(rdata2_bytes); + HDfree(wdata2_bytes); + return FAIL; } /* end test_missing_chunk() */ @@ -7161,8 +7269,8 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) /* Generate random point coordinates. Only one point is selected per chunk */ for(i=0; i<NPOINTS; i++){ - chunk_row = ofs / cols; - chunk_col = ofs % cols; + chunk_row = (int)(ofs / cols); + chunk_col = (int)(ofs % cols); ofs = (ofs + inc) % (rows * cols); HDassert(!check2[chunk_row][chunk_col]); @@ -7282,14 +7390,14 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) for(j = 0; j < nsize[1] / csize[1]; j++) check2[i][j] = 0; - rows = nsize[0] / csize[0]; - cols = nsize[1] / csize[1]; + rows = (long)(nsize[0] / csize[0]); + cols = (long)(nsize[1] / csize[1]); make_random_offset_and_increment(rows * cols, &ofs, &inc); /* Generate random point coordinates. Only one point is selected per chunk */ for(i = 0; i < NPOINTS; i++){ - chunk_row = ofs / cols; - chunk_col = ofs % cols; + chunk_row = (int)(ofs / cols); + chunk_col = (int)(ofs % cols); ofs = (ofs + inc) % (rows * cols); HDassert(!check2[chunk_row][chunk_col]); @@ -7398,8 +7506,8 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) /* Generate random point coordinates. Only one point is selected per chunk */ for(i = 0; i < NPOINTS; i++){ - chunk_row = ofs / cols; - chunk_col = ofs % cols; + chunk_row = (int)(ofs / cols); + chunk_col = (int)(ofs % cols); ofs = (ofs + inc) % (rows * cols); HDassert(!check2[chunk_row][chunk_col]); @@ -8077,9 +8185,13 @@ test_big_chunks_bypass_cache(hid_t fapl) hsize_t t_count[2], t_stride[2], t_offset[2], t_block[2]; /* Setting for hyperslab (2-D) */ /* Buffers for reading and writing data (1-D) */ int *wdata = NULL, *rdata1 = NULL, *rdata2 = NULL; - /* Buffer for reading and writing data (2-D) */ - static int t_wdata[BYPASS_CHUNK_DIM/2][BYPASS_CHUNK_DIM/2], t_rdata1[BYPASS_DIM][BYPASS_DIM], - t_rdata2[BYPASS_CHUNK_DIM/2][BYPASS_CHUNK_DIM/2]; + /* Buffers for reading and writing data (2-D) */ + int **t_wdata = NULL; + int **t_rdata1 = NULL; + int **t_rdata2 = NULL; + int *t_wdata_bytes = NULL; + int *t_rdata1_bytes = NULL; + int *t_rdata2_bytes = NULL; int i, j; /* Local index variables */ H5F_libver_t low; /* File format low bound */ H5D_chunk_index_t idx_type, t_idx_type; /* Dataset chunk index types */ @@ -8089,6 +8201,29 @@ test_big_chunks_bypass_cache(hid_t fapl) h5_fixname(FILENAME[9], fapl, filename, sizeof filename); + /* Set up data arrays */ + if(NULL == (t_wdata_bytes = (int *)HDcalloc((BYPASS_CHUNK_DIM/2) * (BYPASS_CHUNK_DIM/2), sizeof(int)))) + TEST_ERROR; + if(NULL == (t_wdata = (int **)HDcalloc((BYPASS_CHUNK_DIM/2), sizeof(t_wdata_bytes)))) + TEST_ERROR; + for (i = 0; i < (BYPASS_CHUNK_DIM/2); i++) + t_wdata[i] = t_wdata_bytes + (i * (BYPASS_CHUNK_DIM/2)); + + if(NULL == (t_rdata1_bytes = (int *)HDcalloc(BYPASS_DIM * BYPASS_DIM, sizeof(int)))) + TEST_ERROR; + if(NULL == (t_rdata1 = (int **)HDcalloc(BYPASS_DIM, sizeof(t_rdata1_bytes)))) + TEST_ERROR; + for (i = 0; i < BYPASS_DIM; i++) + t_rdata1[i] = t_rdata1_bytes + (i * BYPASS_DIM); + + if(NULL == (t_rdata2_bytes = (int *)HDcalloc((BYPASS_CHUNK_DIM/2) * (BYPASS_CHUNK_DIM/2), sizeof(int)))) + TEST_ERROR; + if(NULL == (t_rdata2 = (int **)HDcalloc((BYPASS_CHUNK_DIM/2), sizeof(t_rdata2_bytes)))) + TEST_ERROR; + for (i = 0; i < (BYPASS_CHUNK_DIM/2); i++) + t_rdata2[i] = t_rdata2_bytes + (i * (BYPASS_CHUNK_DIM/2)); + + /* Check if we are using the latest version of the format */ if(H5Pget_libver_bounds(fapl, &low, NULL) < 0) FAIL_STACK_ERROR @@ -8177,8 +8312,8 @@ test_big_chunks_bypass_cache(hid_t fapl) /* Initialize data to write for 2-D dataset */ for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++) - for(j = 0; j < BYPASS_CHUNK_DIM / 2; j++) - t_wdata[i][j] = j; + for(j = 0; j < BYPASS_CHUNK_DIM / 2; j++) + t_wdata[i][j] = j; /* Set up memory space for the 2-D dataset */ mid = H5Screate_simple(2, t_block, NULL); @@ -8187,7 +8322,7 @@ test_big_chunks_bypass_cache(hid_t fapl) /* This write should go through the cache because fill value is used. */ if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, wdata) < 0) FAIL_STACK_ERROR - if(H5Dwrite(t_dsid, H5T_NATIVE_INT, mid, t_sid, H5P_DEFAULT, t_wdata) < 0) + if(H5Dwrite(t_dsid, H5T_NATIVE_INT, mid, t_sid, H5P_DEFAULT, t_wdata_bytes) < 0) FAIL_STACK_ERROR /* Close the first 1-D & 2-D datasets */ @@ -8202,7 +8337,7 @@ test_big_chunks_bypass_cache(hid_t fapl) * chunk is bigger than the cache size and it isn't allocated on disk. */ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata1) < 0) FAIL_STACK_ERROR - if(H5Dread(t_dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, t_rdata1) < 0) + if(H5Dread(t_dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, t_rdata1_bytes) < 0) FAIL_STACK_ERROR /* Verify data for the first 1-D dataset */ @@ -8233,8 +8368,8 @@ test_big_chunks_bypass_cache(hid_t fapl) for(i = BYPASS_CHUNK_DIM / 2; i < BYPASS_DIM; i++) for(j = BYPASS_CHUNK_DIM / 2; j < BYPASS_DIM; j++) if(t_rdata1[i][j] != fvalue) { - HDprintf(" Read different values than written in the 2nd chunk.\n"); - HDprintf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n", + HDprintf(" Read different values than written in the 2nd chunk.\n"); + HDprintf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n", __LINE__, i, j, t_rdata1[i][j], fvalue); TEST_ERROR } /* end if */ @@ -8258,7 +8393,7 @@ test_big_chunks_bypass_cache(hid_t fapl) /* Write to the second 1-D & 2-D dataset */ if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, wdata) < 0) FAIL_STACK_ERROR - if(H5Dwrite(t_dsid, H5T_NATIVE_INT, mid, t_sid, H5P_DEFAULT, t_wdata) < 0) + if(H5Dwrite(t_dsid, H5T_NATIVE_INT, mid, t_sid, H5P_DEFAULT, t_wdata_bytes) < 0) FAIL_STACK_ERROR /* Close the second 1-D & 2-D dataset */ @@ -8274,7 +8409,7 @@ test_big_chunks_bypass_cache(hid_t fapl) * the cache size. */ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, rdata2) < 0) FAIL_STACK_ERROR - if(H5Dread(t_dsid, H5T_NATIVE_INT, mid, t_sid, H5P_DEFAULT, t_rdata2) < 0) + if(H5Dread(t_dsid, H5T_NATIVE_INT, mid, t_sid, H5P_DEFAULT, t_rdata2_bytes) < 0) FAIL_STACK_ERROR /* Verify data for the second 1-D dataset */ @@ -8309,6 +8444,12 @@ test_big_chunks_bypass_cache(hid_t fapl) HDfree(wdata); HDfree(rdata1); HDfree(rdata2); + HDfree(t_wdata); + HDfree(t_rdata1); + HDfree(t_rdata2); + HDfree(t_wdata_bytes); + HDfree(t_rdata1_bytes); + HDfree(t_rdata2_bytes); PASSED(); return SUCCEED; @@ -8324,12 +8465,17 @@ error: H5Sclose(t_sid); H5Fclose(fid); } H5E_END_TRY; - if(wdata) - HDfree(wdata); - if(rdata1) - HDfree(rdata1); - if(rdata2) - HDfree(rdata2); + + HDfree(wdata); + HDfree(rdata1); + HDfree(rdata2); + HDfree(t_wdata); + HDfree(t_rdata1); + HDfree(t_rdata2); + HDfree(t_wdata_bytes); + HDfree(t_rdata1_bytes); + HDfree(t_rdata2_bytes); + return FAIL; } /* end test_big_chunks_bypass_cache() */ @@ -8831,13 +8977,33 @@ test_chunk_fast_bug1(hid_t fapl) hid_t dsid = -1; /* Dataset ID */ hsize_t dim[2], max_dim[2], chunk_dim[2]; /* Dataset and chunk dimensions */ H5D_alloc_time_t alloc_time; /* Storage allocation time */ - static unsigned wbuf[40][20], rbuf[40][20]; /* Element written/read */ + + unsigned **wbuf = NULL; + unsigned **rbuf = NULL; + unsigned *wbuf_bytes = NULL; + unsigned *rbuf_bytes = NULL; + unsigned i, j; /* Local index variables */ TESTING("datasets w/extensible array chunk indexing bug"); h5_fixname(FILENAME[10], fapl, filename, sizeof filename); + /* Set up data array */ + if(NULL == (wbuf_bytes = (unsigned *)HDcalloc(40 * 20, sizeof(unsigned)))) + TEST_ERROR; + if(NULL == (wbuf = (unsigned **)HDcalloc(40, sizeof(wbuf_bytes)))) + TEST_ERROR; + for (i = 0; i < 40; i++) + wbuf[i] = wbuf_bytes + (i * 20); + + if(NULL == (rbuf_bytes = (unsigned *)HDcalloc(40 * 20, sizeof(unsigned)))) + TEST_ERROR; + if(NULL == (rbuf = (unsigned **)HDcalloc(40, sizeof(rbuf_bytes)))) + TEST_ERROR; + for (i = 0; i < 40; i++) + rbuf[i] = rbuf_bytes + (i * 20); + /* Initialize write buffer */ for(i=0; i<40; i++) for(j=0; j<20; j++) @@ -8871,7 +9037,7 @@ test_chunk_fast_bug1(hid_t fapl) FAIL_STACK_ERROR /* Write buffer to dataset */ - if(H5Dwrite(dsid, H5T_NATIVE_UINT, sid, sid, H5P_DEFAULT, &wbuf) < 0) + if(H5Dwrite(dsid, H5T_NATIVE_UINT, sid, sid, H5P_DEFAULT, wbuf_bytes) < 0) FAIL_STACK_ERROR /* Close everything */ @@ -8881,7 +9047,7 @@ test_chunk_fast_bug1(hid_t fapl) if((dsid = H5Dopen2(fid, "dset", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Read from dataset */ - if(H5Dread(dsid, H5T_NATIVE_UINT, sid, sid, H5P_DEFAULT, &rbuf) < 0) + if(H5Dread(dsid, H5T_NATIVE_UINT, sid, sid, H5P_DEFAULT, rbuf_bytes) < 0) FAIL_STACK_ERROR /* Verify read data */ @@ -8898,6 +9064,11 @@ test_chunk_fast_bug1(hid_t fapl) if(H5Sclose(sid) < 0) FAIL_STACK_ERROR + HDfree(wbuf); + HDfree(rbuf); + HDfree(wbuf_bytes); + HDfree(rbuf_bytes); + PASSED(); return SUCCEED; @@ -8908,6 +9079,12 @@ error: H5Sclose(sid); H5Fclose(fid); } H5E_END_TRY; + + HDfree(wbuf); + HDfree(rbuf); + HDfree(wbuf_bytes); + HDfree(rbuf_bytes); + return FAIL; } /* end test_chunk_fast_bug1() */ @@ -9432,13 +9609,19 @@ test_fixed_array(hid_t fapl) int *rbuf_big = NULL; /* read buffer for big dataset */ const hsize_t chunk_dim2[2] = {4, 3}; /* Chunk dimensions */ - int chunks[12][6]; /* # of chunks for dataset dimensions */ - int chunks_big[125][20]; /* # of chunks for big dataset dimensions */ + + int **chunks = NULL; /* # of chunks for dataset dimensions */ + int **chunks_big = NULL; /* # of chunks for big dataset dimensions */ + int *chunks_bytes = NULL; + int *chunks_big_bytes = NULL; + int chunk_row; /* chunk row index */ int chunk_col; /* chunk column index */ - hsize_t coord[POINTS][2]; /* datdaset coordinates */ - hsize_t coord_big[POINTS_BIG][2]; /* big dataset coordinates */ + hsize_t **coord = NULL; /* datdaset coordinates */ + hsize_t **coord_big = NULL; /* big datdaset coordinates */ + hsize_t *coord_bytes = NULL; + hsize_t *coord_big_bytes = NULL; H5D_chunk_index_t idx_type; /* Dataset chunk index type */ H5F_libver_t low, high; /* File format bounds */ @@ -9461,6 +9644,35 @@ test_fixed_array(hid_t fapl) h5_fixname(FILENAME[12], fapl, filename, sizeof filename); + /* Set up 2D data arrays */ + if(NULL == (chunks_bytes = (int *)HDcalloc(12 * 6, sizeof(int)))) + TEST_ERROR; + if(NULL == (chunks = (int **)HDcalloc(12, sizeof(chunks_bytes)))) + TEST_ERROR; + for (i = 0; i < 12; i++) + chunks[i] = chunks_bytes + (i * 6); + + if(NULL == (chunks_big_bytes = (int *)HDcalloc(125 * 20, sizeof(int)))) + TEST_ERROR; + if(NULL == (chunks_big = (int **)HDcalloc(125, sizeof(chunks_big_bytes)))) + TEST_ERROR; + for (i = 0; i < 125; i++) + chunks_big[i] = chunks_big_bytes + (i * 20); + + if(NULL == (coord_bytes = (hsize_t *)HDcalloc(POINTS * 2, sizeof(hsize_t)))) + TEST_ERROR; + if(NULL == (coord = (hsize_t **)HDcalloc(POINTS, sizeof(coord_bytes)))) + TEST_ERROR; + for (i = 0; i < POINTS; i++) + coord[i] = coord_bytes + (i * 2); + + if(NULL == (coord_big_bytes = (hsize_t *)HDcalloc(POINTS_BIG * 2, sizeof(hsize_t)))) + TEST_ERROR; + if(NULL == (coord_big = (hsize_t **)HDcalloc(POINTS_BIG, sizeof(coord_big_bytes)))) + TEST_ERROR; + for (i = 0; i < POINTS_BIG; i++) + coord_big[i] = coord_big_bytes + (i * 2); + /* Check if we are using the latest version of the format */ if(H5Pget_libver_bounds(fapl, &low, &high) < 0) FAIL_STACK_ERROR @@ -9520,8 +9732,8 @@ test_fixed_array(hid_t fapl) /* Generate random point coordinates. Only one point is selected per chunk */ for(i = 0; i < POINTS; i++){ - chunk_row = ofs / cols; - chunk_col = ofs % cols; + chunk_row = (int)(ofs / cols); + chunk_col = (int)(ofs % cols); ofs = (ofs + inc) % (rows * cols); HDassert(!chunks[chunk_row][chunk_col]); @@ -9560,7 +9772,7 @@ test_fixed_array(hid_t fapl) if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR; /* Select the random points for writing */ - if(H5Sselect_elements(sid_max, H5S_SELECT_SET, POINTS, (const hsize_t *)coord) < 0) + if(H5Sselect_elements(sid_max, H5S_SELECT_SET, POINTS, (const hsize_t *)coord_bytes) < 0) TEST_ERROR; /* Write into dataset */ @@ -9601,7 +9813,7 @@ test_fixed_array(hid_t fapl) if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR; /* Select the random points for writing */ - if(H5Sselect_elements(sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord) < 0) + if(H5Sselect_elements(sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord_bytes) < 0) TEST_ERROR; /* Write into dataset */ @@ -9649,8 +9861,8 @@ test_fixed_array(hid_t fapl) /* Generate random point coordinates. Only one point is selected per chunk */ for(i = 0; i < POINTS_BIG; i++){ - chunk_row = ofs / cols; - chunk_col = ofs % cols; + chunk_row = (int)(ofs / cols); + chunk_col = (int)(ofs % cols); ofs = (ofs + inc) % (rows * cols); HDassert(!chunks_big[chunk_row][chunk_col]); @@ -9663,7 +9875,7 @@ test_fixed_array(hid_t fapl) if((big_mem_id = H5Screate_simple(1, msize_big, NULL)) < 0) TEST_ERROR; /* Select the random points for writing */ - if(H5Sselect_elements(sid_big, H5S_SELECT_SET, POINTS_BIG, (const hsize_t *)coord_big) < 0) + if(H5Sselect_elements(sid_big, H5S_SELECT_SET, POINTS_BIG, (const hsize_t *)coord_big_bytes) < 0) TEST_ERROR; /* Write into dataset */ @@ -9685,7 +9897,7 @@ test_fixed_array(hid_t fapl) if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR; /* Select the random points for reading */ - if(H5Sselect_elements (sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord) < 0) TEST_ERROR; + if(H5Sselect_elements (sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord_bytes) < 0) TEST_ERROR; /* Read from dataset */ if(H5Dread(dsid, H5T_NATIVE_INT, mem_id, sid, H5P_DEFAULT, rbuf) < 0) TEST_ERROR; @@ -9713,7 +9925,7 @@ test_fixed_array(hid_t fapl) if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR; /* Select the random points for reading */ - if(H5Sselect_elements (sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord) < 0) TEST_ERROR; + if(H5Sselect_elements (sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord_bytes) < 0) TEST_ERROR; /* Read from dataset */ if(H5Dread(dsid, H5T_NATIVE_INT, mem_id, sid, H5P_DEFAULT, rbuf) < 0) TEST_ERROR; @@ -9740,7 +9952,7 @@ test_fixed_array(hid_t fapl) if((big_mem_id = H5Screate_simple(1, msize_big, NULL)) < 0) TEST_ERROR; /* Select the random points for reading */ - if(H5Sselect_elements (sid_big, H5S_SELECT_SET, POINTS_BIG, (const hsize_t *)coord_big) < 0) TEST_ERROR; + if(H5Sselect_elements (sid_big, H5S_SELECT_SET, POINTS_BIG, (const hsize_t *)coord_big_bytes) < 0) TEST_ERROR; /* Read from dataset */ if(H5Dread(dsid_big, H5T_NATIVE_INT, big_mem_id, sid_big, H5P_DEFAULT, rbuf_big) < 0) TEST_ERROR; @@ -9782,6 +9994,15 @@ test_fixed_array(hid_t fapl) HDfree(wbuf_big); HDfree(rbuf_big); + HDfree(chunks); + HDfree(chunks_big); + HDfree(coord); + HDfree(coord_big); + HDfree(chunks_bytes); + HDfree(chunks_big_bytes); + HDfree(coord_bytes); + HDfree(coord_big_bytes); + PASSED(); return SUCCEED; @@ -9793,10 +10014,18 @@ error: H5Sclose(mem_id); H5Fclose(fid); } H5E_END_TRY; - if(wbuf_big) - HDfree(wbuf_big); - if(rbuf_big) - HDfree(rbuf_big); + + HDfree(wbuf_big); + HDfree(rbuf_big); + HDfree(chunks); + HDfree(chunks_big); + HDfree(coord); + HDfree(coord_big); + HDfree(chunks_bytes); + HDfree(chunks_big_bytes); + HDfree(coord_bytes); + HDfree(coord_big_bytes); + return FAIL; } /* end test_fixed_array() */ @@ -10763,7 +10992,7 @@ test_earray_hdr_fd(const char *env_h5_driver, hid_t fapl) const hsize_t maxshape[1] = { H5S_UNLIMITED }; const hsize_t chunk[1] = { 8 }; const int buffer[8] = {0, 1, 2, 3, 4, 5, 6, 7}; - H5O_info_t info; + H5O_info2_t info; TESTING("Extensible array chunk index header flush dependencies handled correctly"); @@ -10828,9 +11057,9 @@ test_earray_hdr_fd(const char *env_h5_driver, hid_t fapl) FAIL_STACK_ERROR; /* The second call triggered a bug in the library (JIRA issue: SWMR-95) */ - if(H5Oget_info_by_name2(fid, DSET_EARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(fid, DSET_EARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; - if(H5Oget_info_by_name2(fid, DSET_EARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(fid, DSET_EARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; if(H5Pclose(fapl) < 0) @@ -10883,7 +11112,7 @@ test_farray_hdr_fd(const char *env_h5_driver, hid_t fapl) const hsize_t maxshape[1] = { 64 }; const hsize_t chunk[1] = { 8 }; const int buffer[8] = {0, 1, 2, 3, 4, 5, 6, 7}; - H5O_info_t info; + H5O_info2_t info; TESTING("Fixed array chunk index header flush dependencies handled correctly"); @@ -10948,9 +11177,9 @@ test_farray_hdr_fd(const char *env_h5_driver, hid_t fapl) FAIL_STACK_ERROR; /* The second call triggered a bug in the library (JIRA issue: SWMR-95) */ - if(H5Oget_info_by_name2(fid, DSET_FARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(fid, DSET_FARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; - if(H5Oget_info_by_name2(fid, DSET_FARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(fid, DSET_FARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; if(H5Pclose(fapl) < 0) @@ -11003,7 +11232,7 @@ test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl) const hsize_t maxshape[2] = { H5S_UNLIMITED, H5S_UNLIMITED }; const hsize_t chunk[2] = { 8, 8 }; const int buffer[8] = {0, 1, 2, 3, 4, 5, 6, 7}; - H5O_info_t info; + H5O_info2_t info; TESTING("Version 2 B-tree chunk index header flush dependencies handled correctly"); @@ -11068,9 +11297,9 @@ test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl) FAIL_STACK_ERROR; /* The second call triggered a bug in the library (JIRA issue: SWMR-95) */ - if(H5Oget_info_by_name2(fid, DSET_BT2_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(fid, DSET_BT2_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; - if(H5Oget_info_by_name2(fid, DSET_BT2_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(fid, DSET_BT2_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; if(H5Pclose(fapl) < 0) @@ -12780,13 +13009,13 @@ dls_01_read_stuff(hid_t fid) { int status = 0; hid_t did = 0; - H5O_info_t info; + H5O_info2_t info; did = H5Dopen2(fid, DLS_01_DATASET, H5P_DEFAULT); if(did <= 0) TEST_ERROR - status = H5Oget_info2(did, &info, H5O_INFO_BASIC ); + status = H5Oget_info3(did, &info, H5O_INFO_BASIC); if(status != 0) TEST_ERROR @@ -13283,6 +13512,7 @@ main(void) int nerrors = 0; const char *envval; hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ + int i; /* Don't run this test using certain file drivers */ envval = HDgetenv("HDF5_DRIVER"); @@ -13295,6 +13525,39 @@ main(void) /* Set the random # seed */ HDsrandom((unsigned)HDtime(NULL)); + /* Initialize global arrays */ + /* points */ + if(NULL == (points_data = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int)))) + TEST_ERROR; + if(NULL == (points = (int **)HDcalloc(DSET_DIM1, sizeof(points_data)))) + TEST_ERROR; + for (i = 0; i < DSET_DIM1; i++) + points[i] = points_data + (i * DSET_DIM2); + + /* check */ + if(NULL == (check_data = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int)))) + TEST_ERROR; + if(NULL == (check = (int **)HDcalloc(DSET_DIM1, sizeof(check_data)))) + TEST_ERROR; + for (i = 0; i < DSET_DIM1; i++) + check[i] = check_data + (i * DSET_DIM2); + + /* points_dbl */ + if(NULL == (points_dbl_data = (double *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(double)))) + TEST_ERROR; + if(NULL == (points_dbl = (double **)HDcalloc(DSET_DIM1, sizeof(points_dbl_data)))) + TEST_ERROR; + for (i = 0; i < DSET_DIM1; i++) + points_dbl[i] = points_dbl_data + (i * DSET_DIM2); + + /* check_dbl */ + if(NULL == (check_dbl_data = (double *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(double)))) + TEST_ERROR; + if(NULL == (check_dbl = (double **)HDcalloc(DSET_DIM1, sizeof(check_dbl_data)))) + TEST_ERROR; + for (i = 0; i < DSET_DIM1; i++) + check_dbl[i] = check_dbl_data + (i * DSET_DIM2); + /* Testing setup */ h5_reset(); fapl = h5_fileaccess(); @@ -13480,9 +13743,29 @@ main(void) #endif /* H5_HAVE_FILTER_SZIP */ h5_cleanup(FILENAME, fapl); + HDfree(points); + HDfree(check); + HDfree(points_dbl); + HDfree(check_dbl); + + HDfree(points_data); + HDfree(check_data); + HDfree(points_dbl_data); + HDfree(check_dbl_data); + HDexit(EXIT_SUCCESS); error: + HDfree(points); + HDfree(check); + HDfree(points_dbl); + HDfree(check_dbl); + + HDfree(points_data); + HDfree(check_data); + HDfree(points_dbl_data); + HDfree(check_dbl_data); + nerrors = MAX(1, nerrors); HDprintf("***** %d DATASET TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); diff --git a/test/dtypes.c b/test/dtypes.c index 4bdef59..0f95830 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -5884,7 +5884,7 @@ test_latest(void) hid_t file = (-1); /* File ID */ hid_t tid1 = (-1), tid2 = (-1); /* Datatype ID */ hid_t fapl = (-1); /* File access property list */ - H5O_info_t oi; /* Stat buffer for committed datatype */ + H5O_native_info_t oi; /* Stat buffer for committed datatype */ hsize_t old_dtype_oh_size; /* Size of object header with "old" format */ hsize_t new_dtype_oh_size; /* Size of object header with "new" format */ char filename[1024]; /* Buffer for filename */ @@ -5918,7 +5918,7 @@ test_latest(void) FAIL_STACK_ERROR /* Get information about datatype on disk */ - if(H5Oget_info_by_name2(file, compnd_type, &oi, H5O_INFO_HDR, H5P_DEFAULT) < 0) + if(H5Oget_native_info_by_name(file, compnd_type, &oi, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) FAIL_STACK_ERROR old_dtype_oh_size = oi.hdr.space.total; @@ -5943,7 +5943,7 @@ test_latest(void) FAIL_STACK_ERROR /* Get information about datatype on disk */ - if(H5Oget_info_by_name2(file, compnd_type, &oi, H5O_INFO_HDR, H5P_DEFAULT) < 0) + if(H5Oget_native_info_by_name(file, compnd_type, &oi, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check that the object header info is still the same */ @@ -5979,7 +5979,7 @@ test_latest(void) FAIL_STACK_ERROR /* Get information about datatype on disk */ - if(H5Oget_info_by_name2(file, compnd_type, &oi, H5O_INFO_HDR, H5P_DEFAULT) < 0) + if(H5Oget_native_info_by_name(file, compnd_type, &oi, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) FAIL_STACK_ERROR new_dtype_oh_size = oi.hdr.space.total; @@ -6008,7 +6008,7 @@ test_latest(void) FAIL_STACK_ERROR /* Get information about datatype on disk */ - if(H5Oget_info_by_name2(file, compnd_type, &oi, H5O_INFO_HDR, H5P_DEFAULT) < 0) + if(H5Oget_native_info_by_name(file, compnd_type, &oi, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check that the object header info is still the same */ @@ -7292,7 +7292,7 @@ test_utf_ascii_conv(void) /* Test conversion in memory */ H5E_BEGIN_TRY { - status = H5Tconvert(utf8_vtid, ascii_vtid, 1, (void *)utf8_w, NULL, H5P_DEFAULT); + status = H5Tconvert(utf8_vtid, ascii_vtid, 1, &utf8_w, NULL, H5P_DEFAULT); } H5E_END_TRY if(status >= 0) FAIL_STACK_ERROR @@ -7325,7 +7325,7 @@ test_utf_ascii_conv(void) ************************************************/ /* Test conversion in memory */ H5E_BEGIN_TRY { - status = H5Tconvert(ascii_vtid, utf8_vtid, 1, (void *)ascii_w, NULL, H5P_DEFAULT); + status = H5Tconvert(ascii_vtid, utf8_vtid, 1, &ascii_w, NULL, H5P_DEFAULT); } H5E_END_TRY if(status >= 0) FAIL_STACK_ERROR @@ -32,8 +32,14 @@ const char *FILENAME[] = { NULL }; +/* Windows doesn't have PATH_MAX */ +#ifndef PATH_MAX +#define PATH_MAX 4096 +#endif /* !PATH_MAX */ + /* Global patched filename buffer */ -static char filename[6][1024]; +#define N_FILENAMES 6 +static char *filename[N_FILENAMES]; /* Global property lists - just copies of the defaults (necessary to use * internal functions */ @@ -2896,10 +2902,11 @@ error: int main(void) { - unsigned nerrors = 0; /* track errors */ - H5P_genplist_t *plist; /* Property list pointer for FAPL */ - H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ - hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + unsigned nerrors = 0; /* track errors */ + H5P_genplist_t *plist; /* Property list pointer for FAPL */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + int i; /* iterator */ /* Test Setup */ HDputs("Testing the external file cache"); @@ -2908,6 +2915,11 @@ main(void) fcpl_id = H5Pcreate(H5P_FILE_CREATE); fapl_id = h5_fileaccess(); + /* Allocate memory for filenames */ + for(i = 0; i < N_FILENAMES; i++) { + filename[i] = (char *)HDcalloc(PATH_MAX, sizeof(char)); + } + /* Patch filenames */ h5_fixname(FILENAME[0], fapl_id, filename[0], sizeof(filename[0])); h5_fixname(FILENAME[1], fapl_id, filename[1], sizeof(filename[1])); @@ -2942,7 +2954,8 @@ main(void) nerrors += (h5_verify_cached_stabs(FILENAME, fapl_id) < 0 ? 1 : 0); /* Pop API context */ - if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR + if(api_ctx_pushed && H5CX_pop() < 0) + FAIL_STACK_ERROR api_ctx_pushed = FALSE; if(nerrors) @@ -2952,6 +2965,10 @@ main(void) h5_clean_files(FILENAME, fapl_id); + for(i = 0; i < N_FILENAMES; i++) { + HDfree(filename[i]); + } + return EXIT_SUCCESS; error: @@ -2961,7 +2978,12 @@ error: H5Pclose(fapl_id); } H5E_END_TRY - if(api_ctx_pushed) H5CX_pop(); + if(api_ctx_pushed) + H5CX_pop(); + + for(i = 0; i < N_FILENAMES; i++) { + HDfree(filename[i]); + } return EXIT_FAILURE; } /* end main() */ diff --git a/test/err_compat.c b/test/err_compat.c index d2d039a..eb86760 100644 --- a/test/err_compat.c +++ b/test/err_compat.c @@ -35,7 +35,10 @@ const char *FILENAME[] = { #define DIM0 100 #define DIM1 200 -int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1]; +int **ipoints2 = NULL; +int **icheck2 = NULL; +int *ipoints2_data = NULL; +int *icheck2_data = NULL; #define DSET_NAME "a_dataset" #define FAKE_ID (hid_t)-1 @@ -465,13 +468,29 @@ dump_error(void) int main(void) { - hid_t file, fapl; + hid_t file, fapl; char filename[1024]; - const char *FUNC_main="main"; + const char *FUNC_main="main"; + int i; HDfprintf(stderr, " This program tests the Error API compatible with HDF5 v1.6. There are supposed to be some error messages\n"); fapl = h5_fileaccess(); + /* Set up data arrays */ + if(NULL == (ipoints2_data = (int *)HDcalloc(DIM0 * DIM1, sizeof(int)))) + TEST_ERROR; + if(NULL == (ipoints2 = (int **)HDcalloc(DIM0, sizeof(ipoints2_data)))) + TEST_ERROR; + for (i = 0; i < DIM0; i++) + ipoints2[i] = ipoints2_data + (i * DIM1); + + if(NULL == (icheck2_data = (int *)HDcalloc(DIM0 * DIM1, sizeof(int)))) + TEST_ERROR; + if(NULL == (icheck2 = (int **)HDcalloc(DIM0, sizeof(icheck2_data)))) + TEST_ERROR; + for (i = 0; i < DIM0; i++) + icheck2[i] = icheck2_data + (i * DIM1); + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR ; @@ -500,10 +519,20 @@ main(void) if(H5Fclose(file) < 0) TEST_ERROR ; h5_clean_files(FILENAME, fapl); + HDfree(ipoints2); + HDfree(ipoints2_data); + HDfree(icheck2); + HDfree(icheck2_data); + HDprintf("All error API tests passed.\n"); return 0; error: + HDfree(ipoints2); + HDfree(ipoints2_data); + HDfree(icheck2); + HDfree(icheck2_data); + HDprintf("***** ERROR TEST FAILED! *****\n"); return 1; } diff --git a/test/error_test.c b/test/error_test.c index 1de9065..e99a82f 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -38,7 +38,10 @@ const char *FILENAME[] = { #define DIM0 100 #define DIM1 200 -int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1]; +int **ipoints2 = NULL; +int **icheck2 = NULL; +int *ipoints2_data = NULL; +int *icheck2_data = NULL; hid_t ERR_CLS; hid_t ERR_CLS2; @@ -679,6 +682,7 @@ main(void) hid_t estack_id = -1; char filename[1024]; const char *FUNC_main = "main"; + int i; HDfprintf(stderr, " This program tests the Error API. There're supposed to be some error messages\n"); @@ -689,6 +693,21 @@ main(void) if ((fapl = h5_fileaccess()) < 0) TEST_ERROR; + /* Set up data arrays */ + if(NULL == (ipoints2_data = (int *)HDcalloc(DIM0 * DIM1, sizeof(int)))) + TEST_ERROR; + if(NULL == (ipoints2 = (int **)HDcalloc(DIM0, sizeof(ipoints2_data)))) + TEST_ERROR; + for (i = 0; i < DIM0; i++) + ipoints2[i] = ipoints2_data + (i * DIM1); + + if(NULL == (icheck2_data = (int *)HDcalloc(DIM0 * DIM1, sizeof(int)))) + TEST_ERROR; + if(NULL == (icheck2 = (int **)HDcalloc(DIM0, sizeof(icheck2_data)))) + TEST_ERROR; + for (i = 0; i < DIM0; i++) + icheck2[i] = icheck2_data + (i * DIM1); + h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR; @@ -755,10 +774,20 @@ main(void) h5_clean_files(FILENAME, fapl); + HDfree(ipoints2); + HDfree(ipoints2_data); + HDfree(icheck2); + HDfree(icheck2_data); + HDfprintf(stderr, "\nAll error API tests passed.\n"); return 0; error: + HDfree(ipoints2); + HDfree(ipoints2_data); + HDfree(icheck2); + HDfree(icheck2_data); + HDfprintf(stderr, "\n***** ERROR TEST FAILED (real problem)! *****\n"); return 1; } diff --git a/test/extend.c b/test/extend.c index a31ac0e..1e2b5b5 100644 --- a/test/extend.c +++ b/test/extend.c @@ -25,11 +25,16 @@ const char *FILENAME[] = { NULL }; -#define NX 100 /* USE AN EVEN NUMBER!*/ -#define NY 100 /* USE AN EVEN NUMBER!*/ +#define N1X 100 /* USE AN EVEN NUMBER! */ +#define N1Y 100 /* USE AN EVEN NUMBER! */ +#define N2X (N1X / 2) +#define N2Y (N1Y / 2) /* Data buffers */ -static int buf1[NY][NX], buf2[NX / 2][NY / 2]; +static int **buf1 = NULL; +static int *buf1_data = NULL; +static int **buf2 = NULL; +static int *buf2_data = NULL; /*------------------------------------------------------------------------- @@ -49,8 +54,8 @@ static int write_data(const char *msg, hid_t file, const char *name, hid_t cparms, hid_t mem_space) { hid_t dataset, file_space, half_space; - static const hsize_t dims[2] = {NX, NY}; - static const hsize_t half_dims[2] = {NX / 2, NY / 2}; + static const hsize_t dims[2] = {N1X, N1Y}; + static const hsize_t half_dims[2] = {N2X, N2Y}; hsize_t size[2]; hsize_t max_size[2] = {0, 0}; hsize_t offset[2]; @@ -63,13 +68,13 @@ write_data(const char *msg, hid_t file, const char *name, hid_t cparms, hid_t me /* Write the data */ for(i = 0; i < 5; i++) - for(j = 0; j < 5; j++) { + for(j = 0; j < 5; j++) { - /* Extend the dataset */ - offset[0] = (hsize_t)(i * NX); - offset[1] = (hsize_t)(j * NY); - size[0] = offset[0] + NX; - size[1] = offset[1] + NY; + /* Extend the dataset */ + offset[0] = (hsize_t)(i * N1X); + offset[1] = (hsize_t)(j * N1Y); + size[0] = offset[0] + N1X; + size[1] = offset[1] + N1Y; if(size[0] > max_size[0] || size[1] > max_size[1]) { if(size[0] > max_size[0]) max_size[0] = size[0]; @@ -78,42 +83,41 @@ write_data(const char *msg, hid_t file, const char *name, hid_t cparms, hid_t me if(H5Dset_extent(dataset, max_size) < 0) TEST_ERROR; } /* end if */ - /* Select a hyperslab */ + /* Select a hyperslab */ if((file_space = H5Dget_space(dataset)) < 0) TEST_ERROR; - if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, dims, NULL) < 0) TEST_ERROR; + if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, dims, NULL) < 0) TEST_ERROR; - /* Write to the hyperslab */ - if(H5Dwrite(dataset, H5T_NATIVE_INT, mem_space, file_space, H5P_DEFAULT, buf1) < 0) TEST_ERROR; + /* Write to the hyperslab */ + if(H5Dwrite(dataset, H5T_NATIVE_INT, mem_space, file_space, H5P_DEFAULT, buf1_data) < 0) TEST_ERROR; if(H5Sclose(file_space) < 0) TEST_ERROR; - } /* end for */ + } /* end for */ /* Read the data */ if((half_space = H5Screate_simple(2, half_dims, NULL)) < 0) TEST_ERROR; if((file_space = H5Dget_space(dataset)) < 0) TEST_ERROR; for(i = 0; i < 10; i++) { - for(j = 0; j < 10; j++) { - - /* Select a hyperslab */ - offset[0] = (hsize_t)(i * (NX / 2)); - offset[1] = (hsize_t)(j * (NY / 2)); - if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, half_dims, NULL) < 0) TEST_ERROR; - - /* Read */ - if(H5Dread(dataset, H5T_NATIVE_INT, half_space, file_space, H5P_DEFAULT, buf2) < 0) TEST_ERROR; - - /* Compare */ - for(k = 0; k < (NX / 2); k++) - for(m = 0; m < (NY / 2); m++) - if(buf2[k][m] != buf1[(i % 2) * (NX / 2) + k][(j % 2) * (NY / 2) + m]) { - HDprintf(" i=%d, j=%d, k=%d, m=%d\n", i, j, k, m); - HDprintf(" buf2[%d][%d]=%d\n", k, m, buf2[k][m]); - HDprintf(" buf1[%d][%d]=%d\n", (i % 2) * (NX / 2) + k, (j % 2) * (NY / 2) + m, buf1[(i % 2) * (NX / 2) + k][(j % 2) * (NY / 2) + m]); - TEST_ERROR; - } /* end if */ - } /* end for */ + for(j = 0; j < 10; j++) { + + /* Select a hyperslab */ + offset[0] = (hsize_t)(i * N2X); + offset[1] = (hsize_t)(j * N2Y); + if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, half_dims, NULL) < 0) TEST_ERROR; + + /* Read */ + if(H5Dread(dataset, H5T_NATIVE_INT, half_space, file_space, H5P_DEFAULT, buf2_data) < 0) TEST_ERROR; + + /* Compare */ + for(k = 0; k < N2X; k++) + for(m = 0; m < N2Y; m++) + if(buf2[k][m] != buf1[(i % 2) * N2X + k][(j % 2) * N2Y + m]) { + HDprintf(" i=%d, j=%d, k=%d, m=%d\n", i, j, k, m); + HDprintf(" buf2[%d][%d]=%d\n", k, m, buf2[k][m]); + HDprintf(" buf1[%d][%d]=%d\n", (i % 2) * N2X + k, (j % 2) * N2Y + m, buf1[(i % 2) * N2X + k][(j % 2) * N2Y + m]); + TEST_ERROR; + } /* end if */ + } /* end for */ } /* end for */ - /* Cleanup */ if(H5Dclose(dataset) < 0) TEST_ERROR; if(H5Sclose(file_space) < 0) TEST_ERROR; @@ -146,8 +150,8 @@ static int write_data_deprec(const char *msg, hid_t file, const char *name, hid_t cparms, hid_t mem_space) { hid_t dataset, file_space, half_space; - static const hsize_t dims[2] = {NX, NY}; - static const hsize_t half_dims[2] = {NX / 2, NY / 2}; + static const hsize_t dims[2] = {N1X, N1Y}; + static const hsize_t half_dims[2] = {N2X, N2Y}; static hsize_t size[2]; hsize_t offset[2]; int i, j, k, m; @@ -159,48 +163,48 @@ write_data_deprec(const char *msg, hid_t file, const char *name, hid_t cparms, h /* Write the data */ for(i = 0; i < 5; i++) - for(j = 0; j < 5; j++) { + for(j = 0; j < 5; j++) { - /* Extend the dataset */ - offset[0] = (hsize_t)(i * NX); - offset[1] = (hsize_t)(j * NY); - size[0] = offset[0] + NX; - size[1] = offset[1] + NY; - if(H5Dextend(dataset, size) < 0) TEST_ERROR; + /* Extend the dataset */ + offset[0] = (hsize_t)(i * N1X); + offset[1] = (hsize_t)(j * N1Y); + size[0] = offset[0] + N1X; + size[1] = offset[1] + N1Y; + if(H5Dextend(dataset, size) < 0) TEST_ERROR; - /* Select a hyperslab */ + /* Select a hyperslab */ if((file_space = H5Dget_space(dataset)) < 0) TEST_ERROR; - if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, dims, NULL) < 0) TEST_ERROR; + if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, dims, NULL) < 0) TEST_ERROR; - /* Write to the hyperslab */ - if(H5Dwrite(dataset, H5T_NATIVE_INT, mem_space, file_space, H5P_DEFAULT, buf1) < 0) TEST_ERROR; + /* Write to the hyperslab */ + if(H5Dwrite(dataset, H5T_NATIVE_INT, mem_space, file_space, H5P_DEFAULT, buf1_data) < 0) TEST_ERROR; if(H5Sclose(file_space) < 0) TEST_ERROR; - } /* end for */ + } /* end for */ /* Read the data */ if((half_space = H5Screate_simple(2, half_dims, NULL)) < 0) TEST_ERROR; if((file_space = H5Dget_space(dataset)) < 0) TEST_ERROR; for(i = 0; i < 10; i++) { - for(j = 0; j < 10; j++) { - - /* Select a hyperslab */ - offset[0] = (hsize_t)(i * (NX / 2)); - offset[1] = (hsize_t)(j * (NY / 2)); - if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, half_dims, NULL) < 0) TEST_ERROR; - - /* Read */ - if(H5Dread(dataset, H5T_NATIVE_INT, half_space, file_space, H5P_DEFAULT, buf2) < 0) TEST_ERROR; - - /* Compare */ - for(k = 0; k < (NX / 2); k++) - for(m = 0; m < (NY / 2); m++) - if(buf2[k][m] != buf1[(i % 2) * (NX / 2) + k][(j % 2) * (NY / 2) + m]) { - HDprintf(" i=%d, j=%d, k=%d, m=%d\n", i, j, k, m); - HDprintf(" buf2[%d][%d]=%d\n", k, m, buf2[k][m]); - HDprintf(" buf1[%d][%d]=%d\n", (i % 2) * (NX / 2) + k, (j % 2) * (NY / 2) + m, buf1[(i % 2) * (NX / 2) + k][(j % 2) * (NY / 2) + m]); - TEST_ERROR; - } /* end if */ - } /* end for */ + for(j = 0; j < 10; j++) { + + /* Select a hyperslab */ + offset[0] = (hsize_t)(i * N2X); + offset[1] = (hsize_t)(j * N2Y); + if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, half_dims, NULL) < 0) TEST_ERROR; + + /* Read */ + if(H5Dread(dataset, H5T_NATIVE_INT, half_space, file_space, H5P_DEFAULT, buf2_data) < 0) TEST_ERROR; + + /* Compare */ + for(k = 0; k < N2X; k++) + for(m = 0; m < N2Y; m++) + if(buf2[k][m] != buf1[(i % 2) * N2X + k][(j % 2) * N2Y + m]) { + HDprintf(" i=%d, j=%d, k=%d, m=%d\n", i, j, k, m); + HDprintf(" buf2[%d][%d]=%d\n", k, m, buf2[k][m]); + HDprintf(" buf1[%d][%d]=%d\n", (i % 2) * N2X + k, (j % 2) * N2Y + m, buf1[(i % 2) * N2X + k][(j % 2) * N2Y + m]); + TEST_ERROR; + } /* end if */ + } /* end for */ } /* end for */ @@ -236,8 +240,8 @@ main (void) hid_t file, mem_space, cparms; hid_t fapl; int nerrors = 0; - static const hsize_t dims[2] = {NX, NY}; - static const hsize_t chunk_dims[2] = {NX/2, NY/2}; + static const hsize_t dims[2] = {N1X, N1Y}; + static const hsize_t chunk_dims[2] = {N2X, N2Y}; static hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; char filename[1024]; int i, j; @@ -246,9 +250,23 @@ main (void) fapl = h5_fileaccess(); /* Initialize buffer and space */ - for(i = 0; i < NX; i++) - for(j = 0; j < NY; j++) - buf1[i][j] = i * NY + j; + if(NULL == (buf1_data = (int *)HDcalloc(N1X * N1Y, sizeof(int)))) + TEST_ERROR; + if(NULL == (buf1 = (int **)HDcalloc(N1X, sizeof(buf1_data)))) + TEST_ERROR; + for (i = 0; i < N1X; i++) + buf1[i] = buf1_data + (i * N1Y); + + if(NULL == (buf2_data = (int *)HDcalloc(N2X * N2Y, sizeof(int)))) + TEST_ERROR; + if(NULL == (buf2 = (int **)HDcalloc(N2X, sizeof(buf2_data)))) + TEST_ERROR; + for (i = 0; i < N2X; i++) + buf2[i] = buf2_data + (i * N2Y); + + for(i = 0; i < N1X; i++) + for(j = 0; j < N1Y; j++) + buf1[i][j] = i * N1Y + j; if((mem_space = H5Screate_simple(2, dims, maxdims)) < 0) TEST_ERROR; @@ -288,9 +306,20 @@ main (void) HDprintf("All extend tests passed.\n"); h5_cleanup(FILENAME, fapl); + HDfree(buf1); + HDfree(buf1_data); + HDfree(buf2); + HDfree(buf2_data); + HDexit(EXIT_SUCCESS); error: + + HDfree(buf1); + HDfree(buf1_data); + HDfree(buf2); + HDfree(buf2_data); + HDprintf("*** One or more extend tests failed ***\n"); HDexit(EXIT_FAILURE); } /* end main() */ diff --git a/test/fheap.c b/test/fheap.c index 2cd2be3..b8c54d6 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -7617,7 +7617,8 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ haddr_t fh_addr; /* Address of fractal heap */ - unsigned char heap_id[100][MAX_HEAP_ID_LEN]; /* Heap ID for object inserted */ + unsigned char **heap_id = NULL; + unsigned char *heap_id_data = NULL; struct a_type_t1 { char a[10]; char b[40]; @@ -7629,6 +7630,14 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_ /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); + /* Set up data array */ + if(NULL == (heap_id_data = (unsigned char *)HDcalloc(100 * MAX_HEAP_ID_LEN, sizeof(unsigned char)))) + TEST_ERROR; + if(NULL == (heap_id = (unsigned char **)HDcalloc(100, sizeof(heap_id_data)))) + TEST_ERROR; + for (i = 0; i < 100; i++) + heap_id[i] = heap_id_data + (i * MAX_HEAP_ID_LEN); + /* Create the file to work on */ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0) FAIL_STACK_ERROR @@ -7695,7 +7704,10 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_ /* All tests passed */ PASSED() - return(0); + HDfree(heap_id); + HDfree(heap_id_data); + + return 0; error: H5E_BEGIN_TRY { @@ -7703,7 +7715,11 @@ error: H5HF_close(fh); H5Fclose(file); } H5E_END_TRY; - return(1); + + HDfree(heap_id); + HDfree(heap_id_data); + + return 1; } /* test_man_incr_insert_remove() */ #endif /* QAK */ diff --git a/test/fillval.c b/test/fillval.c index 47cd53a..b3e2e88 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -758,7 +758,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, int fillval=(-1), val_rd, should_be; int i, j, *buf=NULL, odd; unsigned u; - comp_datatype rd_c, fill_c, should_be_c; + comp_datatype rd_c, fill_c, should_be_c; comp_datatype *buf_c=NULL; H5D_space_status_t allocation; @@ -822,7 +822,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, hs_offset[0], hs_offset[1], hs_offset[2], hs_offset[3], hs_offset[4], (double)rd_c.a, rd_c.x, rd_c.y, rd_c.z, - (double)fill_c.a, fill_c.x, fill_c.y, fill_c.z); + (double)fill_c.a, fill_c.x, fill_c.y, fill_c.z); goto error; } } diff --git a/test/flushrefresh.c b/test/flushrefresh.c index 92c9f87..20a4ba4 100644 --- a/test/flushrefresh.c +++ b/test/flushrefresh.c @@ -843,13 +843,13 @@ herr_t flush_verification(const char * obj_pathname, const char * expected) /* Variables */ hid_t oid = -1, fid = -1; herr_t status = 0; - H5O_info_t oinfo; + H5O_info2_t oinfo; /* Try to open the testfile and then obj_pathname within the file */ H5E_BEGIN_TRY { fid = H5Fopen(FILENAME, H5F_ACC_SWMR_READ, H5P_DEFAULT); oid = H5Oopen(fid, obj_pathname, H5P_DEFAULT); - status = H5Oget_info2(oid, &oinfo, H5O_INFO_BASIC); + status = H5Oget_info3(oid, &oinfo, H5O_INFO_BASIC); } H5E_END_TRY; /* Compare to expected result */ @@ -978,9 +978,12 @@ herr_t refresh_verification(const char * obj_pathname) { /* Variables */ hid_t oid,fid,status = 0; - H5O_info_t flushed_oinfo; - H5O_info_t refreshed_oinfo; + H5O_info2_t flushed_oinfo; + H5O_info2_t refreshed_oinfo; + H5O_native_info_t flushed_ninfo; + H5O_native_info_t refreshed_ninfo; int tries = 800, sleep_tries = 400; + int token_cmp; hbool_t ok = FALSE; HDremove(SIGNAL_BETWEEN_PROCESSES_2); @@ -990,8 +993,9 @@ herr_t refresh_verification(const char * obj_pathname) if((oid = H5Oopen(fid, obj_pathname, H5P_DEFAULT)) < 0) PROCESS_ERROR; /* Get Object info */ - if((status = H5Oget_info2(oid, &flushed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR)) < 0) PROCESS_ERROR; - + if((status = H5Oget_info3(oid, &flushed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS)) < 0) PROCESS_ERROR; + if((status = H5Oget_native_info(oid, &flushed_ninfo, H5O_NATIVE_INFO_HDR)) < 0) PROCESS_ERROR; + /* Make sure there are no attributes on the object. This is just a sanity check to ensure we didn't erroneously flush the attribute before starting the verification. */ @@ -1009,18 +1013,20 @@ herr_t refresh_verification(const char * obj_pathname) /* Get object info again. This will NOT reflect what's on disk, only what's in the cache. Thus, all values will be unchanged from above, despite newer information being on disk. */ - if((status = H5Oget_info2(oid, &refreshed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR)) < 0) PROCESS_ERROR; + if((status = H5Oget_info3(oid, &refreshed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS)) < 0) PROCESS_ERROR; + if((status = H5Oget_native_info(oid, &refreshed_ninfo, H5O_NATIVE_INFO_HDR)) < 0) PROCESS_ERROR; /* Verify that before doing a refresh, getting the object info returns stale information. (i.e., unchanged from above, despite new info on disk). */ - if(flushed_oinfo.addr != refreshed_oinfo.addr) PROCESS_ERROR; - if(flushed_oinfo.type != refreshed_oinfo.type) PROCESS_ERROR; - if(flushed_oinfo.hdr.version != refreshed_oinfo.hdr.version) PROCESS_ERROR; - if(flushed_oinfo.hdr.flags != refreshed_oinfo.hdr.flags) PROCESS_ERROR; - if(flushed_oinfo.num_attrs != refreshed_oinfo.num_attrs) PROCESS_ERROR; - if(flushed_oinfo.hdr.nmesgs != refreshed_oinfo.hdr.nmesgs) PROCESS_ERROR; - if(flushed_oinfo.hdr.nchunks != refreshed_oinfo.hdr.nchunks) PROCESS_ERROR; - if(flushed_oinfo.hdr.space.total != refreshed_oinfo.hdr.space.total) PROCESS_ERROR; + if(H5Otoken_cmp(oid, &flushed_oinfo.token, &refreshed_oinfo.token, &token_cmp) < 0) PROCESS_ERROR; + if(token_cmp) PROCESS_ERROR; + if(flushed_oinfo.type != refreshed_oinfo.type) PROCESS_ERROR; + if(flushed_oinfo.num_attrs != refreshed_oinfo.num_attrs) PROCESS_ERROR; + if(flushed_ninfo.hdr.version != refreshed_ninfo.hdr.version) PROCESS_ERROR; + if(flushed_ninfo.hdr.flags != refreshed_ninfo.hdr.flags) PROCESS_ERROR; + if(flushed_ninfo.hdr.nmesgs != refreshed_ninfo.hdr.nmesgs) PROCESS_ERROR; + if(flushed_ninfo.hdr.nchunks != refreshed_ninfo.hdr.nchunks) PROCESS_ERROR; + if(flushed_ninfo.hdr.space.total != refreshed_ninfo.hdr.space.total) PROCESS_ERROR; /* Refresh object */ /* The H5*refresh function called depends on which object we are trying @@ -1047,19 +1053,20 @@ herr_t refresh_verification(const char * obj_pathname) } /* end else */ /* Get object info. This should now accurately reflect the refreshed object on disk. */ - if((status = H5Oget_info2(oid, &refreshed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR)) < 0) - PROCESS_ERROR; + if((status = H5Oget_info3(oid, &refreshed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS)) < 0) PROCESS_ERROR; + if((status = H5Oget_native_info(oid, &refreshed_ninfo, H5O_NATIVE_INFO_HDR)) < 0) PROCESS_ERROR; + if(H5Otoken_cmp(oid, &flushed_oinfo.token, &refreshed_oinfo.token, &token_cmp) < 0) PROCESS_ERROR; /* Confirm following (first 4) attributes are the same: */ /* Confirm following (last 4) attributes are different */ - if( (flushed_oinfo.addr == refreshed_oinfo.addr) && - (flushed_oinfo.type == refreshed_oinfo.type) && - (flushed_oinfo.hdr.version == refreshed_oinfo.hdr.version) && - (flushed_oinfo.hdr.flags == refreshed_oinfo.hdr.flags) && - (flushed_oinfo.num_attrs != refreshed_oinfo.num_attrs) && - (flushed_oinfo.hdr.nmesgs != refreshed_oinfo.hdr.nmesgs) && - (flushed_oinfo.hdr.nchunks != refreshed_oinfo.hdr.nchunks) && - (flushed_oinfo.hdr.space.total != refreshed_oinfo.hdr.space.total) ) { + if( (!token_cmp) && + (flushed_oinfo.type == refreshed_oinfo.type) && + (flushed_oinfo.num_attrs != refreshed_oinfo.num_attrs) && + (flushed_ninfo.hdr.version == refreshed_ninfo.hdr.version) && + (flushed_ninfo.hdr.flags == refreshed_ninfo.hdr.flags) && + (flushed_ninfo.hdr.nmesgs != refreshed_ninfo.hdr.nmesgs) && + (flushed_ninfo.hdr.nchunks != refreshed_ninfo.hdr.nchunks) && + (flushed_ninfo.hdr.space.total != refreshed_ninfo.hdr.space.total) ) { ok = TRUE; break; } @@ -1071,11 +1078,11 @@ herr_t refresh_verification(const char * obj_pathname) if(!ok) { HDprintf("FLUSHED: num_attrs=%d, nmesgs=%d, nchunks=%d, total=%d\n", - (int)flushed_oinfo.num_attrs, (int)flushed_oinfo.hdr.nmesgs, - (int)flushed_oinfo.hdr.nchunks, (int)flushed_oinfo.hdr.space.total); + (int)flushed_oinfo.num_attrs, (int)flushed_ninfo.hdr.nmesgs, + (int)flushed_ninfo.hdr.nchunks, (int)flushed_ninfo.hdr.space.total); HDprintf("REFRESHED: num_attrs=%d, nmesgs=%d, nchunks=%d, total=%d\n", - (int)refreshed_oinfo.num_attrs, (int)refreshed_oinfo.hdr.nmesgs, - (int)refreshed_oinfo.hdr.nchunks, (int)refreshed_oinfo.hdr.space.total); + (int)refreshed_oinfo.num_attrs, (int)refreshed_ninfo.hdr.nmesgs, + (int)refreshed_ninfo.hdr.nchunks, (int)refreshed_ninfo.hdr.space.total); PROCESS_ERROR; } diff --git a/test/genall5.c b/test/genall5.c index 849d97c..3f55930 100644 --- a/test/genall5.c +++ b/test/genall5.c @@ -479,7 +479,7 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) { u = 0; while ((pass) && (u < nlinks)) { - H5L_info_t lnk_info; + H5L_info2_t lnk_info; char linkname[16]; htri_t link_exists; @@ -493,7 +493,7 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) { HDassert(link_exists >= 0); HDmemset(&lnk_info, 0, sizeof(grp_info)); - ret = H5Lget_info(gid, linkname, &lnk_info, H5P_DEFAULT); + ret = H5Lget_info2(gid, linkname, &lnk_info, H5P_DEFAULT); if (ret < 0) { pass = FALSE; @@ -554,7 +554,8 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) { HDfree(slinkval); } /* end if */ else if (1 == (u % 3)) { - H5O_info_t root_oinfo; + H5O_info2_t root_oinfo; + int token_cmp = 0; if (H5L_TYPE_HARD != lnk_info.type) { pass = FALSE; @@ -563,18 +564,25 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) { HDassert(H5L_TYPE_HARD == lnk_info.type); HDmemset(&root_oinfo, 0, sizeof(root_oinfo)); - ret = H5Oget_info2(fid, &root_oinfo, H5O_INFO_BASIC); + ret = H5Oget_info3(fid, &root_oinfo, H5O_INFO_BASIC); if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Oget_info() failed."; } - else if (root_oinfo.addr != lnk_info.u.address) { - pass = FALSE; - failure_mssg = "vrfy_ns_grp_c: root_oinfo.addr != lnk_info.u.address"; + else { + if(H5Otoken_cmp(fid, &root_oinfo.token, &lnk_info.u.token, &token_cmp) < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_c: H5Otoken_cmp() failed."; + } + + if (token_cmp) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_c: root_oinfo.token != lnk_info.u.token"; + } } HDassert(ret >= 0); - HDassert(root_oinfo.addr == lnk_info.u.address); + HDassert(!token_cmp); } /* end else-if */ else { void *elinkval; @@ -888,7 +896,7 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) { u = 0; while ((pass) && (u < nlinks)) { - H5L_info_t lnk_info; + H5L_info2_t lnk_info; char linkname[16]; htri_t link_exists; @@ -902,7 +910,7 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) { HDassert(link_exists >= 0); HDmemset(&lnk_info, 0, sizeof(grp_info)); - ret = H5Lget_info(gid, linkname, &lnk_info, H5P_DEFAULT); + ret = H5Lget_info2(gid, linkname, &lnk_info, H5P_DEFAULT); if (ret < 0) { pass = FALSE; @@ -963,7 +971,8 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) { HDfree(slinkval); } /* end if */ else if (1 == (u % 3)) { - H5O_info_t root_oinfo; + H5O_info2_t root_oinfo; + int token_cmp = 0; if (H5L_TYPE_HARD != lnk_info.type) { pass = FALSE; @@ -972,17 +981,24 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) { HDassert(H5L_TYPE_HARD == lnk_info.type); HDmemset(&root_oinfo, 0, sizeof(root_oinfo)); - ret = H5Oget_info2(fid, &root_oinfo, H5O_INFO_BASIC); + ret = H5Oget_info3(fid, &root_oinfo, H5O_INFO_BASIC); if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_d: H5Oget_info() failed."; } - else if (root_oinfo.addr != lnk_info.u.address) { - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: root_oinfo.addr != lnk_info.u.address"; + else { + if(H5Otoken_cmp(fid, &root_oinfo.token, &lnk_info.u.token, &token_cmp) < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Otoken_cmp() failed."; + } + + if (token_cmp) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: root_oinfo.token != lnk_info.u.token"; + } } HDassert(ret >= 0); - HDassert(root_oinfo.addr == lnk_info.u.address); + HDassert(!token_cmp); } /* end else-if */ else { void *elinkval; @@ -1486,7 +1502,7 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, u = 0; while ((pass) && (u < nlinks)) { - H5L_info_t lnk_info; + H5L_info2_t lnk_info; char linkname[32]; htri_t link_exists; @@ -1500,7 +1516,7 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, HDassert(link_exists >= 0); HDmemset(&lnk_info, 0, sizeof(grp_info)); - ret = H5Lget_info(gid, linkname, &lnk_info, H5P_DEFAULT); + ret = H5Lget_info2(gid, linkname, &lnk_info, H5P_DEFAULT); if (ret < 0) { pass = FALSE; @@ -1557,7 +1573,8 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, HDfree(slinkval); } /* end if */ else { - H5O_info_t root_oinfo; + H5O_info2_t root_oinfo; + int token_cmp = 0; HDassert(1 == (u % 2)); @@ -1568,18 +1585,25 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, HDassert(H5L_TYPE_HARD == lnk_info.type); HDmemset(&root_oinfo, 0, sizeof(root_oinfo)); - ret = H5Oget_info2(fid, &root_oinfo, H5O_INFO_BASIC); + ret = H5Oget_info3(fid, &root_oinfo, H5O_INFO_BASIC); if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_os_grp_n: H5Oget_info() failed."; } - else if (root_oinfo.addr != lnk_info.u.address) { - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: root_oinfo.addr != lnk_info.u.address"; + else { + if(H5Otoken_cmp(fid, &root_oinfo.token, &lnk_info.u.token, &token_cmp) < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Otoken_cmp() failed."; + } + + if (token_cmp) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: root_oinfo.token != lnk_info.u.token"; + } } HDassert(ret >= 0); - HDassert(root_oinfo.addr == lnk_info.u.address); + HDassert(!token_cmp); } /* end else */ u++; diff --git a/test/getname.c b/test/getname.c index 399f364..f677d78 100644 --- a/test/getname.c +++ b/test/getname.c @@ -101,8 +101,8 @@ test_main(hid_t file_id, hid_t fapl) hid_t space_id; hid_t type_id, type2_id; hsize_t dims[1] = { 5 }; - size_t name_len; /* Name length */ - H5O_info_t oinfo; /* Object info structs */ + size_t name_len; /* Name length */ + H5O_info2_t oinfo; /* Object info structs */ hid_t dtype; /* Object identifier for testing */ hid_t dtype_anon; /* Object identifier for testing anonymous */ ssize_t size; /* Size returned by H5Iget_name */ @@ -2390,7 +2390,7 @@ test_main(hid_t file_id, hid_t fapl) if((size = H5Iget_name(dtype_anon, NULL,0)) != 0) TEST_ERROR /* Store the address of the datatype for later use */ - if(H5Oget_info2(dtype_anon, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Oget_info3(dtype_anon, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR /* Update the reference count to dtype_anon to preserve the datatype */ if(H5Oincr_refcount(dtype_anon) < 0) TEST_ERROR @@ -2400,10 +2400,10 @@ test_main(hid_t file_id, hid_t fapl) if(H5Fclose(file2_id) < 0) TEST_ERROR /* Re-open the file and check that the anonymous datatypes persist */ - if( (file2_id = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + if((file2_id = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Check the H5Iget_name does not return an error for anon committed datatypes */ - if((dtype_anon = H5Oopen_by_addr(file2_id, oinfo.addr)) < 0) TEST_ERROR + if((dtype_anon = H5Oopen_by_token(file2_id, oinfo.token)) < 0) TEST_ERROR if((size = H5Iget_name(dtype_anon, NULL, 0)) != 0) TEST_ERROR diff --git a/test/h5test.c b/test/h5test.c index 6a3a5cb..ab859a5 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -1697,7 +1697,7 @@ error: */ static herr_t h5_verify_cached_stabs_cb(hid_t oid, const char H5_ATTR_UNUSED *name, - const H5O_info_t *oinfo, void H5_ATTR_UNUSED *udata) + const H5O_info2_t *oinfo, void H5_ATTR_UNUSED *udata) { if(oinfo->type == H5O_TYPE_GROUP) return H5G__verify_cached_stabs_test(oid); @@ -1745,7 +1745,7 @@ h5_verify_cached_stabs(const char *base_name[], hid_t fapl) continue; } /* end if */ - if(H5Ovisit2(file, H5_INDEX_NAME, H5_ITER_NATIVE, + if(H5Ovisit3(file, H5_INDEX_NAME, H5_ITER_NATIVE, h5_verify_cached_stabs_cb, NULL, H5O_INFO_BASIC) < 0) goto error; diff --git a/test/links.c b/test/links.c index 4dff1cf..60d3152 100644 --- a/test/links.c +++ b/test/links.c @@ -35,6 +35,7 @@ #include "H5Gpkg.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ +#include "H5VLnative_private.h" /* Native VOL connector */ /* File for external link test. Created with gen_udlinks.c */ #define LINKED_FILE "be_extlink2.h5" @@ -314,7 +315,119 @@ typedef struct { static hid_t dcpl_g; /* for [un]minimized dataset object headers */ +static herr_t +UD_hard_create(const char *link_name, hid_t loc_group, const void *udata, + size_t udata_size, hid_t lcpl_id); +static hid_t +UD_hard_traverse(const char *link_name, hid_t cur_group, + const void *udata, size_t udata_size, hid_t lapl_id, + hid_t dxpl_id); +static herr_t +UD_hard_delete(const char *link_name, hid_t file, const void *udata, + size_t udata_size); + +/* User-defined link class */ +const H5L_class_t UD_hard_class[1] = {{ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_HARD_TYPE, /* Link type id number */ + "UD_hard_link", /* Link class name for debugging */ + UD_hard_create, /* Creation callback */ + NULL, /* Move/rename callback */ + NULL, /* Copy callback */ + UD_hard_traverse, /* The actual traversal function */ + UD_hard_delete, /* Deletion callback */ + NULL /* Query callback */ +}}; + +#ifndef H5_NO_DEPRECATED_SYMBOLS +static herr_t +UD_hard_create_deprec(const char *link_name, hid_t loc_group, const void *udata, + size_t udata_size, hid_t lcpl_id); +static hid_t +UD_hard_traverse_deprec(const char *link_name, hid_t cur_group, + const void *udata, size_t udata_size, hid_t lapl_id, + hid_t dxpl_id); +static herr_t +UD_hard_delete_deprec(const char *link_name, hid_t file, const void *udata, + size_t udata_size); + +/* User-defined link class */ +const H5L_class_t UD_hard_class_deprec[1] = {{ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_HARD_TYPE, /* Link type id number */ + "UD_hard_link_deprec", /* Link class name for debugging */ + UD_hard_create_deprec, /* Creation callback */ + NULL, /* Move/rename callback */ + NULL, /* Copy callback */ + UD_hard_traverse_deprec, /* The actual traversal function */ + UD_hard_delete_deprec, /* Deletion callback */ + NULL /* Query callback */ +}}; +#endif + +static hid_t +UD_rereg_traverse(const char *link_name, hid_t cur_group, + const void *udata, size_t udata_size, hid_t lapl_id, + hid_t dxpl_id); + +/* This link class has the same ID number as the UD hard links but + * has a very different traversal function */ +const H5L_class_t UD_rereg_class[1] = {{ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_HARD_TYPE, /* Link type id number */ + "UD_reregistered_type", /* Link class name for debugging */ + NULL, /* Creation callback */ + NULL, /* Move/rename callback */ + NULL, /* Copy callback */ + UD_rereg_traverse, /* The actual traversal function */ + NULL, /* Deletion callback */ + NULL /* Query callback */ +}}; + +static herr_t +UD_cb_create(const char * link_name, hid_t loc_group, const void *udata, + size_t udata_size, hid_t lcpl_id); +static herr_t +UD_cb_move(const char *new_name, hid_t new_loc, const void *udata, + size_t udata_size); +static hid_t +UD_cb_traverse(const char * link_name, hid_t cur_group, const void *udata, + size_t udata_size, hid_t lapl_id, hid_t dxpl_id); +static herr_t +UD_cb_delete(const char *link_name, hid_t file, const void *udata, + size_t udata_size); +static ssize_t +UD_cb_query(const char * link_name, const void *udata, size_t udata_size, + void *buf, size_t buf_size); + +const H5L_class_t UD_cb_class[1] = {{ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_CB_TYPE, /* Link type id number */ + NULL, /* NULL name (to make sure this doesn't break anything */ + UD_cb_create, /* Creation callback */ + UD_cb_move, /* Move/rename callback */ + UD_cb_move, /* Copy callback */ + UD_cb_traverse, /* The actual traversal function */ + UD_cb_delete, /* Deletion callback */ + UD_cb_query /* Query callback */ +}}; +static hid_t +UD_plist_traverse(const char *link_name, hid_t cur_group, + const void *udata, size_t udata_size, hid_t lapl_id, + hid_t dxpl_id); + +const H5L_class_t UD_plist_class[1] = {{ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_PLIST_TYPE, /* Link type id number */ + "UD_plist_link", /* Link class name for debugging */ + NULL, /* Creation callback */ + NULL, /* Move/rename callback */ + NULL, /* Copy callback */ + UD_plist_traverse, /* The actual traversal function */ + NULL, /* Deletion callback */ + NULL /* Query callback */ +}}; /*------------------------------------------------------------------------- * Function: fix_ext_filename @@ -499,10 +612,11 @@ static int cklinks(hid_t fapl, hbool_t new_format) { hid_t file; - H5O_info_t oinfo1, oinfo2; - H5L_info_t linfo2; + H5O_info2_t oinfo1, oinfo2; + H5L_info2_t linfo; char linkval[LINK_BUF_SIZE]; char filename[NAME_BUF_SIZE]; + int token_cmp; herr_t status; if(new_format) @@ -515,14 +629,15 @@ cklinks(hid_t fapl, hbool_t new_format) if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR /* Hard link */ - if(H5Oget_info_by_name2(file, "d1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file, "grp1/hard", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file, "d1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file, "grp1/hard", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_DATASET != oinfo2.type) { H5_FAILED(); HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); TEST_ERROR } /* end if */ - if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { + if(H5Otoken_cmp(file, &oinfo1.token, &oinfo2.token, &token_cmp) < 0) FAIL_STACK_ERROR + if(token_cmp) { H5_FAILED(); HDputs(" Hard link test failed. Link seems not to point to the "); HDputs(" expected file location."); @@ -551,13 +666,14 @@ cklinks(hid_t fapl, hbool_t new_format) } /* end if */ /* Symbolic link */ - if(H5Oget_info_by_name2(file, "grp1/soft", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file, "grp1/soft", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_DATASET != oinfo2.type) { H5_FAILED(); HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); TEST_ERROR } /* end if */ - if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { + if(H5Otoken_cmp(file, &oinfo1.token, &oinfo2.token, &token_cmp) < 0) FAIL_STACK_ERROR + if(token_cmp) { H5_FAILED(); HDputs(" Soft link test failed. Link seems not to point to the "); HDputs(" expected file location."); @@ -573,15 +689,15 @@ cklinks(hid_t fapl, hbool_t new_format) /* Dangling link */ H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(file, "grp1/dangle", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + status = H5Oget_info_by_name3(file, "grp1/dangle", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { H5_FAILED(); HDputs(" H5Oget_info_by_name() should have failed for a dangling link."); TEST_ERROR } /* end if */ - if(H5Lget_info(file, "grp1/dangle", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5L_TYPE_SOFT != linfo2.type) { + if(H5Lget_info2(file, "grp1/dangle", &linfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5L_TYPE_SOFT != linfo.type) { H5_FAILED(); HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); TEST_ERROR @@ -600,15 +716,15 @@ cklinks(hid_t fapl, hbool_t new_format) /* Recursive link */ H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(file, "grp1/recursive", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + status = H5Oget_info_by_name3(file, "grp1/recursive", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { H5_FAILED(); HDputs(" H5Oget_info_by_name() should have failed for a recursive link."); TEST_ERROR } /* end if */ - if(H5Lget_info(file, "grp1/recursive", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5L_TYPE_SOFT != linfo2.type) { + if(H5Lget_info2(file, "grp1/recursive", &linfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5L_TYPE_SOFT != linfo.type) { H5_FAILED(); HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); TEST_ERROR @@ -652,8 +768,9 @@ static int ck_new_links(hid_t fapl, hbool_t new_format) { hid_t file; - H5O_info_t oi_dset, oi_hard1, oi_hard2; + H5O_info2_t oi_dset, oi_hard1, oi_hard2; char filename[NAME_BUF_SIZE]; + int token_cmp1, token_cmp2; if(new_format) TESTING("new link queries (w/new group format)") @@ -665,9 +782,9 @@ ck_new_links(hid_t fapl, hbool_t new_format) if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Get hard link info */ - if(H5Oget_info_by_name2(file, "/grp1/dataset2", &oi_dset, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file, "/grp1/hard1", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file, "/grp2/hard2", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file, "/grp1/dataset2", &oi_dset, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file, "/grp1/hard1", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file, "/grp2/hard2", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR /* Check hard links */ if(H5O_TYPE_DATASET != oi_hard1.type || H5O_TYPE_DATASET != oi_hard2.type) { @@ -675,7 +792,10 @@ ck_new_links(hid_t fapl, hbool_t new_format) HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); TEST_ERROR } - if(H5F_addr_ne(oi_dset.addr, oi_hard1.addr) || H5F_addr_ne(oi_dset.addr, oi_hard2.addr)) { + + if(H5Otoken_cmp(file, &oi_dset.token, &oi_hard1.token, &token_cmp1) < 0) TEST_ERROR + if(H5Otoken_cmp(file, &oi_dset.token, &oi_hard2.token, &token_cmp2) < 0) TEST_ERROR + if(token_cmp1 || token_cmp2) { H5_FAILED(); HDputs(" Hard link test failed. Link seems not to point to the "); HDputs(" expected file location."); @@ -920,7 +1040,7 @@ test_lcpl(hid_t fapl, hbool_t new_format) hid_t dset_id = -1; hid_t type_id = -1; hid_t lcpl_id = -1; - H5L_info_t linfo; + H5L_info2_t linfo; char filename[1024]; hsize_t dims[2]; @@ -942,7 +1062,7 @@ test_lcpl(hid_t fapl, hbool_t new_format) if(H5Gclose(group_id) < 0) TEST_ERROR /* Check that its character encoding is the default */ - if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR /* Create and commit a datatype with the default LCPL */ @@ -951,7 +1071,7 @@ test_lcpl(hid_t fapl, hbool_t new_format) if(H5Tclose(type_id) < 0) TEST_ERROR /* Check that its character encoding is the default */ - if(H5Lget_info(file_id, "type", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "type", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR /* Create a dataspace */ @@ -964,7 +1084,7 @@ test_lcpl(hid_t fapl, hbool_t new_format) if(H5Dclose(dset_id) < 0) TEST_ERROR /* Check that its character encoding is the default */ - if(H5Lget_info(file_id, "dataset", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "dataset", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR /* Create a link creation property list with the UTF-8 character encoding */ @@ -976,7 +1096,7 @@ test_lcpl(hid_t fapl, hbool_t new_format) if(H5Gclose(group_id) < 0) TEST_ERROR /* Check that its character encoding is UTF-8 */ - if(H5Lget_info(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR /* Create and commit a datatype with the new LCPL */ @@ -985,7 +1105,7 @@ test_lcpl(hid_t fapl, hbool_t new_format) if(H5Tclose(type_id) < 0) TEST_ERROR /* Check that its character encoding is UTF-8 */ - if(H5Lget_info(file_id, "type2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "type2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR /* Create a dataset using the new LCPL */ @@ -993,7 +1113,7 @@ test_lcpl(hid_t fapl, hbool_t new_format) if(H5Dclose(dset_id) < 0) TEST_ERROR /* Check that its character encoding is UTF-8 */ - if(H5Lget_info(file_id, "dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR /* Create a new link to the dataset with a different character encoding. */ @@ -1004,35 +1124,35 @@ test_lcpl(hid_t fapl, hbool_t new_format) if(H5Lcreate_hard(file_id, "/dataset2", file_id, "/dataset2_link", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR /* Check that its character encoding is ASCII */ - if(H5Lget_info(file_id, "/dataset2_link", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "/dataset2_link", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR /* Check that the first link's encoding hasn't changed */ - if(H5Lget_info(file_id, "/dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "/dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR /* Make sure that LCPLs work properly for other API calls: */ /* H5Lcreate_soft */ if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR if(H5Lcreate_soft("dataset2", file_id, "slink_to_dset2", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(file_id, "slink_to_dset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "slink_to_dset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR /* H5Lmove */ if(H5Pset_char_encoding(lcpl_id, H5T_CSET_ASCII) < 0) TEST_ERROR if(H5Lmove(file_id, "slink_to_dset2", file_id, "moved_slink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(file_id, "moved_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "moved_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR /* H5Lcopy */ if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR if(H5Lcopy(file_id, "moved_slink", file_id, "copied_slink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(file_id, "copied_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "copied_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR /* H5Lcreate_external */ if(H5Lcreate_external("filename", "path", file_id, "extlink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(file_id, "extlink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "extlink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR /* Close open IDs */ @@ -1328,8 +1448,8 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) hid_t fcpl_id=-1; /* Group creation property list ID */ hid_t lcpl_id=-1; hid_t lcpl2_id=-1; - H5O_info_t oinfo; - H5L_info_t linfo; + H5O_info2_t oinfo; + H5L_info2_t linfo; H5T_cset_t old_cset; int64_t old_corder; /* Creation order value of link */ time_t old_modification_time; @@ -1366,8 +1486,8 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) if(H5Gclose(group_id) < 0) TEST_ERROR /* Get the group's link's information */ - if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR old_cset = linfo.cset; if(old_cset != H5T_CSET_UTF8) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR @@ -1385,8 +1505,8 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) TEST_ERROR /* Get the link's character set & modification time . They should be unchanged */ - if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR if(old_modification_time != oinfo.mtime) TEST_ERROR if(old_cset != linfo.cset) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR @@ -1394,9 +1514,9 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) /* Create a new link to the group. It should have a different creation order value but the same modification time */ if(H5Lcreate_hard(file_id, "group", file_id, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file_id, "group2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR if(old_modification_time != oinfo.mtime) TEST_ERROR - if(H5Lget_info(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(old_corder == linfo.corder) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR if(linfo.corder != 1) TEST_ERROR @@ -1407,9 +1527,9 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) * should not change. */ if(H5Lcopy(file_id, "group", file_id, "group_copied", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group_copied", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file_id, "group_copied", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR if(old_modification_time != oinfo.mtime) TEST_ERROR - if(H5Lget_info(file_id, "group_copied", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "group_copied", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR if(linfo.corder != 2) TEST_ERROR @@ -1418,9 +1538,9 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) /* Move the link with the default property list. */ if(H5Lmove(file_id, "group_copied", file_id, "group_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group_copied2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file_id, "group_copied2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR if(old_modification_time != oinfo.mtime) TEST_ERROR - if(H5Lget_info(file_id, "group_copied2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "group_copied2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR if(linfo.corder != 3) TEST_ERROR @@ -1428,9 +1548,9 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) if(linfo.cset == H5T_CSET_UTF8) TEST_ERROR /* Check that the original link is unchanged */ - if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR if(old_modification_time != oinfo.mtime) TEST_ERROR - if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR if(old_corder != linfo.corder) TEST_ERROR if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR @@ -1439,9 +1559,9 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) * Its creation order value will change, but modification time should not * change. */ if(H5Lmove(file_id, "group", file_id, "group_moved", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group_moved", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file_id, "group_moved", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR if(old_modification_time != oinfo.mtime) TEST_ERROR - if(H5Lget_info(file_id, "group_moved", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "group_moved", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR if(linfo.corder != 4) TEST_ERROR @@ -1450,9 +1570,9 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) /* Move the link again using the default property list. */ if(H5Lmove(file_id, "group_moved", file_id, "group_moved_again", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group_moved_again", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file_id, "group_moved_again", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR if(old_modification_time != oinfo.mtime) TEST_ERROR - if(H5Lget_info(file_id, "group_moved_again", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "group_moved_again", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR if(linfo.corder != 5) TEST_ERROR @@ -1625,6 +1745,3910 @@ error: } H5E_END_TRY; return 1; } /* end test_deprec() */ + +/*------------------------------------------------------------------------- + * Function: cklinks_deprec + * + * Purpose: Open the file created in the first step and check that the + * links look correct. + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +cklinks_deprec(hid_t fapl, hbool_t new_format) +{ + hid_t file; + H5O_info1_t oinfo1, oinfo2; + H5L_info1_t linfo; + char linkval[LINK_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; + herr_t status; + + if(new_format) + TESTING("link queries using deprecated routines (w/new group format)") + else + TESTING("link queries using deprecated routines") + + /* Open the file */ + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); + if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR + + /* Hard link */ + if(H5Oget_info_by_name2(file, "d1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file, "grp1/hard", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5O_TYPE_DATASET != oinfo2.type) { + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + TEST_ERROR + } /* end if */ + if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { + H5_FAILED(); + HDputs(" Hard link test failed. Link seems not to point to the "); + 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_name2(file, "grp1/soft", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5O_TYPE_DATASET != oinfo2.type) { + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + TEST_ERROR + } /* end if */ + if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { + H5_FAILED(); + HDputs(" Soft link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR + } /* end if */ + if(H5Lget_val(file, "grp1/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(HDstrcmp(linkval, "/d1")) { + H5_FAILED(); + HDputs(" Soft link test failed. Wrong link value"); + TEST_ERROR + } /* end if */ + if(H5Lexists(file, "grp1/soft", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + + /* Dangling link */ + H5E_BEGIN_TRY { + status = H5Oget_info_by_name2(file, "grp1/dangle", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + } H5E_END_TRY; + if(status >= 0) { + H5_FAILED(); + HDputs(" H5Oget_info_by_name() should have failed for a dangling link."); + TEST_ERROR + } /* end if */ + if(H5Lget_info1(file, "grp1/dangle", &linfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5L_TYPE_SOFT != linfo.type) { + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); + TEST_ERROR + } /* end if */ + if(H5Lget_val(file, "grp1/dangle", linkval, sizeof linkval, H5P_DEFAULT) < 0) { + H5_FAILED(); + HDprintf(" %d: Can't retrieve link value\n", __LINE__); + TEST_ERROR + } /* end if */ + if(HDstrcmp(linkval, "foobar")) { + H5_FAILED(); + HDputs(" Dangling link test failed. Wrong link value"); + TEST_ERROR + } /* end if */ + if(H5Lexists(file, "grp1/dangle", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + + /* Recursive link */ + H5E_BEGIN_TRY { + status = H5Oget_info_by_name2(file, "grp1/recursive", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + } H5E_END_TRY; + if(status >= 0) { + H5_FAILED(); + HDputs(" H5Oget_info_by_name() should have failed for a recursive link."); + TEST_ERROR + } /* end if */ + if(H5Lget_info1(file, "grp1/recursive", &linfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5L_TYPE_SOFT != linfo.type) { + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); + TEST_ERROR + } /* end if */ + if(H5Lget_val(file, "grp1/recursive", linkval, sizeof linkval, H5P_DEFAULT) < 0) { + H5_FAILED(); + HDprintf(" %d: Can't retrieve link value\n", __LINE__); + TEST_ERROR + } /* end if */ + if(HDstrcmp(linkval, "/grp1/recursive")) { + H5_FAILED(); + HDputs(" Recursive link test failed. Wrong link value"); + TEST_ERROR + } /* end if */ + + /* Non-existent link */ + if(H5Lexists(file, "foobar", H5P_DEFAULT) == TRUE) FAIL_STACK_ERROR + + /* Cleanup */ + if(H5Fclose(file) < 0) FAIL_STACK_ERROR + + PASSED(); + return SUCCEED; + +error: + return FAIL; +} /* end chklinks_deprec() */ + +/*------------------------------------------------------------------------- + * Function: test_lcpl_deprec + * + * Purpose: Tests Link Creation Property Lists + * + * Return: Success: 0 + * Failure: number of errors + *------------------------------------------------------------------------- + */ +static int +test_lcpl_deprec(hid_t fapl, hbool_t new_format) +{ + hid_t file_id = -1; + hid_t group_id = -1; + hid_t space_id = -1; + hid_t dset_id = -1; + hid_t type_id = -1; + hid_t lcpl_id = -1; + H5L_info1_t linfo; + char filename[1024]; + hsize_t dims[2]; + + if(new_format) + TESTING("link creation property lists using deprecated routines (w/new group format)") + else + TESTING("link creation property lists using deprecated routines") + + /* Actually, intermediate group creation is tested elsewhere (tmisc). + * Here we only need to test the character encoding property */ + + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create and link a group with the default LCPL */ + if((group_id = H5Gcreate2(file_id, "/group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Check that its character encoding is the default */ + if(H5Lget_info1(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR + + /* Create and commit a datatype with the default LCPL */ + if((type_id = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if(H5Tcommit2(file_id, "/type", type_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Tclose(type_id) < 0) TEST_ERROR + + /* Check that its character encoding is the default */ + if(H5Lget_info1(file_id, "type", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR + + /* Create a dataspace */ + dims[0] = H5L_DIM1; + dims[1] = H5L_DIM2; + if((space_id=H5Screate_simple(2 ,dims, NULL)) < 0) TEST_ERROR + + /* Create a dataset using the default LCPL */ + if((dset_id = H5Dcreate2(file_id, "/dataset", H5T_NATIVE_INT, space_id, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(dset_id) < 0) TEST_ERROR + + /* Check that its character encoding is the default */ + if(H5Lget_info1(file_id, "dataset", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR + + /* Create a link creation property list with the UTF-8 character encoding */ + if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR + if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR + + /* Create and link a group with the new LCPL */ + if((group_id = H5Gcreate2(file_id, "/group2", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Check that its character encoding is UTF-8 */ + if(H5Lget_info1(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Create and commit a datatype with the new LCPL */ + if((type_id = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if(H5Tcommit2(file_id, "/type2", type_id, lcpl_id, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Tclose(type_id) < 0) TEST_ERROR + + /* Check that its character encoding is UTF-8 */ + if(H5Lget_info1(file_id, "type2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Create a dataset using the new LCPL */ + if((dset_id = H5Dcreate2(file_id, "/dataset2", H5T_NATIVE_INT, space_id, lcpl_id, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(dset_id) < 0) TEST_ERROR + + /* Check that its character encoding is UTF-8 */ + if(H5Lget_info1(file_id, "dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Create a new link to the dataset with a different character encoding. */ + if(H5Pclose(lcpl_id) < 0) TEST_ERROR + if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR + if(H5Pset_char_encoding(lcpl_id, H5T_CSET_ASCII) < 0) TEST_ERROR + + if(H5Lcreate_hard(file_id, "/dataset2", file_id, "/dataset2_link", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + + /* Check that its character encoding is ASCII */ + if(H5Lget_info1(file_id, "/dataset2_link", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR + + /* Check that the first link's encoding hasn't changed */ + if(H5Lget_info1(file_id, "/dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Make sure that LCPLs work properly for other API calls: */ + /* H5Lcreate_soft */ + if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR + if(H5Lcreate_soft("dataset2", file_id, "slink_to_dset2", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info1(file_id, "slink_to_dset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* H5Lmove */ + if(H5Pset_char_encoding(lcpl_id, H5T_CSET_ASCII) < 0) TEST_ERROR + if(H5Lmove(file_id, "slink_to_dset2", file_id, "moved_slink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info1(file_id, "moved_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR + + /* H5Lcopy */ + if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR + if(H5Lcopy(file_id, "moved_slink", file_id, "copied_slink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info1(file_id, "copied_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* H5Lcreate_external */ + if(H5Lcreate_external("filename", "path", file_id, "extlink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info1(file_id, "extlink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Close open IDs */ + if(H5Pclose(lcpl_id) < 0) TEST_ERROR + if(H5Sclose(space_id) < 0) TEST_ERROR + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Gclose(group_id); + H5Dclose(dset_id); + H5Tclose(type_id); + H5Pclose(lcpl_id); + H5Sclose(space_id); + H5Fclose(file_id); + } H5E_END_TRY; + return 1; +} /* end test_lcpl_deprec() */ + +/*------------------------------------------------------------------------- + * Function: test_move_preserves_deprec + * + * Purpose: Tests that moving and renaming links preserves their + * properties. + * + * Return: Success: 0 + * Failure: number of errors + *------------------------------------------------------------------------- + */ +static int +test_move_preserves_deprec(hid_t fapl_id, hbool_t new_format) +{ + hid_t file_id=-1; + hid_t group_id=-1; + hid_t fcpl_id=-1; /* Group creation property list ID */ + hid_t lcpl_id=-1; + hid_t lcpl2_id=-1; + H5O_info1_t oinfo; + H5L_info1_t linfo; + H5T_cset_t old_cset; + int64_t old_corder; /* Creation order value of link */ + time_t old_modification_time; + time_t curr_time; + unsigned crt_order_flags; /* Status of creation order info for GCPL */ + char filename[1024]; + + if(new_format) + TESTING("moving and copying links using deprecated routines preserves their properties (w/new group format)") + else + TESTING("moving and copying links using deprecated routines preserves their properties") + + /* Create a file creation property list with creation order stored for links + * in the root group + */ + if((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR + if(H5Pget_link_creation_order(fcpl_id, &crt_order_flags) < 0) TEST_ERROR + if(crt_order_flags != 0) TEST_ERROR + if(H5Pset_link_creation_order(fcpl_id, H5P_CRT_ORDER_TRACKED) < 0) TEST_ERROR + if(H5Pget_link_creation_order(fcpl_id, &crt_order_flags) < 0) TEST_ERROR + if(crt_order_flags != H5P_CRT_ORDER_TRACKED) TEST_ERROR + + /* Create file */ + /* (with creation order tracking for the root group) */ + h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id)) < 0) TEST_ERROR + + /* Create a link creation property list with the UTF-8 character encoding */ + if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR + if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR + + /* Create a group with that lcpl */ + if((group_id = H5Gcreate2(file_id, "group", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Get the group's link's information */ + if(H5Lget_info1(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + old_cset = linfo.cset; + if(old_cset != H5T_CSET_UTF8) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + old_corder = linfo.corder; + if(old_corder != 0) TEST_ERROR + old_modification_time = oinfo.mtime; + + /* If this test happens too quickly, the times will all be the same. Make sure the time changes. */ + curr_time = HDtime(NULL); + while(HDtime(NULL) <= curr_time) + ; + + /* Close the file and reopen it */ + if(H5Fclose(file_id) < 0) TEST_ERROR + if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) TEST_ERROR + + /* Get the link's character set & modification time . They should be unchanged */ + if(H5Lget_info1(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(old_cset != linfo.cset) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(old_corder != linfo.corder) TEST_ERROR + + /* Create a new link to the group. It should have a different creation order value but the same modification time */ + if(H5Lcreate_hard(file_id, "group", file_id, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(H5Lget_info1(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(old_corder == linfo.corder) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != 1) TEST_ERROR + if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR + + /* Copy the first link to a UTF-8 name. + * Its creation order value should be different, but modification time + * should not change. + */ + if(H5Lcopy(file_id, "group", file_id, "group_copied", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group_copied", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(H5Lget_info1(file_id, "group_copied", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != 2) TEST_ERROR + + /* Check that its character encoding is UTF-8 */ + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Move the link with the default property list. */ + if(H5Lmove(file_id, "group_copied", file_id, "group_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group_copied2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(H5Lget_info1(file_id, "group_copied2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != 3) TEST_ERROR + + /* Check that its character encoding is not UTF-8 */ + if(linfo.cset == H5T_CSET_UTF8) TEST_ERROR + + /* Check that the original link is unchanged */ + if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(H5Lget_info1(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(old_corder != linfo.corder) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Move the first link to a UTF-8 name. + * Its creation order value will change, but modification time should not + * change. */ + if(H5Lmove(file_id, "group", file_id, "group_moved", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group_moved", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(H5Lget_info1(file_id, "group_moved", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != 4) TEST_ERROR + + /* Check that its character encoding is UTF-8 */ + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Move the link again using the default property list. */ + if(H5Lmove(file_id, "group_moved", file_id, "group_moved_again", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group_moved_again", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(H5Lget_info1(file_id, "group_moved_again", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != 5) TEST_ERROR + + /* Check that its character encoding is not UTF-8 */ + if(linfo.cset == H5T_CSET_UTF8) TEST_ERROR + + /* Close open IDs */ + if(H5Pclose(fcpl_id) < 0) TEST_ERROR + if(H5Pclose(lcpl_id) < 0) TEST_ERROR + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Pclose(fcpl_id); + H5Pclose(lcpl_id); + H5Pclose(lcpl2_id); + H5Gclose(group_id); + H5Fclose(file_id); + } H5E_END_TRY; + return 1; +} /* end test_move_preserves_deprec() */ + +/*------------------------------------------------------------------------- + * Function: external_link_root_deprec + * + * Purpose: Build a file with external link to root group in external file + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +external_link_root_deprec(hid_t fapl, hbool_t new_format) +{ + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + H5L_info1_t linfo; /* Link information */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename1[NAME_BUF_SIZE]; + char filename2[NAME_BUF_SIZE]; + const char *file; /* File from external link */ + const char *path; /* Path from external link */ + + if(new_format) + TESTING("external link to root using deprecated routines (w/new group format)") + else + TESTING("external link to root using deprecated routines") + + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); + + /* Create file to point to */ + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Check that external links are registered with the library */ + if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR + + /* Create file with link to first file */ + if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create external link to object in first file */ + if(H5Lcreate_external(filename1, "/", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Check information for external link */ + if(H5Lget_info1(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; + if(H5L_TYPE_EXTERNAL != linfo.type) { + H5_FAILED(); + HDputs(" Unexpected object type - should have been an external link"); + goto error; + } + if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR + if(HDstrcmp(file, filename1)) { + H5_FAILED(); + HDputs(" External link file name incorrect"); + goto error; + } + if(HDstrcmp(path, "/")) { + H5_FAILED(); + HDputs(" External link path incorrect"); + goto error; + } + + /* Create external link to object in first file */ + /* (add a few extra '/'s to make certain library normalizes external link object names) */ + if(H5Lcreate_external(filename1, "///", fid, "ext_link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Check information for external link */ + if(H5Lget_info1(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; + if(H5L_TYPE_EXTERNAL != linfo.type) { + H5_FAILED(); + HDputs(" Unexpected object type - should have been an external link"); + goto error; + } + if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR + if(HDstrcmp(file, filename1)) { + H5_FAILED(); + HDputs(" External link file name incorrect"); + goto error; + } + if(HDstrcmp(path, "/")) { + H5_FAILED(); + HDputs(" External link path incorrect"); + goto error; + } + + /* Close and re-open file to ensure that data is written to disk */ + if(H5Fclose(fid) < 0) TEST_ERROR + if((fid = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + + /* Open object through external link */ + if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/")) TEST_ERROR + + /* Create object in external file */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Close group in external file */ + if(H5Gclose(gid2) < 0) TEST_ERROR + + /* Close external object (lets first file close) */ + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Create a new object using H5Gcreate2 through the external link + * directly + */ + if((gid = H5Gcreate2(fid, "ext_link/newer_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Close file and group */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Check that all file IDs have been closed */ + if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR + H5F_sfile_assert_num(0); + + /* Open first file again with read-only access and check on objects created */ + if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + + /* Open objects created through external link */ + if((gid = H5Gopen2(fid, "new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((gid2 = H5Gopen2(fid, "newer_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Check names */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/new_group")) TEST_ERROR + if(H5Iget_name(gid2, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/newer_group")) TEST_ERROR + + /* Close opened objects */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid2) < 0) TEST_ERROR + + /* Close first file */ + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Check that all file IDs have been closed */ + if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR + H5F_sfile_assert_num(0); + + /* Verify that new objects can't be created through a read-only external + * link. + */ + if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + + H5E_BEGIN_TRY { + gid = H5Gcreate2(fid, "ext_link/readonly_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY + if(gid >= 0) TEST_ERROR + + /* Close second file again */ + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Check that all file IDs have been closed */ + if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR + H5F_sfile_assert_num(0); + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Gclose (gid2); + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return FAIL; +} /* end external_link_root_deprec() */ + +/*------------------------------------------------------------------------- + * Function: external_link_query_deprec + * + * Purpose: Query file & object names for external links, as well as + * information from H5Gget_obj_info + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +external_link_query_deprec(hid_t fapl, hbool_t new_format) +{ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + const char *file_name; /* Name of the file the external link points to */ + const char *object_name; /* Name of the object the external link points to */ + H5O_info1_t oi; /* Object information */ + H5L_info1_t li; /* Link information */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], /* Names of files to externally link across */ + query_buf[NAME_BUF_SIZE]; /* Buffer to hold query result */ + + if(new_format) + TESTING("query aspects of external link using deprecated routines (w/new group format)") + else + TESTING("query aspects of external link using deprecated routines") + + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); + + /* Create first file, with external link to object in second file */ + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create external link */ + /* (add a few extra '/'s to make certain library normalizes external link object names) */ + if(H5Lcreate_external(filename2, "///dst//", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Get size of buffer for external link */ + if(H5Lget_info1(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR + if (H5L_TYPE_EXTERNAL != li.type) { + H5_FAILED(); + HDputs(" Unexpected link class - should have been an external link"); + goto error; + } + + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Create second file to point to */ + if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create object to link to */ + if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Open first file */ + if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + + /* Get size of buffer for external link */ + if(H5Lget_info1(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR + if(H5L_TYPE_EXTERNAL != li.type) { + H5_FAILED(); + HDputs(" Unexpected link class - should have been an external link"); + goto error; + } + + /* Get information for external link. It should be two strings right after each other */ + if(H5Lget_val(fid, "src", query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + + /* Extract the file and object names from the buffer */ + if(H5Lunpack_elink_val(query_buf, li.u.val_size, NULL, &file_name, &object_name) < 0) TEST_ERROR + + /* Compare the file and object names */ + if(HDstrcmp(file_name, filename2)) TEST_ERROR + if(HDstrcmp(object_name, "/dst")) TEST_ERROR + + /* Query information about object that external link points to */ + if(H5Oget_info_by_name2(fid, "src", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5O_TYPE_GROUP != oi.type) { + H5_FAILED(); + HDputs(" Unexpected object type - should have been a group"); + goto error; + } + + /* Close first file */ + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Make sure that passing in NULLs to H5Lunpack_elink_val works */ + if(H5Lunpack_elink_val(query_buf, li.u.val_size, NULL, NULL, NULL) < 0) TEST_ERROR + + /* Make sure that bogus cases trigger errors in H5Lunpack_elink_val */ + H5E_BEGIN_TRY { + if(H5Lunpack_elink_val(query_buf, li.u.val_size - 1, NULL, NULL, NULL) >= 0) TEST_ERROR + } H5E_END_TRY + H5E_BEGIN_TRY { + if(H5Lunpack_elink_val(query_buf, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR + } H5E_END_TRY + H5E_BEGIN_TRY { + if(H5Lunpack_elink_val(NULL, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR + } H5E_END_TRY + H5E_BEGIN_TRY { + if(H5Lunpack_elink_val(NULL, (size_t)1000, NULL, NULL, NULL) >= 0) TEST_ERROR + } H5E_END_TRY + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Gclose(gid); + H5Fclose(fid); + } H5E_END_TRY; + return FAIL; +} /* end external_link_query_deprec() */ + +/*------------------------------------------------------------------------- + * Function: external_link_closing_deprec + * + * Purpose: Test that files are closed correctly when traversing + * external links. + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +external_link_closing_deprec(hid_t fapl, hbool_t new_format) +{ + hid_t fid1 = (-1), fid2 = (-1), fid3 = (-1), fid4=(-1); + hid_t gid=(-1), tid=(-1), tid2=(-1), sid=(-1), did=(-1); + hid_t lcpl_id=(-1); + hsize_t dims[2]; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + filename4[NAME_BUF_SIZE], /* Names of files to externally link across */ + buf[NAME_BUF_SIZE]; /* misc. buffer */ + H5L_info1_t li; + H5O_info1_t oi; + hobj_ref_t obj_ref; + + if(new_format) + TESTING("that external files are closed during traversal (w/new group format)") + else + TESTING("that external files are closed during traversal") + + /* In this test, external links will go from file1 to file2 and from + * file2 to file3. + * Test that all functions that can traverse external files close + * the files they open. + * Test that providing unusual paths containing external links can't + * make HDF5 forget to close a file it opened. + */ + + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); + h5_fixname(FILENAME[5], fapl, filename3, sizeof filename3); + h5_fixname(FILENAME[6], fapl, filename4, sizeof filename4); + + /* Create four files */ + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create a dataspace and a datatype so we can create/commit a dataset/datatype in the files */ + dims[0] = 2; + dims[1] = 2; + if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR + if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if((tid2 = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + + /* Create external links from each file to the next */ + if(H5Lcreate_external(filename2, "/", fid1, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename3, "/", fid2, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename4, "/", fid3, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Close all files but the first */ + if(H5Fclose(fid4) < 0) TEST_ERROR + if(H5Fclose(fid3) < 0) TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + + /* Test creating each kind of object */ + if((gid = H5Gcreate2(fid1, "elink/elink/elink/group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Tcommit2(fid1, "elink/elink/elink/type1", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if((did = H5Dcreate2(fid1, "elink/elink/elink/dataset1", tid2, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Close objects */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Tclose(tid) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR + + /* Test that getting info works */ + if(H5Lget_info1(fid1, "elink/elink/elink/type1", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info1(fid1, "elink/elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(fid1, "elink/elink/elink/type1", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(fid1, "elink/elink/elink", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + + /* Test move */ + if(H5Lmove(fid1, "elink/elink/elink/group1", fid1, + "elink/elink/elink/group1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Open file 4 so we can do some fancy things */ + if((fid4 = H5Fopen(filename4, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR + if(H5Lmove(fid1, "elink/elink/elink/type1", fid4, + "type1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lmove(fid4, "dataset1", fid1, + "elink/elink/elink/dataset1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Close file 4 again */ + if(H5Fclose(fid4) < 0) FAIL_STACK_ERROR + + /* Test copy (as of this test, it uses the same code as move) */ + if(H5Lcopy(fid1, "elink/elink/elink", fid1, + "elink/elink/elink_copied", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcopy(fid1, "elink/elink/elink", fid1, + "elink/elink/elink/elink_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Test H5Gset and get comment */ + if(H5Oset_comment_by_name(fid1, "elink/elink/elink/group1_moved", "comment", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_comment_by_name(fid1, "elink/elink/elink/group1_moved", buf, sizeof(buf), H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(HDstrcmp(buf, "comment")) TEST_ERROR + + /* Test H5*open */ + if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Close objects */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Tclose(tid) < 0) FAIL_STACK_ERROR + if(H5Dclose(did) < 0) FAIL_STACK_ERROR + + /* Test H5*open2 */ + if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Close objects */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Tclose(tid) < 0) FAIL_STACK_ERROR + if(H5Dclose(did) < 0) FAIL_STACK_ERROR + + /* Test H5Oopen */ + if((did = H5Oopen(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR + + /* Test H5Fmount */ + if((gid = H5Gcreate2(fid1, "elink/elink/elink/mnt", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + H5E_BEGIN_TRY { + if(H5Fmount(fid1, "elink/elink/elink/mnt", fid1, H5P_DEFAULT) >= 0) TEST_ERROR + if(H5Funmount(fid1, "elink/elink/elink/mnt") >= 0) TEST_ERROR + } H5E_END_TRY + + /* Test H5Rcreate */ + if(H5Rcreate(&obj_ref, fid1, "elink/elink/elink/type1_moved", H5R_OBJECT, (hid_t)(-1)) < 0) TEST_ERROR + + /* Test unlink */ + if(H5Ldelete(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT) < 0) TEST_ERROR + if(H5Ldelete(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT) < 0) TEST_ERROR + if(H5Ldelete(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT) < 0) TEST_ERROR + if(H5Ldelete(fid1, "elink/elink/elink_copied", H5P_DEFAULT) < 0) TEST_ERROR + if(H5Ldelete(fid1, "elink/elink/elink/elink_copied2", H5P_DEFAULT) < 0) TEST_ERROR + + /* We've tested that the various functions above don't leave files open. + * Now test that we can't confuse HDF5 by giving unusual paths with external links + */ + /* Create an external link that points to another external link */ + if((fid2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if(H5Lcreate_external(filename3, "/elink", fid2, "elink2", + H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + + /* Do an external link traversal that recursively calls another external link. */ + if((gid = H5Gcreate2(fid1, "elink/elink2/group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Create two more groups so that the last three elements in the path are + * all within the same external file + */ + if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3/group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Oget_info_by_name2(fid1, "elink/elink2/group2/group3/group4", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + + /* Add a few regular groups and a soft link in file2 using intermediate group creation */ + if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR + if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR + if(H5Lcreate_soft("/elink2", fid1, "elink/file2group1/file2group2/slink", + lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + + /* Try to traverse this path. There are three soft traversals in a row; + * slink points to (file2)/elink2, which points to (file3)/elink, which + * points to file 4. + */ + if((gid = H5Gcreate2(fid1, "elink/file2group1/file2group2/slink/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Lget_info1(fid1, "elink/file2group1/file2group2/slink/group3", &li, H5P_DEFAULT) < 0) TEST_ERROR + + /* Some simpler tests */ + if((gid = H5Gcreate2(fid1, "elink/file2group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Lget_info1(fid1, "elink/file2group3", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info1(fid1, "elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR + + + /* Close file1, the only file that should still be open */ + if(H5Fclose(fid1) < 0) TEST_ERROR + + /* Re-create each file. If they are hanging open, these creates will fail */ + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Cleanup */ + if(H5Sclose(sid) < 0) TEST_ERROR + if(H5Tclose(tid2) < 0) TEST_ERROR + if(H5Fclose(fid4) < 0) TEST_ERROR + if(H5Fclose(fid3) < 0) TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR + + PASSED(); + + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Gclose(gid); + H5Tclose(tid); + H5Dclose(did); + H5Sclose(sid); + H5Tclose(tid2); + H5Fclose(fid4); + H5Fclose(fid3); + H5Fclose(fid2); + H5Fclose(fid1); + } H5E_END_TRY; + return FAIL; +} /* external_link_closing_deprec() */ + +/* Callback functions for UD hard links. */ +/* UD_hard_create increments the object's reference count */ +static herr_t +UD_hard_create_deprec(const char H5_ATTR_UNUSED * link_name, hid_t loc_group, const void *udata, + size_t udata_size, hid_t H5_ATTR_UNUSED lcpl_id) +{ + haddr_t addr; + hid_t target_obj = -1; + herr_t ret_value = 0; + + if(udata_size != sizeof(haddr_t)) { + ret_value = -1; + goto done; + } /* end if */ + + addr = *((const haddr_t *)udata); + + /* Open the object this link points to */ + target_obj= H5Oopen_by_addr(loc_group, addr); + if(target_obj < 0) { + ret_value = -1; + goto done; + } /* end if */ + + /* Increment the reference count of the target object */ + if(H5Oincr_refcount(target_obj) < 0) { + ret_value = -1; + goto done; + } /* end if */ + +done: + /* Close the target object if we opened it */ + if(target_obj >= 0) { + switch(H5Iget_type(target_obj)) { + case H5I_GROUP: + if(H5Gclose(target_obj) < 0) + ret_value = -1; + break; + + case H5I_DATASET: + if(H5Dclose(target_obj) < 0) + ret_value = -1; + break; + + case H5I_DATATYPE: + if(H5Tclose(target_obj) < 0) + ret_value = -1; + break; + + case H5I_MAP: + /* TODO: Not supported in native file format yet */ + + case H5I_UNINIT: + case H5I_BADID: + case H5I_FILE: + case H5I_DATASPACE: + case H5I_ATTR: + case H5I_VFL: + case H5I_VOL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: + case H5I_NTYPES: + default: + return FAIL; + } /* end switch */ + } /* end if */ + + return ret_value; +} /* end UD_hard_create() */ + +/* Traverse a hard link by opening the object */ +static hid_t +UD_hard_traverse_deprec(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, + const void *udata, size_t udata_size, hid_t H5_ATTR_UNUSED lapl_id, + hid_t H5_ATTR_UNUSED dxpl_id) +{ + haddr_t addr; + hid_t ret_value = -1; + + if(udata_size != sizeof(haddr_t)) + return FAIL; + + addr = *((const haddr_t *) udata); + + ret_value = H5Oopen_by_addr(cur_group, addr); /* If this fails, our return value will be negative. */ + + return ret_value; +} /* end UD_hard_traverse() */ + +/* UD_hard_delete decrements the object's reference count */ +static herr_t +UD_hard_delete_deprec(const char H5_ATTR_UNUSED * link_name, hid_t file, const void *udata, + size_t udata_size) +{ + haddr_t addr; + hid_t target_obj = -1; + herr_t ret_value = 0; + + if(udata_size != sizeof(haddr_t)) { + ret_value = -1; + goto done; + } /* end if */ + + addr = *((const haddr_t *) udata); + + /* Open the object this link points to */ + target_obj= H5Oopen_by_addr(file, addr); + if(target_obj < 0) { + ret_value = -1; + goto done; + } /* end if */ + + /* Decrement the reference count of the target object */ + if(H5Odecr_refcount(target_obj) < 0) { + ret_value = -1; + goto done; + } /* end if */ + +done: + /* Close the target object if we opened it */ + if(target_obj >= 0) { + switch(H5Iget_type(target_obj)) { + case H5I_GROUP: + if(H5Gclose(target_obj) < 0) + ret_value = -1; + break; + + case H5I_DATASET: + if(H5Dclose(target_obj) < 0) + ret_value = -1; + break; + + case H5I_DATATYPE: + if(H5Tclose(target_obj) < 0) + ret_value = -1; + break; + + case H5I_MAP: + /* TODO: Not supported in native file format yet */ + + case H5I_UNINIT: + case H5I_BADID: + case H5I_FILE: + case H5I_DATASPACE: + case H5I_ATTR: + case H5I_VFL: + case H5I_VOL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: + case H5I_NTYPES: + default: + return FAIL; + } /* end switch */ + } /* end if */ + + return ret_value; +} /* end UD_hard_delete() */ + +static int +ud_hard_links_deprec(hid_t fapl) +{ + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + H5L_info1_t li; /* Link information */ + char objname[NAME_BUF_SIZE]; /* Object name */ + h5_stat_size_t empty_size; /* Size of an empty file */ + char filename[NAME_BUF_SIZE]; + + TESTING("user-defined hard link using deprecated routines (w/new group format)") + + /* Set up filename and create file*/ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Get the size of the empty file for reference */ + if(H5Fclose(fid) < 0) TEST_ERROR + if((empty_size = h5_get_file_size(filename, fapl))<0) TEST_ERROR + + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Check that external links are registered and UD hard links are not */ + if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR + + /* Register "user-defined hard links" with the library */ + if(H5Lregister(UD_hard_class_deprec) < 0) TEST_ERROR + + /* Check that UD hard links are now registered */ + if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR + + /* Create a group for the UD hard link to point to */ + if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Get address for the group to give to the hard link */ + if(H5Lget_info1(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR + + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Create a user-defined "hard link" to the group using the address we got + * from H5Lget_info1 */ + if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), (size_t)sizeof(haddr_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Close and re-open file to ensure that data is written to disk */ + if(H5Fclose(fid) < 0) TEST_ERROR + if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + + /* Open group through UD link */ + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/group")) TEST_ERROR + + /* Create object in group */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Close groups*/ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Re-open group without using ud link to check that it was created properly */ + if((gid = H5Gopen2(fid, "group/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/group/new_group")) TEST_ERROR + + /* Close opened object */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + + /* Check that H5Lget_objinfo works on the hard link */ + if(H5Lget_info1(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* UD hard links have no query function, thus return a "link length" of 0 */ + if(li.u.val_size != 0) TEST_ERROR + if(UD_HARD_TYPE != li.type) { + H5_FAILED(); + HDputs(" Unexpected link class - should have been a UD hard link"); + goto error; + } /* end if */ + + /* Unlink the group pointed to by the UD link. It shouldn't be + * deleted because of the UD link. */ + if(H5Ldelete(fid, "/group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Ensure we can open the group through the UD link */ + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Unlink the group contained within it. */ + if(H5Ldelete(gid, "new_group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + + /* Now delete the UD link. This should cause the group to be + * deleted, too. */ + if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Close file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + + /* The file should be empty again. */ + if(empty_size != h5_get_file_size(filename, fapl)) TEST_ERROR + + if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); + } H5E_END_TRY; + return FAIL; +} /* end ud_hard_links_deprec() */ + +static int +ud_link_reregister_deprec(hid_t fapl) +{ + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + H5L_info1_t li; /* Link information */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE]; + h5_stat_size_t empty_size; /* Size of an empty file */ + + TESTING("registering a new class for existing UD links using deprecated routines (w/new group format)") + + /* Set up filename and create file*/ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Get the size of the empty file for reference */ + if(H5Fclose(fid) < 0) TEST_ERROR + if((empty_size = h5_get_file_size(filename, fapl))<0) TEST_ERROR + + if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Check that UD hard links are not registered */ + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR + + /* Register "user-defined hard links" with the library */ + if(H5Lregister(UD_hard_class_deprec) < 0) TEST_ERROR + + /* Check that UD hard links are registered */ + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR + + /* Point a UD defined hard link to a group in the same way as the previous test */ + if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Lget_info1(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), + sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + + /* Create a group named REREG_TARGET_NAME in the same group as the ud link */ + if((gid = H5Gcreate2(fid, REREG_TARGET_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Now unregister UD hard links */ + if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) TEST_ERROR + + /* Check that UD hard links are no longer registered */ + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR + + /* Verify that we can't traverse the ud link anymore */ + H5E_BEGIN_TRY { + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) >= 0) TEST_ERROR + } H5E_END_TRY + + /* Verify that we can't create any new links of this type */ + H5E_BEGIN_TRY { + if(H5Lcreate_ud(fid, "ud_link2", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), + sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT) >= 0) + TEST_ERROR + } H5E_END_TRY + + /* Register a new kind of link with the same ID number */ + if(H5Lregister(UD_rereg_class) < 0) TEST_ERROR + + /* Check that UD hard links are registered again */ + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR + + /* Open a group through the ud link (now a different class of link). + * It should be a different group + * than the UD hard link pointed to */ + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/" REREG_TARGET_NAME)) TEST_ERROR + + /* Create object in group */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Close groups*/ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Re-open group without using ud link to check that it was created properly */ + if((gid = H5Gopen2(fid, "rereg_target/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/rereg_target/new_group")) TEST_ERROR + + /* Close opened object */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + + /* Unlink the group pointed to by the UD hard link. It shouldn't be + * deleted because the UD link incremented its reference count. */ + if(H5Ldelete(fid, "/group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* What a mess! Re-register user-defined links to clean up the + * reference counts. We shouldn't actually need to unregister the + * other link type */ + if(H5Lregister(UD_hard_class_deprec) < 0) FAIL_STACK_ERROR + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) FAIL_STACK_ERROR + + /* Ensure we can open the group through the UD link (now that UD hard + * links have been registered) */ + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + + /* Delete the UD hard link. This should cause the group to be + * deleted, too. */ + if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Unlink the other two groups so that we can make sure the file is empty */ + if(H5Ldelete(fid, "/rereg_target/new_group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, REREG_TARGET_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Close file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + + /* The file should be empty again. */ + if(empty_size != h5_get_file_size(filename, fapl)) TEST_ERROR + + if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) FAIL_STACK_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); + } H5E_END_TRY; + return FAIL; +} /* end ud_link_reregister_deprec() */ + +static int +ud_callbacks_deprec(hid_t fapl, hbool_t new_format) +{ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + hid_t lcpl = -1; /* Link Creation PL */ + H5L_info1_t li; /* Link information */ + char ud_target_name[] = UD_CB_TARGET; /* Link target name */ + char filename[NAME_BUF_SIZE]; + char query_buf[NAME_BUF_SIZE]; + + if(new_format) + TESTING("user-defined link callbacks using deprecated routines (w/new group format)") + else + TESTING("user-defined link callbacks using deprecated routines") + + /* Set up filename and create file*/ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + + if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Check that registered link classes are, and unregistered ones aren't */ + if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR + if(H5Lis_registered((H5L_type_t)UD_CB_TYPE) != FALSE) TEST_ERROR + + /* Hit two birds with one stone: register UD hard links from previous + * test to check that having two UD links registered at once presents + * no problems. */ + if(H5Lregister(UD_hard_class_deprec) < 0) TEST_ERROR + + /* Register user-defined link class. This is the one we'll actually be using. */ + if(H5Lregister(UD_cb_class) < 0) TEST_ERROR + + /* Check that registered link classes are, and unregistered ones aren't */ + if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR + if(H5Lis_registered((H5L_type_t)UD_CB_TYPE) != TRUE) TEST_ERROR + + /* Create a group for the UD link to point to */ + if((gid = H5Gcreate2(fid, UD_CB_TARGET, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Create a user-defined link to the group. These UD links behave like soft links. */ + if(H5Lcreate_ud(fid, UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Try opening group through UD link */ + if((gid = H5Gopen2(fid, UD_CB_LINK_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Query the link to test its query callback */ + if(H5Lget_info1(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.u.val_size != 16) TEST_ERROR + if (UD_CB_TYPE != li.type) { + H5_FAILED(); + HDputs(" Unexpected link class - should have been a UD hard link"); + goto error; + } + + /* Fill the query buffer */ + if(H5Lget_val(fid, UD_CB_LINK_NAME, query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(HDstrcmp(query_buf, "query succeeded") != 0) TEST_ERROR + + /* Move the link */ + if(H5Lmove(fid, UD_CB_LINK_NAME, H5L_SAME_LOC, NEW_UD_CB_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Re-open group to ensure that move worked */ + if((gid = H5Gopen2(fid, NEW_UD_CB_LINK_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + + /* Remove UD link */ + if(H5Ldelete(fid, NEW_UD_CB_LINK_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Test that the callbacks don't work if the link class is not registered */ + + /* Create a new link. Just for fun, give it a non-default character + * encoding (to test that LAPLs work) */ + if((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0) FAIL_STACK_ERROR + if(H5Pset_char_encoding(lcpl, H5T_CSET_UTF8) < 0) FAIL_STACK_ERROR + if(H5Lcreate_ud(fid, UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, lcpl, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Pclose(lcpl) < 0) FAIL_STACK_ERROR + + /* Check its character encoding */ + if(H5Lget_info1(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(li.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Unregister the link class so the library forgets what its callbacks do */ + if(H5Lunregister((H5L_type_t)UD_CB_TYPE) < 0) FAIL_STACK_ERROR + + /* Now test that each of the callbacks fails */ + H5E_BEGIN_TRY { + if(H5Lcreate_ud(fid, NEW_UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, H5P_DEFAULT, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR + if(H5Lmove(fid, UD_CB_LINK_NAME, H5L_SAME_LOC, NEW_UD_CB_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, UD_CB_LINK_NAME, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR + if((gid = H5Gopen2(gid, UD_CB_LINK_NAME, H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, UD_CB_LINK_NAME, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR + } H5E_END_TRY + + /* The query callback should NOT fail, but should be unable to give a linklen */ + if(H5Lget_info1(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(li.u.val_size != 0) TEST_ERROR + if(li.type != UD_CB_TYPE) TEST_ERROR + + /* Unregister the UD hard links */ + if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR + + /* Close file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Pclose (lcpl); + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return FAIL; +} /* end ud_callbacks_deprec() */ + +/*------------------------------------------------------------------------- + * Function: lapl_nlinks_deprec + * + * Purpose: Check that the maximum number of soft links can be adjusted + * by the user using the Link Access Property List. + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +lapl_nlinks_deprec(hid_t fapl, hbool_t new_format) +{ + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + hid_t plist = -1; /* lapl ID */ + hid_t tid = -1, sid = -1, did = -1; /* Other IDs */ + hid_t gapl = -1, dapl = -1, tapl = -1; /* Other property lists */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE]; + size_t nlinks; /* nlinks for H5Pset_nlinks */ + hsize_t dims[2]; + + if(new_format) + TESTING("adjusting nlinks with LAPL using deprecated routines (w/new group format)") + else + TESTING("adjusting nlinks with LAPL using deprecated routines") + + /* Make certain test is valid */ + /* XXX: should probably make a "generic" test that creates the proper + * # of links based on this value - QAK + */ + HDassert(H5L_NUM_LINKS == 16); + + /* Create file */ + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create group with short name in file (used as target for links) */ + if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Create chain of soft links to existing object (limited) */ + if(H5Lcreate_soft("final", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft1", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft2", fid, "soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft3", fid, "soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft4", fid, "soft5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft5", fid, "soft6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft6", fid, "soft7", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft7", fid, "soft8", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft8", fid, "soft9", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft9", fid, "soft10", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft10", fid, "soft11", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft11", fid, "soft12", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft12", fid, "soft13", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft13", fid, "soft14", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft14", fid, "soft15", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft15", fid, "soft16", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft16", fid, "soft17", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Close objects */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Open file */ + if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + + /* Create LAPL with higher-than-usual nlinks value */ + /* Create a non-default lapl with udata set to point to the first group */ + if((plist = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR + nlinks = 20; + if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR + + /* Ensure that nlinks was set successfully */ + nlinks = 0; + if(H5Pget_nlinks(plist, &nlinks) < 0) TEST_ERROR + if(nlinks != 20) TEST_ERROR + + /* Open object through what is normally too many soft links using + * new property list */ + if((gid = H5Oopen(fid, "soft17", plist)) < 0) TEST_ERROR + + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/soft17")) TEST_ERROR + + /* Create group using soft link */ + if((gid2 = H5Gcreate2(gid, "new_soft", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Close groups */ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Set nlinks to a smaller number */ + nlinks = 4; + if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR + + /* Ensure that nlinks was set successfully */ + nlinks = 0; + if(H5Pget_nlinks(plist, &nlinks) < 0) TEST_ERROR + if(nlinks != 4) TEST_ERROR + + /* Try opening through what is now too many soft links */ + H5E_BEGIN_TRY { + gid = H5Oopen(fid, "soft5", plist); + } H5E_END_TRY; + if (gid >= 0) { + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + goto error; + } + + /* Open object through lesser soft link */ + if((gid = H5Oopen(fid, "soft4", plist)) < 0) TEST_ERROR + + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/soft4")) TEST_ERROR + + /* Test other functions that should use a LAPL */ + nlinks = 20; + if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR + + /* Try copying and moving when both src and dst contain many soft links + * using a non-default LAPL + */ + if(H5Lcopy(fid, "soft17", fid, "soft17/newer_soft", H5P_DEFAULT, plist) < 0) TEST_ERROR + if(H5Lmove(fid, "soft17/newer_soft", fid, "soft17/newest_soft", H5P_DEFAULT, plist) < 0) TEST_ERROR + + /* H5Olink */ + if(H5Olink(gid, fid, "soft17/link_to_group", H5P_DEFAULT, plist) < 0) TEST_ERROR + + /* H5Lcreate_hard and H5Lcreate_soft */ + if(H5Lcreate_hard(fid, "soft17", fid, "soft17/link2_to_group", H5P_DEFAULT, plist) < 0) TEST_ERROR + if(H5Lcreate_soft("/soft4", fid, "soft17/soft_link", H5P_DEFAULT, plist) < 0) TEST_ERROR + + /* H5Ldelete */ + if(H5Ldelete(fid, "soft17/soft_link", plist) < 0) TEST_ERROR + + /* H5Lget_val and H5Lget_info1 */ + if(H5Lget_val(fid, "soft17", NULL, (size_t)0, plist) < 0) TEST_ERROR + if(H5Lget_info1(fid, "soft17", NULL, plist) < 0) TEST_ERROR + + /* H5Lcreate_external and H5Lcreate_ud */ + if(H5Lcreate_external("filename", "path", fid, "soft17/extlink", H5P_DEFAULT, plist) < 0) TEST_ERROR + if(H5Lregister(UD_rereg_class) < 0) TEST_ERROR + if(H5Lcreate_ud(fid, "soft17/udlink", (H5L_type_t)UD_HARD_TYPE, NULL, (size_t)0, H5P_DEFAULT, plist) < 0) TEST_ERROR + + /* Close plist */ + if(H5Pclose(plist) < 0) TEST_ERROR + + /* Create a datatype and dataset as targets inside the group */ + if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if(H5Tcommit2(gid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Tclose(tid) < 0) TEST_ERROR + + dims[0] = 2; + dims[1] = 2; + if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR + if((did = H5Dcreate2(gid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR + + /* Close group */ + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Try to open the objects using too many symlinks with default *APLs */ + H5E_BEGIN_TRY { + if((gid = H5Gopen2(fid, "soft17", H5P_DEFAULT)) >= 0) + FAIL_PUTS_ERROR(" Should have failed for too many nested links.") + if((tid = H5Topen2(fid, "soft17/datatype", H5P_DEFAULT)) >= 0) + FAIL_PUTS_ERROR(" Should have failed for too many nested links.") + if((did = H5Dopen2(fid, "soft17/dataset", H5P_DEFAULT)) >= 0) + FAIL_PUTS_ERROR(" Should have failed for too many nested links.") + } H5E_END_TRY + + /* Create property lists with nlinks set */ + if((gapl = H5Pcreate(H5P_GROUP_ACCESS)) < 0) TEST_ERROR + if((tapl = H5Pcreate(H5P_DATATYPE_ACCESS)) < 0) TEST_ERROR + if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) TEST_ERROR + + nlinks = 20; + if(H5Pset_nlinks(gapl, nlinks) < 0) TEST_ERROR + if(H5Pset_nlinks(tapl, nlinks) < 0) TEST_ERROR + if(H5Pset_nlinks(dapl, nlinks) < 0) TEST_ERROR + + /* We should now be able to use these property lists to open each kind + * of object. + */ + if((gid = H5Gopen2(fid, "soft17", gapl)) < 0) FAIL_STACK_ERROR + if((tid = H5Topen2(fid, "soft17/datatype", tapl)) < 0) TEST_ERROR + if((did = H5Dopen2(fid, "soft17/dataset", dapl)) < 0) TEST_ERROR + + /* Close objects */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Tclose(tid) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR + + /* Close plists */ + if(H5Pclose(gapl) < 0) TEST_ERROR + if(H5Pclose(tapl) < 0) TEST_ERROR + if(H5Pclose(dapl) < 0) TEST_ERROR + + /* Unregister UD hard link class */ + if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) TEST_ERROR + + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Pclose(gapl); + H5Pclose(dapl); + H5Pclose(tapl); + H5Dclose(did); + H5Sclose(sid); + H5Tclose(tid); + H5Gclose(gid2); + H5Gclose(gid); + H5Pclose(plist); + H5Fclose(fid); + } H5E_END_TRY; + return FAIL; +} /* end lapl_nlinks_deprec() */ + +/*------------------------------------------------------------------------- + * Function: linkinfo_deprec + * + * Purpose: Check that the link class is returned correctly when queried. + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +linkinfo_deprec(hid_t fapl, hbool_t new_format) +{ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + hid_t tid = -1; /* Type ID */ + hid_t sid = -1, did = -1; /* Dataspace and dataset IDs */ + H5L_info1_t li; /* Link information */ + char filename[NAME_BUF_SIZE]; + + if(new_format) + TESTING("link type field in H5Lget_info using deprecated routines (w/new group format)") + else + TESTING("link type field in H5Lget_info using deprecated routines") + + /* Set up filename and create file*/ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Register a couple of user-defined link classes with the library */ + if(H5Lregister(UD_plist_class) < 0) TEST_ERROR + + /* Create an object of each type */ + if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if(H5Tcommit2(fid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("group", fid, "softlink", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + if((sid = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR + if((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + + if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_PLIST_TYPE, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external("file_name", "obj_path", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Close all objects */ + if(H5Tclose(tid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR + + /* Make sure that link type is correct when objects are queried */ + if(H5Lget_info1(fid, "datatype", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.type != H5L_TYPE_HARD) TEST_ERROR + if(H5Lget_info1(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.type != H5L_TYPE_HARD) TEST_ERROR + if(H5Lget_info1(fid, "dataset", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.type != H5L_TYPE_HARD) TEST_ERROR + + if(H5Lget_info1(fid, "ext_link", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.type != H5L_TYPE_EXTERNAL) TEST_ERROR + if(H5Lget_info1(fid, "softlink", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.type != H5L_TYPE_SOFT) TEST_ERROR + if(H5Lget_info1(fid, "ud_link", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.type != UD_PLIST_TYPE) TEST_ERROR + + /* Ensure that passing a NULL pointer doesn't cause an error */ + if(H5Lget_info1(fid, "group", NULL, H5P_DEFAULT) < 0) TEST_ERROR + + if(H5Fclose(fid) < 0) TEST_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Tclose (tid); + H5Dclose (did); + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return FAIL; +} /* end linkinfo_deprec() */ + +/*------------------------------------------------------------------------- + * Function: corder_create_compact_deprec + * + * Purpose: Create a group with creation order indices and insert links + * in it when in compact form + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +corder_create_compact_deprec(hid_t fapl) +{ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ + hid_t gcpl_id = -1; /* Group creation property list ID */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + unsigned nlinks; /* Number of link messages in group's header */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE];/* File name */ + unsigned u; /* Local index variable */ + + TESTING("creating compact group with creation order indexing using deprecated routines") + + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create group creation property list */ + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR + + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR + + /* Create group with creation order indexing & tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Check on group's initial status */ + if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR + + /* Create several links, but keep group in compact form */ + for(u = 0; u < max_compact; u++) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + + /* Verify state of group */ + if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR + if(nlinks != (u + 1)) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + } /* end for */ + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + /* Re-open the file */ + if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + + /* Open group created */ + if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Verify state of group */ + if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR + if(nlinks != max_compact) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + + /* Loop through links, checking their creation order values */ + /* (the name index is used, but the creation order value is in the same order) */ + for(u = 0; u < max_compact; u++) { + H5L_info1_t linfo; /* Link information */ + + /* Retrieve information for link */ + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if(H5Lget_info1(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify creation order of link */ + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != u) TEST_ERROR + } /* end for */ + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Pclose(gcpl_id); + H5Gclose(group_id); + H5Fclose(file_id); + } H5E_END_TRY; + return FAIL; +} /* end corder_create_compact_deprec() */ + +/*------------------------------------------------------------------------- + * Function: corder_create_dense_deprec + * + * Purpose: Create a group with creation order indices and insert links + * in it until it's in dense form + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +corder_create_dense_deprec(hid_t fapl) +{ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ + hid_t gcpl_id = -1; /* Group creation property list ID */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + unsigned nlinks; /* Number of link messages in group's header */ + hsize_t name_count; /* # of records in name index */ + hsize_t corder_count; /* # of records in creation order index */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE];/* File name */ + unsigned u; /* Local index variable */ + + TESTING("creating dense group with creation order indexing using deprecated routines") + + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create group creation property list */ + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR + + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR + + /* Create group with creation order indexing & tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Check on group's initial status */ + if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR + + /* Create several links, up to limit of compact form */ + for(u = 0; u < max_compact; u++) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + + /* Verify state of group */ + if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR + if(nlinks != (u + 1)) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + } /* end for */ + + /* Create another link, to push group into dense form */ + HDsnprintf(objname, sizeof(objname), "filler %u", max_compact); + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + + /* Verify state of group */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + + /* Retrieve & verify # of records in the name & creation order indices */ + if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR + if(name_count != corder_count) TEST_ERROR + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + /* Re-open the file */ + if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + + /* Open group created */ + if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Verify state of group */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + + /* Loop through links, checking their creation order values */ + /* (the name index is used, but the creation order value is in the same order) */ + for(u = 0; u < (max_compact + 1); u++) { + H5L_info1_t linfo; /* Link information */ + + /* Retrieve information for link */ + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if(H5Lget_info1(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify creation order of link */ + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != u) TEST_ERROR + } /* end for */ + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Pclose(gcpl_id); + H5Gclose(group_id); + H5Fclose(file_id); + } H5E_END_TRY; + return FAIL; +} /* end corder_create_dense_deprec() */ + +/*------------------------------------------------------------------------- + * Function: link_info_by_idx_check_deprec + * + * Purpose: Support routine for link_info_by_idx, to verify the link + * info is correct for a link + * + * Note: This routine assumes that the links have been inserted in the + * group in alphabetical order. + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +link_info_by_idx_check_deprec(hid_t group_id, const char *linkname, hsize_t n, + hbool_t hard_link, hbool_t use_index) +{ + char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ + char valname[NAME_BUF_SIZE]; /* Link value name */ + char tmpval[NAME_BUF_SIZE]; /* Temporary link value */ + H5L_info1_t linfo; /* Link info struct */ + + /* Make link value for increasing/native order queries */ + HDsnprintf(valname, sizeof(valname), "value %02u", (unsigned)n); + + /* Verify the link information for first link, in increasing creation order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != 0) TEST_ERROR + + /* Verify the link information for new link, in increasing creation order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != (int64_t)n) TEST_ERROR + + /* Verify value for new soft link, in increasing creation order */ + if(!hard_link) { + HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end if */ + + /* Verify the name for new link, in increasing creation order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(linkname, tmpname)) TEST_ERROR + + /* Don't test "native" order if there is no creation order index, since + * there's not a good way to easily predict the link's order in the name + * index. + */ + if(use_index) { + /* Verify the link information for first link, in native creation order (which is increasing) */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != 0) TEST_ERROR + + /* Verify the link information for new link, in native creation order (which is increasing) */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != (int64_t)n) TEST_ERROR + + /* Verify value for new soft link, in native creation order (which is increasing) */ + if(!hard_link) { + HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end if */ + + /* Verify the name for new link, in native creation order (which is increasing) */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(linkname, tmpname)) TEST_ERROR + } /* end if */ + + /* Verify the link information for first link, in decreasing creation order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != 0) TEST_ERROR + + /* Verify the link information for new link, in decreasing creation order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != (int64_t)n) TEST_ERROR + + /* Verify value for new soft link, in decreasing creation order */ + if(!hard_link) { + HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end if */ + + /* Verify the name for new link, in decreasing creation order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(linkname, tmpname)) TEST_ERROR + + + /* Verify the link information for first link, in increasing link name order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != 0) TEST_ERROR + + /* Verify the link information for new link, in increasing link name order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != (int64_t)n) TEST_ERROR + + /* Verify value for new soft link, in increasing link name order */ + if(!hard_link) { + HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end if */ + + /* Verify the name for new link, in increasing link name order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(linkname, tmpname)) TEST_ERROR + + /* Don't test "native" order queries on link name order, since there's not + * a good way to easily predict the order of the links in the name index. + */ + + /* Verify the link information for first link, in decreasing link name order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != 0) TEST_ERROR + + /* Verify the link information for new link, in decreasing link name order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != (int64_t)n) TEST_ERROR + + /* Verify value for new soft link, in decreasing link name order */ + if(!hard_link) { + HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end if */ + + /* Verify the name for new link, in decreasing link name order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(linkname, tmpname)) TEST_ERROR + + /* Success */ + return(0); + +error: + /* Failure */ + return(-1); +} /* end link_info_by_idx_check_deprec() */ + +/*------------------------------------------------------------------------- + * Function: link_info_by_idx_deprec + * + * Purpose: Create a group with creation order indices and test querying + * info by index. + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +link_info_by_idx_deprec(hid_t fapl) +{ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + hid_t gcpl_id = -1; /* Group creation property list ID */ + unsigned hard_link; /* Create hard or soft link? */ + unsigned use_index; /* Use index on creation order values */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + H5L_info1_t linfo; /* Link info struct */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char valname[NAME_BUF_SIZE]; /* Link value name */ + 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 */ + for(hard_link = FALSE; hard_link <= TRUE; hard_link++) { + /* Loop over using index for creation order value */ + for(use_index = FALSE; use_index <= TRUE; use_index++) { + if(hard_link) { + if(use_index) + TESTING("querying info by index w/creation order index, using hard links and deprecated routines") + else + TESTING("querying info by index w/o creation order index, using hard links and deprecated routines") + } /* end if */ + else { + if(use_index) + TESTING("querying info by index w/creation order index, using soft links and deprecated routines") + else + TESTING("querying info by index w/o creation order index, using soft links and deprecated routines") + } /* end else */ + + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create group creation property list */ + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR + + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR + + /* Create group with creation order indexing & tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR + + /* Check for query on empty group */ + H5E_BEGIN_TRY { + ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + H5E_BEGIN_TRY { + 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(name_len >= 0) TEST_ERROR + + /* Create several links, up to limit of compact form */ + for(u = 0; u < max_compact; u++) { + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Check for creating hard or soft link */ + if(hard_link) { + hid_t group_id2; /* Group ID */ + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end if */ + else { + /* Make value for link */ + HDsnprintf(valname, sizeof(valname), "value %02u", u); + + /* Create soft link */ + if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + } /* end else */ + + /* Verify link information for new link */ + if(link_info_by_idx_check_deprec(group_id, objname, (hsize_t)u, hard_link, use_index) < 0) TEST_ERROR + } /* end for */ + + /* Verify state of group */ + if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR + + /* Check for out of bound offset queries */ + H5E_BEGIN_TRY { + ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + H5E_BEGIN_TRY { + ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + H5E_BEGIN_TRY { + 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(name_len >= 0) TEST_ERROR + + /* Create more links, to push group into dense form */ + for(; u < (max_compact * 2); u++) { + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Check for creating hard or soft link */ + if(hard_link) { + hid_t group_id2; /* Group ID */ + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end if */ + else { + /* Make value for link */ + HDsnprintf(valname, sizeof(valname), "value %02u", u); + + /* Create soft link */ + if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + } /* end else */ + + /* Verify state of group */ + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + + /* Verify link information for new link */ + if(link_info_by_idx_check_deprec(group_id, objname, (hsize_t)u, hard_link, use_index) < 0) TEST_ERROR + } /* end for */ + + /* Check for out of bound offset queries */ + H5E_BEGIN_TRY { + ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + H5E_BEGIN_TRY { + ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + H5E_BEGIN_TRY { + 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(name_len >= 0) TEST_ERROR + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); + } /* end for */ + } /* end for */ + + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Pclose(gcpl_id); + H5Gclose(group_id); + H5Fclose(file_id); + } H5E_END_TRY; + return FAIL; +} /* end link_info_by_idx_deprec() */ + +/*------------------------------------------------------------------------- + * Function: link_info_by_idx_old_deprec + * + * Purpose: Create a old-format group and test querying + * info by index. + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +link_info_by_idx_old_deprec(hid_t fapl) +{ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ + unsigned hard_link; /* Create hard or soft link? */ + H5L_info1_t linfo; /* Link info struct */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char valname[NAME_BUF_SIZE]; /* Link value name */ + char filename[NAME_BUF_SIZE];/* File name */ + haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ + 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 */ + for(hard_link = FALSE; hard_link <= TRUE; hard_link++) { + if(hard_link) + TESTING("querying info by index in old-style group, using hard links and deprecated routines") + else + TESTING("querying info by index in old-style group, using soft links and deprecated routines") + + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create group to operate on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Create several links */ + for(u = 0; u < CORDER_NLINKS; u++) { + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Check for creating hard or soft link */ + if(hard_link) { + H5O_info1_t oi; /* Buffer for querying object's info */ + + /* Create group */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Retrieve group's address on disk */ + if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oi.addr; + + /* Close group */ + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end if */ + else { + /* Make value for link */ + HDsnprintf(valname, sizeof(valname), "value %02u", u); + + /* Create soft link */ + if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + } /* end else */ + } /* end for */ + + /* Verify link information for created links */ + for(u = 0; u < CORDER_NLINKS; u++) { + unsigned dec_u = CORDER_NLINKS - (u + 1); /* Decreasing mapped index */ + + /* Make link name for increasing/native order queries */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Make link value for increasing/native order queries */ + HDsnprintf(valname, sizeof(valname), "value %02u", u); + + /* Verify link information (in increasing order) */ + if(hard_link) { + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5F_addr_ne(linfo.u.address, objno[u])) TEST_ERROR + } /* end if */ + else { + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end else */ + + /* Verify link name (in increasing order) */ + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(objname, tmpname)) TEST_ERROR + + + /* Verify link information (in native order - native is increasing) */ + if(hard_link) { + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5F_addr_ne(linfo.u.address, objno[u])) TEST_ERROR + } /* end if */ + else { + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end else */ + + /* Verify link name (in native order - native is increasing) */ + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(objname, tmpname)) TEST_ERROR + + + /* Make link name for decreasing order queries */ + HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); + + /* Make link value for decreasing order queries */ + HDsnprintf(valname, sizeof(valname), "value %02u", dec_u); + + /* Verify link information (in decreasing order) */ + if(hard_link) { + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + } /* end if */ + else { + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end else */ + + /* Verify link name (in decreasing order) */ + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Check for creation order index queries */ + H5E_BEGIN_TRY { + ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + H5E_BEGIN_TRY { + 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(name_len >= 0) TEST_ERROR + + /* Verify state of group */ + if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); + } /* end for */ + + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Gclose(group_id); + H5Fclose(file_id); + } H5E_END_TRY; + return FAIL; +} /* end link_info_by_idx_old_deprec() */ + +/*------------------------------------------------------------------------- + * Function: delete_by_idx_deprec + * + * Purpose: Create a group with creation order indices and test deleting + * links by index. + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +delete_by_idx_deprec(hid_t fapl) +{ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + hid_t gcpl_id = -1; /* Group creation property list ID */ + H5_index_t idx_type; /* Type of index to operate on */ + H5_iter_order_t order; /* Order within in the index */ + unsigned use_index; /* Use index on creation order values */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + H5L_info1_t linfo; /* Link info struct */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE];/* File name */ + char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ + + /* Loop over operating on different indices on link fields */ + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) { + /* Loop over operating in different orders */ + for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) { + /* Loop over using index for creation order value */ + for(use_index = FALSE; use_index <= TRUE; use_index++) { + /* Print appropriate test message */ + if(idx_type == H5_INDEX_CRT_ORDER) { + if(order == H5_ITER_INC) { + if(use_index) + TESTING("deleting links by creation order index in increasing order w/creation order index using deprecated routines") + else + TESTING("deleting links by creation order index in increasing order w/o creation order index using deprecated routines") + } /* end if */ + else { + if(use_index) + TESTING("deleting links by creation order index in decreasing order w/creation order index using deprecated routines") + else + TESTING("deleting links by creation order index in decreasing order w/o creation order index using deprecated routines") + } /* end else */ + } /* end if */ + else { + if(order == H5_ITER_INC) { + if(use_index) + TESTING("deleting links by name index in increasing order w/creation order index using deprecated routines") + else + TESTING("deleting links by name index in increasing order w/o creation order index using deprecated routines") + } /* end if */ + else { + if(use_index) + TESTING("deleting links by name index in decreasing order w/creation order index using deprecated routines") + else + TESTING("deleting links by name index in decreasing order w/o creation order index using deprecated routines") + } /* end else */ + } /* end else */ + + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create group creation property list */ + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR + + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR + + /* Create group with creation order tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR + + /* Delete links from one end */ + + /* Check for deletion on empty group */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Check for deletion on non-existing group */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, "None", idx_type, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Create several links, up to limit of compact form */ + for(u = 0; u < max_compact; u++) { + hid_t group_id2; /* Group ID */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + + /* Verify link information for new link */ + if(link_info_by_idx_check_deprec(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR + } /* end for */ + + /* Verify state of group (compact) */ + if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR + + /* Check for out of bound deletion */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Delete links from compact group */ + for(u = 0; u < (max_compact - 1); u++) { + /* Delete first link in appropriate order */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for first link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(linfo.corder != (u + 1)) TEST_ERROR + } /* end if */ + else { + if(linfo.corder != (max_compact - (u + 2))) TEST_ERROR + } /* end else */ + + /* Verify the name for first link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", (max_compact - (u + 2))); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Delete last link */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify state of group (empty) */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + + /* Create more links, to push group into dense form */ + for(u = 0; u < (max_compact * 2); u++) { + hid_t group_id2; /* Group ID */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + + /* Verify state of group (dense) */ + if(u >= max_compact) + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + + /* Verify link information for new link */ + if(link_info_by_idx_check_deprec(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR + } /* end for */ + + /* Check for out of bound deletion again */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Delete links from dense group, in appropriate order */ + for(u = 0; u < ((max_compact * 2) - 1); u++) { + /* Delete first link in appropriate order */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for first link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(linfo.corder != (u + 1)) TEST_ERROR + } /* end if */ + else { + if(linfo.corder != ((max_compact * 2) - (u + 2))) TEST_ERROR + } /* end else */ + + /* Verify the name for first link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - (u + 2))); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Delete last link */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify state of group (empty) */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + + /* Check for deletion on empty group again */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Delete links in middle */ + + /* Create more links, to push group into dense form */ + for(u = 0; u < (max_compact * 2); u++) { + hid_t group_id2; /* Group ID */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + + /* Verify state of group (dense) */ + if(u >= max_compact) + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + + /* Verify link information for new link */ + if(link_info_by_idx_check_deprec(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR + } /* end for */ + + /* Delete every other link from dense group, in appropriate order */ + for(u = 0; u < max_compact; u++) { + /* Delete link */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for current link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", idx_type, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(linfo.corder != ((u * 2) + 1)) TEST_ERROR + } /* end if */ + else { + if(linfo.corder != ((max_compact * 2) - ((u * 2) + 2))) TEST_ERROR + } /* end else */ + + /* Verify the name for current link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 1)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - ((u * 2) + 2))); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Delete remaining links from dense group, in appropriate order */ + for(u = 0; u < (max_compact - 1); u++) { + /* Delete link */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for first link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(linfo.corder != ((u * 2) + 3)) TEST_ERROR + } /* end if */ + else { + if(linfo.corder != ((max_compact * 2) - ((u * 2) + 4))) TEST_ERROR + } /* end else */ + + /* Verify the name for first link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 3)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - ((u * 2) + 4))); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Delete last link */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify state of group (empty) */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); + } /* end for */ + } /* end for */ + } /* end for */ + + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Pclose(gcpl_id); + H5Gclose(group_id); + H5Fclose(file_id); + } H5E_END_TRY; + return FAIL; +} /* end delete_by_idx_deprec() */ + +/*------------------------------------------------------------------------- + * Function: delete_by_idx_old_deprec + * + * Purpose: Create a old-format group and test deleting + * links by index. + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +delete_by_idx_old_deprec(hid_t fapl) +{ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ + H5L_info1_t linfo; /* Link info struct */ + H5_iter_order_t order; /* Order within in the index */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE];/* File name */ + haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ + char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ + + /* Loop over operating in different orders */ + for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) { + /* Print test banner */ + if(order == H5_ITER_INC) + TESTING("deleting links by index in increasing order in old-style group using deprecated routines") + else + TESTING("deleting links by index in decreasing order in old-style group using deprecated routines") + + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create group to operate on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Delete links from one end */ + + /* Check for deletion in empty group */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Create several links */ + for(u = 0; u < CORDER_NLINKS; u++) { + H5O_info1_t oi; /* Buffer for querying object's info */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Create group */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Retrieve group's address on disk */ + if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oi.addr; + + /* Close group */ + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end for */ + + /* Check for bad index type deletion */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Check for out of bounds deletion */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Delete links, in appropriate order */ + for(u = 0; u < (CORDER_NLINKS - 1); u++) { + unsigned dec_u = CORDER_NLINKS - (u + 2); /* Decreasing mapped index */ + + /* Delete first link in appropriate order */ + if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for first link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(H5F_addr_ne(linfo.u.address, objno[u + 1])) TEST_ERROR + } /* end if */ + else { + if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + } /* end else */ + + /* Verify the name for first link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Delete last link */ + if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Check for deletion in empty group (again) */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Verify state of group */ + if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR + + /* Delete links in middle */ + + /* Create several links */ + for(u = 0; u < CORDER_NLINKS; u++) { + H5O_info1_t oi; /* Buffer for querying object's info */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Create group */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Retrieve group's address on disk */ + if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oi.addr; + + /* Close group */ + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end for */ + + /* Delete every other link from group, in appropriate order */ + for(u = 0; u < (CORDER_NLINKS / 2); u++) { + unsigned dec_u = CORDER_NLINKS - ((u * 2) + 2); /* Decreasing mapped index */ + + /* Delete link */ + if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for current link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(H5F_addr_ne(linfo.u.address, objno[(u * 2) + 1])) TEST_ERROR + } /* end if */ + else { + if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + } /* end else */ + + /* Verify the name for current link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 1)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Delete remaining links from group, in appropriate order */ + for(u = 0; u < ((CORDER_NLINKS / 2) - 1); u++) { + unsigned dec_u = CORDER_NLINKS - ((u * 2) + 4); /* Decreasing mapped index */ + + /* Delete link */ + if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for first link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(H5F_addr_ne(linfo.u.address, objno[(u * 2) + 3])) TEST_ERROR + } /* end if */ + else { + if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + } /* end else */ + + /* Verify the name for first link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 3)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Delete last link */ + if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify state of group */ + if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); + } /* end for */ + + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Gclose(group_id); + H5Fclose(file_id); + } H5E_END_TRY; + + return FAIL; +} /* end delete_by_idx_old_deprec() */ + +/*------------------------------------------------------------------------- + * Function: link_iterate_deprec_cb + * + * Purpose: Callback routine for iterating over links in group + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +link_iterate_deprec_cb(hid_t group_id, const char *link_name, const H5L_info1_t *info, + void *_op_data) +{ + link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */ + char objname[NAME_BUF_SIZE]; /* Object name */ + H5L_info1_t my_info; /* Local link info */ + + /* Increment # of times the callback was called */ + op_data->ncalled++; + + /* Get the link information directly to compare */ + if(H5Lget_info1(group_id, link_name, &my_info, H5P_DEFAULT) < 0) + return H5_ITER_ERROR; + + /* Check more things for link iteration (vs. group iteration) */ + if(info) { + /* Check for correct order of iteration */ + /* (if we are operating in increasing or decreasing order) */ + if(op_data->order != H5_ITER_NATIVE) + if(info->corder != op_data->curr) + return H5_ITER_ERROR; + + /* Compare link info structs */ + if(info->type != my_info.type) + return H5_ITER_ERROR; + if(info->corder_valid != my_info.corder_valid) + return H5_ITER_ERROR; + if(info->corder != my_info.corder) + return H5_ITER_ERROR; + if(info->cset != my_info.cset) + return H5_ITER_ERROR; + if(H5F_addr_ne(info->u.address, my_info.u.address)) + return H5_ITER_ERROR; + } /* end if */ + + /* Verify name of link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", (unsigned)my_info.corder); + if(HDstrcmp(link_name, objname)) + return H5_ITER_ERROR; + + /* Check if we've visited this link before */ + if((size_t)op_data->curr >= op_data->max_visit) + return H5_ITER_ERROR; + if(op_data->visited[op_data->curr]) + return H5_ITER_ERROR; + op_data->visited[op_data->curr] = TRUE; + + /* Advance to next value, in correct direction */ + if(op_data->order != H5_ITER_DEC) + op_data->curr++; + else + op_data->curr--; + + /* Check for stopping in the middle of iterating */ + if(op_data->stop > 0) + if(--op_data->stop == 0) + return CORDER_ITER_STOP; + + return H5_ITER_CONT; +} /* end link_iterate_deprec_cb() */ + +/*------------------------------------------------------------------------- + * Function: group_iterate_deprec_cb + * + * Purpose: Callback routine for iterating over links in group with + * H5Giterate() + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +group_iterate_deprec_cb(hid_t group_id, const char *link_name, void *_op_data) +{ + return link_iterate_deprec_cb(group_id, link_name, NULL, _op_data); +} /* end group_iterate_deprec_cb() */ + +/*------------------------------------------------------------------------- + * Function: link_iterate_fail_deprec_cb + * + * Purpose: Callback routine for iterating over links in group that + * always returns failure + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +link_iterate_fail_deprec_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *link_name, + const H5L_info1_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data) +{ + return H5_ITER_ERROR; +} /* end link_iterate_fail_deprec_cb() */ + +/*------------------------------------------------------------------------- + * Function: link_iterate_check_deprec + * + * Purpose: Check iteration over links in a group + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +link_iterate_check_deprec(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, + unsigned max_links, link_iter_info_t *iter_info) +{ + unsigned v; /* Local index variable */ + hsize_t skip; /* # of links to skip in group */ + int gskip; /* # of links to skip in group, with H5Giterate */ + herr_t ret; /* Generic return value */ + + /* Iterate over links in group */ + 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_links - 1); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if(H5Literate1(group_id, idx_type, order, &skip, link_iterate_deprec_cb, iter_info) < 0) TEST_ERROR + + /* Verify that we visited all the links */ + if(skip != max_links) TEST_ERROR + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + + /* Iterate over links in group, with H5Giterate */ + iter_info->nskipped = (unsigned)(gskip = 0); + iter_info->order = order; + iter_info->stop = -1; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if(H5Giterate(group_id, ".", &gskip, group_iterate_deprec_cb, iter_info) < 0) TEST_ERROR + + /* Verify that we visited all the links */ + if(gskip != (int)max_links) TEST_ERROR + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + + /* Skip over some links in group */ + iter_info->nskipped = (unsigned)(skip = max_links / 2); + iter_info->order = order; + iter_info->stop = -1; + iter_info->ncalled = 0; + 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(H5Literate1(group_id, idx_type, order, &skip, link_iterate_deprec_cb, iter_info) < 0) TEST_ERROR + + /* Verify that we visited all the links */ + if(skip != max_links) TEST_ERROR + if(order == H5_ITER_INC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR + } /* end if */ + else if(order == H5_ITER_DEC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + } /* end if */ + else { + unsigned nvisit = 0; /* # of links visited */ + + HDassert(order == H5_ITER_NATIVE); + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == TRUE) + nvisit++; + + if(nvisit != (max_links / 2)) TEST_ERROR + } /* end else */ + + /* Skip over some links in group, with H5Giterate */ + 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) - (unsigned)gskip); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if(H5Giterate(group_id, ".", &gskip, group_iterate_deprec_cb, iter_info) < 0) TEST_ERROR + + /* Verify that we visited all the links */ + if(gskip != (int)max_links) TEST_ERROR + if(order == H5_ITER_INC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR + } /* end if */ + else if(order == H5_ITER_DEC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + } /* end if */ + else { + unsigned nvisit = 0; /* # of links visited */ + + HDassert(order == H5_ITER_NATIVE); + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == TRUE) + nvisit++; + + if(nvisit != (max_links / 2)) TEST_ERROR + } /* end else */ + + /* Iterate over links in group, 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_links - 1); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if((ret = H5Literate1(group_id, idx_type, order, &skip, link_iterate_deprec_cb, iter_info)) < 0) TEST_ERROR + if(ret != CORDER_ITER_STOP) TEST_ERROR + if(iter_info->ncalled != 3) TEST_ERROR + + /* Iterate over links in group, stopping in the middle, with H5Giterate() */ + iter_info->nskipped = (unsigned)(gskip = 0); + iter_info->order = order; + iter_info->stop = 3; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if((ret = H5Giterate(group_id, ".", &gskip, group_iterate_deprec_cb, iter_info)) < 0) TEST_ERROR + if(ret != CORDER_ITER_STOP) TEST_ERROR + if(iter_info->ncalled != 3) TEST_ERROR + + /* Check for iteration routine indicating failure */ + skip = 0; + H5E_BEGIN_TRY { + ret = H5Literate1(group_id, idx_type, order, &skip, link_iterate_fail_deprec_cb, NULL); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Success */ + return SUCCEED; + +error: + return FAIL; +} /* end link_iterate_check_deprec() */ + +/*------------------------------------------------------------------------- + * Function: link_iterate_deprec + * + * Purpose: Create a group with creation order indices and test iterating over + * links by index. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Quincey Koziol + * Tuesday, November 14, 2006 + * + *------------------------------------------------------------------------- + */ +static int +link_iterate_deprec(hid_t fapl) +{ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ + H5_index_t idx_type; /* Type of index to operate on */ + H5_iter_order_t order; /* Order within in the index */ + unsigned use_index; /* Use index on creation order values */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE];/* File name */ + link_iter_info_t iter_info; /* Iterator info */ + hbool_t *visited = NULL; /* Array of flags for visiting links */ + hsize_t skip; /* # of links to skip in group */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ + + /* Create group creation property list */ + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR + + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR + + /* Allocate the "visited link" array */ + iter_info.max_visit = max_compact * 2; + if(NULL == (visited = (hbool_t *)HDmalloc(sizeof(hbool_t) * iter_info.max_visit))) TEST_ERROR + iter_info.visited = visited; + + /* Loop over operating on different indices on link fields */ + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) { + /* Loop over operating in different orders */ + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) { + /* Loop over using index for creation order value */ + for(use_index = FALSE; use_index <= TRUE; use_index++) { + /* Print appropriate test message */ + if(idx_type == H5_INDEX_CRT_ORDER) { + if(order == H5_ITER_INC) { + if(use_index) + TESTING("iterating over links by creation order index in increasing order w/creation order index using deprecated routines") + else + TESTING("iterating over links by creation order index in increasing order w/o creation order index using deprecated routines") + } /* end if */ + else if(order == H5_ITER_DEC) { + if(use_index) + TESTING("iterating over links by creation order index in decreasing order w/creation order index using deprecated routines") + else + TESTING("iterating over links by creation order index in decreasing order w/o creation order index using deprecated routines") + } /* end else */ + else { + HDassert(order == H5_ITER_NATIVE); + if(use_index) + TESTING("iterating over links by creation order index in native order w/creation order index using deprecated routines") + else + TESTING("iterating over links by creation order index in native order w/o creation order index using deprecated routines") + } /* end else */ + } /* end if */ + else { + if(order == H5_ITER_INC) { + if(use_index) + TESTING("iterating over links by name index in increasing order w/creation order index using deprecated routines") + else + TESTING("iterating over links by name index in increasing order w/o creation order index using deprecated routines") + } /* end if */ + else if(order == H5_ITER_DEC) { + if(use_index) + TESTING("iterating over links by name index in decreasing order w/creation order index using deprecated routines") + else + TESTING("iterating over links by name index in decreasing order w/o creation order index using deprecated routines") + } /* end else */ + else { + HDassert(order == H5_ITER_NATIVE); + if(use_index) + TESTING("iterating over links by name index in native order w/creation order index using deprecated routines") + else + TESTING("iterating over links by name index in native order w/o creation order index using deprecated routines") + } /* end else */ + } /* end else */ + + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR + + /* Create group with creation order tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Check for iteration on empty group */ + /* (should be OK) */ + if(H5Literate1(group_id, idx_type, order, NULL, link_iterate_deprec_cb, NULL) < 0) TEST_ERROR + + /* Create several links, up to limit of compact form */ + for(u = 0; u < max_compact; u++) { + hid_t group_id2; /* Group ID */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end for */ + + /* Verify state of group (compact) */ + if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR + + /* Check for out of bound iteration on compact group */ + skip = (hsize_t)u; + H5E_BEGIN_TRY { + ret = H5Literate1(group_id, idx_type, order, &skip, link_iterate_deprec_cb, NULL); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Test iteration over links in compact group */ + if(link_iterate_check_deprec(group_id, idx_type, order, u, &iter_info) < 0) TEST_ERROR + + /* Create more links, to push group into dense form */ + for(; u < (max_compact * 2); u++) { + hid_t group_id2; /* Group ID */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end for */ + + /* Verify state of group (dense) */ + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + + /* Check for out of bound iteration on dense group */ + skip = (hsize_t)u; + H5E_BEGIN_TRY { + ret = H5Literate1(group_id, idx_type, order, &skip, link_iterate_deprec_cb, NULL); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Test iteration over links in dense group */ + if(link_iterate_check_deprec(group_id, idx_type, order, u, &iter_info) < 0) TEST_ERROR + + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); + } /* end for */ + } /* end for */ + } /* end for */ + + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR + + /* Free resources */ + if(visited) + HDfree(visited); + + return SUCCEED; + +error: + /* Free resources */ + H5E_BEGIN_TRY { + H5Pclose(gcpl_id); + H5Gclose(group_id); + H5Fclose(file_id); + } H5E_END_TRY; + + if(visited) + HDfree(visited); + + return FAIL; +} /* end link_iterate_deprec() */ + +/*------------------------------------------------------------------------- + * Function: link_iterate_old_deprec_cb + * + * Purpose: Callback routine for iterating over [old] links in group + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +link_iterate_old_deprec_cb(hid_t group_id, const char *link_name, const H5L_info1_t *info, void *_op_data) +{ + link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */ + char objname[NAME_BUF_SIZE]; /* Object name */ + H5L_info1_t my_info; /* Local link info */ + + /* Increment # of times the callback was called */ + op_data->ncalled++; + + /* Get the link information directly to compare */ + if(H5Lget_info1(group_id, link_name, &my_info, H5P_DEFAULT) < 0) + return H5_ITER_ERROR; + + /* Check more things for link iteration (vs. group iteration) */ + if(info) { + /* Compare link info structs */ + if(info->type != my_info.type) + return H5_ITER_ERROR; + if(info->corder_valid != my_info.corder_valid) + return H5_ITER_ERROR; + if(info->corder != my_info.corder) + return H5_ITER_ERROR; + if(info->cset != my_info.cset) + return H5_ITER_ERROR; + if(H5F_addr_ne(info->u.address, my_info.u.address)) + return H5_ITER_ERROR; + } /* end if */ + + /* Verify name of link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", (info ? (unsigned)op_data->curr : (unsigned)((op_data->ncalled - 1) + op_data->nskipped))); + if(HDstrcmp(link_name, objname)) + return H5_ITER_ERROR; + + /* Check if we've visited this link before */ + if((size_t)op_data->curr >= op_data->max_visit) + return H5_ITER_ERROR; + if(op_data->visited[op_data->curr]) + return H5_ITER_ERROR; + op_data->visited[op_data->curr] = TRUE; + + /* Advance to next value, in correct direction */ + if(op_data->order != H5_ITER_DEC) + op_data->curr++; + else + op_data->curr--; + + /* Check for stopping in the middle of iterating */ + if(op_data->stop > 0) + if(--op_data->stop == 0) + return CORDER_ITER_STOP; + + return H5_ITER_CONT; +} /* end link_iterate_old_deprec_cb() */ + +/*------------------------------------------------------------------------- + * Function: group_iterate_old_deprec_cb + * + * Purpose: Callback routine for iterating over links in group with + * H5Giterate() + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +group_iterate_old_deprec_cb(hid_t group_id, const char *link_name, void *_op_data) +{ + return link_iterate_old_deprec_cb(group_id, link_name, NULL, _op_data); +} /* end group_iterate_old_deprec_cb() */ + +/*------------------------------------------------------------------------- + * Function: link_iterate_old_check_deprec + * + * Purpose: Check iteration over [old] links in a group + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +link_iterate_old_check_deprec(hid_t group_id, H5_iter_order_t order, unsigned max_links, link_iter_info_t *iter_info) +{ + unsigned v; /* Local index variable */ + hsize_t skip; /* # of links to skip in group */ + int gskip; /* # of links to skip in group, with H5Giterate */ + herr_t ret; /* Generic return value */ + + /* Iterate over links in group */ + 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_links - 1); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if(H5Literate1(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_deprec_cb, iter_info) < 0) TEST_ERROR + + /* Verify that we visited all the links */ + if(skip != max_links) TEST_ERROR + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + + /* Iterate over links in group, with H5Giterate */ + iter_info->nskipped = (unsigned)(gskip = 0); + iter_info->order = order; + iter_info->stop = -1; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if(H5Giterate(group_id, ".", &gskip, group_iterate_old_deprec_cb, iter_info) < 0) TEST_ERROR + + /* Verify that we visited all the links */ + if(gskip != (int)max_links) TEST_ERROR + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + + /* Skip over some links in group */ + iter_info->nskipped = (unsigned)(skip = max_links / 2); + iter_info->order = order; + iter_info->stop = -1; + iter_info->ncalled = 0; + 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(H5Literate1(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_deprec_cb, iter_info) < 0) TEST_ERROR + + /* Verify that we visited all the links */ + if(skip != max_links) TEST_ERROR + if(order == H5_ITER_INC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR + } /* end if */ + else if(order == H5_ITER_DEC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + } /* end if */ + else { + unsigned nvisit = 0; /* # of links visited */ + + HDassert(order == H5_ITER_NATIVE); + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == TRUE) + nvisit++; + + if(nvisit != (max_links / 2)) TEST_ERROR + } /* end else */ + + /* Skip over some links in group, with H5Giterate */ + 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) - (unsigned)gskip); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if(H5Giterate(group_id, ".", &gskip, group_iterate_old_deprec_cb, iter_info) < 0) TEST_ERROR + + /* Verify that we visited all the links */ + if(gskip != (int)max_links) TEST_ERROR + if(order == H5_ITER_INC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR + } /* end if */ + else if(order == H5_ITER_DEC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + } /* end if */ + else { + unsigned nvisit = 0; /* # of links visited */ + + HDassert(order == H5_ITER_NATIVE); + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == TRUE) + nvisit++; + + if(nvisit != (max_links / 2)) TEST_ERROR + } /* end else */ + + /* Iterate over links in group, 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_links - 1); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if((ret = H5Literate1(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_deprec_cb, iter_info)) < 0) TEST_ERROR + if(ret != CORDER_ITER_STOP) TEST_ERROR + if(iter_info->ncalled != 3) TEST_ERROR + + /* Iterate over links in group, stopping in the middle, with H5Giterate() */ + iter_info->nskipped = (unsigned)(gskip = 0); + iter_info->order = order; + iter_info->stop = 3; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if((ret = H5Giterate(group_id, ".", &gskip, group_iterate_old_deprec_cb, iter_info)) < 0) TEST_ERROR + if(ret != CORDER_ITER_STOP) TEST_ERROR + if(iter_info->ncalled != 3) TEST_ERROR + + /* Check for iteration routine indicating failure */ + skip = 0; + H5E_BEGIN_TRY { + ret = H5Literate1(group_id, H5_INDEX_NAME, order, &skip, link_iterate_fail_deprec_cb, NULL); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Check for iteration w/bad location ID */ + skip = 0; + H5E_BEGIN_TRY { + ret = H5Literate1((hid_t)(-1), H5_INDEX_NAME, order, &skip, link_iterate_fail_deprec_cb, NULL); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + H5E_BEGIN_TRY { + ret = H5Giterate((hid_t)(-1), ".", &gskip, group_iterate_old_deprec_cb, iter_info); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Success */ + return SUCCEED; + +error: + return FAIL; +} /* end link_iterate_old_check_deprec() */ + +/*------------------------------------------------------------------------- + * Function: link_iterate_old_deprec + * + * Purpose: Create a "old-style" group and test iterating over links by index. + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +link_iterate_old_deprec(hid_t fapl) +{ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + H5_iter_order_t order; /* Order within in the index */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE];/* File name */ + link_iter_info_t iter_info; /* Iterator info */ + hbool_t *visited = NULL; /* Array of flags for visiting links */ + hsize_t skip; /* # of links to skip in group */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ + + /* Allocate the "visited link" array */ + iter_info.max_visit = CORDER_NLINKS; + if(NULL == (visited = (hbool_t *)HDmalloc(sizeof(hbool_t) * iter_info.max_visit))) TEST_ERROR + iter_info.visited = visited; + + /* Loop over operating in different orders */ + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) { + /* Print appropriate test message */ + if(order == H5_ITER_INC) { + TESTING("iterating over links by name index in increasing order in old-style group using deprecated routines") + } /* end if */ + else if(order == H5_ITER_DEC) { + TESTING("iterating over links by name index in decreasing order in old-style group using deprecated routines") + } /* end else */ + else { + HDassert(order == H5_ITER_NATIVE); + TESTING("iterating over links by name index in native order in old-style group using deprecated routines") + } /* end else */ + + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create group with creation order tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Check for iteration on empty group */ + /* (should be OK) */ + if(H5Literate1(group_id, H5_INDEX_NAME, order, NULL, link_iterate_old_deprec_cb, NULL) < 0) TEST_ERROR + + /* Create several links */ + for(u = 0; u < CORDER_NLINKS; u++) { + hid_t group_id2; /* Group ID */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end for */ + + /* Verify state of group (symbol table) */ + if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR + + /* Check for out of bound iteration on old-style group */ + skip = (hsize_t)u; + H5E_BEGIN_TRY { + ret = H5Literate1(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_deprec_cb, NULL); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Check for iteration on creation order */ + /* (should fail) */ + skip = (hsize_t)0; + H5E_BEGIN_TRY { + ret = H5Literate1(group_id, H5_INDEX_CRT_ORDER, order, &skip, link_iterate_old_deprec_cb, NULL); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Test iteration over links in group */ + if(link_iterate_old_check_deprec(group_id, order, u, &iter_info) < 0) TEST_ERROR + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); + } /* end for */ + + /* Free resources */ + if(visited) + HDfree(visited); + + return SUCCEED; + +error: + /* Free resources */ + H5E_BEGIN_TRY { + H5Gclose(group_id); + H5Fclose(file_id); + } H5E_END_TRY; + + if(visited) + HDfree(visited); + + return FAIL; +} /* end link_iterate_old_deprec() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -1642,7 +5666,7 @@ external_link_root(hid_t fapl, hbool_t new_format) { hid_t fid = -1; /* File ID */ hid_t gid = -1, gid2 = -1; /* Group IDs */ - H5L_info_t linfo; /* Link information */ + H5L_info2_t linfo; /* Link information */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename1[NAME_BUF_SIZE]; char filename2[NAME_BUF_SIZE]; @@ -1674,7 +5698,7 @@ external_link_root(hid_t fapl, hbool_t new_format) if(H5Lcreate_external(filename1, "/", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Check information for external link */ - if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; + if(H5Lget_info2(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; if(H5L_TYPE_EXTERNAL != linfo.type) { H5_FAILED(); HDputs(" Unexpected object type - should have been an external link"); @@ -1698,7 +5722,7 @@ external_link_root(hid_t fapl, hbool_t new_format) if(H5Lcreate_external(filename1, "///", fid, "ext_link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Check information for external link */ - if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; + if(H5Lget_info2(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; if(H5L_TYPE_EXTERNAL != linfo.type) { H5_FAILED(); HDputs(" Unexpected object type - should have been an external link"); @@ -5013,15 +9037,15 @@ error: static int external_link_query(hid_t fapl, hbool_t new_format) { - hid_t fid = -1; /* File ID */ - hid_t gid = -1; /* Group IDs */ - const char *file_name; /* Name of the file the external link points to */ - const char *object_name; /* Name of the object the external link points to */ - H5O_info_t oi; /* Object information */ - H5L_info_t li; /* Link information */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], /* Names of files to externally link across */ - query_buf[NAME_BUF_SIZE]; /* Buffer to hold query result */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + const char *file_name; /* Name of the file the external link points to */ + const char *object_name; /* Name of the object the external link points to */ + H5O_info2_t oi; /* Object information */ + H5L_info2_t li; /* Link information */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], /* Names of files to externally link across */ + query_buf[NAME_BUF_SIZE]; /* Buffer to hold query result */ if(new_format) TESTING("query aspects of external link (w/new group format)") @@ -5040,7 +9064,7 @@ external_link_query(hid_t fapl, hbool_t new_format) if(H5Lcreate_external(filename2, "///dst//", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Get size of buffer for external link */ - if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR if (H5L_TYPE_EXTERNAL != li.type) { H5_FAILED(); @@ -5065,7 +9089,7 @@ external_link_query(hid_t fapl, hbool_t new_format) if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Get size of buffer for external link */ - if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR if(H5L_TYPE_EXTERNAL != li.type) { H5_FAILED(); @@ -5084,7 +9108,7 @@ external_link_query(hid_t fapl, hbool_t new_format) if(HDstrcmp(object_name, "/dst")) TEST_ERROR /* Query information about object that external link points to */ - if(H5Oget_info_by_name2(fid, "src", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(fid, "src", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_GROUP != oi.type) { H5_FAILED(); HDputs(" Unexpected object type - should have been a group"); @@ -5729,8 +9753,8 @@ external_link_closing(hid_t fapl, hbool_t new_format) filename3[NAME_BUF_SIZE], filename4[NAME_BUF_SIZE], /* Names of files to externally link across */ buf[NAME_BUF_SIZE]; /* misc. buffer */ - H5L_info_t li; - H5O_info_t oi; + H5L_info2_t li; + H5O_info2_t oi; hobj_ref_t obj_ref; if(new_format) @@ -5786,10 +9810,10 @@ external_link_closing(hid_t fapl, hbool_t new_format) if(H5Dclose(did) < 0) TEST_ERROR /* Test that getting info works */ - if(H5Lget_info(fid1, "elink/elink/elink/type1", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(fid1, "elink/elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(fid1, "elink/elink/elink/type1", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(fid1, "elink/elink/elink", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid1, "elink/elink/elink/type1", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid1, "elink/elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(fid1, "elink/elink/elink/type1", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(fid1, "elink/elink/elink", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR /* Test move */ if(H5Lmove(fid1, "elink/elink/elink/group1", fid1, @@ -5876,7 +9900,7 @@ external_link_closing(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3/group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Oget_info_by_name2(fid1, "elink/elink2/group2/group3/group4", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(fid1, "elink/elink2/group2/group3/group4", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR /* Add a few regular groups and a soft link in file2 using intermediate group creation */ if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR @@ -5890,13 +9914,13 @@ external_link_closing(hid_t fapl, hbool_t new_format) */ if((gid = H5Gcreate2(fid1, "elink/file2group1/file2group2/slink/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Lget_info(fid1, "elink/file2group1/file2group2/slink/group3", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid1, "elink/file2group1/file2group2/slink/group3", &li, H5P_DEFAULT) < 0) TEST_ERROR /* Some simpler tests */ if((gid = H5Gcreate2(fid1, "elink/file2group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Lget_info(fid1, "elink/file2group3", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(fid1, "elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid1, "elink/file2group3", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid1, "elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR /* Close file1, the only file that should still be open */ @@ -7168,19 +11192,19 @@ static herr_t UD_hard_create(const char H5_ATTR_UNUSED * link_name, hid_t loc_group, const void *udata, size_t udata_size, hid_t H5_ATTR_UNUSED lcpl_id) { - haddr_t addr; + H5O_token_t token; hid_t target_obj = -1; herr_t ret_value = 0; - if(udata_size != sizeof(haddr_t)) { + if(udata_size != sizeof(H5O_token_t)) { ret_value = -1; goto done; } /* end if */ - addr = *((const haddr_t *)udata); + token = *(const H5O_token_t *)udata; /* Open the object this link points to */ - target_obj = H5Oopen_by_addr(loc_group, addr); + target_obj = H5Oopen_by_token(loc_group, token); if(target_obj < 0) { ret_value = -1; goto done; @@ -7242,15 +11266,16 @@ UD_hard_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, const void *udata, size_t udata_size, hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id) { - haddr_t addr; + H5O_token_t token; hid_t ret_value = -1; - if(udata_size != sizeof(haddr_t)) + if(udata_size != sizeof(H5O_token_t)) return FAIL; - addr = *((const haddr_t *) udata); + token = *(const H5O_token_t *)udata; - ret_value = H5Oopen_by_addr(cur_group, addr); /* If this fails, our return value will be negative. */ + /* If this fails, our return value will be negative. */ + ret_value = H5Oopen_by_token(cur_group, token); return ret_value; } /* end UD_hard_traverse() */ @@ -7260,19 +11285,19 @@ static herr_t UD_hard_delete(const char H5_ATTR_UNUSED * link_name, hid_t file, const void *udata, size_t udata_size) { - haddr_t addr; + H5O_token_t token; hid_t target_obj = -1; herr_t ret_value = 0; - if(udata_size != sizeof(haddr_t)) { + if(udata_size != sizeof(H5O_token_t)) { ret_value = -1; goto done; } /* end if */ - addr = *((const haddr_t *) udata); + token = *(const H5O_token_t *)udata; /* Open the object this link points to */ - target_obj = H5Oopen_by_addr(file, addr); + target_obj = H5Oopen_by_token(file, token); if(target_obj < 0) { ret_value = -1; goto done; @@ -7328,24 +11353,12 @@ done: return ret_value; } /* end UD_hard_delete() */ -const H5L_class_t UD_hard_class[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_HARD_TYPE, /* Link type id number */ - "UD_hard_link", /* Link class name for debugging */ - UD_hard_create, /* Creation callback */ - NULL, /* Move/rename callback */ - NULL, /* Copy callback */ - UD_hard_traverse, /* The actual traversal function */ - UD_hard_delete, /* Deletion callback */ - NULL /* Query callback */ -}}; - static int ud_hard_links(hid_t fapl) { hid_t fid = -1; /* File ID */ hid_t gid = -1, gid2 = -1; /* Group IDs */ - H5L_info_t li; /* Link information */ + H5L_info2_t li; /* Link information */ char objname[NAME_BUF_SIZE]; /* Object name */ h5_stat_size_t empty_size; /* Size of an empty file */ char filename[NAME_BUF_SIZE]; @@ -7378,13 +11391,13 @@ ud_hard_links(hid_t fapl) if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Get address for the group to give to the hard link */ - if(H5Lget_info(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR if(H5Gclose(gid) < 0) TEST_ERROR /* Create a user-defined "hard link" to the group using the address we got - * from H5Lget_info */ - if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), (size_t)sizeof(haddr_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + * from H5Lget_info2 */ + if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.token), sizeof(H5O_token_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close and re-open file to ensure that data is written to disk */ if(H5Fclose(fid) < 0) TEST_ERROR @@ -7415,7 +11428,7 @@ ud_hard_links(hid_t fapl) if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Check that H5Lget_objinfo works on the hard link */ - if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lget_info2(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* UD hard links have no query function, thus return a "link length" of 0 */ if(li.u.val_size != 0) TEST_ERROR if(UD_HARD_TYPE != li.type) { @@ -7488,26 +11501,12 @@ error: return FAIL; } /* end UD_rereg_traverse() */ -/* This link class has the same ID number as the UD hard links but - * has a very different traversal function */ -const H5L_class_t UD_rereg_class[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_HARD_TYPE, /* Link type id number */ - "UD_reregistered_type", /* Link class name for debugging */ - NULL, /* Creation callback */ - NULL, /* Move/rename callback */ - NULL, /* Copy callback */ - UD_rereg_traverse, /* The actual traversal function */ - NULL, /* Deletion callback */ - NULL /* Query callback */ -}}; - static int ud_link_reregister(hid_t fapl) { hid_t fid = -1; /* File ID */ hid_t gid = -1, gid2 = -1; /* Group IDs */ - H5L_info_t li; /* Link information */ + H5L_info2_t li; /* Link information */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE]; h5_stat_size_t empty_size; /* Size of an empty file */ @@ -7536,11 +11535,11 @@ ud_link_reregister(hid_t fapl) /* Point a UD defined hard link to a group in the same way as the previous test */ if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if (H5Lget_info(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), - sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT) < 0) + if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.token), + sizeof(H5O_token_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Create a group named REREG_TARGET_NAME in the same group as the ud link */ @@ -7560,8 +11559,8 @@ ud_link_reregister(hid_t fapl) /* Verify that we can't create any new links of this type */ H5E_BEGIN_TRY { - if(H5Lcreate_ud(fid, "ud_link2", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), - sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT) >= 0) + if(H5Lcreate_ud(fid, "ud_link2", (H5L_type_t)UD_HARD_TYPE, &(li.u.token), + sizeof(H5O_token_t), H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR } H5E_END_TRY @@ -7643,7 +11642,7 @@ error: /*------------------------------------------------------------------------- - * Function: ud_callbacks + * Function: UD_cb_create * * Purpose: Check that all callbacks are called and are given the correct * information. @@ -7759,25 +11758,13 @@ error: return FAIL; } /* end UD_cb_query() */ -const H5L_class_t UD_cb_class[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_CB_TYPE, /* Link type id number */ - NULL, /* NULL name (to make sure this doesn't break anything */ - UD_cb_create, /* Creation callback */ - UD_cb_move, /* Move/rename callback */ - UD_cb_move, /* Copy callback */ - UD_cb_traverse, /* The actual traversal function */ - UD_cb_delete, /* Deletion callback */ - UD_cb_query /* Query callback */ -}}; - static int ud_callbacks(hid_t fapl, hbool_t new_format) { hid_t fid = -1; /* File ID */ hid_t gid = -1; /* Group ID */ hid_t lcpl = -1; /* Link Creation PL */ - H5L_info_t li; /* Link information */ + H5L_info2_t li; /* Link information */ char ud_target_name[] = UD_CB_TARGET; /* Link target name */ char filename[NAME_BUF_SIZE]; char query_buf[NAME_BUF_SIZE]; @@ -7822,7 +11809,7 @@ ud_callbacks(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR /* Query the link to test its query callback */ - if(H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.u.val_size != 16) TEST_ERROR if (UD_CB_TYPE != li.type) { H5_FAILED(); @@ -7854,7 +11841,7 @@ ud_callbacks(hid_t fapl, hbool_t new_format) if(H5Pclose(lcpl) < 0) FAIL_STACK_ERROR /* Check its character encoding */ - if(H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lget_info2(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(li.cset != H5T_CSET_UTF8) TEST_ERROR /* Unregister the link class so the library forgets what its callbacks do */ @@ -7870,7 +11857,7 @@ ud_callbacks(hid_t fapl, hbool_t new_format) } H5E_END_TRY /* The query callback should NOT fail, but should be unable to give a linklen */ - if(H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lget_info2(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(li.u.val_size != 0) TEST_ERROR if(li.type != UD_CB_TYPE) TEST_ERROR @@ -7924,18 +11911,6 @@ error: return FAIL; } /* end UD_plist_traverse() */ -const H5L_class_t UD_plist_class[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_PLIST_TYPE, /* Link type id number */ - "UD_plist_link", /* Link class name for debugging */ - NULL, /* Creation callback */ - NULL, /* Move/rename callback */ - NULL, /* Copy callback */ - UD_plist_traverse, /* The actual traversal function */ - NULL, /* Deletion callback */ - NULL /* Query callback */ -}}; - static int lapl_udata(hid_t fapl, hbool_t new_format) { @@ -8231,12 +12206,12 @@ const H5L_class_t UD_error4_class[1] = {{ static int ud_link_errors(hid_t fapl, hbool_t new_format) { - hid_t fid = -1; /* File ID */ - hid_t gid = -1; /* Group IDs */ - char group_name[NAME_BUF_SIZE]; - char filename[NAME_BUF_SIZE]; - char query_buf[NAME_BUF_SIZE]; - H5L_info_t li; /* Link information */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + char group_name[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; + char query_buf[NAME_BUF_SIZE]; + H5L_info2_t li; /* Link information */ if(new_format) TESTING("user-defined link error conditions (w/new group format)") @@ -8301,7 +12276,7 @@ ud_link_errors(hid_t fapl, hbool_t new_format) if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) >= 0) TEST_ERROR /* The query callback will fail */ - if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) >=0) TEST_ERROR + if(H5Lget_info2(fid, "ud_link", &li, H5P_DEFAULT) >=0) TEST_ERROR } H5E_END_TRY /* Now use a class with different callback functions */ @@ -8314,7 +12289,7 @@ ud_link_errors(hid_t fapl, hbool_t new_format) if(H5Lcopy(fid, "ud_link", fid, "copy_succ", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* The query callback will succeed when we only want to get the size of the buffer... */ - if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lget_info2(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(li.u.val_size != 0) TEST_ERROR /* ...but fail when we try to write data to the buffer itself*/ H5E_BEGIN_TRY { @@ -8325,7 +12300,7 @@ ud_link_errors(hid_t fapl, hbool_t new_format) if(H5Lregister(UD_cbfail_class3) < 0) FAIL_STACK_ERROR /* Now querying should succeed */ - if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lget_info2(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(li.u.val_size != 8) TEST_ERROR if(H5Lget_val(fid, "ud_link", query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(HDstrcmp(query_buf, "succeed") != 0) TEST_ERROR @@ -8491,9 +12466,9 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) /* H5Ldelete */ if(H5Ldelete(fid, "soft17/soft_link", plist) < 0) TEST_ERROR - /* H5Lget_val and H5Lget_info */ + /* H5Lget_val and H5Lget_info2 */ if(H5Lget_val(fid, "soft17", NULL, (size_t)0, plist) < 0) TEST_ERROR - if(H5Lget_info(fid, "soft17", NULL, plist) < 0) TEST_ERROR + if(H5Lget_info2(fid, "soft17", NULL, plist) < 0) TEST_ERROR /* H5Lcreate_external and H5Lcreate_ud */ if(H5Lcreate_external("filename", "path", fid, "soft17/extlink", H5P_DEFAULT, plist) < 0) TEST_ERROR @@ -8592,12 +12567,12 @@ error: static int linkinfo(hid_t fapl, hbool_t new_format) { - hid_t fid = -1; /* File ID */ - hid_t gid = -1; /* Group ID */ - hid_t tid = -1; /* Type ID */ - hid_t sid = -1, did = -1; /* Dataspace and dataset IDs */ - H5L_info_t li; /* Link information */ - char filename[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + hid_t tid = -1; /* Type ID */ + hid_t sid = -1, did = -1; /* Dataspace and dataset IDs */ + H5L_info2_t li; /* Link information */ + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("link type field in H5Lget_info (w/new group format)") @@ -8630,22 +12605,22 @@ linkinfo(hid_t fapl, hbool_t new_format) if(H5Dclose(did) < 0) TEST_ERROR /* Make sure that link type is correct when objects are queried */ - if(H5Lget_info(fid, "datatype", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "datatype", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.type != H5L_TYPE_HARD) TEST_ERROR - if(H5Lget_info(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.type != H5L_TYPE_HARD) TEST_ERROR - if(H5Lget_info(fid, "dataset", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "dataset", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.type != H5L_TYPE_HARD) TEST_ERROR - if(H5Lget_info(fid, "ext_link", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "ext_link", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.type != H5L_TYPE_EXTERNAL) TEST_ERROR - if(H5Lget_info(fid, "softlink", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "softlink", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.type != H5L_TYPE_SOFT) TEST_ERROR - if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "ud_link", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.type != UD_PLIST_TYPE) TEST_ERROR /* Ensure that passing a NULL pointer doesn't cause an error */ - if(H5Lget_info(fid, "group", NULL, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "group", NULL, H5P_DEFAULT) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR @@ -8815,7 +12790,7 @@ error: *------------------------------------------------------------------------- */ static int -visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info_t *linfo, void *_op_data) +visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info2_t *linfo, void *_op_data) { lvisit_ud_t *op_data = (lvisit_ud_t *)_op_data; @@ -8857,26 +12832,26 @@ link_visit(hid_t fapl, hbool_t new_format) /* Visit all the links reachable from the root group (with file ID) */ udata.idx = 0; udata.info = lvisit0; - if(H5Lvisit(fid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR + if(H5Lvisit2(fid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR /* Visit all the links reachable from the root group (with group ID) */ if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = lvisit0; - if(H5Lvisit(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR + if(H5Lvisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Visit all the links reachable from each internal group */ if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = lvisit1; - if(H5Lvisit(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR + if(H5Lvisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = lvisit2; - if(H5Lvisit(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR + if(H5Lvisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Close file created */ @@ -8921,34 +12896,34 @@ link_visit_by_name(hid_t fapl, hbool_t new_format) /* Visit all the links reachable from the root group (with file ID) */ udata.idx = 0; udata.info = lvisit0; - if(H5Lvisit_by_name(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lvisit_by_name2(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Visit all the links reachable from the root group (with group ID) */ if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = lvisit0; - if(H5Lvisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lvisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Visit all the links reachable from each internal group */ udata.idx = 0; udata.info = lvisit1; - if(H5Lvisit_by_name(fid, "/Group1", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lvisit_by_name2(fid, "/Group1", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = lvisit1; - if(H5Lvisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lvisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = lvisit2; - if(H5Lvisit_by_name(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lvisit_by_name2(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = lvisit2; - if(H5Lvisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lvisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Close file created */ @@ -8976,7 +12951,7 @@ error: *------------------------------------------------------------------------- */ static int -visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info_t *oinfo, void *_op_data) +visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info2_t *oinfo, void *_op_data) { ovisit_ud_t *op_data = (ovisit_ud_t *)_op_data; @@ -9018,26 +12993,26 @@ obj_visit(hid_t fapl, hbool_t new_format) /* Visit all the objects reachable from the root group (with file ID) */ udata.idx = 0; udata.info = new_format ? ovisit0_new : ovisit0_old; - if(H5Ovisit2(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR + if(H5Ovisit3(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR /* Visit all the objects reachable from the root group (with group ID) */ if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit0_new : ovisit0_old; - if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR + if(H5Ovisit3(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Visit all the objects reachable from each internal group */ if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit1_new : ovisit1_old; - if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR + if(H5Ovisit3(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit2_new : ovisit2_old; - if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR + if(H5Ovisit3(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Close file created */ @@ -9082,34 +13057,34 @@ obj_visit_by_name(hid_t fapl, hbool_t new_format) /* Visit all the objects reachable from the root group (with file ID) */ udata.idx = 0; udata.info = new_format ? ovisit0_new : ovisit0_old; - if(H5Ovisit_by_name2(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ovisit_by_name3(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Visit all the objects reachable from the root group (with group ID) */ if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit0_new : ovisit0_old; - if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ovisit_by_name3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Visit all the objects reachable from each internal group */ udata.idx = 0; udata.info = new_format ? ovisit1_new : ovisit1_old; - if(H5Ovisit_by_name2(fid, "/Group1", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ovisit_by_name3(fid, "/Group1", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit1_new : ovisit1_old; - if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ovisit_by_name3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit2_new : ovisit2_old; - if(H5Ovisit_by_name2(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ovisit_by_name3(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit2_new : ovisit2_old; - if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ovisit_by_name3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Close file created */ @@ -9136,7 +13111,7 @@ error: *------------------------------------------------------------------------- */ static int -visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name, const H5O_info_t H5_ATTR_UNUSED *oinfo, void *_op_data) +visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name, const H5O_info2_t H5_ATTR_UNUSED *oinfo, void *_op_data) { unsigned *op_data = (unsigned *)_op_data; @@ -9176,14 +13151,14 @@ obj_visit_stop(hid_t fapl, hbool_t new_format) * returns H5_ITER_STOP */ nvisited = 0; - if((ret = H5Ovisit2(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb, &nvisited, H5O_INFO_BASIC)) < 0) + if((ret = H5Ovisit3(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb, &nvisited, H5O_INFO_BASIC)) < 0) FAIL_STACK_ERROR if(ret != H5_ITER_STOP) TEST_ERROR if(nvisited != 1) TEST_ERROR /* Same test with H5Ovisit_by_name */ nvisited = 0; - if((ret = H5Ovisit_by_name2(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb, + if((ret = H5Ovisit_by_name3(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb, &nvisited, H5O_INFO_BASIC, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(ret != H5_ITER_STOP) TEST_ERROR if(nvisited != 1) TEST_ERROR @@ -9977,11 +13952,11 @@ corder_create_compact(hid_t fapl) /* Loop through links, checking their creation order values */ /* (the name index is used, but the creation order value is in the same order) */ for(u = 0; u < max_compact; u++) { - H5L_info_t linfo; /* Link information */ + H5L_info2_t linfo; /* Link information */ /* Retrieve information for link */ HDsnprintf(objname, sizeof(objname), "filler %u", u); - if(H5Lget_info(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR /* Verify creation order of link */ if(linfo.corder_valid != TRUE) TEST_ERROR @@ -10105,11 +14080,11 @@ corder_create_dense(hid_t fapl) /* Loop through links, checking their creation order values */ /* (the name index is used, but the creation order value is in the same order) */ for(u = 0; u < (max_compact + 1); u++) { - H5L_info_t linfo; /* Link information */ + H5L_info2_t linfo; /* Link information */ /* Retrieve information for link */ HDsnprintf(objname, sizeof(objname), "filler %u", u); - if(H5Lget_info(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR /* Verify creation order of link */ if(linfo.corder_valid != TRUE) TEST_ERROR @@ -10503,19 +14478,19 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ char valname[NAME_BUF_SIZE]; /* Link value name */ char tmpval[NAME_BUF_SIZE]; /* Temporary link value */ - H5L_info_t linfo; /* Link info struct */ + H5L_info2_t linfo; /* Link info struct */ /* Make link value for increasing/native order queries */ HDsnprintf(valname, sizeof(valname), "value %02u", (unsigned)n); /* Verify the link information for first link, in increasing creation order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder != 0) TEST_ERROR /* Verify the link information for new link, in increasing creation order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder != (int64_t)n) TEST_ERROR /* Verify value for new soft link, in increasing creation order */ @@ -10537,12 +14512,12 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, if(use_index) { /* Verify the link information for first link, in native creation order (which is increasing) */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder != 0) TEST_ERROR /* Verify the link information for new link, in native creation order (which is increasing) */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder != (int64_t)n) TEST_ERROR /* Verify value for new soft link, in native creation order (which is increasing) */ @@ -10560,12 +14535,12 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, /* Verify the link information for first link, in decreasing creation order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder != 0) TEST_ERROR /* Verify the link information for new link, in decreasing creation order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder != (int64_t)n) TEST_ERROR /* Verify value for new soft link, in decreasing creation order */ @@ -10583,12 +14558,12 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, /* Verify the link information for first link, in increasing link name order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder != 0) TEST_ERROR /* Verify the link information for new link, in increasing link name order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder != (int64_t)n) TEST_ERROR /* Verify value for new soft link, in increasing link name order */ @@ -10609,12 +14584,12 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, /* Verify the link information for first link, in decreasing link name order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder != 0) TEST_ERROR /* Verify the link information for new link, in decreasing link name order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder != (int64_t)n) TEST_ERROR /* Verify value for new soft link, in decreasing link name order */ @@ -10658,7 +14633,7 @@ link_info_by_idx(hid_t fapl) unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - H5L_info_t linfo; /* Link info struct */ + H5L_info2_t linfo; /* Link info struct */ char objname[NAME_BUF_SIZE]; /* Object name */ char valname[NAME_BUF_SIZE]; /* Link value name */ char filename[NAME_BUF_SIZE];/* File name */ @@ -10702,7 +14677,7 @@ link_info_by_idx(hid_t fapl) /* Check for query on empty group */ H5E_BEGIN_TRY { - ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT); + ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { @@ -10740,11 +14715,11 @@ link_info_by_idx(hid_t fapl) /* Check for out of bound offset queries */ H5E_BEGIN_TRY { - ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); + ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { - ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT); + ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { @@ -10782,11 +14757,11 @@ link_info_by_idx(hid_t fapl) /* Check for out of bound offset queries */ H5E_BEGIN_TRY { - ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); + ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { - ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT); + ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { @@ -10832,19 +14807,22 @@ error: static int link_info_by_idx_old(hid_t fapl) { - hid_t file_id = -1; /* File ID */ - hid_t group_id = -1, group_id2 = -1; /* Group IDs */ - unsigned hard_link; /* Create hard or soft link? */ - H5L_info_t linfo; /* Link info struct */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value name */ - char filename[NAME_BUF_SIZE];/* File name */ - haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ - 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 */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ + H5F_t *f = NULL; + unsigned hard_link; /* Create hard or soft link? */ + H5L_info2_t linfo; /* Link info struct */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char valname[NAME_BUF_SIZE]; /* Link value name */ + char filename[NAME_BUF_SIZE];/* File name */ + H5O_token_t objtoken[CORDER_NLINKS];/* Tokens (Addresses) of the objects created */ + void *vol_obj_file = NULL; /* Object of file_id */ + 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 */ + int token_cmp; + herr_t ret; /* Generic return value */ /* Loop over creating hard or soft links */ for(hard_link = FALSE; hard_link <= TRUE; hard_link++) { @@ -10857,6 +14835,12 @@ link_info_by_idx_old(hid_t fapl) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Need the file struct to address encoding */ + /* Retrieve VOL object */ + if(NULL == (vol_obj_file = H5VL_vol_object(file_id))) TEST_ERROR + /* Retrieve file from VOL object */ + if(NULL == (f = (H5F_t *)H5VL_object_data((const H5VL_object_t *)vol_obj_file))) TEST_ERROR + /* Create group to operate on */ if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -10867,14 +14851,15 @@ link_info_by_idx_old(hid_t fapl) /* Check for creating hard or soft link */ if(hard_link) { - H5O_info_t oi; /* Buffer for querying object's info */ + H5O_info2_t oi; /* Buffer for querying object's info */ /* Create group */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oi.addr; + /* Retrieve group's object token */ + if(H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + + HDmemcpy(&objtoken[u], &oi.token, sizeof(H5O_token_t)); /* Close group */ if(H5Gclose(group_id2) < 0) TEST_ERROR @@ -10900,8 +14885,9 @@ link_info_by_idx_old(hid_t fapl) /* Verify link information (in increasing order) */ if(hard_link) { - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5F_addr_ne(linfo.u.address, objno[u])) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end if */ else { if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR @@ -10915,8 +14901,9 @@ link_info_by_idx_old(hid_t fapl) /* Verify link information (in native order - native is increasing) */ if(hard_link) { - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5F_addr_ne(linfo.u.address, objno[u])) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end if */ else { if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR @@ -10936,8 +14923,9 @@ link_info_by_idx_old(hid_t fapl) /* Verify link information (in decreasing order) */ if(hard_link) { - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[dec_u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end if */ else { if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR @@ -10951,7 +14939,7 @@ link_info_by_idx_old(hid_t fapl) /* Check for creation order index queries */ H5E_BEGIN_TRY { - ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); + ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { @@ -11003,7 +14991,7 @@ delete_by_idx(hid_t fapl) unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - H5L_info_t linfo; /* Link info struct */ + H5L_info2_t linfo; /* Link info struct */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE];/* File name */ char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ @@ -11107,7 +15095,7 @@ delete_by_idx(hid_t fapl) /* Verify the link information for first link in appropriate order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) { if(linfo.corder != (u + 1)) TEST_ERROR } /* end if */ @@ -11163,7 +15151,7 @@ delete_by_idx(hid_t fapl) /* Verify the link information for first link in appropriate order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) { if(linfo.corder != (u + 1)) TEST_ERROR } /* end if */ @@ -11222,7 +15210,7 @@ delete_by_idx(hid_t fapl) /* Verify the link information for current link in appropriate order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) { if(linfo.corder != ((u * 2) + 1)) TEST_ERROR } /* end if */ @@ -11247,7 +15235,7 @@ delete_by_idx(hid_t fapl) /* Verify the link information for first link in appropriate order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) { if(linfo.corder != ((u * 2) + 3)) TEST_ERROR } /* end if */ @@ -11311,16 +15299,19 @@ error: static int delete_by_idx_old(hid_t fapl) { - hid_t file_id = -1; /* File ID */ - hid_t group_id = -1, group_id2 = -1; /* Group IDs */ - H5L_info_t linfo; /* Link info struct */ - H5_iter_order_t order; /* Order within in the index */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename[NAME_BUF_SIZE];/* File name */ - haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ - char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ - unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ + H5F_t *f = NULL; + H5L_info2_t linfo; /* Link info struct */ + H5_iter_order_t order; /* Order within in the index */ + void *vol_obj_file = NULL; /* Object of file_id */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE];/* File name */ + H5O_token_t objtoken[CORDER_NLINKS];/* Tokens (Addresses) of the objects created */ + char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ + unsigned u; /* Local index variable */ + int token_cmp; + herr_t ret; /* Generic return value */ /* Loop over operating in different orders */ for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) { @@ -11334,6 +15325,12 @@ delete_by_idx_old(hid_t fapl) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Need the file struct to address encoding */ + /* Retrieve VOL object */ + if(NULL == (vol_obj_file = H5VL_vol_object(file_id))) TEST_ERROR + /* Retrieve file from VOL object */ + if(NULL == (f = (H5F_t *)H5VL_object_data((const H5VL_object_t *)vol_obj_file))) TEST_ERROR + /* Create group to operate on */ if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -11347,7 +15344,7 @@ delete_by_idx_old(hid_t fapl) /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { - H5O_info_t oi; /* Buffer for querying object's info */ + H5O_info2_t oi; /* Buffer for querying object's info */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -11355,9 +15352,10 @@ delete_by_idx_old(hid_t fapl) /* Create group */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oi.addr; + /* Retrieve group's object token */ + if(H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + + HDmemcpy(&objtoken[u], &oi.token, sizeof(H5O_token_t)); /* Close group */ if(H5Gclose(group_id2) < 0) TEST_ERROR @@ -11384,12 +15382,14 @@ delete_by_idx_old(hid_t fapl) /* Verify the link information for first link in appropriate order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) { - if(H5F_addr_ne(linfo.u.address, objno[u + 1])) TEST_ERROR + if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[u + 1], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end if */ else { - if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[dec_u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end else */ /* Verify the name for first link in appropriate order */ @@ -11418,7 +15418,7 @@ delete_by_idx_old(hid_t fapl) /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { - H5O_info_t oi; /* Buffer for querying object's info */ + H5O_info2_t oi; /* Buffer for querying object's info */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -11426,9 +15426,10 @@ delete_by_idx_old(hid_t fapl) /* Create group */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oi.addr; + /* Retrieve group's object token */ + if(H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + + HDmemcpy(&objtoken[u], &oi.token, sizeof(H5O_token_t)); /* Close group */ if(H5Gclose(group_id2) < 0) TEST_ERROR @@ -11443,12 +15444,14 @@ delete_by_idx_old(hid_t fapl) /* Verify the link information for current link in appropriate order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) { - if(H5F_addr_ne(linfo.u.address, objno[(u * 2) + 1])) TEST_ERROR + if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[(u * 2) + 1], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end if */ else { - if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[dec_u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end else */ /* Verify the name for current link in appropriate order */ @@ -11470,12 +15473,14 @@ delete_by_idx_old(hid_t fapl) /* Verify the link information for first link in appropriate order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) { - if(H5F_addr_ne(linfo.u.address, objno[(u * 2) + 3])) TEST_ERROR + if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[(u * 2) + 3], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end if */ else { - if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[dec_u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end else */ /* Verify the name for first link in appropriate order */ @@ -11525,22 +15530,24 @@ error: *------------------------------------------------------------------------- */ static int -link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, +link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info2_t *info, void *_op_data) { link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */ char objname[NAME_BUF_SIZE]; /* Object name */ - H5L_info_t my_info; /* Local link info */ + H5L_info2_t my_info; /* Local link info */ /* Increment # of times the callback was called */ op_data->ncalled++; /* Get the link information directly to compare */ - if(H5Lget_info(group_id, link_name, &my_info, H5P_DEFAULT) < 0) + if(H5Lget_info2(group_id, link_name, &my_info, H5P_DEFAULT) < 0) return H5_ITER_ERROR; /* Check more things for link iteration (vs. group iteration) */ if(info) { + int token_cmp; + /* Check for correct order of iteration */ /* (if we are operating in increasing or decreasing order) */ if(op_data->order != H5_ITER_NATIVE) @@ -11556,7 +15563,9 @@ link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, return H5_ITER_ERROR; if(info->cset != my_info.cset) return H5_ITER_ERROR; - if(H5F_addr_ne(info->u.address, my_info.u.address)) + if(H5Otoken_cmp(group_id, &info->u.token, &my_info.u.token, &token_cmp) < 0) + return H5_ITER_ERROR; + if(token_cmp) return H5_ITER_ERROR; } /* end if */ @@ -11618,7 +15627,7 @@ group_iterate_cb(hid_t group_id, const char *link_name, void *_op_data) */ static int link_iterate_fail_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *link_name, - const H5L_info_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data) + const H5L_info2_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data) { return H5_ITER_ERROR; } /* end link_iterate_fail_cb() */ @@ -11651,7 +15660,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, iter_info->ncalled = 0; iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); 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 + if(H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, iter_info) < 0) TEST_ERROR /* Verify that we visited all the links */ if(skip != max_links) TEST_ERROR @@ -11681,7 +15690,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, iter_info->ncalled = 0; 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 + if(H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, iter_info) < 0) TEST_ERROR /* Verify that we visited all the links */ if(skip != max_links) TEST_ERROR @@ -11743,7 +15752,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, iter_info->ncalled = 0; iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); - if((ret = H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, iter_info)) < 0) TEST_ERROR + if((ret = H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, iter_info)) < 0) TEST_ERROR if(ret != CORDER_ITER_STOP) TEST_ERROR if(iter_info->ncalled != 3) TEST_ERROR @@ -11763,7 +15772,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, /* Check for iteration routine indicating failure */ skip = 0; H5E_BEGIN_TRY { - ret = H5Literate(group_id, idx_type, order, &skip, link_iterate_fail_cb, NULL); + ret = H5Literate2(group_id, idx_type, order, &skip, link_iterate_fail_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -11881,7 +15890,7 @@ link_iterate(hid_t fapl) /* Check for iteration on empty group */ /* (should be OK) */ - if(H5Literate(group_id, idx_type, order, NULL, link_iterate_cb, NULL) < 0) TEST_ERROR + if(H5Literate2(group_id, idx_type, order, NULL, link_iterate_cb, NULL) < 0) TEST_ERROR /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { @@ -11901,7 +15910,7 @@ link_iterate(hid_t fapl) /* Check for out of bound iteration on compact group */ skip = (hsize_t)u; H5E_BEGIN_TRY { - ret = H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, NULL); + ret = H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -11926,7 +15935,7 @@ link_iterate(hid_t fapl) /* Check for out of bound iteration on dense group */ skip = (hsize_t)u; H5E_BEGIN_TRY { - ret = H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, NULL); + ret = H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -11979,21 +15988,23 @@ error: *------------------------------------------------------------------------- */ static int -link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, void *_op_data) +link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info2_t *info, void *_op_data) { link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */ char objname[NAME_BUF_SIZE]; /* Object name */ - H5L_info_t my_info; /* Local link info */ + H5L_info2_t my_info; /* Local link info */ /* Increment # of times the callback was called */ op_data->ncalled++; /* Get the link information directly to compare */ - if(H5Lget_info(group_id, link_name, &my_info, H5P_DEFAULT) < 0) + if(H5Lget_info2(group_id, link_name, &my_info, H5P_DEFAULT) < 0) return H5_ITER_ERROR; /* Check more things for link iteration (vs. group iteration) */ if(info) { + int token_cmp; + /* Compare link info structs */ if(info->type != my_info.type) return H5_ITER_ERROR; @@ -12003,7 +16014,9 @@ link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *inf return H5_ITER_ERROR; if(info->cset != my_info.cset) return H5_ITER_ERROR; - if(H5F_addr_ne(info->u.address, my_info.u.address)) + if(H5Otoken_cmp(group_id, &info->u.token, &my_info.u.token, &token_cmp) < 0) + return H5_ITER_ERROR; + if(token_cmp) return H5_ITER_ERROR; } /* end if */ @@ -12079,7 +16092,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, unsigned max_links iter_info->ncalled = 0; iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); 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 + if(H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info) < 0) TEST_ERROR /* Verify that we visited all the links */ if(skip != max_links) TEST_ERROR @@ -12109,7 +16122,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, unsigned max_links iter_info->ncalled = 0; 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 + if(H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info) < 0) TEST_ERROR /* Verify that we visited all the links */ if(skip != max_links) TEST_ERROR @@ -12171,7 +16184,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, unsigned max_links iter_info->ncalled = 0; iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); - if((ret = H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info)) < 0) TEST_ERROR + if((ret = H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info)) < 0) TEST_ERROR if(ret != CORDER_ITER_STOP) TEST_ERROR if(iter_info->ncalled != 3) TEST_ERROR @@ -12191,14 +16204,14 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, unsigned max_links /* Check for iteration routine indicating failure */ skip = 0; H5E_BEGIN_TRY { - ret = H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL); + ret = H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR /* Check for iteration w/bad location ID */ skip = 0; H5E_BEGIN_TRY { - ret = H5Literate((hid_t)(-1), H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL); + ret = H5Literate2((hid_t)(-1), H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -12268,7 +16281,7 @@ link_iterate_old(hid_t fapl) /* Check for iteration on empty group */ /* (should be OK) */ - if(H5Literate(group_id, H5_INDEX_NAME, order, NULL, link_iterate_old_cb, NULL) < 0) TEST_ERROR + if(H5Literate2(group_id, H5_INDEX_NAME, order, NULL, link_iterate_old_cb, NULL) < 0) TEST_ERROR /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { @@ -12288,7 +16301,7 @@ link_iterate_old(hid_t fapl) /* Check for out of bound iteration on old-style group */ skip = (hsize_t)u; H5E_BEGIN_TRY { - ret = H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, NULL); + ret = H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -12296,7 +16309,7 @@ link_iterate_old(hid_t fapl) /* (should fail) */ skip = (hsize_t)0; H5E_BEGIN_TRY { - ret = H5Literate(group_id, H5_INDEX_CRT_ORDER, order, &skip, link_iterate_old_cb, NULL); + ret = H5Literate2(group_id, H5_INDEX_CRT_ORDER, order, &skip, link_iterate_old_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -12343,15 +16356,16 @@ error: */ static int open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, - H5_index_t idx_type, H5_iter_order_t order, unsigned max_links, haddr_t *objno) + H5_index_t idx_type, H5_iter_order_t order, unsigned max_links, H5O_token_t *objno) { char mntname[NAME_BUF_SIZE]; /* Link value */ hid_t group_id = -1; /* ID of group to test */ - H5O_info_t oi; /* Buffer for querying object's info */ - haddr_t mnt_root_addr; /* Address of root group in file to mount */ + H5O_info2_t oi; /* Buffer for querying object's info */ + H5O_token_t mnt_root_token; /* Token (address) of root group in file to mount */ hid_t obj_id; /* ID of object opened */ unsigned mnt_idx; /* Index to mount group on */ unsigned u, v; /* Local index variables */ + int token_cmp; /* Work through main & soft link groups */ for(v = 0; v < 2; v++) { @@ -12367,16 +16381,18 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, if((obj_id = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT)) < 0) TEST_ERROR /* Get the object's information */ - if(H5Oget_info2(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Oget_info3(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR /* Check that the object is the correct one */ if(order == H5_ITER_INC) { - if(H5F_addr_ne(oi.addr, objno[u])) TEST_ERROR + if(H5Otoken_cmp(obj_id, &oi.token, &objno[u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end if */ else if(order == H5_ITER_DEC) { unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */ - if(H5F_addr_ne(oi.addr, objno[dec_u])) TEST_ERROR + if(H5Otoken_cmp(obj_id, &oi.token, &objno[dec_u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end if */ else { /* XXX: What to do about native order? */ @@ -12390,8 +16406,9 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, /* Verify opening correct object by index when file mounting is present */ /* Get the address of the root group in the file to mount */ - if(H5Oget_info2(mount_file_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - mnt_root_addr = oi.addr; + if(H5Oget_info3(mount_file_id, &oi, H5O_INFO_BASIC) < 0) + TEST_ERROR + HDmemcpy(&mnt_root_token, &oi.token, sizeof(mnt_root_token)); /* Mount a file over a group in main group */ mnt_idx = 2; @@ -12402,11 +16419,13 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, if((obj_id = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)mnt_idx, H5P_DEFAULT)) < 0) TEST_ERROR /* Get the object's information */ - if(H5Oget_info2(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Oget_info3(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR /* Check that the object is the root of the mounted file and not in the previous file */ - if(H5F_addr_ne(oi.addr, mnt_root_addr)) TEST_ERROR - if(H5F_addr_eq(oi.addr, objno[mnt_idx])) TEST_ERROR + if(H5Otoken_cmp(obj_id, &oi.token, &mnt_root_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR + if(H5Otoken_cmp(obj_id, &oi.token, &objno[mnt_idx], &token_cmp) < 0) TEST_ERROR + if(!token_cmp) TEST_ERROR /* Close object */ if(H5Oclose(obj_id) < 0) TEST_ERROR @@ -12445,11 +16464,11 @@ open_by_idx(hid_t fapl) unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - H5O_info_t oi; /* Buffer for querying object's info */ + H5O_info2_t oi; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ char valname[2 * NAME_BUF_SIZE]; /* Link value */ - haddr_t *objno = NULL; /* Addresses of the objects created */ + H5O_token_t *objno = NULL; /* Tokens (addresses) of the objects created */ unsigned u; /* Local index variable */ hid_t ret; /* Generic return value */ @@ -12459,8 +16478,8 @@ open_by_idx(hid_t fapl) /* Query the group creation properties */ if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR - /* Allocate object address array */ - if(NULL == (objno = (haddr_t *)HDmalloc(sizeof(haddr_t) * (max_compact * 2)))) TEST_ERROR + /* Allocate object token array */ + if(NULL == (objno = (H5O_token_t *)HDmalloc(sizeof(H5O_token_t) * (max_compact * 2)))) TEST_ERROR /* Create file to mount */ h5_fixname(FILENAME[1], fapl, filename, sizeof filename); @@ -12546,8 +16565,8 @@ open_by_idx(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oi.addr; + if(H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oi.token; /* Close group created */ if(H5Gclose(group_id2) < 0) TEST_ERROR @@ -12555,7 +16574,7 @@ open_by_idx(hid_t fapl) /* Create soft link in another group, to objects in main group */ HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - } /* end for */ + } /* Verify state of group (compact) */ if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR @@ -12580,8 +16599,8 @@ open_by_idx(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oi.addr; + if(H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oi.token; /* Close group created */ if(H5Gclose(group_id2) < 0) TEST_ERROR @@ -12645,6 +16664,100 @@ error: /*------------------------------------------------------------------------- + * Function: open_by_idx_check_old + * + * Purpose: Check opening by index in a group + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +open_by_idx_check_old(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, + H5_index_t idx_type, H5_iter_order_t order, unsigned max_links, H5O_token_t *objno) +{ + char mntname[NAME_BUF_SIZE]; /* Link value */ + hid_t group_id = -1; /* ID of group to test */ + H5O_info2_t oi; /* Buffer for querying object's info */ + H5O_token_t mnt_root_token; /* Token of root group in file to mount */ + hid_t obj_id; /* ID of object opened */ + unsigned mnt_idx; /* Index to mount group on */ + unsigned u, v; /* Local index variables */ + int cmp_value; /* Token comparison value */ + + /* Work through main & soft link groups */ + for(v = 0; v < 2; v++) { + /* Choose appropriate group to open links within */ + if(0 == v) + group_id = main_group_id; + else + group_id = soft_group_id; + + /* Open each object in main group by index and check that it's the correct one */ + for(u = 0; u < max_links; u++) { + /* Open the object */ + if((obj_id = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Get the object's information */ + if(H5Oget_info3(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + + /* Check that the object is the correct one */ + if(order == H5_ITER_INC) { + if(H5Otoken_cmp(group_id, &oi.token, &objno[u], &cmp_value) < 0) TEST_ERROR + if(0 != cmp_value) TEST_ERROR + } /* end if */ + else if(order == H5_ITER_DEC) { + unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */ + + if(H5Otoken_cmp(group_id, &oi.token, &objno[dec_u], &cmp_value) < 0) TEST_ERROR + if(0 != cmp_value) TEST_ERROR + } /* end if */ + else { + /* XXX: What to do about native order? */ + } /* end else */ + + /* Close object */ + if(H5Oclose(obj_id) < 0) TEST_ERROR + } /* end for */ + } /* end for */ + + /* Verify opening correct object by index when file mounting is present */ + + /* Get the address of the root group in the file to mount */ + if(H5Oget_info3(mount_file_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + mnt_root_token = oi.token; + + /* Mount a file over a group in main group */ + mnt_idx = 2; + HDsnprintf(mntname, sizeof(mntname), "/%s/filler %02u", CORDER_GROUP_NAME, mnt_idx); + if(H5Fmount(main_group_id, mntname, mount_file_id, H5P_DEFAULT) < 0) TEST_ERROR + + /* Open the object that the file is mounted on */ + if((obj_id = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)mnt_idx, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Get the object's information */ + if(H5Oget_info3(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + + /* Check that the object is the root of the mounted file and not in the previous file */ + if(H5Otoken_cmp(group_id, &oi.token, &mnt_root_token, &cmp_value) < 0) TEST_ERROR + if(0 != cmp_value) TEST_ERROR + if(H5Otoken_cmp(group_id, &oi.token, &objno[mnt_idx], &cmp_value) < 0) TEST_ERROR + if(0 == cmp_value) TEST_ERROR + + /* Close object */ + if(H5Oclose(obj_id) < 0) TEST_ERROR + + /* Unmount the file */ + if(H5Funmount(main_group_id, mntname) < 0) TEST_ERROR + + /* Success */ + return SUCCEED; + +error: + return FAIL; +} /* end open_by_idx_check_old() */ + +/*------------------------------------------------------------------------- * Function: open_by_idx_old * * Purpose: Create an old-style group and test opening @@ -12662,11 +16775,11 @@ open_by_idx_old(hid_t fapl) hid_t group_id = -1; /* Group ID */ hid_t soft_group_id = -1; /* Group ID for soft links */ H5_iter_order_t order; /* Order within in the index */ - H5O_info_t oi; /* Buffer for querying object's info */ + H5O_info2_t oi; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ char valname[2 * NAME_BUF_SIZE]; /* Link value */ - haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ + H5O_token_t objno[CORDER_NLINKS]; /* Tokens for the objects created */ unsigned u; /* Local index variable */ hid_t ret; /* Generic return value */ @@ -12716,8 +16829,8 @@ open_by_idx_old(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oi.addr; + if(H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oi.token; /* Close group created */ if(H5Gclose(group_id2) < 0) TEST_ERROR @@ -12743,7 +16856,7 @@ open_by_idx_old(hid_t fapl) if(ret >= 0) TEST_ERROR /* Verify opening objects by index */ - if(open_by_idx_check(group_id, soft_group_id, mount_file_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR + if(open_by_idx_check_old(group_id, soft_group_id, mount_file_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR /* Close the groups */ if(H5Gclose(group_id) < 0) TEST_ERROR @@ -12784,12 +16897,13 @@ error: */ static int object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type, - H5_iter_order_t order, unsigned max_links, haddr_t *objno) + H5_iter_order_t order, unsigned max_links, H5O_token_t *objno) { char objname[NAME_BUF_SIZE]; /* Object name */ hid_t group_id = -1; /* ID of group to test */ - H5O_info_t oinfo; /* Buffer for querying object's info */ + H5O_info2_t oinfo; /* Buffer for querying object's info */ unsigned u, v; /* Local index variables */ + int token_cmp; /* Work through main & soft link groups */ for(v = 0; v < 2; v++) { @@ -12805,25 +16919,28 @@ object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type, HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Query the object's information, by name */ - if(H5Oget_info_by_name2(group_id, objname, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(group_id, objname, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR /* Check that the object is the correct one */ - if(H5F_addr_ne(oinfo.addr, objno[u])) TEST_ERROR - if(H5F_addr_ne(oinfo.num_attrs, u)) TEST_ERROR + if(H5Otoken_cmp(group_id, &oinfo.token, &objno[u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR + if(oinfo.num_attrs != u) TEST_ERROR /* Query the object's information, by index */ - if(H5Oget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_idx3(group_id, ".", idx_type, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR /* Check that the object is the correct one */ if(order == H5_ITER_INC) { - if(H5F_addr_ne(oinfo.addr, objno[u])) TEST_ERROR - if(H5F_addr_ne(oinfo.num_attrs, u)) TEST_ERROR + if(H5Otoken_cmp(group_id, &oinfo.token, &objno[u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR + if(oinfo.num_attrs != u) TEST_ERROR } /* end if */ else if(order == H5_ITER_DEC) { unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */ - if(H5F_addr_ne(oinfo.addr, objno[dec_u])) TEST_ERROR - if(H5F_addr_ne(oinfo.num_attrs, dec_u)) TEST_ERROR + if(H5Otoken_cmp(group_id, &oinfo.token, &objno[dec_u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR + if(oinfo.num_attrs != dec_u) TEST_ERROR } /* end if */ else { /* XXX: What to do about native order? */ @@ -12863,12 +16980,12 @@ object_info(hid_t fapl) unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - H5O_info_t oinfo; /* Buffer for querying object's info */ + H5O_info2_t oinfo; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ char valname[2 * NAME_BUF_SIZE]; /* Link value */ char attrname[NAME_BUF_SIZE]; /* Attribute name */ - haddr_t *objno = NULL; /* Addresses of the objects created */ + H5O_token_t *objno = NULL; /* Tokens (addresses) of the objects created */ herr_t ret; /* Generic return value */ unsigned u, v; /* Local index variables */ @@ -12878,8 +16995,8 @@ object_info(hid_t fapl) /* Query the group creation properties */ if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR - /* Allocate object address array */ - if(NULL == (objno = (haddr_t *)HDmalloc(sizeof(haddr_t) * (max_compact * 2)))) TEST_ERROR + /* Allocate object token array */ + if(NULL == (objno = (H5O_token_t *)HDmalloc(sizeof(H5O_token_t) * (max_compact * 2)))) TEST_ERROR /* Create dataspace for attributes */ if((space_id = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR @@ -12950,7 +17067,7 @@ object_info(hid_t fapl) /* Check for out of bound query by index on empty group */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -12966,8 +17083,8 @@ object_info(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oinfo.addr; + if(H5Oget_info3(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oinfo.token; /* Create attributes on new object */ for(v = 0; v < u; v++) { @@ -12994,7 +17111,7 @@ object_info(hid_t fapl) /* Check for out of bound query by index */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -13014,8 +17131,8 @@ object_info(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oinfo.addr; + if(H5Oget_info3(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oinfo.token; /* Create attributes on new object */ for(v = 0; v < u; v++) { @@ -13042,7 +17159,7 @@ object_info(hid_t fapl) /* Check for out of bound query by index */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -13088,6 +17205,77 @@ error: /*------------------------------------------------------------------------- + * Function: object_info_check_old + * + * Purpose: Check querying object info in a group + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +object_info_check_old(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type, + H5_iter_order_t order, unsigned max_links, H5O_token_t *objno) +{ + char objname[NAME_BUF_SIZE]; /* Object name */ + hid_t group_id = -1; /* ID of group to test */ + H5O_info2_t oinfo; /* Buffer for querying object's info */ + unsigned u, v; /* Local index variables */ + + /* Work through main & soft link groups */ + for(v = 0; v < 2; v++) { + /* Choose appropriate group to open links within */ + if(0 == v) + group_id = main_group_id; + else + group_id = soft_group_id; + + /* Open each object in group by name and check that it's the correct one */ + for(u = 0; u < max_links; u++) { + int cmp_value; /* Token comparison value */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Query the object's information, by name */ + if(H5Oget_info_by_name3(group_id, objname, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR + + /* Check that the object is the correct one */ + if(H5Otoken_cmp(group_id, &oinfo.token, &objno[u], &cmp_value) < 0) TEST_ERROR + if(0 != cmp_value) TEST_ERROR + if(oinfo.num_attrs != u) TEST_ERROR + + /* Query the object's information, by index */ + if(H5Oget_info_by_idx3(group_id, ".", idx_type, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR + + /* Check that the object is the correct one */ + if(order == H5_ITER_INC) { + if(H5Otoken_cmp(group_id, &oinfo.token, &objno[u], &cmp_value) < 0) TEST_ERROR + if(0 != cmp_value) TEST_ERROR + if(oinfo.num_attrs != u) TEST_ERROR + } + else if(order == H5_ITER_DEC) { + unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */ + + if(H5Otoken_cmp(group_id, &oinfo.token, &objno[dec_u], &cmp_value) < 0) TEST_ERROR + if(0 != cmp_value) TEST_ERROR + if(oinfo.num_attrs != dec_u) TEST_ERROR + } + else { + /* XXX: What to do about native order? */ + } + + } /* end for */ + } /* end for */ + + /* Success */ + return SUCCEED; + +error: + return FAIL; +} /* end object_info_check_old() */ + +/*------------------------------------------------------------------------- * Function: object_info_old * * Purpose: Create an old-style group test querying object info. @@ -13104,12 +17292,12 @@ object_info_old(hid_t fapl) hid_t soft_group_id = -1; /* Group ID for soft links */ hid_t space_id = -1; /* Dataspace ID (for attributes) */ H5_iter_order_t order; /* Order within in the index */ - H5O_info_t oinfo; /* Buffer for querying object's info */ + H5O_info2_t oinfo; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ char valname[2 * NAME_BUF_SIZE]; /* Link value */ char attrname[NAME_BUF_SIZE]; /* Attribute name */ - haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ + H5O_token_t objno[CORDER_NLINKS]; /* Tokens for the objects created */ herr_t ret; /* Generic return value */ unsigned u, v; /* Local index variables */ @@ -13143,7 +17331,7 @@ object_info_old(hid_t fapl) /* Check for out of bound query by index on empty group */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -13159,8 +17347,8 @@ object_info_old(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oinfo.addr; + if(H5Oget_info3(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oinfo.token; /* Create attributes on new object */ for(v = 0; v < u; v++) { @@ -13187,18 +17375,18 @@ object_info_old(hid_t fapl) /* Check for out of bound query by index */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR /* Check for creation order index query */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)(u - 1), &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)(u - 1), &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR /* Verify querying objects by name */ - if(object_info_check(group_id, soft_group_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR + if(object_info_check_old(group_id, soft_group_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR /* Close the groups */ if(H5Gclose(group_id) < 0) TEST_ERROR @@ -13867,7 +18055,8 @@ timestamps(hid_t fapl) hid_t group_id2 = -1; /* Group ID */ hid_t gcpl_id = -1; /* Group creation property list ID */ hid_t gcpl_id2 = -1; /* Group creation property list ID */ - H5O_info_t oinfo, oinfo2; /* Object info for groups created */ + H5O_info2_t oinfo, oinfo2; /* Object info for groups created */ + H5O_native_info_t ninfo, ninfo2; /* Native info for groups created */ char filename[NAME_BUF_SIZE];/* File name */ hbool_t track_times; /* The object timestamp setting */ @@ -13916,10 +18105,15 @@ timestamps(hid_t fapl) if(track_times != TRUE) TEST_ERROR /* Query the object information for each group */ - if(H5Oget_info2(group_id, &oinfo, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR - if(H5Oget_info2(group_id2, &oinfo2, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR + /* Generic info */ + if(H5Oget_info3(group_id, &oinfo, H5O_INFO_TIME) < 0) TEST_ERROR + if(H5Oget_info3(group_id2, &oinfo2, H5O_INFO_TIME) < 0) TEST_ERROR + /* Native file format info */ + if(H5Oget_native_info(group_id, &ninfo, H5O_NATIVE_INFO_HDR) < 0) TEST_ERROR + if(H5Oget_native_info(group_id2, &ninfo2, H5O_NATIVE_INFO_HDR) < 0) TEST_ERROR /* Sanity check object information for each group */ + /* Generic info */ if(oinfo.atime != 0) TEST_ERROR if(oinfo.mtime != 0) TEST_ERROR if(oinfo.ctime != 0) TEST_ERROR @@ -13928,10 +18122,11 @@ timestamps(hid_t fapl) if(oinfo.mtime == oinfo2.mtime) TEST_ERROR if(oinfo.ctime == oinfo2.ctime) TEST_ERROR if(oinfo.btime == oinfo2.btime) TEST_ERROR - if((oinfo.hdr.flags & H5O_HDR_STORE_TIMES) != 0) TEST_ERROR - if((oinfo2.hdr.flags & H5O_HDR_STORE_TIMES) == 0) TEST_ERROR - if(oinfo.hdr.space.total >= oinfo2.hdr.space.total) TEST_ERROR - if(oinfo.hdr.space.meta >= oinfo2.hdr.space.meta) TEST_ERROR + /* Native file format info */ + if((ninfo.hdr.flags & H5O_HDR_STORE_TIMES) != 0) TEST_ERROR + if((ninfo2.hdr.flags & H5O_HDR_STORE_TIMES) == 0) TEST_ERROR + if(ninfo.hdr.space.total >= ninfo2.hdr.space.total) TEST_ERROR + if(ninfo.hdr.space.meta >= ninfo2.hdr.space.meta) TEST_ERROR /* Close the property lists */ if(H5Pclose(gcpl_id) < 0) TEST_ERROR @@ -13962,10 +18157,14 @@ timestamps(hid_t fapl) if(track_times != TRUE) TEST_ERROR /* Query the object information for each group */ - if(H5Oget_info2(group_id, &oinfo, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR - if(H5Oget_info2(group_id2, &oinfo2, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR + if(H5Oget_info3(group_id, &oinfo, H5O_INFO_TIME) < 0) TEST_ERROR + if(H5Oget_info3(group_id2, &oinfo2, H5O_INFO_TIME) < 0) TEST_ERROR + /* Native file format info */ + if(H5Oget_native_info(group_id, &ninfo, H5O_NATIVE_INFO_HDR) < 0) TEST_ERROR + if(H5Oget_native_info(group_id2, &ninfo2, H5O_NATIVE_INFO_HDR) < 0) TEST_ERROR /* Sanity check object information for each group */ + /* Generic info */ if(oinfo.atime != 0) TEST_ERROR if(oinfo.mtime != 0) TEST_ERROR if(oinfo.ctime != 0) TEST_ERROR @@ -13974,10 +18173,11 @@ timestamps(hid_t fapl) if(oinfo.mtime == oinfo2.mtime) TEST_ERROR if(oinfo.ctime == oinfo2.ctime) TEST_ERROR if(oinfo.btime == oinfo2.btime) TEST_ERROR - if((oinfo.hdr.flags & H5O_HDR_STORE_TIMES) != 0) TEST_ERROR - if((oinfo2.hdr.flags & H5O_HDR_STORE_TIMES) == 0) TEST_ERROR - if(oinfo.hdr.space.total >= oinfo2.hdr.space.total) TEST_ERROR - if(oinfo.hdr.space.meta >= oinfo2.hdr.space.meta) TEST_ERROR + /* Native file format info */ + if((ninfo.hdr.flags & H5O_HDR_STORE_TIMES) != 0) TEST_ERROR + if((ninfo2.hdr.flags & H5O_HDR_STORE_TIMES) == 0) TEST_ERROR + if(ninfo.hdr.space.total >= ninfo2.hdr.space.total) TEST_ERROR + if(ninfo.hdr.space.meta >= ninfo2.hdr.space.meta) TEST_ERROR /* Close the property lists */ if(H5Pclose(gcpl_id) < 0) TEST_ERROR @@ -14065,6 +18265,9 @@ main(void) /* General tests... (on both old & new format groups */ nerrors += mklinks(my_fapl, new_format) < 0 ? 1 : 0; nerrors += cklinks(my_fapl, new_format) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += cklinks_deprec(my_fapl, new_format) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += new_links(my_fapl, new_format) < 0 ? 1 : 0; nerrors += ck_new_links(my_fapl, new_format) < 0 ? 1 : 0; nerrors += long_links(my_fapl, new_format) < 0 ? 1 : 0; @@ -14072,13 +18275,18 @@ main(void) /* Test new H5L link creation routine */ nerrors += test_lcpl(my_fapl, new_format); +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += test_lcpl_deprec(my_fapl, new_format); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += test_move(my_fapl, new_format); nerrors += test_copy(my_fapl, new_format); nerrors += test_move_preserves(my_fapl, new_format); #ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += test_move_preserves_deprec(my_fapl, new_format); nerrors += test_deprec(my_fapl, new_format); #endif /* H5_NO_DEPRECATED_SYMBOLS */ + /* tests for external link */ /* Test external file cache first, so it sees the default efc setting on the fapl */ @@ -14106,6 +18314,9 @@ main(void) } /* end else */ nerrors += external_link_root(my_fapl, new_format) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += external_link_root_deprec(my_fapl, new_format) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += external_link_path(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_self(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_pingpong(my_fapl, new_format) < 0 ? 1 : 0; @@ -14113,11 +18324,17 @@ main(void) nerrors += external_link_dangling(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_recursive(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_query(my_fapl, new_format) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += external_link_query_deprec(my_fapl, new_format) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += external_link_unlink_compact(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_unlink_dense(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_move(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_ride(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_closing(my_fapl, new_format) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += external_link_closing_deprec(my_fapl, new_format) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += external_link_endian(new_format) < 0 ? 1 : 0; nerrors += external_link_strong(my_fapl, new_format) < 0 ? 1 : 0; @@ -14156,14 +18373,29 @@ main(void) * above has already been tested for UD links. */ if(new_format == TRUE) { - nerrors += ud_hard_links(fapl2) < 0 ? 1 : 0; /* requires new format groups */ - nerrors += ud_link_reregister(fapl2) < 0 ? 1 : 0; /* requires new format groups */ + nerrors += ud_hard_links(fapl2) < 0 ? 1 : 0; /* requires new format groups */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += ud_hard_links_deprec(fapl2) < 0 ? 1 : 0; /* requires new format groups */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + nerrors += ud_link_reregister(fapl2) < 0 ? 1 : 0; /* requires new format groups */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += ud_link_reregister_deprec(fapl2) < 0 ? 1 : 0; /* requires new format groups */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* end if */ nerrors += ud_callbacks(my_fapl, new_format) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += ud_callbacks_deprec(my_fapl, new_format) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += ud_link_errors(my_fapl, new_format) < 0 ? 1 : 0; nerrors += lapl_udata(my_fapl, new_format) < 0 ? 1 : 0; nerrors += lapl_nlinks(my_fapl, new_format) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += lapl_nlinks_deprec(my_fapl, new_format) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += linkinfo(my_fapl, new_format) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += linkinfo_deprec(my_fapl, new_format) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Misc. extra tests, useful for both new & old format files */ nerrors += link_visit(my_fapl, new_format) < 0 ? 1 : 0; @@ -14187,12 +18419,27 @@ main(void) * correct. */ nerrors += corder_create_compact(fapl2) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += corder_create_compact_deprec(fapl2) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += corder_create_dense(fapl2) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += corder_create_dense_deprec(fapl2) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += corder_transition(fapl2) < 0 ? 1 : 0; nerrors += corder_delete(fapl2) < 0 ? 1 : 0; nerrors += link_info_by_idx(fapl2) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += link_info_by_idx_deprec(fapl2) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += delete_by_idx(fapl2) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += delete_by_idx_deprec(fapl2) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += link_iterate(fapl2) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += link_iterate_deprec(fapl2) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += open_by_idx(fapl2) < 0 ? 1 : 0; nerrors += object_info(fapl2) < 0 ? 1 : 0; nerrors += group_info(fapl2) < 0 ? 1 : 0; @@ -14200,8 +18447,17 @@ main(void) /* Test new API calls on old-style groups */ nerrors += link_info_by_idx_old(fapl) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += link_info_by_idx_old_deprec(fapl) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += delete_by_idx_old(fapl) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += delete_by_idx_old_deprec(fapl) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += link_iterate_old(fapl) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += link_iterate_old_deprec(fapl) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += open_by_idx_old(fapl) < 0 ? 1 : 0; nerrors += object_info_old(fapl) < 0 ? 1 : 0; nerrors += group_info_old(fapl) < 0 ? 1 : 0; diff --git a/test/mount.c b/test/mount.c index 72973ad..3abe084 100644 --- a/test/mount.c +++ b/test/mount.c @@ -400,8 +400,9 @@ static int test_hide(hid_t fapl) { hid_t file1 = -1, file2 = -1, grp = -1; - H5O_info_t oi1, oi2; + H5O_info2_t oi1, oi2; char filename1[1024], filename2[1024]; + hbool_t same_obj; TESTING("name hiding under mount point"); h5_fixname(FILENAME[0], fapl, filename1, sizeof(filename1)); @@ -412,7 +413,7 @@ test_hide(hid_t fapl) FAIL_STACK_ERROR /* Get information about file1:/mnt1/file1 for later */ - if(H5Oget_info_by_name2(file1, "/mnt1/file1", &oi1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(file1, "/mnt1/file1", &oi1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Build the virtual file */ @@ -427,19 +428,32 @@ test_hide(hid_t fapl) H5_FAILED(); HDputs(" Name is still accessible under mount point."); TEST_ERROR - } /* end if */ + } /* * The original objects under file1:/mnt1 are still accessible by their * other names. This is a rather stupid test but demonstrates a point. */ - if(H5Oget_info_by_name2(file1, "/file1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(file1, "/file1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) { + + same_obj = TRUE; + if(oi1.fileno == oi2.fileno) { + int token_cmp; + + if(H5Otoken_cmp(file1, &oi1.token, &oi2.token, &token_cmp) < 0) + FAIL_STACK_ERROR + if(token_cmp) + same_obj = FALSE; + } + else + same_obj = FALSE; + + if(!same_obj) { H5_FAILED(); HDputs(" Hard link failed for hidden object."); TEST_ERROR - } /* end if */ + } /* Unmount and close objects */ if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR @@ -480,8 +494,9 @@ static int test_assoc(hid_t fapl) { hid_t file1 = -1, file2 = -1; - H5O_info_t oi1, oi2; + H5O_info2_t oi1, oi2; char filename1[1024], filename2[1024]; + hbool_t same_obj; TESTING("mount point open"); h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); @@ -493,7 +508,7 @@ test_assoc(hid_t fapl) FAIL_STACK_ERROR /* Get information about the root of file2 */ - if(H5Oget_info2(file2, &oi1, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(file2, &oi1, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR /* Create the virtual file */ @@ -504,11 +519,23 @@ test_assoc(hid_t fapl) * Get info about the mount point -- should be the same as the root group * of file2. */ - if(H5Oget_info_by_name2(file1, "/mnt1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(file1, "/mnt1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) { - H5_FAILED(); + same_obj = TRUE; + if(oi1.fileno == oi2.fileno) { + int token_cmp; + + if(H5Otoken_cmp(file1, &oi1.token, &oi2.token, &token_cmp) < 0) + FAIL_STACK_ERROR + if(token_cmp) + same_obj = FALSE; + } + else + same_obj = FALSE; + + if(!same_obj) { + H5_FAILED(); HDputs(" Association failed."); TEST_ERROR } /* end if */ @@ -676,7 +703,7 @@ static int test_preopen(hid_t fapl) { hid_t file1 = -1, file2 = -1, grp = -1; - H5O_info_t oinfo; + H5O_info2_t oinfo; char filename1[1024], filename2[1024]; TESTING("preopening objects under the mount point"); @@ -694,7 +721,7 @@ test_preopen(hid_t fapl) if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Now access the thing we previously opened */ - if(H5Oget_info2(grp, &oinfo, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR + if(H5Oget_info3(grp, &oinfo, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR /* Shut down */ if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR @@ -738,7 +765,7 @@ test_postopen(hid_t fapl) { hid_t file1 = -1, file2 = -1, grp = -1; - H5O_info_t oinfo; + H5O_info2_t oinfo; char filename1[1024], filename2[1024]; TESTING("open object access after unmount"); @@ -758,10 +785,10 @@ test_postopen(hid_t fapl) if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR /* Now access the thing we previously opened */ - if(H5Oget_info2(grp, &oinfo, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR + if(H5Oget_info3(grp, &oinfo, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR /* Try accessing it from the file */ - if(H5Oget_info_by_name2(file2, "/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file2, "/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Shut down */ if(H5Gclose(grp) < 0) FAIL_STACK_ERROR @@ -803,7 +830,7 @@ static int test_unlink(hid_t fapl) { hid_t file1 = -1, file2 = -1, mnt = -1, root = -1; - H5O_info_t oinfo; + H5O_info2_t oinfo; char filename1[1024], filename2[1024]; herr_t status; @@ -831,12 +858,12 @@ test_unlink(hid_t fapl) * before the H5Fmount() and thus refers to the mount point itself rather * than the group mounted there. */ - if(H5Oget_info_by_name2(file1, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(mnt, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(root, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(root, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file1, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(mnt, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(root, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(root, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(mnt, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + status = H5Oget_info_by_name3(mnt, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { H5_FAILED(); @@ -851,9 +878,9 @@ test_unlink(hid_t fapl) * We should still be able to get to "/file2" of file2 by starting at * `root' which is still open, but not by name. */ - if(H5Oget_info_by_name2(root, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(root, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(mnt, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + status = H5Oget_info_by_name3(mnt, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { H5_FAILED(); @@ -861,7 +888,7 @@ test_unlink(hid_t fapl) TEST_ERROR } /* end if */ H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(file2, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + status = H5Oget_info_by_name3(file2, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { H5_FAILED(); @@ -932,7 +959,7 @@ static int test_mvmpt(hid_t fapl) { hid_t file1 = -1, file2 = -1; - H5O_info_t oinfo; + H5O_info2_t oinfo; char filename1[1024], filename2[1024]; TESTING("mount point renaming"); @@ -949,7 +976,7 @@ test_mvmpt(hid_t fapl) if(H5Lmove(file1, "/mnt_move_a", H5L_SAME_LOC, "/mnt_move_b", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Access something under the new name */ - if(H5Oget_info_by_name2(file1, "/mnt_move_b/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file1, "/mnt_move_b/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Shut down */ if(H5Funmount(file1, "/mnt_move_b") < 0) FAIL_STACK_ERROR @@ -1094,7 +1121,7 @@ static int test_uniformity(hid_t fapl) { hid_t file1 = -1, file2 = -1; - H5O_info_t oinfo; + H5O_info2_t oinfo; char filename1[1024], filename2[1024]; TESTING("file handle uniformity"); @@ -1108,18 +1135,18 @@ test_uniformity(hid_t fapl) if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Access some things from the file1 handle */ - if(H5Oget_info_by_name2(file1, "/", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file1, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file1, "mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file1, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file1, "mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file1, "/", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file1, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file1, "mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file1, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file1, "mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Access the same things from the file2 handle */ - if(H5Oget_info_by_name2(file2, "/", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file2, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file2, "mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file2, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file2, "mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file2, "/", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file2, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file2, "mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file2, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file2, "mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Shut down */ if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR @@ -1158,7 +1185,7 @@ static int test_close(hid_t fapl) { hid_t file1 = -1, file2 = -1; - H5O_info_t oinfo; + H5O_info2_t oinfo; char filename1[1024], filename2[1024]; TESTING("file handle close"); @@ -1176,7 +1203,7 @@ test_close(hid_t fapl) * still accessible through the file2 handle. */ if(H5Fclose(file1) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file2, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { + if(H5Oget_info_by_name3(file2, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { H5_FAILED(); HDputs(" File1 contents are not accessible!"); TEST_ERROR @@ -1197,7 +1224,7 @@ test_close(hid_t fapl) * Close file2. It is not actually closed because it's a child of file1. */ if(H5Fclose(file2) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file1, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file1, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Fclose(file1) < 0) FAIL_STACK_ERROR /* Check that all file IDs have been closed */ @@ -2432,7 +2459,7 @@ test_fcdegree_strong(hid_t fapl) hid_t fid1 = -1, fid2 = -1; /* File IDs */ hid_t gidA = -1, gidM = -1, gidAM = -1; /* Group IDs */ hid_t fapl_id = -1; /* FAPL IDs */ - H5O_info_t oinfo; + H5O_info2_t oinfo; char filename1[1024], filename2[1024]; /* Name of files to mount */ herr_t ret; /* Generic return value */ @@ -2501,9 +2528,9 @@ test_fcdegree_strong(hid_t fapl) TEST_ERROR /* Check that objects are still open */ - if(H5Oget_info2(gidA, &oinfo, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(gidA, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(gidAM, &oinfo, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(gidAM, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR /* Close file #2 (should close open objects also) */ @@ -2512,12 +2539,12 @@ test_fcdegree_strong(hid_t fapl) /* Check that objects are closed */ H5E_BEGIN_TRY { - ret = H5Oget_info2(gidA, &oinfo, H5O_INFO_BASIC); + ret = H5Oget_info3(gidA, &oinfo, H5O_INFO_BASIC); } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { - ret = H5Oget_info2(gidAM, &oinfo, H5O_INFO_BASIC); + ret = H5Oget_info3(gidAM, &oinfo, H5O_INFO_BASIC); } H5E_END_TRY; if(ret >= 0) TEST_ERROR diff --git a/test/mtime.c b/test/mtime.c index 06f576b..81a20db 100644 --- a/test/mtime.c +++ b/test/mtime.c @@ -60,9 +60,10 @@ main(void) hsize_t size[1] = {2}; time_t now; struct tm *tm; - H5O_info_t oi1, oi2; + H5O_info2_t oi1, oi2; signed char buf1[32], buf2[32]; char filename[1024]; + int token_cmp; h5_reset(); fapl = h5_fileaccess(); @@ -88,14 +89,15 @@ main(void) */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR; - if(H5Oget_info_by_name2(file, "dset", &oi1, H5O_INFO_BASIC|H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR; + if(H5Oget_info_by_name3(file, "dset", &oi1, H5O_INFO_BASIC|H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR; if((dset = H5Dopen2(file, "dset", H5P_DEFAULT)) < 0) TEST_ERROR; - if(H5Oget_info2(dset, &oi2, H5O_INFO_BASIC|H5O_INFO_TIME) < 0) TEST_ERROR; + if(H5Oget_info3(dset, &oi2, H5O_INFO_BASIC|H5O_INFO_TIME) < 0) TEST_ERROR; + if(H5Otoken_cmp(file, &oi1.token, &oi2.token, &token_cmp) < 0)TEST_ERROR; if(H5Dclose(dset) < 0) TEST_ERROR; if(H5Fclose(file) < 0) TEST_ERROR; - /* Compare addresses & times from the two ways of calling H5Oget_info() */ - if(oi1.addr != oi2.addr || oi1.ctime != oi2.ctime) { + /* Compare object tokens & times from the two ways of calling H5Oget_info() */ + if(token_cmp || oi1.ctime != oi2.ctime) { H5_FAILED(); HDputs(" Calling H5Oget_info() with the dataset ID returned"); HDputs(" different values than calling it with a file and dataset"); @@ -132,7 +134,7 @@ main(void) file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); if(file >= 0){ - if(H5Oget_info_by_name2(file, "/Dataset1", &oi1, H5O_INFO_TIME, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(file, "/Dataset1", &oi1, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR; if(oi1.ctime != MTIME1) { H5_FAILED(); @@ -162,7 +164,7 @@ main(void) file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); if(file >= 0){ - if(H5Oget_info_by_name2(file, "/Dataset1", &oi2, H5O_INFO_TIME, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(file, "/Dataset1", &oi2, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR; if(oi2.ctime != MTIME2) { H5_FAILED(); diff --git a/test/null_vol_connector.c b/test/null_vol_connector.c index 985b576..ef76fe6 100644 --- a/test/null_vol_connector.c +++ b/test/null_vol_connector.c @@ -126,6 +126,11 @@ static const H5VL_class_t null_vol_g = { NULL, /* specific */ NULL /* optional */ }, + { /* token_cls */ + NULL, /* cmp */ + NULL, /* to_str */ + NULL /* from_str */ + }, NULL /* optional */ }; diff --git a/test/objcopy.c b/test/objcopy.c index cabdbfd..5174700 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -168,7 +168,7 @@ unsigned num_attributes_g; /* Number of attributes created */ static struct { size_t nalloc; /* number of slots allocated */ size_t nobjs; /* number of objects */ - haddr_t *obj; /* Addresses of objects seen */ + H5O_token_t *obj; /* Tokens of objects seen */ } idtab_g; /* Local function prototypes */ @@ -191,9 +191,9 @@ compare_attribute_compound_vlstr(hid_t loc, hid_t loc2); /*------------------------------------------------------------------------- - * Function: addr_insert + * Function: token_insert * - * Purpose: Add an address to the table. + * Purpose: Add a token to the table. * * Return: void * @@ -203,7 +203,7 @@ compare_attribute_compound_vlstr(hid_t loc, hid_t loc2); *------------------------------------------------------------------------- */ static void -addr_insert(H5O_info_t *oi) +token_insert(H5O_info2_t *oi) { size_t n; @@ -215,19 +215,19 @@ addr_insert(H5O_info_t *oi) /* Extend the table */ if(idtab_g.nobjs >= idtab_g.nalloc) { idtab_g.nalloc = MAX(256, 2*idtab_g.nalloc); - idtab_g.obj = (haddr_t *)HDrealloc(idtab_g.obj, idtab_g.nalloc * sizeof(idtab_g.obj[0])); + idtab_g.obj = (H5O_token_t *)HDrealloc(idtab_g.obj, idtab_g.nalloc * sizeof(idtab_g.obj[0])); } /* end if */ /* Insert the entry */ n = idtab_g.nobjs++; - idtab_g.obj[n] = oi->addr; -} /* end addr_insert() */ + idtab_g.obj[n] = oi->token; +} /* end token_insert() */ /*------------------------------------------------------------------------- - * Function: addr_lookup + * Function: token_lookup * - * Purpose: Check if address has already been encountered + * Purpose: Check if a token has already been encountered * * Return: Success: TRUE/FALSE * Failure: (can't fail) @@ -238,24 +238,28 @@ addr_insert(H5O_info_t *oi) *------------------------------------------------------------------------- */ static H5_ATTR_PURE hbool_t -addr_lookup(H5O_info_t *oi) +token_lookup(hid_t loc_id, H5O_info2_t *oi) { - size_t n; + size_t n; + int token_cmp; if(oi->rc < 2) return FALSE; /*only one link possible*/ - for(n = 0; n < idtab_g.nobjs; n++) - if(H5F_addr_eq(idtab_g.obj[n], oi->addr)) + for(n = 0; n < idtab_g.nobjs; n++) { + if(H5Otoken_cmp(loc_id, &idtab_g.obj[n], &oi->token, &token_cmp) < 0) + return FALSE; + if(!token_cmp) return TRUE; + } return FALSE; -} /* end addr_lookup() */ +} /* end token_lookup() */ /*------------------------------------------------------------------------- - * Function: addr_reset + * Function: token_reset * - * Purpose: Reset the address tracking data structures + * Purpose: Reset the token tracking data structures * * Return: void * @@ -265,13 +269,13 @@ addr_lookup(H5O_info_t *oi) *------------------------------------------------------------------------- */ static void -addr_reset(void) +token_reset(void) { if(idtab_g.obj) HDfree(idtab_g.obj); idtab_g.obj = NULL; idtab_g.nalloc = idtab_g.nobjs = 0; -} /* end addr_reset() */ +} /* end token_reset() */ /*------------------------------------------------------------------------- @@ -852,7 +856,7 @@ static int compare_std_attributes(hid_t oid, hid_t oid2, hid_t pid) { hid_t aid = -1, aid2 = -1; /* Attribute IDs */ - H5O_info_t oinfo1, oinfo2; /* Object info */ + H5O_info2_t oinfo1, oinfo2; /* Object info */ unsigned cpy_flags; /* Object copy flags */ /* Retrieve the object copy flags from the property list, if it's non-DEFAULT */ @@ -863,10 +867,10 @@ compare_std_attributes(hid_t oid, hid_t oid2, hid_t pid) cpy_flags = 0; /* Check the number of attributes on source dataset */ - if(H5Oget_info2(oid, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR + if(H5Oget_info3(oid, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR /* Check the number of attributes on destination dataset */ - if(H5Oget_info2(oid2, &oinfo2, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR + if(H5Oget_info3(oid2, &oinfo2, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR if(cpy_flags & H5O_COPY_WITHOUT_ATTR_FLAG) { /* Check that the destination has no attributes */ @@ -1055,11 +1059,13 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, /* break the infinite loop when the ref_object points to itself */ if(obj_owner > 0) { - H5O_info_t oinfo1, oinfo2; + H5O_info2_t oinfo1, oinfo2; + int token_cmp; - if(H5Oget_info2(obj_owner, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(obj1_id, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5F_addr_eq(oinfo1.addr, oinfo2.addr)) { + if(H5Oget_info3(obj_owner, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Oget_info3(obj1_id, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(obj1_id, &oinfo1.token, &oinfo2.token, &token_cmp) < 0) TEST_ERROR + if(!token_cmp) { if(H5Oclose(obj1_id) < 0) TEST_ERROR if(H5Oclose(obj2_id) < 0) TEST_ERROR return TRUE; @@ -1116,11 +1122,13 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, /* break the infinite loop when the ref_object points to itself */ if(obj_owner > 0) { - H5O_info_t oinfo1, oinfo2; + H5O_info2_t oinfo1, oinfo2; + int token_cmp; - if(H5Oget_info2(obj_owner, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(obj1_id, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5F_addr_eq(oinfo1.addr, oinfo2.addr)) { + if(H5Oget_info3(obj_owner, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Oget_info3(obj1_id, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(obj1_id, &oinfo1.token, &oinfo2.token, &token_cmp) < 0) TEST_ERROR + if(!token_cmp) { if(H5Oclose(obj1_id) < 0) TEST_ERROR if(H5Oclose(obj2_id) < 0) TEST_ERROR return TRUE; @@ -1273,7 +1281,7 @@ compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf) /* Check that the space used is the same */ /* (Don't check if the dataset is filtered (i.e. compressed, etc.) and - * the datatype is VLEN, since the addresses for the vlen + * the datatype is VLEN, since the tokens for the vlen * data in each dataset will (probably) be different and the storage * size will thus vary) */ @@ -1394,8 +1402,8 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) if(ginfo2.nlinks > 0) { char objname[NAME_BUF_SIZE]; /* Name of object in group */ char objname2[NAME_BUF_SIZE]; /* Name of object in group */ - H5L_info_t linfo; /* Link information */ - H5L_info_t linfo2; /* Link information */ + H5L_info2_t linfo; /* Link information */ + H5L_info2_t linfo2; /* Link information */ /* Loop over contents of groups */ for(idx = 0; idx < ginfo.nlinks; idx++) { @@ -1405,18 +1413,24 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) if(HDstrcmp(objname, objname2)) TEST_ERROR /* Get link info */ - if(H5Lget_info(gid, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(gid2, objname2, &linfo2, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(gid, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(gid2, objname2, &linfo2, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.type != linfo2.type) TEST_ERROR /* Extra checks for "real" objects */ if(linfo.type == H5L_TYPE_HARD) { - hid_t oid, oid2; /* IDs of objects within group */ - H5O_info_t oinfo, oinfo2; /* Object info */ + hid_t oid, oid2; /* IDs of objects within group */ + H5O_info2_t oinfo, oinfo2; /* Data model object info */ + H5O_native_info_t ninfo, ninfo2; /* Native file format object info */ /* Compare some pieces of the object info */ - if(H5Oget_info_by_name2(gid, objname, &oinfo, H5O_INFO_BASIC|H5O_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(gid2, objname2, &oinfo2, H5O_INFO_BASIC|H5O_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR + /* Get data model object info */ + if(H5Oget_info_by_name3(gid, objname, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(gid2, objname2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + + /* Get native object info */ + if(H5Oget_native_info_by_name(gid, objname, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_native_info_by_name(gid2, objname2, &ninfo2, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR if(oinfo.type != oinfo2.type) TEST_ERROR if(oinfo.rc != oinfo2.rc) TEST_ERROR @@ -1427,17 +1441,17 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) * of messages hasn't increased. */ if(H5O_COPY_PRESERVE_NULL_FLAG & copy_flags) { - if(oinfo.hdr.nmesgs != oinfo2.hdr.nmesgs) + if(ninfo.hdr.nmesgs != ninfo2.hdr.nmesgs) ; else - if(oinfo.hdr.nmesgs < oinfo2.hdr.nmesgs) TEST_ERROR + if(ninfo.hdr.nmesgs < ninfo2.hdr.nmesgs) TEST_ERROR } /* Check for object already having been compared */ - if(addr_lookup(&oinfo)) + if(token_lookup(gid, &oinfo)) continue; else - addr_insert(&oinfo); + token_insert(&oinfo); /* Open objects */ if((oid = H5Oopen(gid, objname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -1580,8 +1594,8 @@ test_copy_named_datatype(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -1605,7 +1619,7 @@ test_copy_named_datatype(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the datatype from SRC to DST */ @@ -1673,8 +1687,8 @@ test_copy_named_datatype_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_ h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -1698,7 +1712,7 @@ test_copy_named_datatype_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_ /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the datatype from SRC to DST */ @@ -1766,8 +1780,8 @@ test_copy_named_datatype_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -1797,7 +1811,7 @@ test_copy_named_datatype_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the datatype from SRC to DST */ @@ -1861,10 +1875,11 @@ test_copy_named_datatype_attr_self(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap hid_t aid = -1; /* Attribute ID */ hid_t sid = -1; /* Dataspace ID */ hsize_t dims[2] = {3, 4}; /* Dataspace dimensions */ - H5O_info_t oinfo, oinfo2; /* Object info */ + H5O_info2_t oinfo, oinfo2; /* Object info */ H5G_info_t ginfo; /* Group info */ - char src_filename[NAME_BUF_SIZE]; - char dst_filename[NAME_BUF_SIZE]; + hbool_t same_type; + char src_filename[NAME_BUF_SIZE]; + char dst_filename[NAME_BUF_SIZE]; TESTING("H5Ocopy(): named datatype with self-referential attribute"); @@ -1872,8 +1887,8 @@ test_copy_named_datatype_attr_self(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -1912,7 +1927,7 @@ test_copy_named_datatype_attr_self(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the datatype from SRC to DST */ @@ -1939,10 +1954,20 @@ test_copy_named_datatype_attr_self(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* verify that the attribute's datatype is committed */ if(H5Tcommitted(tid) != TRUE) TEST_ERROR - /* verify that the addresses of the datatypes are the same */ - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(tid2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.fileno != oinfo2.fileno || oinfo.addr != oinfo2.addr) + /* verify that the tokens of the datatypes are the same */ + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Oget_info3(tid2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR + + same_type = TRUE; + if(oinfo.fileno == oinfo2.fileno) { + int token_cmp; + if(H5Otoken_cmp(tid2, &oinfo.token, &oinfo2.token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) same_type = FALSE; + } + else + same_type = FALSE; + + if(!same_type) FAIL_PUTS_ERROR("destination attribute does not use the same committed datatype") /* Verify that there are only 2 links int he destination root group */ @@ -2015,8 +2040,8 @@ test_copy_dataset_simple(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -2053,7 +2078,7 @@ test_copy_dataset_simple(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -2144,8 +2169,8 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src) h5_fixname(FILENAME[4], fapl_src, src_fname, sizeof src_fname); h5_fixname(FILENAME[5], fapl_dst, dst_fname, sizeof dst_fname); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* Create source file */ fid_src = H5Fcreate(src_fname, H5F_ACC_TRUNC, fcpl_src, fapl_src); @@ -2202,7 +2227,7 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src) fid_dst = H5Fcreate(dst_fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_dst); if (fid_dst < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -2306,8 +2331,8 @@ test_copy_dataset_simple_samefile(hid_t fcpl, hid_t fapl) /* Initialize the filenames */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR @@ -2413,8 +2438,8 @@ test_copy_dataset_simple_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -2451,7 +2476,7 @@ test_copy_dataset_simple_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -2537,8 +2562,8 @@ test_copy_dataset_compound(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -2582,7 +2607,7 @@ test_copy_dataset_compound(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -2669,8 +2694,8 @@ test_copy_dataset_chunked(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -2867,7 +2892,7 @@ test_copy_dataset_chunked(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the datasets from SRC to DST */ @@ -3072,8 +3097,8 @@ test_copy_dataset_chunked_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -3265,7 +3290,7 @@ test_copy_dataset_chunked_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the datasets from SRC to DST */ @@ -3482,8 +3507,8 @@ test_copy_dataset_chunked_sparse(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -3640,7 +3665,7 @@ test_copy_dataset_chunked_sparse(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the datasets from SRC to DST */ @@ -3795,8 +3820,8 @@ test_copy_dataset_compressed(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -3942,7 +3967,7 @@ test_copy_dataset_compressed(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -4129,8 +4154,8 @@ test_copy_dataset_no_edge_filt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -4180,7 +4205,7 @@ test_copy_dataset_no_edge_filt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -4276,8 +4301,8 @@ test_copy_dataset_compact(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -4323,7 +4348,7 @@ test_copy_dataset_compact(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -4408,8 +4433,8 @@ test_copy_dataset_external(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -4450,7 +4475,7 @@ test_copy_dataset_external(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -4530,8 +4555,8 @@ test_copy_dataset_named_dtype(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hi h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -4571,7 +4596,7 @@ test_copy_dataset_named_dtype(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hi /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -4652,8 +4677,8 @@ test_copy_dataset_named_dtype_hier(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -4708,7 +4733,7 @@ test_copy_dataset_named_dtype_hier(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -4791,8 +4816,8 @@ test_copy_dataset_named_dtype_hier_outside(hid_t fcpl_src, hid_t fcpl_dst, hid_t h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -4847,7 +4872,7 @@ test_copy_dataset_named_dtype_hier_outside(hid_t fcpl_src, hid_t fcpl_dst, hid_t /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -4936,8 +4961,8 @@ test_copy_dataset_multi_ohdr_chunks(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fa h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -4991,7 +5016,7 @@ test_copy_dataset_multi_ohdr_chunks(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fa /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -5078,8 +5103,8 @@ test_copy_dataset_attr_named_dtype(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -5137,7 +5162,7 @@ test_copy_dataset_attr_named_dtype(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -5224,8 +5249,8 @@ test_copy_dataset_contig_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_ h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -5258,7 +5283,7 @@ test_copy_dataset_contig_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_ /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -5362,8 +5387,8 @@ test_copy_dataset_chunked_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -5417,7 +5442,7 @@ test_copy_dataset_chunked_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -5545,8 +5570,8 @@ test_copy_dataset_compact_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -5586,7 +5611,7 @@ test_copy_dataset_compact_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -5677,8 +5702,8 @@ test_copy_attribute_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -5712,7 +5737,7 @@ test_copy_attribute_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -5970,8 +5995,8 @@ test_copy_attribute_compound_vlstr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) @@ -6026,7 +6051,7 @@ test_copy_attribute_compound_vlstr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) FAIL_STACK_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -6152,8 +6177,8 @@ test_copy_dataset_compressed_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -6195,7 +6220,7 @@ test_copy_dataset_compressed_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -6285,8 +6310,8 @@ test_copy_group_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_ h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -6310,7 +6335,7 @@ test_copy_group_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_ /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the group from SRC to DST */ @@ -6389,8 +6414,8 @@ test_copy_root_group(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_f h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -6438,7 +6463,7 @@ test_copy_root_group(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_f /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the group from SRC to DST */ @@ -6520,8 +6545,8 @@ test_copy_group(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl) h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -6570,7 +6595,7 @@ test_copy_group(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl) /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the group from SRC to DST */ @@ -6653,8 +6678,8 @@ test_copy_group_deep(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_f h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -6712,7 +6737,7 @@ test_copy_group_deep(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_f /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the group from SRC to DST */ @@ -6784,8 +6809,8 @@ test_copy_group_loop(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_f h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -6823,7 +6848,7 @@ test_copy_group_loop(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_f /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the group from SRC to DST */ @@ -6901,8 +6926,8 @@ test_copy_group_wide_loop(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -6952,7 +6977,7 @@ test_copy_group_wide_loop(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the group from SRC to DST */ @@ -7018,7 +7043,7 @@ test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_ hid_t plid = -1; /* Object copy plist ID */ hsize_t dim2d[2]; hsize_t dim1d[1]; - H5L_info_t linfo; + H5L_info2_t linfo; int buf[DIM_SIZE_1][DIM_SIZE_2]; int i, j; unsigned expand_soft; @@ -7040,8 +7065,8 @@ test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_ h5_fixname(FILENAME[1], src_fapl, dst_filename, sizeof dst_filename); h5_fixname(FILENAME[2], dst_fapl, ext_filename, sizeof ext_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -7135,7 +7160,7 @@ test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_ /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the group from SRC to DST */ @@ -7152,7 +7177,7 @@ test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_ * re-add it as a soft link so compare_groups() works */ if(expand_soft) { /* Check link type */ - if(H5Lget_info(fid_dst, NAME_LINK_SOFT, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid_dst, NAME_LINK_SOFT, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.type != H5L_TYPE_HARD) FAIL_PUTS_ERROR("Soft link was not expanded to a hard link") @@ -7175,7 +7200,7 @@ test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_ * and re-add it as an external link so compare_groups() works */ if(expand_ext) { /* Check link type */ - if(H5Lget_info(fid_dst, NAME_LINK_EXTERN, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid_dst, NAME_LINK_EXTERN, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.type != H5L_TYPE_HARD) FAIL_PUTS_ERROR("External link was not expanded to a hard link") @@ -7295,8 +7320,8 @@ test_copy_soft_link(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fa h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -7341,7 +7366,7 @@ test_copy_soft_link(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fa /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -7425,8 +7450,8 @@ test_copy_ext_link(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fap h5_fixname(FILENAME[1], src_fapl, dst_filename, sizeof dst_filename); h5_fixname(FILENAME[2], dst_fapl, ext_filename, sizeof ext_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -7474,7 +7499,7 @@ test_copy_ext_link(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fap /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -7558,8 +7583,8 @@ test_copy_exist(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl) h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -7596,7 +7621,7 @@ test_copy_exist(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl) /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -7667,8 +7692,8 @@ test_copy_path(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl) h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -7705,7 +7730,7 @@ test_copy_path(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl) /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST (should fail - intermediate groups not there) */ @@ -7789,8 +7814,8 @@ test_copy_same_file_named_datatype(hid_t fcpl_src, hid_t fapl) /* Initialize the filenames */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR @@ -7868,8 +7893,8 @@ test_copy_old_layout(hid_t fcpl_dst, hid_t fapl, hbool_t test_open) /* Initialize the destination filename */ h5_fixname(FILENAME[1], fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* Setup */ if((src_fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR @@ -7883,7 +7908,7 @@ test_copy_old_layout(hid_t fcpl_dst, hid_t fapl, hbool_t test_open) /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(test_open) { @@ -7975,8 +8000,8 @@ test_copy_dataset_compact_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -8025,7 +8050,7 @@ test_copy_dataset_compact_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -8129,8 +8154,8 @@ test_copy_dataset_contig_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -8172,7 +8197,7 @@ test_copy_dataset_contig_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -8284,8 +8309,8 @@ test_copy_dataset_chunked_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -8337,7 +8362,7 @@ test_copy_dataset_chunked_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -8445,8 +8470,8 @@ test_copy_dataset_compressed_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_ h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -8496,7 +8521,7 @@ test_copy_dataset_compressed_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_ /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -8615,8 +8640,8 @@ test_copy_dataset_compact_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -8659,7 +8684,7 @@ test_copy_dataset_compact_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -8785,8 +8810,8 @@ test_copy_dataset_contig_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -8830,7 +8855,7 @@ test_copy_dataset_contig_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -8951,8 +8976,8 @@ test_copy_dataset_chunked_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -9159,8 +9184,8 @@ test_copy_dataset_compressed_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -9326,8 +9351,8 @@ test_copy_dataset_contig_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -9364,7 +9389,7 @@ test_copy_dataset_contig_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -9472,8 +9497,8 @@ test_copy_dataset_chunked_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -9517,7 +9542,7 @@ test_copy_dataset_chunked_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -9625,8 +9650,8 @@ test_copy_dataset_compact_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -9670,7 +9695,7 @@ test_copy_dataset_compact_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -9776,8 +9801,8 @@ test_copy_null_ref(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fap h5_fixname(FILENAME[1], src_fapl, mid_filename, sizeof mid_filename); h5_fixname(FILENAME[2], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* Create source file */ if((fid1 = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) @@ -9945,8 +9970,8 @@ test_copy_null_ref_open(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t ds h5_fixname(FILENAME[1], src_fapl, mid_filename, sizeof mid_filename); h5_fixname(FILENAME[2], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* Create source file */ if((fid1 = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) @@ -10107,8 +10132,8 @@ test_copy_attr_crt_order(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], src_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* Create source file */ if((fid1 = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) @@ -10225,11 +10250,12 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap unsigned int i; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ int buf[DIM_SIZE_1]; /* Buffer for writing data */ - H5O_info_t oinfo; /* Object info */ - haddr_t exp_addr; /* Expected object address */ + H5O_info2_t oinfo; /* Object info */ + H5O_token_t exp_token; /* Expected object token */ char src1_filename[NAME_BUF_SIZE]; char src2_filename[NAME_BUF_SIZE]; char dst_filename[NAME_BUF_SIZE]; + int token_cmp; if(reopen) { TESTING("H5Ocopy(): merging committed datatypes with reopen") @@ -10246,8 +10272,8 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap h5_fixname(FILENAME[3], src_fapl, src2_filename, sizeof src2_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source files */ if((fid_src1 = H5Fcreate(src1_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -10323,7 +10349,7 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy SRC1 to DST */ @@ -10338,31 +10364,34 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open SRC1 committed dtype, get address */ + /* Open SRC1 committed dtype, get token */ if((tid = H5Topen2(fid_dst, NAME_GROUP_TOP "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open SRC1 dset dtype, check address */ + /* Open SRC1 dset dtype, check token */ if((did = H5Dopen2(fid_dst, NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open SRC2 committed dtype, check address */ + /* Open SRC2 committed dtype, check token */ if((tid = H5Topen2(fid_dst, NAME_GROUP_TOP2 "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR - /* Open SRC2 dset dtype, check address */ + /* Open SRC2 dset dtype, check token */ if((did = H5Dopen2(fid_dst, NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10376,7 +10405,7 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* recreate destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy SRC1 to DST */ @@ -10391,19 +10420,20 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open SRC1 dset dtype, get address */ + /* Open SRC1 dset dtype, get token */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open SRC2 dset dtype, check address */ + /* Open SRC2 dset dtype, check token */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10463,9 +10493,10 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo unsigned int i; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ int buf[DIM_SIZE_1]; /* Buffer for writing data */ - H5O_info_t oinfo; /* Object info */ - haddr_t exp_addr; /* Expected object address */ + H5O_info2_t oinfo; /* Object info */ + H5O_token_t exp_token; /* Expected object token */ char filename[NAME_BUF_SIZE]; + int token_cmp; if(reopen) TESTING("H5Ocopy(): merging committed datatypes to the source file with reopen") @@ -10479,8 +10510,8 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo /* Initialize the filename */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create file */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR @@ -10553,7 +10584,7 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo /* * First copy each group to the destination group 3 (each with their own * group), and verify the committed datatypes are merged as expected. All - * datatypes copied should reference (share an address with) the + * datatypes copied should reference (share a token with) the * corresponding source datatype. */ /* Create destination group */ @@ -10572,61 +10603,68 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR } /* end if */ - /* Open group 1 source committed dtype, get address */ + /* Open group 1 source committed dtype, get token */ if((tid = H5Topen2(fid, NAME_GROUP_TOP "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open group 1 source dset dtype, check address */ + /* Open group 1 source dset dtype, check token */ if((did = H5Dopen2(fid, NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open group 1 committed dtype, check address */ + /* Open group 1 committed dtype, check token */ if((tid = H5Topen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR - /* Open group 1 dset dtype, check address */ + /* Open group 1 dset dtype, check token */ if((did = H5Dopen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open group 2 source committed dtype, get address and make sure it is + /* Open group 2 source committed dtype, get token and make sure it is * different from group 1 source committed dtype */ if((tid = H5Topen2(fid, NAME_GROUP_TOP2 "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr == exp_addr) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(!token_cmp) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open group 2 source dset dtype, check address */ + /* Open group 2 source dset dtype, check token */ if((did = H5Dopen2(fid, NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open group 2 committed dtype, check address */ + /* Open group 2 committed dtype, check token */ if((tid = H5Topen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP2 "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR - /* Open group 2 dset dtype, check address */ + /* Open group 2 dset dtype, check token */ if((did = H5Dopen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10650,37 +10688,40 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR } /* end if */ - /* Open group 1 source dset dtype, get address */ + /* Open group 1 source dset dtype, get token */ if((did = H5Dopen2(fid, NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open group 1 dset dtype, check address */ + /* Open group 1 dset dtype, check token */ if((did = H5Dopen2(fid, NAME_GROUP_TOP4 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open group 2 source dset dtype, get address and make sure it is + /* Open group 2 source dset dtype, get token and make sure it is * different from group 1 source dset dtype */ if((did = H5Dopen2(fid, NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr == exp_addr) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(!token_cmp) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open group 2 dset dtype, check address */ + /* Open group 2 dset dtype, check token */ if((did = H5Dopen2(fid, NAME_GROUP_TOP4 "/" NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10736,10 +10777,11 @@ test_copy_committed_dt_merge_sugg(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl unsigned int i; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ int buf[DIM_SIZE_1]; /* Buffer for writing data */ - H5O_info_t oinfo; /* Object info */ - haddr_t exp_addr; /* Expected object address */ + H5O_info2_t oinfo; /* Object info */ + H5O_token_t exp_token; /* Expected object token */ char src_filename[NAME_BUF_SIZE]; char dst_filename[NAME_BUF_SIZE]; + int token_cmp; if(reopen) TESTING("H5Ocopy(): merging committed datatypes with suggestions and reopen") @@ -10754,8 +10796,8 @@ test_copy_committed_dt_merge_sugg(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -10844,17 +10886,18 @@ test_copy_committed_dt_merge_sugg(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open committed dtype "b", get address */ + /* Open committed dtype "b", get token */ if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open dset dtype, check address */ + /* Open dset dtype, check token */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10882,31 +10925,33 @@ test_copy_committed_dt_merge_sugg(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open committed dtype "a", get address */ + /* Open committed dtype "a", get token */ if((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open dset 2 dtype, check address */ + /* Open dset 2 dtype, check token */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open committed dtype "b", get address */ + /* Open committed dtype "b", get token */ if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open dset dtype, check address */ + /* Open dset dtype, check token */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10967,10 +11012,11 @@ test_copy_committed_dt_merge_attr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl unsigned int i; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ int buf[DIM_SIZE_1]; /* Buffer for writing data */ - H5O_info_t oinfo; /* Object info */ - haddr_t exp_addr; /* Expected object address */ + H5O_info2_t oinfo; /* Object info */ + H5O_token_t exp_token; /* Expected object token */ char src_filename[NAME_BUF_SIZE]; char dst_filename[NAME_BUF_SIZE]; + int token_cmp; if(reopen) TESTING("H5Ocopy(): merging committed datatypes with attributes and reopen") @@ -10985,8 +11031,8 @@ test_copy_committed_dt_merge_attr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -11078,19 +11124,20 @@ test_copy_committed_dt_merge_attr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open attribute dtype, get address */ + /* Open attribute dtype, get token */ if((aid = H5Aopen_by_name(fid_dst, NAME_GROUP_TOP, "attr", H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Aget_type(aid)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR if(H5Aclose(aid) < 0) TEST_ERROR - /* Open dset dtype, check address */ + /* Open dset dtype, check token */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -11198,10 +11245,11 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d int i; /* Local index variable */ hsize_t dim1d[1]; /* dimension sizes */ int buf[DIM_SIZE_1]; /* Buffer for data */ - haddr_t exp_addr_int, exp_addr_short; /* Expected object addresses */ - H5O_info_t oinfo; /* Object info */ + H5O_token_t exp_token_int, exp_token_short; /* Expected object tokenes */ + H5O_info2_t oinfo; /* Object info */ char src_filename[NAME_BUF_SIZE]; /* Source file name */ char dst_filename[NAME_BUF_SIZE]; /* Destination file name */ + int token_cmp; if(reopen) TESTING("H5Ocopy(): hier. of committed datatypes and merging with reopen") @@ -11216,8 +11264,8 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* * Populate source file @@ -11338,16 +11386,16 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d */ if(H5Ocopy(fid_src, "/", fid_dst, SRC_ROOT_GROUP, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR - /* get address of committed datatype at root group */ + /* get token of committed datatype at root group */ if((tid = H5Topen2(fid_dst, SRC_ROOT_GROUP "/" ROOT_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr_int = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token_int, &oinfo.token, sizeof(exp_token_int)); if(H5Tclose(tid) < 0) TEST_ERROR - /* get address of committed datatype at /g0 */ + /* get token of committed datatype at /g0 */ if((tid = H5Topen2(fid_dst, SRC_ROOT_GROUP NAME_GROUP_TOP "/" GROUP_NDT_SHORT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr_short = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token_short, &oinfo.token, sizeof(exp_token_short)); if(H5Tclose(tid) < 0) TEST_ERROR /* verify the datatype of first dataset is not committed */ @@ -11357,19 +11405,21 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* check address of datatype for second dataset */ + /* check token of datatype for second dataset */ if((did = H5Dopen2(fid_dst, SRC_ROOT_GROUP NAME_GROUP_TOP "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr_short) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_short, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* check address of datatype for third dataset */ + /* check token of datatype for third dataset */ if((did = H5Dopen2(fid_dst, SRC_ROOT_GROUP NAME_GROUP_TOP "/" SRC_NDT_DSET3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr_int) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_int, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -11378,10 +11428,11 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d */ if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR - /* get address of committed datatype at /g0 */ + /* get token of committed datatype at /g0 */ if((tid = H5Topen2(fid_dst, NAME_GROUP_TOP "/" GROUP_NDT_SHORT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr_short) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_short, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR /* verify the datatype of first dataset is not committed */ @@ -11391,19 +11442,21 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* check address of datatype for second dataset */ + /* check token of datatype for second dataset */ if((did = H5Dopen2(fid_dst, NAME_GROUP_TOP "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr_short) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_short, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* check address of datatype for third dataset */ + /* check token of datatype for third dataset */ if((did = H5Dopen2(fid_dst, NAME_GROUP_TOP "/" SRC_NDT_DSET3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr_int) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_int, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -11414,19 +11467,21 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d if(H5Ocopy(fid_src, NAME_GROUP_TOP "/" SRC_NDT_DSET2, fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET2, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR if(H5Ocopy(fid_src, NAME_GROUP_TOP "/" SRC_NDT_DSET3, fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET3, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR - /* Open attribute with anon ndt (short), get address */ + /* Open attribute with anon ndt (short), get token */ if((aid = H5Aopen_by_name(fid_dst, NAME_GROUP_UNCOPIED, DST_ATTR_ANON_SHORT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Aget_type(aid)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr_short) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_short, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Aclose(aid) < 0) TEST_ERROR - /* Open attribute with anon ndt (int), get address */ + /* Open attribute with anon ndt (int), get token */ if((aid = H5Aopen_by_name(fid_dst, NAME_GROUP_UNCOPIED, DST_ATTR_ANON_INT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Aget_type(aid)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr_int) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_int, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Aclose(aid) < 0) TEST_ERROR @@ -11437,19 +11492,21 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* check address of datatype for second dataset */ + /* check token of datatype for second dataset */ if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr_short) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_short, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* check address of datatype for third dataset */ + /* check token of datatype for third dataset */ if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr_int) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_int, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -11522,10 +11579,11 @@ test_copy_cdt_merge_cdt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t ds hid_t aid = -1; /* Attribute ID */ hid_t ocpypl_id = -1; /* Object copy plist ID */ hsize_t dim1d[1]; /* dimension sizes */ - H5O_info_t oinfo; /* Object info */ - haddr_t exp_addr; /* Expected object addresses */ + H5O_info2_t oinfo; /* Object info */ + H5O_token_t exp_token; /* Expected object token */ char src_filename[NAME_BUF_SIZE]; /* Source file name */ char dst_filename[NAME_BUF_SIZE]; /* Destination file name */ + int token_cmp; if(reopen) TESTING("H5Ocopy(): merging various committed datatypes with reopen") @@ -11536,8 +11594,8 @@ test_copy_cdt_merge_cdt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t ds h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* * Populate source file @@ -11649,53 +11707,57 @@ test_copy_cdt_merge_cdt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t ds /* * Verification */ - /* get address of committed datatype: /src_root/src_ndt_double */ + /* get token of committed datatype: /src_root/src_ndt_double */ if((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_DOUBLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* get address of committed datatype: /dst_ndt_double */ + /* get token of committed datatype: /dst_ndt_double */ if((tid = H5Topen2(fid_dst, "/" DST_NDT_DOUBLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR - /* get address of committed datatype: /src_root/src_ndt_float */ + /* get token of committed datatype: /src_root/src_ndt_float */ if((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_FLOAT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* get address of committed datatype: /dst_ndt_float */ + /* get token of committed datatype: /dst_ndt_float */ if((tid = H5Topen2(fid_dst, "/" DST_NDT_FLOAT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR - /* get address of committed datatype: /src_root/src_ndt_int */ + /* get token of committed datatype: /src_root/src_ndt_int */ if((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* get address of committed datatype: /dst_ndt_int */ + /* get token of committed datatype: /dst_ndt_int */ if((tid = H5Topen2(fid_dst, "/" DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR - /* get address of committed datatype: /src_root/src_ndt_short */ + /* get token of committed datatype: /src_root/src_ndt_short */ if((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_SHORT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* open attribute; get its dtype; get dtype's address: /src_root/src_ndt_double/dst_attr */ + /* open attribute; get its dtype; get dtype's token: /src_root/src_ndt_double/dst_attr */ if((aid = H5Aopen_by_name(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_DOUBLE, DST_ATTR, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Aget_type(aid)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Aclose(aid) < 0) TEST_ERROR @@ -11748,10 +11810,11 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t tid = -1; /* Datatype ID */ hid_t ocpypl_id = -1; /* Object copy plist ID */ - H5O_info_t oinfo; /* Object info */ - haddr_t exp_addr; /* Expected object address */ + H5O_info2_t oinfo; /* Object info */ + H5O_token_t exp_token; /* Expected object token */ char src_filename[NAME_BUF_SIZE]; char dst_filename[NAME_BUF_SIZE]; + int token_cmp; if(reopen) TESTING("H5Ocopy(): merging committed datatypes with suggestions and reopen") @@ -11762,8 +11825,8 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* * Populate source file @@ -11823,16 +11886,17 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* open committed dtype "/dst_ndt_int", get its address */ + /* open committed dtype "/dst_ndt_int", get its token */ if((tid = H5Topen2(fid_dst, DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* check address of "/uncopied/src_ndt_int" */ + /* check token of "/uncopied/src_ndt_int" */ if((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR /* close the DST file */ @@ -11856,16 +11920,17 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* open committed dtype "/uncopied/src_ndt_int", get its address */ + /* open committed dtype "/uncopied/src_ndt_int", get its token */ if((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* check address of "/src_ndt_int" */ + /* check token of "/src_ndt_int" */ if((tid = H5Topen2(fid_dst, SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR /* close the DST file */ @@ -11894,16 +11959,17 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open committed dtype "/uncopied/src_ndt_int", get its address */ + /* Open committed dtype "/uncopied/src_ndt_int", get its token */ if((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* check address of "/src_ndt_int2" */ + /* check token of "/src_ndt_int2" */ if((tid = H5Topen2(fid_dst, SRC_NDT_INT2, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR /* close the DST file */ @@ -11928,16 +11994,17 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open committed dtype "/dst_dt_int", get its address */ + /* Open committed dtype "/dst_dt_int", get its token */ if((tid = H5Topen2(fid_dst, DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* check address of "/uncopied/src_ndt_int2" */ + /* check token of "/uncopied/src_ndt_int2" */ if((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT2, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR /* close the DST file */ @@ -11988,10 +12055,11 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, unsigned int i; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ int buf[DIM_SIZE_1]; /* Buffer for writing data */ - H5O_info_t oinfo; /* Object info */ - haddr_t exp_addr; /* Expected object address */ + H5O_info2_t oinfo; /* Object info */ + H5O_token_t exp_token; /* Expected object token */ char src_filename[NAME_BUF_SIZE]; char dst_filename[NAME_BUF_SIZE]; + int token_cmp; if(reopen) TESTING("H5Ocopy(): merging committed datatypes of datasets with suggestions and reopen") @@ -12006,8 +12074,8 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* * Populate source file @@ -12084,17 +12152,18 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open committed dtype "/dst_ndt_int", get its address */ + /* Open committed dtype "/dst_ndt_int", get its token */ if((tid = H5Topen2(fid_dst, DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* check address of datatype for the copied dataset: "/uncopied/src_ndt_dset" */ + /* check token of datatype for the copied dataset: "/uncopied/src_ndt_dset" */ if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12119,19 +12188,20 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open committed dtype dataset "/uncopied/src_ndt_dset", get its datatype address */ + /* Open committed dtype dataset "/uncopied/src_ndt_dset", get its datatype token */ if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* check address of datatype for the copied dataset: "/src_ndt_dset" */ + /* check token of datatype for the copied dataset: "/src_ndt_dset" */ if((did = H5Dopen2(fid_dst, SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12161,19 +12231,20 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* open the copied dataset: /uncopied/src_ndt_dset", get its address */ + /* open the copied dataset: /uncopied/src_ndt_dset", get its token */ if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* check address of datatype for the copied dataset: "/src_ndt_dset2" */ + /* check token of datatype for the copied dataset: "/src_ndt_dset2" */ if((did = H5Dopen2(fid_dst, SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12199,19 +12270,20 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* open the copied dataset: "/src_ndt_dset", get its datatype address */ + /* open the copied dataset: "/src_ndt_dset", get its datatype token */ if((did = H5Dopen2(fid_dst, SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* check address of datatype for the copied dataset: /uncopied/src_ndt_dset2 */ + /* check token of datatype for the copied dataset: /uncopied/src_ndt_dset2 */ if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12279,8 +12351,8 @@ test_copy_cdt_merge_all_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* * Populate source file @@ -12544,7 +12616,7 @@ test_copy_cdt_merge_all_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* open committed dtype "/dst_grp/dst_dt_int", get its address */ + /* open committed dtype "/dst_grp/dst_dt_int", get its token */ if((exp_tid = H5Topen2(fid_dst, "/" DST_GRP "/" DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR /* open datatype of dataset */ @@ -12637,7 +12709,7 @@ test_copy_cdt_merge_all_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((aid = H5Aopen_by_name(fid_dst, DST_NDT_DOUBLE, DST_ATTR, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if((exp_tid = H5Aget_type(aid)) < 0) TEST_ERROR - /* Open datatype of dataset, check address */ + /* Open datatype of dataset, check token */ if((did = H5Dopen2(fid_dst, "A_src_dset", H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR @@ -12674,7 +12746,7 @@ test_copy_cdt_merge_all_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* open committed dtype "/dst_ndt_short" */ if((exp_tid = H5Topen2(fid_dst, "/" DST_NDT_SHORT, H5P_DEFAULT)) < 0) TEST_ERROR - /* open datatype of dataset, check address */ + /* open datatype of dataset, check token */ if((did = H5Dopen2(fid_dst, "B_src_dset", H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR @@ -12756,11 +12828,12 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, unsigned int i; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ int buf[DIM_SIZE_1]; /* Buffer for writing data */ - H5O_info_t oinfo; /* Object info */ - haddr_t exp_addr; /* Expected object address */ + H5O_info2_t oinfo; /* Object info */ + H5O_token_t exp_token; /* Expected object token */ char src_filename[NAME_BUF_SIZE]; char dst_filename[NAME_BUF_SIZE]; mcdt_search_cb_ud cb_udata; /* User data for callback */ + int token_cmp; if(reopen) TESTING("H5Ocopy(): H5Pset_mcdt_search_cb and reopen") @@ -12775,8 +12848,8 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -12868,17 +12941,18 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open committed dtype "b", get address */ + /* Open committed dtype "b", get token */ if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open dset dtype, check address */ + /* Open dset dtype, check token */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12916,17 +12990,18 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open committed dtype "a", get address */ + /* Open committed dtype "a", get token */ if((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open copied dataset and its dtype, check address */ + /* Open copied dataset and its dtype, check token */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12955,31 +13030,33 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open committed dtype "a", get address */ + /* Open committed dtype "a", get token */ if((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open the copied dataset and get its dtype, addresses should not be equal */ + /* Open the copied dataset and get its dtype, tokens should not be equal */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr == exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(!token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open committed dtype "b", get address */ + /* Open committed dtype "b", get token */ if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open the copied dataset and get its dtype, addresses should not be equal */ + /* Open the copied dataset and get its dtype, tokens should not be equal */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr == exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(!token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -13015,31 +13092,33 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open committed dtype "a", get address */ + /* Open committed dtype "a", get token */ if((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open the copied dataset and get its dtype, addresses should not be equal */ + /* Open the copied dataset and get its dtype, tokens should not be equal */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr == exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(!token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open committed dtype "b", get address */ + /* Open committed dtype "b", get token */ if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open the copied dataset and get its dtype, addresses should not be equal */ + /* Open the copied dataset and get its dtype, tokens should not be equal */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr == exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(!token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -13134,8 +13213,8 @@ test_copy_set_get_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -13382,7 +13461,7 @@ error: */ static herr_t test_copy_iterate_cb(hid_t loc_id, const char *name, - const H5L_info_t H5_ATTR_UNUSED *link_info, void *op_data) + const H5L_info2_t H5_ATTR_UNUSED *link_info, void *op_data) { hid_t dst_loc_id = *((hid_t *)op_data); @@ -13411,8 +13490,8 @@ test_copy_iterate(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], src_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* Create source file */ if((fid1 = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) @@ -13442,8 +13521,7 @@ test_copy_iterate(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl /* Iterate over links in the root group, copying each object */ if((gid = H5Gopen2(fid1, "/", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Literate(gid, H5_INDEX_NAME, H5_ITER_INC, NULL, test_copy_iterate_cb, - &fid2) < 0) + if(H5Literate2(gid, H5_INDEX_NAME, H5_ITER_INC, NULL, test_copy_iterate_cb, &fid2) < 0) TEST_ERROR /* Close */ @@ -13506,8 +13584,8 @@ test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -13641,7 +13719,7 @@ test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl, /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -13827,8 +13905,8 @@ test_copy_dataset_open(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -13836,7 +13914,7 @@ test_copy_dataset_open(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Set dataspace dimensions */ @@ -14373,8 +14451,8 @@ main(void) */ } /* end for */ - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* Verify symbol table messages are cached */ nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); diff --git a/test/objcopy_ref.c b/test/objcopy_ref.c index 4637f23..20c6138 100644 --- a/test/objcopy_ref.c +++ b/test/objcopy_ref.c @@ -72,9 +72,9 @@ unsigned num_attributes_g; /* Number of attributes created */ /* Table containing object id and object name */ /* (Used for detecting duplicate objects when comparing groups */ static struct { - size_t nalloc; /* number of slots allocated */ - size_t nobjs; /* number of objects */ - haddr_t *obj; /* Addresses of objects seen */ + size_t nalloc; /* number of slots allocated */ + size_t nobjs; /* number of objects */ + H5O_token_t *obj; /* tokens for objects seen */ } idtab_g; /* Local function prototypes */ @@ -87,9 +87,9 @@ static int compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags); /*------------------------------------------------------------------------- - * Function: addr_insert + * Function: token_insert * - * Purpose: Add an address to the table. + * Purpose: Add a token to the table. * * Return: void * @@ -99,31 +99,31 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) *------------------------------------------------------------------------- */ static void -addr_insert(H5O_info_t *oi) +token_insert(H5O_info2_t *oinfo) { size_t n; /* Don't add it if the link count is 1 because such an object can only * be encountered once. */ - if(oi->rc < 2) + if(oinfo->rc < 2) return; /* Extend the table */ if(idtab_g.nobjs >= idtab_g.nalloc) { - idtab_g.nalloc = MAX(256, 2*idtab_g.nalloc); - idtab_g.obj = (haddr_t *)HDrealloc(idtab_g.obj, idtab_g.nalloc * sizeof(idtab_g.obj[0])); - } /* end if */ + idtab_g.nalloc = MAX(256, 2 * idtab_g.nalloc); + idtab_g.obj = (H5O_token_t *)HDrealloc(idtab_g.obj, idtab_g.nalloc * sizeof(idtab_g.obj[0])); + } /* Insert the entry */ n = idtab_g.nobjs++; - idtab_g.obj[n] = oi->addr; -} /* end addr_insert() */ + idtab_g.obj[n] = oinfo->token; +} /* end token_insert() */ /*------------------------------------------------------------------------- - * Function: addr_lookup + * Function: token_lookup * - * Purpose: Check if address has already been encountered + * Purpose: Check if a token has already been encountered * * Return: Success: TRUE/FALSE * Failure: (can't fail) @@ -134,24 +134,29 @@ addr_insert(H5O_info_t *oi) *------------------------------------------------------------------------- */ static H5_ATTR_PURE hbool_t -addr_lookup(H5O_info_t *oi) +token_lookup(hid_t loc_id, H5O_info2_t *oinfo) { - size_t n; + size_t n; + int token_cmp; - if(oi->rc < 2) return FALSE; /*only one link possible*/ + if(oinfo->rc < 2) + return FALSE; /*only one link possible*/ - for(n = 0; n < idtab_g.nobjs; n++) - if(H5F_addr_eq(idtab_g.obj[n], oi->addr)) + for(n = 0; n < idtab_g.nobjs; n++) { + if(H5Otoken_cmp(loc_id, &(idtab_g.obj[n]), &oinfo->token, &token_cmp) < 0) + return FALSE; + if(0 == token_cmp) return TRUE; + } return FALSE; -} /* end addr_lookup() */ +} /* end token_lookup() */ /*------------------------------------------------------------------------- - * Function: addr_reset + * Function: token_reset * - * Purpose: Reset the address tracking data structures + * Purpose: Reset the token tracking data structures * * Return: void * @@ -161,13 +166,13 @@ addr_lookup(H5O_info_t *oi) *------------------------------------------------------------------------- */ static void -addr_reset(void) +token_reset(void) { if(idtab_g.obj) HDfree(idtab_g.obj); idtab_g.obj = NULL; idtab_g.nalloc = idtab_g.nobjs = 0; -} /* end addr_reset() */ +} /* end token_reset() */ /*------------------------------------------------------------------------- @@ -625,7 +630,7 @@ static int compare_std_attributes(hid_t oid, hid_t oid2, hid_t pid) { hid_t aid = -1, aid2 = -1; /* Attribute IDs */ - H5O_info_t oinfo1, oinfo2; /* Object info */ + H5O_info2_t oinfo1, oinfo2; /* Object info */ unsigned cpy_flags; /* Object copy flags */ /* Retrieve the object copy flags from the property list, if it's non-DEFAULT */ @@ -636,10 +641,10 @@ compare_std_attributes(hid_t oid, hid_t oid2, hid_t pid) cpy_flags = 0; /* Check the number of attributes on source dataset */ - if(H5Oget_info2(oid, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR + if(H5Oget_info3(oid, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR /* Check the number of attributes on destination dataset */ - if(H5Oget_info2(oid2, &oinfo2, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR + if(H5Oget_info3(oid2, &oinfo2, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR if(cpy_flags & H5O_COPY_WITHOUT_ATTR_FLAG) { /* Check that the destination has no attributes */ @@ -808,11 +813,11 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, /* Check for object or region reference */ if(H5Tequal(tid, H5T_STD_REF) > 0) { - const H5R_ref_t *ref_buf1, *ref_buf2; /* Aliases for buffers to compare */ + H5R_ref_t *ref_buf1, *ref_buf2; /* Aliases for buffers to compare */ /* Loop over elements in buffers */ - ref_buf1 = (const H5R_ref_t *)buf1; - ref_buf2 = (const H5R_ref_t *)buf2; + ref_buf1 = (H5R_ref_t *)buf1; + ref_buf2 = (H5R_ref_t *)buf2; for(u = 0; u < nelmts; u++, ref_buf1++, ref_buf2++) { hid_t obj1_id, obj2_id; /* IDs for objects referenced */ H5O_type_t obj1_type, obj2_type; /* Types of objects referenced */ @@ -828,11 +833,13 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, /* break the infinite loop when the ref_object points to itself */ if(obj_owner > 0) { - H5O_info_t oinfo1, oinfo2; + H5O_info2_t oinfo1, oinfo2; + int token_cmp; - if(H5Oget_info2(obj_owner, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(obj1_id, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5F_addr_eq(oinfo1.addr, oinfo2.addr)) { + if(H5Oget_info3(obj_owner, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Oget_info3(obj1_id, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(obj1_id, &oinfo1.token, &oinfo2.token, &token_cmp) < 0) TEST_ERROR + if(0 == token_cmp) { if(H5Oclose(obj1_id) < 0) TEST_ERROR if(H5Oclose(obj2_id) < 0) TEST_ERROR return TRUE; @@ -1110,8 +1117,8 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) if(ginfo2.nlinks > 0) { char objname[NAME_BUF_SIZE]; /* Name of object in group */ char objname2[NAME_BUF_SIZE]; /* Name of object in group */ - H5L_info_t linfo; /* Link information */ - H5L_info_t linfo2; /* Link information */ + H5L_info2_t linfo; /* Link information */ + H5L_info2_t linfo2; /* Link information */ /* Loop over contents of groups */ for(idx = 0; idx < ginfo.nlinks; idx++) { @@ -1121,18 +1128,24 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) if(HDstrcmp(objname, objname2)) TEST_ERROR /* Get link info */ - if(H5Lget_info(gid, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(gid2, objname2, &linfo2, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(gid, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(gid2, objname2, &linfo2, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.type != linfo2.type) TEST_ERROR /* Extra checks for "real" objects */ if(linfo.type == H5L_TYPE_HARD) { - hid_t oid, oid2; /* IDs of objects within group */ - H5O_info_t oinfo, oinfo2; /* Object info */ + hid_t oid, oid2; /* IDs of objects within group */ + H5O_info2_t oinfo, oinfo2; /* Data model object info */ + H5O_native_info_t ninfo, ninfo2; /* Native file format object info */ /* Compare some pieces of the object info */ - if(H5Oget_info_by_name2(gid, objname, &oinfo, H5O_INFO_BASIC|H5O_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(gid2, objname2, &oinfo2, H5O_INFO_BASIC|H5O_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR + /* Get data model object info */ + if(H5Oget_info_by_name3(gid, objname, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(gid2, objname2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + + /* Get native object info */ + if(H5Oget_native_info_by_name(gid, objname, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_native_info_by_name(gid2, objname2, &ninfo2, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR if(oinfo.type != oinfo2.type) TEST_ERROR if(oinfo.rc != oinfo2.rc) TEST_ERROR @@ -1143,17 +1156,18 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) * of messages hasn't increased. */ if(H5O_COPY_PRESERVE_NULL_FLAG & copy_flags) { - if(oinfo.hdr.nmesgs != oinfo2.hdr.nmesgs) + if(ninfo.hdr.nmesgs != ninfo2.hdr.nmesgs) ; else - if(oinfo.hdr.nmesgs < oinfo2.hdr.nmesgs) TEST_ERROR + if(ninfo.hdr.nmesgs < ninfo2.hdr.nmesgs) + TEST_ERROR } /* Check for object already having been compared */ - if(addr_lookup(&oinfo)) + if(token_lookup(gid, &oinfo)) continue; else - addr_insert(&oinfo); + token_insert(&oinfo); /* Open objects */ if((oid = H5Oopen(gid, objname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -1269,8 +1283,8 @@ test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -1404,7 +1418,7 @@ test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl, /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -1636,8 +1650,8 @@ main(void) FALSE, "H5Ocopy(): expand object reference"); } /* end for */ - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* Verify symbol table messages are cached */ nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); diff --git a/test/ohdr.c b/test/ohdr.c index 53d2f59..120935c 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -322,7 +322,7 @@ test_ohdr_swmr(hbool_t new_format) hsize_t dims[1]; /* Dimension sizes */ size_t u; /* Iterator */ int n; /* Data variable */ - H5O_info_t obj_info; /* Information for the object */ + H5O_native_info_t ninfo; /* Information for the object */ if(new_format) { TESTING("exercise the coding for the re-read of the object header for SWMR access: latest-format"); @@ -392,16 +392,16 @@ test_ohdr_swmr(hbool_t new_format) FAIL_STACK_ERROR /* Get the object information */ - if(H5Oget_info2(did, &obj_info, H5O_INFO_HDR) < 0) + if(H5Oget_native_info(did, &ninfo, H5O_NATIVE_INFO_HDR) < 0) FAIL_STACK_ERROR if(new_format) - if(obj_info.hdr.version != OBJ_VERSION_LATEST) + if(ninfo.hdr.version != OBJ_VERSION_LATEST) FAIL_STACK_ERROR /* The size of object header should be greater than the speculative read size of H5O_SPEC_READ_SIZE */ /* This will exercise the coding for the re-read of the object header for SWMR access */ - if(obj_info.hdr.space.total < H5O_SPEC_READ_SIZE) + if(ninfo.hdr.space.total < H5O_SPEC_READ_SIZE) TEST_ERROR; /* Close the dataset */ @@ -757,10 +757,10 @@ error: */ static int count_attributes(hid_t dset_id) -{ - H5O_info_t info; - - if(H5Oget_info2(dset_id, &info, H5O_INFO_NUM_ATTRS) < 0) +{ + H5O_info2_t info; + + if(H5Oget_info3(dset_id, &info, H5O_INFO_NUM_ATTRS) < 0) return -1; else return (int)info.num_attrs; /* should never exceed int bounds */ @@ -774,10 +774,13 @@ count_attributes(hid_t dset_id) static herr_t _oh_getsize(hid_t did, hsize_t *size_out) { - H5O_info_t info; - if(FAIL == H5Oget_info2(did, &info, H5O_INFO_HDR)) + H5O_native_info_t ninfo; + + if(FAIL == H5Oget_native_info(did, &ninfo, H5O_NATIVE_INFO_HDR)) return FAIL; - *size_out = info.hdr.space.total; + + *size_out = ninfo.hdr.space.total; + return SUCCEED; } /* _oh_getsize */ diff --git a/test/stab.c b/test/stab.c index 80c8b06..215d748 100644 --- a/test/stab.c +++ b/test/stab.c @@ -70,8 +70,10 @@ const char *FILENAME[] = { #define GCPL_ON_ROOT_MAX_COMPACT 4 #define GCPL_ON_ROOT_MIN_DENSE 2 +#ifndef H5_NO_DEPRECATED_SYMBOLS /* Definitions for 'old_api' test */ #define OLD_API_GROUP "/old_api" +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Definitions for 'corrupt_stab_msg' test */ #define CORRUPT_STAB_FILE "corrupt_stab_msg.h5" @@ -328,7 +330,7 @@ lifecycle(hid_t fcpl, hid_t fapl2) unsigned est_num_entries; /* Estimated # of entries in group */ unsigned est_name_len; /* Estimated length of entry name */ unsigned nmsgs; /* Number of messages in group's header */ - H5O_info_t oinfo; /* Object info */ + H5O_native_info_t ninfo; /* Object info */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE]; h5_stat_size_t empty_size; /* Size of an empty file */ @@ -419,11 +421,11 @@ lifecycle(hid_t fcpl, hid_t fapl2) if(H5G__is_new_dense_test(gid) != FALSE) TEST_ERROR /* Check that the object header is only one chunk and the space has been allocated correctly */ - if(H5Oget_info2(gid, &oinfo, H5O_INFO_HDR) < 0) TEST_ERROR - if(oinfo.hdr.space.total != 151) TEST_ERROR - if(oinfo.hdr.space.free != 0) TEST_ERROR - if(oinfo.hdr.nmesgs != 6) TEST_ERROR - if(oinfo.hdr.nchunks != 1) TEST_ERROR + if(H5Oget_native_info(gid, &ninfo, H5O_NATIVE_INFO_HDR) < 0) TEST_ERROR + if(ninfo.hdr.space.total != 151) TEST_ERROR + if(ninfo.hdr.space.free != 0) TEST_ERROR + if(ninfo.hdr.nmesgs != 6) TEST_ERROR + if(ninfo.hdr.nchunks != 1) TEST_ERROR /* Create one more "bottom" group, which should push top group into using a symbol table */ HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); @@ -441,11 +443,11 @@ lifecycle(hid_t fcpl, hid_t fapl2) if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR /* Check that the object header is still one chunk and the space has been allocated correctly */ - if(H5Oget_info2(gid, &oinfo, H5O_INFO_HDR) < 0) TEST_ERROR - if(oinfo.hdr.space.total != 151) TEST_ERROR - if(oinfo.hdr.space.free != 92) TEST_ERROR - if(oinfo.hdr.nmesgs != 3) TEST_ERROR - if(oinfo.hdr.nchunks != 1) TEST_ERROR + if(H5Oget_native_info(gid, &ninfo, H5O_NATIVE_INFO_HDR) < 0) TEST_ERROR + if(ninfo.hdr.space.total != 151) TEST_ERROR + if(ninfo.hdr.space.free != 92) TEST_ERROR + if(ninfo.hdr.nmesgs != 3) TEST_ERROR + if(ninfo.hdr.nchunks != 1) TEST_ERROR /* Unlink objects from top group */ while(u >= LIFECYCLE_MIN_DENSE) { diff --git a/test/tattr.c b/test/tattr.c index b89ec3f..bcd8698 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -20,6 +20,7 @@ *************************************************************/ #include "testhdf5.h" +#include "H5VLnative_private.h" /* * This file needs to access private information from the H5O package. @@ -427,7 +428,7 @@ test_attr_basic_read(hid_t fapl) hid_t dataset; /* Dataset ID */ hid_t group; /* Group ID */ hid_t attr; /* Attribute ID */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ int read_data1[ATTR1_DIM1] = {0}; /* Buffer for reading 1st attribute */ int read_data2[ATTR2_DIM1][ATTR2_DIM2] = {{0}}; /* Buffer for reading 2nd attribute */ int i, j; /* Local index variables */ @@ -445,9 +446,9 @@ test_attr_basic_read(hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 2, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 2, "H5Oget_info3"); /* Open first attribute for the dataset */ attr = H5Aopen(dataset, ATTR_TMP_NAME, H5P_DEFAULT); @@ -474,9 +475,9 @@ test_attr_basic_read(hid_t fapl) CHECK(group, FAIL, "H5Gopen2"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(group, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 1, "H5Oget_info"); + ret = H5Oget_info3(group, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 1, "H5Oget_info3"); /* Open the attribute for the group */ attr = H5Aopen(group, ATTR2_NAME, H5P_DEFAULT); @@ -811,7 +812,7 @@ test_attr_compound_read(hid_t fapl) hid_t field; /* Attribute field datatype */ struct attr4_struct read_data4[ATTR4_DIM1][ATTR4_DIM2]; /* Buffer for reading 4th attribute */ ssize_t name_len; /* Length of attribute name */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ int i, j; /* Local index variables */ herr_t ret; /* Generic return value */ @@ -827,9 +828,9 @@ test_attr_compound_read(hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 1, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 1, "H5Oget_info3"); /* Open 1st attribute for the dataset */ attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT); @@ -1016,7 +1017,7 @@ test_attr_scalar_read(hid_t fapl) hid_t attr; /* Attribute ID */ H5S_class_t stype; /* Dataspace class */ float rdata = 0.0F; /* Buffer for reading 1st attribute */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -1031,9 +1032,9 @@ test_attr_scalar_read(hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 1, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 1, "H5Oget_info3"); /* Open an attribute for the dataset */ attr = H5Aopen(dataset, ATTR5_NAME, H5P_DEFAULT); @@ -1218,7 +1219,7 @@ test_attr_mult_read(hid_t fapl) int read_data2[ATTR2_DIM1][ATTR2_DIM2] = {{0}}; /* Buffer for reading 2nd attribute */ double read_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3] = {{{0}}}; /* Buffer for reading 3rd attribute */ ssize_t name_len; /* Length of attribute name */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ int i, j, k; /* Local index values */ herr_t ret; /* Generic return value */ @@ -1234,9 +1235,9 @@ test_attr_mult_read(hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 3, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 3, "H5Oget_info3"); /* Open 1st attribute for the dataset */ attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT); @@ -1468,7 +1469,7 @@ test_attr_iterate(hid_t fapl) hid_t dataset; /* Dataset ID */ hid_t sid; /* Dataspace ID */ int count; /* operator data for the iterator */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -1491,9 +1492,9 @@ test_attr_iterate(hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 0, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 0, "H5Oget_info3"); /* Iterate over attributes on dataset */ count = 0; @@ -1509,9 +1510,9 @@ test_attr_iterate(hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 3, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 3, "H5Oget_info3"); /* Iterate over attributes on dataset */ count = 0; @@ -1541,7 +1542,7 @@ test_attr_delete(hid_t fapl) hid_t attr; /* Attribute ID */ char attr_name[ATTR_NAME_LEN]; /* Buffer for attribute names */ ssize_t name_len; /* Length of attribute name */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -1556,27 +1557,27 @@ test_attr_delete(hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 3, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 3, "H5Oget_info3"); /* Try to delete bogus attribute */ ret = H5Adelete(dataset, "Bogus"); VERIFY(ret, FAIL, "H5Adelete"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 3, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 3, "H5Oget_info3"); /* Delete middle (2nd) attribute */ ret = H5Adelete(dataset, ATTR2_NAME); CHECK(ret, FAIL, "H5Adelete"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 2, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 2, "H5Oget_info3"); /* Open 1st attribute for the dataset */ attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT); @@ -1611,9 +1612,9 @@ test_attr_delete(hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 1, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 1, "H5Oget_info3"); /* Open last (formally 3rd) attribute for the dataset */ attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT); @@ -1634,9 +1635,9 @@ test_attr_delete(hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 0, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 0, "H5Oget_info3"); /* Close dataset */ ret = H5Dclose(dataset); @@ -1664,7 +1665,7 @@ test_attr_dtype_shared(hid_t fapl) hid_t attr_id; /* Attribute ID */ int data = 8; /* Data to write */ int rdata = 0; /* Read read in */ - H5O_info_t oinfo; /* Object's information */ + H5O_info2_t oinfo; /* Object's information */ h5_stat_size_t empty_filesize; /* Size of empty file */ h5_stat_size_t filesize; /* Size of file after modifications */ herr_t ret; /* Generic return value */ @@ -1698,9 +1699,9 @@ test_attr_dtype_shared(hid_t fapl) CHECK(ret, FAIL, "H5Tcommit2"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "H5Oget_info_by_name3"); /* Create dataspace for dataset */ space_id = H5Screate(H5S_SCALAR); @@ -1711,18 +1712,18 @@ test_attr_dtype_shared(hid_t fapl) CHECK(dset_id, FAIL, "H5Dcreate2"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 2, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 2, "H5Oget_info_by_name3"); /* Create attribute on dataset */ attr_id = H5Acreate2(dset_id, ATTR1_NAME, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr_id, FAIL, "H5Acreate2"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 3, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 3, "H5Oget_info_by_name3"); /* Close attribute */ ret = H5Aclose(attr_id); @@ -1733,18 +1734,18 @@ test_attr_dtype_shared(hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 2, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 2, "H5Oget_info_by_name3"); /* Create attribute on dataset */ attr_id = H5Acreate2(dset_id, ATTR1_NAME, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr_id, FAIL, "H5Acreate2"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 3, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 3, "H5Oget_info_by_name3"); /* Write data into the attribute */ ret = H5Awrite(attr_id, H5T_NATIVE_INT, &data); @@ -1797,18 +1798,18 @@ test_attr_dtype_shared(hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 3, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 3, "H5Oget_info_by_name3"); /* Unlink the dataset */ ret = H5Ldelete(file_id, DSET1_NAME, H5P_DEFAULT); CHECK(ret, FAIL, "H5Ldelete"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "H5Oget_info_by_name3"); /* Unlink the named datatype */ ret = H5Ldelete(file_id, TYPE1_NAME, H5P_DEFAULT); @@ -2440,7 +2441,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) unsigned u; /* Local index variable */ h5_stat_size_t empty_filesize; /* Size of empty file */ h5_stat_size_t filesize; /* Size of file after modifications */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ int use_min_dset_oh = (dcpl_g != H5P_DEFAULT); herr_t ret; /* Generic return value */ @@ -2523,9 +2524,9 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check # of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info3"); } /* end for */ /* Check on dataset's attribute storage status */ @@ -2634,7 +2635,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) htri_t is_dense; /* Are attributes stored densely? */ h5_stat_size_t empty_filesize; /* Size of empty file */ h5_stat_size_t filesize; /* Size of file after modifications */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ unsigned u; /* Local index variable */ int use_min_dset_oh = (dcpl_g != H5P_DEFAULT); unsigned use_corder; /* Track creation order or not */ @@ -2726,9 +2727,9 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Arename_by_name"); /* Check # of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info3"); } /* end for */ /* Check on dataset's attribute storage status */ @@ -2826,7 +2827,7 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl) size_t mesg_count; /* # of shared messages */ h5_stat_size_t empty_filesize; /* Size of empty file */ h5_stat_size_t filesize; /* Size of file after modifications */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ unsigned u; /* Local index variable */ int use_min_dset_oh = (dcpl_g != H5P_DEFAULT); herr_t ret; /* Generic return value */ @@ -2904,9 +2905,9 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check # of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info3"); } /* end for */ /* Check on dataset's attribute storage status */ @@ -10863,9 +10864,10 @@ test_attr_bug8(hid_t fcpl, hid_t fapl) hid_t gid; /* Group ID */ hid_t oid; /* Object ID */ hsize_t dims = 256; /* Attribute dimensions */ - H5O_info_t oinfo; /* Object info */ + 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 */ herr_t ret; /* Generic return status */ /* Output message about test being performed */ @@ -10881,9 +10883,10 @@ test_attr_bug8(hid_t fcpl, hid_t fapl) CHECK(gid, FAIL, "H5Gcreate2"); /* Get root group address */ - ret = H5Oget_info2(fid, &oinfo, H5O_INFO_BASIC); + ret = H5Oget_info3(fid, &oinfo, H5O_INFO_BASIC); CHECK(ret, FAIL, "H5Oget_info"); - root_addr = oinfo.addr; + ret = H5VLnative_token_to_addr(fid, oinfo.token, &root_addr); + CHECK(ret, FAIL, "H5VLnative_token_to_addr"); /* * Create link to root group @@ -10906,10 +10909,12 @@ test_attr_bug8(hid_t fcpl, hid_t fapl) CHECK(gid, FAIL, "H5Gopen2"); oid = H5Oopen(gid, LINK1_NAME, H5P_DEFAULT); CHECK(oid, FAIL, "H5Oopen"); - ret = H5Oget_info2(oid, &oinfo, H5O_INFO_BASIC); + ret = H5Oget_info3(oid, &oinfo, H5O_INFO_BASIC); CHECK(ret, FAIL, "H5Oget_info"); - if(oinfo.addr != root_addr) - TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", (long long unsigned)oinfo.addr, (long long unsigned)root_addr); + 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); /* Close file */ ret = H5Fclose(fid); @@ -10951,10 +10956,12 @@ test_attr_bug8(hid_t fcpl, hid_t fapl) CHECK(gid, FAIL, "H5Gopen2"); oid = H5Oopen(gid, LINK1_NAME, H5P_DEFAULT); CHECK(oid, FAIL, "H5Oopen"); - ret = H5Oget_info2(oid, &oinfo, H5O_INFO_BASIC); + ret = H5Oget_info3(oid, &oinfo, H5O_INFO_BASIC); CHECK(ret, FAIL, "H5Oget_info"); - if(oinfo.addr != root_addr) - TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", (long long unsigned)oinfo.addr, (long long unsigned)root_addr); + 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 = H5Aget_info_by_name(gid, ".", ATTR1_NAME, &ainfo, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aget_info_by_name"); if(ainfo.data_size != dims) diff --git a/test/tfile.c b/test/tfile.c index 351c393..d6047dc 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -5178,7 +5178,7 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, { hid_t file, group; /* Handles */ hid_t fapl; /* File access property list */ - H5O_info_t oinfo; /* Object info */ + H5O_native_info_t ninfo; /* Object info */ herr_t ret; /* Return value */ /* @@ -5196,9 +5196,9 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, /* * Make sure the root group has the correct object header version */ - ret = H5Oget_info_by_name2(file, "/", &oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.version, oh_vers_create, "H5Oget_info_by_name"); + ret = H5Oget_native_info_by_name(file, "/", &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.version, oh_vers_create, "H5Oget_native_info_by_name"); /* * Reopen the file and make sure the root group still has the correct version @@ -5212,9 +5212,9 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, file = H5Fopen("tfile5.h5", H5F_ACC_RDWR, fapl); CHECK(file, FAIL, "H5Fopen"); - ret = H5Oget_info_by_name2(file, "/", &oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.version, oh_vers_create, "H5Oget_info_by_name"); + ret = H5Oget_native_info_by_name(file, "/", &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.version, oh_vers_create, "H5Oget_native_info_by_name"); /* * Create a group named "G1" in the file, and make sure it has the correct @@ -5223,9 +5223,9 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, group = H5Gcreate2(file, "/G1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(group, FAIL, "H5Gcreate"); - ret = H5Oget_info2(group, &oinfo, H5O_INFO_HDR); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.hdr.version, oh_vers_mod, "H5Oget_info"); + ret = H5Oget_native_info(group, &ninfo, H5O_NATIVE_INFO_HDR); + CHECK(ret, FAIL, "H5Oget_native)info"); + VERIFY(ninfo.hdr.version, oh_vers_mod, "H5Oget_native_info"); ret = H5Gclose(group); CHECK(ret, FAIL, "H5Gclose"); @@ -5237,9 +5237,9 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, group = H5Gcreate2(file, "/G1/G3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(group, FAIL, "H5Gcreate"); - ret = H5Oget_info2(group, &oinfo, H5O_INFO_HDR); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.version, oh_vers_mod, "H5Oget_info_by_name"); + ret = H5Oget_native_info(group, &ninfo, H5O_NATIVE_INFO_HDR); + CHECK(ret, FAIL, "H5Oget_native_info"); + VERIFY(ninfo.hdr.version, oh_vers_mod, "H5Oget_native_info"); ret = H5Gclose(group); CHECK(ret, FAIL, "H5Gclose"); @@ -5247,9 +5247,9 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, /* * Make sure the root group still has the correct object header version */ - ret = H5Oget_info_by_name2(file, "/", &oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.version, oh_vers_create, "H5Oget_info_by_name"); + ret = H5Oget_native_info_by_name(file, "/", &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.version, oh_vers_create, "H5Oget_native_info_by_name"); ret = H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); @@ -6035,7 +6035,7 @@ test_libver_bounds_obj(hid_t fapl) hid_t new_fapl = H5I_INVALID_HID; /* File access property list */ H5F_t *f = NULL; /* Internal file pointer */ H5F_libver_t low, high; /* Low and high bounds */ - H5O_info_t oinfo; /* Object info */ + H5O_native_info_t ninfo; /* Object info */ H5G_info_t ginfo; /* Group info */ herr_t ret; /* Return value */ @@ -6059,11 +6059,11 @@ test_libver_bounds_obj(hid_t fapl) CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); /* Get root group's object info */ - ret = H5Oget_info_by_name2(fid, "/", &oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); + ret = H5Oget_native_info_by_name(fid, "/", &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); /* Verify object header version is 2 because shared message is enabled */ - VERIFY(oinfo.hdr.version, H5O_VERSION_2, "H5O_obj_ver_bounds"); + VERIFY(ninfo.hdr.version, H5O_VERSION_2, "H5O_obj_ver_bounds"); /* Close the file */ ret = H5Fclose(fid); @@ -6078,11 +6078,11 @@ test_libver_bounds_obj(hid_t fapl) CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); /* Get root group's object info */ - ret = H5Oget_info_by_name2(fid, "/", &oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); + ret = H5Oget_native_info_by_name(fid, "/", &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); /* Verify object header version is as indicated by low_bound */ - VERIFY(oinfo.hdr.version, H5O_obj_ver_bounds[low], "H5O_obj_ver_bounds"); + VERIFY(ninfo.hdr.version, H5O_obj_ver_bounds[low], "H5O_obj_ver_bounds"); /* Close the file */ ret = H5Fclose(fid); @@ -6133,11 +6133,11 @@ test_libver_bounds_obj(hid_t fapl) VERIFY(ginfo.storage_type, H5G_STORAGE_TYPE_SYMBOL_TABLE, "H5Gget_info"); /* Get object header information */ - ret = H5Oget_info_by_name2(gid, GRP_NAME, &oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); + ret = H5Oget_native_info_by_name(gid, GRP_NAME, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); /* Verify object header version as indicated by low_bound */ - VERIFY(oinfo.hdr.version, H5O_obj_ver_bounds[f->shared->low_bound], "H5O_obj_ver_bounds"); + VERIFY(ninfo.hdr.version, H5O_obj_ver_bounds[f->shared->low_bound], "H5O_obj_ver_bounds"); /* Close the group */ ret = H5Gclose(gid); diff --git a/test/th5o.c b/test/th5o.c index 354245f..ab4a8de 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -20,6 +20,9 @@ *************************************************************/ #include "testhdf5.h" +#include "H5Fprivate.h" +#include "H5VLprivate.h" +#include "H5VLnative_private.h" #define TEST_FILENAME "th5o_file" @@ -231,6 +234,7 @@ test_h5o_close(void) } +#ifndef H5_NO_DEPRECATED_SYMBOLS /**************************************************************** ** ** test_h5o_open_by_addr(): Test H5Oopen_by_addr function. @@ -239,17 +243,17 @@ test_h5o_close(void) static void test_h5o_open_by_addr(void) { - hid_t fid; /* HDF5 File ID */ - hid_t grp, dset, dtype, dspace; /* Object identifiers */ - H5L_info_t li; /* Buffer for H5Lget_info */ - haddr_t grp_addr; /* Addresses for objects */ - haddr_t dset_addr; - haddr_t dtype_addr; - hsize_t dims[RANK]; - H5I_type_t id_type; /* Type of IDs returned from H5Oopen */ - H5G_info_t ginfo; /* Group info struct */ - H5T_class_t type_class; /* Class of the datatype */ - herr_t ret; /* Value returned from API calls */ + hid_t fid; /* HDF5 File ID */ + hid_t grp, dset, dtype, dspace; /* Object identifiers */ + H5L_info2_t li; /* Buffer for H5Lget_info */ + haddr_t grp_addr; /* Addresses for objects */ + haddr_t dset_addr; + haddr_t dtype_addr; + hsize_t dims[RANK]; + H5I_type_t id_type; /* Type of IDs returned from H5Oopen */ + H5G_info_t ginfo; /* Group info struct */ + H5T_class_t type_class; /* Class of the datatype */ + herr_t ret; /* Value returned from API calls */ /* Create a new HDF5 file */ fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -285,15 +289,20 @@ test_h5o_open_by_addr(void) CHECK(ret, FAIL, "H5Sclose"); /* Get address for each object */ - ret = H5Lget_info(fid, "group", &li, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Lget_info"); - grp_addr = li.u.address; - ret = H5Lget_info(fid, "group/datatype", &li, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Lget_info"); - dtype_addr = li.u.address; - ret = H5Lget_info(fid, "dataset", &li, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Lget_info"); - dset_addr = li.u.address; + ret = H5Lget_info2(fid, "group", &li, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info2"); + ret = H5VLnative_token_to_addr(fid, li.u.token, &grp_addr); + CHECK(ret, FAIL, "H5VLnative_token_to_addr"); + + ret = H5Lget_info2(fid, "group/datatype", &li, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info2"); + ret = H5VLnative_token_to_addr(fid, li.u.token, &dtype_addr); + CHECK(ret, FAIL, "H5VLnative_token_to_addr"); + + ret = H5Lget_info2(fid, "dataset", &li, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info2"); + ret = H5VLnative_token_to_addr(fid, li.u.token, &dset_addr); + CHECK(ret, FAIL, "H5VLnative_token_to_addr"); /* Now make sure that H5Oopen_by_addr can open all three types of objects */ grp = H5Oopen_by_addr(fid, grp_addr); @@ -366,7 +375,122 @@ test_h5o_open_by_addr(void) }H5E_END_TRY VERIFY(dtype, FAIL, "H5Oopen_by_addr"); } /* test_h5o_open_by_addr() */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + + +/**************************************************************** +** +** test_h5o_open_by_token(): Test H5Oopen_by_token function. +** +****************************************************************/ +static void +test_h5o_open_by_token(void) +{ + hid_t fid; /* HDF5 File ID */ + hid_t grp, dset, dtype, dspace; /* Object identifiers */ + H5L_info2_t li; /* Buffer for H5Lget_info */ + hsize_t dims[RANK]; + H5I_type_t id_type; /* Type of IDs returned from H5Oopen */ + H5G_info_t ginfo; /* Group info struct */ + H5T_class_t type_class; /* Class of the datatype */ + herr_t ret; /* Value returned from API calls */ + + /* Create a new HDF5 file */ + fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(fid, FAIL, "H5Fcreate"); + + /* Create a group, dataset, and committed datatype within the file */ + /* Create the group */ + grp = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(grp, FAIL, "H5Gcreate2"); + ret = H5Gclose(grp); + CHECK(ret, FAIL, "H5Gclose"); + + /* Commit the type inside the group */ + dtype = H5Tcopy(H5T_NATIVE_INT); + CHECK(dtype, FAIL, "H5Tcopy"); + ret = H5Tcommit2(fid, "group/datatype", dtype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Tcommit2"); + ret = H5Tclose(dtype); + CHECK(ret, FAIL, "H5Tclose"); + + /* Create the data space for the dataset. */ + dims[0] = DIM0; + dims[1] = DIM1; + dspace = H5Screate_simple(RANK, dims, NULL); + CHECK(dspace, FAIL, "H5Screate_simple"); + + /* Create the dataset. */ + dset = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, dspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(dset, FAIL, "H5Dcreate2"); + ret = H5Dclose(dset); + CHECK(ret, FAIL, "H5Dclose"); + ret = H5Sclose(dspace); + CHECK(ret, FAIL, "H5Sclose"); + + /* Make sure that H5Oopen_by_token can open all three types of objects */ + ret = H5Lget_info2(fid, "group", &li, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info"); + grp = H5Oopen_by_token(fid, li.u.token); + CHECK(grp, FAIL, "H5Oopen_by_token"); + + ret = H5Lget_info2(fid, "group/datatype", &li, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info"); + dtype = H5Oopen_by_token(fid, li.u.token); + CHECK(dtype, FAIL, "H5Oopen_by_token"); + + ret = H5Lget_info2(fid, "dataset", &li, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info"); + /* Check that we can use the group ID as a valid location */ + dset = H5Oopen_by_token(grp, li.u.token); + CHECK(dset, FAIL, "H5Oopen_by_token"); + + /* Make sure that each is the right kind of ID */ + id_type = H5Iget_type(grp); + VERIFY(id_type, H5I_GROUP, "H5Iget_type for group ID"); + id_type = H5Iget_type(dtype); + VERIFY(id_type, H5I_DATATYPE, "H5Iget_type for datatype ID"); + id_type = H5Iget_type(dset); + VERIFY(id_type, H5I_DATASET, "H5Iget_type for dataset ID"); + + /* Do something more complex with each of the IDs to make sure they "work" */ + ret = H5Gget_info(grp, &ginfo); + CHECK(ret, FAIL, "H5Gget_info"); + VERIFY(ginfo.nlinks, 1, "H5Gget_info"); /* There should be one object, the datatype */ + + type_class = H5Tget_class(dtype); + VERIFY(type_class, H5T_INTEGER, "H5Tget_class"); + + dspace = H5Dget_space(dset); + CHECK(dspace, FAIL, "H5Dget_space"); + + /* Close the IDs */ + ret = H5Sclose(dspace); + CHECK(ret, FAIL, "H5Sclose"); + ret = H5Gclose(grp); + CHECK(ret, FAIL, "H5Gclose"); + ret = H5Tclose(dtype); + CHECK(ret, FAIL, "H5Tclose"); + ret = H5Dclose(dset); + CHECK(ret, FAIL, "H5Dclose"); + + /* Try giving some bogus values to H5O_open_by_token */ + /* Try opening an object using H5O_TOKEN_UNDEF (should fail) */ + H5E_BEGIN_TRY{ + dtype = H5Oopen_by_token(fid, H5O_TOKEN_UNDEF); + }H5E_END_TRY + VERIFY(dtype, FAIL, "H5Oopen_by_token"); + + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + + /* Also, trying to open an object without a valid location (should fail) */ + H5E_BEGIN_TRY{ + dtype = H5Oopen_by_token(fid, li.u.token); + }H5E_END_TRY + VERIFY(dtype, FAIL, "H5Oopen_by_token"); +} /* test_h5o_open_by_token() */ /**************************************************************** ** @@ -378,7 +502,7 @@ test_h5o_refcount(void) { hid_t fid; /* HDF5 File ID */ hid_t grp, dset, dtype, dspace; /* Object identifiers */ - H5O_info_t oinfo; /* Object info struct */ + H5O_info2_t oinfo; /* Object info struct */ hsize_t dims[RANK]; herr_t ret; /* Value returned from API calls */ @@ -410,15 +534,15 @@ test_h5o_refcount(void) CHECK(ret, FAIL, "H5Sclose"); /* Get ref counts for each object. They should all be 1, since each object has a hard link. */ - ret = H5Oget_info_by_name2(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3"); /* Increment each object's reference count. */ ret = H5Oincr_refcount(grp); @@ -429,15 +553,15 @@ test_h5o_refcount(void) CHECK(ret, FAIL, "H5Oincr_refcount"); /* Get ref counts for each object. They should all be 2 now. */ - ret = H5Oget_info_by_name2(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name3"); /* Decrement the reference counts and check that they decrease back to 1. */ ret = H5Odecr_refcount(grp); @@ -447,15 +571,15 @@ test_h5o_refcount(void) ret = H5Odecr_refcount(dset); CHECK(ret, FAIL, "H5Odecr_refcount"); - ret = H5Oget_info_by_name2(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3"); /* Increment the reference counts and then close the file to make sure the increment is permanant */ ret = H5Oincr_refcount(grp); @@ -485,15 +609,15 @@ test_h5o_refcount(void) dset = H5Dopen2(fid, "dataset", H5P_DEFAULT); CHECK(dset, FAIL, "H5Dopen2"); - ret = H5Oget_info_by_name2(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name3"); /* Decrement the reference counts and close the file */ ret = H5Odecr_refcount(grp); @@ -523,15 +647,15 @@ test_h5o_refcount(void) dset = H5Dopen2(fid, "dataset", H5P_DEFAULT); CHECK(dset, FAIL, "H5Dopen2"); - ret = H5Oget_info_by_name2(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3"); /* Close the IDs */ ret = H5Gclose(grp); @@ -1254,7 +1378,7 @@ test_h5o_getinfo_same_file(void) { hid_t fid1, fid2; /* HDF5 File ID */ hid_t gid1, gid2; /* Group IDs */ - H5O_info_t oinfo1, oinfo2; /* Object info structs */ + H5O_info2_t oinfo1, oinfo2; /* Object info structs */ herr_t ret; /* Value returned from API calls */ /* Create a new HDF5 file */ @@ -1272,24 +1396,24 @@ test_h5o_getinfo_same_file(void) HDmemset(&oinfo2, 0, sizeof(oinfo2)); /* Query the object info for each object, through group IDs */ - ret = H5Oget_info2(gid1, &oinfo1, H5O_INFO_BASIC); - CHECK(ret, FAIL, "H5Oget_info"); - ret = H5Oget_info2(gid2, &oinfo2, H5O_INFO_BASIC); - CHECK(ret, FAIL, "H5Oget_info"); + ret = H5Oget_info3(gid1, &oinfo1, H5O_INFO_BASIC); + CHECK(ret, FAIL, "H5Oget_info3"); + ret = H5Oget_info3(gid2, &oinfo2, H5O_INFO_BASIC); + CHECK(ret, FAIL, "H5Oget_info3"); - VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info"); + VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info3"); /* Reset object info */ HDmemset(&oinfo1, 0, sizeof(oinfo1)); HDmemset(&oinfo2, 0, sizeof(oinfo2)); /* Query the object info for each object, by name */ - ret = H5Oget_info_by_name2(fid1, "group1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid1, "group2", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(fid1, "group1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid1, "group2", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); - VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info"); + VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info3"); /* Close everything */ ret = H5Gclose(gid1); @@ -1317,24 +1441,24 @@ test_h5o_getinfo_same_file(void) HDmemset(&oinfo2, 0, sizeof(oinfo2)); /* Query the object info for each object, through group IDs */ - ret = H5Oget_info2(gid1, &oinfo1, H5O_INFO_BASIC); - CHECK(ret, FAIL, "H5Oget_info"); - ret = H5Oget_info2(gid2, &oinfo2, H5O_INFO_BASIC); - CHECK(ret, FAIL, "H5Oget_info"); + ret = H5Oget_info3(gid1, &oinfo1, H5O_INFO_BASIC); + CHECK(ret, FAIL, "H5Oget_info3"); + ret = H5Oget_info3(gid2, &oinfo2, H5O_INFO_BASIC); + CHECK(ret, FAIL, "H5Oget_info3"); - VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info"); + VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info3"); /* Reset object info */ HDmemset(&oinfo1, 0, sizeof(oinfo1)); HDmemset(&oinfo2, 0, sizeof(oinfo2)); /* Query the object info for each object, by name */ - ret = H5Oget_info_by_name2(fid1, "group1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid1, "group2", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(fid1, "group1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid1, "group2", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); - VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info"); + VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info3"); /* Close everything */ ret = H5Gclose(gid1); @@ -1352,6 +1476,143 @@ test_h5o_getinfo_same_file(void) /**************************************************************** ** +** test_h5o_open_by_addr_deprec(): Test H5Oopen_by_addr function. +** +****************************************************************/ +static void +test_h5o_open_by_addr_deprec(void) +{ + hid_t fid; /* HDF5 File ID */ + hid_t grp, dset, dtype, dspace; /* Object identifiers */ + H5L_info1_t li; /* Buffer for H5Lget_info1 */ + haddr_t grp_addr; /* Addresses for objects */ + haddr_t dset_addr; + haddr_t dtype_addr; + hsize_t dims[RANK]; + H5I_type_t id_type; /* Type of IDs returned from H5Oopen */ + H5G_info_t ginfo; /* Group info struct */ + H5T_class_t type_class; /* Class of the datatype */ + herr_t ret; /* Value returned from API calls */ + + /* Create a new HDF5 file */ + fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(fid, FAIL, "H5Fcreate"); + + /* Create a group, dataset, and committed datatype within the file */ + /* Create the group */ + grp = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(grp, FAIL, "H5Gcreate2"); + ret = H5Gclose(grp); + CHECK(ret, FAIL, "H5Gclose"); + + /* Commit the type inside the group */ + dtype = H5Tcopy(H5T_NATIVE_INT); + CHECK(dtype, FAIL, "H5Tcopy"); + ret = H5Tcommit2(fid, "group/datatype", dtype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Tcommit2"); + ret = H5Tclose(dtype); + CHECK(ret, FAIL, "H5Tclose"); + + /* Create the data space for the dataset. */ + dims[0] = DIM0; + dims[1] = DIM1; + dspace = H5Screate_simple(RANK, dims, NULL); + CHECK(dspace, FAIL, "H5Screate_simple"); + + /* Create the dataset. */ + dset = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, dspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(dset, FAIL, "H5Dcreate2"); + ret = H5Dclose(dset); + CHECK(ret, FAIL, "H5Dclose"); + ret = H5Sclose(dspace); + CHECK(ret, FAIL, "H5Sclose"); + + /* Get address for each object */ + ret = H5Lget_info1(fid, "group", &li, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info"); + grp_addr = li.u.address; + ret = H5Lget_info1(fid, "group/datatype", &li, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info"); + dtype_addr = li.u.address; + ret = H5Lget_info1(fid, "dataset", &li, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info"); + dset_addr = li.u.address; + + /* Now make sure that H5Oopen_by_addr can open all three types of objects */ + grp = H5Oopen_by_addr(fid, grp_addr); + CHECK(grp, FAIL, "H5Oopen_by_addr"); + dtype = H5Oopen_by_addr(fid, dtype_addr); + CHECK(dtype, FAIL, "H5Oopen_by_addr"); + /* Check that we can use the group ID as a valid location */ + dset = H5Oopen_by_addr(grp, dset_addr); + CHECK(dset, FAIL, "H5Oopen_by_addr"); + + /* Make sure that each is the right kind of ID */ + id_type = H5Iget_type(grp); + VERIFY(id_type, H5I_GROUP, "H5Iget_type for group ID"); + id_type = H5Iget_type(dtype); + VERIFY(id_type, H5I_DATATYPE, "H5Iget_type for datatype ID"); + id_type = H5Iget_type(dset); + VERIFY(id_type, H5I_DATASET, "H5Iget_type for dataset ID"); + + /* Do something more complex with each of the IDs to make sure they "work" */ + ret = H5Gget_info(grp, &ginfo); + CHECK(ret, FAIL, "H5Gget_info"); + VERIFY(ginfo.nlinks, 1, "H5Gget_info"); /* There should be one object, the datatype */ + + type_class = H5Tget_class(dtype); + VERIFY(type_class, H5T_INTEGER, "H5Tget_class"); + + dspace = H5Dget_space(dset); + CHECK(dspace, FAIL, "H5Dget_space"); + + /* Close the IDs */ + ret = H5Sclose(dspace); + CHECK(ret, FAIL, "H5Sclose"); + ret = H5Gclose(grp); + CHECK(ret, FAIL, "H5Gclose"); + ret = H5Tclose(dtype); + CHECK(ret, FAIL, "H5Tclose"); + ret = H5Dclose(dset); + CHECK(ret, FAIL, "H5Dclose"); + + /* Try giving some bogus values to H5O_open_by_addr. */ + /* Try to open an object with a bad address */ + grp_addr += 20; + H5E_BEGIN_TRY{ + grp = H5Oopen_by_addr(fid, grp_addr); + }H5E_END_TRY + VERIFY(grp, FAIL, "H5Oopen_by_addr"); + + /* For instance, an objectno smaller than the end of the file's superblock should + * trigger an error */ + grp_addr = 10; + H5E_BEGIN_TRY{ + grp = H5Oopen_by_addr(fid, grp_addr); + }H5E_END_TRY + VERIFY(grp, FAIL, "H5Oopen_by_addr"); + + /* Likewise, an objectno larger than the size of the file should fail */ + grp_addr = 0; + grp_addr = 1000000000; + H5E_BEGIN_TRY{ + grp = H5Oopen_by_addr(fid, grp_addr); + }H5E_END_TRY + VERIFY(grp, FAIL, "H5Oopen_by_addr"); + + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + + /* Also, trying to open an object without a valid location should fail */ + H5E_BEGIN_TRY{ + dtype = H5Oopen_by_addr(fid, dtype_addr); + }H5E_END_TRY + VERIFY(dtype, FAIL, "H5Oopen_by_addr"); +} /* test_h5o_open_by_addr_deprec() */ + + +/**************************************************************** +** ** visit_obj_cb(): ** This is the callback function invoked by H5Ovisit1() in ** test_h5o_getinfo_visit(): @@ -1360,10 +1621,10 @@ test_h5o_getinfo_same_file(void) ** ****************************************************************/ static int -visit_obj_cb(hid_t group_id, const char *name, const H5O_info_t *oinfo1, +visit_obj_cb(hid_t group_id, const char *name, const H5O_info1_t *oinfo1, void H5_ATTR_UNUSED *_op_data) { - H5O_info_t oinfo2; /* Object info structs */ + H5O_info1_t oinfo2; /* Object info structs */ /* Verify the object info for "group1", "group2" and the root group */ if(!(HDstrcmp(name, "group1"))) { @@ -1399,7 +1660,7 @@ test_h5o_getinfo_visit(void) hid_t gid1 = -1, gid2 = -1; /* Group IDs */ hid_t sid = -1; /* Dataspace ID */ hid_t aid = -1; /* Attribute ID */ - H5O_info_t oinfo1, oinfo2; /* Object info structs */ + H5O_info1_t oinfo1, oinfo2; /* Object info structs */ char attrname[25]; /* Attribute name */ int j; /* Local index variable */ herr_t ret; /* Value returned from API calls */ @@ -1438,9 +1699,9 @@ test_h5o_getinfo_visit(void) /* Query the object info for "group1" via H5Oget_info1 and H5Oget_info2 */ ret = H5Oget_info1(gid1, &oinfo1); - CHECK(ret, FAIL, "H5Oget_info"); + CHECK(ret, FAIL, "H5Oget_info1"); ret = H5Oget_info2(gid1, &oinfo2, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); + CHECK(ret, FAIL, "H5Oget_info2"); /* Verify the object info for "group1" is correct */ VERIFY(oinfo1.fileno, oinfo2.fileno, "obj info from H5Oget_info1/2"); @@ -1452,9 +1713,9 @@ test_h5o_getinfo_visit(void) /* Query the object info for "group2" via H5Oget_info1 and H5Oget_info2 */ ret = H5Oget_info_by_name1(fid, "group2", &oinfo1, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); ret = H5Oget_info_by_name2(fid, "group2", &oinfo2, H5O_INFO_HDR|H5O_INFO_META_SIZE, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); /* Verify the object info for "group2" is correct */ VERIFY(oinfo1.hdr.nmesgs, oinfo2.hdr.nmesgs, "obj info from H5Oget_info1/2"); @@ -1491,18 +1752,22 @@ test_h5o(void) /* Output message about test being performed */ MESSAGE(5, ("Testing Objects\n")); - test_h5o_open(); /* Test generic open function */ - test_h5o_open_by_addr(); /* Test opening objects by address */ - test_h5o_close(); /* Test generic close function */ - test_h5o_refcount(); /* Test incrementing and decrementing reference count */ - test_h5o_plist(); /* Test object creation properties */ - test_h5o_link(); /* Test object link routine */ - test_h5o_comment(); /* Test routines for comment */ - test_h5o_comment_by_name(); /* Test routines for comment by name */ - test_h5o_getinfo_same_file(); /* Test info for objects in the same file */ + test_h5o_open(); /* Test generic open function */ #ifndef H5_NO_DEPRECATED_SYMBOLS - test_h5o_getinfo_visit(); /* Test object info for H5Oget_info1/2 and H5Ovisit1 */ -#endif + test_h5o_open_by_addr(); /* Test opening objects by address */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + test_h5o_open_by_token(); /* Test opening objects by token */ + test_h5o_close(); /* Test generic close function */ + test_h5o_refcount(); /* Test incrementing and decrementing reference count */ + test_h5o_plist(); /* Test object creation properties */ + test_h5o_link(); /* Test object link routine */ + test_h5o_comment(); /* Test routines for comment */ + test_h5o_comment_by_name(); /* Test routines for comment by name */ + test_h5o_getinfo_same_file(); /* Test info for objects in the same file */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + test_h5o_open_by_addr_deprec(); /* Test opening objects by address with H5Lget_info1 */ + test_h5o_getinfo_visit(); /* Test object info for H5Oget_info1/2 and H5Ovisit1 */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* test_h5o() */ diff --git a/test/th5s.c b/test/th5s.c index 7e1e547..c60b1ff 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -2459,11 +2459,12 @@ test_h5s_compound_scalar_read(void) /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); -} /* test_h5s_compound_scalar_read() */ +} /* end test_h5s_compound_scalar_read() */ -/* Data arrays for chunk test */ -double chunk_data_dbl[50000][3]; -float chunk_data_flt[50000][3]; + +/* Data array sizes for chunk test */ +#define CHUNK_DATA_NX 50000 +#define CHUNK_DATA_NY 3 /**************************************************************** ** @@ -2481,22 +2482,41 @@ test_h5s_chunk(void) hid_t space_id; hsize_t dims[2]; hsize_t csize[2]; + double **chunk_data_dbl = NULL; + double *chunk_data_dbl_data = NULL; + float **chunk_data_flt = NULL; + float *chunk_data_flt_data = NULL; int i,j; + /* Allocate memory */ + chunk_data_dbl_data = (double *)HDcalloc(CHUNK_DATA_NX * CHUNK_DATA_NY, sizeof(double)); + CHECK_PTR(chunk_data_dbl_data, "HDcalloc"); + chunk_data_dbl = (double **)HDcalloc(CHUNK_DATA_NX, sizeof(chunk_data_dbl_data)); + CHECK_PTR(chunk_data_dbl, "HDcalloc"); + for (i = 0; i < CHUNK_DATA_NX; i++) + chunk_data_dbl[i] = chunk_data_dbl_data + (i * CHUNK_DATA_NY); + + chunk_data_flt_data = (float *)HDcalloc(CHUNK_DATA_NX * CHUNK_DATA_NY, sizeof(float)); + CHECK_PTR(chunk_data_flt_data, "HDcalloc"); + chunk_data_flt = (float **)HDcalloc(CHUNK_DATA_NX, sizeof(chunk_data_flt_data)); + CHECK_PTR(chunk_data_flt, "HDcalloc"); + for (i = 0; i < CHUNK_DATA_NX; i++) + chunk_data_flt[i] = chunk_data_flt_data + (i * CHUNK_DATA_NY); + fileID = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fileID, FAIL, "H5Fcreate"); plist_id = H5Pcreate(H5P_DATASET_CREATE); CHECK(plist_id, FAIL, "H5Pcreate"); - csize[0] = 50000; - csize[1] = 3; + csize[0] = CHUNK_DATA_NX; + csize[1] = CHUNK_DATA_NY; status = H5Pset_chunk(plist_id, 2, csize); CHECK(status, FAIL, "H5Pset_chunk"); /* Create the dataspace */ - dims[0] = 50000; - dims[1] = 3; + dims[0] = CHUNK_DATA_NX; + dims[1] = CHUNK_DATA_NY; space_id = H5Screate_simple(2, dims, NULL); CHECK(space_id, FAIL, "H5Screate_simple"); @@ -2504,11 +2524,11 @@ test_h5s_chunk(void) CHECK(dsetID, FAIL, "H5Dcreate2"); /* Initialize float array */ - for(i = 0; i < 50000; i++) - for(j = 0; j < 3; j++) + for(i = 0; i < CHUNK_DATA_NX; i++) + for(j = 0; j < CHUNK_DATA_NY; j++) chunk_data_flt[i][j] = (float)(i + 1) * 2.5F - (float)j * 100.3F; - status = H5Dwrite(dsetID, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_flt); + status = H5Dwrite(dsetID, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_flt_data); CHECK(status, FAIL, "H5Dwrite"); status = H5Pclose(plist_id); @@ -2521,17 +2541,17 @@ test_h5s_chunk(void) CHECK(status, FAIL, "H5Fclose"); /* Reset/initialize the data arrays to read in */ - HDmemset(chunk_data_dbl, 0, sizeof(double) * 50000 * 3); - HDmemset(chunk_data_flt, 0, sizeof(float) * 50000 * 3); + HDmemset(chunk_data_dbl_data, 0, sizeof(double) * CHUNK_DATA_NX * CHUNK_DATA_NY); + HDmemset(chunk_data_flt_data, 0, sizeof(float) * CHUNK_DATA_NX * CHUNK_DATA_NY); fileID = H5Fopen(DATAFILE, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK(fileID, FAIL, "H5Fopen"); dsetID = H5Dopen2(fileID, "coords", H5P_DEFAULT); CHECK(dsetID, FAIL, "H5Dopen2"); - status= H5Dread(dsetID, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_dbl); + status= H5Dread(dsetID, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_dbl_data); CHECK(status, FAIL, "H5Dread"); - status= H5Dread(dsetID, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_flt); + status= H5Dread(dsetID, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_flt_data); CHECK(status, FAIL, "H5Dread"); status = H5Dclose(dsetID); @@ -2539,13 +2559,18 @@ test_h5s_chunk(void) status = H5Fclose(fileID); CHECK(status, FAIL, "H5Fclose"); - for(i=0; i<50000; i++) { - for(j=0; j<3; j++) { + for(i = 0; i < CHUNK_DATA_NX; i++) { + for(j = 0; j < CHUNK_DATA_NY; j++) { /* Check if the two values are within 0.001% range. */ if(!H5_DBL_REL_EQUAL(chunk_data_dbl[i][j], (double)chunk_data_flt[i][j], (double)0.00001F)) TestErrPrintf("%u: chunk_data_dbl[%d][%d]=%e, chunk_data_flt[%d][%d]=%e\n", (unsigned)__LINE__, i, j, chunk_data_dbl[i][j], i, j, (double)chunk_data_flt[i][j]); } /* end for */ } /* end for */ + + HDfree(chunk_data_dbl); + HDfree(chunk_data_dbl_data); + HDfree(chunk_data_flt); + HDfree(chunk_data_flt_data); } /* test_h5s_chunk() */ /**************************************************************** diff --git a/test/titerate.c b/test/titerate.c index 669a094..9d60915 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -68,9 +68,9 @@ static int find_err_msg_cb(unsigned n, const H5E_error2_t *err_desc, void *_clie /* Local functions */ int iter_strcmp(const void *s1, const void *s2); int iter_strcmp2(const void *s1, const void *s2); -static herr_t liter_cb(hid_t group, const char *name, const H5L_info_t *info, +static herr_t liter_cb(hid_t group, const char *name, const H5L_info2_t *info, void *op_data); -static herr_t liter_cb2(hid_t group, const char *name, const H5L_info_t *info, +static herr_t liter_cb2(hid_t group, const char *name, const H5L_info2_t *info, void *op_data); herr_t aiter_cb(hid_t group, const char *name, const H5A_info_t *ainfo, void *op_data); @@ -91,7 +91,7 @@ H5_ATTR_PURE int iter_strcmp(const void *s1, const void *s2) ** ****************************************************************/ static herr_t -liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_UNUSED *link_info, +liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t H5_ATTR_UNUSED *link_info, void *op_data) { iter_info *info = (iter_info *)op_data; @@ -153,8 +153,8 @@ test_iter_group(hid_t fapl, hbool_t new_format) /* Test iterating over empty group */ info.command = RET_ZERO; idx = 0; - ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); - VERIFY(ret, SUCCEED, "H5Literate"); + ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); + VERIFY(ret, SUCCEED, "H5Literate2"); datatype = H5Tcopy(H5T_NATIVE_INT); CHECK(datatype, FAIL, "H5Tcopy"); @@ -220,12 +220,12 @@ test_iter_group(hid_t fapl, hbool_t new_format) VERIFY(ginfo.nlinks, (NDATASETS + 2), "H5Gget_info"); for(i = 0; i< (int)ginfo.nlinks; i++) { - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ ret = (herr_t)H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, dataset_name, (size_t)NAMELEN, H5P_DEFAULT); CHECK(ret, FAIL, "H5Lget_name_by_idx"); - ret = H5Oget_info_by_idx2(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret = H5Oget_info_by_idx3(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_idx"); } /* end for */ @@ -246,13 +246,13 @@ test_iter_group(hid_t fapl, hbool_t new_format) VERIFY(ginfo.nlinks, NDATASETS + 2, "H5Gget_info"); for(i = 0; i< (int)ginfo.nlinks; i++) { - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ ret = (herr_t)H5Lget_name_by_idx(file, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, dataset_name, (size_t)NAMELEN, H5P_DEFAULT); CHECK(ret, FAIL, "H5Lget_name_by_idx"); - ret = H5Oget_info_by_idx2(file, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_idx"); + ret = H5Oget_info_by_idx3(file, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_idx3"); } /* end for */ H5E_BEGIN_TRY { @@ -264,28 +264,28 @@ test_iter_group(hid_t fapl, hbool_t new_format) info.command = RET_ZERO; idx = (hsize_t)-1; H5E_BEGIN_TRY { - ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); + ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Literate"); + VERIFY(ret, FAIL, "H5Literate2"); /* Test skipping exactly as many entries as in the group */ idx = NDATASETS + 2; H5E_BEGIN_TRY { - ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); + ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Literate"); + VERIFY(ret, FAIL, "H5Literate2"); /* Test skipping more entries than are in the group */ idx = NDATASETS + 3; H5E_BEGIN_TRY { - ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); + ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Literate"); + VERIFY(ret, FAIL, "H5Literate2"); /* Test all objects in group, when callback always returns 0 */ info.command = RET_ZERO; idx = 0; - if((ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) + if((ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) TestErrPrintf("Group iteration function didn't return zero correctly!\n"); /* Test all objects in group, when callback always returns 1 */ @@ -293,15 +293,15 @@ test_iter_group(hid_t fapl, hbool_t new_format) info.command = RET_TWO; i = 0; idx = 0; - while((ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) { + while((ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) { /* Verify return value from iterator gets propagated correctly */ - VERIFY(ret, 2, "H5Literate"); + VERIFY(ret, 2, "H5Literate2"); /* Increment the number of times "2" is returned */ i++; /* Verify that the index is the correct value */ - VERIFY(idx, (hsize_t)i, "H5Literate"); + VERIFY(idx, (hsize_t)i, "H5Literate2"); if(idx > (NDATASETS + 2)) TestErrPrintf("Group iteration function walked too far!\n"); @@ -309,7 +309,7 @@ test_iter_group(hid_t fapl, hbool_t new_format) if(HDstrcmp(info.name, lnames[(size_t)(idx - 1)]) != 0) TestErrPrintf("Group iteration function didn't return name correctly for link - lnames[%u] = '%s'!\n", (unsigned)(idx - 1), lnames[(size_t)(idx - 1)]); } /* end while */ - VERIFY(ret, -1, "H5Literate"); + VERIFY(ret, -1, "H5Literate2"); if(i != (NDATASETS + 2)) TestErrPrintf("%u: Group iteration function didn't perform multiple iterations correctly!\n", __LINE__); @@ -319,15 +319,15 @@ test_iter_group(hid_t fapl, hbool_t new_format) info.command = new_format ? RET_CHANGE2 : RET_CHANGE; i = 0; idx = 0; - while((ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) >= 0) { + while((ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) >= 0) { /* Verify return value from iterator gets propagated correctly */ - VERIFY(ret, 1, "H5Literate"); + VERIFY(ret, 1, "H5Literate2"); /* Increment the number of times "1" is returned */ i++; /* Verify that the index is the correct value */ - VERIFY(idx, (hsize_t)(i + 10), "H5Literate"); + VERIFY(idx, (hsize_t)(i + 10), "H5Literate2"); if(idx > (NDATASETS + 2)) TestErrPrintf("Group iteration function walked too far!\n"); @@ -335,7 +335,7 @@ test_iter_group(hid_t fapl, hbool_t new_format) if(HDstrcmp(info.name, lnames[(size_t)(idx - 1)]) != 0) TestErrPrintf("Group iteration function didn't return name correctly for link - lnames[%u] = '%s'!\n", (unsigned)(idx - 1), lnames[(size_t)(idx - 1)]); } /* end while */ - VERIFY(ret, -1, "H5Literate"); + VERIFY(ret, -1, "H5Literate2"); if(i != 42 || idx != 52) TestErrPrintf("%u: Group iteration function didn't perform multiple iterations correctly!\n", __LINE__); @@ -550,11 +550,11 @@ H5_ATTR_PURE int iter_strcmp2(const void *s1, const void *s2) ** ****************************************************************/ static herr_t -liter_cb2(hid_t loc_id, const char *name, const H5L_info_t H5_ATTR_UNUSED *link_info, +liter_cb2(hid_t loc_id, const char *name, const H5L_info2_t H5_ATTR_UNUSED *link_info, void *opdata) { const iter_info *test_info = (const iter_info *)opdata; - H5O_info_t oinfo; + H5O_info2_t oinfo; herr_t ret; /* Generic return value */ if(HDstrcmp(name, test_info->name)) { @@ -565,8 +565,8 @@ liter_cb2(hid_t loc_id, const char *name, const H5L_info_t H5_ATTR_UNUSED *link_ /* * Get type of the object and check it. */ - ret = H5Oget_info_by_name2(loc_id, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(loc_id, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); if(test_info->type != oinfo.type) { TestErrPrintf("test_info->type = %d, oinfo.type = %d\n", test_info->type, (int)oinfo.type); @@ -683,14 +683,14 @@ test_iter_group_large(hid_t fapl) /* Iterate through the file to see members of the root group */ curr_name = &names[0]; - ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, NULL, liter_cb2, curr_name); - CHECK(ret, FAIL, "H5Literate"); + ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, NULL, liter_cb2, curr_name); + CHECK(ret, FAIL, "H5Literate2"); for(i = 1; i < 100; i++) { hsize_t idx = (hsize_t)i; curr_name = &names[i]; - ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb2, curr_name); - CHECK(ret, FAIL, "H5Literate"); + ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb2, curr_name); + CHECK(ret, FAIL, "H5Literate2"); } /* end for */ /* Close file */ @@ -793,7 +793,7 @@ static void test_grp_memb_funcs(hid_t fapl) VERIFY(ginfo.nlinks, (NDATASETS + 2), "H5Gget_info"); for(i = 0; i < (int)ginfo.nlinks; i++) { - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ /* Test with NULL for name, to query length */ name_len = H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, NULL, (size_t)NAMELEN, H5P_DEFAULT); @@ -809,8 +809,8 @@ static void test_grp_memb_funcs(hid_t fapl) obj_names[i] = HDstrdup(dataset_name); CHECK_PTR(obj_names[i], "strdup"); - ret = H5Oget_info_by_idx2(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_idx"); + ret = H5Oget_info_by_idx3(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_idx3"); if(!HDstrcmp(dataset_name, "grp")) VERIFY(oinfo.type, H5O_TYPE_GROUP, "H5Lget_name_by_idx"); @@ -890,21 +890,21 @@ static void test_links(hid_t fapl) /* Test these two functions, H5Oget_info_by_idx and H5Lget_name_by_idx */ for(i = 0; i < ginfo.nlinks; i++) { - H5O_info_t oinfo; /* Object info */ - H5L_info_t linfo; /* Link info */ + H5O_info2_t oinfo; /* Object info */ + H5L_info2_t linfo; /* Link info */ /* Get link name */ name_len = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, i, obj_name, (size_t)NAMELEN, H5P_DEFAULT); CHECK(name_len, FAIL, "H5Lget_name_by_idx"); /* Get link type */ - ret = H5Lget_info_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &linfo, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Lget_info_by_idx"); + ret = H5Lget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &linfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info_by_idx2"); /* Get object type */ if(linfo.type == H5L_TYPE_HARD) { - ret = H5Oget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_idx"); + ret = H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_idx3"); } /* end if */ if(!HDstrcmp(obj_name, "g1.1")) @@ -1015,6 +1015,87 @@ static void test_corrupted_attnamelen(void) } /* test_corrupted_attnamelen() */ +#ifndef H5_NO_DEPRECATED_SYMBOLS +/**************************************************************** +** +** test_links_deprec(): Test soft and hard link iteration +** +****************************************************************/ +static void test_links_deprec(hid_t fapl) +{ + hid_t file; /* File ID */ + char obj_name[NAMELEN]; /* Names of the object in group */ + ssize_t name_len; /* Length of object's name */ + hid_t gid, gid1; + H5G_info_t ginfo; /* Buffer for querying object's info */ + hsize_t i; + herr_t ret; /* Generic return value */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing Soft and Hard Link Iteration Functionality Using Deprecated Routines\n")); + + /* Create the test file with the datasets */ + file = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + CHECK(file, FAIL, "H5Fcreate"); + + /* create groups */ + gid = H5Gcreate2(file, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(gid, FAIL, "H5Gcreate2"); + + gid1 = H5Gcreate2(file, "/g1/g1.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(gid1, FAIL, "H5Gcreate2"); + + /* create soft and hard links to the group "/g1". */ + ret = H5Lcreate_soft("something", gid, "softlink", H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lcreate_soft"); + + ret = H5Lcreate_hard(gid, "/g1", H5L_SAME_LOC, "hardlink", H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lcreate_hard"); + + ret = H5Gget_info(gid, &ginfo); + CHECK(ret, FAIL, "H5Gget_info"); + VERIFY(ginfo.nlinks, 3, "H5Gget_info"); + + /* Test these two functions, H5Oget_info_by_idx and H5Lget_name_by_idx */ + for(i = 0; i < ginfo.nlinks; i++) { + H5O_info2_t oinfo; /* Object info */ + H5L_info2_t linfo; /* Link info */ + + /* Get link name */ + name_len = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, i, obj_name, (size_t)NAMELEN, H5P_DEFAULT); + CHECK(name_len, FAIL, "H5Lget_name_by_idx"); + + /* Get link type */ + ret = H5Lget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &linfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info_by_idx1"); + + /* Get object type */ + if(linfo.type == H5L_TYPE_HARD) { + ret = H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_idx"); + } /* end if */ + + if(!HDstrcmp(obj_name, "g1.1")) + VERIFY(oinfo.type, H5O_TYPE_GROUP, "H5Lget_name_by_idx"); + else if(!HDstrcmp(obj_name, "hardlink")) + VERIFY(oinfo.type, H5O_TYPE_GROUP, "H5Lget_name_by_idx"); + else if(!HDstrcmp(obj_name, "softlink")) + VERIFY(linfo.type, H5L_TYPE_SOFT, "H5Lget_name_by_idx"); + else + CHECK(0, 0, "unknown object name"); + } /* end for */ + + ret = H5Gclose(gid); + CHECK(ret, FAIL, "H5Gclose"); + + ret = H5Gclose(gid1); + CHECK(ret, FAIL, "H5Gclose"); + + ret = H5Fclose(file); + CHECK(ret, FAIL, "H5Fclose"); +} /* test_links_deprec() */ +#endif + /**************************************************************** ** ** test_iterate(): Main iteration testing routine. @@ -1049,6 +1130,9 @@ test_iterate(void) test_iter_attr(new_format ? fapl2 : fapl, new_format); /* Test attribute iteration */ test_grp_memb_funcs(new_format ? fapl2 : fapl); /* Test group member information functions */ test_links(new_format ? fapl2 : fapl); /* Test soft and hard link iteration */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + test_links_deprec(new_format ? fapl2 : fapl); /* Test soft and hard link iteration */ +#endif } /* end for */ /* Test the fix for issue HDFFV-10588 */ diff --git a/test/tmisc.c b/test/tmisc.c index 62d9cd4..0ea9c4c 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -313,6 +313,7 @@ typedef struct /* Definitions for misc. test #30 */ #define MISC30_FILE "tmisc30.h5" +#ifndef H5_NO_DEPRECATED_SYMBOLS /* Definitions for misc. test #31 */ #define MISC31_FILE "tmisc31.h5" #define MISC31_DSETNAME "dset" @@ -321,6 +322,7 @@ typedef struct #define MISC31_GROUPNAME "group" #define MISC31_PROPNAME "misc31_prop" #define MISC31_DTYPENAME "dtype" +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Definitions for misc. test #33 */ /* Note that this test file is generated by "gen_bad_offset.c" */ @@ -653,7 +655,7 @@ static void test_misc4(void) { hid_t file1, file2, group1, group2, group3; - H5O_info_t oinfo1, oinfo2, oinfo3; + H5O_info2_t oinfo1, oinfo2, oinfo3; herr_t ret; /* Output message about test being performed */ @@ -678,12 +680,12 @@ test_misc4(void) CHECK(group3, FAIL, "H5Gcreate2"); /* Get the stat information for each group */ - ret = H5Oget_info_by_name2(file1, MISC4_GROUP_1, &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(file1, MISC4_GROUP_2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(file2, MISC4_GROUP_1, &oinfo3, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(file1, MISC4_GROUP_1, &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(file1, MISC4_GROUP_2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(file2, MISC4_GROUP_1, &oinfo3, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); /* Verify that the fileno values are the same for groups from file1 */ VERIFY(oinfo1.fileno, oinfo2.fileno, "H5Oget_info_by_name"); @@ -2915,7 +2917,11 @@ test_misc18(void) hid_t sid; /* 'Space ID */ hid_t did1, did2; /* Dataset IDs */ hid_t aid; /* Attribute ID */ - H5O_info_t oinfo; /* Information about object */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + H5O_info1_t old_oinfo; /* (deprecated) information about object */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + H5O_info2_t oinfo; /* Data model information about object */ + H5O_native_info_t ninfo; /* Native file format information about object */ char attr_name[32]; /* Attribute name buffer */ unsigned u; /* Local index variable */ herr_t ret; /* Generic return value */ @@ -2933,26 +2939,48 @@ test_misc18(void) CHECK(did1, FAIL, "H5Dcreate2"); /* Get object information */ - ret = H5Oget_info_by_name2(fid, MISC18_DSET1_NAME, &oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT); + ret = H5Oget_info_by_name3(fid, MISC18_DSET1_NAME, &oinfo, H5O_INFO_NUM_ATTRS, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.nmesgs, 6, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.nchunks, 1, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.space.total, 272, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.space.free, 152, "H5Oget_info_by_name"); VERIFY(oinfo.num_attrs, 0, "H5Oget_info_by_name"); +#ifndef H5_NO_DEPRECATED_SYMBOLS + ret = H5Oget_info_by_name2(fid, MISC18_DSET1_NAME, &old_oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.nmesgs, 6, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.nchunks, 1, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.space.total, 272, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.space.free, 152, "H5Oget_info_by_name"); + VERIFY(old_oinfo.num_attrs, 0, "H5Oget_info_by_name"); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + ret = H5Oget_native_info_by_name(fid, MISC18_DSET1_NAME, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.nmesgs, 6, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.nchunks, 1, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.space.total, 272, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.space.free, 152, "H5Oget_native_info_by_name"); /* Create second dataset */ did2 = H5Dcreate2(fid, MISC18_DSET2_NAME, H5T_STD_U32LE, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(did2, FAIL, "H5Dcreate2"); /* Get object information */ - ret = H5Oget_info_by_name2(fid, MISC18_DSET2_NAME, &oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT); + ret = H5Oget_info_by_name3(fid, MISC18_DSET2_NAME, &oinfo, H5O_INFO_NUM_ATTRS, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.nmesgs, 6, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.nchunks, 1, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.space.total, 272, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.space.free, 152, "H5Oget_info_by_name"); VERIFY(oinfo.num_attrs, 0, "H5Oget_info_by_name"); +#ifndef H5_NO_DEPRECATED_SYMBOLS + ret = H5Oget_info_by_name2(fid, MISC18_DSET2_NAME, &old_oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.nmesgs, 6, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.nchunks, 1, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.space.total, 272, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.space.free, 152, "H5Oget_info_by_name"); + VERIFY(old_oinfo.num_attrs, 0, "H5Oget_info_by_name"); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + ret = H5Oget_native_info_by_name(fid, MISC18_DSET2_NAME, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.nmesgs, 6, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.nchunks, 1, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.space.total, 272, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.space.free, 152, "H5Oget_native_info_by_name"); /* Loop creating attributes on each dataset, flushing them to the file each time */ for(u = 0; u < 10; u++) { @@ -2979,22 +3007,44 @@ test_misc18(void) } /* end for */ /* Get object information for dataset #1 now */ - ret = H5Oget_info_by_name2(fid, MISC18_DSET1_NAME, &oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT); + ret = H5Oget_info_by_name3(fid, MISC18_DSET1_NAME, &oinfo, H5O_INFO_NUM_ATTRS, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.nmesgs, 24, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.nchunks, 9, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.space.total, 888, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.space.free, 16, "H5Oget_info_by_name"); VERIFY(oinfo.num_attrs, 10, "H5Oget_info_by_name"); +#ifndef H5_NO_DEPRECATED_SYMBOLS + ret = H5Oget_info_by_name2(fid, MISC18_DSET1_NAME, &old_oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.nmesgs, 24, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.nchunks, 9, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.space.total, 888, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.space.free, 16, "H5Oget_info_by_name"); + VERIFY(old_oinfo.num_attrs, 10, "H5Oget_info_by_name"); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + ret = H5Oget_native_info_by_name(fid, MISC18_DSET1_NAME, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.nmesgs, 24, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.nchunks, 9, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.space.total, 888, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.space.free, 16, "H5Oget_native_info_by_name"); /* Get object information for dataset #2 now */ - ret = H5Oget_info_by_name2(fid, MISC18_DSET2_NAME, &oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT); + ret = H5Oget_info_by_name3(fid, MISC18_DSET2_NAME, &oinfo, H5O_INFO_NUM_ATTRS, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.nmesgs, 24, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.nchunks, 9, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.space.total, 888, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.space.free, 16, "H5Oget_info_by_name"); VERIFY(oinfo.num_attrs, 10, "H5Oget_info_by_name"); +#ifndef H5_NO_DEPRECATED_SYMBOLS + ret = H5Oget_info_by_name2(fid, MISC18_DSET2_NAME, &old_oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.nmesgs, 24, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.nchunks, 9, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.space.total, 888, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.space.free, 16, "H5Oget_info_by_name"); + VERIFY(old_oinfo.num_attrs, 10, "H5Oget_info_by_name"); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + ret = H5Oget_native_info_by_name(fid, MISC18_DSET2_NAME, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_mative_info_by_name"); + VERIFY(ninfo.hdr.nmesgs, 24, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.nchunks, 9, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.space.total, 888, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.space.free, 16, "H5Oget_native_info_by_name"); /* Close second dataset */ ret = H5Dclose(did2); @@ -3919,7 +3969,7 @@ test_misc23(void) hid_t file_id=0, group_id=0, type_id=0, space_id=0, tmp_id=0, create_id=H5P_DEFAULT, access_id=H5P_DEFAULT; char objname[MISC23_NAME_BUF_SIZE]; /* Name of object */ - H5O_info_t oinfo; + H5O_info2_t oinfo; htri_t tri_status; ssize_t namelen; herr_t status; @@ -4002,9 +4052,9 @@ test_misc23(void) tmp_id = H5Gopen2(file_id, "/A/B01", H5P_DEFAULT); CHECK(tmp_id, FAIL, "H5Gopen2"); - status = H5Oget_info2(tmp_id, &oinfo, H5O_INFO_BASIC); - CHECK(status, FAIL, "H5Oget_info"); - VERIFY(oinfo.rc, 1, "H5Oget_info"); + status = H5Oget_info3(tmp_id, &oinfo, H5O_INFO_BASIC); + CHECK(status, FAIL, "H5Oget_info3"); + VERIFY(oinfo.rc, 1, "H5Oget_info3"); status = H5Gclose(tmp_id); CHECK(status, FAIL, "H5Gclose"); @@ -5278,18 +5328,18 @@ test_misc29(void) static int -test_misc30_get_info_cb(hid_t loc_id, const char *name, const H5L_info_t H5_ATTR_UNUSED *info, +test_misc30_get_info_cb(hid_t loc_id, const char *name, const H5L_info2_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *op_data) { - H5O_info_t object_info; + H5O_info2_t object_info; - return H5Oget_info_by_name2(loc_id, name, &object_info, H5O_INFO_BASIC, H5P_DEFAULT); + return H5Oget_info_by_name3(loc_id, name, &object_info, H5O_INFO_BASIC, H5P_DEFAULT); } static int test_misc30_get_info(hid_t loc_id) { - return H5Literate(loc_id, H5_INDEX_NAME, H5_ITER_INC, NULL, test_misc30_get_info_cb, NULL); + return H5Literate2(loc_id, H5_INDEX_NAME, H5_ITER_INC, NULL, test_misc30_get_info_cb, NULL); } @@ -5368,6 +5418,7 @@ test_misc30(void) static void test_misc31(void) { +#ifndef H5_NO_DEPRECATED_SYMBOLS hid_t file_id; /* File id */ hid_t space_id; /* Dataspace id */ hid_t dset_id; /* Dataset id */ @@ -5375,6 +5426,7 @@ test_misc31(void) hid_t group_id; /* Group id */ hid_t dtype_id; /* Datatype id */ herr_t ret; /* Generic return value */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Output message about test being performed */ MESSAGE(5, ("Deprecated routines initialize after H5close()\n")); @@ -5537,7 +5589,7 @@ test_misc33(void) { hid_t fid = -1; /* File ID */ const char *testfile = H5_get_srcdir_filename(MISC33_FILE); /* Corrected test file name */ - H5O_info_t oinfo; /* Structure for object metadata information */ + H5O_info2_t oinfo; /* Structure for object metadata information */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -5549,21 +5601,21 @@ test_misc33(void) /* Case (1) */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_name2(fid, "/soft_two", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret = H5Oget_info_by_name3(fid, "/soft_two", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Oget_info_by_name"); + VERIFY(ret, FAIL, "H5Oget_info_by_name3"); /* Case (2) */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_name2(fid, "/dsetA", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret = H5Oget_info_by_name3(fid, "/dsetA", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Oget_info_by_name"); + VERIFY(ret, FAIL, "H5Oget_info_by_name3"); /* Case (3) */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_name2(fid, "/soft_one", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret = H5Oget_info_by_name3(fid, "/soft_one", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Oget_info_by_name"); + VERIFY(ret, FAIL, "H5Oget_info_by_name3"); /* Close the file */ ret = H5Fclose(fid); @@ -5732,6 +5784,8 @@ cleanup_misc(void) HDremove(MISC28_FILE); HDremove(MISC29_COPY_FILE); HDremove(MISC30_FILE); +#ifndef H5_NO_DEPRECATED_SYMBOLS HDremove(MISC31_FILE); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* end cleanup_misc() */ diff --git a/test/trefer.c b/test/trefer.c index dec049e..441b7aa 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -568,7 +568,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) hsize_t high[SPACE2_RANK]; /* Selection bounds */ H5R_ref_t *wbuf, /* buffer to write to disk */ *rbuf; /* buffer read from disk */ - H5R_ref_t nvrbuf[3]={{{0}},{{101}},{{-128}}}; /* buffer with non-valid refs */ + H5R_ref_t nvrbuf[3]={{{{0}}},{{{101}}},{{{255}}}}; /* buffer with non-valid refs */ uint8_t *dwbuf, /* Buffer for writing numeric data to disk */ *drbuf; /* Buffer for reading numeric data from disk */ uint8_t *tu8; /* Temporary pointer to uint8 data */ @@ -1380,7 +1380,7 @@ test_reference_obj_deleted(void) ** ****************************************************************/ static herr_t -test_deref_iter_op(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_UNUSED *info, +test_deref_iter_op(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t H5_ATTR_UNUSED *info, void *op_data) { int *count = (int *)op_data; /* Pointer to name counter */ @@ -1430,7 +1430,7 @@ test_reference_group(void) H5R_ref_t rref; /* Reference to read */ H5G_info_t ginfo; /* Group info struct */ char objname[NAME_SIZE]; /* Buffer to store name */ - H5O_info_t oinfo; /* Object info struct */ + H5O_info2_t oinfo; /* Object info struct */ int count = 0; /* Count within iterated group */ ssize_t size; /* Name length */ herr_t ret; @@ -1508,7 +1508,7 @@ test_reference_group(void) CHECK(gid, H5I_INVALID_HID, "H5Ropen_object"); /* Iterate through objects in dereferenced group */ - ret = H5Literate(gid, H5_INDEX_NAME, H5_ITER_INC, NULL, test_deref_iter_op, &count); + ret = H5Literate2(gid, H5_INDEX_NAME, H5_ITER_INC, NULL, test_deref_iter_op, &count); CHECK(ret, FAIL, "H5Literate"); /* Various queries on the group opened */ @@ -1520,9 +1520,9 @@ test_reference_group(void) CHECK(size, (-1), "H5Lget_name_by_idx"); VERIFY_STR(objname, DSETNAME2, "H5Lget_name_by_idx"); - ret = H5Oget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_idx"); - VERIFY(oinfo.type, H5O_TYPE_DATASET, "H5Oget_info_by_idx"); + ret = H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_idx3"); + VERIFY(oinfo.type, H5O_TYPE_DATASET, "H5Oget_info_by_idx3"); /* Unlink one of the objects in the dereferenced group */ ret = H5Ldelete(gid, GROUPNAME2, H5P_DEFAULT); diff --git a/test/trefer_deprec.c b/test/trefer_deprec.c index 6322894..a830314 100644 --- a/test/trefer_deprec.c +++ b/test/trefer_deprec.c @@ -517,7 +517,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) hsize_t high[SPACE2_RANK]; /* Selection bounds */ hdset_reg_ref_t *wbuf, /* buffer to write to disk */ *rbuf; /* buffer read from disk */ - hdset_reg_ref_t nvrbuf[3]={{{0}},{{101}},{{-128}}}; /* buffer with non-valid refs */ + hdset_reg_ref_t nvrbuf[3]={{{0}},{{101}},{{255}}}; /* buffer with non-valid refs */ uint8_t *dwbuf, /* Buffer for writing numeric data to disk */ *drbuf; /* Buffer for reading numeric data from disk */ uint8_t *tu8; /* Temporary pointer to uint8 data */ @@ -1313,7 +1313,7 @@ test_reference_obj_deleted(void) ** ****************************************************************/ static herr_t -test_deref_iter_op(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_UNUSED *info, +test_deref_iter_op(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t H5_ATTR_UNUSED *info, void *op_data) { int *count = (int *)op_data; /* Pointer to name counter */ @@ -1363,7 +1363,7 @@ test_reference_group(void) hobj_ref_t rref; /* Reference to read */ H5G_info_t ginfo; /* Group info struct */ char objname[NAME_SIZE]; /* Buffer to store name */ - H5O_info_t oinfo; /* Object info struct */ + H5O_info2_t oinfo; /* Object info struct */ int count = 0; /* Count within iterated group */ ssize_t size; /* Name length */ herr_t ret; @@ -1438,7 +1438,7 @@ test_reference_group(void) CHECK(gid, FAIL, "H5Rdereference2"); /* Iterate through objects in dereferenced group */ - ret = H5Literate(gid, H5_INDEX_NAME, H5_ITER_INC, NULL, test_deref_iter_op, &count); + ret = H5Literate2(gid, H5_INDEX_NAME, H5_ITER_INC, NULL, test_deref_iter_op, &count); CHECK(ret, FAIL, "H5Literate"); /* Various queries on the group opened */ @@ -1450,9 +1450,9 @@ test_reference_group(void) CHECK(size, FAIL, "H5Lget_name_by_idx"); VERIFY_STR(objname, DSETNAME2, "H5Lget_name_by_idx"); - ret = H5Oget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_idx"); - VERIFY(oinfo.type, H5O_TYPE_DATASET, "H5Oget_info_by_idx"); + ret = H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_idx3"); + VERIFY(oinfo.type, H5O_TYPE_DATASET, "H5Oget_info_by_idx3"); /* Unlink one of the objects in the dereferenced group */ ret = H5Ldelete(gid, GROUPNAME2, H5P_DEFAULT); diff --git a/test/tsohm.c b/test/tsohm.c index c126608..f39b5e5 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -743,7 +743,7 @@ size1_helper(hid_t file, const char *filename, hid_t fapl_id, hbool_t test_file_ */ static h5_stat_size_t getsize_testsize1(const char *filename, hid_t fcpl_id, hid_t fapl_id, - hbool_t test_file_closing, H5O_info_t *oinfo) + hbool_t test_file_closing, H5O_native_info_t *ninfo) { hid_t fid = H5I_INVALID_HID; herr_t ret; @@ -758,8 +758,8 @@ getsize_testsize1(const char *filename, hid_t fcpl_id, hid_t fapl_id, fid = size1_helper(fid, filename, fapl_id, test_file_closing); CHECK(fid, H5I_INVALID_HID, "size1_helper"); - ret = H5Oget_info_by_name2(fid, DSETNAME[0], oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); + ret = H5Oget_native_info_by_name(fid, DSETNAME[0], ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); @@ -807,7 +807,7 @@ test_sohm_size1(void) h5_stat_size_t sohm_final_filesize2; h5_stat_size_t sohm_btree_final_filesize2; - H5O_info_t oinfo; + H5O_native_info_t ninfo; unsigned num_indexes = 1; unsigned index_flags = H5O_SHMESG_DTYPE_FLAG; unsigned min_mesg_size = 50; @@ -866,10 +866,10 @@ test_sohm_size1(void) /* size of populated file, with different populating behaviors */ test_open_close = TRUE; - file_sizes[size_index++] = getsize_testsize1(FILENAME, fcpl_id, fapl_id, test_open_close, &oinfo); + file_sizes[size_index++] = getsize_testsize1(FILENAME, fcpl_id, fapl_id, test_open_close, &ninfo); test_open_close = FALSE; - file_sizes[size_index++] = getsize_testsize1(FILENAME, fcpl_id, fapl_id, test_open_close, &oinfo); - oh_sizes[oh_size_index++] = oinfo.hdr.space.total; + file_sizes[size_index++] = getsize_testsize1(FILENAME, fcpl_id, fapl_id, test_open_close, &ninfo); + oh_sizes[oh_size_index++] = ninfo.hdr.space.total; ret = H5Pclose(fcpl_id); CHECK_I(ret, "H5Pclose"); @@ -974,7 +974,7 @@ test_sohm_size_consistency_open_create(void) unsigned use_btree; hsize_t oh_size_open; hsize_t oh_size_create; - H5O_info_t oinfo; + H5O_native_info_t oinfo; unsigned num_indexes = 1; unsigned index_flags = H5O_SHMESG_DTYPE_FLAG; unsigned min_mesg_size = 50; @@ -1024,8 +1024,8 @@ test_sohm_size_consistency_open_create(void) CHECK_I(file, "size1_helper"); /* Get the size of a dataset object header */ - ret = H5Oget_info_by_name2(file, DSETNAME[0], &oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK_I(ret, "H5Oget_info_by_name"); + ret = H5Oget_native_info_by_name(file, DSETNAME[0], &oinfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK_I(ret, "H5Oget_native_info_by_name"); oh_size_open = oinfo.hdr.space.total; ret = H5Fclose(file); @@ -1039,8 +1039,8 @@ test_sohm_size_consistency_open_create(void) CHECK_I(file, "size1_helper"); /* Get the size of a dataset object header */ - ret = H5Oget_info_by_name2(file, DSETNAME[0], &oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK_I(ret, "H5Oget_info_by_name"); + ret = H5Oget_native_info_by_name(file, DSETNAME[0], &oinfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK_I(ret, "H5Oget_native_info_by_name"); oh_size_create = oinfo.hdr.space.total; ret = H5Fclose(file); diff --git a/test/tvlstr.c b/test/tvlstr.c index 731270c..b93d646 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -861,13 +861,12 @@ static void test_write_same_element(void) hid_t file1, dataset1; hid_t mspace, fspace, dtype; hsize_t fdim[] = {SPACE1_DIM1}; - char *val[SPACE1_DIM1] = {"But", "reuniting", "is a", "great joy"}; + const char *wdata[SPACE1_DIM1] = {"Parting", "is such a", "sweet", "sorrow."}; + const char *val[SPACE1_DIM1] = {"But", "reuniting", "is a", "great joy"}; hsize_t marray[] = {NUMP}; hsize_t coord[SPACE1_RANK][NUMP]; herr_t ret; - char *wdata[SPACE1_DIM1] = {"Parting", "is such a", "sweet", "sorrow."}; - file1 = H5Fcreate(DATAFILE3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(file1, FAIL, "H5Fcreate"); diff --git a/test/unlink.c b/test/unlink.c index 5199dcf..48dd79d 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -433,10 +433,11 @@ test_new_move(hid_t fapl) static int check_new_move(hid_t fapl) { - hid_t file; - H5O_info_t oi_hard1, oi_hard2; - char filename[1024]; - char linkval[1024]; + H5O_info2_t oi_hard1, oi_hard2; + hid_t file; + char filename[1024]; + char linkval[1024]; + int token_cmp; TESTING("check new move function"); @@ -446,15 +447,17 @@ check_new_move(hid_t fapl) FAIL_STACK_ERROR /* Get hard link info */ - if(H5Oget_info_by_name2(file, "/group2/group_new_name", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(file, "/group2/group_new_name", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file, "/group1/hard", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(file, "/group1/hard", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check hard links */ if(H5O_TYPE_GROUP != oi_hard1.type || H5O_TYPE_GROUP != oi_hard2.type) FAIL_PUTS_ERROR(" Unexpected object type, should have been a group") - if(H5F_addr_ne(oi_hard1.addr, oi_hard2.addr)) + if(H5Otoken_cmp(file, &oi_hard1.token, &oi_hard2.token, &token_cmp) < 0) + FAIL_PUTS_ERROR(" H5Otoken_cmp failed") + if(token_cmp) FAIL_PUTS_ERROR(" Hard link test failed. Link seems not to point to the expected file location.") /* Check soft links */ @@ -2156,7 +2159,7 @@ test_full_group_compact(hid_t fapl) { hid_t file_id = -1; hid_t gid = -1, gid2 = -1; /* Group IDs */ - H5O_info_t oi; /* Stat buffer for object */ + H5O_info2_t oi; /* Stat buffer for object */ char objname[128]; /* Buffer for name of objects to create */ char objname2[128]; /* Buffer for name of objects to create */ char filename[1024]; /* Buffer for filename */ @@ -2228,7 +2231,7 @@ test_full_group_compact(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { HDsprintf(objname, "/keep/keep %u\n", u); - if(H5Oget_info_by_name2(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi.rc != 2) TEST_ERROR } /* end for */ @@ -2245,7 +2248,7 @@ test_full_group_compact(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { HDsprintf(objname, "/keep/keep %u\n", u); - if(H5Oget_info_by_name2(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi.rc != 1) TEST_ERROR } /* end for */ @@ -2290,7 +2293,7 @@ test_full_group_dense(hid_t fapl) hid_t file_id = -1; hid_t gcpl = (-1); /* Group creation property list ID */ hid_t gid = -1, gid2 = -1; /* Group IDs */ - H5O_info_t oi; /* Stat buffer for object */ + H5O_info2_t oi; /* Stat buffer for object */ char objname[128]; /* Buffer for name of objects to create */ char objname2[128]; /* Buffer for name of objects to create */ char filename[1024]; /* Buffer for filename */ @@ -2374,7 +2377,7 @@ test_full_group_dense(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { HDsprintf(objname, "/keep/keep %u\n", u); - if(H5Oget_info_by_name2(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi.rc != 2) TEST_ERROR } /* end for */ @@ -2391,7 +2394,7 @@ test_full_group_dense(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { HDsprintf(objname, "/keep/keep %u\n", u); - if(H5Oget_info_by_name2(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi.rc != 1) TEST_ERROR } /* end for */ diff --git a/test/unregister.c b/test/unregister.c index ff116cf..db37f3e 100644 --- a/test/unregister.c +++ b/test/unregister.c @@ -95,11 +95,20 @@ test_unregister_filters(hid_t fapl_id) char filename[FILENAME_BUF_SIZE]; const hsize_t chunk_dims[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2}; /* Chunk dimensions */ hsize_t dims[2]; - int data[DSET_DIM1][DSET_DIM2]; + int **buf = NULL; + int *buf_data = NULL; herr_t ret; TESTING("Unregistering filter"); + /* Set up data array */ + if(NULL == (buf_data = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int)))) + TEST_ERROR; + if(NULL == (buf = (int **)HDcalloc(DSET_DIM1, sizeof(buf_data)))) + TEST_ERROR; + for (i = 0; i < DSET_DIM1; i++) + buf[i] = buf_data + (i * DSET_DIM2); + /* Create first file */ h5_fixname(FILENAME[0], fapl_id, filename, sizeof(filename)); if((fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) @@ -176,7 +185,7 @@ test_unregister_filters(hid_t fapl_id) /* Initialize the data for writing */ for(i = n = 0; i < DSET_DIM1; i++) for(j = 0; j < DSET_DIM2; j++) - data[i][j] = n++; + buf[i][j] = n++; /* Create the dataspace */ dims[0] = DSET_DIM1; @@ -189,7 +198,7 @@ test_unregister_filters(hid_t fapl_id) goto error; /* Write the data to the dataset */ - if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0) goto error; /* Unregister the filter before closing the dataset. It should fail */ @@ -211,7 +220,7 @@ test_unregister_filters(hid_t fapl_id) goto error; /* Write the data to the dataset */ - if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0) goto error; /* Close the dataset in the second file */ @@ -232,6 +241,9 @@ test_unregister_filters(hid_t fapl_id) if(H5Fclose(fid2) < 0) goto error; + HDfree(buf); + HDfree(buf_data); + PASSED(); return SUCCEED; @@ -247,6 +259,9 @@ error: H5Sclose(sid); } H5E_END_TRY; + HDfree(buf); + HDfree(buf_data); + return FAIL; } @@ -317,7 +317,7 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, hid_t dset = -1; /* Virtual dataset */ H5D_space_status_t space_status; /* Dataset space status */ void *plist_buf = NULL; /* Serialized property list buffer */ - H5O_info_t oinfo; /* Object info struct */ + H5O_native_info_t ninfo; /* Object info struct */ htri_t tri_ret; HDassert((config >= TEST_API_BASIC) && (config < TEST_API_NTESTS)); @@ -372,23 +372,23 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, TEST_ERROR /* Test H5Oget_info returns correct metadata size */ - if(H5Oget_info2(dset, &oinfo, H5O_INFO_META_SIZE) < 0) + if(H5Oget_native_info(dset, &ninfo, H5O_NATIVE_INFO_META_SIZE) < 0) TEST_ERROR - if(oinfo.meta_size.obj.index_size != (hsize_t)0) + if(ninfo.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) { - HDprintf("VDS metadata size: %llu Expected: %llu\n", (long long unsigned)oinfo.meta_size.obj.heap_size, (long long unsigned)exp_meta_size); + if(ninfo.meta_size.obj.heap_size != exp_meta_size) { + HDprintf("VDS metadata size: %llu Expected: %llu\n", (long long unsigned)ninfo.meta_size.obj.heap_size, (long long unsigned)exp_meta_size); TEST_ERROR } } else - if((oinfo.meta_size.obj.heap_size != exp_meta_size) - && (oinfo.meta_size.obj.heap_size != (hsize_t)0)) + if((ninfo.meta_size.obj.heap_size != exp_meta_size) + && (ninfo.meta_size.obj.heap_size != (hsize_t)0)) TEST_ERROR - if(oinfo.meta_size.attr.index_size != (hsize_t)0) + if(ninfo.meta_size.attr.index_size != (hsize_t)0) TEST_ERROR - if(oinfo.meta_size.attr.index_size != (hsize_t)0) + if(ninfo.meta_size.attr.index_size != (hsize_t)0) TEST_ERROR /* Test H5Dget_space_status */ @@ -1134,11 +1134,11 @@ error: static int test_vds_prefix_first(unsigned config, hid_t fapl) { - char srcfilename[FILENAME_BUF_SIZE]; - char srcfilename_map[FILENAME_BUF_SIZE]; - char vfilename[FILENAME_BUF_SIZE]; - char srcfilenamepct[FILENAME_BUF_SIZE]; - char srcfilenamepct_map[FILENAME_BUF_SIZE]; + char *srcfilename = NULL; + char *srcfilename_map = NULL; + char *vfilename = NULL; + char *srcfilenamepct = NULL; + char *srcfilenamepct_map = NULL; const char *srcfilenamepct_map_orig = "vds%%%%_src"; hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */ hid_t vfile = -1; /* File with virtual dset */ @@ -1158,11 +1158,22 @@ test_vds_prefix_first(unsigned config, hid_t fapl) TESTING("basic virtual dataset I/O via H5Pset_vds_prefix(): all selection") - h5_fixname(FILENAME[0], fapl, vfilename, sizeof vfilename); - h5_fixname(FILENAME[8], fapl, srcfilename, sizeof srcfilename); - h5_fixname_printf(FILENAME[8], fapl, srcfilename_map, sizeof srcfilename_map); - h5_fixname(FILENAME[10], fapl, srcfilenamepct, sizeof srcfilenamepct); - h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, sizeof srcfilenamepct_map); + if((srcfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((vfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((srcfilenamepct = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((srcfilenamepct_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + + h5_fixname(FILENAME[0], fapl, vfilename, FILENAME_BUF_SIZE); + h5_fixname(FILENAME[8], fapl, srcfilename, FILENAME_BUF_SIZE); + h5_fixname_printf(FILENAME[8], fapl, srcfilename_map, FILENAME_BUF_SIZE); + h5_fixname(FILENAME[10], fapl, srcfilenamepct, FILENAME_BUF_SIZE); + h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, FILENAME_BUF_SIZE); /* create tmp directory and get current working directory path */ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) @@ -1346,6 +1357,12 @@ test_vds_prefix_first(unsigned config, hid_t fapl) TEST_ERROR dcpl = -1; + HDfree(srcfilename); + HDfree(srcfilename_map); + HDfree(vfilename); + HDfree(srcfilenamepct); + HDfree(srcfilenamepct_map); + PASSED(); return 0; @@ -1369,6 +1386,12 @@ test_vds_prefix_first(unsigned config, hid_t fapl) if(HDsetenv("HDF5_VDS_PREFIX", "", 1) < 0) TEST_ERROR + HDfree(srcfilename); + HDfree(srcfilename_map); + HDfree(vfilename); + HDfree(srcfilenamepct); + HDfree(srcfilenamepct_map); + return 1; } /* end test_vds_prefix */ @@ -1386,12 +1409,12 @@ test_vds_prefix_first(unsigned config, hid_t fapl) static int test_basic_io(unsigned config, hid_t fapl) { - char srcfilename[FILENAME_BUF_SIZE]; - char srcfilename_map[FILENAME_BUF_SIZE]; - char vfilename[FILENAME_BUF_SIZE]; - char vfilename2[FILENAME_BUF_SIZE]; - char srcfilenamepct[FILENAME_BUF_SIZE]; - char srcfilenamepct_map[FILENAME_BUF_SIZE]; + char *srcfilename = NULL; + char *srcfilename_map = NULL; + char *vfilename = NULL; + char *vfilename2 = NULL; + char *srcfilenamepct = NULL; + char *srcfilenamepct_map = NULL; const char *srcfilenamepct_map_orig = "vds%%%%_src"; hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */ hid_t vfile = -1; /* File with virtual dset */ @@ -1419,12 +1442,25 @@ test_basic_io(unsigned config, hid_t fapl) TESTING("basic virtual dataset I/O") - h5_fixname(FILENAME[0], fapl, vfilename, sizeof vfilename); - h5_fixname(FILENAME[1], fapl, vfilename2, sizeof vfilename2); - h5_fixname(FILENAME[2], fapl, srcfilename, sizeof srcfilename); - h5_fixname_printf(FILENAME[2], fapl, srcfilename_map, sizeof srcfilename_map); - h5_fixname(FILENAME[4], fapl, srcfilenamepct, sizeof srcfilenamepct); - h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, sizeof srcfilenamepct_map); + if((srcfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((vfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((vfilename2 = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((srcfilenamepct = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((srcfilenamepct_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + + h5_fixname(FILENAME[0], fapl, vfilename, FILENAME_BUF_SIZE); + h5_fixname(FILENAME[1], fapl, vfilename2, FILENAME_BUF_SIZE); + h5_fixname(FILENAME[2], fapl, srcfilename, FILENAME_BUF_SIZE); + h5_fixname_printf(FILENAME[2], fapl, srcfilename_map, FILENAME_BUF_SIZE); + h5_fixname(FILENAME[4], fapl, srcfilenamepct, FILENAME_BUF_SIZE); + h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, FILENAME_BUF_SIZE); /* Create DCPL */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) @@ -4227,6 +4263,13 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR dcpl = -1; + HDfree(srcfilename); + HDfree(srcfilename_map); + HDfree(vfilename); + HDfree(vfilename2); + HDfree(srcfilenamepct); + HDfree(srcfilenamepct_map); + PASSED(); return 0; @@ -4247,6 +4290,13 @@ error: H5Pclose(dcpl); } H5E_END_TRY; + HDfree(srcfilename); + HDfree(srcfilename_map); + HDfree(vfilename); + HDfree(vfilename2); + HDfree(srcfilenamepct); + HDfree(srcfilenamepct_map); + return 1; } /* end test_basic_io() */ @@ -7286,15 +7336,15 @@ error: static int test_printf(unsigned config, hid_t fapl) { - char srcfilename[FILENAME_BUF_SIZE]; - char srcfilename_map[FILENAME_BUF_SIZE]; - char srcfilename2[FILENAME_BUF_SIZE]; - char srcfilename2_map[FILENAME_BUF_SIZE]; - char vfilename[FILENAME_BUF_SIZE]; - char printf_srcfilename_map[FILENAME_BUF_SIZE]; + char *srcfilename = NULL; + char *srcfilename_map = NULL; + char *srcfilename2 = NULL; + char *srcfilename2_map = NULL; + char *vfilename = NULL; + char *printf_srcfilename_map = NULL; + char *srcfilenamepct = NULL; + char *srcfilenamepct_map = NULL; const char *printf_srcfilename_map_orig = "vds_src_%b"; - char srcfilenamepct[FILENAME_BUF_SIZE]; - char srcfilenamepct_map[FILENAME_BUF_SIZE]; const char *srcfilenamepct_map_orig = "vds%%%%_src"; hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */ hid_t vfile = -1; /* File with virtual dset */ @@ -7322,14 +7372,31 @@ test_printf(unsigned config, hid_t fapl) TESTING("virtual dataset I/O with printf source") - h5_fixname(FILENAME[0], fapl, vfilename, sizeof vfilename); - h5_fixname(FILENAME[2], fapl, srcfilename, sizeof srcfilename); - h5_fixname_printf(FILENAME[2], fapl, srcfilename_map, sizeof srcfilename_map); - h5_fixname(FILENAME[3], fapl, srcfilename2, sizeof srcfilename2); - h5_fixname_printf(FILENAME[2], fapl, srcfilename2_map, sizeof srcfilename2_map); - h5_fixname_printf(printf_srcfilename_map_orig, fapl, printf_srcfilename_map, sizeof printf_srcfilename_map); - h5_fixname(FILENAME[4], fapl, srcfilenamepct, sizeof srcfilenamepct); - h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, sizeof srcfilenamepct_map); + if((srcfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((srcfilename2 = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((srcfilename2_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((vfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((printf_srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((srcfilenamepct = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((srcfilenamepct_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + + h5_fixname(FILENAME[0], fapl, vfilename, FILENAME_BUF_SIZE); + h5_fixname(FILENAME[2], fapl, srcfilename, FILENAME_BUF_SIZE); + h5_fixname_printf(FILENAME[2], fapl, srcfilename_map, FILENAME_BUF_SIZE); + h5_fixname(FILENAME[3], fapl, srcfilename2, FILENAME_BUF_SIZE); + h5_fixname_printf(FILENAME[2], fapl, srcfilename2_map, FILENAME_BUF_SIZE); + h5_fixname_printf(printf_srcfilename_map_orig, fapl, printf_srcfilename_map, FILENAME_BUF_SIZE); + h5_fixname(FILENAME[4], fapl, srcfilenamepct, FILENAME_BUF_SIZE); + h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, FILENAME_BUF_SIZE); /* Create DCPL */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) @@ -10940,6 +11007,15 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR memspace = -1; + HDfree(srcfilename); + HDfree(srcfilename_map); + HDfree(srcfilename2); + HDfree(srcfilename2_map); + HDfree(vfilename); + HDfree(printf_srcfilename_map); + HDfree(srcfilenamepct); + HDfree(srcfilenamepct_map); + PASSED(); return 0; @@ -10960,6 +11036,15 @@ error: H5Pclose(dapl); } H5E_END_TRY; + HDfree(srcfilename); + HDfree(srcfilename_map); + HDfree(srcfilename2); + HDfree(srcfilename2_map); + HDfree(vfilename); + HDfree(printf_srcfilename_map); + HDfree(srcfilenamepct); + HDfree(srcfilenamepct_map); + return 1; } /* end test_printf() */ @@ -842,8 +842,7 @@ error: * * Purpose: Tests the file handle interface for FAMILY driver * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Tuesday, Sept 24, 2002 @@ -861,12 +860,21 @@ test_family(void) char dname[]="dataset"; unsigned int i, j; int *fhandle=NULL, *fhandle2=NULL; - int buf[FAMILY_NUMBER][FAMILY_SIZE]; + int **buf = NULL; + int *buf_data = NULL; hsize_t dims[2]={FAMILY_NUMBER, FAMILY_SIZE}; hsize_t file_size; TESTING("FAMILY file driver"); + /* Set up data array */ + if(NULL == (buf_data = (int *)HDcalloc(FAMILY_NUMBER * FAMILY_SIZE, sizeof(int)))) + TEST_ERROR; + if(NULL == (buf = (int **)HDcalloc(FAMILY_NUMBER, sizeof(buf_data)))) + TEST_ERROR; + for (i = 0; i < FAMILY_NUMBER; i++) + buf[i] = buf_data + (i * FAMILY_SIZE); + /* Set property list and file name for FAMILY driver */ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR; @@ -890,7 +898,7 @@ test_family(void) | H5FD_FEAT_AGGREGATE_SMALLDATA)) TEST_ERROR - if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR; if(H5Fclose(file) < 0) @@ -905,7 +913,7 @@ test_family(void) if(H5Pset_fapl_family(fapl, (hsize_t)H5F_FAMILY_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR; - if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR; /* Check file size API */ @@ -917,7 +925,7 @@ test_family(void) TEST_ERROR; /* Create and write dataset */ - if((space=H5Screate_simple(2, dims, NULL)) < 0) + if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR; /* Retrieve the access property list... */ @@ -932,14 +940,14 @@ test_family(void) if (H5Pclose(access_fapl) < 0) TEST_ERROR; - if((dset=H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((dset = H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; for(i = 0; i < FAMILY_NUMBER; i++) for(j = 0; j < FAMILY_SIZE; j++) buf[i][j] = (int)((i * 10000) + j); - if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0) TEST_ERROR; /* check file handle API */ @@ -1004,8 +1012,11 @@ test_family(void) if(H5Pclose(fapl) < 0) TEST_ERROR; + HDfree(buf); + HDfree(buf_data); + PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -1015,8 +1026,12 @@ error: H5Pclose(fapl2); H5Fclose(file); } H5E_END_TRY; - return -1; -} + + HDfree(buf); + HDfree(buf_data); + + return FAIL; +} /* end test_family() */ /*------------------------------------------------------------------------- @@ -1136,8 +1151,7 @@ error: * * Purpose: Actually use the member fapl input to the member vfd. * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * * Programmer: Jacob Smith * 21 May 2019 @@ -1147,108 +1161,91 @@ error: static herr_t test_family_member_fapl(void) { - hid_t file = H5I_INVALID_HID; - hid_t fapl_id = H5I_INVALID_HID; - hid_t memb_fapl_id = H5I_INVALID_HID; - hid_t space = H5I_INVALID_HID; - hid_t dset = H5I_INVALID_HID; + hid_t file = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; + hid_t memb_fapl_id = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; + hid_t dset = H5I_INVALID_HID; char filename[1024]; - char dname[] = "dataset"; - unsigned i = 0; - unsigned j = 0; - int buf[FAMILY_NUMBER][FAMILY_SIZE]; - hsize_t dims[2] = {FAMILY_NUMBER, FAMILY_SIZE}; + char dname[] = "dataset"; + unsigned i = 0; + unsigned j = 0; + int **buf = NULL; + int *buf_data = NULL; + hsize_t dims[2] = {FAMILY_NUMBER, FAMILY_SIZE}; TESTING("Family member FAPL"); - fapl_id = H5Pcreate(H5P_FILE_ACCESS); - if (H5I_INVALID_HID == fapl_id) { + /* Set up data array */ + if(NULL == (buf_data = (int *)HDcalloc(FAMILY_NUMBER * FAMILY_SIZE, sizeof(int)))) TEST_ERROR; - } - memb_fapl_id = H5Pcreate(H5P_FILE_ACCESS); - if (H5I_INVALID_HID == memb_fapl_id) { + if(NULL == (buf = (int **)HDcalloc(FAMILY_NUMBER, sizeof(buf_data)))) TEST_ERROR; - } - if (H5Pset_fapl_sec2(memb_fapl_id) == FAIL) { + for (i = 0; i < FAMILY_NUMBER; i++) + buf[i] = buf_data + (i * FAMILY_SIZE); + + if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) == H5I_INVALID_HID) TEST_ERROR; - } - if (H5Pset_fapl_family(fapl_id, (hsize_t)FAMILY_SIZE, memb_fapl_id) == FAIL) { + + if((memb_fapl_id = H5Pcreate(H5P_FILE_ACCESS)) == H5I_INVALID_HID) TEST_ERROR; - } + + if (H5Pset_fapl_sec2(memb_fapl_id) == FAIL) + TEST_ERROR; + if (H5Pset_fapl_family(fapl_id, (hsize_t)FAMILY_SIZE, memb_fapl_id) == FAIL) + TEST_ERROR; + h5_fixname(FILENAME[2], fapl_id, filename, sizeof(filename)); - file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); - if (H5I_INVALID_HID == file) { + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) == H5I_INVALID_HID) TEST_ERROR; - } - space = H5Screate_simple(2, dims, NULL); - if (H5I_INVALID_HID == space) { + if((space = H5Screate_simple(2, dims, NULL)) == H5I_INVALID_HID) TEST_ERROR; - } /* Create and write to dataset, then close file. */ - dset = H5Dcreate2( - file, - dname, - H5T_NATIVE_INT, - space, - H5P_DEFAULT, - H5P_DEFAULT, - H5P_DEFAULT); - if (H5I_INVALID_HID == dset) { + if((dset = H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) == H5I_INVALID_HID) TEST_ERROR; - } + for (i = 0; i < FAMILY_NUMBER; i++) { for (j = 0; j < FAMILY_SIZE; j++) { buf[i][j] = (int)((i * 10000) + j); } } - if (H5Dwrite(dset, - H5T_NATIVE_INT, - H5S_ALL, - H5S_ALL, - H5P_DEFAULT, - buf) - == FAIL) - { + + if (H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) == FAIL) TEST_ERROR; - } - if (H5Dclose(dset) == FAIL) { + + if (H5Dclose(dset) == FAIL) TEST_ERROR; - } - if (H5Sclose(space) == FAIL) { + if (H5Sclose(space) == FAIL) TEST_ERROR; - } - if (H5Fclose(file) == FAIL) { + if (H5Fclose(file) == FAIL) TEST_ERROR; - } /* "Close" member FAPL at top level and re-open file. * Should succeed, with library managing reference count properly */ - if (H5Pclose(memb_fapl_id) == FAIL) { + if (H5Pclose(memb_fapl_id) == FAIL) TEST_ERROR; - } - file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id); - if (H5I_INVALID_HID == file) { + if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) == H5I_INVALID_HID) TEST_ERROR; - } - if (H5Fclose(file) == FAIL) { + if (H5Fclose(file) == FAIL) TEST_ERROR; - } h5_delete_test_file(FILENAME[2], fapl_id); - if (H5Pclose(fapl_id) == FAIL) { + if (H5Pclose(fapl_id) == FAIL) TEST_ERROR; - } + + HDfree(buf); + HDfree(buf_data); PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -1259,7 +1256,10 @@ error: H5Fclose(file); } H5E_END_TRY; - return -1; + HDfree(buf); + HDfree(buf_data); + + return FAIL; } /* end test_family_member_fapl() */ @@ -1337,10 +1337,19 @@ test_multi(void) char dname[]="dataset"; char meta[] = "this is some metadata on this file"; int i, j; - int buf[MULTI_SIZE][MULTI_SIZE]; + int **buf = NULL; + int *buf_data = NULL; TESTING("MULTI file driver"); + /* Set up data array */ + if(NULL == (buf_data = (int *)HDcalloc(MULTI_SIZE * MULTI_SIZE, sizeof(int)))) + TEST_ERROR; + if(NULL == (buf = (int **)HDcalloc(MULTI_SIZE, sizeof(buf_data)))) + TEST_ERROR; + for (i = 0; i < MULTI_SIZE; i++) + buf[i] = buf_data + (i * MULTI_SIZE); + /* Set file access property list for MULTI driver */ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR; @@ -1443,7 +1452,7 @@ test_multi(void) for(i=0; i<MULTI_SIZE; i++) for(j=0; j<MULTI_SIZE; j++) buf[i][j] = i*10000+j; - if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0) TEST_ERROR; if((fapl2=H5Pcreate(H5P_FILE_ACCESS)) < 0) @@ -1521,6 +1530,9 @@ test_multi(void) if(H5Pclose(fapl) < 0) TEST_ERROR; + HDfree(buf); + HDfree(buf_data); + PASSED(); return SUCCEED; @@ -1534,6 +1546,10 @@ error: H5Fclose(file); H5Aclose(attr); } H5E_END_TRY; + + HDfree(buf); + HDfree(buf_data); + return FAIL; } /* end test_multi() */ @@ -1572,10 +1588,19 @@ test_multi_compat(void) char sv[H5FD_MEM_NTYPES][32]; hsize_t dims[2]={MULTI_SIZE, MULTI_SIZE}; int i, j; - int buf[MULTI_SIZE][MULTI_SIZE]; + int **buf = NULL; + int *buf_data = NULL; TESTING("MULTI file driver backward compatibility"); + /* Set up data array */ + if(NULL == (buf_data = (int *)HDcalloc(MULTI_SIZE * MULTI_SIZE, sizeof(int)))) + TEST_ERROR; + if(NULL == (buf = (int **)HDcalloc(MULTI_SIZE, sizeof(buf_data)))) + TEST_ERROR; + for (i = 0; i < MULTI_SIZE; i++) + buf[i] = buf_data + (i * MULTI_SIZE); + /* Set file access property list for MULTI driver */ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR; @@ -1659,7 +1684,7 @@ test_multi_compat(void) for(i=0; i<MULTI_SIZE; i++) for(j=0; j<MULTI_SIZE; j++) buf[i][j] = i*10000+j; - if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0) TEST_ERROR; if(H5Dclose(dset) < 0) @@ -1697,9 +1722,12 @@ test_multi_compat(void) if(H5Pclose(fapl) < 0) TEST_ERROR; + HDfree(buf); + HDfree(buf_data); + PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -1708,8 +1736,12 @@ error: H5Pclose(fapl); H5Fclose(file); } H5E_END_TRY; - return -1; -} + + HDfree(buf); + HDfree(buf_data); + + return FAIL; +} /* end test_multi_compat() */ /*------------------------------------------------------------------------- @@ -141,6 +141,11 @@ static const H5VL_class_t fake_vol_g = { NULL, /* specific */ NULL /* optional */ }, + { /* token_cls */ + NULL, /* cmp */ + NULL, /* to_str */ + NULL /* from_str */ + }, NULL /* optional */ }; @@ -228,7 +233,7 @@ test_vol_registration(void) TEST_ERROR; /* Try to unregister the native VOL connector (should fail) */ - if (H5I_INVALID_HID == (native_id = H5VLget_connector_id(H5VL_NATIVE_NAME))) + if (H5I_INVALID_HID == (native_id = H5VLget_connector_id_by_name(H5VL_NATIVE_NAME))) TEST_ERROR; H5E_BEGIN_TRY { ret = H5VLunregister_connector(native_id); @@ -870,7 +875,7 @@ test_basic_object_operation(void) hid_t oid = H5I_INVALID_HID; char filename[1024]; - H5O_info_t object_info; + H5O_info2_t object_info; TESTING("Basic VOL object operations"); @@ -884,11 +889,11 @@ test_basic_object_operation(void) TEST_ERROR; /* H5Oget_info */ - if (H5Oget_info2(fid, &object_info, H5O_INFO_ALL) < 0) + if (H5Oget_info3(fid, &object_info, H5O_INFO_ALL) < 0) TEST_ERROR; /* H5Oget_info_by_name */ - if (H5Oget_info_by_name2(fid, NATIVE_VOL_TEST_GROUP_NAME, &object_info, H5O_INFO_ALL, H5P_DEFAULT) < 0) + if (H5Oget_info_by_name3(fid, NATIVE_VOL_TEST_GROUP_NAME, &object_info, H5O_INFO_ALL, H5P_DEFAULT) < 0) TEST_ERROR; /* H5Oexists_by_name */ diff --git a/test/vol_plugin.c b/test/vol_plugin.c index 236a67e..e4f171b 100644 --- a/test/vol_plugin.c +++ b/test/vol_plugin.c @@ -233,7 +233,7 @@ test_getters(void) TEST_ERROR; /* Get the connector's ID */ - if((vol_id_out = H5VLget_connector_id(NULL_VOL_CONNECTOR_NAME)) < 0) + if((vol_id_out = H5VLget_connector_id_by_name(NULL_VOL_CONNECTOR_NAME)) < 0) TEST_ERROR; if(vol_id != vol_id_out) FAIL_PUTS_ERROR("VOL connector IDs don't match"); |