diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/getname.c | 1218 | ||||
-rw-r--r-- | test/mount.c | 15 | ||||
-rw-r--r-- | test/tid.c | 2 |
3 files changed, 310 insertions, 925 deletions
diff --git a/test/getname.c b/test/getname.c index b3f1b2a..d5404cc 100644 --- a/test/getname.c +++ b/test/getname.c @@ -19,8 +19,13 @@ * Purpose: Tests the "ID to name" functionality */ -#include "hdf5.h" +#define H5G_PACKAGE /*suppress error about including H5Gpkg */ + +/* Define this macro to indicate that the testing APIs should be available */ +#define H5G_TESTING + #include "h5test.h" +#include "H5Gpkg.h" /* Groups */ /* Compound datatype */ @@ -42,17 +47,41 @@ const char *FILENAME[] = { #define NX 4 #define NY 5 -static int check_name( char *name, const char* check ) +#define NAME_BUF_SIZE 64 +#define SMALL_NAME_BUF_SIZE 2 + +static int +check_name(hid_t id, const char *chk_name, const char *chk_user_path) { + char name[NAME_BUF_SIZE]; /* Buffer to hold name and its size */ + char user_path[NAME_BUF_SIZE]; /* Buffer to hold user path */ + size_t user_path_len; /* Length of user path */ + unsigned user_path_hidden; /* Whether the user path is hidden */ - int ret = HDstrcmp( name, check ); - HDstrcpy( name, "" ); - return ret; + /* Get name */ + *name = '\0'; + if(H5Iget_name(id, name, NAME_BUF_SIZE) < 0) goto error; -} + /* Get user path */ + *user_path = '\0'; + if(H5G_user_path_test(id, user_path, &user_path_len, &user_path_hidden) < 0) goto error; -#define NAME_BUF_SIZE 40 -#define SMALL_NAME_BUF_SIZE 2 + /* Check on name from H5Iget_name() */ + if(HDstrcmp(name, chk_name)) goto error; + + /* Check on user path */ + if(HDstrcmp(user_path, chk_user_path)) goto error; + + /* Check that if user path is hidden, the name from H5Iget_name() and the user path should be different */ + if(user_path_hidden && !HDstrcmp(chk_name, chk_user_path)) goto error; + + /* Everything matches */ + return 0; + +error: + /* Something doesn't match or something bad happened */ + return -1; +} int main( void ) { @@ -68,16 +97,7 @@ int main( void ) hid_t type_id, type2_id; hsize_t dims[1] = { 5 }; - /*buffer to hold name and its size */ - char name[NAME_BUF_SIZE]; - size_t size=NAME_BUF_SIZE; - - /*small buffer to hold name and its size */ - char name2[SMALL_NAME_BUF_SIZE]; - size_t size2=SMALL_NAME_BUF_SIZE; - - /*dynamic buffer to hold name and its size */ - char *name3 = NULL; + /* Name length */ size_t name_len; /* Reset the library and get the file access property list */ @@ -104,11 +124,8 @@ int main( void ) /* Create group "g0" in the root group using absolute name */ if ((group_id = H5Gcreate( file_id, "/g0", 0 ))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g0" )!=0) TEST_ERROR; + if(check_name(group_id, "/g0", "/g0") < 0) TEST_ERROR; /* Close */ H5Gclose( group_id ); @@ -130,19 +147,11 @@ int main( void ) /* Create group "g2" in group "g1" using absolute name */ if ((group2_id = H5Gcreate( file_id, "/g1/g2", 0 ))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g1" )!=0) - TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; + if(check_name(group_id, "/g1", "/g1") < 0) TEST_ERROR; /* Verify */ - if (check_name( name, "/g1/g2" )!=0) - TEST_ERROR; + if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR; /* Close */ H5Gclose( group_id ); @@ -164,19 +173,11 @@ int main( void ) /* Reopen the group */ if ((group2_id = H5Gopen( file_id, "/g1/g2" ))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g1" )!=0) - TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; + if(check_name(group_id, "/g1", "/g1") < 0) TEST_ERROR; /* Verify */ - if (check_name( name, "/g1/g2" )!=0) - TEST_ERROR; + if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR; /* Close */ H5Gclose( group_id ); @@ -194,19 +195,14 @@ int main( void ) TESTING("H5Iget_name with H5Dcreate"); - /* Create the data space */ + /* Create the dataspace */ if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR; /* Create a new dataset */ - if ((dataset_id = H5Dcreate( file_id , "d1", H5T_NATIVE_INT, space_id, - H5P_DEFAULT ))<0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( dataset_id, name, size )<0) TEST_ERROR; + if ((dataset_id = H5Dcreate( file_id , "d1", H5T_NATIVE_INT, space_id, H5P_DEFAULT ))<0) TEST_ERROR; /* Verify */ - if (check_name( name, "/d1" )!=0) - TEST_ERROR; + if(check_name(dataset_id, "/d1", "/d1") < 0) TEST_ERROR; /* Close */ H5Dclose( dataset_id ); @@ -215,15 +211,10 @@ int main( void ) if ((group_id = H5Gopen( file_id, "g1" ))<0) TEST_ERROR; /* Create a new dataset inside "g1" */ - if ((dataset_id = H5Dcreate( group_id , "d1", H5T_NATIVE_INT, space_id, - H5P_DEFAULT ))<0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( dataset_id, name, size )<0) TEST_ERROR; + if ((dataset_id = H5Dcreate( group_id , "d1", H5T_NATIVE_INT, space_id, H5P_DEFAULT ))<0) TEST_ERROR; /* Verify */ - if (check_name( name, "/g1/d1" )!=0) - TEST_ERROR; + if(check_name(dataset_id, "/g1/d1", "/g1/d1") < 0) TEST_ERROR; /* Close */ H5Gclose( group_id ); @@ -244,12 +235,8 @@ int main( void ) /* Reopen the dataset */ if ((dataset_id = H5Dopen( file_id, "d1"))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( dataset_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/d1" )!=0) - TEST_ERROR; + if(check_name(dataset_id, "/d1", "/d1") < 0) TEST_ERROR; /* Close */ H5Dclose( dataset_id ); @@ -261,12 +248,8 @@ int main( void ) /* Reopen the dataset */ if ((dataset_id = H5Dopen( group_id, "d1"))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( dataset_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g1/d1" )!=0) - TEST_ERROR; + if(check_name(dataset_id, "/g1/d1", "/g1/d1") < 0) TEST_ERROR; /* Close */ H5Dclose( dataset_id ); @@ -303,12 +286,8 @@ int main( void ) /* Reopen the dataset */ if ((dataset_id = H5Dopen( file_id, "/g2/bar/baz/d1"))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( dataset_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g2/bar/baz/d1" )!=0) - TEST_ERROR; + if(check_name(dataset_id, "/g2/bar/baz/d1", "/g2/bar/baz/d1") < 0) TEST_ERROR; /* Close */ H5Dclose( dataset_id ); @@ -334,12 +313,8 @@ int main( void ) /* Save datatype for later */ if (H5Tcommit (file_id, "t1", type_id)<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( type_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/t1" )!=0) - TEST_ERROR; + if(check_name(type_id, "/t1", "/t1") < 0) TEST_ERROR; /* Close datatype */ H5Tclose(type_id); @@ -356,13 +331,8 @@ int main( void ) /* Open the named datatype */ if((type_id=H5Topen(file_id, "t1"))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( type_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/t1" )!=0) - TEST_ERROR; - + if(check_name(type_id, "/t1", "/t1") < 0) TEST_ERROR; /* Close datatype */ H5Tclose(type_id); @@ -384,11 +354,8 @@ int main( void ) /* Rename group */ if (H5Gmove( file_id, "/g1", "/g1a" )<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g1a" )!=0) TEST_ERROR; + if(check_name(group_id, "/g1a", "/g1a") < 0) TEST_ERROR; /* Close */ H5Gclose( group_id ); @@ -411,12 +378,8 @@ int main( void ) /* Rename dataset */ if (H5Gmove( file_id, "/d1", "/d1a" )<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( dataset_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/d1a" )!=0) - TEST_ERROR; + if(check_name(dataset_id, "/d1a", "/d1a") < 0) TEST_ERROR; /* Close */ H5Dclose( dataset_id ); @@ -439,13 +402,8 @@ int main( void ) /* Rename datatype */ if (H5Gmove( file_id, "/t1", "/t1a" )<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( type_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/t1a" )!=0) - TEST_ERROR; - + if(check_name(type_id, "/t1a", "/t1a") < 0) TEST_ERROR; /* Close datatype */ H5Tclose(type_id); @@ -471,44 +429,26 @@ int main( void ) /* Rename group */ if (H5Gmove( group_id, "foo1", "foo2" )<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g3" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; + if(check_name(group_id, "/g3", "/g3") < 0) TEST_ERROR; /* Verify */ - if (check_name( name, "/g3/foo2" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group3_id, name, size )<0) TEST_ERROR; + if(check_name(group2_id, "/g3/foo2", "/g3/foo2") < 0) TEST_ERROR; /* Verify */ - if (check_name( name, "/g3/foo2" )!=0) TEST_ERROR; + if(check_name(group3_id, "/g3/foo2", "/g3/foo2") < 0) TEST_ERROR; /* Rename group again */ if (H5Gmove( file_id, "g3/foo2", "g3/foo1" )<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g3" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; + if(check_name(group_id, "/g3", "/g3") < 0) TEST_ERROR; /* Verify */ - if (check_name( name, "/g3/foo1" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group3_id, name, size )<0) TEST_ERROR; + if(check_name(group2_id, "/g3/foo1", "/g3/foo1") < 0) TEST_ERROR; /* Verify */ - if (check_name( name, "/g3/foo1" )!=0) TEST_ERROR; + if(check_name(group3_id, "/g3/foo1", "/g3/foo1") < 0) TEST_ERROR; /* Close */ H5Gclose( group_id ); @@ -536,45 +476,29 @@ int main( void ) if ((group4_id = H5Gcreate( file_id, "g5", 0 ))<0) TEST_ERROR; if ((group5_id = H5Gcreate( file_id, "g5/C", 0 ))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group3_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g4/A/B" )!=0) - TEST_ERROR; + if(check_name(group3_id, "/g4/A/B", "/g4/A/B") < 0) TEST_ERROR; /* Move group "B" to "D"*/ if (H5Gmove( file_id, "/g4/A/B", "/g5/C/D" )<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group3_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g5/C/D" )!=0) TEST_ERROR; + if(check_name(group3_id, "/g5/C/D", "/g5/C/D") < 0) TEST_ERROR; /* Move group "/g5/C/D" back to "/g4/A/B" using relative name */ if (H5Gmove2( group5_id, "D", group2_id, "B" )<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group3_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g4/A/B" )!=0) TEST_ERROR; + if(check_name(group3_id, "/g4/A/B", "/g4/A/B") < 0) TEST_ERROR; /* Move group "/g4/A/B" to "/g4/F/B" using relative name */ if (H5Gmove2( group_id, "A", group_id, "F")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group3_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g4/F/B" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; + if(check_name(group3_id, "/g4/F/B", "/g4/F/B") < 0) TEST_ERROR; /* Verify */ - if (check_name( name, "/g4/F" )!=0) TEST_ERROR; + if(check_name(group2_id, "/g4/F", "/g4/F") < 0) TEST_ERROR; /* Close */ H5Gclose( group_id ); @@ -599,27 +523,17 @@ int main( void ) if ((group3_id = H5Gcreate( file_id, "g6/A/B", 0 ))<0) TEST_ERROR; if ((group4_id = H5Gcreate( file_id, "g7", 0 ))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group3_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g6/A/B" )!=0) - TEST_ERROR; + if(check_name(group3_id, "/g6/A/B", "/g6/A/B") < 0) TEST_ERROR; /* Move group "A" to "C"*/ if (H5Gmove( file_id, "/g6/A", "/g7/C" )<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g7/C" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group3_id, name, size )<0) TEST_ERROR; + if(check_name(group2_id, "/g7/C", "/g7/C") < 0) TEST_ERROR; /* Verify */ - if (check_name( name, "/g7/C/B" )!=0) TEST_ERROR; + if(check_name(group3_id, "/g7/C/B", "/g7/C/B") < 0) TEST_ERROR; /* Close */ H5Gclose( group_id ); @@ -642,11 +556,8 @@ int main( void ) /* Delete */ if (H5Gunlink( file_id, "/g8")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; + if(check_name(group_id, "", "") < 0) TEST_ERROR; /* Close */ H5Gclose( group_id ); @@ -668,17 +579,11 @@ int main( void ) /* Delete */ if (H5Gunlink( file_id, "/g9/a")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group3_id, name, size )<0) TEST_ERROR; + if(check_name(group2_id, "", "") < 0) TEST_ERROR; /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; + if(check_name(group3_id, "", "") < 0) TEST_ERROR; /* Close */ H5Gclose( group2_id ); @@ -691,17 +596,11 @@ int main( void ) /* Delete, using relative path */ if (H5Gunlink( group_id, "a")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group3_id, name, size )<0) TEST_ERROR; + if(check_name(group2_id, "", "") < 0) TEST_ERROR; /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; + if(check_name(group3_id, "", "") < 0) TEST_ERROR; /* Close */ H5Gclose( group2_id ); @@ -718,11 +617,8 @@ int main( void ) /* Delete */ if (H5Gunlink( file_id, "/g10/a/b")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group3_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; + if(check_name(group3_id, "", "") < 0) TEST_ERROR; /* Close */ H5Gclose( group3_id ); @@ -733,11 +629,8 @@ int main( void ) /* Delete, using relative path */ if (H5Gunlink( group_id, "a/b")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group3_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; + if(check_name(group3_id, "", "") < 0) TEST_ERROR; /* Close */ H5Gclose( group3_id ); @@ -768,17 +661,11 @@ int main( void ) /* Delete */ if (H5Gunlink( file_id, "/g11/d")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( dataset_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( dataset2_id, name, size )<0) TEST_ERROR; + if(check_name(dataset_id, "", "") < 0) TEST_ERROR; /* Verify */ - if (check_name( name, "/g11/g/d" )!=0) TEST_ERROR; + if(check_name(dataset2_id, "/g11/g/d", "/g11/g/d") < 0) TEST_ERROR; /* Close */ H5Dclose( dataset_id ); @@ -806,7 +693,7 @@ int main( void ) /* Create second file and dataset "d" in it */ file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); - /* Create a data space */ + /* Create a dataspace */ if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR; /* Create the dataset */ @@ -821,11 +708,8 @@ int main( void ) /* Access dataset D in the first file under "/G/D" name */ if ((dataset_id = H5Dopen( file_id, "/g12/d"))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( dataset_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g12/d" )!=0) TEST_ERROR; + if(check_name(dataset_id, "/g12/d", "/g12/d") < 0) TEST_ERROR; if (H5Funmount(file_id, "/g12")<0) TEST_ERROR; @@ -873,24 +757,22 @@ int main( void ) /* Access group in the first file */ if ((group_id = H5Gopen( file_id, "/g13/g1/g14/g3/g4"))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g13/g1/g14/g3/g4" )!=0) TEST_ERROR; + if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR; if (H5Funmount(file_id, "/g13/g1")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; + if(check_name(group_id, "", "") < 0) TEST_ERROR; /* Close */ H5Gclose( group_id ); + + /* Access group in the file to mount */ + if ((group3_id = H5Gopen( file1_id, "/g14/g3/g4"))<0) TEST_ERROR; + /* Mount second file under "/g13/g1" in the first file (again) */ if (H5Fmount(file_id, "/g13/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR; @@ -900,23 +782,20 @@ int main( void ) /* Access group in the first file */ if ((group_id = H5Gopen( file_id, "/g13/g1/g14/g3/g4"))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g13/g1/g14/g3/g4" )!=0) TEST_ERROR; + if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR; + if(check_name(group3_id, "/g14/g3/g4", "/g14/g3/g4") < 0) TEST_ERROR; if (H5Funmount(group2_id, "g1")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; + if(check_name(group_id, "", "") < 0) TEST_ERROR; + if(check_name(group3_id, "/g14/g3/g4", "/g14/g3/g4") < 0) TEST_ERROR; /* Close */ H5Gclose( group_id ); H5Gclose( group2_id ); + H5Gclose( group3_id ); /* Mount second file under "/g13/g1" in the first file (again) */ if (H5Fmount(file_id, "/g13/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR; @@ -927,19 +806,15 @@ int main( void ) /* Access group in the first file */ if ((group_id = H5Gopen( file_id, "/g13/g1/g14/g3/g4"))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g13/g1/g14/g3/g4" )!=0) TEST_ERROR; + if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR; + if(check_name(group2_id, "/g13/g1", "/g13/g1") < 0) TEST_ERROR; if (H5Funmount(group2_id, ".")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; + if(check_name(group_id, "", "") < 0) TEST_ERROR; + if(check_name(group2_id, "", "") < 0) TEST_ERROR; /* Close */ H5Gclose( group_id ); @@ -949,31 +824,22 @@ int main( void ) if ((group3_id = H5Gopen( file_id, "/g13"))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group3_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g13" )!=0) TEST_ERROR; + if(check_name(group3_id, "/g13", "/g13") < 0) TEST_ERROR; if (H5Fmount(group3_id, "g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR; /* Get a group ID for the newly mounted group */ if ((group2_id = H5Gopen( file_id, "/g13/g1"))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group2_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g13/g1" )!=0) TEST_ERROR; + if(check_name(group2_id, "/g13/g1", "/g13/g1") < 0) TEST_ERROR; /* Access group in the first file */ if ((group_id = H5Gopen( file_id, "/g13/g1/g14/g3/g4"))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g13/g1/g14/g3/g4" )!=0) TEST_ERROR; + if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR; /* Close */ H5Gclose( group_id ); @@ -981,22 +847,16 @@ int main( void ) /* Access group in the first file, with relative path */ if ((group_id = H5Gopen( group2_id, "g14/g3/g4"))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g13/g1/g14/g3/g4" )!=0) TEST_ERROR; + if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR; /* Close */ H5Gclose( group_id ); if (H5Funmount(group2_id, ".")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; + if(check_name(group2_id, "", "") < 0) TEST_ERROR; /* Close */ H5Gclose( group2_id ); @@ -1006,31 +866,22 @@ int main( void ) if ((group3_id = H5Gopen( file_id, "/g13/g1"))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group3_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g13/g1" )!=0) TEST_ERROR; + if(check_name(group3_id, "/g13/g1", "/g13/g1") < 0) TEST_ERROR; if (H5Fmount(group3_id, ".", file1_id, H5P_DEFAULT)<0) TEST_ERROR; /* Get a group ID for the newly mounted group */ if ((group2_id = H5Gopen( file_id, "/g13/g1"))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group2_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g13/g1" )!=0) TEST_ERROR; + if(check_name(group2_id, "/g13/g1", "/g13/g1") < 0) TEST_ERROR; /* Access group in the first file */ if ((group_id = H5Gopen( file_id, "/g13/g1/g14/g3/g4"))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g13/g1/g14/g3/g4" )!=0) TEST_ERROR; + if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR; /* Close */ H5Gclose( group_id ); @@ -1038,22 +889,17 @@ int main( void ) /* Access group in the first file, with relative path */ if ((group_id = H5Gopen( group2_id, "g14/g3/g4"))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g13/g1/g14/g3/g4" )!=0) TEST_ERROR; + if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR; /* Close */ H5Gclose( group_id ); if (H5Funmount(group2_id, ".")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; + if(check_name(group2_id, "", "") < 0) TEST_ERROR; + if(check_name(group3_id, "/g13/g1", "/g13/g1") < 0) TEST_ERROR; /* Close */ H5Gclose( group2_id ); @@ -1105,35 +951,19 @@ int main( void ) /* Access group in the second file */ if ((group2_id = H5Gopen( file_id, "/g15/g1/g16/g4/g5"))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) - TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group2_id, name, size )< 0) TEST_ERROR; + if(check_name(group_id, "", "/g15/g1/g2/g3") < 0) TEST_ERROR; /* Verify */ - if (check_name( name, "/g15/g1/g16/g4/g5" )!=0) - TEST_ERROR; + if(check_name(group2_id, "/g15/g1/g16/g4/g5", "/g15/g1/g16/g4/g5") < 0) TEST_ERROR; if (H5Funmount(file_id, "/g15/g1")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g15/g1/g2/g3" )!=0) - TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group2_id, name, size )< 0) TEST_ERROR; + if(check_name(group_id, "/g15/g1/g2/g3", "/g15/g1/g2/g3") < 0) TEST_ERROR; /* Verify */ - if (check_name( name, "" )!=0) - TEST_ERROR; + if(check_name(group2_id, "", "") < 0) TEST_ERROR; /* Close */ H5Gclose( group_id ); @@ -1165,7 +995,7 @@ int main( void ) /* Save datatype for later */ if (H5Tcommit (group_id, "t", type_id)<0) TEST_ERROR; - /* Create a data space */ + /* Create a dataspace */ if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR; /* Create a new dataset */ @@ -1181,12 +1011,8 @@ int main( void ) /* Open the named datatype */ if((type_id=H5Topen(file_id, "/g17/t"))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( type_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g17/t" )!=0) - TEST_ERROR; + if(check_name(type_id, "/g17/t", "/g17/t") < 0) TEST_ERROR; /* Close datatype */ H5Tclose(type_id); @@ -1197,12 +1023,8 @@ int main( void ) /* Get datatype*/ if((type_id=H5Dget_type(dataset_id))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( type_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) - TEST_ERROR; + if(check_name(type_id, "", "") < 0) TEST_ERROR; /* Close */ H5Dclose( dataset_id ); @@ -1226,11 +1048,8 @@ if (H5Glink2(dataset_id,".",H5G_LINK_HARD,file_id,"/g17/link")<0) TEST_ERROR; if ((dataset2_id = H5Dopen( file_id, "/g17/link"))<0) TEST_ERROR; /* Make sure that the two IDs use two different names */ -if(H5Iget_name(dataset_id, name, size)<0) TEST_ERROR; -if(check_name(name, "/g17/d")!=0) TEST_ERROR; - -if(H5Iget_name(dataset2_id, name, size)<0) TEST_ERROR; -if(check_name(name, "/g17/link")!=0) TEST_ERROR; + if(check_name(dataset_id, "/g17/d", "/g17/d") < 0) TEST_ERROR; + if(check_name(dataset2_id, "/g17/link", "/g17/link") < 0) TEST_ERROR; if(H5Dclose(dataset_id)<0) TEST_ERROR; if(H5Dclose(dataset2_id)<0) TEST_ERROR; @@ -1250,7 +1069,7 @@ PASSED(); /* Create a new file using default properties. */ if ((file3_id = H5Fcreate( filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl ))<0) TEST_ERROR; - /* Create the data space */ + /* Create the dataspace */ if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR; /* Create a new dataset */ @@ -1262,17 +1081,11 @@ PASSED(); /* Delete */ if (H5Gunlink( file2_id, "/d")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( dataset_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( dataset2_id, name, size )<0) TEST_ERROR; + if(check_name(dataset_id, "", "") < 0) TEST_ERROR; /* Verify */ - if (check_name( name, "/d" )!=0) TEST_ERROR; + if(check_name(dataset2_id, "/d", "/d") < 0) TEST_ERROR; /* Close */ H5Dclose( dataset_id ); @@ -1297,7 +1110,7 @@ PASSED(); /* Create a new file using default properties. */ if ((file3_id = H5Fcreate( filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl ))<0) TEST_ERROR; - /* Create the data space */ + /* Create the dataspace */ if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR; /* Create a new dataset */ @@ -1309,17 +1122,11 @@ PASSED(); /* Delete */ if (H5Gunlink( file3_id, "/d")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( dataset_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/d" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( dataset2_id, name, size )<0) TEST_ERROR; + if(check_name(dataset_id, "/d", "/d") < 0) TEST_ERROR; /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; + if(check_name(dataset2_id, "", "") < 0) TEST_ERROR; /* Close */ H5Dclose( dataset_id ); @@ -1340,15 +1147,20 @@ PASSED(); /* Reopen the group */ if ((group_id = H5Gopen( file_id, "/g17" ))<0) TEST_ERROR; +{ + /*small buffer to hold name and its size */ + char name2[SMALL_NAME_BUF_SIZE]; + /* Get name */ - name_len=H5Iget_name( group_id, name2, size2 ); + name_len=H5Iget_name( group_id, name2, SMALL_NAME_BUF_SIZE ); - if ( name_len > size2 ) - /* Get name with a larger buffer */ - name_len=H5Iget_name( group_id, name, size ); + /* Check that name is longer */ + if(name_len <= SMALL_NAME_BUF_SIZE) TEST_ERROR; + if(HDstrcmp(name2, "/")) TEST_ERROR; +} /* Verify */ - if (check_name( name, "/g17" )!=0) TEST_ERROR; + if(check_name(group_id, "/g17", "/g17") < 0) TEST_ERROR; /* Close */ H5Gclose( group_id ); @@ -1367,27 +1179,31 @@ PASSED(); if ((group_id = H5Gopen( file_id, "/g17" ))<0) TEST_ERROR; /* Get name */ - name_len=H5Iget_name( group_id, NULL, size ); + name_len = H5Iget_name(group_id, NULL, NAME_BUF_SIZE); + +{ + /* dynamic buffer to hold name */ + char *name3; /* Include the extra null character */ - name3 = malloc(name_len+1); + name3 = HDmalloc(name_len + 1); + if(!name3) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group_id, name3, name_len+1 )<0) TEST_ERROR; + /* Get name with dynamic buffer */ + if(H5Iget_name(group_id, name3, name_len + 1) < 0) TEST_ERROR; /* Verify */ - if (check_name( name3, "/g17" )!=0) - TEST_ERROR; + if(HDstrcmp(name3, "/g17")) TEST_ERROR; + *name3 = '\0'; - /* Get name */ - if (H5Iget_name( group_id, name3, 3 )<0) TEST_ERROR; + /* Get name with smaller buffer */ + if(H5Iget_name(group_id, name3, 3) < 0) TEST_ERROR; /* Verify */ - if (check_name( name3, "/g" )!=0) - TEST_ERROR; + if(HDstrcmp(name3, "/g")) TEST_ERROR; - if ( name3 ) - free(name3); + HDfree(name3); +} /* Close */ H5Gclose( group_id ); @@ -1403,21 +1219,28 @@ PASSED(); TESTING("H5Iget_name with invalid IDs"); - /* Create a data space */ + /* Create a dataspace */ if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR; /* Define a datatype */ if ((type_id = H5Tcopy(H5T_NATIVE_INT))<0) TEST_ERROR; /* Create a new dataset */ - if ((dataset_id = H5Dcreate( file_id , "d2", type_id, space_id, - H5P_DEFAULT ))<0) TEST_ERROR; + if ((dataset_id = H5Dcreate( file_id , "d2", type_id, space_id, H5P_DEFAULT ))<0) TEST_ERROR; - /* Get name for non commited datatype, it should fail */ - if (H5Iget_name( type_id, name, size ) >0) TEST_ERROR; +{ + char name[NAME_BUF_SIZE]; /* Buffer to hold name and its size */ + + /* Get name for non commited datatype, it should fail */ + H5E_BEGIN_TRY { + if(H5Iget_name( type_id, name, NAME_BUF_SIZE) > 0) TEST_ERROR; + } H5E_END_TRY; - /* Get name for data space, it should fail */ - if (H5Iget_name( space_id, name, size ) >0) TEST_ERROR; + /* Get name for dataspace, it should fail */ + H5E_BEGIN_TRY { + if(H5Iget_name( space_id, name, NAME_BUF_SIZE) > 0) TEST_ERROR; + } H5E_END_TRY; +} /* Close */ H5Dclose( dataset_id ); @@ -1456,16 +1279,13 @@ PASSED(); if (H5Fmount(file1_id, "/g3/g4", file_id, H5P_DEFAULT)<0) TEST_ERROR; /* Get name for the group ID in the first file, should be "/g18/g2" still */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; - if (check_name( name, "/g18/g2" )!=0) TEST_ERROR; + if(check_name(group2_id, "/g18/g2", "/g18/g2") < 0) TEST_ERROR; /* Get name for the dataset ID in the first file, should be "/g18/g2/d2" still */ - if (H5Iget_name( dataset_id, name, size )<0) TEST_ERROR; - if (check_name( name, "/g18/d2" )!=0) TEST_ERROR; + if(check_name(dataset_id, "/g18/d2", "/g18/d2") < 0) TEST_ERROR; /* Get name for the datatype ID in the first file, should be "/g18/g2/t2" still */ - if (H5Iget_name( type_id, name, size )<0) TEST_ERROR; - if (check_name( name, "/g18/t2" )!=0) TEST_ERROR; + if(check_name(type_id, "/g18/t2", "/g18/t2") < 0) TEST_ERROR; /* Open the mounted group, dataset, and datatype through their new names */ if ((group6_id = H5Gopen( file1_id, "/g3/g4/g18/g2" ))<0) TEST_ERROR; @@ -1473,47 +1293,27 @@ PASSED(); if ((type2_id = H5Topen( file1_id, "/g3/g4/g18/t2" ))<0) TEST_ERROR; /* Verify names */ - if (H5Iget_name( group6_id, name, size )<0) TEST_ERROR; - if (check_name( name, "/g3/g4/g18/g2" )!=0) TEST_ERROR; - - if (H5Iget_name( dataset2_id, name, size )<0) TEST_ERROR; - if (check_name( name, "/g3/g4/g18/d2" )!=0) TEST_ERROR; - - if (H5Iget_name( type2_id, name, size )<0) TEST_ERROR; - if (check_name( name, "/g3/g4/g18/t2" )!=0) TEST_ERROR; + if(check_name(group6_id, "/g3/g4/g18/g2", "/g3/g4/g18/g2") < 0) TEST_ERROR; + if(check_name(dataset2_id, "/g3/g4/g18/d2", "/g3/g4/g18/d2") < 0) TEST_ERROR; + if(check_name(type2_id, "/g3/g4/g18/t2", "/g3/g4/g18/t2") < 0) TEST_ERROR; /* Verify that old IDs still refer to objects by their old names */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; - if (check_name( name, "/g18/g2" )!=0) TEST_ERROR; - - if (H5Iget_name( dataset_id, name, size )<0) TEST_ERROR; - if (check_name( name, "/g18/d2" )!=0) TEST_ERROR; - - if (H5Iget_name( type_id, name, size )<0) TEST_ERROR; - if (check_name( name, "/g18/t2" )!=0) TEST_ERROR; + if(check_name(group2_id, "/g18/g2", "/g18/g2") < 0) TEST_ERROR; + if(check_name(dataset_id, "/g18/d2", "/g18/d2") < 0) TEST_ERROR; + if(check_name(type_id, "/g18/t2", "/g18/t2") < 0) TEST_ERROR; /* Unmount */ if (H5Funmount(file1_id, "/g3/g4")<0) TEST_ERROR; /* Get name for the IDs of the first file, should be unchanged */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; - if (check_name( name, "/g18/g2" )!=0) TEST_ERROR; - - if (H5Iget_name( dataset_id, name, size )<0) TEST_ERROR; - if (check_name( name, "/g18/d2" )!=0) TEST_ERROR; - - if (H5Iget_name( type_id, name, size )<0) TEST_ERROR; - if (check_name( name, "/g18/t2" )!=0) TEST_ERROR; + if(check_name(group2_id, "/g18/g2", "/g18/g2") < 0) TEST_ERROR; + if(check_name(dataset_id, "/g18/d2", "/g18/d2") < 0) TEST_ERROR; + if(check_name(type_id, "/g18/t2", "/g18/t2") < 0) TEST_ERROR; /* Get name for the IDs of the second file, should be "" */ - if (H5Iget_name( group6_id, name, size )<0) TEST_ERROR; - if (check_name( name, "" )!=0) TEST_ERROR; - - if (H5Iget_name( dataset2_id, name, size )<0) TEST_ERROR; - if (check_name( name, "" )!=0) TEST_ERROR; - - if (H5Iget_name( type2_id, name, size )<0) TEST_ERROR; - if (check_name( name, "" )!=0) TEST_ERROR; + if(check_name(group6_id, "", "") < 0) TEST_ERROR; + if(check_name(dataset2_id, "", "") < 0) TEST_ERROR; + if(check_name(type2_id, "", "") < 0) TEST_ERROR; H5Tclose( type_id ); H5Tclose( type2_id ); @@ -1542,22 +1342,14 @@ PASSED(); if ((group_id = H5Gcreate( file1_id, "/g1", 0 ))<0) TEST_ERROR; if ((group2_id = H5Gcreate( file1_id, "/g1/g2", 0 ))<0) TEST_ERROR; - /* Get name for the ID */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g1/g2" )!=0) - TEST_ERROR; + if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR; /* Close file */ H5Fclose( file1_id ); - /* Get name for the ID */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g1/g2" )!=0) - TEST_ERROR; + if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR; /* Close */ H5Gclose( group_id ); @@ -1589,26 +1381,17 @@ PASSED(); /* Open the mounted group */ if ((group5_id = H5Gopen( file2_id, "/g3/g4/g1/g2" ))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group5_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g3/g4/g1/g2" )!=0) TEST_ERROR; + 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; - /* Get name */ - if (H5Iget_name( group5_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; + if(check_name(group5_id, "", "") < 0) TEST_ERROR; /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; + if(check_name(group2_id, "", "") < 0) TEST_ERROR; /* Close */ H5Gclose( group_id ); @@ -1643,125 +1426,72 @@ PASSED(); /* Mount first file at "g3/g4" in the second file */ if(H5Fmount(file2_id, "/g3/g4", file1_id, H5P_DEFAULT)<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group4_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g3/g4" )!=0) TEST_ERROR; + if(check_name(group4_id, "/g3/g4", "/g3/g4") < 0) TEST_ERROR; /* Open the mounted group */ if ((group5_id = H5Gopen( file2_id, "/g3/g4/g1/g2" ))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group5_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g3/g4/g1/g2" )!=0) TEST_ERROR; + if(check_name(group5_id, "/g3/g4/g1/g2", "/g3/g4/g1/g2") < 0) TEST_ERROR; /* Open another mounted group, in the middle of the path */ if ((group6_id = H5Gopen( file2_id, "/g3/g4/g1" ))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group6_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g3/g4/g1" )!=0) TEST_ERROR; + if(check_name(group6_id, "/g3/g4/g1", "/g3/g4/g1") < 0) TEST_ERROR; /* Rename group */ if (H5Gmove( file2_id, "/g3/g4/g1/g2", "/g3/g4/g1/g5" )<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group5_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g3/g4/g1/g5" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "/g1/g5" )!=0) TEST_ERROR; + if(check_name(group5_id, "/g3/g4/g1/g5", "/g3/g4/g1/g5") < 0) TEST_ERROR; + if(check_name(group2_id, "/g1/g5", "/g1/g5") < 0) TEST_ERROR; /* Rename group */ if (H5Gmove( file2_id, "/g3/g4/g1", "/g3/g4/g1a" )<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group5_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g3/g4/g1a/g5" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "/g1a/g5" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group6_id, name, size )<0) TEST_ERROR; + if(check_name(group5_id, "/g3/g4/g1a/g5", "/g3/g4/g1a/g5") < 0) TEST_ERROR; + if(check_name(group2_id, "/g1a/g5", "/g1a/g5") < 0) TEST_ERROR; /* Verify */ - if (check_name( name, "/g3/g4/g1a" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group_id, name, size )<0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "/g1a" )!=0) TEST_ERROR; + if(check_name(group6_id, "/g3/g4/g1a", "/g3/g4/g1a") < 0) TEST_ERROR; + if(check_name(group_id, "/g1a", "/g1a") < 0) TEST_ERROR; /* Rename middle group back, using relative path */ if (H5Gmove( group3_id, "g4/g1a", "g4/g1" )<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group5_id, name, size )<0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "/g3/g4/g1/g5" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "/g1/g5" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group6_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g3/g4/g1" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group_id, name, size )<0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "/g1" )!=0) TEST_ERROR; + if(check_name(group5_id, "/g3/g4/g1/g5", "/g3/g4/g1/g5") < 0) TEST_ERROR; + if(check_name(group2_id, "/g1/g5", "/g1/g5") < 0) TEST_ERROR; + if(check_name(group6_id, "/g3/g4/g1", "/g3/g4/g1") < 0) TEST_ERROR; + if(check_name(group_id, "/g1", "/g1") < 0) TEST_ERROR; /* Rename end group back, using relative path */ if (H5Gmove( group3_id, "g4/g1/g5", "g4/g1/g2" )<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group5_id, name, size )<0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "/g3/g4/g1/g2" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g1/g2" )!=0) TEST_ERROR; + if(check_name(group5_id, "/g3/g4/g1/g2", "/g3/g4/g1/g2") < 0) TEST_ERROR; + if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR; + if(check_name(group6_id, "/g3/g4/g1", "/g3/g4/g1") < 0) TEST_ERROR; + if(check_name(group_id, "/g1", "/g1") < 0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group6_id, name, size )<0) TEST_ERROR; + /* Rename mount point */ + if (H5Gmove( file2_id, "/g3/g4", "/g3/g4a" )<0) TEST_ERROR; /* Verify */ - if (check_name( name, "/g3/g4/g1" )!=0) TEST_ERROR; + if(check_name(group4_id, "/g3/g4a", "/g3/g4a") < 0) TEST_ERROR; + if(check_name(group5_id, "/g3/g4a/g1/g2", "/g3/g4a/g1/g2") < 0) TEST_ERROR; + if(check_name(group6_id, "/g3/g4a/g1", "/g3/g4a/g1") < 0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group_id, name, size )<0) TEST_ERROR; + /* Rename mount point back, using relative path*/ + if (H5Gmove( group3_id, "g4a", "g4" )<0) TEST_ERROR; /* Verify */ - if (check_name( name, "/g1" )!=0) TEST_ERROR; + if(check_name(group4_id, "/g3/g4", "/g3/g4") < 0) TEST_ERROR; + if(check_name(group5_id, "/g3/g4/g1/g2", "/g3/g4/g1/g2") < 0) TEST_ERROR; + if(check_name(group6_id, "/g3/g4/g1", "/g3/g4/g1") < 0) TEST_ERROR; /* Close */ H5Gclose( group_id ); @@ -1789,50 +1519,28 @@ PASSED(); /* Create hard link to "g19/g1/ group */ if (H5Glink(file_id, H5G_LINK_HARD, "/g19/g1", "/g19/g2")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g19/g1" )!=0) TEST_ERROR; + if(check_name(group2_id, "/g19/g1", "/g19/g1") < 0) TEST_ERROR; /* Open the group */ if ((group3_id = H5Gopen( file_id, "/g19/g2" ))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group3_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g19/g2" )!=0) TEST_ERROR; + if(check_name(group3_id, "/g19/g2", "/g19/g2") < 0) TEST_ERROR; /* Rename original group */ if (H5Gmove( file_id, "/g19/g1", "/g19/g3" )<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g19/g3" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group3_id, name, size )<0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "/g19/g2" )!=0) TEST_ERROR; + if(check_name(group2_id, "/g19/g3", "/g19/g3") < 0) TEST_ERROR; + if(check_name(group3_id, "/g19/g2", "/g19/g2") < 0) TEST_ERROR; /* Rename original group back, using relative path */ if (H5Gmove( group_id, "g3", "g1" )<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g19/g1" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group3_id, name, size )<0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "/g19/g2" )!=0) TEST_ERROR; + if(check_name(group2_id, "/g19/g1", "/g19/g1") < 0) TEST_ERROR; + if(check_name(group3_id, "/g19/g2", "/g19/g2") < 0) TEST_ERROR; /* Create another hard link to "/g19/g1" group */ if (H5Glink(file_id, H5G_LINK_HARD, "/g19/g1", "/g19/g3")<0) TEST_ERROR; @@ -1840,32 +1548,16 @@ PASSED(); /* Open the group */ if ((group4_id = H5Gopen( file_id, "/g19/g3" ))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group4_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g19/g3" )!=0) TEST_ERROR; + if(check_name(group4_id, "/g19/g3", "/g19/g3") < 0) TEST_ERROR; /* Delete group */ if (H5Gunlink( file_id, "/g19/g3")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group4_id, name, size )<0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "/g19/g1" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group3_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g19/g2" )!=0) TEST_ERROR; + if(check_name(group4_id, "", "") < 0) TEST_ERROR; + if(check_name(group2_id, "/g19/g1", "/g19/g1") < 0) TEST_ERROR; + if(check_name(group3_id, "/g19/g2", "/g19/g2") < 0) TEST_ERROR; /* Close the unlinked group */ H5Gclose( group4_id ); @@ -1876,32 +1568,16 @@ PASSED(); /* Open the group */ if ((group4_id = H5Gopen( file_id, "/g19/g3" ))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group4_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g19/g3" )!=0) TEST_ERROR; + if(check_name(group4_id, "/g19/g3", "/g19/g3") < 0) TEST_ERROR; /* Delete group, using relative path */ if (H5Gunlink( group_id, "g3")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group4_id, name, size )<0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g19/g1" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group3_id, name, size )<0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "/g19/g2" )!=0) TEST_ERROR; + if(check_name(group4_id, "", "") < 0) TEST_ERROR; + if(check_name(group2_id, "/g19/g1", "/g19/g1") < 0) TEST_ERROR; + if(check_name(group3_id, "/g19/g2", "/g19/g2") < 0) TEST_ERROR; /* Close the unlinked group */ H5Gclose( group4_id ); @@ -1929,20 +1605,14 @@ PASSED(); /* Create symbolic link to "g20/g1/ group */ if (H5Glink(file_id, H5G_LINK_SOFT, "/g20/g1", "/g20/g2")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g20/g1" )!=0) TEST_ERROR; + if(check_name(group2_id, "/g20/g1", "/g20/g1") < 0) TEST_ERROR; /* Open the group */ if ((group3_id = H5Gopen( file_id, "/g20/g2" ))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group3_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g20/g2" )!=0) TEST_ERROR; + if(check_name(group3_id, "/g20/g2", "/g20/g2") < 0) TEST_ERROR; /* Close */ H5Gclose( group_id ); @@ -1966,11 +1636,8 @@ PASSED(); /* Create symbolic link to "g21/g1/ group */ if (H5Glink(file_id, H5G_LINK_SOFT, "/g21/g1", "/g21/g2")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g21/g1" )!=0) TEST_ERROR; + if(check_name(group2_id, "/g21/g1", "/g21/g1") < 0) TEST_ERROR; /* Open the group */ if ((group3_id = H5Gopen( file_id, "/g21/g2" ))<0) TEST_ERROR; @@ -1978,17 +1645,9 @@ PASSED(); /* Rename group */ if (H5Gmove( file_id, "/g21/g1", "/g21/g3" )<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "/g21/g3" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group3_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g21/g2" )!=0) TEST_ERROR; + if(check_name(group2_id, "/g21/g3", "/g21/g3") < 0) TEST_ERROR; + if(check_name(group3_id, "/g21/g2", "/g21/g2") < 0) TEST_ERROR; /* Close */ H5Gclose( group_id ); @@ -2012,11 +1671,8 @@ PASSED(); /* Create symbolic link to "g22/g1/ group */ if (H5Glink(file_id, H5G_LINK_SOFT, "/g22/g1", "/g22/g2")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g22/g1" )!=0) TEST_ERROR; + if(check_name(group2_id, "/g22/g1", "/g22/g1") < 0) TEST_ERROR; /* Open the group */ if ((group3_id = H5Gopen( file_id, "/g22/g2" ))<0) TEST_ERROR; @@ -2024,32 +1680,16 @@ PASSED(); /* Rename soft link */ if (H5Gmove( file_id, "/g22/g2", "/g22/g3" )<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "/g22/g1" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group3_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g22/g3" )!=0) TEST_ERROR; + if(check_name(group2_id, "/g22/g1", "/g22/g1") < 0) TEST_ERROR; + if(check_name(group3_id, "/g22/g3", "/g22/g3") < 0) TEST_ERROR; /* Rename soft link, using relative paths */ if (H5Gmove( group_id, "g3", "g2" )<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "/g22/g1" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group3_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g22/g2" )!=0) TEST_ERROR; + if(check_name(group2_id, "/g22/g1", "/g22/g1") < 0) TEST_ERROR; + if(check_name(group3_id, "/g22/g2", "/g22/g2") < 0) TEST_ERROR; /* Close */ H5Gclose( group_id ); @@ -2074,11 +1714,8 @@ PASSED(); /* Create symbolic link to "g23/g1/ group */ if (H5Glink(file_id, H5G_LINK_SOFT, "/g23/g1", "/g23/g2")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g23/g1" )!=0) TEST_ERROR; + if(check_name(group2_id, "/g23/g1", "/g23/g1") < 0) TEST_ERROR; /* Open the group */ if ((group3_id = H5Gopen( file_id, "/g23/g2" ))<0) TEST_ERROR; @@ -2086,11 +1723,8 @@ PASSED(); /* Delete group */ if (H5Gunlink( file_id, "/g23/g1")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group3_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g23/g2" )!=0) TEST_ERROR; + if(check_name(group3_id, "/g23/g2", "/g23/g2") < 0) TEST_ERROR; /* Close */ H5Gclose( group_id ); @@ -2113,11 +1747,8 @@ PASSED(); /* Create symbolic link to "g24/g1/ group */ if (H5Glink(file_id, H5G_LINK_SOFT, "/g24/g1", "/g24/g2")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g24/g1" )!=0) TEST_ERROR; + if(check_name(group2_id, "/g24/g1", "/g24/g1") < 0) TEST_ERROR; /* Open the group */ if ((group3_id = H5Gopen( file_id, "/g24/g2" ))<0) TEST_ERROR; @@ -2125,11 +1756,8 @@ PASSED(); /* Delete group */ if (H5Gunlink( file_id, "/g24/g2")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group3_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; + if(check_name(group3_id, "", "") < 0) TEST_ERROR; /* Close */ H5Gclose( group_id ); @@ -2194,91 +1822,52 @@ PASSED(); /* Access group which will be hidden in the first file */ if ((group_id = H5Gopen( file_id, "/g25/g1/g2"))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g25/g1/g2" )!=0) TEST_ERROR; + 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; - /* Get name */ - if (H5Iget_name( group_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; + if(check_name(group_id, "", "/g25/g1/g2") < 0) TEST_ERROR; /* Access group which will be hidden in the second file */ if ((group2_id = H5Gopen( file_id, "/g25/g1/g26/g3/g4"))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group2_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g25/g1/g26/g3/g4" )!=0) TEST_ERROR; + 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; - /* Get name */ - if (H5Iget_name( group2_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; + if(check_name(group2_id, "", "/g25/g1/g26/g3/g4") < 0) TEST_ERROR; /* Access group in the third file */ if ((group3_id = H5Gopen( file_id, "/g25/g1/g26/g3/g27/g5/g6"))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group3_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g25/g1/g26/g3/g27/g5/g6" )!=0) TEST_ERROR; + 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; - /* Get name */ - if (H5Iget_name( group3_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; + if(check_name(group3_id, "", "/g25/g1/g26/g3/g27/g5/g6") < 0) TEST_ERROR; /* Access group in the fourth file */ if ((group4_id = H5Gopen( file_id, "/g25/g1/g26/g3/g27/g5/g28/g7/g8"))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group4_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g25/g1/g26/g3/g27/g5/g28/g7/g8" )!=0) TEST_ERROR; + 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; - /* Get name */ - if (H5Iget_name( group4_id, name, size )< 0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group3_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g25/g1/g26/g3/g27/g5/g6" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group2_id, name, size )< 0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group_id, name, size )< 0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; + if(check_name(group4_id, "", "") < 0) TEST_ERROR; + if(check_name(group3_id, "/g25/g1/g26/g3/g27/g5/g6", "/g25/g1/g26/g3/g27/g5/g6") < 0) TEST_ERROR; + if(check_name(group2_id, "", "/g25/g1/g26/g3/g4") < 0) TEST_ERROR; + if(check_name(group_id, "", "/g25/g1/g2") < 0) TEST_ERROR; /* Close */ H5Gclose( group4_id ); @@ -2286,23 +1875,10 @@ PASSED(); if (H5Funmount(file_id, "/g25/g1/g26/g3")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group3_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group2_id, name, size )< 0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "/g25/g1/g26/g3/g4" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group_id, name, size )< 0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; + if(check_name(group3_id, "", "") < 0) TEST_ERROR; + if(check_name(group2_id, "/g25/g1/g26/g3/g4", "/g25/g1/g26/g3/g4") < 0) TEST_ERROR; + if(check_name(group_id, "", "/g25/g1/g2") < 0) TEST_ERROR; /* Close */ H5Gclose( group3_id ); @@ -2310,17 +1886,9 @@ PASSED(); if (H5Funmount(file_id, "/g25/g1")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group2_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group_id, name, size )< 0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "/g25/g1/g2" )!=0) TEST_ERROR; + if(check_name(group2_id, "", "") < 0) TEST_ERROR; + if(check_name(group_id, "/g25/g1/g2", "/g25/g1/g2") < 0) TEST_ERROR; /* Close */ H5Gclose( group_id ); @@ -2348,41 +1916,22 @@ PASSED(); /* Rename group */ if (H5Gmove( file_id, "/g29/g1/g2/g1/g2", "/g29/g1/g2/g1/g3" )<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group5_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g29/g1/g2/g1/g3" )!=0) TEST_ERROR; + if(check_name(group5_id, "/g29/g1/g2/g1/g3", "/g29/g1/g2/g1/g3") < 0) TEST_ERROR; /* Rename group in middle of path, keeping within the same group */ if (H5Gmove( file_id, "/g29/g1/g2/g1", "/g29/g1/g2/g3" )<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group4_id, name, size )< 0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "/g29/g1/g2/g3" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group5_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g29/g1/g2/g3/g3" )!=0) TEST_ERROR; + if(check_name(group4_id, "/g29/g1/g2/g3", "/g29/g1/g2/g3") < 0) TEST_ERROR; + if(check_name(group5_id, "/g29/g1/g2/g3/g3", "/g29/g1/g2/g3/g3") < 0) TEST_ERROR; /* Rename group in middle of path, moving to another group in file */ if (H5Gmove( file_id, "/g29/g1/g2/g3", "/g29/g3" )<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group4_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g29/g3" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group5_id, name, size )< 0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "/g29/g3/g3" )!=0) TEST_ERROR; + if(check_name(group4_id, "/g29/g3", "/g29/g3") < 0) TEST_ERROR; + if(check_name(group5_id, "/g29/g3/g3", "/g29/g3/g3") < 0) TEST_ERROR; /* Close */ H5Gclose( group_id ); @@ -2450,146 +1999,71 @@ PASSED(); /* Access group which will be hidden in the first file */ if ((group_id = H5Gopen( file_id, "/g30/g1/g2"))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g30/g1/g2" )!=0) TEST_ERROR; + if(check_name(group_id, "/g30/g1/g2", "/g30/g1/g2") < 0) TEST_ERROR; /* Mount second file under "/g30/g1" in the first file */ if (H5Fmount(file_id, "/g30/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; + if(check_name(group_id, "", "/g30/g1/g2") < 0) TEST_ERROR; /* Access group which will be hidden in the second file */ if ((group2_id = H5Gopen( file_id, "/g30/g1/g31/g3/g4"))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group2_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g30/g1/g31/g3/g4" )!=0) TEST_ERROR; + if(check_name(group2_id, "/g30/g1/g31/g3/g4", "/g30/g1/g31/g3/g4") < 0) TEST_ERROR; /* Mount third file under "/g30/g1/g31/g3" in the first file */ if (H5Fmount(file_id, "/g30/g1/g31/g3", file2_id, H5P_DEFAULT)<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group2_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; + if(check_name(group2_id, "", "/g30/g1/g31/g3/g4") < 0) TEST_ERROR; /* Access group which will be hidden in the third file */ if ((group3_id = H5Gopen( file_id, "/g30/g1/g31/g3/g32/g5/g6"))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group3_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g30/g1/g31/g3/g32/g5/g6" )!=0) TEST_ERROR; + if(check_name(group3_id, "/g30/g1/g31/g3/g32/g5/g6", "/g30/g1/g31/g3/g32/g5/g6") < 0) TEST_ERROR; /* Mount fourth file under "/g30" in the first file, hiding the files below it */ if (H5Fmount(file_id, "/g30", file3_id, H5P_DEFAULT)<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group3_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; + if(check_name(group3_id, "", "/g30/g1/g31/g3/g32/g5/g6") < 0) TEST_ERROR; /* Access group which will be in the fourth file */ if ((group4_id = H5Gopen( file_id, "/g30/g33/g7/g8"))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group4_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g30/g33/g7/g8" )!=0) TEST_ERROR; + if(check_name(group4_id, "/g30/g33/g7/g8", "/g30/g33/g7/g8") < 0) TEST_ERROR; /* Unmount fourth file */ if (H5Funmount(file_id, "/g30")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group4_id, name, size )< 0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group3_id, name, size )< 0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "/g30/g1/g31/g3/g32/g5/g6" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group2_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group_id, name, size )< 0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; + if(check_name(group4_id, "", "") < 0) TEST_ERROR; + if(check_name(group3_id, "/g30/g1/g31/g3/g32/g5/g6", "/g30/g1/g31/g3/g32/g5/g6") < 0) TEST_ERROR; + if(check_name(group2_id, "", "/g30/g1/g31/g3/g4") < 0) TEST_ERROR; + if(check_name(group_id, "", "/g30/g1/g2") < 0) TEST_ERROR; /* Unmount third file */ if (H5Funmount(file_id, "/g30/g1/g31/g3")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group4_id, name, size )< 0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group3_id, name, size )< 0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group2_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g30/g1/g31/g3/g4" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group_id, name, size )< 0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; + if(check_name(group4_id, "", "") < 0) TEST_ERROR; + if(check_name(group3_id, "", "") < 0) TEST_ERROR; + if(check_name(group2_id, "/g30/g1/g31/g3/g4", "/g30/g1/g31/g3/g4") < 0) TEST_ERROR; + if(check_name(group_id, "", "/g30/g1/g2") < 0) TEST_ERROR; /* Unmount second file */ if (H5Funmount(file_id, "/g30/g1")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group4_id, name, size )< 0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group3_id, name, size )< 0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group2_id, name, size )< 0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group_id, name, size )< 0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "/g30/g1/g2" )!=0) TEST_ERROR; + if(check_name(group4_id, "", "") < 0) TEST_ERROR; + if(check_name(group3_id, "", "") < 0) TEST_ERROR; + if(check_name(group2_id, "", "") < 0) TEST_ERROR; + if(check_name(group_id, "/g30/g1/g2", "/g30/g1/g2") < 0) TEST_ERROR; /* Close groups */ H5Gclose( group_id ); @@ -2632,50 +2106,28 @@ PASSED(); /* Create hard link to "/g34/g1/g2 group */ if (H5Glink(file_id, H5G_LINK_HARD, "/g34/g1/g2", "/g34/g2a")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group3_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g34/g1/g2" )!=0) TEST_ERROR; + if(check_name(group3_id, "/g34/g1/g2", "/g34/g1/g2") < 0) TEST_ERROR; /* Open the link to the group */ if ((group4_id = H5Gopen( file_id, "/g34/g2a" ))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group4_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g34/g2a" )!=0) TEST_ERROR; + if(check_name(group4_id, "/g34/g2a", "/g34/g2a") < 0) TEST_ERROR; /* Mount second file under "/g34/g1" in the first file */ if (H5Fmount(file_id, "/g34/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group3_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group4_id, name, size )<0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "/g34/g2a" )!=0) TEST_ERROR; + if(check_name(group3_id, "", "/g34/g1/g2") < 0) TEST_ERROR; + if(check_name(group4_id, "/g34/g2a", "/g34/g2a") < 0) TEST_ERROR; /* Unmount second file */ if (H5Funmount(file_id, "/g34/g1")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group3_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g34/g1/g2" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group4_id, name, size )<0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "/g34/g2a" )!=0) TEST_ERROR; + if(check_name(group3_id, "/g34/g1/g2", "/g34/g1/g2") < 0) TEST_ERROR; + if(check_name(group4_id, "/g34/g2a", "/g34/g2a") < 0) TEST_ERROR; /* Close */ H5Gclose( group_id ); @@ -2719,35 +2171,21 @@ PASSED(); /* Open group in mounted file */ if ((group5_id = H5Gopen( file_id, "/g36/g1/g37/" ))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group5_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g36/g1/g37" )!=0) TEST_ERROR; + if(check_name(group5_id, "/g36/g1/g37", "/g36/g1/g37") < 0) TEST_ERROR; /* Open group to delete in mounted file */ if ((group6_id = H5Gopen( file_id, "/g36/g1/g37/g4/g5a" ))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group6_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g36/g1/g37/g4/g5a" )!=0) TEST_ERROR; + 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; - /* Get name */ - if (H5Iget_name( group6_id, name, size )<0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group3_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; + if(check_name(group6_id, "", "") < 0) TEST_ERROR; + if(check_name(group3_id, "", "") < 0) TEST_ERROR; /* Close deleted group */ H5Gclose( group6_id ); @@ -2756,44 +2194,18 @@ PASSED(); if ((group6_id = H5Gopen( file_id, "/g36/g1/g37/g4" ))<0) TEST_ERROR; if ((group7_id = H5Gopen( file_id, "/g36/g1/g37/g4/g5b" ))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group6_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g36/g1/g37/g4" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group7_id, name, size )<0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "/g36/g1/g37/g4/g5b" )!=0) TEST_ERROR; + if(check_name(group6_id, "/g36/g1/g37/g4", "/g36/g1/g37/g4") < 0) TEST_ERROR; + 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; - /* Get name */ - if (H5Iget_name( group6_id, name, size )<0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group7_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group4_id, name, size )<0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; + if(check_name(group6_id, "", "") < 0) TEST_ERROR; + if(check_name(group2_id, "", "") < 0) TEST_ERROR; + if(check_name(group7_id, "", "") < 0) TEST_ERROR; + if(check_name(group4_id, "", "") < 0) TEST_ERROR; /* Close deleted groups */ H5Gclose( group6_id ); @@ -2863,52 +2275,30 @@ PASSED(); if ((group_id = H5Gopen( file1_id, "/g38/g1/g39/g3/g4" ))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g38/g1/g39/g3/g4" )!=0) TEST_ERROR; + if(check_name(group_id, "/g38/g1/g39/g3/g4", "/g38/g1/g39/g3/g4") < 0) TEST_ERROR; /* Mount first file under "/g40/g5" in the third file */ if (H5Fmount(file3_id, "/g40/g5", file1_id, H5P_DEFAULT)<0) TEST_ERROR; if ((group2_id = H5Gopen( file3_id, "/g40/g5/g38/g1/g39/g3/g4" ))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "/g40/g5/g38/g1/g39/g3/g4" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g38/g1/g39/g3/g4" )!=0) TEST_ERROR; + if(check_name(group2_id, "/g40/g5/g38/g1/g39/g3/g4", "/g40/g5/g38/g1/g39/g3/g4") < 0) TEST_ERROR; + if(check_name(group_id, "/g38/g1/g39/g3/g4", "/g38/g1/g39/g3/g4") < 0) TEST_ERROR; /* Unmount first file */ if (H5Funmount(file3_id, "/g40/g5")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; - - /* Get name */ - if (H5Iget_name( group_id, name, size )<0) TEST_ERROR; - - /* Verify */ - if (check_name( name, "/g38/g1/g39/g3/g4" )!=0) TEST_ERROR; + if(check_name(group2_id, "", "") < 0) TEST_ERROR; + if(check_name(group_id, "/g38/g1/g39/g3/g4", "/g38/g1/g39/g3/g4") < 0) TEST_ERROR; /* Unmount second file */ if (H5Funmount(file1_id, "/g38/g1")<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; + if(check_name(group_id, "", "") < 0) TEST_ERROR; /* Close */ H5Gclose( group_id ); @@ -2955,22 +2345,16 @@ PASSED(); if ((group_id = H5Gopen( file1_id, "/g41/g1/g42/g3" ))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "/g41/g1/g42/g3" )!=0) TEST_ERROR; + if(check_name(group_id, "/g41/g1/g42/g3", "/g41/g1/g42/g3") < 0) TEST_ERROR; /* Unmount file */ if (H5Funmount(file1_id, "/g41/g1")<0) TEST_ERROR; if ((group2_id = H5Gopen( group_id, "g4" ))<0) TEST_ERROR; - /* Get name */ - if (H5Iget_name( group2_id, name, size )<0) TEST_ERROR; - /* Verify */ - if (check_name( name, "" )!=0) TEST_ERROR; + if(check_name(group2_id, "", "") < 0) TEST_ERROR; /* Close */ H5Gclose( group_id ); diff --git a/test/mount.c b/test/mount.c index a0c5842..d997bd9 100644 --- a/test/mount.c +++ b/test/mount.c @@ -792,19 +792,20 @@ test_mvmpt(hid_t fapl) /* Build the virtual file */ if ((file1=H5Fopen(filename1, H5F_ACC_RDWR, fapl))<0 || (file2=H5Fopen(filename2, H5F_ACC_RDWR, fapl))<0) - goto error; - if (H5Fmount(file1, "/mnt_move_a", file2, H5P_DEFAULT)<0) goto error; + TEST_ERROR + if (H5Fmount(file1, "/mnt_move_a", file2, H5P_DEFAULT)<0) TEST_ERROR /* Rename the mount point */ - if (H5Gmove(file1, "/mnt_move_a", "/mnt_move_b")<0) goto error; + if (H5Gmove(file1, "/mnt_move_a", "/mnt_move_b")<0) TEST_ERROR /* Access something under the new name */ - if (H5Gget_objinfo(file1, "/mnt_move_b/file2", TRUE, NULL)<0) goto error; + if (H5Gget_objinfo(file1, "/mnt_move_b/file2", TRUE, NULL)<0) TEST_ERROR /* Shut down */ - if (H5Funmount(file1, "/mnt_move_b")<0) goto error; - if (H5Fclose(file1)<0) goto error; - if (H5Fclose(file2)<0) goto error; + if (H5Funmount(file1, "/mnt_move_b")<0) TEST_ERROR + if (H5Fclose(file1)<0) TEST_ERROR + if (H5Fclose(file2)<0) TEST_ERROR + PASSED(); return 0; @@ -110,7 +110,7 @@ static int basic_id_test(void) testSize = H5Iget_name(arrayID, nameString, 9); H5E_END_TRY - VERIFY(testSize, 0, "H5Iget_name"); + VERIFY(testSize, -1, "H5Iget_name"); if(testSize != 0) goto out; |