summaryrefslogtreecommitdiffstats
path: root/test/links.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2009-01-09 15:49:10 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2009-01-09 15:49:10 (GMT)
commite3f39ba6dee011479ff34c72ed93065bce622b4e (patch)
tree592a8d28bafdb79f25dece738652a40debf44870 /test/links.c
parent3568733b13b64ec7e55fb3b8955834e2209d55c4 (diff)
downloadhdf5-e3f39ba6dee011479ff34c72ed93065bce622b4e.zip
hdf5-e3f39ba6dee011479ff34c72ed93065bce622b4e.tar.gz
hdf5-e3f39ba6dee011479ff34c72ed93065bce622b4e.tar.bz2
[svn-r16287] Fix one of the new tests in links.c. external_set_elink_cb no longer copies the
driver information from property list to property list. Tested: jam
Diffstat (limited to 'test/links.c')
-rw-r--r--test/links.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/test/links.c b/test/links.c
index cab5f6e..87a69fe 100644
--- a/test/links.c
+++ b/test/links.c
@@ -116,6 +116,8 @@ const char *FILENAME[] = {
#define LE_FILENAME "le_extlink1.h5"
#define BE_FILENAME "be_extlink1.h5"
+#define ELINK_CB_FAM_SIZE (hsize_t) 100
+
#define H5L_DIM1 100
#define H5L_DIM2 100
@@ -4077,10 +4079,13 @@ external_set_elink_acc_flags(hid_t fapl, hbool_t new_format)
*
*-------------------------------------------------------------------------
*/
+ /* User data structure for callback function */
typedef struct {
- const char *parent_file;
- const char *target_file;
- hid_t fapl;
+ const char *parent_file; /* Expected parent file name */
+ const char *target_file; /* Expected target file name */
+ hid_t base_fapl; /* Base fapl for family driver */
+ hsize_t fam_size; /* Size of family files */
+ int code; /* Code to control the actions taken by the callback */
} set_elink_cb_t;
/* Callback function */
@@ -4093,13 +4098,6 @@ external_set_elink_cb_cb(const char *parent_file, const char *parent_group,
hid_t driver;
const void *driver_info;
- /* Codes to cause an invalid condition (and verify that an error is issued */
- if (op_data->fapl == -1) return FAIL;
- if (op_data->fapl == -2) {
- *flags = H5F_ACC_DEFAULT;
- return 0;
- } /* end if */
-
/* Verify file and object names are correct */
if (HDstrcmp(parent_file, op_data->parent_file)) return FAIL;
if (HDstrcmp(parent_group, "/group1")) return FAIL;
@@ -4109,10 +4107,14 @@ external_set_elink_cb_cb(const char *parent_file, const char *parent_group,
/* Set flags to be read-write */
*flags = (*flags & ~H5F_ACC_RDONLY) | H5F_ACC_RDWR;
- /* Copy driver info from op_data->fapl to fapl */
- driver = H5Pget_driver(op_data->fapl);
- driver_info = H5Pget_driver_info(op_data->fapl);
- if (H5Pset_driver(fapl, driver, driver_info) < 0) return FAIL;
+ /* Set family file driver on fapl */
+ if (H5Pset_fapl_family(fapl, op_data->fam_size, op_data->base_fapl) < 0) return FAIL;
+
+ /* Codes to cause an invalid condition (and verify that an error is issued */
+ if (op_data->code == 1)
+ return FAIL;
+ if (op_data->code == 2)
+ *flags = H5F_ACC_DEFAULT;
return 0;
}
@@ -4136,7 +4138,7 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format)
/* Create family fapl */
if ((fam_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR
- if (H5Pset_fapl_family(fam_fapl, (hsize_t) 100, fapl) < 0) TEST_ERROR
+ if (H5Pset_fapl_family(fam_fapl, ELINK_CB_FAM_SIZE, fapl) < 0) TEST_ERROR
/* Create parent and target files, group, and external link */
h5_fixname(FILENAME[40], fapl, filename1, sizeof filename1);
@@ -4154,7 +4156,9 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format)
/* Build user data for callback */
op_data.parent_file = filename1;
op_data.target_file = filename2;
- op_data.fapl = fam_fapl;
+ op_data.base_fapl = fapl;
+ op_data.fam_size = ELINK_CB_FAM_SIZE;
+ op_data.code = 0;
/* Create new gapl, and set elink callback */
if ((gapl = H5Pcreate(H5P_GROUP_ACCESS)) < 0) TEST_ERROR
@@ -4186,7 +4190,7 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format)
if (H5Pclose(fam_fapl) < 0) TEST_ERROR
/* Modify the user data structure to cause the callback to fail next time */
- op_data.fapl = -1;
+ op_data.code = 1;
/* Attempt to reopen group2 (should fail) */
H5E_BEGIN_TRY {
@@ -4195,7 +4199,7 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format)
if (group != FAIL) TEST_ERROR
/* Modify the user data structure to cause the callback to return invalid flags */
- op_data.fapl = -2;
+ op_data.code = 2;
/* Attempt to reopen group2 (should fail) */
H5E_BEGIN_TRY {