diff options
author | Vailin Choi <vchoi@hdfgroup.org> | 2010-11-18 19:11:51 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@hdfgroup.org> | 2010-11-18 19:11:51 (GMT) |
commit | 64a7862ffef32f17f8ec6632c201c99a233f419f (patch) | |
tree | 4a8dc9f80c0b8f6b72a955ba89cad501079034a0 /test/links.c | |
parent | 116391d56a1142b08c4c02eb13ed8e4598af507b (diff) | |
download | hdf5-64a7862ffef32f17f8ec6632c201c99a233f419f.zip hdf5-64a7862ffef32f17f8ec6632c201c99a233f419f.tar.gz hdf5-64a7862ffef32f17f8ec6632c201c99a233f419f.tar.bz2 |
[svn-r19824] 1. Made fixes as in rev #19813 in trunk:
a) Add comments to test_4() in test/external.c about the name "/ link".
b) Fix one memory leak in src/H5Lexternal.c: free memory pointed to by tmp_env_prefix for HDF5_EXT_PREFIX case.
3. Made changes for bug #1930 as in rev #19783, #19781 in trunk.
4. Made corresponding CMake changes as in rev #19782 in trunk.
Diffstat (limited to 'test/links.c')
-rw-r--r-- | test/links.c | 104 |
1 files changed, 1 insertions, 103 deletions
diff --git a/test/links.c b/test/links.c index 650f9e8..a1718ed 100644 --- a/test/links.c +++ b/test/links.c @@ -2724,110 +2724,9 @@ external_link_dangling(hid_t fapl, hbool_t new_format) return -1; } /* end external_link_dangling() */ - - -/*------------------------------------------------------------------------- - * Function: external_link_env: test 1 - * - * Purpose: - * 1. target link: "extlinks1" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks1" - * 4. The environment variable "HDF5_EXT_PREFIX" should be set to ".:tmp" - * Should be able to access the target file in tmp directory through searching - * the pathnames set in HDF5_EXT_PREFIX. - * This test will be skipped if HDF5_EXT_PREFIX is not set as expected. - * - * - * Return: Success: 0 - * Failure: -1 - * - * Programmer: Vailin Choi - * Feb. 20, 2008 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static int -external_link_env(hid_t fapl, hbool_t new_format) -{ - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - const char *envval = NULL; - - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE]; - - if(new_format) - TESTING("external links via environment variable (w/new group format)") - else - TESTING("external links via environment variable") - - if ((envval = HDgetenv("HDF5_EXT_PREFIX")) == NULL) - envval = "nomatch"; - if (HDstrcmp(envval, ".:tmp")) { - SKIPPED(); - return(0); - } - - /* set up name for main file:"extlinks0" */ - h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); - /* set up name for external linked target file: "extlinks1" */ - h5_fixname(FILENAME[14], fapl, filename2, sizeof filename2); - - if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR - - /* set up name for target file: "tmp/extlinks1" */ - h5_fixname(FILENAME[15], fapl, filename3, sizeof filename3); - - /* Create the target file */ - if((fid=H5Fcreate(filename3, 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 - if(H5Fclose(fid) < 0) TEST_ERROR - - - /* Create the main file */ - 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 - - /* 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 pathnames set via environment variable */ - if (gid < 0) { - H5_FAILED(); - puts(" Should have found the file in tmp directory."); - goto error; - } - - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR - - PASSED(); - return 0; - - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; -} /* end external_link_env() */ - /*------------------------------------------------------------------------- - * Function: external_link_prefix: test 2 + * Function: external_link_prefix * * Purpose: 1. target link: "extlinks2" * 2. main file: "extlinks0" @@ -14058,7 +13957,6 @@ main(void) nerrors += external_link_strong(my_fapl, new_format) < 0 ? 1 : 0; /* tests for external link */ - nerrors += external_link_env(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_prefix(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_abs_mainpath(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_rel_mainpath(my_fapl, new_format) < 0 ? 1 : 0; |