mirror of
https://github.com/HDFGroup/hdf5.git
synced 2024-12-03 02:32:04 +08:00
[svn-r14245] Minor change: the test for opening external link twice doesn't work with MULTI driver.
Skip the test if it is.
This commit is contained in:
parent
360da7eb00
commit
1dc74b6177
@ -821,7 +821,8 @@ test_3 (hid_t fapl)
|
|||||||
* Function: test_4
|
* Function: test_4
|
||||||
*
|
*
|
||||||
* Purpose: Tests opening an external link twice. It exposed a bug
|
* Purpose: Tests opening an external link twice. It exposed a bug
|
||||||
* in the library. This function tests the fix.
|
* in the library. This function tests the fix. This test
|
||||||
|
* doesn't work with MULTI driver.
|
||||||
*
|
*
|
||||||
* Return: Success: 0
|
* Return: Success: 0
|
||||||
*
|
*
|
||||||
@ -842,57 +843,66 @@ test_4 (hid_t fapl)
|
|||||||
char pathname[1024];
|
char pathname[1024];
|
||||||
char linked_pathname[1024];
|
char linked_pathname[1024];
|
||||||
char *srcdir = getenv("srcdir"); /*where the src code is located*/
|
char *srcdir = getenv("srcdir"); /*where the src code is located*/
|
||||||
|
const char *envval = NULL;
|
||||||
|
|
||||||
TESTING("opening external link twice");
|
TESTING("opening external link twice");
|
||||||
|
|
||||||
h5_fixname(FILENAME[3], fapl, filename, sizeof filename);
|
/* Don't run this test using the multi file driver */
|
||||||
|
envval = HDgetenv("HDF5_DRIVER");
|
||||||
|
if (envval == NULL)
|
||||||
|
envval = "nomatch";
|
||||||
|
if (HDstrcmp(envval, "multi")) {
|
||||||
|
h5_fixname(FILENAME[3], fapl, filename, sizeof filename);
|
||||||
|
|
||||||
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
|
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
|
if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
pathname[0] = '\0';
|
pathname[0] = '\0';
|
||||||
/* Generate correct name for test file by prepending the source path */
|
/* Generate correct name for test file by prepending the source path */
|
||||||
if(srcdir && ((HDstrlen(srcdir) + HDstrlen(LINKED_FILE) + 1) < sizeof(pathname))) {
|
if(srcdir && ((HDstrlen(srcdir) + HDstrlen(LINKED_FILE) + 1) < sizeof(pathname))) {
|
||||||
HDstrcpy(pathname, srcdir);
|
HDstrcpy(pathname, srcdir);
|
||||||
HDstrcat(pathname, "/");
|
HDstrcat(pathname, "/");
|
||||||
}
|
}
|
||||||
HDstrcat(pathname, LINKED_FILE);
|
HDstrcat(pathname, LINKED_FILE);
|
||||||
|
|
||||||
/* Create an external link to an existing file*/
|
/* Create an external link to an existing file*/
|
||||||
if(H5Lcreate_external(pathname, "/group", gid, " link", H5P_DEFAULT, H5P_DEFAULT) < 0)
|
if(H5Lcreate_external(pathname, "/group", gid, " link", H5P_DEFAULT, H5P_DEFAULT) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if(H5Gclose(gid) < 0)
|
if(H5Gclose(gid) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if(H5Fclose(fid) < 0)
|
if(H5Fclose(fid) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* Reopen the file */
|
/* Reopen the file */
|
||||||
if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
|
if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* Open the external link */
|
/* Open the external link */
|
||||||
if((xid = H5Gopen2(fid, "/ link", H5P_DEFAULT)) < 0)
|
if((xid = H5Gopen2(fid, "/ link", H5P_DEFAULT)) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* Open the external link twice */
|
/* Open the external link twice */
|
||||||
if((xid2 = H5Gopen2(xid, ".", H5P_DEFAULT)) < 0)
|
if((xid2 = H5Gopen2(xid, ".", H5P_DEFAULT)) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if(H5Gclose(xid2) < 0)
|
if(H5Gclose(xid2) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if(H5Gclose(xid) < 0)
|
if(H5Gclose(xid) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if(H5Fclose(fid) < 0)
|
if(H5Fclose(fid) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
PASSED();
|
||||||
|
} else
|
||||||
|
SKIPPED();
|
||||||
|
|
||||||
PASSED();
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
Loading…
Reference in New Issue
Block a user