From e48bb7e1c5c72c08c19e14d472974e34c9c88274 Mon Sep 17 00:00:00 2001 From: Neil Fortner Date: Tue, 27 Apr 2010 15:33:46 -0500 Subject: [PATCH] [svn-r18644] Add testing of H5Lcopy() and H5Lmove() between files for soft and external links. Tested: Fedora (too minor for commit test) --- test/links.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/test/links.c b/test/links.c index afd5872164..f23a566b61 100644 --- a/test/links.c +++ b/test/links.c @@ -1140,11 +1140,13 @@ test_move(hid_t fapl, hbool_t new_format) if((grp_2 = H5Gcreate2(file_a, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if((grp_move = H5Gcreate2(grp_1, "group_move", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create hard and soft links. */ + /* Create hard, soft and external links. */ if(H5Lcreate_hard(grp_1, "group_move", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR if(H5Lcreate_soft("/group1/group_move", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR /* Move a group within the file. Both of source and destination use * H5L_SAME_LOC. Should fail. */ @@ -1159,6 +1161,18 @@ test_move(hid_t fapl, hbool_t new_format) !=FAIL) TEST_ERROR } H5E_END_TRY; + /* Move a soft link across files. Should succeed. */ + if(H5Lmove(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE) + TEST_ERROR + + /* Move an external link across files. Should succeed. */ + if(H5Lmove(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE) + TEST_ERROR + /* Move a group across groups in the same file while renaming it. */ if(H5Lmove(grp_1, "group_move", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -1286,11 +1300,13 @@ test_copy(hid_t fapl, hbool_t new_format) if((grp_2 = H5Gcreate2(file_a, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if((grp_move = H5Gcreate2(grp_1, "group_copy", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create hard and soft links. */ + /* Create hard, soft and external links. */ if(H5Lcreate_hard(grp_1, "group_copy", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR if(H5Lcreate_soft("/group1/group_copy", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR /* Copy a group within the file. Both of source and destination use * H5L_SAME_LOC. Should fail. */ @@ -1305,6 +1321,18 @@ test_copy(hid_t fapl, hbool_t new_format) !=FAIL) TEST_ERROR } H5E_END_TRY; + /* Copy a soft link across files. Should succeed. */ + if(H5Lcopy(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE) + TEST_ERROR + + /* Copy an external link across files. Should succeed. */ + if(H5Lcopy(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE) + TEST_ERROR + /* Move a group across groups in the same file while renaming it. */ if(H5Lcopy(grp_1, "group_copy", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR