From db3c155bf296fa06ab0df56bb7307f2ba19613e5 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 29 Aug 2007 15:44:19 -0500 Subject: [svn-r14126] Description: Move H5Gunlink to deprecated symbol section, replacing internal calls with H5Ldelete. Tested on: FreeBSD/32 6.2 (duty) FreeBSD/64 6.2 (liberty) Linux/32 2.6 (kagiso) Linux/64 2.6 (smirom) Solaris/32 5.10 (linew) Mac OS X/32 10.4.10 (amazon) --- c++/src/H5CommonFG.cpp | 4 +- examples/h5_group.c | 4 +- fortran/src/H5Gf.c | 38 +- hl/src/H5TB.c | 4 +- hl/test/test_ds.c | 8 +- src/H5Gdeprec.c | 2 +- src/H5Gpublic.h | 2 +- test/getname.c | 273 ++++++------- test/links.c | 152 ++++---- test/mount.c | 2 +- test/objcopy.c | 2 +- test/stab.c | 22 +- test/tattr.c | 92 ++--- test/tfile.c | 4 +- test/tmisc.c | 56 +-- test/trefer.c | 12 +- test/tvlstr.c | 16 +- test/unlink.c | 911 ++++++++++++++++++++++--------------------- tools/h5dump/h5dumpgentest.c | 423 ++++++++++---------- tools/h5repack/h5repacktst.c | 154 ++++---- tools/lib/talign.c | 6 +- 21 files changed, 1102 insertions(+), 1085 deletions(-) diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index 0b782cb..34398e7 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -288,10 +288,10 @@ void CommonFG::link( H5G_link_t link_type, const H5std_string& curr_name, const //-------------------------------------------------------------------------- void CommonFG::unlink( const char* name ) const { - herr_t ret_value = H5Gunlink( getLocId(), name ); + herr_t ret_value = H5Ldelete( getLocId(), name, H5P_DEFAULT ); if( ret_value < 0 ) { - throwException("unlink", "H5Gunlink failed"); + throwException("unlink", "H5Ldelete failed"); } } diff --git a/examples/h5_group.c b/examples/h5_group.c index 63331e3..4bad2ea 100644 --- a/examples/h5_group.c +++ b/examples/h5_group.c @@ -143,8 +143,8 @@ main(void) * Unlink name "Data" and use iterator to see the names * of the objects in the file root direvtory. */ - if (H5Gunlink(file, "Data") < 0) - printf(" H5Gunlink failed \n"); + if(H5Ldelete(file, "Data", H5P_DEFAULT) < 0) + printf(" H5Ldelete failed \n"); else printf("\"Data\" is unlinked \n"); diff --git a/fortran/src/H5Gf.c b/fortran/src/H5Gf.c index 0ca7e38..5dd00b0 100644 --- a/fortran/src/H5Gf.c +++ b/fortran/src/H5Gf.c @@ -397,28 +397,26 @@ DONE: int_f nh5gunlink_c(hid_t_f *loc_id, _fcd name, int_f *namelen) { - int ret_value = -1; - hid_t c_loc_id; - char *c_name; - size_t c_namelen; - herr_t c_ret_value; - /* - * Convert Fortran name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if(c_name == NULL) return ret_value; - /* - * Call H5Gunlink function - */ - c_loc_id = (hid_t)*loc_id; - c_ret_value = H5Gunlink(c_loc_id, c_name); - if(c_ret_value < 0) goto DONE; - ret_value = 0; + char *c_name = NULL; + int ret_value = -1; + + /* + * Convert Fortran name to C name + */ + if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + goto DONE; + + /* + * Call H5Gunlink function + */ + if(H5Ldelete((hid_t)*loc_id, c_name, H5P_DEFAULT) < 0) + goto DONE; + ret_value = 0; DONE: - HDfree(c_name); - return ret_value ; + if(c_name) + HDfree(c_name); + return ret_value; } /*---------------------------------------------------------------------------- diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c index a2510ff..23bf569 100644 --- a/hl/src/H5TB.c +++ b/hl/src/H5TB.c @@ -2508,7 +2508,7 @@ herr_t H5TBinsert_field( hid_t loc_id, * Delete 1st table *------------------------------------------------------------------------- */ - if ( H5Gunlink( loc_id, dset_name ) < 0 ) + if ( H5Ldelete( loc_id, dset_name, H5P_DEFAULT ) < 0 ) return -1; /*------------------------------------------------------------------------- @@ -2993,7 +2993,7 @@ herr_t H5TBdelete_field( hid_t loc_id, *------------------------------------------------------------------------- */ - if ( H5Gunlink( loc_id, dset_name ) < 0 ) + if ( H5Ldelete( loc_id, dset_name, H5P_DEFAULT ) < 0 ) return -1; /*------------------------------------------------------------------------- diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index c4bd1ab..43e9424 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -2233,19 +2233,19 @@ static int test_iterators(void) TESTING2("iterate in deleted scales "); - if (H5Gunlink(fid,"ds_0")<0) + if(H5Ldelete(fid, "ds_0", H5P_DEFAULT) < 0) goto out; /* open the previously written "dset_a" */ - if ((did = H5Dopen(fid,"dset_a"))<0) + if((did = H5Dopen(fid, "dset_a")) < 0) goto out; /* iterate */ - if (H5DSiterate_scales(did,0,NULL,op_bogus,NULL)==SUCCEED) + if(H5DSiterate_scales(did, 0, NULL, op_bogus, NULL) == SUCCEED) goto out; /* close */ - if (H5Dclose(did)<0) + if(H5Dclose(did) < 0) goto out; PASSED(); diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 34baef3..4e16430 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -522,7 +522,6 @@ H5G_move(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_move() */ -#endif /* H5_NO_DEPRECATED_SYMBOLS */ /*------------------------------------------------------------------------- @@ -554,6 +553,7 @@ H5Gunlink(hid_t loc_id, const char *name) done: FUNC_LEAVE_API(ret_value) } /* end H5Gunlink() */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /*------------------------------------------------------------------------- diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h index 5a40f97..4e2e262 100644 --- a/src/H5Gpublic.h +++ b/src/H5Gpublic.h @@ -137,7 +137,6 @@ H5_DLL herr_t H5Gclose(hid_t group_id); * * Use of these functions and variables is deprecated. */ -H5_DLL herr_t H5Gunlink(hid_t loc_id, const char *name); H5_DLL herr_t H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/); H5_DLL ssize_t H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char* name, @@ -170,6 +169,7 @@ H5_DLL herr_t H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name); H5_DLL herr_t H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name); +H5_DLL herr_t H5Gunlink(hid_t loc_id, const char *name); #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/test/getname.c b/test/getname.c index 2012d57..e3be2de 100644 --- a/test/getname.c +++ b/test/getname.c @@ -534,32 +534,33 @@ test_main(hid_t file_id, hid_t fapl) /*------------------------------------------------------------------------- - * Test H5Iget_name with H5Gunlink + * Test H5Iget_name with H5Ldelete *------------------------------------------------------------------------- */ - TESTING("H5Iget_name with H5Gunlink"); + TESTING("H5Iget_name with H5Ldelete"); /* Create a new group. */ if((group_id = H5Gcreate2(file_id, "/g8", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Delete */ - if(H5Gunlink(file_id, "/g8") < 0) TEST_ERROR + if(H5Ldelete(file_id, "/g8", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group_id, "", "") < 0) TEST_ERROR /* Close */ - H5Gclose(group_id); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR PASSED(); -/*------------------------------------------------------------------------- - * Test H5Iget_name with H5Gunlink and a long path + + /*------------------------------------------------------------------------- + * Test H5Iget_name with H5Ldelete and a long path *------------------------------------------------------------------------- */ - TESTING("H5Iget_name with H5Gunlink and a long path"); + TESTING("H5Iget_name with H5Ldelete and a long path"); /* Create group "g9/a/b" */ if((group_id = H5Gcreate2(file_id, "g9", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -567,7 +568,7 @@ test_main(hid_t file_id, hid_t fapl) if((group3_id = H5Gcreate2(file_id, "g9/a/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Delete */ - if(H5Gunlink(file_id, "/g9/a") < 0) TEST_ERROR + if(H5Ldelete(file_id, "/g9/a", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group2_id, "", "") < 0) TEST_ERROR @@ -576,15 +577,15 @@ test_main(hid_t file_id, hid_t fapl) if(check_name(group3_id, "", "") < 0) TEST_ERROR /* Close */ - H5Gclose(group2_id); - H5Gclose(group3_id); + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR /* Recreate groups */ if((group2_id = H5Gcreate2(group_id, "a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((group3_id = H5Gcreate2(group_id, "a/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Delete, using relative path */ - if(H5Gunlink(group_id, "a") < 0) TEST_ERROR + if(H5Ldelete(group_id, "a", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group2_id, "", "") < 0) TEST_ERROR @@ -593,11 +594,11 @@ test_main(hid_t file_id, hid_t fapl) if(check_name(group3_id, "", "") < 0) TEST_ERROR /* Close */ - H5Gclose(group2_id); - H5Gclose(group3_id); + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR /* Close */ - H5Gclose(group_id); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR /* Create group "g10/a/b" */ if((group_id = H5Gcreate2(file_id, "g10", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -605,51 +606,51 @@ test_main(hid_t file_id, hid_t fapl) if((group3_id = H5Gcreate2(file_id, "g10/a/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Delete */ - if(H5Gunlink(file_id, "/g10/a/b") < 0) TEST_ERROR + if(H5Ldelete(file_id, "/g10/a/b", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group3_id, "", "") < 0) TEST_ERROR /* Close */ - H5Gclose(group3_id); + if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR /* Recreate group */ if((group3_id = H5Gcreate2(group_id, "a/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Delete, using relative path */ - if(H5Gunlink(group_id, "a/b") < 0) TEST_ERROR + if(H5Ldelete(group_id, "a/b", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group3_id, "", "") < 0) TEST_ERROR /* Close */ - H5Gclose(group3_id); + if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR /* Close */ - H5Gclose(group_id); - H5Gclose(group2_id); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR PASSED(); -/*------------------------------------------------------------------------- - * Test H5Iget_name with H5Gunlink, same names + + /*------------------------------------------------------------------------- + * Test H5Iget_name with H5Ldelete, same names *------------------------------------------------------------------------- */ - TESTING("H5Iget_name with H5Gunlink, same names"); - + TESTING("H5Iget_name with H5Ldelete, same names"); /* Create group "g11/g" */ if((group_id = H5Gcreate2(file_id, "g11", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((group2_id = H5Gcreate2(file_id, "g11/g", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create two datasets "g11/d" and "g11/g/d"*/ - if((space_id = H5Screate_simple(1, dims, NULL)) < 0) TEST_ERROR - if((dataset_id = H5Dcreate(group_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT)) < 0) TEST_ERROR - if((dataset2_id = H5Dcreate(group2_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT)) < 0) TEST_ERROR + if((space_id = H5Screate_simple(1, dims, NULL)) < 0) FAIL_STACK_ERROR + if((dataset_id = H5Dcreate(group_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((dataset2_id = H5Dcreate(group2_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Delete */ - if(H5Gunlink(file_id, "/g11/d") < 0) TEST_ERROR + if(H5Ldelete(file_id, "/g11/d", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(dataset_id, "", "") < 0) TEST_ERROR @@ -658,16 +659,16 @@ test_main(hid_t file_id, hid_t fapl) if(check_name(dataset2_id, "/g11/g/d", "/g11/g/d") < 0) TEST_ERROR /* Close */ - H5Dclose(dataset_id); - H5Dclose(dataset2_id); - H5Sclose(space_id); - H5Gclose(group_id); - H5Gclose(group2_id); + if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR + if(H5Dclose(dataset2_id) < 0) FAIL_STACK_ERROR + if(H5Sclose(space_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR PASSED(); -/*------------------------------------------------------------------------- + /*------------------------------------------------------------------------- * Test H5Iget_name with H5Fmount; with IDs on the list *------------------------------------------------------------------------- */ @@ -1046,6 +1047,7 @@ test_main(hid_t file_id, hid_t fapl) PASSED(); + /*------------------------------------------------------------------------- * Test H5Iget_name with different files, test1 *------------------------------------------------------------------------- @@ -1054,22 +1056,22 @@ test_main(hid_t file_id, hid_t fapl) TESTING("H5Iget_name with different files"); /* Create a new file using default properties. */ - if((file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR -/* Create a new file using default properties. */ - if((file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create a new file using default properties. */ + if((file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create the dataspace */ - if((space_id = H5Screate_simple(1, dims, NULL)) < 0) TEST_ERROR + if((space_id = H5Screate_simple(1, dims, NULL)) < 0) FAIL_STACK_ERROR /* Create a new dataset */ - if((dataset_id = H5Dcreate(file2_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT)) < 0) TEST_ERROR + if((dataset_id = H5Dcreate(file2_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create a new dataset */ - if((dataset2_id = H5Dcreate(file3_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT)) < 0) TEST_ERROR + if((dataset2_id = H5Dcreate(file3_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Delete */ - if(H5Gunlink(file2_id, "/d") < 0) TEST_ERROR + if(H5Ldelete(file2_id, "/d", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(dataset_id, "", "") < 0) TEST_ERROR @@ -1078,16 +1080,16 @@ test_main(hid_t file_id, hid_t fapl) if(check_name(dataset2_id, "/d", "/d") < 0) TEST_ERROR /* Close */ - H5Dclose(dataset_id); - H5Dclose(dataset2_id); - H5Sclose(space_id); - H5Fclose(file2_id); - H5Fclose(file3_id); + if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR + if(H5Dclose(dataset2_id) < 0) FAIL_STACK_ERROR + if(H5Sclose(space_id) < 0) FAIL_STACK_ERROR + if(H5Fclose(file2_id) < 0) FAIL_STACK_ERROR + if(H5Fclose(file3_id) < 0) FAIL_STACK_ERROR PASSED(); -/*------------------------------------------------------------------------- + /*------------------------------------------------------------------------- * Test H5Iget_name with different files, test2 *------------------------------------------------------------------------- */ @@ -1095,22 +1097,22 @@ test_main(hid_t file_id, hid_t fapl) TESTING("H5Iget_name with different files #2"); /* Create a new file using default properties. */ - if((file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR -/* Create a new file using default properties. */ - if((file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create a new file using default properties. */ + if((file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create the dataspace */ - if((space_id = H5Screate_simple(1, dims, NULL)) < 0) TEST_ERROR + if((space_id = H5Screate_simple(1, dims, NULL)) < 0) FAIL_STACK_ERROR /* Create a new dataset */ - if((dataset_id = H5Dcreate(file2_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT)) < 0) TEST_ERROR + if((dataset_id = H5Dcreate(file2_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create a new dataset */ - if((dataset2_id = H5Dcreate(file3_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT)) < 0) TEST_ERROR + if((dataset2_id = H5Dcreate(file3_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Delete */ - if(H5Gunlink(file3_id, "/d") < 0) TEST_ERROR + if(H5Ldelete(file3_id, "/d", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(dataset_id, "/d", "/d") < 0) TEST_ERROR @@ -1119,15 +1121,16 @@ test_main(hid_t file_id, hid_t fapl) if(check_name(dataset2_id, "", "") < 0) TEST_ERROR /* Close */ - H5Dclose(dataset_id); - H5Dclose(dataset2_id); - H5Sclose(space_id); - H5Fclose(file2_id); - H5Fclose(file3_id); + if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR + if(H5Dclose(dataset2_id) < 0) FAIL_STACK_ERROR + if(H5Sclose(space_id) < 0) FAIL_STACK_ERROR + if(H5Fclose(file2_id) < 0) FAIL_STACK_ERROR + if(H5Fclose(file3_id) < 0) FAIL_STACK_ERROR PASSED(); -/*------------------------------------------------------------------------- + + /*------------------------------------------------------------------------- * Test H5Iget_name with a small buffer for name *------------------------------------------------------------------------- */ @@ -1320,7 +1323,7 @@ test_main(hid_t file_id, hid_t fapl) PASSED(); -/*------------------------------------------------------------------------- + /*------------------------------------------------------------------------- * Test H5Iget_name with H5Fclose *------------------------------------------------------------------------- */ @@ -1328,7 +1331,7 @@ test_main(hid_t file_id, hid_t fapl) TESTING("H5Iget_name with H5Fclose"); /* Create a file and group "/g1/g2" in it */ - file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + if((file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR if((group_id = H5Gcreate2(file1_id, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((group2_id = H5Gcreate2(file1_id, "/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -1336,27 +1339,27 @@ test_main(hid_t file_id, hid_t fapl) if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR /* Close file */ - H5Fclose(file1_id); + if(H5Fclose(file1_id) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR /* Close */ - H5Gclose(group_id); - H5Gclose(group2_id); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR PASSED(); -/*------------------------------------------------------------------------- - * Test H5Iget_name with H5Fmount and H5Gunlink + /*------------------------------------------------------------------------- + * Test H5Iget_name with H5Fmount and H5Ldelete *------------------------------------------------------------------------- */ - TESTING("H5Iget_name with H5Fmount and H5Gunlink"); + TESTING("H5Iget_name with H5Fmount and H5Ldelete"); /* Create a file and group "/g1/g2" in it */ - file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + if((file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR if((group_id = H5Gcreate2(file1_id, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((group2_id = H5Gcreate2(file1_id, "/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -1366,7 +1369,7 @@ test_main(hid_t file_id, hid_t fapl) if((group4_id = H5Gcreate2(file2_id, "/g3/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Mount first file at "/g3/g4" in the second file */ - if(H5Fmount(file2_id, "/g3/g4", file1_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Fmount(file2_id, "/g3/g4", file1_id, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Open the mounted group */ if((group5_id = H5Gopen2(file2_id, "/g3/g4/g1/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -1375,7 +1378,7 @@ test_main(hid_t file_id, hid_t fapl) if(check_name(group5_id, "/g3/g4/g1/g2", "/g3/g4/g1/g2") < 0) TEST_ERROR /* Delete */ - if(H5Gunlink(file1_id, "/g3/g4/g1/g2") < 0) TEST_ERROR + if(H5Ldelete(file1_id, "/g3/g4/g1/g2", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group5_id, "", "") < 0) TEST_ERROR @@ -1384,18 +1387,17 @@ test_main(hid_t file_id, hid_t fapl) if(check_name(group2_id, "", "") < 0) TEST_ERROR /* Close */ - H5Gclose(group_id); - H5Gclose(group2_id); - H5Gclose(group3_id); - H5Gclose(group4_id); - H5Gclose(group5_id); - H5Fclose(file1_id); - H5Fclose(file2_id); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group4_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group5_id) < 0) FAIL_STACK_ERROR + if(H5Fclose(file1_id) < 0) FAIL_STACK_ERROR + if(H5Fclose(file2_id) < 0) FAIL_STACK_ERROR PASSED(); - /*------------------------------------------------------------------------- * Test H5Iget_name with H5Fmount and H5Lmove *------------------------------------------------------------------------- @@ -1543,7 +1545,7 @@ test_main(hid_t file_id, hid_t fapl) if(check_name(group4_id, "/g19/g3", "/g19/g3") < 0) TEST_ERROR /* Delete group */ - if(H5Gunlink(file_id, "/g19/g3") < 0) FAIL_STACK_ERROR + if(H5Ldelete(file_id, "/g19/g3", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group4_id, "/g19/g1", "") < 0) TEST_ERROR @@ -1563,7 +1565,7 @@ test_main(hid_t file_id, hid_t fapl) if(check_name(group4_id, "/g19/g3", "/g19/g3") < 0) TEST_ERROR /* Delete group, using relative path */ - if(H5Gunlink(group_id, "g3") < 0) FAIL_STACK_ERROR + if(H5Ldelete(group_id, "g3", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group4_id, "/g19/g1", "") < 0) TEST_ERROR @@ -1581,7 +1583,6 @@ test_main(hid_t file_id, hid_t fapl) PASSED(); - /*------------------------------------------------------------------------- * Test H5Iget_name with H5Lcreate_soft *------------------------------------------------------------------------- @@ -1712,7 +1713,7 @@ test_main(hid_t file_id, hid_t fapl) if((group3_id = H5Gopen2(file_id, "/g23/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Delete group */ - if(H5Gunlink(file_id, "/g23/g1") < 0) FAIL_STACK_ERROR + if(H5Ldelete(file_id, "/g23/g1", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group3_id, "/g23/g2", "/g23/g2") < 0) TEST_ERROR @@ -1724,6 +1725,7 @@ test_main(hid_t file_id, hid_t fapl) PASSED(); + /*------------------------------------------------------------------------- * Test H5Iget_name with H5Lcreate_soft and unlink source *------------------------------------------------------------------------- @@ -1745,7 +1747,7 @@ test_main(hid_t file_id, hid_t fapl) if((group3_id = H5Gopen2(file_id, "/g24/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Delete symbolic link */ - if(H5Gunlink(file_id, "/g24/g2") < 0) FAIL_STACK_ERROR + if(H5Ldelete(file_id, "/g24/g2", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group3_id, "/g24/g1", "") < 0) TEST_ERROR @@ -1757,7 +1759,8 @@ test_main(hid_t file_id, hid_t fapl) PASSED(); -/*------------------------------------------------------------------------- + + /*------------------------------------------------------------------------- * Test H5Iget_name with several nested mounted files *------------------------------------------------------------------------- */ @@ -1770,45 +1773,45 @@ test_main(hid_t file_id, hid_t fapl) if((group3_id = H5Gcreate2(file_id, "/g25/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close */ - H5Gclose(group_id); - H5Gclose(group2_id); - H5Gclose(group3_id); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR /* Create second file and group "/g26/g3/g4" in it */ - file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + if((file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR if((group_id = H5Gcreate2(file1_id, "/g26", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((group2_id = H5Gcreate2(file1_id, "/g26/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((group3_id = H5Gcreate2(file1_id, "/g26/g3/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close */ - H5Gclose(group_id); - H5Gclose(group2_id); - H5Gclose(group3_id); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR /* Create third file and group "/g27/g5/g6" in it */ - file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + if((file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR if((group_id = H5Gcreate2(file2_id, "/g27", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((group2_id = H5Gcreate2(file2_id, "/g27/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((group3_id = H5Gcreate2(file2_id, "/g27/g5/g6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close */ - H5Gclose(group_id); - H5Gclose(group2_id); - H5Gclose(group3_id); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR /* Create fourth file and group "/g28/g5/g6" in it */ - file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + if((file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR if((group_id = H5Gcreate2(file3_id, "/g28", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((group2_id = H5Gcreate2(file3_id, "/g28/g7", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((group3_id = H5Gcreate2(file3_id, "/g28/g7/g8", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close */ - H5Gclose(group_id); - H5Gclose(group2_id); - H5Gclose(group3_id); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR /* Access group which will be hidden in the first file */ if((group_id = H5Gopen2(file_id, "/g25/g1/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -1817,7 +1820,7 @@ test_main(hid_t file_id, hid_t fapl) if(check_name(group_id, "/g25/g1/g2", "/g25/g1/g2") < 0) TEST_ERROR /* Mount second file under "/g25/g1" in the first file */ - if(H5Fmount(file_id, "/g25/g1", file1_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Fmount(file_id, "/g25/g1", file1_id, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group_id, "", "/g25/g1/g2") < 0) TEST_ERROR @@ -1829,7 +1832,7 @@ test_main(hid_t file_id, hid_t fapl) if(check_name(group2_id, "/g25/g1/g26/g3/g4", "/g25/g1/g26/g3/g4") < 0) TEST_ERROR /* Mount third file under "/g25/g1/g26/g3" in the first file */ - if(H5Fmount(file_id, "/g25/g1/g26/g3", file2_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Fmount(file_id, "/g25/g1/g26/g3", file2_id, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group2_id, "", "/g25/g1/g26/g3/g4") < 0) TEST_ERROR @@ -1841,7 +1844,7 @@ test_main(hid_t file_id, hid_t fapl) if(check_name(group3_id, "/g25/g1/g26/g3/g27/g5/g6", "/g25/g1/g26/g3/g27/g5/g6") < 0) TEST_ERROR /* Mount fourth file under "/g25/g1/g26/g3/g27/g5" in the first file */ - if(H5Fmount(file_id, "/g25/g1/g26/g3/g27/g5", file3_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Fmount(file_id, "/g25/g1/g26/g3/g27/g5", file3_id, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group3_id, "", "/g25/g1/g26/g3/g27/g5/g6") < 0) TEST_ERROR @@ -1852,7 +1855,7 @@ test_main(hid_t file_id, hid_t fapl) /* Verify */ if(check_name(group4_id, "/g25/g1/g26/g3/g27/g5/g28/g7/g8", "/g25/g1/g26/g3/g27/g5/g28/g7/g8") < 0) TEST_ERROR - if(H5Funmount(file_id, "/g25/g1/g26/g3/g27/g5") < 0) TEST_ERROR + if(H5Funmount(file_id, "/g25/g1/g26/g3/g27/g5") < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group4_id, "/g28/g7/g8", "") < 0) TEST_ERROR @@ -1861,10 +1864,10 @@ test_main(hid_t file_id, hid_t fapl) if(check_name(group_id, "", "/g25/g1/g2") < 0) TEST_ERROR /* Close */ - H5Gclose(group4_id); - H5Fclose(file3_id); + if(H5Gclose(group4_id) < 0) FAIL_STACK_ERROR + if(H5Fclose(file3_id) < 0) FAIL_STACK_ERROR - if(H5Funmount(file_id, "/g25/g1/g26/g3") < 0) TEST_ERROR + if(H5Funmount(file_id, "/g25/g1/g26/g3") < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group3_id, "/g27/g5/g6", "") < 0) TEST_ERROR @@ -1872,20 +1875,19 @@ test_main(hid_t file_id, hid_t fapl) if(check_name(group_id, "", "/g25/g1/g2") < 0) TEST_ERROR /* Close */ - H5Gclose(group3_id); - H5Fclose(file2_id); + if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR + if(H5Fclose(file2_id) < 0) FAIL_STACK_ERROR - if(H5Funmount(file_id, "/g25/g1") < 0) TEST_ERROR + if(H5Funmount(file_id, "/g25/g1") < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group2_id, "/g26/g3/g4", "") < 0) TEST_ERROR if(check_name(group_id, "/g25/g1/g2", "/g25/g1/g2") < 0) TEST_ERROR /* Close */ - H5Gclose(group_id); - H5Gclose(group2_id); - H5Fclose(file1_id); - + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR + if(H5Fclose(file1_id) < 0) FAIL_STACK_ERROR PASSED(); @@ -2143,12 +2145,12 @@ test_main(hid_t file_id, hid_t fapl) if((group3_id = H5Gcreate2(file_id, "/g36/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close */ - H5Gclose(group_id); - H5Gclose(group2_id); - H5Gclose(group3_id); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR /* Create second file and group "/g37/g4" in it */ - file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + if((file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR if((group_id = H5Gcreate2(file1_id, "/g37", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((group2_id = H5Gcreate2(file1_id, "/g37/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -2156,7 +2158,7 @@ test_main(hid_t file_id, hid_t fapl) if((group4_id = H5Gcreate2(file1_id, "/g37/g4/g5b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Mount second file under "/g36/g1" in the first file */ - if(H5Fmount(file_id, "/g36/g1", file1_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Fmount(file_id, "/g36/g1", file1_id, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Open group in mounted file */ if((group5_id = H5Gopen2(file_id, "/g36/g1/g37/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -2171,14 +2173,14 @@ test_main(hid_t file_id, hid_t fapl) if(check_name(group6_id, "/g36/g1/g37/g4/g5a", "/g36/g1/g37/g4/g5a") < 0) TEST_ERROR /* Delete end group in mounted file, using relative paths */ - if(H5Gunlink(group5_id, "g4/g5a") < 0) TEST_ERROR + if(H5Ldelete(group5_id, "g4/g5a", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group6_id, "", "") < 0) TEST_ERROR if(check_name(group3_id, "", "") < 0) TEST_ERROR /* Close deleted group */ - H5Gclose(group6_id); + if(H5Gclose(group6_id) < 0) FAIL_STACK_ERROR /* Open groups to delete in mounted file */ if((group6_id = H5Gopen2(file_id, "/g36/g1/g37/g4", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -2189,7 +2191,7 @@ test_main(hid_t file_id, hid_t fapl) if(check_name(group7_id, "/g36/g1/g37/g4/g5b", "/g36/g1/g37/g4/g5b") < 0) TEST_ERROR /* Delete middle group in mounted file, using relative paths */ - if(H5Gunlink(group5_id, "g4") < 0) TEST_ERROR + if(H5Ldelete(group5_id, "g4", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group6_id, "", "") < 0) TEST_ERROR @@ -2198,25 +2200,24 @@ test_main(hid_t file_id, hid_t fapl) if(check_name(group4_id, "", "") < 0) TEST_ERROR /* Close deleted groups */ - H5Gclose(group6_id); - H5Gclose(group7_id); + if(H5Gclose(group6_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group7_id) < 0) FAIL_STACK_ERROR /* Close group in mounted file */ - H5Gclose(group5_id); + if(H5Gclose(group5_id) < 0) FAIL_STACK_ERROR - if(H5Funmount(file_id, "/g36/g1") < 0) TEST_ERROR + if(H5Funmount(file_id, "/g36/g1") < 0) FAIL_STACK_ERROR /* Close */ - H5Gclose(group_id); - H5Gclose(group2_id); - H5Gclose(group3_id); - H5Gclose(group4_id); - H5Fclose(file1_id); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group4_id) < 0) FAIL_STACK_ERROR + if(H5Fclose(file1_id) < 0) FAIL_STACK_ERROR PASSED(); - /*------------------------------------------------------------------------- * Test H5Iget_name with mounting already mounted files *------------------------------------------------------------------------- @@ -2225,7 +2226,7 @@ test_main(hid_t file_id, hid_t fapl) TESTING("H5Iget_name with mounting already mounted files"); /* Create file and group "/g38/g1/g2" in it */ - file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + if((file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR if((group_id = H5Gcreate2(file1_id, "/g38", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((group2_id = H5Gcreate2(file1_id, "/g38/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -2237,7 +2238,7 @@ test_main(hid_t file_id, hid_t fapl) H5Gclose(group3_id); /* Create second file and group "/g39/g1/g2" in it */ - file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + if((file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR if((group_id = H5Gcreate2(file2_id, "/g39", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((group2_id = H5Gcreate2(file2_id, "/g39/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -2249,7 +2250,7 @@ test_main(hid_t file_id, hid_t fapl) H5Gclose(group3_id); /* Create third file and group "/g40/g5/g6" in it */ - file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + if((file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR if((group_id = H5Gcreate2(file3_id, "/g40", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((group2_id = H5Gcreate2(file3_id, "/g40/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -2607,7 +2608,7 @@ test_obj_ref(hid_t fapl) /* Now we try unlinking dataset2 from the file and searching for it. It shouldn't be found */ if((dataset2 = H5Rdereference(dataset, H5R_OBJECT, &wbuf[1])) < 0) FAIL_STACK_ERROR - if(H5Gunlink(fid1, "/Group1/Dataset2") < 0) + if(H5Ldelete(fid1, "/Group1/Dataset2", H5P_DEFAULT) < 0) FAIL_STACK_ERROR TESTING("getting path to dataset that has been unlinked"); diff --git a/test/links.c b/test/links.c index 11a5e9e..02ef664 100644 --- a/test/links.c +++ b/test/links.c @@ -1471,9 +1471,9 @@ error: static int test_compat(hid_t fapl, hbool_t new_format) { - hid_t file_id=-1; - hid_t group1_id=-1; - hid_t group2_id=-1; + hid_t file_id = -1; + hid_t group1_id = -1; + hid_t group2_id = -1; H5G_stat_t sb_hard1, sb_hard2, sb_soft1; char filename[1024]; char linkval[1024]; @@ -1489,62 +1489,62 @@ test_compat(hid_t fapl, hbool_t new_format) if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create two groups in the file */ - if((group1_id = H5Gcreate2(file_id, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((group2_id = H5Gcreate2(file_id, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((group1_id = H5Gcreate2(file_id, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((group2_id = H5Gcreate2(file_id, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create links using H5Glink and H5Glink2 */ - if(H5Glink(file_id, H5G_LINK_HARD, "group2", "group1/link_to_group2") < 0) TEST_ERROR - if(H5Glink2(file_id, "group1", H5G_LINK_HARD, group2_id, "link_to_group1") < 0) TEST_ERROR - if(H5Glink2(file_id, "link_to_group1", H5G_LINK_SOFT, H5G_SAME_LOC, "group2/soft_link_to_group1") < 0) TEST_ERROR + if(H5Glink(file_id, H5G_LINK_HARD, "group2", "group1/link_to_group2") < 0) FAIL_STACK_ERROR + if(H5Glink2(file_id, "group1", H5G_LINK_HARD, group2_id, "link_to_group1") < 0) FAIL_STACK_ERROR + if(H5Glink2(file_id, "link_to_group1", H5G_LINK_SOFT, H5G_SAME_LOC, "group2/soft_link_to_group1") < 0) FAIL_STACK_ERROR /* Test that H5Glink created hard links properly */ - if(H5Gget_objinfo(file_id, "/group2", TRUE, &sb_hard1) < 0) TEST_ERROR - if(H5Gget_objinfo(file_id, "/group1/link_to_group2", TRUE, &sb_hard2) < 0) TEST_ERROR + if(H5Gget_objinfo(file_id, "/group2", TRUE, &sb_hard1) < 0) FAIL_STACK_ERROR + if(H5Gget_objinfo(file_id, "/group1/link_to_group2", TRUE, &sb_hard2) < 0) FAIL_STACK_ERROR - if (HDmemcmp(&sb_hard1.objno, sb_hard2.objno, sizeof(sb_hard1.objno))) { + if(HDmemcmp(&sb_hard1.objno, sb_hard2.objno, sizeof(sb_hard1.objno))) { H5_FAILED(); puts(" Hard link test failed. Link seems not to point to the "); puts(" expected file location."); TEST_ERROR - } + } /* end if */ /* Test for the other hard link created */ - if(H5Gget_objinfo(file_id, "/group1", TRUE, &sb_hard1) < 0) TEST_ERROR - if(H5Gget_objinfo(file_id, "/group2/link_to_group1", TRUE, &sb_hard2) < 0) TEST_ERROR + if(H5Gget_objinfo(file_id, "/group1", TRUE, &sb_hard1) < 0) FAIL_STACK_ERROR + if(H5Gget_objinfo(file_id, "/group2/link_to_group1", TRUE, &sb_hard2) < 0) FAIL_STACK_ERROR - if (HDmemcmp(&sb_hard1.objno, sb_hard2.objno, sizeof(sb_hard1.objno))) { + if(HDmemcmp(&sb_hard1.objno, sb_hard2.objno, sizeof(sb_hard1.objno))) { H5_FAILED(); puts(" Hard link test failed. Link seems not to point to the "); puts(" expected file location."); TEST_ERROR - } + } /* end if */ /* Test the soft link */ - if(H5Gget_objinfo(file_id, "/group2/soft_link_to_group1", FALSE, &sb_soft1) < 0) TEST_ERROR + if(H5Gget_objinfo(file_id, "/group2/soft_link_to_group1", FALSE, &sb_soft1) < 0) FAIL_STACK_ERROR if(sb_soft1.type != H5G_LINK) TEST_ERROR if(sb_soft1.linklen != HDstrlen("link_to_group1") + 1) TEST_ERROR - if(H5Gget_linkval(group2_id, "soft_link_to_group1", sb_soft1.linklen, linkval) < 0) TEST_ERROR + if(H5Gget_linkval(group2_id, "soft_link_to_group1", sb_soft1.linklen, linkval) < 0) FAIL_STACK_ERROR if(HDstrcmp("link_to_group1", linkval)) TEST_ERROR /* Test H5Gmove and H5Gmove2 */ - if(H5Gmove(file_id, "group1", "moved_group1") < 0) TEST_ERROR - if(H5Gmove2(file_id, "group2", group1_id, "moved_group2") < 0) TEST_ERROR + if(H5Gmove(file_id, "group1", "moved_group1") < 0) FAIL_STACK_ERROR + if(H5Gmove2(file_id, "group2", group1_id, "moved_group2") < 0) FAIL_STACK_ERROR /* Ensure that both groups can be opened */ - if(H5Gclose(group2_id) < 0) TEST_ERROR - if(H5Gclose(group1_id) < 0) TEST_ERROR + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group1_id) < 0) FAIL_STACK_ERROR if((group1_id = H5Gopen2(file_id, "moved_group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((group2_id = H5Gopen2(file_id, "moved_group1/moved_group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close open IDs */ - if(H5Gclose(group2_id) < 0) TEST_ERROR - if(H5Gclose(group1_id) < 0) TEST_ERROR + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group1_id) < 0) FAIL_STACK_ERROR /* Test H5Gunlink */ - if(H5Gunlink(file_id, "moved_group1/moved_group2") < 0) TEST_ERROR + if(H5Gunlink(file_id, "moved_group1/moved_group2") < 0) FAIL_STACK_ERROR H5E_BEGIN_TRY { if(H5Gopen2(file_id, "moved_group1/moved_group2", H5P_DEFAULT) >=0) TEST_ERROR @@ -2748,25 +2748,25 @@ external_link_unlink_compact(hid_t fapl, hbool_t new_format) /* Unlink external link */ /* Open first file */ - if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR /* Unlink external link */ - if(H5Gunlink(fid, "src") < 0) TEST_ERROR + if(H5Ldelete(fid, "src", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close first file */ - if(H5Fclose(fid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR /* Open second file */ - if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR /* Open group for external link */ if((gid = H5Gopen2(fid, "dst", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close group */ - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); return 0; @@ -2875,18 +2875,18 @@ external_link_unlink_dense(hid_t fapl, hbool_t new_format) /* Unlink external link */ /* Open first file */ - if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR /* Open root group */ if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Unlink external link */ - if(H5Gunlink(fid, "src") < 0) TEST_ERROR + if(H5Ldelete(fid, "src", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Remove enough objects in the root group to change it into a "compact" group */ for(u = 0; u < ((max_compact - min_dense) + 1); u++) { sprintf(objname, "filler %u", u); - if(H5Gunlink(gid, objname) < 0) TEST_ERROR + if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ /* Check on root group's status */ @@ -2897,22 +2897,22 @@ external_link_unlink_dense(hid_t fapl, hbool_t new_format) if(H5G_has_stab_test(gid) == TRUE) TEST_ERROR /* Close root group */ - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Close first file */ - if(H5Fclose(fid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR /* Open second file */ - if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR /* Open group for external link (should be unaffected) */ if((gid = H5Gopen2(fid, "dst", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close group */ - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); return 0; @@ -3242,7 +3242,7 @@ external_link_ride(hid_t fapl, hbool_t new_format) /* Remove enough objects in the root group to change it into a "compact" group */ for(u = 0; u < ((max_compact - min_dense) + 3); u++) { sprintf(objname, "filler %u", u); - if(H5Gunlink(gid, objname) < 0) TEST_ERROR + if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ /* Check on root group's status */ @@ -3253,7 +3253,7 @@ external_link_ride(hid_t fapl, hbool_t new_format) if(H5G_is_new_dense_test(gid) == TRUE) TEST_ERROR /* Close root group */ - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Open object through external link */ if((gid = H5Gopen2(fid, "src", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -3263,34 +3263,34 @@ external_link_ride(hid_t fapl, hbool_t new_format) if(HDstrcmp(objname, "/dst")) TEST_ERROR /* Create object in external file */ - if((gid2 = H5Gcreate2(gid, "new_group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid2 = H5Gcreate2(gid, "new_group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close group in external file */ - if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR /* Close external object */ - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Close first file */ - if(H5Fclose(fid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR /* Open second file */ - if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR /* Open group created through external link */ if((gid = H5Gopen2(fid, "dst/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close group */ - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Open group created through external link */ if((gid = H5Gopen2(fid, "dst/new_group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close group */ - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); return 0; @@ -3936,40 +3936,40 @@ ud_hard_links(hid_t fapl) if(HDstrcmp(objname, "/group/new_group")) TEST_ERROR /* Close opened object */ - if(H5Gclose(gid) < 0) TEST_ERROR + 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) TEST_ERROR + if(H5Lget_info(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(); puts(" 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(H5Gunlink(fid, "/group") < 0) TEST_ERROR + 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(H5Gunlink(gid, "new_group") < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + 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(H5Gunlink(fid, "ud_link") < 0) TEST_ERROR + if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR /* The file should be empty again. */ if(empty_size != h5_get_file_size(filename)) TEST_ERROR - if(H5Lunregister(UD_HARD_TYPE) < 0) TEST_ERROR + if(H5Lunregister(UD_HARD_TYPE) < 0) FAIL_STACK_ERROR PASSED(); return 0; @@ -4123,39 +4123,39 @@ ud_link_reregister(hid_t fapl) if(HDstrcmp(objname, "/rereg_target/new_group")) TEST_ERROR /* Close opened object */ - if(H5Gclose(gid) < 0) TEST_ERROR + 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(H5Gunlink(fid, "/group") < 0) TEST_ERROR + 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) < 0) TEST_ERROR - if(H5Lis_registered(UD_HARD_TYPE) != TRUE) TEST_ERROR + if(H5Lregister(UD_hard_class) < 0) FAIL_STACK_ERROR + if(H5Lis_registered(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) TEST_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Delete the UD hard link. This should cause the group to be * deleted, too. */ - if(H5Gunlink(fid, "ud_link") < 0) TEST_ERROR + 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(H5Gunlink(fid, "/rereg_target/new_group") < 0) TEST_ERROR - if(H5Gunlink(fid, REREG_TARGET_NAME) < 0) TEST_ERROR + 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) TEST_ERROR + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR /* The file should be empty again. */ - if(empty_size!=h5_get_file_size(filename)) TEST_ERROR + if(empty_size != h5_get_file_size(filename)) TEST_ERROR - if(H5Lunregister(UD_HARD_TYPE) < 0) TEST_ERROR - if(H5Lis_registered(UD_HARD_TYPE) != FALSE) TEST_ERROR + if(H5Lunregister(UD_HARD_TYPE) < 0) FAIL_STACK_ERROR + if(H5Lis_registered(UD_HARD_TYPE) != FALSE) FAIL_STACK_ERROR PASSED(); return 0; @@ -4376,7 +4376,7 @@ ud_callbacks(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Remove UD link */ - if(H5Gunlink(fid, NEW_UD_CB_LINK_NAME) < 0) FAIL_STACK_ERROR + 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 */ @@ -4399,9 +4399,9 @@ ud_callbacks(hid_t fapl, hbool_t new_format) H5E_BEGIN_TRY { if(H5Lcreate_ud(fid, NEW_UD_CB_LINK_NAME, 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(H5Gunlink(fid, UD_CB_LINK_NAME) >= 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(H5Gunlink(fid, UD_CB_LINK_NAME) >= 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 */ @@ -4833,11 +4833,11 @@ ud_link_errors(hid_t fapl, hbool_t new_format) if(H5Lcopy(fid, "ud_link", fid, "copy_fail", H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR /* The traversal callback will fail if we remove its target */ - if(H5Gunlink(fid, "group") < 0) TEST_ERROR + if(H5Ldelete(fid, "group", H5P_DEFAULT) < 0) TEST_ERROR if((gid = H5Gopen2(gid, "ud_link", H5P_DEFAULT)) >= 0) TEST_ERROR /* The deletion callback will always fail */ - if(H5Gunlink(fid, "ud_link") >= 0) TEST_ERROR + 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 @@ -4874,7 +4874,7 @@ ud_link_errors(hid_t fapl, hbool_t new_format) if(H5Lcopy(fid, "ud_link", fid, "copy_succ2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Delete link (this callback should work now) */ - if(H5Gunlink(fid, "ud_link") < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ if(H5Fclose(fid) < 0) FAIL_STACK_ERROR diff --git a/test/mount.c b/test/mount.c index 101ac66..028f92b 100644 --- a/test/mount.c +++ b/test/mount.c @@ -689,7 +689,7 @@ test_unlink(hid_t fapl) } /* end if */ /* Unlink the mount point */ - if(H5Gunlink(file1, "/mnt_unlink") < 0) FAIL_STACK_ERROR + if(H5Ldelete(file1, "/mnt_unlink", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* * We should still be able to get to "/file2" of file2 by starting at diff --git a/test/objcopy.c b/test/objcopy.c index 4aa4c45..148eea4 100755 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -7091,7 +7091,7 @@ test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl, unsigned flag, hboo /* Unlink dataset to copy from original location */ /* (So group comparison works properly) */ - if(H5Gunlink(fid_src, NAME_DATASET_SUB_SUB) < 0) TEST_ERROR + if(H5Ldelete(fid_src, NAME_DATASET_SUB_SUB, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* open the group for copy */ if((gid = H5Gopen2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR diff --git a/test/stab.c b/test/stab.c index d49d3a8..2aed346 100644 --- a/test/stab.c +++ b/test/stab.c @@ -456,7 +456,7 @@ lifecycle(hid_t fapl2) while(u >= LIFECYCLE_MIN_DENSE) { sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); - if(H5Gunlink(gid, objname) < 0) TEST_ERROR + if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR u--; } /* end while */ @@ -468,7 +468,7 @@ lifecycle(hid_t fapl2) /* Unlink one more object from the group, which should transform back to using links */ sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); - if(H5Gunlink(gid, objname) < 0) TEST_ERROR + if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR u--; /* Check on top group's status */ @@ -478,10 +478,10 @@ lifecycle(hid_t fapl2) /* Unlink last two objects from top group */ sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); - if(H5Gunlink(gid, objname) < 0) TEST_ERROR + if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR u--; sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); - if(H5Gunlink(gid, objname) < 0) TEST_ERROR + if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check on top group's status */ if(H5G_is_empty_test(gid) != TRUE) TEST_ERROR @@ -490,7 +490,7 @@ lifecycle(hid_t fapl2) if(H5Gclose(gid) < 0) TEST_ERROR /* Unlink top group */ - if(H5Gunlink(fid, LIFECYCLE_TOP_GROUP) < 0) TEST_ERROR + if(H5Ldelete(fid, LIFECYCLE_TOP_GROUP, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close GCPL */ if(H5Pclose(gcpl) < 0) TEST_ERROR @@ -603,7 +603,7 @@ long_compact(hid_t fapl2) if(H5G_is_new_dense_test(gid) != TRUE) TEST_ERROR /* Unlink second object from top group */ - if(H5Gunlink(gid, objname) < 0) TEST_ERROR + if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check on top group's status */ /* (Should still be dense storage to hold links, since name is too long for object header message) */ @@ -613,7 +613,7 @@ long_compact(hid_t fapl2) /* Unlink first object from top group */ objname[0] = 'a'; - if(H5Gunlink(gid, objname) < 0) TEST_ERROR + if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check on top group's status */ /* (Should have deleted the dense storage now) */ @@ -626,7 +626,7 @@ long_compact(hid_t fapl2) if(H5Gclose(gid) < 0) TEST_ERROR /* Unlink top group */ - if(H5Gunlink(fid, "top") < 0) TEST_ERROR + if(H5Ldelete(fid, "top", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR @@ -736,7 +736,7 @@ read_old(hid_t fapl2) /* Delete new objects from old group */ for(u = 0; u < READ_OLD_NGROUPS; u++) { sprintf(objname, "Group %u", u); - if(H5Gunlink(gid, objname) < 0) TEST_ERROR + if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ /* Check on old group's status */ @@ -844,7 +844,7 @@ no_compact(hid_t fapl2) /* Unlink object from top group */ sprintf(objname, NO_COMPACT_BOTTOM_GROUP, (unsigned)0); - if(H5Gunlink(gid, objname) < 0) TEST_ERROR + if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check on top group's status */ if(H5G_is_empty_test(gid) != TRUE) TEST_ERROR @@ -853,7 +853,7 @@ no_compact(hid_t fapl2) if(H5Gclose(gid) < 0) TEST_ERROR /* Unlink top group */ - if(H5Gunlink(fid, NO_COMPACT_TOP_GROUP) < 0) TEST_ERROR + if(H5Ldelete(fid, NO_COMPACT_TOP_GROUP, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR diff --git a/test/tattr.c b/test/tattr.c index b836d98..d987994 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -1735,8 +1735,8 @@ test_attr_dtype_shared(hid_t fapl) VERIFY(statbuf.nlink, 3, "H5Gget_objinfo"); /* Unlink the dataset */ - ret=H5Gunlink(file_id,DSET1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(file_id, DSET1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Check reference count on named datatype */ ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf); @@ -1744,8 +1744,8 @@ test_attr_dtype_shared(hid_t fapl) VERIFY(statbuf.nlink, 1, "H5Gget_objinfo"); /* Unlink the named datatype */ - ret=H5Gunlink(file_id,TYPE1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(file_id, TYPE1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Close file */ ret=H5Fclose(file_id); @@ -1945,8 +1945,8 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); /* Unlink dataset with attributes */ - ret = H5Gunlink(fid, DSET1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Close file */ ret = H5Fclose(fid); @@ -2084,8 +2084,8 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); /* Unlink dataset with attributes */ - ret = H5Gunlink(fid, DSET1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Close file */ ret = H5Fclose(fid); @@ -2262,8 +2262,8 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); /* Unlink dataset with attributes */ - ret = H5Gunlink(fid, DSET1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Close file */ ret = H5Fclose(fid); @@ -2421,8 +2421,8 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); /* Unlink dataset with attributes */ - ret = H5Gunlink(fid, DSET1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Close file */ ret = H5Fclose(fid); @@ -2546,8 +2546,8 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fopen"); /* Unlink dataset */ - ret = H5Gunlink(fid, DSET1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Check on dataset's attribute storage status */ ret = H5F_get_sohm_mesg_count_test(fid, H5O_ATTR_ID, &mesg_count); @@ -2716,8 +2716,8 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); /* Unlink dataset */ - ret = H5Gunlink(fid, DSET1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Close file */ ret = H5Fclose(fid); @@ -2986,8 +2986,8 @@ test_attr_big(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); /* Unlink dataset */ - ret = H5Gunlink(fid, DSET1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Close file */ ret = H5Fclose(fid); @@ -3196,8 +3196,8 @@ test_attr_null_space(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); /* Unlink dataset */ - ret = H5Gunlink(fid, DSET1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Close file */ ret = H5Fclose(fid); @@ -6868,15 +6868,15 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) } /* end if */ /* Unlink datasets with attributes */ - ret = H5Gunlink(fid, DSET1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); - ret = H5Gunlink(fid, DSET2_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); + ret = H5Ldelete(fid, DSET2_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Unlink committed datatype */ if(test_shared == 2) { - ret = H5Gunlink(fid, TYPE1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, TYPE1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); } /* end if */ /* Check on attribute storage status */ @@ -7310,15 +7310,15 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) } /* end if */ /* Unlink datasets with attributes */ - ret = H5Gunlink(fid, DSET1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); - ret = H5Gunlink(fid, DSET2_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "HLdelete"); + ret = H5Ldelete(fid, DSET2_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Unlink committed datatype */ if(test_shared == 2) { - ret = H5Gunlink(fid, TYPE1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, TYPE1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); } /* end if */ /* Check on attribute storage status */ @@ -7674,15 +7674,15 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) } /* end if */ /* Unlink datasets with attributes */ - ret = H5Gunlink(fid, DSET1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); - ret = H5Gunlink(fid, DSET2_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); + ret = H5Ldelete(fid, DSET2_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Unlink committed datatype */ if(test_shared == 2) { - ret = H5Gunlink(fid, TYPE1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, TYPE1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); } /* end if */ /* Check on attribute storage status */ @@ -7983,8 +7983,8 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); /* Unlink second dataset */ - ret = H5Gunlink(fid, DSET2_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, DSET2_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Check on first dataset's attribute storage status */ @@ -8026,13 +8026,13 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); /* Unlink first dataset */ - ret = H5Gunlink(fid, DSET1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Unlink committed datatype */ if(test_shared == 2) { - ret = H5Gunlink(fid, TYPE1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, TYPE1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); } /* end if */ /* Check on attribute storage status */ @@ -8150,8 +8150,8 @@ test_attr_bug1(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Gclose"); /* Unlink second group */ - ret = H5Gunlink(fid, GROUP2_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, GROUP2_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Re-open first group */ gid = H5Gopen2(fid, GROUP1_NAME, H5P_DEFAULT); diff --git a/test/tfile.c b/test/tfile.c index e477622..dc971e7 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -1254,8 +1254,8 @@ test_file_freespace(void) /* Delete datasets in file */ for(u = 0; u < 10; u++) { sprintf(name, "Dataset %u", u); - ret = H5Gunlink(file, name); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(file, name, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); } /* end for */ /* Check that there is the right amount of free space in the file */ diff --git a/test/tmisc.c b/test/tmisc.c index b36a6c4..0fe0434 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -335,8 +335,8 @@ test_misc1(void) CHECK(ret, FAIL, "H5Dclose"); /* Remove the dataset. */ - ret = H5Gunlink(file, MISC1_DSET_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(file, MISC1_DSET_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Write the dataset for the second time with a different value. */ dataset = H5Dcreate(file, MISC1_DSET_NAME, H5T_NATIVE_INT, dataspace, H5P_DEFAULT); @@ -2476,8 +2476,8 @@ test_misc14(void) TestErrPrintf("Error on line %d: data1!=rdata\n",__LINE__); /* Unlink second dataset */ - ret = H5Gunlink(file_id, MISC14_DSET2_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(file_id, MISC14_DSET2_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Close second dataset */ ret = H5Dclose(Dataset2); @@ -2524,8 +2524,8 @@ test_misc14(void) TestErrPrintf("Error on line %d: data2!=rdata\n",__LINE__); /* Unlink first dataset */ - ret = H5Gunlink(file_id, MISC14_DSET1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(file_id, MISC14_DSET1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Close first dataset */ ret = H5Dclose(Dataset1); @@ -2585,8 +2585,8 @@ test_misc14(void) TestErrPrintf("Error on line %d: data3!=rdata\n",__LINE__); /* Unlink second dataset */ - ret = H5Gunlink(file_id, MISC14_DSET2_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(file_id, MISC14_DSET2_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Close second dataset */ ret = H5Dclose(Dataset2); @@ -3683,15 +3683,15 @@ test_misc22(void) MESSAGE(5, ("Testing datatypes with SZIP filter\n")); /* Allocate space for the buffer */ - buf = (char *)HDcalloc(MISC22_SPACE_DIM0*MISC22_SPACE_DIM1,8); + buf = (char *)HDcalloc(MISC22_SPACE_DIM0*MISC22_SPACE_DIM1, 8); CHECK(buf, NULL, "HDcalloc"); /* Create the file */ - fid = H5Fcreate (MISC22_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(MISC22_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fcreate"); /* Create the dataspace for the dataset */ - sid = H5Screate_simple (MISC22_SPACE_RANK, dims, NULL); + sid = H5Screate_simple(MISC22_SPACE_RANK, dims, NULL); CHECK(sid, FAIL, "H5Screate_simple"); for (i = 0; i < 4; i++) { @@ -3704,14 +3704,14 @@ test_misc22(void) MESSAGE(5, (" Testing datatypes size=%d precision=%u offset=%d\n",H5Tget_size(idts[i]),(unsigned)prec[j],(unsigned)offsets[k])); /* Create the DCPL */ - dcpl = H5Pcreate (H5P_DATASET_CREATE); + dcpl = H5Pcreate(H5P_DATASET_CREATE); CHECK(dcpl, FAIL, "H5Pcreate"); /* Set DCPL properties */ - ret = H5Pset_chunk (dcpl, MISC22_SPACE_RANK, chunk_size); + ret = H5Pset_chunk(dcpl, MISC22_SPACE_RANK, chunk_size); CHECK(ret, FAIL, "H5Pset_chunk"); /* Set custom DCPL properties */ - ret = H5Pset_szip (dcpl, H5_SZIP_NN_OPTION_MASK, 32); /* vary the PPB */ + ret = H5Pset_szip(dcpl, H5_SZIP_NN_OPTION_MASK, 32); /* vary the PPB */ CHECK(ret, FAIL, "H5Pset_szip"); /* set up the datatype according to the loop */ @@ -3734,40 +3734,40 @@ test_misc22(void) } /* Create the dataset */ - dsid = H5Dcreate (fid, MISC22_DSET_NAME, dtype, sid, dcpl); + dsid = H5Dcreate(fid, MISC22_DSET_NAME, dtype, sid, dcpl); CHECK(dsid, FAIL, "H5Dwrite"); /* Write out the whole dataset */ - ret = H5Dwrite (dsid, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); + ret = H5Dwrite(dsid, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); CHECK(ret, FAIL, "H5Dwrite"); /* Close everything */ - ret = H5Dclose (dsid); + ret = H5Dclose(dsid); CHECK(ret, FAIL, "H5Dclose"); - ret = H5Tclose (dtype); + ret = H5Tclose(dtype); CHECK(ret, FAIL, "H5Tclose"); - ret = H5Pclose (dcpl); + ret = H5Pclose(dcpl); CHECK(ret, FAIL, "H5Pclose"); - dsid = H5Dopen (fid, MISC22_DSET_NAME); + dsid = H5Dopen(fid, MISC22_DSET_NAME); CHECK(dsid, FAIL, "H5Topen"); dcpl2 = H5Dget_create_plist(dsid); CHECK(dcpl2, FAIL, "H5Dget_create_plist"); - ret= H5Pget_filter_by_id( dcpl2, H5Z_FILTER_SZIP, &flags, - &cd_nelmts, cd_values, 0, NULL , NULL ); + ret= H5Pget_filter_by_id(dcpl2, H5Z_FILTER_SZIP, &flags, + &cd_nelmts, cd_values, 0, NULL , NULL); CHECK(ret, FAIL, "H5Pget_filter_by_id"); VERIFY(cd_values[2], correct, "SZIP filter returned value for precision"); - ret = H5Dclose (dsid); + ret = H5Dclose(dsid); CHECK(ret, FAIL, "H5Dclose"); - ret = H5Gunlink (fid, MISC22_DSET_NAME ); - CHECK(ret, FAIL, "H5Dunlink"); + ret = H5Ldelete(fid, MISC22_DSET_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); - ret = H5Pclose (dcpl2); + ret = H5Pclose(dcpl2); CHECK(ret, FAIL, "H5Pclose"); } } @@ -3780,9 +3780,9 @@ test_misc22(void) CHECK(ret, FAIL, "H5Tclose"); ret = H5Tclose(idts[3]); CHECK(ret, FAIL, "H5Tclose"); - ret = H5Sclose (sid); + ret = H5Sclose(sid); CHECK(ret, FAIL, "H5Sclose"); - ret = H5Fclose (fid); + ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); HDfree(buf); diff --git a/test/trefer.c b/test/trefer.c index 6f984f3..14fc184 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -887,8 +887,8 @@ test_reference_obj_deleted(void) CHECK(ret, FAIL, "H5Dclose"); /* Delete referenced dataset */ - ret = H5Gunlink(fid1,"/Dataset1"); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid1, "/Dataset1", H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Close disk dataspace */ ret = H5Sclose(sid1); @@ -1078,12 +1078,12 @@ test_reference_group(void) VERIFY(objtype, H5G_DATASET, "H5Gget_objtype_by_idx"); /* Unlink one of the objects in the dereferenced group */ - ret = H5Gunlink(gid, GROUPNAME2); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(gid, GROUPNAME2, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Delete dataset object in dereferenced group (with other dataset still open) */ - ret = H5Gunlink(gid, DSETNAME2); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(gid, DSETNAME2, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Close objects */ ret = H5Dclose(did); diff --git a/test/tvlstr.c b/test/tvlstr.c index 272186b..f4f77b9 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -808,24 +808,24 @@ static void test_vl_rewrite(void) } /* Read back from file 2 */ - for(i=0; i * Friday, September 25, 1998 * - * Purpose: Test H5Gunlink(). + * Purpose: Test unlinking operations. */ #define H5G_PACKAGE /*suppress error about including H5Gpkg */ @@ -103,39 +103,40 @@ const char *FILENAME[] = { static int test_one(hid_t file) { - hid_t work=-1, grp=-1; + hid_t work = -1, grp = -1; herr_t status; /* Create a test group */ - if((work = H5Gcreate2(file, "/test_one", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; + if((work = H5Gcreate2(file, "/test_one", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Delete by absolute name */ TESTING("unlink by absolute name"); - if((grp = H5Gcreate2(work, "foo", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(grp) < 0) TEST_ERROR - if(H5Gunlink(file, "/test_one/foo") < 0) TEST_ERROR + if((grp = H5Gcreate2(work, "foo", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(grp) < 0) FAIL_STACK_ERROR + if(H5Ldelete(file, "/test_one/foo", H5P_DEFAULT) < 0) FAIL_STACK_ERROR PASSED(); /* Delete by local name */ TESTING("unlink by local name"); - if((grp = H5Gcreate2(work, "foo", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(grp) < 0) TEST_ERROR - if(H5Gunlink(work, "foo") < 0) TEST_ERROR + if((grp = H5Gcreate2(work, "foo", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(grp) < 0) FAIL_STACK_ERROR + if(H5Ldelete(work, "foo", H5P_DEFAULT) < 0) FAIL_STACK_ERROR PASSED(); /* Delete directly - should fail */ TESTING("unlink without a name"); - if((grp = H5Gcreate2(work, "foo", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((grp = H5Gcreate2(work, "foo", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR H5E_BEGIN_TRY { - status = H5Gunlink(grp, "."); + status = H5Ldelete(grp, ".", H5P_DEFAULT); } H5E_END_TRY; if(status>=0) FAIL_PUTS_ERROR(" Unlinking object w/o a name should have failed.") - if(H5Gclose(grp) < 0) TEST_ERROR - PASSED(); + if(H5Gclose(grp) < 0) FAIL_STACK_ERROR /* Cleanup */ - if(H5Gclose(work) < 0) goto error; + if(H5Gclose(work) < 0) FAIL_STACK_ERROR + + PASSED(); return 0; error: @@ -144,7 +145,7 @@ test_one(hid_t file) H5Gclose(grp); } H5E_END_TRY; return 1; -} +} /* end test_one() */ /*------------------------------------------------------------------------- @@ -184,7 +185,7 @@ test_many(hid_t file) } /* end for */ for(i = 0; i < how_many; i++) { sprintf(name, "obj_%05d", i); - if(H5Gunlink(work, name) < 0) FAIL_STACK_ERROR + if(H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ PASSED(); @@ -196,7 +197,7 @@ test_many(hid_t file) } /* end for */ for(i = (how_many - 1); i >= 0; --i) { sprintf(name, "obj_%05d", i); - if(H5Gunlink(work, name) < 0) FAIL_STACK_ERROR + if(H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ PASSED(); @@ -211,7 +212,7 @@ test_many(hid_t file) sprintf(name, "obj_%05d", how_many - (1 + i / 2)); else sprintf(name, "obj_%05d", i / 2); - if(H5Gunlink(work, name) < 0) FAIL_STACK_ERROR + if(H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ PASSED(); @@ -226,7 +227,7 @@ test_many(hid_t file) sprintf(name, "obj_%05d", how_many - (1 + i / 2)); else sprintf(name, "obj_%05d", i / 2); - if(H5Gunlink(work, name) < 0) FAIL_STACK_ERROR + if(H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ PASSED(); @@ -266,21 +267,22 @@ test_symlink(hid_t file) TESTING("symlink removal"); /* Create a test group and symlink */ - if((work = H5Gcreate2(file, "/test_symlink", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Lcreate_soft("link_value", work, "link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Gunlink(work, "link") < 0) TEST_ERROR + if((work = H5Gcreate2(file, "/test_symlink", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("link_value", work, "link", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(work, "link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Cleanup */ - if (H5Gclose(work) < 0) TEST_ERROR + if(H5Gclose(work) < 0) FAIL_STACK_ERROR + PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { H5Gclose(work); } H5E_END_TRY; return 1; -} +} /* end test_symlink() */ /*------------------------------------------------------------------------- @@ -598,126 +600,132 @@ test_filespace(hid_t fapl) /* Create buffer for writing dataset */ if((data = HDmalloc(sizeof(int)*FILESPACE_DIM0*FILESPACE_DIM1*FILESPACE_DIM2))==NULL) TEST_ERROR + /* Create single dataset (with contiguous storage & late allocation), remove it & verify file size */ TESTING(" contiguous dataset with late allocation"); /* Create file */ - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create a single dataset to remove */ - if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dclose (dataset) < 0) TEST_ERROR + if((dataset = H5Dcreate(file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR /* Remove the dataset */ - if(H5Gunlink (file, DATASETNAME) < 0) TEST_ERROR + if(H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Get the size of the file */ - if((file_size=h5_get_file_size(filename))<0) TEST_ERROR + if((file_size = h5_get_file_size(filename)) < 0) TEST_ERROR /* Verify the file is correct size */ - if(file_size!=empty_size) TEST_ERROR + if(file_size != empty_size) TEST_ERROR PASSED(); + /* Create single dataset (with contiguous storage & early allocation), remove it & verify file size */ TESTING(" contiguous dataset with early allocation"); /* Create file */ - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create a single dataset to remove */ - if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, contig_dcpl)) < 0) TEST_ERROR - if(H5Dclose (dataset) < 0) TEST_ERROR + if((dataset = H5Dcreate(file, DATASETNAME, H5T_NATIVE_INT, space, contig_dcpl)) < 0) FAIL_STACK_ERROR + if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR /* Remove the dataset */ - if(H5Gunlink (file, DATASETNAME) < 0) TEST_ERROR + if(H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Get the size of the file */ - if((file_size=h5_get_file_size(filename))<0) TEST_ERROR + if((file_size = h5_get_file_size(filename))<0) TEST_ERROR /* Verify the file is correct size */ - if(file_size!=empty_size) TEST_ERROR + if(file_size != empty_size) TEST_ERROR PASSED(); + /* Create single dataset (with chunked storage & late allocation), remove it & verify file size */ TESTING(" chunked dataset with late allocation"); /* Create file */ - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create a single dataset to remove */ - if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, late_chunk_dcpl)) < 0) TEST_ERROR - if(H5Dclose (dataset) < 0) TEST_ERROR + if((dataset = H5Dcreate(file, DATASETNAME, H5T_NATIVE_INT, space, late_chunk_dcpl)) < 0) FAIL_STACK_ERROR + if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR /* Remove the dataset */ - if(H5Gunlink (file, DATASETNAME) < 0) TEST_ERROR + if(H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Get the size of the file */ - if((file_size=h5_get_file_size(filename))<0) TEST_ERROR + if((file_size = h5_get_file_size(filename))<0) TEST_ERROR /* Verify the file is correct size */ - if(file_size!=empty_size) TEST_ERROR + if(file_size != empty_size) TEST_ERROR PASSED(); + /* Create single dataset (with chunked storage & early allocation), remove it & verify file size */ TESTING(" chunked dataset with early allocation"); /* Create file */ - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create a single dataset to remove */ - if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, early_chunk_dcpl)) < 0) TEST_ERROR - if(H5Dclose (dataset) < 0) TEST_ERROR + if((dataset = H5Dcreate(file, DATASETNAME, H5T_NATIVE_INT, space, early_chunk_dcpl)) < 0) FAIL_STACK_ERROR + if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR /* Remove the dataset */ - if(H5Gunlink (file, DATASETNAME) < 0) TEST_ERROR + if(H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Get the size of the file */ - if((file_size=h5_get_file_size(filename))<0) TEST_ERROR + if((file_size = h5_get_file_size(filename)) < 0) TEST_ERROR /* Verify the file is correct size */ - if(file_size!=empty_size) TEST_ERROR + if(file_size != empty_size) TEST_ERROR PASSED(); + /* Create single dataset (with compressed storage & early allocation), remove it & verify file size */ TESTING(" compressed, chunked dataset"); /* Create file */ - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create a single dataset to remove */ - if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, comp_dcpl)) < 0) TEST_ERROR - if(H5Dclose (dataset) < 0) TEST_ERROR + if((dataset = H5Dcreate(file, DATASETNAME, H5T_NATIVE_INT, space, comp_dcpl)) < 0) FAIL_STACK_ERROR + if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR /* Remove the dataset */ - if(H5Gunlink (file, DATASETNAME) < 0) TEST_ERROR + if(H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Get the size of the file */ - if((file_size=h5_get_file_size(filename))<0) TEST_ERROR + if((file_size = h5_get_file_size(filename)) < 0) TEST_ERROR /* Verify the file is correct size */ - if(file_size!=empty_size) TEST_ERROR + if(file_size != empty_size) TEST_ERROR PASSED(); + /* Create single dataset (with compressed storage & early allocation), re-write it a bunch of * times (which should re-allocate blocks many times) and remove it & verify * file size. @@ -725,69 +733,71 @@ test_filespace(hid_t fapl) TESTING(" re-writing compressed, chunked dataset"); /* Create file (using FAPL with disabled raw data cache) */ - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_nocache)) < 0) TEST_ERROR + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_nocache)) < 0) FAIL_STACK_ERROR /* Create a single dataset to remove */ - if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, comp_dcpl)) < 0) TEST_ERROR + if((dataset = H5Dcreate(file, DATASETNAME, H5T_NATIVE_INT, space, comp_dcpl)) < 0) FAIL_STACK_ERROR /* Alternate re-writing dataset with compressible & random data */ - for(u=0; u 0; u--) { sprintf(objname, "%s %u", GROUPNAME, (u - 1)); - if(H5Gunlink(file, objname) < 0) TEST_ERROR + if(H5Ldelete(file, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ /* Close file */ - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Get the size of the file */ if((file_size = h5_get_file_size(filename)) < 0) TEST_ERROR @@ -933,35 +946,37 @@ test_filespace(hid_t fapl) PASSED(); + /* Create simple group hiearchy, remove it & verify file size */ TESTING(" simple group hierarchy"); /* Create file */ - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create a small group hierarchy to remove */ - if((group = H5Gcreate2(file, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((group2 = H5Gcreate2(group, GROUP2NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose (group2) < 0) TEST_ERROR - if(H5Gclose (group) < 0) TEST_ERROR + if((group = H5Gcreate2(file, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((group2 = H5Gcreate2(group, GROUP2NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(group2) < 0) FAIL_STACK_ERROR + if(H5Gclose(group) < 0) FAIL_STACK_ERROR /* Remove the second group */ - if(H5Gunlink (file, GROUPNAME "/" GROUP2NAME) < 0) TEST_ERROR + if(H5Ldelete(file, GROUPNAME "/" GROUP2NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Remove the first group */ - if(H5Gunlink (file, GROUPNAME) < 0) TEST_ERROR + if(H5Ldelete(file, GROUPNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Get the size of the file */ - if((file_size=h5_get_file_size(filename))<0) TEST_ERROR + if((file_size = h5_get_file_size(filename)) < 0) TEST_ERROR /* Verify the file is correct size */ - if(file_size!=empty_size) TEST_ERROR + if(file_size != empty_size) TEST_ERROR PASSED(); + /* Create complex group hiearchy, remove it & verify file size */ TESTING(" complex group hierarchy"); @@ -973,252 +988,257 @@ test_filespace(hid_t fapl) SKIPPED(); } else { - /* Create file */ - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - - /* Create a complex group hierarchy to remove */ - for(u=0; u0; u--) { - /* Open group */ - sprintf(objname,"%s %u",GROUPNAME,(u-1)); - if((group = H5Gopen2(file, objname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - - /* Open nested groups inside top groups */ - for(v=0; v 0; u--) { + /* Open group */ + sprintf(objname, "%s %u", GROUPNAME, (u - 1)); + if((group = H5Gopen2(file, objname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Open nested groups inside top groups */ + for(v = 0; v < FILESPACE_NESTED_GROUPS; v++) { + /* Create group */ + sprintf(objname, "%s %u", GROUP2NAME, v); + if((group2 = H5Gopen2(group, objname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Remove datasets inside nested groups */ + for(w = 0; w < FILESPACE_NDATASETS; w++) { + /* Remove dataset */ + sprintf(objname, "%s %u", DATASETNAME, w); + if(H5Ldelete(group2, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + } /* end for */ + + /* Close nested group */ + if(H5Gclose(group2) < 0) FAIL_STACK_ERROR + + /* Remove nested group */ + sprintf(objname, "%s %u",GROUP2NAME, v); + if(H5Ldelete(group, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ - /* Close nested group */ - if(H5Gclose (group2) < 0) TEST_ERROR + /* Close top group */ + if(H5Gclose(group) < 0) FAIL_STACK_ERROR - /* Remove nested group */ - sprintf(objname,"%s %u",GROUP2NAME,v); - if(H5Gunlink (group, objname) < 0) TEST_ERROR + /* Remove top group */ + sprintf(objname, "%s %u", GROUPNAME, (u - 1)); + if(H5Ldelete(file, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ - /* Close top group */ - if(H5Gclose (group) < 0) TEST_ERROR - - /* Remove top group */ - sprintf(objname,"%s %u",GROUPNAME,(u-1)); - if(H5Gunlink (file, objname) < 0) TEST_ERROR - } /* end for */ - - /* Close file */ - if(H5Fclose(file) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(file) < 0) FAIL_STACK_ERROR - /* Get the size of the file */ - if((file_size=h5_get_file_size(filename))<0) TEST_ERROR + /* Get the size of the file */ + if((file_size = h5_get_file_size(filename)) < 0) TEST_ERROR - /* Verify the file is correct size */ - if(file_size!=empty_size) TEST_ERROR + /* Verify the file is correct size */ + if(file_size != empty_size) TEST_ERROR - PASSED(); + PASSED(); } + /* Create dataset and duplicate dataset, remove original & verify file size */ TESTING(" duplicate dataset"); /* Create file */ - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create a single dataset to remove */ - if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dclose (dataset) < 0) TEST_ERROR + if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR /* Create another dataset with same name */ H5E_BEGIN_TRY { - dataset=H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT); + dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT); } H5E_END_TRY; - if (dataset>=0) { + if(dataset >= 0) { H5Dclose(dataset); TEST_ERROR } /* end if */ /* Remove the dataset */ - if(H5Gunlink (file, DATASETNAME) < 0) TEST_ERROR + if(H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Get the size of the file */ - if((file_size=h5_get_file_size(filename))<0) TEST_ERROR + if((file_size = h5_get_file_size(filename))<0) TEST_ERROR /* Verify the file is correct size */ - if(file_size!=empty_size) TEST_ERROR + if(file_size != empty_size) TEST_ERROR PASSED(); + /* Create group and duplicate group, remove original & verify file size */ TESTING(" duplicate group"); /* Create file */ - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create a single group to remove */ - if((group = H5Gcreate2(file, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose (group) < 0) TEST_ERROR + if((group = H5Gcreate2(file, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(group) < 0) FAIL_STACK_ERROR /* Create another group with same name */ H5E_BEGIN_TRY { group = H5Gcreate2(file, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } H5E_END_TRY; - if (group>=0) { + if(group >= 0) { H5Gclose(group); TEST_ERROR } /* end if */ /* Remove the group */ - if(H5Gunlink (file, GROUPNAME) < 0) TEST_ERROR + if(H5Ldelete(file, GROUPNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Get the size of the file */ - if((file_size=h5_get_file_size(filename))<0) TEST_ERROR + if((file_size = h5_get_file_size(filename)) < 0) TEST_ERROR /* Verify the file is correct size */ - if(file_size!=empty_size) TEST_ERROR + if(file_size != empty_size) TEST_ERROR PASSED(); + /* Create named datatype and duplicate named datatype, remove original & verify file size */ TESTING(" duplicate named datatype"); /* Create file */ - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create datatype to commit */ - if((type = H5Tcopy (H5T_NATIVE_INT)) < 0) TEST_ERROR + if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) FAIL_STACK_ERROR /* Create a single named datatype to remove */ - if(H5Tcommit (file, TYPENAME, type) < 0) TEST_ERROR - if(H5Tclose (type) < 0) TEST_ERROR + if(H5Tcommit(file, TYPENAME, type) < 0) FAIL_STACK_ERROR + if(H5Tclose(type) < 0) FAIL_STACK_ERROR /* Create datatype to commit */ - if((type = H5Tcopy (H5T_NATIVE_INT)) < 0) TEST_ERROR + if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) FAIL_STACK_ERROR /* Create another named datatype with same name */ H5E_BEGIN_TRY { - status = H5Tcommit (file, TYPENAME, type); + status = H5Tcommit(file, TYPENAME, type); } H5E_END_TRY; - if (status>=0) TEST_ERROR - if(H5Tclose (type) < 0) TEST_ERROR + if(status >= 0) TEST_ERROR + if(H5Tclose(type) < 0) FAIL_STACK_ERROR /* Remove the named datatype */ - if(H5Gunlink (file, TYPENAME) < 0) TEST_ERROR + if(H5Ldelete(file, TYPENAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Get the size of the file */ - if((file_size=h5_get_file_size(filename))<0) TEST_ERROR + if((file_size = h5_get_file_size(filename)) < 0) TEST_ERROR /* Verify the file is correct size */ - if(file_size!=empty_size) TEST_ERROR + if(file_size != empty_size) TEST_ERROR PASSED(); + /* Create named datatype and duplicate named datatype, remove original & verify file size */ TESTING(" duplicate attribute"); /* Create file */ - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create datasets to remove */ - if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, contig_dcpl)) < 0) TEST_ERROR + if((dataset = H5Dcreate(file, DATASETNAME, H5T_NATIVE_INT, space, contig_dcpl)) < 0) FAIL_STACK_ERROR /* Create a dataspace for the attributes */ - if((attr_space = H5Screate_simple(FILESPACE_ATTR_NDIMS, attr_dims, NULL)) < 0) TEST_ERROR + if((attr_space = H5Screate_simple(FILESPACE_ATTR_NDIMS, attr_dims, NULL)) < 0) FAIL_STACK_ERROR /* Create an attribute on the dataset */ - if((attr = H5Acreate (dataset, ATTRNAME, H5T_NATIVE_INT, attr_space, H5P_DEFAULT)) < 0) TEST_ERROR + if((attr = H5Acreate(dataset, ATTRNAME, H5T_NATIVE_INT, attr_space, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Don't worry about writing the attribute - it will have a fill value */ /* Close the attribute on the dataset */ - if(H5Aclose (attr) < 0) TEST_ERROR + if(H5Aclose(attr) < 0) FAIL_STACK_ERROR /* Create another attribute with same name */ H5E_BEGIN_TRY { - attr = H5Acreate (dataset, ATTRNAME, H5T_NATIVE_INT, attr_space, H5P_DEFAULT); + attr = H5Acreate(dataset, ATTRNAME, H5T_NATIVE_INT, attr_space, H5P_DEFAULT); } H5E_END_TRY; - if (attr>=0) { + if(attr >= 0) { H5Aclose(attr); TEST_ERROR } /* end if */ /* Close the dataspace for the attributes */ - if(H5Sclose (attr_space) < 0) TEST_ERROR + if(H5Sclose(attr_space) < 0) FAIL_STACK_ERROR /* Close dataset */ - if(H5Dclose (dataset) < 0) TEST_ERROR + if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR /* Remove the dataset */ - if(H5Gunlink (file, DATASETNAME) < 0) TEST_ERROR + if(H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Get the size of the file */ - if((file_size=h5_get_file_size(filename))<0) TEST_ERROR + if((file_size = h5_get_file_size(filename)) < 0) TEST_ERROR /* Verify the file is correct size */ - if(file_size!=empty_size) TEST_ERROR + if(file_size != empty_size) TEST_ERROR PASSED(); + /* Cleanup common objects */ /* Release dataset buffer */ HDfree(data); /* Close property lists */ - if(H5Pclose(fapl_nocache) < 0) TEST_ERROR - if(H5Pclose(contig_dcpl) < 0) TEST_ERROR - if(H5Pclose(early_chunk_dcpl) < 0) TEST_ERROR - if(H5Pclose(late_chunk_dcpl) < 0) TEST_ERROR - if(H5Pclose(comp_dcpl) < 0) TEST_ERROR - if(H5Pclose(compact_dcpl) < 0) TEST_ERROR + if(H5Pclose(fapl_nocache) < 0) FAIL_STACK_ERROR + if(H5Pclose(contig_dcpl) < 0) FAIL_STACK_ERROR + if(H5Pclose(early_chunk_dcpl) < 0) FAIL_STACK_ERROR + if(H5Pclose(late_chunk_dcpl) < 0) FAIL_STACK_ERROR + if(H5Pclose(comp_dcpl) < 0) FAIL_STACK_ERROR + if(H5Pclose(compact_dcpl) < 0) FAIL_STACK_ERROR /* Close dataspace */ - if(H5Sclose(space) < 0) TEST_ERROR + if(H5Sclose(space) < 0) FAIL_STACK_ERROR /* Indicate success */ /* Don't print final "PASSED", since we aren't on the correct line anymore */ @@ -1264,8 +1284,8 @@ test_create_unlink(const char *msg, hid_t fapl) FAIL_PUTS_ERROR(" Creating file failed") /* Create a many groups to remove */ - for(u=0; u=0); - write_dset(fid,1,dims,"dsetmytype2",tid,buf); - ret=H5Gunlink(fid,"mytype2"); - assert(ret>=0); - ret=H5Tclose(tid); - assert(ret>=0); + tid = H5Tcopy(H5T_NATIVE_INT); + ret = H5Tcommit(fid, "mytype2", tid); + assert(ret >= 0); + write_dset(fid, 1, dims, "dsetmytype2", tid, buf); + ret = H5Ldelete(fid, "mytype2", H5P_DEFAULT); + assert(ret >= 0); + ret = H5Tclose(tid); + assert(ret >= 0); /*------------------------------------------------------------------------- diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c index c21b858..cc5591d 100644 --- a/tools/h5repack/h5repacktst.c +++ b/tools/h5repack/h5repacktst.c @@ -2384,94 +2384,92 @@ out: */ int make_early(void) { - hsize_t dims[1] ={3000}; - hsize_t cdims[1]={30}; - hid_t fid=-1; - hid_t dset_id=-1; - hid_t sid=-1; - hid_t tid=-1; - hid_t dcpl=-1; - int i; - char name[10]; - int iter=100; - - if ((fid = H5Fcreate(FNAME5,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0) - return -1; - if (H5Fclose(fid)<0) - goto out; - - if ((sid = H5Screate_simple(1, dims, NULL))<0) - goto out; - if ((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0) - goto out; - if (H5Pset_chunk(dcpl,1,cdims)<0) - goto out; - if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY)<0) - goto out; - - for (i=0; i