diff options
author | Vailin Choi <vchoi@hdfgroup.org> | 2010-11-15 04:04:28 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@hdfgroup.org> | 2010-11-15 04:04:28 (GMT) |
commit | 0c589bf7b56738d9c643718be5f12a72a1e39e83 (patch) | |
tree | e226588cafdaa999c835c31859119ba6eca43e85 /test/links.c | |
parent | 7c2fbcb03e6ea67cee77acb46a4f38ba8a24d8ff (diff) | |
download | hdf5-0c589bf7b56738d9c643718be5f12a72a1e39e83.zip hdf5-0c589bf7b56738d9c643718be5f12a72a1e39e83.tar.gz hdf5-0c589bf7b56738d9c643718be5f12a72a1e39e83.tar.bz2 |
[svn-r19781] Fix for bug #1930:
1) Move the test for H5D_EXT_PREFIX in links.c to a separate file: links_env.c
2) links_env.c will be used by testlinks_env.sh to test for the environmental
variable H5D_EXT_PREFIX in searching for the external linked file.
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 3596f1f..e4aead6 100644 --- a/test/links.c +++ b/test/links.c @@ -2707,110 +2707,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" @@ -14015,7 +13914,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; |