summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt229
-rw-r--r--test/CMakePassthroughVOLTests.cmake156
-rw-r--r--test/CMakeTests.cmake412
-rw-r--r--test/CMakeVFDTests.cmake200
-rw-r--r--test/fill18.h5bin0 -> 3479 bytes
-rw-r--r--test/flushrefreshTest.cmake4
-rw-r--r--test/null_vol_connector.c7
-rw-r--r--test/objcopy.c37
-rw-r--r--test/ohdr.c352
-rw-r--r--test/tattr.c109
-rw-r--r--test/tfile.c191
-rw-r--r--test/tselect.c748
-rw-r--r--test/vds.c720
-rw-r--r--test/vol.c73
14 files changed, 2133 insertions, 1105 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index c7888b8..15d10a7 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -25,24 +25,27 @@ set (TEST_LIB_HEADERS
${HDF5_TEST_SOURCE_DIR}/swmr_common.h
)
-add_library (${HDF5_TEST_LIB_TARGET} STATIC ${TEST_LIB_SOURCES} ${TEST_LIB_HEADERS})
-target_include_directories(${HDF5_TEST_LIB_TARGET}
- PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
- INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
-)
-TARGET_C_PROPERTIES (${HDF5_TEST_LIB_TARGET} STATIC)
-target_link_libraries (${HDF5_TEST_LIB_TARGET}
- PUBLIC ${LINK_LIBS} ${HDF5_LIB_TARGET}
- PRIVATE $<$<PLATFORM_ID:Windows>:ws2_32.lib>
-)
-if (MINGW)
- target_link_libraries (${HDF5_TEST_LIB_TARGET} PRIVATE "wsock32.lib")
+if (NOT ONLY_SHARED_LIBS)
+ add_library (${HDF5_TEST_LIB_TARGET} STATIC ${TEST_LIB_SOURCES} ${TEST_LIB_HEADERS})
+ target_include_directories (${HDF5_TEST_LIB_TARGET}
+ PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ )
+ TARGET_C_PROPERTIES (${HDF5_TEST_LIB_TARGET} STATIC)
+ target_link_libraries (${HDF5_TEST_LIB_TARGET}
+ PUBLIC ${LINK_LIBS} ${HDF5_LIB_TARGET}
+ PRIVATE $<$<PLATFORM_ID:Windows>:ws2_32.lib>
+ )
+ if (MINGW)
+ target_link_libraries (${HDF5_TEST_LIB_TARGET} PRIVATE "wsock32.lib")
+ endif ()
+ H5_SET_LIB_OPTIONS (${HDF5_TEST_LIB_TARGET} ${HDF5_TEST_LIB_NAME} STATIC 0)
+ set_target_properties (${HDF5_TEST_LIB_TARGET} PROPERTIES FOLDER libraries/test)
endif ()
-H5_SET_LIB_OPTIONS (${HDF5_TEST_LIB_TARGET} ${HDF5_TEST_LIB_NAME} STATIC 0)
if (BUILD_SHARED_LIBS)
add_library (${HDF5_TEST_LIBSH_TARGET} SHARED ${TEST_LIB_SOURCES} ${TEST_LIB_HEADERS})
- target_include_directories(${HDF5_TEST_LIBSH_TARGET}
+ target_include_directories (${HDF5_TEST_LIBSH_TARGET}
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
@@ -87,9 +90,9 @@ if (BUILD_SHARED_LIBS)
set (HDF5_TEST_PLUGIN_TARGET ${HDF5_TEST_PLUGIN_CORENAME})
add_library (${HDF5_TEST_PLUGIN_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${plugin_name}.c)
- target_include_directories(${HDF5_TEST_PLUGIN_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (${HDF5_TEST_PLUGIN_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_TARGET} SHARED)
- target_link_libraries (${HDF5_TEST_PLUGIN_TARGET} PUBLIC ${HDF5_TEST_LIB_TARGET})
+ target_link_libraries (${HDF5_TEST_PLUGIN_TARGET} PUBLIC ${HDF5_TEST_LIBSH_TARGET})
H5_SET_LIB_OPTIONS (${HDF5_TEST_PLUGIN_TARGET} ${HDF5_TEST_PLUGIN_NAME} SHARED "LIB")
set_target_properties (${HDF5_TEST_PLUGIN_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN)
@@ -112,9 +115,9 @@ if (BUILD_SHARED_LIBS)
set (HDF5_TEST_PLUGIN_TARGET ${HDF5_TEST_PLUGIN_CORENAME})
add_library (${HDF5_TEST_PLUGIN_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${plugin_name}.c)
- target_include_directories(${HDF5_TEST_PLUGIN_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (${HDF5_TEST_PLUGIN_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_TARGET} SHARED)
- target_link_libraries (${HDF5_TEST_PLUGIN_TARGET} PUBLIC ${HDF5_TEST_LIB_TARGET})
+ target_link_libraries (${HDF5_TEST_PLUGIN_TARGET} PUBLIC ${HDF5_TEST_LIBSH_TARGET})
H5_SET_LIB_OPTIONS (${HDF5_TEST_PLUGIN_TARGET} ${HDF5_TEST_PLUGIN_NAME} SHARED "LIB")
set_target_properties (${HDF5_TEST_PLUGIN_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN)
@@ -149,9 +152,9 @@ if (BUILD_SHARED_LIBS)
set (HDF5_VOL_PLUGIN_LIB_TARGET ${HDF5_VOL_PLUGIN_LIB_CORENAME})
add_library (${HDF5_VOL_PLUGIN_LIB_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${vol_lib}.c)
- target_include_directories(${HDF5_VOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (${HDF5_VOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (${HDF5_VOL_PLUGIN_LIB_TARGET} SHARED)
- target_link_libraries (${HDF5_VOL_PLUGIN_LIB_TARGET} PUBLIC ${HDF5_TEST_LIB_TARGET})
+ target_link_libraries (${HDF5_VOL_PLUGIN_LIB_TARGET} PUBLIC ${HDF5_TEST_LIBSH_TARGET})
H5_SET_LIB_OPTIONS (${HDF5_VOL_PLUGIN_LIB_TARGET} ${HDF5_VOL_PLUGIN_LIB_NAME} SHARED "LIB")
set_target_properties (${HDF5_VOL_PLUGIN_LIB_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN)
@@ -282,17 +285,15 @@ set (H5_TESTS
macro (ADD_H5_EXE file)
add_executable (${file} ${HDF5_TEST_SOURCE_DIR}/${file}.c)
- target_include_directories(${file} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (${file} STATIC)
- target_link_libraries (${file} PRIVATE ${HDF5_TEST_LIB_TARGET})
- set_target_properties (${file} PROPERTIES FOLDER test)
- if (BUILD_SHARED_LIBS)
- add_executable (${file}-shared ${HDF5_TEST_SOURCE_DIR}/${file}.c)
- target_include_directories(${file}-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (${file}-shared SHARED)
- target_link_libraries (${file}-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET})
- set_target_properties (${file}-shared PROPERTIES FOLDER test)
+ target_include_directories (${file} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (${file} STATIC)
+ target_link_libraries (${file} PRIVATE ${HDF5_TEST_LIB_TARGET})
+ else ()
+ TARGET_C_PROPERTIES (${file} SHARED)
+ target_link_libraries (${file} PRIVATE ${HDF5_TEST_LIBSH_TARGET})
endif ()
+ set_target_properties (${file} PROPERTIES FOLDER test)
endmacro ()
set (H5_TESTS_MULTIPLE
@@ -314,66 +315,58 @@ endforeach ()
######### Also special handling of link libs #############
#-- Adding test for direct_chunk
add_executable (direct_chunk ${HDF5_TEST_SOURCE_DIR}/direct_chunk.c)
-target_include_directories(direct_chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (direct_chunk STATIC)
-target_link_libraries (direct_chunk PRIVATE ${HDF5_TEST_LIB_TARGET} ${LINK_COMP_LIBS})
-set_target_properties (direct_chunk PROPERTIES FOLDER test)
-if (BUILD_SHARED_LIBS)
- add_executable (direct_chunk-shared ${HDF5_TEST_SOURCE_DIR}/direct_chunk.c)
- target_include_directories(direct_chunk-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (direct_chunk-shared SHARED)
- target_link_libraries (direct_chunk-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${LINK_COMP_LIBS})
- set_target_properties (direct_chunk-shared PROPERTIES FOLDER test)
+target_include_directories (direct_chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (direct_chunk STATIC)
+ target_link_libraries (direct_chunk PRIVATE ${HDF5_TEST_LIB_TARGET} ${LINK_COMP_LIBS})
+else ()
+ TARGET_C_PROPERTIES (direct_chunk SHARED)
+ target_link_libraries (direct_chunk PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${LINK_COMP_LIBS})
endif ()
+set_target_properties (direct_chunk PROPERTIES FOLDER test)
######### Special handling for multiple sources #############
#-- Adding test for testhdf5
add_executable (testhdf5 ${testhdf5_SOURCES})
-target_include_directories(testhdf5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (testhdf5 STATIC)
-target_link_libraries (testhdf5 PRIVATE ${HDF5_TEST_LIB_TARGET})
-set_target_properties (testhdf5 PROPERTIES FOLDER test)
-if (BUILD_SHARED_LIBS)
- add_executable (testhdf5-shared ${testhdf5_SOURCES})
- target_include_directories(testhdf5-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (testhdf5-shared SHARED)
- target_link_libraries (testhdf5-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET})
- set_target_properties (testhdf5-shared PROPERTIES FOLDER test)
+target_include_directories (testhdf5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (testhdf5 STATIC)
+ target_link_libraries (testhdf5 PRIVATE ${HDF5_TEST_LIB_TARGET})
+else ()
+ TARGET_C_PROPERTIES (testhdf5 SHARED)
+ target_link_libraries (testhdf5 PRIVATE ${HDF5_TEST_LIBSH_TARGET})
endif ()
+set_target_properties (testhdf5 PROPERTIES FOLDER test)
#-- Adding test for cache_image
add_executable (cache_image ${cache_image_SOURCES})
-target_include_directories(cache_image PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (cache_image STATIC)
-target_link_libraries (cache_image PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
-set_target_properties (cache_image PROPERTIES FOLDER test)
-if (BUILD_SHARED_LIBS)
- add_executable (cache_image-shared ${cache_image_SOURCES})
- target_include_directories(cache_image-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (cache_image-shared SHARED)
- target_link_libraries (cache_image-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
- set_target_properties (cache_image-shared PROPERTIES FOLDER test)
+target_include_directories (cache_image PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (cache_image STATIC)
+ target_link_libraries (cache_image PRIVATE ${HDF5_TEST_LIB_TARGET})
+else ()
+ TARGET_C_PROPERTIES (cache_image SHARED)
+ target_link_libraries (cache_image PRIVATE ${HDF5_TEST_LIBSH_TARGET})
endif ()
+set_target_properties (cache_image PROPERTIES FOLDER test)
#-- Adding test for ttsafe
add_executable (ttsafe ${ttsafe_SOURCES})
-target_include_directories(ttsafe PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (ttsafe STATIC)
-target_link_libraries (ttsafe PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
-if (NOT WIN32)
- target_link_libraries (ttsafe
- PRIVATE $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads>
- )
+target_include_directories (ttsafe PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (ttsafe STATIC)
+ target_link_libraries (ttsafe PRIVATE ${HDF5_TEST_LIB_TARGET})
+ if (NOT WIN32)
+ target_link_libraries (ttsafe
+ PRIVATE $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads>
+ )
+ endif ()
+else ()
+ TARGET_C_PROPERTIES (ttsafe SHARED)
+ target_link_libraries (ttsafe PRIVATE ${HDF5_TEST_LIBSH_TARGET} $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads>)
endif ()
set_target_properties (ttsafe PROPERTIES FOLDER test)
-if (BUILD_SHARED_LIBS)
- add_executable (ttsafe-shared ${ttsafe_SOURCES})
- target_include_directories(ttsafe-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (ttsafe-shared SHARED)
- target_link_libraries (ttsafe-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads>)
- set_target_properties (ttsafe-shared PROPERTIES FOLDER test)
-endif ()
##############################################################################
### A D D I T I O N A L T E S T S ###
@@ -443,43 +436,33 @@ endforeach ()
# This has to be copied to the test directory for execve() to find it
# and it can't be renamed (i.e., no <foo>-shared).
add_executable (accum_swmr_reader ${HDF5_TEST_SOURCE_DIR}/accum_swmr_reader.c)
-target_include_directories(accum_swmr_reader PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (accum_swmr_reader STATIC)
-target_link_libraries (accum_swmr_reader PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+target_include_directories (accum_swmr_reader PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (accum_swmr_reader STATIC)
+ target_link_libraries (accum_swmr_reader PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
+else ()
+ TARGET_C_PROPERTIES (accum_swmr_reader SHARED)
+ target_link_libraries (accum_swmr_reader PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+endif ()
set_target_properties (accum_swmr_reader PROPERTIES FOLDER test)
#-- Set accum dependencies
set_target_properties (accum PROPERTIES DEPENDS accum_swmr_reader)
-if (BUILD_SHARED_LIBS)
- set_target_properties (accum-shared PROPERTIES DEPENDS accum_swmr_reader)
-endif ()
##############################################################################
### P L U G I N T E S T S
##############################################################################
if (BUILD_SHARED_LIBS)
add_executable (filter_plugin ${HDF5_TEST_SOURCE_DIR}/filter_plugin.c)
- target_include_directories(filter_plugin PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (filter_plugin PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (filter_plugin SHARED)
- target_link_libraries (filter_plugin PRIVATE ${HDF5_TEST_LIB_TARGET})
+ target_link_libraries (filter_plugin PRIVATE ${HDF5_TEST_LIBSH_TARGET})
set_target_properties (filter_plugin PROPERTIES FOLDER test)
add_executable (vol_plugin ${HDF5_TEST_SOURCE_DIR}/vol_plugin.c)
- target_include_directories(vol_plugin PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (vol_plugin PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (vol_plugin SHARED)
- target_link_libraries (vol_plugin PRIVATE ${HDF5_TEST_LIB_TARGET})
- set_target_properties (vol_plugin PROPERTIES FOLDER test)
-else ()
- add_executable (filter_plugin ${HDF5_TEST_SOURCE_DIR}/filter_plugin.c)
- target_include_directories(filter_plugin PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (filter_plugin STATIC)
- target_link_libraries (filter_plugin PRIVATE ${HDF5_TEST_LIB_TARGET})
- set_target_properties (filter_plugin PROPERTIES FOLDER test)
-
- add_executable (vol_plugin ${HDF5_TEST_SOURCE_DIR}/vol_plugin.c)
- target_include_directories(vol_plugin PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (vol_plugin STATIC)
- target_link_libraries (vol_plugin PRIVATE ${HDF5_TEST_LIB_TARGET})
+ target_link_libraries (vol_plugin PRIVATE ${HDF5_TEST_LIBSH_TARGET})
set_target_properties (vol_plugin PROPERTIES FOLDER test)
endif ()
@@ -488,44 +471,38 @@ endif ()
##############################################################################
set (use_append_chunk_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_append_chunk.c ${HDF5_TEST_SOURCE_DIR}/use_common.c)
add_executable (use_append_chunk ${use_append_chunk_SOURCES})
-target_include_directories(use_append_chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (use_append_chunk STATIC)
-target_link_libraries (use_append_chunk PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
-set_target_properties (use_append_chunk PROPERTIES FOLDER test)
-if (BUILD_SHARED_LIBS)
- add_executable (use_append_chunk-shared ${use_append_chunk_SOURCES})
- target_include_directories(use_append_chunk-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (use_append_chunk-shared SHARED)
- target_link_libraries (use_append_chunk-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
- set_target_properties (use_append_chunk-shared PROPERTIES FOLDER test)
+target_include_directories (use_append_chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (use_append_chunk STATIC)
+ target_link_libraries (use_append_chunk PRIVATE ${HDF5_TEST_LIB_TARGET})
+else ()
+ TARGET_C_PROPERTIES (use_append_chunk SHARED)
+ target_link_libraries (use_append_chunk PRIVATE ${HDF5_TEST_LIBSH_TARGET})
endif ()
+set_target_properties (use_append_chunk PROPERTIES FOLDER test)
set (use_append_mchunks_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_append_mchunks.c ${HDF5_TEST_SOURCE_DIR}/use_common.c)
add_executable (use_append_mchunks ${use_append_mchunks_SOURCES})
-target_include_directories(use_append_mchunks PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (use_append_mchunks STATIC)
-target_link_libraries (use_append_mchunks PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
-set_target_properties (use_append_mchunks PROPERTIES FOLDER test)
-if (BUILD_SHARED_LIBS)
- add_executable (use_append_mchunks-shared ${use_append_mchunks_SOURCES})
- target_include_directories(use_append_mchunks-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (use_append_mchunks-shared SHARED)
- target_link_libraries (use_append_mchunks-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
- set_target_properties (use_append_mchunks-shared PROPERTIES FOLDER test)
+target_include_directories (use_append_mchunks PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (use_append_mchunks STATIC)
+ target_link_libraries (use_append_mchunks PRIVATE ${HDF5_TEST_LIB_TARGET})
+else ()
+ TARGET_C_PROPERTIES (use_append_mchunks SHARED)
+ target_link_libraries (use_append_mchunks PRIVATE ${HDF5_TEST_LIBSH_TARGET})
endif ()
+set_target_properties (use_append_mchunks PROPERTIES FOLDER test)
set (use_disable_mdc_flushes_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_disable_mdc_flushes.c)
add_executable (use_disable_mdc_flushes ${use_disable_mdc_flushes_SOURCES})
-target_include_directories(use_disable_mdc_flushes PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (use_disable_mdc_flushes STATIC)
-target_link_libraries (use_disable_mdc_flushes PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
-set_target_properties (use_disable_mdc_flushes PROPERTIES FOLDER test)
-if (BUILD_SHARED_LIBS)
- add_executable (use_disable_mdc_flushes-shared ${use_disable_mdc_flushes_SOURCES})
- target_include_directories(use_disable_mdc_flushes-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (use_disable_mdc_flushes-shared SHARED)
- target_link_libraries (use_disable_mdc_flushes-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
- set_target_properties (use_disable_mdc_flushes-shared PROPERTIES FOLDER test)
+target_include_directories (use_disable_mdc_flushes PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (use_disable_mdc_flushes STATIC)
+ target_link_libraries (use_disable_mdc_flushes PRIVATE ${HDF5_TEST_LIB_TARGET})
+else ()
+ TARGET_C_PROPERTIES (use_disable_mdc_flushes SHARED)
+ target_link_libraries (use_disable_mdc_flushes PRIVATE ${HDF5_TEST_LIBSH_TARGET})
endif ()
+set_target_properties (use_disable_mdc_flushes PROPERTIES FOLDER test)
include (CMakeTests.cmake)
diff --git a/test/CMakePassthroughVOLTests.cmake b/test/CMakePassthroughVOLTests.cmake
index 928654e..24a0201 100644
--- a/test/CMakePassthroughVOLTests.cmake
+++ b/test/CMakePassthroughVOLTests.cmake
@@ -31,37 +31,23 @@ foreach (voltest ${VOL_LIST})
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${voltest}")
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${voltest}/testfiles")
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${voltest}/testfiles/plist_files")
- if (BUILD_SHARED_LIBS)
- file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${voltest}-shared")
- file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${voltest}-shared/testfiles")
- file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${voltest}-shared/testfiles/plist_files")
- endif ()
endforeach ()
foreach (voltest ${VOL_LIST})
foreach (h5_tfile ${HDF5_TEST_FILES})
HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/${voltest}/${h5_tfile}" "HDF5_VOLTEST_LIB_files")
- if (BUILD_SHARED_LIBS)
- HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/${voltest}-shared/${h5_tfile}" "HDF5_VOLTEST_LIBSH_files")
- endif ()
endforeach ()
endforeach ()
foreach (voltest ${VOL_LIST})
foreach (ref_file ${HDF5_REFERENCE_FILES})
HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/${voltest}/${ref_file}" "HDF5_VOLTEST_LIB_files")
- if (BUILD_SHARED_LIBS)
- HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/${voltest}-shared/${ref_file}" "HDF5_VOLTEST_LIBSH_files")
- endif ()
endforeach ()
endforeach ()
foreach (voltest ${VOL_LIST})
foreach (h5_file ${HDF5_REFERENCE_TEST_FILES})
HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/${voltest}/${h5_file}" "HDF5_VOLTEST_LIB_files")
- if (BUILD_SHARED_LIBS)
- HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/${voltest}-shared/${h5_file}" "HDF5_VOLTEST_LIBSH_files")
- endif ()
endforeach ()
endforeach ()
@@ -69,17 +55,10 @@ foreach (voltest ${VOL_LIST})
foreach (plistfile ${HDF5_REFERENCE_PLIST_FILES})
HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile}" "${PROJECT_BINARY_DIR}/${voltest}/testfiles/plist_files/${plistfile}" "HDF5_VOLTEST_LIB_files")
HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile}" "${PROJECT_BINARY_DIR}/${voltest}/testfiles/plist_files/def_${plistfile}" "HDF5_VOLTEST_LIB_files")
- if (BUILD_SHARED_LIBS)
- HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile}" "${PROJECT_BINARY_DIR}/${voltest}-shared/testfiles/plist_files/${plistfile}" "HDF5_VOLTEST_LIBSH_files")
- HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile}" "${PROJECT_BINARY_DIR}/${voltest}-shared/testfiles/plist_files/def_${plistfile}" "HDF5_VOLTEST_LIBSH_files")
- endif ()
endforeach ()
endforeach ()
add_custom_target(HDF5_VOLTEST_LIB_files ALL COMMENT "Copying files needed by HDF5_VOLTEST_LIB tests" DEPENDS ${HDF5_VOLTEST_LIB_files_list})
-if (BUILD_SHARED_LIBS)
- add_custom_target(HDF5_VOLTEST_LIBSH_files ALL COMMENT "Copying files needed by HDF5_VOLTEST_LIBSH tests" DEPENDS ${HDF5_VOLTEST_LIBSH_files_list})
-endif ()
##############################################################################
##############################################################################
@@ -133,39 +112,10 @@ endif ()
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname}
)
- if (BUILD_SHARED_LIBS)
- add_test (
- NAME VOL-${volname}-${voltest}-shared-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- ${volname}-shared/${volname}-${voltest}-shared.out
- ${volname}-shared/${volname}-${voltest}-shared.out.err
- )
- add_test (NAME VOL-${volname}-${voltest}-shared
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:${voltest}-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_VOL:STRING=${volinfo}"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${volname}-${voltest}-shared.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${volname}-shared"
- -P "${HDF_RESOURCES_DIR}/volTest.cmake"
- )
- set_tests_properties (VOL-${volname}-${voltest}-shared PROPERTIES
- DEPENDS VOL-${volname}-${voltest}-shared-clear-objects
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname}-shared"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname}-shared
- )
- endif ()
else ()
add_test (NAME VOL-${volname}-${voltest}
COMMAND ${CMAKE_COMMAND} -E echo "SKIP VOL-${volname}-${voltest}"
)
- if (BUILD_SHARED_LIBS)
- add_test (NAME VOL-${volname}-${voltest}-shared
- COMMAND ${CMAKE_COMMAND} -E echo "SKIP VOL-${volname}-${voltest}-shared"
- )
- endif ()
endif ()
else ()
add_test (
@@ -190,30 +140,6 @@ endif ()
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname}
)
- if (BUILD_SHARED_LIBS)
- add_test (
- NAME VOL-${volname}-${voltest}-shared-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- ${volname}-shared/${volname}-${voltest}-shared.out
- ${volname}-shared/${volname}-${voltest}-shared.out.err
- )
- add_test (NAME VOL-${volname}-${voltest}-shared
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:${voltest}-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_VOL:STRING=${volinfo}"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${volname}-${voltest}-shared.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${volname}-shared"
- -P "${HDF_RESOURCES_DIR}/volTest.cmake"
- )
- set_tests_properties (VOL-${volname}-${voltest}-shared PROPERTIES
- DEPENDS VOL-${volname}-${voltest}-shared-clear-objects
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname}-shared"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname}-shared
- )
- endif ()
endif ()
else ()
add_test (
@@ -238,30 +164,6 @@ endif ()
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname};HDF5TestExpress=${HDF_TEST_EXPRESS}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname}
)
- if (BUILD_SHARED_LIBS AND NOT "${voltest}" STREQUAL "cache")
- add_test (
- NAME VOL-${volname}-${voltest}-shared-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- ${volname}-shared/${volname}-${voltest}-shared.out
- ${volname}-shared/${volname}-${voltest}-shared.out.err
- )
- add_test (NAME VOL-${volname}-${voltest}-shared
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:${voltest}-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_VOL:STRING=${volinfo}"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${volname}-${voltest}-shared.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${volname}-shared"
- -P "${HDF_RESOURCES_DIR}/volTest.cmake"
- )
- set_tests_properties (VOL-${volname}-${voltest}-shared PROPERTIES
- DEPENDS VOL-${volname}-${voltest}-shared-clear-objects
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname}-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname}-shared
- )
- endif ()
endif ()
endmacro ()
@@ -289,30 +191,6 @@ endif ()
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname}
)
- if (BUILD_SHARED_LIBS)
- add_test (
- NAME VOL-${volname}-${voltest}-shared-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- ${volname}-shared/${volname}-${voltest}-shared.out
- ${volname}-shared/${volname}-${voltest}-shared.out.err
- )
- add_test (NAME VOL-${volname}-${voltest}-shared
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:${voltest}-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_VOL:STRING=${volinfo}"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${volname}-${voltest}-shared.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${volname}-shared"
- -P "${HDF_RESOURCES_DIR}/volTest.cmake"
- )
- set_tests_properties (VOL-${volname}-${voltest}-shared PROPERTIES
- DEPENDS VOL-${volname}-${voltest}-shared-clear-objects
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname}-shared"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname}-shared
- )
- endif ()
endmacro ()
macro (ADD_VOL_TEST volname volinfo resultcode)
@@ -333,15 +211,6 @@ endif ()
if (NOT CYGWIN)
set_tests_properties (VOL-${volname}-cache PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
endif ()
- if (BUILD_SHARED_LIBS)
- set_tests_properties (VOL-${volname}-flush2-shared PROPERTIES DEPENDS VOL-${volname}-flush1-shared)
- set_tests_properties (VOL-${volname}-flush1-shared PROPERTIES TIMEOUT 10)
- set_tests_properties (VOL-${volname}-flush2-shared PROPERTIES TIMEOUT 10)
- set_tests_properties (VOL-${volname}-istore-shared PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
- if (NOT CYGWIN AND NOT WIN32)
- set_tests_properties (VOL-${volname}-cache-shared PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
- endif ()
- endif ()
if (HDF5_TEST_FHEAP_PASSTHROUGH_VOL)
add_test (
NAME VOL-${volname}-fheap-clear-objects
@@ -366,31 +235,6 @@ endif ()
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname};HDF5TestExpress=${HDF_TEST_EXPRESS}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname}
)
- if (BUILD_SHARED_LIBS)
- add_test (
- NAME VOL-${volname}-fheap-shared-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- ${volname}-shared/${volname}-fheap-shared.out
- ${volname}-shared/${volname}-fheap-shared.out.err
- )
- add_test (NAME VOL-${volname}-fheap-shared
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:fheap-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_VOL:STRING=${volinfo}"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${volname}-fheap-shared.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${volname}-shared"
- -P "${HDF_RESOURCES_DIR}/volTest.cmake"
- )
- set_tests_properties (VOL-${volname}-fheap-shared PROPERTIES
- DEPENDS VOL-${volname}-fheap-shared-clear-objects
- TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname}-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname}-shared
- )
- endif ()
endif ()
endmacro ()
diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake
index 3e6add0..1e7ddff 100644
--- a/test/CMakeTests.cmake
+++ b/test/CMakeTests.cmake
@@ -20,11 +20,6 @@
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST")
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/testfiles")
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/testfiles/plist_files")
-if (BUILD_SHARED_LIBS)
- file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST-shared")
- file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST-shared/testfiles")
- file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST-shared/testfiles/plist_files")
-endif ()
# --------------------------------------------------------------------
# Copy all the HDF5 files from the source directory into the test directory
@@ -39,20 +34,9 @@ add_custom_command (
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different "$<TARGET_FILE:accum_swmr_reader>" "${PROJECT_BINARY_DIR}/H5TEST/accum_swmr_reader"
)
-if (BUILD_SHARED_LIBS)
- add_custom_command (
- TARGET accum_swmr_reader
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different "$<TARGET_FILE:accum_swmr_reader>" "${PROJECT_BINARY_DIR}/H5TEST-shared/accum_swmr_reader"
- )
-endif ()
foreach (h5_tfile ${HDF5_TEST_FILES})
HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/H5TEST/${h5_tfile}" "HDF5_TEST_LIB_files")
- if (BUILD_SHARED_LIBS)
- HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/H5TEST-shared/${h5_tfile}" "HDF5_TEST_LIBSH_files")
- endif ()
endforeach ()
# --------------------------------------------------------------------
@@ -68,9 +52,6 @@ set (HDF5_REFERENCE_FILES
foreach (ref_file ${HDF5_REFERENCE_FILES})
HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/H5TEST/${ref_file}" "HDF5_TEST_LIB_files")
- if (BUILD_SHARED_LIBS)
- HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/H5TEST-shared/${ref_file}" "HDF5_TEST_LIBSH_files")
- endif ()
endforeach ()
# --------------------------------------------------------------------
@@ -130,10 +111,6 @@ set (HDF5_REFERENCE_PLIST_FILES
foreach (plistfile ${HDF5_REFERENCE_PLIST_FILES})
HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile}" "${PROJECT_BINARY_DIR}/H5TEST/testfiles/plist_files/${plistfile}" "HDF5_TEST_LIB_files")
HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile}" "${PROJECT_BINARY_DIR}/H5TEST/testfiles/plist_files/def_${plistfile}" "HDF5_TEST_LIB_files")
- if (BUILD_SHARED_LIBS)
- HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile}" "${PROJECT_BINARY_DIR}/H5TEST-shared/testfiles/plist_files/${plistfile}" "HDF5_TEST_LIBSH_files")
- HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile}" "${PROJECT_BINARY_DIR}/H5TEST-shared/testfiles/plist_files/def_${plistfile}" "HDF5_TEST_LIBSH_files")
- endif ()
endforeach ()
# --------------------------------------------------------------------
@@ -158,6 +135,7 @@ set (HDF5_REFERENCE_TEST_FILES
filespace_1_6.h5
filespace_1_8.h5
fill_old.h5
+ fill18.h5
filter_error.h5
fsm_aggr_nopersist.h5
fsm_aggr_persist.h5
@@ -194,38 +172,35 @@ set (HDF5_REFERENCE_TEST_FILES
foreach (h5_file ${HDF5_REFERENCE_TEST_FILES})
HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/H5TEST/${h5_file}" "HDF5_TEST_LIB_files")
- if (BUILD_SHARED_LIBS)
- HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/H5TEST-shared/${h5_file}" "HDF5_TEST_LIBSH_files")
- endif ()
endforeach ()
add_custom_target(HDF5_TEST_LIB_files ALL COMMENT "Copying files needed by HDF5_TEST_LIB tests" DEPENDS ${HDF5_TEST_LIB_files_list})
-if (BUILD_SHARED_LIBS)
- add_custom_target(HDF5_TEST_LIBSH_files ALL COMMENT "Copying files needed by HDF5_TEST_LIBSH tests" DEPENDS ${HDF5_TEST_LIBSH_files_list})
-endif ()
+
+set (testhdf5_CLEANFILES
+ coord.h5
+ dtypes10.h5
+ sys_file1
+ tattr.h5
+ tfile1.h5
+ tfile2.h5
+ tfile3.h5
+ tfile4.h5
+ tfile5.h5
+ tfile6.h5
+ tfile7.h5
+ tfilespace.h5
+ th5o_file
+ th5s1.h5
+ tselect.h5
+ tsohm.h5
+ tsohm_dst.h5
+ tsohm_src.h5
+)
# Remove any output file left over from previous test run
add_test (NAME H5TEST-clear-testhdf5-objects
COMMAND ${CMAKE_COMMAND}
- -E remove
- coord.h5
- dtypes10.h5
- sys_file1
- tattr.h5
- tfile1.h5
- tfile2.h5
- tfile3.h5
- tfile4.h5
- tfile5.h5
- tfile6.h5
- tfile7.h5
- tfilespace.h5
- th5o_file
- th5s1.h5
- tselect.h5
- tsohm.h5
- tsohm_dst.h5
- tsohm_src.h5
+ -E remove ${testhdf5_CLEANFILES}
WORKING_DIRECTORY
${HDF5_TEST_BINARY_DIR}/H5TEST
)
@@ -255,59 +230,6 @@ set_tests_properties (H5TEST-testhdf5-select PROPERTIES
ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
)
-if (NOT HDF5_ENABLE_USING_MEMCHECKER)
- if (BUILD_SHARED_LIBS)
- add_test (NAME H5TEST-shared-clear-testhdf5-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- coord.h5
- dtypes10.h5
- sys_file1
- tattr.h5
- tfile1.h5
- tfile2.h5
- tfile3.h5
- tfile4.h5
- tfile5.h5
- tfile6.h5
- tfile7.h5
- tfilespace.h5
- th5o_file
- th5s1.h5
- tselect.h5
- tsohm.h5
- tsohm_dst.h5
- tsohm_src.h5
- WORKING_DIRECTORY
- ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
- set_tests_properties (H5TEST-shared-clear-testhdf5-objects PROPERTIES FIXTURES_SETUP shared_clear_testhdf5)
- add_test (NAME H5TEST-shared-testhdf5-base COMMAND $<TARGET_FILE:testhdf5-shared> -x heap -x file -x select)
- set_tests_properties (H5TEST-shared-testhdf5-base PROPERTIES
- FIXTURES_REQUIRED shared_clear_testhdf5
- ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
- add_test (NAME H5TEST-shared-testhdf5-heap COMMAND $<TARGET_FILE:testhdf5-shared> -o heap)
- set_tests_properties (H5TEST-shared-testhdf5-heap PROPERTIES
- FIXTURES_REQUIRED shared_clear_testhdf5
- ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
- add_test (NAME H5TEST-shared-testhdf5-file COMMAND $<TARGET_FILE:testhdf5-shared> -o file)
- set_tests_properties (H5TEST-shared-testhdf5-file PROPERTIES
- FIXTURES_REQUIRED shared_clear_testhdf5
- ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
- add_test (NAME H5TEST-shared-testhdf5-select COMMAND $<TARGET_FILE:testhdf5-shared> -o select)
- set_tests_properties (H5TEST-shared-testhdf5-select PROPERTIES
- FIXTURES_REQUIRED shared_clear_testhdf5
- ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
- endif ()
-endif ()
##############################################################################
##############################################################################
@@ -568,6 +490,7 @@ foreach (h5_test ${H5_TESTS})
-D "TEST_EXPECT=0"
-D "TEST_SKIP_COMPARE=TRUE"
-D "TEST_OUTPUT=${h5_test}.txt"
+ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
#-D "TEST_REFERENCE=${test}.out"
-D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST"
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
@@ -587,49 +510,6 @@ set_tests_properties (H5TEST-big PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
set_tests_properties (H5TEST-btree2 PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
set_tests_properties (H5TEST-objcopy PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
-if (BUILD_SHARED_LIBS)
- # Remove any output file left over from previous test run
- add_test (NAME H5TEST-shared-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- ${test_CLEANFILES}
- WORKING_DIRECTORY
- ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
- set_tests_properties (H5TEST-shared-clear-objects PROPERTIES FIXTURES_SETUP shared_clear_objects)
-
- foreach (h5_test ${H5_TESTS})
- if (NOT h5_test IN_LIST H5TEST_SEPARATE_TESTS)
- if ("${h5_test}" STREQUAL "big" AND CYGWIN)
- add_test (NAME H5TEST-shared-${h5_test}
- COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${test}-shared"
- )
- else ()
- add_test (NAME H5TEST-shared-${h5_test} COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:${h5_test}-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=${h5_test}.txt"
- #-D "TEST_REFERENCE=${test}.out"
- -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- endif ()
- set_tests_properties (H5TEST-shared-${h5_test} PROPERTIES
- FIXTURES_REQUIRED shared_clear_objects
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
- endif ()
- endforeach ()
-
- set_tests_properties (H5TEST-shared-fheap PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
- set_tests_properties (H5TEST-shared-big PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
- set_tests_properties (H5TEST-shared-btree2 PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
- set_tests_properties (H5TEST-shared-objcopy PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
-endif ()
-
#-- Adding test for cache
if (NOT CYGWIN)
add_test (NAME H5TEST-clear-cache-objects
@@ -663,22 +543,22 @@ if (NOT CYGWIN)
endif ()
if (TEST_CACHE_IMAGE)
-#-- Adding test for cache_image
-add_test (
- NAME H5TEST-clear-cache_image-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- cache_image_test.h5
- WORKING_DIRECTORY
- ${HDF5_TEST_BINARY_DIR}/H5TEST
-)
-set_tests_properties (H5TEST-clear-cache_image-objects PROPERTIES FIXTURES_SETUP cache_image_clear_objects)
-add_test (NAME H5TEST-cache_image COMMAND $<TARGET_FILE:cache_image>)
-set_tests_properties (H5TEST-cache_image PROPERTIES
- FIXTURES_REQUIRED cache_image_clear_objects
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
-)
+ #-- Adding test for cache_image
+ add_test (
+ NAME H5TEST-clear-cache_image-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ cache_image_test.h5
+ WORKING_DIRECTORY
+ ${HDF5_TEST_BINARY_DIR}/H5TEST
+ )
+ set_tests_properties (H5TEST-clear-cache_image-objects PROPERTIES FIXTURES_SETUP cache_image_clear_objects)
+ add_test (NAME H5TEST-cache_image COMMAND $<TARGET_FILE:cache_image>)
+ set_tests_properties (H5TEST-cache_image PROPERTIES
+ FIXTURES_REQUIRED cache_image_clear_objects
+ ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}"
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
+ )
endif ()
#-- Adding test for external_env
@@ -758,40 +638,6 @@ set_tests_properties (H5TEST-vds_env PROPERTIES
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
)
-if (BUILD_SHARED_LIBS)
- #-- Adding test for cache
- if (NOT CYGWIN AND NOT WIN32)
- add_test (NAME H5TEST-shared-clear-cache-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- cache_test.h5
- WORKING_DIRECTORY
- ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
- set_tests_properties (H5TEST-clear-objects PROPERTIES FIXTURES_SETUP shared_cache_clear_objects)
- if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME H5TEST-shared-cache COMMAND $<TARGET_FILE:cache-shared>)
- else ()
- add_test (NAME H5TEST-shared-cache COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:cache-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=cache-shared.txt"
- #-D "TEST_REFERENCE=cache-shared.out"
- -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- endif ()
- set_tests_properties (H5TEST-shared-cache PROPERTIES
- FIXTURES_REQUIRED shared_cache_clear_objects
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
- set_tests_properties (H5TEST-shared-cache PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
- endif ()
-endif ()
-
#-- Adding test for flush1/2
add_test (NAME H5TEST-clear-flush-objects
COMMAND ${CMAKE_COMMAND}
@@ -857,7 +703,6 @@ set_tests_properties (H5TEST-tcheck_version-release PROPERTIES
WILL_FAIL "true"
)
-
##############################################################################
##############################################################################
### A D D I T I O N A L T E S T S ###
@@ -1029,170 +874,6 @@ add_test (NAME H5TEST-testlibinfo
${HDF5_TEST_BINARY_DIR}/H5TEST
)
-if (BUILD_SHARED_LIBS)
- #-- Adding test for err_compat
- if (HDF5_ENABLE_DEPRECATED_SYMBOLS)
- add_test (NAME H5TEST-shared-clear-err_compat-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- err_compat.txt
- err_compat.txt.err
- WORKING_DIRECTORY
- ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
- set_tests_properties (H5TEST-shared-clear-err_compat-objects PROPERTIES FIXTURES_SETUP shared_err_compat_clear_objects)
- add_test (NAME H5TEST-shared-err_compat COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:err_compat-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_MASK_ERROR=true"
- -D "ERROR_APPEND=1"
- -D "TEST_OUTPUT=err_compat.txt"
- -D "TEST_REFERENCE=err_compat_1"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- set_tests_properties (H5TEST-shared-err_compat PROPERTIES
- FIXTURES_REQUIRED shared_err_compat_clear_objects
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
- endif ()
-
- #-- Adding test for error_test
- add_test (NAME H5TEST-shared-clear-error_test-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- error_test.txt
- error_test.txt.err
- WORKING_DIRECTORY
- ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
- set_tests_properties (H5TEST-shared-clear-error_test-objects PROPERTIES FIXTURES_SETUP shared_error_test_clear_objects)
- if (HDF5_USE_16_API_DEFAULT)
- add_test (
- NAME H5TEST-shared-error_test
- COMMAND ${CMAKE_COMMAND} -E echo "SKIP $<TARGET_FILE:error_test-shared>"
- )
- set_property(TEST H5TEST-shared-error_test PROPERTY DISABLED)
- else ()
- add_test (NAME H5TEST-shared-error_test COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:error_test-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_MASK_ERROR=true"
- -D "ERROR_APPEND=1"
- -D "TEST_OUTPUT=error_test.txt"
- -D "TEST_REFERENCE=error_test_1"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- set_tests_properties (H5TEST-shared-error_test PROPERTIES
- FIXTURES_REQUIRED shared_error_test_clear_objects
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared;HDF5_PLUGIN_PRELOAD=::"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
- endif ()
-
- #-- Adding test for links_env
- add_test (NAME H5TEST-shared-clear-links_env-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- links_env.txt
- links_env.txt.err
- extlinks_env0.h5
- extlinks_env1.h5
- tmp/extlinks_env1.h5
- WORKING_DIRECTORY
- ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
- set_tests_properties (H5TEST-shared-clear-links_env-objects PROPERTIES FIXTURES_SETUP shared_links_env_clear_objects)
- add_test (NAME H5TEST-shared-links_env COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:links_env-shared>"
- -D "TEST_ARGS:STRING="
- #-D "TEST_ENV_VAR:STRING=HDF5_EXT_PREFIX"
- #-D "TEST_ENV_VALUE:STRING=.:tmp"
- -D "TEST_EXPECT=0"
- -D "TEST_OUTPUT=links_env.txt"
- -D "TEST_REFERENCE=links_env.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- set_tests_properties (H5TEST-shared-links_env PROPERTIES
- FIXTURES_REQUIRED shared_links_env_clear_objects
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared;HDF5_EXT_PREFIX=.:tmp"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
-
- #-- Adding test for external_env
- add_test (NAME H5TEST-shared-clear-external_env-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- extern_1r.raw
- extern_2r.raw
- extern_3r.raw
- extern_4r.raw
- extern_1w.raw
- extern_2w.raw
- extern_3w.raw
- extern_4w.raw
- WORKING_DIRECTORY
- ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
- set_tests_properties (H5TEST-shared-clear-external_env-objects PROPERTIES FIXTURES_SETUP shared_external_env_clear_objects)
- add_test (NAME H5TEST-shared-external_env COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:external_env-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_ENV_VAR:STRING=HDF5_EXTFILE_PREFIX"
- -D "TEST_ENV_VALUE:STRING=\${ORIGIN}"
- -D "TEST_EXPECT=0"
- -D "TEST_OUTPUT=external_env.txt"
- -D "TEST_REFERENCE=external_env.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- set_tests_properties (H5TEST-shared-external_env PROPERTIES
- FIXTURES_REQUIRED shared_external_env_clear_objects
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
-
- #-- Adding test for vds_env
- add_test (NAME H5TEST-shared-clear-vds_env-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- vds_virt_0.h5
- vds_virt_3.h5
- vds_src_2.h5
- WORKING_DIRECTORY
- ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
- set_tests_properties (H5TEST-shared-clear-vds_env-objects PROPERTIES FIXTURES_SETUP shared_vds_env_clear_objects)
- add_test (NAME H5TEST-shared-vds_env COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:vds_env-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_ENV_VAR:STRING=HDF5_VDS_PREFIX"
- -D "TEST_ENV_VALUE:STRING=\${ORIGIN}/tmp"
- -D "TEST_EXPECT=0"
- -D "TEST_OUTPUT=vds_env.txt"
- -D "TEST_REFERENCE=vds_env.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- set_tests_properties (H5TEST-shared-vds_env PROPERTIES
- FIXTURES_REQUIRED shared_vds_env_clear_objects
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
-
- #-- Adding test for libinfo
- add_test (NAME H5TEST-shared-testlibinfo
- COMMAND ${CMAKE_COMMAND} -D "TEST_PROGRAM=$<TARGET_FILE:${HDF5_LIBSH_TARGET}>" -P "${GREP_RUNNER}"
- WORKING_DIRECTORY
- ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
-endif ()
-
##############################################################################
### F I L T E R P L U G I N T E S T S
##############################################################################
@@ -1239,9 +920,6 @@ if (ENABLE_EXTENDED_TESTS)
#-- Adding test for flushrefresh
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/flushrefresh_test")
- if (BUILD_SHARED_LIBS)
- file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST-shared/flushrefresh_test")
- endif ()
find_package (Perl)
if (PERL_FOUND)
add_test (NAME H5TEST-clear-testflushrefresh-objects
@@ -1272,10 +950,10 @@ if (ENABLE_EXTENDED_TESTS)
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST/flushrefresh_test"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST/flushrefresh_test
)
- else ()
- message (STATUS "Cannot execute TEST flushrefresh - perl not found")
endif ()
-endif()
+else ()
+ message (STATUS "Cannot execute TEST flushrefresh - perl not found")
+endif ()
##############################################################################
##############################################################################
@@ -1322,10 +1000,10 @@ endif ()
##############################################################################
##############################################################################
-if (HDF5_BUILD_GENERATORS)
+if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
macro (ADD_H5_GENERATOR genfile)
add_executable (${genfile} ${HDF5_TEST_SOURCE_DIR}/${genfile}.c)
- target_include_directories(${genfile} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (${genfile} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (${genfile} STATIC)
target_link_libraries (${genfile} PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (${genfile} PROPERTIES FOLDER generator/test)
diff --git a/test/CMakeVFDTests.cmake b/test/CMakeVFDTests.cmake
index 383b2f4..0ddce92 100644
--- a/test/CMakeVFDTests.cmake
+++ b/test/CMakeVFDTests.cmake
@@ -34,37 +34,23 @@ foreach (vfdtest ${VFD_LIST})
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}")
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}/testfiles")
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}/testfiles/plist_files")
- if (BUILD_SHARED_LIBS)
- file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}-shared")
- file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}-shared/testfiles")
- file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}-shared/testfiles/plist_files")
- endif ()
endforeach ()
foreach (vfdtest ${VFD_LIST})
foreach (h5_tfile ${HDF5_TEST_FILES})
HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/${vfdtest}/${h5_tfile}" "HDF5_VFDTEST_LIB_files")
- if (BUILD_SHARED_LIBS)
- HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/${vfdtest}-shared/${h5_tfile}" "HDF5_VFDTEST_LIBSH_files")
- endif ()
endforeach ()
endforeach ()
foreach (vfdtest ${VFD_LIST})
foreach (ref_file ${HDF5_REFERENCE_FILES})
HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/${vfdtest}/${ref_file}" "HDF5_VFDTEST_LIB_files")
- if (BUILD_SHARED_LIBS)
- HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/${vfdtest}-shared/${ref_file}" "HDF5_VFDTEST_LIBSH_files")
- endif ()
endforeach ()
endforeach ()
foreach (vfdtest ${VFD_LIST})
foreach (h5_file ${HDF5_REFERENCE_TEST_FILES})
HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/${vfdtest}/${h5_file}" "HDF5_VFDTEST_LIB_files")
- if (BUILD_SHARED_LIBS)
- HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/${vfdtest}-shared/${h5_file}" "HDF5_VFDTEST_LIBSH_files")
- endif ()
endforeach ()
endforeach ()
@@ -72,17 +58,10 @@ foreach (vfdtest ${VFD_LIST})
foreach (plistfile ${HDF5_REFERENCE_PLIST_FILES})
HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile}" "${PROJECT_BINARY_DIR}/${vfdtest}/testfiles/plist_files/${plistfile}" "HDF5_VFDTEST_LIB_files")
HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile}" "${PROJECT_BINARY_DIR}/${vfdtest}/testfiles/plist_files/def_${plistfile}" "HDF5_VFDTEST_LIB_files")
- if (BUILD_SHARED_LIBS)
- HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile}" "${PROJECT_BINARY_DIR}/${vfdtest}-shared/testfiles/plist_files/${plistfile}" "HDF5_VFDTEST_LIBSH_files")
- HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile}" "${PROJECT_BINARY_DIR}/${vfdtest}-shared/testfiles/plist_files/def_${plistfile}" "HDF5_VFDTEST_LIBSH_files")
- endif ()
endforeach ()
endforeach ()
add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HDF5_VFDTEST_LIB tests" DEPENDS ${HDF5_VFDTEST_LIB_files_list})
-if (BUILD_SHARED_LIBS)
- add_custom_target(HDF5_VFDTEST_LIBSH_files ALL COMMENT "Copying files needed by HDF5_VFDTEST_LIBSH tests" DEPENDS ${HDF5_VFDTEST_LIBSH_files_list})
-endif ()
##############################################################################
##############################################################################
@@ -136,39 +115,10 @@ endif ()
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}
)
- if (BUILD_SHARED_LIBS)
- add_test (
- NAME VFD-${vfdname}-${vfdtest}-shared-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out
- ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out.err
- )
- add_test (NAME VFD-${vfdname}-${vfdtest}-shared
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_VFD:STRING=${vfdname}"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${vfdname}-${vfdtest}-shared.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}-shared"
- -P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
- )
- set_tests_properties (VFD-${vfdname}-${vfdtest}-shared PROPERTIES
- DEPENDS VFD-${vfdname}-${vfdtest}-shared-clear-objects
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared
- )
- endif ()
else ()
add_test (NAME VFD-${vfdname}-${vfdtest}
COMMAND ${CMAKE_COMMAND} -E echo "SKIP VFD-${vfdname}-${vfdtest}"
)
- if (BUILD_SHARED_LIBS)
- add_test (NAME VFD-${vfdname}-${vfdtest}-shared
- COMMAND ${CMAKE_COMMAND} -E echo "SKIP VFD-${vfdname}-${vfdtest}-shared"
- )
- endif ()
endif ()
else ()
add_test (
@@ -193,30 +143,6 @@ endif ()
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}
)
- if (BUILD_SHARED_LIBS)
- add_test (
- NAME VFD-${vfdname}-${vfdtest}-shared-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out
- ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out.err
- )
- add_test (NAME VFD-${vfdname}-${vfdtest}-shared
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_VFD:STRING=${vfdname}"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${vfdname}-${vfdtest}-shared.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}-shared"
- -P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
- )
- set_tests_properties (VFD-${vfdname}-${vfdtest}-shared PROPERTIES
- DEPENDS VFD-${vfdname}-${vfdtest}-shared-clear-objects
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared
- )
- endif ()
endif ()
else ()
add_test (
@@ -241,80 +167,32 @@ endif ()
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname};HDF5TestExpress=${HDF_TEST_EXPRESS}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}
)
- if (BUILD_SHARED_LIBS AND NOT "${vfdtest}" STREQUAL "cache")
- add_test (
- NAME VFD-${vfdname}-${vfdtest}-shared-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out
- ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out.err
- )
- add_test (NAME VFD-${vfdname}-${vfdtest}-shared
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_VFD:STRING=${vfdname}"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${vfdname}-${vfdtest}-shared.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}-shared"
- -P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
- )
- set_tests_properties (VFD-${vfdname}-${vfdtest}-shared PROPERTIES
- DEPENDS VFD-${vfdname}-${vfdtest}-shared-clear-objects
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared
- )
- endif ()
endif ()
endmacro ()
macro (DO_VFD_TEST vfdtest vfdname resultcode)
- add_test (
- NAME VFD-${vfdname}-${vfdtest}-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- ${vfdname}/${vfdname}-${vfdtest}.out
- ${vfdname}/${vfdname}-${vfdtest}.out.err
- )
- add_test (NAME VFD-${vfdname}-${vfdtest}
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}>"
- -D "TEST_ARGS:STRING="
- -D "TEST_VFD:STRING=${vfdname}"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${vfdname}-${vfdtest}.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}"
- -P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
- )
- set_tests_properties (VFD-${vfdname}-${vfdtest} PROPERTIES
- DEPENDS VFD-${vfdname}-${vfdtest}-clear-objects
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}
- )
- if (BUILD_SHARED_LIBS)
- add_test (
- NAME VFD-${vfdname}-${vfdtest}-shared-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out
- ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out.err
- )
- add_test (NAME VFD-${vfdname}-${vfdtest}-shared
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_VFD:STRING=${vfdname}"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${vfdname}-${vfdtest}-shared.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}-shared"
- -P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
- )
- set_tests_properties (VFD-${vfdname}-${vfdtest}-shared PROPERTIES
- DEPENDS VFD-${vfdname}-${vfdtest}-shared-clear-objects
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared
- )
- endif ()
+ add_test (
+ NAME VFD-${vfdname}-${vfdtest}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${vfdname}/${vfdname}-${vfdtest}.out
+ ${vfdname}/${vfdname}-${vfdtest}.out.err
+ )
+ add_test (NAME VFD-${vfdname}-${vfdtest}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_VFD:STRING=${vfdname}"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_OUTPUT=${vfdname}-${vfdtest}.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}"
+ -P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
+ )
+ set_tests_properties (VFD-${vfdname}-${vfdtest} PROPERTIES
+ DEPENDS VFD-${vfdname}-${vfdtest}-clear-objects
+ ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}"
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}
+ )
endmacro ()
macro (ADD_VFD_TEST vfdname resultcode)
@@ -334,15 +212,6 @@ endif ()
if (NOT CYGWIN)
set_tests_properties (VFD-${vfdname}-cache PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
endif ()
- if (BUILD_SHARED_LIBS)
- set_tests_properties (VFD-${vfdname}-flush2-shared PROPERTIES DEPENDS VFD-${vfdname}-flush1-shared)
- set_tests_properties (VFD-${vfdname}-flush1-shared PROPERTIES TIMEOUT 10)
- set_tests_properties (VFD-${vfdname}-flush2-shared PROPERTIES TIMEOUT 10)
- set_tests_properties (VFD-${vfdname}-istore-shared PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
- if (NOT CYGWIN AND NOT WIN32)
- set_tests_properties (VFD-${vfdname}-cache-shared PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
- endif ()
- endif ()
if (HDF5_TEST_FHEAP_VFD)
add_test (
NAME VFD-${vfdname}-fheap-clear-objects
@@ -367,31 +236,6 @@ endif ()
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname};HDF5TestExpress=${HDF_TEST_EXPRESS}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}
)
- if (BUILD_SHARED_LIBS)
- add_test (
- NAME VFD-${vfdname}-fheap-shared-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- ${vfdname}-shared/${vfdname}-fheap-shared.out
- ${vfdname}-shared/${vfdname}-fheap-shared.out.err
- )
- add_test (NAME VFD-${vfdname}-fheap-shared
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:fheap-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_VFD:STRING=${vfdname}"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${vfdname}-fheap-shared.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}-shared"
- -P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
- )
- set_tests_properties (VFD-${vfdname}-fheap-shared PROPERTIES
- DEPENDS VFD-${vfdname}-fheap-shared-clear-objects
- TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared
- )
- endif ()
endif ()
endmacro ()
diff --git a/test/fill18.h5 b/test/fill18.h5
new file mode 100644
index 0000000..c092f59
--- /dev/null
+++ b/test/fill18.h5
Binary files differ
diff --git a/test/flushrefreshTest.cmake b/test/flushrefreshTest.cmake
index aa18c8a..73210ef 100644
--- a/test/flushrefreshTest.cmake
+++ b/test/flushrefreshTest.cmake
@@ -18,7 +18,7 @@ if (NOT TEST_PROGRAM)
message (FATAL_ERROR "Require TEST_PROGRAM to be defined")
endif ()
if (NOT TEST_FOLDER)
- message ( FATAL_ERROR "Require TEST_FOLDER to be defined")
+ message (FATAL_ERROR "Require TEST_FOLDER to be defined")
endif ()
if (NOT TEST_OUTPUT)
message (FATAL_ERROR "Require TEST_OUTPUT to be defined")
@@ -169,4 +169,4 @@ endif ()
message (STATUS "COMMAND Error: ${TEST_ERROR}")
# everything went fine...
-message ("Passed")
+message (STATUS "Passed")
diff --git a/test/null_vol_connector.c b/test/null_vol_connector.c
index b78e859..5ed8545 100644
--- a/test/null_vol_connector.c
+++ b/test/null_vol_connector.c
@@ -15,8 +15,15 @@
* (registration, etc.).
*/
+
+/* Public HDF5 header */
+#include "hdf5.h"
+
+/* For HDF5 plugin functionality */
#include "H5PLextern.h"
+
+/* This connector's header */
#include "null_vol_connector.h"
/* The VOL class struct */
diff --git a/test/objcopy.c b/test/objcopy.c
index df1c0e4..e646c87 100644
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -2136,7 +2136,7 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src)
char src_fname[NAME_BUF_SIZE]; /* Name of source file */
char dst_fname[NAME_BUF_SIZE]; /* Name of destination file */
H5F_libver_t low, high; /* File format bounds */
- unsigned srcdset_fillversion; /* Fill version of source dataset */
+ unsigned srcdset_layoutversion; /* Layout version of source dataset */
int i, j; /* Local index variables */
H5D_t *dsetp = NULL; /* Pointer to internal dset structure */
herr_t ret; /* Generic return value */
@@ -2179,7 +2179,8 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src)
/* Get the internal dset ptr to get the fill version for verifying later */
if ((dsetp = (H5D_t *)H5VL_object(did_src)) == NULL) TEST_ERROR
- srcdset_fillversion = dsetp->shared->dcpl_cache.fill.version;
+
+ srcdset_layoutversion = dsetp->shared->layout.version;
/* Close dataspace */
if(H5Sclose(sid) < 0) TEST_ERROR
@@ -2224,9 +2225,9 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src)
/* If copy failed, check if the failure is expected */
if (ret < 0)
{
- /* Failure is valid if fill version of source dataset is
+ /* Failure is valid if layout version of source dataset is
greater than destination */
- if (srcdset_fillversion <= H5O_fill_ver_bounds[high])
+ if (srcdset_layoutversion <= H5O_layout_ver_bounds[high])
TEST_ERROR
/* Close the DST file before continue */
@@ -5870,12 +5871,14 @@ compare_attribute_compound_vlstr(hid_t loc, hid_t loc2)
{
hid_t aid = -1, aid2 = -1; /* Attribute IDs */
hid_t tid = -1, tid2 = -1; /* Datatype IDs */
+ hid_t sid = -1, sid2 = -1; /* Dataspace IDs */
+ hid_t dxpl_id = -1;
typedef struct { /* Compound structure for the attribute */
int i;
char *v;
} s1;
s1 rbuf; /* Buffer for data read */
- s1 rbuf2; /* Buffer for data read */
+ s1 rbuf2; /* Buffer for data read */
/* Open the attributes attached to the objects */
if((aid = H5Aopen_by_idx(loc, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT)) < 0)
@@ -5889,6 +5892,12 @@ compare_attribute_compound_vlstr(hid_t loc, hid_t loc2)
if((tid2 = H5Aget_type(aid2)) < 0)
FAIL_STACK_ERROR
+ /* Get the attributes' dataspaces */
+ if((sid = H5Aget_space(aid)) < 0)
+ FAIL_STACK_ERROR
+ if((sid2 = H5Aget_space(aid2)) < 0)
+ FAIL_STACK_ERROR
+
/* Read the attributes */
if(H5Aread(aid, tid, &rbuf) < 0)
FAIL_STACK_ERROR
@@ -5903,6 +5912,19 @@ compare_attribute_compound_vlstr(hid_t loc, hid_t loc2)
if(HDmemcmp(rbuf.v, rbuf2.v, HDstrlen(rbuf.v)))
FAIL_STACK_ERROR
+ /* Reclaim vlen buffer */
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
+ if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
+ if(H5Dvlen_reclaim(tid, sid, dxpl_id, &rbuf) < 0) TEST_ERROR
+ if(H5Dvlen_reclaim(tid, sid, dxpl_id, &rbuf2) < 0) TEST_ERROR
+ if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+
+ /* Close the dataspaces */
+ if(H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Sclose(sid2) < 0)
+ FAIL_STACK_ERROR
+
/* Close the attributes */
if(H5Aclose(aid) < 0)
FAIL_STACK_ERROR
@@ -5914,8 +5936,13 @@ error:
H5E_BEGIN_TRY {
H5Aclose(aid);
H5Aclose(aid2);
+ H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, &rbuf);
+ H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, &rbuf2);
+ H5Sclose(sid);
+ H5Sclose(sid2);
H5Tclose(tid);
H5Tclose(tid2);
+ H5Pclose(dxpl_id);
} H5E_END_TRY;
return FALSE;
diff --git a/test/ohdr.c b/test/ohdr.c
index 9fc5791..d15e43b 100644
--- a/test/ohdr.c
+++ b/test/ohdr.c
@@ -751,27 +751,6 @@ error:
} /* test_unknown() */
/*
- * Set an attribute with the given information.
- * If the out parameter `attr_id` is negative, a new attribute will be
- * created with the given information. Else, it will attempt to update the
- * attribute with the new value.
- *
- * `dataspace_id` ignored if `attribute_id` >= 0
- */
-static herr_t
-put_attribute(hid_t loc_id, const char *attrname, const void *attrvalue, hid_t datatype_id, hid_t dataspace_id, hid_t *attribute_id)
-{
- if((*attribute_id) < 0) {
- hid_t id = -1;
- id = H5Acreate2(loc_id, attrname, datatype_id, dataspace_id, H5P_DEFAULT, H5P_DEFAULT);
- if(id < 0)
- return FAIL;
- *attribute_id = id;
- }
- return H5Awrite(*attribute_id, datatype_id, attrvalue);
-} /* put_attribute */
-
-/*
* Count the number of attributes attached to an object.
* Returns negative in event of error.
*/
@@ -830,216 +809,181 @@ oh_compare(hid_t did1, hid_t did2)
* Conduct additions side-by-side with a standard datataset and one with
* minimized dataset object headers.
*/
+#define ATTR_NAME_MAX 16
+#define ATTR_SHORT "first"
+#define ATTR_LONG "second"
+#define N_ATTRS 64
static herr_t
test_minimized_dset_ohdr_attribute_addition(hid_t fapl_id)
{
- hsize_t array_10[1] = {10}; /* dataspace extent */
- char buffer[10] = ""; /* to inspect string attribute */
- int a_out = 0;
- char filename[512] = "";
- hid_t int_type_id = -1;
- hid_t char_type_id = -1;
- hid_t dcpl_id = -1;
- hid_t dspace_id = -1;
- hid_t dspace_scalar_id = -1;
- hid_t dset_id = -1;
- hid_t mindset_id = -1;
- hid_t attr_1_id = -1;
- hid_t attr_1a_id = -1;
- hid_t attr_2_id = -1;
- hid_t attr_2a_id = -1;
- hid_t attr_3_id = -1;
- hid_t attr_3a_id = -1;
- hid_t file_id = -1;
- herr_t ret;
- int count = 0;
-
- TESTING("minimized dset object headers attribute additions")
-
- /*********
- * SETUP *
- *********/
-
- if(h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename)) == NULL)
- TEST_ERROR
-
- dspace_id = H5Screate_simple(1, array_10, NULL);
- if(dspace_id < 0) TEST_ERROR
-
- dspace_scalar_id = H5Screate(H5S_SCALAR);
- if(dspace_scalar_id < 0) TEST_ERROR
-
- char_type_id = H5Tcopy(H5T_NATIVE_CHAR);
- if(char_type_id < 0) TEST_ERROR
-
- int_type_id = H5Tcopy(H5T_NATIVE_INT);
- if(int_type_id < 0) TEST_ERROR
-
- dcpl_id = H5Pcreate(H5P_DATASET_CREATE);
- if(dcpl_id < 0) TEST_ERROR
-
- ret = H5Pset_dset_no_attrs_hint(dcpl_id, TRUE);
- if(ret < 0) TEST_ERROR
-
- file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
- if(file_id < 0) TEST_ERROR
-
- H5E_BEGIN_TRY {
- count = count_attributes(dset_id);
- } H5E_END_TRY;
- if(count != -1) TEST_ERROR
-
- dset_id = H5Dcreate2(file_id, "dataset", int_type_id, dspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if(dset_id < 0) TEST_ERROR
-
- mindset_id = H5Dcreate2(file_id, "mindataset", int_type_id, dspace_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
- if(mindset_id < 0) TEST_ERROR
-
- /********************
- * TEST/DEMONSTRATE *
- ********************/
-
- /* -------------------
- * no attributes added
- */
+ hsize_t dims[1] = {0}; /* dataspace extent */
+ char filename[512] = "";
+ char attr_name[ATTR_NAME_MAX] = "";
+ hid_t fid = H5I_INVALID_HID;
+ hid_t dcpl_id = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t aid = H5I_INVALID_HID;
+ char *in_buf = NULL;
+ char *out_buf = NULL;
+ size_t buf_size = 0;
+ int out_val = 0;
+ int in_val = 0;
+ int i;
+
+ TESTING("adding attributes to datasets created with H5Pset_dset_no_attrs_hint()")
+
+ /* Create the test file */
+ if(NULL == h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename)))
+ TEST_ERROR;
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) == H5I_INVALID_HID)
+ TEST_ERROR;
- count = count_attributes(dset_id);
- if(count != 0) TEST_ERROR
- count = count_attributes(mindset_id);
- if(count != 0) TEST_ERROR
+ /* Set the 'no attrs' hint on the dcpl */
+ if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) == H5I_INVALID_HID)
+ TEST_ERROR;
+ if(H5Pset_dset_no_attrs_hint(dcpl_id, TRUE) < 0)
+ TEST_ERROR;
- /* -----------------
- * add one attribute
- */
- ret = put_attribute(dset_id, "PURPOSE", "DEMO", char_type_id, dspace_id, &attr_1_id);
- if(ret < 0) TEST_ERROR
+ /* The dataset doesn't need to contain data */
+ dims[0] = 0;
+ if((sid = H5Screate_simple(1, dims, NULL)) == H5I_INVALID_HID)
+ TEST_ERROR;
- ret = put_attribute(mindset_id, "PURPOSE", "DEMO", char_type_id, dspace_id, &attr_1a_id);
- if(ret < 0) TEST_ERROR
+ /* Create the dataset */
+ if((did = H5Dcreate2(fid, "H5Pset_dset_no_attrs_hint", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) == H5I_INVALID_HID)
+ TEST_ERROR;
- count = count_attributes(dset_id);
- if(count != 1) TEST_ERROR
- count = count_attributes(mindset_id);
- if(count != 1) TEST_ERROR
+ /* Close */
+ if(H5Pclose(dcpl_id) < 0)
+ TEST_ERROR;
+ if(H5Sclose(sid) < 0)
+ TEST_ERROR;
- ret = H5Aread(attr_1_id, char_type_id, buffer);
- if(ret < 0) TEST_ERROR
- if(HDstrcmp("DEMO", buffer)) TEST_ERROR
+ /**********************************************
+ * ADD A (STRING) ATTRIBUTE AND MANIPULATE IT *
+ **********************************************/
- ret = H5Aread(attr_1a_id, char_type_id, buffer);
- if(ret < 0) TEST_ERROR
- if(HDstrcmp("DEMO", buffer)) TEST_ERROR
+ buf_size = HDstrlen(ATTR_LONG) + 1;
+ if(NULL == (in_buf = (char *)HDcalloc(buf_size, sizeof(char))))
+ TEST_ERROR;
+ if(NULL == (out_buf = (char *)HDcalloc(buf_size, sizeof(char))))
+ TEST_ERROR;
- /* -----------------
- * modify one attribute
+ /* Create a string attribute on the dataset
+ *
+ * It has to be long enough to hold the longest string we're going to write
+ * to it.
*/
+ dims[0] = buf_size;
+ if((sid = H5Screate_simple(1, dims, NULL)) == H5I_INVALID_HID)
+ TEST_ERROR;
+ if((aid = H5Acreate2(did, "string_attr", H5T_NATIVE_CHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) == H5I_INVALID_HID)
+ TEST_ERROR;
- ret = put_attribute(dset_id, "PURPOSE", "REWRITE", char_type_id, -1, &attr_1_id);
- if(ret < 0) TEST_ERROR
+ /* Write attribute data */
+ HDstrcpy(in_buf, ATTR_SHORT);
+ if(H5Awrite(aid, H5T_NATIVE_CHAR, in_buf) < 0)
+ TEST_ERROR;
- ret = put_attribute(mindset_id, "PURPOSE", "REWRITE", char_type_id, -1, &attr_1a_id);
- if(ret < 0) TEST_ERROR
+ /* Make sure the count is correct */
+ if(count_attributes(did) != 1)
+ TEST_ERROR;
- count = count_attributes(dset_id);
- if(count != 1) TEST_ERROR
- count = count_attributes(mindset_id);
- if(count != 1) TEST_ERROR
+ /* Read the data back and verify */
+ if(H5Aread(aid, H5T_NATIVE_CHAR, out_buf) < 0)
+ TEST_ERROR;
+ if(HDstrcmp(in_buf, out_buf))
+ TEST_ERROR;
- ret = H5Aread(attr_1_id, char_type_id, buffer);
- if(ret < 0) TEST_ERROR
- if(HDstrcmp("REWRITE", buffer)) TEST_ERROR
+ /* modify the string attribute */
+ HDmemset(in_buf, 0, buf_size);
+ HDstrcpy(in_buf, ATTR_LONG);
+ if(H5Awrite(aid, H5T_NATIVE_CHAR, in_buf) < 0)
+ TEST_ERROR;
- ret = H5Aread(attr_1a_id, char_type_id, buffer);
- if(ret < 0) TEST_ERROR
- if(HDstrcmp("REWRITE", buffer)) TEST_ERROR
+ if(count_attributes(did) != 1)
+ TEST_ERROR;
- /* -----------------
- * add second attribute
- */
+ /* Read the data back and verify */
+ if(H5Aread(aid, H5T_NATIVE_CHAR, out_buf) < 0)
+ TEST_ERROR;
+ if(HDstrcmp(in_buf, out_buf))
+ TEST_ERROR;
- a_out = 5;
- ret = put_attribute(dset_id, "RANK", &a_out, int_type_id, dspace_scalar_id, &attr_2_id);
- if(ret < 0) TEST_ERROR
+ /* Close */
+ if(H5Sclose(sid) < 0)
+ TEST_ERROR;
+ if(H5Aclose(aid) < 0)
+ TEST_ERROR;
- a_out = 3;
- ret = put_attribute(mindset_id, "RANK", &a_out, int_type_id, dspace_scalar_id, &attr_2a_id);
- if(ret < 0) TEST_ERROR
+ /***************************************
+ * ADD A BUNCH OF (INTEGER) ATTRIBUTES *
+ ***************************************/
- count = count_attributes(dset_id);
- if(count != 2) TEST_ERROR
- count = count_attributes(mindset_id);
- if(count != 2) TEST_ERROR
+ if((sid = H5Screate(H5S_SCALAR)) == H5I_INVALID_HID)
+ TEST_ERROR;
- ret = H5Aread(attr_2_id, int_type_id, &a_out);
- if(ret < 0) TEST_ERROR
- if(a_out != 5) TEST_ERROR
+ /* Loop over a reasonable number of attributes */
+ for(i = 0; i < N_ATTRS; i++) {
- ret = H5Aread(attr_2a_id, int_type_id, &a_out);
- if(ret < 0) TEST_ERROR
- if(a_out != 3) TEST_ERROR
+ /* Set the attribute's name */
+ if(HDsnprintf(attr_name, ATTR_NAME_MAX, "int_attr_%d", i) < 0)
+ TEST_ERROR;
- /* -----------------
- * add third attribute
- */
+ /* Create an integer attribute on the dataset */
+ if((aid = H5Acreate2(did, attr_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) == H5I_INVALID_HID)
+ TEST_ERROR;
- a_out = -86;
- ret = put_attribute(dset_id, "FLAVOR", &a_out, int_type_id, dspace_scalar_id, &attr_3_id);
- if(ret < 0) TEST_ERROR
+ /* Write attribute data */
+ in_val = i;
+ if(H5Awrite(aid, H5T_NATIVE_INT, &in_val) < 0)
+ TEST_ERROR;
- a_out = 2185;
- ret = put_attribute(mindset_id, "FLAVOR", &a_out, int_type_id, dspace_scalar_id, &attr_3a_id);
- if(ret < 0) TEST_ERROR
+ /* Make sure the count is correct (already has one attribute) */
+ if(count_attributes(did) != i + 2)
+ TEST_ERROR;
- count = count_attributes(dset_id);
- if(count != 3) TEST_ERROR
- count = count_attributes(mindset_id);
- if(count != 3) TEST_ERROR
+ /* Read the data back and verify */
+ if(H5Aread(aid, H5T_NATIVE_INT, &out_val) < 0)
+ TEST_ERROR;
+ if(in_val != out_val)
+ TEST_ERROR;
- ret = H5Aread(attr_3_id, int_type_id, &a_out);
- if(ret < 0) TEST_ERROR
- if(a_out != -86) TEST_ERROR
+ /* Close */
+ if(H5Aclose(aid) < 0)
+ TEST_ERROR;
+ }
- ret = H5Aread(attr_3a_id, int_type_id, &a_out);
- if(ret < 0) TEST_ERROR
- if(a_out != 2185) TEST_ERROR
+ /* Close */
+ if(H5Sclose(sid) < 0)
+ TEST_ERROR;
- /************
- * TEARDOWN *
- ************/
+ /* Close the remaining IDs */
+ if(H5Dclose(did) < 0)
+ TEST_ERROR;
+ if(H5Fclose(fid) < 0)
+ TEST_ERROR;
- if(H5Tclose(int_type_id) < 0) TEST_ERROR
- if(H5Tclose(char_type_id) < 0) TEST_ERROR
- if(H5Pclose(dcpl_id) < 0) TEST_ERROR
- if(H5Sclose(dspace_id) < 0) TEST_ERROR
- if(H5Dclose(dset_id) < 0) TEST_ERROR
- if(H5Dclose(mindset_id) < 0) TEST_ERROR
- if(H5Aclose(attr_1_id) < 0) TEST_ERROR
- if(H5Aclose(attr_1a_id) < 0) TEST_ERROR
- if(H5Aclose(attr_2_id) < 0) TEST_ERROR
- if(H5Aclose(attr_2a_id) < 0) TEST_ERROR
- if(H5Aclose(attr_3_id) < 0) TEST_ERROR
- if(H5Aclose(attr_3a_id) < 0) TEST_ERROR
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ /* Free memory */
+ HDfree(in_buf);
+ HDfree(out_buf);
- PASSED()
+ PASSED();
return SUCCEED;
error :
H5E_BEGIN_TRY {
- (void)H5Tclose(int_type_id);
- (void)H5Tclose(char_type_id);
(void)H5Pclose(dcpl_id);
- (void)H5Sclose(dspace_id);
- (void)H5Dclose(dset_id);
- (void)H5Dclose(mindset_id);
- (void)H5Aclose(attr_1_id);
- (void)H5Aclose(attr_1a_id);
- (void)H5Aclose(attr_2_id);
- (void)H5Aclose(attr_2a_id);
- (void)H5Aclose(attr_3_id);
- (void)H5Aclose(attr_3a_id);
- (void)H5Fclose(file_id);
+ (void)H5Sclose(sid);
+ (void)H5Dclose(did);
+ (void)H5Aclose(aid);
+ (void)H5Fclose(fid);
} H5E_END_TRY;
+
+ HDfree(in_buf);
+ HDfree(out_buf);
+
return FAIL;
} /* test_minimized_dset_ohdr_attribute_addition */
@@ -1085,19 +1029,24 @@ test_minimized_dset_ohdr_size_comparisons(hid_t fapl_id)
* file-minimized | F_x | F_Y | F_N
*/
- TESTING("minimized dset object headers size comparisons");
/*********
* SETUP *
*********/
+ /* Set filenames (not in a test, can't use TEST_ERROR) */
if(h5_fixname(FILENAME[1], fapl_id, filename_a, sizeof(filename_a)) == NULL)
- TEST_ERROR
-
+ return FAIL;
if(h5_fixname(FILENAME[2], fapl_id, filename_b, sizeof(filename_b)) == NULL)
- TEST_ERROR
+ return FAIL;
for (compact = 0; compact < 2; compact++) { /* 0 or 1 */
+
+ if(compact)
+ TESTING("minimized dset object headers size comparisons (compact)")
+ else
+ TESTING("minimized dset object headers size comparisons")
+
dcpl_default = H5Pcreate(H5P_DATASET_CREATE);
if(dcpl_default < 0) TEST_ERROR
@@ -1112,15 +1061,13 @@ test_minimized_dset_ohdr_size_comparisons(hid_t fapl_id)
if(ret < 0) TEST_ERROR
if(compact) {
- HDprintf("...compact ");
ret = H5Pset_layout(dcpl_default, H5D_COMPACT);
if(ret < 0) TEST_ERROR
ret = H5Pset_layout(dcpl_minimize, H5D_COMPACT);
if(ret < 0) TEST_ERROR
ret = H5Pset_layout(dcpl_dontmin, H5D_COMPACT);
if(ret < 0) TEST_ERROR
- } else
- HDprintf("...not compact ");
+ }
dspace_id = H5Screate_simple(1, array_10, NULL);
if(dspace_id < 0) TEST_ERROR
@@ -1191,9 +1138,10 @@ test_minimized_dset_ohdr_size_comparisons(hid_t fapl_id)
if(H5Dclose(dset_F_N_id) < 0) TEST_ERROR
if(H5Dclose(dset_F_Y_id) < 0) TEST_ERROR
+ PASSED()
+
} /* compact and non-compact */
- PASSED()
return SUCCEED;
error :
diff --git a/test/tattr.c b/test/tattr.c
index 37763da..b83ed9f 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -581,107 +581,118 @@ test_attr_flush(hid_t fapl)
static void
test_attr_plist(hid_t fapl)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t plist; /* Property list ID */
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- hsize_t dims2[] = {ATTR1_DIM1};
- H5T_cset_t cset; /* Character set for attributes */
- herr_t ret; /* Generic return value */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ hid_t did = H5I_INVALID_HID; /* Dataset ID */
+ hid_t dsid = H5I_INVALID_HID; /* Dataspace ID (for dataset) */
+ hid_t asid = H5I_INVALID_HID; /* Dataspace ID (for attribute) */
+ hid_t aid = H5I_INVALID_HID; /* Attribute ID */
+ hid_t acpl_id = H5I_INVALID_HID; /* Attribute creation property list ID */
+ hid_t aapl_id = H5I_INVALID_HID; /* Attribute access property list ID */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims2[] = {ATTR1_DIM1};
+ H5T_cset_t cset; /* Character set for attributes */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Attribute Property Lists\n"));
/* Create file */
- fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- CHECK(fid1, FAIL, "H5Fcreate");
+ fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ CHECK(fid, H5I_INVALID_HID, "H5Fcreate");
/* Create dataspace for dataset */
- sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
- CHECK(sid1, FAIL, "H5Screate_simple");
+ dsid = H5Screate_simple(SPACE1_RANK, dims1, NULL);
+ CHECK(dsid, H5I_INVALID_HID, "H5Screate_simple");
/* Create a dataset */
- dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
- CHECK(dataset, FAIL, "H5Dcreate2");
+ did = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, dsid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
+ CHECK(did, H5I_INVALID_HID, "H5Dcreate2");
/* Create dataspace for attribute */
- sid2 = H5Screate_simple(ATTR1_RANK, dims2, NULL);
- CHECK(sid2, FAIL, "H5Screate_simple");
+ asid = H5Screate_simple(ATTR1_RANK, dims2, NULL);
+ CHECK(asid, H5I_INVALID_HID, "H5Screate_simple");
+
+ /* Create default creation property list for attribute */
+ acpl_id = H5Pcreate(H5P_ATTRIBUTE_CREATE);
+ CHECK(acpl_id, H5I_INVALID_HID, "H5Pcreate");
- /* Create default property list for attribute */
- plist = H5Pcreate(H5P_ATTRIBUTE_CREATE);
- CHECK(plist, FAIL, "H5Pcreate");
+ /* Create default access property list for attribute
+ * This currently has no properties, but we need to test its creation
+ * and use.
+ */
+ aapl_id = H5Pcreate(H5P_ATTRIBUTE_ACCESS);
+ CHECK(aapl_id, H5I_INVALID_HID, "H5Pcreate");
/* Get the character encoding and ensure that it is the default (ASCII) */
- ret = H5Pget_char_encoding(plist, &cset);
+ ret = H5Pget_char_encoding(acpl_id, &cset);
CHECK(ret, FAIL, "H5Pget_char_encoding");
VERIFY(cset, H5T_CSET_ASCII, "H5Pget_char_encoding");
/* Create an attribute for the dataset using the property list */
- attr = H5Acreate2(dataset, ATTR1_NAME, H5T_NATIVE_INT, sid2, plist, H5P_DEFAULT);
- CHECK(attr, FAIL, "H5Acreate2");
+ aid = H5Acreate2(did, ATTR1_NAME, H5T_NATIVE_INT, asid, acpl_id, aapl_id);
+ CHECK(aid, H5I_INVALID_HID, "H5Acreate2");
- /* Close the property list, and get the attribute's property list */
- ret = H5Pclose(plist);
+ /* Close the property list, and get the attribute's creation property list */
+ ret = H5Pclose(acpl_id);
CHECK(ret, FAIL, "H5Pclose");
- plist = H5Aget_create_plist(attr);
- CHECK(plist, FAIL, "H5Aget_create_plist");
+ acpl_id = H5Aget_create_plist(aid);
+ CHECK(acpl_id, H5I_INVALID_HID, "H5Aget_create_plist");
/* Get the character encoding and ensure that it is the default (ASCII) */
- ret = H5Pget_char_encoding(plist, &cset);
+ ret = H5Pget_char_encoding(acpl_id, &cset);
CHECK(ret, FAIL, "H5Pget_char_encoding");
VERIFY(cset, H5T_CSET_ASCII, "H5Pget_char_encoding");
/* Close the property list and attribute */
- ret = H5Pclose(plist);
+ ret = H5Pclose(acpl_id);
CHECK(ret, FAIL, "H5Pclose");
- ret = H5Aclose(attr);
+ ret = H5Aclose(aid);
CHECK(ret, FAIL, "H5Aclose");
/* Create a new property list and modify it to use a different encoding */
- plist = H5Pcreate(H5P_ATTRIBUTE_CREATE);
- CHECK(plist, FAIL, "H5Pcreate");
- ret = H5Pset_char_encoding(plist, H5T_CSET_UTF8);
+ acpl_id = H5Pcreate(H5P_ATTRIBUTE_CREATE);
+ CHECK(acpl_id, H5I_INVALID_HID, "H5Pcreate");
+ ret = H5Pset_char_encoding(acpl_id, H5T_CSET_UTF8);
CHECK(ret, FAIL, "H5Pset_char_encoding");
/* Get the character encoding and ensure that it has been changed */
- ret = H5Pget_char_encoding(plist, &cset);
+ ret = H5Pget_char_encoding(acpl_id, &cset);
CHECK(ret, FAIL, "H5Pget_char_encoding");
VERIFY(cset, H5T_CSET_UTF8, "H5Pget_char_encoding");
/* Create an attribute for the dataset using the modified property list */
- attr = H5Acreate2(dataset, ATTR2_NAME, H5T_NATIVE_INT, sid2, plist, H5P_DEFAULT);
- CHECK(attr, FAIL, "H5Acreate2");
+ aid = H5Acreate2(did, ATTR2_NAME, H5T_NATIVE_INT, asid, acpl_id, aapl_id);
+ CHECK(aid, H5I_INVALID_HID, "H5Acreate2");
/* Close the property list and attribute */
- ret = H5Pclose(plist);
+ ret = H5Pclose(acpl_id);
CHECK(ret, FAIL, "H5Pclose");
- ret = H5Aclose(attr);
+ ret = H5Aclose(aid);
CHECK(ret, FAIL, "H5Aclose");
/* Re-open the second attribute and ensure that its character encoding is correct */
- attr = H5Aopen(dataset, ATTR2_NAME, H5P_DEFAULT);
- CHECK(attr, FAIL, "H5Aopen");
- plist = H5Aget_create_plist(attr);
- CHECK(plist, FAIL, "H5Aget_create_plist");
- ret = H5Pget_char_encoding(plist, &cset);
+ aid = H5Aopen(did, ATTR2_NAME, H5P_DEFAULT);
+ CHECK(aid, H5I_INVALID_HID, "H5Aopen");
+ acpl_id = H5Aget_create_plist(aid);
+ CHECK(acpl_id, H5I_INVALID_HID, "H5Aget_create_plist");
+ ret = H5Pget_char_encoding(acpl_id, &cset);
CHECK(ret, FAIL, "H5Pget_char_encoding");
VERIFY(cset, H5T_CSET_UTF8, "H5Pget_char_encoding");
/* Close everything */
- ret=H5Sclose(sid1);
+ ret = H5Sclose(dsid);
CHECK(ret, FAIL, "H5Sclose");
- ret=H5Sclose(sid2);
+ ret = H5Sclose(asid);
CHECK(ret, FAIL, "H5Sclose");
- ret = H5Pclose(plist);
+ ret = H5Pclose(aapl_id);
+ CHECK(ret, FAIL, "H5Pclose");
+ ret = H5Pclose(acpl_id);
CHECK(ret, FAIL, "H5Pclose");
- ret=H5Aclose(attr);
+ ret = H5Aclose(aid);
CHECK(ret, FAIL, "H5Aclose");
- ret=H5Dclose(dataset);
+ ret = H5Dclose(did);
CHECK(ret, FAIL, "H5Dclose");
- ret=H5Fclose(fid1);
+ ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
} /* test_attr_plist() */
diff --git a/test/tfile.c b/test/tfile.c
index 695d437..140bd14 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -169,6 +169,15 @@ const char *FILESPACE_NAME[] = {
NULL
};
+
+/* Declarations for test_libver_bounds_copy(): */
+/* SRC_FILE: source file created under 1.8 branch with latest format */
+/* DST_FILE: destination file for copying the dataset in SRC_FILE */
+/* DSET_DS1: the dataset created in SRC_FILE to be copied to DST_FILE */
+#define SRC_FILE "fill18.h5"
+#define DST_FILE "fill18_copy.h5"
+#define DSET_DS1 "DS1"
+
/* Local test function declarations for version bounds */
static void test_libver_bounds_low_high(void);
static void test_libver_bounds_super(hid_t fapl);
@@ -1850,6 +1859,102 @@ test_file_ishdf5(const char *env_h5_drvr)
} /* end test_file_ishdf5() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+/****************************************************************
+**
+** test_file_delete(): tests H5Fdelete for all VFDs
+**
+*****************************************************************/
+#define FILE_DELETE "test_file_delete"
+#define FILE_DELETE_NOT_HDF5 "test_file_delete_not_hdf5"
+static void
+test_file_delete(hid_t fapl_id)
+{
+ hid_t fid = H5I_INVALID_HID; /* File to be deleted */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ htri_t is_hdf5; /* Whether a file is an HDF5 file */
+ int fd; /* POSIX file descriptor */
+ int iret;
+ herr_t ret;
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing Deletion of HDF5 Files\n"));
+
+ /*************/
+ /* HDF5 FILE */
+ /*************/
+
+ /* This is just a placeholder until the native VOL connector supports
+ * H5Fdelete().
+ */
+
+ /* Get fapl-dependent filename */
+ h5_fixname(FILE_DELETE, fapl_id, filename, sizeof(filename));
+
+ /* Create a file */
+ fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
+ CHECK(fid, H5I_INVALID_HID, "H5Fcreate");
+
+ /* Close file */
+ ret = H5Fclose(fid);
+ VERIFY(ret, SUCCEED, "H5Fclose");
+
+ /* Verify that the file is an HDF5 file */
+ is_hdf5 = H5Fis_accessible(filename, fapl_id);
+ VERIFY(is_hdf5, TRUE, "H5Fis_accessible");
+
+ /* Attempt to delete the file - should fail */
+ H5E_BEGIN_TRY {
+ ret = H5Fdelete(filename, fapl_id);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Fdelete");
+
+ /* Verify that the file still exists */
+ is_hdf5 = H5Fis_accessible(filename, fapl_id);
+ VERIFY(is_hdf5, TRUE, "H5Fis_accessible");
+
+ /* Actually delete the test file */
+ h5_delete_test_file(FILE_DELETE, fapl_id);
+
+ /*****************/
+ /* NON-HDF5 FILE */
+ /*****************/
+
+ /* Get fapl-dependent filename */
+ h5_fixname(FILE_DELETE_NOT_HDF5, fapl_id, filename, sizeof(filename));
+
+ /* Create a non-HDF5 file */
+ fd = HDopen(filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW);
+ CHECK_I(fd, "HDopen");
+
+ /* Close the file */
+ ret = HDclose(fd);
+ VERIFY(ret, 0, "HDclose");
+
+ /* Verify that the file is not an HDF5 file */
+ /* Note that you can get a FAIL result when h5_fixname()
+ * perturbs the filename as a file with that exact name
+ * may not have been created since we created it with
+ * open(2) and not the library.
+ */
+ H5E_BEGIN_TRY {
+ is_hdf5 = H5Fis_accessible(filename, fapl_id);
+ } H5E_END_TRY;
+ CHECK(is_hdf5, TRUE, "H5Fis_accessible");
+
+ /* Try to delete it (should fail) */
+ H5E_BEGIN_TRY {
+ ret = H5Fdelete(filename, fapl_id);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Fdelete");
+
+ /* Delete the file */
+ iret = HDremove(filename);
+ VERIFY(iret, 0, "HDremove");
+
+} /* end test_file_delete() */
+
+
/****************************************************************
**
** test_file_open_dot(): low-level file test routine.
@@ -5277,6 +5382,79 @@ test_libver_bounds_open(void)
} /* end test_libver_bounds_open() */
+/*-------------------------------------------------------------------------
+ * Function: test_libver_bounds_copy
+ *
+ * Purpose: Test to verify HDFFV-10800 is fixed:
+ * This test is copied from the user test program: copy10.c.
+ * (See attached programs in the jira issue.)
+ *
+ * The source file used in the test is generated by the user test
+ * program "fill18.c" with the 1.8 library. The file is created
+ * with the latest format and the dataset created in the file
+ * has version 3 fill value message (latest).
+ *
+ * The test creates the destination file with (v18, v18) version bounds.
+ * H5Ocopy() should succeed in copying the dataset in the source file
+ * to the destination file.
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+test_libver_bounds_copy(void)
+{
+ hid_t src_fid = -1; /* File ID */
+ hid_t dst_fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property list ID */
+ const char *src_fname; /* Source file name */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about the test being performed */
+ MESSAGE(5, ("Testing H5Ocopy a dataset in a 1.8 library file to a 1.10 library file\n"));
+
+ /* Get the test file name */
+ src_fname = H5_get_srcdir_filename(SRC_FILE);
+
+ /* Open the source test file */
+ src_fid = H5Fopen(src_fname, H5F_ACC_RDONLY, H5P_DEFAULT);
+ CHECK(src_fid, FAIL, "H5Fopen");
+
+ /* Create file access property list */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
+
+ /* Set library version bounds to (v18, v18) */
+ ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_V18, H5F_LIBVER_V18);
+ CHECK(ret, FAIL, "H5Pset_libver_bounds");
+
+ /* Create the destination file with the fapl */
+ dst_fid = H5Fcreate(DST_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ CHECK(dst_fid, FAIL, "H5Pcreate");
+
+ /* Close the fapl */
+ ret = H5Pclose(fapl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Copy the dataset in the source file to the destination file */
+ ret = H5Ocopy(src_fid, DSET_DS1, dst_fid, DSET_DS1, H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret, SUCCEED, "H5Ocopy");
+
+ /* Close the source file */
+ ret = H5Fclose(src_fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Close the destination file */
+ ret = H5Fclose(dst_fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Remove the destination file */
+ HDremove(DST_FILE);
+
+} /* end test_libver_bounds_copy() */
+
/****************************************************************
**
** test_libver_bounds():
@@ -5295,6 +5473,7 @@ test_libver_bounds(void)
test_libver_bounds_real(H5F_LIBVER_EARLIEST, 1, H5F_LIBVER_LATEST, 2);
test_libver_bounds_real(H5F_LIBVER_LATEST, 2, H5F_LIBVER_EARLIEST, 2);
test_libver_bounds_open();
+ test_libver_bounds_copy();
} /* end test_libver_bounds() */
/**************************************************************************************
@@ -7606,6 +7785,8 @@ void
test_file(void)
{
const char *env_h5_drvr; /* File Driver value from environment */
+ hid_t fapl_id = H5I_INVALID_HID; /* VFD-dependent fapl ID */
+ herr_t ret;
/* Output message about test being performed */
MESSAGE(5, ("Testing Low-Level File I/O\n"));
@@ -7615,6 +7796,10 @@ test_file(void)
if(env_h5_drvr == NULL)
env_h5_drvr = "nomatch";
+ /* Improved version of VFD-dependent checks */
+ fapl_id = h5_fileaccess();
+ CHECK(fapl_id, H5I_INVALID_HID, "h5_fileaccess");
+
test_file_create(); /* Test file creation(also creation templates)*/
test_file_open(); /* Test file opening */
test_file_reopen(); /* Test file reopening */
@@ -7624,6 +7809,7 @@ test_file(void)
test_file_perm(); /* Test file access permissions */
test_file_perm2(); /* Test file access permission again */
test_file_is_accessible(env_h5_drvr); /* Test detecting HDF5 files correctly */
+ test_file_delete(fapl_id); /* Test H5Fdelete */
test_file_open_dot(); /* Test opening objects with "." for a name */
test_file_open_overlap(); /* Test opening files in an overlapping manner */
test_file_getname(); /* Test basic H5Fget_name() functionality */
@@ -7662,6 +7848,10 @@ test_file(void)
test_file_ishdf5(env_h5_drvr); /* Test detecting HDF5 files correctly */
test_deprec(); /* Test deprecated routines */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+ ret = H5Pclose(fapl_id);
+ CHECK(ret, FAIL, "H5Pclose");
+
} /* test_file() */
@@ -7690,5 +7880,6 @@ cleanup_file(void)
HDremove(FILE5);
HDremove(FILE6);
HDremove(FILE7);
+ HDremove(DST_FILE);
}
diff --git a/test/tselect.c b/test/tselect.c
index 842fe17..d912df5 100644
--- a/test/tselect.c
+++ b/test/tselect.c
@@ -173,6 +173,9 @@
#define SPACE13_DIM3 50
#define SPACE13_NPOINTS 4
+/* Information for testing selection iterators */
+#define SEL_ITER_MAX_SEQ 256
+
/* Location comparison function */
static int compare_size_t(const void *s1, const void *s2);
@@ -4918,6 +4921,466 @@ test_select_hyper_union(void)
/****************************************************************
**
+** test_select_hyper_union_stagger(): Test basic H5S (dataspace) selection code.
+** Tests unions of staggered hyperslabs. (Uses H5Scombine_hyperslab
+** and H5Smodify_select instead of H5Sselect_hyperslab)
+**
+****************************************************************/
+static void
+test_select_hyper_union_stagger(void)
+{
+ hid_t file_id; /* File ID */
+ hid_t dset_id; /* Dataset ID */
+ hid_t dataspace; /* File dataspace ID */
+ hid_t memspace; /* Memory dataspace ID */
+ hid_t tmp_space; /* Temporary dataspace ID */
+ hid_t tmp2_space; /* Another emporary dataspace ID */
+ hsize_t dimsm[2]={7,7}; /* Memory array dimensions */
+ hsize_t dimsf[2]={6,5}; /* File array dimensions */
+ hsize_t count[2]={3,1}; /* 1st Hyperslab size */
+ hsize_t count2[2]={3,1}; /* 2nd Hyperslab size */
+ hsize_t count3[2]={2,1}; /* 3rd Hyperslab size */
+ hsize_t start[2]={0,0}; /* 1st Hyperslab offset */
+ hsize_t start2[2]={2,1}; /* 2nd Hyperslab offset */
+ hsize_t start3[2]={4,2}; /* 3rd Hyperslab offset */
+ hsize_t count_out[2]={4,2}; /* Hyperslab size in memory */
+ hsize_t start_out[2]={0,3}; /* Hyperslab offset in memory */
+ int data[6][5]; /* Data to write */
+ int data_out[7][7]; /* Data read in */
+ int input_loc[8][2]={{0,0},
+ {1,0},
+ {2,0},
+ {2,1},
+ {3,1},
+ {4,1},
+ {4,2},
+ {5,2}};
+ int output_loc[8][2]={{0,3},
+ {0,4},
+ {1,3},
+ {1,4},
+ {2,3},
+ {2,4},
+ {3,3},
+ {3,4}};
+ int dsetrank=2; /* File Dataset rank */
+ int memrank=2; /* Memory Dataset rank */
+ int i,j; /* Local counting variables */
+ herr_t error;
+ hsize_t stride[2]={1,1};
+ hsize_t block[2]={1,1};
+
+ /* Initialize data to write */
+ for(i=0; i<6; i++)
+ for(j=0; j<5; j++)
+ data[i][j] = j*10 + i;
+
+ /* Create file */
+ file_id=H5Fcreate(FILENAME,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT);
+ CHECK(file_id, FAIL, "H5Fcreate");
+
+ /* Create File Dataspace */
+ dataspace=H5Screate_simple(dsetrank,dimsf,NULL);
+ CHECK(dataspace, FAIL, "H5Screate_simple");
+
+ /* Create File Dataset */
+ dset_id=H5Dcreate2(file_id,"IntArray",H5T_NATIVE_INT,dataspace,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dset_id, FAIL, "H5Dcreate2");
+
+ /* Write File Dataset */
+ error=H5Dwrite(dset_id,H5T_NATIVE_INT,dataspace,dataspace,H5P_DEFAULT,data);
+ CHECK(error, FAIL, "H5Dwrite");
+
+ /* Close things */
+ error=H5Sclose(dataspace);
+ CHECK(error, FAIL, "H5Sclose");
+ error = H5Dclose(dset_id);
+ CHECK(error, FAIL, "H5Dclose");
+ error = H5Fclose(file_id);
+ CHECK(error, FAIL, "H5Fclose");
+
+ /* Initialize intput buffer */
+ memset(data_out, 0, 7 * 7 * sizeof(int));
+
+ /* Open file */
+ file_id = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
+ CHECK(file_id, FAIL, "H5Fopen");
+
+ /* Open dataset */
+ dset_id = H5Dopen2(file_id, "IntArray", H5P_DEFAULT);
+ CHECK(dset_id, FAIL, "H5Dopen2");
+
+ /* Get the dataspace */
+ dataspace = H5Dget_space(dset_id);
+ CHECK(dataspace, FAIL, "H5Dget_space");
+
+ /* Select the hyperslabs */
+ error = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block);
+ CHECK(error, FAIL, "H5Sselect_hyperslab");
+ tmp_space = H5Scombine_hyperslab(dataspace, H5S_SELECT_OR, start2, stride, count2, block);
+ CHECK(tmp_space, FAIL, "H5Scombine_hyperslab");
+
+ /* Copy the file dataspace and select hyperslab */
+ tmp2_space = H5Scopy(dataspace);
+ CHECK(tmp2_space, FAIL, "H5Scopy");
+ error=H5Sselect_hyperslab(tmp2_space, H5S_SELECT_SET, start3, stride, count3, block);
+ CHECK(error, FAIL, "H5Sselect_hyperslab");
+
+ /* Combine the copied dataspace with the temporary dataspace */
+ error=H5Smodify_select(tmp_space,H5S_SELECT_OR,tmp2_space);
+ CHECK(error, FAIL, "H5Smodify_select");
+
+ /* Create Memory Dataspace */
+ memspace=H5Screate_simple(memrank,dimsm,NULL);
+ CHECK(memspace, FAIL, "H5Screate_simple");
+
+ /* Select hyperslab in memory */
+ error=H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start_out, stride, count_out, block);
+ CHECK(error, FAIL, "H5Sselect_hyperslab");
+
+ /* Read File Dataset */
+ error=H5Dread(dset_id,H5T_NATIVE_INT,memspace,tmp_space,H5P_DEFAULT,data_out);
+ CHECK(error, FAIL, "H5Dread");
+
+ /* Verify input data */
+ for(i=0; i<8; i++) {
+ if(data[input_loc[i][0]][input_loc[i][1]]!=data_out[output_loc[i][0]][output_loc[i][1]]) {
+ printf("input data #%d is wrong!\n",i);
+ printf("input_loc=[%d][%d]\n",input_loc[i][0],input_loc[i][1]);
+ printf("output_loc=[%d][%d]\n",output_loc[i][0],output_loc[i][1]);
+ printf("data=%d\n",data[input_loc[i][0]][input_loc[i][1]]);
+ TestErrPrintf("data_out=%d\n",data_out[output_loc[i][0]][output_loc[i][1]]);
+ } /* end if */
+ } /* end for */
+
+ /* Close things */
+ error=H5Sclose(tmp2_space);
+ CHECK(error, FAIL, "H5Sclose");
+ error=H5Sclose(tmp_space);
+ CHECK(error, FAIL, "H5Sclose");
+ error=H5Sclose(dataspace);
+ CHECK(error, FAIL, "H5Sclose");
+ error=H5Sclose(memspace);
+ CHECK(error, FAIL, "H5Sclose");
+ error=H5Dclose(dset_id);
+ CHECK(error, FAIL, "H5Dclose");
+ error=H5Fclose(file_id);
+ CHECK(error, FAIL, "H5Fclose");
+}
+
+/****************************************************************
+**
+** test_select_hyper_union_3d(): Test basic H5S (dataspace) selection code.
+** Tests unions of hyperslabs in 3-D (Uses H5Scombine_hyperslab
+** and H5Scombine_select instead of H5Sselect_hyperslab)
+**
+****************************************************************/
+static void
+test_select_hyper_union_3d(void)
+{
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1,sid2; /* Dataspace ID */
+ hid_t tmp_space; /* Temporary Dataspace ID */
+ hid_t tmp2_space; /* Another temporary Dataspace ID */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims2[] = {SPACE4_DIM1, SPACE4_DIM2, SPACE4_DIM3};
+ hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
+ hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
+ struct row_list {
+ size_t z;
+ size_t y;
+ size_t x;
+ size_t l;
+ } rows[]= { /* Array of x,y,z coordinates & length for each row written from memory */
+ {0,0,0,6}, /* 1st face of 3-D object */
+ {0,1,0,6},
+ {0,2,0,6},
+ {0,3,0,6},
+ {0,4,0,6},
+ {1,0,0,6}, /* 2nd face of 3-D object */
+ {1,1,0,6},
+ {1,2,0,6},
+ {1,3,0,6},
+ {1,4,0,6},
+ {2,0,0,6}, /* 3rd face of 3-D object */
+ {2,1,0,10},
+ {2,2,0,10},
+ {2,3,0,10},
+ {2,4,0,10},
+ {2,5,2,8},
+ {2,6,2,8},
+ {3,0,0,6}, /* 4th face of 3-D object */
+ {3,1,0,10},
+ {3,2,0,10},
+ {3,3,0,10},
+ {3,4,0,10},
+ {3,5,2,8},
+ {3,6,2,8},
+ {4,0,0,6}, /* 5th face of 3-D object */
+ {4,1,0,10},
+ {4,2,0,10},
+ {4,3,0,10},
+ {4,4,0,10},
+ {4,5,2,8},
+ {4,6,2,8},
+ {5,1,2,8}, /* 6th face of 3-D object */
+ {5,2,2,8},
+ {5,3,2,8},
+ {5,4,2,8},
+ {5,5,2,8},
+ {5,6,2,8},
+ {6,1,2,8}, /* 7th face of 3-D object */
+ {6,2,2,8},
+ {6,3,2,8},
+ {6,4,2,8},
+ {6,5,2,8},
+ {6,6,2,8},
+ {7,1,2,8}, /* 8th face of 3-D object */
+ {7,2,2,8},
+ {7,3,2,8},
+ {7,4,2,8},
+ {7,5,2,8},
+ {7,6,2,8}};
+ uint8_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf, /* temporary buffer pointer */
+ *tbuf2; /* temporary buffer pointer */
+ int i,j,k; /* Counters */
+ herr_t ret; /* Generic return value */
+ hsize_t npoints; /* Number of elements in selection */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing Hyperslab Selection Functions with unions of 3-D hyperslabs\n"));
+
+ /* Allocate write & read buffers */
+ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE4_DIM1 * SPACE4_DIM2 * SPACE4_DIM3);
+ CHECK(wbuf, NULL, "HDmalloc");
+ rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), SPACE3_DIM1 * SPACE3_DIM2);
+ CHECK(rbuf, NULL, "HDcalloc");
+
+ /* Initialize write buffer */
+ for(i=0, tbuf=wbuf; i<SPACE4_DIM1; i++)
+ for(j=0; j<SPACE4_DIM2; j++)
+ for(k=0; k<SPACE4_DIM3; k++)
+ *tbuf++=(uint8_t)((((i*SPACE4_DIM2)+j)*SPACE4_DIM3)+k);
+
+ /* Create file */
+ fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(fid1, FAIL, "H5Fcreate");
+
+/* Test case of two blocks which overlap corners and must be split */
+ /* Create dataspace for dataset on disk */
+ sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
+ CHECK(sid1, FAIL, "H5Screate_simple");
+
+ /* Create dataspace for writing buffer */
+ sid2 = H5Screate_simple(SPACE4_RANK, dims2, NULL);
+ CHECK(sid2, FAIL, "H5Screate_simple");
+
+ /* Select 2x15x13 hyperslab for disk dataset */
+ start[0]=1; start[1]=0; start[2]=0;
+ stride[0]=1; stride[1]=1; stride[2]=1;
+ count[0]=2; count[1]=15; count[2]=13;
+ block[0]=1; block[1]=1; block[2]=1;
+ ret = H5Sselect_hyperslab(sid1,H5S_SELECT_SET,start,stride,count,block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Select 5x5x6 hyperslab for memory dataset */
+ start[0]=0; start[1]=0; start[2]=0;
+ stride[0]=1; stride[1]=1; stride[2]=1;
+ count[0]=5; count[1]=5; count[2]=6;
+ block[0]=1; block[1]=1; block[2]=1;
+ ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Union overlapping 15x20 hyperslab for memory dataset (forming a irregularly shaped region) */
+ start[0]=2; start[1]=1; start[2]=2;
+ stride[0]=1; stride[1]=1; stride[2]=1;
+ count[0]=6; count[1]=6; count[2]=8;
+ block[0]=1; block[1]=1; block[2]=1;
+ tmp_space = H5Scombine_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ CHECK(tmp_space, FAIL, "H5Sselect_hyperslab");
+
+ /* Combine dataspaces and create new dataspace */
+ tmp2_space = H5Scombine_select(sid2,H5S_SELECT_OR,tmp_space);
+ CHECK(tmp2_space, FAIL, "H5Scombin_select");
+
+ npoints = (hsize_t)H5Sget_select_npoints(tmp2_space);
+ VERIFY(npoints, 15*26, "H5Sget_select_npoints");
+
+ /* Create a dataset */
+ dataset = H5Dcreate2(fid1, SPACE1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
+
+ /* Write selection to disk */
+ ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,tmp2_space,sid1,H5P_DEFAULT,wbuf);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Close temporary dataspaces */
+ ret = H5Sclose(tmp_space);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(tmp2_space);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close memory dataspace */
+ ret = H5Sclose(sid2);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Create dataspace for reading buffer */
+ sid2 = H5Screate_simple(SPACE3_RANK, dims3, NULL);
+ CHECK(sid2, FAIL, "H5Screate_simple");
+
+ /* Select 15x26 hyperslab for reading memory dataset */
+ start[0]=0; start[1]=0;
+ stride[0]=1; stride[1]=1;
+ count[0]=15; count[1]=26;
+ block[0]=1; block[1]=1;
+ ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Read selection from disk */
+ ret=H5Dread(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,rbuf);
+ CHECK(ret, FAIL, "H5Dread");
+
+ /* Compare data read with data written out */
+ for(i=0,tbuf2=rbuf; i<(int)(sizeof(rows)/sizeof(struct row_list)); i++) {
+ tbuf=wbuf+(rows[i].z*SPACE4_DIM3*SPACE4_DIM2)+(rows[i].y*SPACE4_DIM3)+rows[i].x;
+ for(j=0; j<(int)rows[i].l; j++, tbuf++, tbuf2++) {
+ if(*tbuf!=*tbuf2)
+ TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2);
+ } /* end for */
+ } /* end for */
+
+ /* Close memory dataspace */
+ ret = H5Sclose(sid2);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close disk dataspace */
+ ret = H5Sclose(sid1);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Close file */
+ ret = H5Fclose(fid1);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Free memory buffers */
+ HDfree(wbuf);
+ HDfree(rbuf);
+} /* test_select_hyper_union_3d() */
+
+/****************************************************************
+**
+** test_select_hyper_valid_combination(): Tests invalid and valid
+** combinations of selections on dataspace for H5Scombine_select
+** and H5Smodify_select.
+**
+****************************************************************/
+static void
+test_select_hyper_valid_combination(void)
+{
+ hid_t single_pt_sid; /* Dataspace ID with single point selection */
+ hid_t single_hyper_sid; /* Dataspace ID with single block hyperslab selection */
+ hid_t regular_hyper_sid; /* Dataspace ID with regular hyperslab selection */
+ hid_t non_existent_sid = -1; /* A non-existent space id */
+ hid_t tmp_sid; /* Temporary dataspace ID */
+ hsize_t dims2D[] = {SPACE9_DIM1, SPACE9_DIM2};
+ hsize_t dims3D[] = {SPACE4_DIM1, SPACE4_DIM2, SPACE4_DIM3};
+
+ hsize_t coord1[1][SPACE2_RANK]; /* Coordinates for single point selection */
+ hsize_t start[SPACE4_RANK]; /* Hyperslab start */
+ hsize_t stride[SPACE4_RANK]; /* Hyperslab stride */
+ hsize_t count[SPACE4_RANK]; /* Hyperslab block count */
+ hsize_t block[SPACE4_RANK]; /* Hyperslab block size */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(6, ("Testing Selection Combination Validity\n"));
+ assert(SPACE9_DIM2>=POINT1_NPOINTS);
+
+ /* Create dataspace for single point selection */
+ single_pt_sid = H5Screate_simple(SPACE9_RANK, dims2D, NULL);
+ CHECK(single_pt_sid, FAIL, "H5Screate_simple");
+
+ /* Select sequence of ten points for multiple point selection */
+ coord1[0][0] = 2; coord1[0][1] = 2;
+ ret = H5Sselect_elements(single_pt_sid, H5S_SELECT_SET, (size_t)1, (const hsize_t *)coord1);
+ CHECK(ret, FAIL, "H5Sselect_elements");
+
+ /* Create dataspace for single hyperslab selection */
+ single_hyper_sid = H5Screate_simple(SPACE9_RANK, dims2D, NULL);
+ CHECK(single_hyper_sid, FAIL, "H5Screate_simple");
+
+ /* Select 10x10 hyperslab for single hyperslab selection */
+ start[0]=1; start[1]=1;
+ stride[0]=1; stride[1]=1;
+ count[0]=1; count[1]=1;
+ block[0]=(SPACE9_DIM1-2); block[1]=(SPACE9_DIM2-2);
+ ret = H5Sselect_hyperslab(single_hyper_sid,H5S_SELECT_SET,start,stride,count,block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Create dataspace for regular hyperslab selection */
+ regular_hyper_sid = H5Screate_simple(SPACE4_RANK, dims3D, NULL);
+ CHECK(regular_hyper_sid, FAIL, "H5Screate_simple");
+
+ /* Select regular, strided hyperslab selection */
+ start[0]=2; start[1]=2; start[2]=2;
+ stride[0]=2; stride[1]=2; stride[2]=2;
+ count[0]=5; count[1]=2; count[2]=5;
+ block[0]=1; block[1]=1; block[2]=1;
+ ret = H5Sselect_hyperslab(regular_hyper_sid,H5S_SELECT_SET,start,stride,count,block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+
+ /* Test all the selections created */
+
+ /* Test the invalid combinations between point and hyperslab */
+ tmp_sid = H5Scombine_select(single_pt_sid, H5S_SELECT_AND, single_hyper_sid);
+ VERIFY(tmp_sid, FAIL, "H5Scombine_select");
+
+ tmp_sid = H5Smodify_select(single_pt_sid, H5S_SELECT_AND, single_hyper_sid);
+ VERIFY(tmp_sid, FAIL, "H5Smodify_select");
+
+ /* Test the invalid combination between two hyperslab but of different dimension size */
+ tmp_sid = H5Scombine_select(single_hyper_sid, H5S_SELECT_AND, regular_hyper_sid);
+ VERIFY(tmp_sid, FAIL, "H5Scombine_select");
+
+ tmp_sid = H5Smodify_select(single_hyper_sid, H5S_SELECT_AND, regular_hyper_sid);
+ VERIFY(tmp_sid, FAIL, "H5Smodify_select");
+
+ /* Test invalid operation inputs to the two functions */
+ tmp_sid = H5Scombine_select(single_hyper_sid, H5S_SELECT_SET, single_hyper_sid);
+ VERIFY(tmp_sid, FAIL, "H5Scombine_select");
+
+ tmp_sid = H5Smodify_select(single_hyper_sid, H5S_SELECT_SET, single_hyper_sid);
+ VERIFY(tmp_sid, FAIL, "H5Smodify_select");
+
+ /* Test inputs in case of non-existent space ids */
+ tmp_sid = H5Scombine_select(single_hyper_sid, H5S_SELECT_AND, non_existent_sid);
+ VERIFY(tmp_sid, FAIL, "H5Scombine_select");
+
+ tmp_sid = H5Smodify_select(single_hyper_sid, H5S_SELECT_AND, non_existent_sid);
+ VERIFY(tmp_sid, FAIL, "H5Smodify_select");
+
+ /* Close dataspaces */
+ ret = H5Sclose(single_pt_sid);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(single_hyper_sid);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(regular_hyper_sid);
+ CHECK(ret, FAIL, "H5Sclose");
+} /* test_select_hyper_valid_combination() */
+
+
+/****************************************************************
+**
** test_select_hyper_and_2d(): Test basic H5S (dataspace) selection code.
** Tests 'and' of hyperslabs in 2-D
**
@@ -14453,6 +14916,283 @@ test_irreg_io(void)
/****************************************************************
**
+** test_sel_iter(): Test selection iterator API routines.
+**
+****************************************************************/
+static void
+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 dims2[] = {32}; /* 1-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 */
+ hsize_t block[2]; /* Hyperslab block size */
+ size_t nseq; /* # of sequences retrieved */
+ size_t nbytes; /* # of bytes retrieved */
+ hsize_t off[SEL_ITER_MAX_SEQ]; /* Offsets for retrieved sequences */
+ size_t len[SEL_ITER_MAX_SEQ]; /* Lengths for retrieved sequences */
+ 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 */
+
+ /* Output message about test being performed */
+ MESSAGE(6, ("Testing Dataspace Selection Iterators\n"));
+
+ /* Create dataspace */
+ sid = H5Screate_simple(2, dims1, NULL);
+ CHECK(sid, FAIL, "H5Screate_simple");
+
+
+ /* Try creating selection iterator object with bad parameters */
+ H5E_BEGIN_TRY { /* Bad dataspace ID */
+ iter_id = H5Ssel_iter_create(H5I_INVALID_HID, (size_t)1, (unsigned)0);
+ } H5E_END_TRY;
+ VERIFY(iter_id, FAIL, "H5Ssel_iter_create");
+ H5E_BEGIN_TRY { /* Bad element size */
+ iter_id = H5Ssel_iter_create(sid, (size_t)0, (unsigned)0);
+ } H5E_END_TRY;
+ VERIFY(iter_id, FAIL, "H5Ssel_iter_create");
+ H5E_BEGIN_TRY { /* Bad flag(s) */
+ iter_id = H5Ssel_iter_create(sid, (size_t)1, (unsigned)0xffff);
+ } H5E_END_TRY;
+ VERIFY(iter_id, FAIL, "H5Ssel_iter_create");
+
+ /* Try closing selection iterator, with bad parameters */
+ H5E_BEGIN_TRY { /* Invalid ID */
+ ret = H5Ssel_iter_close(H5I_INVALID_HID);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Ssel_iter_close");
+ H5E_BEGIN_TRY { /* Not a selection iterator ID */
+ ret = H5Ssel_iter_close(sid);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Ssel_iter_close");
+
+
+ /* Try with no selection sharing, and with sharing */
+ for(sel_share = 0; sel_share < 2; sel_share++) {
+ /* Set selection iterator sharing flags */
+ if(sel_share)
+ sel_iter_flags = H5S_SEL_ITER_SHARE_WITH_DATASPACE;
+ else
+ sel_iter_flags = 0;
+
+ /* Create selection iterator object */
+ iter_id = H5Ssel_iter_create(sid, (size_t)1, (unsigned)sel_iter_flags);
+ CHECK(iter_id, FAIL, "H5Ssel_iter_create");
+
+ /* Close selection iterator */
+ ret = H5Ssel_iter_close(iter_id);
+ CHECK(ret, FAIL, "H5Ssel_iter_close");
+
+ /* Try closing selection iterator twice */
+ H5E_BEGIN_TRY { /* Invalid ID */
+ ret = H5Ssel_iter_close(iter_id);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Ssel_iter_close");
+
+
+ /* Create selection iterator object */
+ iter_id = H5Ssel_iter_create(sid, (size_t)1, (unsigned)sel_iter_flags);
+ CHECK(iter_id, FAIL, "H5Ssel_iter_create");
+
+ /* Try retrieving sequences, with bad parameters */
+ H5E_BEGIN_TRY { /* Invalid ID */
+ ret = H5Ssel_iter_get_seq_list(H5I_INVALID_HID, (size_t)1, (size_t)1, &nseq, &nbytes, off, len);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Ssel_iter_get_seq_list");
+ H5E_BEGIN_TRY { /* Invalid nseq pointer */
+ ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)1, (size_t)1, NULL, &nbytes, off, len);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Ssel_iter_get_seq_list");
+ H5E_BEGIN_TRY { /* Invalid nbytes pointer */
+ ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)1, (size_t)1, &nseq, NULL, off, len);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Ssel_iter_get_seq_list");
+ H5E_BEGIN_TRY { /* Invalid offset array */
+ ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)1, (size_t)1, &nseq, &nbytes, NULL, len);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Ssel_iter_get_seq_list");
+ H5E_BEGIN_TRY { /* Invalid length array */
+ ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)1, (size_t)1, &nseq, &nbytes, off, NULL);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Ssel_iter_get_seq_list");
+
+ /* Close selection iterator */
+ ret = H5Ssel_iter_close(iter_id);
+ CHECK(ret, FAIL, "H5Ssel_iter_close");
+
+
+ /* Test iterators on various basic selection types */
+ for(sel_type = H5S_SEL_NONE; sel_type <= H5S_SEL_ALL; sel_type = (H5S_sel_type)(sel_type + 1)) {
+ switch(sel_type) {
+ case H5S_SEL_NONE: /* "None" selection */
+ ret = H5Sselect_none(sid);
+ CHECK(ret, FAIL, "H5Sselect_none");
+ break;
+
+ case H5S_SEL_POINTS: /* Point selection */
+ /* Select sequence of ten points */
+ coord1[0][0] = 0; coord1[0][1] = 9;
+ coord1[1][0] = 1; coord1[1][1] = 2;
+ coord1[2][0] = 2; coord1[2][1] = 4;
+ coord1[3][0] = 0; coord1[3][1] = 6;
+ coord1[4][0] = 1; coord1[4][1] = 8;
+ coord1[5][0] = 2; coord1[5][1] = 10;
+ coord1[6][0] = 0; coord1[6][1] = 11;
+ coord1[7][0] = 1; coord1[7][1] = 4;
+ coord1[8][0] = 2; coord1[8][1] = 1;
+ coord1[9][0] = 0; coord1[9][1] = 3;
+ ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
+ CHECK(ret, FAIL, "H5Sselect_elements");
+ break;
+
+ case H5S_SEL_HYPERSLABS: /* Hyperslab selection */
+ /* Select regular hyperslab */
+ start[0] = 3; start[1] = 0;
+ stride[0] = 2; stride[1] = 2;
+ count[0] = 2; count[1] = 5;
+ block[0] = 1; block[1] = 1;
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+ break;
+
+ case H5S_SEL_ALL: /* "All" selection */
+ ret = H5Sselect_all(sid);
+ CHECK(ret, FAIL, "H5Sselect_all");
+ break;
+
+ case H5S_SEL_ERROR:
+ case H5S_SEL_N:
+ default:
+ HDassert(0 && "Can't occur");
+ break;
+ } /* end switch */
+
+ /* Create selection iterator object */
+ iter_id = H5Ssel_iter_create(sid, (size_t)1, (unsigned)sel_iter_flags);
+ CHECK(iter_id, FAIL, "H5Ssel_iter_create");
+
+ /* Try retrieving no sequences, with 0 for maxseq & maxbytes */
+ ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)0, (size_t)1, &nseq, &nbytes, off, len);
+ CHECK(ret, FAIL, "H5Ssel_iter_get_seq_list");
+ VERIFY(nseq, 0, "H5Ssel_iter_get_seq_list");
+ VERIFY(nbytes, 0, "H5Ssel_iter_get_seq_list");
+ ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)1, (size_t)0, &nseq, &nbytes, off, len);
+ CHECK(ret, FAIL, "H5Ssel_iter_get_seq_list");
+ VERIFY(nseq, 0, "H5Ssel_iter_get_seq_list");
+ VERIFY(nbytes, 0, "H5Ssel_iter_get_seq_list");
+
+ /* Try retrieving all sequences */
+ ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)SEL_ITER_MAX_SEQ, (size_t)(1024 * 1024), &nseq, &nbytes, off, len);
+ CHECK(ret, FAIL, "H5Ssel_iter_get_seq_list");
+
+ /* Check results from retrieving sequence list */
+ switch(sel_type) {
+ case H5S_SEL_NONE: /* "None" selection */
+ VERIFY(nseq, 0, "H5Ssel_iter_get_seq_list");
+ VERIFY(nbytes, 0, "H5Ssel_iter_get_seq_list");
+ break;
+
+ case H5S_SEL_POINTS: /* Point selection */
+ VERIFY(nseq, 10, "H5Ssel_iter_get_seq_list");
+ VERIFY(nbytes, 10, "H5Ssel_iter_get_seq_list");
+ break;
+
+ case H5S_SEL_HYPERSLABS: /* Hyperslab selection */
+ VERIFY(nseq, 10, "H5Ssel_iter_get_seq_list");
+ VERIFY(nbytes, 10, "H5Ssel_iter_get_seq_list");
+ break;
+
+ case H5S_SEL_ALL: /* "All" selection */
+ VERIFY(nseq, 1, "H5Ssel_iter_get_seq_list");
+ VERIFY(nbytes, 72, "H5Ssel_iter_get_seq_list");
+ break;
+
+ case H5S_SEL_ERROR:
+ case H5S_SEL_N:
+ default:
+ HDassert(0 && "Can't occur");
+ break;
+ } /* end switch */
+
+ /* Close selection iterator */
+ ret = H5Ssel_iter_close(iter_id);
+ CHECK(ret, FAIL, "H5Ssel_iter_close");
+ } /* end for */
+
+ /* Point selection which will merge into smaller # of sequences */
+ coord1[0][0] = 0; coord1[0][1] = 9;
+ coord1[1][0] = 0; coord1[1][1] = 10;
+ coord1[2][0] = 0; coord1[2][1] = 11;
+ coord1[3][0] = 0; coord1[3][1] = 6;
+ coord1[4][0] = 1; coord1[4][1] = 8;
+ coord1[5][0] = 2; coord1[5][1] = 10;
+ coord1[6][0] = 0; coord1[6][1] = 11;
+ coord1[7][0] = 1; coord1[7][1] = 4;
+ coord1[8][0] = 1; coord1[8][1] = 5;
+ coord1[9][0] = 1; coord1[9][1] = 6;
+ ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
+ CHECK(ret, FAIL, "H5Sselect_elements");
+
+ /* Create selection iterator object */
+ iter_id = H5Ssel_iter_create(sid, (size_t)1, (unsigned)sel_iter_flags);
+ CHECK(iter_id, FAIL, "H5Ssel_iter_create");
+
+ /* Try retrieving all sequences */
+ ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)SEL_ITER_MAX_SEQ, (size_t)(1024 * 1024), &nseq, &nbytes, off, len);
+ CHECK(ret, FAIL, "H5Ssel_iter_get_seq_list");
+ VERIFY(nseq, 6, "H5Ssel_iter_get_seq_list");
+ VERIFY(nbytes, 10, "H5Ssel_iter_get_seq_list");
+
+ /* Close selection iterator */
+ ret = H5Ssel_iter_close(iter_id);
+ CHECK(ret, FAIL, "H5Ssel_iter_close");
+
+
+ /* Select irregular hyperslab, which will merge into smaller # of sequences */
+ start[0] = 3; start[1] = 0;
+ stride[0] = 2; stride[1] = 2;
+ count[0] = 2; count[1] = 5;
+ block[0] = 1; block[1] = 1;
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ start[0] = 3; start[1] = 3;
+ stride[0] = 2; stride[1] = 2;
+ count[0] = 2; count[1] = 5;
+ block[0] = 1; block[1] = 1;
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_OR, start, stride, count, block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Create selection iterator object */
+ iter_id = H5Ssel_iter_create(sid, (size_t)1, (unsigned)sel_iter_flags);
+ CHECK(iter_id, FAIL, "H5Ssel_iter_create");
+
+ /* Try retrieving all sequences */
+ ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)SEL_ITER_MAX_SEQ, (size_t)(1024 * 1024), &nseq, &nbytes, off, len);
+ CHECK(ret, FAIL, "H5Ssel_iter_get_seq_list");
+ VERIFY(nseq, 6, "H5Ssel_iter_get_seq_list");
+ VERIFY(nbytes, 20, "H5Ssel_iter_get_seq_list");
+
+ /* Close selection iterator */
+ ret = H5Ssel_iter_close(iter_id);
+ CHECK(ret, FAIL, "H5Ssel_iter_close");
+
+ } /* end for */
+
+ /* Close dataspace */
+ ret = H5Sclose(sid);
+ CHECK(ret, FAIL, "H5Sclose");
+} /* test_sel_iter() */
+
+
+/****************************************************************
+**
** test_select(): Main H5S selection testing routine.
**
****************************************************************/
@@ -14519,6 +15259,12 @@ test_select(void)
test_select_hyper_offset2();/* Test more selection offset code with hyperslabs */
test_select_point_offset(); /* Test selection offset code with elements */
test_select_hyper_union(); /* Test hyperslab union code */
+
+ /* Fancy hyperslab API tests */
+ test_select_hyper_union_stagger(); /* Test hyperslab union code for staggered slabs */
+ test_select_hyper_union_3d(); /* Test hyperslab union code for 3-D dataset */
+ test_select_hyper_valid_combination(); /* Test different input combinations */
+
test_select_hyper_and_2d(); /* Test hyperslab intersection (AND) code for 2-D dataset */
test_select_hyper_xor_2d(); /* Test hyperslab XOR code for 2-D dataset */
test_select_hyper_notb_2d(); /* Test hyperslab NOTB code for 2-D dataset */
@@ -14622,6 +15368,8 @@ test_select(void)
/* Test irregular selection I/O */
test_irreg_io();
+ /* Test selection iterators */
+ test_sel_iter();
} /* test_select() */
diff --git a/test/vds.c b/test/vds.c
index c3b6181..af052a8 100644
--- a/test/vds.c
+++ b/test/vds.c
@@ -1409,7 +1409,7 @@ test_basic_io(unsigned config, hid_t fapl)
int erbuf[10][26]; /* Expected read buffer */
int fill = -1; /* Fill value */
herr_t ret; /* Generic return value */
- int i, j;
+ int i, j, u, v;
TESTING("basic virtual dataset I/O")
@@ -3498,6 +3498,724 @@ test_basic_io(unsigned config, hid_t fapl)
memspace = -1;
+ /*
+ * Test 8: For code coverage: Horizontal block virtual mappings, and file
+ * selection, grid memory selection
+ */
+ /* Clear virtual layout in DCPL */
+ if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ TEST_ERROR
+
+ /* Create memory dataspace */
+ if((memspace = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Create virtual dataspaces */
+ dims[0] = 8;
+ dims[1] = 15;
+ if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+ if((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Create source dataspace */
+ dims[0] = 4;
+ if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Select all in source space (should not be necessary, but just to be sure)
+ */
+ if(H5Sselect_all(srcspace[0]) < 0)
+ TEST_ERROR
+
+ /* Select hyperslabs in virtual spaces */
+ start[0] = 0;
+ start[1] = 0;
+ if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+ start[0] = 4;
+ if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+
+ /* Add virtual layout mappings */
+ if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0)
+ TEST_ERROR
+ if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[0]) < 0)
+ TEST_ERROR
+
+ /* Reset dims */
+ dims[0] = 10;
+ dims[1] = 26;
+
+ /* Create virtual file */
+ if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+
+ /* Create source file if requested */
+ if(config & TEST_IO_DIFFERENT_FILE) {
+ if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ }
+ else {
+ srcfile[0] = vfile;
+ if(H5Iinc_ref(srcfile[0]) < 0)
+ TEST_ERROR
+ }
+
+ /* Create source datasets */
+ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Create virtual dataset */
+ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Reset erbuf */
+ HDmemset(erbuf[0], 0, sizeof(rbuf));
+
+ /* Populate write buffer */
+ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j;
+
+ /* Select hyperslab in memory */
+ start[0] = 0;
+ start[1] = 0;
+ count[0] = 4;
+ count[1] = 15;
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Write data directly to first source dataset */
+ if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ u = 0;
+ v = 0;
+ for(i = 2; i < 4; i++)
+ for(j = 0; j < 15; j++) {
+ erbuf[u][v] = buf[i][j];
+ v += 2;
+ if(v >= 24) {
+ u += 2;
+ v = 0;
+ }
+ }
+
+ /* Select hyperslab in memory */
+ start[0] = 4;
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Write data directly to second source dataset */
+ if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ for(i = 4; i < 6; i++)
+ for(j = 0; j < 15; j++) {
+ erbuf[u][v] = buf[i][j];
+ v += 2;
+ if(v >= 24) {
+ u += 2;
+ v = 0;
+ }
+ }
+
+ /* Close srcdsets and srcfile if config option specified */
+ if(config & TEST_IO_CLOSE_SRC) {
+ if(H5Dclose(srcdset[0]) < 0)
+ TEST_ERROR
+ srcdset[0] = -1;
+ if(H5Dclose(srcdset[1]) < 0)
+ TEST_ERROR
+ srcdset[1] = -1;
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ }
+
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ }
+
+ /* Select hyperslab in memory */
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 2;
+ stride[1] = 2;
+ count[0] = 5;
+ count[1] = 12;
+ block[0] = 1;
+ block[1] = 1;
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Select hyperslab in file */
+ start[0] = 2;
+ start[1] = 0;
+ count[0] = 4;
+ count[1] = 15;
+ if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Read data through virtual dataset */
+ HDmemset(rbuf[0], 0, sizeof(rbuf));
+ if(H5Dread(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, rbuf[0]) < 0)
+ TEST_ERROR
+
+ /* Verify read data */
+ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if(rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
+
+ /* Close */
+ if(!(config & TEST_IO_CLOSE_SRC)) {
+ if(H5Dclose(srcdset[0]) < 0)
+ TEST_ERROR
+ srcdset[0] = -1;
+ if(H5Dclose(srcdset[1]) < 0)
+ TEST_ERROR
+ srcdset[1] = -1;
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ }
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if(H5Sclose(srcspace[0]) < 0)
+ TEST_ERROR
+ srcspace[0] = -1;
+ if(H5Sclose(vspace[0]) < 0)
+ TEST_ERROR
+ vspace[0] = -1;
+ if(H5Sclose(vspace[1]) < 0)
+ TEST_ERROR
+ vspace[1] = -1;
+ if(H5Sclose(memspace) < 0)
+ TEST_ERROR
+ memspace = -1;
+
+
+ /*
+ * Test 9: For code coverage: Horizontal block virtual mappings, and file
+ * selection, grid memory selection, 3 mappings, 3D memory space
+ */
+ /* Clear virtual layout in DCPL */
+ if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ TEST_ERROR
+
+ /* Create memory dataspace */
+ dims[1] = 13;
+ dims[2] = 2;
+ if((memspace = H5Screate_simple(3, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Create virtual dataspaces */
+ dims[0] = 6;
+ dims[1] = 10;
+ if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+ if((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+ if((vspace[2] = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Create source dataspace */
+ dims[0] = 2;
+ if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Select all in source space (should not be necessary, but just to be sure)
+ */
+ if(H5Sselect_all(srcspace[0]) < 0)
+ TEST_ERROR
+
+ /* Select hyperslabs in virtual spaces */
+ start[0] = 0;
+ start[1] = 0;
+ if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+ start[0] = 2;
+ if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+ start[0] = 4;
+ if(H5Sselect_hyperslab(vspace[2], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+
+ /* Add virtual layout mappings */
+ if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0)
+ TEST_ERROR
+ if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[0]) < 0)
+ TEST_ERROR
+ if(H5Pset_virtual(dcpl, vspace[2], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset3", srcspace[0]) < 0)
+ TEST_ERROR
+
+ /* Reset dims */
+ dims[0] = 10;
+ dims[1] = 26;
+
+ /* Create virtual file */
+ if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+
+ /* Create source file if requested */
+ if(config & TEST_IO_DIFFERENT_FILE) {
+ if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ }
+ else {
+ srcfile[0] = vfile;
+ if(H5Iinc_ref(srcfile[0]) < 0)
+ TEST_ERROR
+ }
+
+ /* Create source datasets */
+ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset3", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Create virtual dataset */
+ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Reset erbuf */
+ HDmemset(erbuf[0], 0, sizeof(rbuf));
+
+ /* Populate write buffer */
+ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j;
+
+ /* Select hyperslab in memory */
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ count[0] = 2;
+ count[1] = 5;
+ count[2] = 2;
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Write data directly to first source dataset */
+ if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ u = 0;
+ v = 0;
+ for(i = 0; i < 2; i++)
+ for(j = 0; j < 10; j++) {
+ erbuf[u][v] = buf[i][j];
+ if(++v == 6)
+ v += 2;
+ else if(v == 14) {
+ u += 2;
+ v = 0;
+ }
+ }
+
+ /* Select hyperslab in memory */
+ start[0] = 2;
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Write data directly to second source dataset */
+ if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ for(i = 2; i < 4; i++)
+ for(j = 0; j < 10; j++) {
+ erbuf[u][v] = buf[i][j];
+ if(++v == 6)
+ v += 2;
+ else if(v == 14) {
+ u += 2;
+ v = 0;
+ }
+ }
+
+ /* Select hyperslab in memory */
+ start[0] = 4;
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Write data directly to third source dataset */
+ if(H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ for(i = 4; i < 6; i++)
+ for(j = 0; j < 10; j++) {
+ erbuf[u][v] = buf[i][j];
+ if(++v == 6)
+ v += 2;
+ else if(v == 14) {
+ u += 2;
+ v = 0;
+ }
+ }
+
+ /* Close srcdsets and srcfile if config option specified */
+ if(config & TEST_IO_CLOSE_SRC) {
+ if(H5Dclose(srcdset[0]) < 0)
+ TEST_ERROR
+ srcdset[0] = -1;
+ if(H5Dclose(srcdset[1]) < 0)
+ TEST_ERROR
+ srcdset[1] = -1;
+ if(H5Dclose(srcdset[2]) < 0)
+ TEST_ERROR
+ srcdset[2] = -1;
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ }
+
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ }
+
+ /* Select hyperslab in memory */
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ stride[0] = 2;
+ stride[1] = 4;
+ stride[2] = 1;
+ count[0] = 5;
+ count[1] = 2;
+ count[2] = 1;
+ block[0] = 1;
+ block[1] = 3;
+ block[2] = 2;
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Read data through virtual dataset */
+ HDmemset(rbuf[0], 0, sizeof(rbuf));
+ if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ TEST_ERROR
+
+ /* Verify read data */
+ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if(rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
+
+ /* Close */
+ if(!(config & TEST_IO_CLOSE_SRC)) {
+ if(H5Dclose(srcdset[0]) < 0)
+ TEST_ERROR
+ srcdset[0] = -1;
+ if(H5Dclose(srcdset[1]) < 0)
+ TEST_ERROR
+ srcdset[1] = -1;
+ if(H5Dclose(srcdset[2]) < 0)
+ TEST_ERROR
+ srcdset[2] = -1;
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ }
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if(H5Sclose(srcspace[0]) < 0)
+ TEST_ERROR
+ srcspace[0] = -1;
+ if(H5Sclose(vspace[0]) < 0)
+ TEST_ERROR
+ vspace[0] = -1;
+ if(H5Sclose(vspace[1]) < 0)
+ TEST_ERROR
+ vspace[1] = -1;
+ if(H5Sclose(vspace[2]) < 0)
+ TEST_ERROR
+ vspace[2] = -1;
+ if(H5Sclose(memspace) < 0)
+ TEST_ERROR
+ memspace = -1;
+
+
+ /*
+ * Test 10: For code coverage: Vertical stripe virtual mappings, vertical
+ * block file selection, block memory selection, 3D VDS
+ */
+ /* Clear virtual layout in DCPL */
+ if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ TEST_ERROR
+
+ /* Create memory dataspace */
+ if((memspace = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Create virtual dataspaces */
+ dims[0] = 10;
+ dims[1] = 9;
+ dims[2] = 6;
+ if((vspace[0] = H5Screate_simple(3, dims, NULL)) < 0)
+ TEST_ERROR
+ if((vspace[1] = H5Screate_simple(3, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Create source dataspace */
+ dims[1] = 12;
+ if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Select all in source space (should not be necessary, but just to be sure)
+ */
+ if(H5Sselect_all(srcspace[0]) < 0)
+ TEST_ERROR
+
+ /* Select hyperslabs in virtual spaces */
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ count[0] = 1;
+ count[1] = 4;
+ count[2] = 3;
+ stride[0] = 1;
+ stride[1] = 2;
+ stride[2] = 2;
+ block[0] = 10;
+ block[1] = 1;
+ block[2] = 1;
+ if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+ start[2] = 1;
+ if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Add virtual layout mappings */
+ if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0)
+ TEST_ERROR
+ if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[0]) < 0)
+ TEST_ERROR
+
+ /* Reset dims */
+ dims[0] = 10;
+ dims[1] = 26;
+
+ /* Create virtual file */
+ if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+
+ /* Create source file if requested */
+ if(config & TEST_IO_DIFFERENT_FILE) {
+ if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ }
+ else {
+ srcfile[0] = vfile;
+ if(H5Iinc_ref(srcfile[0]) < 0)
+ TEST_ERROR
+ }
+
+ /* Create source datasets */
+ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Create virtual dataset */
+ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Initialize erbuf */
+ HDmemset(erbuf[0], 0, sizeof(rbuf));
+ for(i = 0; i < 10; i++)
+ for(j = 0; j < 24; j += 6) {
+ erbuf[i][j] = -1;
+ erbuf[i][j + 1] = -1;
+ }
+
+ /* Populate write buffer */
+ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j;
+
+ /* Select hyperslab in memory */
+ start[0] = 0;
+ start[1] = 0;
+ count[0] = 10;
+ count[1] = 12;
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Write data directly to first source dataset */
+ if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ u = 0;
+ v = 0;
+ for(i = 0; i < 10; i++)
+ for(j = 0; j < 8; j++) {
+ if(v == 0 || v == 12)
+ erbuf[u][v] = buf[i][j];
+ v += 2;
+ if(!(v % 6))
+ v += 6;
+ if(v >= 28) {
+ u++;
+ v = 0;
+ }
+ }
+
+ /* Select hyperslab in memory */
+ start[1] = 8;
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Write data directly to second source dataset */
+ if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ u = 0;
+ v = 1;
+ for(i = 0; i < 10; i++)
+ for(j = 8; j < 16; j++) {
+ if(v == 1 || v == 13)
+ erbuf[u][v] = buf[i][j];
+ v += 2;
+ if(!((v - 1) % 6))
+ v += 6;
+ if(v >= 28) {
+ u++;
+ v = 1;
+ }
+ }
+
+ /* Close srcdsets and srcfile if config option specified */
+ if(config & TEST_IO_CLOSE_SRC) {
+ if(H5Dclose(srcdset[0]) < 0)
+ TEST_ERROR
+ srcdset[0] = -1;
+ if(H5Dclose(srcdset[1]) < 0)
+ TEST_ERROR
+ srcdset[1] = -1;
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ }
+
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ }
+
+ /* Select hyperslab in memory */
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 6;
+ count[0] = 1;
+ count[1] = 4;
+ block[0] = 10;
+ block[1] = 2;
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Select hyperslab in file */
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ count[0] = 10;
+ count[1] = 4;
+ count[2] = 2;
+ if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Read data through virtual dataset */
+ HDmemset(rbuf[0], 0, sizeof(rbuf));
+ if(H5Dread(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, rbuf[0]) < 0)
+ TEST_ERROR
+
+ /* Verify read data */
+ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if(rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
+
+ /* Close */
+ if(!(config & TEST_IO_CLOSE_SRC)) {
+ if(H5Dclose(srcdset[0]) < 0)
+ TEST_ERROR
+ srcdset[0] = -1;
+ if(H5Dclose(srcdset[1]) < 0)
+ TEST_ERROR
+ srcdset[1] = -1;
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ }
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if(H5Sclose(srcspace[0]) < 0)
+ TEST_ERROR
+ srcspace[0] = -1;
+ if(H5Sclose(vspace[0]) < 0)
+ TEST_ERROR
+ vspace[0] = -1;
+ if(H5Sclose(vspace[1]) < 0)
+ TEST_ERROR
+ vspace[1] = -1;
+ if(H5Sclose(memspace) < 0)
+ TEST_ERROR
+ memspace = -1;
+
+
/* Close */
if(H5Pclose(dcpl) < 0)
TEST_ERROR
diff --git a/test/vol.c b/test/vol.c
index 3f6afaa..5ff0af0 100644
--- a/test/vol.c
+++ b/test/vol.c
@@ -11,7 +11,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Purpose: Tests the virtual object layer (H5VL)
+ * Purpose: Tests the virtual object layer (H5VL)
*
* This is a minimal test to ensure VOL usage (setting a VOL, etc.)
* works as expected. Actual VOL functionality is tested using
@@ -148,50 +148,83 @@ static const H5VL_class_t fake_vol_g = {
static herr_t
test_vol_registration(void)
{
- htri_t is_registered;
- hid_t vol_id = -1, vol_id2 = -1;
+ hid_t native_id = H5I_INVALID_HID;
+ hid_t lapl_id = H5I_INVALID_HID;
+ hid_t vipl_id = H5I_INVALID_HID;
+ herr_t ret = SUCCEED;
+ htri_t is_registered = FAIL;
+ hid_t vol_id = H5I_INVALID_HID;
+ hid_t vol_id2 = H5I_INVALID_HID;
TESTING("VOL registration");
/* The test/fake VOL connector should not be registered at the start of the test */
if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0)
- FAIL_STACK_ERROR;
+ TEST_ERROR;
if (is_registered > 0)
- FAIL_PUTS_ERROR("native VOL connector is inappropriately registered");
+ FAIL_PUTS_ERROR("VOL connector is inappropriately registered");
- /* Load a VOL interface */
- if ((vol_id = H5VLregister_connector(&fake_vol_g, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR;
+ /* Test registering a connector with an incorrect property list (SHOULD FAIL) */
+ if ((lapl_id = H5Pcreate(H5P_LINK_ACCESS)) < 0)
+ TEST_ERROR;
+ H5E_BEGIN_TRY {
+ vol_id = H5VLregister_connector(&fake_vol_g, lapl_id);
+ } H5E_END_TRY;
+ if (H5I_INVALID_HID != vol_id)
+ FAIL_PUTS_ERROR("should not be able to register a connector with an incorrect property list");
+ if (H5Pclose(lapl_id) < 0)
+ TEST_ERROR;
+
+ /* Load a VOL interface
+ * The vipl_id does nothing without a VOL that needs it, but we do need to
+ * test creating a property list of that class and passing it along as a
+ * smoke check.
+ */
+ if ((vipl_id = H5Pcreate(H5P_VOL_INITIALIZE)) < 0)
+ TEST_ERROR;
+ if ((vol_id = H5VLregister_connector(&fake_vol_g, vipl_id)) < 0)
+ TEST_ERROR;
+ if (H5Pclose(vipl_id) < 0)
+ TEST_ERROR;
/* The test/fake VOL connector should be registered now */
if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0)
- FAIL_STACK_ERROR;
+ TEST_ERROR;
if (0 == is_registered)
- FAIL_PUTS_ERROR("native VOL connector is un-registered");
+ FAIL_PUTS_ERROR("VOL connector is un-registered");
/* Re-register a VOL connector */
if ((vol_id2 = H5VLregister_connector(&fake_vol_g, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR;
+ TEST_ERROR;
/* The test/fake VOL connector should still be registered now */
if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0)
- FAIL_STACK_ERROR;
+ TEST_ERROR;
if (0 == is_registered)
- FAIL_PUTS_ERROR("native VOL connector is un-registered");
+ FAIL_PUTS_ERROR("VOL connector is un-registered");
/* Unregister the second test/fake VOL ID */
if (H5VLunregister_connector(vol_id2) < 0)
- FAIL_STACK_ERROR;
+ TEST_ERROR;
/* The test/fake VOL connector should still be registered now */
if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0)
- FAIL_STACK_ERROR;
+ TEST_ERROR;
if (0 == is_registered)
- FAIL_PUTS_ERROR("native VOL connector is un-registered");
+ FAIL_PUTS_ERROR("VOL connector is un-registered");
/* Unregister the original test/fake VOL ID */
if (H5VLunregister_connector(vol_id) < 0)
- FAIL_STACK_ERROR;
+ TEST_ERROR;
+
+ /* Try to unregister the native VOL connector (should fail) */
+ if (H5I_INVALID_HID == (native_id = H5VLget_connector_id(H5VL_NATIVE_NAME)))
+ TEST_ERROR;
+ H5E_BEGIN_TRY {
+ ret = H5VLunregister_connector(native_id);
+ } H5E_END_TRY;
+ if (FAIL != ret)
+ FAIL_PUTS_ERROR("should not be able to unregister the native VOL connector");
PASSED();
return SUCCEED;
@@ -199,6 +232,8 @@ test_vol_registration(void)
error:
H5E_BEGIN_TRY {
H5VLunregister_connector(vol_id);
+ H5Pclose(lapl_id);
+ H5Pclose(vipl_id);
} H5E_END_TRY;
return FAIL;
@@ -223,7 +258,7 @@ test_native_vol_init(void)
/* The native VOL connector should always be registered */
if ((is_registered = H5VLis_connector_registered(H5VL_NATIVE_NAME)) < 0)
- FAIL_STACK_ERROR;
+ TEST_ERROR;
if (0 == is_registered)
FAIL_PUTS_ERROR("native VOL connector is un-registered");
@@ -281,7 +316,7 @@ test_basic_file_operation(const char *env_h5_drvr)
if(H5Pset_fclose_degree(fapl_id, H5F_CLOSE_SEMI) < 0)
TEST_ERROR;
if(H5Pset_metadata_read_attempts(fapl_id, 9) < 0)
- FAIL_STACK_ERROR
+ TEST_ERROR
/* H5Fcreate */
if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)