diff options
author | Richard Warren <Richard.Warren@hdfgroup.org> | 2020-09-25 11:45:15 (GMT) |
---|---|---|
committer | Richard Warren <Richard.Warren@hdfgroup.org> | 2020-09-25 11:45:15 (GMT) |
commit | 5dd85abb4124f337eea52ef33d0c7e3fd67ed92d (patch) | |
tree | 7146b025f19d5d5bb5f85428f2cf6d6d91ceca19 /test | |
parent | d612a249afe1eb4799ccbf725d8309452446dee7 (diff) | |
download | hdf5-5dd85abb4124f337eea52ef33d0c7e3fd67ed92d.zip hdf5-5dd85abb4124f337eea52ef33d0c7e3fd67ed92d.tar.gz hdf5-5dd85abb4124f337eea52ef33d0c7e3fd67ed92d.tar.bz2 |
Create a new branch for the September Subfiling deliverable
Diffstat (limited to 'test')
-rw-r--r-- | test/CMakeLists.txt | 1 | ||||
-rw-r--r-- | test/Makefile.am | 6 | ||||
-rw-r--r-- | test/tselect.c | 6 | ||||
-rw-r--r-- | test/vfd.c | 364 |
4 files changed, 175 insertions, 202 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 311d753..7da92cd 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -145,6 +145,7 @@ if (BUILD_SHARED_LIBS) #----------------------------------------------------------------------------- set (VOL_PLUGIN_LIBS null_vol_connector + h5subfiling_vol ) foreach (vol_lib ${VOL_PLUGIN_LIBS}) diff --git a/test/Makefile.am b/test/Makefile.am index 7ebeae7..8e6a900 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -116,7 +116,8 @@ if HAVE_SHARED_CONDITIONAL # The libh5test library provides common support code for the tests. # The filter_plugin* libraries are for use in filter_plugin.c. # Build them as shared libraries if that option was enabled in configure. - noinst_LTLIBRARIES=libh5test.la libfilter_plugin1_dsets.la libfilter_plugin2_dsets.la libfilter_plugin3_dsets.la libfilter_plugin4_groups.la libnull_vol_connector.la + noinst_LTLIBRARIES=libh5test.la libfilter_plugin1_dsets.la libfilter_plugin2_dsets.la libfilter_plugin3_dsets.la libfilter_plugin4_groups.la \ + libnull_vol_connector.la libh5subfiling_vol.la libfilter_plugin1_dsets_la_SOURCES=filter_plugin1_dsets.c libfilter_plugin2_dsets_la_SOURCES=filter_plugin2_dsets.c libfilter_plugin3_dsets_la_SOURCES=filter_plugin3_dsets.c @@ -133,7 +134,8 @@ if HAVE_SHARED_CONDITIONAL # null_vol_connector is used for testing basic VOL plugin functionality. libnull_vol_connector_la_SOURCES=null_vol_connector.c libnull_vol_connector_la_LDFLAGS=$(AM_LDFLAGS) -avoid-version -module -shared -export-dynamic -rpath /nowhere - + libh5subfiling_vol_la_SOURCES=h5subfiling_vol.c + libh5subfiling_vol_la_LDFLAGS=$(AM_LDFLAGS) -avoid-version -module -shared -export-dynamic -rpath /nowhere else # The libh5test library provides common support code for the tests. noinst_LTLIBRARIES=libh5test.la diff --git a/test/tselect.c b/test/tselect.c index c98db5d..305d660 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -14915,8 +14915,8 @@ test_sel_iter(void) { hid_t sid; /* Dataspace ID */ hid_t iter_id; /* Dataspace selection iterator ID */ - hsize_t dims1[] = {6, 12}; /* 2-D Dataspace dimensions */ - hsize_t coord1[POINT1_NPOINTS][2]; /* Coordinates for point selection */ + hsize_t dims1[] = {6, 12}; /* 2-D Dataspace dimensions */ + hsize_t coord1[POINT1_NPOINTS][2]; /* Coordinates for point selection */ hsize_t start[2]; /* Hyperslab start */ hsize_t stride[2]; /* Hyperslab stride */ hsize_t count[2]; /* Hyperslab block count */ @@ -14928,7 +14928,7 @@ test_sel_iter(void) H5S_sel_type sel_type; /* Selection type */ unsigned sel_share; /* Whether to share selection with dataspace */ unsigned sel_iter_flags; /* Flags for selection iterator creation */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(6, ("Testing Dataspace Selection Iterators\n")); @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu + * Programmer: Raymond Lu<slu@ncsa.uiuc.edu> * Tuesday, Sept 24, 2002 * * Purpose: Tests the basic features of Virtual File Drivers @@ -2258,51 +2258,46 @@ 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 = NULL; - - if (NULL == (fetched_info = HDcalloc(1, sizeof(H5FD_splitter_vfd_config_t)))) - SPLITTER_TEST_FAULT("memory allocation for fetched_info struct failed"); + H5FD_splitter_vfd_config_t fetched_info; - 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; + 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 (H5Pget_fapl_splitter(fapl_id, &fetched_info) < 0) { + SPLITTER_TEST_FAULT("can't get splitter info\n"); } 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)) + 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); + 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() */ @@ -2336,42 +2331,37 @@ run_splitter_test(const struct splitter_dataset_def *data, 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; + H5FD_splitter_vfd_config_t vfd_config; + char filename_rw[H5FD_SPLITTER_PATH_MAX + 1]; 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]; - 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) { + 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] = '\0'; /* reset as empty string */ + *vfd_config.log_file_path = '\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 +2374,7 @@ run_splitter_test(const struct splitter_dataset_def *data, 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) { @@ -2411,7 +2401,7 @@ run_splitter_test(const struct splitter_dataset_def *data, 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 +2439,12 @@ run_splitter_test(const struct splitter_dataset_def *data, } /* 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 if appropriate */ - logfile = fopen(vfd_config->log_file_path, "r"); + /* Verify existence of logfile iff appropriate */ + logfile = fopen(vfd_config.log_file_path, "r"); if ( (TRUE == provide_logfile_path && NULL == logfile) || (FALSE == provide_logfile_path && NULL != logfile) ) { @@ -2464,22 +2454,19 @@ run_splitter_test(const struct splitter_dataset_def *data, done: if (ret_value < 0) { H5E_BEGIN_TRY { - H5Dclose(dset_id); - H5Sclose(space_id); - H5Pclose(fapl_id_out); - H5Pclose(fapl_id_cpy); - H5Pclose(fapl_id); - H5Fclose(file_id); + (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); } H5E_END_TRY; } - - if (logfile != NULL) + if (logfile != NULL) { fclose(logfile); - - HDfree(vfd_config); - HDfree(filename_rw); - + } return ret_value; + } /* end run_splitter_test() */ @@ -2501,28 +2488,25 @@ done: static int driver_is_splitter_compatible(hid_t fapl_id) { - H5FD_splitter_vfd_config_t *vfd_config = NULL; + H5FD_splitter_vfd_config_t vfd_config; 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"); - } - - if(H5I_INVALID_HID == (split_fapl_id = H5Pcreate(H5P_FILE_ACCESS))) { + split_fapl_id = H5Pcreate(H5P_FILE_ACCESS); + if (H5I_INVALID_HID == split_fapl_id) { 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] = '\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'; H5E_BEGIN_TRY { - ret = H5Pset_fapl_splitter(split_fapl_id, vfd_config); + ret = H5Pset_fapl_splitter(split_fapl_id, &vfd_config); } H5E_END_TRY; if (SUCCEED == ret) { ret_value = -1; @@ -2533,17 +2517,12 @@ driver_is_splitter_compatible(hid_t fapl_id) } split_fapl_id = H5I_INVALID_HID; - HDfree(vfd_config); - return ret_value; error: H5E_BEGIN_TRY { - H5Pclose(split_fapl_id); + (void)H5Pclose(split_fapl_id); } H5E_END_TRY; - - HDfree(vfd_config); - return -1; } /* end driver_is_splitter_compatible() */ @@ -2566,24 +2545,19 @@ splitter_RO_test( const struct splitter_dataset_def *data, hid_t child_fapl_id) { - char *filename_rw = NULL; - H5FD_splitter_vfd_config_t *vfd_config = NULL; + 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; int ret_value = 0; + hid_t file_id = H5I_INVALID_HID; - 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; + 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"); } @@ -2592,7 +2566,7 @@ splitter_RO_test( 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) { @@ -2614,7 +2588,7 @@ splitter_RO_test( * 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 { @@ -2623,13 +2597,13 @@ splitter_RO_test( 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 { @@ -2642,7 +2616,7 @@ splitter_RO_test( /* 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); @@ -2668,14 +2642,10 @@ splitter_RO_test( done: if (ret_value < 0) { H5E_BEGIN_TRY { - H5Pclose(fapl_id); - H5Fclose(file_id); + (void)H5Pclose(fapl_id); + (void)H5Fclose(file_id); } H5E_END_TRY; - } - - HDfree(vfd_config); - HDfree(filename_rw); - + } /* end if error */ return ret_value; } /* end splitter_RO_test() */ @@ -2814,9 +2784,9 @@ splitter_create_single_file_at( done: if (ret_value < 0) { H5E_BEGIN_TRY { - H5Dclose(dset_id); - H5Sclose(space_id); - H5Fclose(file_id); + (void)H5Dclose(dset_id); + (void)H5Sclose(space_id); + (void)H5Fclose(file_id); } H5E_END_TRY; } /* end if error */ return ret_value; @@ -2877,7 +2847,7 @@ splitter_compare_expected_data(hid_t file_id, done: if (ret_value < 0) { H5E_BEGIN_TRY { - H5Dclose(dset_id); + (void)H5Dclose(dset_id); } H5E_END_TRY; } return ret_value; @@ -2910,9 +2880,8 @@ done: static int splitter_tentative_open_test(hid_t child_fapl_id) { - const char *filename_tmp = "splitter_tmp.h5"; - char *filename_rw = NULL; - H5FD_splitter_vfd_config_t *vfd_config = NULL; + 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; int buf[SPLITTER_SIZE][SPLITTER_SIZE]; /* for comparison */ @@ -2922,11 +2891,6 @@ 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++) { @@ -2941,13 +2905,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"); } @@ -2955,23 +2919,14 @@ 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) { SPLITTER_TEST_FAULT("set FAPL not SPLITTER\n"); } - /* Create instance of file on disk. - * Will be copied verbatim as needed, to avoid issues where differences in - * the creation time would befoul comparisons. - */ - if (splitter_create_single_file_at(filename_tmp, child_fapl_id, &data) < 0) { - SPLITTER_TEST_FAULT("can't write W/O file\n"); - } - - /* - * H5Fopen() with RDWR access. + /* H5Fopen() with RDWR access. * Neither file exist already * Should fail. */ @@ -2985,18 +2940,17 @@ 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"); } - /* - * H5Fopen() with RDWR access. - * Only W/O file present. + /* H5Fopen() with RDWR access. + * W/O file exists already. * Should fail. */ - 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 (splitter_create_single_file_at(vfd_config.wo_path, child_fapl_id, &data) < 0) { + SPLITTER_TEST_FAULT("can't write W/O file\n"); } H5E_BEGIN_TRY { file_id = H5Fopen(filename_rw, H5F_ACC_RDWR, fapl_id); @@ -3007,22 +2961,21 @@ 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"); } - /* - * H5Fopen() with RDWR access. - * Only R/W file present. + /* H5Fopen() with RDWR access. + * R/W file exists already. * Should fail. */ - if (h5_duplicate_file_by_bytes(filename_tmp, filename_rw) < 0) { - SPLITTER_TEST_FAULT("Can't create R/W file copy.\n"); + if (splitter_create_single_file_at(filename_rw, child_fapl_id, &data) < 0) { + SPLITTER_TEST_FAULT("can't write R/W file\n"); } H5E_BEGIN_TRY { file_id = H5Fopen(filename_rw, H5F_ACC_RDWR, fapl_id); @@ -3033,17 +2986,16 @@ 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"); } - /* - * H5Fopen() with RDWR access. - * Both files present. + /* H5Fopen() with RDWR access. + * Both files already exist. */ - 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 (splitter_create_single_file_at(vfd_config.wo_path, child_fapl_id, &data) < 0) { + SPLITTER_TEST_FAULT("can't write W/O file\n"); } file_id = H5Fopen(filename_rw, H5F_ACC_RDWR, fapl_id); if (file_id == H5I_INVALID_HID) { @@ -3056,13 +3008,15 @@ 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) { + SPLITTER_TEST_FAULT("files are not byte-for-byte equivalent\n"); + } - /* - * H5Fcreate() with TRUNC access. - * Both files present. + /* H5Fcreate() with TRUNC access. + * Both files already exist. */ file_id = H5Fcreate(filename_rw, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); @@ -3076,24 +3030,24 @@ 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); - /* - * H5Fcreate() with TRUNC access. + /* H5Fcreate() with TRUNC access. * R/W already exists. */ - if (h5_duplicate_file_by_bytes(filename_tmp, filename_rw) < 0) { - SPLITTER_TEST_FAULT("Can't create R/W file copy.\n"); + HDremove(filename_rw); + HDremove(vfd_config.wo_path); + if (splitter_create_single_file_at(filename_rw, child_fapl_id, &data) < 0) { + SPLITTER_TEST_FAULT("can't write R/W file\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); @@ -3107,23 +3061,23 @@ 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); - /* - * H5Fcreate() with TRUNC access. - * Only W/O present. + /* H5Fcreate() with TRUNC access. + * W/O already exists. */ - if (h5_duplicate_file_by_bytes(filename_tmp, vfd_config->wo_path) < 0) { - SPLITTER_TEST_FAULT("Can't create W/O file copy.\n"); + HDremove(filename_rw); + HDremove(vfd_config.wo_path); + if (splitter_create_single_file_at(vfd_config.wo_path, child_fapl_id, &data) < 0) { + SPLITTER_TEST_FAULT("can't write R/W file\n"); } + if (file_exists(filename_rw, child_fapl_id)) { SPLITTER_TEST_FAULT("failed to remove R/W file\n"); } @@ -3138,19 +3092,16 @@ 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); /* H5Fcreate with both files absent is tested elsewhere */ - /* - * Cleanup + /* Cleanup */ if (H5Pclose(fapl_id) < 0) { @@ -3160,14 +3111,10 @@ splitter_tentative_open_test(hid_t child_fapl_id) done: if (ret_value < 0) { H5E_BEGIN_TRY { - H5Pclose(fapl_id); - H5Fclose(file_id); + (void)H5Pclose(fapl_id); + (void)H5Fclose(file_id); } H5E_END_TRY; - } - - HDfree(vfd_config); - HDfree(filename_rw); - + } /* end if error */ return ret_value; } /* end splitter_tentative_open_test() */ @@ -3204,7 +3151,7 @@ file_exists(const char *filename, hid_t fapl_id) error: H5E_BEGIN_TRY { - H5Fclose(file_id); + (void)H5Fclose(file_id); } H5E_END_TRY; return ret_value; } /* end file_exists() */ @@ -3278,6 +3225,7 @@ test_splitter(void) TEST_ERROR; } + /* Test file creation, utilizing different child FAPLs (default vs. * specified), logfile, and Write Channel error ignoring behavior. */ @@ -3303,6 +3251,7 @@ test_splitter(void) /* TODO: SWMR open? */ /* Concurrent opens with both drivers using the Splitter */ + if (H5Pclose(child_fapl_id) == FAIL) { TEST_ERROR; } @@ -3311,9 +3260,9 @@ test_splitter(void) return 0; error: - if (child_fapl_id != H5I_INVALID_HID) - H5Pclose(child_fapl_id); - + if (child_fapl_id != H5I_INVALID_HID) { + (void)H5Pclose(child_fapl_id); + } return -1; } /* end test_splitter() */ @@ -4088,10 +4037,26 @@ test_subfiling(void) hid_t driver_id = -1; /* ID for this VFD */ unsigned long driver_flags = 0; /* VFD feature flags */ char filename[1024]; /* filename */ - void *os_file_handle = NULL; /* OS file handle */ - hsize_t file_size; /* file size */ H5FD_subfiling_fapl_t fa_in = {H5FD_CURR_SUBFILING_FAPL_T_VERSION}; H5FD_subfiling_fapl_t fa_out; + int require_mpi_finalize = 0; + + +#if defined(HAVE_SERIAL_SUBFILING) + void *os_file_handle = NULL; /* OS file handle */ + hsize_t file_size; /* file size */ +#else + int mpi_enabled; /* if MPI_Init has been called */ + if (MPI_Initialized(&mpi_enabled) == MPI_SUCCESS) { + if (!mpi_enabled) { + int mpi_provides, require = MPI_THREAD_MULTIPLE; + if ((MPI_Init_thread(NULL, NULL, require, &mpi_provides)) != MPI_SUCCESS) { + TEST_ERROR; + } + require_mpi_finalize++; + } + } +#endif TESTING("subfiling file driver"); @@ -4124,7 +4089,6 @@ test_subfiling(void) if(!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA)) TEST_ERROR if(!(driver_flags & H5FD_FEAT_POSIX_COMPAT_HANDLE)) TEST_ERROR if(!(driver_flags & H5FD_FEAT_SUPPORTS_SWMR_IO)) TEST_ERROR - if(!(driver_flags & H5FD_FEAT_DEFAULT_VFD_COMPATIBLE)) TEST_ERROR /* Check for extra flags not accounted for above */ if(driver_flags != (H5FD_FEAT_AGGREGATE_METADATA @@ -4132,8 +4096,8 @@ test_subfiling(void) | H5FD_FEAT_DATA_SIEVE | H5FD_FEAT_AGGREGATE_SMALLDATA | H5FD_FEAT_POSIX_COMPAT_HANDLE - | H5FD_FEAT_SUPPORTS_SWMR_IO - | H5FD_FEAT_DEFAULT_VFD_COMPATIBLE)) + | H5FD_FEAT_SUPPORTS_SWMR_IO)) + TEST_ERROR if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) @@ -4158,6 +4122,7 @@ test_subfiling(void) if(H5Pclose(fapl_id_out) < 0) TEST_ERROR; +#if defined(HAVE_SERIAL_SUBFILING) /* Check that we can get an operating-system-specific handle from * the library. * @@ -4180,6 +4145,7 @@ test_subfiling(void) if(file_size < 1 * KB || file_size > 4 * KB) FAIL_PUTS_ERROR("suspicious file size obtained from H5Fget_filesize"); +#endif /* Close and delete the file */ if(H5Fclose(fid) < 0) @@ -4191,6 +4157,9 @@ test_subfiling(void) if(H5Pclose(fapl_id) < 0) TEST_ERROR; + if (require_mpi_finalize) + MPI_Finalize(); + PASSED(); return 0; @@ -4213,7 +4182,8 @@ error: * * Purpose: Tests the basic features of Virtual File Drivers * - * Return: EXIT_SUCCESS/EXIT_FAILURE + * Return: Success: 0 + * Failure: 1 * *------------------------------------------------------------------------- */ @@ -4249,11 +4219,11 @@ main(void) if(nerrors) { HDprintf("***** %d Virtual File Driver TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); - return EXIT_FAILURE; - } + return 1; + } /* end if */ HDprintf("All Virtual File Driver tests passed.\n"); - return EXIT_SUCCESS; + return 0; } /* end main() */ |