mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-19 16:50:46 +08:00
[svn-r29035] Removed external links test from external storage test.
This test is duplicated more comprehensively in the links.c file so there is no need to copy it over. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 serial autotools
This commit is contained in:
parent
2b2b95814e
commit
e9139733f2
104
test/external.c
104
test/external.c
@ -20,16 +20,11 @@
|
||||
* Purpose: Tests datasets stored in external raw files.
|
||||
*/
|
||||
#include "h5test.h"
|
||||
#include "H5srcdir.h"
|
||||
|
||||
/* File for external link test. Created with gen_udlinks.c */
|
||||
#define LINKED_FILE "be_extlink2.h5"
|
||||
|
||||
const char *FILENAME[] = {
|
||||
"extern_1",
|
||||
"extern_2",
|
||||
"extern_3",
|
||||
"extern_4", /* Remove when links test is moved */
|
||||
NULL
|
||||
};
|
||||
|
||||
@ -858,104 +853,6 @@ test_write_file_set(hid_t fapl)
|
||||
return 1;
|
||||
} /* end test_write_file_set() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_open_ext_link_twice
|
||||
*
|
||||
* Purpose: Tests opening an external link twice. It exposed a bug
|
||||
* in the library. This function tests the fix. This test
|
||||
* doesn't work with MULTI driver.
|
||||
*
|
||||
* TODO: Fix to work with multiple VFDs instead of blindly
|
||||
* switching to sec2.
|
||||
*
|
||||
* TODO: Move this test to the links test, where it belongs.
|
||||
*
|
||||
* Return: Success: 0
|
||||
* Failure: 1
|
||||
*
|
||||
* Programmer: Raymond Lu
|
||||
* 5 November 2007
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static int
|
||||
test_open_ext_link_twice(hid_t fapl)
|
||||
{
|
||||
hid_t fid = -1; /* file ID */
|
||||
hid_t gid = -1; /* group ID */
|
||||
hid_t xid = -1; /* external link ID */
|
||||
hid_t xid2 = -1; /* external link ID (2nd opening) */
|
||||
char filename[1024]; /* file name */
|
||||
const char *pathname = H5_get_srcdir_filename(LINKED_FILE); /* Corrected test file name */
|
||||
|
||||
TESTING("opening external link twice");
|
||||
|
||||
/* Make a copy of the FAPL, in order to switch to the sec2 driver */
|
||||
/* (useful when running test with another VFD) */
|
||||
if((fapl = H5Pcopy(fapl)) < 0)
|
||||
FAIL_STACK_ERROR
|
||||
|
||||
/* Switch local copy of the fapl to the sec2 driver */
|
||||
if(H5Pset_fapl_sec2(fapl) < 0)
|
||||
FAIL_STACK_ERROR
|
||||
|
||||
h5_fixname(FILENAME[3], fapl, filename, sizeof filename);
|
||||
|
||||
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
|
||||
FAIL_STACK_ERROR
|
||||
|
||||
if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
|
||||
FAIL_STACK_ERROR
|
||||
|
||||
/* Create an external link to an existing file */
|
||||
if(H5Lcreate_external(pathname, "/group", gid, " link", H5P_DEFAULT, H5P_DEFAULT) < 0)
|
||||
FAIL_STACK_ERROR
|
||||
|
||||
if(H5Gclose(gid) < 0)
|
||||
FAIL_STACK_ERROR
|
||||
|
||||
if(H5Fclose(fid) < 0)
|
||||
FAIL_STACK_ERROR
|
||||
|
||||
/* Reopen the file */
|
||||
if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
|
||||
FAIL_STACK_ERROR
|
||||
|
||||
/* Open the external link which is "/ link" as created previously via H5Lcreate_external() */
|
||||
if((xid = H5Gopen2(fid, "/ link", H5P_DEFAULT)) < 0)
|
||||
FAIL_STACK_ERROR
|
||||
|
||||
/* Open the external link twice */
|
||||
if((xid2 = H5Gopen2(xid, ".", H5P_DEFAULT)) < 0)
|
||||
FAIL_STACK_ERROR
|
||||
|
||||
if(H5Gclose(xid2) < 0)
|
||||
FAIL_STACK_ERROR
|
||||
|
||||
if(H5Gclose(xid) < 0)
|
||||
FAIL_STACK_ERROR
|
||||
|
||||
if(H5Fclose(fid) < 0)
|
||||
FAIL_STACK_ERROR
|
||||
|
||||
if(H5Pclose(fapl) < 0)
|
||||
FAIL_STACK_ERROR
|
||||
|
||||
PASSED();
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
H5E_BEGIN_TRY {
|
||||
H5Gclose(gid);
|
||||
H5Gclose(xid);
|
||||
H5Gclose(xid2);
|
||||
H5Fclose(fid);
|
||||
} H5E_END_TRY;
|
||||
return 1;
|
||||
} /* end test_open_ext_link_twice() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: main
|
||||
@ -1032,7 +929,6 @@ main(void)
|
||||
/* These tests use the VFD-aware fapl */
|
||||
nerrors += test_read_file_set(current_fapl_id);
|
||||
nerrors += test_write_file_set(current_fapl_id);
|
||||
nerrors += test_open_ext_link_twice(current_fapl_id);
|
||||
|
||||
/* Verify symbol table messages are cached */
|
||||
nerrors += (h5_verify_cached_stabs(FILENAME, current_fapl_id) < 0 ? 1 : 0);
|
||||
|
@ -22,9 +22,6 @@
|
||||
* They will be named according to the platform and should
|
||||
* be placed in the hdf5/test directory so that the links test can use them.
|
||||
*
|
||||
* Note: The be_extlink2.h5 is also used by external.c to test opening
|
||||
* external link twice. -SLU 2007/11/7
|
||||
*
|
||||
*/
|
||||
|
||||
#include "hdf5.h"
|
||||
|
@ -7299,7 +7299,7 @@ error:
|
||||
} H5E_END_TRY
|
||||
|
||||
return -1;
|
||||
} /* end efc_open_twice */
|
||||
} /* end external_open_twice() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user