diff options
author | Allen Byrne <50328838+byrnHDF@users.noreply.github.com> | 2023-08-21 22:13:03 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-21 22:13:03 (GMT) |
commit | ceef4a9ebd055f9ec0378a97ec2ce9421cdec866 (patch) | |
tree | 887ab50783fb357f8c5f9fe0dee1d6ba5dc536a5 | |
parent | 89b4afd4b317c5131cbc8607c99d21b369d050eb (diff) | |
download | hdf5-ceef4a9ebd055f9ec0378a97ec2ce9421cdec866.zip hdf5-ceef4a9ebd055f9ec0378a97ec2ce9421cdec866.tar.gz hdf5-ceef4a9ebd055f9ec0378a97ec2ce9421cdec866.tar.bz2 |
Merge/update CMake, presets,java and tools (#3393)
238 files changed, 5413 insertions, 3388 deletions
diff --git a/.gitattributes b/.gitattributes index 52722da..0b51cd8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -191,19 +191,18 @@ java/examples/testfiles/examples.intro.H5_CreateGroup.txt -text java/examples/testfiles/examples.intro.H5_CreateGroupAbsoluteRelative.txt -text java/examples/testfiles/examples.intro.H5_CreateGroupDataset.txt -text java/examples/testfiles/examples.intro.H5_ReadWrite.txt -text -java/lib/ext/slf4j-nop-1.7.33.jar -text svneol=unset#application/zip -java/lib/ext/slf4j-simple-1.7.33.jar -text svneol=unset#application/zip +java/lib/ext/slf4j-nop-2.0.6.jar -text svneol=unset#application/zip +java/lib/ext/slf4j-simple-2.0.6.jar -text svneol=unset#application/zip java/lib/hamcrest-core.jar -text svneol=unset#application/java-archive java/lib/junit.jar -text svneol=unset#application/java-archive java/lib/simplelogger.properties -text -java/lib/slf4j-api-1.7.33.jar -text svneol=unset#application/zip +java/lib/slf4j-api-2.0.6.jar -text svneol=unset#application/zip java/src/CMakeLists.txt -text java/src/Makefile.am -text java/src/hdf/CMakeLists.txt -text java/src/hdf/hdf5lib/CMakeLists.txt -text java/src/hdf/hdf5lib/H5.java -text java/src/hdf/hdf5lib/HDF5Constants.java -text -java/src/hdf/hdf5lib/HDF5GroupInfo.java -text java/src/hdf/hdf5lib/HDFArray.java -text java/src/hdf/hdf5lib/HDFNativeData.java -text java/src/hdf/hdf5lib/callbacks/Callbacks.java -text diff --git a/CMakeFilters.cmake b/CMakeFilters.cmake index b81d6e2..200634e 100644 --- a/CMakeFilters.cmake +++ b/CMakeFilters.cmake @@ -164,11 +164,11 @@ if (HDF5_ENABLE_SZIP_SUPPORT) if (NOT SZIP_FOUND) find_package (SZIP) # Legacy find endif () - if (SZIP_FOUND) - set (SZIP_INCLUDE_DIR_GEN ${SZIP_INCLUDE_DIR}) - set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIRS} ${SZIP_INCLUDE_DIR}) - set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES}) - endif () + endif () + if (SZIP_FOUND) + set (SZIP_INCLUDE_DIR_GEN ${SZIP_INCLUDE_DIR}) + set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIRS} ${SZIP_INCLUDE_DIR}) + set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES}) endif () else () if (BUILD_SZIP_WITH_FETCHCONTENT) @@ -200,8 +200,6 @@ if (HDF5_ENABLE_SZIP_SUPPORT) set (SZIP_PACKAGE_NAME ${SZIP_PACKAGE_NAME}) endif () set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_STATIC_LIBRARY}) - else () - message (FATAL_ERROR "SZIP is Required for SZIP support in HDF5") endif () endif () if (SZIP_FOUND) diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index 67fd493..1fb7714 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -138,7 +138,7 @@ install ( option (HDF5_PACK_EXAMPLES "Package the HDF5 Library Examples Compressed File" OFF) if (HDF5_PACK_EXAMPLES) configure_file ( - ${HDF_RESOURCES_DIR}/HDF5_Examples.cmake.in + ${HDF_RESOURCES_DIR}/examples/HDF5_Examples.cmake.in ${HDF5_BINARY_DIR}/HDF5_Examples.cmake @ONLY ) install ( @@ -150,15 +150,20 @@ if (HDF5_PACK_EXAMPLES) option (EXAMPLES_USE_RELEASE_NAME "Use the released examples artifact name" OFF) option (EXAMPLES_DOWNLOAD "Download to use released examples files" OFF) if (EXAMPLES_DOWNLOAD) - if (NOT EXAMPLES_USE_LOCALCONTENT) - set (EXAMPLES_URL ${EXAMPLES_TGZ_ORIGPATH}/${EXAMPLES_TGZ_ORIGNAME}) + if (EXAMPLES_USE_RELEASE_NAME) + set (EXAMPLES_NAME ${EXAMPLES_TGZ_ORIGNAME}) else () - set (EXAMPLES_URL ${TGZPATH}/${EXAMPLES_TGZ_ORIGNAME}) + set (EXAMPLES_NAME ${HDF5_EXAMPLES_COMPRESSED}) endif () - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Examples file is ${EXAMPLES_URL}") + if (NOT EXAMPLES_USE_LOCALCONTENT) + set (EXAMPLES_URL ${EXAMPLES_TGZ_ORIGPATH}/${EXAMPLES_NAME}) + file (DOWNLOAD ${EXAMPLES_URL} ${HDF5_BINARY_DIR}/${HDF5_EXAMPLES_COMPRESSED} STATUS EX_DL) + message (STATUS "Examples file is ${EXAMPLES_URL} STATUS=${EX_DL}") + else () + set (EXAMPLES_URL ${TGZPATH}/${EXAMPLES_NAME}) + file (COPY_FILE ${EXAMPLES_URL} ${HDF5_BINARY_DIR}/${HDF5_EXAMPLES_COMPRESSED} RESULT EX_DL) + message (STATUS "Examples file is ${EXAMPLES_URL} RESULT=${EX_DL}") endif () - file (DOWNLOAD ${EXAMPLES_URL} ${HDF5_BINARY_DIR}/${HDF5_EXAMPLES_COMPRESSED}) if (EXISTS "${HDF5_BINARY_DIR}/${HDF5_EXAMPLES_COMPRESSED}") execute_process( COMMAND ${CMAKE_COMMAND} -E tar xzf ${HDF5_EXAMPLES_COMPRESSED} @@ -166,7 +171,6 @@ if (HDF5_PACK_EXAMPLES) COMMAND_ECHO STDOUT ) endif () - set (EXAMPLES_USE_RELEASE_NAME ON CACHE BOOL "" FORCE) else () if (EXISTS "${HDF5_EXAMPLES_COMPRESSED_DIR}/${HDF5_EXAMPLES_COMPRESSED}") execute_process( @@ -176,20 +180,18 @@ if (HDF5_PACK_EXAMPLES) ) endif () endif () - if (EXAMPLES_USE_RELEASE_NAME) - get_filename_component (EX_LAST_EXT ${HDF5_EXAMPLES_COMPRESSED} LAST_EXT) - if (${EX_LAST_EXT} STREQUAL ".zip") - get_filename_component (EX_DIR_NAME ${HDF5_EXAMPLES_COMPRESSED} NAME_WLE) - else () - get_filename_component (EX_DIR_NAME ${HDF5_EXAMPLES_COMPRESSED} NAME_WLE) - get_filename_component (EX_DIR_NAME ${EX_DIR_NAME} NAME_WLE) - endif () - execute_process( - COMMAND ${CMAKE_COMMAND} -E rename ${EX_DIR_NAME} HDF5Examples - WORKING_DIRECTORY ${HDF5_BINARY_DIR} - COMMAND_ECHO STDOUT - ) + get_filename_component (EX_LAST_EXT ${HDF5_EXAMPLES_COMPRESSED} LAST_EXT) + if (${EX_LAST_EXT} STREQUAL ".zip") + get_filename_component (EX_DIR_NAME ${HDF5_EXAMPLES_COMPRESSED} NAME_WLE) + else () + get_filename_component (EX_DIR_NAME ${HDF5_EXAMPLES_COMPRESSED} NAME_WLE) + get_filename_component (EX_DIR_NAME ${EX_DIR_NAME} NAME_WLE) endif () + execute_process( + COMMAND ${CMAKE_COMMAND} -E rename ${EX_DIR_NAME} HDF5Examples + WORKING_DIRECTORY ${HDF5_BINARY_DIR} + COMMAND_ECHO STDOUT + ) install ( DIRECTORY ${HDF5_BINARY_DIR}/HDF5Examples DESTINATION ${HDF5_INSTALL_DATA_DIR} @@ -204,13 +206,13 @@ if (HDF5_PACK_EXAMPLES) ) install ( FILES - ${HDF_RESOURCES_DIR}/CTestScript.cmake + ${HDF_RESOURCES_DIR}/examples/CTestScript.cmake DESTINATION ${HDF5_INSTALL_DATA_DIR} COMPONENT hdfdocuments ) install ( FILES - ${HDF_RESOURCES_DIR}/HDF5_Examples_options.cmake + ${HDF_RESOURCES_DIR}/examples/HDF5_Examples_options.cmake DESTINATION ${HDF5_INSTALL_DATA_DIR} COMPONENT hdfdocuments ) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b51a31..28fe23d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -222,6 +222,7 @@ set (HDF_CONFIG_DIR ${HDF5_SOURCE_DIR}/config) set (HDF_RESOURCES_DIR ${HDF5_SOURCE_DIR}/config/cmake) set (HDF5_SRC_DIR ${HDF5_SOURCE_DIR}/src) set (HDF5_TEST_SRC_DIR ${HDF5_SOURCE_DIR}/test) +set (HDF5_TEST_PAR_DIR ${HDF5_SOURCE_DIR}/testpar) set (HDF5_CPP_SRC_DIR ${HDF5_SOURCE_DIR}/c++) set (HDF5_CPP_TST_DIR ${HDF5_SOURCE_DIR}/c++/test) set (HDF5_HL_SRC_DIR ${HDF5_SOURCE_DIR}/hl) @@ -236,9 +237,9 @@ set (HDF5_JAVA_JNI_SRC_DIR ${HDF5_SOURCE_DIR}/java/src/jni) set (HDF5_JAVA_HDF5_SRC_DIR ${HDF5_SOURCE_DIR}/java/src/hdf) set (HDF5_JAVA_TEST_SRC_DIR ${HDF5_SOURCE_DIR}/java/test) set (HDF5_JAVA_LIB_DIR ${HDF5_SOURCE_DIR}/java/lib) -set (HDF5_JAVA_LOGGING_JAR ${HDF5_SOURCE_DIR}/java/lib/slf4j-api-1.7.33.jar) -set (HDF5_JAVA_LOGGING_NOP_JAR ${HDF5_SOURCE_DIR}/java/lib/ext/slf4j-nop-1.7.33.jar) -set (HDF5_JAVA_LOGGING_SIMPLE_JAR ${HDF5_SOURCE_DIR}/java/lib/ext/slf4j-simple-1.7.33.jar) +set (HDF5_JAVA_LOGGING_JAR ${HDF5_SOURCE_DIR}/java/lib/slf4j-api-2.0.6.jar) +set (HDF5_JAVA_LOGGING_NOP_JAR ${HDF5_SOURCE_DIR}/java/lib/ext/slf4j-nop-2.0.6.jar) +set (HDF5_JAVA_LOGGING_SIMPLE_JAR ${HDF5_SOURCE_DIR}/java/lib/ext/slf4j-simple-2.0.6.jar) set (HDF5_DOXYGEN_DIR ${HDF5_SOURCE_DIR}/doxygen) set (HDF5_SRC_INCLUDE_DIRS ${HDF5_SRC_DIR}) @@ -574,15 +575,6 @@ if (HDF5_ENABLE_COVERAGE) endif () #----------------------------------------------------------------------------- -# Option to indicate using dmalloc -#----------------------------------------------------------------------------- -# option (HDF5_ENABLE_USING_DMALLOC "Indicate that dmalloc is used" OFF) -# if (HDF5_ENABLE_USING_DMALLOC) -# find_package (DMALLOC) -# set (H5_HAVE_DMALLOC DMALLOC_FOUND) -# endif () - -#----------------------------------------------------------------------------- # Option to indicate using a memory checker #----------------------------------------------------------------------------- option (HDF5_ENABLE_USING_MEMCHECKER "Indicate that a memory checker is used" OFF) @@ -662,6 +654,13 @@ if (${HDF_CFG_NAME} MATCHES "Debug" OR ${HDF_CFG_NAME} MATCHES "Developer") endif () #----------------------------------------------------------------------------- +# Add some definitions for Developer Builds +#----------------------------------------------------------------------------- +if (${HDF_CFG_NAME} MATCHES "Developer") + include (${HDF_RESOURCES_DIR}/HDF5DeveloperBuild.cmake) +endif () + +#----------------------------------------------------------------------------- # Option to embed library info into executables #----------------------------------------------------------------------------- if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten") @@ -989,11 +988,11 @@ if (BUILD_TESTING) mark_as_advanced (HDF5_TEST_JAVA) if (NOT HDF5_EXTERNALLY_CONFIGURED) - if (EXISTS "${HDF5_SOURCE_DIR}/test" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/test") + if (EXISTS "${HDF5_TEST_SRC_DIR}" AND IS_DIRECTORY "${HDF5_TEST_SRC_DIR}") add_subdirectory (test) endif () if (H5_HAVE_PARALLEL) - if (EXISTS "${HDF5_SOURCE_DIR}/testpar" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/testpar") + if (EXISTS "${HDF5_TEST_PAR_DIR}" AND IS_DIRECTORY "${HDF5_TEST_PAR_DIR}") add_subdirectory (testpar) endif () endif () diff --git a/CMakePresets.json b/CMakePresets.json index 13766ca..152aa41 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -14,28 +14,35 @@ } }, { - "name": "ci-StdCompression", + "name": "ci-CompressionVars", "hidden": true, - "inherits": "ci-base-tgz", "cacheVariables": { "BUILD_ZLIB_WITH_FETCHCONTENT": "ON", "ZLIB_PACKAGE_NAME": {"type": "STRING", "value": "zlib"}, "ZLIB_TGZ_ORIGPATH": {"type": "STRING", "value": "https://github.com/madler/zlib/releases/download/v1.2.13"}, "ZLIB_TGZ_ORIGNAME": {"type": "STRING", "value": "zlib-1.2.13.tar.gz"}, - "ZLIB_USE_LOCALCONTENT": "OFF", "BUILD_SZIP_WITH_FETCHCONTENT": "ON", "LIBAEC_PACKAGE_NAME": {"type": "STRING", "value": "libaec"}, "LIBAEC_TGZ_ORIGPATH": {"type": "STRING", "value": "https://github.com/MathisRosenhauer/libaec/releases/download/v1.0.6"}, - "LIBAEC_TGZ_ORIGNAME": {"type": "STRING", "value": "libaec-1.0.6.tar.gz"}, - "LIBAEC_USE_LOCALCONTENT": "OFF" + "LIBAEC_TGZ_ORIGNAME": {"type": "STRING", "value": "libaec-1.0.6.tar.gz"} + } + }, + { + "name": "ci-StdCompression", + "hidden": true, + "inherits": ["ci-base-tgz", "ci-CompressionVars"], + "cacheVariables": { + "HDF5_PACKAGE_EXTLIBS": "ON", + "ZLIB_USE_LOCALCONTENT": "OFF", + "LIBAEC_USE_LOCALCONTENT": "OFF", + "HDF5_ENABLE_SZIP_SUPPORT": "ON" } }, { "name": "ci-base-plugins", "hidden": true, - "inherits": "ci-base-tgz", "cacheVariables": { - "PLUGIN_TGZ_NAME": {"type": "STRING", "value": "hdf5_plugins-1.14.0.tar.gz"}, + "PLUGIN_TGZ_NAME": {"type": "STRING", "value": "hdf5_plugins.tar.gz"}, "PLUGIN_PACKAGE_NAME": {"type": "STRING", "value": "pl"}, "BSHUF_TGZ_NAME": {"type": "STRING", "value": "bitshuffle.tar.gz"}, "BSHUF_PACKAGE_NAME": {"type": "STRING", "value": "bshuf"}, @@ -63,32 +70,49 @@ } }, { - "name": "ci-StdPlugins", + "name": "ci-PluginsVars", "hidden": true, - "inherits": ["ci-base-plugins", "ci-base-tgz"], "cacheVariables": { "HDF5_ENABLE_PLUGIN_SUPPORT": "ON", "PLUGIN_TGZ_ORIGPATH": {"type": "STRING", "value": "https://github.com/HDFGroup/hdf5_plugins/archive/refs/tags"}, - "PLUGIN_TGZ_ORIGNAME": {"type": "STRING", "value": "hdf5_plugins-1.14.0.tar.gz"} + "PLUGIN_TGZ_ORIGNAME": {"type": "STRING", "value": "hdf5_plugins-master.tar.gz"} } }, - { - "name": "ci-StdExamples", + { + "name": "ci-StdPlugins", "hidden": true, - "inherits": "ci-base", + "inherits": ["ci-base-plugins", "ci-PluginsVars", "ci-base-tgz"], "cacheVariables": { - "HDF5_PACK_EXAMPLES": "ON", - "HDF5_EXAMPLES_COMPRESSED": {"type": "STRING", "value": "hdf5-examples-2.0.3.tar.gz"}, + "H5PL_VERS_MAJOR": "1", + "H5PL_VERS_MINOR": "12", + "H5PL_VERS_RELEASE": "3" + } + }, + { + "name": "ci-ExamplesVars", + "hidden": true, + "cacheVariables": { + "HDF5_EXAMPLES_COMPRESSED": {"type": "STRING", "value": "hdf5-examples-2.0.4.tar.gz"}, "HDF5_EXAMPLES_COMPRESSED_DIR": {"type": "STRING", "value": "${sourceParentDir}/temp"}, "EXAMPLES_TGZ_ORIGPATH": {"type": "STRING", "value": "https://github.com/HDFGroup/hdf5-examples/archive/refs/tags/"}, - "EXAMPLES_TGZ_ORIGNAME": {"type": "STRING", "value": "2.0.3.tar.gz"}, + "EXAMPLES_TGZ_ORIGNAME": {"type": "STRING", "value": "2.0.4.tar.gz"} + } + }, + { + "name": "ci-StdExamples", + "hidden": true, + "inherits": ["ci-base", "ci-ExamplesVars", "ci-base-tgz"], + "cacheVariables": { + "EXAMPLES_USE_RELEASE_NAME": "ON", + "EXAMPLES_USE_LOCALCONTENT": "OFF", + "HDF5_PACK_EXAMPLES": "ON", "EXAMPLES_DOWNLOAD": "ON" } }, - { + { "name": "ci-StdShar", "hidden": true, - "inherits": "ci-StdCompression", + "inherits": ["ci-StdCompression", "ci-StdExamples"], "cacheVariables": { "HDF_PACKAGE_NAMESPACE": {"type": "STRING", "value": "hdf5::"}, "HDF5_INSTALL_MOD_FORTRAN": "NO", @@ -105,8 +129,7 @@ "ci-x64-Release-MSVC", "ci-CPP", "ci-Java", - "ci-StdShar", - "ci-StdExamples" + "ci-StdShar" ] }, { @@ -117,8 +140,7 @@ "ci-CPP", "ci-Fortran", "ci-Java", - "ci-StdShar", - "ci-StdExamples" + "ci-StdShar" ] }, { @@ -129,8 +151,7 @@ "ci-CPP", "ci-Fortran", "ci-Java", - "ci-StdShar", - "ci-StdExamples" + "ci-StdShar" ] }, { @@ -141,8 +162,7 @@ "ci-CPP", "ci-Fortran", "ci-Java", - "ci-StdShar", - "ci-StdExamples" + "ci-StdShar" ] } ], diff --git a/bin/README.md b/bin/README.md new file mode 100644 index 0000000..e2e2570 --- /dev/null +++ b/bin/README.md @@ -0,0 +1,30 @@ +# Scripts in `bin` and their purpose + +Programs run via `autogen.sh` (or the equivalent in CMake) are indicated. + +|Program|Purpose| +|-------|-------| +|`buildhdf5`|Convenience script to build HDF5 using the Autotools| +|`checkapi`|Checks if public API calls are used in internal functions| +|`chkcopyright`|Checks if files have appropriate copyright statements| +|`cmakehdf5`|Convenience script to build HDF5 using CMake| +|`debug-ohdr`|Examines debug output from `H5O_open/close` to look for open objects| +|`format_source`|Runs `clang-format` over the source files, applying our rules| +|`genparser`|Creates the flex/bison-based parser files in the high-level library| +|`h5cc.in`|Input file from which h5cc is created| +|`h5redeploy.in`|Input file from which h5redeploy is created| +|`h5vers`|Updates the library version number| +|`make_err`|Generates the H5E header files (called in `autogen.sh`)| +|`make_vers`|Generates H5version.h (called in `autogen.sh`)| +|`make_overflow`|Generates H5overflow.h (called in `autogen.sh`)| +|`output_filter`|Used in the tools test code to strip extraneous output before we diff files| +|`restore.sh`|Removes files generated by `autogen.sh`| +|`runbkprog`|Used by CMake to run test programs in the background| +|`switch_maint_mode`|Switches maintainer mode on/off in `configure.ac`| +|`trace`|Adds `TRACE` macros to HDF5 C library source files (run by `autogen.sh`)| +|`warnhist`|Generates compiler warning statistics for gcc/clang when fed output of make| + +## TODO + +* chkcopyright is currently semi-broken as it doesn't handle the full variety of copyright headers we need. We're leaving it in place, though, in the hopes that someone will update it in the future. +* Extending warnhist to better understand the output of additional compilers/languages would be nice. diff --git a/bin/release b/bin/release index d9e4f7b..1226d33 100755 --- a/bin/release +++ b/bin/release @@ -206,7 +206,7 @@ tar2cmakezip() cp /mnt/scr1/pre-release/hdf5/CMake/LIBAEC.tar.gz $cmziptmpsubdir cp /mnt/scr1/pre-release/hdf5/CMake/ZLib.tar.gz $cmziptmpsubdir cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-2.0.3-Source.zip $cmziptmpsubdir - cp /mnt/scr1/pre-release/hdf5/CMake/hdf5_plugins-1_12_2.zip $cmziptmpsubdir + cp /mnt/scr1/pre-release/hdf5/CMake/hdf5_plugins-master.zip $cmziptmpsubdir cp $cmziptmpsubdir/$version/config/cmake/scripts/CTestScript.cmake $cmziptmpsubdir cp $cmziptmpsubdir/$version/config/cmake/scripts/HDF5config.cmake $cmziptmpsubdir cp $cmziptmpsubdir/$version/config/cmake/scripts/HDF5options.cmake $cmziptmpsubdir @@ -298,7 +298,7 @@ tar2cmaketgz() cp /mnt/scr1/pre-release/hdf5/CMake/LIBAEC.tar.gz $cmgztmpsubdir cp /mnt/scr1/pre-release/hdf5/CMake/ZLib.tar.gz $cmgztmpsubdir cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-2.0.3-Source.tar.gz $cmgztmpsubdir - cp /mnt/scr1/pre-release/hdf5/CMake/hdf5_plugins-1_12_2.tar.gz $cmgztmpsubdir + cp /mnt/scr1/pre-release/hdf5/CMake/hdf5_plugins-master.tar.gz $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/CTestScript.cmake $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/HDF5config.cmake $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/HDF5options.cmake $cmgztmpsubdir @@ -377,7 +377,7 @@ tar2hpccmaketgz() cp /mnt/scr1/pre-release/hdf5/CMake/LIBAEC.tar.gz $cmgztmpsubdir cp /mnt/scr1/pre-release/hdf5/CMake/ZLib.tar.gz $cmgztmpsubdir cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-2.0.3-Source.tar.gz $cmgztmpsubdir - cp /mnt/scr1/pre-release/hdf5/CMake/hdf5_plugins-1_12_2.tar.gz $cmgztmpsubdir + cp /mnt/scr1/pre-release/hdf5/CMake/hdf5_plugins-master.tar.gz $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/CTestScript.cmake $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/HDF5config.cmake $cmgztmpsubdir diff --git a/c++/examples/CMakeLists.txt b/c++/examples/CMakeLists.txt index c50315f..606c221 100644 --- a/c++/examples/CMakeLists.txt +++ b/c++/examples/CMakeLists.txt @@ -34,7 +34,7 @@ set (tutr_examples foreach (example ${examples}) add_executable (cpp_ex_${example} ${HDF5_CPP_EXAMPLES_SOURCE_DIR}/${example}.cpp) - target_include_directories (cpp_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (cpp_ex_${example} PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (cpp_ex_${example} STATIC) target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) @@ -59,7 +59,7 @@ endforeach () foreach (example ${tutr_examples}) add_executable (cpp_ex_${example} ${HDF5_CPP_EXAMPLES_SOURCE_DIR}/${example}.cpp) - target_include_directories (cpp_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (cpp_ex_${example} PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (cpp_ex_${example} STATIC) target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) diff --git a/c++/examples/CMakeTests.cmake b/c++/examples/CMakeTests.cmake index 5af0b2a..f710204 100644 --- a/c++/examples/CMakeTests.cmake +++ b/c++/examples/CMakeTests.cmake @@ -16,17 +16,31 @@ ############################################################################## ############################################################################## # Remove any output file left over from previous test run +set (CPP_EX_CLEANFILES + Group.h5 + SDS.h5 + SDScompound.h5 + SDSextendible.h5 + Select.h5 +) add_test ( NAME CPP_ex-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove - Group.h5 - SDS.h5 - SDScompound.h5 - SDSextendible.h5 - Select.h5 + -E remove ${CPP_EX_CLEANFILES} +) +set_tests_properties (CPP_ex-clear-objects PROPERTIES + FIXTURES_SETUP clear_cppex + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} +) +add_test ( + NAME CPP_ex-clean-objects + COMMAND ${CMAKE_COMMAND} + -E remove ${CPP_EX_CLEANFILES} +) +set_tests_properties (CPP_ex-clean-objects PROPERTIES + FIXTURES_CLEANUP clear_cppex + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} ) -set_tests_properties (CPP_ex-clear-objects PROPERTIES FIXTURES_SETUP clear_cppex) foreach (example ${examples}) if (HDF5_ENABLE_USING_MEMCHECKER) @@ -53,19 +67,32 @@ endforeach () #the following dependencies are handled by the order of the files # SET_TESTS_PROPERTIES(CPP_ex_readdata PROPERTIES DEPENDS CPP_ex_create) # SET_TESTS_PROPERTIES(CPP_ex_chunks PROPERTIES DEPENDS CPP_ex_extend_ds) - +set (CPP_EX_TUTR_CLEANFILES + h5tutr_cmprss.h5 + h5tutr_dset.h5 + h5tutr_extend.h5 + h5tutr_group.h5 + h5tutr_groups.h5 + h5tutr_subset.h5 +) add_test ( NAME CPP_ex_tutr-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove - h5tutr_cmprss.h5 - h5tutr_dset.h5 - h5tutr_extend.h5 - h5tutr_group.h5 - h5tutr_groups.h5 - h5tutr_subset.h5 + -E remove ${CPP_EX_TUTR_CLEANFILES} +) +set_tests_properties (CPP_ex_tutr-clear-objects PROPERTIES + FIXTURES_SETUP clear_cppex_tutr + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} +) +add_test ( + NAME CPP_ex_tutr-clean-objects + COMMAND ${CMAKE_COMMAND} + -E remove ${CPP_EX_TUTR_CLEANFILES} +) +set_tests_properties (CPP_ex_tutr-clean-objects PROPERTIES + FIXTURES_CLEANUP clear_cppex_tutr + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} ) -set_tests_properties (CPP_ex_tutr-clear-objects PROPERTIES FIXTURES_SETUP clear_cppex_tutr) foreach (example ${tutr_examples}) if (HDF5_ENABLE_USING_MEMCHECKER) diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index 6bf0e8d..f8ac729 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -80,7 +80,7 @@ set (CPP_HDRS if (BUILD_STATIC_LIBS) add_library (${HDF5_CPP_LIB_TARGET} STATIC ${CPP_SOURCES} ${CPP_HDRS}) target_include_directories (${HDF5_CPP_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" + PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) target_compile_options(${HDF5_CPP_LIB_TARGET} PRIVATE "${HDF5_CMAKE_CXX_FLAGS}") @@ -98,7 +98,7 @@ endif () if (BUILD_SHARED_LIBS) add_library (${HDF5_CPP_LIBSH_TARGET} SHARED ${CPP_SOURCES} ${CPP_HDRS}) target_include_directories (${HDF5_CPP_LIBSH_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" + PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) target_compile_options(${HDF5_CPP_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_CXX_FLAGS}") diff --git a/c++/test/CMakeLists.txt b/c++/test/CMakeLists.txt index 331cada..3511c5f 100644 --- a/c++/test/CMakeLists.txt +++ b/c++/test/CMakeLists.txt @@ -38,7 +38,7 @@ set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}) configure_file (${HDF5_CPP_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ONLY) add_executable (cpp_testhdf5 ${CPP_TEST_SOURCES} ${HDF5_CPP_TEST_SOURCE_DIR}/h5cpputil.h) -target_include_directories (cpp_testhdf5 PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_include_directories (cpp_testhdf5 PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(cpp_testhdf5 PRIVATE "${HDF5_CMAKE_CXX_FLAGS}") target_compile_definitions(cpp_testhdf5 PRIVATE "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK>"# Parallel/MPI, prevent spurious cpp/cxx warnings diff --git a/c++/test/CMakeTests.cmake b/c++/test/CMakeTests.cmake index e34f629..fc94a68 100644 --- a/c++/test/CMakeTests.cmake +++ b/c++/test/CMakeTests.cmake @@ -17,20 +17,6 @@ add_custom_target(cpp_testhdf5_files ALL COMMENT "Copying files needed by cpp_te ### T E S T I N G ### ############################################################################## ############################################################################## -# Remove any output file left over from previous test run -add_test ( - NAME CPP_testhdf5-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - tattr_basic.h5 - tattr_compound.h5 - tattr_dtype.h5 - tattr_multi.h5 - tattr_scalar.h5 - tfattrs.h5 - titerate.h5 -) - if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME CPP_testhdf5 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:cpp_testhdf5>) else () @@ -46,7 +32,9 @@ else () -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () -set_tests_properties (CPP_testhdf5 PROPERTIES DEPENDS CPP_testhdf5-clear-objects) +set_tests_properties (CPP_testhdf5 PROPERTIES + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} +) ############################################################################## ############################################################################## diff --git a/c++/test/CMakeVFDTests.cmake b/c++/test/CMakeVFDTests.cmake index ced9b0c..5405df3 100644 --- a/c++/test/CMakeVFDTests.cmake +++ b/c++/test/CMakeVFDTests.cmake @@ -22,22 +22,9 @@ H5_CREATE_VFD_DIR() ### T H E T E S T S M A C R O S ### ############################################################################## ############################################################################## - macro (ADD_VFD_TEST vfdname resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove - tattr_basic.h5 - tattr_compound.h5 - tattr_dtype.h5 - tattr_multi.h5 - tattr_scalar.h5 - tfattrs.h5 - titerate.h5 - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${vfdname} - ) - add_test ( NAME CPP_VFD-${vfdname}-cpp_testhdf5 COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" @@ -49,7 +36,6 @@ macro (ADD_VFD_TEST vfdname resultcode) -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}" -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) - set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES DEPENDS CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects) set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES TIMEOUT ${CTEST_SHORT_TIMEOUT}) endif () endmacro () diff --git a/config/README.md b/config/README.md new file mode 100644 index 0000000..8459b77 --- /dev/null +++ b/config/README.md @@ -0,0 +1,88 @@ +# The `config` directory + +## Intro + +HDF5 can be configured using both the GNU Autotools and CMake. We try to keep +them in sync, but you can expect minor differences to crop up. Please create +a GitHub issue for any differences noted. Note that with the Autotools, we +do NOT check generated files into GitHub until release time, so you will +need to generate `configure`, `Makefile.in`(s), etc. via `autogen.sh` in the +project root if you want to build with that system. + +Configuration information for the HDF5 library and tools is (unfortunately) +spread across the repository. Basic library configuration will generally +be found in `configure.ac` (Autotools) and the root's `CMakeLists.txt` (CMake). +Each subdirectory of the project also has its own `Makefile.am` or CMake build +and test files. + +This directory contains a few important things: + +* Autotools OS- and compiler-specific configuration +* CMake support files (in `cmake`) +* Warning files shared between the two systems (in `*-warnings` directories) +* CMake toolchain files (in `toolchain`) +* CMake sanitizer files (in `sanitizer`) + +CMake will be documented elsewhere. This document focuses on the Autotools files +and the shared warning files. + +## Autotools + +An Autotools build will first use `$host_cpu`, `$host_os`, etc. to try to find a +suitable platform file in `config` to source and start checking compilers. The +code that does this is in `configure.ac` (search for `host_os`). For example, +MacOS will source the `apple` file and FreeBSD will source the `freebsd` file. +There are a bunch of Linux files, but they all eventually invoke +`linux-gnulibc1`. + +If you dig into one of these files, the way that they check for compilers is +rather crude. Each OS script will simply source the various C, C++, and +Fortran compiler files that are listed inside. Each compiler file checks +the designated compiler's version output to see if there's a match, and if so, +the flag processing proceeds, and a variable like `cc_flags_set` will be set +at the end. + +In case it's not obvious, the C files end in `-flags`, C++ in `-cxxflags`, and +Fortran in `-fflags`. + +When a compiler matches, the script will attempt to set the `CFLAGS`, etc. +variables based on the platform and compiler's properties. There are typically +a large number of flag categories (e.g., `DEBUG_OPT_CFLAGS`) that are +conditionally appended to the canonical variables, like `AM_FLAGS`, by the +remainder of the `configure` script. + +For the major compilers, like Clang and gcc, there will be a section at the +end where we append version-specific flags, mainly for warnings. These are +imported via a function in the script (`load_gnu_arguments()` for gcc). See +below for more detail. + +## Warnings files + +Keeping the Autotools and CMake build files in sync has always been a bit of a +struggle. One way that we help to ensure that the same flags are used in each +build system is to import the warnings settings from text files that are +maintained separately from the Autotools and CMake build files. We like to +configure the compiler to be as crabby as possible so as to catch subtle bugs, +so there are a LOT of warning flags for popular compilers like Clang and gcc. + +We've located these files in `config/*-warnings` directories. Each file +represents a compiler version and contains the warning flags we set, one to a +line. Lines that start with `#` are considered comment lines. You'll also see +`developer` and `no-developer` flavors of compiler version files. The former +corresponds to "developer flags" that are usually either only semi-useful and/or +generate a lot of (usually unfixable) noise. The latter corresponds to things +that we want to ensure do NOT appear in non-developer builds of the library. +These might involve a different level setting (`-Wfoo=x`) or something that +gets incorporated in a "conglomerate" flag like `-Wextra` so we need to set +`-Wno-foo` in non-developer builds. Developer warnings can be turned on +via a configure option. You will also sometimes see `error` files. Those are +files that include warnings that will be considered errors if you have enabled +the "warnings as errors" configure option set. Now that the library is largely +warning-free, these are less useful than in the past as you can now just set +-Werror directly in many cases (our configure script is smart about not running +configure checks with -Werror). + +For anyone interested, we are always interested in improving both the OS and +compiler files, so pull requests for those are always welcome, especially for +platforms we don't have routine access to. If you are a compiler or platform +expert/aficionado, please help us out! diff --git a/config/apple b/config/apple index 3eb65a7..a8a219b 100644 --- a/config/apple +++ b/config/apple @@ -21,58 +21,60 @@ # No support for OS older than darwin 10.X. if test "X-" = "X-$CC"; then case "$host_os" in - darwin10.*) # Snow Leopard. Use gcc/g++ because clang++ is not available. - CC=gcc - CC_BASENAME=gcc - ;; - *) - CC=clang - CC_BASENAME=clang - - # Production - PROD_CFLAGS="-O3" - PROD_CPPFLAGS= - - # Debug - DEBUG_CFLAGS="-g -O0" - DEBUG_CPPFLAGS= - - # Profile - # Use this for profiling with gprof - # Just "-g" for now. More later. - PROFILE_CFLAGS="-g" - PROFILE_CPPFLAGS= - ;; + darwin10.*) # Snow Leopard. Use gcc/g++ because clang++ is not available. + CC=gcc + CC_BASENAME=gcc + ;; + *) + if test "X-$enable_parallel" = "X-yes"; then + # default to use mpicc which is the defacto MPI compiler name + CC=mpicc + CC_BASENAME=mpicc + else + CC=clang + CC_BASENAME=clang + fi + + # Production + PROD_CFLAGS="-O3" + PROD_CPPFLAGS= + + # Debug + DEBUG_CFLAGS="-g -O0" + DEBUG_CPPFLAGS= + + # Profile + # Use this for profiling with gprof + # Just "-g" for now. More later. + PROFILE_CFLAGS="-g" + PROFILE_CPPFLAGS= + ;; esac fi -# Figure out compiler flags +# Figure out C compiler flags . $srcdir/config/gnu-flags . $srcdir/config/clang-flags +. $srcdir/config/intel-flags + # temp patch: if GCC 4.2.1 is used in Lion or Mountain Lion systems, do not # use -O option as it causes failures in test/dt_arith. case "$host_os" in darwin1[12].*) # lion & mountain lion - #echo cc_vendor=$cc_vendor'-'cc_version=$cc_version - case "$cc_vendor-$cc_version" in - gcc-4.2.1) - # Remove any -O flags - #echo PROD_CFLAGS=$PROD_CFLAGS - PROD_CFLAGS="`echo $PROD_CFLAGS | sed -e 's/-O[0-3]*//'`" - #echo new PROD_CFLAGS=$PROD_CFLAGS - ;; - esac - ;; + #echo cc_vendor=$cc_vendor'-'cc_version=$cc_version + case "$cc_vendor-$cc_version" in + gcc-4.2.1) + # Remove any -O flags + #echo PROD_CFLAGS=$PROD_CFLAGS + PROD_CFLAGS="`echo $PROD_CFLAGS | sed -e 's/-O[0-3]*//'`" + #echo new PROD_CFLAGS=$PROD_CFLAGS + ;; + esac + ;; esac - -. $srcdir/config/intel-flags + if test "X-" = "X-$FC"; then case $CC_BASENAME in - clang) - # clang has no fortran compiler. Use gfortran. - FC=gfortran - FC_BASENAME=gfortran - ;; gcc*) FC=gfortran FC_BASENAME=gfortran @@ -81,15 +83,26 @@ if test "X-" = "X-$FC"; then FC=ifort FC_BASENAME=ifort ;; + mpicc*) + FC=mpif90 + FC_BASENAME=mpif90 + ;; + clang) + # clang has no fortran compiler. Use gfortran. + FC=gfortran + FC_BASENAME=gfortran + ;; esac fi +# Figure out FORTRAN compiler flags +. $srcdir/config/gnu-fflags +. $srcdir/config/intel-fflags + + +# The default C++ compiler is `clang++'. if test "X-" = "X-$CXX"; then case $CC_BASENAME in - clang) - CXX=clang++ - CXX_BASENAME=clang++ - ;; gcc) CXX=g++ CXX_BASENAME=g++ @@ -98,18 +111,21 @@ if test "X-" = "X-$CXX"; then CXX=icpc CXX_BASENAME=icpc ;; + mpicc*) + FC=mpif90 + FC_BASENAME=mpif90 + ;; + clang) + CXX=clang++ + CXX_BASENAME=clang++ + ;; esac fi -case $CXX_BASENAME in - clang++) - PROD_CXXFLAGS="-O3" - DEBUG_CXXFLAGS="-g -O0" - # Use this for profiling with gprof - # Just "-g" for now. More later. - PROFILE_CXXFLAGS="-g" - ;; -esac +# Figure out C++ compiler flags +. $srcdir/config/intel-cxxflags # Do this ahead of GNU to avoid icpc being detected as g++ +. $srcdir/config/gnu-cxxflags +. $srcdir/config/clang-cxxflags # compiler version strings case $CC in @@ -132,16 +148,15 @@ case $CC in echo "No match to get cc_version_info for $CC" ;; esac + # Figure out Fortran compiler flags and version strings case $FC in *gfortran*) - . $srcdir/config/gnu-fflags fc_version_info=`$FC $FCFLAGS $H5_FCFLAGS --version 2>&1 |\ grep 'GCC' | sed 's/\(.*(GCC) [-a-z0-9\. ]*\).*/\1/'` ;; *ifc*|*ifort*) - . $srcdir/config/intel-fflags fc_version_info=`$FC $FCFLAGS $H5_FCFLAGS -V 2>&1 | grep 'Version' |\ sed 's/\(Intel.* Compiler\).*\( Version [a-z0-9\.]*\).*\( Build [0-9]*\)/\1\2\3/'` ;; @@ -155,13 +170,11 @@ esac # get c++ version info case $CXX in clang++) - . $srcdir/config/clang-cxxflags cxx_version_info=`$CXX $CXXFLAGS $H5_CXXFLAGS --version 2>&1 |\ grep 'Apple' | sed 's/(.*//'` ;; *g++*) - . $srcdir/config/gnu-cxxflags cxx_version_info=`$CXX $CXXFLAGS $H5_CXXFLAGS --version 2>&1 |\ grep 'GCC' | sed 's/.*\((GCC) [-a-z0-9\. ]*.*\)/\1/'` ;; diff --git a/config/clang-cxxflags b/config/clang-cxxflags index 5685ca1..c279d67 100644 --- a/config/clang-cxxflags +++ b/config/clang-cxxflags @@ -112,7 +112,7 @@ if test "X-clang" = "X-$cxx_vendor" -o "X-Apple LLVM" = "X-$cxx_vendor"; then ;; esac - H5_CXXFLAGS="$H5_CXXFLAGS $arch" + H5_CXXFLAGS="$H5_CXXFLAGS $arch -std=c++98" ############## # Production # diff --git a/config/clang-warnings/error-general b/config/clang-warnings/error-general index 883dff7..384fcc6 100644 --- a/config/clang-warnings/error-general +++ b/config/clang-warnings/error-general @@ -26,9 +26,6 @@ # -Wunused-variable # -# H5VLpassthru.c -# -Werror=unused-parameter -# -Wunused-parameter # # diff --git a/config/cmake-presets/hidden-presets.json b/config/cmake-presets/hidden-presets.json index 18ffdd1..02d200a 100644 --- a/config/cmake-presets/hidden-presets.json +++ b/config/cmake-presets/hidden-presets.json @@ -7,8 +7,8 @@ "description": "Basic build using Ninja generator", "generator": "Ninja", "hidden": true, - "binaryDir": "${sourceParentDir}/build/${presetName}", - "installDir": "${sourceParentDir}/install/${presetName}" + "binaryDir": "${sourceParentDir}/build112/${presetName}", + "installDir": "${sourceParentDir}/install112/${presetName}" }, { "name": "ci-x64", diff --git a/config/cmake/CTestCustom.cmake b/config/cmake/CTestCustom.cmake index 94a6481..30ff60f 100644 --- a/config/cmake/CTestCustom.cmake +++ b/config/cmake/CTestCustom.cmake @@ -23,6 +23,7 @@ set (CTEST_CUSTOM_WARNING_EXCEPTION "stamp.verify" "CMake Warning*stamp" "src.ZLIB.*:[ \t]*warning" + "src.HDF5_ZLIB.*:[ \t]*warning" "warning LNK4197:.*ZLIB-prefix" "src.SZIP.*:[ \t]*warning" # "POSIX name for this item is deprecated" @@ -36,6 +37,7 @@ set (CTEST_CUSTOM_WARNING_EXCEPTION ".*note.*expected.*void.*but argument is of type.*volatile.*" ".*src.SZIP.*:[ \t]*warning.*" ".*src.ZLIB.*:[ \t]*warning.*" + ".*src.HDF5_ZLIB.*:[ \t]*warning.*" ".*src.JPEG.*:[ \t]*warning.*" ".*POSIX name for this item is deprecated.*" ".*disabling jobserver mode.*" @@ -64,19 +66,32 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE H5TEST-vds_env-clear-objects PERFORM_h5perform-clear-objects HL_test-clear-objects + HL_test-clean-objects HL_FORTRAN_test-clear-objects + HL_FORTRAN_test-clean-objects FORTRAN_testhdf5-clear-objects + FORTRAN_testhdf5-clean-objects FORTRAN_flush1-clear-objects + FORTRAN_flush1-clean-objects CPP_testhdf5-clear-objects + CPP_testhdf5-clean-objects ######### examples ######### EXAMPLES-clear-objects + EXAMPLES-clean-objects CPP_ex-clear-objects + CPP_ex-clean-objects CPP_ex_tutr-clear-objects + CPP_ex_tutr-clean-objects HL_ex-clear-objects + HL_ex-clean-objects f90_ex-clear-objects + f90_ex-clean-objects HL_CPP_ptableTest-clear-objects + HL_CPP_ptableTest-clean-objects HL_CPP_ex_ptExampleFL-clear-objects + HL_CPP_ex_ptExampleFL-clean-objects HL_FORTRAN_f90_ex-clear-objects + HL_FORTRAN_f90_ex-clean-objects ######### tools/h5clear ######### H5CLEAR-clearall-objects H5CLEAR-h5clear_gentest # does not close ids by design @@ -196,5 +211,7 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE PERFORM_h5perform-clearall-objects ######### hl/tools ######### HL_TOOLS-clear-objects + HL_TOOLS-clean-objects H5WATCH-clearall-objects + H5WATCH-cleanall-objects ) diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 8900d4c..ee57eb0 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -159,7 +159,7 @@ CHECK_INCLUDE_FILE_CONCAT (stdbool.h ${HDF_PREFIX}_HAVE_STDBOOL_H) ## Check for non-standard extension quadmath.h CHECK_INCLUDE_FILES(quadmath.h C_HAVE_QUADMATH) -if (${C_HAVE_QUADMATH}) +if (C_HAVE_QUADMATH) set(${HDF_PREFIX}_HAVE_QUADMATH_H 1) else () set(${HDF_PREFIX}_HAVE_QUADMATH_H 0) @@ -898,7 +898,7 @@ endif() if (HDF5_BUILD_FORTRAN) HDF_CHECK_TYPE_SIZE(__float128 _SIZEOF___FLOAT128) - if (${_SIZEOF___FLOAT128}) + if (_SIZEOF___FLOAT128) set (${HDF_PREFIX}_HAVE_FLOAT128 1) set (${HDF_PREFIX}_SIZEOF___FLOAT128 ${_SIZEOF___FLOAT128}) else () @@ -907,7 +907,7 @@ if (HDF5_BUILD_FORTRAN) endif () HDF_CHECK_TYPE_SIZE(_Quad _SIZEOF__QUAD) - if (NOT ${_SIZEOF__QUAD}) + if (NOT _SIZEOF__QUAD) set (${HDF_PREFIX}_SIZEOF__QUAD 0) else () set (${HDF_PREFIX}_SIZEOF__QUAD ${_SIZEOF__QUAD}) @@ -927,12 +927,17 @@ if (HDF5_BUILD_FORTRAN) ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler1.c ${SOURCE_CODE} ) + if (CMAKE_VERSION VERSION_LESS 3.25) + set (_RUN_OUTPUT_VARIABLE "RUN_OUTPUT_VARIABLE") + else () + set (_RUN_OUTPUT_VARIABLE "RUN_OUTPUT_STDOUT_VARIABLE") + endif() TRY_RUN (RUN_RESULT_VAR COMPILE_RESULT_VAR ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler1.c COMPILE_DEFINITIONS "-D_SIZEOF___FLOAT128=${H5_SIZEOF___FLOAT128};-D_HAVE_QUADMATH_H=${H5_HAVE_QUADMATH_H}" COMPILE_OUTPUT_VARIABLE COMPILEOUT - RUN_OUTPUT_VARIABLE OUTPUT_VAR + ${_RUN_OUTPUT_VARIABLE} OUTPUT_VAR ) set (${RETURN_OUTPUT_VAR} ${OUTPUT_VAR}) @@ -969,7 +974,6 @@ if (HDF5_BUILD_FORTRAN) message (FATAL_ERROR "Compilation of C ${FUNCTION_NAME} - Failed") endif () endmacro () - set (PROG_SRC " #include <float.h>\n\ @@ -991,7 +995,7 @@ if (HDF5_BUILD_FORTRAN) #define C_LDBL_DIG DECIMAL_DIG\n\ #else\n\ #define C_LDBL_DIG LDBL_DIG\n\ -#endif\n\nint main() {\nprintf(\"\\%d\\\;\\%d\\\;\", C_LDBL_DIG, C_FLT128_DIG)\\\;\n\nreturn 0\\\;\n}\n +#endif\n\nint main(void) {\nprintf(\"\\%d\\\;\\%d\\\;\", C_LDBL_DIG, C_FLT128_DIG)\\\;\n\nreturn 0\\\;\n}\n " ) @@ -1003,21 +1007,23 @@ if (HDF5_BUILD_FORTRAN) list (GET PROG_OUTPUT4 0 H5_LDBL_DIG) list (GET PROG_OUTPUT4 1 H5_FLT128_DIG) - endif () - if (${HDF_PREFIX}_SIZEOF___FLOAT128 EQUAL "0" OR FLT128_DIG EQUAL "0") - set (${HDF_PREFIX}_HAVE_FLOAT128 0) - set (${HDF_PREFIX}_SIZEOF___FLOAT128 0) - set (_PAC_C_MAX_REAL_PRECISION ${H5_LDBL_DIG}) + if (${HDF_PREFIX}_SIZEOF___FLOAT128 EQUAL "0" OR FLT128_DIG EQUAL "0") + set (${HDF_PREFIX}_HAVE_FLOAT128 0) + set (${HDF_PREFIX}_SIZEOF___FLOAT128 0) + set (_PAC_C_MAX_REAL_PRECISION ${H5_LDBL_DIG}) + else () + set (_PAC_C_MAX_REAL_PRECISION ${H5_FLT128_DIG}) + endif () + if (NOT ${_PAC_C_MAX_REAL_PRECISION}) + set (${HDF_PREFIX}_PAC_C_MAX_REAL_PRECISION 0) + else () + set (${HDF_PREFIX}_PAC_C_MAX_REAL_PRECISION ${_PAC_C_MAX_REAL_PRECISION}) + endif () + message (STATUS "maximum decimal precision for C var - ${${HDF_PREFIX}_PAC_C_MAX_REAL_PRECISION}") else () - set (_PAC_C_MAX_REAL_PRECISION ${H5_FLT128_DIG}) - endif () - if (NOT ${_PAC_C_MAX_REAL_PRECISION}) set (${HDF_PREFIX}_PAC_C_MAX_REAL_PRECISION 0) - else () - set (${HDF_PREFIX}_PAC_C_MAX_REAL_PRECISION ${_PAC_C_MAX_REAL_PRECISION}) endif () - message (STATUS "maximum decimal precision for C var - ${${HDF_PREFIX}_PAC_C_MAX_REAL_PRECISION}") endif() @@ -1067,7 +1073,7 @@ endmacro () # ---------------------------------------------------------------------- # Set the flag to indicate that the machine is using a special algorithm to convert # 'long double' to '(unsigned) long' values. (This flag should only be set for -# the IBM Power6 Linux. When the bit sequence of long double is +# the IBM Power Linux. When the bit sequence of long double is # 0x4351ccf385ebc8a0bfcc2a3c3d855620, the converted value of (unsigned)long # is 0x004733ce17af227f, not the same as the library's conversion to 0x004733ce17af2282. # The machine's conversion gets the correct value. We define the macro and disable @@ -1077,7 +1083,7 @@ H5ConversionTests (${HDF_PREFIX}_LDOUBLE_TO_LONG_SPECIAL "Checking IF your syst # ---------------------------------------------------------------------- # Set the flag to indicate that the machine is using a special algorithm # to convert some values of '(unsigned) long' to 'long double' values. -# (This flag should be off for all machines, except for IBM Power6 Linux, +# (This flag should be off for all machines, except for IBM Power Linux, # when the bit sequences are 003fff..., 007fff..., 00ffff..., 01ffff..., # ..., 7fffff..., the compiler uses a unknown algorithm. We define a # macro and skip the test for now until we know about the algorithm. diff --git a/config/cmake/ConversionTests.c b/config/cmake/ConversionTests.c index f80959f..725f049 100644 --- a/config/cmake/ConversionTests.c +++ b/config/cmake/ConversionTests.c @@ -11,13 +11,13 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #if defined(__has_attribute) -#if __has_attribute(no_sanitize) -#define HDF_NO_UBSAN __attribute__((no_sanitize("undefined"))) +# if __has_attribute(no_sanitize) +# define HDF_NO_UBSAN __attribute__((no_sanitize("undefined"))) +# else +# define HDF_NO_UBSAN +# endif #else -#define HDF_NO_UBSAN -#endif -#else -#define HDF_NO_UBSAN +# define HDF_NO_UBSAN #endif #ifdef H5_LDOUBLE_TO_LONG_SPECIAL_TEST @@ -34,45 +34,51 @@ int HDF_NO_UBSAN main(void) unsigned char s2[8]; int ret = 1; - if(sizeof(long double) == 16 && sizeof(long) == 8) { - /*make sure the long double type has 16 bytes in size and - * 11 bits of exponent. If it is, - *the bit sequence should be like below. It's not - *a decent way to check but this info isn't available. */ - memcpy(s, &ld, 16); - if(s[0]==0x43 && s[1]==0x51 && s[2]==0xcc && s[3]==0xf3 && - s[4]==0x85 && s[5]==0xeb && s[6]==0xc8 && s[7]==0xa0 && - s[8]==0xbf && s[9]==0xcc && s[10]==0x2a && s[11]==0x3c) { - - /* Assign the hexadecimal value of long double type. */ - s[0]=0x43; s[1]=0x51; s[2]=0xcc; s[3]=0xf3; - s[4]=0x85; s[5]=0xeb; s[6]=0xc8; s[7]=0xa0; - s[8]=0xbf; s[9]=0xcc; s[10]=0x2a; s[11]=0x3c; - s[12]=0x3d; s[13]=0x85; s[14]=0x56; s[15]=0x20; - - memcpy(&ld, s, 16); - - ll = (long)ld; - memcpy(s2, &ll, 8); - - /* The library's algorithm converts it to 0x 00 47 33 ce 17 af 22 82 - * and gets wrong value 20041683600089730 on the IBM Power6 Linux. - * But the IBM Power6 Linux converts it to 0x00 47 33 ce 17 af 22 7f - * and gets the correct value 20041683600089727. It uses some special - * algorithm. We're going to define the macro and skip the test until - * we can figure out how they do it. */ - if(s2[0]==0x00 && s2[1]==0x47 && s2[2]==0x33 && s2[3]==0xce && - s2[4]==0x17 && s2[5]==0xaf && s2[6]==0x22 && s2[7]==0x7f) - ret = 0; - - ull = (unsigned long)ld; - memcpy(s2, &ull, 8); - - /* The unsigned long is the same as signed long. */ - if(s2[0]==0x00 && s2[1]==0x47 && s2[2]==0x33 && s2[3]==0xce && - s2[4]==0x17 && s2[5]==0xaf && s2[6]==0x22 && s2[7]==0x7f) - ret = 0; - } + if (sizeof(long double) == 16 && sizeof(long) == 8) { + /* Make sure the long double type has 16 bytes in size and + * 11 bits of exponent. If it is, the bit sequence should be + * like below. It's not a decent way to check but this info + * isn't available. + */ + memcpy(s, &ld, 16); + if (s[0]==0x43 && s[1]==0x51 && s[2]==0xcc && s[3]==0xf3 && + s[4]==0x85 && s[5]==0xeb && s[6]==0xc8 && s[7]==0xa0 && + s[8]==0xbf && s[9]==0xcc && s[10]==0x2a && s[11]==0x3c) { + + /* Assign the hexadecimal value of long double type. */ + s[0]=0x43; s[1]=0x51; s[2]=0xcc; s[3]=0xf3; + s[4]=0x85; s[5]=0xeb; s[6]=0xc8; s[7]=0xa0; + s[8]=0xbf; s[9]=0xcc; s[10]=0x2a; s[11]=0x3c; + s[12]=0x3d; s[13]=0x85; s[14]=0x56; s[15]=0x20; + + memcpy(&ld, s, 16); + + ll = (long)ld; + memcpy(s2, &ll, 8); + + /* The library's algorithm converts it to 0x00 47 33 ce 17 af 22 82 + * and gets wrong value 20041683600089730 on Linux on IBM Power + * architecture. + * + * But Linux on IBM Power converts it to 0x00 47 33 ce 17 af 22 7f + * and gets the correct value 20041683600089727. It uses some special + * algorithm. We're going to define the macro and skip the test until + * we can figure out how they do it. + */ + if (s2[0]==0x00 && s2[1]==0x47 && s2[2]==0x33 && s2[3]==0xce && + s2[4]==0x17 && s2[5]==0xaf && s2[6]==0x22 && s2[7]==0x7f) + + ret = 0; + + ull = (unsigned long)ld; + memcpy(s2, &ull, 8); + + /* The unsigned long is the same as signed long */ + if(s2[0]==0x00 && s2[1]==0x47 && s2[2]==0x33 && s2[3]==0xce && + s2[4]==0x17 && s2[5]==0xaf && s2[6]==0x22 && s2[7]==0x7f) + + ret = 0; + } } done: @@ -94,50 +100,61 @@ int HDF_NO_UBSAN main(void) unsigned char s[16]; int flag=0, ret=1; - /*Determine if long double has 16 byte in size, 11 bit exponent, and - *the bias is 0x3ff */ - if(sizeof(long double) == 16) { - ld = 1.0L; - memcpy(s, &ld, 16); - if(s[0]==0x3f && s[1]==0xf0 && s[2]==0x00 && s[3]==0x00 && - s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00) - flag = 1; - } + /* Determine if long double has 16 byte in size, 11 bit exponent, and + * the bias is 0x3ff + */ + if (sizeof(long double) == 16) { + ld = 1.0L; + memcpy(s, &ld, 16); + + if (s[0]==0x3f && s[1]==0xf0 && s[2]==0x00 && s[3]==0x00 && + s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00) - if(flag==1 && sizeof(long)==8) { - ll = 0x003fffffffffffffL; - ld = (long double)ll; - memcpy(s, &ld, 16); - /* The library converts the value to 0x434fffffffffffff8000000000000000. - * In decimal it is 18014398509481982.000000, one value short of the original. - * The IBM Power6 Linux converts it to 0x4350000000000000bff0000000000000. - * The value is correct in decimal. It uses some special - * algorithm. We're going to define the macro and skip the test until - * we can figure out how they do it. */ - if(s[0]==0x43 && s[1]==0x50 && s[2]==0x00 && s[3]==0x00 && - s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00 && - s[8]==0xbf && s[9]==0xf0 && s[10]==0x00 && s[11]==0x00 && - s[12]==0x00 && s[13]==0x00 && s[14]==0x00 && s[15]==0x00) - ret = 0; + flag = 1; } - if(flag==1 && sizeof(unsigned long)==8) { - ull = 0xffffffffffffffffUL; - ld = (long double)ull; - memcpy(s, &ld, 16); - /* Use a different value from signed long to test. The problem is the same - * for both long and unsigned long. The value is 18446744073709551615. - * The library converts the value to 0x43effffffffffffffe000000000000000. - * In decimal it's 18446744073709548544.000000, very different from the original. - * The IBM Power6 Linux converts it to 0x43f0000000000000bff0000000000000. - * The value is correct in decimal. It uses some special - * algorithm. We're going to define the macro and skip the test until - * we can figure out how they do it. */ - if(s[0]==0x43 && s[1]==0xf0 && s[2]==0x00 && s[3]==0x00 && - s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00 && - s[8]==0xbf && s[9]==0xf0 && s[10]==0x00 && s[11]==0x00 && - s[12]==0x00 && s[13]==0x00 && s[14]==0x00 && s[15]==0x00) - ret = 0; + + if (flag==1 && sizeof(long)==8) { + ll = 0x003fffffffffffffL; + ld = (long double)ll; + memcpy(s, &ld, 16); + + /* The library converts the value to 0x434fffffffffffff8000000000000000. + * In decimal it is 18014398509481982.000000, one value short of the original. + * + * Linux on IBM Power architecture converts it to + * 0x4350000000000000bff0000000000000. The value is correct in decimal. + * It uses some special algorithm. We're going to define the macro and + * skip the test until we can figure out how they do it. + */ + if (s[0]==0x43 && s[1]==0x50 && s[2]==0x00 && s[3]==0x00 && + s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00 && + s[8]==0xbf && s[9]==0xf0 && s[10]==0x00 && s[11]==0x00 && + s[12]==0x00 && s[13]==0x00 && s[14]==0x00 && s[15]==0x00) + + ret = 0; } + + if (flag==1 && sizeof(unsigned long)==8) { + ull = 0xffffffffffffffffUL; + ld = (long double)ull; + memcpy(s, &ld, 16); + + /* Use a different value from signed long to test. The problem is the + * same for both long and unsigned long. The value is 18446744073709551615. + * The library converts the value to 0x43effffffffffffffe000000000000000. + * In decimal it's 18446744073709548544.000000, very different from the + * original. Linux on IBM Power architecture converts it to + * 0x43f0000000000000bff0000000000000. The value is correct in decimal. + * It uses some special algorithm. We're going to define the macro and + * skip the test until we can figure out how they do it. + */ + if (s[0]==0x43 && s[1]==0xf0 && s[2]==0x00 && s[3]==0x00 && + s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00 && + s[8]==0xbf && s[9]==0xf0 && s[10]==0x00 && s[11]==0x00 && + s[12]==0x00 && s[13]==0x00 && s[14]==0x00 && s[15]==0x00) + + ret = 0; + } done: exit(ret); } @@ -157,18 +174,21 @@ int HDF_NO_UBSAN main(void) unsigned char s[16]; int ret = 0; - if(sizeof(long double) == 16) { - /*make sure the long double type is the same as the failing type - *which has 16 bytes in size and 11 bits of exponent. If it is, - *the bit sequence should be like below. It's not - *a decent way to check but this info isn't available. */ + if (sizeof(long double) == 16) { + /* Make sure the long double type is the same as the failing type + * which has 16 bytes in size and 11 bits of exponent. If it is, + * the bit sequence should be like below. It's not + * a decent way to check but this info isn't available. + */ memcpy(s, &ld, 16); - if(s[0]==0x43 && s[1]==0x51 && s[2]==0xcc && s[3]==0xf3 && + + if (s[0]==0x43 && s[1]==0x51 && s[2]==0xcc && s[3]==0xf3 && s[4]==0x85 && s[5]==0xeb && s[6]==0xc8 && s[7]==0xa0 && s[8]==0xbf && s[9]==0xcc && s[10]==0x2a && s[11]==0x3c) { - /*slightly adjust the bit sequence (s[8]=0xdf). The converted - *values will go wild on Mac OS 10.4 and IRIX64 6.5.*/ + /* Slightly adjust the bit sequence (s[8]=0xdf). The converted + * values will go wild on Mac OS 10.4 and IRIX64 6.5. + */ s[0]=0x43; s[1]=0x51; s[2]=0xcc; s[3]=0xf3; s[4]=0x85; s[5]=0xeb; s[6]=0xc8; s[7]=0xa0; s[8]=0xdf; s[9]=0xcc; s[10]=0x2a; s[11]=0x3c; @@ -178,7 +198,7 @@ int HDF_NO_UBSAN main(void) ll = (long long)ld; ull = (unsigned long long)ld; - if(ll != 20041683600089728 || ull != 20041683600089728) + if (ll != 20041683600089728 || ull != 20041683600089728) ret = 1; } } @@ -200,93 +220,47 @@ int HDF_NO_UBSAN main(void) unsigned char s[16]; int flag=0, ret=0; - /*Determine if long double has 16 byte in size, 11 bit exponent, and - *the bias is 0x3ff */ - if(sizeof(long double) == 16) { + /* Determine if long double has 16 byte in size, 11 bit exponent, and + * the bias is 0x3ff + */ + if (sizeof(long double) == 16) { ld = 1.0L; memcpy(s, &ld, 16); - if(s[0]==0x3f && s[1]==0xf0 && s[2]==0x00 && s[3]==0x00 && + if (s[0]==0x3f && s[1]==0xf0 && s[2]==0x00 && s[3]==0x00 && s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00) + flag = 1; } - if(flag==1 && sizeof(long long)==8) { + if (flag==1 && sizeof(long long)==8) { ll = 0x01ffffffffffffffLL; ld = (long double)ll; memcpy(s, &ld, 16); - /*Check if the bit sequence is as supposed to be*/ - if(s[0]!=0x43 || s[1]!=0x7f || s[2]!=0xff || s[3]!=0xff || + + /* Check if the bit sequence is as expected*/ + if (s[0]!=0x43 || s[1]!=0x7f || s[2]!=0xff || s[3]!=0xff || s[4]!=0xff || s[5]!=0xff || s[6]!=0xff || s[7]!=0xff || s[8]!=0xf0 || s[9]!=0x00 || s[10]!=0x00 || s[11]!=0x00) + ret = 1; } - if(flag==1 && sizeof(unsigned long long)==8) { + if (flag==1 && sizeof(unsigned long long)==8) { ull = 0x01ffffffffffffffULL; ld = (long double)ull; memcpy(s, &ld, 16); - if(s[0]!=0x43 || s[1]!=0x7f || s[2]!=0xff || s[3]!=0xff || + + if (s[0]!=0x43 || s[1]!=0x7f || s[2]!=0xff || s[3]!=0xff || s[4]!=0xff || s[5]!=0xff || s[6]!=0xff || s[7]!=0xff || s[8]!=0xf0 || s[9]!=0x00 || s[10]!=0x00 || s[11]!=0x00) + ret = 1; } + done: exit(ret); } #endif -#ifdef H5_NO_ALIGNMENT_RESTRICTIONS_TEST - -#include <stdlib.h> -#include <string.h> - -typedef struct { - size_t len; - void *p; -} hvl_t; - -#ifdef FC_DUMMY_MAIN -#ifndef FC_DUMMY_MAIN_EQ_F77 -# ifdef __cplusplus -extern "C" -# endif -int FC_DUMMY_MAIN() -{ return 1;} -#endif -#endif -int HDF_NO_UBSAN -main () -{ - - char *chp = "beefs"; - char **chpp = malloc (2 * sizeof (char *)); - char **chpp2; - hvl_t vl = { 12345, (void *) chp }; - hvl_t *vlp; - hvl_t *vlp2; - - memcpy ((void *) ((char *) chpp + 1), &chp, sizeof (char *)); - chpp2 = (char **) ((char *) chpp + 1); - if (strcmp (*chpp2, chp)) { - free (chpp); - return 1; - } - free (chpp); - - vlp = malloc (2 * sizeof (hvl_t)); - memcpy ((void *) ((char *) vlp + 1), &vl, sizeof (hvl_t)); - vlp2 = (hvl_t *) ((char *) vlp + 1); - if (vlp2->len != vl.len || vlp2->p != vl.p) { - free (vlp); - return 1; - } - free (vlp); - - ; - return 0; -} - -#endif - #ifdef H5_DISABLE_SOME_LDOUBLE_CONV_TEST #include <stdio.h> @@ -304,7 +278,7 @@ int HDF_NO_UBSAN main(void) pclose(fp); - if(strncmp(cpu, "ppc64le", 7) == 0) + if (strncmp(cpu, "ppc64le", 7) == 0) return 0; return 1; diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 761717d..838726c 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -14,13 +14,13 @@ #ifndef H5_CONFIG_H_ #define H5_CONFIG_H_ -/* Define if the Windows virtual file driver should be compiled */ +/* Define if this is a Windows machine */ #cmakedefine H5_HAVE_WINDOWS @H5_HAVE_WINDOWS@ /* Define if using MinGW */ #cmakedefine H5_HAVE_MINGW @H5_HAVE_MINGW@ -/* Define if on the Windows platform and default WIN32 API */ +/* Define if on the Windows platform and using the Win32 API */ #cmakedefine H5_HAVE_WIN32_API @H5_HAVE_WIN32_API@ /* Define if using a Windows compiler (i.e. Visual Studio) */ diff --git a/config/cmake/HDF5DeveloperBuild.cmake b/config/cmake/HDF5DeveloperBuild.cmake new file mode 100644 index 0000000..40efb0e --- /dev/null +++ b/config/cmake/HDF5DeveloperBuild.cmake @@ -0,0 +1,196 @@ +# +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://www.hdfgroup.org/licenses. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +# + +# CMake settings for HDF5 Developer mode builds + +# Set CMake C++ flags based off of Debug build flags +set (CMAKE_CXX_FLAGS_DEVELOPER ${CMAKE_CXX_FLAGS_DEBUG} CACHE STRING + "Flags used by the C++ compiler during developer builds." FORCE +) + +# Set CMake C flags based off of Debug build flags. Add in -Og +# option to disable some GCC optimizations that might affect +# debugging negatively and also include some GCC compiler passes +# that collect debugging information +set (CMAKE_C_FLAGS_DEVELOPER "${CMAKE_C_FLAGS_DEBUG} -Og" CACHE STRING + "Flags used by the C compiler during developer builds." FORCE +) + +# Set CMake binary linker flags based off of Debug binary linker flags +set (CMAKE_EXE_LINKER_FLAGS_DEVELOPER ${CMAKE_EXE_LINKER_FLAGS_DEBUG} + CACHE STRING "Flags used for linking binaries during developer builds." + FORCE +) + +# Set CMake shared library linker flags based off of Debug shared library +# linker flags +set (CMAKE_SHARED_LINKER_FLAGS_DEVELOPER ${CMAKE_SHARED_LINKER_FLAGS_DEBUG} + CACHE STRING "Flags used by the shared libraries linker during developer builds." + FORCE +) + +mark_as_advanced ( + CMAKE_CXX_FLAGS_DEVELOPER + CMAKE_C_FLAGS_DEVELOPER + CMAKE_EXE_LINKER_FLAGS_DEVELOPER + CMAKE_SHARED_LINKER_FLAGS_DEVELOPER +) + +#----------------------------------------------------------------------------- +# Define various HDF5 macros for debugging the library +#----------------------------------------------------------------------------- + +# Enable debugging of various HDF5 modules +set (HDF5_ENABLE_DEBUG_APIS ON CACHE BOOL "Turn on extra debug output in all packages" FORCE) + +# HDF5 module debug definitions for debug code which either isn't +# currently integrated with HDF5_ENABLE_DEBUG_APIS, or which isn't +# well integrated with HDF5's H5DEBUG(X) (where 'X' is a package +# letter) system. This type of debug code usually always prints output +# to stdout, regardless of whether debugging for its particular module +# has been requested via the HDF5_DEBUG environment variable. Therefore, +# we don't automatically enable this debug code, but allow developers +# to quickly add those definitions into their build here, without +# needing to hack up source files. +option (HDF5_ENABLE_DEBUG_H5AC_DIRTY_BYTES "Enable printing of H5AC module dirty bytes information" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5AC_DIRTY_BYTES) +if (HDF5_ENABLE_DEBUG_H5AC_DIRTY_BYTES) + list (APPEND HDF5_DEBUG_APIS H5AC_DEBUG_DIRTY_BYTES_CREATION) +endif () + +option (HDF5_ENABLE_DEBUG_H5FA "Enable debugging of H5FA module" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5FA) +if (HDF5_ENABLE_DEBUG_H5FA) + list (APPEND HDF5_DEBUG_APIS H5FA_DEBUG) +endif () + +option (HDF5_ENABLE_DEBUG_H5FD_ALLOC "Enable debugging of H5FD module allocation code" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5FD_ALLOC) +if (HDF5_ENABLE_DEBUG_H5FD_ALLOC) + list (APPEND HDF5_DEBUG_APIS H5FD_ALLOC_DEBUG) +endif () + +option (HDF5_ENABLE_DEBUG_H5FL "Enable debugging of H5FL module" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5FL) +if (HDF5_ENABLE_DEBUG_H5FL) + list (APPEND HDF5_DEBUG_APIS H5FL_DEBUG) +endif () + +option (HDF5_ENABLE_DEBUG_H5FS "Enable debugging of H5FS module" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5FS) +if (HDF5_ENABLE_DEBUG_H5FS) + list (APPEND HDF5_DEBUG_APIS H5FS_DEBUG) +endif () + +option (HDF5_ENABLE_DEBUG_H5FS_SINFO "Enable debugging of H5FS module section info" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5FS_SINFO) +if (HDF5_ENABLE_DEBUG_H5FS_SINFO) + list (APPEND HDF5_DEBUG_APIS H5FS_SINFO_DEBUG) +endif () + +option (HDF5_ENABLE_DEBUG_H5MF_AGGR "Enable debugging of H5MF module aggregation code" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5MF_AGGR) +if (HDF5_ENABLE_DEBUG_H5MF_AGGR) + list (APPEND HDF5_DEBUG_APIS H5MF_AGGR_DEBUG) +endif () + +option (HDF5_ENABLE_DEBUG_H5MF_ALLOC "Enable debugging of H5MF module allocation code" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5MF_ALLOC) +if (HDF5_ENABLE_DEBUG_H5MF_ALLOC) + list (APPEND HDF5_DEBUG_APIS H5MF_ALLOC_DEBUG) +endif () + +option (HDF5_ENABLE_DEBUG_H5MF_ALLOC_MORE "Enable extra debugging of H5MF module allocation code" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5MF_ALLOC_MORE) +if (HDF5_ENABLE_DEBUG_H5MF_ALLOC_MORE) + list (APPEND HDF5_DEBUG_APIS H5MF_ALLOC_DEBUG_MORE) +endif () + +option (HDF5_ENABLE_DEBUG_H5MF_ALLOC_DUMP "Enable printing of debugging info for H5MF module allocation code" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5MF_ALLOC_DUMP) +if (HDF5_ENABLE_DEBUG_H5MF_ALLOC_DUMP) + list (APPEND HDF5_DEBUG_APIS H5MF_ALLOC_DEBUG_DUMP) +endif () + +option (HDF5_ENABLE_DEBUG_H5R "Enable debugging of H5R module" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5R) +if (HDF5_ENABLE_DEBUG_H5R) + list (APPEND HDF5_DEBUG_APIS H5R_DEBUG) +endif () + +option (HDF5_ENABLE_DEBUG_H5S_HYPER "Enable debugging of H5S hyperslab code" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5S_HYPER) +if (HDF5_ENABLE_DEBUG_H5S_HYPER) + list (APPEND HDF5_DEBUG_APIS H5S_HYPER_DEBUG) +endif () + +option (HDF5_ENABLE_DEBUG_H5T_REF "Enable debugging of H5T module reference code" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5T_REF) +if (HDF5_ENABLE_DEBUG_H5T_REF) + list (APPEND HDF5_DEBUG_APIS H5T_REF_DEBUG) +endif () + +# HDF5 module debug definitions for debug code which may add +# considerable amounts of overhead when enabled and is usually +# only useful for specific circumstances rather than general +# developer use. +option (HDF5_ENABLE_DEBUG_H5B "Enable debugging of H5B module" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5B) +if (HDF5_ENABLE_DEBUG_H5B) + list (APPEND HDF5_DEBUG_APIS H5B_DEBUG) +endif () + +option (HDF5_ENABLE_DEBUG_H5B2 "Enable debugging of H5B2 module" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5B2) +if (HDF5_ENABLE_DEBUG_H5B2) + list (APPEND HDF5_DEBUG_APIS H5B2_DEBUG) +endif () + +option (HDF5_ENABLE_DEBUG_H5C_SANITY_CHECKS "Enable full sanity checking in H5C module" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5C_SANITY_CHECKS) +if (HDF5_ENABLE_DEBUG_H5C_SANITY_CHECKS) + list (APPEND HDF5_DEBUG_APIS H5C_DO_SANITY_CHECKS) + list (APPEND HDF5_DEBUG_APIS H5C_DO_SLIST_SANITY_CHECKS) + list (APPEND HDF5_DEBUG_APIS H5C_DO_TAGGING_SANITY_CHECKS) + list (APPEND HDF5_DEBUG_APIS H5C_DO_EXTREME_SANITY_CHECKS) + + # See note in H5Cprivate.h about this #define + # list (APPEND HDF5_DEBUG_APIS H5C_DO_MEMORY_SANITY_CHECKS=1) +endif () + +option (HDF5_ENABLE_DEBUG_H5FL_TRACK "Enable tracking of free list allocations" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5FL_TRACK) +if (HDF5_ENABLE_DEBUG_H5FL_TRACK) + list (APPEND HDF5_DEBUG_APIS H5FL_TRACK) + + # Free list tracking requires the codestack functionality + set (HDF5_ENABLE_CODESTACK ON CACHE BOOL "Enable the function stack tracing (for developer debugging)." FORCE) +else () + unset (HDF5_ENABLE_CODESTACK CACHE) +endif () + +option (HDF5_ENABLE_DEBUG_H5FS_ASSERT "Enable extra debugging of H5FS module" OFF) +mark_as_advanced (HDF5_ENABLE_DEBUG_H5FS_ASSERT) +if (HDF5_ENABLE_DEBUG_H5FS_ASSERT) + list (APPEND HDF5_DEBUG_APIS H5FS_DEBUG_ASSERT) +endif () + +# If HDF5 free list debugging wasn't specifically enabled, disable +# free lists entirely for developer build modes, as they can +# make certain types of issues (like references to stale pointers) +# much more difficult to debug +if (NOT HDF5_ENABLE_DEBUG_H5FL AND NOT HDF5_ENABLE_DEBUG_H5FL_TRACK) + list (APPEND HDF5_DEVELOPER_DEFS H5_NO_FREE_LISTS) +endif () + +# Enable strict checking of the file format +list (APPEND HDF5_DEVELOPER_DEFS H5_STRICT_FORMAT_CHECKS) diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index 5cf5088..fd09c51 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -17,6 +17,12 @@ enable_language (Fortran) set (HDF_PREFIX "H5") + +# Force lowercase Fortran module file names +if (CMAKE_Fortran_COMPILER_ID STREQUAL "Cray") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ef") +endif () + include (CheckFortranFunctionExists) if (NOT CMAKE_VERSION VERSION_LESS "3.14.0") diff --git a/config/cmake/HDFCXXCompilerFlags.cmake b/config/cmake/HDFCXXCompilerFlags.cmake index e656146..bd730a9 100644 --- a/config/cmake/HDFCXXCompilerFlags.cmake +++ b/config/cmake/HDFCXXCompilerFlags.cmake @@ -53,7 +53,7 @@ endif () if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS}") - if (${HDF_CFG_NAME} MATCHES "Debug") + if (${HDF_CFG_NAME} MATCHES "Debug" OR ${HDF_CFG_NAME} MATCHES "Developer") if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og -ftrapv -fno-common") endif () diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index 1560bbd..3320ca8 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -51,7 +51,7 @@ endif() if (CMAKE_COMPILER_IS_GNUCC) set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS}") - if (${HDF_CFG_NAME} MATCHES "Debug") + if (${HDF_CFG_NAME} MATCHES "Debug" OR ${HDF_CFG_NAME} MATCHES "Developer") if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Og -ftrapv -fno-common") endif () @@ -176,6 +176,10 @@ endif () # Developer warnings (suggestions from gcc, not code problems) #----------------------------------------------------------------------------- option (HDF5_ENABLE_DEV_WARNINGS "Enable HDF5 developer group warnings" OFF) +if (${HDF_CFG_NAME} MATCHES "Developer") + # Developer build modes should always have these types of warnings enabled + set (HDF5_ENABLE_DEV_WARNINGS ON CACHE BOOL "Enable HDF5 developer group warnings" FORCE) +endif () if (HDF5_ENABLE_DEV_WARNINGS) message (STATUS "....HDF5 developer group warnings are enabled") if (CMAKE_C_COMPILER_ID STREQUAL "Intel") @@ -189,6 +193,19 @@ if (HDF5_ENABLE_DEV_WARNINGS) elseif (CMAKE_C_COMPILER_ID MATCHES "IntelLLVM" OR CMAKE_C_COMPILER_ID MATCHES "[Cc]lang") ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/developer-general") endif () + + # Turn on -Winline warnings now only for non-Debug and + # non-Developer builds. For at least GNU compilers this + # flag appears to conflict specifically with the -Og + # optimization flag and will produce warnings about functions + # not being considered for inlining + if (NOT ${HDF_CFG_NAME} MATCHES "Debug" AND NOT ${HDF_CFG_NAME} MATCHES "Developer") + if (CMAKE_C_COMPILER_ID STREQUAL "GNU") + list (APPEND H5_CFLAGS "-Winline") + elseif (CMAKE_C_COMPILER_ID STREQUAL "Intel" AND NOT _INTEL_WINDOWS) + list (APPEND H5_CFLAGS "-Winline") + endif () + endif () else () if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-general") @@ -270,6 +287,38 @@ if (CMAKE_C_COMPILER_ID STREQUAL "GNU") # ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-10") endif () endif () + + # Append more extra warning flags that only gcc 12.x+ knows about + # or which should only be enabled for gcc 12.x+ + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.0) + if (HDF5_ENABLE_DEV_WARNINGS) + ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-12") + #else () + # ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-12") + endif () + endif () +endif () + +#----------------------------------------------------------------------------- +# Option to allow the user to enable debug output +# from various HDF5 modules +#----------------------------------------------------------------------------- +option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) +if (HDF5_ENABLE_DEBUG_APIS) + # Add standard debug definitions to any existing ones + list (APPEND HDF5_DEBUG_APIS + H5AC_DEBUG + H5CX_DEBUG + H5D_DEBUG + H5D_CHUNK_DEBUG + H5F_DEBUG + H5HL_DEBUG + H5I_DEBUG + H5O_DEBUG + H5S_DEBUG + H5T_DEBUG + H5Z_DEBUG + ) endif () #----------------------------------------------------------------------------- diff --git a/config/cmake/HDFFortranCompilerFlags.cmake b/config/cmake/HDFFortranCompilerFlags.cmake index 84b3ebe..65a1cdc 100644 --- a/config/cmake/HDFFortranCompilerFlags.cmake +++ b/config/cmake/HDFFortranCompilerFlags.cmake @@ -54,17 +54,18 @@ if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_Fortran_COMPILER_VERS endif () endif () -#----------------------------------------------------------------------------- -# CDash is configured to only allow 3000 warnings, so -# break into groups (from the config/gnu-flags file) -#----------------------------------------------------------------------------- if (NOT MSVC AND NOT MINGW) # General flags if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel") ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/ifort-general") - list (APPEND HDF5_CMAKE_Fortran_FLAGS "-stand f03" "-free") + list (APPEND HDF5_CMAKE_Fortran_FLAGS "-free") elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-general") + if (HDF5_ENABLE_DEV_WARNINGS) + ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-developer-general") + else () + ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-no-developer-general") + endif () list (APPEND HDF5_CMAKE_Fortran_FLAGS "-ffree-form" "-fimplicit-none") if (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 8.0 AND NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 4.6) list (APPEND HDF5_CMAKE_Fortran_FLAGS "-std=f2008ts") @@ -82,6 +83,11 @@ if (NOT MSVC AND NOT MINGW) # Append more extra warning flags that only gcc 4.8+ knows about if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 4.8) ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-4.8") + if (HDF5_ENABLE_DEV_WARNINGS) + ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-developer-4.8") + else () + ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-no-developer-4.8") + endif () endif () # Append more extra warning flags that only gcc 4.9+ knows about @@ -92,7 +98,7 @@ if (NOT MSVC AND NOT MINGW) # Append more extra warning flags that only gcc 5.x+ knows about if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 5.0) if (HDF5_ENABLE_DEV_WARNINGS) - ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-gfort-5") + ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/gfort-developer-5") endif () endif () diff --git a/config/cmake/HDFMacros.cmake b/config/cmake/HDFMacros.cmake index 6037570..42b6a22 100644 --- a/config/cmake/HDFMacros.cmake +++ b/config/cmake/HDFMacros.cmake @@ -77,7 +77,7 @@ macro (INSTALL_TARGET_PDB libtarget targetdestination targetcomponent) if (${target_type} MATCHES "SHARED") set (targetfilename $<TARGET_PDB_FILE:${libtarget}>) else () - get_property (target_name TARGET ${libtarget} PROPERTY "$<IF:$<CONFIG:Debug>,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>") + get_property (target_name TARGET ${libtarget} PROPERTY "$<IF:$<OR:$<CONFIG:Debug>,$<CONFIG:Developer>>,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>") set (targetfilename $<TARGET_FILE_DIR:${libtarget}>/${target_name}.pdb) endif () install ( @@ -121,6 +121,7 @@ macro (HDF_SET_LIB_OPTIONS libtarget libname libtype) set_target_properties (${libtarget} PROPERTIES OUTPUT_NAME ${LIB_RELEASE_NAME} # OUTPUT_NAME_DEBUG ${LIB_DEBUG_NAME} + OUTPUT_NAME_DEVELOPER ${LIB_DEBUG_NAME} OUTPUT_NAME_RELEASE ${LIB_RELEASE_NAME} OUTPUT_NAME_MINSIZEREL ${LIB_RELEASE_NAME} OUTPUT_NAME_RELWITHDEBINFO ${LIB_RELEASE_NAME} @@ -130,6 +131,7 @@ macro (HDF_SET_LIB_OPTIONS libtarget libname libtype) if (WIN32) set_target_properties (${libtarget} PROPERTIES COMPILE_PDB_NAME_DEBUG ${LIB_DEBUG_NAME} + COMPILE_PDB_NAME_DEVELOPER ${LIB_DEBUG_NAME} COMPILE_PDB_NAME_RELEASE ${LIB_RELEASE_NAME} COMPILE_PDB_NAME_MINSIZEREL ${LIB_RELEASE_NAME} COMPILE_PDB_NAME_RELWITHDEBINFO ${LIB_RELEASE_NAME} @@ -155,7 +157,7 @@ macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion) if (${importtype} MATCHES "IMPORT") set (importprefix "${CMAKE_STATIC_LIBRARY_PREFIX}") endif () - if (${HDF_CFG_NAME} MATCHES "Debug") + if (${HDF_CFG_NAME} MATCHES "Debug" OR ${HDF_CFG_NAME} MATCHES "Developer") set (IMPORT_LIB_NAME ${LIB_DEBUG_NAME}) else () set (IMPORT_LIB_NAME ${LIB_RELEASE_NAME}) diff --git a/config/cmake/ZLIB/zlib-config.cmake.in b/config/cmake/ZLIB/zlib-config.cmake.in index 307896b..9e6ef48 100644 --- a/config/cmake/ZLIB/zlib-config.cmake.in +++ b/config/cmake/ZLIB/zlib-config.cmake.in @@ -30,7 +30,7 @@ set (${ZLIB_PACKAGE_NAME}_VERSION_MINOR @ZLIB_VERSION_MINOR@) #----------------------------------------------------------------------------- # Don't include targets if this file is being picked up by another -# project which has already build ZLIB as a subproject +# project which has already built ZLIB as a subproject #----------------------------------------------------------------------------- if (NOT TARGET "@ZLIB_PACKAGE@") include (@PACKAGE_SHARE_INSTALL_DIR@/@ZLIB_PACKAGE@@ZLIB_PACKAGE_EXT@-targets.cmake) diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake index 3cae5ab..4713578 100644 --- a/config/cmake/cacheinit.cmake +++ b/config/cmake/cacheinit.cmake @@ -32,6 +32,10 @@ set_property (CACHE HDF5_INSTALL_MOD_FORTRAN PROPERTY STRINGS NO SHARED STATIC) set (HDF5_BUILD_GENERATORS ON CACHE BOOL "Build Test Generators" FORCE) +set (HDF5_ENABLE_SZIP_SUPPORT ON CACHE BOOL "Use SZip Filter" FORCE) + +set (HDF5_ENABLE_SZIP_ENCODING ON CACHE BOOL "Use SZip Encoding" FORCE) + set (MPIEXEC_MAX_NUMPROCS "4" CACHE STRING "Minimum number of processes for HDF parallel tests" FORCE) set (HDF5_ENABLE_ALL_WARNINGS ON CACHE BOOL "Enable all warnings" FORCE) @@ -69,6 +73,9 @@ set (LIBAEC_USE_LOCALCONTENT ON CACHE BOOL "Use local file for LIBAEC FetchConte set (PLUGIN_TGZ_NAME "hdf5_plugins.tar.gz" CACHE STRING "Use PLUGINS from compressed file" FORCE) set (PLUGIN_PACKAGE_NAME "pl" CACHE STRING "Name of PLUGIN package" FORCE) +set (H5PL_VERS_MAJOR "1" CACHE STRING "Major version of hdf5 package for PLUGIN package" FORCE) +set (H5PL_VERS_MINOR "12" CACHE STRING "Minor version of hdf5 package for PLUGIN package" FORCE) +set (H5PL_VERS_RELEASE "3" CACHE STRING "Release version of hdf5 package for PLUGIN package" FORCE) ############# # bitshuffle diff --git a/config/cmake/CTestScript.cmake b/config/cmake/examples/CTestScript.cmake index dcf2685..76bce56 100644 --- a/config/cmake/CTestScript.cmake +++ b/config/cmake/examples/CTestScript.cmake @@ -35,23 +35,30 @@ if (NOT SITE_OS_NAME) message (STATUS "Dashboard script uname output: ${osname}-${osrel}-${cpu}\n") set (CTEST_BUILD_NAME "${osname}-${osrel}-${cpu}") - if (SITE_BUILDNAME_SUFFIX) - set (CTEST_BUILD_NAME "${SITE_BUILDNAME_SUFFIX}-${CTEST_BUILD_NAME}") - endif () - set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS}") else () ## machine name provided ## -------------------------- if (CMAKE_HOST_UNIX) - set(CTEST_BUILD_NAME "${SITE_OS_NAME}-${SITE_OS_VERSION}-${SITE_OS_BITS}-${SITE_COMPILER_NAME}-${SITE_COMPILER_VERSION}") + set (CTEST_BUILD_NAME "${SITE_OS_NAME}-${SITE_OS_VERSION}-${SITE_OS_BITS}-${SITE_COMPILER_NAME}-${SITE_COMPILER_VERSION}") else () - set(CTEST_BUILD_NAME "${SITE_OS_NAME}-${SITE_OS_VERSION}-${SITE_COMPILER_NAME}") - endif () - if (SITE_BUILDNAME_SUFFIX) - set(CTEST_BUILD_NAME "${CTEST_BUILD_NAME}-${SITE_BUILDNAME_SUFFIX}") + set (CTEST_BUILD_NAME "${SITE_OS_NAME}-${SITE_OS_VERSION}-${SITE_COMPILER_NAME}") endif () - set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}") endif () +if (SITE_BUILDNAME_SUFFIX) + set (CTEST_BUILD_NAME "${SITE_BUILDNAME_SUFFIX}-${CTEST_BUILD_NAME}") +endif () +set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}") + +# Launchers work only with Makefile and Ninja generators. +if(NOT "${CTEST_CMAKE_GENERATOR}" MATCHES "Make|Ninja" OR LOCAL_SKIP_TEST) + set(CTEST_USE_LAUNCHERS 0) + set(ENV{CTEST_USE_LAUNCHERS_DEFAULT} 0) + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=OFF") +else() + set(CTEST_USE_LAUNCHERS 1) + set(ENV{CTEST_USE_LAUNCHERS_DEFAULT} 1) + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON") +endif() #----------------------------------------------------------------------------- # MacOS machines need special options diff --git a/config/cmake/HDF5_Examples.cmake.in b/config/cmake/examples/HDF5_Examples.cmake.in index 9f3db03..da2502c 100644 --- a/config/cmake/HDF5_Examples.cmake.in +++ b/config/cmake/examples/HDF5_Examples.cmake.in @@ -87,7 +87,7 @@ if(WIN32) set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}\\build) set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}") set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}") -else(APPLE) +elseif(APPLE) set(ENV{DYLD_LIBRARY_PATH} "${INSTALLDIR}/lib") set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}/build) set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}") diff --git a/config/cmake/HDF5_Examples_options.cmake b/config/cmake/examples/HDF5_Examples_options.cmake index cdd49eb..cdd49eb 100644 --- a/config/cmake/HDF5_Examples_options.cmake +++ b/config/cmake/examples/HDF5_Examples_options.cmake diff --git a/config/cmake/grepTest.cmake b/config/cmake/grepTest.cmake index c4a6eb7..9dcedb5 100644 --- a/config/cmake/grepTest.cmake +++ b/config/cmake/grepTest.cmake @@ -192,6 +192,22 @@ if (TEST_FILTER) endif () endif () +if (NOT DEFINED ENV{HDF5_NOCLEANUP}) + if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") + file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}) + endif () + + if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err") + file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err) + endif () + + if (TEST_DELETE_LIST) + foreach (dfile in ${TEST_DELETE_LIST}) + file (REMOVE ${dfile}) + endforeach () + endif () +endif () + # everything went fine... message (STATUS "Passed: The output of ${TEST_PROGRAM} matched") diff --git a/config/cmake/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.in index 1a3fb7b..699db89 100644 --- a/config/cmake/hdf5-config.cmake.in +++ b/config/cmake/hdf5-config.cmake.in @@ -38,7 +38,7 @@ set (${HDF5_PACKAGE_NAME}_BUILD_CPP_LIB @HDF5_BUILD_CPP_LIB@) set (${HDF5_PACKAGE_NAME}_BUILD_JAVA @HDF5_BUILD_JAVA@) set (${HDF5_PACKAGE_NAME}_BUILD_TOOLS @HDF5_BUILD_TOOLS@) set (${HDF5_PACKAGE_NAME}_BUILD_HL_LIB @HDF5_BUILD_HL_LIB@) -set (${HDF5_PACKAGE_NAME}_BUILD_HL_TOOLS @HDF5_BUILD_HL_TOOLS@) +set (${HDF5_PACKAGE_NAME}_BUILD_HL_GIF_TOOLS @HDF5_BUILD_HL_GIF_TOOLS@) set (${HDF5_PACKAGE_NAME}_ENABLE_THREADSAFE @HDF5_ENABLE_THREADSAFE@) set (${HDF5_PACKAGE_NAME}_ENABLE_PLUGIN_SUPPORT @HDF5_ENABLE_PLUGIN_SUPPORT@) set (${HDF5_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT @HDF5_ENABLE_Z_LIB_SUPPORT@) @@ -70,8 +70,8 @@ endif () if (${HDF5_PACKAGE_NAME}_BUILD_JAVA) set (${HDF5_PACKAGE_NAME}_JAVA_INCLUDE_DIRS @PACKAGE_CURRENT_BUILD_DIR@/lib/jarhdf5-@HDF5_VERSION_STRING@.jar - @PACKAGE_CURRENT_BUILD_DIR@/lib/slf4j-api-1.7.33.jar - @PACKAGE_CURRENT_BUILD_DIR@/lib/slf4j-nop-1.7.33.jar + @PACKAGE_CURRENT_BUILD_DIR@/lib/slf4j-api-2.0.6.jar + @PACKAGE_CURRENT_BUILD_DIR@/lib/slf4j-nop-2.0.6.jar ) set (${HDF5_PACKAGE_NAME}_JAVA_LIBRARY "@PACKAGE_CURRENT_BUILD_DIR@/lib") set (${HDF5_PACKAGE_NAME}_JAVA_LIBRARIES "${${HDF5_PACKAGE_NAME}_JAVA_LIBRARY}") diff --git a/config/cmake/jrunTest.cmake b/config/cmake/jrunTest.cmake index f6fa3b3..294b05f 100644 --- a/config/cmake/jrunTest.cmake +++ b/config/cmake/jrunTest.cmake @@ -300,6 +300,22 @@ if (TEST_SKIP_COMPARE AND NOT TEST_NO_DISPLAY) endif () endif () +if (NOT DEFINED ENV{HDF5_NOCLEANUP}) + if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") + file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}) + endif () + + if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err") + file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err) + endif () + + if (TEST_DELETE_LIST) + foreach (dfile in ${TEST_DELETE_LIST}) + file (REMOVE ${dfile}) + endforeach () + endif () +endif () + # everything went fine... message (STATUS "${TEST_PROGRAM} Passed") diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in index 0e2c013..46aadb7 100644 --- a/config/cmake/libhdf5.settings.cmake.in +++ b/config/cmake/libhdf5.settings.cmake.in @@ -28,6 +28,7 @@ Linking Options: AM_LDFLAGS: @AM_LDFLAGS@ Extra libraries: @LINK_LIBS@ Archiver: @CMAKE_AR@ + AR_FLAGS: Ranlib: @CMAKE_RANLIB@ Languages: @@ -44,23 +45,24 @@ Languages: Static C Library: @H5_ENABLE_STATIC_LIB@ Fortran: @HDF5_BUILD_FORTRAN@ -@BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Compiler: @CMAKE_Fortran_COMPILER@ @CMAKE_Fortran_COMPILER_VERSION@ -@BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Flags: @CMAKE_Fortran_FLAGS@ -@BUILD_FORTRAN_CONDITIONAL_TRUE@ H5 Fortran Flags: @HDF5_CMAKE_Fortran_FLAGS@ -@BUILD_FORTRAN_CONDITIONAL_TRUE@ AM Fortran Flags: @AM_FCFLAGS@ -@BUILD_FORTRAN_CONDITIONAL_TRUE@ Shared Fortran Library: @H5_ENABLE_SHARED_LIB@ -@BUILD_FORTRAN_CONDITIONAL_TRUE@ Static Fortran Library: @H5_ENABLE_STATIC_LIB@ + Fortran Compiler: @CMAKE_Fortran_COMPILER@ @CMAKE_Fortran_COMPILER_VERSION@ + Fortran Flags: @CMAKE_Fortran_FLAGS@ + H5 Fortran Flags: @HDF5_CMAKE_Fortran_FLAGS@ + AM Fortran Flags: @AM_FCFLAGS@ + Shared Fortran Library: @H5_ENABLE_SHARED_LIB@ + Static Fortran Library: @H5_ENABLE_STATIC_LIB@ + Module Directory: @CMAKE_Fortran_MODULE_DIRECTORY@ C++: @HDF5_BUILD_CPP_LIB@ -@BUILD_CXX_CONDITIONAL_TRUE@ C++ Compiler: @CMAKE_CXX_COMPILER@ @CMAKE_CXX_COMPILER_VERSION@ -@BUILD_CXX_CONDITIONAL_TRUE@ C++ Flags: @CMAKE_CXX_FLAGS@ -@BUILD_CXX_CONDITIONAL_TRUE@ H5 C++ Flags: @HDF5_CMAKE_CXX_FLAGS@ -@BUILD_CXX_CONDITIONAL_TRUE@ AM C++ Flags: @AM_CXXFLAGS@ -@BUILD_CXX_CONDITIONAL_TRUE@ Shared C++ Library: @H5_ENABLE_SHARED_LIB@ -@BUILD_CXX_CONDITIONAL_TRUE@ Static C++ Library: @H5_ENABLE_STATIC_LIB@ + C++ Compiler: @CMAKE_CXX_COMPILER@ @CMAKE_CXX_COMPILER_VERSION@ + C++ Flags: @CMAKE_CXX_FLAGS@ + H5 C++ Flags: @HDF5_CMAKE_CXX_FLAGS@ + AM C++ Flags: @AM_CXXFLAGS@ + Shared C++ Library: @H5_ENABLE_SHARED_LIB@ + Static C++ Library: @H5_ENABLE_STATIC_LIB@ - JAVA: @HDF5_BUILD_JAVA@ -@BUILD_JAVA_CONDITIONAL_TRUE@ JAVA Compiler: @CMAKE_Java_COMPILER@ @Java_VERSION@ + JAVA: @HDF5_BUILD_JAVA@ + JAVA Compiler: @CMAKE_Java_COMPILER@ @Java_VERSION@ Features: --------- @@ -71,7 +73,7 @@ Features: Dimension scales w/ new references: @DIMENSION_SCALES_WITH_NEW_REF@ Build HDF5 Tests: @BUILD_TESTING@ Build HDF5 Tools: @HDF5_BUILD_TOOLS@ - Build High-level HDF5 Tools: @HDF5_BUILD_HL_TOOLS@ + Build GIF Tools: @HDF5_BUILD_HL_GIF_TOOLS@ Threadsafety: @HDF5_ENABLE_THREADSAFE@ Default API mapping: @DEFAULT_API_VERSION@ With deprecated public symbols: @HDF5_ENABLE_DEPRECATED_SYMBOLS@ diff --git a/config/cmake/mccacheinit.cmake b/config/cmake/mccacheinit.cmake index dd0c9ec..ef1ac4a 100644 --- a/config/cmake/mccacheinit.cmake +++ b/config/cmake/mccacheinit.cmake @@ -11,9 +11,9 @@ # # This is the CMakeCache file. -######################## +######################### # EXTERNAL cache entries -######################## +######################### set (CMAKE_INSTALL_FRAMEWORK_PREFIX "Library/Frameworks" CACHE STRING "Frameworks installation directory" FORCE) @@ -25,14 +25,14 @@ set (HDF_PACKAGE_NAMESPACE "hdf5::" CACHE STRING "Name for HDF package namespace set (HDF5_BUILD_CPP_LIB ON CACHE BOOL "Build HDF5 C++ Library" FORCE) -set (HDF5_BUILD_EXAMPLES ON CACHE BOOL "Build HDF5 Library Examples" FORCE) - set (HDF5_BUILD_FORTRAN ON CACHE BOOL "Build FORTRAN support" FORCE) set (HDF5_BUILD_HL_LIB ON CACHE BOOL "Build HIGH Level HDF5 Library" FORCE) set (HDF5_BUILD_TOOLS ON CACHE BOOL "Build HDF5 Tools" FORCE) +set (HDF5_BUILD_EXAMPLES ON CACHE BOOL "Build HDF5 Library Examples" FORCE) + set (HDF5_ENABLE_Z_LIB_SUPPORT ON CACHE BOOL "Enable Zlib Filters" FORCE) set (HDF5_ENABLE_SZIP_SUPPORT ON CACHE BOOL "Use SZip Filter" FORCE) @@ -45,11 +45,18 @@ set (HDF5_ENABLE_USING_MEMCHECKER ON CACHE BOOL "Indicate that a memory checker set (HDF5_NO_PACKAGES ON CACHE BOOL "CPACK - Disable packaging" FORCE) -set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO GIT TGZ)" FORCE) +set (HDF_TEST_EXPRESS "2" CACHE STRING "Control testing framework (0-3)" FORCE) + +set (HDF5_MINGW_STATIC_GCC_LIBS ON CACHE BOOL "Statically link libgcc/libstdc++" FORCE) + +set (HDF5_ALLOW_EXTERNAL_SUPPORT "TGZ" CACHE STRING "Allow External Library Building (NO GIT TGZ)" FORCE) set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO GIT TGZ) +set (ZLIB_PACKAGE_NAME "zlib" CACHE STRING "Name of ZLIB package" FORCE) set (ZLIB_TGZ_NAME "ZLib.tar.gz" CACHE STRING "Use ZLib from compressed file" FORCE) +set (LIBAEC_PACKAGE_NAME "libaec" CACHE STRING "Name of AEC SZIP package" FORCE) +set (SZIP_PACKAGE_NAME "szip" CACHE STRING "Name of SZIP package" FORCE) set (SZIP_TGZ_NAME "SZip.tar.gz" CACHE STRING "Use SZip from compressed file" FORCE) set (SZAEC_TGZ_NAME "LIBAEC.tar.gz" CACHE STRING "Use SZip AEC from compressed file" FORCE) set (USE_LIBAEC ON CACHE BOOL "Use libaec szip replacement" FORCE) @@ -57,7 +64,3 @@ set (USE_LIBAEC ON CACHE BOOL "Use libaec szip replacement" FORCE) set (CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build Debug" FORCE) set (CTEST_CONFIGURATION_TYPE "Debug" CACHE STRING "Build Debug" FORCE) - -set (ZLIB_PACKAGE_NAME "zlib" CACHE STRING "Name of ZLIB package" FORCE) -set (LIBAEC_PACKAGE_NAME "libaec" CACHE STRING "Name of AEC SZIP package" FORCE) -set (SZIP_PACKAGE_NAME "szip" CACHE STRING "Name of SZIP package" FORCE) diff --git a/config/cmake/runTest.cmake b/config/cmake/runTest.cmake index d1c454f..e26b8ea 100644 --- a/config/cmake/runTest.cmake +++ b/config/cmake/runTest.cmake @@ -378,6 +378,22 @@ if (TEST_SKIP_COMPARE AND NOT TEST_NO_DISPLAY) ) endif () +if (NOT DEFINED ENV{HDF5_NOCLEANUP}) + if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}" AND NOT TEST_SAVE) + file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}) + endif () + + if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err") + file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err) + endif () + + if (TEST_DELETE_LIST) + foreach (dfile in ${TEST_DELETE_LIST}) + file (REMOVE ${dfile}) + endforeach () + endif () +endif () + # everything went fine... message (STATUS "${TEST_PROGRAM} Passed") diff --git a/config/cmake/scripts/HDF5options.cmake b/config/cmake/scripts/HDF5options.cmake index 92bfd37..5267212 100644 --- a/config/cmake/scripts/HDF5options.cmake +++ b/config/cmake/scripts/HDF5options.cmake @@ -69,9 +69,9 @@ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRIN ### disable using ext zlib #set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF") -### disable using ext szip -#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF") -#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF") +### enable using ext szip +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=ON") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=ON") #### package examples #### #set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACK_EXAMPLES:BOOL=ON -DHDF5_EXAMPLES_COMPRESSED:STRING=HDF5Examples-2.0.3-Source.tar.gz -DHDF5_EXAMPLES_COMPRESSED_DIR:PATH=${CTEST_SCRIPT_DIRECTORY}") diff --git a/config/cmake/vfdTest.cmake b/config/cmake/vfdTest.cmake index f5a4e3e..fadc67f 100644 --- a/config/cmake/vfdTest.cmake +++ b/config/cmake/vfdTest.cmake @@ -72,5 +72,21 @@ endif () message (STATUS "COMMAND Error: ${TEST_ERROR}") +if (NOT DEFINED ENV{HDF5_NOCLEANUP}) + if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") + file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}) + endif () + + if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err") + file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err) + endif () + + if (TEST_DELETE_LIST) + foreach (dfile in ${TEST_DELETE_LIST}) + file (REMOVE ${dfile}) + endforeach () + endif () +endif () + # everything went fine... message (STATUS "Passed: The ${TEST_PROGRAM} program used vfd ${TEST_VFD}") diff --git a/config/cmake/volTest.cmake b/config/cmake/volTest.cmake index 27ef8a2..a47c3e9 100644 --- a/config/cmake/volTest.cmake +++ b/config/cmake/volTest.cmake @@ -72,5 +72,21 @@ endif () message (STATUS "COMMAND Error: ${TEST_ERROR}") +if (NOT DEFINED ENV{HDF5_NOCLEANUP}) + if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") + file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}) + endif () + + if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err") + file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err) + endif () + + if (TEST_DELETE_LIST) + foreach (dfile in ${TEST_DELETE_LIST}) + file (REMOVE ${dfile}) + endforeach () + endif () +endif () + # everything went fine... message (STATUS "Passed: The ${TEST_PROGRAM} program used vol ${TEST_VOL}") diff --git a/config/conclude_fc.am b/config/conclude_fc.am index 77403cb..d26016a 100644 --- a/config/conclude_fc.am +++ b/config/conclude_fc.am @@ -19,12 +19,14 @@ # AM_FCCPPFLAGS, FCCPPFLAGS are currently not used. PPFCCOMPILE = $(FC) $(FCDEFS) $(DEFAULT_INCLUDES) $(FCINCLUDES) $(AM_FCCPPFLAGS) $(FCCPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -LTPPFCCOMPILE = $(LIBTOOL) --tag=FC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(PPFCCOMPILE) +LTPPFCCOMPILE = $(LIBTOOL) --silent --tag=FC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(PPFCCOMPILE) # Treat all .f90 and .F90 files as preprocessed Fortran. .f90.o: + @if $(AM_V_P); then set -x; else echo " PPFC $@"; fi; \ $(PPFCCOMPILE) -c -o $@ $< .F90.o: + @if $(AM_V_P); then set -x; else echo " PPFC $@"; fi; \ $(PPFCCOMPILE) -c -o $@ $< include $(top_srcdir)/config/conclude.am diff --git a/config/gnu-cxxflags b/config/gnu-cxxflags index 5668c56..33a47c8 100644 --- a/config/gnu-cxxflags +++ b/config/gnu-cxxflags @@ -118,7 +118,7 @@ if test "X-g++" = "X-$cxx_vendor"; then esac # C++-specific - H5_CXXFLAGS="$H5_CXXFLAGS $arch" + H5_CXXFLAGS="$H5_CXXFLAGS $arch -std=c++98" ############## # Production # diff --git a/config/gnu-fflags b/config/gnu-fflags index 3096cee..b3385ec 100644 --- a/config/gnu-fflags +++ b/config/gnu-fflags @@ -149,6 +149,9 @@ if test "X-gfortran" = "X-$f9x_vendor"; then H5_FCFLAGS="$H5_FCFLAGS $(load_gnu_arguments gfort-general)" + NO_DEVELOPER_WARNING_FCFLAGS="$NO_DEVELOPER_WARNING_FCFLAGS $(load_gnu_arguments gfort-no-developer-general)" + DEVELOPER_WARNING_FCFLAGS="$DEVELOPER_WARNING_FCFLAGS $(load_gnu_arguments gfort-developer-general)" + ############################# # Version-specific warnings # ############################# @@ -156,13 +159,15 @@ if test "X-gfortran" = "X-$f9x_vendor"; then # gfortran >= 4.8 if test $f9x_vers_major -ge 5 -o $f9x_vers_major -eq 4 -a $f9x_vers_minor -ge 8; then H5_FCFLAGS="$H5_FCFLAGS $(load_gnu_arguments gfort-4.8)" + DEVELOPER_WARNING_FCFLAGS="$DEVELOPER_WARNING_FCFLAGS $(load_gnu_arguments gfort-developer-4.8)" + NO_DEVELOPER_WARNING_FCFLAGS="$NO_DEVELOPER_WARNING_FCFLAGS $(load_gnu_arguments gfort-no-developer-4.8)" fi # gfortran 4.9 (nothing new) # gfortran >= 5 if test $f9x_vers_major -ge 5; then - DEVELOPER_WARNING_FCFLAGS="$DEVELOPER_WARNING_FCFLAGS $(load_gnu_arguments developer-gfort-5)" + DEVELOPER_WARNING_FCFLAGS="$DEVELOPER_WARNING_FCFLAGS $(load_gnu_arguments gfort-developer-5)" fi # gfortran >= 6 diff --git a/config/gnu-warnings/4.8 b/config/gnu-warnings/4.8 index fa678ff..8a19289 100644 --- a/config/gnu-warnings/4.8 +++ b/config/gnu-warnings/4.8 @@ -7,9 +7,6 @@ -Wpacked-bitfield-compat -Wsync-nand -# warning flag added for GCC >= 4.5 --Wstrict-overflow=5 - # This warning can only be truly addressed using the gcc extension of # using D to indicate doubles (e.g., 1.23D). -Wno-unsuffixed-float-constants @@ -19,10 +16,6 @@ -Wtrampolines # warning flag added for GCC >= 4.7 -# -# -Wstack-usage=8192 warnings need to be swept up on a branch so -# that we can stop burdening the whole development team. -# -Wstack-usage=8192 # warning flag added for GCC >= 4.8 diff --git a/config/gnu-warnings/cxx-4.8 b/config/gnu-warnings/cxx-4.8 index 744ebdc..387c41e 100644 --- a/config/gnu-warnings/cxx-4.8 +++ b/config/gnu-warnings/cxx-4.8 @@ -7,18 +7,11 @@ -Wpacked-bitfield-compat -Wsync-nand -# warning flag added for GCC >= 4.5 --Wstrict-overflow=5 - # warning flags added for GCC >= 4.6 -Wdouble-promotion -Wtrampolines # warning flag added for GCC >= 4.7 -# -# -Wstack-usage=8192 warnings need to be swept up on a branch so -# that we can stop burdening the whole development team. -# -Wstack-usage=8192 # warning flag added for GCC >= 4.8 diff --git a/config/gnu-warnings/cxx-developer-4.8 b/config/gnu-warnings/cxx-developer-4.8 index e0d975f..f5fbdad 100644 --- a/config/gnu-warnings/cxx-developer-4.8 +++ b/config/gnu-warnings/cxx-developer-4.8 @@ -1,5 +1,10 @@ -# developer warning flags added for GCC >= 4.5 +# developer warning flag added for GCC >= 4.5 # +# strict-overflow level 5 catches a LOT of false positives, but is useful +# for detecting overflow conditions. +# +-Wstrict-overflow=5 + # developer warning flag added for GCC >= 4.6 -Wsuggest-attribute=const diff --git a/config/gnu-warnings/developer-12 b/config/gnu-warnings/developer-12 new file mode 100644 index 0000000..0835d96 --- /dev/null +++ b/config/gnu-warnings/developer-12 @@ -0,0 +1,4 @@ +# Enable GCC's static analyzer for GCC 12+ +# (Temporarily disabled as the analyzer currently adds significant +# compile time overhead for a few test files like cache.c) +# -fanalyzer diff --git a/config/gnu-warnings/developer-4.8 b/config/gnu-warnings/developer-4.8 index bfd15a1..be7720c 100644 --- a/config/gnu-warnings/developer-4.8 +++ b/config/gnu-warnings/developer-4.8 @@ -6,6 +6,13 @@ # -Wjump-misses-init +# developer warning flag added for GCC >= 4.5 +# +# strict-overflow level 5 catches a LOT of false positives, but is useful +# for detecting overflow conditions. +# +-Wstrict-overflow=5 + # developer warning flag added for GCC >= 4.6 -Wsuggest-attribute=const diff --git a/config/gnu-warnings/developer-general b/config/gnu-warnings/developer-general index 460b874..79ecd6a 100644 --- a/config/gnu-warnings/developer-general +++ b/config/gnu-warnings/developer-general @@ -1,10 +1,17 @@ # (suggestions from gcc, not code problems) -Waggregate-return -Wdisabled-optimization --Winline -Wmissing-format-attribute -Wmissing-noreturn -Wswitch-default -Wswitch-enum -Wunsafe-loop-optimizations -Wunused-macros +# -Winline warnings aren't included here because, for at least +# GNU compilers, this flag appears to conflict specifically with +# the -Og optimization level flag added for Debug and Developer +# builds and will produce warnings about functions not being +# considered for inlining. The flag will be added to the list +# of compiler flags separately if developer warnings are enabled +# and the build type is not Debug or Developer +#-Winline diff --git a/config/gnu-warnings/error-8 b/config/gnu-warnings/error-8 index cbb25f6..36c1414 100644 --- a/config/gnu-warnings/error-8 +++ b/config/gnu-warnings/error-8 @@ -6,17 +6,4 @@ # in order to detect initializations that occur there. It's possible # that GCC 8 only performs that analysis at -O3, though. # -# -# NOTE: File Driver files are not compatible with these warnings as errors -# H5FDlog.c, -# -Werror=maybe-uninitialized --Wmaybe-uninitialized -# NOTE: src/ files are not compatible with these warnings as errors -# src/H5Shyper.c,src/H5SL.c,src/H5Shyper.c -# -Werror=maybe-uninitialized -# NOTE: Test files are not compatible with these warnings as errors -# test/cache_common.c, -# -Werror=maybe-uninitialized -# NOTE: hl/src/ files are not compatible with these warnings as errors -# hl/src/H5DS.c, -# -Werror=maybe-uninitialized +-Werror=maybe-uninitialized diff --git a/config/gnu-warnings/error-general b/config/gnu-warnings/error-general index a66d284..73d1dd5 100644 --- a/config/gnu-warnings/error-general +++ b/config/gnu-warnings/error-general @@ -3,7 +3,10 @@ # circumstances, so ask the compiler to treat them as errors: # -Werror=bad-function-cast +-Werror=cast-align +-Werror=format -Werror=implicit-function-declaration +-Werror=int-to-pointer-cast -Werror=missing-declarations -Werror=missing-prototypes -Werror=nested-externs @@ -11,10 +14,11 @@ -Werror=packed -Werror=pointer-sign -Werror=pointer-to-int-cast --Werror=int-to-pointer-cast -Werror=redundant-decls -Werror=strict-prototypes -Werror=switch +-Werror=unused-but-set-variable +-Werror=unused-variable # #-Werror=discarded-qualifiers # @@ -25,43 +29,11 @@ # -Wunused-function # -# H5FDdrvr_module.h -# -Werror=unused-variable -# --Wunused-variable -# # H5VLpassthru.c # -Werror=unused-parameter # -Wunused-parameter # -# -# -# NOTE: Tools files are not compatible with these warnings as errors -# lib/h5tools.c -# -Werror=cast-align -# --Wcast-align -# -# lib/h5diff_array.c -# -Werror=unused-but-set-variable -# --Wunused-but-set-variable -# -# lib/h5tools_utils.c -# -Werror=unused-parameter -# -# -# NOTE: JNI files are not compatible with these warnings as errors -# jni/h5pDCPLImp.c,jni/nativeData.c,jni/h5util.c,jni/h5rImp.c -# jni/h5sImp.c,jni/h5tImp.c -# -Werror=cast-align -# jni/h5util.c -# -Werror=format(-overflow) -# --Werror=format -# -# #Examples and tests do not use the same set of extensive warning flags as libraries # Here is a list of tests and examples that have issues with the stricter warnings as error # diff --git a/config/gnu-warnings/gfort-4.8 b/config/gnu-warnings/gfort-4.8 index 9d880de..f986072 100644 --- a/config/gnu-warnings/gfort-4.8 +++ b/config/gnu-warnings/gfort-4.8 @@ -1,5 +1,4 @@ # warning flags added for gfortran >= 4.4 --Warray-temporaries -Wintrinsics-std # warning flag added for gfortran >= 4.5 diff --git a/config/gnu-warnings/gfort-developer-4.8 b/config/gnu-warnings/gfort-developer-4.8 new file mode 100644 index 0000000..20effdc --- /dev/null +++ b/config/gnu-warnings/gfort-developer-4.8 @@ -0,0 +1,3 @@ +# warning flags added for gfortran >= 4.4 +-Warray-temporaries + diff --git a/config/gnu-warnings/developer-gfort-5 b/config/gnu-warnings/gfort-developer-5 index c5d3850..c5d3850 100644 --- a/config/gnu-warnings/developer-gfort-5 +++ b/config/gnu-warnings/gfort-developer-5 diff --git a/config/gnu-warnings/gfort-developer-general b/config/gnu-warnings/gfort-developer-general new file mode 100644 index 0000000..dde15fe --- /dev/null +++ b/config/gnu-warnings/gfort-developer-general @@ -0,0 +1,3 @@ +# There is no easy way in Fortran to indicate parameters are intentionally +# unused and many callbacks will have these, generating a lot of noise. +-Wunused-dummy-argument diff --git a/config/gnu-warnings/gfort-no-developer-4.8 b/config/gnu-warnings/gfort-no-developer-4.8 new file mode 100644 index 0000000..82274ef --- /dev/null +++ b/config/gnu-warnings/gfort-no-developer-4.8 @@ -0,0 +1,3 @@ +# warning flags added for gfortran >= 4.4 +-Wno-array-temporaries + diff --git a/config/gnu-warnings/gfort-no-developer-general b/config/gnu-warnings/gfort-no-developer-general new file mode 100644 index 0000000..bfcba22 --- /dev/null +++ b/config/gnu-warnings/gfort-no-developer-general @@ -0,0 +1,3 @@ +# There is no easy way in Fortran to indicate parameters are intentionally +# unused and many callbacks will have these, generating a lot of noise. +-Wno-unused-dummy-argument diff --git a/config/gnu-warnings/no-cxx-developer-4.8 b/config/gnu-warnings/no-cxx-developer-4.8 index 3c3de93..d4d00e3 100644 --- a/config/gnu-warnings/no-cxx-developer-4.8 +++ b/config/gnu-warnings/no-cxx-developer-4.8 @@ -1,3 +1,6 @@ +# no-developer warning flag added for GCC >= 4.5 +-Wstrict-overflow=2 + # no-developer warning flag added for GCC >= 4.6 -Wno-suggest-attribute=const diff --git a/config/gnu-warnings/no-developer-4.8 b/config/gnu-warnings/no-developer-4.8 index 09a9a96..412b907 100644 --- a/config/gnu-warnings/no-developer-4.8 +++ b/config/gnu-warnings/no-developer-4.8 @@ -1,5 +1,6 @@ -# no-developer warning flag added for GCC >= 4.5 +# no-developer warning flags added for GCC >= 4.5 -Wno-jump-misses-init +-Wstrict-overflow=2 # no-developer warning flag added for GCC >= 4.6 -Wno-suggest-attribute=const diff --git a/config/ibm-aix b/config/ibm-aix index fb7e1df..b2f5d05 100644 --- a/config/ibm-aix +++ b/config/ibm-aix @@ -148,8 +148,6 @@ ac_cv_sizeof_char=${ac_cv_sizeof_char=1} ac_cv_sizeof_short=${ac_cv_sizeof_short=2} ac_cv_sizeof_int=${ac_cv_sizeof_int=4} ac_cv_sizeof_long_long=${ac_cv_sizeof_long_long=8} -# Do not cache __int64 since it is not a standard C type and some compilers -# (e.g., gcc) does not support it. ac_cv_sizeof_float=${ac_cv_sizeof_float=4} ac_cv_sizeof_double=${ac_cv_sizeof_double=8} ac_cv_sizeof_long_double=${ac_cv_sizeof_long_double=8} diff --git a/config/intel-cxxflags b/config/intel-cxxflags index 484100f..9d2be69 100644 --- a/config/intel-cxxflags +++ b/config/intel-cxxflags @@ -81,7 +81,7 @@ if test "X-icpc" = "X-$cxx_vendor"; then # General # ########### - H5_CXXFLAGS="$H5_CXXFLAGS $arch" + H5_CXXFLAGS="$H5_CXXFLAGS $arch -std=c++98" ############## # Production # diff --git a/config/intel-fflags b/config/intel-fflags index 843d21e..ad1ce7c 100644 --- a/config/intel-fflags +++ b/config/intel-fflags @@ -122,7 +122,7 @@ if test "X-ifort" = "X-$f9x_vendor"; then # General # ########### - H5_FCFLAGS="$H5_FCFLAGS -stand:f03 -free" + H5_FCFLAGS="$H5_FCFLAGS -free" H5_FCFLAGS="$H5_FCFLAGS $(load_intel_arguments ifort-general)" ############################# diff --git a/config/intel-warnings/developer-general b/config/intel-warnings/developer-general index fae56f0..861218e 100644 --- a/config/intel-warnings/developer-general +++ b/config/intel-warnings/developer-general @@ -1,4 +1,11 @@ --Winline -Wreorder -Wport -Wstrict-aliasing +# -Winline warnings aren't included here because, for at least +# GNU compilers, this flag appears to conflict specifically with +# the -Og optimization level flag added for Debug and Developer +# builds and will produce warnings about functions not being +# considered for inlining. The flag will be added to the list +# of compiler flags separately if developer warnings are enabled +# and the build type is not Debug or Developer +#-Winline diff --git a/config/pgi-cxxflags b/config/pgi-cxxflags index 5fc74ae..84654cb 100644 --- a/config/pgi-cxxflags +++ b/config/pgi-cxxflags @@ -48,7 +48,7 @@ if test "X-pgc++" = "X-$cxx_vendor"; then # General # ########### - H5_CXXFLAGS="$H5_CXXFLAGS -Minform=warn" + H5_CXXFLAGS="$H5_CXXFLAGS -std=c++98 -Minform=warn" ############## # Production # diff --git a/config/sanitizer/README.md b/config/sanitizer/README.md index 0d5fb6c..308f9c3 100644 --- a/config/sanitizer/README.md +++ b/config/sanitizer/README.md @@ -53,7 +53,7 @@ These obviously force the standard to be required, and also disables compiler-sp ## Sanitizer Builds [`sanitizers.cmake`](sanitizers.cmake) -Sanitizers are tools that perform checks during a program’s runtime and returns issues, and as such, along with unit testing, code coverage and static analysis, is another tool to add to the programmers toolbox. And of course, like the previous tools, are tragically simple to add into any project using CMake, allowing any project and developer to quickly and easily use. +Sanitizers are tools that perform checks during a program's runtime and return issues, and as such, along with unit testing, code coverage and static analysis, are another tool to add to the programmer's toolbox. And, of course, like the previous tools, they are simple to add to any project using CMake, allowing any project and developer to quickly and easily use them. A quick rundown of the tools available, and what they do: - [LeakSanitizer](https://clang.llvm.org/docs/LeakSanitizer.html) detects memory leaks, or issues where memory is allocated and never deallocated, causing programs to slowly consume more and more memory, eventually leading to a crash. diff --git a/configure.ac b/configure.ac index 403a82b..0fad0ae 100644 --- a/configure.ac +++ b/configure.ac @@ -81,14 +81,21 @@ AM_MAINTAINER_MODE([enable]) ## This allows multiple src-dir builds within one host. AC_PREFIX_DEFAULT([`pwd`/hdf5]) -## Run post processing on files created by configure. +## Run post processing on files created by configure +## ## src/H5pubconf.h: ## Generate src/H5pubconf.h from src/H5config.h by prepending H5_ to all ## macro names. This avoid name conflict between HDF5 macro names and those ## generated by another software package that uses the HDF5 library. +## ## src/libhdf5.settings: -## Remove all lines begun with "#" which are generated by CONDITIONAL's of -## configure. +## Remove all lines beginning with "#" which are generated by CONDITIONAL's +## of configure. +## +## src/H5build_settings.c +## Remove all lines beginning with "#" which are generated by CONDITIONAL's +## of configure. This uses a check for whitespace after the pound sign +## to avoid clobbering include statements. AC_CONFIG_COMMANDS([pubconf], [ echo "creating src/H5pubconf.h" sed 's/#define /#define H5_/' <src/H5config.h |\ @@ -182,6 +189,14 @@ saved_user_JAVAFLAGS="$JAVAFLAGS" saved_user_LDFLAGS="$LDFLAGS" saved_user_CPPFLAGS="$CPPFLAGS" +## Strip out -Werror from CFLAGS since that can cause checks to fail when +## compiling the test program fails due to warnings +CFLAGS="`echo $CFLAGS | sed -e 's/-Werror//g'`" +CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Werror//g'`" +FCFLAGS="`echo $FCFLAGS | sed -e 's/-Werror//g'`" +JAVACFLAGS="`echo $JAVACFLAGS | sed -e 's/-Werror//g'`" +CPPFLAGS="`echo $CPPFLAGS | sed -e 's/-Werror//g'`" + ## Support F9X variable to define Fortran compiler if FC variable is ## not used. This should be deprecated in the future. if test "x" = "x$FC"; then @@ -535,30 +550,6 @@ AC_CHECK_SIZEOF([double]) AC_CHECK_SIZEOF([long double]) ## ---------------------------------------------------------------------- -## Check for non-standard extension __FLOAT128 -## -HAVE_FLOAT128=0 -HAVE_QUADMATH=0 -FLT128_DIG=0 -LDBL_DIG=0 - -AC_CHECK_SIZEOF([__float128]) -AC_CHECK_SIZEOF([_Quad]) -AC_CHECK_HEADERS([quadmath.h], [HAVE_QUADMATH=1], []) -PAC_FC_LDBL_DIG - -AC_SUBST([PAC_C_MAX_REAL_PRECISION]) - -if test "$ac_cv_sizeof___float128" != 0 && test "$FLT128_DIG" != 0 ; then - AC_DEFINE([HAVE_FLOAT128], [1], [Determine if __float128 is available]) - PAC_C_MAX_REAL_PRECISION=$FLT128_DIG -else - PAC_C_MAX_REAL_PRECISION=$LDBL_DIG -fi -AC_DEFINE_UNQUOTED([PAC_C_MAX_REAL_PRECISION], $PAC_C_MAX_REAL_PRECISION, [Determine the maximum decimal precision in C]) -AC_MSG_RESULT([$PAC_C_MAX_REAL_PRECISION]) - -## ---------------------------------------------------------------------- ## Check if the Fortran interface should be enabled ## @@ -579,6 +570,30 @@ AC_MSG_RESULT([$HDF_FORTRAN]) if test "X$HDF_FORTRAN" = "Xyes"; then +## ---------------------------------------------------------------------- +## Check for non-standard extension __FLOAT128 +## + HAVE_FLOAT128=0 + HAVE_QUADMATH=0 + FLT128_DIG=0 + LDBL_DIG=0 + + AC_CHECK_SIZEOF([__float128]) + AC_CHECK_SIZEOF([_Quad]) + AC_CHECK_HEADERS([quadmath.h], [HAVE_QUADMATH=1], []) + PAC_FC_LDBL_DIG + + AC_SUBST([PAC_C_MAX_REAL_PRECISION]) + + if test "$ac_cv_sizeof___float128" != 0 && test "$FLT128_DIG" != 0 ; then + AC_DEFINE([HAVE_FLOAT128], [1], [Determine if __float128 is available]) + PAC_C_MAX_REAL_PRECISION=$FLT128_DIG + else + PAC_C_MAX_REAL_PRECISION=$LDBL_DIG + fi + AC_DEFINE_UNQUOTED([PAC_C_MAX_REAL_PRECISION], $PAC_C_MAX_REAL_PRECISION, [Determine the maximum decimal precision in C]) + AC_MSG_RESULT([$PAC_C_MAX_REAL_PRECISION]) + ## We will output an include file for Fortran, H5config_f.inc which ## contains various configure definitions used by the Fortran Library. ## Prepend H5_ to all macro names. This avoids name conflict between HDF5 macro @@ -832,6 +847,7 @@ AC_LANG_POP(C++) ## library is disabled. AC_SUBST([HDF5_HL]) AC_SUBST([HDF5_HL_TOOLS]) +AC_SUBST([HDF5_HL_GIF_TOOLS]) ## The high-level library and high-level tools are enabled unless the build mode ## is clean. @@ -872,22 +888,6 @@ else AC_MSG_RESULT([no]) fi -AC_MSG_CHECKING([if the high-level tools are enabled]) -AC_ARG_ENABLE([hltools], - [AS_HELP_STRING([--enable-hltools], - [Enable the high-level tools. - [default=yes] - ])], - [HDF5_HL_TOOLS=$enableval]) - -if test "X${HDF5_HL}" = "Xyes" -a "X-$HDF5_HL_TOOLS" = "X-yes"; then - AC_MSG_RESULT([yes]) - HL_TOOLS="tools" -else - AC_MSG_RESULT([no]) -fi - - ## ---------------------------------------------------------------------- ## Enable new references for dimension scales ## @@ -1179,6 +1179,27 @@ AC_ARG_ENABLE([tools], AC_MSG_RESULT([$HDF5_TOOLS]) ## ---------------------------------------------------------------------- +## Check if they would like to disable building the high-level GIF +## tools (they have unfixed CVE issues) +## + +AC_MSG_CHECKING([if the high-level GIF tools are enabled]) +AC_ARG_ENABLE([hlgiftools], + [AS_HELP_STRING([--enable-hlgiftools], + [Enable the high-level GIF tools. NOTE: These have unfixed CVE issues! + [default=no] + ])], + [HDF5_HL_GIF_TOOLS=$enableval]) + +if test "X-$HDF5_TOOLS" = "X-yes" -a "X-$HDF5_HL" = "X-yes" -a "X-$HDF5_HL_GIF_TOOLS" = "X-yes"; then + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) + HDF5_HL_GIF_TOOLS="no" +fi + + +## ---------------------------------------------------------------------- ## Check if they would like to enable building doxygen files ## @@ -1465,7 +1486,12 @@ case "$host_cpu-$host_vendor-$host_os" in ## VFD on Linux systems. H5_CPPFLAGS="-D_GNU_SOURCE $H5_CPPFLAGS" ;; - + *mingw*) + AC_DEFINE([HAVE_WINDOWS], [1], [Define if this is a Windows machine]) + AC_DEFINE([HAVE_WIN32_API], [1], [Define if on the Windows platform using the Win32 API]) + AC_DEFINE([HAVE_MINGW], [1], [Define if using MinGW]) + H5_CPPFLAGS="-D_GNU_SOURCE -D__USE_MINGW_ANSI_STDIO $H5_CPPFLAGS" + ;; esac ## Need to add the AM_ and H5_ into CFLAGS/CPPFLAGS to make them visible @@ -2044,8 +2070,8 @@ if test "X$THREADSAFE" = "Xyes"; then ## supported a priori. POSIX.1-2001 requires that a conformant ## system need only support one of SYSTEM or PROCESS scopes. ## - ## For cross-compiling, we've added a pessimistic 'no'. You can - ## hand-hack the config file if you know otherwise. + ## CROSS-COMPILING: Use a pessimistic 'no'. You can hand-hack the config + ## file if you know otherwise. AC_MSG_CHECKING([Pthreads supports system scope]) AC_CACHE_VAL([hdf5_cv_system_scope_threads], [AC_RUN_IFELSE( @@ -2499,6 +2525,7 @@ case "X-$DEV_WARNINGS" in ;; X-no) H5_CFLAGS="$H5_CFLAGS $NO_DEVELOPER_WARNING_CFLAGS" + H5_FCFLAGS="$H5_FCFLAGS $NO_DEVELOPER_WARNING_FCFLAGS" AC_MSG_RESULT([no]) ;; *) @@ -3545,12 +3572,13 @@ esac ## ---------------------------------------------------------------------- ## Set the flag to indicate that the machine is using a special algorithm to convert ## 'long double' to '(unsigned) long' values. (This flag should only be set for -## the IBM Power6 Linux. When the bit sequence of long double is +## the IBM Power Linux. When the bit sequence of long double is ## 0x4351ccf385ebc8a0bfcc2a3c3d855620, the converted value of (unsigned)long ## is 0x004733ce17af227f, not the same as the library's conversion to 0x004733ce17af2282. ## The machine's conversion gets the correct value. We define the macro and disable ## this kind of test until we figure out what algorithm they use. ## +## CROSS-COMPILING: Assume 'no' AC_MSG_CHECKING([if using special algorithm to convert long double to (unsigned) long values]) ## NOTE: Place all configure test programs into cmake's source file, then use a preprocessor directive @@ -3565,7 +3593,7 @@ else AC_CACHE_VAL([hdf5_cv_ldouble_to_long_special], [AC_RUN_IFELSE( [AC_LANG_SOURCE([$TEST_SRC])] - , [hdf5_cv_ldouble_to_long_special=yes], [hdf5_cv_ldouble_to_long_special=no],)]) + , [hdf5_cv_ldouble_to_long_special=yes], [hdf5_cv_ldouble_to_long_special=no], [hdf5_cv_ldouble_to_long_special=no])]) fi if test ${hdf5_cv_ldouble_to_long_special} = "yes"; then @@ -3579,11 +3607,12 @@ fi ## ---------------------------------------------------------------------- ## Set the flag to indicate that the machine is using a special algorithm ## to convert some values of '(unsigned) long' to 'long double' values. -## (This flag should be off for all machines, except for IBM Power6 Linux, +## (This flag should be off for all machines, except for IBM Power Linux, ## when the bit sequences are 003fff..., 007fff..., 00ffff..., 01ffff..., ## ..., 7fffff..., the compiler uses a unknown algorithm. We define a ## macro and skip the test for now until we know about the algorithm. ## +## CROSS-COMPILING: Assume 'no' AC_MSG_CHECKING([if using special algorithm to convert (unsigned) long to long double values]) TEST_SRC="`(echo \"#define H5_LONG_TO_LDOUBLE_SPECIAL_TEST 1\"; cat $srcdir/config/cmake/ConversionTests.c)`" @@ -3594,7 +3623,7 @@ else AC_CACHE_VAL([hdf5_cv_long_to_ldouble_special], [AC_RUN_IFELSE( [AC_LANG_SOURCE([$TEST_SRC])] - , [hdf5_cv_long_to_ldouble_special=yes], [hdf5_cv_long_to_ldouble_special=no],)]) + , [hdf5_cv_long_to_ldouble_special=yes], [hdf5_cv_long_to_ldouble_special=no], [hdf5_cv_long_to_ldouble_special=no])]) fi if test ${hdf5_cv_long_to_ldouble_special} = "yes"; then @@ -3616,6 +3645,7 @@ fi ## 0x4351ccf385ebc8a0ffcc... will make the converted values wildly wrong. ## This test detects this wrong behavior and disable the test. ## +## CROSS-COMPILING: Assume 'yes' AC_MSG_CHECKING([if correctly converting long double to (unsigned) long long values]) TEST_SRC="`(echo \"#define H5_LDOUBLE_TO_LLONG_ACCURATE_TEST 1\"; cat $srcdir/config/cmake/ConversionTests.c)`" @@ -3625,7 +3655,7 @@ if test ${ac_cv_sizeof_long_double} = 0; then else AC_CACHE_VAL([hdf5_cv_ldouble_to_llong_accurate], [AC_RUN_IFELSE([AC_LANG_SOURCE([$TEST_SRC])], - [hdf5_cv_ldouble_to_llong_accurate=yes], [hdf5_cv_ldouble_to_llong_accurate=no],[])]) + [hdf5_cv_ldouble_to_llong_accurate=yes], [hdf5_cv_ldouble_to_llong_accurate=no], [hdf5_cv_ldouble_to_llong_accurate=yes])]) fi if test ${hdf5_cv_ldouble_to_llong_accurate} = "yes"; then @@ -3645,6 +3675,7 @@ fi ## When the bit sequences are 003fff..., 007fff..., 00ffff..., 01ffff..., ## ..., 7fffff..., the converted values are twice as big as they should be. ## +## CROSS-COMPILING: Assume 'yes' AC_MSG_CHECKING([if correctly converting (unsigned) long long to long double values]) TEST_SRC="`(echo \"#define H5_LLONG_TO_LDOUBLE_CORRECT_TEST 1\"; cat $srcdir/config/cmake/ConversionTests.c)`" @@ -3654,7 +3685,7 @@ if test ${ac_cv_sizeof_long_double} = 0; then else AC_CACHE_VAL([hdf5_cv_llong_to_ldouble_correct], [AC_RUN_IFELSE([AC_LANG_SOURCE([$TEST_SRC])], - [hdf5_cv_llong_to_ldouble_correct=yes], [hdf5_cv_llong_to_ldouble_correct=no],[])]) + [hdf5_cv_llong_to_ldouble_correct=yes], [hdf5_cv_llong_to_ldouble_correct=no], [hdf5_cv_llong_to_ldouble_correct=yes])]) fi if test ${hdf5_cv_llong_to_ldouble_correct} = "yes"; then @@ -3669,6 +3700,7 @@ fi ## Set the flag to indicate that the machine is IBM ppc64le and cannot ## accurately convert some long double values. ## +## CROSS-COMPILING: Assume 'yes' AC_MSG_CHECKING([if the system is IBM ppc64le and cannot correctly convert some long double values]) TEST_SRC="`(echo \"#define H5_DISABLE_SOME_LDOUBLE_CONV_TEST 1\"; cat $srcdir/config/cmake/ConversionTests.c)`" @@ -3678,7 +3710,7 @@ if test ${ac_cv_sizeof_long_double} = 0; then else AC_CACHE_VAL([hdf5_cv_disable_some_ldouble_conv], [AC_RUN_IFELSE([AC_LANG_SOURCE([$TEST_SRC])], - [hdf5_cv_disable_some_ldouble_conv=yes], [hdf5_cv_disable_some_ldouble_conv=no],[])]) + [hdf5_cv_disable_some_ldouble_conv=yes], [hdf5_cv_disable_some_ldouble_conv=no], [hdf5_cv_disable_some_ldouble_conv=yes])]) fi if test ${hdf5_cv_disable_some_ldouble_conv} = "yes"; then @@ -3882,11 +3914,13 @@ esac AC_SUBST([DEFAULT_API_VERSION]) AC_MSG_CHECKING([which version of public symbols to use by default]) AC_ARG_WITH([default-api-version], - [AS_HELP_STRING([--with-default-api-version=(v16|v18|v110|v112)], + [AS_HELP_STRING([--with-default-api-version=(default|v16|v18|v110|v112)], [Specify default release version of public symbols [default=v112]])],, [withval=v112]) +## Allowing "default" allows the GitHub CI to check that we didn't forget +## to change the defaults when creating a new major version if test "X$withval" = "Xv16"; then AC_MSG_RESULT([v16]) DEFAULT_API_VERSION=v16 @@ -4059,7 +4093,7 @@ AM_CONDITIONAL([BUILD_HDF5_HL_CONDITIONAL], [test "X$HDF5_HL" = "Xyes"]) AM_CONDITIONAL([BUILD_TESTS_CONDITIONAL], [test "X$HDF5_TESTS" = "Xyes"]) AM_CONDITIONAL([BUILD_TESTS_PARALLEL_CONDITIONAL], [test -n "$TESTPARALLEL"]) AM_CONDITIONAL([BUILD_TOOLS_CONDITIONAL], [test "X$HDF5_TOOLS" = "Xyes"]) -AM_CONDITIONAL([BUILD_TOOLS_HL_CONDITIONAL], [test "X$HDF5_HL_TOOLS" = "Xyes"]) +AM_CONDITIONAL([BUILD_TOOLS_HL_GIF_CONDITIONAL], [test "X$HDF5_HL_GIF_TOOLS" = "Xyes"]) AM_CONDITIONAL([BUILD_DOXYGEN_CONDITIONAL], [test "X$HDF5_DOXYGEN" = "Xyes"]) ## ---------------------------------------------------------------------- @@ -4164,10 +4198,10 @@ fi ## AM_CONDITIONAL([HAVE_SHARED_CONDITIONAL], [test "X$enable_shared" = "Xyes"]) -AC_CONFIG_FILES([src/libhdf5.settings - Makefile +AC_CONFIG_FILES([Makefile doxygen/Doxyfile src/Makefile + src/libhdf5.settings test/Makefile test/H5srcdir_str.h test/testabort_fail.sh diff --git a/doxygen/dox/IntroHDF5.dox b/doxygen/dox/IntroHDF5.dox index ec46217..3ca7d00 100644 --- a/doxygen/dox/IntroHDF5.dox +++ b/doxygen/dox/IntroHDF5.dox @@ -124,7 +124,7 @@ It is a 2-dimensional 5 x 3 array (the dataspace). The datatype should not be co </ul> \subsubsection subsec_intro_desc_prop_dspace Dataspaces -A dataspace describes the layout of a dataset’s data elements. It can consist of no elements (NULL), +A dataspace describes the layout of a dataset's data elements. It can consist of no elements (NULL), a single element (scalar), or a simple array. <table> @@ -141,7 +141,7 @@ in size (i.e. they are extendible). There are two roles of a dataspace: \li It contains the spatial information (logical layout) of a dataset stored in a file. This includes the rank and dimensions of a dataset, which are a permanent part of the dataset definition. -\li It describes an application’s data buffers and data elements participating in I/O. In other words, it can be used to select a portion or subset of a dataset. +\li It describes an application's data buffers and data elements participating in I/O. In other words, it can be used to select a portion or subset of a dataset. <table> <caption>The dataspace is used to describe both the logical layout of a dataset and a subset of a dataset.</caption> @@ -602,8 +602,8 @@ Navigate back: \ref index "Main" / \ref GettingStarted @page HDF5Examples HDF5 Examples Example programs of how to use HDF5 are provided below. For HDF-EOS specific examples, see the <a href="http://hdfeos.org/zoo/index.php">examples</a> -of how to access and visualize NASA HDF-EOS files using IDL, MATLAB, and NCL on the -<a href="http://hdfeos.org/">HDF-EOS Tools and Information Center</a> page. +of how to access and visualize NASA HDF-EOS files using Python, IDL, MATLAB, and NCL +on the <a href="http://hdfeos.org/">HDF-EOS Tools and Information Center</a> page. \section secHDF5Examples Examples \li \ref LBExamples diff --git a/doxygen/dox/LearnBasics.dox b/doxygen/dox/LearnBasics.dox index 298672d..1f57cca 100644 --- a/doxygen/dox/LearnBasics.dox +++ b/doxygen/dox/LearnBasics.dox @@ -59,7 +59,7 @@ These examples (C, C++, Fortran) are provided in the HDF5 source code and (Unix) <tr> <td>Create a file </td> -<td>C Fortran C++ <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/java/examples/intro/H5_CreateFile.java">Java</a> Python +<td>C Fortran C++ <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/java/examples/intro/H5_CreateFile.java">Java</a> Python </td> <td> </td> @@ -67,7 +67,7 @@ These examples (C, C++, Fortran) are provided in the HDF5 source code and (Unix) <tr> <td>Create a dataset </td> -<td><a href="https://raw.githubusercontent.com//HDFGroup/hdf5/hdf5_1_10/examples/h5_crtdat.c">C</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/fortran/examples/h5_crtdat.f90">Fortran</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/c++/examples/h5tutr_crtdat.cpp">C++</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/java/examples/intro/H5_CreateDataset.java">Java</a> <a href="https://support.hdfgroup.org/ftp/HDF5/examples/Py/h5_crtdat.py">Python</a> +<td><a href="https://raw.githubusercontent.com//HDFGroup/hdf5/hdf5_1_12/examples/h5_crtdat.c">C</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/fortran/examples/h5_crtdat.f90">Fortran</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/c++/examples/h5tutr_crtdat.cpp">C++</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/java/examples/intro/H5_CreateDataset.java">Java</a> <a href="https://support.hdfgroup.org/ftp/HDF5/examples/Py/h5_crtdat.py">Python</a> </td> <td> </td> @@ -75,7 +75,7 @@ These examples (C, C++, Fortran) are provided in the HDF5 source code and (Unix) <tr> <td>Read and write to a dataset </td> -<td><a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/examples/h5_rdwt.c">C</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/fortran/examples/h5_rdwt.f90">Fortran</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/c++/examples/h5tutr_rdwt.cpp">C++</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/java/examples/intro/H5_ReadWrite.java">Java</a> <a href="https://support.hdfgroup.org/ftp/HDF5/examples/Py/h5_rdwt.py">Python</a> +<td><a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/examples/h5_rdwt.c">C</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/fortran/examples/h5_rdwt.f90">Fortran</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/c++/examples/h5tutr_rdwt.cpp">C++</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/java/examples/intro/H5_ReadWrite.java">Java</a> <a href="https://support.hdfgroup.org/ftp/HDF5/examples/Py/h5_rdwt.py">Python</a> </td> <td> </td> @@ -83,7 +83,7 @@ These examples (C, C++, Fortran) are provided in the HDF5 source code and (Unix) <tr> <td>Create an attribute </td> -<td><a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/examples/h5_crtatt.c">C</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/fortran/examples/h5_crtatt.f90">Fortran</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/c++/examples/h5tutr_crtatt.cpp">C++</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/java/examples/intro/H5_CreateAttribute.java">Java</a> <a href="https://support.hdfgroup.org/ftp/HDF5/examples/Py/h5_crtatt.py">Python</a> +<td><a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/examples/h5_crtatt.c">C</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/fortran/examples/h5_crtatt.f90">Fortran</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/c++/examples/h5tutr_crtatt.cpp">C++</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/java/examples/intro/H5_CreateAttribute.java">Java</a> <a href="https://support.hdfgroup.org/ftp/HDF5/examples/Py/h5_crtatt.py">Python</a> </td> <td> </td> @@ -91,7 +91,7 @@ These examples (C, C++, Fortran) are provided in the HDF5 source code and (Unix) <tr> <td>Create a group </td> -<td><a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/examples/h5_crtgrp.c">C</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/fortran/examples/h5_crtgrp.f90">Fortran</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/c++/examples/h5tutr_crtgrp.cpp">C++</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/java/examples/intro/H5_CreateGroup.java">Java</a> <a href="https://support.hdfgroup.org/ftp/HDF5/examples/Py/h5_crtgrp.py">Python</a> +<td><a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/examples/h5_crtgrp.c">C</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/fortran/examples/h5_crtgrp.f90">Fortran</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/c++/examples/h5tutr_crtgrp.cpp">C++</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/java/examples/intro/H5_CreateGroup.java">Java</a> <a href="https://support.hdfgroup.org/ftp/HDF5/examples/Py/h5_crtgrp.py">Python</a> </td> <td> </td> @@ -99,7 +99,7 @@ These examples (C, C++, Fortran) are provided in the HDF5 source code and (Unix) <tr> <td>Create groups in a file using absolute and relative paths </td> -<td><a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/examples/h5_crtgrpar.c">C</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/fortran/examples/h5_crtgrpar.f90">Fortran</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/c++/examples/h5tutr_crtgrpar.cpp">C++</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/java/examples/intro/H5_CreateGroupAbsoluteRelative.java">Java</a> <a href="https://support.hdfgroup.org/ftp/HDF5/examples/Py/h5_crtgrpar.py">Python</a> +<td><a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/examples/h5_crtgrpar.c">C</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/fortran/examples/h5_crtgrpar.f90">Fortran</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/c++/examples/h5tutr_crtgrpar.cpp">C++</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/java/examples/intro/H5_CreateGroupAbsoluteRelative.java">Java</a> <a href="https://support.hdfgroup.org/ftp/HDF5/examples/Py/h5_crtgrpar.py">Python</a> </td> <td> </td> @@ -107,7 +107,7 @@ These examples (C, C++, Fortran) are provided in the HDF5 source code and (Unix) <tr> <td>Create datasets in a group </td> -<td><a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/examples/h5_crtgrpd.c">C</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/fortran/examples/h5_crtgrpd.f90">Fortran</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/c++/examples/h5tutr_crtgrpd.cpp">C++</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/java/examples/intro/H5_CreateGroupDataset.java">Java</a> <a href="https://support.hdfgroup.org/ftp/HDF5/examples/Py/h5_crtgrpd.py">Python</a> +<td><a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/examples/h5_crtgrpd.c">C</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/fortran/examples/h5_crtgrpd.f90">Fortran</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/c++/examples/h5tutr_crtgrpd.cpp">C++</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/java/examples/intro/H5_CreateGroupDataset.java">Java</a> <a href="https://support.hdfgroup.org/ftp/HDF5/examples/Py/h5_crtgrpd.py">Python</a> </td> <td> </td> @@ -115,7 +115,7 @@ These examples (C, C++, Fortran) are provided in the HDF5 source code and (Unix) <tr> <td>Create a file and dataset and select/read a subset from the dataset </td> -<td><a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/examples/h5_subset.c">C</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/fortran/examples/h5_subset.f90">Fortran</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/c++/examples/h5tutr_subset.cpp">C++</a> Java Python +<td><a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/examples/h5_subset.c">C</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/fortran/examples/h5_subset.f90">Fortran</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/c++/examples/h5tutr_subset.cpp">C++</a> Java Python </td> <td>Also see examples to Write by row (and column) below. </td> @@ -123,7 +123,7 @@ These examples (C, C++, Fortran) are provided in the HDF5 source code and (Unix) <tr> <td>Create an extendible (unlimited dimension) dataset </td> -<td><a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/examples/h5_extend.c">C</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/fortran/examples/h5_extend.f90">Fortran</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/c++/examples/h5tutr_extend.cpp">C++</a> Java Python +<td><a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/examples/h5_extend.c">C</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/fortran/examples/h5_extend.f90">Fortran</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/c++/examples/h5tutr_extend.cpp">C++</a> Java Python </td> <td>Also see examples to Extend by row (and column) below </td> @@ -131,7 +131,7 @@ These examples (C, C++, Fortran) are provided in the HDF5 source code and (Unix) <tr> <td>Create a chunked and compressed dataset </td> -<td><a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/examples/h5_cmprss.c">C</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/fortran/examples/h5_cmprss.f90">Fortran</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_10/c++/examples/h5tutr_cmprss.cpp">C++</a> Java <a href="https://support.hdfgroup.org/ftp/HDF5/examples/Py/h5_cmprss.py">Python</a> +<td><a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/examples/h5_cmprss.c">C</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/fortran/examples/h5_cmprss.f90">Fortran</a> <a href="https://raw.githubusercontent.com/HDFGroup/hdf5/hdf5_1_12/c++/examples/h5tutr_cmprss.cpp">C++</a> Java <a href="https://support.hdfgroup.org/ftp/HDF5/examples/Py/h5_cmprss.py">Python</a> </td> <td> </td> diff --git a/doxygen/dox/UsersGuide.dox b/doxygen/dox/UsersGuide.dox index a8ff060..3a9c745 100644 --- a/doxygen/dox/UsersGuide.dox +++ b/doxygen/dox/UsersGuide.dox @@ -126,7 +126,7 @@ HDF5 Release 1.12 <li> \ref subsubsec_dataset_program_transfer <li> \ref subsubsec_dataset_program_read </ul> -\li \ref subsec_dataset_transfer Data Transfer +\li \ref subsec_dataset_transfer <ul> <li> \ref subsubsec_dataset_transfer_pipe <li> \ref subsubsec_dataset_transfer_filter diff --git a/doxygen/dox/high_level/extension.dox b/doxygen/dox/high_level/extension.dox index d754b96..20a099a 100644 --- a/doxygen/dox/high_level/extension.dox +++ b/doxygen/dox/high_level/extension.dox @@ -392,7 +392,7 @@ H5_HLRDLL herr_t H5LRread_region(hid_t obj_id, * * \details H5LRget_region_info() queries information about the data * pointed by a region reference \p ref. It returns one of the - * absolute paths to a dataset, length of the path, dataset’s rank + * absolute paths to a dataset, length of the path, dataset's rank * and datatype, description of the referenced region and type of * the referenced region. Any output argument can be NULL if that * argument does not need to be returned. diff --git a/doxygen/examples/H5Fclose.c b/doxygen/examples/H5Fclose.c index 525bad3..8c2ef08 100644 --- a/doxygen/examples/H5Fclose.c +++ b/doxygen/examples/H5Fclose.c @@ -1,7 +1,7 @@ #include "hdf5.h" int -main() +main(void) { hid_t file; if ((file = H5Fcreate("foo.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) diff --git a/doxygen/examples/H5Fcreate.c b/doxygen/examples/H5Fcreate.c index 525bad3..8c2ef08 100644 --- a/doxygen/examples/H5Fcreate.c +++ b/doxygen/examples/H5Fcreate.c @@ -1,7 +1,7 @@ #include "hdf5.h" int -main() +main(void) { hid_t file; if ((file = H5Fcreate("foo.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) diff --git a/doxygen/examples/hello_hdf5.c b/doxygen/examples/hello_hdf5.c index a37d39f..f078090 100644 --- a/doxygen/examples/hello_hdf5.c +++ b/doxygen/examples/hello_hdf5.c @@ -1,7 +1,7 @@ #include "hdf5.h" int -main() +main(void) { herr_t retval; unsigned majnum, minnum, relnum; diff --git a/doxygen/examples/tables/fileDriverLists.dox b/doxygen/examples/tables/fileDriverLists.dox index 1aae3ce..125df63 100644 --- a/doxygen/examples/tables/fileDriverLists.dox +++ b/doxygen/examples/tables/fileDriverLists.dox @@ -94,8 +94,8 @@ version of the file can be written back to disk or abandoned.</td> <tr> <td>Family</td> <td>#H5FD_FAMILY</td> -<td>With this driver, the HDF5 file’s address space is partitioned into pieces and sent to -separate storage files using an underlying driver of the user’s choice. This driver is for +<td>With this driver, the HDF5 file's address space is partitioned into pieces and sent to +separate storage files using an underlying driver of the user's choice. This driver is for systems that do not support files larger than 2 gigabytes.</td> <td>#H5Pset_fapl_family</td> </tr> diff --git a/doxygen/examples/tables/propertyLists.dox b/doxygen/examples/tables/propertyLists.dox index cac7fd2..dccefb5 100644 --- a/doxygen/examples/tables/propertyLists.dox +++ b/doxygen/examples/tables/propertyLists.dox @@ -920,4 +920,4 @@ encoding for object names.</td> //! [acpl_table] * */ - +
\ No newline at end of file diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index f453467..371dea8 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -52,7 +52,7 @@ endif () foreach (example ${examples}) add_executable (${example} ${HDF5_EXAMPLES_SOURCE_DIR}/${example}.c) - target_include_directories (${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (${example} PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (${example} STATIC) target_link_libraries (${example} PRIVATE ${HDF5_LIB_TARGET}) @@ -73,7 +73,7 @@ endforeach () if (H5_HAVE_PARALLEL) foreach (parallel_example ${parallel_examples}) add_executable (${parallel_example} ${HDF5_EXAMPLES_SOURCE_DIR}/${parallel_example}.c) - target_include_directories (${parallel_example} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (${parallel_example} PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (${parallel_example} STATIC) target_link_libraries (${parallel_example} PRIVATE ${HDF5_LIB_TARGET} MPI::MPI_C) diff --git a/examples/CMakeTests.cmake b/examples/CMakeTests.cmake index 6c84d1d..30f73c4 100644 --- a/examples/CMakeTests.cmake +++ b/examples/CMakeTests.cmake @@ -70,7 +70,18 @@ if (HDF5_TEST_SERIAL) NAME EXAMPLES-clear-objects COMMAND ${CMAKE_COMMAND} -E remove ${test_ex_CLEANFILES} ) - set_tests_properties (EXAMPLES-clear-objects PROPERTIES FIXTURES_SETUP clear_EXAMPLES) + set_tests_properties (EXAMPLES-clear-objects PROPERTIES + FIXTURES_SETUP clear_EXAMPLES + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + ) + add_test ( + NAME EXAMPLES-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove ${test_ex_CLEANFILES} + ) + set_tests_properties (EXAMPLES-clean-objects PROPERTIES + FIXTURES_CLEANUP clear_EXAMPLES + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + ) foreach (example ${examples}) if (HDF5_ENABLE_USING_MEMCHECKER) @@ -83,7 +94,6 @@ if (HDF5_TEST_SERIAL) -D "TEST_EXPECT=0" -D "TEST_SKIP_COMPARE=TRUE" -D "TEST_OUTPUT=${example}.txt" - #-D "TEST_REFERENCE=${example}.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) @@ -113,7 +123,6 @@ if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL AND NOT WIN32) -D "TEST_SKIP_COMPARE=TRUE" -D "TEST_OUTPUT=${parallel_example}.out" -D "TEST_REFERENCE:STRING=PHDF5 example finished with no errors" - #-D "TEST_FILTER:STRING=PHDF5 tests finished with no errors" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -P "${HDF_RESOURCES_DIR}/grepTest.cmake" ) diff --git a/examples/h5_cmprss.c b/examples/h5_cmprss.c index 9aefe32..ffd3191 100644 --- a/examples/h5_cmprss.c +++ b/examples/h5_cmprss.c @@ -23,7 +23,7 @@ #define DIM1 20 int -main() +main(void) { hid_t file_id, dataset_id, dataspace_id; /* identifiers */ diff --git a/examples/h5_crtatt.c b/examples/h5_crtatt.c index f33e1f1..8534703f 100644 --- a/examples/h5_crtatt.c +++ b/examples/h5_crtatt.c @@ -19,7 +19,7 @@ #define FILE "dset.h5" int -main() +main(void) { hid_t file_id, dataset_id, attribute_id, dataspace_id; /* identifiers */ diff --git a/examples/h5_crtdat.c b/examples/h5_crtdat.c index 8de9077..d8ac072 100644 --- a/examples/h5_crtdat.c +++ b/examples/h5_crtdat.c @@ -19,7 +19,7 @@ #define FILE "dset.h5" int -main() +main(void) { hid_t file_id, dataset_id, dataspace_id; /* identifiers */ diff --git a/examples/h5_crtgrp.c b/examples/h5_crtgrp.c index f9066f4..3517bf3 100644 --- a/examples/h5_crtgrp.c +++ b/examples/h5_crtgrp.c @@ -19,7 +19,7 @@ #define FILE "group.h5" int -main() +main(void) { hid_t file_id, group_id; /* identifiers */ diff --git a/examples/h5_crtgrpar.c b/examples/h5_crtgrpar.c index f397155..1b47429 100644 --- a/examples/h5_crtgrpar.c +++ b/examples/h5_crtgrpar.c @@ -19,7 +19,7 @@ #define FILE "groups.h5" int -main() +main(void) { hid_t file_id, group1_id, group2_id, group3_id; /* identifiers */ diff --git a/examples/h5_crtgrpd.c b/examples/h5_crtgrpd.c index 364a3b9..f1750d6 100644 --- a/examples/h5_crtgrpd.c +++ b/examples/h5_crtgrpd.c @@ -19,7 +19,7 @@ #define FILE "groups.h5" int -main() +main(void) { hid_t file_id, group_id, dataset_id, dataspace_id; /* identifiers */ diff --git a/examples/h5_extlink.c b/examples/h5_extlink.c index 8d3fc8c..e1f02cf 100644 --- a/examples/h5_extlink.c +++ b/examples/h5_extlink.c @@ -411,7 +411,7 @@ UD_hard_create(const char *link_name, hid_t loc_group, const void *udata, size_t goto done; } - token = *((H5O_token_t *)udata); + token = *((const H5O_token_t *)udata); //! [H5Oopen_by_token_snip] @@ -459,7 +459,7 @@ UD_hard_delete(const char *link_name, hid_t loc_group, const void *udata, size_t goto done; } - token = *((H5O_token_t *)udata); + token = *((const H5O_token_t *)udata); /* Open the object this link points to */ target_obj = H5Oopen_by_token(loc_group, token); @@ -498,7 +498,7 @@ UD_hard_traverse(const char *link_name, hid_t cur_group, const void *udata, size if (udata_size != sizeof(H5O_token_t)) return H5I_INVALID_HID; - token = *((H5O_token_t *)udata); + token = *((const H5O_token_t *)udata); /* Open the object by token. If H5Oopen_by_token fails, ret_value will * be negative to indicate that the traversal function failed. diff --git a/examples/h5_rdwt.c b/examples/h5_rdwt.c index 679dc46..9947f59 100644 --- a/examples/h5_rdwt.c +++ b/examples/h5_rdwt.c @@ -19,7 +19,7 @@ #define FILE "dset.h5" int -main() +main(void) { hid_t file_id, dataset_id; /* identifiers */ diff --git a/examples/testh5cc.sh.in b/examples/testh5cc.sh.in index 88fc684..d42e7f1 100644 --- a/examples/testh5cc.sh.in +++ b/examples/testh5cc.sh.in @@ -11,14 +11,6 @@ # help@hdfgroup.org. # # Tests for the h5cc compiler tool -# Created: Albert Cheng, 2007/4/11 -# -# Modification: -# Albert Cheng, 2008/9/27 -# Added -shlib tests and verbose control. -# Albert Cheng, 2009/10/28 -# Added version compatibility tests. -# srcdir=@srcdir@ diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index 793df8d..3aaad08 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -45,7 +45,7 @@ foreach (example ${examples}) target_include_directories (f90_ex_${example} PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/static" - "${HDF5_SRC_DIR}" + "${HDF5_SRC_INCLUDE_DIRS}" "${HDF5_SRC_BINARY_DIR}" "${HDF5_F90_BINARY_DIR}" "${HDF5_F90_BINARY_DIR}/static" @@ -60,7 +60,7 @@ foreach (example ${examples}) target_include_directories (f90_ex_${example} PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared" - "${HDF5_SRC_DIR}" + "${HDF5_SRC_INCLUDE_DIRS}" "${HDF5_SRC_BINARY_DIR}" "${HDF5_F90_BINARY_DIR}" "${HDF5_F90_BINARY_DIR}/shared" @@ -86,7 +86,7 @@ foreach (example ${F2003_examples}) target_include_directories (f03_ex_${example} PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/static" - "${HDF5_SRC_DIR}" + "${HDF5_SRC_INCLUDE_DIRS}" "${HDF5_SRC_BINARY_DIR}" "${HDF5_F90_BINARY_DIR}" "${HDF5_F90_BINARY_DIR}/static" @@ -101,7 +101,7 @@ foreach (example ${F2003_examples}) target_include_directories (f03_ex_${example} PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared" - "${HDF5_SRC_DIR}" + "${HDF5_SRC_INCLUDE_DIRS}" "${HDF5_SRC_BINARY_DIR}" "${HDF5_F90_BINARY_DIR}" "${HDF5_F90_BINARY_DIR}/shared" @@ -127,7 +127,7 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) target_include_directories (f90_ex_ph5example PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/static" - "${HDF5_SRC_DIR}" + "${HDF5_SRC_INCLUDE_DIRS}" "${HDF5_SRC_BINARY_DIR}" "${HDF5_F90_BINARY_DIR}" "${HDF5_F90_BINARY_DIR}/static" @@ -148,7 +148,7 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) target_include_directories (f90_ex_ph5example PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared" - "${HDF5_SRC_DIR}" + "${HDF5_SRC_INCLUDE_DIRS}" "${HDF5_SRC_BINARY_DIR}" "${HDF5_F90_BINARY_DIR}" "${HDF5_F90_BINARY_DIR}/shared" diff --git a/fortran/examples/CMakeTests.cmake b/fortran/examples/CMakeTests.cmake index 09b3fa0..dabab8b 100644 --- a/fortran/examples/CMakeTests.cmake +++ b/fortran/examples/CMakeTests.cmake @@ -40,7 +40,18 @@ if (HDF5_TEST_SERIAL) NAME f90_ex-clear-objects COMMAND ${CMAKE_COMMAND} -E remove ${test_ex_fortran_CLEANFILES} ) - set_tests_properties (f90_ex-clear-objects PROPERTIES FIXTURES_SETUP clear_f90_ex) + set_tests_properties (f90_ex-clear-objects PROPERTIES + FIXTURES_SETUP clear_f90_ex + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + ) + add_test ( + NAME f90_ex-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove ${test_ex_fortran_CLEANFILES} + ) + set_tests_properties (f90_ex-clean-objects PROPERTIES + FIXTURES_CLEANUP clear_f90_ex + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + ) foreach (example ${examples}) if (HDF5_ENABLE_USING_MEMCHECKER) diff --git a/fortran/examples/testh5fc.sh.in b/fortran/examples/testh5fc.sh.in index 2f7c176..0328bbb 100644 --- a/fortran/examples/testh5fc.sh.in +++ b/fortran/examples/testh5fc.sh.in @@ -11,10 +11,6 @@ # help@hdfgroup.org. # # Tests for the h5fc compiler tool -# Created: Albert Cheng, 2007/3/14 -# -# Modification: -# srcdir=@srcdir@ diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index c253c2c..3dac037 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -10,6 +10,12 @@ if (WIN32) set (H5_NOPAREXP ";") endif () set (H5_F03EXP ";") + if (NOT H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE) + set (H5_DBL_NOT_UNIQUE_EXP ";") + endif () + if (NOT H5_NO_DEPRECATED_SYMBOLS) + set (H5_NO_DEPRECATED_SYMBOLS ";") + endif () configure_file (${HDF5_F90_SRC_SOURCE_DIR}/hdf5_fortrandll.def.in ${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def @ONLY) endif () endif () @@ -71,7 +77,7 @@ add_executable (H5match_types ${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h ${HDF5_F90_SRC_SOURCE_DIR}/H5match_types.c ) -target_include_directories (H5match_types PRIVATE "${HDF5_SRC_BINARY_DIR};${HDF5_SRC_DIR};${HDF5_F90_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_include_directories (H5match_types PRIVATE "${HDF5_SRC_BINARY_DIR};${HDF5_SRC_INCLUDE_DIRS};${HDF5_F90_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") add_custom_command (TARGET H5match_types POST_BUILD BYPRODUCTS ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h ${HDF5_F90_BINARY_DIR}/H5fortran_types.F90 @@ -159,7 +165,7 @@ endif () if (BUILD_STATIC_LIBS) add_library (${HDF5_F90_C_LIB_TARGET} STATIC ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS} ${f90CStub_CGEN_HDRS}) target_include_directories (${HDF5_F90_C_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" + PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) target_compile_options(${HDF5_F90_C_LIB_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") @@ -178,7 +184,7 @@ endif () if (BUILD_SHARED_LIBS) add_library (${HDF5_F90_C_LIBSH_TARGET} SHARED ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS} ${f90CStub_CGEN_SHHDRS}) target_include_directories (${HDF5_F90_C_LIBSH_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" + PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) target_compile_options(${HDF5_F90_C_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") @@ -420,29 +426,33 @@ else () ) endif () +set (mod_export_files + h5fortran_types.mod + hdf5.mod + h5fortkit.mod + h5global.mod + h5a.mod + h5d.mod + h5e.mod + h5f.mod + h5g.mod + h5i.mod + h5l.mod + h5lib.mod + h5o.mod + h5p.mod + h5r.mod + h5s.mod + h5t.mod + h5vl.mod + h5z.mod + h5_gen.mod +) + if (BUILD_STATIC_LIBS) - set (mod_files - ${MOD_BUILD_DIR}/h5fortran_types.mod - ${MOD_BUILD_DIR}/hdf5.mod - ${MOD_BUILD_DIR}/h5fortkit.mod - ${MOD_BUILD_DIR}/h5global.mod - ${MOD_BUILD_DIR}/h5a.mod - ${MOD_BUILD_DIR}/h5d.mod - ${MOD_BUILD_DIR}/h5e.mod - ${MOD_BUILD_DIR}/h5f.mod - ${MOD_BUILD_DIR}/h5g.mod - ${MOD_BUILD_DIR}/h5i.mod - ${MOD_BUILD_DIR}/h5l.mod - ${MOD_BUILD_DIR}/h5lib.mod - ${MOD_BUILD_DIR}/h5o.mod - ${MOD_BUILD_DIR}/h5p.mod - ${MOD_BUILD_DIR}/h5r.mod - ${MOD_BUILD_DIR}/h5s.mod - ${MOD_BUILD_DIR}/h5t.mod - ${MOD_BUILD_DIR}/h5vl.mod - ${MOD_BUILD_DIR}/h5z.mod - ${MOD_BUILD_DIR}/h5_gen.mod - ) + foreach (mod_file ${mod_export_files}) + set (mod_files ${mod_files} ${MOD_BUILD_DIR}/${mod_file}) + endforeach () install ( FILES ${mod_files} @@ -464,28 +474,9 @@ if (BUILD_STATIC_LIBS) endif () if (BUILD_SHARED_LIBS) - set (modsh_files - ${MODSH_BUILD_DIR}/h5fortran_types.mod - ${MODSH_BUILD_DIR}/hdf5.mod - ${MODSH_BUILD_DIR}/h5fortkit.mod - ${MODSH_BUILD_DIR}/h5global.mod - ${MODSH_BUILD_DIR}/h5a.mod - ${MODSH_BUILD_DIR}/h5d.mod - ${MODSH_BUILD_DIR}/h5e.mod - ${MODSH_BUILD_DIR}/h5f.mod - ${MODSH_BUILD_DIR}/h5g.mod - ${MODSH_BUILD_DIR}/h5i.mod - ${MODSH_BUILD_DIR}/h5l.mod - ${MODSH_BUILD_DIR}/h5lib.mod - ${MODSH_BUILD_DIR}/h5o.mod - ${MODSH_BUILD_DIR}/h5p.mod - ${MODSH_BUILD_DIR}/h5r.mod - ${MODSH_BUILD_DIR}/h5s.mod - ${MODSH_BUILD_DIR}/h5t.mod - ${MODSH_BUILD_DIR}/h5vl.mod - ${MODSH_BUILD_DIR}/h5z.mod - ${MODSH_BUILD_DIR}/h5_gen.mod - ) + foreach (mod_file ${mod_export_files}) + set (modsh_files ${modsh_files} ${MODSH_BUILD_DIR}/${mod_file}) + endforeach () install ( FILES ${modsh_files} diff --git a/fortran/src/H5config_f.inc.cmake b/fortran/src/H5config_f.inc.cmake index 565d6eb..3c9bf88 100644 --- a/fortran/src/H5config_f.inc.cmake +++ b/fortran/src/H5config_f.inc.cmake @@ -11,7 +11,7 @@ ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! fortran/src/H5config_f.inc. Generated from fortran/src/H5config_f.inc.in by configure -! Define if we have parallel support +! Define if there is parallel support #cmakedefine01 H5_HAVE_PARALLEL #if H5_HAVE_PARALLEL == 0 #undef H5_HAVE_PARALLEL @@ -70,3 +70,9 @@ ! Fortran compiler id #define H5_Fortran_COMPILER_ID @CMAKE_Fortran_COMPILER_ID@ + +! Define if deprecated public API symbols are disabled +#cmakedefine01 H5_NO_DEPRECATED_SYMBOLS +#if H5_NO_DEPRECATED_SYMBOLS == 0 +#undef H5_NO_DEPRECATED_SYMBOLS +#endif
\ No newline at end of file diff --git a/fortran/src/H5config_f.inc.in b/fortran/src/H5config_f.inc.in index 685b4d2..bd32a8c 100644 --- a/fortran/src/H5config_f.inc.in +++ b/fortran/src/H5config_f.inc.in @@ -71,3 +71,6 @@ ! Fortran compiler name #undef Fortran_COMPILER_ID +! Define if deprecated public API symbols are disabled +#undef NO_DEPRECATED_SYMBOLS + diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in index 4207239..b5d1af3 100644 --- a/fortran/src/hdf5_fortrandll.def.in +++ b/fortran/src/hdf5_fortrandll.def.in @@ -14,7 +14,7 @@ H5A_mp_H5AWRITE_CHAR_SCALAR H5A_mp_H5AREAD_CHAR_SCALAR H5A_mp_H5ACREATE_F H5A_mp_H5AOPEN_NAME_F -H5A_mp_H5AOPEN_IDX_F +@H5_NO_DEPRECATED_SYMBOLS@H5A_mp_H5AOPEN_IDX_F H5A_mp_H5AGET_SPACE_F H5A_mp_H5AGET_TYPE_F H5A_mp_H5AGET_NAME_F diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 2d29497..bfad283 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -45,7 +45,7 @@ if (NOT BUILD_SHARED_LIBS) add_library (${HDF5_F90_C_TEST_LIB_TARGET} STATIC t.c t.h) set_source_files_properties (t.c PROPERTIES LANGUAGE C) target_include_directories (${HDF5_F90_C_TEST_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" + PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) target_compile_options(${HDF5_F90_C_TEST_LIB_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") @@ -62,7 +62,7 @@ if (NOT BUILD_SHARED_LIBS) else () add_library (${HDF5_F90_C_TEST_LIBSH_TARGET} SHARED t.c t.h) target_include_directories (${HDF5_F90_C_TEST_LIBSH_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" + PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) target_compile_options(${HDF5_F90_C_TEST_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") diff --git a/fortran/test/CMakeTests.cmake b/fortran/test/CMakeTests.cmake index 68d8a5a..93571e1 100644 --- a/fortran/test/CMakeTests.cmake +++ b/fortran/test/CMakeTests.cmake @@ -57,7 +57,18 @@ add_test ( NAME FORTRAN_testhdf5-clear-objects COMMAND ${CMAKE_COMMAND} -E remove ${testhdf5_fortran_CLEANFILES} ) -set_tests_properties (FORTRAN_testhdf5-clear-objects PROPERTIES FIXTURES_SETUP clear_testhdf5_fortran) +set_tests_properties (FORTRAN_testhdf5-clear-objects PROPERTIES + FIXTURES_SETUP clear_testhdf5_fortran + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} +) +add_test ( + NAME FORTRAN_testhdf5-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove ${testhdf5_fortran_CLEANFILES} +) +set_tests_properties (FORTRAN_testhdf5-clean-objects PROPERTIES + FIXTURES_CLEANUP clear_testhdf5_fortran + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} +) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME FORTRAN_testhdf5_fortran COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:testhdf5_fortran>) @@ -147,6 +158,9 @@ else () -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () +set_tests_properties (FORTRAN_vol_connector PROPERTIES + FIXTURES_REQUIRED clear_testhdf5_fortran +) #-- Adding test for fflush1 add_test ( @@ -169,3 +183,10 @@ add_test ( set_tests_properties (FORTRAN_fflush2 PROPERTIES DEPENDS FORTRAN_fflush1 ) +add_test ( + NAME FORTRAN_flush1-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove flush.h5 +) +set_tests_properties (FORTRAN_flush1-clean-objects PROPERTIES + DEPENDS FORTRAN_fflush2 +) diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt index d41343c..f2e9201 100644 --- a/fortran/testpar/CMakeLists.txt +++ b/fortran/testpar/CMakeLists.txt @@ -53,8 +53,6 @@ else () ) endif () -#set_property(TARGET parallel_test APPEND PROPERTY LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">) -#set_property(TARGET parallel_test APPEND PROPERTY LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>) if(MSVC) set_property(TARGET parallel_test PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() diff --git a/hl/CMakeLists.txt b/hl/CMakeLists.txt index 9391231..2dc8012 100644 --- a/hl/CMakeLists.txt +++ b/hl/CMakeLists.txt @@ -17,15 +17,7 @@ add_subdirectory (src) # Build HDF5 Tools if (HDF5_BUILD_TOOLS) - #----------------------------------------------------------------------------- - #-- Option to build the High level Tools - #----------------------------------------------------------------------------- - if (EXISTS "${HDF5_HL_SOURCE_DIR}/tools" AND IS_DIRECTORY "${HDF5_HL_SOURCE_DIR}/tools") - option (HDF5_BUILD_HL_TOOLS "Build HDF5 HL Tools" ON) - if (HDF5_BUILD_HL_TOOLS) - add_subdirectory (tools) - endif () - endif () + add_subdirectory (tools) endif () #-- Add High Level Examples diff --git a/hl/Makefile.am b/hl/Makefile.am index c9050ae..1b6b988 100644 --- a/hl/Makefile.am +++ b/hl/Makefile.am @@ -36,14 +36,10 @@ else TEST_DIR = endif if BUILD_TOOLS_CONDITIONAL -if BUILD_TOOLS_HL_CONDITIONAL TOOLS_DIR = tools else TOOLS_DIR = endif -else - TOOLS_DIR = -endif ## Don't recurse into any subdirectories if HDF5 is not configured to ## use the HL library diff --git a/hl/c++/examples/CMakeLists.txt b/hl/c++/examples/CMakeLists.txt index bfad538..548dd00 100644 --- a/hl/c++/examples/CMakeLists.txt +++ b/hl/c++/examples/CMakeLists.txt @@ -5,7 +5,7 @@ project (HDF5_HL_CPP_EXAMPLES CXX) # Add in the examples for the Packet Table codes # -------------------------------------------------------------------- add_executable (ptExampleFL ${HDF5_HL_CPP_EXAMPLES_SOURCE_DIR}/ptExampleFL.cpp) -target_include_directories (ptExampleFL PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_include_directories (ptExampleFL PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (ptExampleFL STATIC) target_link_libraries (ptExampleFL PRIVATE diff --git a/hl/c++/examples/CMakeTests.cmake b/hl/c++/examples/CMakeTests.cmake index 7564fd7..8b2b4ce 100644 --- a/hl/c++/examples/CMakeTests.cmake +++ b/hl/c++/examples/CMakeTests.cmake @@ -16,12 +16,16 @@ ############################################################################## ############################################################################## # Remove any output file left over from previous test run +set (HL_CPP_EX_PT_CLEANFILES + PTcppexampleFL.h5 +) add_test ( NAME HL_CPP_ex_ptExampleFL-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove - PTcppexampleFL.h5 - ptExampleFL.txt + -E remove ${HL_CPP_EX_PT_CLEANFILES} +) +set_tests_properties (HL_CPP_ex_ptExampleFL-clear-objects PROPERTIES + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} ) if (HDF5_ENABLE_USING_MEMCHECKER) @@ -40,3 +44,12 @@ else () ) endif () set_tests_properties (HL_CPP_ex_ptExampleFL PROPERTIES DEPENDS HL_CPP_ex_ptExampleFL-clear-objects) +add_test ( + NAME HL_CPP_ex_ptExampleFL-clean-objects + COMMAND ${CMAKE_COMMAND} + -E remove ${HL_CPP_EX_PT_CLEANFILES} +) +set_tests_properties (HL_CPP_ex_ptExampleFL-clean-objects PROPERTIES + DEPENDS HL_CPP_ex_ptExampleFL + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} +) diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt index b8e1178..71a4c9b 100644 --- a/hl/c++/src/CMakeLists.txt +++ b/hl/c++/src/CMakeLists.txt @@ -11,7 +11,7 @@ set (HDF5_HL_CPP_HDRS ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.h) if (BUILD_STATIC_LIBS) add_library (${HDF5_HL_CPP_LIB_TARGET} STATIC ${HDF5_HL_CPP_SOURCES} ${HDF5_HL_CPP_HDRS}) target_include_directories (${HDF5_HL_CPP_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" + PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) target_compile_options(${HDF5_HL_CPP_LIB_TARGET} PRIVATE "${HDF5_CMAKE_CXX_FLAGS}") @@ -26,7 +26,7 @@ endif () if (BUILD_SHARED_LIBS) add_library (${HDF5_HL_CPP_LIBSH_TARGET} SHARED ${HDF5_HL_CPP_SOURCES}) target_include_directories (${HDF5_HL_CPP_LIBSH_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" + PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) target_compile_options(${HDF5_HL_CPP_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_CXX_FLAGS}") diff --git a/hl/c++/test/CMakeLists.txt b/hl/c++/test/CMakeLists.txt index 9a1d6fd..fb750dd 100644 --- a/hl/c++/test/CMakeLists.txt +++ b/hl/c++/test/CMakeLists.txt @@ -3,7 +3,7 @@ project (HDF5_HL_CPP_TEST CXX) add_executable (hl_ptableTest ${HDF5_HL_CPP_TEST_SOURCE_DIR}/ptableTest.cpp) target_compile_options(hl_ptableTest PRIVATE "${HDF5_CMAKE_CXX_FLAGS}") -target_include_directories (hl_ptableTest PRIVATE "${HDF5_HL_SRC_DIR}/test;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_include_directories (hl_ptableTest PRIVATE "${HDF5_HL_SRC_DIR}/test;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (hl_ptableTest STATIC) target_link_libraries (hl_ptableTest PRIVATE diff --git a/hl/c++/test/CMakeTests.cmake b/hl/c++/test/CMakeTests.cmake index 5abbd47..4137270 100644 --- a/hl/c++/test/CMakeTests.cmake +++ b/hl/c++/test/CMakeTests.cmake @@ -15,12 +15,19 @@ ### T E S T I N G ### ############################################################################## ############################################################################## - +# Remove any output file left over from previous test run +set (HL_CPP_PT_CLEANFILES + packettest.h5 +) add_test ( NAME HL_CPP_ptableTest-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove ${example}.txt + -E remove ${HL_CPP_PT_CLEANFILES} ) +set_tests_properties (HL_CPP_ptableTest-clear-objects PROPERTIES + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} +) + if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME HL_CPP_ptableTest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:hl_ptableTest>) else () @@ -37,3 +44,12 @@ else () ) endif () set_tests_properties (HL_CPP_ptableTest PROPERTIES DEPENDS HL_CPP_ptableTest-clear-objects) +add_test ( + NAME HL_CPP_ptableTest-clean-objects + COMMAND ${CMAKE_COMMAND} + -E remove ${HL_CPP_PT_CLEANFILES} +) +set_tests_properties (HL_CPP_ptableTest-clean-objects PROPERTIES + DEPENDS HL_CPP_ptableTest + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} +) diff --git a/hl/examples/CMakeLists.txt b/hl/examples/CMakeLists.txt index 93ae9e8..f14d030 100644 --- a/hl/examples/CMakeLists.txt +++ b/hl/examples/CMakeLists.txt @@ -28,7 +28,7 @@ set (examples foreach (example ${examples}) add_executable (hl_ex_${example} ${HDF5_HL_EXAMPLES_SOURCE_DIR}/${example}.c) - target_include_directories (hl_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (hl_ex_${example} PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (hl_ex_${example} STATIC) target_link_libraries (hl_ex_${example} PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) diff --git a/hl/examples/CMakeTests.cmake b/hl/examples/CMakeTests.cmake index 6014f6c..6a0a6e7 100644 --- a/hl/examples/CMakeTests.cmake +++ b/hl/examples/CMakeTests.cmake @@ -27,31 +27,45 @@ endforeach () add_custom_target(hl_ex_ex_ds1_files ALL COMMENT "Copying files needed by hl_ex_ex_ds1 tests" DEPENDS ${hl_ex_ex_ds1_files_list}) # Remove any output file left over from previous test run +set (HL_EX_CLEANFILES + ex_lite1.h5 + ex_lite2.h5 + ex_lite3.h5 + packet_table_FLexample.h5 + ex_image1.h5 + ex_image2.h5 + ex_table_01.h5 + ex_table_02.h5 + ex_table_03.h5 + ex_table_04.h5 + ex_table_05.h5 + ex_table_06.h5 + ex_table_07.h5 + ex_table_08.h5 + ex_table_09.h5 + ex_table_10.h5 + ex_table_11.h5 + ex_table_12.h5 + ex_ds1.h5 +) add_test ( NAME HL_ex-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove - ex_lite1.h5 - ex_lite2.h5 - ex_lite3.h5 - packet_table_FLexample.h5 - ex_image1.h5 - ex_image2.h5 - ex_table_01.h5 - ex_table_02.h5 - ex_table_03.h5 - ex_table_04.h5 - ex_table_05.h5 - ex_table_06.h5 - ex_table_07.h5 - ex_table_08.h5 - ex_table_09.h5 - ex_table_10.h5 - ex_table_11.h5 - ex_table_12.h5 - ex_ds1.h5 + -E remove ${HL_EX_CLEANFILES} +) +set_tests_properties (HL_ex-clear-objects PROPERTIES + FIXTURES_SETUP clear_HL_ex + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} +) +add_test ( + NAME HL_ex-clean-objects + COMMAND ${CMAKE_COMMAND} + -E remove ${HL_EX_CLEANFILES} +) +set_tests_properties (HL_ex-clean-objects PROPERTIES + FIXTURES_CLEANUP clear_HL_ex + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} ) -set_tests_properties (HL_ex-clear-objects PROPERTIES FIXTURES_SETUP clear_HL_ex) foreach (example ${examples}) if (HDF5_ENABLE_USING_MEMCHECKER) diff --git a/hl/fortran/examples/CMakeTests.cmake b/hl/fortran/examples/CMakeTests.cmake index 6389fbe..46827b5 100644 --- a/hl/fortran/examples/CMakeTests.cmake +++ b/hl/fortran/examples/CMakeTests.cmake @@ -17,14 +17,28 @@ ############################################################################## # Remove any output file left over from previous test run +set (HL_FORTRAN_F90_EX_CLEANFILES + ex_ds1.h5 + exlite.h5 +) add_test ( NAME HL_FORTRAN_f90_ex-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove - ex_ds1.h5 - exlite.h5 + -E remove ${HL_FORTRAN_F90_EX_CLEANFILES} +) +set_tests_properties (HL_FORTRAN_f90_ex-clear-objects PROPERTIES + FIXTURES_SETUP clear_HL_FORTRAN_f90_ex + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} +) +add_test ( + NAME HL_FORTRAN_f90_ex-clean-objects + COMMAND ${CMAKE_COMMAND} + -E remove ${HL_FORTRAN_F90_EX_CLEANFILES} +) +set_tests_properties (HL_FORTRAN_f90_ex-clean-objects PROPERTIES + FIXTURES_CLEANUP clear_HL_FORTRAN_f90_ex + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} ) -set_tests_properties (HL_FORTRAN_f90_ex-clear-objects PROPERTIES FIXTURES_SETUP clear_HL_FORTRAN_f90_ex) foreach (example ${examples}) if (HDF5_ENABLE_USING_MEMCHECKER) @@ -44,5 +58,6 @@ foreach (example ${examples}) endif () set_tests_properties (HL_FORTRAN_f90_ex_${example} PROPERTIES FIXTURES_REQUIRED clear_HL_FORTRAN_f90_ex + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} ) endforeach () diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 538b689..5455d77 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -59,7 +59,7 @@ set (HDF5_HL_F90_HEADERS ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5LTf90proto.h ${HDF5_HL_ if (BUILD_STATIC_LIBS) add_library (${HDF5_HL_F90_C_LIB_TARGET} STATIC ${HDF5_HL_F90_C_SOURCES} ${HDF5_HL_F90_HEADERS}) target_include_directories (${HDF5_HL_F90_C_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" + PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) target_compile_options(${HDF5_HL_F90_C_LIB_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") @@ -76,7 +76,7 @@ endif () if (BUILD_SHARED_LIBS) add_library (${HDF5_HL_F90_C_LIBSH_TARGET} SHARED ${HDF5_HL_F90_C_SOURCES} ${HDF5_HL_F90_HEADERS}) target_include_directories (${HDF5_HL_F90_C_LIBSH_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" + PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) target_compile_options(${HDF5_HL_F90_C_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") @@ -235,16 +235,19 @@ endif () # Add file(s) to CMake Install #----------------------------------------------------------------------------- +set (mod_export_files + h5ds.mod + h5tb.mod + h5tb_const.mod + h5lt.mod + h5lt_const.mod + h5im.mod +) if (BUILD_STATIC_LIBS) - set (mod_files - ${MOD_BUILD_DIR}/h5ds.mod - ${MOD_BUILD_DIR}/h5tb.mod - ${MOD_BUILD_DIR}/h5tb_const.mod - ${MOD_BUILD_DIR}/h5lt.mod - ${MOD_BUILD_DIR}/h5lt_const.mod - ${MOD_BUILD_DIR}/h5im.mod - ) + foreach (mod_file ${mod_export_files}) + set (mod_files ${mod_files} ${MOD_BUILD_DIR}/${mod_file}) + endforeach () install ( FILES ${mod_files} @@ -265,14 +268,9 @@ if (BUILD_STATIC_LIBS) endif () endif () if (BUILD_SHARED_LIBS) - set (modsh_files - ${MODSH_BUILD_DIR}/h5ds.mod - ${MODSH_BUILD_DIR}/h5tb.mod - ${MODSH_BUILD_DIR}/h5tb_const.mod - ${MODSH_BUILD_DIR}/h5lt.mod - ${MODSH_BUILD_DIR}/h5lt_const.mod - ${MODSH_BUILD_DIR}/h5im.mod - ) + foreach (mod_file ${mod_export_files}) + set (modsh_files ${modsh_files} ${MODSH_BUILD_DIR}/${mod_file}) + endforeach () install ( FILES ${modsh_files} diff --git a/hl/fortran/test/CMakeTests.cmake b/hl/fortran/test/CMakeTests.cmake index e082f4c..209186b 100644 --- a/hl/fortran/test/CMakeTests.cmake +++ b/hl/fortran/test/CMakeTests.cmake @@ -17,15 +17,15 @@ ############################################################################## set (test_hl_fortran_CLEANFILES - dsetf1.h5 - dsetf2.h5 - dsetf3.h5 - dsetf4.h5 - dsetf5.h5 - f1img.h5 - f1tab.h5 - f2tab.h5 - tstds.h5 + dsetf1.h5 + dsetf2.h5 + dsetf3.h5 + dsetf4.h5 + dsetf5.h5 + f1img.h5 + f1tab.h5 + f2tab.h5 + tstds.h5 ) # Remove any output file left over from previous test run @@ -34,7 +34,19 @@ add_test ( COMMAND ${CMAKE_COMMAND} -E remove ${test_hl_fortran_CLEANFILES} ) -set_tests_properties (HL_FORTRAN_test-clear-objects PROPERTIES FIXTURES_SETUP clear_HL_FORTRAN_test) +set_tests_properties (HL_FORTRAN_test-clear-objects PROPERTIES + FIXTURES_SETUP clear_HL_FORTRAN_test + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} +) +add_test ( + NAME HL_FORTRAN_test-clean-objects + COMMAND ${CMAKE_COMMAND} + -E remove ${test_hl_fortran_CLEANFILES} +) +set_tests_properties (HL_FORTRAN_test-clean-objects PROPERTIES + FIXTURES_CLEANUP clear_HL_FORTRAN_test + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} +) macro (ADD_H5_FORTRAN_TEST file) if (HDF5_ENABLE_USING_MEMCHECKER) @@ -54,6 +66,7 @@ macro (ADD_H5_FORTRAN_TEST file) endif () set_tests_properties (HL_FORTRAN_f90_${file} PROPERTIES FIXTURES_REQUIRED clear_HL_FORTRAN_test + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} ) endmacro () diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index 2700188..fafa0ef 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -43,7 +43,7 @@ set (HL_PRIVATE_HEADERS if (BUILD_STATIC_LIBS) add_library (${HDF5_HL_LIB_TARGET} STATIC ${HL_SOURCES} ${HL_HEADERS} ${HL_PRIVATE_HEADERS}) target_include_directories (${HDF5_HL_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" + PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) target_compile_options(${HDF5_HL_LIB_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") @@ -58,7 +58,7 @@ endif () if (BUILD_SHARED_LIBS) add_library (${HDF5_HL_LIBSH_TARGET} SHARED ${HL_SOURCES} ${HL_HEADERS} ${HL_PRIVATE_HEADERS}) target_include_directories (${HDF5_HL_LIBSH_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" + PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) target_compile_options(${HDF5_HL_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") diff --git a/hl/test/CMakeLists.txt b/hl/test/CMakeLists.txt index c619fc6..cec2458 100644 --- a/hl/test/CMakeLists.txt +++ b/hl/test/CMakeLists.txt @@ -20,7 +20,7 @@ configure_file (${HDF5_HL_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ON macro (HL_ADD_EXE hl_name) add_executable (hl_${hl_name} ${hl_name}.c) target_compile_options(hl_${hl_name} PRIVATE "${HDF5_CMAKE_C_FLAGS}") - target_include_directories (hl_${hl_name} PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (hl_${hl_name} PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (hl_${hl_name} STATIC) target_link_libraries (hl_${hl_name} PRIVATE @@ -58,7 +58,7 @@ HL_ADD_EXE (test_h5do_compat) # test_packet has two source files add_executable (hl_test_packet test_packet.c test_packet_vlen.c) target_compile_options(hl_test_packet PRIVATE "${HDF5_CMAKE_C_FLAGS}") -target_include_directories (hl_test_packet PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_include_directories (hl_test_packet PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (hl_test_packet STATIC) target_link_libraries (hl_test_packet PRIVATE @@ -90,7 +90,7 @@ endif () if (HDF5_BUILD_GENERATORS AND BUILD_STATIC_LIBS) add_executable (hl_gen_test_ds gen_test_ds.c) target_compile_options(hl_gen_test_ds PRIVATE "${HDF5_CMAKE_C_FLAGS}") - target_include_directories (hl_gen_test_ds PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (hl_gen_test_ds PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (hl_gen_test_ds STATIC) target_link_libraries (hl_gen_test_ds PRIVATE ${HDF5_HL_LIB_TARGET} @@ -108,7 +108,7 @@ if (HDF5_BUILD_GENERATORS AND BUILD_STATIC_LIBS) add_executable (hl_gen_test_ld gen_test_ld.c) target_compile_options(hl_gen_test_ld PRIVATE "${HDF5_CMAKE_C_FLAGS}") - target_include_directories (hl_gen_test_ld PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (hl_gen_test_ld PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (hl_gen_test_ld STATIC) target_link_libraries (hl_gen_test_ld PRIVATE ${HDF5_HL_LIB_TARGET} diff --git a/hl/test/CMakeTests.cmake b/hl/test/CMakeTests.cmake index cc4786e..9d3ff0c 100644 --- a/hl/test/CMakeTests.cmake +++ b/hl/test/CMakeTests.cmake @@ -81,7 +81,18 @@ add_test ( NAME HL_test-clear-objects COMMAND ${CMAKE_COMMAND} -E remove ${test_hl_CLEANFILES} ) -set_tests_properties (HL_test-clear-objects PROPERTIES FIXTURES_SETUP clear_test_hl) +set_tests_properties (HL_test-clear-objects PROPERTIES + FIXTURES_SETUP clear_test_hl + WORKING_DIRECTORY ${HDF5_HL_TEST_BINARY_DIR} +) +add_test ( + NAME HL_test-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove ${test_hl_CLEANFILES} +) +set_tests_properties (HL_test-clean-objects PROPERTIES + FIXTURES_CLEANUP clear_test_hl + WORKING_DIRECTORY ${HDF5_HL_TEST_BINARY_DIR} +) # -------------------------------------------------------------------- # Macro used to add a unit test diff --git a/hl/tools/CMakeLists.txt b/hl/tools/CMakeLists.txt index fd9b6d9..a0bd744 100644 --- a/hl/tools/CMakeLists.txt +++ b/hl/tools/CMakeLists.txt @@ -1,6 +1,12 @@ cmake_minimum_required (VERSION 3.12) project (HDF5_HL_TOOLS C) -add_subdirectory (gif2h5) +#----------------------------------------------------------------------------- +#-- Option to build the High level GIF Tools +#----------------------------------------------------------------------------- +option (HDF5_BUILD_HL_GIF_TOOLS "Build HDF5 HL GIF Tools" OFF) +if (HDF5_BUILD_HL_GIF_TOOLS) + add_subdirectory (gif2h5) +endif () add_subdirectory (h5watch) diff --git a/hl/tools/Makefile.am b/hl/tools/Makefile.am index 6687f40..9f93f67 100644 --- a/hl/tools/Makefile.am +++ b/hl/tools/Makefile.am @@ -18,7 +18,13 @@ include $(top_srcdir)/config/commence.am +if BUILD_TOOLS_HL_GIF_CONDITIONAL + TOOLS_GIF_DIR = gif2h5 +else + TOOLS_GIF_DIR = +endif + # All subdirectories -SUBDIRS=gif2h5 h5watch +SUBDIRS=h5watch $(TOOLS_GIF_DIR) include $(top_srcdir)/config/conclude.am diff --git a/hl/tools/gif2h5/CMakeLists.txt b/hl/tools/gif2h5/CMakeLists.txt index a797c80..8f18b09 100644 --- a/hl/tools/gif2h5/CMakeLists.txt +++ b/hl/tools/gif2h5/CMakeLists.txt @@ -17,7 +17,7 @@ set (GIF2H5_SOURCES if (BUILD_STATIC_LIBS) add_executable (gif2h5 ${GIF2H5_SOURCES}) target_compile_options(gif2h5 PRIVATE "${HDF5_CMAKE_C_FLAGS}") - target_include_directories (gif2h5 PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (gif2h5 PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (gif2h5 STATIC) target_link_libraries (gif2h5 PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (gif2h5 PROPERTIES FOLDER tools/hl) @@ -30,7 +30,7 @@ endif () if (BUILD_SHARED_LIBS) add_executable (gif2h5-shared ${GIF2H5_SOURCES}) target_compile_options(gif2h5-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") - target_include_directories (gif2h5-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (gif2h5-shared PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (gif2h5-shared SHARED) target_link_libraries (gif2h5-shared PRIVATE ${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TOOLS_LIBSH_TARGET}) set_target_properties (gif2h5-shared PROPERTIES FOLDER tools/hl) @@ -59,7 +59,7 @@ set (hdf2gif_SOURCES if (BUILD_STATIC_LIBS) add_executable (h52gif ${hdf2gif_SOURCES}) target_compile_options(h52gif PRIVATE "${HDF5_CMAKE_C_FLAGS}") - target_include_directories (h52gif PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h52gif PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h52gif STATIC) target_link_libraries (h52gif PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h52gif PROPERTIES FOLDER tools/hl) @@ -72,7 +72,7 @@ endif () if (BUILD_SHARED_LIBS) add_executable (h52gif-shared ${hdf2gif_SOURCES}) target_compile_options(h52gif-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") - target_include_directories (h52gif-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h52gif-shared PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h52gif-shared SHARED) target_link_libraries (h52gif-shared PRIVATE ${HDF5_HL_LIBSH_TARGET} PRIVATE ${HDF5_LIBSH_TARGET} ${HDF5_TOOLS_LIBSH_TARGET}) set_target_properties (h52gif-shared PROPERTIES FOLDER tools/hl) @@ -101,7 +101,7 @@ if (BUILD_TESTING AND HDF5_TEST_SERIAL) # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS AND BUILD_STATIC_LIBS) add_executable (hl_h52gifgentest ${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/h52gifgentst.c) - target_include_directories (hl_h52gifgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (hl_h52gifgentest PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (hl_h52gifgentest STATIC) target_link_libraries (hl_h52gifgentest PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (hl_h52gifgentest PROPERTIES FOLDER generator/tools/hl) diff --git a/hl/tools/gif2h5/CMakeTests.cmake b/hl/tools/gif2h5/CMakeTests.cmake index 36ea5f9..b2a8e27 100644 --- a/hl/tools/gif2h5/CMakeTests.cmake +++ b/hl/tools/gif2h5/CMakeTests.cmake @@ -28,16 +28,24 @@ HDFTEST_COPY_FILE("${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/testfiles/ex_image2.h5" "$ add_custom_target(gif2h5_files ALL COMMENT "Copying files needed by gif2h5 tests" DEPENDS ${gif2h5_files_list}) # Remove any output file left over from previous test run +set (HL_TOOLS_CLEANFILES + image1.gif + image1.h5 + image.gif + image24.gif +) add_test ( NAME HL_TOOLS-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove - image1.gif - image1.h5 - image.gif - image24.gif + -E remove ${HL_TOOLS_CLEANFILES} ) set_tests_properties (HL_TOOLS-clear-objects PROPERTIES FIXTURES_SETUP clear_tools_hl) +add_test ( + NAME HL_TOOLS-clean-objects + COMMAND ${CMAKE_COMMAND} + -E remove ${HL_TOOLS_CLEANFILES} +) +set_tests_properties (HL_TOOLS-clean-objects PROPERTIES FIXTURES_CLEANUP clear_tools_hl) add_test (NAME HL_TOOLS_gif2h5 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:gif2h5${tgt_file_ext}> testfiles/image1.gif image1.h5) set_tests_properties (HL_TOOLS_gif2h5 PROPERTIES diff --git a/hl/tools/h5watch/CMakeLists.txt b/hl/tools/h5watch/CMakeLists.txt index 6c667c7..9d07a1e 100644 --- a/hl/tools/h5watch/CMakeLists.txt +++ b/hl/tools/h5watch/CMakeLists.txt @@ -12,7 +12,7 @@ set (H5WATCH_SOURCES if (BUILD_STATIC_LIBS) add_executable (h5watch ${H5WATCH_SOURCES}) target_compile_options(h5watch PRIVATE "${HDF5_CMAKE_C_FLAGS}") - target_include_directories (h5watch PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5watch PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5watch STATIC) target_link_libraries (h5watch PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5watch PROPERTIES FOLDER tools/hl) @@ -21,7 +21,7 @@ endif () if (BUILD_SHARED_LIBS) add_executable (h5watch-shared ${H5WATCH_SOURCES}) target_compile_options(h5watch-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") - target_include_directories (h5watch-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5watch-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5watch-shared SHARED) target_link_libraries (h5watch-shared PRIVATE ${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TOOLS_LIBSH_TARGET}) set_target_properties (h5watch-shared PROPERTIES FOLDER tools/hl) @@ -46,7 +46,7 @@ if (BUILD_TESTING AND HDF5_TEST_SWMR AND HDF5_TEST_SERIAL) ) add_executable (extend_dset ${extend_dset_SOURCES}) target_compile_options(extend_dset PRIVATE "${HDF5_CMAKE_C_FLAGS}") - target_include_directories (extend_dset PRIVATE "${HDF5_HL_SRC_DIR}/test;${HDF5_HL_SRC_DIR}/src;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (extend_dset PRIVATE "${HDF5_HL_SRC_DIR}/test;${HDF5_HL_SRC_DIR}/src;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (BUILD_STATIC_LIBS) TARGET_C_PROPERTIES (extend_dset STATIC) target_link_libraries (extend_dset PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) @@ -65,7 +65,7 @@ if (BUILD_TESTING AND HDF5_TEST_SWMR AND HDF5_TEST_SERIAL) add_executable (h5watchgentest ${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/h5watchgentest.c) target_compile_options(h5watchgentest PRIVATE "${HDF5_CMAKE_C_FLAGS}") - target_include_directories (h5watchgentest PRIVATE "${HDF5_HL_SRC_DIR}/src;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5watchgentest PRIVATE "${HDF5_HL_SRC_DIR}/src;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (BUILD_STATIC_LIBS) TARGET_C_PROPERTIES (h5watchgentest STATIC) target_link_libraries (h5watchgentest PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) diff --git a/hl/tools/h5watch/CMakeTests.cmake b/hl/tools/h5watch/CMakeTests.cmake index 32b2b95..a7828b3 100644 --- a/hl/tools/h5watch/CMakeTests.cmake +++ b/hl/tools/h5watch/CMakeTests.cmake @@ -116,12 +116,6 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes macro (ADD_H5_WATCH resultfile resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5WATCH-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove ${resultfile}.h5 - ) - set_tests_properties (H5WATCH-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - add_test ( NAME H5WATCH-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" @@ -134,7 +128,7 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5WATCH-${resultfile} PROPERTIES - DEPENDS H5WATCH-${resultfile}-clear-objects + DEPENDS ${last_test} FIXTURES_REQUIRED gen_test_watch ) set (last_test "H5WATCH-${resultfile}") @@ -164,7 +158,12 @@ set_tests_properties (H5WATCH-clearall-objects PROPERTIES FIXTURES_REQUIRED swmr if (last_test) set_tests_properties (H5WATCH-clearall-objects PROPERTIES DEPENDS ${last_test}) endif () -set (last_test "H5WATCH-clearall-objects") +set (last_test "H5WATCH-cleanall-objects") +add_test ( + NAME H5WATCH-cleanall-objects + COMMAND ${CMAKE_COMMAND} -E remove WATCH.h5 +) +set_tests_properties (H5WATCH-cleanall-objects PROPERTIES FIXTURES_CLEANUP swmr_vfd_check_compat) ################################################################################################# # # @@ -189,7 +188,7 @@ set (last_test "H5WATCH-clearall-objects") add_test (NAME H5WATCH-h5watchgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5watchgentest>) set_tests_properties (H5WATCH-h5watchgentest PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" - DEPENDS "H5WATCH-clearall-objects" + DEPENDS H5WATCH-clearall-objects ) set_tests_properties (H5WATCH-h5watchgentest PROPERTIES FIXTURES_SETUP gen_test_watch) set_tests_properties (H5WATCH-h5watchgentest PROPERTIES FIXTURES_REQUIRED swmr_vfd_check_compat) diff --git a/java/examples/datasets/JavaDatasetExample.sh.in b/java/examples/datasets/JavaDatasetExample.sh.in index b299ff2..9683076 100644 --- a/java/examples/datasets/JavaDatasetExample.sh.in +++ b/java/examples/datasets/JavaDatasetExample.sh.in @@ -58,8 +58,8 @@ $top_builddir/java/src/jni/.libs/libhdf5_java.* $top_builddir/java/src/$JARFILE " LIST_JAR_TESTFILES=" -$HDFLIB_HOME/slf4j-api-1.7.33.jar -$HDFLIB_HOME/ext/slf4j-simple-1.7.33.jar +$HDFLIB_HOME/slf4j-api-2.0.6.jar +$HDFLIB_HOME/ext/slf4j-simple-2.0.6.jar " LIST_DATA_FILES=" $HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Alloc.txt @@ -222,7 +222,7 @@ JAVAEXEFLAGS=@H5_JAVAFLAGS@ COPY_LIBFILES_TO_BLDLIBDIR COPY_DATAFILES_TO_BLDDIR -CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.33.jar:"$BLDLIBDIR"/slf4j-simple-1.7.33.jar:"$TESTJARFILE"" +CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-2.0.6.jar:"$BLDLIBDIR"/slf4j-simple-2.0.6.jar:"$TESTJARFILE"" TEST=/usr/bin/test if [ ! -x /usr/bin/test ] diff --git a/java/examples/datasets/Makefile.am b/java/examples/datasets/Makefile.am index 8b71ced..d4bb666 100644 --- a/java/examples/datasets/Makefile.am +++ b/java/examples/datasets/Makefile.am @@ -27,7 +27,7 @@ classes: pkgpath = examples/datasets hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar -CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.33.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.33.jar:$$CLASSPATH +CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-2.0.6.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-2.0.6.jar:$$CLASSPATH jarfile = jar$(PACKAGE_TARNAME)datasets.jar diff --git a/java/examples/datatypes/CMakeLists.txt b/java/examples/datatypes/CMakeLists.txt index 47df1f8..c77a715 100644 --- a/java/examples/datatypes/CMakeLists.txt +++ b/java/examples/datatypes/CMakeLists.txt @@ -65,7 +65,7 @@ endforeach () if (BUILD_TESTING AND HDF5_TEST_EXAMPLES AND HDF5_TEST_SERIAL) get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<CONFIG:Debug>:${CMAKE_DEBUG_POSTFIX}>;") + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<OR:$<CONFIG:Debug>,$<CONFIG:Developer>>:${CMAKE_DEBUG_POSTFIX}>;") set (last_test "") foreach (example ${HDF_JAVA_EXAMPLES}) diff --git a/java/examples/datatypes/JavaDatatypeExample.sh.in b/java/examples/datatypes/JavaDatatypeExample.sh.in index a82d883..fc4a627 100644 --- a/java/examples/datatypes/JavaDatatypeExample.sh.in +++ b/java/examples/datatypes/JavaDatatypeExample.sh.in @@ -55,8 +55,8 @@ $top_builddir/java/src/jni/.libs/libhdf5_java.* $top_builddir/java/src/$JARFILE " LIST_JAR_TESTFILES=" -$HDFLIB_HOME/slf4j-api-1.7.33.jar -$HDFLIB_HOME/ext/slf4j-simple-1.7.33.jar +$HDFLIB_HOME/slf4j-api-2.0.6.jar +$HDFLIB_HOME/ext/slf4j-simple-2.0.6.jar " LIST_DATA_FILES=" $HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_Array.txt @@ -218,7 +218,7 @@ JAVAEXEFLAGS=@H5_JAVAFLAGS@ COPY_LIBFILES_TO_BLDLIBDIR COPY_DATAFILES_TO_BLDDIR -CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.33.jar:"$BLDLIBDIR"/slf4j-simple-1.7.33.jar:"$TESTJARFILE"" +CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-2.0.6.jar:"$BLDLIBDIR"/slf4j-simple-2.0.6.jar:"$TESTJARFILE"" TEST=/usr/bin/test if [ ! -x /usr/bin/test ] diff --git a/java/examples/datatypes/Makefile.am b/java/examples/datatypes/Makefile.am index 55ff91f..12e5cb8 100644 --- a/java/examples/datatypes/Makefile.am +++ b/java/examples/datatypes/Makefile.am @@ -27,7 +27,7 @@ classes: pkgpath = examples/datatypes hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar -CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.33.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.33.jar:$$CLASSPATH +CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-2.0.6.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-2.0.6.jar:$$CLASSPATH jarfile = jar$(PACKAGE_TARNAME)datatypes.jar diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt index fdaf95c..01da53c 100644 --- a/java/examples/groups/CMakeLists.txt +++ b/java/examples/groups/CMakeLists.txt @@ -64,7 +64,7 @@ add_custom_target(H5Ex_G_Visit_files ALL COMMENT "Copying files needed by H5Ex_G if (BUILD_TESTING AND HDF5_TEST_EXAMPLES AND HDF5_TEST_SERIAL) get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<CONFIG:Debug>:${CMAKE_DEBUG_POSTFIX}>;") + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<OR:$<CONFIG:Debug>,$<CONFIG:Developer>>:${CMAKE_DEBUG_POSTFIX}>;") set (last_test "") foreach (example ${HDF_JAVA_EXAMPLES}) diff --git a/java/examples/groups/JavaGroupExample.sh.in b/java/examples/groups/JavaGroupExample.sh.in index 1b84ed3..4773579 100644 --- a/java/examples/groups/JavaGroupExample.sh.in +++ b/java/examples/groups/JavaGroupExample.sh.in @@ -57,8 +57,8 @@ $top_builddir/java/src/jni/.libs/libhdf5_java.* $top_builddir/java/src/$JARFILE " LIST_JAR_TESTFILES=" -$HDFLIB_HOME/slf4j-api-1.7.33.jar -$HDFLIB_HOME/ext/slf4j-simple-1.7.33.jar +$HDFLIB_HOME/slf4j-api-2.0.6.jar +$HDFLIB_HOME/ext/slf4j-simple-2.0.6.jar " LIST_ITER_FILES=" $HDFTEST_HOME/h5ex_g_iterate.h5 @@ -257,7 +257,7 @@ COPY_LIBFILES_TO_BLDLIBDIR COPY_DATAFILES_TO_BLDDIR COPY_ITERFILES_TO_BLDITERDIR -CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.33.jar:"$BLDLIBDIR"/slf4j-simple-1.7.33.jar:"$TESTJARFILE"" +CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-2.0.6.jar:"$BLDLIBDIR"/slf4j-simple-2.0.6.jar:"$TESTJARFILE"" TEST=/usr/bin/test if [ ! -x /usr/bin/test ] diff --git a/java/examples/groups/Makefile.am b/java/examples/groups/Makefile.am index c520860..a3fb774 100644 --- a/java/examples/groups/Makefile.am +++ b/java/examples/groups/Makefile.am @@ -27,7 +27,7 @@ classes: pkgpath = examples/groups hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar -CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.33.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.33.jar:$$CLASSPATH +CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-2.0.6.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-2.0.6.jar:$$CLASSPATH jarfile = jar$(PACKAGE_TARNAME)groups.jar diff --git a/java/examples/intro/CMakeLists.txt b/java/examples/intro/CMakeLists.txt index f744559..518bbf8 100644 --- a/java/examples/intro/CMakeLists.txt +++ b/java/examples/intro/CMakeLists.txt @@ -54,7 +54,7 @@ endforeach () if (BUILD_TESTING AND HDF5_TEST_EXAMPLES AND HDF5_TEST_SERIAL) get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<CONFIG:Debug>:${CMAKE_DEBUG_POSTFIX}>;") + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<OR:$<CONFIG:Debug>,$<CONFIG:Developer>>:${CMAKE_DEBUG_POSTFIX}>;") set (last_test "") foreach (example ${HDF_JAVA_EXAMPLES}) diff --git a/java/examples/intro/JavaIntroExample.sh.in b/java/examples/intro/JavaIntroExample.sh.in index 41ed694..56b6e57 100644 --- a/java/examples/intro/JavaIntroExample.sh.in +++ b/java/examples/intro/JavaIntroExample.sh.in @@ -55,8 +55,8 @@ $top_builddir/java/src/jni/.libs/libhdf5_java.* $top_builddir/java/src/$JARFILE " LIST_JAR_TESTFILES=" -$HDFLIB_HOME/slf4j-api-1.7.33.jar -$HDFLIB_HOME/ext/slf4j-simple-1.7.33.jar +$HDFLIB_HOME/slf4j-api-2.0.6.jar +$HDFLIB_HOME/ext/slf4j-simple-2.0.6.jar " LIST_DATA_FILES=" $HDFTEST_HOME/../testfiles/examples.intro.H5_CreateDataset.txt @@ -207,7 +207,7 @@ JAVAEXEFLAGS=@H5_JAVAFLAGS@ COPY_LIBFILES_TO_BLDLIBDIR COPY_DATAFILES_TO_BLDDIR -CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.33.jar:"$BLDLIBDIR"/slf4j-simple-1.7.33.jar:"$TESTJARFILE"" +CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-2.0.6.jar:"$BLDLIBDIR"/slf4j-simple-2.0.6.jar:"$TESTJARFILE"" TEST=/usr/bin/test if [ ! -x /usr/bin/test ] diff --git a/java/examples/intro/Makefile.am b/java/examples/intro/Makefile.am index 741f122..b6d6a1f 100644 --- a/java/examples/intro/Makefile.am +++ b/java/examples/intro/Makefile.am @@ -27,7 +27,7 @@ classes: pkgpath = examples/intro hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar -CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.33.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.33.jar:$$CLASSPATH +CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-2.0.6.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-2.0.6.jar:$$CLASSPATH jarfile = jar$(PACKAGE_TARNAME)intro.jar diff --git a/java/lib/ext/slf4j-nop-1.7.33.jar b/java/lib/ext/slf4j-nop-1.7.33.jar Binary files differdeleted file mode 100644 index aa8fc09..0000000 --- a/java/lib/ext/slf4j-nop-1.7.33.jar +++ /dev/null diff --git a/java/lib/ext/slf4j-nop-2.0.6.jar b/java/lib/ext/slf4j-nop-2.0.6.jar Binary files differnew file mode 100644 index 0000000..27740a5 --- /dev/null +++ b/java/lib/ext/slf4j-nop-2.0.6.jar diff --git a/java/lib/ext/slf4j-simple-1.7.33.jar b/java/lib/ext/slf4j-simple-1.7.33.jar Binary files differdeleted file mode 100644 index ebf4846..0000000 --- a/java/lib/ext/slf4j-simple-1.7.33.jar +++ /dev/null diff --git a/java/lib/ext/slf4j-simple-2.0.6.jar b/java/lib/ext/slf4j-simple-2.0.6.jar Binary files differnew file mode 100644 index 0000000..f8913c0 --- /dev/null +++ b/java/lib/ext/slf4j-simple-2.0.6.jar diff --git a/java/lib/slf4j-api-1.7.33.jar b/java/lib/slf4j-api-1.7.33.jar Binary files differdeleted file mode 100644 index db3730d..0000000 --- a/java/lib/slf4j-api-1.7.33.jar +++ /dev/null diff --git a/java/lib/slf4j-api-2.0.6.jar b/java/lib/slf4j-api-2.0.6.jar Binary files differnew file mode 100644 index 0000000..a2cb802 --- /dev/null +++ b/java/lib/slf4j-api-2.0.6.jar diff --git a/java/src/Makefile.am b/java/src/Makefile.am index 67d21f8..35232ff 100644 --- a/java/src/Makefile.am +++ b/java/src/Makefile.am @@ -36,7 +36,7 @@ jarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar hdf5_javadir = $(libdir) pkgpath = hdf/hdf5lib -CLASSPATH_ENV=CLASSPATH=.:$(top_srcdir)/java/lib/slf4j-api-1.7.33.jar:$$CLASSPATH +CLASSPATH_ENV=CLASSPATH=.:$(top_srcdir)/java/lib/slf4j-api-2.0.6.jar:$$CLASSPATH AM_JAVACFLAGS = $(H5_JAVACFLAGS) -deprecation diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index 90c4575..78ce2a0 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -57,6 +57,9 @@ import hdf.hdf5lib.structs.H5O_info_t; import hdf.hdf5lib.structs.H5O_native_info_t; import hdf.hdf5lib.structs.H5O_token_t; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + /** * @page HDF5LIB HDF5 Java API Package * This class is the Java interface for the HDF5 library. @@ -257,7 +260,7 @@ public class H5 implements java.io.Serializable { */ private static final long serialVersionUID = 6129888282117053288L; - private final static org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(H5.class); + private final static Logger log = LoggerFactory.getLogger(H5.class); /** * @ingroup JH5 diff --git a/java/src/jni/CMakeLists.txt b/java/src/jni/CMakeLists.txt index ab306ef..fc11c1b 100644 --- a/java/src/jni/CMakeLists.txt +++ b/java/src/jni/CMakeLists.txt @@ -78,7 +78,7 @@ set (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) ########### JNI libraries always must be built shared ############### add_library (${HDF5_JAVA_JNI_LIB_TARGET} SHARED ${HDF5_JAVA_JNI_CSRCS} ${HDF5_JAVA_JNI_CHDRS}) target_include_directories (${HDF5_JAVA_JNI_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_JAVA_JNI_SOURCE_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" + PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};${HDF5_JAVA_JNI_SOURCE_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" ) target_compile_options(${HDF5_JAVA_JNI_LIB_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (${HDF5_JAVA_JNI_LIB_TARGET} SHARED) @@ -106,7 +106,7 @@ if (HDF5_EXPORTED_TARGETS) ${HDF5_EXPORTED_TARGETS} LIBRARY DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT libraries ARCHIVE DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT libraries - RUNTIME DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT libraries + RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT libraries FRAMEWORK DESTINATION ${HDF5_INSTALL_FWRK_DIR} COMPONENT libraries INCLUDES DESTINATION include ) diff --git a/java/src/jni/h5aImp.c b/java/src/jni/h5aImp.c index 4b531a6..00c39da 100644 --- a/java/src/jni/h5aImp.c +++ b/java/src/jni/h5aImp.c @@ -155,13 +155,15 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Aread(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jbyteArray buf, jboolean isCriticalPinning) { - jboolean readBufIsCopy; - jbyte *readBuf = NULL; - hsize_t dims[H5S_MAX_RANK]; - hid_t sid = H5I_INVALID_HID; - jsize n; - htri_t vl_data_class; - herr_t status = FAIL; + jboolean readBufIsCopy; + jbyte *readBuf = NULL; + hsize_t dims[H5S_MAX_RANK]; + hid_t sid = H5I_INVALID_HID; + size_t typeSize; + H5T_class_t type_class; + jsize vl_array_len = 0; // Only used by vl_data_class types + htri_t vl_data_class; + herr_t status = FAIL; UNUSED(clss); @@ -173,40 +175,58 @@ Java_hdf_hdf5lib_H5_H5Aread(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_t if (vl_data_class) { /* Get size of data array */ - if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) { - CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + if ((vl_array_len = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread: readBuf length < 0"); - } - dims[0] = (hsize_t)n; - if ((sid = H5Screate_simple(1, dims, NULL)) < 0) + if (!(typeSize = H5Tget_size(mem_type_id))) H5_LIBRARY_ERROR(ENVONLY); - } - if (isCriticalPinning) { - PIN_BYTE_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, - "H5Aread: read buffer not critically pinned"); + if (NULL == (readBuf = HDcalloc((size_t)vl_array_len, typeSize))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Aread: failed to allocate raw VL read buffer"); } else { - PIN_BYTE_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread: read buffer not pinned"); + if (isCriticalPinning) { + PIN_BYTE_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, + "H5Aread: read buffer not critically pinned"); + } + else { + PIN_BYTE_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread: read buffer not pinned"); + } } if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, (void *)readBuf)) < 0) H5_LIBRARY_ERROR(ENVONLY); + if (vl_data_class) { + if ((type_class = H5Tget_class((hid_t)mem_type_id)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + translate_rbuf(env, buf, mem_type_id, type_class, vl_array_len, readBuf); + } + done: if (readBuf) { if ((status >= 0) && vl_data_class) { + dims[0] = (hsize_t)vl_array_len; + if ((sid = H5Screate_simple(1, dims, NULL)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + H5Treclaim(attr_id, sid, H5P_DEFAULT, readBuf); + if (sid >= 0) H5Sclose(sid); } - if (isCriticalPinning) { - UNPIN_ARRAY_CRITICAL(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0); + if (vl_data_class) { + HDfree(readBuf); } else { - UNPIN_BYTE_ARRAY(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0); + if (isCriticalPinning) { + UNPIN_ARRAY_CRITICAL(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0); + } + else { + UNPIN_BYTE_ARRAY(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0); + } } } @@ -222,38 +242,52 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Awrite(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jbyteArray buf, jboolean isCriticalPinning) { - jboolean writeBufIsCopy; - jbyte *writeBuf = NULL; - hsize_t dims[H5S_MAX_RANK]; - hid_t sid = H5I_INVALID_HID; - jsize n; - htri_t vl_data_class; - herr_t status = FAIL; + jboolean writeBufIsCopy; + jbyte *writeBuf = NULL; + hsize_t dims[H5S_MAX_RANK]; + hid_t sid = H5I_INVALID_HID; + size_t typeSize; + H5T_class_t type_class; + jsize vl_array_len = 0; // Only used by vl_data_class types + htri_t vl_data_class; + herr_t status = FAIL; UNUSED(clss); if (NULL == buf) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Awrite: write buffer is NULL"); - /* Get size of data array */ - if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) { - CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread: readBuf length < 0"); - } - - dims[0] = (hsize_t)n; - if ((sid = H5Screate_simple(1, dims, NULL)) < 0) - H5_LIBRARY_ERROR(ENVONLY); - if ((vl_data_class = h5str_detect_vlen(mem_type_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); - if (isCriticalPinning) { - PIN_BYTE_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, - "H5Awrite: write buffer not critically pinned"); + if (vl_data_class) { + /* Get size of data array */ + if ((vl_array_len = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) { + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite: write buffer length < 0"); + } + + if (!(typeSize = H5Tget_size(mem_type_id))) + H5_LIBRARY_ERROR(ENVONLY); + + if (NULL == (writeBuf = HDcalloc((size_t)vl_array_len, typeSize))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Awrite: failed to allocate raw VL write buffer"); } else { - PIN_BYTE_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite: write buffer not pinned"); + if (isCriticalPinning) { + PIN_BYTE_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, + "H5Awrite: write buffer not critically pinned"); + } + else { + PIN_BYTE_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite: write buffer not pinned"); + } + } + + if (vl_data_class) { + if ((type_class = H5Tget_class((hid_t)mem_type_id)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + translate_wbuf(ENVONLY, buf, mem_type_id, type_class, vl_array_len, writeBuf); } if ((status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, writeBuf)) < 0) @@ -261,14 +295,24 @@ Java_hdf_hdf5lib_H5_H5Awrite(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_ done: if (writeBuf) { - if ((status >= 0) && vl_data_class) + if ((status >= 0) && vl_data_class) { + dims[0] = (hsize_t)vl_array_len; + if ((sid = H5Screate_simple(1, dims, NULL)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + H5Treclaim(attr_id, sid, H5P_DEFAULT, writeBuf); + } - if (isCriticalPinning) { - UNPIN_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0); + if (vl_data_class) { + HDfree(writeBuf); } else { - UNPIN_BYTE_ARRAY(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0); + if (isCriticalPinning) { + UNPIN_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0); + } + else { + UNPIN_BYTE_ARRAY(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0); + } } } @@ -1063,13 +1107,15 @@ done: JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5AreadVL(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf) { - H5T_class_t type_class; + jbyte *readBuf = NULL; hsize_t dims[H5S_MAX_RANK]; hid_t sid = H5I_INVALID_HID; - jsize n = 0; + size_t typeSize; + H5T_class_t type_class; + jsize vl_array_len; htri_t vl_data_class; - herr_t status = FAIL; - jbyteArray *readBuf = NULL; + herr_t status = FAIL; + htri_t is_variable = 0; UNUSED(clss); @@ -1078,228 +1124,42 @@ Java_hdf_hdf5lib_H5_H5AreadVL(JNIEnv *env, jclass clss, jlong attr_id, jlong mem if ((vl_data_class = h5str_detect_vlen(mem_type_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); + /* Get size of data array */ + if ((vl_array_len = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread: readBuf length < 0"); + if ((is_variable = H5Tis_variable_str(mem_type_id)) < 0) + H5_LIBRARY_ERROR(ENVONLY); - if (vl_data_class) { - /* Get size of data array */ - if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) { - CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5AreadVL: readBuf length < 0"); - } + if (!(typeSize = H5Tget_size(mem_type_id))) + H5_LIBRARY_ERROR(ENVONLY); - dims[0] = (hsize_t)n; - if ((sid = H5Screate_simple(1, dims, NULL)) < 0) - H5_LIBRARY_ERROR(ENVONLY); - } + if (NULL == (readBuf = HDcalloc((size_t)vl_array_len, typeSize))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Aread: failed to allocate raw VL read buffer"); + if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, (void *)readBuf)) < 0) + H5_LIBRARY_ERROR(ENVONLY); if ((type_class = H5Tget_class((hid_t)mem_type_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); - if (type_class == H5T_VLEN) { - size_t typeSize; - hid_t memb = H5I_INVALID_HID; - H5T_class_t vlClass; - size_t vlSize; - void *rawBuf = NULL; - jobjectArray jList = NULL; - - size_t i, j, x; - - if (!(typeSize = H5Tget_size(mem_type_id))) - H5_LIBRARY_ERROR(ENVONLY); - - if (!(memb = H5Tget_super(mem_type_id))) - H5_LIBRARY_ERROR(ENVONLY); - if ((vlClass = H5Tget_class((hid_t)memb)) < 0) - H5_LIBRARY_ERROR(ENVONLY); - if (!(vlSize = H5Tget_size(memb))) - H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (rawBuf = HDcalloc((size_t)n, typeSize))) - H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AreadVL: failed to allocate raw VL read buffer"); - - if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, (void *)rawBuf)) < 0) - H5_LIBRARY_ERROR(ENVONLY); - - /* Cache class types */ - /* jclass cBool = ENVPTR->FindClass(ENVONLY, "java/lang/Boolean"); */ - jclass cByte = ENVPTR->FindClass(ENVONLY, "java/lang/Byte"); - jclass cShort = ENVPTR->FindClass(ENVONLY, "java/lang/Short"); - jclass cInt = ENVPTR->FindClass(ENVONLY, "java/lang/Integer"); - jclass cLong = ENVPTR->FindClass(ENVONLY, "java/lang/Long"); - jclass cFloat = ENVPTR->FindClass(ENVONLY, "java/lang/Float"); - jclass cDouble = ENVPTR->FindClass(ENVONLY, "java/lang/Double"); - - /* - jmethodID boolValueMid = - ENVPTR->GetStaticMethodID(ENVONLY, cBool, "valueOf", "(Z)Ljava/lang/Boolean;"); - */ - jmethodID byteValueMid = ENVPTR->GetStaticMethodID(ENVONLY, cByte, "valueOf", "(B)Ljava/lang/Byte;"); - jmethodID shortValueMid = - ENVPTR->GetStaticMethodID(ENVONLY, cShort, "valueOf", "(S)Ljava/lang/Short;"); - jmethodID intValueMid = ENVPTR->GetStaticMethodID(ENVONLY, cInt, "valueOf", "(I)Ljava/lang/Integer;"); - jmethodID longValueMid = ENVPTR->GetStaticMethodID(ENVONLY, cLong, "valueOf", "(J)Ljava/lang/Long;"); - jmethodID floatValueMid = - ENVPTR->GetStaticMethodID(ENVONLY, cFloat, "valueOf", "(F)Ljava/lang/Float;"); - jmethodID doubleValueMid = - ENVPTR->GetStaticMethodID(ENVONLY, cDouble, "valueOf", "(D)Ljava/lang/Double;"); - - // retrieve the java.util.List interface class - jclass cList = ENVPTR->FindClass(ENVONLY, "java/util/List"); - jmethodID addMethod = ENVPTR->GetMethodID(ENVONLY, cList, "add", "(Ljava/lang/Object;)Z"); - - /* Convert each element to a list */ - for (i = 0; i < (size_t)n; i++) { - hvl_t vl_elem; - - // The list we're going to return: - if (NULL == (jList = ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)buf, (jsize)i))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - - /* Get the number of sequence elements */ - HDmemcpy(&vl_elem, (char *)rawBuf + i * typeSize, sizeof(hvl_t)); - - jsize nelmts = (jsize)vl_elem.len; - if (vl_elem.len != (size_t)nelmts) - H5_JNI_FATAL_ERROR(ENVONLY, "H5AreadVL: overflow of number of VL elements"); - if (nelmts < 0) - H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5AreadVL: number of VL elements < 0"); - - jobject jobj = NULL; - for (j = 0; j < (size_t)nelmts; j++) { - switch (vlClass) { - /* case H5T_BOOL: { - jboolean boolValue; - for (x = 0; x < vlSize; x++) { - ((char *)&boolValue)[x] = ((char *)vl_elem.p)[j*vlSize+x]; - } - - jobj = ENVPTR->CallStaticObjectMethod(ENVONLY, cBool, boolValueMid, boolValue); - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - break; - } */ - case H5T_INTEGER: { - switch (vlSize) { - case sizeof(jbyte): { - jbyte byteValue; - for (x = 0; x < vlSize; x++) { - ((char *)&byteValue)[x] = ((char *)vl_elem.p)[j * vlSize + x]; - } - - jobj = - ENVPTR->CallStaticObjectMethod(ENVONLY, cByte, byteValueMid, byteValue); - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - break; - } - case sizeof(jshort): { - jshort shortValue; - for (x = 0; x < vlSize; x++) { - ((char *)&shortValue)[x] = ((char *)vl_elem.p)[j * vlSize + x]; - } - - jobj = ENVPTR->CallStaticObjectMethod(ENVONLY, cShort, shortValueMid, - shortValue); - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - break; - } - case sizeof(jint): { - jint intValue; - for (x = 0; x < vlSize; x++) { - ((char *)&intValue)[x] = ((char *)vl_elem.p)[j * vlSize + x]; - } - - jobj = ENVPTR->CallStaticObjectMethod(ENVONLY, cInt, intValueMid, intValue); - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - break; - } - case sizeof(jlong): { - jlong longValue; - for (x = 0; x < vlSize; x++) { - ((char *)&longValue)[x] = ((char *)vl_elem.p)[j * vlSize + x]; - } - - jobj = - ENVPTR->CallStaticObjectMethod(ENVONLY, cLong, longValueMid, longValue); - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - break; - } - } - break; - } - case H5T_FLOAT: { - switch (vlSize) { - case sizeof(jfloat): { - jfloat floatValue; - for (x = 0; x < vlSize; x++) { - ((char *)&floatValue)[x] = ((char *)vl_elem.p)[j * vlSize + x]; - } - - jobj = ENVPTR->CallStaticObjectMethod(ENVONLY, cFloat, floatValueMid, - (double)floatValue); - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - break; - } - case sizeof(jdouble): { - jdouble doubleValue; - for (x = 0; x < vlSize; x++) { - ((char *)&doubleValue)[x] = ((char *)vl_elem.p)[j * vlSize + x]; - } - - jobj = ENVPTR->CallStaticObjectMethod(ENVONLY, cDouble, doubleValueMid, - doubleValue); - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - break; - } - } - break; - } - case H5T_REFERENCE: { - jboolean bb; - jbyte *barray = NULL; - - jsize byteArraySize = (jsize)vlSize; - if (vlSize != (size_t)byteArraySize) - H5_JNI_FATAL_ERROR(ENVONLY, "H5AreadVL: overflow of byteArraySize"); - - if (NULL == (jobj = ENVPTR->NewByteArray(ENVONLY, byteArraySize))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - - PIN_BYTE_ARRAY(ENVONLY, (jbyteArray)jobj, barray, &bb, - "readVL reference: byte array not pinned"); - - for (x = 0; x < vlSize; x++) { - barray[x] = ((jbyte *)vl_elem.p)[j * vlSize + x]; - } - if (barray) - UNPIN_BYTE_ARRAY(ENVONLY, (jbyteArray)jobj, barray, jobj ? 0 : JNI_ABORT); - break; - } - default: - H5_UNIMPLEMENTED(ENVONLY, "H5AreadVL: invalid class type"); - break; - } - - // Add it to the list - ENVPTR->CallBooleanMethod(ENVONLY, jList, addMethod, jobj); - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - } - } /* end for */ - - if (rawBuf) - HDfree(rawBuf); - } - else { - if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, (void *)readBuf)) < 0) - H5_LIBRARY_ERROR(ENVONLY); - } + translate_rbuf(env, buf, mem_type_id, type_class, vl_array_len, readBuf); done: if (readBuf) { if ((status >= 0) && vl_data_class) { + dims[0] = (hsize_t)vl_array_len; + if ((sid = H5Screate_simple(1, dims, NULL)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + H5Treclaim(attr_id, sid, H5P_DEFAULT, readBuf); + if (sid >= 0) H5Sclose(sid); } - - UNPIN_BYTE_ARRAY(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0); + if (is_variable) { + for (size_t i = 0; i < (size_t)vl_array_len; i++) + HDfree(((char **)readBuf)[i]); + } + HDfree(readBuf); } return (jint)status; @@ -1313,205 +1173,61 @@ done: JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5AwriteVL(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf) { - H5T_class_t type_class; + jbyte *writeBuf = NULL; hsize_t dims[H5S_MAX_RANK]; hid_t sid = H5I_INVALID_HID; - jsize n; + size_t typeSize; + H5T_class_t type_class; + jsize vl_array_len; htri_t vl_data_class; - herr_t status = FAIL; - jboolean writeBufIsCopy; - jbyteArray writeBuf = NULL; + herr_t status = FAIL; + htri_t is_variable = 0; UNUSED(clss); if (NULL == buf) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5AwriteVL: write buffer is NULL"); + if ((vl_data_class = h5str_detect_vlen(mem_type_id)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + /* Get size of data array */ - if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) { + if ((vl_array_len = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5AwriteVL: readBuf length < 0"); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite: write buffer length < 0"); } - - dims[0] = (hsize_t)n; - if ((sid = H5Screate_simple(1, dims, NULL)) < 0) + if ((is_variable = H5Tis_variable_str(mem_type_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); - if ((vl_data_class = h5str_detect_vlen(mem_type_id)) < 0) + if (!(typeSize = H5Tget_size(mem_type_id))) H5_LIBRARY_ERROR(ENVONLY); + if (NULL == (writeBuf = HDcalloc((size_t)vl_array_len, typeSize))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Awrite: failed to allocate raw VL write buffer"); + if ((type_class = H5Tget_class((hid_t)mem_type_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); - if (type_class == H5T_VLEN) { - size_t typeSize; - hid_t memb = H5I_INVALID_HID; - H5T_class_t vlClass; - size_t vlSize; - void *rawBuf = NULL; - jobjectArray jList = NULL; - - size_t i, j, x; - if (!(typeSize = H5Tget_size(mem_type_id))) - H5_LIBRARY_ERROR(ENVONLY); - - if (!(memb = H5Tget_super(mem_type_id))) - H5_LIBRARY_ERROR(ENVONLY); - if ((vlClass = H5Tget_class((hid_t)memb)) < 0) - H5_LIBRARY_ERROR(ENVONLY); - if (!(vlSize = H5Tget_size(memb))) - H5_LIBRARY_ERROR(ENVONLY); - - if (NULL == (rawBuf = HDcalloc((size_t)n, typeSize))) - H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AwriteVL: failed to allocate raw VL write buffer"); - - /* Cache class types */ - /* jclass cBool = ENVPTR->FindClass(ENVONLY, "java/lang/Boolean"); */ - jclass cByte = ENVPTR->FindClass(ENVONLY, "java/lang/Byte"); - jclass cShort = ENVPTR->FindClass(ENVONLY, "java/lang/Short"); - jclass cInt = ENVPTR->FindClass(ENVONLY, "java/lang/Integer"); - jclass cLong = ENVPTR->FindClass(ENVONLY, "java/lang/Long"); - jclass cFloat = ENVPTR->FindClass(ENVONLY, "java/lang/Float"); - jclass cDouble = ENVPTR->FindClass(ENVONLY, "java/lang/Double"); - - /* jmethodID boolValueMid = ENVPTR->GetMethodID(ENVONLY, cBool, "booleanValue", "()Z"); */ - jmethodID byteValueMid = ENVPTR->GetMethodID(ENVONLY, cByte, "byteValue", "()B"); - jmethodID shortValueMid = ENVPTR->GetMethodID(ENVONLY, cShort, "shortValue", "()S"); - jmethodID intValueMid = ENVPTR->GetMethodID(ENVONLY, cInt, "intValue", "()I"); - jmethodID longValueMid = ENVPTR->GetMethodID(ENVONLY, cLong, "longValue", "()J"); - jmethodID floatValueMid = ENVPTR->GetMethodID(ENVONLY, cFloat, "floatValue", "()F"); - jmethodID doubleValueMid = ENVPTR->GetMethodID(ENVONLY, cDouble, "doubleValue", "()D"); - - /* Convert each list to a vlen element */ - for (i = 0; i < (size_t)n; i++) { - hvl_t vl_elem; - - if (NULL == (jList = ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)buf, (jsize)i))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - - // retrieve the java.util.List interface class - jclass cList = ENVPTR->FindClass(ENVONLY, "java/util/List"); - - // retrieve the toArray method and invoke it - jmethodID mToArray = ENVPTR->GetMethodID(ENVONLY, cList, "toArray", "()[Ljava/lang/Object;"); - if (mToArray == NULL) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - jobjectArray array = (jobjectArray)ENVPTR->CallObjectMethod(ENVONLY, jList, mToArray); - jsize jnelmts = ENVPTR->GetArrayLength(ENVONLY, array); - - if (jnelmts < 0) - H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5AwriteVL: number of VL elements < 0"); - - HDmemcpy(&vl_elem, (char *)rawBuf + i * typeSize, sizeof(hvl_t)); - vl_elem.len = (size_t)jnelmts; - - if (NULL == (vl_elem.p = HDmalloc((size_t)jnelmts * vlSize))) - H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AwriteVL: failed to allocate vlen ptr buffer"); - - jobject jobj = NULL; - for (j = 0; j < (size_t)jnelmts; j++) { - if (NULL == (jobj = ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)array, (jsize)j))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - - switch (vlClass) { - /* case H5T_BOOL: { - jboolean boolValue = ENVPTR->CallBooleanMethod(ENVONLY, jobj, boolValueMid); - for (x = 0; x < vlSize; x++) { - ((char *)vl_elem.p)[j * vlSize + x] = ((char *)&boolValue)[x]; - } - break; - } */ - case H5T_INTEGER: { - switch (vlSize) { - case sizeof(jbyte): { - jbyte byteValue = ENVPTR->CallByteMethod(ENVONLY, jobj, byteValueMid); - for (x = 0; x < vlSize; x++) { - ((char *)vl_elem.p)[j * vlSize + x] = ((char *)&byteValue)[x]; - } - break; - } - case sizeof(jshort): { - jshort shortValue = ENVPTR->CallShortMethod(ENVONLY, jobj, shortValueMid); - for (x = 0; x < vlSize; x++) { - ((char *)vl_elem.p)[j * vlSize + x] = ((char *)&shortValue)[x]; - } - break; - } - case sizeof(jint): { - jint intValue = ENVPTR->CallIntMethod(ENVONLY, jobj, intValueMid); - for (x = 0; x < vlSize; x++) { - ((char *)vl_elem.p)[j * vlSize + x] = ((char *)&intValue)[x]; - } - break; - } - case sizeof(jlong): { - jlong longValue = ENVPTR->CallLongMethod(ENVONLY, jobj, longValueMid); - for (x = 0; x < vlSize; x++) { - ((char *)vl_elem.p)[j * vlSize + x] = ((char *)&longValue)[x]; - } - break; - } - } - break; - } - case H5T_FLOAT: { - switch (vlSize) { - case sizeof(jfloat): { - jfloat floatValue = ENVPTR->CallFloatMethod(ENVONLY, jobj, floatValueMid); - for (x = 0; x < vlSize; x++) { - ((char *)vl_elem.p)[j * vlSize + x] = ((char *)&floatValue)[x]; - } - break; - } - case sizeof(jdouble): { - jdouble doubleValue = ENVPTR->CallDoubleMethod(ENVONLY, jobj, doubleValueMid); - for (x = 0; x < vlSize; x++) { - ((char *)vl_elem.p)[j * vlSize + x] = ((char *)&doubleValue)[x]; - } - break; - } - } - break; - } - case H5T_REFERENCE: { - jbyte *barray = (jbyte *)ENVPTR->GetByteArrayElements(ENVONLY, jobj, 0); - for (x = 0; x < vlSize; x++) { - ((char *)vl_elem.p)[j * vlSize + x] = ((char *)barray)[x]; - } - ENVPTR->ReleaseByteArrayElements(ENVONLY, jobj, barray, 0); - break; - } - default: - H5_UNIMPLEMENTED(ENVONLY, "H5AwriteVL: invalid class type"); - break; - } - ENVPTR->DeleteLocalRef(ENVONLY, jobj); - } - - HDmemcpy((char *)rawBuf + i * typeSize, &vl_elem, sizeof(hvl_t)); - - ENVPTR->DeleteLocalRef(ENVONLY, jList); - } /* end for (i = 0; i < n; i++) */ - - if ((status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, rawBuf)) < 0) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + translate_wbuf(ENVONLY, buf, mem_type_id, type_class, vl_array_len, writeBuf); - if (rawBuf) - HDfree(rawBuf); - } - else { - PIN_BYTE_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5AwriteVL: write buffer not pinned"); - if ((status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, writeBuf)) < 0) - H5_LIBRARY_ERROR(ENVONLY); - } + if ((status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, writeBuf)) < 0) + H5_LIBRARY_ERROR(ENVONLY); done: if (writeBuf) { - if ((status >= 0) && vl_data_class) + if ((status >= 0) && vl_data_class) { + dims[0] = (hsize_t)vl_array_len; + if ((sid = H5Screate_simple(1, dims, NULL)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + H5Treclaim(attr_id, sid, H5P_DEFAULT, writeBuf); + } + if (is_variable) { + for (size_t i = 0; i < (size_t)vl_array_len; i++) + HDfree(((char **)writeBuf)[i]); + } - if (type_class != H5T_VLEN) - UNPIN_BYTE_ARRAY(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0); + HDfree(writeBuf); } return (jint)status; @@ -1914,21 +1630,24 @@ H5AwriteVL_asstr(JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf) continue; } - /* - * length = ENVPTR->GetStringUTFLength(ENVONLY, jstr); - * CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - */ - PIN_JAVA_STRING(ENVONLY, jstr, utf8, NULL, "H5AwriteVL_asstr: failed to pin string buffer"); /* - * TODO: If the string isn't a copy, we should probably make - * one before destroying it with h5str_convert. + * Make a copy of the string since h5str_convert uses strtok. */ + char *utf8_copy = NULL; - if (!h5str_convert(ENVONLY, (char **)&utf8, aid, tid, &(((char *)writeBuf)[i * typeSize]), 0)) + jsize length = ENVPTR->GetStringUTFLength(ENVONLY, jstr); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (NULL == (utf8_copy = HDstrndup(utf8, (size_t)length))) + H5_LIBRARY_ERROR(ENVONLY); + + if (!h5str_convert(ENVONLY, &utf8_copy, aid, tid, &(((char *)writeBuf)[i * typeSize]), 0)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + free(utf8_copy); + UNPIN_JAVA_STRING(ENVONLY, jstr, utf8); utf8 = NULL; diff --git a/java/src/jni/h5dImp.c b/java/src/jni/h5dImp.c index c8dc0c3..de7fb21 100644 --- a/java/src/jni/h5dImp.c +++ b/java/src/jni/h5dImp.c @@ -181,47 +181,71 @@ Java_hdf_hdf5lib_H5_H5Dread(JNIEnv *env, jclass clss, jlong dataset_id, jlong me jlong file_space_id, jlong xfer_plist_id, jbyteArray buf, jboolean isCriticalPinning) { - jboolean readBufIsCopy; - jbyte *readBuf = NULL; - htri_t vl_data_class; - herr_t status = FAIL; + jboolean readBufIsCopy; + jbyte *readBuf = NULL; + size_t typeSize; + H5T_class_t type_class; + jsize vl_array_len; // Only used by vl_data_class types + htri_t vl_data_class; + herr_t status = FAIL; UNUSED(clss); if (NULL == buf) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dread: read buffer is NULL"); - /* Get size of data array */ - if (ENVPTR->GetArrayLength(ENVONLY, buf) < 0) { - CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread: readBuf length < 0"); - } - if ((vl_data_class = h5str_detect_vlen(mem_type_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); - if (isCriticalPinning) { - PIN_BYTE_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, - "H5Dread: read buffer not critically pinned"); + if (vl_data_class) { + /* Get size of data array */ + if ((vl_array_len = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) { + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread: readBuf length < 0"); + } + + if (!(typeSize = H5Tget_size(mem_type_id))) + H5_LIBRARY_ERROR(ENVONLY); + + if (NULL == (readBuf = HDcalloc((size_t)vl_array_len, typeSize))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dread: failed to allocate raw VL read buffer"); } else { - PIN_BYTE_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread: read buffer not pinned"); + if (isCriticalPinning) { + PIN_BYTE_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, + "H5Dread: read buffer not critically pinned"); + } + else { + PIN_BYTE_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread: read buffer not pinned"); + } } if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, - (hid_t)xfer_plist_id, readBuf)) < 0) + (hid_t)xfer_plist_id, (void *)readBuf)) < 0) H5_LIBRARY_ERROR(ENVONLY); + if (vl_data_class) { + if ((type_class = H5Tget_class((hid_t)mem_type_id)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + translate_rbuf(env, buf, mem_type_id, type_class, vl_array_len, readBuf); + } + done: if (readBuf) { if ((status >= 0) && vl_data_class) H5Treclaim(dataset_id, mem_space_id, H5P_DEFAULT, readBuf); - if (isCriticalPinning) { - UNPIN_ARRAY_CRITICAL(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0); + if (vl_data_class) { + HDfree(readBuf); } else { - UNPIN_BYTE_ARRAY(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0); + if (isCriticalPinning) { + UNPIN_ARRAY_CRITICAL(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0); + } + else { + UNPIN_BYTE_ARRAY(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0); + } } } @@ -238,31 +262,50 @@ Java_hdf_hdf5lib_H5_H5Dwrite(JNIEnv *env, jclass clss, jlong dataset_id, jlong m jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id, jbyteArray buf, jboolean isCriticalPinning) { - jboolean writeBufIsCopy; - jbyte *writeBuf = NULL; - htri_t vl_data_class; - herr_t status = FAIL; + jboolean writeBufIsCopy; + jbyte *writeBuf = NULL; + size_t typeSize; + H5T_class_t type_class; + jsize vl_array_len; // Only used by vl_data_class types + htri_t vl_data_class; + herr_t status = FAIL; UNUSED(clss); if (NULL == buf) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dwrite: write buffer is NULL"); - /* Get size of data array */ - if (ENVPTR->GetArrayLength(ENVONLY, buf) < 0) { - CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread: readBuf length < 0"); - } - if ((vl_data_class = h5str_detect_vlen(mem_type_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); - if (isCriticalPinning) { - PIN_BYTE_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, - "H5Dwrite: write buffer not critically pinned"); + if (vl_data_class) { + /* Get size of data array */ + if ((vl_array_len = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) { + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite: write buffer length < 0"); + } + + if (!(typeSize = H5Tget_size(mem_type_id))) + H5_LIBRARY_ERROR(ENVONLY); + + if (NULL == (writeBuf = HDcalloc((size_t)vl_array_len, typeSize))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dwrite: failed to allocate raw VL write buffer"); } else { - PIN_BYTE_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite: write buffer not pinned"); + if (isCriticalPinning) { + PIN_BYTE_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, + "H5Dwrite: write buffer not critically pinned"); + } + else { + PIN_BYTE_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite: write buffer not pinned"); + } + } + + if (vl_data_class) { + if ((type_class = H5Tget_class((hid_t)mem_type_id)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + translate_wbuf(ENVONLY, buf, mem_type_id, type_class, vl_array_len, writeBuf); } if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, @@ -274,11 +317,16 @@ done: if ((status >= 0) && vl_data_class) H5Treclaim(dataset_id, mem_space_id, H5P_DEFAULT, writeBuf); - if (isCriticalPinning) { - UNPIN_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0); + if (vl_data_class) { + HDfree(writeBuf); } else { - UNPIN_BYTE_ARRAY(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0); + if (isCriticalPinning) { + UNPIN_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0); + } + else { + UNPIN_BYTE_ARRAY(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0); + } } } @@ -1086,234 +1134,52 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5DreadVL(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id, jobjectArray buf) { + jbyte *readBuf = NULL; + size_t typeSize; H5T_class_t type_class; - jsize n; + jsize vl_array_len; htri_t vl_data_class; - herr_t status = FAIL; - jbyteArray *readBuf = NULL; + herr_t status = FAIL; + htri_t is_variable = 0; UNUSED(clss); if (NULL == buf) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5DreadVL: read buffer is NULL"); + if ((vl_data_class = h5str_detect_vlen(mem_type_id)) < 0) + H5_LIBRARY_ERROR(ENVONLY); /* Get size of data array */ - if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) { + if ((vl_array_len = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5DreadVL: readBuf length < 0"); } - - if ((vl_data_class = h5str_detect_vlen(mem_type_id)) < 0) + if ((is_variable = H5Tis_variable_str(mem_type_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); - if ((type_class = H5Tget_class((hid_t)mem_type_id)) < 0) + if (!(typeSize = H5Tget_size(mem_type_id))) H5_LIBRARY_ERROR(ENVONLY); - if (type_class == H5T_VLEN) { - size_t typeSize; - hid_t memb = H5I_INVALID_HID; - H5T_class_t vlClass; - size_t vlSize; - void *rawBuf = NULL; - jobjectArray jList = NULL; - - size_t i, j, x; - - if (!(typeSize = H5Tget_size(mem_type_id))) - H5_LIBRARY_ERROR(ENVONLY); - - if (!(memb = H5Tget_super(mem_type_id))) - H5_LIBRARY_ERROR(ENVONLY); - if ((vlClass = H5Tget_class((hid_t)memb)) < 0) - H5_LIBRARY_ERROR(ENVONLY); - if (!(vlSize = H5Tget_size(memb))) - H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (rawBuf = HDcalloc((size_t)n, typeSize))) - H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5DreadVL: failed to allocate raw VL read buffer"); - - if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, - (hid_t)file_space_id, (hid_t)xfer_plist_id, (void *)rawBuf)) < 0) - H5_LIBRARY_ERROR(ENVONLY); + if (NULL == (readBuf = HDcalloc((size_t)vl_array_len, typeSize))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5DreadVL: failed to allocate raw VL read buffer"); - /* Cache class types */ - /* jclass cBool = ENVPTR->FindClass(ENVONLY, "java/lang/Boolean"); */ - jclass cByte = ENVPTR->FindClass(ENVONLY, "java/lang/Byte"); - jclass cShort = ENVPTR->FindClass(ENVONLY, "java/lang/Short"); - jclass cInt = ENVPTR->FindClass(ENVONLY, "java/lang/Integer"); - jclass cLong = ENVPTR->FindClass(ENVONLY, "java/lang/Long"); - jclass cFloat = ENVPTR->FindClass(ENVONLY, "java/lang/Float"); - jclass cDouble = ENVPTR->FindClass(ENVONLY, "java/lang/Double"); - - /* - jmethodID boolValueMid = - ENVPTR->GetStaticMethodID(ENVONLY, cBool, "valueOf", "(Z)Ljava/lang/Boolean;"); - */ - jmethodID byteValueMid = ENVPTR->GetStaticMethodID(ENVONLY, cByte, "valueOf", "(B)Ljava/lang/Byte;"); - jmethodID shortValueMid = - ENVPTR->GetStaticMethodID(ENVONLY, cShort, "valueOf", "(S)Ljava/lang/Short;"); - jmethodID intValueMid = ENVPTR->GetStaticMethodID(ENVONLY, cInt, "valueOf", "(I)Ljava/lang/Integer;"); - jmethodID longValueMid = ENVPTR->GetStaticMethodID(ENVONLY, cLong, "valueOf", "(J)Ljava/lang/Long;"); - jmethodID floatValueMid = - ENVPTR->GetStaticMethodID(ENVONLY, cFloat, "valueOf", "(F)Ljava/lang/Float;"); - jmethodID doubleValueMid = - ENVPTR->GetStaticMethodID(ENVONLY, cDouble, "valueOf", "(D)Ljava/lang/Double;"); - - // retrieve the java.util.List interface class - jclass cList = ENVPTR->FindClass(ENVONLY, "java/util/List"); - jmethodID addMethod = ENVPTR->GetMethodID(ENVONLY, cList, "add", "(Ljava/lang/Object;)Z"); - - /* Convert each element to a list */ - for (i = 0; i < (size_t)n; i++) { - hvl_t vl_elem; - - // The list we're going to return: - if (NULL == (jList = ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)buf, (jsize)i))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - - /* Get the number of sequence elements */ - HDmemcpy(&vl_elem, (char *)rawBuf + i * typeSize, sizeof(hvl_t)); - - jsize nelmts = (jsize)vl_elem.len; - if (vl_elem.len != (size_t)nelmts) - H5_JNI_FATAL_ERROR(ENVONLY, "H5DreadVL: overflow of number of VL elements"); - if (nelmts < 0) - H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5DreadVL: number of VL elements < 0"); - - jobject jobj = NULL; - for (j = 0; j < (size_t)nelmts; j++) { - switch (vlClass) { - /*case H5T_BOOL: { - jboolean boolValue; - for (x = 0; x < vlSize; x++) { - ((char *)&boolValue)[x] = ((char *)vl_elem.p)[j*vlSize+x]; - } - - jobj = ENVPTR->CallStaticObjectMethod(ENVONLY, cBool, boolValueMid, boolValue); - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - break; - } */ - case H5T_INTEGER: { - switch (vlSize) { - case sizeof(jbyte): { - jbyte byteValue; - for (x = 0; x < vlSize; x++) { - ((char *)&byteValue)[x] = ((char *)vl_elem.p)[j * vlSize + x]; - } - - jobj = - ENVPTR->CallStaticObjectMethod(ENVONLY, cByte, byteValueMid, byteValue); - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - break; - } - case sizeof(jshort): { - jshort shortValue; - for (x = 0; x < vlSize; x++) { - ((char *)&shortValue)[x] = ((char *)vl_elem.p)[j * vlSize + x]; - } - - jobj = ENVPTR->CallStaticObjectMethod(ENVONLY, cShort, shortValueMid, - shortValue); - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - break; - } - case sizeof(jint): { - jint intValue; - for (x = 0; x < vlSize; x++) { - ((char *)&intValue)[x] = ((char *)vl_elem.p)[j * vlSize + x]; - } - - jobj = ENVPTR->CallStaticObjectMethod(ENVONLY, cInt, intValueMid, intValue); - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - break; - } - case sizeof(jlong): { - jlong longValue; - for (x = 0; x < vlSize; x++) { - ((char *)&longValue)[x] = ((char *)vl_elem.p)[j * vlSize + x]; - } - - jobj = - ENVPTR->CallStaticObjectMethod(ENVONLY, cLong, longValueMid, longValue); - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - break; - } - } - break; - } - case H5T_FLOAT: { - switch (vlSize) { - case sizeof(jfloat): { - jfloat floatValue; - for (x = 0; x < vlSize; x++) { - ((char *)&floatValue)[x] = ((char *)vl_elem.p)[j * vlSize + x]; - } - - jobj = ENVPTR->CallStaticObjectMethod(ENVONLY, cFloat, floatValueMid, - (double)floatValue); - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - break; - } - case sizeof(jdouble): { - jdouble doubleValue; - for (x = 0; x < vlSize; x++) { - ((char *)&doubleValue)[x] = ((char *)vl_elem.p)[j * vlSize + x]; - } - - jobj = ENVPTR->CallStaticObjectMethod(ENVONLY, cDouble, doubleValueMid, - doubleValue); - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - break; - } - } - break; - } - case H5T_REFERENCE: { - jboolean bb; - jbyte *barray = NULL; - - jsize byteArraySize = (jsize)vlSize; - if (vlSize != (size_t)byteArraySize) - H5_JNI_FATAL_ERROR(ENVONLY, "H5DreadVL: overflow of byteArraySize"); - - if (NULL == (jobj = ENVPTR->NewByteArray(ENVONLY, byteArraySize))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - - PIN_BYTE_ARRAY(ENVONLY, (jbyteArray)jobj, barray, &bb, - "readVL reference: byte array not pinned"); - - for (x = 0; x < vlSize; x++) { - barray[x] = ((jbyte *)vl_elem.p)[j * vlSize + x]; - } - if (barray) - UNPIN_BYTE_ARRAY(ENVONLY, (jbyteArray)jobj, barray, jobj ? 0 : JNI_ABORT); - break; - } - default: - H5_UNIMPLEMENTED(ENVONLY, "H5DreadVL: invalid class type"); - break; - } - - // Add it to the list - ENVPTR->CallBooleanMethod(ENVONLY, jList, addMethod, jobj); - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - } - } /* end for */ + if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, + (hid_t)xfer_plist_id, (void *)readBuf)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + if ((type_class = H5Tget_class((hid_t)mem_type_id)) < 0) + H5_LIBRARY_ERROR(ENVONLY); - if (rawBuf) - HDfree(rawBuf); - } - else { - if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, - (hid_t)file_space_id, (hid_t)xfer_plist_id, (void *)readBuf)) < 0) - H5_LIBRARY_ERROR(ENVONLY); - } + translate_rbuf(env, buf, mem_type_id, type_class, vl_array_len, readBuf); done: if (readBuf) { if ((status >= 0) && vl_data_class) H5Treclaim(dataset_id, mem_space_id, H5P_DEFAULT, readBuf); - - UNPIN_BYTE_ARRAY(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0); + if (is_variable) { + for (size_t i = 0; i < (size_t)vl_array_len; i++) + HDfree(((char **)readBuf)[i]); + } + HDfree(readBuf); } return (jint)status; @@ -1328,201 +1194,55 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5DwriteVL(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id, jobjectArray buf) { + jbyte *writeBuf = NULL; + size_t typeSize; H5T_class_t type_class; - jsize n; + jsize vl_array_len; // Only used by vl_data_class types htri_t vl_data_class; - herr_t status = FAIL; - jboolean writeBufIsCopy; - jbyteArray writeBuf = NULL; + herr_t status = FAIL; + htri_t is_variable = 0; UNUSED(clss); if (NULL == buf) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5DwriteVL: write buffer is NULL"); + if ((vl_data_class = h5str_detect_vlen(mem_type_id)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + /* Get size of data array */ - if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) { + if ((vl_array_len = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5DwriteVL: readBuf length < 0"); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5DwriteVL: write buffer length < 0"); } - - if ((vl_data_class = h5str_detect_vlen(mem_type_id)) < 0) + if ((is_variable = H5Tis_variable_str(mem_type_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); - if ((type_class = H5Tget_class((hid_t)mem_type_id)) < 0) + if (!(typeSize = H5Tget_size(mem_type_id))) H5_LIBRARY_ERROR(ENVONLY); - if (type_class == H5T_VLEN) { - size_t typeSize; - hid_t memb = H5I_INVALID_HID; - H5T_class_t vlClass; - size_t vlSize; - void *rawBuf = NULL; - jobjectArray jList = NULL; - - size_t i, j, x; - - if (!(typeSize = H5Tget_size(mem_type_id))) - H5_LIBRARY_ERROR(ENVONLY); - - if (!(memb = H5Tget_super(mem_type_id))) - H5_LIBRARY_ERROR(ENVONLY); - if ((vlClass = H5Tget_class((hid_t)memb)) < 0) - H5_LIBRARY_ERROR(ENVONLY); - if (!(vlSize = H5Tget_size(memb))) - H5_LIBRARY_ERROR(ENVONLY); - - if (NULL == (rawBuf = HDcalloc((size_t)n, typeSize))) - H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5DwriteVL: failed to allocate raw VL write buffer"); - - /* Cache class types */ - /* jclass cBool = ENVPTR->FindClass(ENVONLY, "java/lang/Boolean"); */ - jclass cByte = ENVPTR->FindClass(ENVONLY, "java/lang/Byte"); - jclass cShort = ENVPTR->FindClass(ENVONLY, "java/lang/Short"); - jclass cInt = ENVPTR->FindClass(ENVONLY, "java/lang/Integer"); - jclass cLong = ENVPTR->FindClass(ENVONLY, "java/lang/Long"); - jclass cFloat = ENVPTR->FindClass(ENVONLY, "java/lang/Float"); - jclass cDouble = ENVPTR->FindClass(ENVONLY, "java/lang/Double"); - - /* jmethodID boolValueMid = ENVPTR->GetMethodID(ENVONLY, cBool, "booleanValue", "()Z"); */ - jmethodID byteValueMid = ENVPTR->GetMethodID(ENVONLY, cByte, "byteValue", "()B"); - jmethodID shortValueMid = ENVPTR->GetMethodID(ENVONLY, cShort, "shortValue", "()S"); - jmethodID intValueMid = ENVPTR->GetMethodID(ENVONLY, cInt, "intValue", "()I"); - jmethodID longValueMid = ENVPTR->GetMethodID(ENVONLY, cLong, "longValue", "()J"); - jmethodID floatValueMid = ENVPTR->GetMethodID(ENVONLY, cFloat, "floatValue", "()F"); - jmethodID doubleValueMid = ENVPTR->GetMethodID(ENVONLY, cDouble, "doubleValue", "()D"); - - /* Convert each list to a vlen element */ - for (i = 0; i < (size_t)n; i++) { - hvl_t vl_elem; - - if (NULL == (jList = ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)buf, (jsize)i))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - - // retrieve the java.util.List interface class - jclass cList = ENVPTR->FindClass(ENVONLY, "java/util/List"); - - // retrieve the toArray method and invoke it - jmethodID mToArray = ENVPTR->GetMethodID(ENVONLY, cList, "toArray", "()[Ljava/lang/Object;"); - if (mToArray == NULL) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - jobjectArray array = (jobjectArray)ENVPTR->CallObjectMethod(ENVONLY, jList, mToArray); - jsize jnelmts = ENVPTR->GetArrayLength(ENVONLY, array); - - if (jnelmts < 0) - H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5DwriteVL: number of VL elements < 0"); - - HDmemcpy(&vl_elem, (char *)rawBuf + i * typeSize, sizeof(hvl_t)); - vl_elem.len = (size_t)jnelmts; - - if (NULL == (vl_elem.p = HDmalloc((size_t)jnelmts * vlSize))) - H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5DwriteVL: failed to allocate vlen ptr buffer"); - - jobject jobj = NULL; - for (j = 0; j < (size_t)jnelmts; j++) { - if (NULL == (jobj = ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)array, (jsize)j))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - - switch (vlClass) { - /* case H5T_BOOL: { - jboolean boolValue = ENVPTR->CallBooleanMethod(ENVONLY, jobj, boolValueMid); - for (x = 0; x < vlSize; x++) { - ((char *)vl_elem.p)[j * vlSize + x] = ((char *)&boolValue)[x]; - } - break; - } */ - case H5T_INTEGER: { - switch (vlSize) { - case sizeof(jbyte): { - jbyte byteValue = ENVPTR->CallByteMethod(ENVONLY, jobj, byteValueMid); - for (x = 0; x < vlSize; x++) { - ((char *)vl_elem.p)[j * vlSize + x] = ((char *)&byteValue)[x]; - } - break; - } - case sizeof(jshort): { - jshort shortValue = ENVPTR->CallShortMethod(ENVONLY, jobj, shortValueMid); - for (x = 0; x < vlSize; x++) { - ((char *)vl_elem.p)[j * vlSize + x] = ((char *)&shortValue)[x]; - } - break; - } - case sizeof(jint): { - jint intValue = ENVPTR->CallIntMethod(ENVONLY, jobj, intValueMid); - for (x = 0; x < vlSize; x++) { - ((char *)vl_elem.p)[j * vlSize + x] = ((char *)&intValue)[x]; - } - break; - } - case sizeof(jlong): { - jlong longValue = ENVPTR->CallLongMethod(ENVONLY, jobj, longValueMid); - for (x = 0; x < vlSize; x++) { - ((char *)vl_elem.p)[j * vlSize + x] = ((char *)&longValue)[x]; - } - break; - } - } - break; - } - case H5T_FLOAT: { - switch (vlSize) { - case sizeof(jfloat): { - jfloat floatValue = ENVPTR->CallFloatMethod(ENVONLY, jobj, floatValueMid); - for (x = 0; x < vlSize; x++) { - ((char *)vl_elem.p)[j * vlSize + x] = ((char *)&floatValue)[x]; - } - break; - } - case sizeof(jdouble): { - jdouble doubleValue = ENVPTR->CallDoubleMethod(ENVONLY, jobj, doubleValueMid); - for (x = 0; x < vlSize; x++) { - ((char *)vl_elem.p)[j * vlSize + x] = ((char *)&doubleValue)[x]; - } - break; - } - } - break; - } - case H5T_REFERENCE: { - jbyte *barray = (jbyte *)ENVPTR->GetByteArrayElements(ENVONLY, jobj, 0); - for (x = 0; x < vlSize; x++) { - ((char *)vl_elem.p)[j * vlSize + x] = ((char *)barray)[x]; - } - ENVPTR->ReleaseByteArrayElements(ENVONLY, jobj, barray, 0); - break; - } - default: - H5_UNIMPLEMENTED(ENVONLY, "H5DwriteVL: invalid class type"); - break; - } - ENVPTR->DeleteLocalRef(ENVONLY, jobj); - } - HDmemcpy((char *)rawBuf + i * typeSize, &vl_elem, sizeof(hvl_t)); + if (NULL == (writeBuf = HDcalloc((size_t)vl_array_len, typeSize))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5DwriteVL: failed to allocate raw VL write buffer"); - ENVPTR->DeleteLocalRef(ENVONLY, jList); - } /* end for (i = 0; i < n; i++) */ + if ((type_class = H5Tget_class((hid_t)mem_type_id)) < 0) + H5_LIBRARY_ERROR(ENVONLY); - if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, - (hid_t)file_space_id, (hid_t)xfer_plist_id, rawBuf)) < 0) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + translate_wbuf(ENVONLY, buf, mem_type_id, type_class, vl_array_len, writeBuf); - if (rawBuf) - HDfree(rawBuf); - } - else { - PIN_BYTE_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5DwriteVL: write buffer not pinned"); - if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, - (hid_t)file_space_id, (hid_t)xfer_plist_id, writeBuf)) < 0) - H5_LIBRARY_ERROR(ENVONLY); - } + if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, + (hid_t)xfer_plist_id, writeBuf)) < 0) + H5_LIBRARY_ERROR(ENVONLY); done: if (writeBuf) { if ((status >= 0) && vl_data_class) H5Treclaim(dataset_id, mem_space_id, H5P_DEFAULT, writeBuf); + if (is_variable) { + for (size_t i = 0; i < (size_t)vl_array_len; i++) + HDfree(((char **)writeBuf)[i]); + } - if (type_class != H5T_VLEN) - UNPIN_BYTE_ARRAY(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0); + HDfree(writeBuf); } return (jint)status; @@ -1958,21 +1678,24 @@ H5DwriteVL_asstr(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_si continue; } - /* - * length = ENVPTR->GetStringUTFLength(ENVONLY, jstr); - * CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - */ - PIN_JAVA_STRING(ENVONLY, jstr, utf8, NULL, "H5DwriteVL_asstr: failed to pin string buffer"); /* - * TODO: If the string isn't a copy, we should probably make - * one before destroying it with h5str_convert. + * Make a copy of the string since h5str_convert uses strtok. */ + char *utf8_copy = NULL; + + jsize length = ENVPTR->GetStringUTFLength(ENVONLY, jstr); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (NULL == (utf8_copy = HDstrndup(utf8, (size_t)length))) + H5_LIBRARY_ERROR(ENVONLY); - if (!h5str_convert(ENVONLY, (char **)&utf8, did, tid, &(((char *)writeBuf)[i * typeSize]), 0)) + if (!h5str_convert(ENVONLY, &utf8_copy, did, tid, &(((char *)writeBuf)[i * typeSize]), 0)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + HDfree(utf8_copy); + UNPIN_JAVA_STRING(ENVONLY, jstr, utf8); utf8 = NULL; diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index 06087a7..152f019 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -77,6 +77,9 @@ static int render_bin_output_region_data_points(FILE *stream, hid_t region_sp hsize_t *ptdata); static int render_bin_output_region_points(FILE *stream, hid_t region_space, hid_t region_id, hid_t container); +jobject translate_atomic_rbuf(JNIEnv *env, jlong mem_type_id, H5T_class_t type_class, void *raw_buf); +void translate_atomic_wbuf(JNIEnv *env, jobject in_obj, jlong mem_type_id, H5T_class_t type_class, + void *raw_buf); /* Strings for output */ #define H5_TOOLS_GROUP "GROUP" @@ -435,40 +438,43 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ break; case H5T_ENUM: { - void *value = NULL; + void *value = NULL; + unsigned char tmp_uchar = 0; + unsigned short tmp_ushort = 0; + unsigned int tmp_uint = 0; +#if H5_SIZEOF_LONG != H5_SIZEOF_INT + unsigned long tmp_ulong = 0; +#endif +#if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG + unsigned long long tmp_ullong = 0; +#endif token = HDstrtok(this_str, delimiter); switch (typeSize) { case sizeof(char): { - unsigned char tmp_uchar = 0; - value = &tmp_uchar; + value = &tmp_uchar; break; } case sizeof(short): { - unsigned short tmp_ushort = 0; - value = &tmp_ushort; + value = &tmp_ushort; break; } #if H5_SIZEOF_LONG != H5_SIZEOF_INT case sizeof(long): { - unsigned long tmp_ulong = 0; - value = &tmp_ulong; + value = &tmp_ulong; break; } #endif #if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG case sizeof(long long): { - unsigned long long tmp_ullong = 0; - value = &tmp_ullong; + value = &tmp_ullong; break; } #endif - default: { - unsigned int tmp_uint = 0; - value = &tmp_uint; + value = &tmp_uint; break; } } @@ -3426,10 +3432,8 @@ Java_hdf_hdf5lib_H5_H5AreadComplex(JNIEnv *env, jclass clss, jlong attr_id, jlon size = (((H5Tget_size(mem_type_id)) > (H5Tget_size(p_type))) ? (H5Tget_size(mem_type_id)) : (H5Tget_size(p_type))); - if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) <= 0) { - CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) <= 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5AreadComplex: read buffer length <= 0"); - } if (NULL == (readBuf = (char *)HDmalloc((size_t)n * size))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AreadComplex: failed to allocate read buffer"); @@ -4042,6 +4046,854 @@ done: H5Aclose(attr_id); } /* end Java_hdf_hdf5lib_H5_H5export_1attribute */ +jobject +translate_atomic_rbuf(JNIEnv *env, jlong mem_type_id, H5T_class_t type_class, void *raw_buf) +{ + jobject jobj = NULL; + hid_t memb = H5I_INVALID_HID; + jobjectArray jList = NULL; + H5T_class_t vlClass; + size_t vlSize; + size_t i; + size_t typeSize; + // raw_buf is normally bytes except when used for variable length strings + char *char_buf = (char *)raw_buf; + + /* retrieve the java.util.ArrayList interface class */ + jclass arrCList = ENVPTR->FindClass(ENVONLY, "java/util/ArrayList"); + jmethodID arrListMethod = ENVPTR->GetMethodID(ENVONLY, arrCList, "<init>", "(I)V"); + + /* Cache class types */ + /* jclass cBool = ENVPTR->FindClass(ENVONLY, "java/lang/Boolean"); */ + jclass cByte = ENVPTR->FindClass(ENVONLY, "java/lang/Byte"); + jclass cShort = ENVPTR->FindClass(ENVONLY, "java/lang/Short"); + jclass cInt = ENVPTR->FindClass(ENVONLY, "java/lang/Integer"); + jclass cLong = ENVPTR->FindClass(ENVONLY, "java/lang/Long"); + jclass cFloat = ENVPTR->FindClass(ENVONLY, "java/lang/Float"); + jclass cDouble = ENVPTR->FindClass(ENVONLY, "java/lang/Double"); + /*jobjectArray + jmethodID boolValueMid = + ENVPTR->GetStaticMethodID(ENVONLY, cBool, "valueOf", "(Z)Ljava/lang/Boolean;"); + */ + jmethodID byteValueMid = ENVPTR->GetStaticMethodID(ENVONLY, cByte, "valueOf", "(B)Ljava/lang/Byte;"); + jmethodID shortValueMid = ENVPTR->GetStaticMethodID(ENVONLY, cShort, "valueOf", "(S)Ljava/lang/Short;"); + jmethodID intValueMid = ENVPTR->GetStaticMethodID(ENVONLY, cInt, "valueOf", "(I)Ljava/lang/Integer;"); + jmethodID longValueMid = ENVPTR->GetStaticMethodID(ENVONLY, cLong, "valueOf", "(J)Ljava/lang/Long;"); + jmethodID floatValueMid = ENVPTR->GetStaticMethodID(ENVONLY, cFloat, "valueOf", "(F)Ljava/lang/Float;"); + jmethodID doubleValueMid = + ENVPTR->GetStaticMethodID(ENVONLY, cDouble, "valueOf", "(D)Ljava/lang/Double;"); + + if (!(typeSize = H5Tget_size(mem_type_id))) + H5_LIBRARY_ERROR(ENVONLY); + + switch (type_class) { + case H5T_VLEN: { + if (!(memb = H5Tget_super(mem_type_id))) + H5_LIBRARY_ERROR(ENVONLY); + if ((vlClass = H5Tget_class(memb)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + if (!(vlSize = H5Tget_size(memb))) + H5_LIBRARY_ERROR(ENVONLY); + + /* Convert element to a list */ + hvl_t vl_elem; + + /* Get the number of sequence elements */ + memcpy(&vl_elem, char_buf, sizeof(hvl_t)); + jsize nelmts = (jsize)vl_elem.len; + if (vl_elem.len != (size_t)nelmts) + H5_JNI_FATAL_ERROR(ENVONLY, "translate_atomic_rbuf: overflow of number of VL elements"); + + if (nelmts < 0) + H5_BAD_ARGUMENT_ERROR(ENVONLY, "translate_atomic_rbuf: number of VL elements < 0"); + + /* The list we're going to return: */ + if (NULL == (jList = (jobjectArray)ENVPTR->NewObject(ENVONLY, arrCList, arrListMethod, 0))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "translate_atomic_rbuf: failed to allocate list read buffer"); + + translate_rbuf(ENVONLY, jList, memb, vlClass, (jsize)nelmts, vl_elem.p); + jobj = jList; + break; + } /* H5T_VLEN */ + case H5T_COMPOUND: { + int nmembs = H5Tget_nmembers(mem_type_id); + + /* The list we're going to return: */ + if (NULL == (jList = (jobjectArray)ENVPTR->NewObject(ENVONLY, arrCList, arrListMethod, 0))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "translate_atomic_rbuf: failed to allocate list read buffer"); + + /* Convert each element to a compound object */ + for (i = 0; i < (size_t)nmembs; i++) { + H5T_class_t memb_vlClass; + size_t memb_vlSize; + size_t memb_offset; + + if ((memb = H5Tget_member_type(mem_type_id, (unsigned int)i)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + memb_offset = H5Tget_member_offset(mem_type_id, (unsigned int)i); + if ((memb_vlClass = H5Tget_class(memb)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + if (!(memb_vlSize = H5Tget_size(memb))) + H5_LIBRARY_ERROR(ENVONLY); + + translate_atomic_rbuf(ENVONLY, memb, memb_vlClass, char_buf + i * typeSize + memb_offset); + H5Tclose(memb); + } + jobj = jList; + break; + } /* H5T_COMPOUND */ + case H5T_ARRAY: { + void *objBuf = NULL; + size_t typeCount; + + if (!(memb = H5Tget_super(mem_type_id))) + H5_LIBRARY_ERROR(ENVONLY); + if ((vlClass = H5Tget_class(memb)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + if (!(vlSize = H5Tget_size(memb))) + H5_LIBRARY_ERROR(ENVONLY); + if (!(typeSize = H5Tget_size(mem_type_id))) + H5_LIBRARY_ERROR(ENVONLY); + + typeCount = typeSize / vlSize; + + if (NULL == (objBuf = HDmalloc(typeSize))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "translate_atomic_rbuf: failed to allocate buffer"); + + /* Convert each element */ + /* Get the object element */ + memcpy((char *)objBuf, char_buf, typeSize); + + /* The list we're going to return: */ + if (NULL == (jList = (jobjectArray)ENVPTR->NewObject(ENVONLY, arrCList, arrListMethod, 0))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "translate_atomic_rbuf: failed to allocate list read buffer"); + + translate_rbuf(ENVONLY, jList, memb, vlClass, (jsize)typeCount, objBuf); + jobj = jList; + + if (objBuf) + HDfree(objBuf); + + break; + } /* H5T_ARRAY */ + case H5T_ENUM: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_INTEGER: { + /* Convert each element */ + switch (typeSize) { + case sizeof(jbyte): { + jbyte byteValue; + HDmemcpy(((char *)&byteValue), char_buf, typeSize); + + if (NULL == + (jobj = ENVPTR->CallStaticObjectMethod(ENVONLY, cByte, byteValueMid, byteValue))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + break; + } + case sizeof(jshort): { + jshort shortValue; + HDmemcpy(((char *)&shortValue), char_buf, typeSize); + + if (NULL == + (jobj = ENVPTR->CallStaticObjectMethod(ENVONLY, cShort, shortValueMid, shortValue))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + break; + } + case sizeof(jint): { + jint intValue; + + HDmemcpy(((char *)&intValue), char_buf, typeSize); + + if (NULL == (jobj = ENVPTR->CallStaticObjectMethod(ENVONLY, cInt, intValueMid, intValue))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + break; + } + case sizeof(jlong): { + jlong longValue; + HDmemcpy(((char *)&longValue), char_buf, typeSize); + + if (NULL == + (jobj = ENVPTR->CallStaticObjectMethod(ENVONLY, cLong, longValueMid, longValue))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + break; + } + } + break; + } /* H5T_INTEGER */ + case H5T_FLOAT: { + /* Convert each element to a list */ + switch (typeSize) { + case sizeof(jfloat): { + jfloat floatValue; + HDmemcpy(((char *)&floatValue), char_buf, typeSize); + + if (NULL == (jobj = ENVPTR->CallStaticObjectMethod(ENVONLY, cFloat, floatValueMid, + (double)floatValue))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + break; + } + case sizeof(jdouble): { + jdouble doubleValue; + HDmemcpy(((char *)&doubleValue), char_buf, typeSize); + + if (NULL == (jobj = ENVPTR->CallStaticObjectMethod(ENVONLY, cDouble, doubleValueMid, + doubleValue))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + break; + } + } + break; + } /* H5T_FLOAT */ + case H5T_REFERENCE: { + /* Convert each element to a list */ + jboolean bb; + jbyte *barray = NULL; + + jsize byteArraySize = (jsize)typeSize; + if (typeSize != (size_t)byteArraySize) + H5_JNI_FATAL_ERROR(ENVONLY, "translate_atomic_rbuf: overflow of byteArraySize"); + + if (NULL == (jobj = ENVPTR->NewByteArray(ENVONLY, byteArraySize))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + PIN_BYTE_ARRAY(ENVONLY, (jbyteArray)jobj, barray, &bb, + "translate_atomic_rbuf reference: byte array not pinned"); + + HDmemcpy(barray, ((jbyte *)raw_buf), typeSize); + if (barray) + UNPIN_BYTE_ARRAY(ENVONLY, (jbyteArray)jobj, barray, jobj ? 0 : JNI_ABORT); + + break; + } /* H5T_REFERENCE */ + case H5T_STRING: { + htri_t is_variable = 0; + + if ((is_variable = H5Tis_variable_str(mem_type_id)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + /* Convert each element */ + if (is_variable) { + char **var_str_buf = (char **)raw_buf; + if (NULL == (jobj = ENVPTR->NewStringUTF(ENVONLY, *var_str_buf))) { + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "translate_atomic_rbuf: out of memory - unable to " + "construct string from UTF characters"); + } + } + else { + if (NULL == (jobj = ENVPTR->NewStringUTF(ENVONLY, char_buf))) { + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "translate_atomic_rbuf: out of memory - unable to " + "construct string from UTF characters"); + } + } + + break; + } /* H5T_STRING */ + default: + H5_UNIMPLEMENTED(ENVONLY, "translate_atomic_rbuf: invalid class type"); + break; + } /* switch(type_class) */ + +done: + + return jobj; +} + +void +translate_atomic_wbuf(JNIEnv *env, jobject in_obj, jlong mem_type_id, H5T_class_t type_class, void *raw_buf) +{ + hid_t memb = H5I_INVALID_HID; + H5T_class_t vlClass; + size_t vlSize; + size_t i; + size_t typeSize; + // raw_buf is normally bytes except when used for variable length strings + char *char_buf = (char *)raw_buf; + + /* retrieve the java.util.ArrayList interface class */ + jclass arrCList = ENVPTR->FindClass(ENVONLY, "java/util/ArrayList"); + /* retrieve the toArray method */ + jmethodID mToArray = ENVPTR->GetMethodID(ENVONLY, arrCList, "toArray", "()[Ljava/lang/Object;"); + + /* Cache class types */ + jclass cByte = ENVPTR->FindClass(ENVONLY, "java/lang/Byte"); + jclass cShort = ENVPTR->FindClass(ENVONLY, "java/lang/Short"); + jclass cInt = ENVPTR->FindClass(ENVONLY, "java/lang/Integer"); + jclass cLong = ENVPTR->FindClass(ENVONLY, "java/lang/Long"); + jclass cFloat = ENVPTR->FindClass(ENVONLY, "java/lang/Float"); + jclass cDouble = ENVPTR->FindClass(ENVONLY, "java/lang/Double"); + + jmethodID byteValueMid = ENVPTR->GetMethodID(ENVONLY, cByte, "byteValue", "()B"); + jmethodID shortValueMid = ENVPTR->GetMethodID(ENVONLY, cShort, "shortValue", "()S"); + jmethodID intValueMid = ENVPTR->GetMethodID(ENVONLY, cInt, "intValue", "()I"); + jmethodID longValueMid = ENVPTR->GetMethodID(ENVONLY, cLong, "longValue", "()J"); + jmethodID floatValueMid = ENVPTR->GetMethodID(ENVONLY, cFloat, "floatValue", "()F"); + jmethodID doubleValueMid = ENVPTR->GetMethodID(ENVONLY, cDouble, "doubleValue", "()D"); + + if (!(typeSize = H5Tget_size(mem_type_id))) + H5_LIBRARY_ERROR(ENVONLY); + + switch (type_class) { + case H5T_VLEN: { + if (!(memb = H5Tget_super(mem_type_id))) + H5_LIBRARY_ERROR(ENVONLY); + if ((vlClass = H5Tget_class((hid_t)memb)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + if (!(vlSize = H5Tget_size(memb))) + H5_LIBRARY_ERROR(ENVONLY); + + /* Convert element to a vlen element */ + hvl_t vl_elem; + + jsize jnelmts = ENVPTR->GetArrayLength(ENVONLY, in_obj); + + if (jnelmts < 0) + H5_BAD_ARGUMENT_ERROR(ENVONLY, "translate_atomic_wbuf: number of VL elements < 0"); + + vl_elem.len = (size_t)jnelmts; + + if (NULL == (vl_elem.p = HDmalloc((size_t)jnelmts * vlSize))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "translate_atomic_wbuf: failed to allocate vlen ptr buffer"); + + translate_wbuf(ENVONLY, (jobjectArray)in_obj, memb, vlClass, (jsize)jnelmts, vl_elem.p); + + HDmemcpy(char_buf, &vl_elem, sizeof(hvl_t)); + break; + } /* H5T_VLEN */ + case H5T_COMPOUND: { + /* Convert each compound element */ + int nmembs = H5Tget_nmembers(mem_type_id); + + /* invoke the toArray method */ + if (mToArray == NULL) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + jobjectArray array = (jobjectArray)ENVPTR->CallObjectMethod(ENVONLY, in_obj, mToArray); + jsize jnelmts = ENVPTR->GetArrayLength(ENVONLY, array); + + if (jnelmts != nmembs) + H5_BAD_ARGUMENT_ERROR( + ENVONLY, "translate_atomic_wbuf: number of elements not equal to number of members"); + + /* Convert each compound object to an element */ + for (i = 0; i < (size_t)nmembs; i++) { + H5T_class_t memb_vlClass; + size_t memb_vlSize; + size_t memb_offset; + + if ((memb = H5Tget_member_type(mem_type_id, (unsigned int)i)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + memb_offset = H5Tget_member_offset(mem_type_id, (unsigned int)i); + if ((memb_vlClass = H5Tget_class(memb)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + if (!(memb_vlSize = H5Tget_size(memb))) + H5_LIBRARY_ERROR(ENVONLY); + + jobject arr_obj = ENVPTR->GetObjectArrayElement(ENVONLY, array, (jsize)i); + translate_atomic_wbuf(ENVONLY, arr_obj, memb, memb_vlClass, + char_buf + i * typeSize + memb_offset); + ENVPTR->DeleteLocalRef(ENVONLY, arr_obj); + H5Tclose(memb); + } + break; + } /* H5T_COMPOUND */ + case H5T_ARRAY: { + void *objBuf = NULL; + + if (!(memb = H5Tget_super(mem_type_id))) + H5_LIBRARY_ERROR(ENVONLY); + if ((vlClass = H5Tget_class(memb)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + if (!(vlSize = H5Tget_size(memb))) + H5_LIBRARY_ERROR(ENVONLY); + + /* Convert each array element */ + /* invoke the toArray method */ + if (mToArray == NULL) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + jobjectArray array = (jobjectArray)ENVPTR->CallObjectMethod(ENVONLY, in_obj, mToArray); + jsize jnelmts = ENVPTR->GetArrayLength(ENVONLY, array); + + if (jnelmts < 0) + H5_BAD_ARGUMENT_ERROR(ENVONLY, "translate_atomic_wbuf: number of array elements < 0"); + + if (NULL == (objBuf = HDmalloc((size_t)jnelmts * vlSize))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "translate_atomic_wbuf: failed to allocate buffer"); + + translate_wbuf(ENVONLY, array, memb, vlClass, (jsize)jnelmts, objBuf); + + HDmemcpy(char_buf, (char *)objBuf, vlSize * (size_t)jnelmts); + break; + } /* H5T_ARRAY */ + case H5T_ENUM: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_INTEGER: { + /* Convert each element */ + switch (typeSize) { + case sizeof(jbyte): { + jbyte byteValue = ENVPTR->CallByteMethod(ENVONLY, in_obj, byteValueMid); + HDmemcpy(char_buf, ((char *)&byteValue), typeSize); + break; + } + case sizeof(jshort): { + jshort shortValue = ENVPTR->CallShortMethod(ENVONLY, in_obj, shortValueMid); + HDmemcpy(char_buf, ((char *)&shortValue), typeSize); + break; + } + case sizeof(jint): { + jint intValue = ENVPTR->CallIntMethod(ENVONLY, in_obj, intValueMid); + HDmemcpy(char_buf, ((char *)&intValue), typeSize); + break; + } + case sizeof(jlong): { + jlong longValue = ENVPTR->CallLongMethod(ENVONLY, in_obj, longValueMid); + HDmemcpy(char_buf, ((char *)&longValue), typeSize); + break; + } + } + break; + } /* H5T_INTEGER */ + case H5T_FLOAT: { + /* Convert each element */ + switch (typeSize) { + case sizeof(jfloat): { + jfloat floatValue = ENVPTR->CallFloatMethod(ENVONLY, in_obj, floatValueMid); + HDmemcpy(char_buf, ((char *)&floatValue), typeSize); + break; + } + case sizeof(jdouble): { + jdouble doubleValue = ENVPTR->CallDoubleMethod(ENVONLY, in_obj, doubleValueMid); + HDmemcpy(char_buf, ((char *)&doubleValue), typeSize); + break; + } + } + break; + } /* H5T_FLOAT */ + case H5T_REFERENCE: { + /* Convert each array element */ + jbyte *barray = (jbyte *)ENVPTR->GetByteArrayElements(ENVONLY, in_obj, 0); + HDmemcpy(char_buf, ((char *)barray), typeSize); + ENVPTR->ReleaseByteArrayElements(ENVONLY, in_obj, barray, 0); + break; + } /* H5T_REFERENCE */ + case H5T_STRING: { + htri_t is_variable = 0; + + if ((is_variable = H5Tis_variable_str(mem_type_id)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + /* Convert each pointer element */ + jsize length; + const char *utf8 = NULL; + + HDmemset(char_buf, 0, typeSize); + if (NULL != in_obj) { + PIN_JAVA_STRING(ENVONLY, in_obj, utf8, NULL, "translate_atomic_wbuf jobj not pinned"); + length = ENVPTR->GetStringUTFLength(ENVONLY, in_obj); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + if (is_variable) { + char *new_buf = (char *)calloc(1, (size_t)(length + 1)); + HDmemcpy(((char *)new_buf), utf8, (size_t)length); + HDmemcpy(char_buf, &new_buf, typeSize); + } + else { + HDmemcpy(char_buf, utf8, (size_t)length); + } + UNPIN_JAVA_STRING(ENVONLY, in_obj, utf8); + utf8 = NULL; + } + break; + } /* H5T_STRING */ + default: + H5_UNIMPLEMENTED(ENVONLY, "translate_atomic_wbuf: invalid class type"); + break; + } /* switch(type_class) */ + +done: + + return; +} + +void +translate_rbuf(JNIEnv *env, jobjectArray ret_buf, jlong mem_type_id, H5T_class_t type_class, jsize count, + void *raw_buf) +{ + hid_t memb = H5I_INVALID_HID; + int ret_buflen = -1; + jboolean found_jList = JNI_TRUE; + jobjectArray jList = NULL; + jobject jobj = NULL; + H5T_class_t vlClass; + size_t vlSize; + size_t i, x; + size_t typeSize; + // raw_buf is normally bytes except when used for variable length strings + char *char_buf = (char *)raw_buf; + + /* retrieve the java.util.ArrayList interface class */ + jclass arrCList = ENVPTR->FindClass(ENVONLY, "java/util/ArrayList"); + jmethodID arrListMethod = ENVPTR->GetMethodID(ENVONLY, arrCList, "<init>", "(I)V"); + jmethodID arrAddMethod = ENVPTR->GetMethodID(ENVONLY, arrCList, "add", "(Ljava/lang/Object;)Z"); + + if (!(typeSize = H5Tget_size(mem_type_id))) + H5_LIBRARY_ERROR(ENVONLY); + + ret_buflen = ENVPTR->GetArrayLength(ENVONLY, ret_buf); + if (ret_buflen < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "ret_buflen: Array length cannot be negative"); + + switch (type_class) { + case H5T_VLEN: { + if (!(memb = H5Tget_super(mem_type_id))) + H5_LIBRARY_ERROR(ENVONLY); + if ((vlClass = H5Tget_class(memb)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + if (!(vlSize = H5Tget_size(memb))) + H5_LIBRARY_ERROR(ENVONLY); + + /* Convert each element to a list */ + for (i = 0; i < (size_t)count; i++) { + hvl_t vl_elem; + + found_jList = JNI_TRUE; + jList = NULL; + + /* Get the number of sequence elements */ + HDmemcpy(&vl_elem, char_buf + i * sizeof(hvl_t), sizeof(hvl_t)); + jsize nelmts = (jsize)vl_elem.len; + if (vl_elem.len != (size_t)nelmts) + H5_JNI_FATAL_ERROR(ENVONLY, "translate_rbuf: overflow of number of VL elements"); + + if (nelmts < 0) + H5_BAD_ARGUMENT_ERROR(ENVONLY, "translate_rbuf: number of VL elements < 0"); + + /* The list we're going to return: */ + if (i < (size_t)ret_buflen) { + jList = ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)ret_buf, (jsize)i); + } + if (NULL == jList) { + found_jList = JNI_FALSE; + if (NULL == + (jList = (jobjectArray)ENVPTR->NewObject(ENVONLY, arrCList, arrListMethod, 0))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, + "translate_rbuf: failed to allocate list read buffer"); + } + + translate_rbuf(ENVONLY, jList, memb, vlClass, (jsize)nelmts, vl_elem.p); + if (found_jList == JNI_FALSE) { + jboolean addResult = + ENVPTR->CallBooleanMethod(ENVONLY, ret_buf, arrAddMethod, (jobject)jList); + if (!addResult) + H5_JNI_FATAL_ERROR(ENVONLY, "translate_rbuf: cannot add VL element"); + } + else { + ENVPTR->SetObjectArrayElement(ENVONLY, ret_buf, (jsize)i, (jobject)jList); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + } + ENVPTR->DeleteLocalRef(ENVONLY, jList); + } + break; + } /* H5T_VLEN */ + case H5T_COMPOUND: { + /* Convert each compound element to a list */ + for (i = 0; i < (size_t)count; i++) { + found_jList = JNI_TRUE; + jList = NULL; + + /* The list we're going to return: */ + if (i < (size_t)ret_buflen) { + jList = ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)ret_buf, (jsize)i); + } + if (NULL == jList) { + found_jList = JNI_FALSE; + if (NULL == + (jList = (jobjectArray)ENVPTR->NewObject(ENVONLY, arrCList, arrListMethod, 0))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, + "translate_rbuf: failed to allocate list read buffer"); + } + int nmembs = H5Tget_nmembers(mem_type_id); + /* Convert each element to a list */ + for (x = 0; x < (size_t)nmembs; x++) { + H5T_class_t memb_vlClass; + size_t memb_vlSize; + size_t memb_offset; + + if ((memb = H5Tget_member_type(mem_type_id, (unsigned int)x)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + memb_offset = H5Tget_member_offset(mem_type_id, (unsigned int)x); + + if ((memb_vlClass = H5Tget_class(memb)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + if (!(memb_vlSize = H5Tget_size(memb))) + H5_LIBRARY_ERROR(ENVONLY); + + jobj = translate_atomic_rbuf(ENVONLY, memb, memb_vlClass, + char_buf + i * typeSize + memb_offset); + if (jobj) { + if (found_jList == JNI_FALSE) + ENVPTR->CallBooleanMethod(ENVONLY, jList, arrAddMethod, (jobject)jobj); + else + ENVPTR->SetObjectArrayElement(ENVONLY, jList, (jsize)i, (jobject)jobj); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + ENVPTR->DeleteLocalRef(ENVONLY, jobj); + } + + H5Tclose(memb); + } + if (ret_buflen == 0) + ENVPTR->CallBooleanMethod(ENVONLY, ret_buf, arrAddMethod, jList); + else + ENVPTR->SetObjectArrayElement(ENVONLY, ret_buf, (jsize)i, jList); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + ENVPTR->DeleteLocalRef(ENVONLY, jList); + } + break; + } /* H5T_COMPOUND */ + case H5T_ARRAY: { + void *objBuf = NULL; + size_t typeCount; + + if (!(memb = H5Tget_super(mem_type_id))) + H5_LIBRARY_ERROR(ENVONLY); + if ((vlClass = H5Tget_class(memb)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + if (!(vlSize = H5Tget_size(memb))) + H5_LIBRARY_ERROR(ENVONLY); + if (!(typeSize = H5Tget_size(mem_type_id))) + H5_LIBRARY_ERROR(ENVONLY); + + typeCount = typeSize / vlSize; + + if (NULL == (objBuf = HDmalloc(typeSize))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "translate_rbuf: failed to allocate buffer"); + + /* Convert each element to a list */ + for (i = 0; i < (size_t)count; i++) { + found_jList = JNI_TRUE; + jList = NULL; + + /* Get the object element */ + HDmemcpy((char *)objBuf, char_buf + i * typeSize, typeSize); + + /* The list we're going to return: */ + if (i < (size_t)ret_buflen) { + if (NULL == + (jList = ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)ret_buf, (jsize)i))) + found_jList = JNI_FALSE; + } + if (NULL == jList) { + if (NULL == + (jList = (jobjectArray)ENVPTR->NewObject(ENVONLY, arrCList, arrListMethod, 0))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, + "translate_rbuf: failed to allocate list read buffer"); + } + + translate_rbuf(ENVONLY, jList, memb, vlClass, (jsize)typeCount, objBuf); + if (found_jList == JNI_FALSE) + ENVPTR->CallBooleanMethod(ENVONLY, ret_buf, arrAddMethod, jList); + else + ENVPTR->SetObjectArrayElement(ENVONLY, ret_buf, (jsize)i, jList); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + ENVPTR->DeleteLocalRef(ENVONLY, jList); + } + + if (objBuf) + HDfree(objBuf); + + break; + } /* H5T_ARRAY */ + case H5T_ENUM: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_INTEGER: + case H5T_FLOAT: + case H5T_REFERENCE: + case H5T_STRING: { + /* Convert each element to a list */ + for (i = 0; i < (size_t)count; i++) { + jobj = translate_atomic_rbuf(ENVONLY, mem_type_id, type_class, char_buf + i * typeSize); + if (jobj) { + if (ret_buflen == 0) + ENVPTR->CallBooleanMethod(ENVONLY, ret_buf, arrAddMethod, (jobject)jobj); + else + ENVPTR->SetObjectArrayElement(ENVONLY, ret_buf, (jsize)i, (jobject)jobj); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + ENVPTR->DeleteLocalRef(ENVONLY, jobj); + } + } + break; + } + default: + H5_UNIMPLEMENTED(ENVONLY, "translate_rbuf: invalid class type"); + break; + } /* switch(type_class) */ + +done: + + return; +} + +void +translate_wbuf(JNIEnv *env, jobjectArray in_buf, jlong mem_type_id, H5T_class_t type_class, jsize count, + void *raw_buf) +{ + hid_t memb = H5I_INVALID_HID; + jobjectArray jList = NULL; + jobject jobj = NULL; + H5T_class_t vlClass; + size_t vlSize; + size_t i, x; + size_t typeSize; + // raw_buf is normally bytes except when used for variable length strings + char *char_buf = (char *)raw_buf; + + /* retrieve the java.util.ArrayList interface class */ + jclass arrCList = ENVPTR->FindClass(ENVONLY, "java/util/ArrayList"); + /* retrieve the toArray method */ + jmethodID mToArray = ENVPTR->GetMethodID(ENVONLY, arrCList, "toArray", "()[Ljava/lang/Object;"); + + if (!(typeSize = H5Tget_size(mem_type_id))) + H5_LIBRARY_ERROR(ENVONLY); + + switch (type_class) { + case H5T_VLEN: { + if (!(memb = H5Tget_super(mem_type_id))) + H5_LIBRARY_ERROR(ENVONLY); + if ((vlClass = H5Tget_class((hid_t)memb)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + if (!(vlSize = H5Tget_size(memb))) + H5_LIBRARY_ERROR(ENVONLY); + + /* Convert each list to a vlen element */ + for (i = 0; i < (size_t)count; i++) { + hvl_t vl_elem; + + if (NULL == (jList = ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)in_buf, (jsize)i))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + /* invoke the toArray method */ + if (mToArray == NULL) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + jobjectArray array = (jobjectArray)ENVPTR->CallObjectMethod(ENVONLY, jList, mToArray); + jsize jnelmts = ENVPTR->GetArrayLength(ENVONLY, array); + + if (jnelmts < 0) + H5_BAD_ARGUMENT_ERROR(ENVONLY, "translate_wbuf: number of VL elements < 0"); + + vl_elem.len = (size_t)jnelmts; + + if (NULL == (vl_elem.p = HDmalloc((size_t)jnelmts * vlSize))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "translate_wbuf: failed to allocate vlen ptr buffer"); + + translate_wbuf(ENVONLY, array, memb, vlClass, (jsize)jnelmts, vl_elem.p); + + HDmemcpy(char_buf + i * sizeof(hvl_t), &vl_elem, sizeof(hvl_t)); + + ENVPTR->DeleteLocalRef(ENVONLY, jList); + } /* end for (i = 0; i < count; i++) */ + break; + } /* H5T_VLEN */ + case H5T_COMPOUND: { + /* Convert each list to a compound element */ + for (i = 0; i < (size_t)count; i++) { + if (NULL == (jList = ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)in_buf, (jsize)i))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + int nmembs = H5Tget_nmembers(mem_type_id); + + /* invoke the toArray method */ + if (mToArray == NULL) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + jobjectArray array = (jobjectArray)ENVPTR->CallObjectMethod(ENVONLY, jList, mToArray); + jsize jnelmts = ENVPTR->GetArrayLength(ENVONLY, array); + + if (jnelmts != nmembs) + H5_BAD_ARGUMENT_ERROR( + ENVONLY, "translate_wbuf: number of elements not equal to number of members"); + + /* Convert each compound object to an element */ + for (x = 0; x < (size_t)nmembs; x++) { + H5T_class_t memb_vlClass; + size_t memb_vlSize; + size_t memb_offset; + + if ((memb = H5Tget_member_type(mem_type_id, (unsigned int)x)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + memb_offset = H5Tget_member_offset(mem_type_id, (unsigned int)x); + + if ((memb_vlClass = H5Tget_class(memb)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + if (!(memb_vlSize = H5Tget_size(memb))) + H5_LIBRARY_ERROR(ENVONLY); + + jobject arr_obj = ENVPTR->GetObjectArrayElement(ENVONLY, array, (jsize)x); + translate_atomic_wbuf(ENVONLY, arr_obj, memb, memb_vlClass, + char_buf + i * typeSize + memb_offset); + ENVPTR->DeleteLocalRef(ENVONLY, arr_obj); + H5Tclose(memb); + } + + ENVPTR->DeleteLocalRef(ENVONLY, jList); + } /* end for (i = 0; i < count; i++) */ + break; + } /* H5T_COMPOUND */ + case H5T_ARRAY: { + if (!(memb = H5Tget_super(mem_type_id))) + H5_LIBRARY_ERROR(ENVONLY); + if ((vlClass = H5Tget_class(memb)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + if (!(vlSize = H5Tget_size(memb))) + H5_LIBRARY_ERROR(ENVONLY); + + /* Convert each list to an array element */ + for (i = 0; i < (size_t)count; i++) { + if (NULL == (jList = ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)in_buf, (jsize)i))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + /* invoke the toArray method */ + if (mToArray == NULL) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + jobjectArray array = (jobjectArray)ENVPTR->CallObjectMethod(ENVONLY, jList, mToArray); + jsize jnelmts = ENVPTR->GetArrayLength(ENVONLY, array); + + if (jnelmts < 0) + H5_BAD_ARGUMENT_ERROR(ENVONLY, "translate_wbuf: number of array elements < 0"); + + translate_wbuf(ENVONLY, array, memb, vlClass, jnelmts, + char_buf + i * vlSize * (size_t)jnelmts); + + ENVPTR->DeleteLocalRef(ENVONLY, jList); + } /* end for (i = 0; i < count; i++) */ + break; + } /* H5T_ARRAY */ + case H5T_ENUM: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_INTEGER: + case H5T_FLOAT: + case H5T_REFERENCE: + case H5T_STRING: { + /* Convert each list to an array element */ + for (i = 0; i < (size_t)count; i++) { + if (NULL == (jobj = ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)in_buf, (jsize)i))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + translate_atomic_wbuf(ENVONLY, jobj, mem_type_id, type_class, char_buf + i * typeSize); + ENVPTR->DeleteLocalRef(ENVONLY, jobj); + } + break; + } + default: + H5_UNIMPLEMENTED(ENVONLY, "translate_wbuf: invalid class type"); + break; + } /* switch(type_class) */ + +done: + + return; +} + #ifdef __cplusplus } #endif diff --git a/java/src/jni/h5util.h b/java/src/jni/h5util.h index fa0a061..d8ecef9 100644 --- a/java/src/jni/h5util.h +++ b/java/src/jni/h5util.h @@ -51,6 +51,11 @@ extern int h5str_dump_simple_mem(JNIEnv *env, FILE *stream, hid_t attr, int b extern htri_t H5Tdetect_variable_str(hid_t tid); +extern void translate_rbuf(JNIEnv *env, jobjectArray ret_buf, jlong mem_type_id, H5T_class_t type_class, + jsize count, void *raw_buf); +extern void translate_wbuf(JNIEnv *env, jobjectArray ret_buf, jlong mem_type_id, H5T_class_t type_class, + jsize count, void *raw_buf); + /* * Symbols used to format the output of h5str_sprintf and * to interpret the input to h5str_convert. diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index 3e18d35..48ea0f5 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -120,23 +120,39 @@ else () endif () get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) -set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<CONFIG:Debug>:${CMAKE_DEBUG_POSTFIX}>;") +set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<OR:$<CONFIG:Debug>,$<CONFIG:Developer>>:${CMAKE_DEBUG_POSTFIX}>;") set (CMAKE_JAVA_CLASSPATH ".") foreach (CMAKE_INCLUDE_PATH ${CMAKE_JAVA_INCLUDE_PATH}) set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${CMAKE_INCLUDE_PATH}") endforeach () if (HDF5_TEST_JAVA AND HDF5_TEST_SERIAL) + add_test ( + NAME JUnit-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove + test.h5 + testF2.h5 + testPf00000.h5 + testPf00001.h5 + WORKING_DIRECTORY ${HDF5_BINARY_DIR}/java/test + ) + set_tests_properties (JUnit-clear-objects PROPERTIES FIXTURES_SETUP clear_JUnit) + + add_test ( + NAME JUnit-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove + test.h5 + testF2.h5 + testPf00000.h5 + testPf00001.h5 + WORKING_DIRECTORY ${HDF5_BINARY_DIR}/java/test + ) + set_tests_properties (JUnit-clean-objects PROPERTIES FIXTURES_CLEANUP clear_JUnit) + foreach (test_file ${HDF5_JAVA_TEST_SOURCES}) set (TEST_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${HDF5_JAVA_TEST_LIB_TARGET}_${test_file}_JAR_FILE}") add_test ( - NAME JUnit-${test_file}-clearall-objects - COMMAND ${CMAKE_COMMAND} -E remove - JUnit-${test_file}.out - JUnit-${test_file}.out.err - ) - add_test ( NAME JUnit-${test_file} COMMAND "${CMAKE_COMMAND}" -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" @@ -156,7 +172,8 @@ if (HDF5_TEST_JAVA AND HDF5_TEST_SERIAL) ) set_tests_properties (JUnit-${test_file} PROPERTIES ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/testdir2" - DEPENDS "JUnit-${test_file}-clearall-objects" + FIXTURES_REQUIRED clear_JUnit + WORKING_DIRECTORY ${HDF5_BINARY_DIR}/java/test ) endforeach () @@ -169,13 +186,6 @@ if (HDF5_TEST_JAVA AND HDF5_TEST_SERIAL) macro (DO_VOL_TEST voltest volname volinfo volclasspath) #message(STATUS "${voltest}-${volname} with ${volinfo}") - add_test ( - NAME JUnit-VOL-${volname}-${voltest}-clearall-objects - COMMAND ${CMAKE_COMMAND} -E remove - JUnit-VOL-${volname}-${voltest}.out - JUnit-VOL-${volname}-${voltest}.out.err - WORKING_DIRECTORY ${HDF5_BINARY_DIR}/java/test/${volname} - ) add_test (NAME JUnit-VOL-${volname}-${voltest} COMMAND "${CMAKE_COMMAND}" -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" @@ -196,7 +206,20 @@ if (HDF5_TEST_JAVA AND HDF5_TEST_SERIAL) ) set_tests_properties (JUnit-VOL-${volname}-${voltest} PROPERTIES ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/testdir2" - DEPENDS "JUnit-VOL-${volname}-${voltest}-clearall-objects" + WORKING_DIRECTORY ${HDF5_BINARY_DIR}/java/test/${volname} + ) + add_test ( + NAME JUnit-VOL-${volname}-${voltest}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove + test.h5 + testF2.h5 + testPf00000.h5 + testPf00001.h5 + WORKING_DIRECTORY ${HDF5_BINARY_DIR}/java/test/${volname} + ) + set_tests_properties (JUnit-VOL-${volname}-${voltest}-clean-objects PROPERTIES + ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/testdir2" + DEPENDS "JUnit-VOL-${volname}-${voltest}" WORKING_DIRECTORY ${HDF5_BINARY_DIR}/java/test/${volname} ) endmacro () @@ -208,6 +231,8 @@ if (HDF5_TEST_JAVA AND HDF5_TEST_SERIAL) vol_pass_through2 ) + # native VOL = 0 + # pass-through VOL = 1 set (vol_native native) set (vol_pass_through1 "pass_through under_vol=0\;under_info={}") set (vol_pass_through2 "pass_through under_vol=505\;under_info={under_vol=0\;under_info={}}") diff --git a/java/test/Makefile.am b/java/test/Makefile.am index bb6be7f..6a407db 100644 --- a/java/test/Makefile.am +++ b/java/test/Makefile.am @@ -27,7 +27,7 @@ classes: pkgpath = test hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar -CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/junit.jar:$(top_srcdir)/java/lib/hamcrest-core.jar:$(top_srcdir)/java/lib/slf4j-api-1.7.33.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.33.jar:$$CLASSPATH +CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/junit.jar:$(top_srcdir)/java/lib/hamcrest-core.jar:$(top_srcdir)/java/lib/slf4j-api-2.0.6.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-2.0.6.jar:$$CLASSPATH jarfile = jar$(PACKAGE_TARNAME)test.jar diff --git a/java/test/TestH5A.java b/java/test/TestH5A.java index 4437ec7..90fe24c 100644 --- a/java/test/TestH5A.java +++ b/java/test/TestH5A.java @@ -46,6 +46,7 @@ public class TestH5A { private static final int DIM_Y = 6; long H5fid = HDF5Constants.H5I_INVALID_HID; long H5dsid = HDF5Constants.H5I_INVALID_HID; + long H5atid = HDF5Constants.H5I_INVALID_HID; long H5did = HDF5Constants.H5I_INVALID_HID; long[] H5dims = {DIM_X, DIM_Y}; long type_id = HDF5Constants.H5I_INVALID_HID; @@ -136,8 +137,12 @@ public class TestH5A { } catch (Exception ex) { } - - _deleteFile(H5_FILE); + if (H5atid > 0) + try { + H5.H5Tclose(H5atid); + } + catch (Exception ex) { + } if (type_id > 0) try { @@ -163,6 +168,8 @@ public class TestH5A { } catch (Exception ex) { } + + _deleteFile(H5_FILE); System.out.println(); } @@ -1072,7 +1079,7 @@ public class TestH5A { HDF5Constants.H5P_DEFAULT); assertTrue("testH5Awrite_readVL: ", attr_id >= 0); - H5.H5Awrite_VLStrings(attr_id, atype_id, str_data); + H5.H5AwriteVL(attr_id, atype_id, str_data); H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); @@ -1084,7 +1091,7 @@ public class TestH5A { strs[j] = ""; } try { - H5.H5Aread_VLStrings(attr_id, atype_id, strs); + H5.H5AreadVL(attr_id, atype_id, strs); } catch (Exception ex) { ex.printStackTrace(); @@ -1501,9 +1508,8 @@ public class TestH5A { H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); - for (int j = 0; j < dims.length; j++) { + for (int j = 0; j < dims.length; j++) lsize *= dims[j]; - } // Read Integer data ArrayList[] vl_readbuf = new ArrayList[4]; @@ -1576,4 +1582,422 @@ public class TestH5A { } } } + + @Test + public void testH5AVLwrVL() + { + String attr_int_name = "VLIntdata"; + long attr_int_id = HDF5Constants.H5I_INVALID_HID; + long atype_int_id = HDF5Constants.H5I_INVALID_HID; + long base_atype_int_id = HDF5Constants.H5I_INVALID_HID; + long aspace_id = HDF5Constants.H5I_INVALID_HID; + long[] dims = {4}; + long lsize = 1; + + ArrayList[] base_vl_int_data = new ArrayList[4]; + ArrayList[] vl_int_data = new ArrayList[4]; + try { + // Write Integer data + vl_int_data[0] = new ArrayList<Integer>(Arrays.asList(1)); + vl_int_data[1] = new ArrayList<Integer>(Arrays.asList(2, 3)); + vl_int_data[2] = new ArrayList<Integer>(Arrays.asList(4, 5, 6)); + vl_int_data[3] = new ArrayList<Integer>(Arrays.asList(7, 8, 9, 10)); + Class dataClass = vl_int_data.getClass(); + assertTrue("testH5AVLwrVL.getClass: " + dataClass, dataClass.isArray()); + + // Write VL data + base_vl_int_data[0] = new ArrayList<ArrayList<Integer>>(); + base_vl_int_data[0].add(vl_int_data[0]); + base_vl_int_data[1] = new ArrayList<ArrayList<Integer>>(); + base_vl_int_data[1].add(vl_int_data[0]); + base_vl_int_data[1].add(vl_int_data[1]); + base_vl_int_data[2] = new ArrayList<ArrayList<Integer>>(); + base_vl_int_data[2].add(vl_int_data[0]); + base_vl_int_data[2].add(vl_int_data[1]); + base_vl_int_data[2].add(vl_int_data[2]); + base_vl_int_data[3] = new ArrayList<ArrayList<Integer>>(); + base_vl_int_data[3].add(vl_int_data[0]); + base_vl_int_data[3].add(vl_int_data[1]); + base_vl_int_data[3].add(vl_int_data[2]); + base_vl_int_data[3].add(vl_int_data[3]); + + try { + atype_int_id = H5.H5Tvlen_create(HDF5Constants.H5T_STD_U32LE); + assertTrue("testH5AVLwr.H5Tvlen_create: ", atype_int_id >= 0); + base_atype_int_id = H5.H5Tvlen_create(atype_int_id); + assertTrue("testH5AVLwrVL.H5Tvlen_create: ", base_atype_int_id >= 0); + } + catch (Exception err) { + if (base_atype_int_id > 0) + try { + H5.H5Tclose(base_atype_int_id); + } + catch (Exception ex) { + } + if (atype_int_id > 0) + try { + H5.H5Tclose(atype_int_id); + } + catch (Exception ex) { + } + err.printStackTrace(); + fail("H5.testH5AVLwrVL: " + err); + } + + try { + aspace_id = H5.H5Screate_simple(1, dims, null); + assertTrue(aspace_id > 0); + attr_int_id = H5.H5Acreate(H5did, attr_int_name, base_atype_int_id, aspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + assertTrue("testH5AVLwrVL: ", attr_int_id >= 0); + + H5.H5AwriteVL(attr_int_id, base_atype_int_id, base_vl_int_data); + } + catch (Exception err) { + if (attr_int_id > 0) + try { + H5.H5Aclose(attr_int_id); + } + catch (Exception ex) { + } + if (atype_int_id > 0) + try { + H5.H5Tclose(atype_int_id); + } + catch (Exception ex) { + } + err.printStackTrace(); + fail("H5.testH5AVLwrVL: " + err); + } + finally { + if (aspace_id > 0) + try { + H5.H5Sclose(aspace_id); + } + catch (Exception ex) { + } + } + + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + + for (int j = 0; j < dims.length; j++) + lsize *= dims[j]; + + // Read Integer data + ArrayList[] base_vl_readbuf = new ArrayList[4]; + for (int j = 0; j < lsize; j++) + base_vl_readbuf[j] = new ArrayList<ArrayList<Integer>>(); + + try { + H5.H5AreadVL(attr_int_id, base_atype_int_id, base_vl_readbuf); + } + catch (Exception ex) { + ex.printStackTrace(); + } + ArrayList<ArrayList<Integer>> vl_readbuf = (ArrayList<ArrayList<Integer>>)base_vl_readbuf[0]; + assertTrue("vl_readbuf 0 exists", vl_readbuf != null); + ArrayList<Integer> vl_readbuf_int = (ArrayList<Integer>)(vl_readbuf.get(0)); + /* + * System.out.println(); System.out.println("vl_readbuf: " + vl_readbuf); + * System.out.println("vl_readbuf_int: " + vl_readbuf_int); + */ + assertTrue("testHADVLwrVL:" + vl_readbuf_int.get(0), + vl_int_data[0].get(0).equals(vl_readbuf_int.get(0))); + + vl_readbuf = (ArrayList<ArrayList<Integer>>)base_vl_readbuf[1]; + vl_readbuf_int = (ArrayList<Integer>)(vl_readbuf.get(1)); + /* + * System.out.println("vl_readbuf: " + vl_readbuf); System.out.println("vl_readbuf_int: " + + * vl_readbuf_int); + */ + assertTrue("testH5AVLwrVL:" + vl_readbuf_int.get(1), + vl_int_data[1].get(1).equals(vl_readbuf_int.get(1))); + + vl_readbuf = (ArrayList<ArrayList<Integer>>)base_vl_readbuf[2]; + vl_readbuf_int = (ArrayList<Integer>)(vl_readbuf.get(2)); + /* + * System.out.println("vl_readbuf: " + vl_readbuf); System.out.println("vl_readbuf_int: " + + * vl_readbuf_int); + */ + assertTrue("testH5AVLwrVL:" + vl_readbuf_int.get(2), + vl_int_data[2].get(2).equals(vl_readbuf_int.get(2))); + + vl_readbuf = (ArrayList<ArrayList<Integer>>)base_vl_readbuf[3]; + vl_readbuf_int = (ArrayList<Integer>)(vl_readbuf.get(3)); + /* + * System.out.println("vl_readbuf: " + vl_readbuf); System.out.println("vl_readbuf_int: " + + * vl_readbuf_int); + */ + assertTrue("testH5AVLwrVL:" + vl_readbuf_int.get(3), + vl_int_data[3].get(3).equals(vl_readbuf_int.get(3))); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.testH5AVLwrVL: " + err); + } + finally { + if (attr_int_id > 0) + try { + H5.H5Aclose(attr_int_id); + } + catch (Exception ex) { + } + if (atype_int_id > 0) + try { + H5.H5Tclose(atype_int_id); + } + catch (Exception ex) { + } + if (base_atype_int_id > 0) + try { + H5.H5Tclose(base_atype_int_id); + } + catch (Exception ex) { + } + } + } + + @Test + public void testH5AArraywr() + { + String att_int_name = "ArrayIntdata"; + long att_int_id = HDF5Constants.H5I_INVALID_HID; + long atype_int_id = HDF5Constants.H5I_INVALID_HID; + long aspace_id = HDF5Constants.H5I_INVALID_HID; + long[] dims = {4}; + long lsize = 1; + + ArrayList[] arr_int_data = new ArrayList[4]; + try { + // Write Integer data + arr_int_data[0] = new ArrayList<Integer>(Arrays.asList(1, 2, 3, 4)); + arr_int_data[1] = new ArrayList<Integer>(Arrays.asList(2, 3, 4, 5)); + arr_int_data[2] = new ArrayList<Integer>(Arrays.asList(4, 5, 6, 7)); + arr_int_data[3] = new ArrayList<Integer>(Arrays.asList(7, 8, 9, 10)); + Class dataClass = arr_int_data.getClass(); + assertTrue("testH5AArraywr.getClass: " + dataClass, dataClass.isArray()); + + try { + atype_int_id = H5.H5Tarray_create(HDF5Constants.H5T_STD_U32LE, 1, dims); + assertTrue("testH5AArraywr.H5Tarray_create: ", atype_int_id >= 0); + } + catch (Exception err) { + if (atype_int_id > 0) + try { + H5.H5Tclose(atype_int_id); + } + catch (Exception ex) { + } + err.printStackTrace(); + fail("H5.testH5AArraywr: " + err); + } + + try { + aspace_id = H5.H5Screate_simple(1, dims, null); + assertTrue(aspace_id > 0); + att_int_id = H5.H5Acreate(H5did, att_int_name, atype_int_id, aspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + assertTrue("testH5AVLwr: ", att_int_id >= 0); + + H5.H5AwriteVL(att_int_id, atype_int_id, arr_int_data); + } + catch (Exception err) { + if (att_int_id > 0) + try { + H5.H5Aclose(att_int_id); + } + catch (Exception ex) { + } + if (atype_int_id > 0) + try { + H5.H5Tclose(atype_int_id); + } + catch (Exception ex) { + } + err.printStackTrace(); + fail("H5.testH5AVLwr: " + err); + } + finally { + if (aspace_id > 0) + try { + H5.H5Sclose(aspace_id); + } + catch (Exception ex) { + } + } + + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + + for (int j = 0; j < dims.length; j++) + lsize *= dims[j]; + + // Read Integer data + ArrayList[] arr_readbuf = new ArrayList[4]; + for (int j = 0; j < lsize; j++) + arr_readbuf[j] = new ArrayList<Integer>(); + + try { + H5.H5AreadVL(att_int_id, atype_int_id, arr_readbuf); + } + catch (Exception ex) { + ex.printStackTrace(); + } + assertTrue("testH5AVLwr:" + arr_readbuf[0].get(0), + arr_int_data[0].get(0).equals(arr_readbuf[0].get(0))); + assertTrue("testH5AVLwr:" + arr_readbuf[1].get(0), + arr_int_data[1].get(0).equals(arr_readbuf[1].get(0))); + assertTrue("testH5AVLwr:" + arr_readbuf[2].get(0), + arr_int_data[2].get(0).equals(arr_readbuf[2].get(0))); + assertTrue("testH5AVLwr:" + arr_readbuf[3].get(0), + arr_int_data[3].get(0).equals(arr_readbuf[3].get(0))); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.testH5AArraywr: " + err); + } + finally { + if (att_int_id > 0) + try { + H5.H5Aclose(att_int_id); + } + catch (Exception ex) { + } + if (atype_int_id > 0) + try { + H5.H5Tclose(atype_int_id); + } + catch (Exception ex) { + } + } + } + + @Test + public void testH5AArray_string_buffer() throws Throwable + { + String att_str_name = "ArrayStringdata"; + long att_str_id = HDF5Constants.H5I_INVALID_HID; + long atype_str_id = HDF5Constants.H5I_INVALID_HID; + long aspace_id = HDF5Constants.H5I_INVALID_HID; + long[] strdims = {4}; + long[] dims = {6}; + long lsize = 1; + + String[] str_data0 = {"Parting", "is such", "sweet", "sorrow."}; + String[] str_data1 = {"Testing", "one", "two", "three."}; + String[] str_data2 = {"Dog,", "man's", "best", "friend."}; + String[] str_data3 = {"Diamonds", "are", "a", "girls!"}; + String[] str_data4 = {"S A", "T U R", "D A Y", "night"}; + String[] str_data5 = {"That's", "all", "folks", "!!!"}; + + ArrayList[] arr_str_data = new ArrayList[6]; + arr_str_data[0] = new ArrayList<String>(Arrays.asList(str_data0)); + arr_str_data[1] = new ArrayList<String>(Arrays.asList(str_data1)); + arr_str_data[2] = new ArrayList<String>(Arrays.asList(str_data2)); + arr_str_data[3] = new ArrayList<String>(Arrays.asList(str_data3)); + arr_str_data[4] = new ArrayList<String>(Arrays.asList(str_data4)); + arr_str_data[5] = new ArrayList<String>(Arrays.asList(str_data5)); + + try { + H5atid = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5AArray_string_buffer.H5.H5Tcopy: " + err); + } + assertTrue("testH5AArray_string_buffer.H5Tcopy: ", H5atid >= 0); + try { + H5.H5Tset_size(H5atid, HDF5Constants.H5T_VARIABLE); + assertTrue("testH5AArray_string_buffer.H5Tis_variable_str", H5.H5Tis_variable_str(H5atid)); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5DArray_string_buffer.H5Tset_size: " + err); + } + try { + atype_str_id = H5.H5Tarray_create(H5atid, 1, strdims); + assertTrue("testH5AArray_string_buffer.H5Tarray_create: ", atype_str_id >= 0); + } + catch (Exception err) { + if (atype_str_id > 0) + try { + H5.H5Tclose(atype_str_id); + } + catch (Exception ex) { + } + err.printStackTrace(); + fail("testH5AArray_string_buffer: " + err); + } + + try { + aspace_id = H5.H5Screate_simple(1, dims, null); + assertTrue(aspace_id > 0); + att_str_id = H5.H5Acreate(H5did, att_str_name, atype_str_id, aspace_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + assertTrue("testH5AArray_string_buffer: ", att_str_id >= 0); + + H5.H5AwriteVL(att_str_id, atype_str_id, arr_str_data); + } + catch (Exception err) { + if (att_str_id > 0) + try { + H5.H5Dclose(att_str_id); + } + catch (Exception ex) { + } + if (atype_str_id > 0) + try { + H5.H5Tclose(atype_str_id); + } + catch (Exception ex) { + } + err.printStackTrace(); + fail("testH5AArray_string_buffer: " + err); + } + finally { + if (aspace_id > 0) + try { + H5.H5Sclose(aspace_id); + } + catch (Exception ex) { + } + } + + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + + for (int j = 0; j < dims.length; j++) + lsize *= dims[j]; + + ArrayList[] arr_readbuf = new ArrayList[6]; + for (int j = 0; j < lsize; j++) + arr_readbuf[j] = new ArrayList<String>(); + + try { + H5.H5AreadVL(att_str_id, atype_str_id, arr_readbuf); + } + catch (Exception ex) { + ex.printStackTrace(); + } + finally { + if (att_str_id > 0) + try { + H5.H5Aclose(att_str_id); + } + catch (Exception ex) { + } + if (atype_str_id > 0) + try { + H5.H5Tclose(atype_str_id); + } + catch (Exception ex) { + } + } + assertTrue("testH5AArray_string_buffer:" + arr_readbuf[0].get(0), + arr_str_data[0].get(0).equals(arr_readbuf[0].get(0))); + assertTrue("testH5AArray_string_buffer:" + arr_readbuf[1].get(0), + arr_str_data[1].get(0).equals(arr_readbuf[1].get(0))); + assertTrue("testH5AArray_string_buffer:" + arr_readbuf[2].get(0), + arr_str_data[2].get(0).equals(arr_readbuf[2].get(0))); + assertTrue("testH5AArray_string_buffer:" + arr_readbuf[3].get(0), + arr_str_data[3].get(0).equals(arr_readbuf[3].get(0))); + } } diff --git a/java/test/TestH5D.java b/java/test/TestH5D.java index f7e5702..eacaabf 100644 --- a/java/test/TestH5D.java +++ b/java/test/TestH5D.java @@ -31,6 +31,7 @@ import hdf.hdf5lib.exceptions.HDF5LibraryException; import org.junit.After; import org.junit.Before; +import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestName; @@ -157,7 +158,7 @@ public class TestH5D { assertTrue("TestH5D._createDataset.H5Dcreate: ", H5did >= 0); } - private final void _createVLDataset(long fid, long dsid, String name, long dapl) + private final void _createVLStrDataset(String name, long dapl) { try { H5dtid = H5.H5Tcopy(HDF5Constants.H5T_C_S1); @@ -166,24 +167,24 @@ public class TestH5D { err.printStackTrace(); fail("H5.H5Tcopy: " + err); } - assertTrue("TestH5D._createVLDataset.H5Tcopy: ", H5dtid >= 0); + assertTrue("TestH5D._createVLStrDataset.H5Tcopy: ", H5dtid >= 0); try { H5.H5Tset_size(H5dtid, HDF5Constants.H5T_VARIABLE); - assertTrue("TestH5D._createVLDataset.H5Tis_variable_str", H5.H5Tis_variable_str(H5dtid)); + assertTrue("TestH5D._createVLStrDataset.H5Tis_variable_str", H5.H5Tis_variable_str(H5dtid)); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Tset_size: " + err); } try { - H5did = H5.H5Dcreate(fid, name, H5dtid, dsid, HDF5Constants.H5P_DEFAULT, + H5did = H5.H5Dcreate(H5fid, name, H5dtid, H5dsid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Dcreate: " + err); } - assertTrue("TestH5D._createVLDataset.H5Dcreate: ", H5did >= 0); + assertTrue("TestH5D._createVLStrDataset.H5Dcreate: ", H5did >= 0); } private final void _closeH5file() throws HDF5LibraryException @@ -934,7 +935,7 @@ public class TestH5D { buf_data[(indx * DIM_Y) + jndx] == 126); } - @Test + @Ignore public void testH5Dvlen_get_buf_size() { String[] str_data = {"Parting", "is such", "sweet", "sorrow.", "Testing", "one", "two", "three.", @@ -945,12 +946,12 @@ public class TestH5D { for (int idx = 0; idx < str_data.length; idx++) str_data_bytes += str_data[idx].length() + 1; // Account for terminating null - _createVLDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + _createVLStrDataset("dset", HDF5Constants.H5P_DEFAULT); try { if ((H5did >= 0) && (H5dtid >= 0)) - H5.H5Dwrite_VLStrings(H5did, H5dtid, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, str_data); + H5.H5DwriteVL(H5did, H5dtid, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, str_data); } catch (Exception e) { e.printStackTrace(); @@ -964,26 +965,122 @@ public class TestH5D { assertTrue("H5Dvlen_get_buf_size " + vl_size + " == " + str_data_bytes, vl_size == str_data_bytes); } - @Test - public void testH5Dvlen_read_default_buffer() throws Throwable + @Ignore + public void testH5Dvlen_string_buffer() throws Throwable { - String[] str_data = {"Parting", "is such", "sweet", "sorrow.", "Testing", "one", "two", "three.", - "Dog,", "man's", "best", "friend.", "Diamonds", "are", "a", "girls!", - "S A", "T U R", "D A Y", "night", "That's", "all", "folks", "!!!"}; - byte[] read_data = new byte[512]; + String dset_str_name = "VLStringdata"; + long dset_str_id = HDF5Constants.H5I_INVALID_HID; + long dtype_str_id = HDF5Constants.H5I_INVALID_HID; + long dspace_id = HDF5Constants.H5I_INVALID_HID; + long[] dims = {64}; + long lsize = 1; - _createVLDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + String[] str_data0 = {"Parting", "is such", "sweet", "sorrow."}; + String[] str_data1 = {"Testing", "one", "two", "three."}; + String[] str_data2 = {"Dog,", "man's", "best", "friend."}; + String[] str_data3 = {"Diamonds", "are", "a", "girls!"}; + String[] str_data4 = {"S A", "T U R", "D A Y", "night"}; + String[] str_data5 = {"That's", "all", "folks", "!!!"}; + + ArrayList[] vl_str_data = new ArrayList[6]; + vl_str_data[0] = new ArrayList<String>(Arrays.asList(str_data0)); + vl_str_data[1] = new ArrayList<String>(Arrays.asList(str_data1)); + vl_str_data[2] = new ArrayList<String>(Arrays.asList(str_data2)); + vl_str_data[3] = new ArrayList<String>(Arrays.asList(str_data3)); + vl_str_data[4] = new ArrayList<String>(Arrays.asList(str_data4)); + vl_str_data[5] = new ArrayList<String>(Arrays.asList(str_data5)); try { - H5.H5Dwrite_VLStrings(H5did, H5dtid, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, str_data); + H5dtid = H5.H5Tcopy(HDF5Constants.H5T_C_S1); } - catch (Exception e) { - e.printStackTrace(); + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Dvlen_string_buffer.H5.H5Tcopy: " + err); + } + assertTrue("testH5Dvlen_string_buffer.H5Tcopy: ", H5dtid >= 0); + try { + H5.H5Tset_size(H5dtid, HDF5Constants.H5T_VARIABLE); + assertTrue("testH5Dvlen_string_buffer.H5Tis_variable_str", H5.H5Tis_variable_str(H5dtid)); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Dvlen_string_buffer.H5Tset_size: " + err); + } + try { + dtype_str_id = H5.H5Tvlen_create(H5dtid); + assertTrue("testH5Dvlen_string_buffer.H5Tvlen_create: ", dtype_str_id >= 0); + } + catch (Exception err) { + if (dtype_str_id > 0) + try { + H5.H5Tclose(dtype_str_id); + } + catch (Exception ex) { + } + err.printStackTrace(); + fail("testH5Dvlen_string_buffer: " + err); + } + + try { + dspace_id = H5.H5Screate_simple(1, dims, null); + assertTrue(dspace_id > 0); + dset_str_id = + H5.H5Dcreate(H5fid, dset_str_name, dtype_str_id, dspace_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + assertTrue("testH5Dvlen_string_buffer: ", dset_str_id >= 0); + + H5.H5DwriteVL(dset_str_id, dtype_str_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, vl_str_data); + } + catch (Exception err) { + if (dset_str_id > 0) + try { + H5.H5Dclose(dset_str_id); + } + catch (Exception ex) { + } + if (dtype_str_id > 0) + try { + H5.H5Tclose(dtype_str_id); + } + catch (Exception ex) { + } + err.printStackTrace(); + fail("testH5Dvlen_string_buffer: " + err); + } + finally { + if (dspace_id > 0) + try { + H5.H5Sclose(dspace_id); + } + catch (Exception ex) { + } } - H5.H5Dread(H5did, H5dtid, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, - read_data); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + + for (int j = 0; j < dims.length; j++) + lsize *= dims[j]; + + ArrayList[] vl_readbuf = new ArrayList[4]; + for (int j = 0; j < lsize; j++) + vl_readbuf[j] = new ArrayList<String>(); + + try { + H5.H5DreadVL(dset_str_id, dtype_str_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, vl_readbuf); + } + catch (Exception ex) { + ex.printStackTrace(); + } + assertTrue("testH5Dvlen_string_buffer:" + vl_readbuf[0].get(0), + vl_str_data[0].get(0).equals(vl_readbuf[0].get(0))); + assertTrue("testH5Dvlen_string_buffer:" + vl_readbuf[1].get(0), + vl_str_data[1].get(0).equals(vl_readbuf[1].get(0))); + assertTrue("testH5Dvlen_string_buffer:" + vl_readbuf[2].get(0), + vl_str_data[2].get(0).equals(vl_readbuf[2].get(0))); + assertTrue("testH5Dvlen_string_buffer:" + vl_readbuf[3].get(0), + vl_str_data[3].get(0).equals(vl_readbuf[3].get(0))); } @Test @@ -994,20 +1091,21 @@ public class TestH5D { "S A", "T U R", "D A Y", "night", "That's", "all", "folks", "!!!"}; String[] str_rdata = new String[DIM_X * DIM_Y]; - _createVLDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + _createVLStrDataset("dset", HDF5Constants.H5P_DEFAULT); try { if ((H5did >= 0) && (H5dtid >= 0)) - H5.H5Dwrite_VLStrings(H5did, H5dtid, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, str_wdata); + H5.H5DwriteVL(H5did, H5dtid, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, str_wdata); } catch (Exception e) { e.printStackTrace(); } + try { if ((H5did >= 0) && (H5dtid >= 0)) - H5.H5Dread_VLStrings(H5did, H5dtid, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, str_rdata); + H5.H5DreadVL(H5did, H5dtid, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, str_rdata); } catch (Exception e) { e.printStackTrace(); @@ -1153,51 +1251,50 @@ public class TestH5D { H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); - for (int j = 0; j < dims.length; j++) { + for (int j = 0; j < dims.length; j++) lsize *= dims[j]; - } // Read Integer data - ArrayList[] vl_readbuf = new ArrayList[4]; + ArrayList[] vl_int_readbuf = new ArrayList[4]; for (int j = 0; j < lsize; j++) - vl_readbuf[j] = new ArrayList<Integer>(); + vl_int_readbuf[j] = new ArrayList<Integer>(); try { H5.H5DreadVL(dset_int_id, dtype_int_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, vl_readbuf); + HDF5Constants.H5P_DEFAULT, vl_int_readbuf); } catch (Exception ex) { ex.printStackTrace(); } - assertTrue("testH5DVLwr:" + vl_readbuf[0].get(0), - vl_int_data[0].get(0).equals(vl_readbuf[0].get(0))); - assertTrue("testH5DVLwr:" + vl_readbuf[1].get(0), - vl_int_data[1].get(0).equals(vl_readbuf[1].get(0))); - assertTrue("testH5DVLwr:" + vl_readbuf[2].get(0), - vl_int_data[2].get(0).equals(vl_readbuf[2].get(0))); - assertTrue("testH5DVLwr:" + vl_readbuf[3].get(0), - vl_int_data[3].get(0).equals(vl_readbuf[3].get(0))); + assertTrue("testH5DVLwr:" + vl_int_readbuf[0].get(0), + vl_int_data[0].get(0).equals(vl_int_readbuf[0].get(0))); + assertTrue("testH5DVLwr:" + vl_int_readbuf[1].get(0), + vl_int_data[1].get(0).equals(vl_int_readbuf[1].get(0))); + assertTrue("testH5DVLwr:" + vl_int_readbuf[2].get(0), + vl_int_data[2].get(0).equals(vl_int_readbuf[2].get(0))); + assertTrue("testH5DVLwr:" + vl_int_readbuf[3].get(0), + vl_int_data[3].get(0).equals(vl_int_readbuf[3].get(0))); // Read Double data - vl_readbuf = new ArrayList[4]; + ArrayList[] vl_dbl_readbuf = new ArrayList[4]; for (int j = 0; j < lsize; j++) - vl_readbuf[j] = new ArrayList<Double>(); + vl_dbl_readbuf[j] = new ArrayList<Double>(); try { H5.H5DreadVL(dset_dbl_id, dtype_dbl_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, vl_readbuf); + HDF5Constants.H5P_DEFAULT, vl_dbl_readbuf); } catch (Exception ex) { ex.printStackTrace(); } - assertTrue("testH5DVLwr:" + vl_readbuf[0].get(0), - vl_dbl_data[0].get(0).equals(vl_readbuf[0].get(0))); - assertTrue("testH5DVLwr:" + vl_readbuf[1].get(0), - vl_dbl_data[1].get(0).equals(vl_readbuf[1].get(0))); - assertTrue("testH5DVLwr:" + vl_readbuf[2].get(0), - vl_dbl_data[2].get(0).equals(vl_readbuf[2].get(0))); - assertTrue("testH5DVLwr:" + vl_readbuf[3].get(0), - vl_dbl_data[3].get(0).equals(vl_readbuf[3].get(0))); + assertTrue("testH5DVLwr:" + vl_dbl_readbuf[0].get(0), + vl_dbl_data[0].get(0).equals(vl_dbl_readbuf[0].get(0))); + assertTrue("testH5DVLwr:" + vl_dbl_readbuf[1].get(0), + vl_dbl_data[1].get(0).equals(vl_dbl_readbuf[1].get(0))); + assertTrue("testH5DVLwr:" + vl_dbl_readbuf[2].get(0), + vl_dbl_data[2].get(0).equals(vl_dbl_readbuf[2].get(0))); + assertTrue("testH5DVLwr:" + vl_dbl_readbuf[3].get(0), + vl_dbl_data[3].get(0).equals(vl_dbl_readbuf[3].get(0))); } catch (Throwable err) { err.printStackTrace(); @@ -1230,4 +1327,624 @@ public class TestH5D { } } } + + @Test + public void testH5DVLwrVL() + { + String dset_int_name = "VLIntdata"; + long dset_int_id = HDF5Constants.H5I_INVALID_HID; + long dtype_int_id = HDF5Constants.H5I_INVALID_HID; + long base_dtype_int_id = HDF5Constants.H5I_INVALID_HID; + long dspace_id = HDF5Constants.H5I_INVALID_HID; + long[] dims = {4}; + long lsize = 1; + + ArrayList[] base_vl_int_data = new ArrayList[4]; + ArrayList[] vl_int_data = new ArrayList[4]; + try { + // Write Integer data + vl_int_data[0] = new ArrayList<Integer>(Arrays.asList(1)); + vl_int_data[1] = new ArrayList<Integer>(Arrays.asList(2, 3)); + vl_int_data[2] = new ArrayList<Integer>(Arrays.asList(4, 5, 6)); + vl_int_data[3] = new ArrayList<Integer>(Arrays.asList(7, 8, 9, 10)); + Class dataClass = vl_int_data.getClass(); + assertTrue("testH5DVLwrVL.getClass: " + dataClass, dataClass.isArray()); + + // Write VL data + base_vl_int_data[0] = new ArrayList<ArrayList<Integer>>(); + base_vl_int_data[0].add(vl_int_data[0]); + base_vl_int_data[1] = new ArrayList<ArrayList<Integer>>(); + base_vl_int_data[1].add(vl_int_data[0]); + base_vl_int_data[1].add(vl_int_data[1]); + base_vl_int_data[2] = new ArrayList<ArrayList<Integer>>(); + base_vl_int_data[2].add(vl_int_data[0]); + base_vl_int_data[2].add(vl_int_data[1]); + base_vl_int_data[2].add(vl_int_data[2]); + base_vl_int_data[3] = new ArrayList<ArrayList<Integer>>(); + base_vl_int_data[3].add(vl_int_data[0]); + base_vl_int_data[3].add(vl_int_data[1]); + base_vl_int_data[3].add(vl_int_data[2]); + base_vl_int_data[3].add(vl_int_data[3]); + + try { + dtype_int_id = H5.H5Tvlen_create(HDF5Constants.H5T_STD_U32LE); + assertTrue("testH5DVLwrVL.H5Tvlen_create: ", dtype_int_id >= 0); + base_dtype_int_id = H5.H5Tvlen_create(dtype_int_id); + assertTrue("testH5DVLwrVL.H5Tvlen_create: ", base_dtype_int_id >= 0); + } + catch (Exception err) { + if (base_dtype_int_id > 0) + try { + H5.H5Tclose(base_dtype_int_id); + } + catch (Exception ex) { + } + if (dtype_int_id > 0) + try { + H5.H5Tclose(dtype_int_id); + } + catch (Exception ex) { + } + err.printStackTrace(); + fail("H5.testH5DVLwrVL: " + err); + } + + try { + dspace_id = H5.H5Screate_simple(1, dims, null); + assertTrue(dspace_id > 0); + dset_int_id = H5.H5Dcreate(H5fid, dset_int_name, base_dtype_int_id, dspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + assertTrue("testH5DVLwrVL: ", dset_int_id >= 0); + + H5.H5DwriteVL(dset_int_id, base_dtype_int_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, base_vl_int_data); + } + catch (Exception err) { + if (dset_int_id > 0) + try { + H5.H5Dclose(dset_int_id); + } + catch (Exception ex) { + } + if (dtype_int_id > 0) + try { + H5.H5Tclose(dtype_int_id); + } + catch (Exception ex) { + } + err.printStackTrace(); + fail("H5.testH5DVLwrVL: " + err); + } + finally { + if (dspace_id > 0) + try { + H5.H5Sclose(dspace_id); + } + catch (Exception ex) { + } + } + + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + + for (int j = 0; j < dims.length; j++) + lsize *= dims[j]; + + // Read Integer data + ArrayList[] base_vl_readbuf = new ArrayList[4]; + for (int j = 0; j < lsize; j++) + base_vl_readbuf[j] = new ArrayList<ArrayList<Integer>>(); + + try { + H5.H5DreadVL(dset_int_id, base_dtype_int_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, base_vl_readbuf); + } + catch (Exception ex) { + ex.printStackTrace(); + } + ArrayList<ArrayList<Integer>> vl_readbuf = (ArrayList<ArrayList<Integer>>)base_vl_readbuf[0]; + assertTrue("vl_readbuf 0 exists", vl_readbuf != null); + ArrayList<Integer> vl_readbuf_int = (ArrayList<Integer>)(vl_readbuf.get(0)); + /* + * System.out.println(); System.out.println("vl_readbuf: " + vl_readbuf); + * System.out.println("vl_readbuf_int: " + vl_readbuf_int); + */ + assertTrue("testH5DVLwrVL:" + vl_readbuf_int.get(0), + vl_int_data[0].get(0).equals(vl_readbuf_int.get(0))); + + vl_readbuf = (ArrayList<ArrayList<Integer>>)base_vl_readbuf[1]; + vl_readbuf_int = (ArrayList<Integer>)(vl_readbuf.get(1)); + /* + * System.out.println("vl_readbuf: " + vl_readbuf); System.out.println("vl_readbuf_int: " + + * vl_readbuf_int); + */ + assertTrue("testH5DVLwrVL:" + vl_readbuf_int.get(1), + vl_int_data[1].get(1).equals(vl_readbuf_int.get(1))); + + vl_readbuf = (ArrayList<ArrayList<Integer>>)base_vl_readbuf[2]; + vl_readbuf_int = (ArrayList<Integer>)(vl_readbuf.get(2)); + /* + * System.out.println("vl_readbuf: " + vl_readbuf); System.out.println("vl_readbuf_int: " + + * vl_readbuf_int); + */ + assertTrue("testH5DVLwrVL:" + vl_readbuf_int.get(2), + vl_int_data[2].get(2).equals(vl_readbuf_int.get(2))); + + vl_readbuf = (ArrayList<ArrayList<Integer>>)base_vl_readbuf[3]; + vl_readbuf_int = (ArrayList<Integer>)(vl_readbuf.get(3)); + /* + * System.out.println("vl_readbuf: " + vl_readbuf); System.out.println("vl_readbuf_int: " + + * vl_readbuf_int); + */ + assertTrue("testH5DVLwrVL:" + vl_readbuf_int.get(3), + vl_int_data[3].get(3).equals(vl_readbuf_int.get(3))); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.testH5DVLwrVL: " + err); + } + finally { + if (dset_int_id > 0) + try { + H5.H5Dclose(dset_int_id); + } + catch (Exception ex) { + } + if (dtype_int_id > 0) + try { + H5.H5Tclose(dtype_int_id); + } + catch (Exception ex) { + } + if (base_dtype_int_id > 0) + try { + H5.H5Tclose(base_dtype_int_id); + } + catch (Exception ex) { + } + } + } + + @Test + public void testH5DArraywr() + { + String dset_int_name = "ArrayIntdata"; + long dset_int_id = HDF5Constants.H5I_INVALID_HID; + long dtype_int_id = HDF5Constants.H5I_INVALID_HID; + long dspace_id = HDF5Constants.H5I_INVALID_HID; + long[] dims = {4}; + long lsize = 1; + + ArrayList[] arr_int_data = new ArrayList[4]; + try { + // Write Integer data + arr_int_data[0] = new ArrayList<Integer>(Arrays.asList(1, 2, 3, 4)); + arr_int_data[1] = new ArrayList<Integer>(Arrays.asList(2, 3, 4, 5)); + arr_int_data[2] = new ArrayList<Integer>(Arrays.asList(4, 5, 6, 7)); + arr_int_data[3] = new ArrayList<Integer>(Arrays.asList(7, 8, 9, 10)); + Class dataClass = arr_int_data.getClass(); + assertTrue("testH5DArraywr.getClass: " + dataClass, dataClass.isArray()); + + try { + dtype_int_id = H5.H5Tarray_create(HDF5Constants.H5T_STD_U32LE, 1, dims); + assertTrue("testH5DArraywr.H5Tarray_create: ", dtype_int_id >= 0); + } + catch (Exception err) { + if (dtype_int_id > 0) + try { + H5.H5Tclose(dtype_int_id); + } + catch (Exception ex) { + } + err.printStackTrace(); + fail("H5.testH5DArraywr: " + err); + } + + try { + dspace_id = H5.H5Screate_simple(1, dims, null); + assertTrue(dspace_id > 0); + dset_int_id = + H5.H5Dcreate(H5fid, dset_int_name, dtype_int_id, dspace_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + assertTrue("testH5DVLwr: ", dset_int_id >= 0); + + H5.H5DwriteVL(dset_int_id, dtype_int_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, arr_int_data); + } + catch (Exception err) { + if (dset_int_id > 0) + try { + H5.H5Dclose(dset_int_id); + } + catch (Exception ex) { + } + if (dtype_int_id > 0) + try { + H5.H5Tclose(dtype_int_id); + } + catch (Exception ex) { + } + err.printStackTrace(); + fail("H5.testH5DVLwr: " + err); + } + finally { + if (dspace_id > 0) + try { + H5.H5Sclose(dspace_id); + } + catch (Exception ex) { + } + } + + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + + for (int j = 0; j < dims.length; j++) + lsize *= dims[j]; + + // Read Integer data + ArrayList[] arr_readbuf = new ArrayList[4]; + for (int j = 0; j < lsize; j++) + arr_readbuf[j] = new ArrayList<Integer>(); + + try { + H5.H5DreadVL(dset_int_id, dtype_int_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, arr_readbuf); + } + catch (Exception ex) { + ex.printStackTrace(); + } + assertTrue("testH5DVLwr:" + arr_readbuf[0].get(0), + arr_int_data[0].get(0).equals(arr_readbuf[0].get(0))); + assertTrue("testH5DVLwr:" + arr_readbuf[1].get(0), + arr_int_data[1].get(0).equals(arr_readbuf[1].get(0))); + assertTrue("testH5DVLwr:" + arr_readbuf[2].get(0), + arr_int_data[2].get(0).equals(arr_readbuf[2].get(0))); + assertTrue("testH5DVLwr:" + arr_readbuf[3].get(0), + arr_int_data[3].get(0).equals(arr_readbuf[3].get(0))); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.testH5DArraywr: " + err); + } + finally { + if (dset_int_id > 0) + try { + H5.H5Dclose(dset_int_id); + } + catch (Exception ex) { + } + if (dtype_int_id > 0) + try { + H5.H5Tclose(dtype_int_id); + } + catch (Exception ex) { + } + } + } + + @Test + public void testH5DArray_string_buffer() throws Throwable + { + String dset_str_name = "ArrayStringdata"; + long dset_str_id = HDF5Constants.H5I_INVALID_HID; + long dtype_str_id = HDF5Constants.H5I_INVALID_HID; + long dspace_id = HDF5Constants.H5I_INVALID_HID; + long[] strdims = {4}; + long[] dims = {6}; + long lsize = 1; + + String[] str_data0 = {"Parting", "is such", "sweet", "sorrow."}; + String[] str_data1 = {"Testing", "one", "two", "three."}; + String[] str_data2 = {"Dog,", "man's", "best", "friend."}; + String[] str_data3 = {"Diamonds", "are", "a", "girls!"}; + String[] str_data4 = {"S A", "T U R", "D A Y", "night"}; + String[] str_data5 = {"That's", "all", "folks", "!!!"}; + + ArrayList[] arr_str_data = new ArrayList[6]; + arr_str_data[0] = new ArrayList<String>(Arrays.asList(str_data0)); + arr_str_data[1] = new ArrayList<String>(Arrays.asList(str_data1)); + arr_str_data[2] = new ArrayList<String>(Arrays.asList(str_data2)); + arr_str_data[3] = new ArrayList<String>(Arrays.asList(str_data3)); + arr_str_data[4] = new ArrayList<String>(Arrays.asList(str_data4)); + arr_str_data[5] = new ArrayList<String>(Arrays.asList(str_data5)); + + try { + H5dtid = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5DArray_string_buffer.H5.H5Tcopy: " + err); + } + assertTrue("testH5DArray_string_buffer.H5Tcopy: ", H5dtid >= 0); + try { + H5.H5Tset_size(H5dtid, HDF5Constants.H5T_VARIABLE); + assertTrue("testH5DArray_string_buffer.H5Tis_variable_str", H5.H5Tis_variable_str(H5dtid)); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5DArray_string_buffer.H5Tset_size: " + err); + } + try { + dtype_str_id = H5.H5Tarray_create(H5dtid, 1, strdims); + assertTrue("testH5DArray_string_buffer.H5Tarray_create: ", dtype_str_id >= 0); + } + catch (Exception err) { + if (dtype_str_id > 0) + try { + H5.H5Tclose(dtype_str_id); + } + catch (Exception ex) { + } + err.printStackTrace(); + fail("testH5DArray_string_buffer: " + err); + } + + try { + dspace_id = H5.H5Screate_simple(1, dims, null); + assertTrue(dspace_id > 0); + dset_str_id = + H5.H5Dcreate(H5fid, dset_str_name, dtype_str_id, dspace_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + assertTrue("testH5DArray_string_buffer: ", dset_str_id >= 0); + + H5.H5DwriteVL(dset_str_id, dtype_str_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, arr_str_data); + } + catch (Exception err) { + if (dset_str_id > 0) + try { + H5.H5Dclose(dset_str_id); + } + catch (Exception ex) { + } + if (dtype_str_id > 0) + try { + H5.H5Tclose(dtype_str_id); + } + catch (Exception ex) { + } + err.printStackTrace(); + fail("testH5DArray_string_buffer: " + err); + } + finally { + if (dspace_id > 0) + try { + H5.H5Sclose(dspace_id); + } + catch (Exception ex) { + } + } + + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + + for (int j = 0; j < dims.length; j++) + lsize *= dims[j]; + + ArrayList[] arr_readbuf = new ArrayList[6]; + for (int j = 0; j < lsize; j++) + arr_readbuf[j] = new ArrayList<String>(); + + try { + H5.H5DreadVL(dset_str_id, dtype_str_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, arr_readbuf); + } + catch (Exception ex) { + ex.printStackTrace(); + } + finally { + if (dset_str_id > 0) + try { + H5.H5Dclose(dset_str_id); + } + catch (Exception ex) { + } + if (dtype_str_id > 0) + try { + H5.H5Tclose(dtype_str_id); + } + catch (Exception ex) { + } + } + assertTrue("testH5DArray_string_buffer:" + arr_readbuf[0].get(0), + arr_str_data[0].get(0).equals(arr_readbuf[0].get(0))); + assertTrue("testH5DArray_string_buffer:" + arr_readbuf[1].get(0), + arr_str_data[1].get(0).equals(arr_readbuf[1].get(0))); + assertTrue("testH5DArray_string_buffer:" + arr_readbuf[2].get(0), + arr_str_data[2].get(0).equals(arr_readbuf[2].get(0))); + assertTrue("testH5DArray_string_buffer:" + arr_readbuf[3].get(0), + arr_str_data[3].get(0).equals(arr_readbuf[3].get(0))); + } + + @Test + public void testH5DArrayenum_rw() + { + String dset_enum_name = "ArrayEnumdata"; + long dset_enum_id = HDF5Constants.H5I_INVALID_HID; + long dtype_enum_id = HDF5Constants.H5I_INVALID_HID; + long dtype_arr_enum_id = HDF5Constants.H5I_INVALID_HID; + long dspace_id = HDF5Constants.H5I_INVALID_HID; + long[] dims = {4}; + long lsize = 1; + String enum_type = "Enum_type"; + byte[] enum_val = new byte[1]; + String enum_name = null; + + // Create a enumerate datatype + try { + dtype_enum_id = H5.H5Tcreate(HDF5Constants.H5T_ENUM, (long)1); + assertTrue("testH5DArrayenum_wr.H5Tarray_create: ", dtype_enum_id >= 0); + } + catch (Throwable err) { + if (dtype_enum_id > 0) + try { + H5.H5Tclose(dtype_enum_id); + } + catch (Exception ex) { + } + err.printStackTrace(); + fail("testH5DArrayenum_rw:H5Tcreate " + err); + } + + try { + enum_val[0] = 10; + H5.H5Tenum_insert(dtype_enum_id, "RED", enum_val); + enum_val[0] = 11; + H5.H5Tenum_insert(dtype_enum_id, "GREEN", enum_val); + enum_val[0] = 12; + H5.H5Tenum_insert(dtype_enum_id, "BLUE", enum_val); + enum_val[0] = 13; + H5.H5Tenum_insert(dtype_enum_id, "ORANGE", enum_val); + enum_val[0] = 14; + H5.H5Tenum_insert(dtype_enum_id, "YELLOW", enum_val); + + // Query member number and member index by member name, for enumeration type. + assertTrue("Can't get member number", H5.H5Tget_nmembers(dtype_enum_id) == 5); + assertTrue("Can't get correct index number", + H5.H5Tget_member_index(dtype_enum_id, "ORANGE") == 3); + + // Commit enumeration datatype and close it */ + H5.H5Tcommit(H5fid, enum_type, dtype_enum_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + + H5.H5Tclose(dtype_enum_id); + + // Open the dataytpe for query + dtype_enum_id = H5.H5Topen(H5fid, enum_type, HDF5Constants.H5P_DEFAULT); + assertTrue("testH5DArrayenum_rw:H5Tcreate", dtype_enum_id >= 0); + + // Query member number and member index by member name, for enumeration type + assertTrue("Can't get member number", H5.H5Tget_nmembers(dtype_enum_id) == 5); + assertTrue("Can't get correct index number", + H5.H5Tget_member_index(dtype_enum_id, "ORANGE") == 3); + + // Query member value by member name, for enumeration type + H5.H5Tenum_valueof(dtype_enum_id, "ORANGE", enum_val); + assertTrue("Incorrect value for enum member", enum_val[0] == 13); + + // Query member value by member index, for enumeration type + H5.H5Tget_member_value(dtype_enum_id, 2, enum_val); + assertTrue("Incorrect value for enum member", enum_val[0] == 12); + + // Query member name by member value, for enumeration type + enum_val[0] = 14; + enum_name = H5.H5Tenum_nameof(dtype_enum_id, enum_val, 16); + assertTrue("Incorrect name for enum member", enum_name.compareTo("YELLOW") == 0); + + ArrayList[] arr_enum_data = new ArrayList[4]; + try { + // Write Integer data + arr_enum_data[0] = new ArrayList<Integer>(Arrays.asList(10, 11, 12, 13)); + arr_enum_data[1] = new ArrayList<Integer>(Arrays.asList(11, 12, 13, 14)); + arr_enum_data[2] = new ArrayList<Integer>(Arrays.asList(12, 13, 14, 10)); + arr_enum_data[3] = new ArrayList<Integer>(Arrays.asList(13, 14, 10, 11)); + Class dataClass = arr_enum_data.getClass(); + assertTrue("testH5DArrayenum_wr.getClass: " + dataClass, dataClass.isArray()); + + try { + dtype_arr_enum_id = H5.H5Tarray_create(HDF5Constants.H5T_STD_U32LE, 1, dims); + assertTrue("testH5DArrayenum_wr.H5Tarray_create: ", dtype_arr_enum_id >= 0); + } + catch (Exception err) { + if (dtype_arr_enum_id > 0) + try { + H5.H5Tclose(dtype_arr_enum_id); + } + catch (Exception ex) { + } + err.printStackTrace(); + fail("H5.testH5DArrayenum_wr: " + err); + } + + dspace_id = H5.H5Screate_simple(1, dims, null); + assertTrue(dspace_id > 0); + dset_enum_id = H5.H5Dcreate(H5fid, dset_enum_name, dtype_arr_enum_id, dspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + assertTrue("testH5DVLwr: ", dset_enum_id >= 0); + + H5.H5DwriteVL(dset_enum_id, dtype_arr_enum_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, arr_enum_data); + } + catch (Throwable err) { + if (dset_enum_id > 0) + try { + H5.H5Dclose(dset_enum_id); + } + catch (Exception ex) { + } + if (dtype_enum_id > 0) + try { + H5.H5Tclose(dtype_enum_id); + } + catch (Exception ex) { + } + if (dtype_arr_enum_id > 0) + try { + H5.H5Tclose(dtype_arr_enum_id); + } + catch (Exception ex) { + } + err.printStackTrace(); + fail("testH5DArrayenum_rw:query " + err); + } + finally { + if (dspace_id > 0) + try { + H5.H5Sclose(dspace_id); + } + catch (Exception ex) { + } + } + + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + + for (int j = 0; j < dims.length; j++) + lsize *= dims[j]; + + // Read Integer data + ArrayList[] arr_readbuf = new ArrayList[4]; + for (int j = 0; j < lsize; j++) + arr_readbuf[j] = new ArrayList<Integer>(); + + try { + H5.H5DreadVL(dset_enum_id, dtype_arr_enum_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, arr_readbuf); + } + catch (Exception ex) { + ex.printStackTrace(); + } + assertTrue("testH5DVLArrayenum_wr:" + arr_readbuf[0].get(0), + arr_enum_data[0].get(0).equals(arr_readbuf[0].get(0))); + assertTrue("testH5DVLArrayenum_wr:" + arr_readbuf[1].get(0), + arr_enum_data[1].get(0).equals(arr_readbuf[1].get(0))); + assertTrue("testH5DVLArrayenum_wr:" + arr_readbuf[2].get(0), + arr_enum_data[2].get(0).equals(arr_readbuf[2].get(0))); + assertTrue("testH5DVLArrayenum_wr:" + arr_readbuf[3].get(0), + arr_enum_data[3].get(0).equals(arr_readbuf[3].get(0))); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.testH5DArrayenum_wr: " + err); + } + finally { + if (dset_enum_id > 0) + try { + H5.H5Dclose(dset_enum_id); + } + catch (Exception ex) { + } + if (dtype_enum_id > 0) + try { + H5.H5Tclose(dtype_enum_id); + } + catch (Exception ex) { + } + if (dtype_arr_enum_id > 0) + try { + H5.H5Tclose(dtype_arr_enum_id); + } + catch (Exception ex) { + } + } + } } diff --git a/java/test/TestH5R.java b/java/test/TestH5R.java index 221a71e..1dcf992 100644 --- a/java/test/TestH5R.java +++ b/java/test/TestH5R.java @@ -600,7 +600,7 @@ public class TestH5R { HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); assertTrue("testH5RVLattr_ref: ", attr_obj_id >= 0); - H5.H5AwriteVL(attr_obj_id, atype_obj_id, vl_obj_data); + H5.H5Awrite(attr_obj_id, atype_obj_id, vl_obj_data); } catch (Exception err) { if (attr_obj_id > 0) @@ -657,7 +657,7 @@ public class TestH5R { HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); assertTrue("testH5RVLattr_ref: ", attr_reg_id >= 0); - H5.H5AwriteVL(attr_reg_id, atype_reg_id, vl_reg_data); + H5.H5Awrite(attr_reg_id, atype_reg_id, vl_reg_data); } catch (Exception err) { if (attr_reg_id > 0) @@ -696,7 +696,7 @@ public class TestH5R { vl_readbuf[j] = new ArrayList<byte[]>(); try { - H5.H5AreadVL(attr_obj_id, atype_obj_id, vl_readbuf); + H5.H5Aread(attr_obj_id, atype_obj_id, vl_readbuf); } catch (Exception ex) { ex.printStackTrace(); @@ -716,7 +716,7 @@ public class TestH5R { vl_readbuf[j] = new ArrayList<byte[]>(); try { - H5.H5AreadVL(attr_reg_id, atype_reg_id, vl_readbuf); + H5.H5Aread(attr_reg_id, atype_reg_id, vl_readbuf); } catch (Exception ex) { ex.printStackTrace(); @@ -831,8 +831,8 @@ public class TestH5R { HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); assertTrue("testH5RVLdset_ref: ", dset_obj_id >= 0); - H5.H5DwriteVL(dset_obj_id, dtype_obj_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, vl_obj_data); + H5.H5Dwrite(dset_obj_id, dtype_obj_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, vl_obj_data); } catch (Exception err) { if (dset_obj_id > 0) @@ -890,8 +890,8 @@ public class TestH5R { HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); assertTrue("testH5RVLdset_ref: ", dset_reg_id >= 0); - H5.H5DwriteVL(dset_reg_id, dtype_reg_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, vl_reg_data); + H5.H5Dwrite(dset_reg_id, dtype_reg_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, vl_reg_data); } catch (Exception err) { if (dset_reg_id > 0) @@ -930,8 +930,8 @@ public class TestH5R { vl_readbuf[j] = new ArrayList<byte[]>(); try { - H5.H5DreadVL(dset_obj_id, dtype_obj_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, vl_readbuf); + H5.H5Dread(dset_obj_id, dtype_obj_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, vl_readbuf); } catch (Exception ex) { ex.printStackTrace(); @@ -951,8 +951,8 @@ public class TestH5R { vl_readbuf[j] = new ArrayList<byte[]>(); try { - H5.H5DreadVL(dset_reg_id, dtype_reg_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, vl_readbuf); + H5.H5Dread(dset_reg_id, dtype_reg_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, vl_readbuf); } catch (Exception ex) { ex.printStackTrace(); diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index 4e5152b..0690081 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -67,8 +67,8 @@ $top_builddir/java/src/jni/.libs/libhdf5_java.* LIST_JAR_TESTFILES=" $HDFLIB_HOME/hamcrest-core.jar $HDFLIB_HOME/junit.jar -$HDFLIB_HOME/slf4j-api-1.7.33.jar -$HDFLIB_HOME/ext/slf4j-simple-1.7.33.jar +$HDFLIB_HOME/slf4j-api-2.0.6.jar +$HDFLIB_HOME/ext/slf4j-simple-2.0.6.jar " LIST_JAR_FILES=" $top_builddir/java/src/$JARFILE @@ -304,7 +304,7 @@ JAVAEXEFLAGS=@H5_JAVAFLAGS@ COPY_LIBFILES_TO_BLDLIBDIR COPY_DATAFILES_TO_BLDDIR -CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/junit.jar:"$BLDLIBDIR"/hamcrest-core.jar:"$BLDLIBDIR"/slf4j-api-1.7.33.jar:"$BLDLIBDIR"/slf4j-simple-1.7.33.jar:"$TESTJARFILE"" +CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/junit.jar:"$BLDLIBDIR"/hamcrest-core.jar:"$BLDLIBDIR"/slf4j-api-2.0.6.jar:"$BLDLIBDIR"/slf4j-simple-2.0.6.jar:"$TESTJARFILE"" TEST=/usr/bin/test if [ ! -x /usr/bin/test ] diff --git a/java/test/testfiles/JUnit-TestH5A.txt b/java/test/testfiles/JUnit-TestH5A.txt index efdd4a2..f31c86c 100644 --- a/java/test/testfiles/JUnit-TestH5A.txt +++ b/java/test/testfiles/JUnit-TestH5A.txt @@ -11,6 +11,7 @@ JUnit version 4.11 .testH5Aget_info_by_name .testH5Aget_create_plist .testH5Adelete_by_name +.testH5AVLwrVL .testH5Aopen_by_name .testH5Aget_info .testH5Aget_name @@ -22,14 +23,16 @@ JUnit version 4.11 .testH5Adelete_by_idx_order .testH5Arename_by_name .testH5Acreate2_invalidobject +.testH5AArraywr .testH5Acreate2 .testH5Aiterate_by_name .testH5Adelete_by_idx_null .testH5Adelete_by_idx_invalidobject .testH5Awrite_readVL +.testH5AArray_string_buffer .testH5Aget_info1 Time: XXXX -OK (29 tests) +OK (32 tests) diff --git a/java/test/testfiles/JUnit-TestH5D.txt b/java/test/testfiles/JUnit-TestH5D.txt index 288e6d0..4c30621 100644 --- a/java/test/testfiles/JUnit-TestH5D.txt +++ b/java/test/testfiles/JUnit-TestH5D.txt @@ -1,5 +1,8 @@ JUnit version 4.11 +.testH5DArrayenum_rw +.testH5DVLwrVL .testH5Dget_storage_size +.testH5DArraywr .testH5Diterate_write .testH5Dcreate .testH5Dget_offset @@ -12,15 +15,14 @@ JUnit version 4.11 .testH5Dget_storage_size_empty .testH5Diterate .testH5Dget_access_plist -.testH5Dvlen_get_buf_size .testH5Dget_space_closed +.testH5DArray_string_buffer .testH5Dget_space_status .testH5Dvlen_write_read .testH5Dget_space .testH5Dget_type_closed -.testH5Dvlen_read_default_buffer Time: XXXX -OK (20 tests) +OK (22 tests) diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 6d6660f..0d867d4 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -374,7 +374,7 @@ IV. Further considerations the settings for the developers' environment. Then the only options needed on the command line are those options that are different. Example using HDF default cache file: - cmake -C ../config/cmake/cacheinit.cmake -G "Visual Studio 12 2013" \ + cmake -C ../config/cmake/cacheinit.cmake -G "Visual Studio 16 2019" \ -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF \ -DCMAKE_BUILD_TYPE:STRING=Release .. @@ -775,6 +775,8 @@ BUILD_SHARED_LIBS "Build Shared Libraries" ON BUILD_STATIC_LIBS "Build Static Libraries" ON BUILD_STATIC_EXECS "Build Static Executables" OFF BUILD_TESTING "Build HDF5 Unit Testing" ON +if (WINDOWS) + DISABLE_PDB_FILES "Do not install PDB files" OFF ---------------- HDF5 Build Options --------------------- HDF5_BUILD_CPP_LIB "Build HDF5 C++ Library" OFF @@ -783,7 +785,7 @@ HDF5_BUILD_FORTRAN "Build FORTRAN support" OFF HDF5_BUILD_JAVA "Build JAVA support" OFF HDF5_BUILD_HL_LIB "Build HIGH Level HDF5 Library" ON HDF5_BUILD_TOOLS "Build HDF5 Tools" ON -HDF5_BUILD_HL_TOOLS "Build HIGH Level HDF5 Tools" ON +HDF5_BUILD_HL_GIF_TOOLS "Build HIGH Level HDF5 GIF Tools" OFF ---------------- HDF5 Folder Build Options --------------------- Defaults relative to $<INSTALL_PREFIX> diff --git a/release_docs/README_HDF5_CMake b/release_docs/README_HDF5_CMake index 6d95fd5..d4fa9db 100644 --- a/release_docs/README_HDF5_CMake +++ b/release_docs/README_HDF5_CMake @@ -10,7 +10,7 @@ This tar file contains LIBAEC.tar.gz source for building SZIP replacement ZLib.tar.gz source for building ZLIB hdf5_plugins.tar.gz source for building compression plugins - HDF5Examples-2.0.1-Source.tar.gz source for building examples + HDF5Examples-2.0.3-Source.tar.gz source for building examples For more information about building HDF5 with CMake, see USING_HDF5_CMake.txt in hdf5-1.12.3/release_docs, or diff --git a/release_docs/USING_HDF5_VS.txt b/release_docs/USING_HDF5_VS.txt index ae9be69..22f2f54 100644 --- a/release_docs/USING_HDF5_VS.txt +++ b/release_docs/USING_HDF5_VS.txt @@ -38,7 +38,10 @@ Using Visual Studio 2010 and above with HDF5 Libraries built with Visual Studio library, and then optionally the HDF5 High Level, Fortran or C++ libraries. For example, to compile a C++ application, enter: - szip.lib zlib.lib hdf5.lib hdf5_cpp.lib + hdf5.lib hdf5_cpp.lib + + For static linking: + libszaec.lib libaec.lib libzlib.lib libhdf5.lib libhdf5_cpp.lib ========================================================================== diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2f30e97..193174b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1018,7 +1018,7 @@ endif () #### make the H5detect program set (lib_prog_deps) add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c) -target_include_directories (H5detect PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_include_directories (H5detect PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_definitions(H5detect PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) TARGET_C_PROPERTIES (H5detect STATIC) target_link_libraries (H5detect @@ -1112,7 +1112,7 @@ endif () # make the H5make_libsettings program add_executable (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c) -target_include_directories (H5make_libsettings PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_include_directories (H5make_libsettings PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_definitions(H5make_libsettings PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) TARGET_C_PROPERTIES (H5make_libsettings STATIC) target_link_libraries (H5make_libsettings @@ -1157,10 +1157,6 @@ if (BUILD_SHARED_LIBS) ) endif () -## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,O,S,ST,T,Z" -#all_packages="AC,B2,CX,D,F,HL,I,O,S,ST,T,Z" -option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) - #----------------------------------------------------------------------------- # Add H5Tinit source to build - generated by H5detect/CMake at configure time #----------------------------------------------------------------------------- @@ -1173,8 +1169,8 @@ if (BUILD_STATIC_LIBS) add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS} ${H5_MODULE_HEADERS}) target_include_directories (${HDF5_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" - INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>;$<BUILD_INTERFACE:${HDF5_SRC_BINARY_DIR}>" + PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" + INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>;$<BUILD_INTERFACE:${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR}>" ) target_compile_options(${HDF5_LIB_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_compile_definitions(${HDF5_LIB_TARGET} @@ -1182,8 +1178,9 @@ if (BUILD_STATIC_LIBS) ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS} PRIVATE - "$<$<BOOL:${HDF5_ENABLE_TRACE}>:H5_DEBUG_API>" # Enable tracing of the API - "$<$<BOOL:${HDF5_ENABLE_DEBUG_APIS}>:H5Z_DEBUG;H5T_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG>" + "$<$<BOOL:${HDF5_ENABLE_TRACE}>:H5_DEBUG_API>" # Enable tracing of the API + "$<$<BOOL:${HDF5_ENABLE_DEBUG_APIS}>:${HDF5_DEBUG_APIS}>" + "$<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}>" ) TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC) target_link_libraries (${HDF5_LIB_TARGET} @@ -1212,9 +1209,9 @@ if (BUILD_SHARED_LIBS) add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS} ${H5_MODULE_HEADERS}) target_include_directories (${HDF5_LIBSH_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" + PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" PUBLIC "$<$<BOOL:${HDF5_ENABLE_HDFS}>:${HDFS_INCLUDE_DIR}>" - INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>;$<BUILD_INTERFACE:${HDF5_SRC_BINARY_DIR}>" + INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>;$<BUILD_INTERFACE:${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR}>" ) target_compile_options(${HDF5_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_compile_definitions(${HDF5_LIBSH_TARGET} @@ -1225,7 +1222,8 @@ if (BUILD_SHARED_LIBS) PRIVATE "$<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:H5_HAVE_THREADSAFE>" "$<$<BOOL:${HDF5_ENABLE_TRACE}>:H5_DEBUG_API>" # Enable tracing of the API - "$<$<BOOL:${HDF5_ENABLE_DEBUG_APIS}>:H5Z_DEBUG;H5T_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG>" + "$<$<BOOL:${HDF5_ENABLE_DEBUG_APIS}>:${HDF5_DEBUG_APIS}>" + "$<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}>" ) TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_LIBSH_TARGET} @@ -1374,17 +1372,7 @@ endif () # Option to build documentation #----------------------------------------------------------------------------- if (DOXYGEN_FOUND) -# This cmake function requires that the non-default doxyfile settings are provided with set (DOXYGEN_xxx) commands -# In addition the doxyfile aliases @INCLUDE option is not supported and would need to be provided in a set (DOXYGEN_ALIASES) command. -# doxygen_add_docs (hdf5lib_doc -## ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS} ${HDF5_DOXYGEN_DIR}/dox -# ${DOXYGEN_INPUT_DIRECTORY} -# ALL -# WORKING_DIRECTORY ${HDF5_SRC_DIR} -# COMMENT "Generating HDF5 library Source Documentation" -# ) - -# This custom target and doxygen/configure work together + # This custom target and doxygen/configure work together # Replace variables inside @@ with the current values add_custom_target (hdf5lib_doc ALL COMMAND ${DOXYGEN_EXECUTABLE} ${HDF5_BINARY_DIR}/Doxyfile diff --git a/src/H5private.h b/src/H5private.h index 747c77d..89bc272 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1521,6 +1521,9 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDstrncpy #define HDstrncpy(X, Y, Z) strncpy(X, Y, Z) #endif +#ifndef HDstrndup +#define HDstrndup(S, N) strndup(S, N) +#endif #ifndef HDstrpbrk #define HDstrpbrk(X, Y) strpbrk(X, Y) #endif diff --git a/src/H5system.c b/src/H5system.c index 94f883b..17404a2 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -1059,6 +1059,49 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5_expand_windows_env_vars() */ + +/*------------------------------------------------------------------------- + * Function: H5_strndup + * + * Purpose: Similar to strndup() for use on Windows. Allocates a new + * string and copies at most `n` bytes from the original + * string into the new string. If the original string is + * longer than `n`, only `n` bytes are copied from the + * original string. In either case, the string being returned + * is guaranteed to be terminated with a null byte. + * + * The returned pointer is allocated by H5MM_malloc in this + * routine and must be freed by the caller with H5MM_free or + * H5MM_xfree. + * + * Return: Pointer to copied string on success + * NULL on failure + * + *------------------------------------------------------------------------- + */ +char * +H5_strndup(const char *s, size_t n) +{ + size_t len; + char *ret_value = NULL; + + FUNC_ENTER_NOAPI_NOINIT + + if (!s) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "string cannot be NULL"); + + for (len = 0; len < n && s[len] != '\0'; len++) + ; + + if (NULL == (ret_value = H5MM_malloc(len + 1))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't allocate buffer for string"); + + H5MM_memcpy(ret_value, s, len); + ret_value[len] = '\0'; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} #endif /* H5_HAVE_WIN32_API */ /* Global variables */ diff --git a/src/H5win32defs.h b/src/H5win32defs.h index 38a350b..d7839fc 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -76,6 +76,7 @@ struct timezone { #define HDsleep(S) Sleep(S * 1000) #define HDstat(S, B) _stati64(S, B) #define HDstrcasecmp(A, B) _stricmp(A, B) +#define HDstrndup(S, N) H5_strndup(S, N) #define HDstrdup(S) _strdup(S) #define HDstrtok_r(X, Y, Z) strtok_s(X, Y, Z) #define HDtzset() _tzset() @@ -100,6 +101,7 @@ H5_DLL wchar_t *H5_get_utf16_str(const char *s); H5_DLL int Wopen_utf8(const char *path, int oflag, ...); H5_DLL int Wremove_utf8(const char *path); H5_DLL int H5_get_win32_times(H5_timevals_t *tvs); +H5_DLL char *H5_strndup(const char *s, size_t n); #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3102f9a..16d8bed 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -30,12 +30,14 @@ set (TEST_LIB_HEADERS if (BUILD_STATIC_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_SRC_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" + PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) target_compile_options(${HDF5_TEST_LIB_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_compile_definitions(${HDF5_TEST_LIB_TARGET} - PRIVATE "H5_TEST_EXPRESS_LEVEL_DEFAULT=${H5_TEST_EXPRESS_LEVEL_DEFAULT}" + PRIVATE + "H5_TEST_EXPRESS_LEVEL_DEFAULT=${H5_TEST_EXPRESS_LEVEL_DEFAULT}" + "$<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}>" ) TARGET_C_PROPERTIES (${HDF5_TEST_LIB_TARGET} STATIC) target_link_libraries (${HDF5_TEST_LIB_TARGET} @@ -52,18 +54,21 @@ endif () if (BUILD_SHARED_LIBS) add_library (${HDF5_TEST_LIBSH_TARGET} SHARED ${TEST_LIB_SOURCES} ${TEST_LIB_HEADERS}) target_include_directories (${HDF5_TEST_LIBSH_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" + PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) target_compile_options(${HDF5_TEST_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_compile_definitions(${HDF5_TEST_LIBSH_TARGET} - PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" - PRIVATE "H5_TEST_EXPRESS_LEVEL_DEFAULT=${H5_TEST_EXPRESS_LEVEL_DEFAULT}" + PUBLIC + "H5_BUILT_AS_DYNAMIC_LIB" + PRIVATE + "H5_TEST_EXPRESS_LEVEL_DEFAULT=${H5_TEST_EXPRESS_LEVEL_DEFAULT}" + "$<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}>" ) TARGET_C_PROPERTIES (${HDF5_TEST_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_TEST_LIBSH_TARGET} PUBLIC ${LINK_LIBS} ${HDF5_LIBSH_TARGET} - PRIVATE $<$<OR:$<PLATFORM_ID:Windows>,$<PLATFORM_ID:MinGW>>:ws2_32.lib> + PRIVATE "$<$<OR:$<PLATFORM_ID:Windows>,$<PLATFORM_ID:MinGW>>:ws2_32.lib>" ) if (MINGW) target_link_libraries (${HDF5_TEST_LIBSH_TARGET} PRIVATE "wsock32.lib") @@ -109,7 +114,7 @@ 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_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (${HDF5_TEST_PLUGIN_TARGET} PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_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_LIBSH_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_TEST_PLUGIN_TARGET} ${HDF5_TEST_PLUGIN_NAME} SHARED "LIB") @@ -141,7 +146,7 @@ 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_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (${HDF5_TEST_PLUGIN_TARGET} PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_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_LIBSH_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_TEST_PLUGIN_TARGET} ${HDF5_TEST_PLUGIN_NAME} SHARED "LIB") @@ -185,7 +190,7 @@ 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_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (${HDF5_VOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_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_LIBSH_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_VOL_PLUGIN_LIB_TARGET} ${HDF5_VOL_PLUGIN_LIB_NAME} SHARED "LIB") @@ -344,8 +349,12 @@ endif () macro (ADD_H5_EXE file) add_executable (${file} ${HDF5_TEST_SOURCE_DIR}/${file}.c) - target_include_directories (${file} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (${file} PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(${file} PRIVATE "${HDF5_CMAKE_C_FLAGS}") + target_compile_definitions(${file} + PRIVATE + "$<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}>" + ) if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (${file} STATIC) target_link_libraries (${file} PRIVATE ${HDF5_TEST_LIB_TARGET}) @@ -386,7 +395,11 @@ endforeach () #-- Adding test for chunk_info add_executable (chunk_info ${HDF5_TEST_SOURCE_DIR}/chunk_info.c) target_compile_options(chunk_info PRIVATE "${HDF5_CMAKE_C_FLAGS}") -target_include_directories (chunk_info PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_compile_definitions(chunk_info + PRIVATE + "$<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}>" +) +target_include_directories (chunk_info PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (chunk_info STATIC) target_link_libraries (chunk_info PRIVATE ${HDF5_TEST_LIB_TARGET} ${LINK_COMP_LIBS}) @@ -406,7 +419,11 @@ endif () #-- Adding test for direct_chunk add_executable (direct_chunk ${HDF5_TEST_SOURCE_DIR}/direct_chunk.c) target_compile_options(direct_chunk PRIVATE "${HDF5_CMAKE_C_FLAGS}") -target_include_directories (direct_chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_compile_definitions(direct_chunk + PRIVATE + "$<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}>" +) +target_include_directories (direct_chunk PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_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}) @@ -427,7 +444,11 @@ endif () #-- Adding test for testhdf5 add_executable (testhdf5 ${testhdf5_SOURCES}) target_compile_options(testhdf5 PRIVATE "${HDF5_CMAKE_C_FLAGS}") -target_include_directories (testhdf5 PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_compile_definitions(testhdf5 + PRIVATE + "$<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}>" +) +target_include_directories (testhdf5 PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_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}) @@ -447,7 +468,11 @@ endif () #-- Adding test for cache_image add_executable (cache_image ${cache_image_SOURCES}) target_compile_options(cache_image PRIVATE "${HDF5_CMAKE_C_FLAGS}") -target_include_directories (cache_image PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_compile_definitions(cache_image + PRIVATE + "$<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}>" +) +target_include_directories (cache_image PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_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}) @@ -467,7 +492,11 @@ endif () #-- Adding test for ttsafe add_executable (ttsafe ${ttsafe_SOURCES}) target_compile_options(ttsafe PRIVATE "${HDF5_CMAKE_C_FLAGS}") -target_include_directories (ttsafe PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_compile_definitions(ttsafe + PRIVATE + "$<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}>" +) +target_include_directories (ttsafe PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_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}) @@ -478,7 +507,7 @@ if (NOT BUILD_SHARED_LIBS) endif () else () TARGET_C_PROPERTIES (ttsafe SHARED) - target_link_libraries (ttsafe PRIVATE ${HDF5_TEST_LIBSH_TARGET} $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads>) + target_link_libraries (ttsafe PRIVATE ${HDF5_TEST_LIBSH_TARGET} "$<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads>") endif () set_target_properties (ttsafe PROPERTIES FOLDER test) @@ -493,7 +522,11 @@ endif () #-- Adding test for thread_id add_executable (thread_id ${HDF5_TEST_SOURCE_DIR}/thread_id.c) target_compile_options(thread_id PRIVATE "${HDF5_CMAKE_C_FLAGS}") -target_include_directories (thread_id PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_compile_definitions(thread_id + PRIVATE + "$<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}>" +) +target_include_directories (thread_id PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (thread_id STATIC) target_link_libraries (thread_id PRIVATE ${HDF5_TEST_LIB_TARGET}) @@ -504,7 +537,7 @@ if (NOT BUILD_SHARED_LIBS) endif () else () TARGET_C_PROPERTIES (thread_id SHARED) - target_link_libraries (thread_id PRIVATE ${HDF5_TEST_LIBSH_TARGET} $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads>) + target_link_libraries (thread_id PRIVATE ${HDF5_TEST_LIBSH_TARGET} "$<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads>") endif () set_target_properties (thread_id PROPERTIES FOLDER test) @@ -518,7 +551,7 @@ endif () if (HDF5_BUILD_UTILS) # requires mirror server #-- Adding test for mirror_vfd add_executable (mirror_vfd ${mirror_vfd_SOURCES}) - target_include_directories (mirror_vfd PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (mirror_vfd PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (mirror_vfd STATIC) target_link_libraries (mirror_vfd PRIVATE ${HDF5_TEST_LIB_TARGET}) @@ -597,8 +630,12 @@ set (H5_VDS_SWMR_TESTS macro (ADD_H5_VDS_EXE file) add_executable (${file} ${HDF5_TEST_SOURCE_DIR}/${file}.c ${HDF5_TEST_SOURCE_DIR}/vds_swmr.h) - target_include_directories (${file} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (${file} PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(${file} PRIVATE "${HDF5_CMAKE_C_FLAGS}") + target_compile_definitions(${file} + PRIVATE + "$<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}>" + ) if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (${file} STATIC) target_link_libraries (${file} PRIVATE ${HDF5_TEST_LIB_TARGET}) @@ -625,7 +662,11 @@ endforeach () # 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_compile_options(accum_swmr_reader PRIVATE "${HDF5_CMAKE_C_FLAGS}") -target_include_directories (accum_swmr_reader PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_compile_definitions(accum_swmr_reader + PRIVATE + "$<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}>" +) +target_include_directories (accum_swmr_reader PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_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}) @@ -650,7 +691,7 @@ set_target_properties (accum PROPERTIES DEPENDS accum_swmr_reader) ############################################################################## 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_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (filter_plugin PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (filter_plugin SHARED) target_link_libraries (filter_plugin PRIVATE ${HDF5_TEST_LIBSH_TARGET}) set_target_properties (filter_plugin PROPERTIES FOLDER test) @@ -663,7 +704,7 @@ if (BUILD_SHARED_LIBS) endif () add_executable (vol_plugin ${HDF5_TEST_SOURCE_DIR}/vol_plugin.c) - target_include_directories (vol_plugin PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (vol_plugin PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (vol_plugin SHARED) target_link_libraries (vol_plugin PRIVATE ${HDF5_TEST_LIBSH_TARGET}) set_target_properties (vol_plugin PROPERTIES FOLDER test) @@ -682,7 +723,11 @@ endif () set (use_append_chunk_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_append_chunk.c ${HDF5_TEST_SOURCE_DIR}/use_common.c ${HDF5_TEST_SOURCE_DIR}/use.h) add_executable (use_append_chunk ${use_append_chunk_SOURCES}) target_compile_options(use_append_chunk PRIVATE "${HDF5_CMAKE_C_FLAGS}") -target_include_directories (use_append_chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_compile_definitions(use_append_chunk + PRIVATE + "$<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}>" +) +target_include_directories (use_append_chunk PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_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}) @@ -703,7 +748,11 @@ if (HDF5_BUILD_UTILS) # requires mirror server set (use_append_chunk_mirror_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_append_chunk_mirror.c ${HDF5_TEST_SOURCE_DIR}/use_common.c ${HDF5_TEST_SOURCE_DIR}/use.h) add_executable (use_append_chunk_mirror ${use_append_chunk_mirror_SOURCES}) target_compile_options(use_append_chunk_mirror PRIVATE "${HDF5_CMAKE_C_FLAGS}") - target_include_directories (use_append_chunk_mirror PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_compile_definitions(use_append_chunk_mirror + PRIVATE + "$<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}>" + ) + target_include_directories (use_append_chunk_mirror PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (use_append_chunk_mirror STATIC) target_link_libraries (use_append_chunk_mirror PRIVATE ${HDF5_TEST_LIB_TARGET}) @@ -724,7 +773,11 @@ endif () set (use_append_mchunks_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_append_mchunks.c ${HDF5_TEST_SOURCE_DIR}/use_common.c ${HDF5_TEST_SOURCE_DIR}/use.h) add_executable (use_append_mchunks ${use_append_mchunks_SOURCES}) target_compile_options(use_append_mchunks PRIVATE "${HDF5_CMAKE_C_FLAGS}") -target_include_directories (use_append_mchunks PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_compile_definitions(use_append_mchunks + PRIVATE + "$<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}>" +) +target_include_directories (use_append_mchunks PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_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}) @@ -744,7 +797,11 @@ endif () 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_compile_options(use_disable_mdc_flushes PRIVATE "${HDF5_CMAKE_C_FLAGS}") -target_include_directories (use_disable_mdc_flushes PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_compile_definitions(use_disable_mdc_flushes + PRIVATE + "$<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}>" +) +target_include_directories (use_disable_mdc_flushes PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_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}) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 5f4f89a..08f5e3b 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -114,7 +114,7 @@ foreach (plistfile ${HDF5_REFERENCE_PLIST_FILES}) endforeach () # -------------------------------------------------------------------- -#-- Copy all the HDF5 files from the test directory into the source directory +#-- Copy all the HDF5 files from the source directory into the test directory # -------------------------------------------------------------------- set (HDF5_REFERENCE_TEST_FILES aggr.h5 @@ -178,24 +178,24 @@ endforeach () add_custom_target(HDF5_TEST_LIB_files ALL COMMENT "Copying files needed by HDF5_TEST_LIB tests" DEPENDS ${HDF5_TEST_LIB_files_list}) 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 + 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 @@ -205,6 +205,12 @@ add_test ( WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) set_tests_properties (H5TEST-testhdf5-clear-objects PROPERTIES FIXTURES_SETUP clear_testhdf5) +add_test ( + NAME H5TEST-testhdf5-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove ${testhdf5_CLEANFILES} + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +) +set_tests_properties (H5TEST-testhdf5-clean-objects PROPERTIES FIXTURES_CLEANUP clear_testhdf5) add_test (NAME H5TEST-testhdf5-base COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:testhdf5> -x file -x select) set_tests_properties (H5TEST-testhdf5-base PROPERTIES @@ -232,179 +238,94 @@ set_tests_properties (H5TEST-testhdf5-select PROPERTIES ############################################################################## set (test_CLEANFILES - accum.h5 - cmpd_dset.h5 - compact_dataset.h5 - dataset.h5 - dset_offset.h5 - max_compact_dataset.h5 - simple.h5 - set_local.h5 - random_chunks.h5 - huge_chunks.h5 - chunk_cache.h5 - big_chunk.h5 - chunk_fast.h5 - chunk_expand.h5 - chunk_fixed.h5 - copy_dcpl_newfile.h5 - partial_chunks.h5 - layout_extend.h5 - zero_chunk.h5 - chunk_single.h5 - swmr_non_latest.h5 - earray_hdr_fd.h5 - farray_hdr_fd.h5 - bt2_hdr_fd.h5 - storage_size.h5 - dls_01_strings.h5 - power2up.h5 - version_bounds.h5 - alloc_0sized.h5 - extend.h5 - istore.h5 - extlinks*.h5 - frspace.h5 - links*.h5 - sys_file1 - tfile*.h5 - th5s*.h5 - lheap.h5 - fheap.h5 - ohdr.h5 - ohdr_min_a.h5 - ohdr_min_b.h5 + cmpd_dtransform.h5 + direct_chunk.h5 + dt_arith1.h5 + dt_arith2.h5 + dtransform.h5 + dtypes3.h5 + dtypes4.h5 min_dset_ohdr_testfile.h5 - stab.h5 - extern_*.h5 - extern_*.raw - gheap*.h5 - dt_arith1 - dt_arith2 - links.h5 - links*.h5 - extlinks*.h5 - tmp - tmp_links - tmp2_links - tmp_links_env - tmp_vds/* - tmp_vds_env/* - big.data - big*.h5 - stdio.h5 - sec2.h5 - dtypes*.h5 - dt_arith*.h5 - tattr.h5 - tselect.h5 - mtime.h5 - unlink.h5 - unicode.h5 - coord.h5 - fillval_*.h5 - fillval.raw - mount_*.h5 - testmeta.h5 - ttime.h5 - trefer*.h5 - trefer_*.h5 - tvltypes.h5 - tvlstr.h5 - tvlstr2.h5 - twriteorder.dat - enum1.h5 - titerate.h5 - ttsafe.h5 - tarray1.h5 - tgenprop.h5 - tmisc*.h5 - set_extent*.h5 - ext*.bin - getname.h5 - getname*.h5 + ohdr_min_a.h5 sec2_file.h5 - direct_file.h5 - family_file000*.h5 - new_family_v16_000*.h5 - multi_file-*.h5 - core_file - filter_plugin.h5 - new_move_*.h5 - ntypes.h5 - dangle.h5 - error_test.h5 - err_compat.h5 - dtransform.h5 - test_filters.h5 - get_file_name.h5 - tstint*.h5 - unlink_chunked.h5 - btree2.h5 - btree2_tmp.h5 - objcopy_src.h5 - objcopy_dst.h5 + single_latest.h5 + source_file.h5 + splitter_rw_file.h5 + splitter_tmp.h5 + splitter_wo_file.h5 + stdio_file.h5 + swmr0.h5 + tfile_is_accessible_non_hdf5.h5 + tfile_is_accessible.h5 + tfile1.h5.h5 + tfile8.h5 + tfile8.h5.h5 + tmisc15.h5.h5 + tstint1.h5 + tstint2.h5 + tverbounds_dtype.h5 + virtual_file1.h5 objcopy_ext.dat - app_ref.h5 - farray.h5 - farray_tmp.h5 - earray.h5 - earray_tmp.h5 - efc*.h5 log_vfd_out.log - log_ros3_out.log - log_s3comms_out.log - new_multi_file_v16-r.h5 - new_multi_file_v16-s.h5 - split_get_file_image_test-m.h5 - split_get_file_image_test-r.h5 - file_image_core_test.h5.copy - unregister_filter_1.h5 - unregister_filter_2.h5 - vds_virt.h5 - vds_dapl.h5 - vds_src_*.h5 - swmr_data.h5 - use_use_append_chunk.h5 - use_append_mchunks.h5 - use_disable_mdc_flushes.h5 - flushrefresh.h5 - flushrefresh_VERIFICATION_START - flushrefresh_VERIFICATION_CHECKPOINT1 - flushrefresh_VERIFICATION_CHECKPOINT2 - flushrefresh_VERIFICATION_DONE - filenotclosed.h5 - del_many_dense_attrs.h5 - atomic_data - accum_swmr_big.h5 - ohdr_swmr.h5 - test_swmr*.h5 - cache_logging.h5 - cache_logging.out - vds_swmr.h5 - vds_swmr_src_*.h5 - swmr*.h5 - swmr_writer.out - swmr_writer.log.* - swmr_reader.out.* - swmr_reader.log.* - tbogus.h5.copy - cache_image_test.h5 - direct_chunk.h5 - native_vol_test.h5 - splitter*.h5 splitter.log - mirror_rw/* - mirror_wo/* + tbogus.h5.copy + tmp_vds/vds_src_2.h5 +) + +set (EXTLINKS_CLEANFILES + extlinks16A-000000.h5 + extlinks16A-000001.h5 + extlinks16B-b.h5 + extlinks16B-g.h5 + extlinks16B-l.h5 + extlinks16B-r.h5 + extlinks16B-s.h5 + extlinks19B-000000.h5 + extlinks19B-000001.h5 + extlinks19B-000002.h5 + extlinks19B-000003.h5 + extlinks19B-000004.h5 + extlinks19B-000005.h5 + extlinks19B-000006.h5 + extlinks19B-000007.h5 + extlinks19B-000008.h5 + extlinks19B-000009.h5 + extlinks19B-000010.h5 + extlinks19B-000011.h5 + extlinks19B-000012.h5 + extlinks19B-000013.h5 + extlinks19B-000014.h5 + extlinks19B-000015.h5 + extlinks19B-000016.h5 + extlinks19B-000017.h5 + extlinks19B-000018.h5 + extlinks19B-000019.h5 + extlinks19B-000020.h5 + extlinks19B-000021.h5 + extlinks19B-000022.h5 + extlinks19B-000023.h5 + extlinks19B-000024.h5 + extlinks19B-000025.h5 + extlinks19B-000026.h5 + extlinks19B-000027.h5 + extlinks19B-000028.h5 ) # Remove any output file left over from previous test run add_test ( NAME H5TEST-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove ${test_CLEANFILES} + COMMAND ${CMAKE_COMMAND} -E remove ${test_CLEANFILES} ${EXTLINKS_CLEANFILES} + COMMAND_EXPAND_LISTS WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) set_tests_properties (H5TEST-clear-objects PROPERTIES FIXTURES_SETUP clear_H5TEST) +add_test ( + NAME H5TEST-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove ${test_CLEANFILES} ${EXTLINKS_CLEANFILES} + COMMAND_EXPAND_LISTS + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +) +set_tests_properties (H5TEST-clean-objects PROPERTIES FIXTURES_CLEANUP clear_H5TEST) set (H5TEST_SEPARATE_TESTS testhdf5 @@ -420,7 +341,7 @@ foreach (h5_test ${H5_TESTS}) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5TEST-${h5_test} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:${h5_test}>) set_tests_properties (H5TEST-${h5_test} PROPERTIES - FIXTURES_REQUIRED clear_objects + FIXTURES_REQUIRED clear_H5TEST ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) @@ -461,10 +382,18 @@ set_tests_properties (H5TEST-objcopy PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOU if (NOT CYGWIN) add_test ( NAME H5TEST-cache-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove cache_test.h5 + COMMAND ${CMAKE_COMMAND} -E remove + cache_test.h5 WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) set_tests_properties (H5TEST-cache-clear-objects PROPERTIES FIXTURES_SETUP clear_cache) + add_test ( + NAME H5TEST-cache-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove + cache_test.h5 + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST + ) + set_tests_properties (H5TEST-cache-clean-objects PROPERTIES FIXTURES_CLEANUP clear_cache) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5TEST-cache COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:cache>) else () @@ -496,6 +425,12 @@ if (TEST_CACHE_IMAGE) WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) set_tests_properties (H5TEST-cache_image-clear-objects PROPERTIES FIXTURES_SETUP clear_cache_image) + add_test ( + NAME H5TEST-cache_image-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove cache_image_test.h5 + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST + ) + set_tests_properties (H5TEST-cache_image-clean-objects PROPERTIES FIXTURES_CLEANUP clear_cache_image) add_test (NAME H5TEST_cache_image COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:cache_image>) set_tests_properties (H5TEST-cache_image PROPERTIES FIXTURES_REQUIRED clear_cache_image @@ -505,21 +440,28 @@ if (TEST_CACHE_IMAGE) endif () #-- Adding test for external_env +set (H5TEST_EXTERNAL_CLEANFILES + extern_1r.raw + extern_2r.raw + extern_3r.raw + extern_4r.raw + extern_1w.raw + extern_2w.raw + extern_3w.raw + extern_4w.raw +) add_test ( NAME H5TEST-external_env-clear-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 + COMMAND ${CMAKE_COMMAND} -E remove ${H5TEST_EXTERNAL_CLEANFILES} + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) set_tests_properties (H5TEST-external_env-clear-objects PROPERTIES FIXTURES_SETUP clear_external_env) +add_test ( + NAME H5TEST-external_env-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove ${H5TEST_EXTERNAL_CLEANFILES} + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +) +set_tests_properties (H5TEST-external_env-clean-objects PROPERTIES FIXTURES_CLEANUP clear_external_env) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5TEST-external_env COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:external_env>) else () @@ -545,15 +487,13 @@ set_tests_properties (H5TEST-external_env PROPERTIES #-- Adding test for vds_env add_test ( - NAME H5TEST-vds_env-clear-objects + NAME H5TEST-vds_env-clean-objects COMMAND ${CMAKE_COMMAND} -E remove - vds_virt_0.h5 - vds_virt_3.h5 - vds_src_2.h5 + tmp_vds_env/vds_env_src_2.h5 WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -set_tests_properties (H5TEST-vds_env-clear-objects PROPERTIES FIXTURES_SETUP clear_vds_env) +set_tests_properties (H5TEST-vds_env-clean-objects PROPERTIES FIXTURES_CLEANUP clear_vds_env) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5TEST-vds_env COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:vds_env>) else () @@ -578,20 +518,26 @@ set_tests_properties (H5TEST-vds_env PROPERTIES ) #-- Adding test for flush1/2 +set (FLUSH_CLEANFILES + flush.h5 + flush-swmr.h5 + noflush.h5 + noflush-swmr.h5 + flush_extend.h5 + flush_extend-swmr.h5 + noflush_extend.h5 + noflush_extend-swmr.h5 +) add_test (NAME H5TEST-flush-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove - flush.h5 - flush-swmr.h5 - noflush.h5 - noflush-swmr.h5 - flush_extend.h5 - flush_extend-swmr.h5 - noflush_extend.h5 - noflush_extend-swmr.h5 - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST + COMMAND ${CMAKE_COMMAND} -E remove ${FLUSH_CLEANFILES} + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) set_tests_properties (H5TEST-flush-clear-objects PROPERTIES FIXTURES_SETUP clear_flush) +add_test (NAME H5TEST-flush-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove ${FLUSH_CLEANFILES} + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +) +set_tests_properties (H5TEST-flush-clean-objects PROPERTIES FIXTURES_CLEANUP clear_flush) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5TEST-flush1 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:flush1>) else () @@ -686,6 +632,12 @@ add_test ( WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) set_tests_properties (H5TEST-filenotclosed-clear-objects PROPERTIES FIXTURES_SETUP clear_filenotclosed) +add_test ( + NAME H5TEST-filenotclosed-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove filenotclosed.h5 + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +) +set_tests_properties (H5TEST-filenotclosed-clean-objects PROPERTIES FIXTURES_CLEANUP clear_filenotclosed) add_test (NAME H5TEST-filenotclosed COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:filenotclosed>) set_tests_properties (H5TEST-filenotclosed PROPERTIES FIXTURES_REQUIRED clear_filenotclosed @@ -700,6 +652,12 @@ add_test ( WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) set_tests_properties (H5TEST-del_many_dense_attrs-clear-objects PROPERTIES FIXTURES_SETUP clear_del_many_dense_attrs) +add_test ( + NAME H5TEST-del_many_dense_attrs-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove del_many_dense_attrs.h5 + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +) +set_tests_properties (H5TEST-del_many_dense_attrs-clean-objects PROPERTIES FIXTURES_CLEANUP clear_del_many_dense_attrs) add_test (NAME H5TEST-del_many_dense_attrs COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:del_many_dense_attrs>) set_tests_properties (H5TEST-del_many_dense_attrs PROPERTIES FIXTURES_REQUIRED clear_del_many_dense_attrs @@ -779,6 +737,14 @@ else () ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5_PLUGIN_PRELOAD=::" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) + add_test ( + NAME H5TEST-error_test-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove error_test.txt + ) + set_tests_properties (H5TEST-error_test-clean-objects PROPERTIES + DEPENDS H5TEST-error_test + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST + ) endif () #-- Adding test for links_env @@ -791,6 +757,15 @@ add_test (NAME H5TEST-links_env-clear-objects ${HDF5_TEST_BINARY_DIR}/H5TEST ) set_tests_properties (H5TEST-links_env-clear-objects PROPERTIES FIXTURES_SETUP clear_links_env) +add_test (NAME H5TEST-links_env-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove + extlinks_env0.h5 + extlinks_env1.h5 + tmp_links_env/extlinks_env1.h5 + WORKING_DIRECTORY + ${HDF5_TEST_BINARY_DIR}/H5TEST +) +set_tests_properties (H5TEST-links_env-clean-objects PROPERTIES FIXTURES_CLEANUP clear_links_env) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5TEST-links_env COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:links_env>) else () @@ -844,16 +819,6 @@ if (BUILD_SHARED_LIBS) ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/filter_plugin_dir1${CMAKE_SEP}${CMAKE_BINARY_DIR}/filter_plugin_dir2;srcdir=${HDF5_TEST_BINARY_DIR}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR} ) - -############################################################################## -# HDFFV-9655 relative plugin test disabled -# -# add_test (NAME H5PLUGIN-pluginRelative COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:plugin>) -# set_tests_properties (H5PLUGIN-pluginRelative PROPERTIES -# ENVIRONMENT "HDF5_PLUGIN_PATH=@/${BIN_REL_PATH}testdir1${CMAKE_SEP}@/${BIN_REL_PATH}testdir2;srcdir=${HDF5_TEST_BINARY_DIR}" -# WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR} -# ) -############################################################################## endif () option (TEST_SHELL_SCRIPTS "Enable shell script tests" ON) @@ -876,10 +841,20 @@ if (ENABLE_EXTENDED_TESTS) if (H5_PERL_FOUND) add_test ( NAME H5TEST-testflushrefresh-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove flushrefresh.h5 + COMMAND ${CMAKE_COMMAND} -E remove + flushrefresh.h5 + flushrefresh_test/flushrefresh.h5 WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST/flushrefresh_test ) set_tests_properties (H5TEST-testflushrefresh-clear-objects PROPERTIES FIXTURES_SETUP clear_testflushrefresh) + add_test ( + NAME H5TEST-testflushrefresh-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove + flushrefresh.h5 + flushrefresh_test/flushrefresh.h5 + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST/flushrefresh_test + ) + set_tests_properties (H5TEST-testflushrefresh-clean-objects PROPERTIES FIXTURES_CLEANUP clear_testflushrefresh) add_test (NAME H5TEST-testflushrefresh COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$<TARGET_FILE:flushrefresh>" @@ -952,7 +927,7 @@ endif () if (HDF5_BUILD_GENERATORS AND BUILD_STATIC_LIBS) macro (ADD_H5_GENERATOR genfile) add_executable (${genfile} ${HDF5_TEST_SOURCE_DIR}/${genfile}.c) - target_include_directories (${genfile} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (${genfile} PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_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 87683fa..32877a4 100644 --- a/test/CMakeVFDTests.cmake +++ b/test/CMakeVFDTests.cmake @@ -138,21 +138,23 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD endmacro () macro (DO_VFD_TEST vfdtest vfdname resultcode) - add_test (NAME VFD-${vfdname}-${vfdtest} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -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 - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} - ) + if (NOT "${vfdtest}" IN_LIST H5_VFD_${vfdname}_SKIP_TESTS) + add_test (NAME VFD-${vfdname}-${vfdtest} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -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 + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} + ) + endif () endmacro () macro (ADD_VFD_TEST vfdname resultcode) @@ -165,10 +167,18 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD endif () endif () endforeach () - set_tests_properties (VFD-${vfdname}-flush2 PROPERTIES DEPENDS VFD-${vfdname}-flush1) - set_tests_properties (VFD-${vfdname}-flush1 PROPERTIES TIMEOUT 10) - set_tests_properties (VFD-${vfdname}-flush2 PROPERTIES TIMEOUT 10) - set_tests_properties (VFD-${vfdname}-istore PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) + if (NOT "flush2" IN_LIST H5_VFD_${vfdname}_SKIP_TESTS) + if (NOT "flush1" IN_LIST H5_VFD_${vfdname}_SKIP_TESTS) + set_tests_properties (VFD-${vfdname}-flush2 PROPERTIES DEPENDS VFD-${vfdname}-flush1) + endif () + set_tests_properties (VFD-${vfdname}-flush2 PROPERTIES TIMEOUT 10) + endif () + if (NOT "flush1" IN_LIST H5_VFD_${vfdname}_SKIP_TESTS) + set_tests_properties (VFD-${vfdname}-flush1 PROPERTIES TIMEOUT 10) + endif () + if (NOT "istore" IN_LIST H5_VFD_${vfdname}_SKIP_TESTS) + set_tests_properties (VFD-${vfdname}-istore PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) + endif () if (NOT CYGWIN) set_tests_properties (VFD-${vfdname}-cache PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) endif () diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt index eb5b8cd..0683338 100644 --- a/testpar/CMakeLists.txt +++ b/testpar/CMakeLists.txt @@ -23,8 +23,12 @@ set (testphdf5_SOURCES #-- Adding test for testhdf5 add_executable (testphdf5 ${testphdf5_SOURCES}) target_compile_options(testphdf5 PRIVATE "${HDF5_CMAKE_C_FLAGS}") +target_compile_definitions(testphdf5 + PRIVATE + "$<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}>" +) target_include_directories (testphdf5 - PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" + PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" ) if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (testphdf5 STATIC) @@ -49,8 +53,12 @@ endif () macro (ADD_H5P_EXE file) add_executable (${file} ${HDF5_TEST_PAR_SOURCE_DIR}/${file}.c) target_compile_options(${file} PRIVATE "${HDF5_CMAKE_C_FLAGS}") + target_compile_definitions(${file} + PRIVATE + "$<$<CONFIG:Developer>:${HDF5_DEVELOPER_DEFS}>" + ) target_include_directories (${file} - PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" + PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" ) if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (${file} STATIC) diff --git a/testpar/CMakeTests.cmake b/testpar/CMakeTests.cmake index ee69881..1a3f409 100644 --- a/testpar/CMakeTests.cmake +++ b/testpar/CMakeTests.cmake @@ -22,6 +22,12 @@ add_test ( WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR} ) set_tests_properties (MPI_TEST-clear-testphdf5-objects PROPERTIES FIXTURES_SETUP par_clear_testphdf5) +add_test ( + NAME MPI_TEST-clean-testphdf5-objects + COMMAND ${CMAKE_COMMAND} -E remove ParaTest.h5 + WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR} +) +set_tests_properties (MPI_TEST-clean-testphdf5-objects PROPERTIES FIXTURES_CLEANUP par_clear_testphdf5) set (SKIP_tests cchunk1 @@ -101,6 +107,12 @@ add_test ( WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR} ) set_tests_properties (MPI_TEST-clear-objects PROPERTIES FIXTURES_SETUP par_clear_objects) +add_test ( + NAME MPI_TEST-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove ${test_par_CLEANFILES} + WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR} +) +set_tests_properties (MPI_TEST-clean-objects PROPERTIES FIXTURES_CLEANUP par_clear_objects) foreach (h5_testp ${H5P_TESTS}) add_test (NAME MPI_TEST_${h5_testp} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:${h5_testp}> ${MPIEXEC_POSTFLAGS}) diff --git a/testpar/CMakeVFDTests.cmake b/testpar/CMakeVFDTests.cmake index d6a4025..40624d5 100644 --- a/testpar/CMakeVFDTests.cmake +++ b/testpar/CMakeVFDTests.cmake @@ -25,26 +25,34 @@ set (H5P_VFD_TESTS macro (ADD_VFD_TEST vfdname resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) foreach (h5_test ${H5P_VFD_TESTS}) - add_test ( - NAME MPI_TEST_VFD-${vfdname}-${h5_test} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$<TARGET_FILE:${h5_test}>" - -D "TEST_ARGS:STRING=" - -D "TEST_VFD:STRING=${vfdname}" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_OUTPUT=${vfdname}-${h5_test}.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}" - -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" - ) - set_tests_properties (MPI_TEST_VFD-${vfdname}-${h5_test} PROPERTIES - ENVIRONMENT "srcdir=${HDF5_TEST_PAR_BINARY_DIR}/${vfdname}" - WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR}/${vfdname} - ) + if (NOT "${h5_test}" IN_LIST H5P_VFD_${vfdname}_TESTS_SKIP) + add_test ( + NAME MPI_TEST_VFD-${vfdname}-${h5_test} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$<TARGET_FILE:${h5_test}>" + -D "TEST_ARGS:STRING=" + -D "TEST_VFD:STRING=${vfdname}" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_OUTPUT=${vfdname}-${h5_test}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}" + -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" + ) + set_tests_properties (MPI_TEST_VFD-${vfdname}-${h5_test} PROPERTIES + ENVIRONMENT "srcdir=${HDF5_TEST_PAR_BINARY_DIR}/${vfdname}" + WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR}/${vfdname} + ) + endif () endforeach () - set_tests_properties (MPI_TEST_VFD-${vfdname}-t_pflush1 PROPERTIES WILL_FAIL "true") - #set_property (TEST MPI_TEST_t_pflush1 PROPERTY PASS_REGULAR_EXPRESSION "PASSED") - set_tests_properties (MPI_TEST_VFD-${vfdname}-t_pflush2 PROPERTIES DEPENDS MPI_TEST_VFD-${vfdname}-t_pflush1) + if (NOT "t_pflush1" IN_LIST H5P_VFD_${vfdname}_TESTS_SKIP) + set_tests_properties (MPI_TEST_VFD-${vfdname}-t_pflush1 PROPERTIES WILL_FAIL "true") + #set_property (TEST MPI_TEST_t_pflush1 PROPERTY PASS_REGULAR_EXPRESSION "PASSED") + endif () + if (NOT "t_pflush2" IN_LIST H5P_VFD_${vfdname}_TESTS_SKIP) + if (NOT "t_pflush1" IN_LIST H5P_VFD_${vfdname}_TESTS_SKIP) + set_tests_properties (MPI_TEST_VFD-${vfdname}-t_pflush2 PROPERTIES DEPENDS MPI_TEST_VFD-${vfdname}-t_pflush1) + endif () + endif () endif () endmacro () diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index f0e40fe..bf9d087 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -37,7 +37,7 @@ set (H5_TOOLS_LIB_HDRS if (BUILD_STATIC_LIBS) add_library (${HDF5_TOOLS_LIB_TARGET} STATIC ${H5_TOOLS_LIB_SOURCES} ${H5_TOOLS_LIB_HDRS}) target_include_directories (${HDF5_TOOLS_LIB_TARGET} - PRIVATE "${HDF5_TOOLS_LIB_SOURCE_DIR};${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" + PRIVATE "${HDF5_TOOLS_LIB_SOURCE_DIR};${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) target_compile_options(${HDF5_TOOLS_LIB_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") @@ -57,7 +57,7 @@ endif () if (BUILD_SHARED_LIBS) add_library (${HDF5_TOOLS_LIBSH_TARGET} SHARED ${H5_TOOLS_LIB_SOURCES} ${H5_TOOLS_LIB_HDRS}) target_include_directories (${HDF5_TOOLS_LIBSH_TARGET} - PRIVATE "${HDF5_TOOLS_LIB_SOURCE_DIR};${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" + PRIVATE "${HDF5_TOOLS_LIB_SOURCE_DIR};${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) target_compile_options(${HDF5_TOOLS_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") diff --git a/tools/libtest/CMakeLists.txt b/tools/libtest/CMakeLists.txt index 33df35b..a7d2eb3 100644 --- a/tools/libtest/CMakeLists.txt +++ b/tools/libtest/CMakeLists.txt @@ -6,7 +6,7 @@ project (HDF5_TOOLS_LIBTEST C) #----------------------------------------------------------------------------- add_executable (h5tools_test_utils ${HDF5_TOOLS_LIBTEST_SOURCE_DIR}/h5tools_test_utils.c) target_compile_options(h5tools_test_utils PRIVATE "${HDF5_CMAKE_C_FLAGS}") -target_include_directories(h5tools_test_utils PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_include_directories(h5tools_test_utils PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (BUILD_STATIC_LIBS) TARGET_C_PROPERTIES (h5tools_test_utils STATIC) target_link_libraries (h5tools_test_utils PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) diff --git a/tools/libtest/CMakeTests.cmake b/tools/libtest/CMakeTests.cmake index 2d8e877..79810c4 100644 --- a/tools/libtest/CMakeTests.cmake +++ b/tools/libtest/CMakeTests.cmake @@ -24,21 +24,10 @@ ############################################################################## macro (ADD_H5_TEST resultfile resultcode) - add_test ( - NAME H5LIBTEST-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.out - ${resultfile}.out.err - ) - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5LIBTEST-${resultfile}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () add_test (NAME H5LIBTEST-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5tools_test_utils> ${ARGN}) if (NOT "${resultcode}" STREQUAL "0") set_tests_properties (H5LIBTEST-${resultfile} PROPERTIES WILL_FAIL "true") endif () - set_tests_properties (H5LIBTEST-${resultfile} PROPERTIES DEPENDS H5LIBTEST-${resultfile}-clear-objects) endmacro () ############################################################################## diff --git a/tools/src/h5copy/CMakeLists.txt b/tools/src/h5copy/CMakeLists.txt index 9bf98cc..686dbad 100644 --- a/tools/src/h5copy/CMakeLists.txt +++ b/tools/src/h5copy/CMakeLists.txt @@ -6,7 +6,7 @@ project (HDF5_TOOLS_SRC_H5COPY C) # -------------------------------------------------------------------- if (BUILD_STATIC_LIBS) add_executable (h5copy ${HDF5_TOOLS_SRC_H5COPY_SOURCE_DIR}/h5copy.c) - target_include_directories (h5copy PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5copy PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(h5copy PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5copy STATIC) target_link_libraries (h5copy PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) @@ -18,7 +18,7 @@ endif () if (BUILD_SHARED_LIBS) add_executable (h5copy-shared ${HDF5_TOOLS_SRC_H5COPY_SOURCE_DIR}/h5copy.c) - target_include_directories (h5copy-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5copy-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(h5copy-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5copy-shared SHARED) target_link_libraries (h5copy-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) diff --git a/tools/src/h5diff/CMakeLists.txt b/tools/src/h5diff/CMakeLists.txt index 718e552..cd28c41 100644 --- a/tools/src/h5diff/CMakeLists.txt +++ b/tools/src/h5diff/CMakeLists.txt @@ -10,7 +10,7 @@ if (BUILD_STATIC_LIBS) ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.h ) - target_include_directories (h5diff PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5diff PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(h5diff PRIVATE "${HDF5_CMAKE_C_FLAGS}") #target_compile_definitions (h5diff PRIVATE H5_TOOLS_DEBUG) TARGET_C_PROPERTIES (h5diff STATIC) @@ -26,7 +26,7 @@ if (BUILD_SHARED_LIBS) ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.h ) - target_include_directories (h5diff-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5diff-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(h5diff-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") #target_compile_definitions (h5diff-shared PRIVATE H5_TOOLS_DEBUG) TARGET_C_PROPERTIES (h5diff-shared SHARED) @@ -54,7 +54,7 @@ if (H5_HAVE_PARALLEL) ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/ph5diff_main.c ) - target_include_directories (ph5diff PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (ph5diff PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(ph5diff PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (ph5diff STATIC) target_link_libraries (ph5diff PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:MPI::MPI_C>") @@ -67,7 +67,7 @@ if (H5_HAVE_PARALLEL) ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/ph5diff_main.c ) - target_include_directories (ph5diff-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (ph5diff-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(ph5diff-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (ph5diff-shared SHARED) target_link_libraries (ph5diff-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:MPI::MPI_C>") diff --git a/tools/src/h5dump/CMakeLists.txt b/tools/src/h5dump/CMakeLists.txt index ad39e77..b013145 100644 --- a/tools/src/h5dump/CMakeLists.txt +++ b/tools/src/h5dump/CMakeLists.txt @@ -15,7 +15,7 @@ if (BUILD_STATIC_LIBS) ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.h ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.h ) - target_include_directories (h5dump PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5dump PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(h5dump PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5dump STATIC) target_link_libraries (h5dump PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) @@ -36,7 +36,7 @@ if (BUILD_SHARED_LIBS) ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.h ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.h ) - target_include_directories (h5dump-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5dump-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(h5dump-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5dump-shared SHARED) target_link_libraries (h5dump-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) diff --git a/tools/src/h5format_convert/CMakeLists.txt b/tools/src/h5format_convert/CMakeLists.txt index 59b1ff5..d6d9027 100644 --- a/tools/src/h5format_convert/CMakeLists.txt +++ b/tools/src/h5format_convert/CMakeLists.txt @@ -6,7 +6,7 @@ project (HDF5_TOOLS_SRC_H5FC C) # -------------------------------------------------------------------- if (BUILD_STATIC_LIBS) add_executable (h5format_convert ${HDF5_TOOLS_SRC_H5FC_SOURCE_DIR}/h5format_convert.c) - target_include_directories (h5format_convert PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5format_convert PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(h5format_convert PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5format_convert STATIC) target_link_libraries (h5format_convert PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) @@ -17,7 +17,7 @@ if (BUILD_STATIC_LIBS) endif () if (BUILD_SHARED_LIBS) add_executable (h5format_convert-shared ${HDF5_TOOLS_SRC_H5FC_SOURCE_DIR}/h5format_convert.c) - target_include_directories (h5format_convert-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5format_convert-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(h5format_convert-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5format_convert-shared SHARED) target_link_libraries (h5format_convert-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) diff --git a/tools/src/h5import/CMakeLists.txt b/tools/src/h5import/CMakeLists.txt index bc96122..c8ee6b8 100644 --- a/tools/src/h5import/CMakeLists.txt +++ b/tools/src/h5import/CMakeLists.txt @@ -6,7 +6,7 @@ project (HDF5_TOOLS_SRC_H5IMPORT C) # -------------------------------------------------------------------- if (BUILD_STATIC_LIBS) add_executable (h5import ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.c ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.h) - target_include_directories (h5import PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5import PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5import STATIC) target_link_libraries (h5import PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) #set_target_properties (h5import PROPERTIES COMPILE_DEFINITIONS H5DEBUGIMPORT) @@ -18,7 +18,7 @@ endif () if (BUILD_SHARED_LIBS) add_executable (h5import-shared ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.c ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.h) - target_include_directories (h5import-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5import-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5import-shared SHARED) target_link_libraries (h5import-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) #set_target_properties (h5import-shared PROPERTIES COMPILE_DEFINITIONS H5DEBUGIMPORT) diff --git a/tools/src/h5jam/CMakeLists.txt b/tools/src/h5jam/CMakeLists.txt index 0755be2..aabdd00 100644 --- a/tools/src/h5jam/CMakeLists.txt +++ b/tools/src/h5jam/CMakeLists.txt @@ -6,14 +6,14 @@ project (HDF5_TOOLS_SRC_H5JAM C) # -------------------------------------------------------------------- if (BUILD_STATIC_LIBS) add_executable (h5jam ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5jam.c) - target_include_directories (h5jam PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5jam PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5jam STATIC) target_link_libraries (h5jam PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5jam PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5jam") add_executable (h5unjam ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5unjam.c) - target_include_directories (h5unjam PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5unjam PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5unjam STATIC) target_link_libraries (h5unjam PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5unjam PROPERTIES FOLDER tools) @@ -27,14 +27,14 @@ endif () if (BUILD_SHARED_LIBS) add_executable (h5jam-shared ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5jam.c) - target_include_directories (h5jam-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5jam-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5jam-shared SHARED) target_link_libraries (h5jam-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5jam-shared PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5jam-shared") add_executable (h5unjam-shared ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5unjam.c) - target_include_directories (h5unjam-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5unjam-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5unjam-shared SHARED) target_link_libraries (h5unjam-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5unjam-shared PROPERTIES FOLDER tools) diff --git a/tools/src/h5ls/CMakeLists.txt b/tools/src/h5ls/CMakeLists.txt index 5d19d15..055d545 100644 --- a/tools/src/h5ls/CMakeLists.txt +++ b/tools/src/h5ls/CMakeLists.txt @@ -6,7 +6,7 @@ project (HDF5_TOOLS_SRC_H5LS C) #----------------------------------------------------------------------------- if (BUILD_STATIC_LIBS) add_executable (h5ls ${HDF5_TOOLS_SRC_H5LS_SOURCE_DIR}/h5ls.c) - target_include_directories (h5ls PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5ls PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(h5ls PRIVATE "${HDF5_CMAKE_C_FLAGS}") #target_compile_definitions(h5ls PRIVATE H5_TOOLS_DEBUG) TARGET_C_PROPERTIES (h5ls STATIC) @@ -19,7 +19,7 @@ endif () if (BUILD_SHARED_LIBS) add_executable (h5ls-shared ${HDF5_TOOLS_SRC_H5LS_SOURCE_DIR}/h5ls.c) - target_include_directories (h5ls-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5ls-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(h5ls-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") #target_compile_definitions(h5ls-shared PRIVATE H5_TOOLS_DEBUG) TARGET_C_PROPERTIES (h5ls-shared SHARED) diff --git a/tools/src/h5perf/CMakeLists.txt b/tools/src/h5perf/CMakeLists.txt index a0dc729..9fd9366 100644 --- a/tools/src/h5perf/CMakeLists.txt +++ b/tools/src/h5perf/CMakeLists.txt @@ -2,15 +2,14 @@ cmake_minimum_required (VERSION 3.12) project (HDF5_TOOLS_SRC_H5PERF C) # -------------------------------------------------------------------- -# Add the executables +# h5perf_serial # -------------------------------------------------------------------- -#-- Adding test for h5perf_serial set (h5perf_serial_SOURCES ${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/sio_perf.c ${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/sio_engine.c ) add_executable (h5perf_serial ${h5perf_serial_SOURCES}) -target_include_directories (h5perf_serial PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_include_directories (h5perf_serial PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (BUILD_STATIC_LIBS) TARGET_C_PROPERTIES (h5perf_serial STATIC) target_link_libraries (h5perf_serial PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) @@ -23,48 +22,20 @@ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5perf_serial set (H5_DEP_EXECUTABLES h5perf_serial) -#----------------------------------------------------------------------------- -# Add Target to clang-format -#----------------------------------------------------------------------------- if (HDF5_ENABLE_FORMATTERS) clang_format (HDF5_TOOLS_SRC_H5PERF_h5perf_serial_FORMAT h5perf_serial) endif () +# -------------------------------------------------------------------- +# h5perf +# -------------------------------------------------------------------- if (H5_HAVE_PARALLEL) - if (UNIX) - #-- Adding test for perf - only on unix systems - set (perf_SOURCES - ${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/perf.c - ) - add_executable (perf ${perf_SOURCES}) - target_include_directories (perf PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") - if (BUILD_STATIC_LIBS) - TARGET_C_PROPERTIES (perf STATIC) - target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>") - else () - TARGET_C_PROPERTIES (perf SHARED) - target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>") - endif () - set_target_properties (perf PROPERTIES FOLDER perform) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};perf") - - set (H5_DEP_EXECUTABLES perf) - - #----------------------------------------------------------------------------- - # Add Target to clang-format - #----------------------------------------------------------------------------- - if (HDF5_ENABLE_FORMATTERS) - clang_format (HDF5_TOOLS_SRC_H5PERF_perf_FORMAT perf) - endif () - endif () - - #-- Adding test for h5perf set (h5perf_SOURCES ${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/pio_perf.c ${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/pio_engine.c ) add_executable (h5perf ${h5perf_SOURCES}) - target_include_directories (h5perf PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5perf PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (BUILD_STATIC_LIBS) TARGET_C_PROPERTIES (h5perf STATIC) target_link_libraries (h5perf PRIVATE ${LINK_LIBS} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:MPI::MPI_C>") @@ -77,9 +48,6 @@ if (H5_HAVE_PARALLEL) set (H5_DEP_EXECUTABLES h5perf) - #----------------------------------------------------------------------------- - # Add Target to clang-format - #----------------------------------------------------------------------------- if (HDF5_ENABLE_FORMATTERS) clang_format (HDF5_TOOLS_SRC_H5PERF_h5perf_FORMAT h5perf) endif () diff --git a/tools/src/h5repack/CMakeLists.txt b/tools/src/h5repack/CMakeLists.txt index 0a4bddc..261c05a 100644 --- a/tools/src/h5repack/CMakeLists.txt +++ b/tools/src/h5repack/CMakeLists.txt @@ -17,7 +17,7 @@ set (REPACK_COMMON_SOURCES if (BUILD_STATIC_LIBS) add_executable (h5repack ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_main.c) - target_include_directories (h5repack PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5repack PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(h5repack PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5repack STATIC) target_link_libraries (h5repack PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) @@ -29,7 +29,7 @@ endif () if (BUILD_SHARED_LIBS) add_executable (h5repack-shared ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_main.c) - target_include_directories (h5repack-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5repack-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(h5repack-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5repack-shared SHARED) target_link_libraries (h5repack-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) diff --git a/tools/src/h5stat/CMakeLists.txt b/tools/src/h5stat/CMakeLists.txt index 5ee091c..661b7f8 100644 --- a/tools/src/h5stat/CMakeLists.txt +++ b/tools/src/h5stat/CMakeLists.txt @@ -6,7 +6,7 @@ project (HDF5_TOOLS_SRC_H5STAT C) # -------------------------------------------------------------------- if (BUILD_STATIC_LIBS) add_executable (h5stat ${HDF5_TOOLS_SRC_H5STAT_SOURCE_DIR}/h5stat.c) - target_include_directories (h5stat PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5stat PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(h5stat PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5stat STATIC) target_link_libraries (h5stat PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) @@ -18,7 +18,7 @@ endif () if (BUILD_SHARED_LIBS) add_executable (h5stat-shared ${HDF5_TOOLS_SRC_H5STAT_SOURCE_DIR}/h5stat.c) - target_include_directories (h5stat-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5stat-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(h5stat-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5stat-shared SHARED) target_link_libraries (h5stat-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) diff --git a/tools/src/misc/CMakeLists.txt b/tools/src/misc/CMakeLists.txt index 751fe09..b9e7f28 100644 --- a/tools/src/misc/CMakeLists.txt +++ b/tools/src/misc/CMakeLists.txt @@ -7,7 +7,7 @@ project (HDF5_TOOLS_SRC_MISC C) #-- Misc Executables if (BUILD_STATIC_LIBS) add_executable (h5debug ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5debug.c) - target_include_directories (h5debug PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5debug PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(h5debug PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5debug STATIC) target_link_libraries (h5debug PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) @@ -15,7 +15,7 @@ if (BUILD_STATIC_LIBS) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5debug") add_executable (h5repart ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5repart.c) - target_include_directories (h5repart PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5repart PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(h5repart PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5repart STATIC) target_link_libraries (h5repart PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) @@ -23,7 +23,7 @@ if (BUILD_STATIC_LIBS) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repart") add_executable (h5mkgrp ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5mkgrp.c) - target_include_directories (h5mkgrp PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5mkgrp PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(h5mkgrp PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5mkgrp STATIC) target_link_libraries (h5mkgrp PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) @@ -31,7 +31,7 @@ if (BUILD_STATIC_LIBS) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5mkgrp") add_executable (h5clear ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5clear.c) - target_include_directories (h5clear PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5clear PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(h5clear PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5clear STATIC) target_link_libraries (h5clear PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) @@ -47,7 +47,7 @@ if (BUILD_STATIC_LIBS) endif () if (BUILD_SHARED_LIBS) add_executable (h5debug-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5debug.c) - target_include_directories (h5debug-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5debug-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5debug-shared SHARED) target_compile_options(h5debug-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_link_libraries (h5debug-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) @@ -55,7 +55,7 @@ if (BUILD_SHARED_LIBS) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5debug-shared") add_executable (h5repart-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5repart.c) - target_include_directories (h5repart-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5repart-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(h5repart-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5repart-shared SHARED) target_link_libraries (h5repart-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) @@ -63,7 +63,7 @@ if (BUILD_SHARED_LIBS) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repart-shared") add_executable (h5mkgrp-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5mkgrp.c) - target_include_directories (h5mkgrp-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5mkgrp-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(h5mkgrp-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5mkgrp-shared SHARED) target_link_libraries (h5mkgrp-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) @@ -71,7 +71,7 @@ if (BUILD_SHARED_LIBS) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5mkgrp-shared") add_executable (h5clear-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5clear.c) - target_include_directories (h5clear-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5clear-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(h5clear-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5clear-shared SHARED) target_link_libraries (h5clear-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) diff --git a/tools/test/h5copy/CMakeLists.txt b/tools/test/h5copy/CMakeLists.txt index fb88473..c2b375e 100644 --- a/tools/test/h5copy/CMakeLists.txt +++ b/tools/test/h5copy/CMakeLists.txt @@ -6,7 +6,7 @@ project (HDF5_TOOLS_TEST_H5COPY C) # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS AND BUILD_STATIC_LIBS) add_executable (h5copygentest ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/h5copygentest.c) - target_include_directories (h5copygentest PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5copygentest PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5copygentest STATIC) target_link_libraries (h5copygentest PRIVATE ${HDF5_LIB_TARGET}) set_target_properties (h5copygentest PROPERTIES FOLDER generator/tools) @@ -30,7 +30,7 @@ if (BUILD_SHARED_LIBS) set (H5COPY_TOOL_PLUGIN_LIB_TARGET ${H5COPY_TOOL_PLUGIN_LIB_CORENAME}) add_library (${H5COPY_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_copy.c) - target_include_directories (${H5COPY_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (${H5COPY_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (${H5COPY_TOOL_PLUGIN_LIB_TARGET} SHARED) target_link_libraries (${H5COPY_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_LIBSH_TARGET}) H5_SET_LIB_OPTIONS (${H5COPY_TOOL_PLUGIN_LIB_TARGET} ${H5COPY_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") diff --git a/tools/test/h5copy/CMakeTests.cmake b/tools/test/h5copy/CMakeTests.cmake index 9310ec0..b47000a 100644 --- a/tools/test/h5copy/CMakeTests.cmake +++ b/tools/test/h5copy/CMakeTests.cmake @@ -57,25 +57,17 @@ # Perform h5copy according to passing parameters # macro (ADD_H5_F_TEST testname resultcode infile fparam vparam sparam srcname dparam dstname) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5COPY_F-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}.out.h5 - ) - endif () + # Remove any output file left over from previous test run + add_test ( + NAME H5COPY_F-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}.out.h5 + ) add_test ( NAME H5COPY_F-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5copy${tgt_file_ext}> -f ${fparam} -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} ) - if (HDF5_ENABLE_USING_MEMCHECKER) - if (last_test) - set_tests_properties (H5COPY_F-${testname} PROPERTIES DEPENDS ${last_test}) - endif () - else () - set_tests_properties (H5COPY_F-${testname} PROPERTIES DEPENDS H5COPY_F-${testname}-clear-objects) - endif () + set_tests_properties (H5COPY_F-${testname} PROPERTIES DEPENDS H5COPY_F-${testname}-clear-objects) # resultcode=2 will cause the test to skip the diff test if (NOT "${resultcode}" STREQUAL "2") @@ -88,28 +80,29 @@ set_tests_properties (H5COPY_F-${testname}-DIFF PROPERTIES WILL_FAIL "true") endif () endif () + add_test ( + NAME H5COPY_F-${testname}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}.out.h5 + ) + if (NOT "${resultcode}" STREQUAL "2") + set_tests_properties (H5COPY_F-${testname}-clean-objects PROPERTIES DEPENDS H5COPY_F-${testname}-DIFF) + else () + set_tests_properties (H5COPY_F-${testname}-clean-objects PROPERTIES DEPENDS H5COPY_F-${testname}) + endif () endmacro () macro (ADD_H5_TEST testname resultcode infile vparam sparam srcname dparam dstname) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5COPY-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}.out.h5 - ) - endif () + # Remove any output file left over from previous test run + add_test ( + NAME H5COPY-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}.out.h5 + ) add_test ( NAME H5COPY-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5copy${tgt_file_ext}> -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} ) - if (HDF5_ENABLE_USING_MEMCHECKER) - if (last_test) - set_tests_properties (H5COPY-${testname} PROPERTIES DEPENDS ${last_test}) - endif () - else () - set_tests_properties (H5COPY-${testname} PROPERTIES DEPENDS H5COPY-${testname}-clear-objects) - endif () + set_tests_properties (H5COPY-${testname} PROPERTIES DEPENDS H5COPY-${testname}-clear-objects) # resultcode=2 will cause the test to skip the diff test if (NOT "${resultcode}" STREQUAL "2") @@ -122,6 +115,15 @@ set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES WILL_FAIL "true") endif () endif () + add_test ( + NAME H5COPY-${testname}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}.out.h5 + ) + if (NOT "${resultcode}" STREQUAL "2") + set_tests_properties (H5COPY-${testname}-clean-objects PROPERTIES DEPENDS H5COPY-${testname}-DIFF) + else () + set_tests_properties (H5COPY-${testname}-clean-objects PROPERTIES DEPENDS H5COPY-${testname}) + endif () endmacro () macro (ADD_SKIP_H5_TEST testname skipresultfile) @@ -135,25 +137,17 @@ endmacro () macro (ADD_H5_TEST2 testname resultcode infile psparam pdparam vparam sparam srcname dparam dstname) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5COPY-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}.out.h5 - ) - endif () + # Remove any output file left over from previous test run + add_test ( + NAME H5COPY-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}.out.h5 + ) add_test ( NAME H5COPY-${testname}-prefill COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5copy${tgt_file_ext}> -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam} ) - if (HDF5_ENABLE_USING_MEMCHECKER) - if (last_test) - set_tests_properties (H5COPY-${testname}-prefill PROPERTIES DEPENDS ${last_test}) - endif () - else () - set_tests_properties (H5COPY-${testname}-prefill PROPERTIES DEPENDS H5COPY-${testname}-clear-objects) - endif () + set_tests_properties (H5COPY-${testname}-prefill PROPERTIES DEPENDS H5COPY-${testname}-clear-objects) add_test ( NAME H5COPY-${testname} @@ -171,28 +165,29 @@ set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES WILL_FAIL "true") endif () endif () + add_test ( + NAME H5COPY-${testname}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}.out.h5 + ) + if (NOT "${resultcode}" STREQUAL "2") + set_tests_properties (H5COPY-${testname}-clean-objects PROPERTIES DEPENDS H5COPY-${testname}-DIFF) + else () + set_tests_properties (H5COPY-${testname}-clean-objects PROPERTIES DEPENDS H5COPY-${testname}) + endif () endmacro () macro (ADD_H5_TEST_SAME testname resultcode pfile psparam pdparam vparam sparam srcname dparam dstname) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5COPY_SAME-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}.out.h5 - ) - endif () + # Remove any output file left over from previous test run + add_test ( + NAME H5COPY_SAME-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}.out.h5 + ) add_test ( NAME H5COPY_SAME-${testname}-prefill COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5copy${tgt_file_ext}> -i ./testfiles/${pfile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam} ) - if (HDF5_ENABLE_USING_MEMCHECKER) - if (last_test) - set_tests_properties (H5COPY_SAME-${testname}-prefill PROPERTIES DEPENDS ${last_test}) - endif () - else (HDF5_ENABLE_USING_MEMCHECKER) - set_tests_properties (H5COPY_SAME-${testname}-prefill PROPERTIES DEPENDS H5COPY_SAME-${testname}-clear-objects) - endif () + set_tests_properties (H5COPY_SAME-${testname}-prefill PROPERTIES DEPENDS H5COPY_SAME-${testname}-clear-objects) add_test ( NAME H5COPY_SAME-${testname} @@ -210,6 +205,15 @@ set_tests_properties (H5COPY_SAME-${testname}-DIFF PROPERTIES WILL_FAIL "true") endif () endif () + add_test ( + NAME H5COPY_SAME-${testname}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}.out.h5 + ) + if (NOT "${resultcode}" STREQUAL "2") + set_tests_properties (H5COPY_SAME-${testname}-clean-objects PROPERTIES DEPENDS H5COPY_SAME-${testname}-DIFF) + else () + set_tests_properties (H5COPY_SAME-${testname}-clean-objects PROPERTIES DEPENDS H5COPY_SAME-${testname}) + endif () endmacro () # @@ -217,21 +221,19 @@ # files instead of checking with h5ls. # macro (ADD_H5_CMP_TEST testname resultcode infile vparam sparam srcname dparam dstname) + # Remove any output file left over from previous test run + add_test ( + NAME H5COPY-CMP-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}.out.h5 + ) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5COPY-CMP-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5copy${tgt_file_ext}> -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}) if ("${resultcode}" STREQUAL "1") set_tests_properties (H5COPY-CMP-${testname} PROPERTIES WILL_FAIL "true") endif () - if (last_test) - set_tests_properties (H5COPY-CMP-${testname} PROPERTIES DEPENDS ${last_test}) - endif () + set_tests_properties (H5COPY-CMP-${testname} PROPERTIES DEPENDS H5COPY-CMP-${testname}-clear-objects) else () - # Remove any output file left over from previous test run - add_test ( - NAME H5COPY-CMP-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}.out.h5 - ) add_test ( NAME H5COPY-CMP-${testname} COMMAND "${CMAKE_COMMAND}" @@ -248,6 +250,11 @@ ) set_tests_properties (H5COPY-CMP-${testname} PROPERTIES DEPENDS H5COPY-CMP-${testname}-clear-objects) endif () + add_test ( + NAME H5COPY-CMP-${testname}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}.out.h5 + ) + set_tests_properties (H5COPY-CMP-${testname}-clean-objects PROPERTIES DEPENDS H5COPY-CMP-${testname}) endmacro () macro (ADD_H5_UD_TEST testname resultcode infile sparam srcname dparam dstname cmpfile) @@ -310,6 +317,11 @@ -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5COPY_UD-${testname}-DIFF PROPERTIES DEPENDS H5COPY_UD-${testname}) + add_test ( + NAME H5COPY_UD-${testname}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove testfiles/${testname}.out.h5 + ) + set_tests_properties (H5COPY_UD-${testname}-clean-objects PROPERTIES DEPENDS H5COPY_UD-${testname}-DIFF) endif () endmacro () @@ -317,7 +329,7 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) # Remove any output file left over from previous test run add_test ( - NAME H5COPY_UD_ERR-${testname}-clearall-objects + NAME H5COPY_UD_ERR-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove testfiles/${testname}_ERR.out.h5 ) if ("${resultcode}" STREQUAL "2") @@ -357,7 +369,7 @@ -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () - set_tests_properties (H5COPY_UD_ERR-${testname} PROPERTIES DEPENDS H5COPY_UD_ERR-${testname}-clearall-objects) + set_tests_properties (H5COPY_UD_ERR-${testname} PROPERTIES DEPENDS H5COPY_UD_ERR-${testname}-clear-objects) add_test ( NAME H5COPY_UD_ERR-${testname}-DIFF COMMAND "${CMAKE_COMMAND}" @@ -375,6 +387,11 @@ -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5COPY_UD_ERR-${testname}-DIFF PROPERTIES DEPENDS H5COPY_UD_ERR-${testname}) + add_test ( + NAME H5COPY_UD_ERR-${testname}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove testfiles/${testname}_ERR.out.h5 + ) + set_tests_properties (H5COPY_UD_ERR-${testname}-clean-objects PROPERTIES DEPENDS H5COPY_UD_ERR-${testname}-DIFF) endif () endmacro () @@ -418,51 +435,6 @@ set (HDF_EXT_SRC_FILE h5copy_extlinks_src) set (HDF_EXT_TRG_FILE h5copy_extlinks_trg) - if (HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5COPY-clearall-objects - COMMAND ${CMAKE_COMMAND} -E remove - simple.out.h5 - chunk.out.h5 - compact.out.h5 - compound.out.h5 - compressed.out.h5 - named_vl.out.h5 - nested_vl.out.h5 - simple_top.out.h5 - dsrename.out.h5 - grp_empty.out.h5 - grp_dsets.out.h5 - grp_nested.out.h5 - simple_group.out.h5 - grp_rename.out.h5 - grp_dsets_rename.out.h5 - A_B1_simple.out.h5 - A_B2_simple2.out.h5 - C_D_simple.out.h5 - E_F_grp_dsets.out.h5 - G_H_grp_nested.out.h5 - region_ref.out.h5 - ext_link.out.h5 - ext_link_f.out.h5 - ext_dangle_noobj.out.h5 - ext_dangle_noobj_f.out.h5 - ext_dangle_nofile.out.h5 - ext_dangle_nofile_f.out.h5 - ext_link_group.out.h5 - ext_link_group_f.out.h5 - samefile1.out.h5 - samefile2.out.h5 - h5copy_misc1.out.h5 - ) - set_tests_properties (H5COPY-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (last_test) - set_tests_properties (H5COPY-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5COPY-clearall-objects") - endif () - # See which filters are usable (and skip tests for filters we # don't have). Do this by searching H5pubconf.h to see which # filters are defined. diff --git a/tools/test/h5diff/CMakeLists.txt b/tools/test/h5diff/CMakeLists.txt index e516806..dbddad6 100644 --- a/tools/test/h5diff/CMakeLists.txt +++ b/tools/test/h5diff/CMakeLists.txt @@ -6,7 +6,7 @@ project (HDF5_TOOLS_TEST_H5DIFF C) # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS AND BUILD_STATIC_LIBS) add_executable (h5diffgentest ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/h5diffgentest.c) - target_include_directories (h5diffgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5diffgentest PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5diffgentest STATIC) target_link_libraries (h5diffgentest PRIVATE ${HDF5_LIB_TARGET}) set_target_properties (h5diffgentest PROPERTIES FOLDER generator/tools) @@ -30,7 +30,7 @@ if (BUILD_SHARED_LIBS) set (H5DIFF_TOOL_PLUGIN_LIB_TARGET ${H5DIFF_TOOL_PLUGIN_LIB_CORENAME}) add_library (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_diff.c) - target_include_directories (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} SHARED) target_link_libraries (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_LIBSH_TARGET}) H5_SET_LIB_OPTIONS (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} ${H5DIFF_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index d2f0617..7e437af 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -387,13 +387,9 @@ # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DIFF-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5diff${tgt_file_ext}> ${ARGN}) - set_tests_properties (H5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (${resultcode}) set_tests_properties (H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (last_test) - set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () else () add_test ( NAME H5DIFF-${resultfile} @@ -408,10 +404,10 @@ -D "TEST_APPEND=EXIT CODE:" -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) - if (last_test) - set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () endif () + set_tests_properties (H5DIFF-${resultfile} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + ) endmacro () macro (ADD_PH5_TEST resultfile resultcode) @@ -422,9 +418,6 @@ if (${resultcode}) set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (last_test) - set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () else () add_test ( NAME MPI_TEST_H5DIFF-${resultfile} @@ -441,11 +434,10 @@ -D "TEST_SORT_COMPARE=TRUE" -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) - if (last_test) - set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "MPI_TEST_H5DIFF-${resultfile}") endif () + set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/PAR/testfiles" + ) endmacro () macro (ADD_H5_UD_TEST testname resultcode resultfile) @@ -485,9 +477,6 @@ -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () - if (last_test) - set_tests_properties (H5DIFF_UD-${testname} PROPERTIES DEPENDS ${last_test}) - endif () endif () endmacro () @@ -562,394 +551,6 @@ set (FILEV4 4_vds.h5) set (FILEV5 5_vds.h5) - if (HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5DIFF-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - h5diff_10.out - h5diff_10.out.err - h5diff_100.out - h5diff_100.out.err - h5diff_101.out - h5diff_101.out.err - h5diff_102.out - h5diff_102.out.err - h5diff_103.out - h5diff_103.out.err - h5diff_104.out - h5diff_104.out.err - h5diff_11.out - h5diff_11.out.err - h5diff_12.out - h5diff_12.out.err - h5diff_13.out - h5diff_13.out.err - h5diff_14.out - h5diff_14.out.err - h5diff_15.out - h5diff_15.out.err - h5diff_16_1.out - h5diff_16_1.out.err - h5diff_16_2.out - h5diff_16_2.out.err - h5diff_16_3.out - h5diff_16_3.out.err - h5diff_17.out - h5diff_17.out.err - h5diff_171.out - h5diff_171.out.err - h5diff_172.out - h5diff_172.out.err - h5diff_18_1.out - h5diff_18_1.out.err - h5diff_18.out - h5diff_18.out.err - h5diff_20.out - h5diff_20.out.err - h5diff_200.out - h5diff_200.out.err - h5diff_201.out - h5diff_201.out.err - h5diff_202.out - h5diff_202.out.err - h5diff_203.out - h5diff_203.out.err - h5diff_204.out - h5diff_204.out.err - h5diff_205.out - h5diff_205.out.err - h5diff_206.out - h5diff_206.out.err - h5diff_207.out - h5diff_207.out.err - h5diff_208.out - h5diff_208.out.err - h5diff_220.out - h5diff_220.out.err - h5diff_221.out - h5diff_221.out.err - h5diff_222.out - h5diff_222.out.err - h5diff_223.out - h5diff_223.out.err - h5diff_224.out - h5diff_224.out.err - h5diff_21.out - h5diff_21.out.err - h5diff_22.out - h5diff_22.out.err - h5diff_23.out - h5diff_23.out.err - h5diff_24.out - h5diff_24.out.err - h5diff_25.out - h5diff_25.out.err - h5diff_26.out - h5diff_26.out.err - h5diff_27.out - h5diff_27.out.err - h5diff_28.out - h5diff_28.out.err - h5diff_300.out - h5diff_300.out.err - h5diff_400.out - h5diff_400.out.err - h5diff_401.out - h5diff_401.out.err - h5diff_402.out - h5diff_402.out.err - h5diff_403.out - h5diff_403.out.err - h5diff_404.out - h5diff_404.out.err - h5diff_405.out - h5diff_405.out.err - h5diff_406.out - h5diff_406.out.err - h5diff_407.out - h5diff_407.out.err - h5diff_408.out - h5diff_408.out.err - h5diff_409.out - h5diff_409.out.err - h5diff_410.out - h5diff_410.out.err - h5diff_411.out - h5diff_411.out.err - h5diff_412.out - h5diff_412.out.err - h5diff_413.out - h5diff_413.out.err - h5diff_414.out - h5diff_414.out.err - h5diff_415.out - h5diff_415.out.err - h5diff_416.out - h5diff_416.out.err - h5diff_417.out - h5diff_417.out.err - h5diff_418.out - h5diff_418.out.err - h5diff_419.out - h5diff_419.out.err - h5diff_420.out - h5diff_420.out.err - h5diff_421.out - h5diff_421.out.err - h5diff_422.out - h5diff_422.out.err - h5diff_423.out - h5diff_423.out.err - h5diff_424.out - h5diff_424.out.err - h5diff_425.out - h5diff_425.out.err - h5diff_450.out - h5diff_450.out.err - h5diff_451.out - h5diff_451.out.err - h5diff_452.out - h5diff_452.out.err - h5diff_453.out - h5diff_453.out.err - h5diff_454.out - h5diff_454.out.err - h5diff_455.out - h5diff_455.out.err - h5diff_456.out - h5diff_456.out.err - h5diff_457.out - h5diff_457.out.err - h5diff_458.out - h5diff_458.out.err - h5diff_459.out - h5diff_459.out.err - h5diff_465.out - h5diff_465.out.err - h5diff_466.out - h5diff_466.out.err - h5diff_467.out - h5diff_467.out.err - h5diff_468.out - h5diff_468.out.err - h5diff_469.out - h5diff_469.out.err - h5diff_471.out - h5diff_471.out.err - h5diff_472.out - h5diff_472.out.err - h5diff_473.out - h5diff_473.out.err - h5diff_474.out - h5diff_474.out.err - h5diff_475.out - h5diff_475.out.err - h5diff_480.out - h5diff_480.out.err - h5diff_481.out - h5diff_481.out.err - h5diff_482.out - h5diff_482.out.err - h5diff_483.out - h5diff_483.out.err - h5diff_484.out - h5diff_484.out.err - h5diff_50.out - h5diff_50.out.err - h5diff_51.out - h5diff_51.out.err - h5diff_52.out - h5diff_52.out.err - h5diff_53.out - h5diff_53.out.err - h5diff_54.out - h5diff_54.out.err - h5diff_55.out - h5diff_55.out.err - h5diff_56.out - h5diff_56.out.err - h5diff_57.out - h5diff_57.out.err - h5diff_58.out - h5diff_58.out.err - h5diff_59.out - h5diff_59.out.err - h5diff_500.out - h5diff_500.out.err - h5diff_501.out - h5diff_501.out.err - h5diff_502.out - h5diff_502.out.err - h5diff_503.out - h5diff_503.out.err - h5diff_504.out - h5diff_504.out.err - h5diff_505.out - h5diff_505.out.err - h5diff_506.out - h5diff_506.out.err - h5diff_507.out - h5diff_507.out.err - h5diff_508.out - h5diff_508.out.err - h5diff_509.out - h5diff_509.out.err - h5diff_510.out - h5diff_510.out.err - h5diff_511.out - h5diff_511.out.err - h5diff_512.out - h5diff_512.out.err - h5diff_513.out - h5diff_513.out.err - h5diff_514.out - h5diff_514.out.err - h5diff_515.out - h5diff_515.out.err - h5diff_516.out - h5diff_516.out.err - h5diff_517.out - h5diff_517.out.err - h5diff_518.out - h5diff_518.out.err - h5diff_530.out - h5diff_530.out.err - h5diff_540.out - h5diff_540.out.err - h5diff_60.out - h5diff_60.out.err - h5diff_61.out - h5diff_61.out.err - h5diff_62.out - h5diff_62.out.err - h5diff_63.out - h5diff_63.out.err - h5diff_600.out - h5diff_600.out.err - h5diff_601.out - h5diff_601.out.err - h5diff_603.out - h5diff_603.out.err - h5diff_604.out - h5diff_604.out.err - h5diff_605.out - h5diff_605.out.err - h5diff_606.out - h5diff_606.out.err - h5diff_607.out - h5diff_607.out.err - h5diff_608.out - h5diff_608.out.err - h5diff_609.out - h5diff_609.out.err - h5diff_610.out - h5diff_610.out.err - h5diff_612.out - h5diff_612.out.err - h5diff_613.out - h5diff_613.out.err - h5diff_614.out - h5diff_614.out.err - h5diff_615.out - h5diff_615.out.err - h5diff_616.out - h5diff_616.out.err - h5diff_617.out - h5diff_617.out.err - h5diff_618.out - h5diff_618.out.err - h5diff_619.out - h5diff_619.out.err - h5diff_621.out - h5diff_621.out.err - h5diff_622.out - h5diff_622.out.err - h5diff_623.out - h5diff_623.out.err - h5diff_624.out - h5diff_624.out.err - h5diff_625.out - h5diff_625.out.err - h5diff_626.out - h5diff_626.out.err - h5diff_627.out - h5diff_627.out.err - h5diff_628.out - h5diff_628.out.err - h5diff_629.out - h5diff_629.out.err - h5diff_640.out - h5diff_640.out.err - h5diff_641.out - h5diff_641.out.err - h5diff_642.out - h5diff_642.out.err - h5diff_643.out - h5diff_643.out.err - h5diff_644.out - h5diff_644.out.err - h5diff_645.out - h5diff_645.out.err - h5diff_646.out - h5diff_646.out.err - h5diff_70.out - h5diff_70.out.err - h5diff_700.out - h5diff_700.out.err - h5diff_701.out - h5diff_701.out.err - h5diff_702.out - h5diff_702.out.err - h5diff_703.out - h5diff_703.out.err - h5diff_704.out - h5diff_704.out.err - h5diff_705.out - h5diff_705.out.err - h5diff_706.out - h5diff_706.out.err - h5diff_707.out - h5diff_707.out.err - h5diff_708.out - h5diff_708.out.err - h5diff_709.out - h5diff_709.out.err - h5diff_710.out - h5diff_710.out.err - h5diff_80.out - h5diff_80.out.err - h5diff_800.out - h5diff_800.out.err - h5diff_801.out - h5diff_801.out.err - h5diff_830.out - h5diff_830.out.err - h5diff_8625.out - h5diff_8625.out.err - h5diff_8639.out - h5diff_8639.out.err - h5diff_90.out - h5diff_90.out.err - h5diff_v1.out - h5diff_v1.out.err - h5diff_v2.out - h5diff_v2.out.err - h5diff_v3.out - h5diff_v3.out.err - h5diff_vlstr.out - h5diff_vlstr.out.err - h5diff_eps.out - h5diff_eps.out.err - ) - set_tests_properties (H5DIFF-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (last_test) - set_tests_properties (H5DIFF-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5DIFF-clearall-objects") - endif () - # ############################################################################ # # Common usage # ############################################################################ diff --git a/tools/test/h5dump/CMakeLists.txt b/tools/test/h5dump/CMakeLists.txt index 19f3ca8..6a5e57b 100644 --- a/tools/test/h5dump/CMakeLists.txt +++ b/tools/test/h5dump/CMakeLists.txt @@ -10,7 +10,7 @@ if (BUILD_SHARED_LIBS) set (H5DUMP_TOOL_PLUGIN_LIB_TARGET ${H5DUMP_TOOL_PLUGIN_LIB_CORENAME}) add_library (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_dump.c) - target_include_directories (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} SHARED) target_link_libraries (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_LIBSH_TARGET}) H5_SET_LIB_OPTIONS (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} ${H5DUMP_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") @@ -42,7 +42,7 @@ endif () # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS AND BUILD_STATIC_LIBS) add_executable (h5dumpgentest ${HDF5_TOOLS_TEST_H5DUMP_SOURCE_DIR}/h5dumpgentest.c) - target_include_directories (h5dumpgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_TEST_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5dumpgentest PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_TEST_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5dumpgentest STATIC) target_link_libraries (h5dumpgentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5dumpgentest PROPERTIES FOLDER generator/tools) diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index 2cba7b7..0ae7bbd 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -434,11 +434,6 @@ # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5dump${tgt_file_ext}> ${ARGN}) - set_tests_properties (H5DUMP-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - if (last_test) - set_tests_properties (H5DUMP-${testname} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5DUMP-${testname}") else () add_test ( NAME H5DUMP-${testname} @@ -452,10 +447,10 @@ -D "TEST_REFERENCE=h5dump-${testname}.txt" -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) - if (last_test) - set_tests_properties (H5DUMP-${testname} PROPERTIES DEPENDS ${last_test}) - endif () endif () + set_tests_properties (H5DUMP-${testname} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" + ) endmacro () macro (ADD_SKIP_H5_TEST skipresultfile skipresultcode testtype) @@ -476,19 +471,13 @@ # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5dump${tgt_file_ext}> ${ARGN}) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (last_test) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () - else () - add_test ( - NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove ${resultfile}.bin + set_tests_properties (H5DUMP-${resultfile} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" ) - set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") + else () add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -501,27 +490,32 @@ -D "TEST_REFERENCE=${resultfile}.ddl" -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") endif () + set_tests_properties (H5DUMP-${resultfile} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" + ) endmacro () macro (ADD_H5_TEST_N resultfile resultcode) + add_test ( + NAME H5DUMP-N-${resultfile}-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove + ${resultfile}-N.bin + ) + set_tests_properties (H5DUMP-N-${resultfile}-clear-objects PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" + ) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-N-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5dump${tgt_file_ext}> ${ARGN}) - set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (${resultcode}) set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (last_test) - set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () - else () - add_test ( - NAME H5DUMP-N-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove ${resultfile}-N.bin + set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES + DEPENDS H5DUMP-N-${resultfile}-clear-objects + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" ) - set_tests_properties (H5DUMP-N-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") + else () add_test ( NAME H5DUMP-N-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -534,27 +528,41 @@ -D "TEST_REFERENCE=${resultfile}-N.ddl" -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES DEPENDS "H5DUMP-N-${resultfile}-clear-objects") endif () + set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES + DEPENDS H5DUMP-N-${resultfile}-clear-objects + ) + add_test ( + NAME H5DUMP-N-${resultfile}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove + ${resultfile}-N.bin + ) + set_tests_properties (H5DUMP-N-${resultfile}-clean-objects PROPERTIES + DEPENDS H5DUMP-N-${resultfile} + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" + ) endmacro () macro (ADD_H5_TEST_EXPORT resultfile targetfile resultcode) + add_test ( + NAME H5DUMP-${resultfile}-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove + ${resultfile}.txt + ) + set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" + ) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5dump${tgt_file_ext}> ${ARGN} ${resultfile}.txt ${targetfile}) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (last_test) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () - else () - add_test ( - NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove ${resultfile}.txt + set_tests_properties (H5DUMP-${resultfile} PROPERTIES + DEPENDS H5DUMP-${resultfile}-clear-objects + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" ) - set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") + else () add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -567,35 +575,58 @@ -D "TEST_REFERENCE=${resultfile}.ddl" -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") + set_tests_properties (H5DUMP-${resultfile} PROPERTIES + DEPENDS H5DUMP-${resultfile}-clear-objects + ) add_test ( NAME H5DUMP-${resultfile}-output-cmp - COMMAND ${CMAKE_COMMAND} -E compare_files ${CMAKE_IGNORE_EOL} ${resultfile}.txt ${resultfile}.exp + COMMAND ${CMAKE_COMMAND} -E compare_files --ignore-eol ${resultfile}.txt ${resultfile}.exp + ) + set_tests_properties (H5DUMP-${resultfile}-output-cmp PROPERTIES + DEPENDS H5DUMP-${resultfile} + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" ) - set_tests_properties (H5DUMP-${resultfile}-output-cmp PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") set_tests_properties (H5DUMP-${resultfile}-output-cmp PROPERTIES DEPENDS H5DUMP-${resultfile}) endif () + add_test ( + NAME H5DUMP-${resultfile}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove + ${resultfile}.txt + ) + if (HDF5_ENABLE_USING_MEMCHECKER) + set_tests_properties (H5DUMP-${resultfile}-clean-objects PROPERTIES + DEPENDS H5DUMP-${resultfile} + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" + ) + else () + set_tests_properties (H5DUMP-${resultfile}-clean-objects PROPERTIES + DEPENDS H5DUMP-${resultfile}-output-cmp + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" + ) + endif () endmacro () macro (ADD_H5_TEST_EXPORT_DDL resultfile targetfile resultcode ddlfile) + add_test ( + NAME H5DUMP-${resultfile}-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove + ${ddlfile}.txt + ${resultfile}.txt + ) + set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" + ) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5dump${tgt_file_ext}> --ddl=${ddlfile}.txt ${ARGN} ${resultfile}.txt ${targetfile}) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (last_test) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () - else () - add_test ( - NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove - ${ddlfile}.txt - ${resultfile}.txt + set_tests_properties (H5DUMP-${resultfile} PROPERTIES + DEPENDS H5DUMP-${resultfile}-clear-objects + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" ) - set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") + else () add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -608,19 +639,43 @@ -D "TEST_REFERENCE=${resultfile}.ddl" -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") + set_tests_properties (H5DUMP-${resultfile} PROPERTIES + DEPENDS H5DUMP-${resultfile}-clear-objects + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" + ) add_test ( NAME H5DUMP-${resultfile}-output-cmp - COMMAND ${CMAKE_COMMAND} -E compare_files ${CMAKE_IGNORE_EOL} ${resultfile}.txt ${resultfile}.exp + COMMAND ${CMAKE_COMMAND} -E compare_files --ignore-eol ${resultfile}.txt ${resultfile}.exp + ) + set_tests_properties (H5DUMP-${resultfile}-output-cmp PROPERTIES + DEPENDS H5DUMP-${resultfile} + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" ) - set_tests_properties (H5DUMP-${resultfile}-output-cmp PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - set_tests_properties (H5DUMP-${resultfile}-output-cmp PROPERTIES DEPENDS H5DUMP-${resultfile}) add_test ( NAME H5DUMP-${resultfile}-output-cmp-ddl - COMMAND ${CMAKE_COMMAND} -E compare_files ${CMAKE_IGNORE_EOL} ${ddlfile}.txt ${ddlfile}.exp + COMMAND ${CMAKE_COMMAND} -E compare_files --ignore-eol ${ddlfile}.txt ${ddlfile}.exp + ) + set_tests_properties (H5DUMP-${resultfile}-output-cmp-ddl PROPERTIES + DEPENDS H5DUMP-${resultfile}-output-cmp + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" + ) + endif () + add_test ( + NAME H5DUMP-${resultfile}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove + ${ddlfile}.txt + ${resultfile}.txt + ) + if (HDF5_ENABLE_USING_MEMCHECKER) + set_tests_properties (H5DUMP-${resultfile}-clean-objects PROPERTIES + DEPENDS H5DUMP-${resultfile} + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" + ) + else () + set_tests_properties (H5DUMP-${resultfile}-clean-objects PROPERTIES + DEPENDS H5DUMP-${resultfile}-output-cmp-ddl + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" ) - set_tests_properties (H5DUMP-${resultfile}-output-cmp-ddl PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - set_tests_properties (H5DUMP-${resultfile}-output-cmp-ddl PROPERTIES DEPENDS H5DUMP-${resultfile}-output-cmp) endif () endmacro () @@ -628,21 +683,37 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5DUMP-output-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove ${resultfile}.txt + COMMAND ${CMAKE_COMMAND} -E remove + ${resultfile}.txt + ) + set_tests_properties (H5DUMP-output-${resultfile}-clear-objects PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" ) - set_tests_properties (H5DUMP-output-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( NAME H5DUMP-output-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5dump${tgt_file_ext}> ${ARGN} ${resultfile}.txt ${targetfile} ) - set_tests_properties (H5DUMP-output-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - set_tests_properties (H5DUMP-output-${resultfile} PROPERTIES DEPENDS H5DUMP-output-${resultfile}-clear-objects) + set_tests_properties (H5DUMP-output-${resultfile} PROPERTIES + DEPENDS H5DUMP-output-${resultfile}-clear-objects + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" + ) add_test ( NAME H5DUMP-output-cmp-${resultfile} - COMMAND ${CMAKE_COMMAND} -E compare_files ${CMAKE_IGNORE_EOL} ${resultfile}.txt ${resultfile}.exp + COMMAND ${CMAKE_COMMAND} -E compare_files --ignore-eol ${resultfile}.txt ${resultfile}.exp + ) + set_tests_properties (H5DUMP-output-cmp-${resultfile} PROPERTIES + DEPENDS H5DUMP-output-${resultfile} + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" + ) + add_test ( + NAME H5DUMP-output-${resultfile}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove + ${resultfile}.txt + ) + set_tests_properties (H5DUMP-output-${resultfile}-clean-objects PROPERTIES + DEPENDS H5DUMP-output-cmp-${resultfile} + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" ) - set_tests_properties (H5DUMP-output-cmp-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - set_tests_properties (H5DUMP-output-cmp-${resultfile} PROPERTIES DEPENDS H5DUMP-output-${resultfile}) endif () endmacro () @@ -661,6 +732,9 @@ -D "TEST_MASK_ERROR=true" -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) + set_tests_properties (H5DUMP-${resultfile} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" + ) endif () endmacro () @@ -678,6 +752,9 @@ -D "TEST_REFERENCE=${result_check}" -P "${HDF_RESOURCES_DIR}/grepTest.cmake" ) + set_tests_properties (H5DUMP-${resultfile} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" + ) endif () endmacro () @@ -696,6 +773,9 @@ -D "TEST_ERRREF=${result_errcheck}" -P "${HDF_RESOURCES_DIR}/grepTest.cmake" ) + set_tests_properties (H5DUMP-${resultfile} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" + ) endif () endmacro () @@ -716,6 +796,46 @@ -D "TEST_ENV_VALUE:STRING=${envval}" -P "${HDF_RESOURCES_DIR}/grepTest.cmake" ) + set_tests_properties (H5DUMP-${resultfile} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" + ) + endif () + endmacro () + + macro (ADD_H5_BIN_EXPORT conffile resultcode testfile) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + add_test ( + NAME H5DUMP-BIN_EXPORT-${conffile}-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove + ${conffile}.bin + ) + set_tests_properties (H5DUMP-BIN_EXPORT-${conffile}-clear-objects PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" + ) + add_test ( + NAME H5DUMP-BIN_EXPORT-${conffile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_file_ext}>" + -D "TEST_ARGS:STRING=${ARGN};-o;${conffile}.bin;${testfile}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" + -D "TEST_OUTPUT=${conffile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${conffile}.ddl" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" + ) + set_tests_properties (H5DUMP-BIN_EXPORT-${conffile} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" + ) + add_test ( + NAME H5DUMP-BIN_EXPORT-${conffile}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove + ${conffile}.bin + ) + set_tests_properties (H5DUMP-BIN_EXPORT-${conffile}-clean-objects PROPERTIES + DEPENDS H5DUMP-BIN_EXPORT-${conffile} + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" + ) endif () endmacro () @@ -728,7 +848,9 @@ ${resultfile}.bin ${resultfile}.h5 ) - set_tests_properties (H5DUMP-IMPORT-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") + set_tests_properties (H5DUMP-IMPORT-${resultfile}-clear-objects PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" + ) add_test ( NAME H5DUMP-IMPORT-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -741,20 +863,37 @@ -D "TEST_REFERENCE=${conffile}.ddl" -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP-IMPORT-${resultfile} PROPERTIES DEPENDS "H5DUMP-IMPORT-${resultfile}-clear-objects") + set_tests_properties (H5DUMP-IMPORT-${resultfile} PROPERTIES + DEPENDS H5DUMP-IMPORT-${resultfile}-clear-objects + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" + ) add_test (NAME H5DUMP-IMPORT-h5import-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5import${tgt_file_ext}> ${resultfile}.bin -c ${conffile}.out -o ${resultfile}.h5) - set_tests_properties (H5DUMP-IMPORT-h5import-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - set_tests_properties (H5DUMP-IMPORT-h5import-${resultfile} PROPERTIES DEPENDS H5DUMP-IMPORT-${resultfile}) + set_tests_properties (H5DUMP-IMPORT-h5import-${resultfile} PROPERTIES + DEPENDS H5DUMP-IMPORT-${resultfile} + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" + ) add_test (NAME H5DUMP-IMPORT-h5diff-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5diff${tgt_file_ext}> ${testfile} ${resultfile}.h5 /integer /integer) - set_tests_properties (H5DUMP-IMPORT-h5diff-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - set_tests_properties (H5DUMP-IMPORT-h5diff-${resultfile} PROPERTIES DEPENDS H5DUMP-IMPORT-h5import-${resultfile}) + set_tests_properties (H5DUMP-IMPORT-h5diff-${resultfile} PROPERTIES + DEPENDS H5DUMP-IMPORT-h5import-${resultfile} + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" + ) + add_test ( + NAME H5DUMP-IMPORT-${resultfile}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove + ${resultfile}.bin + ${resultfile}.h5 + ) + set_tests_properties (H5DUMP-IMPORT-${resultfile}-clean-objects PROPERTIES + DEPENDS H5DUMP-IMPORT-h5diff-${resultfile} + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" + ) endif () endmacro () macro (ADD_H5_UD_TEST testname resultcode resultfile) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5DUMP_UD-${testname} + NAME H5DUMP_UD-${testname}-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_file_ext}>" @@ -768,6 +907,9 @@ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) + set_tests_properties (H5DUMP_UD-${testname}-${resultfile} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" + ) endif () endmacro () @@ -1103,7 +1245,7 @@ ADD_H5_TEST (tvms 0 --enable-error-stack tvms.h5) # test for binary output - ADD_H5_TEST (tbin1LE 0 --enable-error-stack -d integer -o tbin1LE.bin -b LE tbinary.h5) + ADD_H5_BIN_EXPORT (tbin1LE 0 tbinary.h5 --enable-error-stack -d integer -b LE) # test for string binary output ADD_H5_EXPORT_TEST (tstr2bin2 tstr2.h5 0 --enable-error-stack -d /g2/dset2 -b -o) @@ -1113,14 +1255,14 @@ # ADD_H5_TEST_IMPORT (tbin1 out1D tbinary.h5 0 --enable-error-stack -d integer -b) if (NOT HDF5_ENABLE_USING_MEMCHECKER) - ADD_H5_TEST (tbin2 0 --enable-error-stack -b BE -d float -o tbin2.bin tbinary.h5) + ADD_H5_BIN_EXPORT (tbin2 0 tbinary.h5 --enable-error-stack -b BE -d float) endif () # the NATIVE test can be validated with h5import/h5diff # ADD_H5_TEST_IMPORT (tbin3 out3D tbinary.h5 0 --enable-error-stack -d integer -b NATIVE) if (NOT HDF5_ENABLE_USING_MEMCHECKER) - ADD_H5_TEST (tbin4 0 --enable-error-stack -d double -b FILE -o tbin4.bin tbinary.h5) + ADD_H5_BIN_EXPORT (tbin4 0 tbinary.h5 --enable-error-stack -d double -b FILE) endif () # test for dataset region references diff --git a/tools/test/h5dump/CMakeTestsPBITS.cmake b/tools/test/h5dump/CMakeTestsPBITS.cmake index 3c188c4..caca4b7 100644 --- a/tools/test/h5dump/CMakeTestsPBITS.cmake +++ b/tools/test/h5dump/CMakeTestsPBITS.cmake @@ -123,13 +123,9 @@ # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5dump${tgt_file_ext}> ${ARGN}) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/pbits") if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (last_pbits_test) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_pbits_test}) - endif () else () add_test ( NAME H5DUMP-${resultfile} @@ -144,6 +140,9 @@ -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () + set_tests_properties (H5DUMP-${resultfile} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/pbits" + ) endmacro () ############################################################################## diff --git a/tools/test/h5dump/CMakeTestsVDS.cmake b/tools/test/h5dump/CMakeTestsVDS.cmake index 31624e6..42f08c9 100644 --- a/tools/test/h5dump/CMakeTestsVDS.cmake +++ b/tools/test/h5dump/CMakeTestsVDS.cmake @@ -119,13 +119,9 @@ # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5dump${tgt_file_ext}> ${ARGN}) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (last_vds_test) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_VDS_test}) - endif () else () add_test ( NAME H5DUMP-${resultfile} @@ -140,6 +136,9 @@ -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () + set_tests_properties (H5DUMP-${resultfile} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds" + ) endmacro () macro (ADD_H5_VDS_PREFIX_TEST resultfile resultcode) diff --git a/tools/test/h5dump/CMakeTestsXML.cmake b/tools/test/h5dump/CMakeTestsXML.cmake index a8083fb..833a616 100644 --- a/tools/test/h5dump/CMakeTestsXML.cmake +++ b/tools/test/h5dump/CMakeTestsXML.cmake @@ -177,13 +177,9 @@ macro (ADD_XML_H5_TEST resultfile resultcode) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP_XML-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5dump${tgt_file_ext}> --xml ${ARGN}) - set_tests_properties (H5DUMP_XML-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/xml") if (${resultcode}) set_tests_properties (H5DUMP_XML-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (last_xml_test) - set_tests_properties (H5DUMP_XML-${resultfile} PROPERTIES DEPENDS ${last_xml_test}) - endif () else () add_test ( NAME H5DUMP_XML-${resultfile} @@ -198,6 +194,9 @@ -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () + set_tests_properties (H5DUMP_XML-${resultfile} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/xml" + ) endmacro () ############################################################################## diff --git a/tools/test/h5dump/h5dump_plugin.sh.in b/tools/test/h5dump/h5dump_plugin.sh.in index a552f60..d9b77ee 100644 --- a/tools/test/h5dump/h5dump_plugin.sh.in +++ b/tools/test/h5dump/h5dump_plugin.sh.in @@ -3,7 +3,7 @@ # Copyright by The HDF Group. # All rights reserved. # -# This file is part of HDF5. The full HDF5 copyright notice, including +# This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in # the COPYING file, which can be found at the root of the source code # distribution tree, or in https://www.hdfgroup.org/licenses. @@ -88,7 +88,7 @@ if [ $? != 0 ]; then fi # setup plugin path -ENVCMD="env HDF5_PLUGIN_PATH=../${PLUGIN_LIBDIR}" +ENVCMD="env HDF5_PLUGIN_PATH=../${PLUGIN_LIBDIR}:${HDF5_PLUGIN_PATH}" # # copy test files and expected output files from source dirs to test dir diff --git a/tools/test/h5format_convert/CMakeLists.txt b/tools/test/h5format_convert/CMakeLists.txt index a77335a..4d61bf7 100644 --- a/tools/test/h5format_convert/CMakeLists.txt +++ b/tools/test/h5format_convert/CMakeLists.txt @@ -5,7 +5,7 @@ project (HDF5_TOOLS_TEST_H5FC C) # Add the h5format_convert test executables # -------------------------------------------------------------------- add_executable (h5fc_chk_idx ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/h5fc_chk_idx.c) -target_include_directories (h5fc_chk_idx PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_include_directories (h5fc_chk_idx PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (BUILD_STATIC_LIBS) TARGET_C_PROPERTIES (h5fc_chk_idx STATIC) target_link_libraries (h5fc_chk_idx PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) @@ -24,7 +24,7 @@ endif () if (HDF5_BUILD_GENERATORS AND BUILD_STATIC_LIBS) add_executable (h5fc_gentest ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/h5fc_gentest.c) - target_include_directories (h5fc_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5fc_gentest PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5fc_gentest STATIC) target_link_libraries (h5fc_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5fc_gentest PROPERTIES FOLDER generator/tools) diff --git a/tools/test/h5format_convert/CMakeTests.cmake b/tools/test/h5format_convert/CMakeTests.cmake index 5b8c51f..73cb2ee 100644 --- a/tools/test/h5format_convert/CMakeTests.cmake +++ b/tools/test/h5format_convert/CMakeTests.cmake @@ -101,49 +101,58 @@ # If using memchecker add tests without using scripts if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5FC-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/outtmp.h5 + NAME H5FC-${testname}-${testfile}-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}-tmp.h5 ) - if (last_test) - set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () if (${testfile}) add_test ( NAME H5FC-${testname}-${testfile}-tmpfile - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/outtmp.h5 + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/${testname}-tmp.h5 + ) + set_tests_properties (H5FC-${testname}-${testfile}-tmpfile PROPERTIES + DEPENDS H5FC-${testname}-${testfile}-clear-objects ) - set_tests_properties (H5FC-${testname}-${testfile}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") add_test ( NAME H5FC-${testname}-${testfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert${tgt_file_ext}>" - -D "TEST_ARGS=${ARGN};outtmp.h5" + -D "TEST_ARGS=${ARGN};${testname}-tmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" - -D "TEST_OUTPUT=${testname}.out" + -D "TEST_OUTPUT=${testname}-${testfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}" -D "TEST_ERRREF=${resultfile}.err" -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) - set_tests_properties (H5FC-${testname}-${testfile} PROPERTIES DEPENDS "H5FC-${testname}-${testfile}-tmpfile") + set_tests_properties (H5FC-${testname}-${testfile} PROPERTIES + DEPENDS H5FC-${testname}-${testfile}-tmpfile + ) set (last_test "H5FC-${testname}-${testfile}") else () add_test ( - NAME H5FC-${testname}-NA + NAME H5FC-${testname}-${testfile}-NA COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert${tgt_file_ext}>" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" - -D "TEST_OUTPUT=${testname}.out" + -D "TEST_OUTPUT=${testname}-${testfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}" -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) - set_tests_properties (H5FC-${testname}-NA PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") - set (last_test "H5FC-${testname}-NA") + set_tests_properties (H5FC-${testname}-${testfile}-NA PROPERTIES + DEPENDS H5FC-${testname}-${testfile}-tmpfile + ) endif () + add_test ( + NAME H5FC-${testname}-${testfile}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}-tmp.h5 + ) + set_tests_properties (H5FC-${testname}-${testfile}-clean-objects PROPERTIES + DEPENDS H5FC-${testname}-${testfile}-NA + ) endif () endmacro () @@ -151,31 +160,38 @@ # If using memchecker add tests without using scripts if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5FC-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/outtmp.h5 + NAME H5FC-${testname}-${testfile}-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}-tmp.h5 ) - if (last_test) - set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () add_test ( NAME H5FC-${testname}-${testfile}-tmpfile - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/outtmp.h5 + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/${testname}-tmp.h5 + ) + set_tests_properties (H5FC-${testname}-${testfile}-tmpfile PROPERTIES + DEPENDS H5FC-${testname}-${testfile}-clear-object ) - set_tests_properties (H5FC-${testname}-${testfile}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") add_test ( NAME H5FC-${testname}-${testfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert${tgt_file_ext}>" - -D "TEST_ARGS=${ARGN};outtmp.h5" + -D "TEST_ARGS=${ARGN};${testname}-tmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" - -D "TEST_OUTPUT=${testname}.out" + -D "TEST_OUTPUT=${testname}-${testfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}" -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) - set_tests_properties (H5FC-${testname}-${testfile} PROPERTIES DEPENDS "H5FC-${testname}-${testfile}-tmpfile") - set (last_test "H5FC-${testname}-${testfile}") + set_tests_properties (H5FC-${testname}-${testfile} PROPERTIES + DEPENDS H5FC-${testname}-${testfile}-tmpfile + ) + add_test ( + NAME H5FC-${testname}-${testfile}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}-tmp.h5 + ) + set_tests_properties (H5FC-${testname}-${testfile}-clean-objects PROPERTIES + DEPENDS H5FC-${testname}-${testfile} + ) endif () endmacro () @@ -183,32 +199,39 @@ # If using memchecker add tests without using scripts if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5FC-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/outtmp.h5 + NAME H5FC-${testname}-${testfile}-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}-tmp.h5 ) - if (last_test) - set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () add_test ( NAME H5FC-${testname}-${testfile}-tmpfile - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/outtmp.h5 + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/${testname}-tmp.h5 + ) + set_tests_properties (H5FC-${testname}-${testfile}-tmpfile PROPERTIES + DEPENDS H5FC-${testname}-${testfile}-clear-objects ) - set_tests_properties (H5FC-${testname}-${testfile}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") add_test ( NAME H5FC-${testname}-${testfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert${tgt_file_ext}>" - -D "TEST_ARGS=${ARGN};outtmp.h5" + -D "TEST_ARGS=${ARGN};${testname}-tmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" - -D "TEST_OUTPUT=${testname}.out" + -D "TEST_OUTPUT=${testname}-${testfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}" -D "TEST_ERRREF=${result_errcheck}" -P "${HDF_RESOURCES_DIR}/grepTest.cmake" ) - set_tests_properties (H5FC-${testname}-${testfile} PROPERTIES DEPENDS "H5FC-${testname}-${testfile}-tmpfile") - set (last_test "H5FC-${testname}-${testfile}") + set_tests_properties (H5FC-${testname}-${testfile} PROPERTIES + DEPENDS H5FC-${testname}-${testfile}-tmpfile + ) + add_test ( + NAME H5FC-${testname}-${testfile}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}-tmp.h5 + ) + set_tests_properties (H5FC-${testname}-${testfile}-clean-objects PROPERTIES + DEPENDS H5FC-${testname}-${testfile} + ) endif () endmacro () @@ -217,30 +240,44 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5FC-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/tmp.h5 + COMMAND ${CMAKE_COMMAND} -E remove + ./testfiles/${testname}-tmp.h5 ) - if (last_test) - set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () + set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES + FIXTURES_SETUP clear_H5FC-${testname} + ) + add_test ( + NAME H5FC_CHECK_IDX-${testname}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove + ./testfiles/${testname}-tmp.h5 + ) + set_tests_properties (H5FC_CHECK_IDX-${testname}-clean-objects PROPERTIES + FIXTURES_CLEANUP clear_H5FC-${testname} + ) + add_test ( NAME H5FC-${testname}-tmpfile - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} testfiles/tmp.h5 + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/${testname}-tmp.h5 + ) + set_tests_properties (H5FC-${testname}-tmpfile PROPERTIES + FIXTURES_REQUIRED clear_H5FC-${testname} ) - set_tests_properties (H5FC-${testname}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") add_test ( NAME H5FC-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert${tgt_file_ext}>" - -D "TEST_ARGS=${ARGN};./testfiles/tmp.h5" + -D "TEST_ARGS=${ARGN};./testfiles/${testname}-tmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=testfiles/${testname}.out" -D "TEST_SKIP_COMPARE=TRUE" -D "TEST_EXPECT=${resultcode}" -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) - set_tests_properties (H5FC-${testname} PROPERTIES DEPENDS "H5FC-${testname}-tmpfile") - set (last_test "H5FC-${testname}") + set_tests_properties (H5FC-${testname} PROPERTIES + DEPENDS "H5FC-${testname}-tmpfile" + FIXTURES_REQUIRED clear_H5FC-${testname} + ) endif () endmacro () @@ -248,47 +285,61 @@ # If using memchecker add tests without using scripts if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5FC_CHECK_IDX-${testname} - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5fc_chk_idx> ./testfiles/tmp.h5 ${ARGN} + NAME H5FC_CHECK_IDX-${dependtest}-${testname} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5fc_chk_idx> ./testfiles/${dependtest}-tmp.h5 ${ARGN} ) - set_tests_properties (H5FC_CHECK_IDX-${testname} PROPERTIES DEPENDS "H5FC-${dependtest}") - endif () + set_tests_properties (H5FC_CHECK_IDX-${dependtest}-${testname} PROPERTIES + DEPENDS "H5FC-${dependtest}" + FIXTURES_REQUIRED clear_H5FC-${dependtest} + ) + endif () endmacro () macro (ADD_H5_TEST_CHECK_IDX testname resultcode testfile) # If using memchecker add tests without using scripts if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5FC-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/chktmp.h5 + NAME H5FC_TEST_CHECK_IDX-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove + ./testfiles/${testname}-tmp.h5 ) - if (last_test) - set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () add_test ( - NAME H5FC-${testname}-tmpfile - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} testfiles/chktmp.h5 + NAME H5FC_TEST_CHECK_IDX-${testname}-tmpfile + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/${testname}-tmp.h5 + ) + set_tests_properties (H5FC_TEST_CHECK_IDX-${testname}-tmpfile PROPERTIES + DEPENDS "H5FC_TEST_CHECK_IDX-${testname}-clear-objects" ) - set_tests_properties (H5FC-${testname}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") add_test ( - NAME H5FC-${testname} + NAME H5FC_TEST_CHECK_IDX-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert${tgt_file_ext}>" - -D "TEST_ARGS=-d;${ARGN};./testfiles/chktmp.h5" + -D "TEST_ARGS=-d;${ARGN};./testfiles/${testname}-tmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=testfiles/${testname}.out" -D "TEST_SKIP_COMPARE=TRUE" -D "TEST_EXPECT=${resultcode}" -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) - set_tests_properties (H5FC-${testname} PROPERTIES DEPENDS "H5FC-${testname}-tmpfile") + set_tests_properties (H5FC_TEST_CHECK_IDX-${testname} PROPERTIES + DEPENDS "H5FC_TEST_CHECK_IDX-${testname}-tmpfile" + ) + add_test ( + NAME H5FC_TEST_CHECK_IDX-${testname}-check + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5fc_chk_idx> ./testfiles/${testname}-tmp.h5 ${ARGN} + ) + set_tests_properties (H5FC_TEST_CHECK_IDX-${testname}-check PROPERTIES + DEPENDS "H5FC_TEST_CHECK_IDX-${testname}" + ) add_test ( - NAME H5FC_CHECK_IDX-${testname} - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5fc_chk_idx> ./testfiles/chktmp.h5 ${ARGN} + NAME H5FC_TEST_CHECK_IDX-${testname}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove + ./testfiles/${testname}-tmp.h5 + ) + set_tests_properties (H5FC_TEST_CHECK_IDX-${testname}-clean-objects PROPERTIES + DEPENDS H5FC_TEST_CHECK_IDX-${testname}-check ) - set_tests_properties (H5FC_CHECK_IDX-${testname} PROPERTIES DEPENDS "H5FC-${testname}") - set (last_test "H5FC_CHECK_IDX-${testname}") endif () endmacro () @@ -296,44 +347,55 @@ # If using memchecker skip tests if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5FC-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/dmptmp.h5 + NAME H5FC_H5DUMP_CHECK-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove + ./testfiles/${testname}-tmp.h5 ) - if (last_test) - set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () add_test ( - NAME H5FC-${testname}-tmpfile - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testname}.h5 testfiles/dmptmp.h5 + NAME H5FC_H5DUMP_CHECK-${testname}-tmpfile + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testname}.h5 ./testfiles/${testname}-tmp.h5 + ) + set_tests_properties (H5FC_H5DUMP_CHECK-${testname}-tmpfile PROPERTIES + DEPENDS "H5FC_H5DUMP_CHECK-${testname}-clear-objects" ) - set_tests_properties (H5FC-${testname}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") add_test ( - NAME H5FC-${testname} + NAME H5FC_H5DUMP_CHECK-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert${tgt_file_ext}>" - -D "TEST_ARGS=${ARGN};./testfiles/dmptmp.h5" + -D "TEST_ARGS=${ARGN};./testfiles/${testname}-tmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=testfiles/${testname}.out" -D "TEST_SKIP_COMPARE=TRUE" -D "TEST_EXPECT=0" -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) - set_tests_properties (H5FC-${testname} PROPERTIES DEPENDS "H5FC-${testname}-tmpfile") + set_tests_properties (H5FC_H5DUMP_CHECK-${testname} PROPERTIES + DEPENDS "H5FC_H5DUMP_CHECK-${testname}-tmpfile" + ) add_test ( - NAME H5FC_CHECK_DUMP-${testname} + NAME H5FC_H5DUMP_CHECK-${testname}-dump COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_file_ext}>" - -D "TEST_ARGS:STRING=-BH;./testfiles/dmptmp.h5" + -D "TEST_ARGS:STRING=-BH;./testfiles/${testname}-tmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=testfiles/${testname}_chk.out" -D "TEST_EXPECT=0" -D "TEST_REFERENCE=testfiles/${testname}.ddl" -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) - set_tests_properties (H5FC_CHECK_DUMP-${testname} PROPERTIES DEPENDS "H5FC-${testname}") - set (last_test "H5FC_CHECK_DUMP-${testname}") + set_tests_properties (H5FC_H5DUMP_CHECK-${testname}-dump PROPERTIES + DEPENDS "H5FC_H5DUMP_CHECK-${testname}" + ) + add_test ( + NAME H5FC_H5DUMP_CHECK-${testname}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove + ./testfiles/${testname}-tmp.h5 + ) + set_tests_properties (H5FC_H5DUMP_CHECK-${testname}-clean-objects PROPERTIES + DEPENDS H5FC_H5DUMP_CHECK-${testname}-dump + ) endif () endmacro () @@ -343,22 +405,6 @@ ############################################################################## ############################################################################## - if (HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5FC-clearall-objects - COMMAND ${CMAKE_COMMAND} -E remove - outtmp.h5 - tmp.h5 - chktmp.h5 - dmptmp.h5 - ) - if (last_test) - set_tests_properties (H5FC-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5FC-clearall-objects") - endif () - # h5format_convert --help # h5format_convert (no options) # h5format_convert nonexist.h5 (no options, file does not exist) diff --git a/tools/test/h5format_convert/testfiles/h5fc_ext1_f.ddl b/tools/test/h5format_convert/testfiles/h5fc_ext1_f.ddl index db00a99..f788913 100644 --- a/tools/test/h5format_convert/testfiles/h5fc_ext1_f.ddl +++ b/tools/test/h5format_convert/testfiles/h5fc_ext1_f.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/dmptmp.h5" { +HDF5 "./testfiles/h5fc_ext1_f-tmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/test/h5format_convert/testfiles/h5fc_ext1_i.ddl b/tools/test/h5format_convert/testfiles/h5fc_ext1_i.ddl index 4be6d90..6564031 100644 --- a/tools/test/h5format_convert/testfiles/h5fc_ext1_i.ddl +++ b/tools/test/h5format_convert/testfiles/h5fc_ext1_i.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/dmptmp.h5" { +HDF5 "./testfiles/h5fc_ext1_i-tmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/test/h5format_convert/testfiles/h5fc_ext1_s.ddl b/tools/test/h5format_convert/testfiles/h5fc_ext1_s.ddl index db00a99..746de2b 100644 --- a/tools/test/h5format_convert/testfiles/h5fc_ext1_s.ddl +++ b/tools/test/h5format_convert/testfiles/h5fc_ext1_s.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/dmptmp.h5" { +HDF5 "./testfiles/h5fc_ext1_s-tmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/test/h5format_convert/testfiles/h5fc_ext2_if.ddl b/tools/test/h5format_convert/testfiles/h5fc_ext2_if.ddl index 4be6d90..57781ec 100644 --- a/tools/test/h5format_convert/testfiles/h5fc_ext2_if.ddl +++ b/tools/test/h5format_convert/testfiles/h5fc_ext2_if.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/dmptmp.h5" { +HDF5 "./testfiles/h5fc_ext2_if-tmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/test/h5format_convert/testfiles/h5fc_ext2_is.ddl b/tools/test/h5format_convert/testfiles/h5fc_ext2_is.ddl index 4be6d90..8fd061d 100644 --- a/tools/test/h5format_convert/testfiles/h5fc_ext2_is.ddl +++ b/tools/test/h5format_convert/testfiles/h5fc_ext2_is.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/dmptmp.h5" { +HDF5 "./testfiles/h5fc_ext2_is-tmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/test/h5format_convert/testfiles/h5fc_ext2_sf.ddl b/tools/test/h5format_convert/testfiles/h5fc_ext2_sf.ddl index db00a99..435ed46 100644 --- a/tools/test/h5format_convert/testfiles/h5fc_ext2_sf.ddl +++ b/tools/test/h5format_convert/testfiles/h5fc_ext2_sf.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/dmptmp.h5" { +HDF5 "./testfiles/h5fc_ext2_sf-tmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/test/h5format_convert/testfiles/h5fc_ext3_isf.ddl b/tools/test/h5format_convert/testfiles/h5fc_ext3_isf.ddl index 4be6d90..57a78d3 100644 --- a/tools/test/h5format_convert/testfiles/h5fc_ext3_isf.ddl +++ b/tools/test/h5format_convert/testfiles/h5fc_ext3_isf.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/dmptmp.h5" { +HDF5 "./testfiles/h5fc_ext3_isf-tmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/test/h5format_convert/testfiles/h5fc_v_all.ddl b/tools/test/h5format_convert/testfiles/h5fc_v_all.ddl index a1af831..c5e55c7 100644 --- a/tools/test/h5format_convert/testfiles/h5fc_v_all.ddl +++ b/tools/test/h5format_convert/testfiles/h5fc_v_all.ddl @@ -1,5 +1,5 @@ Process command line options -Open the file outtmp.h5 +Open the file h5fc_v_all-tmp.h5 Processing all datasets in the file... Going to process dataset:/DSET_CONTIGUOUS... Open the dataset diff --git a/tools/test/h5format_convert/testfiles/h5fc_v_bt1.ddl b/tools/test/h5format_convert/testfiles/h5fc_v_bt1.ddl index 31de12a..23f775d 100644 --- a/tools/test/h5format_convert/testfiles/h5fc_v_bt1.ddl +++ b/tools/test/h5format_convert/testfiles/h5fc_v_bt1.ddl @@ -1,5 +1,5 @@ Process command line options -Open the file outtmp.h5 +Open the file h5fc_v_bt1-tmp.h5 Going to process dataset: /GROUP/DSET_BT2... Open the dataset Retrieve the dataset's layout diff --git a/tools/test/h5format_convert/testfiles/h5fc_v_err.ddl b/tools/test/h5format_convert/testfiles/h5fc_v_err.ddl index 0b7d0ac..066f2d5 100644 --- a/tools/test/h5format_convert/testfiles/h5fc_v_err.ddl +++ b/tools/test/h5format_convert/testfiles/h5fc_v_err.ddl @@ -1,5 +1,5 @@ Process command line options -Open the file outtmp.h5 +Open the file h5fc_v_err-tmp.h5 Processing all datasets in the file... Going to process dataset:/DSET_ERR... Open the dataset diff --git a/tools/test/h5format_convert/testfiles/h5fc_v_n_1d.ddl b/tools/test/h5format_convert/testfiles/h5fc_v_n_1d.ddl index fcdadd8..1c6d7fb 100644 --- a/tools/test/h5format_convert/testfiles/h5fc_v_n_1d.ddl +++ b/tools/test/h5format_convert/testfiles/h5fc_v_n_1d.ddl @@ -1,6 +1,6 @@ Process command line options It is noop... -Open the file outtmp.h5 +Open the file h5fc_v_n_1d-tmp.h5 Going to process dataset: /DSET_EA... Open the dataset Retrieve the dataset's layout diff --git a/tools/test/h5format_convert/testfiles/h5fc_v_n_all.ddl b/tools/test/h5format_convert/testfiles/h5fc_v_n_all.ddl index 074ce6f..ad00d92 100644 --- a/tools/test/h5format_convert/testfiles/h5fc_v_n_all.ddl +++ b/tools/test/h5format_convert/testfiles/h5fc_v_n_all.ddl @@ -1,6 +1,6 @@ Process command line options It is noop... -Open the file outtmp.h5 +Open the file h5fc_v_n_all-tmp.h5 Processing all datasets in the file... Going to process dataset:/DSET_CONTIGUOUS... Open the dataset diff --git a/tools/test/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl b/tools/test/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl index c75699a..e79b11a 100644 --- a/tools/test/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl +++ b/tools/test/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl @@ -1,6 +1,6 @@ Process command line options It is noop... -Open the file outtmp.h5 +Open the file h5fc_v_ndata_bt1-tmp.h5 Going to process dataset: /DSET_NDATA_BT2... Open the dataset Retrieve the dataset's layout diff --git a/tools/test/h5format_convert/testfiles/h5fc_v_non_chunked.ddl b/tools/test/h5format_convert/testfiles/h5fc_v_non_chunked.ddl index 5945389..50575c0 100644 --- a/tools/test/h5format_convert/testfiles/h5fc_v_non_chunked.ddl +++ b/tools/test/h5format_convert/testfiles/h5fc_v_non_chunked.ddl @@ -1,5 +1,5 @@ Process command line options -Open the file outtmp.h5 +Open the file h5fc_v_non_chunked-tmp.h5 Going to process dataset: /DSET_CONTIGUOUS... Open the dataset Retrieve the dataset's layout diff --git a/tools/test/h5format_convert/testfiles/old_h5fc_ext1_f.ddl b/tools/test/h5format_convert/testfiles/old_h5fc_ext1_f.ddl index db00a99..45fa3fb 100644 --- a/tools/test/h5format_convert/testfiles/old_h5fc_ext1_f.ddl +++ b/tools/test/h5format_convert/testfiles/old_h5fc_ext1_f.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/dmptmp.h5" { +HDF5 "./testfiles/old_h5fc_ext1_f-tmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/test/h5format_convert/testfiles/old_h5fc_ext1_i.ddl b/tools/test/h5format_convert/testfiles/old_h5fc_ext1_i.ddl index d9cc0b7..67a7116 100644 --- a/tools/test/h5format_convert/testfiles/old_h5fc_ext1_i.ddl +++ b/tools/test/h5format_convert/testfiles/old_h5fc_ext1_i.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/dmptmp.h5" { +HDF5 "./testfiles/old_h5fc_ext1_i-tmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 1 FREELIST_VERSION 0 diff --git a/tools/test/h5format_convert/testfiles/old_h5fc_ext1_s.ddl b/tools/test/h5format_convert/testfiles/old_h5fc_ext1_s.ddl index db00a99..7f67d9f 100644 --- a/tools/test/h5format_convert/testfiles/old_h5fc_ext1_s.ddl +++ b/tools/test/h5format_convert/testfiles/old_h5fc_ext1_s.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/dmptmp.h5" { +HDF5 "./testfiles/old_h5fc_ext1_s-tmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/test/h5format_convert/testfiles/old_h5fc_ext2_if.ddl b/tools/test/h5format_convert/testfiles/old_h5fc_ext2_if.ddl index 4be6d90..350d3ba 100644 --- a/tools/test/h5format_convert/testfiles/old_h5fc_ext2_if.ddl +++ b/tools/test/h5format_convert/testfiles/old_h5fc_ext2_if.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/dmptmp.h5" { +HDF5 "./testfiles/old_h5fc_ext2_if-tmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/test/h5format_convert/testfiles/old_h5fc_ext2_is.ddl b/tools/test/h5format_convert/testfiles/old_h5fc_ext2_is.ddl index 4be6d90..6b2b2c3 100644 --- a/tools/test/h5format_convert/testfiles/old_h5fc_ext2_is.ddl +++ b/tools/test/h5format_convert/testfiles/old_h5fc_ext2_is.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/dmptmp.h5" { +HDF5 "./testfiles/old_h5fc_ext2_is-tmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/test/h5format_convert/testfiles/old_h5fc_ext2_sf.ddl b/tools/test/h5format_convert/testfiles/old_h5fc_ext2_sf.ddl index db00a99..4a038e3 100644 --- a/tools/test/h5format_convert/testfiles/old_h5fc_ext2_sf.ddl +++ b/tools/test/h5format_convert/testfiles/old_h5fc_ext2_sf.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/dmptmp.h5" { +HDF5 "./testfiles/old_h5fc_ext2_sf-tmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/test/h5format_convert/testfiles/old_h5fc_ext3_isf.ddl b/tools/test/h5format_convert/testfiles/old_h5fc_ext3_isf.ddl index 4be6d90..602627f 100644 --- a/tools/test/h5format_convert/testfiles/old_h5fc_ext3_isf.ddl +++ b/tools/test/h5format_convert/testfiles/old_h5fc_ext3_isf.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/dmptmp.h5" { +HDF5 "./testfiles/old_h5fc_ext3_isf-tmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/test/h5format_convert/testh5fc.sh.in b/tools/test/h5format_convert/testh5fc.sh.in index d5fef40..cd2b801 100644 --- a/tools/test/h5format_convert/testh5fc.sh.in +++ b/tools/test/h5format_convert/testh5fc.sh.in @@ -66,10 +66,10 @@ TESTDIR=./testfiles test -d $TESTDIR || mkdir $TESTDIR # Copy the testfile to a temporary file for testing as h5format_convert is changing the file in place -TMPOUTFILE=outtmp.h5 +TMPOUTFILE=tmp.h5 TMPFILE=tmp.h5 -TMPCHKFILE=chktmp.h5 -TMPDMPFILE=dmptmp.h5 +TMPCHKFILE=tmp.h5 +TMPDMPFILE=tmp.h5 ###################################################################### # test files @@ -182,10 +182,10 @@ CLEAN_TESTFILES_AND_TESTDIR() if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then $RM $TESTDIR else - $RM $TESTDIR/$TMPFILE + $RM $TESTDIR/$TMPFILE $RM $TESTDIR/$TMPOUTFILE $RM $TESTDIR/$TMPCHKFILE - $RM $TESTDIR/$TMPDMPFILE + $RM $TESTDIR/*-$TMPDMPFILE fi } @@ -224,13 +224,14 @@ TOOLTEST_OUT() { actual_err="$TESTDIR/`basename $1 .ddl`.out.err" actual_sav=${actual}-sav actual_err_sav=${actual_err}-sav + testfile="`basename $1 .ddl`-tmp.h5" # Prepare the test file - $RM $TESTDIR/$TMPOUTFILE + $RM $TESTDIR/$testfile TFILE=$2 if [ ! -z "$2" ] && [ -e $TESTDIR/$2 ] ; then - $CP $TESTDIR/$2 $TESTDIR/$TMPOUTFILE - TFILE=$TMPOUTFILE + $CP $TESTDIR/$2 $TESTDIR/$testfile + TFILE=$testfile fi # Run test. @@ -261,13 +262,14 @@ TOOLTEST_MASK_OUT() { actual_err="$TESTDIR/`basename $1 .ddl`.out.err" actual_sav=${actual}-sav actual_err_sav=${actual_err}-sav + testfile="`basename $1 .ddl`-tmp.h5" # Prepare the test file - $RM $TESTDIR/$TMPOUTFILE + $RM $TESTDIR/$testfile TFILE=$2 if [ ! -z "$2" ] && [ -e $TESTDIR/$2 ] ; then - $CP $TESTDIR/$2 $TESTDIR/$TMPOUTFILE - TFILE=$TMPOUTFILE + $CP $TESTDIR/$2 $TESTDIR/$testfile + TFILE=$testfile fi # Run test. @@ -321,13 +323,14 @@ TOOLTEST_ERR() { actual_err="$TESTDIR/`basename $1 .ddl`.out.err" actual_sav=${actual}-sav actual_err_sav=${actual_err}-sav + testfile="`basename $1 .ddl`-tmp.h5" # Prepare the test file - $RM $TESTDIR/$TMPOUTFILE + $RM $TESTDIR/$testfile TFILE=$2 if [ ! -z "$2" ] && [ -e $TESTDIR/$2 ] ; then - $CP $TESTDIR/$2 $TESTDIR/$TMPOUTFILE - TFILE=$TMPOUTFILE + $CP $TESTDIR/$2 $TESTDIR/$testfile + TFILE=$testfile fi # Run test. @@ -360,9 +363,10 @@ TOOLTEST_ERR() { # -n TOOLTEST() { TESTING $FORMCONV $3 $4 $5 $1 - $RM $TESTDIR/$2 - $CP $TESTDIR/$1 $TESTDIR/$2 - $RUNSERIAL $FORMCONV_BIN $3 $4 $5 $TESTDIR/$2 + testfile="`basename $1 .h5`-tmp.h5" + $RM $TESTDIR/$testfile + $CP $TESTDIR/$1 $TESTDIR/$testfile + $RUNSERIAL $FORMCONV_BIN $3 $4 $5 $TESTDIR/$testfile exitcode=$? if [ $exitcode -ne 0 ]; then echo "*FAILED*" @@ -382,7 +386,7 @@ CHECKING() { # $1 dataset name IDX_CHECK() { CHECKING $1 - $RUNSERIAL $CHK_IDX_BIN $TESTDIR/$TMPCHKFILE $1 + $RUNSERIAL $CHK_IDX_BIN $TESTDIR/$2 $1 ret=$? if [ $ret -eq 0 ]; then echo " PASSED" @@ -414,7 +418,8 @@ H5DUMP_CHECK() { expect="$TESTDIR/$2" actual="$TESTDIR/`basename $2 .ddl`.out" actual_err="$TESTDIR/`basename $2 .ddl`.err" - $RUNSERIAL $H5DUMP_BIN -BH $TESTDIR/$TMPDMPFILE > $actual 2>$actual_err + testfile="`basename $2 .ddl`-tmp.h5" + $RUNSERIAL $H5DUMP_BIN -BH $TESTDIR/$testfile > $actual 2>$actual_err cat $actual_err >> $actual # Compare output @@ -497,45 +502,45 @@ TOOLTEST_MASK_OUT h5fc_v_err.ddl h5fc_err_level.h5 -v # h5format_convert -d /GROUP/DSET_FA h5fc_ext_none.h5 # h5format_convert -d /DSET_NONE h5fc_ext_none.h5 # h5format_convert -d /GROUP/DSET_NDATA_NONE h5fc_ext_none.h5 -TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /DSET_EA -IDX_CHECK /DSET_EA +TOOLTEST h5fc_ext_none.h5 h5fc_ext_none-tmp.h5 -d /DSET_EA +IDX_CHECK /DSET_EA h5fc_ext_none-tmp.h5 # -TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /GROUP/DSET_NDATA_EA -IDX_CHECK /GROUP/DSET_NDATA_EA +TOOLTEST h5fc_ext_none.h5 h5fc_ext_none-tmp.h5 -d /GROUP/DSET_NDATA_EA +IDX_CHECK /GROUP/DSET_NDATA_EA h5fc_ext_none-tmp.h5 # -TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /GROUP/DSET_BT2 -IDX_CHECK /GROUP/DSET_BT2 +TOOLTEST h5fc_ext_none.h5 h5fc_ext_none-tmp.h5 -d /GROUP/DSET_BT2 +IDX_CHECK /GROUP/DSET_BT2 h5fc_ext_none-tmp.h5 # -TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /DSET_NDATA_BT2 -IDX_CHECK /DSET_NDATA_BT2 +TOOLTEST h5fc_ext_none.h5 h5fc_ext_none-tmp.h5 -d /DSET_NDATA_BT2 +IDX_CHECK /DSET_NDATA_BT2 h5fc_ext_none-tmp.h5 # -TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /DSET_FA -IDX_CHECK /DSET_FA +TOOLTEST h5fc_ext_none.h5 h5fc_ext_none-tmp.h5 -d /DSET_FA +IDX_CHECK /DSET_FA h5fc_ext_none-tmp.h5 # -TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /GROUP/DSET_NDATA_FA -IDX_CHECK /GROUP/DSET_NDATA_FA +TOOLTEST h5fc_ext_none.h5 h5fc_ext_none-tmp.h5 -d /GROUP/DSET_NDATA_FA +IDX_CHECK /GROUP/DSET_NDATA_FA h5fc_ext_none-tmp.h5 # -TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /DSET_NONE -IDX_CHECK /DSET_NONE +TOOLTEST h5fc_ext_none.h5 h5fc_ext_none-tmp.h5 -d /DSET_NONE +IDX_CHECK /DSET_NONE h5fc_ext_none-tmp.h5 # -TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /GROUP/DSET_NDATA_NONE -IDX_CHECK /GROUP/DSET_NDATA_NONE +TOOLTEST h5fc_ext_none.h5 h5fc_ext_none-tmp.h5 -d /GROUP/DSET_NDATA_NONE +IDX_CHECK /GROUP/DSET_NDATA_NONE h5fc_ext_none-tmp.h5 # # # # No output from tests: just check exit code # h5format_convert -d /DSET_NDATA_BT2 old_h5fc_ext_none.h5 (v1-btree dataset) # h5format_convert -d /DSET_CONTIGUOUS h5fc_non_v3.h5 (non-chunked dataset) -TOOLTEST old_h5fc_ext_none.h5 $TMPFILE -d /DSET_NDATA_BT2 -TOOLTEST h5fc_non_v3.h5 $TMPFILE -d /DSET_CONTIGUOUS +TOOLTEST old_h5fc_ext_none.h5 old_h5fc_ext_none-tmp.h5 -d /DSET_NDATA_BT2 +TOOLTEST h5fc_non_v3.h5 h5fc_non_v3-tmp.h5 -d /DSET_CONTIGUOUS # # # # No output from tests: just check exit code # h5format_convert -d /GROUP/DSET_BT2 -n h5fc_non_v3.h5 (noop, one dataset) # h5format_convert -n h5fc_non_v3.h5 (noop, all datasets) -TOOLTEST h5fc_non_v3.h5 $TMPFILE -d /GROUP/DSET_BT2 -n -TOOLTEST h5fc_non_v3.h5 $TMPFILE -n +TOOLTEST h5fc_non_v3.h5 h5fc_non_v3-tmp.h5 -d /GROUP/DSET_BT2 -n +TOOLTEST h5fc_non_v3.h5 h5fc_non_v3-tmp.h5 -n # # # @@ -543,11 +548,11 @@ TOOLTEST h5fc_non_v3.h5 $TMPFILE -n # h5format_convert h5fc_non_v3.h5 # 1) convert all datasets # 2) verify indexing types -TOOLTEST h5fc_non_v3.h5 $TMPCHKFILE -IDX_CHECK /DSET_NDATA_EA -IDX_CHECK /DSET_NDATA_BT2 -IDX_CHECK /GROUP/DSET_BT2 -IDX_CHECK /GROUP/DSET_EA +TOOLTEST h5fc_non_v3.h5 h5fc_non_v3-tmp.h5 +IDX_CHECK /DSET_NDATA_EA h5fc_non_v3-tmp.h5 +IDX_CHECK /DSET_NDATA_BT2 h5fc_non_v3-tmp.h5 +IDX_CHECK /GROUP/DSET_BT2 h5fc_non_v3-tmp.h5 +IDX_CHECK /GROUP/DSET_EA h5fc_non_v3-tmp.h5 # # # @@ -555,47 +560,47 @@ IDX_CHECK /GROUP/DSET_EA # h5format_convert h5fc_edge_v3.h5 # 1) convert the chunked dataset (filter, no-filter-edge-chunk) # 2) verify the indexing type -TOOLTEST h5fc_edge_v3.h5 $TMPCHKFILE -IDX_CHECK /DSET_EDGE +TOOLTEST h5fc_edge_v3.h5 h5fc_edge_v3-tmp.h5 +IDX_CHECK /DSET_EDGE h5fc_edge_v3-tmp.h5 # # # The following test files have messages in the superblock extension. # Verify h5dump output for correctness after conversion -TOOLTEST h5fc_ext1_i.h5 $TMPDMPFILE +TOOLTEST h5fc_ext1_i.h5 h5fc_ext1_i-tmp.h5 H5DUMP_CHECK h5fc_ext1_i.h5 h5fc_ext1_i.ddl -TOOLTEST h5fc_ext1_s.h5 $TMPDMPFILE +TOOLTEST h5fc_ext1_s.h5 h5fc_ext1_s-tmp.h5 H5DUMP_CHECK h5fc_ext1_s.h5 h5fc_ext1_s.ddl -TOOLTEST h5fc_ext1_f.h5 $TMPDMPFILE +TOOLTEST h5fc_ext1_f.h5 h5fc_ext1_f-tmp.h5 H5DUMP_CHECK h5fc_ext1_f.h5 h5fc_ext1_f.ddl # -TOOLTEST h5fc_ext2_if.h5 $TMPDMPFILE +TOOLTEST h5fc_ext2_if.h5 h5fc_ext2_if-tmp.h5 H5DUMP_CHECK h5fc_ext2_if.h5 h5fc_ext2_if.ddl -TOOLTEST h5fc_ext2_is.h5 $TMPDMPFILE +TOOLTEST h5fc_ext2_is.h5 h5fc_ext2_is-tmp.h5 H5DUMP_CHECK h5fc_ext2_is.h5 h5fc_ext2_is.ddl -TOOLTEST h5fc_ext2_sf.h5 $TMPDMPFILE +TOOLTEST h5fc_ext2_sf.h5 h5fc_ext2_sf-tmp.h5 H5DUMP_CHECK h5fc_ext2_sf.h5 h5fc_ext2_sf.ddl # -TOOLTEST h5fc_ext3_isf.h5 $TMPDMPFILE +TOOLTEST h5fc_ext3_isf.h5 h5fc_ext3_isf-tmp.h5 H5DUMP_CHECK h5fc_ext3_isf.h5 h5fc_ext3_isf.ddl # # # -TOOLTEST old_h5fc_ext1_i.h5 $TMPDMPFILE +TOOLTEST old_h5fc_ext1_i.h5 old_h5fc_ext1_i-tmp.h5 H5DUMP_CHECK old_h5fc_ext1_i.h5 old_h5fc_ext1_i.ddl -TOOLTEST old_h5fc_ext1_s.h5 $TMPDMPFILE +TOOLTEST old_h5fc_ext1_s.h5 old_h5fc_ext1_s-tmp.h5 H5DUMP_CHECK old_h5fc_ext1_s.h5 old_h5fc_ext1_s.ddl -TOOLTEST old_h5fc_ext1_f.h5 $TMPDMPFILE +TOOLTEST old_h5fc_ext1_f.h5 old_h5fc_ext1_f-tmp.h5 H5DUMP_CHECK old_h5fc_ext1_f.h5 old_h5fc_ext1_f.ddl # -TOOLTEST old_h5fc_ext2_if.h5 $TMPDMPFILE +TOOLTEST old_h5fc_ext2_if.h5 old_h5fc_ext2_if-tmp.h5 H5DUMP_CHECK old_h5fc_ext2_if.h5 old_h5fc_ext2_if.ddl -TOOLTEST old_h5fc_ext2_is.h5 $TMPDMPFILE +TOOLTEST old_h5fc_ext2_is.h5 old_h5fc_ext2_is-tmp.h5 H5DUMP_CHECK old_h5fc_ext2_is.h5 old_h5fc_ext2_is.ddl -TOOLTEST old_h5fc_ext2_sf.h5 $TMPDMPFILE +TOOLTEST old_h5fc_ext2_sf.h5 old_h5fc_ext2_sf-tmp.h5 H5DUMP_CHECK old_h5fc_ext2_sf.h5 old_h5fc_ext2_sf.ddl # -TOOLTEST old_h5fc_ext3_isf.h5 $TMPDMPFILE +TOOLTEST old_h5fc_ext3_isf.h5 old_h5fc_ext3_isf-tmp.h5 H5DUMP_CHECK old_h5fc_ext3_isf.h5 old_h5fc_ext3_isf.ddl # # Clean up temporary files/directories diff --git a/tools/test/h5import/CMakeLists.txt b/tools/test/h5import/CMakeLists.txt index 567d9f6..710ba47 100644 --- a/tools/test/h5import/CMakeLists.txt +++ b/tools/test/h5import/CMakeLists.txt @@ -5,7 +5,7 @@ project (HDF5_TOOLS_TEST_H5IMPORT C) # Add the h5import executables # -------------------------------------------------------------------- add_executable (h5importtest ${HDF5_TOOLS_TEST_H5IMPORT_SOURCE_DIR}/h5importtest.c) -target_include_directories (h5importtest PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_include_directories (h5importtest PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (BUILD_STATIC_LIBS) TARGET_C_PROPERTIES (h5importtest STATIC) target_link_libraries (h5importtest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) diff --git a/tools/test/h5import/CMakeTests.cmake b/tools/test/h5import/CMakeTests.cmake index 81ebc4a..7506116 100644 --- a/tools/test/h5import/CMakeTests.cmake +++ b/tools/test/h5import/CMakeTests.cmake @@ -97,26 +97,23 @@ ############################################################################## macro (ADD_H5_TEST testname importfile conffile testfile) - # If using memchecker skip macro based tests - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5IMPORT-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5import${tgt_file_ext}> ${importfile} -c ${conffile} -o ${testfile}) - set_tests_properties (H5IMPORT-${testname} PROPERTIES - FIXTURES_REQUIRED set_h5importtest - ) - else () - add_test ( - NAME H5IMPORT-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove ${testfile} - ) - set_tests_properties (H5IMPORT-${testname}-clear-objects PROPERTIES - FIXTURES_REQUIRED set_h5importtest - ) - - add_test (NAME H5IMPORT-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5import${tgt_file_ext}> ${importfile} -c ${conffile} -o ${testfile}) - set_tests_properties (H5IMPORT-${testname} PROPERTIES - DEPENDS H5IMPORT-${testname}-clear-objects - ) + add_test ( + NAME H5IMPORT-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove + ${testfile} + ${testfile}.new + ) + set_tests_properties (H5IMPORT-${testname}-clear-objects PROPERTIES + FIXTURES_REQUIRED set_h5importtest + ) + add_test (NAME H5IMPORT-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5import${tgt_file_ext}> ${importfile} -c ${conffile} -o ${testfile}) + set_tests_properties (H5IMPORT-${testname} PROPERTIES + DEPENDS H5IMPORT-${testname}-clear-objects + FIXTURES_REQUIRED set_h5importtest + ) + # If using memchecker skip macro based tests + if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5IMPORT-${testname}-H5DMP COMMAND "${CMAKE_COMMAND}" @@ -125,6 +122,7 @@ -D "TEST_ARGS:STRING=${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${testfile}.new" + -D "TEST_SAVE=1" -D "TEST_EXPECT=0" -D "TEST_FILTER=(^(HDF5)[^\n]*)" -D "TEST_SKIP_COMPARE=TRUE" @@ -132,6 +130,7 @@ ) set_tests_properties (H5IMPORT-${testname}-H5DMP PROPERTIES DEPENDS H5IMPORT-${testname} + FIXTURES_REQUIRED set_h5importtest ) add_test ( NAME H5IMPORT-${testname}-H5DMP_CMP @@ -148,8 +147,20 @@ ) set_tests_properties (H5IMPORT-${testname}-H5DMP_CMP PROPERTIES DEPENDS H5IMPORT-${testname}-H5DMP + FIXTURES_REQUIRED set_h5importtest ) endif () + + add_test ( + NAME H5IMPORT-${testname}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove + ${testfile} + ${testfile}.new + ) + set_tests_properties (H5IMPORT-${testname}-clean-objects PROPERTIES + DEPENDS H5IMPORT-${testname}-H5DMP_CMP + FIXTURES_REQUIRED set_h5importtest + ) endmacro () macro (ADD_H5_DUMPTEST testname datasetname testfile) @@ -160,9 +171,11 @@ COMMAND ${CMAKE_COMMAND} -E remove d${testfile} d${testfile}.bin + d${testfile}.dmp ) set_tests_properties (H5IMPORT-DUMP-${testname}-clear-objects PROPERTIES DEPENDS H5IMPORT-${testname}-H5DMP_CMP + FIXTURES_REQUIRED set_h5importtest ) if ("${ARGN}" STREQUAL "BINARY") @@ -174,6 +187,7 @@ -D "TEST_ARGS:STRING=-p;-d;${datasetname};-o;d${testfile}.bin;-b;NATIVE;testfiles/${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=d${testfile}.dmp" + -D "TEST_SAVE=1" -D "TEST_EXPECT=0" -D "TEST_SKIP_COMPARE=TRUE" -P "${HDF_RESOURCES_DIR}/runTest.cmake" @@ -187,6 +201,7 @@ -D "TEST_ARGS:STRING=-p;-d;${datasetname};-o;d${testfile}.bin;-y;--width=1;testfiles/${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=d${testfile}.dmp" + -D "TEST_SAVE=1" -D "TEST_EXPECT=0" -D "TEST_SKIP_COMPARE=TRUE" -P "${HDF_RESOURCES_DIR}/runTest.cmake" @@ -194,6 +209,7 @@ endif () set_tests_properties (H5IMPORT-DUMP-${testname}-H5DMP PROPERTIES DEPENDS "H5IMPORT-DUMP-${testname}-clear-objects" + FIXTURES_REQUIRED set_h5importtest ) add_test ( @@ -210,6 +226,7 @@ ) set_tests_properties (H5IMPORT-DUMP-${testname} PROPERTIES DEPENDS "H5IMPORT-DUMP-${testname}-H5DMP" + FIXTURES_REQUIRED set_h5importtest ) add_test ( @@ -222,13 +239,26 @@ -D "TEST_OUTPUT=d${testfile}.dff" -D "TEST_EXPECT=0" -D "TEST_FILTER=(^(Warning)[^\n]*)" - -D "TEST_REFERENCE=testfiles/d${testfile}.txt" + -D "TEST_REFERENCE=testfiles/${testfile}.txt" -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5IMPORT-DUMP-${testname}-H5DFF PROPERTIES DEPENDS "H5IMPORT-DUMP-${testname}" + FIXTURES_REQUIRED set_h5importtest ) endif () + + add_test ( + NAME H5IMPORT-DUMP-${testname}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove + d${testfile} + d${testfile}.bin + d${testfile}.dmp + ) + set_tests_properties (H5IMPORT-DUMP-${testname}-clean-objects PROPERTIES + DEPENDS H5IMPORT-DUMP-${testname}-H5DFF + FIXTURES_REQUIRED set_h5importtest + ) endmacro () macro (ADD_H5_DUMPSUBTEST testname testfile datasetname) @@ -237,8 +267,9 @@ add_test ( NAME H5IMPORT_SUB-DUMP-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove - d-${testname}.h5 - ${testname}.bin + ds${testname}.h5 + ds${testname}.bin + ds${testname}.dmp ) set_tests_properties (H5IMPORT_SUB-DUMP-${testname}-clear-objects PROPERTIES FIXTURES_REQUIRED set_h5importtest @@ -249,15 +280,17 @@ COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_file_ext}>" - -D "TEST_ARGS:STRING=-p;-d;${datasetname};${ARGN};-o;${testname}.bin;-b;NATIVE;testfiles/${testfile}" + -D "TEST_ARGS:STRING=-p;-d;${datasetname};${ARGN};-o;ds${testname}.bin;-b;NATIVE;testfiles/${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -D "TEST_OUTPUT=${testname}.dmp" + -D "TEST_OUTPUT=ds${testname}.dmp" + -D "TEST_SAVE=1" -D "TEST_EXPECT=0" -D "TEST_SKIP_COMPARE=TRUE" -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5IMPORT_SUB-DUMP-${testname}-H5DMP PROPERTIES DEPENDS "H5IMPORT_SUB-DUMP-${testname}-clear-objects" + FIXTURES_REQUIRED set_h5importtest ) add_test ( @@ -265,32 +298,46 @@ COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$<TARGET_FILE:h5import${tgt_file_ext}>" - -D "TEST_ARGS:STRING=${testname}.bin;-c;${testname}.dmp;-o;d-${testname}.h5" + -D "TEST_ARGS:STRING=ds${testname}.bin;-c;ds${testname}.dmp;-o;ds${testname}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -D "TEST_OUTPUT=${testname}.imp" + -D "TEST_OUTPUT=ds${testname}.imp" -D "TEST_EXPECT=0" -D "TEST_SKIP_COMPARE=TRUE" -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5IMPORT_SUB-DUMP-${testname}-H5IMP PROPERTIES DEPENDS "H5IMPORT_SUB-DUMP-${testname}-H5DMP" + FIXTURES_REQUIRED set_h5importtest ) add_test ( NAME H5IMPORT_SUB-DUMP-${testname}-CMP COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_file_ext}>" - -D "TEST_ARGS:STRING=-p;d-${testname}.h5" + -D "TEST_ARGS:STRING=-p;ds${testname}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -D "TEST_OUTPUT=d-${testname}.dmp" + -D "TEST_OUTPUT=ds${testname}.dmp" -D "TEST_EXPECT=0" -D "TEST_REFERENCE=testfiles/${testname}.ddl" -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5IMPORT_SUB-DUMP-${testname}-CMP PROPERTIES - DEPENDS "H5IMPORT_SUB-DUMP-${testname}-H5IMP" + DEPENDS "H5IMPORT_SUB-DUMP-${testname}-H5IMP" + FIXTURES_REQUIRED set_h5importtest ) endif () + + add_test ( + NAME H5IMPORT_SUB-DUMP-${testname}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove + ds${testname}.h5 + ds${testname}.bin + ds${testname}.dmp + ) + set_tests_properties (H5IMPORT_SUB-DUMP-${testname}-clean-objects PROPERTIES + DEPENDS "H5IMPORT_SUB-DUMP-${testname}-CMP" + FIXTURES_REQUIRED set_h5importtest + ) endmacro () macro (ADD_H5_SKIP_DUMPTEST testname datasetname testfile) @@ -368,23 +415,55 @@ set (last_test "H5IMPORT-clear-objects") endif () - add_test ( - NAME H5IMPORT-h5importtest-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove + set (H5IMPORTTEST_CLEANFILES binfp64.bin binfp64.conf + binfp64.h5 + binfp64.h5.new binin8.bin binin8.conf + binin8.h5 + binin8.h5.new binin8w.bin binin8w.conf + binin8w.h5 + binin8w.h5.new binin16.bin binin16.conf + binin16.h5 + binin16.h5.new binin32.bin binin32.conf + binin32.h5 + binin32.h5.new binuin16.bin binuin16.conf + binuin16.h5 + binuin16.h5.new binuin32.bin binuin32.conf + binuin32.h5 + binuin32.h5.new + txtfp32.h5 + txtfp32.h5.new + txtfp64.h5 + txtfp64.h5.new + txtin8.h5 + txtin8.h5.new + txtin8w.h5 + txtin8w.h5.new + txtin16.h5 + txtin16.h5.new + txtin32.h5 + txtin32.h5.new + txtuin16.h5 + txtuin16.h5.new + txtuin32.h5 + txtuin32.h5.new + ) + add_test ( + NAME H5IMPORT-h5importtest-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove ${H5IMPORTTEST_CLEANFILES} ) add_test (NAME H5IMPORT-h5importtest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5importtest>) @@ -392,6 +471,13 @@ FIXTURES_SETUP set_h5importtest DEPENDS H5IMPORT-h5importtest-clear-objects ) + add_test ( + NAME H5IMPORT-h5importtest-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove ${H5IMPORTTEST_CLEANFILES} + ) + set_tests_properties (H5IMPORT-h5importtest-clean-objects PROPERTIES + FIXTURES_CLEANUP set_h5importtest + ) # ----- TESTING "ASCII I32 rank 3 - Output BE " ; ADD_H5_TEST (ASCII_I32 testfiles/txtin32.txt testfiles/txtin32.conf txtin32.h5) diff --git a/tools/test/h5import/h5importtestutil.sh.in b/tools/test/h5import/h5importtestutil.sh.in index 59ae34c..ba91ee5 100644 --- a/tools/test/h5import/h5importtestutil.sh.in +++ b/tools/test/h5import/h5importtestutil.sh.in @@ -267,9 +267,9 @@ fi TOOLTEST5() { err=0 -$RUNSERIAL $DUMPER_BIN -p -d $3 $4 -o d-$1.bin -b NATIVE tmp_testfiles/$2 > d-$1.dmp -$RUNSERIAL $H5IMPORT_BIN d-$1.bin -c d-$1.dmp -o d-$1.h5 > d-$1.imp -$RUNSERIAL $DUMPER_BIN -p d-$1.h5 > log2 +$RUNSERIAL $DUMPER_BIN -p -d $3 $4 -o ds$1.bin -b NATIVE tmp_testfiles/$2 > ds$1.dmp +$RUNSERIAL $H5IMPORT_BIN ds$1.bin -c ds$1.dmp -o ds$1.h5 > ds$1.imp +$RUNSERIAL $DUMPER_BIN -p ds$1.h5 > log2 $CP -f $SRC_H5IMPORT_TESTFILES/$1.ddl log1 cmp -s log1 log2 || err=1 diff --git a/tools/test/h5import/testfiles/tall_fp32.ddl b/tools/test/h5import/testfiles/tall_fp32.ddl index 2a0dc1b..53f24bf 100644 --- a/tools/test/h5import/testfiles/tall_fp32.ddl +++ b/tools/test/h5import/testfiles/tall_fp32.ddl @@ -1,4 +1,4 @@ -HDF5 "d-tall_fp32.h5" { +HDF5 "dstall_fp32.h5" { GROUP "/" { GROUP "g2" { DATASET "dset2.2" { diff --git a/tools/test/h5import/testfiles/tall_i32.ddl b/tools/test/h5import/testfiles/tall_i32.ddl index d9280bc..b05dd53 100644 --- a/tools/test/h5import/testfiles/tall_i32.ddl +++ b/tools/test/h5import/testfiles/tall_i32.ddl @@ -1,4 +1,4 @@ -HDF5 "d-tall_i32.h5" { +HDF5 "dstall_i32.h5" { GROUP "/" { GROUP "g1" { GROUP "g1.1" { diff --git a/tools/test/h5import/testfiles/tintsattrs_u32.ddl b/tools/test/h5import/testfiles/tintsattrs_u32.ddl index cf8889c..a53217a 100644 --- a/tools/test/h5import/testfiles/tintsattrs_u32.ddl +++ b/tools/test/h5import/testfiles/tintsattrs_u32.ddl @@ -1,4 +1,4 @@ -HDF5 "d-tintsattrs_u32.h5" { +HDF5 "dstintsattrs_u32.h5" { GROUP "/" { DATASET "DU32BITS" { DATATYPE H5T_STD_U32LE diff --git a/tools/test/h5jam/CMakeLists.txt b/tools/test/h5jam/CMakeLists.txt index 97e6b76..a7feb20 100644 --- a/tools/test/h5jam/CMakeLists.txt +++ b/tools/test/h5jam/CMakeLists.txt @@ -6,7 +6,7 @@ project (HDF5_TOOLS_TEST_H5JAM C) # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS AND BUILD_STATIC_LIBS) add_executable (h5jamgentest ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/h5jamgentest.c) - target_include_directories (h5jamgentest PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5jamgentest PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5jamgentest STATIC) target_link_libraries (h5jamgentest PRIVATE ${HDF5_LIB_TARGET}) set_target_properties (h5jamgentest PROPERTIES FOLDER generator/tools) @@ -22,7 +22,7 @@ if (HDF5_BUILD_GENERATORS AND BUILD_STATIC_LIBS) endif () add_executable (getub ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/getub.c) -target_include_directories (getub PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_include_directories (getub PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (BUILD_STATIC_LIBS) TARGET_C_PROPERTIES (getub STATIC) target_link_libraries (getub PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) @@ -33,7 +33,7 @@ endif () set_target_properties (getub PROPERTIES FOLDER tools) add_executable (tellub ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/tellub.c) -target_include_directories (tellub PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_include_directories (tellub PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (BUILD_STATIC_LIBS) TARGET_C_PROPERTIES (tellub STATIC) target_link_libraries (tellub PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) diff --git a/tools/test/h5jam/testh5jam.sh.in b/tools/test/h5jam/testh5jam.sh.in index b2464ed..805ce11 100644 --- a/tools/test/h5jam/testh5jam.sh.in +++ b/tools/test/h5jam/testh5jam.sh.in @@ -182,7 +182,7 @@ CLEANUP() { # SETUP file tocopy # Clone a standard input file in the test directory -# Modification: +# # Was using "cp" command which means file $2 will inherit the permission # setting of file $1. If $1 is read-only, so will $2. That will cause # failure when the test attempts to write it later on. Changed to use diff --git a/tools/test/h5ls/CMakeLists.txt b/tools/test/h5ls/CMakeLists.txt index ba6e468..b6c1057 100644 --- a/tools/test/h5ls/CMakeLists.txt +++ b/tools/test/h5ls/CMakeLists.txt @@ -10,7 +10,7 @@ if (BUILD_SHARED_LIBS) set (H5LS_TOOL_PLUGIN_LIB_TARGET ${H5LS_TOOL_PLUGIN_LIB_CORENAME}) add_library (${H5LS_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_ls.c) - target_include_directories (${H5LS_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (${H5LS_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (${H5LS_TOOL_PLUGIN_LIB_TARGET} SHARED) target_link_libraries (${H5LS_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_LIBSH_TARGET}) H5_SET_LIB_OPTIONS (${H5LS_TOOL_PLUGIN_LIB_TARGET} ${H5LS_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") diff --git a/tools/test/h5ls/CMakeTests.cmake b/tools/test/h5ls/CMakeTests.cmake index 34f8e6f..15f18b5 100644 --- a/tools/test/h5ls/CMakeTests.cmake +++ b/tools/test/h5ls/CMakeTests.cmake @@ -138,7 +138,9 @@ # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5LS-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5ls${tgt_file_ext}> ${ARGN}) - set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + set_tests_properties (H5LS-${resultfile} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + ) if ("${resultcode}" STREQUAL "1") set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true") endif () @@ -157,6 +159,9 @@ -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () + set_tests_properties (H5LS-${resultfile} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + ) endmacro () macro (ADD_H5_ERR_TEST resultfile resultcode) @@ -182,12 +187,15 @@ -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () + set_tests_properties (H5LS-${resultfile} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + ) endmacro () macro (ADD_H5_UD_TEST testname resultcode resultfile) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5LS_UD-${testname} + NAME H5LS_UD-${testname}-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$<TARGET_FILE:h5ls${tgt_file_ext}>" @@ -201,6 +209,9 @@ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) + set_tests_properties (H5LS_UD-${testname}-${resultfile} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + ) endif () endmacro () diff --git a/tools/test/h5ls/h5ls_plugin.sh.in b/tools/test/h5ls/h5ls_plugin.sh.in index 0077b07..02e0cf7 100644 --- a/tools/test/h5ls/h5ls_plugin.sh.in +++ b/tools/test/h5ls/h5ls_plugin.sh.in @@ -3,7 +3,7 @@ # Copyright by The HDF Group. # All rights reserved. # -# This file is part of HDF5. The full HDF5 copyright notice, including +# This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in # the COPYING file, which can be found at the root of the source code # distribution tree, or in https://www.hdfgroup.org/licenses. @@ -88,7 +88,7 @@ if [ $? != 0 ]; then fi # setup plugin path -ENVCMD="env HDF5_PLUGIN_PATH=../${PLUGIN_LIBDIR}" +ENVCMD="env HDF5_PLUGIN_PATH=../${PLUGIN_LIBDIR}:${HDF5_PLUGIN_PATH}" # # copy test files and expected output files from source dirs to test dir diff --git a/tools/test/h5repack/CMakeLists.txt b/tools/test/h5repack/CMakeLists.txt index 2f79763..2fd2827 100644 --- a/tools/test/h5repack/CMakeLists.txt +++ b/tools/test/h5repack/CMakeLists.txt @@ -6,7 +6,7 @@ project (HDF5_TOOLS_TEST_H5REPACK C) # -------------------------------------------------------------------- add_executable (testh5repack_detect_szip ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testh5repack_detect_szip.c) target_include_directories (testh5repack_detect_szip - PRIVATE "${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" + PRIVATE "${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" ) if (BUILD_STATIC_LIBS) TARGET_C_PROPERTIES (testh5repack_detect_szip STATIC) @@ -29,7 +29,7 @@ set (REPACK_COMMON_SOURCES ) add_executable (h5repacktest ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/h5repacktst.c) target_include_directories (h5repacktest - PRIVATE "${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_TEST_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" + PRIVATE "${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_TEST_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" ) if (BUILD_STATIC_LIBS) TARGET_C_PROPERTIES (h5repacktest STATIC) @@ -52,13 +52,13 @@ if (BUILD_SHARED_LIBS) set (H5REPACK_TOOL_PLUGIN_LIB_VTARGET ${H5REPACK_TOOL_PLUGIN_LIB_VCORENAME}) add_library (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_rpk.c) - target_include_directories (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} SHARED) target_link_libraries (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_LIBSH_TARGET}) H5_SET_LIB_OPTIONS (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} ${H5REPACK_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") add_library (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} SHARED dynlib_vrpk.c) - target_include_directories (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} SHARED) target_link_libraries (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} PRIVATE ${HDF5_LIBSH_TARGET}) H5_SET_LIB_OPTIONS (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} ${H5REPACK_TOOL_PLUGIN_LIB_VNAME} SHARED "LIB") @@ -99,7 +99,7 @@ endif () # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS AND BUILD_STATIC_LIBS) add_executable (h5repackgentest ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/h5repackgentest.c) - target_include_directories (h5repackgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5repackgentest PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5repackgentest STATIC) target_link_libraries (h5repackgentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5repackgentest PROPERTIES FOLDER generator/tools) diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake index 936ee3e..9ced142 100644 --- a/tools/test/h5repack/CMakeTests.cmake +++ b/tools/test/h5repack/CMakeTests.cmake @@ -222,9 +222,6 @@ # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5REPACK-h5repack-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_file_ext}> ${ARGN}) - set_tests_properties (H5REPACK-h5repack-${testname} PROPERTIES - WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" - ) else () add_test ( NAME H5REPACK-h5repack-${testname} @@ -240,7 +237,7 @@ ) endif () set_tests_properties (H5REPACK-h5repack-${testname} PROPERTIES - FIXTURES_REQUIRED clear_h5repack + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" ) endmacro () @@ -257,9 +254,6 @@ NAME H5REPACK_OLD-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${testfile} ) - set_tests_properties (H5REPACK_OLD-${testname}-clear-objects PROPERTIES - FIXTURES_REQUIRED clear_h5repack - ) add_test ( NAME H5REPACK_OLD-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_file_ext}> ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} @@ -274,6 +268,13 @@ set_tests_properties (H5REPACK_OLD-${testname}_DFF PROPERTIES DEPENDS H5REPACK_OLD-${testname} ) + add_test ( + NAME H5REPACK_OLD-${testname}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK_OLD-${testname}-clean-objects PROPERTIES + DEPENDS H5REPACK_OLD-${testname}_DFF + ) endif () endif () endmacro () @@ -292,9 +293,6 @@ NAME H5REPACK-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${testfile} ) - set_tests_properties (H5REPACK-${testname}-clear-objects PROPERTIES - FIXTURES_REQUIRED clear_h5repack - ) add_test ( NAME H5REPACK-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_file_ext}> --enable-error-stack ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} @@ -309,6 +307,13 @@ set_tests_properties (H5REPACK-${testname}_DFF PROPERTIES DEPENDS H5REPACK-${testname} ) + add_test ( + NAME H5REPACK-${testname}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK-${testname}-clean-objects PROPERTIES + DEPENDS H5REPACK-${testname}_DFF + ) endif () endmacro () @@ -322,20 +327,20 @@ set_property(TEST H5REPACK_CMP-${testname} PROPERTY DISABLED) endif () else () + add_test ( + NAME H5REPACK_CMP-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${resultfile} + ) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_CMP-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_file_ext}> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} ) - else () - add_test ( - NAME H5REPACK_CMP-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${resultfile} - ) - set_tests_properties (H5REPACK_CMP-${testname}-clear-objects PROPERTIES - FIXTURES_REQUIRED clear_h5repack + set_tests_properties (H5REPACK_CMP-${testname} PROPERTIES + DEPENDS H5REPACK_CMP-${testname}-clear-objects ) + else () add_test ( NAME H5REPACK_CMP-${testname} COMMAND "${CMAKE_COMMAND}" @@ -353,6 +358,13 @@ DEPENDS H5REPACK_CMP-${testname}-clear-objects ) endif () + add_test ( + NAME H5REPACK_CMP-${testname}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${resultfile} + ) + set_tests_properties (H5REPACK_CMP-${testname}-clean-objects PROPERTIES + DEPENDS H5REPACK_CMP-${testname} + ) endif () endmacro () @@ -366,24 +378,18 @@ set_property(TEST H5REPACK_MASK-${testname} PROPERTY DISABLED) endif () else () + add_test ( + NAME H5REPACK_MASK-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${resultfile} + ) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_MASK-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_file_ext}> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} ) - set_tests_properties (H5REPACK_MASK-${testname} PROPERTIES - FIXTURES_REQUIRED clear_h5repack - ) else (HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5REPACK_MASK-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${resultfile} - ) - set_tests_properties (H5REPACK_MASK-${testname}-clear-objects PROPERTIES DEPENDS ${last_test} - FIXTURES_REQUIRED clear_h5repack - ) - add_test ( NAME H5REPACK_MASK-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" @@ -397,8 +403,17 @@ -D "TEST_ERRREF=${result_errcheck}" -P "${HDF_RESOURCES_DIR}/grepTest.cmake" ) - set_tests_properties (H5REPACK_MASK-${testname} PROPERTIES DEPENDS H5REPACK_MASK-${testname}-clear-objects) endif () + set_tests_properties (H5REPACK_MASK-${testname} PROPERTIES + DEPENDS H5REPACK_MASK-${testname}-clear-objects + ) + add_test ( + NAME H5REPACK_MASK-${testname}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${resultfile} + ) + set_tests_properties (H5REPACK_MASK-${testname}-clean-objects PROPERTIES + DEPENDS H5REPACK_MASK-${testname} + ) endif () endmacro () @@ -416,6 +431,62 @@ NAME H5REPACK_DMP-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${resultfile} ) + add_test ( + NAME H5REPACK_DMP-${testname} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_file_ext}> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} + ) + set_tests_properties (H5REPACK_DMP-${testname} PROPERTIES + DEPENDS H5REPACK_DMP-${testname}-clear-objects + ) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + add_test ( + NAME H5REPACK_DMP-h5dump-${testname} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_file_ext}>" + -D "TEST_ARGS:STRING=-q;creation_order;-pH;out-${testname}.${resultfile}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${resultfile}-${testname}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${testname}.${resultfile}.ddl" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" + ) + set_tests_properties (H5REPACK_DMP-h5dump-${testname} PROPERTIES + DEPENDS H5REPACK_DMP-${testname} + ) + add_test ( + NAME H5REPACK_DMP-${testname}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${resultfile} + ) + set_tests_properties (H5REPACK_DMP-${testname}-clean-objects PROPERTIES + DEPENDS H5REPACK_DMP-h5dump-${testname} + ) + else () + add_test ( + NAME H5REPACK_DMP-${testname}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${resultfile} + ) + set_tests_properties (H5REPACK_DMP-${testname}-clean-objects PROPERTIES + DEPENDS H5REPACK_DMP-${testname} + ) + endif () + endif () + endmacro () + + macro (ADD_H5_DMP_NO_OPT_TEST testname testtype resultcode resultfile) + if ("${testtype}" STREQUAL "SKIP") + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + add_test ( + NAME H5REPACK_DMP-${testname} + COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" + ) + set_property(TEST H5REPACK_DMP-${testname} PROPERTY DISABLED) + endif () + else () + add_test ( + NAME H5REPACK_DMP-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${resultfile} + ) set_tests_properties (H5REPACK_DMP-${testname}-clear-objects PROPERTIES FIXTURES_REQUIRED clear_h5repack ) @@ -432,7 +503,7 @@ COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_file_ext}>" - -D "TEST_ARGS:STRING=-q;creation_order;-pH;out-${testname}.${resultfile}" + -D "TEST_ARGS:STRING=out-${testname}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}-${testname}.out" -D "TEST_EXPECT=${resultcode}" @@ -460,9 +531,6 @@ NAME H5REPACK_DIFF-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${testfile} ) - set_tests_properties (H5REPACK_DIFF-${testname}-clear-objects PROPERTIES - FIXTURES_REQUIRED clear_h5repack - ) add_test ( NAME H5REPACK_DIFF-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_file_ext}> --enable-error-stack ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} @@ -485,6 +553,13 @@ set_tests_properties (H5REPACK_DIFF-${testname}_DFF PROPERTIES DEPENDS H5REPACK_DIFF-${testname} ) + add_test ( + NAME H5REPACK_DIFF-${testname}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK_DIFF-${testname}-clean-objects PROPERTIES + DEPENDS H5REPACK_DIFF-${testname}_DFF + ) endif () endmacro () @@ -502,9 +577,6 @@ NAME H5REPACK_STAT-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${statarg}.${resultfile} ) - set_tests_properties (H5REPACK_STAT-${testname}-clear-objects PROPERTIES - FIXTURES_REQUIRED clear_h5repack - ) add_test ( NAME H5REPACK_STAT-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_file_ext}> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${statarg}.${resultfile} @@ -526,7 +598,22 @@ -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5REPACK_STAT-h5stat-${testname} PROPERTIES - DEPENDS "H5REPACK_STAT-${testname}" + DEPENDS H5REPACK_STAT-${testname} + ) + add_test ( + NAME H5REPACK_STAT-${testname}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${statarg}.${resultfile} + ) + set_tests_properties (H5REPACK_STAT-${testname}-clean-objects PROPERTIES + DEPENDS H5REPACK_STAT-h5stat-${testname} + ) + else () + add_test ( + NAME H5REPACK_STAT-${testname}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${statarg}.${resultfile} + ) + set_tests_properties (H5REPACK_STAT-${testname}-clean-objects PROPERTIES + DEPENDS H5REPACK_STAT-${testname} ) endif () endif () @@ -547,9 +634,6 @@ NAME H5REPACK_VERIFY_LAYOUT-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${testfile} ) - set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}-clear-objects PROPERTIES - FIXTURES_REQUIRED clear_h5repack - ) add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_file_ext}> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} @@ -608,6 +692,13 @@ DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}_DFF ) endif () + add_test ( + NAME H5REPACK_VERIFY_LAYOUT-${testname}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}-clean-objects PROPERTIES + DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}_DMP + ) endif () endif () endmacro () @@ -628,9 +719,6 @@ NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${testfile} ) - set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname}-clear-objects PROPERTIES - FIXTURES_REQUIRED clear_h5repack - ) add_test ( NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_file_ext}> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} @@ -655,6 +743,13 @@ WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" DEPENDS H5REPACK_VERIFY_LAYOUT_VDS-${testname} ) + add_test ( + NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname}-clean-objects PROPERTIES + DEPENDS H5REPACK_VERIFY_LAYOUT_VDS-${testname}_DMP + ) endif () endif () endmacro () @@ -666,9 +761,6 @@ NAME H5REPACK_VERIFY_SUPERBLOCK-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${testfile} ) - set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname}-clear-objects PROPERTIES - FIXTURES_REQUIRED clear_h5repack - ) add_test ( NAME H5REPACK_VERIFY_SUPERBLOCK-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_file_ext}> -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} @@ -692,6 +784,13 @@ set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname}_DMP PROPERTIES DEPENDS H5REPACK_VERIFY_SUPERBLOCK-${testname} ) + add_test ( + NAME H5REPACK_VERIFY_SUPERBLOCK-${testname}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname}-clean-objects PROPERTIES + DEPENDS H5REPACK_VERIFY_SUPERBLOCK-${testname}_DMP + ) endif () endmacro () @@ -700,9 +799,6 @@ NAME ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${testfile} ) - set_tests_properties (ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}-clear-objects PROPERTIES - FIXTURES_REQUIRED clear_h5repack - ) add_test ( NAME ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_file_ext}> -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} @@ -711,6 +807,13 @@ DEPENDS ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}-clear-objects WILL_FAIL "true" ) + add_test ( + NAME ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${testfile} + ) + set_tests_properties (ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}-clean-objects PROPERTIES + DEPENDS ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname} + ) endmacro () macro (ADD_H5_TEST_META testname testfile) @@ -719,14 +822,7 @@ NAME H5REPACK_META-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}_N.${testname}.h5 - testfiles/out-${testname}_N.${testname}.out - testfiles/out-${testname}_N.${testname}.out.err testfiles/out-${testname}_M.${testname}.h5 - testfiles/out-${testname}_M.${testname}.out - testfiles/out-${testname}_M.${testname}.out.err - ) - set_tests_properties (H5REPACK_META-${testname}-clear-objects PROPERTIES - FIXTURES_REQUIRED clear_h5repack ) add_test ( NAME H5REPACK_META-${testname}_N @@ -775,7 +871,7 @@ add_test (NAME H5REPACK_META-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" - -D "TEST_ONEFILE=out-${testname}_N.${testname}.out" + -D "TEST_ONEFILE=out-${testname}_N.${testname}.h5" -D "TEST_TWOFILE=out-${testname}_M.${testname}.h5" -D "TEST_FUNCTION=LTEQ" -P "${HDF_RESOURCES_DIR}/fileCompareTest.cmake" @@ -788,6 +884,15 @@ set_tests_properties (H5REPACK_META-${testname} PROPERTIES DEPENDS H5REPACK_META-${testname}_M_DFF ) + add_test ( + NAME H5REPACK_META-${testname}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove + testfiles/out-${testname}_N.${testname}.h5 + testfiles/out-${testname}_M.${testname}.h5 + ) + set_tests_properties (H5REPACK_META-${testname}-clean-objects PROPERTIES + DEPENDS H5REPACK_META-${testname} + ) endmacro () macro (ADD_H5_UD_TEST testname resultcode resultfile) @@ -797,9 +902,6 @@ NAME H5REPACK_UD-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${resultfile} ) - set_tests_properties (H5REPACK_UD-${testname}-clear-objects PROPERTIES - FIXTURES_REQUIRED clear_h5repack - ) add_test ( NAME H5REPACK_UD-${testname} COMMAND "${CMAKE_COMMAND}" @@ -835,7 +937,14 @@ -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5REPACK_UD-${testname}-h5dump PROPERTIES - DEPENDS "H5REPACK_UD-${testname}" + DEPENDS H5REPACK_UD-${testname} + ) + add_test ( + NAME H5REPACK_UD-${testname}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${resultfile} + ) + set_tests_properties (H5REPACK_UD-${testname}-clean-objects PROPERTIES + DEPENDS H5REPACK_UD-${testname}-h5dump ) endif () endmacro () @@ -859,7 +968,6 @@ ) set_tests_properties (H5REPACK_EXTERNAL-${testname}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" - FIXTURES_REQUIRED clear_h5repack ) # make sure external data file 0 is available add_test ( @@ -934,6 +1042,14 @@ DEPENDS H5REPACK_EXTERNAL-${testname}_DFF4 WILL_FAIL "true" ) + add_test ( + NAME H5REPACK_EXTERNAL-${testname}-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove h5repack_${testfile}_rp.h5 + ) + set_tests_properties (H5REPACK_EXTERNAL-${testname}-clean-objects PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + DEPENDS H5REPACK_EXTERNAL-${testname}_DFF_FAIL + ) endif () endif () endmacro () @@ -976,123 +1092,6 @@ set (FILEV4 4_vds.h5) set (FILEV5 5_vds.h5) - if (HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - set (LIST_TO_CLEAR - out-family.tfamily%05d.h5 - out-HDFFV-7840.h5diff_attr1.h5 - out-attr.h5repack_attr.h5 - out-native_attr.h5repack_attr.h5 - out-HDFFV-5932.h5repack_attr_refs.h5 - out-deflate_copy.h5repack_deflate.h5 - out-deflate_remove.h5repack_deflate.h5 - out-early.h5repack_early.h5 - out-fill.h5repack_fill.h5 - out-native_fill.h5repack_fill.h5 - out-gzip_verbose_filters.h5repack_filters.h5 - out-fletcher_copy.h5repack_fletcher.h5 - out-fletcher_remove.h5repack_fletcher.h5 - out-hlink.h5repack_hlink.h5 - out-chunk_18x13.h5repack_layout.h5 - out-chunk_20x10.h5repack_layout.h5 - out-chunk_compa.h5repack_layout.h5 - out-chunk_conti.h5repack_layout.h5 - out-compa.h5repack_layout.h5 - out-conti.h5repack_layout.h5 - out-deflate_file.h5repack_layout.h5 - out-deflate_limit.h5repack_layout.h5 - out-dset2_chunk_20x10.h5repack_layout.h5 - out-dset2_compa.h5repack_layout.h5 - out-dset2_conti.h5repack_layout.h5 - out-dset_compa_chunk.h5repack_layout.h5 - out-dset_compa_compa.h5repack_layout.h5 - out-dset_compa_conti.h5repack_layout.h5 - out-dset_conti_chunk.h5repack_layout.h5 - out-dset_conti_compa.h5repack_layout.h5 - out-dset_conti_conti.h5repack_layout.h5 - out-fletcher_all.h5repack_layout.h5 - out-fletcher_individual.h5repack_layout.h5 - out-global_filters.h5repack_layout.h5 - out-gzip_all.h5repack_layout.h5 - out-gzip_individual.h5repack_layout.h5 - out-layout.h5repack_layout.h5 - out-layout_long_switches.h5repack_layout.h5 - out-layout_short_switches.h5repack_layout.h5 - out-old_style_layout_short_switches.h5repack_layout.h5 - out-plugin_test.h5repack_layout.h5 - out-shuffle_all.h5repack_layout.h5 - out-shuffle_individual.h5repack_layout.h5 - out-upgrade_layout.h5repack_layouto.h5 - out-contig_small_compa.h5repack_layout2.h5 - out-contig_small_fixed_compa.h5repack_layout2.h5 - out-ckdim_biger.h5repack_layout3.h5 - out-ckdim_smaller.h5repack_layout3.h5 - out-chunk2chunk.h5repack_layout3.h5 - out-chunk2compa.h5repack_layout3.h5 - out-chunk2conti.h5repack_layout3.h5 - out-error1.h5repack_layout3.h5 - out-error2.h5repack_layout3.h5 - out-error3.h5repack_layout3.h5 - out-error4.h5repack_layout3.h5 - out-committed_dt.h5repack_named_dtypes.h5 - out-nbit_add.h5repack_nbit.h5 - out-nbit_copy.h5repack_nbit.h5 - out-nbit_remove.h5repack_nbit.h5 - out-add_alignment.h5repack_objs.h5 - out-add_userblock.h5repack_objs.h5 - out-objs.h5repack_objs.h5 - out-gt_mallocsize.h5repack_objs.h5 - out-bug1814.h5repack_refs.h5 - out-shuffle_copy.h5repack_shuffle.h5 - out-shuffle_remove.h5repack_shuffle.h5 - out-scale_add.h5repack_soffset.h5 - out-scale_copy.h5repack_soffset.h5 - out-scale_remove.h5repack_soffset.h5 - out-meta_short_M.meta_short.h5 - out-meta_short_N.meta_short.h5 - out-meta_long_M.meta_long.h5 - out-meta_long_N.meta_long.h5 - out-vds_compa.4_vds.h5 - out-vds_conti.4_vds.h5 - out-vds_chunk2x5x8.3_1_vds.h5 - out-vds_chunk3x6x9.2_vds.h5 - out-vds_dset_chunk20x10x5.1_vds.h5 - ) - - set (LIST_TO_CLEAR ${LIST_TO_CLEAR} ${LIST_OTHER_TEST_FILES}) - - foreach (h5_file ${LIST_HDF5_TEST_FILES}) - get_filename_component(fname "${h5_file}" NAME) - set (LIST_TO_CLEAR ${LIST_TO_CLEAR} - ${h5_file}.h5 - ) - endforeach () - - foreach (h5_file ${LIST_TST_TEST_FILES}) - get_filename_component(fname "${h5_file}" NAME) - set (LIST_TO_CLEAR ${LIST_TO_CLEAR} - ${h5_file}.tst.out - ${h5_file}.tst.out.err - ) - endforeach () - - foreach (h5_file ${LIST_DDL_TEST_FILES}) - get_filename_component(fname "${h5_file}" NAME) - set (LIST_TO_CLEAR ${LIST_TO_CLEAR} - ${h5_file}.ddl.out - ${h5_file}.ddl.out.err - ) - endforeach () - add_test ( - NAME H5REPACK-clearall-objects - COMMAND ${CMAKE_COMMAND} -E remove ${LIST_TO_CLEAR} - ) - set_tests_properties (H5REPACK-clearall-objects PROPERTIES - FIXTURES_SETUP clear_h5repack - WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" - ) - endif () - ADD_HELP_TEST(help 0 -h) add_test (NAME H5REPACK-testh5repack_detect_szip COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:testh5repack_detect_szip>) @@ -1108,7 +1107,7 @@ set (passRegex "no") set_tests_properties (H5REPACK-testh5repack_detect_szip PROPERTIES PASS_REGULAR_EXPRESSION "no") endif () - set_tests_properties (H5REPACK-testh5repack_detect_szip PROPERTIES DEPENDS H5REPACK-clearall-objects) + set_tests_properties (H5REPACK-testh5repack_detect_szip PROPERTIES DEPENDS H5REPACK-h5repack-${testname}) set (last_test "H5REPACK-testh5repack_detect_szip") # add_test (NAME H5REPACK-h5repacktest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repacktest>) diff --git a/tools/test/h5repack/CMakeVFDTests.cmake b/tools/test/h5repack/CMakeVFDTests.cmake index f8ac10b..335ac28 100644 --- a/tools/test/h5repack/CMakeVFDTests.cmake +++ b/tools/test/h5repack/CMakeVFDTests.cmake @@ -22,59 +22,73 @@ H5_CREATE_VFD_DIR() ### T H E T E S T S M A C R O S ### ############################################################################## ############################################################################## - +set (H5REPACK_CLEANFILES + bounds_latest_latest.h5 + h5repack_attr.h5 + h5repack_attr_refs.h5 + h5repack_deflate.h5 + h5repack_early.h5 + h5repack_ext.h5 + h5repack_fill.h5 + h5repack_filters.h5 + h5repack_fletcher.h5 + h5repack_hlink.h5 + h5repack_layout.h5 + h5repack_layouto.h5 + h5repack_layout2.h5 + h5repack_layout3.h5 + h5repack_layout.UD.h5 + h5repack_named_dtypes.h5 + h5repack_nested_8bit_enum.h5 + h5repack_nested_8bit_enum_deflated.h5 + h5repack_nbit.h5 + h5repack_objs.h5 + h5repack_refs.h5 + h5repack_shuffle.h5 + h5repack_soffset.h5 + h5repack_szip.h5 + # fsm + h5repack_aggr.h5 + h5repack_fsm_aggr_nopersist.h5 + h5repack_fsm_aggr_persist.h5 + h5repack_none.h5 + h5repack_paged_nopersist.h5 + h5repack_paged_persist.h5 +) macro (ADD_VFD_TEST vfdname resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK-${vfdname}-h5repacktest-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove - bounds_latest_latest.h5 - h5repack_attr.h5 - h5repack_attr_refs.h5 - h5repack_deflate.h5 - h5repack_early.h5 - h5repack_ext.h5 - h5repack_fill.h5 - h5repack_filters.h5 - h5repack_fletcher.h5 - h5repack_hlink.h5 - h5repack_layout.h5 - h5repack_layouto.h5 - h5repack_layout2.h5 - h5repack_layout3.h5 - h5repack_layout.UD.h5 - h5repack_named_dtypes.h5 - h5repack_nested_8bit_enum.h5 - h5repack_nested_8bit_enum_deflated.h5 - h5repack_nbit.h5 - h5repack_objs.h5 - h5repack_refs.h5 - h5repack_shuffle.h5 - h5repack_soffset.h5 - h5repack_szip.h5 - # fsm - h5repack_aggr.h5 - h5repack_fsm_aggr_nopersist.h5 - h5repack_fsm_aggr_persist.h5 - h5repack_none.h5 - h5repack_paged_nopersist.h5 - h5repack_paged_persist.h5 + COMMAND ${CMAKE_COMMAND} -E remove ${H5REPACK_CLEANFILES} WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${vfdname} ) - add_test ( - NAME H5REPACK_VFD-${vfdname}-h5repacktest - COMMAND "${CMAKE_COMMAND}" - -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$<TARGET_FILE:h5repacktest>" - -D "TEST_ARGS:STRING=" - -D "TEST_VFD:STRING=${vfdname}" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_OUTPUT=${vfdname}-h5repacktest.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}" - -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" - ) - set_tests_properties (H5REPACK_VFD-${vfdname}-h5repacktest PROPERTIES DEPENDS H5REPACK_VFD-${vfdname}-h5repacktest-clear-objects) - set_tests_properties (H5REPACK_VFD-${vfdname}-h5repacktest PROPERTIES TIMEOUT ${CTEST_SHORT_TIMEOUT}) + if (NOT "h5repacktest" IN_LIST H5REPACK_VFD_${vfdname}_SKIP_TESTS) + add_test ( + NAME H5REPACK_VFD-${vfdname}-h5repacktest + COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5repacktest>" + -D "TEST_ARGS:STRING=" + -D "TEST_VFD:STRING=${vfdname}" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_OUTPUT=${vfdname}-h5repacktest.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}" + -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" + ) + set_tests_properties (H5REPACK_VFD-${vfdname}-h5repacktest PROPERTIES + DEPENDS H5REPACK_VFD-${vfdname}-h5repacktest-clear-objects + TIMEOUT ${CTEST_SHORT_TIMEOUT} + ) + add_test ( + NAME H5REPACK_VFD-${vfdname}-h5repacktest-clean-objects + COMMAND ${CMAKE_COMMAND} -E remove + ${H5REPACK_CLEANFILES} + ) + set_tests_properties (H5REPACK_VFD-${vfdname}-h5repacktest-clean-objects PROPERTIES + DEPENDS H5REPACK_VFD-${vfdname}-h5repacktest + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${vfdname} + ) + endif () endif () endmacro () diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in index 7776c3e..f6e981a 100644 --- a/tools/test/h5repack/h5repack.sh.in +++ b/tools/test/h5repack/h5repack.sh.in @@ -12,10 +12,6 @@ # # Tests for the h5repack tool # -# Modification: -# Pedro Vicente Nunes, 11/15/2006 -# Added $FILEN variables for file names -# srcdir=@srcdir@ @@ -1129,6 +1125,56 @@ TOOLTEST_DUMP() rm -f $outfile } +# This is same as TOOLTEST_DUMP() with comparing h5dump output +# without any option +# +TOOLTEST_DUMP_NO_OPT() +{ + infile=$2 + outfile=out-$1.$2 + expect="$TESTDIR/$1.$2.ddl" + actual="$TESTDIR/out-$1.$2.out" + actual_err="$TESTDIR/out-$1.$2.err" + + shift + shift + + # Run test. + TESTING $H5REPACK $@ + ( + cd $TESTDIR + $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile + ) >$actual 2>$actual_err + RET=$? + if [ $RET != 0 ] ; then + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + else + echo " PASSED" + VERIFY h5dump output $@ + ( + cd $TESTDIR + $RUNSERIAL $H5DUMP_BIN $outfile + ) >$actual 2>$actual_err + cat $actual_err >> $actual + + RET=$? + + fi + + if cmp -s $expect $actual; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected result (*.ddl) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && diff -c $expect $actual |sed 's/^/ /' + fi + + rm -f $actual $actual_err + rm -f $outfile +} + # This is similar to TOOLTEST_DUMP(). # Test h5repack with options added for paged aggregation. # h5stat is used on the repacked file and the expected output diff --git a/tools/test/h5repack/h5repack_plugin.sh.in b/tools/test/h5repack/h5repack_plugin.sh.in index 0331d85..bd7c3a1 100644 --- a/tools/test/h5repack/h5repack_plugin.sh.in +++ b/tools/test/h5repack/h5repack_plugin.sh.in @@ -3,7 +3,7 @@ # Copyright by The HDF Group. # All rights reserved. # -# This file is part of HDF5. The full HDF5 copyright notice, including +# This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in # the COPYING file, which can be found at the root of the source code # distribution tree, or in https://www.hdfgroup.org/licenses. @@ -98,7 +98,7 @@ if [ $? != 0 ]; then fi # setup plugin path -ENVCMD="env HDF5_PLUGIN_PATH=../${PLUGIN_LIBDIR}" +ENVCMD="env HDF5_PLUGIN_PATH=../${PLUGIN_LIBDIR}:${HDF5_PLUGIN_PATH}" COPY_TESTFILES_TO_TESTDIR() { diff --git a/tools/test/h5stat/CMakeLists.txt b/tools/test/h5stat/CMakeLists.txt index a79f61c..19dbe78 100644 --- a/tools/test/h5stat/CMakeLists.txt +++ b/tools/test/h5stat/CMakeLists.txt @@ -6,7 +6,7 @@ project (HDF5_TOOLS_TEST_H5STAT C) # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS AND BUILD_STATIC_LIBS) add_executable (h5stat_gentest ${HDF5_TOOLS_TEST_H5STAT_SOURCE_DIR}/h5stat_gentest.c) - target_include_directories (h5stat_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5stat_gentest PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5stat_gentest STATIC) target_link_libraries (h5stat_gentest PRIVATE ${HDF5_LIB_TARGET}) set_target_properties (h5stat_gentest PROPERTIES FOLDER generator/tools) diff --git a/tools/test/h5stat/CMakeTests.cmake b/tools/test/h5stat/CMakeTests.cmake index c79c0a1..14bb5ea 100644 --- a/tools/test/h5stat/CMakeTests.cmake +++ b/tools/test/h5stat/CMakeTests.cmake @@ -114,6 +114,9 @@ -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () + set_tests_properties (H5STAT-${resultfile} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}" + ) endmacro () macro (ADD_H5_ERR_TEST resultfile resultcode) @@ -138,6 +141,9 @@ -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () + set_tests_properties (H5STAT-${resultfile} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}" + ) endmacro () ############################################################################## @@ -146,17 +152,6 @@ ############################################################################## ############################################################################## - if (HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - foreach (ddl_file ${HDF5_REFERENCE_FILES}) - set (CLEAR_LIST ${CLEAR_LIST} ${ddl_file}.out ${ddl_file}.out.err) - endforeach () - add_test ( - NAME H5STAT-clearall-objects - COMMAND ${CMAKE_COMMAND} -E remove ${CLEAR_LIST} - ) - endif () - # Test for help flag ADD_H5_TEST (h5stat_help1 0 -h) ADD_H5_TEST (h5stat_help2 0 --help) diff --git a/tools/test/h5stat/testh5stat.sh.in b/tools/test/h5stat/testh5stat.sh.in index 9cbedce..65e40c4 100644 --- a/tools/test/h5stat/testh5stat.sh.in +++ b/tools/test/h5stat/testh5stat.sh.in @@ -12,10 +12,6 @@ # # Tests for the h5stat tool # -# Modifications: -# Vailin Choi; July 2013 -# Add tests for -l, -m, -a options -# srcdir=@srcdir@ diff --git a/tools/test/misc/CMakeLists.txt b/tools/test/misc/CMakeLists.txt index fe66e94..df8b43e 100644 --- a/tools/test/misc/CMakeLists.txt +++ b/tools/test/misc/CMakeLists.txt @@ -6,7 +6,7 @@ project (HDF5_TOOLS_TEST_MISC C) # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS AND BUILD_STATIC_LIBS) add_executable (h5repart_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5repart_gentest.c) - target_include_directories (h5repart_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5repart_gentest PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5repart_gentest STATIC) target_link_libraries (h5repart_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (h5repart_gentest PROPERTIES FOLDER generator/tools) @@ -20,7 +20,7 @@ if (HDF5_BUILD_GENERATORS AND BUILD_STATIC_LIBS) endif () add_executable (h5clear_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5clear_gentest.c) - target_include_directories (h5clear_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_TEST_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5clear_gentest PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_TEST_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5clear_gentest STATIC) target_link_libraries (h5clear_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (h5clear_gentest PROPERTIES FOLDER tools) @@ -38,7 +38,7 @@ if (HDF5_BUILD_GENERATORS AND BUILD_STATIC_LIBS) endif () add_executable (h5repart_test ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/repart_test.c) -target_include_directories (h5repart_test PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_include_directories (h5repart_test PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (BUILD_STATIC_LIBS) TARGET_C_PROPERTIES (h5repart_test STATIC) target_link_libraries (h5repart_test PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) @@ -56,7 +56,7 @@ if (HDF5_ENABLE_FORMATTERS) endif () add_executable (clear_open_chk ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/clear_open_chk.c) -target_include_directories (clear_open_chk PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_include_directories (clear_open_chk PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (BUILD_STATIC_LIBS) TARGET_C_PROPERTIES (clear_open_chk STATIC) target_link_libraries (clear_open_chk PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) diff --git a/tools/test/misc/CMakeTestsRepart.cmake b/tools/test/misc/CMakeTestsRepart.cmake index 20ae263..04c74ec 100644 --- a/tools/test/misc/CMakeTestsRepart.cmake +++ b/tools/test/misc/CMakeTestsRepart.cmake @@ -72,6 +72,19 @@ family_to_sec2.h5 ) set_tests_properties (H5REPART-clearall-objects PROPERTIES FIXTURES_SETUP clear_testrepart) + add_test ( + NAME H5REPART-clean-objects + COMMAND ${CMAKE_COMMAND} + -E remove + fst_family00000.h5 + scd_family00000.h5 + scd_family00001.h5 + scd_family00002.h5 + scd_family00003.h5 + family_to_single.h5 + family_to_sec2.h5 + ) + set_tests_properties (H5REPART-clean-objects PROPERTIES FIXTURES_CLEANUP clear_testrepart) # repartition family member size to 20,000 bytes. add_test ( @@ -116,6 +129,7 @@ ) set_tests_properties (H5REPART-h5repart_test PROPERTIES DEPENDS "H5REPART-h5repart_20K;H5REPART-h5repart_5K;H5REPART-h5repart_single;H5REPART-h5repart_sec2" + FIXTURES_REQUIRED clear_testrepart ) set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} diff --git a/tools/test/misc/testh5mkgrp.sh.in b/tools/test/misc/testh5mkgrp.sh.in index aae5c3a..d581fe1 100644 --- a/tools/test/misc/testh5mkgrp.sh.in +++ b/tools/test/misc/testh5mkgrp.sh.in @@ -12,9 +12,6 @@ # # Tests for the h5mkgrp tool # -# Quincey Koziol -# Tuesday, February 13, 2007 -# srcdir=@srcdir@ diff --git a/tools/test/perform/CMakeLists.txt b/tools/test/perform/CMakeLists.txt index 7bf79c5..adc9a04 100644 --- a/tools/test/perform/CMakeLists.txt +++ b/tools/test/perform/CMakeLists.txt @@ -1,44 +1,14 @@ cmake_minimum_required (VERSION 3.12) project (HDF5_TOOLS_TEST_PERFORM C) -# -------------------------------------------------------------------- -# Add the executables -# -------------------------------------------------------------------- - -if (HDF5_BUILD_PERFORM_STANDALONE) - #-- Adding test for h5perf_serial_alone - io_timer.c includes - set (h5perf_serial_alone_SOURCES - ${HDF5_TOOLS_DIR}/lib/io_timer.c - ${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/sio_perf.c - ${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/sio_engine.c - ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_standalone.c - ) - add_executable (h5perf_serial_alone ${h5perf_serial_alone_SOURCES}) - target_include_directories (h5perf_serial_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR};${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") - if (NOT BUILD_SHARED_LIBS) - TARGET_C_PROPERTIES (h5perf_serial_alone STATIC) - target_link_libraries (h5perf_serial_alone PRIVATE ${HDF5_LIB_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>") - else () - TARGET_C_PROPERTIES (h5perf_serial_alone SHARED) - target_link_libraries (h5perf_serial_alone PRIVATE ${HDF5_LIBSH_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>") - endif () - set_target_properties (h5perf_serial_alone PROPERTIES FOLDER perform) - set_property (TARGET h5perf_serial_alone APPEND PROPERTY COMPILE_DEFINITIONS STANDALONE) - - #----------------------------------------------------------------------------- - # Add Target to clang-format - #----------------------------------------------------------------------------- - if (HDF5_ENABLE_FORMATTERS) - clang_format (HDF5_TOOLS_TEST_PERFORM_h5perf_serial_alone_FORMAT h5perf_serial_alone) - endif () -endif () - -#-- Adding test for chunk +#----------------------------------------------------------------------------- +# chunk +#----------------------------------------------------------------------------- set (chunk_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/chunk.c ) add_executable(chunk ${chunk_SOURCES}) -target_include_directories (chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_include_directories (chunk PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (chunk STATIC) target_link_libraries (chunk PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) @@ -48,19 +18,18 @@ else () endif () set_target_properties (chunk PROPERTIES FOLDER perform) -#----------------------------------------------------------------------------- -# Add Target to clang-format -#----------------------------------------------------------------------------- if (HDF5_ENABLE_FORMATTERS) clang_format (HDF5_TOOLS_TEST_PERFORM_chunk_FORMAT chunk) endif () -#-- Adding test for iopipe +#----------------------------------------------------------------------------- +# iopipe +#----------------------------------------------------------------------------- set (iopipe_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/iopipe.c ) add_executable (iopipe ${iopipe_SOURCES}) -target_include_directories (iopipe PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_include_directories (iopipe PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (iopipe STATIC) target_link_libraries (iopipe PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) @@ -70,19 +39,18 @@ else () endif () set_target_properties (iopipe PROPERTIES FOLDER perform) -#----------------------------------------------------------------------------- -# Add Target to clang-format -#----------------------------------------------------------------------------- if (HDF5_ENABLE_FORMATTERS) clang_format (HDF5_TOOLS_TEST_PERFORM_iopipe_FORMAT iopipe) endif () -#-- Adding test for chunk_cache +#----------------------------------------------------------------------------- +# chunk_cache +#----------------------------------------------------------------------------- set (chunk_cache_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/chunk_cache.c ) add_executable (chunk_cache ${chunk_cache_SOURCES}) -target_include_directories (chunk_cache PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_include_directories (chunk_cache PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (chunk_cache STATIC) target_link_libraries (chunk_cache PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) @@ -92,19 +60,18 @@ else () endif () set_target_properties (chunk_cache PROPERTIES FOLDER perform) -#----------------------------------------------------------------------------- -# Add Target to clang-format -#----------------------------------------------------------------------------- if (HDF5_ENABLE_FORMATTERS) clang_format (HDF5_TOOLS_TEST_PERFORM_chunk_cache_FORMAT chunk_cache) endif () -#-- Adding test for overhead +#----------------------------------------------------------------------------- +# overhead +#----------------------------------------------------------------------------- set (overhead_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/overhead.c ) add_executable (overhead ${overhead_SOURCES}) -target_include_directories (overhead PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_include_directories (overhead PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (overhead STATIC) target_link_libraries (overhead PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) @@ -114,19 +81,18 @@ else () endif () set_target_properties (overhead PROPERTIES FOLDER perform) -#----------------------------------------------------------------------------- -# Add Target to clang-format -#----------------------------------------------------------------------------- if (HDF5_ENABLE_FORMATTERS) clang_format (HDF5_TOOLS_TEST_PERFORM_overhead_FORMAT overhead) endif () -#-- Adding test for perf_meta +#----------------------------------------------------------------------------- +# perf_meta +#----------------------------------------------------------------------------- set (perf_meta_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/perf_meta.c ) add_executable (perf_meta ${perf_meta_SOURCES}) -target_include_directories (perf_meta PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_include_directories (perf_meta PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (perf_meta STATIC) target_link_libraries (perf_meta PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) @@ -136,19 +102,18 @@ else () endif () set_target_properties (perf_meta PROPERTIES FOLDER perform) -#----------------------------------------------------------------------------- -# Add Target to clang-format -#----------------------------------------------------------------------------- if (HDF5_ENABLE_FORMATTERS) clang_format (HDF5_TOOLS_TEST_PERFORM_perf_meta_FORMAT perf_meta) endif () -#-- Adding test for zip_perf +#----------------------------------------------------------------------------- +# zip_perf +#----------------------------------------------------------------------------- set (zip_perf_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/zip_perf.c ) add_executable (zip_perf ${zip_perf_SOURCES}) -target_include_directories (zip_perf PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_include_directories (zip_perf PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (zip_perf STATIC) target_link_libraries (zip_perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} ${LINK_COMP_LIBS}) @@ -158,45 +123,10 @@ else () endif () set_target_properties (zip_perf PROPERTIES FOLDER perform) -#----------------------------------------------------------------------------- -# Add Target to clang-format -#----------------------------------------------------------------------------- if (HDF5_ENABLE_FORMATTERS) clang_format (HDF5_TOOLS_TEST_PERFORM_zip_perf_FORMAT zip_perf) endif () -if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL) - if (HDF5_BUILD_PERFORM_STANDALONE) - #-- Adding test for h5perf - set (h5perf_alone_SOURCES - ${HDF5_TOOLS_DIR}/lib/io_timer.c - ${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/pio_perf.c - ${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/pio_engine.c - ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_standalone.c - ) - add_executable (h5perf_alone ${h5perf_alone_SOURCES}) - target_include_directories (h5perf_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR};${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") - if (NOT BUILD_SHARED_LIBS) - TARGET_C_PROPERTIES (h5perf_alone STATIC) - target_link_libraries (h5perf_alone PRIVATE ${HDF5_LIB_TARGET} ${LINK_LIBS} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>") - else () - TARGET_C_PROPERTIES (h5perf_alone SHARED) - target_link_libraries (h5perf_alone PRIVATE ${HDF5_LIBSH_TARGET} ${LINK_LIBS} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>") - endif () - set_target_properties (h5perf_alone PROPERTIES FOLDER perform) - set_property (TARGET h5perf_alone - APPEND PROPERTY COMPILE_DEFINITIONS STANDALONE - ) - - #----------------------------------------------------------------------------- - # Add Target to clang-format - #----------------------------------------------------------------------------- - if (HDF5_ENABLE_FORMATTERS) - clang_format (HDF5_TOOLS_TEST_PERFORM_h5perf_alone_FORMAT h5perf_alone) - endif () - endif () -endif () - if (HDF5_TEST_TOOLS) include (CMakeTests.cmake) endif () diff --git a/tools/test/perform/CMakeTests.cmake b/tools/test/perform/CMakeTests.cmake index 17f4b48..acfe169 100644 --- a/tools/test/perform/CMakeTests.cmake +++ b/tools/test/perform/CMakeTests.cmake @@ -23,12 +23,10 @@ add_custom_target(zip_perf_files ALL COMMENT "Copying files needed by zip_perf t # Add Tests #----------------------------------------------------------------------------- if (HDF5_TEST_SERIAL) - # Remove any output file left over from previous test run - add_test ( - NAME PERFORM_h5perform-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove + set (PERFORM_CLEANFILES chunk.h5 + direct_write.h5 + unix.raw iopipe.h5 iopipe.raw x-diag-rd.dat @@ -36,21 +34,21 @@ if (HDF5_TEST_SERIAL) x-rowmaj-rd.dat x-rowmaj-wr.dat x-gnuplot - h5perf_serial.txt - h5perf_serial.txt.err - chunk.txt - chunk.txt.err - iopipe.txt - iopipe.txt.err - overhead.txt - overhead.txt.err - perf_meta.txt - perf_meta.txt.err - zip_perf-h.txt - zip_perf-h.txt.err - zip_perf.txt - zip_perf.txt.err ) + # Remove any output file left over from previous test run + add_test ( + NAME PERFORM_h5perform-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove ${PERFORM_CLEANFILES} + ) + set_tests_properties (PERFORM_h5perform-clear-objects PROPERTIES FIXTURES_SETUP clear_perform) + + add_test ( + NAME PERFORM_h5perform-clean-objects + COMMAND ${CMAKE_COMMAND} + -E remove ${PERFORM_CLEANFILES} + ) + set_tests_properties (PERFORM_h5perform-clean-objects PROPERTIES FIXTURES_CLEANUP clear_perform) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME PERFORM_h5perf_serial COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5perf_serial>) @@ -69,13 +67,9 @@ if (HDF5_TEST_SERIAL) endif () set_tests_properties (PERFORM_h5perf_serial PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT} - DEPENDS "PERFORM_h5perform-clearall-objects" + FIXTURES_REQUIRED clear_perform ) - if (HDF5_BUILD_PERFORM_STANDALONE) - add_test (NAME PERFORM_h5perf_serial_alone COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5perf_serial_alone>) - endif () - if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME PERFORM_chunk COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:chunk>) else () @@ -92,7 +86,7 @@ if (HDF5_TEST_SERIAL) ) endif () set_tests_properties (PERFORM_chunk PROPERTIES - DEPENDS "PERFORM_h5perform-clearall-objects" + FIXTURES_REQUIRED clear_perform ) if (HDF5_ENABLE_USING_MEMCHECKER) @@ -111,7 +105,7 @@ if (HDF5_TEST_SERIAL) ) endif () set_tests_properties (PERFORM_iopipe PROPERTIES - DEPENDS "PERFORM_h5perform-clearall-objects" + FIXTURES_REQUIRED clear_perform ) if (HDF5_ENABLE_USING_MEMCHECKER) @@ -130,7 +124,7 @@ if (HDF5_TEST_SERIAL) ) endif () set_tests_properties (PERFORM_overhead PROPERTIES - DEPENDS "PERFORM_h5perform-clearall-objects" + FIXTURES_REQUIRED clear_perform ) if (HDF5_ENABLE_USING_MEMCHECKER) @@ -149,7 +143,7 @@ if (HDF5_TEST_SERIAL) ) endif () set_tests_properties (PERFORM_perf_meta PROPERTIES - DEPENDS "PERFORM_h5perform-clearall-objects" + FIXTURES_REQUIRED clear_perform ) if (HDF5_ENABLE_USING_MEMCHECKER) @@ -168,7 +162,7 @@ if (HDF5_TEST_SERIAL) ) endif () set_tests_properties (PERFORM_zip_perf_help PROPERTIES - DEPENDS "PERFORM_h5perform-clearall-objects" + FIXTURES_REQUIRED clear_perform ) if (HDF5_ENABLE_USING_MEMCHECKER) @@ -187,18 +181,12 @@ if (HDF5_TEST_SERIAL) ) endif () set_tests_properties (PERFORM_zip_perf PROPERTIES - DEPENDS "PERFORM_zip_perf_help;PERFORM_h5perform-clearall-objects" + DEPENDS "PERFORM_zip_perf_help" + FIXTURES_REQUIRED clear_perform ) endif () if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL) - if (UNIX) - add_test (NAME MPI_TEST_PERFORM_perf COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:perf> ${MPIEXEC_POSTFLAGS}) - endif () - add_test (NAME MPI_TEST_PERFORM_h5perf COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:h5perf> ${MPIEXEC_POSTFLAGS}) - if (HDF5_BUILD_PERFORM_STANDALONE) - add_test (NAME MPI_TEST_PERFORM_h5perf_alone COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:h5perf_alone> ${MPIEXEC_POSTFLAGS}) - endif () endif () diff --git a/utils/mirror_vfd/CMakeLists.txt b/utils/mirror_vfd/CMakeLists.txt index 4765e2c..ef62417 100644 --- a/utils/mirror_vfd/CMakeLists.txt +++ b/utils/mirror_vfd/CMakeLists.txt @@ -12,7 +12,7 @@ set (mirror_server_SOURCES ${HDF5_UTILS_MIRRORVFD_SOURCE_DIR}/mirror_remote.h ) add_executable (mirror_server ${mirror_server_SOURCES}) -target_include_directories (mirror_server PRIVATE "${HDF5_UTILS_DIR};${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_include_directories (mirror_server PRIVATE "${HDF5_UTILS_DIR};${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (mirror_server STATIC) target_link_libraries (mirror_server PRIVATE ${HDF5_LIB_TARGET}) @@ -37,7 +37,7 @@ endif () set (mirror_server_stop_SOURCES ${HDF5_UTILS_MIRRORVFD_SOURCE_DIR}/mirror_server_stop.c) add_executable (mirror_server_stop ${mirror_server_stop_SOURCES}) -target_include_directories (mirror_server_stop PRIVATE "${HDF5_UTILS_DIR};${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_include_directories (mirror_server_stop PRIVATE "${HDF5_UTILS_DIR};${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (mirror_server_stop STATIC) target_link_libraries (mirror_server_stop PRIVATE ${HDF5_LIB_TARGET}) diff --git a/utils/test/CMakeLists.txt b/utils/test/CMakeLists.txt index 921fbd0..baf2ca5 100644 --- a/utils/test/CMakeLists.txt +++ b/utils/test/CMakeLists.txt @@ -7,7 +7,7 @@ project (HDF5_TEST C) macro (ADD_H5_EXE file) add_executable (${file} ${HDF5_TEST_SOURCE_DIR}/${file}.c) - target_include_directories (${file} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (${file} PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") target_compile_options(${file} PRIVATE "${HDF5_CMAKE_C_FLAGS}") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (${file} STATIC) |