summaryrefslogtreecommitdiffstats
path: root/test/vfd.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/vfd.c')
-rw-r--r--test/vfd.c308
1 files changed, 173 insertions, 135 deletions
diff --git a/test/vfd.c b/test/vfd.c
index 0efe4f5..076273b 100644
--- a/test/vfd.c
+++ b/test/vfd.c
@@ -2271,46 +2271,51 @@ error:
static int
compare_splitter_config_info(hid_t fapl_id, H5FD_splitter_vfd_config_t *info)
{
- int ret_value = 0;
- H5FD_splitter_vfd_config_t fetched_info;
+ int ret_value = 0;
+ H5FD_splitter_vfd_config_t *fetched_info = NULL;
- fetched_info.magic = H5FD_SPLITTER_MAGIC;
- fetched_info.version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
- fetched_info.rw_fapl_id = H5I_INVALID_HID;
- fetched_info.wo_fapl_id = H5I_INVALID_HID;
+ if (NULL == (fetched_info = HDcalloc(1, sizeof(H5FD_splitter_vfd_config_t))))
+ SPLITTER_TEST_FAULT("memory allocation for fetched_info struct failed");
- if (H5Pget_fapl_splitter(fapl_id, &fetched_info) < 0) {
- SPLITTER_TEST_FAULT("can't get splitter info\n");
+ fetched_info->magic = H5FD_SPLITTER_MAGIC;
+ fetched_info->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
+ fetched_info->rw_fapl_id = H5I_INVALID_HID;
+ fetched_info->wo_fapl_id = H5I_INVALID_HID;
+
+ if (H5Pget_fapl_splitter(fapl_id, fetched_info) < 0) {
+ SPLITTER_TEST_FAULT("can't get splitter info");
}
if (info->rw_fapl_id == H5P_DEFAULT) {
- if (H5Pget_driver(fetched_info.rw_fapl_id) != H5Pget_driver(H5P_FILE_ACCESS_DEFAULT)) {
+ if (H5Pget_driver(fetched_info->rw_fapl_id) != H5Pget_driver(H5P_FILE_ACCESS_DEFAULT)) {
SPLITTER_TEST_FAULT("Read-Write driver mismatch (default)\n");
}
}
else {
- if (H5Pget_driver(fetched_info.rw_fapl_id) != H5Pget_driver(info->rw_fapl_id)) {
+ if (H5Pget_driver(fetched_info->rw_fapl_id) != H5Pget_driver(info->rw_fapl_id)) {
SPLITTER_TEST_FAULT("Read-Write driver mismatch\n");
}
}
if (info->wo_fapl_id == H5P_DEFAULT) {
- if (H5Pget_driver(fetched_info.wo_fapl_id) != H5Pget_driver(H5P_FILE_ACCESS_DEFAULT)) {
+ if (H5Pget_driver(fetched_info->wo_fapl_id) != H5Pget_driver(H5P_FILE_ACCESS_DEFAULT)) {
SPLITTER_TEST_FAULT("Write-Only driver mismatch (default)\n");
}
}
else {
- if (H5Pget_driver(fetched_info.wo_fapl_id) != H5Pget_driver(info->wo_fapl_id)) {
+ if (H5Pget_driver(fetched_info->wo_fapl_id) != H5Pget_driver(info->wo_fapl_id)) {
SPLITTER_TEST_FAULT("Write-Only driver mismatch\n");
}
}
- if ((HDstrlen(info->wo_path) != HDstrlen(fetched_info.wo_path)) ||
- HDstrncmp(info->wo_path, fetched_info.wo_path, H5FD_SPLITTER_PATH_MAX)) {
- HDfprintf(stderr, "MISMATCH: '%s' :: '%s'\n", info->wo_path, fetched_info.wo_path);
+ if ((HDstrlen(info->wo_path) != HDstrlen(fetched_info->wo_path)) ||
+ HDstrncmp(info->wo_path, fetched_info->wo_path, H5FD_SPLITTER_PATH_MAX)) {
+ HDfprintf(stderr, "MISMATCH: '%s' :: '%s'\n", info->wo_path, fetched_info->wo_path);
HEXPRINT(H5FD_SPLITTER_PATH_MAX, info->wo_path);
- HEXPRINT(H5FD_SPLITTER_PATH_MAX, fetched_info.wo_path);
+ HEXPRINT(H5FD_SPLITTER_PATH_MAX, fetched_info->wo_path);
SPLITTER_TEST_FAULT("Write-Only file path mismatch\n");
}
done:
+ HDfree(fetched_info);
+
return ret_value;
} /* end compare_splitter_config_info() */
@@ -2335,43 +2340,48 @@ static int
run_splitter_test(const struct splitter_dataset_def *data, hbool_t ignore_wo_errors,
hbool_t provide_logfile_path, hid_t sub_fapl_ids[2])
{
- hid_t file_id = H5I_INVALID_HID;
- hid_t fapl_id = H5I_INVALID_HID;
- hid_t dset_id = H5I_INVALID_HID;
- hid_t space_id = H5I_INVALID_HID;
- hid_t fapl_id_out = H5I_INVALID_HID;
- hid_t fapl_id_cpy = H5I_INVALID_HID;
- H5FD_splitter_vfd_config_t vfd_config;
- char filename_rw[H5FD_SPLITTER_PATH_MAX + 1];
- FILE * logfile = NULL;
- int ret_value = 0;
-
- vfd_config.magic = H5FD_SPLITTER_MAGIC;
- vfd_config.version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
- vfd_config.ignore_wo_errs = ignore_wo_errors;
- vfd_config.rw_fapl_id = sub_fapl_ids[0];
- vfd_config.wo_fapl_id = sub_fapl_ids[1];
-
- if (splitter_prepare_file_paths(&vfd_config, filename_rw) < 0) {
+ hid_t file_id = H5I_INVALID_HID;
+ hid_t fapl_id = H5I_INVALID_HID;
+ hid_t dset_id = H5I_INVALID_HID;
+ hid_t space_id = H5I_INVALID_HID;
+ hid_t fapl_id_out = H5I_INVALID_HID;
+ hid_t fapl_id_cpy = H5I_INVALID_HID;
+ H5FD_splitter_vfd_config_t *vfd_config = NULL;
+ char * filename_rw = NULL;
+ FILE * logfile = NULL;
+ int ret_value = 0;
+
+ if (NULL == (vfd_config = HDcalloc(1, sizeof(H5FD_splitter_vfd_config_t))))
+ SPLITTER_TEST_FAULT("memory allocation for vfd_config struct failed");
+ if (NULL == (filename_rw = HDcalloc(H5FD_SPLITTER_PATH_MAX + 1, sizeof(char))))
+ SPLITTER_TEST_FAULT("memory allocation for filename_rw string failed");
+
+ vfd_config->magic = H5FD_SPLITTER_MAGIC;
+ vfd_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
+ vfd_config->ignore_wo_errs = ignore_wo_errors;
+ vfd_config->rw_fapl_id = sub_fapl_ids[0];
+ vfd_config->wo_fapl_id = sub_fapl_ids[1];
+
+ if (splitter_prepare_file_paths(vfd_config, filename_rw) < 0) {
SPLITTER_TEST_FAULT("can't prepare file paths\n");
}
if (provide_logfile_path == FALSE) {
- *vfd_config.log_file_path = '\0'; /* reset as empty string */
+ vfd_config->log_file_path[0] = '\0'; /* reset as empty string */
}
/* Create a new fapl to use the SPLITTER file driver */
if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) == H5I_INVALID_HID) {
SPLITTER_TEST_FAULT("can't create FAPL ID\n");
}
- if (H5Pset_fapl_splitter(fapl_id, &vfd_config) < 0) {
+ if (H5Pset_fapl_splitter(fapl_id, vfd_config) < 0) {
SPLITTER_TEST_FAULT("can't set splitter FAPL\n");
}
if (H5Pget_driver(fapl_id) != H5FD_SPLITTER) {
SPLITTER_TEST_FAULT("set FAPL not SPLITTER\n");
}
- if (compare_splitter_config_info(fapl_id, &vfd_config) < 0) {
+ if (compare_splitter_config_info(fapl_id, vfd_config) < 0) {
SPLITTER_TEST_FAULT("information mismatch\n");
}
@@ -2384,7 +2394,7 @@ run_splitter_test(const struct splitter_dataset_def *data, hbool_t ignore_wo_err
if (H5I_INVALID_HID == fapl_id_cpy) {
SPLITTER_TEST_FAULT("can't copy FAPL\n");
}
- if (compare_splitter_config_info(fapl_id_cpy, &vfd_config) < 0) {
+ if (compare_splitter_config_info(fapl_id_cpy, vfd_config) < 0) {
SPLITTER_TEST_FAULT("information mismatch\n");
}
if (H5Pclose(fapl_id_cpy) < 0) {
@@ -2410,7 +2420,7 @@ run_splitter_test(const struct splitter_dataset_def *data, hbool_t ignore_wo_err
if (H5Pget_driver(fapl_id_out) != H5FD_SPLITTER) {
SPLITTER_TEST_FAULT("wrong file FAPL driver\n");
}
- if (compare_splitter_config_info(fapl_id_out, &vfd_config) < 0) {
+ if (compare_splitter_config_info(fapl_id_out, vfd_config) < 0) {
SPLITTER_TEST_FAULT("information mismatch\n");
}
if (H5Pclose(fapl_id_out) < 0) {
@@ -2449,12 +2459,12 @@ run_splitter_test(const struct splitter_dataset_def *data, hbool_t ignore_wo_err
}
/* Verify that the R/W and W/O files are identical */
- if (h5_compare_file_bytes(filename_rw, vfd_config.wo_path) < 0) {
+ if (h5_compare_file_bytes(filename_rw, vfd_config->wo_path) < 0) {
SPLITTER_TEST_FAULT("files are not byte-for-byte equivalent\n");
}
- /* Verify existence of logfile iff appropriate */
- logfile = fopen(vfd_config.log_file_path, "r");
+ /* Verify existence of logfile if appropriate */
+ logfile = fopen(vfd_config->log_file_path, "r");
if ((TRUE == provide_logfile_path && NULL == logfile) ||
(FALSE == provide_logfile_path && NULL != logfile)) {
SPLITTER_TEST_FAULT("no logfile when one was expected\n");
@@ -2464,20 +2474,23 @@ done:
if (ret_value < 0) {
H5E_BEGIN_TRY
{
- (void)H5Dclose(dset_id);
- (void)H5Sclose(space_id);
- (void)H5Pclose(fapl_id_out);
- (void)H5Pclose(fapl_id_cpy);
- (void)H5Pclose(fapl_id);
- (void)H5Fclose(file_id);
+ H5Dclose(dset_id);
+ H5Sclose(space_id);
+ H5Pclose(fapl_id_out);
+ H5Pclose(fapl_id_cpy);
+ H5Pclose(fapl_id);
+ H5Fclose(file_id);
}
H5E_END_TRY;
}
- if (logfile != NULL) {
+
+ if (logfile != NULL)
fclose(logfile);
- }
- return ret_value;
+ HDfree(vfd_config);
+ HDfree(filename_rw);
+
+ return ret_value;
} /* end run_splitter_test() */
/*-------------------------------------------------------------------------
@@ -2498,24 +2511,27 @@ done:
static int
driver_is_splitter_compatible(hid_t fapl_id)
{
- H5FD_splitter_vfd_config_t vfd_config;
- hid_t split_fapl_id = H5I_INVALID_HID;
- herr_t ret = SUCCEED;
- int ret_value = 0;
+ H5FD_splitter_vfd_config_t *vfd_config = NULL;
+ hid_t split_fapl_id = H5I_INVALID_HID;
+ herr_t ret = SUCCEED;
+ int ret_value = 0;
+
+ if (NULL == (vfd_config = HDcalloc(1, sizeof(H5FD_splitter_vfd_config_t)))) {
+ FAIL_PUTS_ERROR("memory allocation for vfd_config struct failed");
+ }
- split_fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- if (H5I_INVALID_HID == split_fapl_id) {
+ if (H5I_INVALID_HID == (split_fapl_id = H5Pcreate(H5P_FILE_ACCESS))) {
FAIL_PUTS_ERROR("Can't create contained FAPL");
}
- vfd_config.magic = H5FD_SPLITTER_MAGIC;
- vfd_config.version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
- vfd_config.ignore_wo_errs = FALSE;
- vfd_config.rw_fapl_id = H5P_DEFAULT;
- vfd_config.wo_fapl_id = fapl_id;
- HDstrncpy(vfd_config.wo_path, "nonesuch", H5FD_SPLITTER_PATH_MAX);
- *vfd_config.log_file_path = '\0';
+ vfd_config->magic = H5FD_SPLITTER_MAGIC;
+ vfd_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
+ vfd_config->ignore_wo_errs = FALSE;
+ vfd_config->rw_fapl_id = H5P_DEFAULT;
+ vfd_config->wo_fapl_id = fapl_id;
+ HDstrncpy(vfd_config->wo_path, "nonesuch", H5FD_SPLITTER_PATH_MAX);
+ vfd_config->log_file_path[0] = '\0';
- H5E_BEGIN_TRY { ret = H5Pset_fapl_splitter(split_fapl_id, &vfd_config); }
+ H5E_BEGIN_TRY { ret = H5Pset_fapl_splitter(split_fapl_id, vfd_config); }
H5E_END_TRY;
if (SUCCEED == ret) {
ret_value = -1;
@@ -2526,11 +2542,16 @@ driver_is_splitter_compatible(hid_t fapl_id)
}
split_fapl_id = H5I_INVALID_HID;
+ HDfree(vfd_config);
+
return ret_value;
error:
- H5E_BEGIN_TRY { (void)H5Pclose(split_fapl_id); }
+ H5E_BEGIN_TRY { H5Pclose(split_fapl_id); }
H5E_END_TRY;
+
+ HDfree(vfd_config);
+
return -1;
} /* end driver_is_splitter_compatible() */
@@ -2550,19 +2571,24 @@ error:
static int
splitter_RO_test(const struct splitter_dataset_def *data, hid_t child_fapl_id)
{
- char filename_rw[H5FD_SPLITTER_PATH_MAX + 1];
- H5FD_splitter_vfd_config_t vfd_config;
- hid_t fapl_id = H5I_INVALID_HID;
- int ret_value = 0;
- hid_t file_id = H5I_INVALID_HID;
-
- vfd_config.magic = H5FD_SPLITTER_MAGIC;
- vfd_config.version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
- vfd_config.ignore_wo_errs = FALSE;
- vfd_config.rw_fapl_id = child_fapl_id;
- vfd_config.wo_fapl_id = child_fapl_id;
-
- if (splitter_prepare_file_paths(&vfd_config, filename_rw) < 0) {
+ char * filename_rw = NULL;
+ H5FD_splitter_vfd_config_t *vfd_config = NULL;
+ hid_t fapl_id = H5I_INVALID_HID;
+ hid_t file_id = H5I_INVALID_HID;
+ int ret_value = 0;
+
+ if (NULL == (vfd_config = HDcalloc(1, sizeof(H5FD_splitter_vfd_config_t))))
+ SPLITTER_TEST_FAULT("memory allocation for vfd_config struct failed");
+ if (NULL == (filename_rw = HDcalloc(H5FD_SPLITTER_PATH_MAX + 1, sizeof(char))))
+ SPLITTER_TEST_FAULT("memory allocation for filename_rw string failed");
+
+ vfd_config->magic = H5FD_SPLITTER_MAGIC;
+ vfd_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
+ vfd_config->ignore_wo_errs = FALSE;
+ vfd_config->rw_fapl_id = child_fapl_id;
+ vfd_config->wo_fapl_id = child_fapl_id;
+
+ if (splitter_prepare_file_paths(vfd_config, filename_rw) < 0) {
SPLITTER_TEST_FAULT("can't prepare splitter file paths\n");
}
@@ -2571,7 +2597,7 @@ splitter_RO_test(const struct splitter_dataset_def *data, hid_t child_fapl_id)
if (H5I_INVALID_HID == fapl_id) {
SPLITTER_TEST_FAULT("can't create FAPL ID\n");
}
- if (H5Pset_fapl_splitter(fapl_id, &vfd_config) < 0) {
+ if (H5Pset_fapl_splitter(fapl_id, vfd_config) < 0) {
SPLITTER_TEST_FAULT("can't set splitter FAPL\n");
}
if (H5Pget_driver(fapl_id) != H5FD_SPLITTER) {
@@ -2592,7 +2618,7 @@ splitter_RO_test(const struct splitter_dataset_def *data, hid_t child_fapl_id)
* Should fail.
*/
- if (splitter_create_single_file_at(vfd_config.wo_path, vfd_config.wo_fapl_id, data) < 0) {
+ if (splitter_create_single_file_at(vfd_config->wo_path, vfd_config->wo_fapl_id, data) < 0) {
SPLITTER_TEST_FAULT("can't write W/O file\n");
}
H5E_BEGIN_TRY { file_id = H5Fopen(filename_rw, H5F_ACC_RDONLY, fapl_id); }
@@ -2600,13 +2626,13 @@ splitter_RO_test(const struct splitter_dataset_def *data, hid_t child_fapl_id)
if (file_id >= 0) {
SPLITTER_TEST_FAULT("R/O open with extant W/O file unexpectedly successful\n");
}
- HDremove(vfd_config.wo_path);
+ HDremove(vfd_config->wo_path);
/* Attempt R/O open when only R/W file exists
* Should fail.
*/
- if (splitter_create_single_file_at(filename_rw, vfd_config.rw_fapl_id, data) < 0) {
+ if (splitter_create_single_file_at(filename_rw, vfd_config->rw_fapl_id, data) < 0) {
SPLITTER_TEST_FAULT("can't create R/W file\n");
}
H5E_BEGIN_TRY { file_id = H5Fopen(filename_rw, H5F_ACC_RDONLY, fapl_id); }
@@ -2618,7 +2644,7 @@ splitter_RO_test(const struct splitter_dataset_def *data, hid_t child_fapl_id)
/* Attempt R/O open when both R/W and W/O files exist
*/
- if (splitter_create_single_file_at(vfd_config.wo_path, vfd_config.wo_fapl_id, data) < 0) {
+ if (splitter_create_single_file_at(vfd_config->wo_path, vfd_config->wo_fapl_id, data) < 0) {
SPLITTER_TEST_FAULT("can't create W/O file\n");
}
file_id = H5Fopen(filename_rw, H5F_ACC_RDONLY, fapl_id);
@@ -2645,11 +2671,15 @@ done:
if (ret_value < 0) {
H5E_BEGIN_TRY
{
- (void)H5Pclose(fapl_id);
- (void)H5Fclose(file_id);
+ H5Pclose(fapl_id);
+ H5Fclose(file_id);
}
H5E_END_TRY;
- } /* end if error */
+ }
+
+ HDfree(vfd_config);
+ HDfree(filename_rw);
+
return ret_value;
} /* end splitter_RO_test() */
@@ -2779,9 +2809,9 @@ done:
if (ret_value < 0) {
H5E_BEGIN_TRY
{
- (void)H5Dclose(dset_id);
- (void)H5Sclose(space_id);
- (void)H5Fclose(file_id);
+ H5Dclose(dset_id);
+ H5Sclose(space_id);
+ H5Fclose(file_id);
}
H5E_END_TRY;
} /* end if error */
@@ -2840,7 +2870,7 @@ splitter_compare_expected_data(hid_t file_id, const struct splitter_dataset_def
done:
if (ret_value < 0) {
- H5E_BEGIN_TRY { (void)H5Dclose(dset_id); }
+ H5E_BEGIN_TRY { H5Dclose(dset_id); }
H5E_END_TRY;
}
return ret_value;
@@ -2872,11 +2902,11 @@ done:
static int
splitter_tentative_open_test(hid_t child_fapl_id)
{
- const char filename_tmp[H5FD_SPLITTER_PATH_MAX + 1] = "splitter_tmp.h5";
- char filename_rw[H5FD_SPLITTER_PATH_MAX + 1];
- H5FD_splitter_vfd_config_t vfd_config;
- hid_t fapl_id = H5I_INVALID_HID;
- hid_t file_id = H5I_INVALID_HID;
+ const char * filename_tmp = "splitter_tmp.h5";
+ char * filename_rw = NULL;
+ H5FD_splitter_vfd_config_t *vfd_config = NULL;
+ hid_t fapl_id = H5I_INVALID_HID;
+ hid_t file_id = H5I_INVALID_HID;
int buf[SPLITTER_SIZE][SPLITTER_SIZE]; /* for comparison */
hsize_t dims[2] = {SPLITTER_SIZE, SPLITTER_SIZE}; /* for comparison */
int i = 0; /* for comparison */
@@ -2884,6 +2914,11 @@ splitter_tentative_open_test(hid_t child_fapl_id)
struct splitter_dataset_def data; /* for comparison */
int ret_value = 0;
+ if (NULL == (vfd_config = HDcalloc(1, sizeof(H5FD_splitter_vfd_config_t))))
+ SPLITTER_TEST_FAULT("memory allocation for vfd_config struct failed");
+ if (NULL == (filename_rw = HDcalloc(H5FD_SPLITTER_PATH_MAX + 1, sizeof(char))))
+ SPLITTER_TEST_FAULT("memory allocation for filename_rw string failed");
+
/* pre-fill data buffer to write */
for (i = 0; i < SPLITTER_SIZE; i++) {
for (j = 0; j < SPLITTER_SIZE; j++) {
@@ -2898,13 +2933,13 @@ splitter_tentative_open_test(hid_t child_fapl_id)
data.n_dims = 2;
data.dset_name = SPLITTER_DATASET_NAME;
- vfd_config.magic = H5FD_SPLITTER_MAGIC;
- vfd_config.version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
- vfd_config.ignore_wo_errs = FALSE;
- vfd_config.rw_fapl_id = child_fapl_id;
- vfd_config.wo_fapl_id = child_fapl_id;
+ vfd_config->magic = H5FD_SPLITTER_MAGIC;
+ vfd_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
+ vfd_config->ignore_wo_errs = FALSE;
+ vfd_config->rw_fapl_id = child_fapl_id;
+ vfd_config->wo_fapl_id = child_fapl_id;
- if (splitter_prepare_file_paths(&vfd_config, filename_rw) < 0) {
+ if (splitter_prepare_file_paths(vfd_config, filename_rw) < 0) {
SPLITTER_TEST_FAULT("can't prepare splitter file paths\n");
}
@@ -2912,7 +2947,7 @@ splitter_tentative_open_test(hid_t child_fapl_id)
if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) == H5I_INVALID_HID) {
SPLITTER_TEST_FAULT("can't create FAPL ID\n");
}
- if (H5Pset_fapl_splitter(fapl_id, &vfd_config) < 0) {
+ if (H5Pset_fapl_splitter(fapl_id, vfd_config) < 0) {
SPLITTER_TEST_FAULT("can't set splitter FAPL\n");
}
if (H5Pget_driver(fapl_id) != H5FD_SPLITTER) {
@@ -2941,7 +2976,7 @@ splitter_tentative_open_test(hid_t child_fapl_id)
if (file_exists(filename_rw, child_fapl_id)) {
SPLITTER_TEST_FAULT("R/W file unexpectedly created\n");
}
- if (file_exists(vfd_config.wo_path, child_fapl_id)) {
+ if (file_exists(vfd_config->wo_path, child_fapl_id)) {
SPLITTER_TEST_FAULT("W/O file unexpectedly created\n");
}
@@ -2951,7 +2986,7 @@ splitter_tentative_open_test(hid_t child_fapl_id)
* Should fail.
*/
- if (h5_duplicate_file_by_bytes(filename_tmp, vfd_config.wo_path) < 0) {
+ if (h5_duplicate_file_by_bytes(filename_tmp, vfd_config->wo_path) < 0) {
SPLITTER_TEST_FAULT("Can't create W/O file copy.\n");
}
H5E_BEGIN_TRY { file_id = H5Fopen(filename_rw, H5F_ACC_RDWR, fapl_id); }
@@ -2962,11 +2997,11 @@ splitter_tentative_open_test(hid_t child_fapl_id)
if (file_exists(filename_rw, child_fapl_id)) {
SPLITTER_TEST_FAULT("R/W file unexpectedly created\n");
}
- if (!file_exists(vfd_config.wo_path, child_fapl_id)) {
+ if (!file_exists(vfd_config->wo_path, child_fapl_id)) {
SPLITTER_TEST_FAULT("W/O file mysteriously disappeared\n");
}
- HDremove(vfd_config.wo_path);
- if (file_exists(vfd_config.wo_path, child_fapl_id)) {
+ HDremove(vfd_config->wo_path);
+ if (file_exists(vfd_config->wo_path, child_fapl_id)) {
SPLITTER_TEST_FAULT("failed to remove W/O file\n");
}
@@ -2987,7 +3022,7 @@ splitter_tentative_open_test(hid_t child_fapl_id)
if (!file_exists(filename_rw, child_fapl_id)) {
SPLITTER_TEST_FAULT("R/W file mysteriously disappeared\n");
}
- if (file_exists(vfd_config.wo_path, child_fapl_id)) {
+ if (file_exists(vfd_config->wo_path, child_fapl_id)) {
SPLITTER_TEST_FAULT("W/O file unexpectedly created\n");
}
@@ -2996,7 +3031,7 @@ splitter_tentative_open_test(hid_t child_fapl_id)
* Both files present.
*/
- if (h5_duplicate_file_by_bytes(filename_tmp, vfd_config.wo_path) < 0) {
+ if (h5_duplicate_file_by_bytes(filename_tmp, vfd_config->wo_path) < 0) {
SPLITTER_TEST_FAULT("Can't create W/O file copy.\n");
}
file_id = H5Fopen(filename_rw, H5F_ACC_RDWR, fapl_id);
@@ -3010,7 +3045,7 @@ splitter_tentative_open_test(hid_t child_fapl_id)
if (!file_exists(filename_rw, child_fapl_id)) {
SPLITTER_TEST_FAULT("R/W file mysteriously disappared\n");
}
- if (!file_exists(vfd_config.wo_path, child_fapl_id)) {
+ if (!file_exists(vfd_config->wo_path, child_fapl_id)) {
SPLITTER_TEST_FAULT("W/O file mysteriously disappeared\n");
}
@@ -3030,14 +3065,14 @@ splitter_tentative_open_test(hid_t child_fapl_id)
if (!file_exists(filename_rw, child_fapl_id)) {
SPLITTER_TEST_FAULT("R/W file mysteriously disappared\n");
}
- if (!file_exists(vfd_config.wo_path, child_fapl_id)) {
+ if (!file_exists(vfd_config->wo_path, child_fapl_id)) {
SPLITTER_TEST_FAULT("W/O file mysteriously disappeared\n");
}
- if (h5_compare_file_bytes(filename_rw, vfd_config.wo_path) < 0) {
+ if (h5_compare_file_bytes(filename_rw, vfd_config->wo_path) < 0) {
SPLITTER_TEST_FAULT("files are not byte-for-byte equivalent\n");
}
HDremove(filename_rw);
- HDremove(vfd_config.wo_path);
+ HDremove(vfd_config->wo_path);
/*
* H5Fcreate() with TRUNC access.
@@ -3047,7 +3082,7 @@ splitter_tentative_open_test(hid_t child_fapl_id)
if (h5_duplicate_file_by_bytes(filename_tmp, filename_rw) < 0) {
SPLITTER_TEST_FAULT("Can't create R/W file copy.\n");
}
- if (file_exists(vfd_config.wo_path, child_fapl_id)) {
+ if (file_exists(vfd_config->wo_path, child_fapl_id)) {
SPLITTER_TEST_FAULT("failed to remove W/O file\n");
}
file_id = H5Fcreate(filename_rw, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
@@ -3061,21 +3096,21 @@ splitter_tentative_open_test(hid_t child_fapl_id)
if (!file_exists(filename_rw, child_fapl_id)) {
SPLITTER_TEST_FAULT("R/W file mysteriously disappared\n");
}
- if (!file_exists(vfd_config.wo_path, child_fapl_id)) {
+ if (!file_exists(vfd_config->wo_path, child_fapl_id)) {
SPLITTER_TEST_FAULT("W/O file mysteriously disappeared\n");
}
- if (h5_compare_file_bytes(filename_rw, vfd_config.wo_path) < 0) {
+ if (h5_compare_file_bytes(filename_rw, vfd_config->wo_path) < 0) {
SPLITTER_TEST_FAULT("files are not byte-for-byte equivalent\n");
}
HDremove(filename_rw);
- HDremove(vfd_config.wo_path);
+ HDremove(vfd_config->wo_path);
/*
* H5Fcreate() with TRUNC access.
* Only W/O present.
*/
- if (h5_duplicate_file_by_bytes(filename_tmp, vfd_config.wo_path) < 0) {
+ if (h5_duplicate_file_by_bytes(filename_tmp, vfd_config->wo_path) < 0) {
SPLITTER_TEST_FAULT("Can't create W/O file copy.\n");
}
if (file_exists(filename_rw, child_fapl_id)) {
@@ -3092,14 +3127,14 @@ splitter_tentative_open_test(hid_t child_fapl_id)
if (!file_exists(filename_rw, child_fapl_id)) {
SPLITTER_TEST_FAULT("R/W file mysteriously disappared\n");
}
- if (!file_exists(vfd_config.wo_path, child_fapl_id)) {
+ if (!file_exists(vfd_config->wo_path, child_fapl_id)) {
SPLITTER_TEST_FAULT("W/O file mysteriously disappeared\n");
}
- if (h5_compare_file_bytes(filename_rw, vfd_config.wo_path) < 0) {
+ if (h5_compare_file_bytes(filename_rw, vfd_config->wo_path) < 0) {
SPLITTER_TEST_FAULT("files are not byte-for-byte equivalent\n");
}
HDremove(filename_rw);
- HDremove(vfd_config.wo_path);
+ HDremove(vfd_config->wo_path);
/* H5Fcreate with both files absent is tested elsewhere */
@@ -3115,11 +3150,15 @@ done:
if (ret_value < 0) {
H5E_BEGIN_TRY
{
- (void)H5Pclose(fapl_id);
- (void)H5Fclose(file_id);
+ H5Pclose(fapl_id);
+ H5Fclose(file_id);
}
H5E_END_TRY;
- } /* end if error */
+ }
+
+ HDfree(vfd_config);
+ HDfree(filename_rw);
+
return ret_value;
} /* end splitter_tentative_open_test() */
@@ -3153,7 +3192,7 @@ file_exists(const char *filename, hid_t fapl_id)
return ret_value;
error:
- H5E_BEGIN_TRY { (void)H5Fclose(file_id); }
+ H5E_BEGIN_TRY { H5Fclose(file_id); }
H5E_END_TRY;
return ret_value;
} /* end file_exists() */
@@ -3259,9 +3298,9 @@ test_splitter(void)
return 0;
error:
- if (child_fapl_id != H5I_INVALID_HID) {
- (void)H5Pclose(child_fapl_id);
- }
+ if (child_fapl_id != H5I_INVALID_HID)
+ H5Pclose(child_fapl_id);
+
return -1;
} /* end test_splitter() */
@@ -3272,8 +3311,7 @@ error:
*
* Purpose: Tests the basic features of Virtual File Drivers
*
- * Return: Success: 0
- * Failure: 1
+ * Return: EXIT_SUCCESS/EXIT_FAILURE
*
*-------------------------------------------------------------------------
*/
@@ -3298,14 +3336,14 @@ main(void)
nerrors += test_stdio() < 0 ? 1 : 0;
nerrors += test_windows() < 0 ? 1 : 0;
nerrors += test_ros3() < 0 ? 1 : 0;
- nerrors += test_splitter() < 0 ? 1 : 0;
+/* nerrors += test_splitter() < 0 ? 1 : 0; */
if (nerrors) {
HDprintf("***** %d Virtual File Driver TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : "");
- return 1;
- } /* end if */
+ return EXIT_FAILURE;
+ }
HDprintf("All Virtual File Driver tests passed.\n");
- return 0;
+ return EXIT_SUCCESS;
} /* end main() */