diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-11-10 17:30:09 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-11-10 17:30:09 (GMT) |
commit | 37358db8ab62fa9c9057ea118b8576d5a4368ef1 (patch) | |
tree | a1290bfece5213bedc47eb9a0817ef19f5c9ea9b /test/links.c | |
parent | fbd4cf9bfea5418e2e4e2b81f31459db4aae4d61 (diff) | |
download | hdf5-37358db8ab62fa9c9057ea118b8576d5a4368ef1.zip hdf5-37358db8ab62fa9c9057ea118b8576d5a4368ef1.tar.gz hdf5-37358db8ab62fa9c9057ea118b8576d5a4368ef1.tar.bz2 |
[svn-r17862] Description:
Bring r17860 from trunk to 1.8 branch:
"Normalize" object names for external links, making them into the same
form as used for soft links.
Begin the process of adding more printf-like information to library
error reporting. HGOTO_ERROR() and HDONE_ERROR() macros can now use the last
parameter (a string) like a printf() formatting string and pass extra
parameters with additional information. (For example, see the HGOTO_ERROR
macros in H5FD_sec2_read() in src/H5FDsec2.c)
Bring the underlying H5E_printf_stack() routine from trunk to 1.8
branch also.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.6.2 (amazon) in debug mode
Mac OS X/32 10.6.2 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Diffstat (limited to 'test/links.c')
-rw-r--r-- | test/links.c | 47 |
1 files changed, 32 insertions, 15 deletions
diff --git a/test/links.c b/test/links.c index 8ee16a6..04f2b90 100644 --- a/test/links.c +++ b/test/links.c @@ -1794,6 +1794,30 @@ external_link_root(hid_t fapl, hbool_t new_format) goto error; } + /* Create external link to object in first file */ + /* (add a few extra '/'s to make certain library normalizes external link object names) */ + if(H5Lcreate_external(filename1, "///", fid, "ext_link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Check information for external link */ + if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; + if(H5L_TYPE_EXTERNAL != linfo.type) { + H5_FAILED(); + puts(" Unexpected object type - should have been an external link"); + goto error; + } + if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR + if(HDstrcmp(file, filename1)) { + H5_FAILED(); + puts(" External link file name incorrect"); + goto error; + } + if(HDstrcmp(path, "/")) { + H5_FAILED(); + puts(" External link path incorrect"); + goto error; + } + /* Close and re-open file to ensure that data is written to disk */ if(H5Fclose(fid) < 0) TEST_ERROR if((fid = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR @@ -3411,8 +3435,8 @@ external_link_reltar(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[26], fapl, filename2, sizeof filename2); /* Create the target file */ - if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* closing for target file */ if(H5Gclose(gid) < 0) TEST_ERROR @@ -3420,25 +3444,17 @@ external_link_reltar(hid_t fapl, hbool_t new_format) /* Create the main file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename2, "///A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; - - /* - * Should be able to find the target file from: - * main file's current working directory + pathname of external linked targetfile - */ - if (gid < 0) { + if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) { H5_FAILED(); puts(" Should have found the file in tmp directory."); goto error; - } + } /* end if */ /* closing for main file */ if(H5Gclose(gid) < 0) TEST_ERROR @@ -5301,7 +5317,8 @@ external_link_query(hid_t fapl, hbool_t new_format) if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external link */ - if(H5Lcreate_external(filename2, "/dst", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* (add a few extra '/'s to make certain library normalizes external link object names) */ + if(H5Lcreate_external(filename2, "///dst//", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Get size of buffer for external link */ if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR |