mirror of
https://github.com/HDFGroup/hdf5.git
synced 2026-09-25 04:09:44 +03:00
API test updates (#3018)
* Remove macros from api tests (#2929) * Remove macros and undefined callbacks (#2959) * Remove remaining macros from H5_api_tests_disabled.h (#2968) * Put some vol capability checks in testpar tests and remove remaining warnings (#2995) * API tests datatype generation cleanup * Clean up API tests' random datatype generation and fix bug with enum datatype generation * Init parallel API tests with MPI_THREAD_MULTIPLE * HDF5 API tests - Check VOL connector registration * Determine whether a VOL connector failed to load before running API tests * Cleanup some usages of H5VL_CAP_FLAG_CREATION_ORDER in API tests * Remove some now-unused macros from H5_api_tests_disabled.h * Enable HDF5 API tests by default * Implement CMake option to install HDF5 API tests * Check for invalid AAPL from H5Acreate * Enable building of VOL connectors alongside HDF5 in CMake * Prepend CMake VOL URL option indices with 0s so they come in order * Don't turn on API tests by default yet * Document VOL connector FetchContent functionality * Add release note for API test updates * Only install testing library if API tests are installed * Fix grammar
This commit is contained in:
+194
-6
@@ -125,6 +125,21 @@ if (HDF5_ENABLE_FORMATTERS)
|
||||
clang_format (HDF5_TEST_h5_api_test_parallel_FORMAT h5_api_test_parallel)
|
||||
endif ()
|
||||
|
||||
if (HDF5_TEST_API_INSTALL)
|
||||
install (
|
||||
TARGETS
|
||||
h5_api_test_parallel
|
||||
EXPORT
|
||||
${HDF5_EXPORTED_TARGETS}
|
||||
DESTINATION
|
||||
${HDF5_INSTALL_BIN_DIR}
|
||||
PERMISSIONS
|
||||
OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
|
||||
COMPONENT
|
||||
tests
|
||||
)
|
||||
endif ()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Build the ported HDF5 test executables
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -203,6 +218,21 @@ foreach (api_test_extra ${HDF5_API_PAR_TESTS_EXTRA})
|
||||
if (HDF5_ENABLE_FORMATTERS)
|
||||
clang_format (HDF5_TEST_h5_api_test_parallel_${api_test_extra}_FORMAT h5_api_test_parallel_${api_test_extra})
|
||||
endif ()
|
||||
|
||||
if (HDF5_TEST_API_INSTALL)
|
||||
install (
|
||||
TARGETS
|
||||
h5_api_test_parallel_${api_test_extra}
|
||||
EXPORT
|
||||
${HDF5_EXPORTED_TARGETS}
|
||||
DESTINATION
|
||||
${HDF5_INSTALL_BIN_DIR}
|
||||
PERMISSIONS
|
||||
OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
|
||||
COMPONENT
|
||||
tests
|
||||
)
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -229,7 +259,7 @@ if (HDF5_TEST_PARALLEL)
|
||||
)
|
||||
endif ()
|
||||
|
||||
set(last_api_test "")
|
||||
set (last_api_test "")
|
||||
foreach (api_test ${HDF5_API_TESTS})
|
||||
add_test (
|
||||
NAME "h5_api_test_parallel_${api_test}"
|
||||
@@ -240,9 +270,9 @@ if (HDF5_TEST_PARALLEL)
|
||||
${HDF5_TEST_API_DRIVER_EXTRA_FLAGS}
|
||||
)
|
||||
|
||||
set_tests_properties("h5_api_test_parallel_${api_test}" PROPERTIES DEPENDS "${last_api_test}")
|
||||
set_tests_properties ("h5_api_test_parallel_${api_test}" PROPERTIES DEPENDS "${last_api_test}")
|
||||
|
||||
set(last_api_test "h5_api_test_parallel_${api_test}")
|
||||
set (last_api_test "h5_api_test_parallel_${api_test}")
|
||||
endforeach ()
|
||||
|
||||
foreach (hdf5_test ${HDF5_API_PAR_TESTS_EXTRA})
|
||||
@@ -267,8 +297,99 @@ if (HDF5_TEST_PARALLEL)
|
||||
${HDF5_TEST_API_DRIVER_EXTRA_FLAGS}
|
||||
)
|
||||
endforeach ()
|
||||
|
||||
# Add tests for each external VOL connector that was built
|
||||
foreach (external_vol_tgt ${HDF5_EXTERNAL_VOL_TARGETS})
|
||||
# Determine whether connector should be tested with parallel tests
|
||||
get_target_property (vol_test_parallel "${external_vol_tgt}" HDF5_VOL_TEST_PARALLEL)
|
||||
if (${vol_test_parallel})
|
||||
# Determine environment variables that need to be set for testing
|
||||
set (vol_test_env "")
|
||||
set (vol_plugin_paths "${CMAKE_BINARY_DIR}/${HDF5_INSTALL_BIN_DIR}")
|
||||
|
||||
get_target_property (vol_test_string "${external_vol_tgt}" HDF5_VOL_NAME)
|
||||
list (APPEND vol_test_env "HDF5_VOL_CONNECTOR=${vol_test_string}")
|
||||
|
||||
get_target_property (vol_lib_targets "${external_vol_tgt}" HDF5_VOL_TARGETS)
|
||||
foreach (lib_target ${vol_lib_targets})
|
||||
get_target_property (lib_target_output_dir "${lib_target}" LIBRARY_OUTPUT_DIRECTORY)
|
||||
if (NOT "${lib_target_output_dir}" STREQUAL "lib_target_output_dir-NOTFOUND"
|
||||
AND NOT "${lib_target_output_dir}" STREQUAL ""
|
||||
AND NOT "${lib_target_output_dir}" STREQUAL "${CMAKE_BINARY_DIR}/${HDF5_INSTALL_BIN_DIR}")
|
||||
set (vol_plugin_paths "${vol_plugin_paths}${CMAKE_SEP}${lib_target_output_dir}")
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
list (APPEND vol_test_env "HDF5_PLUGIN_PATH=${vol_plugin_paths}")
|
||||
|
||||
# Add main API tests
|
||||
set (last_api_test "")
|
||||
foreach (api_test ${HDF5_API_TESTS})
|
||||
add_test (
|
||||
NAME "${external_vol_tgt}-h5_api_test_parallel_${api_test}"
|
||||
COMMAND $<TARGET_FILE:h5_api_test_driver>
|
||||
--server ${HDF5_TEST_API_SERVER}
|
||||
--client $<TARGET_FILE:h5_api_test_parallel> "${api_test}"
|
||||
--serial
|
||||
${HDF5_TEST_API_DRIVER_EXTRA_FLAGS}
|
||||
)
|
||||
set_tests_properties (
|
||||
"${external_vol_tgt}-h5_api_test_parallel_${api_test}"
|
||||
PROPERTIES
|
||||
ENVIRONMENT
|
||||
"${vol_test_env}"
|
||||
WORKING_DIRECTORY
|
||||
"${HDF5_TEST_BINARY_DIR}/${external_vol_tgt}"
|
||||
DEPENDS
|
||||
"${last_api_test}"
|
||||
)
|
||||
|
||||
set (last_api_test "${external_vol_tgt}-h5_api_test_parallel_${api_test}")
|
||||
endforeach ()
|
||||
|
||||
# Add any extra HDF5 tests
|
||||
foreach (hdf5_test ${HDF5_API_PAR_TESTS_EXTRA})
|
||||
add_test (
|
||||
NAME "${external_vol_tgt}-h5_api_test_parallel_${hdf5_test}"
|
||||
COMMAND $<TARGET_FILE:h5_api_test_driver>
|
||||
--server ${HDF5_TEST_API_SERVER}
|
||||
--client $<TARGET_FILE:h5_api_test_parallel_${hdf5_test}>
|
||||
--serial
|
||||
${HDF5_TEST_API_DRIVER_EXTRA_FLAGS}
|
||||
)
|
||||
set_tests_properties (
|
||||
"${external_vol_tgt}-h5_api_test_parallel_${hdf5_test}"
|
||||
PROPERTIES
|
||||
ENVIRONMENT
|
||||
"${vol_test_env}"
|
||||
WORKING_DIRECTORY
|
||||
"${HDF5_TEST_BINARY_DIR}/${external_vol_tgt}"
|
||||
)
|
||||
endforeach ()
|
||||
|
||||
# Hook external tests to same test suite
|
||||
foreach (ext_api_test ${HDF5_API_EXT_PARALLEL_TESTS})
|
||||
add_test (
|
||||
NAME "${external_vol_tgt}-h5_api_ext_test_parallel_${ext_api_test}"
|
||||
COMMAND $<TARGET_FILE:h5_api_test_driver>
|
||||
--server ${HDF5_TEST_API_SERVER}
|
||||
--client $<TARGET_FILE:${ext_api_test}>
|
||||
--serial
|
||||
${HDF5_TEST_API_DRIVER_EXTRA_FLAGS}
|
||||
)
|
||||
set_tests_properties (
|
||||
"${external_vol_tgt}-h5_api_ext_test_parallel_${ext_api_test}"
|
||||
PROPERTIES
|
||||
ENVIRONMENT
|
||||
"${vol_test_env}"
|
||||
WORKING_DIRECTORY
|
||||
"${HDF5_TEST_BINARY_DIR}/${external_vol_tgt}"
|
||||
)
|
||||
endforeach ()
|
||||
endif ()
|
||||
endforeach ()
|
||||
else ()
|
||||
set(last_api_test "")
|
||||
set (last_api_test "")
|
||||
foreach (api_test ${HDF5_API_TESTS})
|
||||
add_test (
|
||||
NAME "h5_api_test_parallel_${api_test}"
|
||||
@@ -277,9 +398,9 @@ if (HDF5_TEST_PARALLEL)
|
||||
${MPIEXEC_POSTFLAGS}
|
||||
)
|
||||
|
||||
set_tests_properties("h5_api_test_parallel_${api_test}" PROPERTIES DEPENDS "${last_api_test}")
|
||||
set_tests_properties ("h5_api_test_parallel_${api_test}" PROPERTIES DEPENDS "${last_api_test}")
|
||||
|
||||
set(last_api_test "h5_api_test_parallel_${api_test}")
|
||||
set (last_api_test "h5_api_test_parallel_${api_test}")
|
||||
endforeach ()
|
||||
|
||||
foreach (hdf5_test ${HDF5_API_PAR_TESTS_EXTRA})
|
||||
@@ -290,5 +411,72 @@ if (HDF5_TEST_PARALLEL)
|
||||
${MPIEXEC_POSTFLAGS}
|
||||
)
|
||||
endforeach ()
|
||||
|
||||
# Add tests for each external VOL connector that was built
|
||||
foreach (external_vol_tgt ${HDF5_EXTERNAL_VOL_TARGETS})
|
||||
# Determine whether connector should be tested with parallel tests
|
||||
get_target_property (vol_test_parallel "${external_vol_tgt}" HDF5_VOL_TEST_PARALLEL)
|
||||
if (${vol_test_parallel})
|
||||
# Determine environment variables that need to be set for testing
|
||||
set (vol_test_env "")
|
||||
set (vol_plugin_paths "${CMAKE_BINARY_DIR}/${HDF5_INSTALL_BIN_DIR}")
|
||||
|
||||
get_target_property (vol_test_string "${external_vol_tgt}" HDF5_VOL_NAME)
|
||||
list (APPEND vol_test_env "HDF5_VOL_CONNECTOR=${vol_test_string}")
|
||||
|
||||
get_target_property (vol_lib_targets "${external_vol_tgt}" HDF5_VOL_TARGETS)
|
||||
foreach (lib_target ${vol_lib_targets})
|
||||
get_target_property (lib_target_output_dir "${lib_target}" LIBRARY_OUTPUT_DIRECTORY)
|
||||
if (NOT "${lib_target_output_dir}" STREQUAL "lib_target_output_dir-NOTFOUND"
|
||||
AND NOT "${lib_target_output_dir}" STREQUAL ""
|
||||
AND NOT "${lib_target_output_dir}" STREQUAL "${CMAKE_BINARY_DIR}/${HDF5_INSTALL_BIN_DIR}")
|
||||
set (vol_plugin_paths "${vol_plugin_paths}${CMAKE_SEP}${lib_target_output_dir}")
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
list (APPEND vol_test_env "HDF5_PLUGIN_PATH=${vol_plugin_paths}")
|
||||
|
||||
# Add main API tests
|
||||
set (last_api_test "")
|
||||
foreach (api_test ${HDF5_API_TESTS})
|
||||
add_test (
|
||||
NAME "${external_vol_tgt}-h5_api_test_parallel_${api_test}"
|
||||
COMMAND ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS}
|
||||
${MPIEXEC_PREFLAGS} $<TARGET_FILE:h5_api_test_parallel> "${api_test}"
|
||||
${MPIEXEC_POSTFLAGS}
|
||||
)
|
||||
set_tests_properties (
|
||||
"${external_vol_tgt}-h5_api_test_parallel_${api_test}"
|
||||
PROPERTIES
|
||||
ENVIRONMENT
|
||||
"${vol_test_env}"
|
||||
WORKING_DIRECTORY
|
||||
"${HDF5_TEST_BINARY_DIR}/${external_vol_tgt}"
|
||||
DEPENDS
|
||||
"${last_api_test}"
|
||||
)
|
||||
|
||||
set (last_api_test "${external_vol_tgt}-h5_api_test_parallel_${api_test}")
|
||||
endforeach ()
|
||||
|
||||
# Add any extra HDF5 tests
|
||||
foreach (hdf5_test ${HDF5_API_PAR_TESTS_EXTRA})
|
||||
add_test (
|
||||
NAME "${external_vol_tgt}-h5_api_test_parallel_${hdf5_test}"
|
||||
COMMAND ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS}
|
||||
${MPIEXEC_PREFLAGS} $<TARGET_FILE:h5_api_test_parallel_${hdf5_test}>
|
||||
${MPIEXEC_POSTFLAGS}
|
||||
)
|
||||
set_tests_properties (
|
||||
"${external_vol_tgt}-h5_api_test_parallel_${hdf5_test}"
|
||||
PROPERTIES
|
||||
ENVIRONMENT
|
||||
"${vol_test_env}"
|
||||
WORKING_DIRECTORY
|
||||
"${HDF5_TEST_BINARY_DIR}/${external_vol_tgt}"
|
||||
)
|
||||
endforeach ()
|
||||
endif ()
|
||||
endforeach ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
@@ -77,7 +77,7 @@ test_one_dataset_io(void)
|
||||
int *write_buf = NULL;
|
||||
int *read_buf = NULL;
|
||||
|
||||
TESTING_MULTIPART("single dataset I/O")
|
||||
TESTING_MULTIPART("single dataset I/O");
|
||||
|
||||
/* Make sure the connector supports the API functions being tested */
|
||||
if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) ||
|
||||
@@ -442,7 +442,7 @@ test_multi_dataset_io(void)
|
||||
int *write_buf = NULL;
|
||||
int *read_buf = NULL;
|
||||
|
||||
TESTING_MULTIPART("multi dataset I/O")
|
||||
TESTING_MULTIPART("multi dataset I/O");
|
||||
|
||||
/* Make sure the connector supports the API functions being tested */
|
||||
if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) ||
|
||||
@@ -768,7 +768,7 @@ test_multi_file_dataset_io(void)
|
||||
int *write_buf = NULL;
|
||||
int *read_buf = NULL;
|
||||
|
||||
TESTING_MULTIPART("multi file dataset I/O")
|
||||
TESTING_MULTIPART("multi file dataset I/O");
|
||||
|
||||
/* Make sure the connector supports the API functions being tested */
|
||||
if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) ||
|
||||
@@ -1191,7 +1191,7 @@ test_multi_file_grp_dset_io(void)
|
||||
int *write_buf = NULL;
|
||||
int *read_buf = NULL;
|
||||
|
||||
TESTING_MULTIPART("multi file dataset I/O with groups")
|
||||
TESTING_MULTIPART("multi file dataset I/O with groups");
|
||||
|
||||
/* Make sure the connector supports the API functions being tested */
|
||||
if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) ||
|
||||
@@ -2024,7 +2024,7 @@ test_attribute_exists(void)
|
||||
if (exists1)
|
||||
FAIL_PUTS_ERROR(" H5Aexists returned TRUE for an attribute that should not exist")
|
||||
if (!exists2)
|
||||
FAIL_PUTS_ERROR(" H5Aexists returned FALSE for an attribute that should exist")
|
||||
FAIL_PUTS_ERROR(" H5Aexists returned FALSE for an attribute that should exist");
|
||||
|
||||
/* Close */
|
||||
if (H5Aclose_async(attr_id, es_id) < 0)
|
||||
@@ -2913,11 +2913,10 @@ test_group(void)
|
||||
|
||||
/* Make sure the connector supports the API functions being tested */
|
||||
if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) ||
|
||||
!(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_MORE) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) ||
|
||||
!(vol_cap_flags_g & H5VL_CAP_FLAG_CREATION_ORDER)) {
|
||||
!(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_MORE) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) {
|
||||
if (MAINPROCESS) {
|
||||
SKIPPED();
|
||||
HDprintf(" API functions for basic file, group, group more, creation order, or flush aren't "
|
||||
HDprintf(" API functions for basic file, group, group more or flush aren't "
|
||||
"supported with this connector\n");
|
||||
}
|
||||
|
||||
@@ -2931,9 +2930,11 @@ test_group(void)
|
||||
if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
/* Track creation order */
|
||||
if (H5Pset_link_creation_order(gcpl_id, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) < 0)
|
||||
TEST_ERROR;
|
||||
if (vol_cap_flags_g & H5VL_CAP_FLAG_CREATION_ORDER) {
|
||||
/* Track creation order */
|
||||
if (H5Pset_link_creation_order(gcpl_id, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) < 0)
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
/* Create event stack */
|
||||
if ((es_id = H5EScreate()) < 0)
|
||||
@@ -2997,10 +2998,12 @@ test_group(void)
|
||||
if (H5Gget_info_async(group_id, &info1, es_id) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
/* Test H5Gget_info_by_idx_async */
|
||||
if (H5Gget_info_by_idx_async(parent_group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, 1, &info2,
|
||||
H5P_DEFAULT, es_id) < 0)
|
||||
TEST_ERROR;
|
||||
if (vol_cap_flags_g & H5VL_CAP_FLAG_CREATION_ORDER) {
|
||||
/* Test H5Gget_info_by_idx_async */
|
||||
if (H5Gget_info_by_idx_async(parent_group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, 1, &info2,
|
||||
H5P_DEFAULT, es_id) < 0)
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
/* Test H5Gget_info_by_name_async */
|
||||
if (H5Gget_info_by_name_async(parent_group_id, "group3", &info3, H5P_DEFAULT, es_id) < 0)
|
||||
@@ -3014,11 +3017,13 @@ test_group(void)
|
||||
|
||||
/* Verify group infos */
|
||||
if (info1.nlinks != 0)
|
||||
FAIL_PUTS_ERROR(" incorrect number of links")
|
||||
if (info2.nlinks != 1)
|
||||
FAIL_PUTS_ERROR(" incorrect number of links")
|
||||
FAIL_PUTS_ERROR(" incorrect number of links");
|
||||
if (vol_cap_flags_g & H5VL_CAP_FLAG_CREATION_ORDER) {
|
||||
if (info2.nlinks != 1)
|
||||
FAIL_PUTS_ERROR(" incorrect number of links");
|
||||
}
|
||||
if (info3.nlinks != 2)
|
||||
FAIL_PUTS_ERROR(" incorrect number of links")
|
||||
FAIL_PUTS_ERROR(" incorrect number of links");
|
||||
|
||||
/* Close */
|
||||
if (H5Gclose_async(group_id, es_id) < 0)
|
||||
@@ -3271,17 +3276,17 @@ test_link(void)
|
||||
|
||||
/* Check if existence returns were correct */
|
||||
if (!existsh1)
|
||||
FAIL_PUTS_ERROR(" link exists returned FALSE for link that should exist")
|
||||
FAIL_PUTS_ERROR(" link exists returned FALSE for link that should exist");
|
||||
if (!existss1)
|
||||
FAIL_PUTS_ERROR(" link exists returned FALSE for link that should exist")
|
||||
FAIL_PUTS_ERROR(" link exists returned FALSE for link that should exist");
|
||||
if (!existsh2)
|
||||
FAIL_PUTS_ERROR(" link exists returned FALSE for link that should exist")
|
||||
FAIL_PUTS_ERROR(" link exists returned FALSE for link that should exist");
|
||||
if (existss2)
|
||||
FAIL_PUTS_ERROR(" link exists returned TRUE for link that should not exist")
|
||||
FAIL_PUTS_ERROR(" link exists returned TRUE for link that should not exist");
|
||||
if (existsh3)
|
||||
FAIL_PUTS_ERROR(" link exists returned TRUE for link that should not exist")
|
||||
FAIL_PUTS_ERROR(" link exists returned TRUE for link that should not exist");
|
||||
if (existsh3)
|
||||
FAIL_PUTS_ERROR(" link exists returned TRUE for link that should not exist")
|
||||
FAIL_PUTS_ERROR(" link exists returned TRUE for link that should not exist");
|
||||
|
||||
/* Close */
|
||||
if (H5Gclose_async(parent_group_id, es_id) < 0)
|
||||
|
||||
@@ -172,14 +172,34 @@ error:
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
const char *vol_connector_string;
|
||||
const char *vol_connector_name;
|
||||
unsigned seed;
|
||||
hid_t fapl_id = H5I_INVALID_HID;
|
||||
hid_t fapl_id = H5I_INVALID_HID;
|
||||
hid_t default_con_id = H5I_INVALID_HID;
|
||||
hid_t registered_con_id = H5I_INVALID_HID;
|
||||
char *vol_connector_string_copy = NULL;
|
||||
char *vol_connector_info = NULL;
|
||||
int required = MPI_THREAD_MULTIPLE;
|
||||
int provided;
|
||||
|
||||
/*
|
||||
* Attempt to initialize with MPI_THREAD_MULTIPLE for VOL connectors
|
||||
* that require that level of threading support in MPI
|
||||
*/
|
||||
if (MPI_SUCCESS != MPI_Init_thread(&argc, &argv, required, &provided)) {
|
||||
HDfprintf(stderr, "MPI_Init_thread failed\n");
|
||||
HDexit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
MPI_Init(&argc, &argv);
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
|
||||
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
|
||||
|
||||
if (provided < required) {
|
||||
if (MAINPROCESS)
|
||||
HDprintf("** INFO: couldn't initialize with MPI_THREAD_MULTIPLE threading support **\n");
|
||||
}
|
||||
|
||||
/* Simple argument checking, TODO can improve that later */
|
||||
if (argc > 1) {
|
||||
enum H5_api_test_type i = H5_api_test_name_to_type(argv[1]);
|
||||
@@ -209,7 +229,7 @@ main(int argc, char **argv)
|
||||
if (mpi_size > 1) {
|
||||
if (MPI_SUCCESS != MPI_Bcast(&seed, 1, MPI_UNSIGNED, 0, MPI_COMM_WORLD)) {
|
||||
if (MAINPROCESS)
|
||||
HDprintf("Couldn't broadcast test seed\n");
|
||||
HDfprintf(stderr, "Couldn't broadcast test seed\n");
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
@@ -222,14 +242,45 @@ main(int argc, char **argv)
|
||||
HDsnprintf(H5_api_test_parallel_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix,
|
||||
PARALLEL_TEST_FILE_NAME);
|
||||
|
||||
if (NULL == (vol_connector_name = HDgetenv(HDF5_VOL_CONNECTOR))) {
|
||||
if (NULL == (vol_connector_string = HDgetenv(HDF5_VOL_CONNECTOR))) {
|
||||
if (MAINPROCESS)
|
||||
HDprintf("No VOL connector selected; using native VOL connector\n");
|
||||
vol_connector_name = "native";
|
||||
vol_connector_info = NULL;
|
||||
}
|
||||
else {
|
||||
char *token = NULL;
|
||||
|
||||
BEGIN_INDEPENDENT_OP(copy_connector_string)
|
||||
{
|
||||
if (NULL == (vol_connector_string_copy = HDstrdup(vol_connector_string))) {
|
||||
if (MAINPROCESS)
|
||||
HDfprintf(stderr, "Unable to copy VOL connector string\n");
|
||||
INDEPENDENT_OP_ERROR(copy_connector_string);
|
||||
}
|
||||
}
|
||||
END_INDEPENDENT_OP(copy_connector_string);
|
||||
|
||||
BEGIN_INDEPENDENT_OP(get_connector_name)
|
||||
{
|
||||
if (NULL == (token = HDstrtok(vol_connector_string_copy, " "))) {
|
||||
if (MAINPROCESS)
|
||||
HDfprintf(stderr, "Error while parsing VOL connector string\n");
|
||||
INDEPENDENT_OP_ERROR(get_connector_name);
|
||||
}
|
||||
}
|
||||
END_INDEPENDENT_OP(get_connector_name);
|
||||
|
||||
vol_connector_name = token;
|
||||
|
||||
if (NULL != (token = HDstrtok(NULL, " "))) {
|
||||
vol_connector_info = token;
|
||||
}
|
||||
}
|
||||
|
||||
if (MAINPROCESS) {
|
||||
HDprintf("Running parallel API tests with VOL connector '%s'\n\n", vol_connector_name);
|
||||
HDprintf("Running parallel API tests with VOL connector '%s' and info string '%s'\n\n",
|
||||
vol_connector_name, vol_connector_info ? vol_connector_info : "");
|
||||
HDprintf("Test parameters:\n");
|
||||
HDprintf(" - Test file name: '%s'\n", H5_api_test_parallel_filename);
|
||||
HDprintf(" - Number of MPI ranks: %d\n", mpi_size);
|
||||
@@ -237,17 +288,74 @@ main(int argc, char **argv)
|
||||
HDprintf("\n\n");
|
||||
}
|
||||
|
||||
BEGIN_INDEPENDENT_OP(create_fapl)
|
||||
{
|
||||
if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, FALSE)) < 0) {
|
||||
if (MAINPROCESS)
|
||||
HDfprintf(stderr, "Unable to create FAPL\n");
|
||||
INDEPENDENT_OP_ERROR(create_fapl);
|
||||
}
|
||||
}
|
||||
END_INDEPENDENT_OP(create_fapl);
|
||||
|
||||
BEGIN_INDEPENDENT_OP(check_vol_register)
|
||||
{
|
||||
/*
|
||||
* If using a VOL connector other than the native
|
||||
* connector, check whether the VOL connector was
|
||||
* successfully registered before running the tests.
|
||||
* Otherwise, HDF5 will default to running the tests
|
||||
* with the native connector, which could be misleading.
|
||||
*/
|
||||
if (0 != HDstrcmp(vol_connector_name, "native")) {
|
||||
htri_t is_registered;
|
||||
|
||||
if ((is_registered = H5VLis_connector_registered_by_name(vol_connector_name)) < 0) {
|
||||
if (MAINPROCESS)
|
||||
HDfprintf(stderr, "Unable to determine if VOL connector is registered\n");
|
||||
INDEPENDENT_OP_ERROR(check_vol_register);
|
||||
}
|
||||
|
||||
if (!is_registered) {
|
||||
if (MAINPROCESS)
|
||||
HDfprintf(stderr, "Specified VOL connector '%s' wasn't correctly registered!\n",
|
||||
vol_connector_name);
|
||||
INDEPENDENT_OP_ERROR(check_vol_register);
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* If the connector was successfully registered, check that
|
||||
* the connector ID set on the default FAPL matches the ID
|
||||
* for the registered connector before running the tests.
|
||||
*/
|
||||
if (H5Pget_vol_id(fapl_id, &default_con_id) < 0) {
|
||||
if (MAINPROCESS)
|
||||
HDfprintf(stderr, "Couldn't retrieve ID of VOL connector set on default FAPL\n");
|
||||
INDEPENDENT_OP_ERROR(check_vol_register);
|
||||
}
|
||||
|
||||
if ((registered_con_id = H5VLget_connector_id_by_name(vol_connector_name)) < 0) {
|
||||
if (MAINPROCESS)
|
||||
HDfprintf(stderr, "Couldn't retrieve ID of registered VOL connector\n");
|
||||
INDEPENDENT_OP_ERROR(check_vol_register);
|
||||
}
|
||||
|
||||
if (default_con_id != registered_con_id) {
|
||||
if (MAINPROCESS)
|
||||
HDfprintf(stderr,
|
||||
"VOL connector set on default FAPL didn't match specified VOL connector\n");
|
||||
INDEPENDENT_OP_ERROR(check_vol_register);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
END_INDEPENDENT_OP(check_vol_register);
|
||||
|
||||
/* Retrieve the VOL cap flags - work around an HDF5
|
||||
* library issue by creating a FAPL
|
||||
*/
|
||||
BEGIN_INDEPENDENT_OP(get_capability_flags)
|
||||
{
|
||||
if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, FALSE)) < 0) {
|
||||
if (MAINPROCESS)
|
||||
HDfprintf(stderr, "Unable to create FAPL\n");
|
||||
INDEPENDENT_OP_ERROR(get_capability_flags);
|
||||
}
|
||||
|
||||
vol_cap_flags_g = H5VL_CAP_FLAG_NONE;
|
||||
if (H5Pget_vol_cap_flags(fapl_id, &vol_cap_flags_g) < 0) {
|
||||
if (MAINPROCESS)
|
||||
@@ -265,7 +373,8 @@ main(int argc, char **argv)
|
||||
{
|
||||
if (MAINPROCESS) {
|
||||
if (create_test_container(H5_api_test_parallel_filename, vol_cap_flags_g) < 0) {
|
||||
HDprintf(" failed to create testing container file '%s'\n", H5_api_test_parallel_filename);
|
||||
HDfprintf(stderr, " failed to create testing container file '%s'\n",
|
||||
H5_api_test_parallel_filename);
|
||||
INDEPENDENT_OP_ERROR(create_test_container);
|
||||
}
|
||||
}
|
||||
@@ -314,9 +423,19 @@ main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (default_con_id >= 0 && H5VLclose(default_con_id) < 0) {
|
||||
if (MAINPROCESS)
|
||||
HDfprintf(stderr, " failed to close VOL connector ID\n");
|
||||
}
|
||||
|
||||
if (registered_con_id >= 0 && H5VLclose(registered_con_id) < 0) {
|
||||
if (MAINPROCESS)
|
||||
HDfprintf(stderr, " failed to close VOL connector ID\n");
|
||||
}
|
||||
|
||||
if (fapl_id >= 0 && H5Pclose(fapl_id) < 0) {
|
||||
if (MAINPROCESS)
|
||||
HDprintf(" failed to close MPI FAPL\n");
|
||||
HDfprintf(stderr, " failed to close MPI FAPL\n");
|
||||
}
|
||||
|
||||
H5close();
|
||||
@@ -326,8 +445,12 @@ main(int argc, char **argv)
|
||||
HDexit(EXIT_SUCCESS);
|
||||
|
||||
error:
|
||||
HDfree(vol_connector_string_copy);
|
||||
|
||||
H5E_BEGIN_TRY
|
||||
{
|
||||
H5VLclose(default_con_id);
|
||||
H5VLclose(registered_con_id);
|
||||
H5Pclose(fapl_id);
|
||||
}
|
||||
H5E_END_TRY;
|
||||
|
||||
@@ -3623,6 +3623,19 @@ test_no_collective_cause_mode(int selection_mode)
|
||||
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
|
||||
|
||||
/* Make sure the connector supports the API functions being tested */
|
||||
if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) ||
|
||||
!(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) {
|
||||
if (MAINPROCESS) {
|
||||
puts("SKIPPED");
|
||||
printf(" API functions for basic file, dataset, or dataset more aren't supported with this "
|
||||
"connector\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
MPI_Barrier(MPI_COMM_WORLD);
|
||||
|
||||
HDassert(mpi_size >= 1);
|
||||
|
||||
@@ -994,6 +994,18 @@ test_delete(void)
|
||||
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
|
||||
|
||||
/* Make sure the connector supports the API functions being tested */
|
||||
if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_MORE)) {
|
||||
if (MAINPROCESS) {
|
||||
puts("SKIPPED");
|
||||
printf(" API functions for basic file or file more aren't supported with this "
|
||||
"connector\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* setup file access plist */
|
||||
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
|
||||
VRFY((fapl_id != H5I_INVALID_HID), "H5Pcreate");
|
||||
|
||||
@@ -85,6 +85,20 @@ file_image_daisy_chain_test(void)
|
||||
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
|
||||
|
||||
/* Make sure the connector supports the API functions being tested */
|
||||
if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_MORE) ||
|
||||
!(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE) ||
|
||||
!(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) {
|
||||
if (MAINPROCESS) {
|
||||
puts("SKIPPED");
|
||||
printf(" API functions for basic file, dataset, or dataset more aren't supported with this "
|
||||
"connector\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* setup file name */
|
||||
HDsnprintf(file_name, 1024, "file_image_daisy_chain_test_%05d.h5", (int)mpi_rank);
|
||||
|
||||
|
||||
@@ -1037,6 +1037,19 @@ independent_group_read(void)
|
||||
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
|
||||
|
||||
/* Make sure the connector supports the API functions being tested */
|
||||
if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) ||
|
||||
!(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) {
|
||||
if (MAINPROCESS) {
|
||||
puts("SKIPPED");
|
||||
printf(
|
||||
" API functions for basic file, group, or dataset aren't supported with this connector\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type);
|
||||
H5Pset_all_coll_metadata_ops(plist, FALSE);
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
#include "H5private.h"
|
||||
#include "testpar.h"
|
||||
#include "H5_api_tests_disabled.h"
|
||||
|
||||
/*
|
||||
* Define parameters for various tests since we do not have access to
|
||||
|
||||
Reference in New Issue
Block a user