diff options
Diffstat (limited to 'test/links.c')
-rw-r--r-- | test/links.c | 1130 |
1 files changed, 747 insertions, 383 deletions
diff --git a/test/links.c b/test/links.c index deae5ef..afd5872 100644 --- a/test/links.c +++ b/test/links.c @@ -28,6 +28,7 @@ #define H5G_TESTING #include "h5test.h" +#include "H5srcdir.h" #include "H5Gpkg.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ @@ -327,7 +328,7 @@ typedef struct { * 14 Jan. 2009 *------------------------------------------------------------------------- */ -static void +static void fix_ext_filename(char *path_name, char *cwd, const char *file_name) { HDstrcpy(path_name, cwd); @@ -638,7 +639,7 @@ cklinks(hid_t fapl, hbool_t new_format) TEST_ERROR } /* end if */ - /* Non-existant link */ + /* Non-existent link */ if(H5Lexists(file, "foobar", H5P_DEFAULT) == TRUE) FAIL_STACK_ERROR /* Cleanup */ @@ -2190,7 +2191,7 @@ external_link_mult(hid_t fapl, hbool_t new_format) *------------------------------------------------------------------------- */ static int -external_link_self(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) +external_link_self(hid_t fapl, hbool_t new_format) { hid_t fid = (-1); /* File ID */ hid_t gid = (-1), gid2 = (-1); /* Group IDs */ @@ -2205,125 +2206,116 @@ external_link_self(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) else TESTING("external link to self") - /* Skip test when using core VFD, since it doesn't re-open file when linking - * to same file. - */ - if(HDstrcmp(env_h5_drvr, "core")) { - /* Set up filename */ - h5_fixname(FILENAME[1], fapl, filename1, sizeof filename1); - h5_fixname(FILENAME[2], fapl, filename2, sizeof filename1); - h5_fixname(FILENAME[3], fapl, filename3, sizeof filename1); + /* Set up filename */ + h5_fixname(FILENAME[1], fapl, filename1, sizeof filename1); + h5_fixname(FILENAME[2], fapl, filename2, sizeof filename1); + h5_fixname(FILENAME[3], fapl, filename3, sizeof filename1); - /* Create file */ - if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create file */ + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create an lcpl with intermediate group creation set */ - if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR - if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR + /* Create an lcpl with intermediate group creation set */ + if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR + if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR - /* Create a series of groups within the file: /A/B and /X/Y/Z */ - if((gid = H5Gcreate2(fid, "A/B", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "X/Y", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create a series of groups within the file: /A/B and /X/Y/Z */ + if((gid = H5Gcreate2(fid, "A/B", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "X/Y", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Pclose (lcpl_id) < 0) TEST_ERROR + if(H5Pclose (lcpl_id) < 0) TEST_ERROR - /* Create external link to own root group*/ - if(H5Lcreate_external(filename1, "/X", fid, "A/B/C", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to own root group*/ + if(H5Lcreate_external(filename1, "/X", fid, "A/B/C", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - if((gid = H5Gopen2(fid, "A/B/C/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object through external link */ + if((gid = H5Gopen2(fid, "A/B/C/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/X")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/X")) TEST_ERROR - /* Create object through external link */ - if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create object through external link */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close created group */ - if(H5Gclose(gid2) < 0) TEST_ERROR + /* Close created group */ + if(H5Gclose(gid2) < 0) TEST_ERROR - /* Close object opened through external link */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close object opened through external link */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Check on object created */ - if((gid = H5Gopen2(fid, "X/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Check on object created */ + if((gid = H5Gopen2(fid, "X/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, "/X/new_group")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/X/new_group")) TEST_ERROR - /* Close opened object */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close opened object */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Complicate things. Use this file as an intermediate file in a chain - * of external links that will go: file2 -> file1 -> file1 -> file3 - */ + /* Complicate things. Use this file as an intermediate file in a chain + * of external links that will go: file2 -> file1 -> file1 -> file3 + */ - /* Create file2 with an external link to file1 */ - if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create file2 with an external link to file1 */ + if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if(H5Lcreate_external(filename1, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file2 */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file2 */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create file3 as a target */ - if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "end", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* Create file3 as a target */ + if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "end", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Open file1 and create an extlink pointing to file3 */ - if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + /* Open file1 and create an extlink pointing to file3 */ + if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if(H5Lcreate_external(filename3, "/", fid, "/X/Y/Z", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename3, "/", fid, "/X/Y/Z", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file1 */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file1 */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Re-open file2 and traverse through file1 (with its recursive extlink) to file3 */ - if((fid=H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + /* Re-open file2 and traverse through file1 (with its recursive extlink) to file3 */ + if((fid=H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((gid = H5Gopen2(fid, "ext_link/B/C/Y/Z/end", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((gid = H5Gopen2(fid, "ext_link/B/C/Y/Z/end", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Create object through external link */ - if((gid2 = H5Gcreate2(gid, "newer_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create object through external link */ + if((gid2 = H5Gcreate2(gid, "newer_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Cleanup */ - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* Cleanup */ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Open up file3 and make sure the object was created successfully */ - if((fid = H5Fopen(filename3, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR + /* Open up file3 and make sure the object was created successfully */ + if((fid = H5Fopen(filename3, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR - if((gid = H5Gopen2(fid, "end/newer_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((gid = H5Gopen2(fid, "end/newer_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Cleanup */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* Cleanup */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - } /* end if */ - else { - SKIPPED(); - puts(" Current VFD can't reopen same file through external link"); - } /* end else */ + PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Fclose(gid2); - H5Fclose(gid); + H5Gclose(gid2); + H5Gclose(gid); H5Pclose(lcpl_id); H5Fclose(fid); } H5E_END_TRY; @@ -2356,7 +2348,7 @@ external_link_self(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) *------------------------------------------------------------------------- */ static int -external_link_pingpong(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) +external_link_pingpong(hid_t fapl, hbool_t new_format) { hid_t fid = (-1); /* File ID */ hid_t gid = (-1), gid2 = (-1); /* Group IDs */ @@ -2369,86 +2361,77 @@ external_link_pingpong(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) else TESTING("external links back and forth") - /* Skip test when using core VFD, since it doesn't re-open file when linking - * to same file. - */ - if(HDstrcmp(env_h5_drvr, "core")) { - /* Set up filenames */ - h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); - h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); - /* Create first file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create first file */ + if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external links for chain */ - if(H5Lcreate_external(filename2, "/link2", fid, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename2, "/link4", fid, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename2, "/link6", fid, "link5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external links for chain */ + if(H5Lcreate_external(filename2, "/link2", fid, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename2, "/link4", fid, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename2, "/link6", fid, "link5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create final object */ - if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create final object */ + if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create second file */ - if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create second file */ + if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external links for chain */ - if(H5Lcreate_external(filename1, "/link3", fid, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename1, "/link5", fid, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename1, "/final", fid, "link6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external links for chain */ + if(H5Lcreate_external(filename1, "/link3", fid, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/link5", fid, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/final", fid, "link6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Open first file */ - if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + /* Open first file */ + if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - /* Open object through external link */ - if((gid = H5Gopen2(fid, "link1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object through external link */ + if((gid = H5Gopen2(fid, "link1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/final")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/final")) TEST_ERROR - /* Create object in external file */ - if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) 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 group in external file */ + if(H5Gclose(gid2) < 0) TEST_ERROR - /* Close external object (lets first file close) */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close external object (lets first file close) */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Open first file again and check on object created */ - if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + /* Open first file again and check on object created */ + if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - /* Open object created through external link */ - if((gid = H5Gopen2(fid, "/final/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object created through external link */ + if((gid = H5Gopen2(fid, "/final/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, "/final/new_group")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/final/new_group")) TEST_ERROR - /* Close opened object */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close opened object */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - } /* end if */ - else { - SKIPPED(); - puts(" Current VFD can't reopen same file through external link"); - } /* end else */ + PASSED(); return 0; @@ -5993,7 +5976,7 @@ error: *------------------------------------------------------------------------- */ static int -external_link_closing(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) +external_link_closing(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); @@ -6013,194 +5996,185 @@ external_link_closing(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) else TESTING("that external files are closed during traversal") - /* Skip test when using core VFD, since it doesn't re-open file when linking - * to same file. + /* 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. */ - if(HDstrcmp(env_h5_drvr, "core")) { - /* 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, H5P_DEFAULT, 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_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_name(fid1, "elink/elink/elink/type1", &oi, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name(fid1, "elink/elink/elink", &oi, 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, (-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_name(fid1, "elink/elink2/group2/group3/group4", &oi, 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_info(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 - - - /* 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 + /* 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); - PASSED(); - } /* end if */ - else { - SKIPPED(); - puts(" Current VFD can't reopen same file through external link"); - } /* end else */ + /* 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, H5P_DEFAULT, 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_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_name(fid1, "elink/elink/elink/type1", &oi, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name(fid1, "elink/elink/elink", &oi, 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, (-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_name(fid1, "elink/elink2/group2/group3/group4", &oi, 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_info(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 + + + /* 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 0; @@ -6241,34 +6215,19 @@ external_link_endian(hbool_t new_format) hid_t fid = (-1); /* File ID */ hid_t gid = (-1), gid2 = (-1); /* Group IDs */ hid_t lapl_id = (-1); /* Prop List ID */ - char * srcdir = getenv("srcdir"); /* The source directory */ - char pathbuf[NAME_BUF_SIZE]; /* Path to the files */ - char namebuf[NAME_BUF_SIZE]; + const char *pathbuf = H5_get_srcdir(); /* Path to the files */ + const char *namebuf; if(new_format) TESTING("endianness of external links (w/new group format)") else TESTING("endianness of external links") - /* - * Create the name of the file to open (in case we are using the --srcdir - * option and the file is in a different directory from this test). - */ - if (srcdir && ((HDstrlen(srcdir) + 2) < sizeof(pathbuf)) ) - { - HDstrcpy(pathbuf, srcdir); - HDstrcat(pathbuf, "/"); - } - else - HDstrcpy(pathbuf, ""); - /* Create a link access property list with the path to the srcdir */ if((lapl_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR if(H5Pset_elink_prefix(lapl_id, pathbuf) < 0) TEST_ERROR - if(HDstrlen(pathbuf) + HDstrlen(LE_FILENAME) >= sizeof(namebuf)) TEST_ERROR - HDstrcpy(namebuf, pathbuf); - HDstrcat(namebuf, LE_FILENAME); + namebuf = H5_get_srcdir_filename(LE_FILENAME); /* Corrected test file name */ /* Test LE file; try to open a group through the external link */ if((fid = H5Fopen(namebuf, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR @@ -6282,9 +6241,7 @@ external_link_endian(hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - if(HDstrlen(pathbuf) + HDstrlen(BE_FILENAME) >= sizeof(namebuf)) TEST_ERROR - HDstrcpy(namebuf, pathbuf); - HDstrcat(namebuf, BE_FILENAME); + namebuf = H5_get_srcdir_filename(BE_FILENAME); /* Corrected test file name */ /* Test BE file; try to open a group through the external link */ if((fid = H5Fopen(namebuf, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR @@ -6611,6 +6568,143 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) /*------------------------------------------------------------------------- + * Function: external_copy_invalid_object + * + * Purpose: Check that attempting to copy an object through an + * external link to the source file but with an invalid + * object name fails gracefully, and does not leave lingering + * file ids. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Neil Fortner + * Wednesday, March 3, 2010 + * + *------------------------------------------------------------------------- + */ +static int +external_copy_invalid_object(hid_t fapl, hbool_t new_format) +{ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group ID */ + hid_t ocpyplid = (-1); /* Object copy plist ID */ + char filename[NAME_BUF_SIZE]; + + if(new_format) + TESTING("copying invalid external links to the source file (w/new group format)") + else + TESTING("copying invalid external links to the source file") + + /* Set up filename */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + + /* Create object copy plist, set expand external flag */ + if((ocpyplid = H5Pcreate(H5P_OBJECT_COPY)) < 0) TEST_ERROR + if(H5Pset_copy_object(ocpyplid, H5O_COPY_EXPAND_EXT_LINK_FLAG) < 0) TEST_ERROR + + /* Create file and group */ + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Create an external link in the group to the source file with an invalid + * object name */ + if(H5Lcreate_external(filename, "no_object", fid, "/group1/link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Copy the group containing the external link */ + if(H5Ocopy(fid, "group1", fid, "group2", ocpyplid, H5P_DEFAULT) < 0) TEST_ERROR + + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Attempt to truncate the file again. If there is a lingering id for this + * file this will fail */ + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Close */ + if(H5Fclose(fid) < 0) TEST_ERROR + if(H5Pclose(ocpyplid) < 0) TEST_ERROR + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Gclose(gid); + H5Fclose(fid); + H5Pclose(ocpyplid); + } H5E_END_TRY + + return -1; +} /* end external_copy_invalid_object */ + + +/*------------------------------------------------------------------------- + * Function: external_dont_fail_to_source + * + * Purpose: Check that external links with invalid target file names + * work properly and do not attempt to (re)open the source + * file. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Neil Fortner + * Wednesday, March 3, 2010 + * + *------------------------------------------------------------------------- + */ +static int +external_dont_fail_to_source(hid_t fapl, hbool_t new_format) +{ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group ID */ + hid_t oid = (-1); /* Object ID */ + char filename[NAME_BUF_SIZE]; + + if(new_format) + TESTING("that invalid external links don't open the source file (w/new group format)") + else + TESTING("that invalid external links don't open the source file") + + /* Set up filename */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + + /* Create file and group */ + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Create an external link with an invalid file name, but the same object + * name as the group. This way, if the external link is interpreted to + * refer to the source file, it will link to the group */ + if(H5Lcreate_external("no_file", "/group", fid, "link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Attempt to open the object the link points to. This should fail */ + H5E_BEGIN_TRY { + oid = H5Oopen(fid, "link", H5P_DEFAULT); + } H5E_END_TRY + if(oid >= 0) FAIL_PUTS_ERROR("Succeeded in opening target of invalid external link") + + /* Close */ + if(H5Fclose(fid) < 0) TEST_ERROR + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Gclose(gid); + H5Oclose(oid); + H5Fclose(fid); + } H5E_END_TRY + + return -1; +} /* end external_dont_fail_to_source */ + + +/*------------------------------------------------------------------------- * Function: ud_hard_links * * Purpose: Check that the functionality of hard links can be duplicated @@ -8190,8 +8284,7 @@ build_visit_file(hid_t fapl) hid_t did = (-1); /* Dataset ID */ hid_t tid = (-1); /* Datatype ID */ char filename[NAME_BUF_SIZE]; - char pathname[1024]; /* Path of external link file */ - char *srcdir = getenv("srcdir"); /* where the src code is located */ + const char *pathname = H5_get_srcdir_filename(LINKED_FILE); /* Corrected test file name */ h5_fixname(FILENAME[9], fapl, filename, sizeof filename); @@ -8227,17 +8320,9 @@ build_visit_file(hid_t fapl) if(H5Lcreate_hard(fid, "/", fid, "/Group1/Group2/hard_zero", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Create external link to existing file */ - pathname[0] = '\0'; - /* Generate correct name for test file by prepending the source path */ - if(srcdir && ((HDstrlen(srcdir) + HDstrlen(LINKED_FILE) + 1) < sizeof(pathname))) { - HDstrcpy(pathname, srcdir); - HDstrcat(pathname, "/"); - } - HDstrcat(pathname, LINKED_FILE); - if(H5Lcreate_external(pathname, "/group", fid, "/ext_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create dangling external link to non-existant file */ + /* Create dangling external link to non-existent file */ if(H5Lcreate_external("foo.h5", "/group", fid, "/ext_dangle", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Create dataset in each group */ @@ -8370,7 +8455,7 @@ link_visit(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Fclose(gid); + H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; return -1; @@ -8448,7 +8533,7 @@ link_visit_by_name(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Fclose(gid); + H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; return -1; @@ -8548,7 +8633,7 @@ obj_visit(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Fclose(gid); + H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; return -1; @@ -8627,7 +8712,7 @@ obj_visit_by_name(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Fclose(gid); + H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; return -1; @@ -9099,6 +9184,294 @@ error: /*------------------------------------------------------------------------- + * Function: obj_exists + * + * Purpose: Test the 'object exists' routine + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Quincey Koziol + * Tuesday, February 2, 2010 + * + *------------------------------------------------------------------------- + */ +static int +obj_exists(hid_t fapl, hbool_t new_format) +{ + char filename[NAME_BUF_SIZE]; /* Buffer for file name */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + herr_t status; /* Generic return value */ + + if(new_format) + TESTING("object exists (w/new group format)") + else + TESTING("object exists") + + /* 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) + FAIL_STACK_ERROR + +/* Hard links */ + /* Verify that H5Oexists_by_name() fails for non-existent link in root group */ + H5E_BEGIN_TRY { + status = H5Oexists_by_name(fid, "foo", H5P_DEFAULT); + } H5E_END_TRY + if(status >= 0) TEST_ERROR + + /* Create a group, as a destination for testing */ + if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + + /* Verify that H5Oexists_by_name() succeeds for hard linked object */ + if(TRUE != H5Oexists_by_name(fid, "group", H5P_DEFAULT)) + TEST_ERROR + + /* Verify that H5Oexists_by_name() fails for non-existent link in non-root group */ + H5E_BEGIN_TRY { + status = H5Oexists_by_name(fid, "group/foo", H5P_DEFAULT); + } H5E_END_TRY + if(status >= 0) TEST_ERROR + + +/* Soft links */ + /* Create dangling soft-link in root group */ + if(H5Lcreate_soft("dangle", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Verify that H5Oexists_by_name() returns FALSE for dangling soft-link in root group */ + if(FALSE != H5Oexists_by_name(fid, "soft1", H5P_DEFAULT)) + TEST_ERROR + + /* Create soft-link in root group that points to object */ + if(H5Lcreate_soft("/group", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Verify that H5Oexists_by_name() returns TRUE for soft-link in root group that points to object */ + if(TRUE != H5Oexists_by_name(fid, "soft2", H5P_DEFAULT)) + TEST_ERROR + + /* Create dangling soft-link in non-root group */ + if(H5Lcreate_soft("dangle", fid, "group/soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Verify that H5Oexists_by_name() returns FALSE for dangling soft-link in non-root group */ + if(FALSE != H5Oexists_by_name(fid, "group/soft1", H5P_DEFAULT)) + TEST_ERROR + + /* Create soft-link in non-root group that points to object */ + if(H5Lcreate_soft("/group", fid, "group/soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Verify that H5Oexists_by_name() returns TRUE for soft-link in non-root group that points to object */ + if(TRUE != H5Oexists_by_name(fid, "group/soft2", H5P_DEFAULT)) + TEST_ERROR + + +/* External links */ + /* Create dangling (file doesn't exist) external link in root group */ + if(H5Lcreate_external("nofile", "dangle", fid, "external1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify that H5Oexists_by_name() returns FALSE for dangling (file doesn't exist) external link in root group */ + if(FALSE != H5Oexists_by_name(fid, "external1", H5P_DEFAULT)) + TEST_ERROR + + /* Create dangling (object doesn't exist) external link in root group */ + if(H5Lcreate_external(filename, "dangle", fid, "external2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify that H5Oexists_by_name() returns FALSE for dangling (object doesn't exist) external link in root group */ + if(FALSE != H5Oexists_by_name(fid, "external2", H5P_DEFAULT)) + TEST_ERROR + + /* Create external link in root group that points to object */ + if(H5Lcreate_external(filename, "group", fid, "external3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify that H5Oexists_by_name() returns TRUE for external link in root group that points to object */ + if(TRUE != H5Oexists_by_name(fid, "external3", H5P_DEFAULT)) + TEST_ERROR + + /* Create dangling (file doesn't exist) external link in non-root group */ + if(H5Lcreate_external("nofile", "dangle", fid, "group/external1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify that H5Oexists_by_name() returns FALSE for dangling (file doesn't exist) external link in non-root group */ + if(FALSE != H5Oexists_by_name(fid, "group/external1", H5P_DEFAULT)) + TEST_ERROR + + /* Create dangling (object doesn't exist) external link in non-root group */ + if(H5Lcreate_external(filename, "dangle", fid, "group/external2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify that H5Oexists_by_name() returns FALSE for dangling (object doesn't exist) external link in non-root group */ + if(FALSE != H5Oexists_by_name(fid, "group/external2", H5P_DEFAULT)) + TEST_ERROR + + /* Create external link in non-root group that points to object */ + if(H5Lcreate_external(filename, "group", fid, "group/external3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify that H5Oexists_by_name() returns TRUE for external link in non-root group that points to object */ + if(TRUE != H5Oexists_by_name(fid, "group/external3", H5P_DEFAULT)) + TEST_ERROR + + +/* Soft->External links */ + /* Create soft-link in root group that points to dangling (file doesn't exist) external link */ + if(H5Lcreate_soft("external1", fid, "soft-elink1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "soft-elink1", H5P_DEFAULT)) + TEST_ERROR + + /* Create soft-link in root group that points to dangling (object doesn't exist) external link */ + if(H5Lcreate_soft("external2", fid, "soft-elink2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "soft-elink2", H5P_DEFAULT)) + TEST_ERROR + + /* Create soft-link in root group that points to external link that points to object */ + if(H5Lcreate_soft("external3", fid, "soft-elink3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Verify that H5Oexists_by_name() returns TRUE */ + if(TRUE != H5Oexists_by_name(fid, "soft-elink3", H5P_DEFAULT)) + TEST_ERROR + + /* Create soft-link in root group that points to dangling (file doesn't exist) external link in non-root group */ + if(H5Lcreate_soft("group/external1", fid, "soft-elink4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "soft-elink4", H5P_DEFAULT)) + TEST_ERROR + + /* Create soft-link in root group that points to dangling (object doesn't exist) external link in non-root group */ + if(H5Lcreate_soft("group/external2", fid, "soft-elink5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "soft-elink5", H5P_DEFAULT)) + TEST_ERROR + + /* Create soft-link in root group that points to external link in non-root group that points to object */ + if(H5Lcreate_soft("group/external3", fid, "soft-elink6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Verify that H5Oexists_by_name() returns TRUE */ + if(TRUE != H5Oexists_by_name(fid, "soft-elink6", H5P_DEFAULT)) + TEST_ERROR + + /* Create soft-link in non-root group that points to dangling (file doesn't exist) external link */ + if(H5Lcreate_soft("/external1", fid, "group/soft-elink1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "group/soft-elink1", H5P_DEFAULT)) + TEST_ERROR + + /* Create soft-link in non-root group that points to dangling (object doesn't exist) external link */ + if(H5Lcreate_soft("/external2", fid, "group/soft-elink2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "group/soft-elink2", H5P_DEFAULT)) + TEST_ERROR + + /* Create soft-link in non-root group that points to external link that points to object */ + if(H5Lcreate_soft("/external3", fid, "group/soft-elink3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Verify that H5Oexists_by_name() returns TRUE */ + if(TRUE != H5Oexists_by_name(fid, "group/soft-elink3", H5P_DEFAULT)) + TEST_ERROR + + /* Create soft-link in non-root group that points to dangling (file doesn't exist) external link in non-root group */ + if(H5Lcreate_soft("/group/external1", fid, "group/soft-elink4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "group/soft-elink4", H5P_DEFAULT)) + TEST_ERROR + + /* Create soft-link in non-root group that points to dangling (object doesn't exist) external link in non-root group */ + if(H5Lcreate_soft("/group/external2", fid, "group/soft-elink5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "group/soft-elink5", H5P_DEFAULT)) + TEST_ERROR + + /* Create soft-link in non-root group that points to external link in non-root group that points to object */ + if(H5Lcreate_soft("/group/external3", fid, "group/soft-elink6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Verify that H5Oexists_by_name() returns TRUE */ + if(TRUE != H5Oexists_by_name(fid, "group/soft-elink6", H5P_DEFAULT)) + TEST_ERROR + + +/* External->Soft links */ + /* Create external link in root group that points to dangling soft link in root group */ + if(H5Lcreate_external(filename, "soft1", fid, "elink-soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "elink-soft1", H5P_DEFAULT)) + TEST_ERROR + + /* Create external link in root group that points to soft link in root group that points to object */ + if(H5Lcreate_external(filename, "soft2", fid, "elink-soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify that H5Oexists_by_name() returns TRUE */ + if(TRUE != H5Oexists_by_name(fid, "elink-soft2", H5P_DEFAULT)) + TEST_ERROR + + /* Create external link in root group that points to dangling soft link in non-root group */ + if(H5Lcreate_external(filename, "group/soft1", fid, "elink-soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "elink-soft3", H5P_DEFAULT)) + TEST_ERROR + + /* Create external link in root group that points to soft link in root group that points to object */ + if(H5Lcreate_external(filename, "group/soft2", fid, "elink-soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify that H5Oexists_by_name() returns TRUE */ + if(TRUE != H5Oexists_by_name(fid, "elink-soft4", H5P_DEFAULT)) + TEST_ERROR + + /* Create external link in non-root group that points to dangling soft link in root group */ + if(H5Lcreate_external(filename, "soft1", fid, "group/elink-soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "group/elink-soft1", H5P_DEFAULT)) + TEST_ERROR + + /* Create external link in non-root group that points to soft link in root group that points to object */ + if(H5Lcreate_external(filename, "soft2", fid, "group/elink-soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify that H5Oexists_by_name() returns TRUE */ + if(TRUE != H5Oexists_by_name(fid, "group/elink-soft2", H5P_DEFAULT)) + TEST_ERROR + + /* Create external link in non-root group that points to dangling soft link in non-root group */ + if(H5Lcreate_external(filename, "group/soft1", fid, "group/elink-soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "group/elink-soft3", H5P_DEFAULT)) + TEST_ERROR + + /* Create external link in non-root group that points to soft link in non-root group that points to object */ + if(H5Lcreate_external(filename, "group/soft2", fid, "group/elink-soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify that H5Oexists_by_name() returns TRUE */ + if(TRUE != H5Oexists_by_name(fid, "group/elink-soft4", H5P_DEFAULT)) + TEST_ERROR + + + /* Close file created */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Gclose(gid); + H5Fclose(fid); + } H5E_END_TRY; + return -1; +} /* end obj_exists() */ + + +/*------------------------------------------------------------------------- * Function: corder_create_empty * * Purpose: Create an empty group with creation order indices @@ -10887,13 +11260,6 @@ link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, char objname[NAME_BUF_SIZE]; /* Object name */ H5L_info_t my_info; /* Local link info */ -#ifdef QAK -HDfprintf(stderr, "link_name = '%s'\n", link_name); -if(info) - HDfprintf(stderr, "info->corder = %Hd\n", info->corder); -HDfprintf(stderr, "op_data->curr = %Hd\n", op_data->curr); -#endif /* QAK */ - /* Increment # of times the callback was called */ op_data->ncalled++; @@ -11372,13 +11738,6 @@ link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *inf char objname[NAME_BUF_SIZE]; /* Object name */ H5L_info_t my_info; /* Local link info */ -#ifdef QAK -HDfprintf(stderr, "link_name = '%s'\n", link_name); -if(info) - HDfprintf(stderr, "info->corder = %Hd\n", info->corder); -HDfprintf(stderr, "op_data->curr = %Hd\n", op_data->curr); -#endif /* QAK */ - /* Increment # of times the callback was called */ op_data->ncalled++; @@ -13571,8 +13930,8 @@ main(void) nerrors += external_link_path(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_mult(my_fapl, new_format) < 0 ? 1 : 0; #ifndef H5_CANNOT_OPEN_TWICE - nerrors += external_link_self(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_pingpong(env_h5_drvr, 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; nerrors += external_link_toomany(my_fapl, new_format) < 0 ? 1 : 0; #endif /* H5_CANNOT_OPEN_TWICE */ nerrors += external_link_dangling(my_fapl, new_format) < 0 ? 1 : 0; @@ -13583,7 +13942,7 @@ main(void) nerrors += external_link_move(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_ride(my_fapl, new_format) < 0 ? 1 : 0; #ifndef H5_CANNOT_OPEN_TWICE - nerrors += external_link_closing(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_closing(my_fapl, new_format) < 0 ? 1 : 0; #endif /* H5_CANNOT_OPEN_TWICE */ nerrors += external_link_endian(new_format) < 0 ? 1 : 0; nerrors += external_link_strong(my_fapl, new_format) < 0 ? 1 : 0; @@ -13615,6 +13974,8 @@ main(void) nerrors += external_link_win9(my_fapl, new_format) < 0 ? 1 : 0; #endif nerrors += external_symlink(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_copy_invalid_object(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_dont_fail_to_source(my_fapl, new_format) < 0 ? 1 : 0; /* These tests assume that external links are a form of UD links, * so assume that everything that passed for external links @@ -13637,6 +13998,9 @@ main(void) nerrors += obj_visit_by_name(my_fapl, new_format) < 0 ? 1 : 0; nerrors += obj_visit_stop(my_fapl, new_format) < 0 ? 1 : 0; nerrors += link_filters(my_fapl, new_format) < 0 ? 1 : 0; +#ifndef H5_CANNOT_OPEN_TWICE + nerrors += obj_exists(my_fapl, new_format) < 0 ? 1 : 0; +#endif /* H5_CANNOT_OPEN_TWICE */ /* Keep this test last, it's testing files that are used above */ /* do not do this for files used by external link tests */ |