From ba2cfde1fda880bf9d4b18dd439100ee5c4680bb Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 29 Mar 2017 16:44:23 -0500 Subject: Merge/port changes from develop back to 1.8 for tools and cmake --- CMakeLists.txt | 14 +- c++/test/CMakeTests.cmake | 4 +- c++/test/tlinks.cpp | 2 +- config/cmake/CTestCustom.cmake | 15 +- configure.ac | 1 + fortran/examples/CMakeTests.cmake | 2 +- hl/test/CMakeTests.cmake | 6 +- release_docs/INSTALL_CMake.txt | 374 ++++++------ release_docs/USING_HDF5_CMake.txt | 12 +- src/H5PL.c | 359 +++++++++++- src/H5PLpublic.h | 9 +- src/H5private.h | 8 +- src/H5system.c | 3 +- src/H5win32defs.h | 16 +- test/CMakeTests.cmake | 16 +- test/app_ref.c | 4 + test/big.c | 16 +- test/cache.c | 4 - test/cache_api.c | 207 ++++--- test/cache_common.c | 12 +- test/dt_arith.c | 67 ++- test/dtypes.c | 95 +++- test/efc.c | 2 +- test/err_compat.c | 3 +- test/error_test.c | 2 +- test/file_image.c | 19 +- test/freespace.c | 2 + test/h5test.c | 419 ++++++++++---- test/h5test.h | 47 +- test/mf.c | 2 + test/plugin.c | 632 ++++++++++++++------- test/set_extent.c | 3 - test/vfd.c | 149 +++-- testpar/CMakeLists.txt | 2 +- testpar/CMakeTests.cmake | 4 +- testpar/t_mpi.c | 2 +- testpar/t_pflush2.c | 4 +- testpar/t_shapesame.c | 2 +- testpar/testphdf5.c | 2 +- tools/h5copy/CMakeTests.cmake | 24 +- tools/h5copy/h5copy.c | 142 +++-- tools/h5diff/h5diff_common.c | 5 +- tools/h5diff/h5diff_main.c | 3 +- tools/h5dump/CMakeTests.cmake | 48 +- tools/h5dump/CMakeTestsPBITS.cmake | 4 +- tools/h5dump/CMakeTestsXML.cmake | 8 +- tools/h5dump/h5dump_extern.h | 7 +- tools/h5dump/h5dump_xml.c | 138 ++--- tools/h5import/CMakeTests.cmake | 12 +- tools/h5import/h5import.c | 28 +- tools/h5jam/CMakeTests.cmake | 24 +- tools/h5jam/getub.c | 213 ++++--- tools/h5jam/h5jam.c | 192 +++---- tools/h5ls/CMakeTests.cmake | 8 +- tools/h5ls/h5ls.c | 122 ++-- tools/h5repack/CMakeTests.cmake | 38 +- tools/h5repack/dynlib_rpk.c | 4 +- tools/h5repack/dynlib_vrpk.c | 8 +- tools/h5repack/h5repack.c | 28 +- tools/h5repack/h5repack_copy.c | 108 ++-- tools/h5repack/h5repack_main.c | 569 +++++++++---------- tools/h5repack/h5repack_parse.c | 7 +- tools/h5repack/h5repack_plugin.sh.in | 25 +- tools/h5repack/h5repack_verify.c | 7 +- tools/h5repack/h5repacktst.c | 2 +- .../h5repack_layout.h5-plugin_version_test.ddl | 14 +- tools/h5stat/CMakeTests.cmake | 4 +- tools/h5stat/h5stat.c | 2 +- tools/lib/h5diff.c | 10 +- tools/lib/h5diff_attr.c | 6 +- tools/lib/io_timer.c | 5 +- tools/misc/CMakeTests.cmake | 8 +- tools/misc/h5debug.c | 24 +- tools/misc/h5mkgrp.c | 3 - tools/misc/h5repart.c | 89 +-- tools/perform/chunk.c | 477 ++++++++-------- tools/perform/perf_meta.c | 2 +- tools/testfiles/textlinksrc-nodangle-1.ls | 4 +- tools/testfiles/tgroup-1.ls | 4 +- 79 files changed, 2916 insertions(+), 2052 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e413e3..08a65c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -245,7 +245,7 @@ string (REGEX REPLACE ".*LT_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_SOVERS_MINOR ${_lt_vers_am_contents}) string (REGEX REPLACE ".*LT_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_SOVERS_RELEASE ${_lt_vers_am_contents}) -MATH (EXPR H5_SOVERS_MAJOR ${H5_SOVERS_INTERFACE}-${H5_SOVERS_RELEASE}) +math (EXPR H5_SOVERS_MAJOR ${H5_SOVERS_INTERFACE}-${H5_SOVERS_RELEASE}) message (STATUS "SOVERSION: ${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}") string (REGEX REPLACE ".*LT_TOOLS_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_TOOLS_SOVERS_INTERFACE ${_lt_vers_am_contents}) @@ -253,7 +253,7 @@ string (REGEX REPLACE ".*LT_TOOLS_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_TOOLS_SOVERS_MINOR ${_lt_vers_am_contents}) string (REGEX REPLACE ".*LT_TOOLS_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_TOOLS_SOVERS_RELEASE ${_lt_vers_am_contents}) -MATH (EXPR H5_TOOLS_SOVERS_MAJOR ${H5_TOOLS_SOVERS_INTERFACE}-${H5_TOOLS_SOVERS_RELEASE}) + math (EXPR H5_TOOLS_SOVERS_MAJOR ${H5_TOOLS_SOVERS_INTERFACE}-${H5_TOOLS_SOVERS_RELEASE}) message (STATUS "SOVERSION_TOOLS: ${H5_TOOLS_SOVERS_MAJOR}.${H5_TOOLS_SOVERS_RELEASE}.${H5_TOOLS_SOVERS_MINOR}") string (REGEX REPLACE ".*LT_CXX_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_CXX_SOVERS_INTERFACE ${_lt_vers_am_contents}) @@ -261,7 +261,7 @@ string (REGEX REPLACE ".*LT_CXX_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_CXX_SOVERS_MINOR ${_lt_vers_am_contents}) string (REGEX REPLACE ".*LT_CXX_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_CXX_SOVERS_RELEASE ${_lt_vers_am_contents}) -MATH (EXPR H5_CXX_SOVERS_MAJOR ${H5_CXX_SOVERS_INTERFACE}-${H5_CXX_SOVERS_RELEASE}) + math (EXPR H5_CXX_SOVERS_MAJOR ${H5_CXX_SOVERS_INTERFACE}-${H5_CXX_SOVERS_RELEASE}) message (STATUS "SOVERSION_CXX: ${H5_CXX_SOVERS_MAJOR}.${H5_CXX_SOVERS_RELEASE}.${H5_CXX_SOVERS_MINOR}") string (REGEX REPLACE ".*LT_F_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_F_SOVERS_INTERFACE ${_lt_vers_am_contents}) @@ -269,7 +269,7 @@ string (REGEX REPLACE ".*LT_F_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_F_SOVERS_MINOR ${_lt_vers_am_contents}) string (REGEX REPLACE ".*LT_F_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_F_SOVERS_RELEASE ${_lt_vers_am_contents}) -MATH (EXPR H5_F_SOVERS_MAJOR ${H5_F_SOVERS_INTERFACE}-${H5_F_SOVERS_RELEASE}) + math (EXPR H5_F_SOVERS_MAJOR ${H5_F_SOVERS_INTERFACE}-${H5_F_SOVERS_RELEASE}) message (STATUS "SOVERSION_F: ${H5_F_SOVERS_MAJOR}.${H5_F_SOVERS_RELEASE}.${H5_F_SOVERS_MINOR}") string (REGEX REPLACE ".*LT_HL_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_HL_SOVERS_INTERFACE ${_lt_vers_am_contents}) @@ -277,7 +277,7 @@ string (REGEX REPLACE ".*LT_HL_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_HL_SOVERS_MINOR ${_lt_vers_am_contents}) string (REGEX REPLACE ".*LT_HL_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_HL_SOVERS_RELEASE ${_lt_vers_am_contents}) -MATH (EXPR H5_HL_SOVERS_MAJOR ${H5_HL_SOVERS_INTERFACE}-${H5_HL_SOVERS_RELEASE}) + math (EXPR H5_HL_SOVERS_MAJOR ${H5_HL_SOVERS_INTERFACE}-${H5_HL_SOVERS_RELEASE}) message (STATUS "SOVERSION_HL: ${H5_HL_SOVERS_MAJOR}.${H5_HL_SOVERS_RELEASE}.${H5_HL_SOVERS_MINOR}") string (REGEX REPLACE ".*LT_HL_CXX_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_HL_CXX_SOVERS_INTERFACE ${_lt_vers_am_contents}) @@ -285,7 +285,7 @@ string (REGEX REPLACE ".*LT_HL_CXX_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_HL_CXX_SOVERS_MINOR ${_lt_vers_am_contents}) string (REGEX REPLACE ".*LT_HL_CXX_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_HL_CXX_SOVERS_RELEASE ${_lt_vers_am_contents}) -MATH (EXPR H5_HL_CXX_SOVERS_MAJOR ${H5_HL_CXX_SOVERS_INTERFACE}-${H5_HL_CXX_SOVERS_RELEASE}) + math (EXPR H5_HL_CXX_SOVERS_MAJOR ${H5_HL_CXX_SOVERS_INTERFACE}-${H5_HL_CXX_SOVERS_RELEASE}) message (STATUS "SOVERSION_HL_CXX: ${H5_HL_CXX_SOVERS_MAJOR}.${H5_HL_CXX_SOVERS_RELEASE}.${H5_HL_CXX_SOVERS_MINOR}") string (REGEX REPLACE ".*LT_HL_F_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_HL_F_SOVERS_INTERFACE ${_lt_vers_am_contents}) @@ -293,7 +293,7 @@ string (REGEX REPLACE ".*LT_HL_F_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_HL_F_SOVERS_MINOR ${_lt_vers_am_contents}) string (REGEX REPLACE ".*LT_HL_F_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_HL_F_SOVERS_RELEASE ${_lt_vers_am_contents}) -MATH (EXPR H5_HL_F_SOVERS_MAJOR ${H5_HL_F_SOVERS_INTERFACE}-${H5_HL_F_SOVERS_RELEASE}) + math (EXPR H5_HL_F_SOVERS_MAJOR ${H5_HL_F_SOVERS_INTERFACE}-${H5_HL_F_SOVERS_RELEASE}) message (STATUS "SOVERSION_HL_F: ${H5_HL_F_SOVERS_MAJOR}.${H5_HL_F_SOVERS_RELEASE}.${H5_HL_F_SOVERS_MINOR}") #----------------------------------------------------------------------------- diff --git a/c++/test/CMakeTests.cmake b/c++/test/CMakeTests.cmake index cf07ab3..7ffabb2 100644 --- a/c++/test/CMakeTests.cmake +++ b/c++/test/CMakeTests.cmake @@ -50,7 +50,7 @@ if (HDF5_TEST_VFD) set (VFD_LIST ${VFD_LIST} direct) endif () - MACRO (ADD_VFD_TEST vfdname resultcode) + macro (ADD_VFD_TEST vfdname resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdname}") add_test ( @@ -78,7 +78,7 @@ if (HDF5_TEST_VFD) 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 30) endif () - ENDMACRO () + endmacro () # Run test with different Virtual File Driver foreach (vfd ${VFD_LIST}) diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp index 2b05764..03fe02e 100644 --- a/c++/test/tlinks.cpp +++ b/c++/test/tlinks.cpp @@ -615,7 +615,7 @@ void test_links() /* Close 2nd FAPL */ H5Pclose(fapl2_id); - h5_cleanup(FILENAME, fapl_id); + h5_clean_files(FILENAME, fapl_id); /* Test that external links can be used after a library reset. MUST be * called last so the reset doesn't interfere with the property lists. This diff --git a/config/cmake/CTestCustom.cmake b/config/cmake/CTestCustom.cmake index 8d80f19..9a51878 100644 --- a/config/cmake/CTestCustom.cmake +++ b/config/cmake/CTestCustom.cmake @@ -1,5 +1,10 @@ set (CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 3000) - +# Allow full output to go to CDash set to 0 +SET(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 50000) +SET(CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE 50000) +# WARNING! This could be a lot of output and could overwhelm CDash and the +# MySQL DB so this might not be a good idea! + set (CTEST_CUSTOM_WARNING_EXCEPTION ${CTEST_CUSTOM_WARNING_EXCEPTION} "H5detect.c.[0-9]+.[ \t]*:[ \t]*warning C4090:" @@ -16,7 +21,7 @@ set (CTEST_CUSTOM_WARNING_EXCEPTION "note: expanded from macro" # "fpp:[ \t]*warning:[ \t]*cannot remove H5_DEBUG_API - not a predefined macro" ) - + set (CTEST_CUSTOM_MEMCHECK_IGNORE ${CTEST_CUSTOM_MEMCHECK_IGNORE} H5TEST-flush1 #designed to fail @@ -47,6 +52,7 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE H5DUMP_PACKED_BITS-clearall-objects H5DUMP-XML-clearall-objects ######### tools/h5import ######### + H5IMPORT-h5importtest-clear-objects H5IMPORT-clear-objects ######### tools/h5jam ######### H5JAM-SETUP-N_twithub_u10_c-clear-objects @@ -204,6 +210,7 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE H5REPACK_VERIFY_LAYOUT_ALL-layout_long_switches #uses grepTest.cmake H5REPACK_VERIFY_LAYOUT_ALL-layout_short_switches #uses grepTest.cmake H5REPACK-plugin + H5REPACK_CMP-plugin_zero ######### tools/h5stat ######### H5STAT-clearall-objects ######### tools/misc ######### @@ -212,4 +219,8 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE ######### examples ######### EXAMPLES-clear-objects CPP_ex-clear-objects + CPP_ex_tutr-clear-objects + HL_ex-clear-objects + f90_ex-clear-objects + HL_FORTRAN_f90_ex-clear-objects ) diff --git a/configure.ac b/configure.ac index f0eb713..f0a1bb3 100644 --- a/configure.ac +++ b/configure.ac @@ -1581,6 +1581,7 @@ AC_CHECK_FUNCS([gethostname getrusage gettimeofday]) AC_CHECK_FUNCS([lstat rand_r random setsysinfo]) AC_CHECK_FUNCS([signal longjmp setjmp siglongjmp sigsetjmp sigprocmask]) AC_CHECK_FUNCS([snprintf srandom strdup symlink system]) +AC_CHECK_FUNCS([strtoll strtoull]) AC_CHECK_FUNCS([tmpfile asprintf vasprintf vsnprintf waitpid]) ## ---------------------------------------------------------------------- diff --git a/fortran/examples/CMakeTests.cmake b/fortran/examples/CMakeTests.cmake index e616979..87822f3 100644 --- a/fortran/examples/CMakeTests.cmake +++ b/fortran/examples/CMakeTests.cmake @@ -134,7 +134,7 @@ if (HDF5_ENABLE_F2003) endif () set (last_test "f03_ex-shared_${example}") endif () - endforeach (example ${F2003_examples}) + endforeach () endif () if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) diff --git a/hl/test/CMakeTests.cmake b/hl/test/CMakeTests.cmake index e8b7079..c451ab1 100644 --- a/hl/test/CMakeTests.cmake +++ b/hl/test/CMakeTests.cmake @@ -28,13 +28,13 @@ set (HL_REFERENCE_TEST_FILES # -------------------------------------------------------------------- foreach (h5_file ${HL_REFERENCE_TEST_FILES}) HDFTEST_COPY_FILE("${HDF5_HL_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_HL_TEST_BINARY_DIR}/${h5_file}" "hl_test_files") -endforeach (h5_file ${HL_REFERENCE_TEST_FILES}) +endforeach () add_custom_target(hl_test_files ALL COMMENT "Copying files needed by hl_test tests" DEPENDS ${hl_test_files_list}) # -------------------------------------------------------------------- # Macro used to add a unit test # -------------------------------------------------------------------- -MACRO (HL_ADD_TEST hl_name) +macro (HL_ADD_TEST hl_name) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME HL_${hl_name} COMMAND $) else () @@ -55,7 +55,7 @@ MACRO (HL_ADD_TEST hl_name) WORKING_DIRECTORY ${HDF5_HL_TEST_BINARY_DIR} ) endif () -ENDMACRO () +endmacro () # Remove any output file left over from previous test run add_test ( diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 0db7d98..bfec833 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -30,7 +30,7 @@ Obtaining HDF5 source code CMake version 1. We suggest you obtain the latest CMake from the Kitware web site. - The HDF5 1.8."X" product requires a minimum CMake version 3.1.0, + The HDF5 1.8."X" product requires a minimum CMake version 3.2.2, where "X" is the current HDF5 release version. Note: @@ -51,7 +51,7 @@ The following files referenced below are available at the HDF web site: http://www.hdfgroup.org/HDF5/release/cmakebuild.html Single compressed file with all the files needed, including source: - hdf5-1.8.16-CMake.zip or hdf5-1.8.16-CMake.tar.gz + hdf5-1.8.19-CMake.zip or hdf5-1.8.19-CMake.tar.gz Individual files ----------------------------------------------- @@ -688,232 +688,232 @@ set(CTEST_SOURCE_VERSEXT "") #STATIC_ONLY - Default is YES #FORTRAN_LIBRARIES - Default is NO #NO_MAC_FORTRAN - set to TRUE to allow shared libs on a Mac -if(DEFINED CTEST_SCRIPT_ARG) +if (DEFINED CTEST_SCRIPT_ARG) # transform ctest script arguments of the form # script.ctest,var1=value1,var2=value2 # to variables with the respective names set to the respective values - string(REPLACE "," ";" script_args "${CTEST_SCRIPT_ARG}") - foreach(current_var ${script_args}) + string (REPLACE "," ";" script_args "${CTEST_SCRIPT_ARG}") + foreach (current_var ${script_args}) if ("${current_var}" MATCHES "^([^=]+)=(.+)$") - set("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}") - endif() - endforeach() -endif() + set ("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}") + endif () + endforeach () +endif () # build generator must be defined -if(NOT DEFINED BUILD_GENERATOR) - message(FATAL_ERROR "BUILD_GENERATOR must be defined - Unix, VS2015, VS201564, VS2013, VS201364, VS2012, or VS201264") -else() - if(${BUILD_GENERATOR} STREQUAL "Unix") - set(CTEST_CMAKE_GENERATOR "Unix Makefiles") - elseif(${BUILD_GENERATOR} STREQUAL "VS2015") - set(CTEST_CMAKE_GENERATOR "Visual Studio 14 2015") - elseif(${BUILD_GENERATOR} STREQUAL "VS201564") - set(CTEST_CMAKE_GENERATOR "Visual Studio 14 2015 Win64") - elseif(${BUILD_GENERATOR} STREQUAL "VS2013") - set(CTEST_CMAKE_GENERATOR "Visual Studio 12 2013") - elseif(${BUILD_GENERATOR} STREQUAL "VS201364") - set(CTEST_CMAKE_GENERATOR "Visual Studio 12 2013 Win64") - elseif(${BUILD_GENERATOR} STREQUAL "VS2012") - set(CTEST_CMAKE_GENERATOR "Visual Studio 11 2012") - elseif(${BUILD_GENERATOR} STREQUAL "VS201264") - set(CTEST_CMAKE_GENERATOR "Visual Studio 11 2012 Win64") - else() - message(FATAL_ERROR "Invalid BUILD_GENERATOR must be - Unix, VS2015, VS201564, VS2013, VS201364, VS2012, or VS201264") - endif() -endif() +if (NOT DEFINED BUILD_GENERATOR) + message (FATAL_ERROR "BUILD_GENERATOR must be defined - Unix, VS2015, VS201564, VS2013, VS201364, VS2012, or VS201264") +else () + if (${BUILD_GENERATOR} STREQUAL "Unix") + set (CTEST_CMAKE_GENERATOR "Unix Makefiles") + elseif (${BUILD_GENERATOR} STREQUAL "VS2015") + set (CTEST_CMAKE_GENERATOR "Visual Studio 14 2015") + elseif (${BUILD_GENERATOR} STREQUAL "VS201564") + set (CTEST_CMAKE_GENERATOR "Visual Studio 14 2015 Win64") + elseif (${BUILD_GENERATOR} STREQUAL "VS2013") + set (CTEST_CMAKE_GENERATOR "Visual Studio 12 2013") + elseif (${BUILD_GENERATOR} STREQUAL "VS201364") + set (CTEST_CMAKE_GENERATOR "Visual Studio 12 2013 Win64") + elseif (${BUILD_GENERATOR} STREQUAL "VS2012") + set (CTEST_CMAKE_GENERATOR "Visual Studio 11 2012") + elseif (${BUILD_GENERATOR} STREQUAL "VS201264") + set (CTEST_CMAKE_GENERATOR "Visual Studio 11 2012 Win64") + else () + message (FATAL_ERROR "Invalid BUILD_GENERATOR must be - Unix, VS2015, VS201564, VS2013, VS201364, VS2012, or VS201264") + endif () +endif () ################################################################### ### Following Line is one of [Release, RelWithDebInfo, Debug] ##### -set(CTEST_CONFIGURATION_TYPE "$ENV{CMAKE_CONFIG_TYPE}") +set (CTEST_CONFIGURATION_TYPE "$ENV{CMAKE_CONFIG_TYPE}") ################################################################### -if(NOT DEFINED INSTALLDIR) - if(WIN32) - set(INSTALLDIR "C:/Program Files/HDF_Group/HDF5/${CTEST_SOURCE_VERSION}") - else() - set(INSTALLDIR "${CTEST_SCRIPT_DIRECTORY}/HDF_Group/HDF5/${CTEST_SOURCE_VERSION}") - endif() -endif() -if(NOT DEFINED CTEST_CONFIGURATION_TYPE) - set(CTEST_CONFIGURATION_TYPE "Release") -endif() -if(NOT DEFINED CTEST_SOURCE_NAME) - set(CTEST_SOURCE_NAME "hdf5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}") -endif() -if(NOT DEFINED STATIC_ONLY) - set(STATICONLYLIBRARIES "YES") -else() - set(STATICONLYLIBRARIES "NO") -endif() -if(NOT DEFINED FORTRAN_LIBRARIES) - set(FORTRANLIBRARIES "NO") -else() - set(FORTRANLIBRARIES "YES") -endif() - -set(CTEST_BINARY_NAME "build") -set(CTEST_DASHBOARD_ROOT "${CTEST_SCRIPT_DIRECTORY}") -if(WIN32) - set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}") - set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}") -else() - set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}") - set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}") -endif() +if (NOT DEFINED INSTALLDIR) + if (WIN32) + set (INSTALLDIR "C:/Program Files/HDF_Group/HDF5/${CTEST_SOURCE_VERSION}") + else () + set (INSTALLDIR "${CTEST_SCRIPT_DIRECTORY}/HDF_Group/HDF5/${CTEST_SOURCE_VERSION}") + endif () +endif () +if (NOT DEFINED CTEST_CONFIGURATION_TYPE) + set (CTEST_CONFIGURATION_TYPE "Release") +endif () +if (NOT DEFINED CTEST_SOURCE_NAME) + set (CTEST_SOURCE_NAME "hdf5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}") +endif () +if (NOT DEFINED STATIC_ONLY) + set (STATICONLYLIBRARIES "YES") +else () + set (STATICONLYLIBRARIES "NO") +endif () +if (NOT DEFINED FORTRAN_LIBRARIES) + set (FORTRANLIBRARIES "NO") +else () + set(FORTRANLIBRARIES "YES") +endif () + +set (CTEST_BINARY_NAME "build") +set (CTEST_DASHBOARD_ROOT "${CTEST_SCRIPT_DIRECTORY}") +if (WIN32) + set (CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}") + set (CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}") +else () + set (CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}") + set (CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}") +endif () ################################################################### ######### Following describes compiler ############ -if(WIN32) - set(SITE_OS_NAME "Windows") - set(SITE_OS_VERSION "WIN7") - if(${BUILD_GENERATOR} STREQUAL "VS201564") - set(SITE_OS_BITS "64") - set(SITE_COMPILER_NAME "vs2015") - set(SITE_COMPILER_VERSION "14") - elseif(${BUILD_GENERATOR} STREQUAL "VS2015") - set(SITE_OS_BITS "32") - set(SITE_COMPILER_NAME "vs2015") - set(SITE_COMPILER_VERSION "14") - elseif(${BUILD_GENERATOR} STREQUAL "VS201364") - set(SITE_OS_BITS "64") - set(SITE_COMPILER_NAME "vs2013") - set(SITE_COMPILER_VERSION "12") - elseif(${BUILD_GENERATOR} STREQUAL "VS2013") - set(SITE_OS_BITS "32") - set(SITE_COMPILER_NAME "vs2013") - set(SITE_COMPILER_VERSION "12") - elseif(${BUILD_GENERATOR} STREQUAL "VS201264") - set(SITE_OS_BITS "64") - set(SITE_COMPILER_NAME "vs2012") - set(SITE_COMPILER_VERSION "11") - elseif(${BUILD_GENERATOR} STREQUAL "VS2012") - set(SITE_OS_BITS "32") - set(SITE_COMPILER_NAME "vs2012") - set(SITE_COMPILER_VERSION "11") - endif() +if (WIN32) + set (SITE_OS_NAME "Windows") + set (SITE_OS_VERSION "WIN7") + if (${BUILD_GENERATOR} STREQUAL "VS201564") + set (SITE_OS_BITS "64") + set (SITE_COMPILER_NAME "vs2015") + set (SITE_COMPILER_VERSION "14") + elseif (${BUILD_GENERATOR} STREQUAL "VS2015") + set (SITE_OS_BITS "32") + set (SITE_COMPILER_NAME "vs2015") + set (SITE_COMPILER_VERSION "14") + elseif (${BUILD_GENERATOR} STREQUAL "VS201364") + set (SITE_OS_BITS "64") + set (SITE_COMPILER_NAME "vs2013") + set (SITE_COMPILER_VERSION "12") + elseif (${BUILD_GENERATOR} STREQUAL "VS2013") + set (SITE_OS_BITS "32") + set (SITE_COMPILER_NAME "vs2013") + set (SITE_COMPILER_VERSION "12") + elseif (${BUILD_GENERATOR} STREQUAL "VS201264") + set (SITE_OS_BITS "64") + set (SITE_COMPILER_NAME "vs2012") + set (SITE_COMPILER_VERSION "11") + elseif (${BUILD_GENERATOR} STREQUAL "VS2012") + set (SITE_OS_BITS "32") + set (SITE_COMPILER_NAME "vs2012") + set (SITE_COMPILER_VERSION "11") + endif () ## Set the following to unique id your computer ## - set(CTEST_SITE "WIN7${BUILD_GENERATOR}.XXXX") -else() - set(CTEST_CMAKE_GENERATOR "Unix Makefiles") + set (CTEST_SITE "WIN7${BUILD_GENERATOR}.XXXX") +else () + set (CTEST_CMAKE_GENERATOR "Unix Makefiles") ## Set the following to unique id your computer ## - if(APPLE) - set(CTEST_SITE "MAC.XXXX") - else() - set(CTEST_SITE "LINUX.XXXX") - endif() - if(APPLE) - execute_process(COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE) - set(ENV{CC} "${XCODE_CC}") - set(ENV{CXX} "${XCODE_CXX}") - set(CTEST_USE_LAUNCHERS 1) - set(RR_WARNINGS_COMMON "-Wno-format-nonliteral -Wno-cast-align -Wno-unused -Wno-unused-variable -Wno-unused-function -Wno-self-assign -Wno-unused-parameter -Wno-sign-compare") - set(RR_WARNINGS_C "${RR_WARNINGS_COMMON} -Wno-deprecated-declarations -Wno-uninitialized") - set(RR_WARNINGS_CXX "${RR_WARNINGS_COMMON} -Woverloaded-virtual -Wshadow -Wwrite-strings -Wc++11-compat") - set(RR_FLAGS_COMMON "-g -O0 -fstack-protector-all -D_FORTIFY_SOURCE=2") - set(RR_FLAGS_C "${RR_FLAGS_COMMON}") - set(RR_FLAGS_CXX "${RR_FLAGS_COMMON}") - set(ENV{CFLAGS} "${RR_WARNINGS_C} ${RR_FLAGS_C}") - set(ENV{CXXFLAGS} "${RR_WARNINGS_CXX} ${RR_FLAGS_CXX}") - endif() -endif() + if (APPLE) + set (CTEST_SITE "MAC.XXXX") + else () + set (CTEST_SITE "LINUX.XXXX") + endif () + if (APPLE) + execute_process (COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process (COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE) + set (ENV{CC} "${XCODE_CC}") + set (ENV{CXX} "${XCODE_CXX}") + set (CTEST_USE_LAUNCHERS 1) + set (RR_WARNINGS_COMMON "-Wno-format-nonliteral -Wno-cast-align -Wno-unused -Wno-unused-variable -Wno-unused-function -Wno-self-assign -Wno-unused-parameter -Wno-sign-compare") + set (RR_WARNINGS_C "${RR_WARNINGS_COMMON} -Wno-deprecated-declarations -Wno-uninitialized") + set (RR_WARNINGS_CXX "${RR_WARNINGS_COMMON} -Woverloaded-virtual -Wshadow -Wwrite-strings -Wc++11-compat") + set (RR_FLAGS_COMMON "-g -O0 -fstack-protector-all -D_FORTIFY_SOURCE=2") + set (RR_FLAGS_C "${RR_FLAGS_COMMON}") + set (RR_FLAGS_CXX "${RR_FLAGS_COMMON}") + set (ENV{CFLAGS} "${RR_WARNINGS_C} ${RR_FLAGS_C}") + set (ENV{CXXFLAGS} "${RR_WARNINGS_CXX} ${RR_FLAGS_CXX}") + endif () +endif () ################################################################### ################################################################### ######### Following is for submission to CDash ############ ################################################################### -set(MODEL "Experimental") +set (MODEL "Experimental") ################################################################### ################################################################### ##### Following controls CDash submission ##### -#set(LOCAL_SUBMIT "TRUE") +#set (LOCAL_SUBMIT "TRUE") ##### Following controls test process ##### -#set(LOCAL_SKIP_TEST "TRUE") -#set(LOCAL_MEMCHECK_TEST "TRUE") -#set(LOCAL_COVERAGE_TEST "TRUE") +#set (LOCAL_SKIP_TEST "TRUE") +#set (LOCAL_MEMCHECK_TEST "TRUE") +#set (LOCAL_COVERAGE_TEST "TRUE") ##### Following controls cpack command ##### -#set(LOCAL_NO_PACKAGE "TRUE") +#set (LOCAL_NO_PACKAGE "TRUE") ##### Following controls source update ##### -#set(LOCAL_UPDATE "TRUE") -set(REPOSITORY_URL "https://git@bitbucket.hdfgroup.org/scm/hdffv/hdf5.git") -set(REPOSITORY_BRANCH "develop") +#set (LOCAL_UPDATE "TRUE") +set (REPOSITORY_URL "https://git@bitbucket.hdfgroup.org/scm/hdffv/hdf5.git") +set (REPOSITORY_BRANCH "hdf5_1_8") #uncomment to use a compressed source file: *.tar on linux or mac *.zip on windows -#set(CTEST_USE_TAR_SOURCE "${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}") +#set (CTEST_USE_TAR_SOURCE "${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}") ################################################################### ################################################################### -if(${STATICONLYLIBRARIES}) - set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF") +if (${STATICONLYLIBRARIES}) + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF") ######### Following describes computer ############ ## following is optional to describe build ## - set(SITE_BUILDNAME_SUFFIX "STATIC") -endif() + set (SITE_BUILDNAME_SUFFIX "STATIC") +endif () ################################################################### #### fortran #### -if(${FORTRANLIBRARIES}) - set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=ON") +if (${FORTRANLIBRARIES}) + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=ON") ### enable Fortran 2003 depends on HDF5_BUILD_FORTRAN - set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_F2003:BOOL=ON") -else() - set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_F2003:BOOL=ON") +else () + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF") ### enable Fortran 2003 depends on HDF5_BUILD_FORTRAN - set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_F2003:BOOL=OFF") -endif() + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_F2003:BOOL=OFF") +endif () ### change install prefix -set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_INSTALL_PREFIX:PATH=${INSTALLDIR}") -set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCTEST_CONFIGURATION_TYPE:STRING=$ENV{CMAKE_CONFIG_TYPE}") +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_INSTALL_PREFIX:PATH=${INSTALLDIR}") +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCTEST_CONFIGURATION_TYPE:STRING=$ENV{CMAKE_CONFIG_TYPE}") ################################################################### -if(WIN32) - set(BINFILEBASE "HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}") - include(${CTEST_SCRIPT_DIRECTORY}\\HDF5options.cmake) - include(${CTEST_SCRIPT_DIRECTORY}\\CTestScript.cmake) - if(EXISTS "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.exe") - file(COPY "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.exe" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif() - if(EXISTS "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.msi") - file(COPY "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.msi" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif() - if(EXISTS "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.zip") - file(COPY "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.zip" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif() -else() - set(BINFILEBASE "HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}") - include(${CTEST_SCRIPT_DIRECTORY}/HDF5options.cmake) - include(${CTEST_SCRIPT_DIRECTORY}/CTestScript.cmake) - if(APPLE) - if(EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.dmg") - file(COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.dmg" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif() - if(EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.tar.gz") - file(COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif() - if(EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.sh") - file(COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif() - else() - if(CYGWIN) - if(EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.sh") - file(COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif() - if(EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.tar.gz") - file(COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif() - else() - if(EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.sh") - file(COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif() - if(EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.tar.gz") - file(COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif() - endif() - endif() -endif() +if (WIN32) + set (BINFILEBASE "HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}") + include (${CTEST_SCRIPT_DIRECTORY}\\HDF5options.cmake) + include (${CTEST_SCRIPT_DIRECTORY}\\CTestScript.cmake) + if (EXISTS "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.exe") + file (COPY "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.exe" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + if (EXISTS "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.msi") + file (COPY "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.msi" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + if (EXISTS "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.zip") + file (COPY "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.zip" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () +else () + set (BINFILEBASE "HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}") + include (${CTEST_SCRIPT_DIRECTORY}/HDF5options.cmake) + include (${CTEST_SCRIPT_DIRECTORY}/CTestScript.cmake) + if (APPLE) + if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.dmg") + file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.dmg" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.tar.gz") + file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.sh") + file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + else () + if (CYGWIN) + if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.sh") + file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.tar.gz") + file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + else () + if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.sh") + file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.tar.gz") + file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + endif () + endif () +endif () HDF5options.cmake: ############################################################################################# @@ -924,6 +924,10 @@ HDF5options.cmake: ### uncomment/comment and change the following lines for other configuration options ############################################################################################# +#### alternate toolsets #### +#set(CMAKE_GENERATOR_TOOLSET "Intel C++ Compiler 17.0") + +############################################################################################# #### ext libraries #### ### ext libs from tgz @@ -949,7 +953,7 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING ### disable packaging #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_NO_PACKAGES:BOOL=ON") -### Create install package with external libraries (szip, zlib, jpeg) +### Create install package with external libraries (szip, zlib) set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACKAGE_EXTLIBS:BOOL=ON") ############################################################################################# diff --git a/release_docs/USING_HDF5_CMake.txt b/release_docs/USING_HDF5_CMake.txt index 9098f15..589ef03 100644 --- a/release_docs/USING_HDF5_CMake.txt +++ b/release_docs/USING_HDF5_CMake.txt @@ -221,7 +221,9 @@ NOTE: this file is available at the HDF web site: HDF518_Examples.cmake - +Also available at the HDF web site is a CMake application framework template. +You can quickly add files to the framework and execute the script to compile +your application with an installed HDF5 binary. ======================================================================== ctest @@ -269,12 +271,12 @@ if (NOT DEFINED STATIC_ONLY) set (STATICONLYLIBRARIES "YES") else () set (STATICONLYLIBRARIES "NO") -endif() +endif () if (NOT DEFINED FORTRAN_LIBRARIES) set (FORTRANLIBRARIES "NO") else () set (FORTRANLIBRARIES "YES") -endif() +endif () if (NOT DEFINED JAVA_LIBRARIES) set (JAVALIBRARIES "NO") else () @@ -314,7 +316,7 @@ else () endif () if (${JAVALIBRARIES}) set (BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=ON") -else() +else () set (BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=OFF") endif () set (BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF5_PACKAGE_NAME:STRING=@HDF5_PACKAGE@@HDF_PACKAGE_EXT@") @@ -407,7 +409,7 @@ endif () ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res) if (LOCAL_SUBMIT) ctest_submit (PARTS Test) -endif() +endif () if (res GREATER 0) message (FATAL_ERROR "tests FAILED") endif () diff --git a/src/H5PL.c b/src/H5PL.c index 82075f4..0e136a4 100644 --- a/src/H5PL.c +++ b/src/H5PL.c @@ -73,7 +73,7 @@ #define H5PL_CLR_ERROR /* maximum size for expanding env vars */ -#define EXPAND_BUFFER_SIZE 32767 +#define H5PL_EXPAND_BUFFER_SIZE 32767 typedef const void *(__cdecl *H5PL_get_plugin_info_t)(void); @@ -86,7 +86,7 @@ typedef const void *(__cdecl *H5PL_get_plugin_info_t)(void); #define H5PL_HANDLE void * /* Get a handle to a plugin library. Windows: TEXT macro handles Unicode strings */ -#define H5PL_OPEN_DLIB(S) dlopen(S, RTLD_NOW) +#define H5PL_OPEN_DLIB(S) dlopen(S, RTLD_LAZY) /* Get the address of a symbol in dynamic library */ #define H5PL_GET_LIB_FUNC(H,N) dlsym(H,N) @@ -95,7 +95,7 @@ typedef const void *(__cdecl *H5PL_get_plugin_info_t)(void); #define H5PL_CLOSE_LIB(H) dlclose(H) /* Clear error */ -#define H5PL_CLR_ERROR dlerror() +#define H5PL_CLR_ERROR HERROR(H5E_PLUGIN, H5E_CANTGET, "can't dlopen:%s", dlerror()) typedef const void *(*H5PL_get_plugin_info_t)(void); #endif /* H5_HAVE_WIN32_API */ @@ -212,10 +212,13 @@ H5PLset_loading_state(unsigned int plugin_type) { char *preload_path; herr_t ret_value = SUCCEED; /* Return value */ + FUNC_ENTER_API(FAIL) H5TRACE1("e", "Iu", plugin_type); + /* change the bit value of the requested plugin type(s) */ H5PL_plugin_g = plugin_type; + /* check if special ENV variable is set and disable all plugin types */ if(NULL != (preload_path = HDgetenv("HDF5_PLUGIN_PRELOAD"))) { /* Special symbol "::" means no plugin during data reading. */ @@ -243,12 +246,14 @@ herr_t H5PLget_loading_state(unsigned int *plugin_type) { herr_t ret_value = SUCCEED; /* Return value */ + FUNC_ENTER_API(FAIL) H5TRACE1("e", "*Iu", plugin_type); if(plugin_type) *plugin_type = H5PL_plugin_g; - done: + +done: FUNC_LEAVE_API(ret_value) } /* end H5PLget_loading_state() */ @@ -375,6 +380,304 @@ done: /*------------------------------------------------------------------------- + * Function: H5PLappend + * + * Purpose: Insert a plugin path at the end of the list. + * + * Return: Non-negative or success. + * + *------------------------------------------------------------------------- + */ +herr_t +H5PLappend(char* plugin_path) +{ + herr_t ret_value = SUCCEED; /* Return value */ + char *dl_path = NULL; + + FUNC_ENTER_API(FAIL) + if(H5PL_num_paths_g == H5PL_MAX_PATH_NUM) + HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, FAIL, "too many directories in path for table") + if(NULL == plugin_path) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "no path provided") + dl_path = H5MM_strdup(plugin_path); + if(NULL == dl_path) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path") +#ifdef H5_HAVE_WIN32_API + else { /* Expand windows env var*/ + long bufCharCount; + char *tempbuf; + if(NULL == (tempbuf = (char *)H5MM_malloc(H5PL_EXPAND_BUFFER_SIZE))) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for expanded path") + if((bufCharCount = ExpandEnvironmentStrings(dl_path, tempbuf, H5PL_EXPAND_BUFFER_SIZE)) > H5PL_EXPAND_BUFFER_SIZE) { + tempbuf = (char *)H5MM_xfree(tempbuf); + HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, FAIL, "expanded path is too long") + } + if(bufCharCount == 0) { + tempbuf = (char *)H5MM_xfree(tempbuf); + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "failed to expand path") + } + dl_path = (char *)H5MM_xfree(dl_path); + dl_path = H5MM_strdup(tempbuf); + tempbuf = (char *)H5MM_xfree(tempbuf); + } +#endif /* H5_HAVE_WIN32_API */ + if(NULL == (H5PL_path_table_g[H5PL_num_paths_g] = H5MM_strdup(dl_path))) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path") + H5PL_num_paths_g++; + +done: + if(dl_path) + dl_path = (char *)H5MM_xfree(dl_path); + + FUNC_LEAVE_API(ret_value) +} /* end H5PLappend() */ + + +/*------------------------------------------------------------------------- + * Function: H5PLprepend + * + * Purpose: Insert a plugin path at the beginning of the list. + * + * Return: Non-negative or success. + * + *------------------------------------------------------------------------- + */ +herr_t +H5PLprepend(char* plugin_path) +{ + herr_t ret_value = SUCCEED; /* Return value */ + char *dl_path = NULL; + unsigned int plindex; + + FUNC_ENTER_API(FAIL) + if(H5PL_num_paths_g == H5PL_MAX_PATH_NUM) + HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, FAIL, "too many directories in path for table") + if(NULL == plugin_path) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "no path provided") + dl_path = H5MM_strdup(plugin_path); + if(NULL == dl_path) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path") +#ifdef H5_HAVE_WIN32_API + else { /* Expand windows env var*/ + long bufCharCount; + char *tempbuf; + if (NULL == (tempbuf = (char *)H5MM_malloc(H5PL_EXPAND_BUFFER_SIZE))) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for expanded path") + if ((bufCharCount = ExpandEnvironmentStrings(dl_path, tempbuf, H5PL_EXPAND_BUFFER_SIZE)) > H5PL_EXPAND_BUFFER_SIZE) { + tempbuf = (char *)H5MM_xfree(tempbuf); + HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, FAIL, "expanded path is too long") + } + if (bufCharCount == 0) { + tempbuf = (char *)H5MM_xfree(tempbuf); + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "failed to expand path") + } + dl_path = (char *)H5MM_xfree(dl_path); + dl_path = H5MM_strdup(tempbuf); + tempbuf = (char *)H5MM_xfree(tempbuf); + } +#endif /* H5_HAVE_WIN32_API */ + for (plindex = (unsigned int)H5PL_num_paths_g; plindex > 0; plindex--) + H5PL_path_table_g[plindex] = H5PL_path_table_g[plindex - 1]; + if (NULL == (H5PL_path_table_g[0] = H5MM_strdup(dl_path))) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path") + H5PL_num_paths_g++; + +done: + if (dl_path) + dl_path = (char *)H5MM_xfree(dl_path); + + FUNC_LEAVE_API(ret_value) +} /* end H5PLprepend() */ + + +/*------------------------------------------------------------------------- + * Function: H5PLput + * + * Purpose: Replace the path at the specified index. + * + * Return: Non-negative or success. + * + *------------------------------------------------------------------------- + */ +herr_t +H5PLput(char* plugin_path, unsigned int index) +{ + herr_t ret_value = SUCCEED; /* Return value */ + char *dl_path = NULL; + + FUNC_ENTER_API(FAIL) + if(NULL == plugin_path) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "no path provided") + dl_path = H5MM_strdup(plugin_path); + if(NULL == dl_path) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path") +#ifdef H5_HAVE_WIN32_API + else { /* Expand windows env var*/ + long bufCharCount; + char *tempbuf; + if(NULL == (tempbuf = (char *)H5MM_malloc(H5PL_EXPAND_BUFFER_SIZE))) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for expanded path") + if((bufCharCount = ExpandEnvironmentStrings(dl_path, tempbuf, H5PL_EXPAND_BUFFER_SIZE)) > H5PL_EXPAND_BUFFER_SIZE) { + tempbuf = (char *)H5MM_xfree(tempbuf); + HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, FAIL, "expanded path is too long") + } + if(bufCharCount == 0) { + tempbuf = (char *)H5MM_xfree(tempbuf); + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "failed to expand path") + } + dl_path = (char *)H5MM_xfree(dl_path); + dl_path = H5MM_strdup(tempbuf); + tempbuf = (char *)H5MM_xfree(tempbuf); + } +#endif /* H5_HAVE_WIN32_API */ + if(H5PL_path_table_g[index]) + H5PL_path_table_g[index] = (char *)H5MM_xfree(H5PL_path_table_g[index]); + if(NULL == (H5PL_path_table_g[index] = H5MM_strdup(dl_path))) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path") + +done: + if(dl_path) + dl_path = (char *)H5MM_xfree(dl_path); + + FUNC_LEAVE_API(ret_value) +} /* end H5PLput() */ + + +/*------------------------------------------------------------------------- + * Function: H5PLinsert + * + * Purpose: Insert a plugin path at the specified index, moving other paths after the index. + * + * Return: Non-negative or success. + * + *------------------------------------------------------------------------- + */ +herr_t +H5PLinsert(char* plugin_path, unsigned int index) +{ + herr_t ret_value = SUCCEED; /* Return value */ + char *dl_path = NULL; + unsigned int plindex; + + FUNC_ENTER_API(FAIL) + if(H5PL_num_paths_g == H5PL_MAX_PATH_NUM) + HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, FAIL, "too many directories in path for table") + if(NULL == plugin_path) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "no path provided") + dl_path = H5MM_strdup(plugin_path); + if(NULL == dl_path) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path") +#ifdef H5_HAVE_WIN32_API + else { /* Expand windows env var*/ + long bufCharCount; + char *tempbuf; + if(NULL == (tempbuf = (char *)H5MM_malloc(H5PL_EXPAND_BUFFER_SIZE))) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for expanded path") + if((bufCharCount = ExpandEnvironmentStrings(dl_path, tempbuf, H5PL_EXPAND_BUFFER_SIZE)) > H5PL_EXPAND_BUFFER_SIZE) { + tempbuf = (char *)H5MM_xfree(tempbuf); + HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, FAIL, "expanded path is too long") + } + if(bufCharCount == 0) { + tempbuf = (char *)H5MM_xfree(tempbuf); + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "failed to expand path") + } + dl_path = (char *)H5MM_xfree(dl_path); + dl_path = H5MM_strdup(tempbuf); + tempbuf = (char *)H5MM_xfree(tempbuf); + } +#endif /* H5_HAVE_WIN32_API */ + for(plindex = (unsigned int)H5PL_num_paths_g; plindex > index; plindex--) + H5PL_path_table_g[plindex] = H5PL_path_table_g[plindex - 1]; + if(NULL == (H5PL_path_table_g[index] = H5MM_strdup(dl_path))) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path") + H5PL_num_paths_g++; + +done: + if(dl_path) + dl_path = (char *)H5MM_xfree(dl_path); + + FUNC_LEAVE_API(ret_value) +} /* end H5PLinsert() */ + + +/*------------------------------------------------------------------------- + * Function: H5PLremove + * + * Purpose: Remove the plugin path at the specifed index and compacting the list. + * + * Return: Non-negative or success. + * + *------------------------------------------------------------------------- + */ +herr_t +H5PLremove(unsigned int index) +{ + herr_t ret_value = SUCCEED; /* Return value */ + char *dl_path = NULL; + unsigned int plindex; + + FUNC_ENTER_API(FAIL) + if(H5PL_num_paths_g == 0) + HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, FAIL, "no directories in table") + if(NULL == (dl_path = H5PL_path_table_g[index])) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "no directory path at index") + for(plindex = index; plindex < (unsigned int)H5PL_num_paths_g; plindex++) + H5PL_path_table_g[plindex] = H5PL_path_table_g[plindex + 1]; + if(H5PL_path_table_g[plindex]) + dl_path = (char *)H5MM_xfree(dl_path); + H5PL_num_paths_g--; + H5PL_path_table_g[H5PL_num_paths_g] = NULL; + +done: + if(dl_path) + dl_path = (char *)H5MM_xfree(dl_path); + + FUNC_LEAVE_API(ret_value) +} /* end H5PLremove() */ + + +/*------------------------------------------------------------------------- + * Function: H5PLget + * + * Purpose: Query the plugin path at the specified index. + * + * Return: Non-NULL on success/NULL on failure + * + *------------------------------------------------------------------------- + */ +const char* +H5PLget(unsigned int index) +{ + char* ret_value = NULL; /* Return value */ + + FUNC_ENTER_API(NULL) + if(H5PL_num_paths_g == 0) + HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, FAIL, "no directories in table") + if(NULL == (ret_value = H5PL_path_table_g[index])) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "no directory path at index") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5PLget() */ + + +/*------------------------------------------------------------------------- + * Function: H5PLsize + * + * Purpose: Query the size of the current list of plugin paths. + * + * Return: Non-negative or success. + * + *------------------------------------------------------------------------- + */ +unsigned int +H5PLsize(void) +{ + return (unsigned int)H5PL_num_paths_g; +} /* end H5PLsize() */ + + +/*------------------------------------------------------------------------- * Function: H5PL__init_path_table * * Purpose: Initialize the path table. @@ -401,24 +704,31 @@ H5PL__init_path_table(void) */ origin_dl_path = HDgetenv("HDF5_PLUGIN_PATH"); if(NULL == origin_dl_path) - dl_path = HDstrdup(H5PL_DEFAULT_PATH); + dl_path = H5MM_strdup(H5PL_DEFAULT_PATH); else - dl_path = HDstrdup(origin_dl_path); + dl_path = H5MM_strdup(origin_dl_path); if(NULL == dl_path) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path") #ifdef H5_HAVE_WIN32_API else { /* Expand windows env var*/ long bufCharCount; - char tempbuf[EXPAND_BUFFER_SIZE]; - if((bufCharCount = ExpandEnvironmentStrings(dl_path, tempbuf, EXPAND_BUFFER_SIZE)) > EXPAND_BUFFER_SIZE) + char *tempbuf; + if(NULL == (tempbuf = (char *)H5MM_malloc(H5PL_EXPAND_BUFFER_SIZE))) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for expanded path") + if((bufCharCount = ExpandEnvironmentStrings(dl_path, tempbuf, H5PL_EXPAND_BUFFER_SIZE)) > H5PL_EXPAND_BUFFER_SIZE) { + tempbuf = (char *)H5MM_xfree(tempbuf); HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, FAIL, "expanded path is too long") - if(bufCharCount == 0) + } + if(bufCharCount == 0) { + tempbuf = (char *)H5MM_xfree(tempbuf); HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "failed to expand path") + } dl_path = (char *)H5MM_xfree(dl_path); dl_path = H5MM_strdup(tempbuf); + tempbuf = (char *)H5MM_xfree(tempbuf); } -#endif H5_HAVE_WIN32_API +#endif /* H5_HAVE_WIN32_API */ /* Put paths in the path table. They are separated by ":" */ dir = HDstrtok(dl_path, H5PL_PATH_SEPARATOR); @@ -426,7 +736,7 @@ H5PL__init_path_table(void) /* Check for too many directories in path */ if(H5PL_num_paths_g == H5PL_MAX_PATH_NUM) HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, FAIL, "too many directories in path for table") - if(NULL == (H5PL_path_table_g[H5PL_num_paths_g] = HDstrdup(dir))) + if(NULL == (H5PL_path_table_g[H5PL_num_paths_g] = H5MM_strdup(dir))) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path") H5PL_num_paths_g++; dir = HDstrtok(NULL, H5PL_PATH_SEPARATOR); @@ -508,14 +818,9 @@ H5PL__find(H5PL_type_t plugin_type, int type_id, char *dir, const void **info) /* Attempt to open the dynamic library as a filter library */ if((found_in_dir = H5PL__open(plugin_type, pathname, type_id, info)) < 0) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "search in directory failed") - if(found_in_dir) { - /* Indicate success */ - HGOTO_DONE(TRUE) - } /* end if */ - else { - HDassert(pathname); - pathname = (char *)H5MM_xfree(pathname); - } + if(found_in_dir) + HGOTO_DONE(TRUE) /* Indicate success */ + pathname = (char *)H5MM_xfree(pathname); } /* end if */ } /* end while */ @@ -523,8 +828,7 @@ done: if(dirp) if(HDclosedir(dirp) < 0) HDONE_ERROR(H5E_FILE, H5E_CLOSEERROR, FAIL, "can't close directory: %s", HDstrerror(errno)) - if(pathname) - pathname = (char *)H5MM_xfree(pathname); + pathname = (char *)H5MM_xfree(pathname); FUNC_LEAVE_NOAPI(ret_value) } /* end H5PL__find() */ @@ -565,14 +869,9 @@ H5PL__find(H5PL_type_t plugin_type, int type_id, char *dir, const void **info) if((found_in_dir = H5PL__open(plugin_type, pathname, type_id, info)) < 0) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "search in directory failed") - if(found_in_dir) { - /* Indicate success */ - HGOTO_DONE(TRUE) - } /* end if */ - else { - HDassert(pathname); - pathname = (char *)H5MM_xfree(pathname); - } + if(found_in_dir) + HGOTO_DONE(TRUE) /* Indicate success */ + pathname = (char *)H5MM_xfree(pathname); } /* end if */ } while(FindNextFileA(hFind, &fdFile)); /* Find the next file. */ @@ -707,7 +1006,7 @@ H5PL__search_table(H5PL_type_t plugin_type, int type_id, const void **info) const H5Z_class2_t *plugin_info; if(NULL == (get_plugin_info = (H5PL_get_plugin_info_t)H5PL_GET_LIB_FUNC((H5PL_table_g[i]).handle, "H5PLget_plugin_info"))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get function for H5PLget_plugin_info") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get function for H5PLget_plugin_info") if(NULL == (plugin_info = (const H5Z_class2_t *)(*get_plugin_info)())) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get plugin info") diff --git a/src/H5PLpublic.h b/src/H5PLpublic.h index 0296819..f3fe497 100644 --- a/src/H5PLpublic.h +++ b/src/H5PLpublic.h @@ -43,7 +43,14 @@ extern "C" { /* plugin state */ H5_DLL herr_t H5PLset_loading_state(unsigned int plugin_type); -H5_DLL herr_t H5PLget_loading_state(unsigned int *plugin_type/*out*/); +H5_DLL herr_t H5PLget_loading_state(unsigned int* plugin_type/*out*/); +H5_DLL herr_t H5PLappend(char* plugin_path); +H5_DLL herr_t H5PLprepend(char* plugin_path); +H5_DLL herr_t H5PLput(char* plugin_path, unsigned int index); +H5_DLL herr_t H5PLinsert(char* plugin_path, unsigned int index); +H5_DLL herr_t H5PLremove(unsigned int index); +H5_DLL const char* H5PLget(unsigned int index); +H5_DLL unsigned int H5PLsize(void); #ifdef __cplusplus } diff --git a/src/H5private.h b/src/H5private.h index 2e2516a..3c0cb75 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1273,7 +1273,13 @@ typedef off_t h5_stat_size_t; #ifndef HDstrtol #define HDstrtol(S,R,N) strtol(S,R,N) #endif /* HDstrtol */ -H5_DLL int64_t HDstrtoll (const char *s, const char **rest, int base); +#ifndef HDstrtoll + #ifdef H5_HAVE_STRTOLL + #define HDstrtoll(S,R,N) strtoll(S,R,N) + #else + H5_DLL int64_t HDstrtoll (const char *s, const char **rest, int base); + #endif /* H5_HAVE_STRTOLL */ +#endif /* HDstrtoll */ #ifndef HDstrtoul #define HDstrtoul(S,R,N) strtoul(S,R,N) #endif /* HDstrtoul */ diff --git a/src/H5system.c b/src/H5system.c index 3d43a7d..2503161 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -473,6 +473,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) * *------------------------------------------------------------------------- */ +#ifndef HDstrtoll int64_t HDstrtoll(const char *s, const char **rest, int base) { @@ -548,7 +549,7 @@ HDstrtoll(const char *s, const char **rest, int base) *rest = s; return acc; } /* end HDstrtoll() */ - +#endif /*------------------------------------------------------------------------- * Function: HDrand/HDsrand diff --git a/src/H5win32defs.h b/src/H5win32defs.h index 3dab8de..63084d2 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -23,6 +23,11 @@ * */ +/* + * _MSC_VER = 1900 VS2015 + * _MSC_VER = 1800 VS2013 + * _MSC_VER = 1700 VS2012 + */ #ifdef H5_HAVE_WIN32_API typedef struct _stati64 h5_stat_t; @@ -53,13 +58,22 @@ typedef __int64 h5_stat_size_t; #define HDsleep(S) Sleep(S*1000) #define HDstat(S,B) _stati64(S,B) #define HDstrcasecmp(A,B) _stricmp(A,B) -#define HDstrtoull(S,R,N) _strtoui64(S,R,N) #define HDstrdup(S) _strdup(S) #define HDtzset() _tzset() #define HDunlink(S) _unlink(S) #define HDwrite(F,M,Z) _write(F,M,Z) #ifdef H5_HAVE_VISUAL_STUDIO + +#if (_MSC_VER < 1800) + #ifndef H5_HAVE_STRTOLL + #define HDstrtoll(S,R,N) _strtoi64(S,R,N) + #endif /* H5_HAVE_STRTOLL */ + #ifndef H5_HAVE_STRTOULL + #define HDstrtoull(S,R,N) _strtoui64(S,R,N) + #endif /* H5_HAVE_STRTOULL */ +#endif /* MSC_VER < 1800 */ + /* * The (void*) cast just avoids a compiler warning in H5_HAVE_VISUAL_STUDIO */ diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 5fbde25..e8b4bec 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -145,7 +145,7 @@ endif () add_custom_target(HDF5_TEST_LIB_files ALL COMMENT "Copying files needed by HDF5_TEST_LIB tests" DEPENDS ${HDF5_TEST_LIB_files_list}) if (BUILD_SHARED_LIBS AND TEST_SHARED_PROGRAMS) add_custom_target(HDF5_TEST_LIBSH_files ALL COMMENT "Copying files needed by HDF5_TEST_LIBSH tests" DEPENDS ${HDF5_TEST_LIBSH_files_list}) -endif() +endif () # Remove any output file left over from previous test run add_test (NAME H5TEST-clear-testhdf5-objects @@ -776,7 +776,7 @@ if (HDF5_TEST_VFD) endif () # Windows only macro - MACRO (CHECK_VFD_TEST vfdtest vfdname resultcode) + macro (CHECK_VFD_TEST vfdtest vfdname resultcode) if (${vfdtest} STREQUAL "flush1" OR ${vfdtest} STREQUAL "flush2") if (${vfdname} STREQUAL "multi" OR ${vfdname} STREQUAL "split") if (NOT BUILD_SHARED_LIBS AND NOT CMAKE_BUILD_TYPE MATCHES Debug) @@ -819,7 +819,7 @@ if (HDF5_TEST_VFD) COMMAND ${CMAKE_COMMAND} -E echo "SKIP VFD-${vfdname}-${vfdtest}-shared" ) endif () - endif() + endif () else () add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND "${CMAKE_COMMAND}" @@ -884,9 +884,9 @@ if (HDF5_TEST_VFD) ) endif () endif () - ENDMACRO () + endmacro () - MACRO (ADD_VFD_TEST vfdname resultcode) + macro (ADD_VFD_TEST vfdname resultcode) foreach (test ${H5_VFD_TESTS}) if (WIN32) CHECK_VFD_TEST (${test} ${vfdname} ${resultcode}) @@ -979,7 +979,7 @@ if (HDF5_TEST_VFD) ) endif () endif () - ENDMACRO () + endmacro () # Run test with different Virtual File Driver foreach (vfd ${VFD_LIST}) @@ -995,13 +995,13 @@ endif () ############################################################################## if (HDF5_BUILD_GENERATORS) - MACRO (ADD_H5_GENERATOR genfile) + macro (ADD_H5_GENERATOR genfile) add_executable (${genfile} ${HDF5_TEST_SOURCE_DIR}/${genfile}.c) TARGET_NAMING (${genfile} STATIC) TARGET_C_PROPERTIES (${genfile} STATIC " " " ") target_link_libraries (${genfile} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (${genfile} PROPERTIES FOLDER generator/test) - ENDMACRO () + endmacro () # generator executables set (H5_GENERATORS diff --git a/test/app_ref.c b/test/app_ref.c index 3052df7..4b72bcb 100644 --- a/test/app_ref.c +++ b/test/app_ref.c @@ -185,6 +185,10 @@ main (void) PASSED(); + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + + /* Clean up any file(s) created */ h5_reset(); fapl = H5Pcreate (H5P_FILE_ACCESS); h5_cleanup (FILENAME, fapl); diff --git a/test/big.c b/test/big.c index db03c99..9ac4316 100644 --- a/test/big.c +++ b/test/big.c @@ -120,7 +120,7 @@ static hsize_t values_used[WRT_N]; static hsize_t randll(hsize_t limit, int current_index) { - hsize_t acc; + hsize_t acc = 0; int overlap = 1; int i; int tries = 0; @@ -508,7 +508,7 @@ reader(char *filename, hid_t fapl) if('#' != ln[0]) break; i = (int)HDstrtol(ln + 1, &s, 10); - hs_offset[0] = HDstrtoll(s, NULL, 0); + hs_offset[0] = HDstrtoull(s, NULL, 0); HDfprintf(stdout, "#%03d 0x%016Hx%47s", i, hs_offset[0], ""); HDfflush(stdout); @@ -618,8 +618,8 @@ test_sec2(hid_t fapl) quit: /* End with normal return code */ /* Clean up the test file */ - if(h5_cleanup(FILENAME, fapl)) - HDremove(DNAME); + h5_clean_files(FILENAME, fapl); + HDremove(DNAME); return 0; error: @@ -655,8 +655,8 @@ test_stdio(hid_t fapl) quit: /* End with normal return code */ /* Clean up the test file */ - if(h5_cleanup(FILENAME, fapl)) - HDremove(DNAME); + h5_clean_files(FILENAME, fapl); + HDremove(DNAME); HDfflush(stdout); return 0; @@ -716,8 +716,8 @@ test_family(hid_t fapl) quit: /* End with normal return code */ /* Clean up the test file */ - if(h5_cleanup(FILENAME, fapl)) - HDremove(DNAME); + h5_clean_files(FILENAME, fapl); + HDremove(DNAME); return 0; error: diff --git a/test/cache.c b/test/cache.c index df6d805..c0bfbe2 100644 --- a/test/cache.c +++ b/test/cache.c @@ -19,10 +19,6 @@ * This file contains tests for the cache implemented in * H5C.c */ -#include "H5private.h" /* Put this first, so H5open() isn't invoked in public macros */ -#include "h5test.h" -#include "H5Iprivate.h" -#include "H5ACprivate.h" #include "cache_common.h" diff --git a/test/cache_api.c b/test/cache_api.c index 8f556be..1a826db 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -20,11 +20,9 @@ * with the cache implemented in H5C.c */ -#include "h5test.h" -#include "H5Iprivate.h" -#include "H5ACprivate.h" #include "cache_common.h" +/* extern declarations */ /* global variable declarations: */ @@ -50,19 +48,19 @@ static void check_file_mdc_api_errs(void); /**************************************************************************/ /*------------------------------------------------------------------------- - * Function: check_fapl_mdc_api_calls() + * Function: check_fapl_mdc_api_calls() * - * Purpose: Verify that the file access property list related - * metadata cache related API calls are functioning - * correctly. + * Purpose: Verify that the file access property list related + * metadata cache related API calls are functioning + * correctly. * - * Since we have tested the H5C code elsewhere, it should - * be sufficient to verify that the desired configuration - * data is getting to the cache. + * Since we have tested the H5C code elsewhere, it should + * be sufficient to verify that the desired configuration + * data is getting to the cache. * * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/12/04 * *------------------------------------------------------------------------- @@ -131,13 +129,13 @@ check_fapl_mdc_api_calls(void) if ( pass ) { - fapl_id = H5Pcreate(H5P_FILE_ACCESS); + fapl_id = H5Pcreate(H5P_FILE_ACCESS); - if ( fapl_id < 0 ) { + if ( fapl_id < 0 ) { - pass = FALSE; + pass = FALSE; failure_mssg = "H5Pcreate(H5P_FILE_ACCESS) failed.\n"; - } + } } if ( pass ) { @@ -149,7 +147,7 @@ check_fapl_mdc_api_calls(void) if ( result < 0 ) { pass = FALSE; - failure_mssg = "H5Pget_mdc_config() failed.\n"; + failure_mssg = "H5Pget_mdc_config() failed.\n"; } else if (!CACHE_CONFIGS_EQUAL(default_config, scratch, TRUE, TRUE)) { @@ -170,7 +168,7 @@ check_fapl_mdc_api_calls(void) if ( result < 0 ) { pass = FALSE; - failure_mssg = "H5Pset_mdc_config() failed.\n"; + failure_mssg = "H5Pset_mdc_config() failed.\n"; } } @@ -183,7 +181,7 @@ check_fapl_mdc_api_calls(void) if ( result < 0 ) { pass = FALSE; - failure_mssg = "H5Pget_mdc_config() failed.\n"; + failure_mssg = "H5Pget_mdc_config() failed.\n"; } else if ( ! CACHE_CONFIGS_EQUAL(mod_config, scratch, TRUE, TRUE) ) { @@ -197,7 +195,7 @@ check_fapl_mdc_api_calls(void) if ( H5Pclose(fapl_id) < 0 ) { pass = FALSE; - failure_mssg = "H5Pclose() failed.\n"; + failure_mssg = "H5Pclose() failed.\n"; } } @@ -239,11 +237,11 @@ check_fapl_mdc_api_calls(void) if ( file_ptr == NULL ) { pass = FALSE; - failure_mssg = "Can't get file_ptr.\n"; + failure_mssg = "Can't get file_ptr.\n"; - } else { + } else { - cache_ptr = file_ptr->shared->cache; + cache_ptr = file_ptr->shared->cache; } } @@ -262,10 +260,9 @@ check_fapl_mdc_api_calls(void) /* conpare the cache's internal configuration with the expected value */ if ( pass ) { - if ( ! resize_configs_are_equal(&default_auto_size_ctl, \ + if ( ! resize_configs_are_equal(&default_auto_size_ctl, \ &cache_ptr->resize_ctl, TRUE) ) { - pass = FALSE; failure_mssg = "Unexpected value(s) in cache resize_ctl 1.\n"; } @@ -295,7 +292,7 @@ check_fapl_mdc_api_calls(void) if ( result < 0 ) { pass = FALSE; - failure_mssg = "H5Pget_mdc_config() failed.\n"; + failure_mssg = "H5Pget_mdc_config() failed.\n"; } else if (!CACHE_CONFIGS_EQUAL(default_config, scratch, TRUE, TRUE)) { @@ -305,22 +302,22 @@ check_fapl_mdc_api_calls(void) } else if ( H5Pclose(fapl_id) < 0 ) { pass = FALSE; - failure_mssg = "H5Pclose() failed.\n"; + failure_mssg = "H5Pclose() failed.\n"; } } /* close the file and delete it */ if ( pass ) { - if ( H5Fclose(file_id) < 0 ) { + if ( H5Fclose(file_id) < 0 ) { pass = FALSE; - failure_mssg = "H5Fclose() failed.\n"; + failure_mssg = "H5Fclose() failed.\n"; } else if ( HDremove(filename) < 0 ) { pass = FALSE; - failure_mssg = "HDremove() failed.\n"; + failure_mssg = "HDremove() failed.\n"; } } @@ -335,13 +332,13 @@ check_fapl_mdc_api_calls(void) /* Create a FAPL */ if ( pass ) { - fapl_id = H5Pcreate(H5P_FILE_ACCESS); + fapl_id = H5Pcreate(H5P_FILE_ACCESS); - if ( fapl_id < 0 ) { + if ( fapl_id < 0 ) { - pass = FALSE; + pass = FALSE; failure_mssg = "H5Pcreate(H5P_FILE_ACCESS) failed.\n"; - } + } } /* Modify the initial mdc configuration in the FAPL. */ @@ -353,7 +350,7 @@ check_fapl_mdc_api_calls(void) if ( result < 0 ) { pass = FALSE; - failure_mssg = "H5Pset_mdc_config() failed.\n"; + failure_mssg = "H5Pset_mdc_config() failed.\n"; } } @@ -388,7 +385,7 @@ check_fapl_mdc_api_calls(void) if ( file_ptr == NULL ) { pass = FALSE; - failure_mssg = "Can't get file_ptr.\n"; + failure_mssg = "Can't get file_ptr.\n"; } else { @@ -411,10 +408,9 @@ check_fapl_mdc_api_calls(void) /* conpare the cache's internal configuration with the expected value */ if ( pass ) { - if ( ! resize_configs_are_equal(&mod_auto_size_ctl, \ + if ( ! resize_configs_are_equal(&mod_auto_size_ctl, \ &cache_ptr->resize_ctl, TRUE) ) { - pass = FALSE; failure_mssg = "Unexpected value(s) in cache resize_ctl 2.\n"; } @@ -444,7 +440,7 @@ check_fapl_mdc_api_calls(void) if ( result < 0 ) { pass = FALSE; - failure_mssg = "H5Pget_mdc_config() failed.\n"; + failure_mssg = "H5Pget_mdc_config() failed.\n"; } else if ( ! CACHE_CONFIGS_EQUAL(mod_config, scratch, TRUE, TRUE) ) { @@ -454,7 +450,7 @@ check_fapl_mdc_api_calls(void) } else if ( H5Pclose(test_fapl_id) < 0 ) { pass = FALSE; - failure_mssg = "H5Pclose() failed.\n"; + failure_mssg = "H5Pclose() failed.\n"; } } @@ -464,22 +460,22 @@ check_fapl_mdc_api_calls(void) if ( H5Pclose(fapl_id) < 0 ) { pass = FALSE; - failure_mssg = "H5Pclose() failed.\n"; + failure_mssg = "H5Pclose() failed.\n"; } } /* close the file and delete it */ if ( pass ) { - if ( H5Fclose(file_id) < 0 ) { + if ( H5Fclose(file_id) < 0 ) { pass = FALSE; - failure_mssg = "H5Fclose() failed.\n"; + failure_mssg = "H5Fclose() failed.\n"; } else if ( HDremove(filename) < 0 ) { pass = FALSE; - failure_mssg = "HDremove() failed.\n"; + failure_mssg = "HDremove() failed.\n"; } } @@ -493,26 +489,24 @@ check_fapl_mdc_api_calls(void) /*------------------------------------------------------------------------- - * Function: check_file_mdc_api_calls() + * Function: check_file_mdc_api_calls() * - * Purpose: Verify that the file related metadata cache API calls are - * functioning correctly. + * Purpose: Verify that the file related metadata cache API calls are + * functioning correctly. * - * Since we have tested the H5C code elsewhere, it should - * be sufficient to verify that the desired configuration - * data is getting in and out of the cache. Similarly, - * we need only verify that the cache monitoring calls - * return the data that the cache thinks they should return. - * We shouldn't need to verify data correctness beyond that - * point. + * Since we have tested the H5C code elsewhere, it should + * be sufficient to verify that the desired configuration + * data is getting in and out of the cache. Similarly, + * we need only verify that the cache monitoring calls + * return the data that the cache thinks they should return. + * We shouldn't need to verify data correctness beyond that + * point. * * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/14/04 * - * Modifications: - * *------------------------------------------------------------------------- */ @@ -821,15 +815,15 @@ check_file_mdc_api_calls(void) /* close the file and delete it */ if ( pass ) { - if ( H5Fclose(file_id) < 0 ) { + if ( H5Fclose(file_id) < 0 ) { pass = FALSE; - failure_mssg = "H5Fclose() failed.\n"; + failure_mssg = "H5Fclose() failed.\n"; } else if ( HDremove(filename) < 0 ) { pass = FALSE; - failure_mssg = "HDremove() failed.\n"; + failure_mssg = "HDremove() failed.\n"; } } @@ -845,17 +839,16 @@ check_file_mdc_api_calls(void) /*------------------------------------------------------------------------- * Function: mdc_api_call_smoke_check() * - * Purpose: - * - * Return: void + * Purpose: Initial basic functional test to see if there are problems + * with the cache API calls. * - * Programmer: John Mainzer - * 4/14/04 + * NOTE: This test takes some time to run and checks the + * HDF5TestExpress environment variable. * - * Modifications: + * Return: void * - * JRM -- 7/12/06 - * Added progress reporting code. + * Programmer: John Mainzer + * 4/14/04 * *------------------------------------------------------------------------- */ @@ -880,7 +873,7 @@ mdc_api_call_smoke_check(int express_test) hid_t filespace_ids[NUM_DSETS]; hid_t memspace_id = -1; hid_t dataset_ids[NUM_DSETS]; - hid_t properties; + hid_t properties = -1; char dset_name[64]; int i, j, k, l, m, n; herr_t status; @@ -1105,7 +1098,7 @@ mdc_api_call_smoke_check(int express_test) sprintf(dset_name, "/dset%03d", i); dataset_ids[i] = H5Dcreate2(file_id, dset_name, H5T_STD_I32BE, - dataspace_id, H5P_DEFAULT, properties, H5P_DEFAULT); + dataspace_id, H5P_DEFAULT, properties, H5P_DEFAULT); if ( dataset_ids[i] < 0 ) { @@ -1329,9 +1322,9 @@ mdc_api_call_smoke_check(int express_test) } n++; - } + /* close the file spaces we are done with */ i = 1; while ( ( pass ) && ( i < NUM_DSETS ) ) @@ -1450,7 +1443,6 @@ mdc_api_call_smoke_check(int express_test) } n++; - } /* close file space 0 */ @@ -1496,16 +1488,16 @@ mdc_api_call_smoke_check(int express_test) /* close the file and delete it */ if ( pass ) { - if ( H5Fclose(file_id) < 0 ) { + if ( H5Fclose(file_id) < 0 ) { pass = FALSE; - failure_mssg = "H5Fclose() failed.\n"; + failure_mssg = "H5Fclose() failed.\n"; } else if ( HDremove(filename) < 0 ) { pass = FALSE; - failure_mssg = "HDremove() failed.\n"; + failure_mssg = "HDremove() failed.\n"; } } @@ -3000,18 +2992,16 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /*------------------------------------------------------------------------- - * Function: check_fapl_mdc_api_errs() + * Function: check_fapl_mdc_api_errs() * - * Purpose: Verify that the FAPL related MDC API calls reject input - * errors gracefully. + * Purpose: Verify that the FAPL related MDC API calls reject input + * errors gracefully. * * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/19/04 * - * Modifications: - * *------------------------------------------------------------------------- */ @@ -3030,7 +3020,6 @@ check_fapl_mdc_api_errs(void) pass = TRUE; - /* first test H5Pget_mdc_config(). */ @@ -3038,8 +3027,8 @@ check_fapl_mdc_api_errs(void) if ( pass ) { H5E_BEGIN_TRY { - result = H5Pget_mdc_config((hid_t)-1, &scratch); - } H5E_END_TRY; + result = H5Pget_mdc_config((hid_t)-1, &scratch); + } H5E_END_TRY; if ( result >= 0 ) { @@ -3065,7 +3054,7 @@ check_fapl_mdc_api_errs(void) scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER; if ( ( pass ) && - ( ( H5Pget_mdc_config(fapl_id, &scratch) < 0 ) || + ( ( H5Pget_mdc_config(fapl_id, &scratch) < 0) || ( !CACHE_CONFIGS_EQUAL(default_config, scratch, TRUE, TRUE) ) ) ) { pass = FALSE; @@ -3171,18 +3160,16 @@ check_fapl_mdc_api_errs(void) /*------------------------------------------------------------------------- - * Function: check_file_mdc_api_errs() + * Function: check_file_mdc_api_errs() * - * Purpose: Verify that the file related MDC API calls reject input - * errors gracefully. + * Purpose: Verify that the file related MDC API calls reject input + * errors gracefully. * * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/19/04 * - * Modifications: - * *------------------------------------------------------------------------- */ @@ -3215,7 +3202,7 @@ check_file_mdc_api_errs(void) /* setup the file name */ if ( pass ) { - if ( show_progress ) { + if ( show_progress ) { HDfprintf(stdout, "%s: calling h5_fixname().\n", fcn_name); } @@ -3230,7 +3217,7 @@ check_file_mdc_api_errs(void) if ( pass ) { - if ( show_progress ) { + if ( show_progress ) { HDfprintf(stdout, "%s: calling H5Fcreate().\n", fcn_name); } @@ -3252,7 +3239,7 @@ check_file_mdc_api_errs(void) scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER; if ( pass ) { - if ( show_progress ) { + if ( show_progress ) { HDfprintf(stdout, "%s: testing H5Fget_mdc_config() 1.\n", fcn_name); } @@ -3270,7 +3257,7 @@ check_file_mdc_api_errs(void) if ( pass ) { - if ( show_progress ) { + if ( show_progress ) { HDfprintf(stdout, "%s: testing H5Fget_mdc_config() 2.\n", fcn_name); } @@ -3289,7 +3276,7 @@ check_file_mdc_api_errs(void) scratch.version = -1; /* a convenient, invalid value */ if ( pass ) { - if ( show_progress ) { + if ( show_progress ) { HDfprintf(stdout, "%s: testing H5Fget_mdc_config() 3.\n", fcn_name); } @@ -3311,7 +3298,7 @@ check_file_mdc_api_errs(void) scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER; if ( pass ) { - if ( show_progress ) { + if ( show_progress ) { HDfprintf(stdout, "%s: testing H5Fset_mdc_config() 1.\n", fcn_name); } @@ -3329,7 +3316,7 @@ check_file_mdc_api_errs(void) if ( pass ) { - if ( show_progress ) { + if ( show_progress ) { HDfprintf(stdout, "%s: testing H5Fset_mdc_config() 2.\n", fcn_name); } @@ -3348,7 +3335,7 @@ check_file_mdc_api_errs(void) i = 0; while ( ( pass ) && ( i < NUM_INVALID_CONFIGS ) ) { - if ( show_progress ) { + if ( show_progress ) { HDfprintf(stdout, "%s: testing H5Fset_mdc_config() with invalid config %d.\n", @@ -3378,7 +3365,7 @@ check_file_mdc_api_errs(void) /* test H5Fget_mdc_hit_rate() */ if ( pass ) { - if ( show_progress ) { + if ( show_progress ) { HDfprintf(stdout, "%s: testing H5Fget_mdc_hit_rate() 1.\n", fcn_name); @@ -3397,7 +3384,7 @@ check_file_mdc_api_errs(void) if ( pass ) { - if ( show_progress ) { + if ( show_progress ) { HDfprintf(stdout, "%s: testing H5Fget_mdc_hit_rate() 2.\n", fcn_name); @@ -3418,7 +3405,7 @@ check_file_mdc_api_errs(void) /* test H5Freset_mdc_hit_rate_stats() */ if ( pass ) { - if ( show_progress ) { + if ( show_progress ) { HDfprintf(stdout, "%s: testing H5Freset_mdc_hit_rate_stats().\n", fcn_name); @@ -3440,7 +3427,7 @@ check_file_mdc_api_errs(void) /* test H5Fget_mdc_size() */ if ( pass ) { - if ( show_progress ) { + if ( show_progress ) { HDfprintf(stdout, "%s: testing H5Fget_mdc_size() 1.\n", fcn_name); } @@ -3459,7 +3446,7 @@ check_file_mdc_api_errs(void) if ( pass ) { - if ( show_progress ) { + if ( show_progress ) { HDfprintf(stdout, "%s: testing H5Fget_mdc_size() 2.\n", fcn_name); } @@ -3481,7 +3468,7 @@ check_file_mdc_api_errs(void) /* close the file and delete it */ if ( pass ) { - if ( show_progress ) { + if ( show_progress ) { HDfprintf(stdout, "%s: cleaning up from tests.\n", fcn_name); } @@ -3508,22 +3495,17 @@ check_file_mdc_api_errs(void) /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Run tests on the cache code contained in H5C.c + * Purpose: Run tests on the cache code contained in H5C.c * * Return: Success: * - * Failure: - * - * Programmer: John Mainzer + * Programmer: John Mainzer * 6/24/04 * - * Modifications: - * *------------------------------------------------------------------------- */ - int main(void) { @@ -3552,3 +3534,4 @@ main(void) return(0); } /* main() */ + diff --git a/test/cache_common.c b/test/cache_common.c index 5fe68db..6ca3d9f 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -20,9 +20,6 @@ * implemented in H5C.c */ #include "H5private.h" /* Put this first, so H5open() isn't invoked in public macros */ -#include "h5test.h" -#include "H5Cprivate.h" -#include "H5Iprivate.h" #include "H5MFprivate.h" #include "cache_common.h" @@ -338,8 +335,7 @@ static void execute_flush_op(H5F_t *file_ptr, struct test_entry_t *entry_ptr, - -/* address translation funtions: */ +/* address translation functions: */ /*------------------------------------------------------------------------- @@ -357,8 +353,8 @@ static void execute_flush_op(H5F_t *file_ptr, struct test_entry_t *entry_ptr, */ void addr_to_type_and_index(haddr_t addr, - int32_t * type_ptr, - int32_t * index_ptr) + int32_t *type_ptr, + int32_t *index_ptr) { int i; int32_t type; @@ -1577,7 +1573,7 @@ entry_in_cache(H5C_t * cache_ptr, /*------------------------------------------------------------------------- * Function: reset_entries * - * Purpose: reset the contents of the entries arrays to know values. + * Purpose: reset the contents of the entries arrays to known values. * * Return: void * diff --git a/test/dt_arith.c b/test/dt_arith.c index 4337690..8396d38 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -20,8 +20,6 @@ * Purpose: Tests the data type interface (H5T) */ -#include -#include #include "h5test.h" /* Number of elements in each random test */ @@ -645,11 +643,18 @@ test_hard_query(void) } /* end if */ PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); return 0; - error: +error: + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); return 1; } /* end test_hard_query() */ @@ -871,7 +876,11 @@ error: if(saved_buf2) HDfree(saved_buf2); + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /*print statistics*/ + return MAX((int)fails_this_test, 1); } @@ -1290,6 +1299,10 @@ test_derived_flt(void) } /* end if */ PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /*print statistics*/ return 0; @@ -1305,7 +1318,12 @@ test_derived_flt(void) H5Pclose (dxpl_id); H5Fclose (file); } H5E_END_TRY; + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /*print statistics*/ + return MAX((int)fails_this_test, 1); } @@ -1592,6 +1610,10 @@ test_derived_integer(void) HDfree(saved_buf); PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /*print statistics*/ return 0; @@ -1606,7 +1628,12 @@ test_derived_integer(void) H5Pclose (dxpl_id); H5Fclose (file); } H5E_END_TRY; + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /*print statistics*/ + return MAX((int)fails_this_test, 1); } @@ -2601,7 +2628,12 @@ done: if (saved) aligned_free(saved); if (aligned) HDfree(aligned); HDfflush(stdout); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /*print statistics*/ + return (int)fails_all_tests; error: @@ -2609,7 +2641,12 @@ error: if (saved) aligned_free(saved); if (aligned) HDfree(aligned); HDfflush(stdout); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /*print statistics*/ + return MAX((int)fails_all_tests, 1); } @@ -3307,6 +3344,9 @@ done: HDassert(0 && "Should not reach this point!"); return 1; #else + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /* If the source is normalized values, treat the failures as error; @@ -3330,7 +3370,11 @@ error: HDassert(0 && "Should not reach this point!"); return 1; #else + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + if(run_test==TEST_NOOP || run_test==TEST_NORMAL) return MAX((int)fails_all_tests, 1); else if(run_test==TEST_DENORM || run_test==TEST_SPECIAL) @@ -4506,6 +4550,9 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) if (saved) aligned_free(saved); if (aligned) HDfree(aligned); HDfflush(stdout); + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /*print statistics*/ /* If the source is normalized floating values, treat the failures as error; @@ -4520,6 +4567,10 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) if (saved) aligned_free(saved); if (aligned) HDfree(aligned); HDfflush(stdout); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /*print statistics*/ if(run_test==TEST_NORMAL) @@ -5168,6 +5219,10 @@ main(void) *---------------------------------------------------------------------- */ without_hardware_g = TRUE; + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /* Test software floating-point conversion functions */ @@ -5183,8 +5238,14 @@ main(void) /* Test software integer-float conversion functions */ nerrors += run_int_fp_conv("soft"); + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + if (nerrors) { printf("***** %lu FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S"); diff --git a/test/dtypes.c b/test/dtypes.c index 7c2ad7b..e06c81f 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -20,8 +20,6 @@ * Purpose: Tests the datatype interface (H5T) */ -#include -#include #include "h5test.h" #include "H5srcdir.h" #include "H5Iprivate.h" /* For checking that datatype id's don't leak */ @@ -769,11 +767,20 @@ test_compound_2(void) CHECK_NMEMBS(nmembs , st, dt) PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return 0; - error: +error: + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return 1; } @@ -888,11 +895,19 @@ test_compound_3(void) CHECK_NMEMBS(nmembs, st, dt) PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); return 0; - error: +error: + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return 1; } @@ -1015,11 +1030,19 @@ test_compound_4(void) CHECK_NMEMBS(nmembs, st, dt) PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); return 0; - error: +error: + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return 1; } @@ -1226,11 +1249,19 @@ test_compound_6(void) CHECK_NMEMBS(nmembs, st, dt) PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); return 0; - error: +error: + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return 1; } @@ -1365,11 +1396,19 @@ test_compound_7(void) } /* end if */ PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); return 0; - error: +error: + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return 1; } @@ -4229,6 +4268,10 @@ test_conv_str_1(void) HDfree(buf); PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); return 0; @@ -4241,7 +4284,11 @@ error: if(buf) HDfree(buf); + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return 1; } @@ -4304,7 +4351,11 @@ error: if(buf) HDfree(buf); + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return ret_value; } @@ -4418,7 +4469,11 @@ error: if(tag) H5free_memory(tag); /* Technically allocated by API call */ + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return ret_value; /* Number of errors */ } @@ -4490,7 +4545,11 @@ error: if(buf) HDfree(buf); + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return ret_value; } @@ -4657,13 +4716,22 @@ test_conv_bitfield(void) H5Tclose(st); H5Tclose(dt); PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); return 0; - error: +error: H5Tclose(st); H5Tclose(dt); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return 1; } @@ -4781,14 +4849,18 @@ test_bitfield_funcs(void) retval = 0; - error: - +error: if (retval == -1) retval = 1; H5free_memory(tag); H5Tclose(ntype); H5Tclose(type); if (retval == 0) PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return retval; } @@ -7423,8 +7495,10 @@ main(void) #ifndef H5_NO_DEPRECATED_SYMBOLS nerrors += test_deprec(fapl); #endif /* H5_NO_DEPRECATED_SYMBOLS */ + h5_cleanup(FILENAME, fapl); /*must happen before first reset*/ reset_hdf5(); + nerrors += test_conv_str_1(); nerrors += test_conv_str_2(); nerrors += test_conv_str_3(); @@ -7452,6 +7526,7 @@ main(void) nerrors += test_opaque(); nerrors += test_set_order(); nerrors += test_utf_ascii_conv(); + if(nerrors) { printf("***** %lu FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S"); diff --git a/test/efc.c b/test/efc.c index ff4f738..167308f 100644 --- a/test/efc.c +++ b/test/efc.c @@ -3200,7 +3200,7 @@ main(void) puts("All external file cache tests passed."); - h5_cleanup(FILENAME, fapl_id); + h5_clean_files(FILENAME, fapl_id); return 0; diff --git a/test/err_compat.c b/test/err_compat.c index 576433e..7779ddc 100644 --- a/test/err_compat.c +++ b/test/err_compat.c @@ -500,7 +500,7 @@ main(void) } if(H5Fclose(file) < 0) TEST_ERROR ; - h5_cleanup(FILENAME, fapl); + h5_clean_files(FILENAME, fapl); printf("All error API tests passed.\n"); return 0; @@ -510,3 +510,4 @@ main(void) return 1; } #endif /* H5_NO_DEPRECATED_SYMBOLS */ + diff --git a/test/error_test.c b/test/error_test.c index 64f301d..ee181b1 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -756,7 +756,7 @@ main(void) if(test_filter_error(filename) < 0) TEST_ERROR; - h5_cleanup(FILENAME, fapl); + h5_clean_files(FILENAME, fapl); HDfprintf(stderr, "\nAll error API tests passed.\n"); return 0; diff --git a/test/file_image.c b/test/file_image.c index b1b9d47..d9c782a 100644 --- a/test/file_image.c +++ b/test/file_image.c @@ -643,7 +643,7 @@ test_core(void) if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Release resources */ - h5_cleanup(FILENAME, fapl); + h5_clean_files(FILENAME, fapl); HDfree(udata); HDfree(file_image); HDremove(copied_filename); @@ -890,8 +890,7 @@ test_get_file_image(const char * test_banner, VERIFY(err == SUCCEED, "H5Pclose(core_fapl_id) failed."); /* tidy up */ - result = h5_cleanup(FILENAME2, fapl); - VERIFY(result != 0, "h5_cleanup() failed."); + h5_clean_files(FILENAME2, fapl); /* discard the image buffer if it exists */ if(image_ptr != NULL) @@ -1039,8 +1038,7 @@ test_get_file_image_error_rejection(void) VERIFY(err == SUCCEED, "H5Fclose(file_id) failed."); /* tidy up */ - result = h5_cleanup(FILENAME2, fapl_id); - VERIFY(result != 0, "h5_cleanup(1) failed."); + h5_clean_files(FILENAME2, fapl_id); /* discard the image buffer if it exists */ if(image_ptr != NULL) @@ -1145,8 +1143,7 @@ test_get_file_image_error_rejection(void) VERIFY(err == SUCCEED, "H5Fclose(2) failed."); /* tidy up */ - result = h5_cleanup(FILENAME2, fapl_id); - VERIFY(result != 0, "h5_cleanup(2 failed."); + h5_clean_files(FILENAME2, fapl_id); /************************** Test #3 **********************************/ /* set up a split file driver test file, and try to get its image @@ -1208,8 +1205,7 @@ test_get_file_image_error_rejection(void) VERIFY(err == SUCCEED, "H5Fclose(2) failed."); /* tidy up */ - result = h5_cleanup(FILENAME2, fapl_id); - VERIFY(result != 0, "h5_cleanup(2 failed."); + h5_clean_files(FILENAME2, fapl_id); /************************** Test #4 **********************************/ /* set up a family file driver test file, and try to get its image @@ -1269,8 +1265,7 @@ test_get_file_image_error_rejection(void) VERIFY(err == SUCCEED, "H5Fclose(2) failed."); /* tidy up */ - result = h5_cleanup(FILENAME2, fapl_id); - VERIFY(result != 0, "h5_cleanup(2 failed."); + h5_clean_files(FILENAME2, fapl_id); PASSED(); @@ -1340,6 +1335,8 @@ main(void) errors += test_get_file_image_error_rejection(); + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); if(errors) { printf("***** %d File Image TEST%s FAILED! *****\n", diff --git a/test/freespace.c b/test/freespace.c index 1338ae7..f82c1f6 100644 --- a/test/freespace.c +++ b/test/freespace.c @@ -2841,6 +2841,8 @@ main(void) if(env_h5_drvr == NULL) env_h5_drvr = "nomatch"; + h5_reset(); + fapl = h5_fileaccess(); /* make sure alignment is not set for tests to succeed */ diff --git a/test/h5test.c b/test/h5test.c index 4d841f1..188c12f 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -22,8 +22,7 @@ */ #undef NDEBUG /*override -DNDEBUG */ -#include -#include + #include "h5test.h" #include "H5srcdir.h" @@ -75,7 +74,7 @@ char *paraprefix = NULL; /* for command line option para-prefix */ MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */ #endif -#define READ_BUF_SIZE 4096 +#define READ_BUF_SIZE 65536 /* * These are the letters that are appended to the file name when generating @@ -91,6 +90,12 @@ MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */ */ static const char *multi_letters = "msbrglo"; +/* Length of multi-file VFD filename buffers */ +#define H5TEST_MULTI_FILENAME_LEN 1024 + +/* Previous error reporting function */ +static H5E_auto2_t err_func = NULL; + static herr_t h5_errors(hid_t estack, void *client_data); static char * h5_fixname_real(const char *base_name, hid_t fapl, const char *suffix, char *fullname, size_t size); @@ -120,77 +125,228 @@ h5_errors(hid_t estack, void H5_ATTR_UNUSED *client_data) return 0; } - + /*------------------------------------------------------------------------- - * Function: h5_cleanup + * Function: h5_clean_files * - * Purpose: Cleanup temporary test files. + * Purpose: Cleanup temporary test files (always). * base_name contains the list of test file names. - * The file access property list is also closed. * - * Return: Non-zero if cleanup actions were performed; zero otherwise. + * Return: void * - * Programmer: Albert Cheng - * May 28, 1998 + * Programmer: Neil Fortner + * June 1, 2015 * *------------------------------------------------------------------------- */ -int -h5_cleanup(const char *base_name[], hid_t fapl) +void +h5_clean_files(const char *base_name[], hid_t fapl) { - int retval = 0; + int i; - if(GetTestCleanup()) { - int i; + for(i = 0; base_name[i]; i++) { + char filename[1024]; + char temp[2048]; + hid_t driver; + + if(NULL == h5_fixname(base_name[i], fapl, filename, sizeof(filename))) + continue; - for(i = 0; base_name[i]; i++) { - char filename[1024]; - char temp[2048]; - hid_t driver; + driver = H5Pget_driver(fapl); - if(NULL == h5_fixname(base_name[i], fapl, filename, sizeof(filename))) - continue; + if(driver == H5FD_FAMILY) { + int j; - driver = H5Pget_driver(fapl); + for(j = 0; /*void*/; j++) { + HDsnprintf(temp, sizeof temp, filename, j); - if(driver == H5FD_FAMILY) { - int j; + if(HDaccess(temp, F_OK) < 0) + break; - for(j = 0; /*void*/; j++) { - HDsnprintf(temp, sizeof temp, filename, j); + HDremove(temp); + } /* end for */ + } else if(driver == H5FD_CORE) { + hbool_t backing; /* Whether the core file has backing store */ - if(HDaccess(temp, F_OK) < 0) - break; + H5Pget_fapl_core(fapl, NULL, &backing); - HDremove(temp); - } /* end for */ - } else if(driver == H5FD_CORE) { - hbool_t backing; /* Whether the core file has backing store */ + /* If the file was stored to disk with bacing store, remove it */ + if(backing) + HDremove(filename); + } else if (driver == H5FD_MULTI) { + H5FD_mem_t mt; - H5Pget_fapl_core(fapl, NULL, &backing); + HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES); - /* If the file was stored to disk with bacing store, remove it */ - if(backing) - HDremove(filename); - } else if (driver == H5FD_MULTI) { - H5FD_mem_t mt; + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) { + HDsnprintf(temp, sizeof temp, "%s-%c.h5", filename, multi_letters[mt]); + HDremove(temp); /*don't care if it fails*/ + } /* end for */ + } else { + HDremove(filename); + } + } /* end for */ - HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES); + /* Close the FAPL used to access the file */ + H5Pclose(fapl); - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) { - HDsnprintf(temp, sizeof temp, "%s-%c.h5", filename, multi_letters[mt]); - HDremove(temp); /*don't care if it fails*/ - } /* end for */ - } else { - HDremove(filename); - } + return; +} /* end h5_clean_files() */ + + +/*------------------------------------------------------------------------- + * Function: h5_delete_test_file + * + * Purpose Clean up temporary test files. + * + * When a test calls h5_fixname() to get a VFD-dependent + * test file name, this function can be used to clean it up. + * + * Return: void + * + * Since this is a cleanup file, we don't care if it fails. + * + * Programmer: Dana Robinson + * February 2016 + * + *------------------------------------------------------------------------- + */ +void +h5_delete_test_file(const char *base_name, hid_t fapl) +{ + char filename[1024]; /* VFD-dependent filename to delete */ + char sub_filename[2048]; /* sub-files in multi & family VFDs */ + hid_t driver = -1; /* VFD ID */ + + /* Get the VFD-dependent filename */ + if(NULL == h5_fixname(base_name, fapl, filename, sizeof(filename))) + return; + + driver = H5Pget_driver(fapl); + + if(driver == H5FD_FAMILY) { + int j; + for(j = 0; /*void*/; j++) { + HDsnprintf(sub_filename, sizeof(sub_filename), filename, j); + + /* If we can't access the file, it probably doesn't exist + * and we are done deleting the sub-files. + */ + if(HDaccess(sub_filename, F_OK) < 0) + break; + + HDremove(sub_filename); + } /* end for */ + } else if(driver == H5FD_CORE) { + hbool_t backing; /* Whether the core file has backing store */ + + H5Pget_fapl_core(fapl, NULL, &backing); + + /* If the file was stored to disk with bacing store, remove it */ + if(backing) + HDremove(filename); + } else if (driver == H5FD_MULTI) { + H5FD_mem_t mt; + + HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); + + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) { + HDsnprintf(sub_filename, sizeof(sub_filename), "%s-%c.h5", filename, multi_letters[mt]); + HDremove(sub_filename); } /* end for */ + } else { + HDremove(filename); + } /* end if */ + + return; +} /* end h5_delete_test_file() */ + + +/*------------------------------------------------------------------------- + * Function: h5_delete_all_test_files + * + * Purpose Clean up temporary test files. + * + * When a test calls h5_fixname() get a VFD-dependent + * test file name, this function can be used to clean it up. + * + * This function takes an array of filenames that ends with + * a NULL string and cleans them all. + * + * Return: void + * + * Since this is a cleanup file, we don't care if it fails. + * + * Programmer: Dana Robinson + * February 2016 + * + *------------------------------------------------------------------------- + */ +void +h5_delete_all_test_files(const char *base_name[], hid_t fapl) +{ + int i; /* iterator */ + + for(i = 0; base_name[i]; i++) { + h5_delete_test_file(base_name[i], fapl); + } /* end for */ + + return; +} /* end h5_delete_all_test_files() */ + + +/*------------------------------------------------------------------------- + * Function: h5_cleanup + * + * Purpose: Cleanup temporary test files. + * base_name contains the list of test file names. + * The file access property list is also closed. + * + * Return: Non-zero if cleanup actions were performed; zero otherwise. + * + * Programmer: Albert Cheng + * May 28, 1998 + * + *------------------------------------------------------------------------- + */ +int +h5_cleanup(const char *base_name[], hid_t fapl) +{ + int retval = 0; + + if(GetTestCleanup()) { + /* Clean up files in base_name, and the FAPL */ + h5_clean_files(base_name, fapl); retval = 1; } /* end if */ - H5Pclose(fapl); + /* Restore the original error reporting routine */ + h5_restore_err(); + return retval; +} /* end h5_cleanup() */ + + +/*------------------------------------------------------------------------- + * Function: h5_restore_err + * + * Purpose: Restore the default error handler. + * + * Return: N/A + * + * Programmer: Quincey Koziol + * Sept 10, 2015 + * + *------------------------------------------------------------------------- + */ +void +h5_restore_err(void) +{ + /* Restore the original error reporting routine */ + HDassert(err_func != NULL); + H5Eset_auto2(H5E_DEFAULT, err_func, NULL); + err_func = NULL; } @@ -212,6 +368,10 @@ h5_reset(void) HDfflush(stdout); HDfflush(stderr); H5close(); + + /* Save current error stack reporting routine and redirect to our local one */ + HDassert(err_func == NULL); + H5Eget_auto2(H5E_DEFAULT, &err_func, NULL); H5Eset_auto2(H5E_DEFAULT, h5_errors, NULL); /* @@ -233,12 +393,12 @@ h5_reset(void) */ sprintf(filename, "/tmp/h5emit-%05d.h5", HDgetpid()); H5E_BEGIN_TRY { - hid_t file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, - H5P_DEFAULT); - hid_t grp = H5Gcreate2(file, "emit", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Gclose(grp); - H5Fclose(file); - HDunlink(filename); + hid_t file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, + H5P_DEFAULT); + hid_t grp = H5Gcreate2(file, "emit", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Gclose(grp); + H5Fclose(file); + HDunlink(filename); } H5E_END_TRY; } #endif /* OLD_WAY */ @@ -528,30 +688,27 @@ h5_rmprefix(const char *filename) const char *ret_ptr; if ((ret_ptr = HDstrstr(filename, ":")) == NULL) - ret_ptr = filename; + ret_ptr = filename; else - ret_ptr++; + ret_ptr++; return(ret_ptr); } /*------------------------------------------------------------------------- - * Function: h5_fileaccess - * - * Purpose: Returns a file access template which is the default template - * but with a file driver set according to the constant or - * environment variable HDF5_DRIVER + * Function: h5_fileaccess * - * Return: Success: A file access property list + * Purpose: Returns a file access template which is the default template + * but with a file driver set according to the constant or + * environment variable HDF5_DRIVER * - * Failure: -1 + * Return: Success: A file access property list + * Failure: -1 * * Programmer: Robb Matzke * Thursday, November 19, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ hid_t @@ -559,50 +716,61 @@ h5_fileaccess(void) { const char *val = NULL; const char *name; - char s[1024]; - hid_t fapl = -1; + char s[1024]; + hid_t fapl = -1; /* First use the environment variable, then the constant */ val = HDgetenv("HDF5_DRIVER"); #ifdef HDF5_DRIVER - if (!val) + if(!val) val = HDF5_DRIVER; #endif - if ((fapl=H5Pcreate(H5P_FILE_ACCESS))<0) + if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) return -1; - if (!val || !*val) - return fapl; /*use default*/ + if(!val || !*val) + return fapl; /* use default */ HDstrncpy(s, val, sizeof s); s[sizeof(s)-1] = '\0'; - if (NULL==(name=HDstrtok(s, " \t\n\r"))) return fapl; + if(NULL == (name = HDstrtok(s, " \t\n\r"))) + return fapl; - if (!HDstrcmp(name, "sec2")) { + if(!HDstrcmp(name, "sec2")) { /* Unix read() and write() system calls */ - if (H5Pset_fapl_sec2(fapl)<0) return -1; - } else if (!HDstrcmp(name, "stdio")) { + if (H5Pset_fapl_sec2(fapl) < 0) + return -1; + } + else if(!HDstrcmp(name, "stdio")) { /* Standard C fread() and fwrite() system calls */ - if (H5Pset_fapl_stdio(fapl)<0) return -1; - } else if (!HDstrcmp(name, "core")) { + if (H5Pset_fapl_stdio(fapl) < 0) + return -1; + } + else if(!HDstrcmp(name, "core")) { /* In-memory driver settings (backing store on, 1 MB increment) */ - if (H5Pset_fapl_core(fapl, (size_t)1, TRUE)<0) return -1; - } else if (!HDstrcmp(name, "core_paged")) { + if(H5Pset_fapl_core(fapl, (size_t)1, TRUE) < 0) + return -1; + } + else if(!HDstrcmp(name, "core_paged")) { /* In-memory driver with write tracking and paging on */ - if (H5Pset_fapl_core(fapl, (size_t)1, TRUE)<0) return -1; - if (H5Pset_core_write_tracking(fapl, TRUE, (size_t)524288)<0) return -1; - } else if (!HDstrcmp(name, "split")) { + if(H5Pset_fapl_core(fapl, (size_t)1, TRUE) < 0) + return -1; + if(H5Pset_core_write_tracking(fapl, TRUE, (size_t)4096) < 0) + return -1; + } + else if(!HDstrcmp(name, "split")) { /* Split meta data and raw data each using default driver */ - if (H5Pset_fapl_split(fapl, + if(H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, - "-r.h5", H5P_DEFAULT)<0) + "-r.h5", H5P_DEFAULT) < 0) return -1; - } else if (!HDstrcmp(name, "multi")) { + } + else if(!HDstrcmp(name, "multi")) { /* Multi-file driver, general case of the split driver */ H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; hid_t memb_fapl[H5FD_MEM_NTYPES]; const char *memb_name[H5FD_MEM_NTYPES]; - char sv[H5FD_MEM_NTYPES][1024]; + char *sv[H5FD_MEM_NTYPES]; haddr_t memb_addr[H5FD_MEM_NTYPES]; H5FD_mem_t mt; @@ -613,45 +781,52 @@ h5_fileaccess(void) HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES); for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { - memb_fapl[mt] = H5P_DEFAULT; - sprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); + memb_fapl[mt] = H5P_DEFAULT; + if(NULL == (sv[mt] = (char *)HDmalloc(H5TEST_MULTI_FILENAME_LEN))) + return -1; + HDsprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); memb_name[mt] = sv[mt]; memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10); } /* end for */ - if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, - memb_addr, FALSE)<0) { + if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0) return -1; - } - } else if (!HDstrcmp(name, "family")) { + + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) + HDfree(sv[mt]); + } + else if(!HDstrcmp(name, "family")) { hsize_t fam_size = 100*1024*1024; /*100 MB*/ /* Family of files, each 1MB and using the default driver */ - if ((val=HDstrtok(NULL, " \t\n\r"))) + if((val = HDstrtok(NULL, " \t\n\r"))) fam_size = (hsize_t)(HDstrtod(val, NULL) * 1024*1024); - if (H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0) + if(H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0) return -1; - } else if (!HDstrcmp(name, "log")) { + } + else if(!HDstrcmp(name, "log")) { unsigned log_flags = H5FD_LOG_LOC_IO | H5FD_LOG_ALLOC; /* Log file access */ - if ((val = HDstrtok(NULL, " \t\n\r"))) + if((val = HDstrtok(NULL, " \t\n\r"))) log_flags = (unsigned)HDstrtol(val, NULL, 0); - - if (H5Pset_fapl_log(fapl, NULL, log_flags, (size_t)0) < 0) + if(H5Pset_fapl_log(fapl, NULL, log_flags, (size_t)0) < 0) return -1; - } else if (!HDstrcmp(name, "direct")) { + } + else if(!HDstrcmp(name, "direct")) { #ifdef H5_HAVE_DIRECT /* Linux direct read() and write() system calls. Set memory boundary, file block size, * and copy buffer size to the default values. */ - if (H5Pset_fapl_direct(fapl, 1024, 4096, 8*4096)<0) + if(H5Pset_fapl_direct(fapl, 1024, 4096, 8 * 4096) < 0) return -1; #endif - } else if(!HDstrcmp(name, "latest")) { + } + else if(!HDstrcmp(name, "latest")) { /* use the latest format */ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) return -1; - } else { + } + else { /* Unknown driver */ return -1; } @@ -1180,8 +1355,6 @@ getenv_all(MPI_Comm comm, int root, const char* name) * Programmer: Larry Knox * Monday, October 13, 2009 * - * Modifications: - * *------------------------------------------------------------------------- */ int @@ -1189,24 +1362,44 @@ h5_make_local_copy(const char *origfilename, const char *local_copy_name) { int fd_old = (-1), fd_new = (-1); /* File descriptors for copying data */ ssize_t nread; /* Number of bytes read in */ - char buf[READ_BUF_SIZE]; /* Buffer for copying data */ - const char *filename = H5_get_srcdir_filename(origfilename);; /* Get the test file name to copy */ + void *buf = NULL; /* Buffer for copying data */ + const char *filename = H5_get_srcdir_filename(origfilename); /* Get the test file name to copy */ + + /* Allocate copy buffer */ + if(NULL == (buf = HDcalloc((size_t)1, (size_t)READ_BUF_SIZE))) + goto error; /* Copy old file into temporary file */ - if((fd_old = HDopen(filename, O_RDONLY, 0666)) < 0) return -1; - if((fd_new = HDopen(local_copy_name, O_RDWR|O_CREAT|O_TRUNC, 0666)) - < 0) return -1; + if((fd_old = HDopen(filename, O_RDONLY, 0666)) < 0) + goto error; + if((fd_new = HDopen(local_copy_name, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0) + goto error; /* Copy data */ while((nread = HDread(fd_old, buf, (size_t)READ_BUF_SIZE)) > 0) - HDwrite(fd_new, buf, (size_t)nread); - + if(HDwrite(fd_new, buf, (size_t)nread) < 0) + goto error; + /* Close files */ - if(HDclose(fd_old) < 0) return -1; - if(HDclose(fd_new) < 0) return -1; + if(HDclose(fd_old) < 0) + goto error; + if(HDclose(fd_new) < 0) + goto error; + + /* Release memory */ + HDfree(buf); return 0; -} + +error: + /* ignore return values since we're already noted the problem */ + if(fd_old > 0) + HDclose(fd_old); + if(fd_new > 0) + HDclose(fd_new); + HDfree(buf); + return -1; +} /* end h5_make_local_copy() */ /*------------------------------------------------------------------------- diff --git a/test/h5test.h b/test/h5test.h index 19524a9..065c089 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -61,18 +61,18 @@ /* Should be used internally by the libtest.a only. */ #define HDGetTestVerbosity() (TestVerbosity) -#define VERBOSE_NONE (HDGetTestVerbosity()==VERBO_NONE) -#define VERBOSE_DEF (HDGetTestVerbosity()>=VERBO_DEF) -#define VERBOSE_LO (HDGetTestVerbosity()>=VERBO_LO) -#define VERBOSE_MED (HDGetTestVerbosity()>=VERBO_MED) -#define VERBOSE_HI (HDGetTestVerbosity()>=VERBO_HI) +#define VERBOSE_NONE (HDGetTestVerbosity()==VERBO_NONE) +#define VERBOSE_DEF (HDGetTestVerbosity()>=VERBO_DEF) +#define VERBOSE_LO (HDGetTestVerbosity()>=VERBO_LO) +#define VERBOSE_MED (HDGetTestVerbosity()>=VERBO_MED) +#define VERBOSE_HI (HDGetTestVerbosity()>=VERBO_HI) /* * Test controls definitions. */ -#define SKIPTEST 1 /* Skip this test */ -#define ONLYTEST 2 /* Do only this test */ -#define BEGINTEST 3 /* Skip all tests before this test */ +#define SKIPTEST 1 /* Skip this test */ +#define ONLYTEST 2 /* Do only this test */ +#define BEGINTEST 3 /* Skip all tests before this test */ /* * This contains the filename prefix specificied as command line option for @@ -86,8 +86,8 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */ /* * Print the current location on the standard output stream. */ -#define AT() printf (" at %s:%d in %s()...\n", \ - __FILE__, __LINE__, FUNC); +#define AT() printf (" at %s:%d in %s()...\n", \ + __FILE__, __LINE__, FUNC); /* * The name of the test is printed by saying TESTING("something") which will @@ -98,12 +98,13 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */ * spaces. If the h5_errors() is used for automatic error handling then * the H5_FAILED() macro is invoked automatically when an API function fails. */ -#define TESTING(WHAT) {printf("Testing %-62s",WHAT); fflush(stdout);} -#define TESTING_2(WHAT) {printf(" Testing %-62s",WHAT); fflush(stdout);} -#define PASSED() {puts(" PASSED");fflush(stdout);} -#define H5_FAILED() {puts("*FAILED*");fflush(stdout);} -#define H5_WARNING() {puts("*WARNING*");fflush(stdout);} -#define SKIPPED() {puts(" -SKIP-");fflush(stdout);} +#define TESTING(WHAT) {printf("Testing %-62s",WHAT); fflush(stdout);} +#define TESTING_2(WHAT) {printf(" Testing %-62s",WHAT); fflush(stdout);} +#define PASSED() {puts(" PASSED");fflush(stdout);} +#define H5_FAILED() {puts("*FAILED*");fflush(stdout);} +#define H5_WARNING() {puts("*WARNING*");fflush(stdout);} +#define SKIPPED() {puts(" -SKIP-");fflush(stdout);} +#define PUTS_ERROR(s) {puts(s); AT(); goto error;} #define TEST_ERROR {H5_FAILED(); AT(); goto error;} #define STACK_ERROR {H5Eprint2(H5E_DEFAULT, stdout); goto error;} #define FAIL_STACK_ERROR {H5_FAILED(); AT(); H5Eprint2(H5E_DEFAULT, stdout); \ @@ -113,9 +114,9 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */ /* * Alarm definitions to wait up (terminate) a test that runs too long. */ -#define H5_ALARM_SEC 1200 /* default is 20 minutes */ -#define ALARM_ON TestAlarmOn() -#define ALARM_OFF HDalarm(0) +#define H5_ALARM_SEC 1200 /* default is 20 minutes */ +#define ALARM_ON TestAlarmOn() +#define ALARM_OFF HDalarm(0) /* * The methods to compare the equality of floating-point values: @@ -140,13 +141,16 @@ extern "C" { #endif /* Generally useful testing routines */ +H5TEST_DLL void h5_clean_files(const char *base_name[], hid_t fapl); H5TEST_DLL int h5_cleanup(const char *base_name[], hid_t fapl); H5TEST_DLL char *h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size); H5TEST_DLL char *h5_fixname_no_suffix(const char *base_name, hid_t fapl, char *fullname, size_t size); +H5TEST_DLL char *h5_fixname_printf(const char *base_name, hid_t fapl, char *fullname, size_t size); H5TEST_DLL hid_t h5_fileaccess(void); H5TEST_DLL void h5_no_hwconv(void); H5TEST_DLL const char *h5_rmprefix(const char *filename); H5TEST_DLL void h5_reset(void); +H5TEST_DLL void h5_restore_err(void); H5TEST_DLL void h5_show_hostname(void); H5TEST_DLL h5_stat_size_t h5_get_file_size(const char *filename, hid_t fapl); H5TEST_DLL int print_func(const char *format, ...); @@ -156,13 +160,14 @@ H5TEST_DLL herr_t h5_verify_cached_stabs(const char *base_name[], hid_t fapl); /* Routines for operating on the list of tests (for the "all in one" tests) */ H5TEST_DLL void TestUsage(void); H5TEST_DLL void AddTest(const char *TheName, void (*TheCall) (void), - void (*Cleanup) (void), const char *TheDescr, - const void *Parameters); + void (*Cleanup) (void), const char *TheDescr, + const void *Parameters); H5TEST_DLL void TestInfo(const char *ProgName); H5TEST_DLL void TestParseCmdLine(int argc, char *argv[]); H5TEST_DLL void PerformTests(void); H5TEST_DLL void TestSummary(void); H5TEST_DLL void TestCleanup(void); +H5TEST_DLL void TestShutdown(void); H5TEST_DLL void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_parser)(int ac, char *av[])); H5TEST_DLL int GetTestVerbosity(void); H5TEST_DLL int SetTestVerbosity(int newval); diff --git a/test/mf.c b/test/mf.c index a252c2d..eb58beb 100644 --- a/test/mf.c +++ b/test/mf.c @@ -6246,6 +6246,8 @@ main(void) if(env_h5_drvr == NULL) env_h5_drvr = "nomatch"; + h5_reset(); + fapl = h5_fileaccess(); /* Make a copy of the FAPL before adjusting the alignment */ diff --git a/test/plugin.c b/test/plugin.c index 28c7c30..f0c0dd0 100644 --- a/test/plugin.c +++ b/test/plugin.c @@ -12,13 +12,11 @@ * to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu - * 13 February 2013 + * Programmer: Raymond Lu + * 13 February 2013 * - * Purpose: Tests the plugin module (H5PL) + * Purpose: Tests the plugin module (H5PL) */ -#include -#include #include "h5test.h" #include "H5srcdir.h" @@ -31,7 +29,7 @@ /* Filters for HDF5 internal test */ #define H5Z_FILTER_DYNLIB1 257 -#define H5Z_FILTER_DYNLIB2 258 +#define H5Z_FILTER_DYNLIB2 258 #define H5Z_FILTER_DYNLIB3 259 #define H5Z_FILTER_DYNLIB4 260 @@ -42,8 +40,8 @@ const char *FILENAME[] = { #define FILENAME_BUF_SIZE 1024 /* Dataset names for testing filters */ -#define DSET_DEFLATE_NAME "deflate" -#define DSET_DYNLIB1_NAME "dynlib1" +#define DSET_DEFLATE_NAME "deflate" +#define DSET_DYNLIB1_NAME "dynlib1" #define DSET_DYNLIB2_NAME "dynlib2" #define DSET_DYNLIB4_NAME "dynlib4" @@ -64,7 +62,7 @@ const char *FILENAME[] = { #define GROUP_ITERATION 1000 -int points_deflate[DSET_DIM1][DSET_DIM2], +int points_deflate[DSET_DIM1][DSET_DIM2], points_dynlib1[DSET_DIM1][DSET_DIM2], points_dynlib2[DSET_DIM1][DSET_DIM2], points_dynlib4[DSET_DIM1][DSET_DIM2], @@ -72,14 +70,14 @@ int points_deflate[DSET_DIM1][DSET_DIM2], /*------------------------------------------------------------------------- - * Function: test_filter_internal + * Function: test_filter_internal * - * Purpose: Tests writing entire data and partial data with filters + * Purpose: Tests writing entire data and partial data with filters * - * Return: Success: 0 - * Failure: -1 + * Return: Success: 0 + * Failure: -1 * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * 27 February 2013 * *------------------------------------------------------------------------- @@ -87,28 +85,28 @@ int points_deflate[DSET_DIM1][DSET_DIM2], static herr_t test_filter_internal(hid_t fid, const char *name, hid_t dcpl) { - hid_t dataset; /* Dataset ID */ - hid_t dxpl; /* Dataset xfer property list ID */ - hid_t write_dxpl; /* Dataset xfer property list ID for writing */ - hid_t sid; /* Dataspace ID */ - const hsize_t size[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */ - const hsize_t hs_offset[2] = {FILTER_HS_OFFSET1, FILTER_HS_OFFSET2}; /* Hyperslab offset */ - const hsize_t hs_size[2] = {FILTER_HS_SIZE1, FILTER_HS_SIZE2}; /* Hyperslab size */ - void *tconv_buf = NULL; /* Temporary conversion buffer */ - int points[DSET_DIM1][DSET_DIM2], check[DSET_DIM1][DSET_DIM2]; - size_t i, j; /* Local index variables */ + hid_t dataset; /* Dataset ID */ + hid_t dxpl; /* Dataset xfer property list ID */ + hid_t write_dxpl; /* Dataset xfer property list ID for writing */ + hid_t sid; /* Dataspace ID */ + const hsize_t size[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */ + const hsize_t hs_offset[2] = {FILTER_HS_OFFSET1, FILTER_HS_OFFSET2}; /* Hyperslab offset */ + const hsize_t hs_size[2] = {FILTER_HS_SIZE1, FILTER_HS_SIZE2}; /* Hyperslab size */ + void *tconv_buf = NULL; /* Temporary conversion buffer */ + int points[DSET_DIM1][DSET_DIM2], check[DSET_DIM1][DSET_DIM2]; + size_t i, j; /* Local index variables */ int n = 0; /* Create the data space */ - if((sid = H5Screate_simple(2, size, NULL)) < 0) goto error; + if((sid = H5Screate_simple(2, size, NULL)) < 0) TEST_ERROR /* * Create a small conversion buffer to test strip mining. We * might as well test all we can! */ - if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) goto error; + if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR tconv_buf = HDmalloc((size_t)1000); - if(H5Pset_buffer(dxpl, (size_t)1000, tconv_buf, NULL) < 0) goto error; + if(H5Pset_buffer(dxpl, (size_t)1000, tconv_buf, NULL) < 0) TEST_ERROR if((write_dxpl = H5Pcopy(dxpl)) < 0) TEST_ERROR; TESTING(" filters (setup)"); @@ -117,12 +115,12 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl) if(H5Pall_filters_avail(dcpl)!=TRUE) { H5_FAILED(); printf(" Line %d: Incorrect filter availability\n",__LINE__); - goto error; + TEST_ERROR } /* end if */ /* Create the dataset */ if((dataset = H5Dcreate2(fid, name, H5T_NATIVE_INT, sid, H5P_DEFAULT, - dcpl, H5P_DEFAULT)) < 0) goto error; + dcpl, H5P_DEFAULT)) < 0) TEST_ERROR PASSED(); @@ -133,18 +131,18 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl) TESTING(" filters (uninitialized read)"); if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) - TEST_ERROR; + TEST_ERROR; for(i=0; i<(size_t)size[0]; i++) { - for(j=0; j<(size_t)size[1]; j++) { - if(0!=check[i][j]) { - H5_FAILED(); - printf(" Read a non-zero value.\n"); - printf(" At index %lu,%lu\n", - (unsigned long)i, (unsigned long)j); - goto error; - } - } + for(j=0; j<(size_t)size[1]; j++) { + if(0!=check[i][j]) { + H5_FAILED(); + printf(" Read a non-zero value.\n"); + printf(" At index %lu,%lu\n", + (unsigned long)i, (unsigned long)j); + TEST_ERROR + } + } } PASSED(); @@ -157,13 +155,13 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl) n = 0; for(i=0; i 0; i--) { + if (H5PLremove(i-1) < 0) { + fprintf(stderr," at %d: %s\n", i, pathname); + TEST_ERROR + } + } + /* Verify the table is empty */ + if (H5PLsize() > 0) TEST_ERROR + PASSED(); + + TESTING(" remove (exceed)"); + /* Exceed the min path removal */ + H5E_BEGIN_TRY { + ret = H5PLremove(0); + } H5E_END_TRY + if (ret >= 0) + TEST_ERROR + PASSED(); + + TESTING(" append"); + /* Create multiple paths to fill table */ + for (i=0; i < 16; i++) { + sprintf(pathname, "a_path_%d", i); + if (H5PLappend(pathname) < 0) { + fprintf(stderr," at %d: %s\n", i, pathname); + TEST_ERROR + } + } + /* Verify the table is full */ + if (H5PLsize() != 16) TEST_ERROR + PASSED(); + TESTING(" append (exceed)"); + /* Exceed the max path append */ + H5E_BEGIN_TRY { + sprintf(pathname, "a_path_%d", 16); + ret = H5PLappend(pathname); + } H5E_END_TRY + if (ret >= 0) + TEST_ERROR PASSED(); + TESTING(" remove (verify for prepend)"); + /* Remove one path*/ + if (H5PLremove(8) < 0) TEST_ERROR + + /* Verify that the entries were moved */ + sprintf(pathname, "%s", H5PLget(8)); + if (strcmp(pathname, "a_path_9") != 0) { + fprintf(stderr," get 8: %s\n", pathname); + TEST_ERROR + } + PASSED(); + + /* Verify the table is not full */ + if (H5PLsize() != 15) TEST_ERROR + + TESTING(" prepend"); + /* Prepend one path*/ + sprintf(pathname, "a_path_%d", 17); + if (H5PLprepend(pathname) < 0) { + fprintf(stderr," prepend 17: %s\n", pathname); + TEST_ERROR + } + + /* Verify the table is full */ + if (H5PLsize() != 16) TEST_ERROR + + /* Verify that the entries were moved */ + sprintf(pathname, "%s", H5PLget(8)); + if (strcmp(pathname, "a_path_7") != 0) { + fprintf(stderr," get 8: %s\n", pathname); + TEST_ERROR + } + sprintf(pathname, "%s", H5PLget(0)); + if (strcmp(pathname, "a_path_17") != 0) { + fprintf(stderr," get 0: %s\n", pathname); + TEST_ERROR + } + PASSED(); + + TESTING(" prepend (exceed)"); + /* Exceed the max path prepend */ + H5E_BEGIN_TRY { + sprintf(pathname, "a_path_%d", 18); + ret = H5PLprepend(pathname); + } H5E_END_TRY + if (ret >= 0) + TEST_ERROR + PASSED(); + + TESTING(" replace"); + /* Replace one path*/ + sprintf(pathname, "a_path_%d", 20); + if (H5PLput(pathname, 1) < 0) { + fprintf(stderr," replace 1: %s\n", pathname); + TEST_ERROR + } + + /* Verify the table is full */ + if (H5PLsize() != 16) TEST_ERROR + + /* Verify that the entries were not moved */ + sprintf(pathname, "%s", H5PLget(0)); + if (strcmp(pathname, "a_path_17") != 0) { + fprintf(stderr," get 0: %s\n", pathname); + TEST_ERROR + } + sprintf(pathname, "%s", H5PLget(2)); + if (strcmp(pathname, "a_path_1") != 0) { + fprintf(stderr," get 2: %s\n", pathname); + TEST_ERROR + } + PASSED(); + + TESTING(" remove (verify for insert)"); + /* Remove one path*/ + if (H5PLremove(4) < 0) TEST_ERROR + + /* Verify that the entries were moved */ + sprintf(pathname, "%s", H5PLget(4)); + if (strcmp(pathname, "a_path_4") != 0) { + fprintf(stderr," get 4: %s\n", pathname); + TEST_ERROR + } + PASSED(); + + /* Verify the table is not full */ + if (H5PLsize() != 15) TEST_ERROR + + TESTING(" insert"); + /* Insert one path*/ + sprintf(pathname, "a_path_%d", 21); + if (H5PLinsert(pathname, 3) < 0){ + fprintf(stderr," insert 3: %s\n", pathname); + TEST_ERROR + } + + /* Verify that the entries were moved */ + sprintf(pathname, "%s", H5PLget(4)); + if (strcmp(pathname, "a_path_2") != 0){ + fprintf(stderr," get 4: %s\n", pathname); + TEST_ERROR + } + PASSED(); + + /* Verify the table is full */ + if (H5PLsize() != 16) TEST_ERROR + + TESTING(" insert (exceed)"); + /* Exceed the max path insert */ + H5E_BEGIN_TRY { + sprintf(pathname, "a_path_%d", 22); + ret = H5PLinsert(pathname, 12); + } H5E_END_TRY + if (ret >= 0) + TEST_ERROR + + PASSED (); + return 0; error: @@ -731,30 +918,30 @@ error: /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Tests the plugin module (H5PL) + * Purpose: Tests the plugin module (H5PL) * - * Return: Success: exit(0) + * Return: Success: exit(EXIT_SUCCESS) * - * Failure: exit(1) + * Failure: exit(EXIT_FAILURE) * - * Programmer: Raymond Lu - * 14 March 2013 + * Programmer: Raymond Lu + * 14 March 2013 * *------------------------------------------------------------------------- */ int main(void) { - char filename[FILENAME_BUF_SIZE]; - hid_t file, fapl, fapl2; - hbool_t new_format; + char filename[FILENAME_BUF_SIZE]; + hid_t file, fapl, fapl2; + unsigned new_format; int mdc_nelmts; size_t rdcc_nelmts; size_t rdcc_nbytes; double rdcc_w0; - int nerrors = 0; + int nerrors = 0; /* Testing setup */ h5_reset(); @@ -762,10 +949,10 @@ main(void) /* Turn off the chunk cache, so all the chunks are immediately written to disk */ if(H5Pget_cache(fapl, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0) < 0) - TEST_ERROR + TEST_ERROR rdcc_nbytes = 0; if(H5Pset_cache(fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0) < 0) - TEST_ERROR + TEST_ERROR /* Copy the file access property list */ if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR @@ -791,22 +978,25 @@ main(void) /* Create the file for this test */ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR + TEST_ERROR /* Test dynamically loaded filters for chunked dataset */ - nerrors += (test_filters_for_datasets(file) < 0 ? 1 : 0); + nerrors += (test_filters_for_datasets(file) < 0 ? 1 : 0); /* Test dynamically loaded filters for groups */ nerrors += (test_filters_for_groups(file) < 0 ? 1 : 0); if(H5Fclose(file) < 0) - TEST_ERROR + TEST_ERROR } /* end for */ /* Close FAPL */ if(H5Pclose(fapl2) < 0) TEST_ERROR if(H5Pclose(fapl) < 0) TEST_ERROR - + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + puts("\nTesting reading data with with dynamic plugin filters:"); /* Close the library so that all loaded plugin libraries are unloaded */ @@ -815,13 +1005,16 @@ main(void) /* Reopen the file for testing data reading */ if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) - TEST_ERROR + TEST_ERROR /* Read the data with filters */ - nerrors += (test_read_with_filters(file) < 0 ? 1 : 0); + nerrors += (test_read_with_filters(file) < 0 ? 1 : 0); /* Open the groups with filters */ - nerrors += (test_groups_with_filters(file) < 0 ? 1 : 0); + nerrors += (test_groups_with_filters(file) < 0 ? 1 : 0); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); /* Close the library so that all loaded plugin libraries are unloaded */ h5_reset(); @@ -835,10 +1028,13 @@ main(void) nerrors += (test_noread_with_filters(file) < 0 ? 1 : 0); if(H5Fclose(file) < 0) - TEST_ERROR + TEST_ERROR + + /* Test the APIs for access to the filter plugin path table */ + nerrors += (test_filter_path_apis() < 0 ? 1 : 0); if(nerrors) - TEST_ERROR + TEST_ERROR printf("All plugin tests passed.\n"); h5_cleanup(FILENAME, fapl); diff --git a/test/set_extent.c b/test/set_extent.c index f6c3766..5df649c 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -20,9 +20,6 @@ * Purpose: Tests the H5Dset_extent call */ -#include -#include -#include "hdf5.h" #include "h5test.h" /*------------------------------------------------------------------------- diff --git a/test/vfd.c b/test/vfd.c index 4ece2ba..94c0a5c 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -80,9 +80,9 @@ const char *FILENAME[] = { static herr_t test_sec2(void) { - hid_t file = -1; - hid_t fapl = -1; - hid_t access_fapl = -1; + hid_t file = -1; /* file ID */ + hid_t fapl = -1; /* file access property list ID */ + hid_t access_fapl = -1; char filename[1024]; int *fhandle = NULL; hsize_t file_size = 0; @@ -90,7 +90,8 @@ test_sec2(void) TESTING("SEC2 file driver"); /* Set property list and file name for SEC2 driver. */ - fapl = h5_fileaccess(); + if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + TEST_ERROR; if(H5Pset_fapl_sec2(fapl) < 0) TEST_ERROR; h5_fixname(FILENAME[0], fapl, filename, sizeof filename); @@ -125,11 +126,12 @@ test_sec2(void) */ if(file_size < 1 * KB || file_size > 4 * KB) TEST_ERROR; + h5_delete_test_file(FILENAME[0], fapl); - if(H5Fclose(file) < 0) + /* Close the fapl */ + if(H5Pclose(fapl) < 0) TEST_ERROR; - h5_cleanup(FILENAME, fapl); PASSED(); return 0; @@ -184,7 +186,8 @@ test_direct(void) /* Set property list and file name for Direct driver. Set memory alignment boundary * and file block size to 512 which is the minimum for Linux 2.6. */ - fapl = h5_fileaccess(); + if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + TEST_ERROR; if(H5Pset_fapl_direct(fapl, MBOUNDARY, FBSIZE, CBSIZE) < 0) TEST_ERROR; h5_fixname(FILENAME[5], fapl, filename, sizeof filename); @@ -333,7 +336,12 @@ test_direct(void) HDassert(check); HDfree(check); - h5_cleanup(FILENAME, fapl); + h5_delete_test_file(FILENAME[1], fapl); + + /* Close the fapl */ + if(H5Pclose(fapl) < 0) + TEST_ERROR; + PASSED(); return 0; @@ -387,7 +395,8 @@ test_core(void) TESTING("CORE file driver"); /* Set property list and file name for CORE driver */ - fapl = h5_fileaccess(); + if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + TEST_ERROR; if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE) < 0) TEST_ERROR; if(H5Pset_core_write_tracking(fapl, TRUE, CORE_PAGE_SIZE) < 0) @@ -558,14 +567,19 @@ test_core(void) TEST_ERROR; if(H5Dclose(dset1) < 0) TEST_ERROR; - if(H5Fclose(file) < 0) - TEST_ERROR; HDassert(points); HDfree(points); HDassert(check); HDfree(check); - h5_cleanup(FILENAME, fapl); + /* Close and delete the file */ + if(H5Fclose(file) < 0) + TEST_ERROR; + h5_delete_test_file(FILENAME[5], fapl); + + /* Close the fapl */ + if(H5Pclose(fapl) < 0) + TEST_ERROR; PASSED(); return 0; @@ -602,7 +616,7 @@ error: static herr_t test_family_opens(char *fname, hid_t fa_pl) { - hid_t file; + hid_t file=-1; char first_name[1024]; char wrong_name[1024]; int i; @@ -673,7 +687,7 @@ error: static herr_t test_family(void) { - hid_t file=(-1), fapl, fapl2=(-1), space=(-1), dset=(-1); + hid_t file=-1, fapl=-1, fapl2=-1, space=-1, dset=-1; hid_t access_fapl = -1; char filename[1024]; char dname[]="dataset"; @@ -686,11 +700,11 @@ test_family(void) TESTING("FAMILY file driver"); /* Set property list and file name for FAMILY driver */ - fapl = h5_fileaccess(); - + if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + TEST_ERROR; if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0) TEST_ERROR; - h5_fixname(FILENAME[2], fapl, filename, sizeof filename); + h5_fixname(FILENAME[2], fapl, filename, sizeof(filename)); if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR; @@ -797,10 +811,15 @@ test_family(void) if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR; + /* Close and delete the file */ if(H5Fclose(file) < 0) TEST_ERROR; + h5_delete_test_file(FILENAME[2], fapl); + + /* Close the fapl */ + if(H5Pclose(fapl) < 0) + TEST_ERROR; - h5_cleanup(FILENAME, fapl); PASSED(); return 0; @@ -808,7 +827,8 @@ error: H5E_BEGIN_TRY { H5Sclose(space); H5Dclose(dset); - H5Pclose (fapl2); + H5Pclose(fapl); + H5Pclose(fapl2); H5Fclose(file); } H5E_END_TRY; return -1; @@ -836,8 +856,8 @@ error: static herr_t test_family_compat(void) { - hid_t file = (-1), fapl; - hid_t dset; + hid_t file = -1, fapl = -1; + hid_t dset = -1; char dname[]="dataset"; char filename[1024]; char pathname[1024], pathname_individual[1024]; @@ -847,13 +867,13 @@ test_family_compat(void) TESTING("FAMILY file driver backward compatibility"); /* Set property list and file name for FAMILY driver */ - fapl = h5_fileaccess(); - + if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + TEST_ERROR; if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE2, H5P_DEFAULT) < 0) TEST_ERROR; - h5_fixname(COMPAT_BASENAME, fapl, filename, sizeof filename); - h5_fixname(FILENAME[3], fapl, newname, sizeof newname); + h5_fixname(COMPAT_BASENAME, fapl, filename, sizeof(filename)); + h5_fixname(FILENAME[3], fapl, newname, sizeof(newname)); pathname[0] = '\0'; HDstrcat(pathname, filename); @@ -869,7 +889,7 @@ test_family_compat(void) counter++; HDsnprintf(newname_individual, sizeof(newname_individual), newname, counter); HDsnprintf(pathname_individual, sizeof(pathname_individual), pathname, counter); - } + } /* end while */ /* Make sure we can open the file. Use the read and write mode to flush the * superblock. */ @@ -895,10 +915,14 @@ test_family_compat(void) if(H5Dclose(dset) < 0) TEST_ERROR; + /* Close and delete the file */ if(H5Fclose(file) < 0) TEST_ERROR; + h5_delete_test_file(FILENAME[3], fapl); - h5_cleanup(FILENAME, fapl); + /* Close the fapl */ + if(H5Pclose(fapl) < 0) + TEST_ERROR; PASSED(); @@ -931,7 +955,7 @@ error: static herr_t test_multi_opens(char *fname) { - hid_t file; + hid_t file=-1; char super_name[1024]; /*name string "%%s-s.h5"*/ char sf_name[1024]; /*name string "multi_file-s.h5"*/ @@ -963,8 +987,8 @@ test_multi_opens(char *fname) static herr_t test_multi(void) { - hid_t file=(-1), fapl, fapl2=(-1), dset=(-1), space=(-1); - hid_t root, attr, aspace, atype; + hid_t file=-1, fapl=-1, fapl2=-1, dset=-1, space=-1; + hid_t root=-1, attr=-1, aspace=-1, atype=-1; hid_t access_fapl = -1; char filename[1024]; int *fhandle2=NULL, *fhandle=NULL; @@ -982,14 +1006,16 @@ test_multi(void) int buf[MULTI_SIZE][MULTI_SIZE]; TESTING("MULTI file driver"); + /* Set file access property list for MULTI driver */ - fapl = h5_fileaccess(); + if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + TEST_ERROR; - HDmemset(memb_map, 0, sizeof memb_map); - HDmemset(memb_fapl, 0, sizeof memb_fapl); - HDmemset(memb_name, 0, sizeof memb_name); - HDmemset(memb_addr, 0, sizeof memb_addr); - HDmemset(sv, 0, sizeof sv); + HDmemset(memb_map, 0, sizeof(memb_map)); + HDmemset(memb_fapl, 0, sizeof(memb_fapl)); + HDmemset(memb_name, 0, sizeof(memb_name)); + HDmemset(memb_addr, 0, sizeof(memb_addr)); + HDmemset(sv, 0, sizeof(sv)); for(mt=H5FD_MEM_DEFAULT; mt 4 * KB) TEST_ERROR; + /* Close and delete the file */ if(H5Fclose(file) < 0) TEST_ERROR; + h5_delete_test_file(FILENAME[6], fapl); + + /* Close the fapl */ + if(H5Pclose(fapl) < 0) + TEST_ERROR; - h5_cleanup(FILENAME, fapl); PASSED(); return 0; @@ -1429,7 +1472,8 @@ test_stdio(void) TESTING("STDIO file driver"); /* Set property list and file name for STDIO driver. */ - fapl = h5_fileaccess(); + if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + TEST_ERROR; if(H5Pset_fapl_stdio(fapl) < 0) TEST_ERROR; h5_fixname(FILENAME[7], fapl, filename, sizeof filename); @@ -1465,10 +1509,15 @@ test_stdio(void) if(file_size < 1 * KB || file_size > 4 * KB) TEST_ERROR; + /* Close and delete the file */ if(H5Fclose(file) < 0) TEST_ERROR; + h5_delete_test_file(FILENAME[7], fapl); + + /* Close the fapl */ + if(H5Pclose(fapl) < 0) + TEST_ERROR; - h5_cleanup(FILENAME, fapl); PASSED(); return 0; @@ -1519,7 +1568,8 @@ test_windows(void) #else /* H5_HAVE_WINDOWS */ /* Set property list and file name for WINDOWS driver. */ - fapl = h5_fileaccess(); + if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + TEST_ERROR; if(H5Pset_fapl_windows(fapl) < 0) TEST_ERROR; h5_fixname(FILENAME[8], fapl, filename, sizeof filename); @@ -1555,10 +1605,15 @@ test_windows(void) if(file_size < 1 * KB || file_size > 4 * KB) TEST_ERROR; + /* Close and delete the file */ if(H5Fclose(file) < 0) TEST_ERROR; + h5_delete_test_file(FILENAME[8], fapl); + + /* Close the fapl */ + if(H5Pclose(fapl) < 0) + TEST_ERROR; - h5_cleanup(FILENAME, fapl); PASSED(); return 0; diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt index c88e3e8..5655bb0 100644 --- a/testpar/CMakeLists.txt +++ b/testpar/CMakeLists.txt @@ -53,6 +53,6 @@ set (H5P_TESTS foreach (testp ${H5P_TESTS}) ADD_H5P_EXE(${testp}) -endforeach (testp ${H5P_TESTS}) +endforeach () include (CMakeTests.cmake) diff --git a/testpar/CMakeTests.cmake b/testpar/CMakeTests.cmake index 86eaa03..7dce6d6 100644 --- a/testpar/CMakeTests.cmake +++ b/testpar/CMakeTests.cmake @@ -36,7 +36,7 @@ if (HDF5_TEST_VFD) set (VFD_LIST ${VFD_LIST} direct) endif () - MACRO (ADD_VFD_TEST vfdname resultcode) + macro (ADD_VFD_TEST vfdname resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) foreach (test ${H5P_VFD_TESTS}) add_test ( @@ -52,7 +52,7 @@ if (HDF5_TEST_VFD) ) endforeach () endif () - ENDMACRO () + endmacro () # Run test with different Virtual File Driver foreach (vfd ${VFD_LIST}) diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c index 7bd2f58..814fd22 100644 --- a/testpar/t_mpi.c +++ b/testpar/t_mpi.c @@ -1236,7 +1236,7 @@ finish: /* turn off alarm */ ALARM_OFF; - h5_cleanup(FILENAME, fapl); + h5_clean_files(FILENAME, fapl); H5close(); /* MPI_Finalize must be called AFTER H5close which may use MPI calls */ diff --git a/testpar/t_pflush2.c b/testpar/t_pflush2.c index 3b46afd..42cb6c4 100644 --- a/testpar/t_pflush2.c +++ b/testpar/t_pflush2.c @@ -201,8 +201,8 @@ main(int argc, char* argv[]) H5Eset_auto2(H5E_DEFAULT, func, NULL); - h5_cleanup(&FILENAME[0], fapl1); - h5_cleanup(&FILENAME[1], fapl2); + h5_clean_files(&FILENAME[0], fapl1); + h5_clean_files(&FILENAME[1], fapl2); } else { diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c index 9088470..48b0569 100644 --- a/testpar/t_shapesame.c +++ b/testpar/t_shapesame.c @@ -5123,7 +5123,7 @@ int main(int argc, char **argv) TestSummary(); /* Clean up test files */ - h5_cleanup(FILENAME, fapl); + h5_clean_files(FILENAME, fapl); nerrors += GetTestNumErrs(); diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index eaa9eb1..8ee8f3e 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -565,7 +565,7 @@ int main(int argc, char **argv) TestSummary(); /* Clean up test files */ - h5_cleanup(FILENAME, fapl); + h5_clean_files(FILENAME, fapl); nerrors += GetTestNumErrs(); diff --git a/tools/h5copy/CMakeTests.cmake b/tools/h5copy/CMakeTests.cmake index c429377..6e230e4 100644 --- a/tools/h5copy/CMakeTests.cmake +++ b/tools/h5copy/CMakeTests.cmake @@ -36,7 +36,7 @@ # # Perform h5copy according to passing parmeters # - MACRO (ADD_H5_F_TEST testname resultcode infile fparam vparam sparam srcname dparam dstname) + 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 ( @@ -70,9 +70,9 @@ set_tests_properties (H5COPY_F-${testname}-DIFF PROPERTIES WILL_FAIL "true") endif () endif () - ENDMACRO () + endmacro () - MACRO (ADD_H5_TEST testname resultcode infile vparam sparam srcname dparam dstname) + 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 ( @@ -106,18 +106,18 @@ set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES WILL_FAIL "true") endif () endif () - ENDMACRO () + endmacro () - MACRO (ADD_SKIP_H5_TEST testname skipresultfile) + macro (ADD_SKIP_H5_TEST testname skipresultfile) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5COPY-${testname}-${skipresultfile}-SKIPPED COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${testname}-${skipresultfile} ${ARGN}" ) endif () - ENDMACRO () + endmacro () - MACRO (ADD_H5_TEST2 testname resultcode infile psparam pdparam vparam sparam srcname dparam dstname) + 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 ( @@ -156,9 +156,9 @@ set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES WILL_FAIL "true") endif () endif () - ENDMACRO () + endmacro () - MACRO (ADD_H5_TEST_SAME testname resultcode pfile psparam pdparam vparam sparam srcname dparam dstname) + 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 ( @@ -197,13 +197,13 @@ set_tests_properties (H5COPY_SAME-${testname}-DIFF PROPERTIES WILL_FAIL "true") endif () endif () - ENDMACRO () + endmacro () # # Similiar to ADD_H5_TEST macro. Compare to outputs from source & target # files instead of checking with h5ls. # - MACRO (ADD_H5_CMP_TEST testname resultcode infile vparam sparam srcname dparam dstname) + macro (ADD_H5_CMP_TEST testname resultcode infile vparam sparam srcname dparam dstname) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5COPY-CMP-${testname} COMMAND $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}) @@ -235,7 +235,7 @@ ) set_tests_properties (H5COPY-CMP-${testname} PROPERTIES DEPENDS H5COPY-CMP-${testname}-clear-objects) endif () - ENDMACRO () + endmacro () ############################################################################## ############################################################################## diff --git a/tools/h5copy/h5copy.c b/tools/h5copy/h5copy.c index b5965ba..5371a21 100644 --- a/tools/h5copy/h5copy.c +++ b/tools/h5copy/h5copy.c @@ -23,7 +23,7 @@ #define PROGRAMNAME "h5copy" /* command-line options: short and long-named parameters */ -static const char *s_opts = "d:f:hi:o:ps:vV"; +static const char *s_opts = "d:f:hi:o:ps:vVE"; static struct long_options l_opts[] = { { "destination", require_arg, 'd' }, { "flag", require_arg, 'f' }, @@ -34,6 +34,7 @@ static struct long_options l_opts[] = { { "source", require_arg, 's' }, { "verbose", no_arg, 'v' }, { "version", no_arg, 'V' }, + { "enable-error-stack", no_arg, 'E' }, { NULL, 0, '\0' } }; char *fname_src = NULL; @@ -91,43 +92,44 @@ leave(int ret) static void usage (void) { - HDfprintf(stdout, "\ -usage: h5copy [OPTIONS] [OBJECTS...]\n\ - OBJECTS\n\ - -i, --input input file name\n\ - -o, --output output file name\n\ - -s, --source source object name\n\ - -d, --destination destination object name\n\ - OPTIONS\n\ - -h, --help Print a usage message and exit\n\ - -p, --parents No error if existing, make parent groups as needed\n\ - -v, --verbose Print information about OBJECTS and OPTIONS\n\ - -V, --version Print version number and exit\n\ - -f, --flag Flag type\n\n\ - Flag type is one of the following strings:\n\n\ - shallow Copy only immediate members for groups\n\n\ - soft Expand soft links into new objects\n\n\ - ext Expand external links into new objects\n\n\ - ref Copy references and any referenced objects, i.e., objects\n\ - that the references point to.\n\ - Referenced objects are copied in addition to the objects\n\ - specified on the command line and reference datasets are\n\ - populated with correct reference values. Copies of referenced\n\ - datasets outside the copy range specified on the command line\n\ - will normally have a different name from the original.\n\ - (Default:Without this option, reference value(s) in any\n\ - reference datasets are set to NULL and referenced objects are\n\ - not copied unless they are otherwise within the copy range\n\ - specified on the command line.)\n\n\ - noattr Copy object without copying attributes\n\n\ - allflags Switches all flags from the default to the non-default setting\n\n\ - These flag types correspond to the following API symbols\n\n\ - H5O_COPY_SHALLOW_HIERARCHY_FLAG\n\ - H5O_COPY_EXPAND_SOFT_LINK_FLAG\n\ - H5O_COPY_EXPAND_EXT_LINK_FLAG\n\ - H5O_COPY_EXPAND_REFERENCE_FLAG\n\ - H5O_COPY_WITHOUT_ATTR_FLAG\n\ - H5O_COPY_ALL\n"); + FLUSHSTREAM(rawoutstream); + PRINTVALSTREAM(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "usage: h5copy [OPTIONS] [OBJECTS...]\n"); + PRINTVALSTREAM(rawoutstream, " OBJECTS\n"); + PRINTVALSTREAM(rawoutstream, " -i, --input input file name\n"); + PRINTVALSTREAM(rawoutstream, " -o, --output output file name\n"); + PRINTVALSTREAM(rawoutstream, " -s, --source source object name\n"); + PRINTVALSTREAM(rawoutstream, " -d, --destination destination object name\n"); + PRINTVALSTREAM(rawoutstream, " OPTIONS\n"); + PRINTVALSTREAM(rawoutstream, " -h, --help Print a usage message and exit\n"); + PRINTVALSTREAM(rawoutstream, " -p, --parents No error if existing, make parent groups as needed\n"); + PRINTVALSTREAM(rawoutstream, " -v, --verbose Print information about OBJECTS and OPTIONS\n"); + PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n"); + PRINTVALSTREAM(rawoutstream, " -f, --flag Flag type\n\n"); + PRINTVALSTREAM(rawoutstream, " Flag type is one of the following strings:\n\n"); + PRINTVALSTREAM(rawoutstream, " shallow Copy only immediate members for groups\n\n"); + PRINTVALSTREAM(rawoutstream, " soft Expand soft links into new objects\n\n"); + PRINTVALSTREAM(rawoutstream, " ext Expand external links into new objects\n\n"); + PRINTVALSTREAM(rawoutstream, " ref Copy references and any referenced objects, i.e., objects\n"); + PRINTVALSTREAM(rawoutstream, " that the references point to.\n"); + PRINTVALSTREAM(rawoutstream, " Referenced objects are copied in addition to the objects\n"); + PRINTVALSTREAM(rawoutstream, " specified on the command line and reference datasets are\n"); + PRINTVALSTREAM(rawoutstream, " populated with correct reference values. Copies of referenced\n"); + PRINTVALSTREAM(rawoutstream, " datasets outside the copy range specified on the command line\n"); + PRINTVALSTREAM(rawoutstream, " will normally have a different name from the original.\n"); + PRINTVALSTREAM(rawoutstream, " (Default:Without this option, reference value(s) in any\n"); + PRINTVALSTREAM(rawoutstream, " reference datasets are set to NULL and referenced objects are\n"); + PRINTVALSTREAM(rawoutstream, " not copied unless they are otherwise within the copy range\n"); + PRINTVALSTREAM(rawoutstream, " specified on the command line.)\n\n"); + PRINTVALSTREAM(rawoutstream, " noattr Copy object without copying attributes\n\n"); + PRINTVALSTREAM(rawoutstream, " allflags Switches all flags from the default to the non-default setting\n\n"); + PRINTVALSTREAM(rawoutstream, " These flag types correspond to the following API symbols\n\n"); + PRINTVALSTREAM(rawoutstream, " H5O_COPY_SHALLOW_HIERARCHY_FLAG\n"); + PRINTVALSTREAM(rawoutstream, " H5O_COPY_EXPAND_SOFT_LINK_FLAG\n"); + PRINTVALSTREAM(rawoutstream, " H5O_COPY_EXPAND_EXT_LINK_FLAG\n"); + PRINTVALSTREAM(rawoutstream, " H5O_COPY_EXPAND_REFERENCE_FLAG\n"); + PRINTVALSTREAM(rawoutstream, " H5O_COPY_WITHOUT_ATTR_FLAG\n"); + PRINTVALSTREAM(rawoutstream, " H5O_COPY_ALL\n"); } @@ -215,6 +217,11 @@ static int parse_flag(const char* s_flag, unsigned *flag) int main (int argc, const char *argv[]) { + int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ + H5E_auto2_t func; + H5E_auto2_t tools_func; + void *edata; + void *tools_edata; hid_t fid_src = -1; hid_t fid_dst = -1; unsigned flag = 0; @@ -229,14 +236,22 @@ main (int argc, const char *argv[]) h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); - /* initialize h5tools lib */ + /* Disable error reporting */ + H5Eget_auto2(H5E_DEFAULT, &func, &edata); + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); + + /* Initialize h5tools lib */ h5tools_init(); + /* Disable tools error reporting */ + H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata); + H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL); + /* init linkinfo struct */ HDmemset(&linkinfo, 0, sizeof(h5tool_link_info_t)); /* Check for no command line parameters */ - if(argc == 1) + if(argc == 1) { usage(); leave(EXIT_FAILURE); @@ -291,6 +306,10 @@ main (int argc, const char *argv[]) verbose = 1; break; + case 'E': + enable_error_stack = TRUE; + break; + default: usage(); leave(EXIT_FAILURE); @@ -329,6 +348,11 @@ main (int argc, const char *argv[]) leave(EXIT_FAILURE); } + if (enable_error_stack) { + H5Eset_auto2(H5E_DEFAULT, func, edata); + H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata); + } + /*------------------------------------------------------------------------- * open output file *-------------------------------------------------------------------------*/ @@ -393,19 +417,19 @@ main (int argc, const char *argv[]) /* create property to pass copy options */ if ( (ocpl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0) - goto error; + HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pcreate failed"); /* set options for object copy */ if (flag) { if ( H5Pset_copy_object(ocpl_id, flag) < 0) - goto error; + HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pset_copy_object failed"); } /* Create link creation property list */ if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) { error_msg("Could not create link creation property list\n"); - goto error; + HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pcreate failed"); } /* end if */ /* Check for creating intermediate groups */ @@ -413,7 +437,7 @@ main (int argc, const char *argv[]) /* Set the intermediate group creation property */ if(H5Pset_create_intermediate_group(lcpl_id, 1) < 0) { error_msg("Could not set property for creating parent groups\n"); - goto error; + HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pset_create_intermediate_group failed"); } /* end if */ /* Display some output if requested */ @@ -424,7 +448,7 @@ main (int argc, const char *argv[]) { size_t i, len; - len = HDstrlen(oname_dst); + len = HDstrlen(oname_dst); /* check if all the parents groups exist. skip root group */ for (i = 1; i < len; i++) @@ -440,7 +464,7 @@ main (int argc, const char *argv[]) { error_msg("group <%s> doesn't exist. Use -p to create parent groups.\n", str_ptr); HDfree(str_ptr); - goto error; + HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Lexists failed"); } HDfree(str_ptr); } @@ -450,17 +474,17 @@ main (int argc, const char *argv[]) /*------------------------------------------------------------------------- * do the copy *-------------------------------------------------------------------------*/ - + if(verbose) linkinfo.opt.msg_mode = 1; - + li_ret = H5tools_get_symlink_info(fid_src, oname_src, &linkinfo, 1); if (li_ret == 0) /* dangling link */ { - if(H5Lcopy(fid_src, oname_src, + if(H5Lcopy(fid_src, oname_src, fid_dst, oname_dst, H5P_DEFAULT, H5P_DEFAULT) < 0) - goto error; + HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Lcopy failed"); } else /* valid link */ { @@ -470,33 +494,33 @@ main (int argc, const char *argv[]) oname_dst, /* Name of the destination object */ ocpl_id, /* Object copy property list */ lcpl_id)<0) /* Link creation property list */ - goto error; + HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Ocopy failed"); } /* free link info path */ if (linkinfo.trg_path) - HDfree((char*)linkinfo.trg_path); + HDfree(linkinfo.trg_path); /* close propertis */ if(H5Pclose(ocpl_id)<0) - goto error; + HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pclose failed"); if(H5Pclose(lcpl_id)<0) - goto error; + HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pclose failed"); /* close files */ if (H5Fclose(fid_src)<0) - goto error; + HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Fclose failed"); if (H5Fclose(fid_dst)<0) - goto error; + HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Fclose failed"); leave(EXIT_SUCCESS); -error: +done: printf("Error in copy...Exiting\n"); /* free link info path */ if (linkinfo.trg_path) - HDfree((char*)linkinfo.trg_path); + HDfree(linkinfo.trg_path); H5E_BEGIN_TRY { H5Pclose(ocpl_id); @@ -505,6 +529,6 @@ error: H5Fclose(fid_dst); } H5E_END_TRY; - leave(EXIT_FAILURE); + leave(ret_value); } diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c index a371cc0..98335b8 100644 --- a/tools/h5diff/h5diff_common.c +++ b/tools/h5diff/h5diff_common.c @@ -249,16 +249,17 @@ void parse_command_line(int argc, usage(); h5diff_exit(EXIT_FAILURE); } - options->count = atol( opt_arg ); - + options->count = HDstrtoull(opt_arg, NULL, 0); break; case 'N': options->do_nans = 0; break; + case 'c': options->m_list_not_cmp = 1; break; + case 'e': options->use_system_epsilon = 1; break; diff --git a/tools/h5diff/h5diff_main.c b/tools/h5diff/h5diff_main.c index a916ec5..2b971f4 100644 --- a/tools/h5diff/h5diff_main.c +++ b/tools/h5diff/h5diff_main.c @@ -16,6 +16,7 @@ #include #include #include +#include "H5private.h" #include "h5diff.h" #include "h5diff_common.h" #include "h5tools.h" @@ -138,6 +139,6 @@ int main(int argc, const char *argv[]) */ void h5diff_exit(int status) { - exit(status); + HDexit(status); } diff --git a/tools/h5dump/CMakeTests.cmake b/tools/h5dump/CMakeTests.cmake index fb3c253..422fc83 100644 --- a/tools/h5dump/CMakeTests.cmake +++ b/tools/h5dump/CMakeTests.cmake @@ -381,7 +381,7 @@ ############################################################################## ############################################################################## - MACRO (ADD_HELP_TEST testname resultcode) + macro (ADD_HELP_TEST testname resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${testname} COMMAND $ ${ARGN}) @@ -403,9 +403,9 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - ENDMACRO () + endmacro () - MACRO (ADD_SKIP_H5_TEST skipresultfile skipresultcode testtype) + macro (ADD_SKIP_H5_TEST skipresultfile skipresultcode testtype) if (${testtype} STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -416,9 +416,9 @@ else () ADD_H5_TEST (${skipresultfile} ${skipresultcode} ${ARGN}) endif () - ENDMACRO () + endmacro () - MACRO (ADD_H5_TEST resultfile resultcode) + macro (ADD_H5_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN}) @@ -449,9 +449,9 @@ ) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") endif () - ENDMACRO () + endmacro () - MACRO (ADD_H5_TEST_N resultfile resultcode) + macro (ADD_H5_TEST_N resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-N-${resultfile} COMMAND $ ${ARGN}) @@ -482,9 +482,9 @@ ) set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES DEPENDS "H5DUMP-N-${resultfile}-clear-objects") endif () - ENDMACRO () + endmacro () - MACRO (ADD_H5_TEST_EXPORT resultfile targetfile resultcode) + macro (ADD_H5_TEST_EXPORT resultfile targetfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN} ${resultfile}.txt ${targetfile}) @@ -522,9 +522,9 @@ 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 () - ENDMACRO () + endmacro () - MACRO (ADD_H5_TEST_EXPORT_DDL resultfile targetfile resultcode ddlfile) + macro (ADD_H5_TEST_EXPORT_DDL resultfile targetfile resultcode ddlfile) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND $ --ddl=${ddlfile}.txt ${ARGN} ${resultfile}.txt ${targetfile}) @@ -569,9 +569,9 @@ 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 () + endmacro () - MACRO (ADD_H5_EXPORT_TEST resultfile targetfile resultcode) + macro (ADD_H5_EXPORT_TEST resultfile targetfile resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5DUMP-output-${resultfile}-clear-objects @@ -593,9 +593,9 @@ 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 () + endmacro () - MACRO (ADD_H5_MASK_TEST resultfile resultcode) + macro (ADD_H5_MASK_TEST resultfile resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5DUMP-${resultfile} @@ -610,9 +610,9 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - ENDMACRO () + endmacro () - MACRO (ADD_H5ERR_MASK_TEST resultfile resultcode) + macro (ADD_H5ERR_MASK_TEST resultfile resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5DUMP-${resultfile} @@ -628,9 +628,9 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - ENDMACRO () + endmacro () - MACRO (ADD_H5ERR_MASK_ENV_TEST resultfile resultcode envvar envval) + macro (ADD_H5ERR_MASK_ENV_TEST resultfile resultcode envvar envval) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5DUMP-${resultfile} @@ -648,9 +648,9 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - ENDMACRO () + endmacro () - MACRO (ADD_H5_TEST_IMPORT conffile resultfile testfile resultcode) + macro (ADD_H5_TEST_IMPORT conffile resultfile testfile resultcode) # If using memchecker add tests without using scripts if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -678,9 +678,9 @@ 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}) endif () - ENDMACRO () + endmacro () - MACRO (ADD_H5_UD_TEST testname resultcode resultfile) + macro (ADD_H5_UD_TEST testname resultcode resultfile) if (NOT HDF5_ENABLE_USING_MEMCHECKER) # Remove any output file left over from previous test run add_test ( @@ -705,7 +705,7 @@ ) set_tests_properties (H5DUMP_UD-${testname} PROPERTIES DEPENDS H5DUMP_UD-${testname}-clearall-objects) endif () - ENDMACRO () + endmacro () ############################################################################## ############################################################################## diff --git a/tools/h5dump/CMakeTestsPBITS.cmake b/tools/h5dump/CMakeTestsPBITS.cmake index c6bd78c..a36afc1 100644 --- a/tools/h5dump/CMakeTestsPBITS.cmake +++ b/tools/h5dump/CMakeTestsPBITS.cmake @@ -108,7 +108,7 @@ ############################################################################## ############################################################################## - MACRO (ADD_H5_PBITS_TEST resultfile resultcode) + macro (ADD_H5_PBITS_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN}) @@ -132,7 +132,7 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - ENDMACRO () + endmacro () ############################################################################## ############################################################################## diff --git a/tools/h5dump/CMakeTestsXML.cmake b/tools/h5dump/CMakeTestsXML.cmake index 6cdc81c..7fb9a3b 100644 --- a/tools/h5dump/CMakeTestsXML.cmake +++ b/tools/h5dump/CMakeTestsXML.cmake @@ -144,7 +144,7 @@ ############################################################################## ############################################################################## - MACRO (ADD_XML_SKIP_H5_TEST skipresultfile skipresultcode testtype) + macro (ADD_XML_SKIP_H5_TEST skipresultfile skipresultcode testtype) if (${testtype} STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -155,9 +155,9 @@ else () ADD_XML_H5_TEST (${skipresultfile} ${skipresultcode} ${ARGN}) endif () - ENDMACRO () + endmacro () - MACRO (ADD_XML_H5_TEST resultfile resultcode) + macro (ADD_XML_H5_TEST resultfile resultcode) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-XML-${resultfile} COMMAND $ --xml ${ARGN}) set_tests_properties (H5DUMP-XML-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/xml") @@ -180,7 +180,7 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - ENDMACRO () + endmacro () ############################################################################## ############################################################################## diff --git a/tools/h5dump/h5dump_extern.h b/tools/h5dump/h5dump_extern.h index 08f9e36..2a8c9f6 100644 --- a/tools/h5dump/h5dump_extern.h +++ b/tools/h5dump/h5dump_extern.h @@ -52,7 +52,7 @@ typedef struct h5dump_table_list_t { extern h5dump_table_list_t table_list; extern table_t *group_table, *dset_table, *type_table; -extern int dump_indent; /*how far in to indent the line */ +extern unsigned dump_indent; /*how far in to indent the line */ extern int unamedtype; /* shared datatype with no name */ extern hbool_t hit_elink; /* whether we have traversed an external link */ @@ -73,7 +73,6 @@ extern int display_fi; /*file index */ extern int display_ai; /*array index */ extern int display_escape; /*escape non printable characters */ extern int display_region; /*print region reference data */ -extern int enable_error_stack; /* re-enable error stack */ extern int disable_compact_subset; /* disable compact form of subset notation */ extern int display_packed_bits; /*print 1-8 byte numbers as packed bits*/ extern int include_attrs; /* Display attributes */ @@ -88,8 +87,8 @@ extern H5_iter_order_t sort_order; /*sort_order [ascending | descending] */ extern unsigned long long packed_mask[PACKED_BITS_MAX]; /* packed bits are restricted to 8*sizeof(llong) bytes */ /* packed bits display parameters */ -extern int packed_offset[PACKED_BITS_MAX]; -extern int packed_length[PACKED_BITS_MAX]; +extern unsigned packed_offset[PACKED_BITS_MAX]; +extern unsigned packed_length[PACKED_BITS_MAX]; /* * The global table is set to either ddl_function_table or diff --git a/tools/h5dump/h5dump_xml.c b/tools/h5dump/h5dump_xml.c index 8ad76e6..0b9f10f 100644 --- a/tools/h5dump/h5dump_xml.c +++ b/tools/h5dump/h5dump_xml.c @@ -156,7 +156,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; string_dataformat = *outputformat; @@ -332,9 +332,8 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ H5Dclose(obj); goto done; } - else { + else found_obj->displayed = TRUE; - } } /* end if */ dump_function_table->dump_dataset_function(obj, name, NULL); @@ -755,7 +754,7 @@ xml_escape_the_string(const char *str, int slen) if (slen < 0) len = HDstrlen(str); else - len = slen; + len = (size_t)slen; extra = 0; @@ -877,7 +876,7 @@ xml_print_datatype(hid_t type, unsigned in_group) HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; string_dataformat = *outputformat; @@ -953,7 +952,6 @@ xml_print_datatype(hid_t type, unsigned in_group) } } else { - switch (H5Tget_class(type)) { case H5T_INTEGER: ctx.need_prefix = TRUE; @@ -1582,7 +1580,7 @@ xml_dump_datatype(hid_t type) HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; string_dataformat = *outputformat; @@ -1592,7 +1590,7 @@ xml_dump_datatype(hid_t type) string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { + if (h5tools_nCols == 0) { string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } @@ -1721,7 +1719,7 @@ xml_dump_dataspace(hid_t space) HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; string_dataformat = *outputformat; @@ -1731,7 +1729,7 @@ xml_dump_dataspace(hid_t space) string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { + if (h5tools_nCols == 0) { string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } @@ -1897,7 +1895,7 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset, h5tool_format_t string_dataformat; HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; /* Print all the values. */ @@ -1911,7 +1909,7 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset, string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { + if (h5tools_nCols == 0) { string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } @@ -1950,12 +1948,10 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset, if (obj_data == DATASET_DATA) { type = H5Dget_type(obj_id); - if (H5Tget_class(type) == H5T_REFERENCE) { + if (H5Tget_class(type) == H5T_REFERENCE) status = xml_print_refs(obj_id, DATASET_DATA); - } - else if (H5Tget_class(type) == H5T_STRING) { + else if (H5Tget_class(type) == H5T_STRING) status = xml_print_strs(obj_id, DATASET_DATA); - } else { h5tools_context_t datactx; HDmemset(&datactx, 0, sizeof(datactx)); @@ -2095,7 +2091,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; string_dataformat = *outputformat; @@ -2105,7 +2101,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { + if (h5tools_nCols == 0) { string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } @@ -2425,7 +2421,7 @@ xml_dump_named_datatype(hid_t type, const char *name) HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; string_dataformat = *outputformat; @@ -2435,7 +2431,7 @@ xml_dump_named_datatype(hid_t type, const char *name) string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { + if (h5tools_nCols == 0) { string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } @@ -2650,7 +2646,7 @@ xml_dump_group(hid_t gid, const char *name) HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; string_dataformat = *outputformat; @@ -2660,7 +2656,7 @@ xml_dump_group(hid_t gid, const char *name) string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { + if (h5tools_nCols == 0) { string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } @@ -3011,9 +3007,8 @@ xml_print_refs(hid_t did, int source) goto error; e = H5Dread(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); /* need to check result here */ - if (e < 0) { + if (e < 0) goto error; - } } else if (source == ATTRIBUTE_DATA) { space = H5Aget_space(did); @@ -3028,9 +3023,8 @@ xml_print_refs(hid_t did, int source) } e = H5Aread(did, H5T_STD_REF_OBJ, buf); /* need to check the result here */ - if (e < 0) { + if (e < 0) goto error; - } } refbuf = (hobj_ref_t *) buf; @@ -3039,7 +3033,7 @@ xml_print_refs(hid_t did, int source) HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; string_dataformat = *outputformat; @@ -3049,7 +3043,7 @@ xml_print_refs(hid_t did, int source) string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { + if (h5tools_nCols == 0) { string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } @@ -3140,20 +3134,16 @@ xml_print_strs(hid_t did, int source) h5tool_format_t string_dataformat; hsize_t curr_pos = 0; /* total data element position */ - if (source == DATASET_DATA) { + if (source == DATASET_DATA) type = H5Dget_type(did); - } - else if (source == ATTRIBUTE_DATA) { + else if (source == ATTRIBUTE_DATA) type = H5Aget_type(did); - } - else { + else /* return an error */ return FAIL; - } - if (H5Tget_class(type) != H5T_STRING) { + if (H5Tget_class(type) != H5T_STRING) /* return an error */ goto error; - } /* Check if we have VL data in the dataset's datatype */ is_vlstr = H5Tis_variable_str(type); @@ -3169,9 +3159,8 @@ xml_print_strs(hid_t did, int source) goto error; e = H5Dread(did, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); - if (e < 0) { + if (e < 0) goto error; - } } else if (source == ATTRIBUTE_DATA) { space = H5Aget_space(did); @@ -3185,9 +3174,8 @@ xml_print_strs(hid_t did, int source) goto error; e = H5Aread(did, type, buf); - if (e < 0) { + if (e < 0) goto error; - } } bp = (char*) buf; @@ -3198,7 +3186,7 @@ xml_print_strs(hid_t did, int source) HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; string_dataformat = *outputformat; @@ -3208,7 +3196,7 @@ xml_print_strs(hid_t did, int source) string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { + if (h5tools_nCols == 0) { string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } @@ -3314,7 +3302,7 @@ check_filters(hid_t dcpl) HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; string_dataformat = *outputformat; @@ -3324,7 +3312,7 @@ check_filters(hid_t dcpl) string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { + if (h5tools_nCols == 0) { string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } @@ -3454,7 +3442,7 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; string_dataformat = *outputformat; @@ -3464,7 +3452,7 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { + if (h5tools_nCols == 0) { string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } @@ -3824,7 +3812,7 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; t_name = xml_escape_the_name(name); @@ -3838,7 +3826,7 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { + if (h5tools_nCols == 0) { string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } @@ -4039,42 +4027,42 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s H5Pget_fill_time(dcpl, &ft); h5tools_str_append(&buffer, "FillTime=\""); switch (ft) { - case H5D_FILL_TIME_ALLOC: - h5tools_str_append(&buffer, "FillOnAlloc"); - break; - case H5D_FILL_TIME_NEVER: - h5tools_str_append(&buffer, "FillNever"); - break; - case H5D_FILL_TIME_IFSET: - h5tools_str_append(&buffer, "FillIfSet"); - break; + case H5D_FILL_TIME_ALLOC: + h5tools_str_append(&buffer, "FillOnAlloc"); + break; + case H5D_FILL_TIME_NEVER: + h5tools_str_append(&buffer, "FillNever"); + break; + case H5D_FILL_TIME_IFSET: + h5tools_str_append(&buffer, "FillIfSet"); + break; case H5D_FILL_TIME_ERROR: HDassert(0); /* fall through */ - default: - h5tools_str_append(&buffer, "?"); - break; + default: + h5tools_str_append(&buffer, "?"); + break; } /* end switch */ h5tools_str_append(&buffer, "\" "); H5Pget_alloc_time(dcpl, &at); h5tools_str_append(&buffer, "AllocationTime=\""); switch (at) { - case H5D_ALLOC_TIME_EARLY: - h5tools_str_append(&buffer, "Early"); - break; - case H5D_ALLOC_TIME_INCR: - h5tools_str_append(&buffer, "Incremental"); - break; - case H5D_ALLOC_TIME_LATE: - h5tools_str_append(&buffer, "Late"); - break; - case H5D_ALLOC_TIME_DEFAULT: + case H5D_ALLOC_TIME_EARLY: + h5tools_str_append(&buffer, "Early"); + break; + case H5D_ALLOC_TIME_INCR: + h5tools_str_append(&buffer, "Incremental"); + break; + case H5D_ALLOC_TIME_LATE: + h5tools_str_append(&buffer, "Late"); + break; + case H5D_ALLOC_TIME_DEFAULT: case H5D_ALLOC_TIME_ERROR: HDassert(0); /* fall through */ - default: - h5tools_str_append(&buffer, "?"); - break; + default: + h5tools_str_append(&buffer, "?"); + break; } /* end switch */ h5tools_str_append(&buffer, "\""); h5tools_str_append(&buffer, ">"); @@ -4418,7 +4406,7 @@ xml_print_enum(hid_t type) HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; string_dataformat = *outputformat; @@ -4428,7 +4416,7 @@ xml_print_enum(hid_t type) string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { + if (h5tools_nCols == 0) { string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } diff --git a/tools/h5import/CMakeTests.cmake b/tools/h5import/CMakeTests.cmake index 4e6e171..bfc5ef8 100644 --- a/tools/h5import/CMakeTests.cmake +++ b/tools/h5import/CMakeTests.cmake @@ -80,7 +80,7 @@ ### T H E T E S T S M A C R O S ### ############################################################################## ############################################################################## - MACRO (ADD_H5_TEST testname importfile conffile testfile) + 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 $ ${importfile} -c ${conffile} -o ${testfile}) @@ -126,9 +126,9 @@ ) set_tests_properties (H5IMPORT-${testname}-H5DMP_CMP PROPERTIES DEPENDS H5IMPORT-${testname}-H5DMP) endif () - ENDMACRO () + endmacro () - MACRO (ADD_H5_DUMPTEST testname datasetname testfile) + macro (ADD_H5_DUMPTEST testname datasetname testfile) # If using memchecker skip tests if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -194,16 +194,16 @@ ) set_tests_properties (H5IMPORT-DUMP-${testname}-H5DFF PROPERTIES DEPENDS "H5IMPORT-DUMP-${testname}") endif () - ENDMACRO () + endmacro () - MACRO (ADD_H5_SKIP_DUMPTEST testname datasetname testfile) + macro (ADD_H5_SKIP_DUMPTEST testname datasetname testfile) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5IMPORT-DUMP-${testname}-SKIPPED COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${testname} ${datasetname} ${testfile} --- DEFLATE filter not available" ) endif () - ENDMACRO () + endmacro () # -------------------------------------------------------------------- # Determine if filter is available for h5diff diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c index 9617df3..d1aab0c 100644 --- a/tools/h5import/h5import.c +++ b/tools/h5import/h5import.c @@ -1439,7 +1439,7 @@ static int processConfigurationFile(char *infile, struct Input *in) #endif if (HDstrcmp("H5T_VARIABLE;", temp)) { char *more = temp; - ival = HDstrtol(more, &more, 10); + ival = (int)HDstrtol(more, &more, 10); if (getInputSize(in, ival) == -1) { (void) HDfprintf(stderr, err5b, infile); goto error; @@ -2279,13 +2279,13 @@ static int parseDimensions(struct Input *in, char *strm) HDstrncpy(temp, strm, sizeof(temp)); temp[sizeof(temp) - 1] = '\0'; in->sizeOfDimension[i++] - = HDstrtol(HDstrtok (temp, delimiter), NULL, BASE_10); + = HDstrtoull(HDstrtok (temp, delimiter), NULL, BASE_10); while (1) { token = HDstrtok (NULL, delimiter); if (token == NULL) break; - in->sizeOfDimension[i++] = HDstrtol(token, NULL, BASE_10); + in->sizeOfDimension[i++] = HDstrtoull(token, NULL, BASE_10); } return (0); } @@ -3121,7 +3121,7 @@ static int getRank(struct Input *in, FILE *strm) /* same as getChunkedDimensionSizes. But defined separately for extensibility */ static int getDimensionSizes(struct Input *in, FILE *strm) { - int ival; + unsigned long long ullval; int i = 0; const char *err1 = "Unable to allocate dynamic memory.\n"; @@ -3132,8 +3132,8 @@ static int getDimensionSizes(struct Input *in, FILE *strm) return (-1); } - while (fscanf(strm, "%d", (&ival)) == 1) - in->sizeOfDimension[i++] = ival; + while (fscanf(strm, "%llu", (&ullval)) == 1) + in->sizeOfDimension[i++] = ullval; if (in->rank != i) { (void) HDfprintf(stderr, "%s", err2); @@ -3144,7 +3144,7 @@ static int getDimensionSizes(struct Input *in, FILE *strm) /* same as getDimensionSizes. But defined separately for extensibility */ static int getChunkedDimensionSizes(struct Input *in, FILE *strm) { - int ival; + unsigned long long ullval; int i = 0; const char *err1 = "Unable to allocate dynamic memory.\n"; @@ -3156,8 +3156,8 @@ static int getChunkedDimensionSizes(struct Input *in, FILE *strm) return (-1); } - while (fscanf(strm, "%d", (&ival)) == 1) - in->sizeOfChunk[i++] = ival; + while (fscanf(strm, "%llu", (&ullval)) == 1) + in->sizeOfChunk[i++] = ullval; if (in->rank != i) { (void) HDfprintf(stderr, "%s", err2); @@ -3174,7 +3174,7 @@ static int getChunkedDimensionSizes(struct Input *in, FILE *strm) static int getMaximumDimensionSizes(struct Input *in, FILE *strm) { - int ival; + long long llval; int i = 0; const char *err1 = "Unable to allocate dynamic memory.\n"; @@ -3186,11 +3186,11 @@ static int getMaximumDimensionSizes(struct Input *in, FILE *strm) return (-1); } - while (fscanf(strm, "%d", (&ival)) == 1) { - if (ival == -1) + while (fscanf(strm, "%lld", (&llval)) == 1) { + if (llval == -1) in->maxsizeOfDimension[i++] = H5S_UNLIMITED; else - in->maxsizeOfDimension[i++] = ival; + in->maxsizeOfDimension[i++] = (hsize_t)llval; } if (in->rank != i) { @@ -3927,7 +3927,7 @@ static int process(struct Options *opt) return (-1); } HDfclose(extfile); - H5Pset_external(proplist, in->externFilename, (off_t) 0, numOfElements * in->inputSize / 8); + H5Pset_external(proplist, in->externFilename, (off_t)0, numOfElements * (hsize_t)in->inputSize / 8); } /* create dataspace */ diff --git a/tools/h5jam/CMakeTests.cmake b/tools/h5jam/CMakeTests.cmake index f82e0d6..c9ec521 100644 --- a/tools/h5jam/CMakeTests.cmake +++ b/tools/h5jam/CMakeTests.cmake @@ -40,7 +40,7 @@ # TEST_H5JAM_OUTPUT # For the purpose to verify only output & exitcode from h5jam # - MACRO (TEST_H5JAM_OUTPUT expectfile resultcode) + macro (TEST_H5JAM_OUTPUT expectfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5JAM-${expectfile} COMMAND $ ${ARGN}) @@ -60,13 +60,13 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - ENDMACRO () + endmacro () # ============================================================ # TEST_H5UNJAM_OUTPUT # For the purpose to verify only output & exitcode from h5unjam # - MACRO (TEST_H5UNJAM_OUTPUT expectfile resultcode) + macro (TEST_H5UNJAM_OUTPUT expectfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5JAM-UNJAM-${expectfile} COMMAND $ ${ARGN}) @@ -86,9 +86,9 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - ENDMACRO () + endmacro () - MACRO (CHECKFILE testname testdepends expected actual) + macro (CHECKFILE testname testdepends expected actual) # If using memchecker add tests without using scripts if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -118,9 +118,9 @@ ) set_tests_properties (H5JAM-${testname}-CHECKFILE-H5DMP_CMP PROPERTIES DEPENDS H5JAM-${testname}-CHECKFILE-H5DMP) endif () - ENDMACRO() + endmacro() - MACRO (UNJAMTEST testname setfile infile ufile chkfile outfile) + macro (UNJAMTEST testname setfile infile ufile chkfile outfile) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5JAM-${testname}-UNJAM-SETUP-clear-objects @@ -213,9 +213,9 @@ CHECKFILE (${testname} "H5JAM-${testname}-UNJAM-CHECK_NOUB" ${chkfile} ${outfile}) endif () - ENDMACRO() + endmacro() - MACRO (JAMTEST testname jamfile infile chkfile outfile) + macro (JAMTEST testname jamfile infile chkfile outfile) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5JAM-${testname}-clear-objects @@ -256,9 +256,9 @@ set_tests_properties (H5JAM-${testname}-CHECK_UB_1 PROPERTIES DEPENDS H5JAM-${testname}-CHECK_UB_1-clear-objects) CHECKFILE (${testname} "H5JAM-${testname}-CHECK_UB_1" ${chkfile} ${outfile}) endif () - ENDMACRO () + endmacro () - MACRO (JAMTEST_NONE testname jamfile infile setfile chkfile) + macro (JAMTEST_NONE testname jamfile infile setfile chkfile) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5JAM-${testname}_NONE-clear-objects @@ -311,7 +311,7 @@ set_tests_properties (H5JAM-${testname}_NONE-CHECK_UB_1 PROPERTIES DEPENDS H5JAM-${testname}_NONE-CHECK_UB_1-clear-objects) CHECKFILE (${testname} "H5JAM-${testname}_NONE-CHECK_UB_1" ${infile} ${chkfile}) endif () - ENDMACRO () + endmacro () ############################################################################## ############################################################################## diff --git a/tools/h5jam/getub.c b/tools/h5jam/getub.c index 776eaeb..4e02e6b 100644 --- a/tools/h5jam/getub.c +++ b/tools/h5jam/getub.c @@ -13,21 +13,14 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include -#include - -#ifdef H5_HAVE_UNISTD_H -#include -#endif - #include "H5private.h" #include "h5tools.h" #include "h5tools_utils.h" -void parse_command_line (int argc, const char *argv[]); +void parse_command_line(int argc, const char *argv[]); /* Name of tool */ -#define PROGRAMNAME "getub" +#define PROGRAM_NAME "getub" char *nbytes = NULL; static const char *s_opts = "c:"; /* add more later ? */ @@ -42,19 +35,14 @@ static struct long_options l_opts[] = { * Purpose: Print the usage message * * Return: void - * - * Programmer: - * - * Modifications: - * *------------------------------------------------------------------------- */ static void usage (const char *prog) { - fflush (stdout); - fprintf (stdout, "usage: %s -c nb file] \n", prog); - fprintf (stdout, " print first 'nb' byts of file to stdoug.\n"); + HDfflush(stdout); + HDfprintf(stdout, "usage: %s -c nb file] \n", prog); + HDfprintf(stdout, " print first 'nb' byts of file to stdoug.\n"); } /*------------------------------------------------------------------------- @@ -65,112 +53,105 @@ usage (const char *prog) * Return: Success: * * Failure: Exits program with EXIT_FAILURE value. - * - * Programmer: - * - * Modifications: - * *------------------------------------------------------------------------- */ - void -parse_command_line (int argc, const char *argv[]) +parse_command_line(int argc, const char *argv[]) { - int opt; - - /* parse command line options */ - while ((opt = get_option (argc, argv, s_opts, l_opts)) != EOF) - { - switch ((char) opt) - { - case 'c': - nbytes = HDstrdup (opt_arg); - break; - case '?': - default: - usage (h5tools_getprogname()); - exit (EXIT_FAILURE); - } - } - - if (argc <= opt_ind) - { + int opt; + + /* parse command line options */ + while((opt = get_option (argc, argv, s_opts, l_opts)) != EOF) { + switch((char) opt) { + case 'c': + nbytes = HDstrdup(opt_arg); + break; + case '?': + default: + usage(h5tools_getprogname()); + HDexit(EXIT_FAILURE); + } /* end switch */ + } /* end while */ + + if(argc <= opt_ind) { error_msg("missing file name\n"); - usage (h5tools_getprogname()); - exit (EXIT_FAILURE); - } -} + usage(h5tools_getprogname()); + HDexit(EXIT_FAILURE); + } /* end if */ +} /* end parse_command_line() */ int -main (int argc, const char *argv[]) +main(int argc, const char *argv[]) { - int fd; - unsigned int size; - char *filename; - long res; - char *buf; - - h5tools_setprogname(PROGRAMNAME); - h5tools_setstatus(EXIT_SUCCESS); - - /* Initialize h5tools lib */ - h5tools_init(); - - parse_command_line (argc, argv); - - if (nbytes == NULL) - { - /* missing arg */ - error_msg("missing size\n"); - usage (h5tools_getprogname()); - exit (EXIT_FAILURE); - } - if (argc <= (opt_ind)) - { - error_msg("missing file name\n"); - usage (h5tools_getprogname()); - exit (EXIT_FAILURE); - } - filename = HDstrdup (argv[opt_ind]); - - size = 0; - res = sscanf (nbytes, "%u", &size); - if (res == EOF) - { + int fd = -1; + unsigned size; + char *filename = NULL; + long res; + char *buf = NULL; + + h5tools_setprogname(PROGRAM_NAME); + h5tools_setstatus(EXIT_SUCCESS); + + /* Initialize h5tools lib */ + h5tools_init(); + + parse_command_line(argc, argv); + + if(NULL == nbytes) { + /* missing arg */ + error_msg("missing size\n"); + usage(h5tools_getprogname()); + goto error; + } /* end if */ + + if(argc <= (opt_ind)) { + error_msg("missing file name\n"); + usage(h5tools_getprogname()); + goto error; + } /* end if */ + + filename = HDstrdup(argv[opt_ind]); + + size = 0; + if(EOF == (res = sscanf(nbytes, "%u", &size))) { /* fail */ error_msg("missing file name\n"); - usage (h5tools_getprogname()); - exit (EXIT_FAILURE); - } - - fd = HDopen (filename, O_RDONLY, 0); - if (fd < 0) - { - error_msg("can't open file %s\n", filename); - exit (EXIT_FAILURE); - } - - buf = (char *)HDmalloc ((unsigned)(size + 1)); - if (buf == NULL) - { - HDclose (fd); - exit (EXIT_FAILURE); - } - - res = HDread (fd, buf, (unsigned)size); - - if (res < (long)size) - { - if (buf) - HDfree (buf); - HDclose (fd); - exit (EXIT_FAILURE); - } - - HDwrite (1, buf, (unsigned)size); - - if (buf) - HDfree (buf); - HDclose (fd); - return (EXIT_SUCCESS); -} + usage(h5tools_getprogname()); + goto error; + } /* end if */ + + if((fd = HDopen(filename, O_RDONLY, 0)) < 0) { + error_msg("can't open file %s\n", filename); + goto error; + } /* end if */ + + if(NULL == (buf = (char *)HDmalloc((unsigned)(size + 1)))) { + error_msg("can't allocate buffer \n"); + goto error; + } /* end if */ + + res = HDread(fd, buf, (unsigned)size); + if(res < (long)size) { + error_msg("Bad read \n"); + goto error; + } /* end if */ + + if(HDwrite(1, buf, (unsigned)size) < 0) { + error_msg("Bad write \n"); + goto error; + } /* end if */ + + /* close things and exit */ + HDfree(buf); + HDclose(fd); + + return EXIT_SUCCESS; + +error: + if(buf) + HDfree(buf); + if(fd > -1) + HDclose(fd); + return EXIT_FAILURE; +} /* end main() */ + diff --git a/tools/h5jam/h5jam.c b/tools/h5jam/h5jam.c index ab38f65..ad52553 100644 --- a/tools/h5jam/h5jam.c +++ b/tools/h5jam/h5jam.c @@ -421,109 +421,88 @@ main (int argc, const char *argv[]) * Return: Success: last byte written in the output. * Failure: Exits program with EXIT_FAILURE value. * - * Programmer: - * - * Modifications: - * *------------------------------------------------------------------------- */ hsize_t -copy_some_to_file (int infid, int outfid, hsize_t startin, hsize_t startout, +copy_some_to_file(int infid, int outfid, hsize_t startin, hsize_t startout, ssize_t limit) { - char buf[1024]; - h5_stat_t sbuf; - int res; - ssize_t tot = 0; - ssize_t howmuch = 0; - ssize_t nchars = -1; -/* used in assertion check - ssize_t ncw = -1; -*/ - ssize_t to; - ssize_t from; - ssize_t toend; - ssize_t fromend; - - if(startin > startout) { - /* this case is prohibited */ - error_msg("copy_some_to_file: panic: startin > startout?\n"); - exit (EXIT_FAILURE); - } - - if(limit < 0) { - res = HDfstat(infid, &sbuf); - if(res < 0) { - error_msg("Can't stat file \n"); - exit (EXIT_FAILURE); - } - - howmuch = (ssize_t)sbuf.st_size; - } - else - howmuch = limit; - - if(howmuch == 0) - return 0; - - /* assert (howmuch > 0) */ - - toend = (ssize_t) startout + howmuch; - fromend = (ssize_t) startin + howmuch; - - if (howmuch > 512) - { - to = toend - 512; - from = fromend - 512; - } - else - { - to = toend - howmuch; - from = fromend - howmuch; - } - - while (howmuch > 0) - { - HDlseek (outfid, (off_t) to, SEEK_SET); - HDlseek (infid, (off_t) from, SEEK_SET); - - if (howmuch > 512) - { - nchars = HDread (infid, buf, (unsigned) 512); - } - else - { - nchars = HDread (infid, buf, (unsigned)howmuch); - } - - if (nchars <= 0) - { - printf ("huh? \n"); - exit (EXIT_FAILURE); - } - /*ncw = */ HDwrite (outfid, buf, (unsigned) nchars); - - /* assert (ncw == nchars) */ - - tot += nchars; - howmuch -= nchars; - if (howmuch > 512) - { - to -= nchars; - from -= nchars; - } - else - { - to -= howmuch; - from -= howmuch; - } - } + char buf[1024]; + h5_stat_t sbuf; + int res; + ssize_t tot = 0; + ssize_t howmuch = 0; + ssize_t nchars = -1; + ssize_t to; + ssize_t from; + ssize_t toend; + ssize_t fromend; + + if(startin > startout) { + /* this case is prohibited */ + error_msg("copy_some_to_file: panic: startin > startout?\n"); + exit (EXIT_FAILURE); + } /* end if */ + + if(limit < 0) { + res = HDfstat(infid, &sbuf); + if(res < 0) { + error_msg("Can't stat file \n"); + HDexit(EXIT_FAILURE); + } /* end if */ + + howmuch = (ssize_t)sbuf.st_size; + } else { + howmuch = limit; + } /* end if */ + + if(0 == howmuch) + return 0; + + toend = (ssize_t) startout + howmuch; + fromend = (ssize_t) startin + howmuch; + + if (howmuch > 512) { + to = toend - 512; + from = fromend - 512; + } else { + to = toend - howmuch; + from = fromend - howmuch; + } /* end if */ + + while (howmuch > 0) { + HDlseek(outfid, (off_t) to, SEEK_SET); + HDlseek(infid, (off_t) from, SEEK_SET); + + if (howmuch > 512) { + nchars = HDread(infid, buf, (unsigned) 512); + } else { + nchars = HDread(infid, buf, (unsigned)howmuch); + } /* end if */ + + if (nchars <= 0) { + error_msg("Read error \n"); + HDexit(EXIT_FAILURE); + } /* end if */ + + if(HDwrite (outfid, buf, (unsigned) nchars) < 0) { + error_msg("Write error \n"); + HDexit(EXIT_FAILURE); + } - /* assert howmuch == 0 */ - /* assert tot == limit */ + tot += nchars; + howmuch -= nchars; + if(howmuch > 512) { + to -= nchars; + from -= nchars; + } else { + to -= howmuch; + from -= howmuch; + } /* end if */ + } /* end while */ - return ((hsize_t) tot + (hsize_t) startout); -} + return (hsize_t)tot + (hsize_t)startout; +} /* end copy_some_to_file() */ /*------------------------------------------------------------------------- @@ -539,28 +518,21 @@ copy_some_to_file (int infid, int outfid, hsize_t startin, hsize_t startout, * * Return: Success: last byte written in the output. * Failure: Exits program with EXIT_FAILURE value. - * - * Programmer: - * - * Modifications: - * *------------------------------------------------------------------------- */ hsize_t compute_user_block_size (hsize_t ublock_size) { - hsize_t where = 512; + hsize_t where = 512; - if (ublock_size == 0) - return 0; + if(0 == ublock_size) + return 0; - while (where < ublock_size) - { - where *= 2; - } + while(where < ublock_size) + where *= 2; - return (where); -} + return where; +} /* end compute_user_block_size() */ /* * Write zeroes to fill the file from 'where' to 512, 1024, etc. bytes. diff --git a/tools/h5ls/CMakeTests.cmake b/tools/h5ls/CMakeTests.cmake index 2addebf..f88ecf4 100644 --- a/tools/h5ls/CMakeTests.cmake +++ b/tools/h5ls/CMakeTests.cmake @@ -109,7 +109,7 @@ ############################################################################## ############################################################################## - MACRO (ADD_H5_TEST resultfile resultcode) + macro (ADD_H5_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5LS-${resultfile} COMMAND $ ${ARGN}) @@ -133,9 +133,9 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - ENDMACRO () + endmacro () - MACRO (ADD_H5_UD_TEST testname resultcode resultfile) + macro (ADD_H5_UD_TEST testname resultcode resultfile) if (NOT HDF5_ENABLE_USING_MEMCHECKER) # Remove any output file left over from previous test run add_test ( @@ -160,7 +160,7 @@ ) set_tests_properties (H5LS_UD-${testname} PROPERTIES DEPENDS H5LS_UD-${testname}-clearall-objects) endif () - ENDMACRO () + endmacro () ############################################################################## ############################################################################## diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index 4ab4f22..452f307 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -177,66 +177,65 @@ static herr_t visit_obj(hid_t file, const char *oname, iter_t *iter); static void usage (void) { - HDfprintf(rawerrorstream, "\ -usage: %s [OPTIONS] file[/OBJECT] [file[/[OBJECT]...]\n\ - OPTIONS\n\ - -h, -?, --help Print a usage message and exit\n\ - -a, --address Print raw data address. If dataset is contiguous, address\n\ - is offset in file of beginning of raw data. If chunked,\n\ - returned list of addresses indicates offset of each chunk.\n\ - Must be used with -v, --verbose option.\n\ - Provides no information for non-dataset objects.\n\ - -d, --data Print the values of datasets\n\ - --enable-error-stack\n\ - Prints messages from the HDF5 error stack as they occur.\n\ - --follow-symlinks\n\ - Follow symbolic links (soft links and external links)\n\ - to display target object information.\n\ - Without this option, h5ls identifies a symbolic link\n\ - as a soft link or external link and prints the value\n\ - assigned to the symbolic link; it does not provide any\n\ - information regarding the target object or determine\n\ - whether the link is a dangling link.\n\ - --no-dangling-links\n\ - Must be used with --follow-symlinks option;\n\ - otherwise, h5ls shows error message and returns an exit\n\ - code of 1. \n\ - Check for any symbolic links (soft links or external links)\n\ - that do not resolve to an existing object (dataset, group,\n\ - or named datatype).\n\ - If any dangling link is found, this situation is treated\n\ - as an error and h5ls returns an exit code of 1.\n\ - -f, --full Print full path names instead of base names\n\ - -g, --group Show information about a group, not its contents\n\ - -l, --label Label members of compound datasets\n\ - -r, --recursive List all groups recursively, avoiding cycles\n\ - -s, --string Print 1-byte integer datasets as ASCII\n\ - -S, --simple Use a machine-readable output format\n\ - -wN, --width=N Set the number of columns of output\n\ - -v, --verbose Generate more verbose output\n\ - -V, --version Print version number and exit\n\ - --vfd=DRIVER Use the specified virtual file driver\n\ - -x, --hexdump Show raw data in hexadecimal format\n\ -\n\ - file/OBJECT\n\ - Each object consists of an HDF5 file name optionally followed by a\n\ - slash and an object name within the file (if no object is specified\n\ - within the file then the contents of the root group are displayed).\n\ - The file name may include a printf(3C) integer format such as\n\ - \"%%05d\" to open a file family.\n\ -\n\ - Deprecated Options\n\ - The following options have been deprecated in HDF5. While they remain\n\ - available, they have been superseded as indicated and may be removed\n\ - from HDF5 in the future. Use the indicated replacement option in all\n\ - new work; where possible, existing scripts, et cetera, should also be\n\ - updated to use the replacement option.\n\ -\n\ - -E or --external Follow external links.\n\ - Replaced by --follow-symlinks.\n\ - -e, --errors Show all HDF5 error reporting\n\ - Replaced by --enable-error-stack.\n", - h5tools_getprogname()); + FLUSHSTREAM(rawoutstream); + PRINTVALSTREAM(rawoutstream, "usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...]\n"); + PRINTVALSTREAM(rawoutstream, " OPTIONS\n"); + PRINTVALSTREAM(rawoutstream, " -h, -?, --help Print a usage message and exit\n"); + PRINTVALSTREAM(rawoutstream, " -a, --address Print raw data address. If dataset is contiguous, address\n"); + PRINTVALSTREAM(rawoutstream, " is offset in file of beginning of raw data. If chunked,\n"); + PRINTVALSTREAM(rawoutstream, " returned list of addresses indicates offset of each chunk.\n"); + PRINTVALSTREAM(rawoutstream, " Must be used with -v, --verbose option.\n"); + PRINTVALSTREAM(rawoutstream, " Provides no information for non-dataset objects.\n"); + PRINTVALSTREAM(rawoutstream, " -d, --data Print the values of datasets\n"); + PRINTVALSTREAM(rawoutstream, " --enable-error-stack\n"); + PRINTVALSTREAM(rawoutstream, " Prints messages from the HDF5 error stack as they occur.\n"); + PRINTVALSTREAM(rawoutstream, " --follow-symlinks\n"); + PRINTVALSTREAM(rawoutstream, " Follow symbolic links (soft links and external links)\n"); + PRINTVALSTREAM(rawoutstream, " to display target object information.\n"); + PRINTVALSTREAM(rawoutstream, " Without this option, h5ls identifies a symbolic link\n"); + PRINTVALSTREAM(rawoutstream, " as a soft link or external link and prints the value\n"); + PRINTVALSTREAM(rawoutstream, " assigned to the symbolic link; it does not provide any\n"); + PRINTVALSTREAM(rawoutstream, " information regarding the target object or determine\n"); + PRINTVALSTREAM(rawoutstream, " whether the link is a dangling link.\n"); + PRINTVALSTREAM(rawoutstream, " --no-dangling-links\n"); + PRINTVALSTREAM(rawoutstream, " Must be used with --follow-symlinks option;\n"); + PRINTVALSTREAM(rawoutstream, " otherwise, h5ls shows error message and returns an exit\n"); + PRINTVALSTREAM(rawoutstream, " code of 1. \n"); + PRINTVALSTREAM(rawoutstream, " Check for any symbolic links (soft links or external links)\n"); + PRINTVALSTREAM(rawoutstream, " that do not resolve to an existing object (dataset, group,\n"); + PRINTVALSTREAM(rawoutstream, " or named datatype).\n"); + PRINTVALSTREAM(rawoutstream, " If any dangling link is found, this situation is treated\n"); + PRINTVALSTREAM(rawoutstream, " as an error and h5ls returns an exit code of 1.\n"); + PRINTVALSTREAM(rawoutstream, " -f, --full Print full path names instead of base names\n"); + PRINTVALSTREAM(rawoutstream, " -g, --group Show information about a group, not its contents\n"); + PRINTVALSTREAM(rawoutstream, " -l, --label Label members of compound datasets\n"); + PRINTVALSTREAM(rawoutstream, " -r, --recursive List all groups recursively, avoiding cycles\n"); + PRINTVALSTREAM(rawoutstream, " -s, --string Print 1-byte integer datasets as ASCII\n"); + PRINTVALSTREAM(rawoutstream, " -S, --simple Use a machine-readable output format\n"); + PRINTVALSTREAM(rawoutstream, " -wN, --width=N Set the number of columns of output\n"); + PRINTVALSTREAM(rawoutstream, " -v, --verbose Generate more verbose output\n"); + PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n"); + PRINTVALSTREAM(rawoutstream, " --vfd=DRIVER Use the specified virtual file driver\n"); + PRINTVALSTREAM(rawoutstream, " -x, --hexdump Show raw data in hexadecimal format\n"); + PRINTVALSTREAM(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, " file/OBJECT\n"); + PRINTVALSTREAM(rawoutstream, " Each object consists of an HDF5 file name optionally followed by a\n"); + PRINTVALSTREAM(rawoutstream, " slash and an object name within the file (if no object is specified\n"); + PRINTVALSTREAM(rawoutstream, " within the file then the contents of the root group are displayed).\n"); + PRINTVALSTREAM(rawoutstream, " The file name may include a printf(3C) integer format such as\n"); + PRINTVALSTREAM(rawoutstream, " \"%%05d\" to open a file family.\n"); + PRINTVALSTREAM(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, " Deprecated Options\n"); + PRINTVALSTREAM(rawoutstream, " The following options have been deprecated in HDF5. While they remain\n"); + PRINTVALSTREAM(rawoutstream, " available, they have been superseded as indicated and may be removed\n"); + PRINTVALSTREAM(rawoutstream, " from HDF5 in the future. Use the indicated replacement option in all\n"); + PRINTVALSTREAM(rawoutstream, " new work; where possible, existing scripts, et cetera, should also be\n"); + PRINTVALSTREAM(rawoutstream, " updated to use the replacement option.\n"); + PRINTVALSTREAM(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, " -E or --external Follow external links.\n"); + PRINTVALSTREAM(rawoutstream, " Replaced by --follow-symlinks.\n"); + PRINTVALSTREAM(rawoutstream, " -e, --errors Show all HDF5 error reporting\n"); + PRINTVALSTREAM(rawoutstream, " Replaced by --enable-error-stack.\n"); } @@ -2795,9 +2794,8 @@ main(int argc, const char *argv[]) file = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, preferred_driver, drivername, sizeof drivername); if(file >= 0) { - if(verbose_g) { + if(verbose_g) PRINTSTREAM(rawoutstream, "Opened \"%s\" with %s driver.\n", fname, drivername); - } break; /*success*/ } /* end if */ diff --git a/tools/h5repack/CMakeTests.cmake b/tools/h5repack/CMakeTests.cmake index fa454ce..0ed2804 100644 --- a/tools/h5repack/CMakeTests.cmake +++ b/tools/h5repack/CMakeTests.cmake @@ -19,7 +19,7 @@ set (VFD_LIST ${VFD_LIST} direct) endif () - MACRO (ADD_VFD_TEST vfdname resultcode) + macro (ADD_VFD_TEST vfdname resultcode) add_test ( NAME H5REPACK-VFD-${vfdname}-h5repacktest COMMAND "${CMAKE_COMMAND}" @@ -35,7 +35,7 @@ set_tests_properties (H5REPACK-VFD-${vfdname}-h5repacktest PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5REPACK-VFD-${vfdname}-h5repacktest") - ENDMACRO () + endmacro () endif () # -------------------------------------------------------------------- @@ -109,7 +109,7 @@ ############################################################################## ############################################################################## - MACRO (ADD_HELP_TEST testname resultcode) + macro (ADD_HELP_TEST testname resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5REPACK-${testname} COMMAND $ ${ARGN}) @@ -131,9 +131,9 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - ENDMACRO () + endmacro () - MACRO (ADD_H5_TEST_OLD testname testtype testfile) + macro (ADD_H5_TEST_OLD testname testtype testfile) if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -155,9 +155,9 @@ ) set_tests_properties (H5REPACK_OLD-${testname}_DFF PROPERTIES DEPENDS H5REPACK_OLD-${testname}) endif () - ENDMACRO () + endmacro () - MACRO (ADD_H5_TEST testname testtype testfile) + macro (ADD_H5_TEST testname testtype testfile) if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -179,9 +179,9 @@ ) set_tests_properties (H5REPACK-${testname}_DFF PROPERTIES DEPENDS H5REPACK-${testname}) endif () - ENDMACRO () + endmacro () - MACRO (ADD_H5_CMP_TEST testname testfilter testtype resultcode resultfile) + macro (ADD_H5_CMP_TEST testname testfilter testtype resultcode resultfile) if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -213,9 +213,9 @@ set_tests_properties (H5REPACK_CMP-${testname} PROPERTIES DEPENDS ${last_test}) endif () endif () - ENDMACRO () + endmacro () - MACRO (ADD_H5_DMP_TEST testname testtype resultcode resultfile) + macro (ADD_H5_DMP_TEST testname testtype resultcode resultfile) if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -246,9 +246,9 @@ set_tests_properties (H5REPACK_DMP-h5dump-${testname} PROPERTIES DEPENDS "H5REPACK_DMP-${testname}") endif () endif () - ENDMACRO () + endmacro () - MACRO (ADD_H5_VERIFY_TEST testname testtype resultcode testfile testdset testfilter) + macro (ADD_H5_VERIFY_TEST testname testtype resultcode testfile testdset testfilter) if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -310,9 +310,9 @@ endif () endif () endif () - ENDMACRO () + endmacro () - MACRO (ADD_H5_TEST_META testname testfile) + macro (ADD_H5_TEST_META testname testfile) add_test ( NAME H5REPACK_META-${testname}_N COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5 @@ -329,9 +329,9 @@ add_test (NAME H5REPACK_META-${testname} COMMAND ${CMAKE_COMMAND} -E compare_files ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5 ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_M.${testname}.h5) set_tests_properties (H5REPACK_META-${testname} PROPERTIES WILL_FAIL "true") set_tests_properties (H5REPACK_META-${testname} PROPERTIES DEPENDS H5REPACK_META-${testname}_M) - ENDMACRO () + endmacro () - MACRO (ADD_H5_UD_TEST testname resultcode resultfile) + macro (ADD_H5_UD_TEST testname resultcode resultfile) if (NOT HDF5_ENABLE_USING_MEMCHECKER) # Remove any output file left over from previous test run add_test ( @@ -370,7 +370,7 @@ ) set_tests_properties (H5REPACK_UD-h5dump-${testname} PROPERTIES DEPENDS "H5REPACK_UD-${testname}") endif () - ENDMACRO () + endmacro () ############################################################################## ############################################################################## @@ -982,7 +982,7 @@ ############################################################################## ### P L U G I N T E S T S ############################################################################## - ADD_H5_UD_TEST (plugin_version_test 0 h5repack_layout.h5 -v -f UD=260,4,9,1,8,18) + ADD_H5_UD_TEST (plugin_version_test 0 h5repack_layout.h5 -v -f UD=260,4,9,${H5_VERS_MAJOR},${H5_VERS_MINOR},${H5_VERS_RELEASE}) ADD_H5_UD_TEST (plugin_test 0 h5repack_layout.h5 -v -f UD=257,1,9) ADD_H5_UD_TEST (plugin_none 0 h5repack_layout.UD.h5 -v -f NONE) # check for no parameters diff --git a/tools/h5repack/dynlib_rpk.c b/tools/h5repack/dynlib_rpk.c index 70333f8..3469e58 100644 --- a/tools/h5repack/dynlib_rpk.c +++ b/tools/h5repack/dynlib_rpk.c @@ -38,8 +38,8 @@ const H5Z_class2_t H5Z_DYNLIB1[1] = {{ (H5Z_func_t)H5Z_filter_dynlib1, /* The actual filter function */ }}; -H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;} -const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB1;} +H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;} +const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB1;} /*------------------------------------------------------------------------- * Function: H5Z_filter_dynlib1 diff --git a/tools/h5repack/dynlib_vrpk.c b/tools/h5repack/dynlib_vrpk.c index 97cb211..8da0270 100644 --- a/tools/h5repack/dynlib_vrpk.c +++ b/tools/h5repack/dynlib_vrpk.c @@ -67,19 +67,19 @@ H5Z_filter_dynlib4(unsigned int flags, size_t cd_nelmts, /* Check for the library version */ if(H5get_libversion(&ver_info[0], &ver_info[1], &ver_info[2]) < 0) { PUSH_ERR("dynlib4", H5E_CALLBACK, "H5get_libversion"); - return 0; + return(0); } /* Check for the correct number of parameters */ if(cd_nelmts == 0) - return 0; + return(0); /* Check that permanent parameters are set correctly */ if(cd_values[0] > 9) - return 0; + return(0); if(ver_info[0] != cd_values[1] || ver_info[1] != cd_values[2]) { PUSH_ERR("dynlib4", H5E_CALLBACK, "H5get_libversion does not match"); - return 0; + return(0); } add_on = (int)cd_values[0]; diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index 3f99374..0c14992 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -79,21 +79,21 @@ int h5repack(const char* infile, const char* outfile, pack_opt_t *options) { */ int h5repack_init(pack_opt_t *options, int verbose) { - int k, n; - - HDmemset(options, 0, sizeof(pack_opt_t)); - options->min_comp = 0; - options->verbose = verbose; - options->layout_g = H5D_LAYOUT_ERROR; - - for (n = 0; n < H5_REPACK_MAX_NFILTERS; n++) { - options->filter_g[n].filtn = -1; - options->filter_g[n].cd_nelmts = 0; - for (k = 0; k < CD_VALUES; k++) - options->filter_g[n].cd_values[k] = 0; - } + int k, n; + + HDmemset(options, 0, sizeof(pack_opt_t)); + options->min_comp = 0; + options->verbose = verbose; + options->layout_g = H5D_LAYOUT_ERROR; + + for (n = 0; n < H5_REPACK_MAX_NFILTERS; n++) { + options->filter_g[n].filtn = -1; + options->filter_g[n].cd_nelmts = 0; + for (k = 0; k < CD_VALUES; k++) + options->filter_g[n].cd_values[k] = 0; + } - return (options_table_init(&(options->op_tbl))); + return (options_table_init(&(options->op_tbl))); } /*------------------------------------------------------------------------- diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index 9573ee8..c31f400 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -54,12 +54,12 @@ *------------------------------------------------------------------------- */ static int Get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], - size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p); + size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p); static void print_dataset_info(hid_t dcpl_id, char *objname, double per, int pr); static int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, - pack_opt_t *options); + pack_opt_t *options); static int copy_user_block(const char *infile, const char *outfile, - hsize_t size); + hsize_t size); #if defined (H5REPACK_DEBUG_USER_BLOCK) static void print_user_block(const char *filename, hid_t fid); #endif @@ -67,10 +67,10 @@ static herr_t walk_error_callback(unsigned n, const H5E_error2_t *err_desc, void /* get the major number from the error stack. */ static herr_t walk_error_callback(H5_ATTR_UNUSED unsigned n, const H5E_error2_t *err_desc, void *udata) { - if (err_desc) - *((hid_t *) udata) = err_desc->maj_num; + if (err_desc) + *((hid_t *) udata) = err_desc->maj_num; - return 0; + return 0; } /*------------------------------------------------------------------------- @@ -84,28 +84,18 @@ static herr_t walk_error_callback(H5_ATTR_UNUSED unsigned n, const H5E_error2_t * * Date: October, 23, 2003 * - * Modification: - * Peter Cao, June 13, 2007 - * Add "-L, --latest" and other options to pack a file with the latest file format - * - * Peter Cao, September 25, 2007 - * Copy user block when repacking a file - * - * Pedro Vicente, August 20, 2008 - * Add a user block to file if requested - * *------------------------------------------------------------------------- */ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) { - int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ - hid_t fidin; - hid_t fidout = -1; - trav_table_t *travt = NULL; - hsize_t ub_size = 0; /* size of user block */ - hid_t fcpl = H5P_DEFAULT; /* file creation property list ID */ - hid_t fapl = H5P_DEFAULT; /* file access property list ID */ + int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ + hid_t fidin; + hid_t fidout = -1; + trav_table_t *travt = NULL; + hsize_t ub_size = 0; /* size of user block */ + hid_t fcpl = H5P_DEFAULT; /* file creation property list ID */ + hid_t fapl = H5P_DEFAULT; /* file access property list ID */ /*------------------------------------------------------------------------- * open input file @@ -659,7 +649,7 @@ done: */ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, - pack_opt_t *options) /* repack options */ + pack_opt_t *options) /* repack options */ { int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ hid_t grp_in = -1; /* group ID */ @@ -1497,65 +1487,65 @@ void print_user_block(const char *filename, hid_t fid) { int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ int fh; /* file handle */ - hsize_t ub_size; /* user block size */ - hsize_t size; /* size read */ - hid_t fcpl; /* file creation property list ID for HDF5 file */ - int i; - - /* get user block size */ - if(( fcpl = H5Fget_create_plist(fid)) < 0) { - error_msg("failed to retrieve file creation property list\n"); + hsize_t ub_size; /* user block size */ + hsize_t size; /* size read */ + hid_t fcpl; /* file creation property list ID for HDF5 file */ + int i; + + /* get user block size */ + if(( fcpl = H5Fget_create_plist(fid)) < 0) { + error_msg("failed to retrieve file creation property list\n"); HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Fget_create_plist failed"); } - if(H5Pget_userblock(fcpl, &ub_size) < 0) { - error_msg("failed to retrieve userblock size\n"); + if(H5Pget_userblock(fcpl, &ub_size) < 0) { + error_msg("failed to retrieve userblock size\n"); HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pget_userblock failed"); } - if(H5Pclose(fcpl) < 0) { - error_msg("failed to close property list\n"); + if(H5Pclose(fcpl) < 0) { + error_msg("failed to close property list\n"); HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); } - /* open file */ - if((fh = HDopen(filename, O_RDONLY, 0)) < 0) { + /* open file */ + if((fh = HDopen(filename, O_RDONLY, 0)) < 0) { HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDopen failed"); } - size = ub_size; + size = ub_size; - /* read file */ - while(size > 0) { - ssize_t nread; /* # of bytes read */ - char rbuf[USERBLOCK_XFER_SIZE]; /* buffer for reading */ + /* read file */ + while(size > 0) { + ssize_t nread; /* # of bytes read */ + char rbuf[USERBLOCK_XFER_SIZE]; /* buffer for reading */ - /* read buffer */ - if(size > USERBLOCK_XFER_SIZE) - nread = HDread(fh, rbuf, (size_t)USERBLOCK_XFER_SIZE); - else - nread = HDread(fh, rbuf, (size_t)size); + /* read buffer */ + if(size > USERBLOCK_XFER_SIZE) + nread = HDread(fh, rbuf, (size_t)USERBLOCK_XFER_SIZE); + else + nread = HDread(fh, rbuf, (size_t)size); - for(i = 0; i < nread; i++) { + for(i = 0; i < nread; i++) { - printf("%c ", rbuf[i]); + printf("%c ", rbuf[i]); - } - printf("\n"); + } + printf("\n"); - if(nread < 0) { + if(nread < 0) { HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "nread < 0"); } - /* update size of userblock left to transfer */ - size -= nread; - } + /* update size of userblock left to transfer */ + size -= nread; + } done: - if(fh > 0) - HDclose(fh); + if(fh > 0) + HDclose(fh); - return; + return; } #endif diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index 7998ae8..912126f 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -191,14 +191,12 @@ static void usage(const char *prog) { * Programmer: Quincey Koziol * Saturday, 31. January 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ -static void leave(int ret) { - h5tools_close(); - - HDexit(ret); +static void leave(int ret) +{ + h5tools_close(); + HDexit(ret); } /*------------------------------------------------------------------------- @@ -214,134 +212,133 @@ static void leave(int ret) { * *------------------------------------------------------------------------- */ - static -int read_info(const char *filename, pack_opt_t *options) { - - char stype[10]; - char comp_info[1024]; - FILE *fp = NULL; - char c; - int i, rc = 1; - int ret_value = EXIT_SUCCESS; - - if ((fp = HDfopen(filename, "r")) == (FILE *) NULL) { - error_msg("cannot open options file %s\n", filename); - h5tools_setstatus(EXIT_FAILURE); - ret_value = EXIT_FAILURE; - goto done; - } - - /* cycle until end of file reached */ - while (1) { - rc = fscanf(fp, "%s", stype); - if (rc == -1) - break; - - /*------------------------------------------------------------------------- - * filter - *------------------------------------------------------------------------- - */ - if (HDstrcmp(stype,"-f") == 0) { - /* find begining of info */ - i = 0; - c = '0'; - while (c != ' ') { - if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { +int read_info(const char *filename, pack_opt_t *options) +{ + char stype[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + char comp_info[1024]; + FILE *fp = NULL; + char c; + int i, rc = 1; + int ret_value = EXIT_SUCCESS; + + if ((fp = HDfopen(filename, "r")) == (FILE *) NULL) { + error_msg("cannot open options file %s\n", filename); + h5tools_setstatus(EXIT_FAILURE); + ret_value = EXIT_FAILURE; + goto done; + } + + /* cycle until end of file reached */ + while (1) { + rc = fscanf(fp, "%s", stype); + if (rc == -1) + break; + + /*------------------------------------------------------------------------- + * filter + *------------------------------------------------------------------------- + */ + if (HDstrcmp(stype,"-f") == 0) { + /* find begining of info */ + i = 0; + c = '0'; + while (c != ' ') { + if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { error_msg("fscanf error\n"); h5tools_setstatus(EXIT_FAILURE); ret_value = EXIT_FAILURE; goto done; } /* end if */ - if (HDfeof(fp)) - break; - } - c = '0'; - /* go until end */ - while (c != ' ') { - if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { + if (HDfeof(fp)) + break; + } + c = '0'; + /* go until end */ + while (c != ' ') { + if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { error_msg("fscanf error\n"); h5tools_setstatus(EXIT_FAILURE); ret_value = EXIT_FAILURE; goto done; } /* end if */ - comp_info[i] = c; - i++; - if (HDfeof(fp)) - break; - if (c == 10 /*eol*/) - break; - } - comp_info[i - 1] = '\0'; /*cut the last " */ - - if (h5repack_addfilter(comp_info, options) == -1) { - error_msg("could not add compression option\n"); - h5tools_setstatus(EXIT_FAILURE); - ret_value = EXIT_FAILURE; - goto done; - } - } - /*------------------------------------------------------------------------- - * layout - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(stype,"-l") == 0) { - - /* find begining of info */ - i = 0; - c = '0'; - while (c != ' ') { - if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { + comp_info[i] = c; + i++; + if (HDfeof(fp)) + break; + if (c == 10 /*eol*/) + break; + } + comp_info[i - 1] = '\0'; /*cut the last " */ + + if (h5repack_addfilter(comp_info, options) == -1) { + error_msg("could not add compression option\n"); + h5tools_setstatus(EXIT_FAILURE); + ret_value = EXIT_FAILURE; + goto done; + } + } + /*------------------------------------------------------------------------- + * layout + *------------------------------------------------------------------------- + */ + else if (HDstrcmp(stype,"-l") == 0) { + + /* find begining of info */ + i = 0; + c = '0'; + while (c != ' ') { + if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { error_msg("fscanf error\n"); h5tools_setstatus(EXIT_FAILURE); ret_value = EXIT_FAILURE; goto done; } /* end if */ - if (HDfeof(fp)) - break; - } - c = '0'; - /* go until end */ - while (c != ' ') { - if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { + if (HDfeof(fp)) + break; + } + c = '0'; + /* go until end */ + while (c != ' ') { + if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { error_msg("fscanf error\n"); h5tools_setstatus(EXIT_FAILURE); ret_value = EXIT_FAILURE; goto done; } /* end if */ - comp_info[i] = c; - i++; - if (HDfeof(fp)) - break; - if (c == 10 /*eol*/) - break; - } - comp_info[i - 1] = '\0'; /*cut the last " */ - - if (h5repack_addlayout(comp_info, options) == -1) { - error_msg("could not add chunck option\n"); - h5tools_setstatus(EXIT_FAILURE); - ret_value = EXIT_FAILURE; - goto done; - } - } - /*------------------------------------------------------------------------- - * not valid - *------------------------------------------------------------------------- - */ - else { - error_msg("bad file format for %s", filename); - h5tools_setstatus(EXIT_FAILURE); - ret_value = EXIT_FAILURE; - goto done; - } - } + comp_info[i] = c; + i++; + if (HDfeof(fp)) + break; + if (c == 10 /*eol*/) + break; + } + comp_info[i - 1] = '\0'; /*cut the last " */ + + if (h5repack_addlayout(comp_info, options) == -1) { + error_msg("could not add chunck option\n"); + h5tools_setstatus(EXIT_FAILURE); + ret_value = EXIT_FAILURE; + goto done; + } + } + /*------------------------------------------------------------------------- + * not valid + *------------------------------------------------------------------------- + */ + else { + error_msg("bad file format for %s", filename); + h5tools_setstatus(EXIT_FAILURE); + ret_value = EXIT_FAILURE; + goto done; + } + } done: - if (fp) - HDfclose(fp); + if (fp) + HDfclose(fp); - return ret_value; + return ret_value; } /*------------------------------------------------------------------------- @@ -351,184 +348,178 @@ done: * *------------------------------------------------------------------------- */ - static -int parse_command_line(int argc, const char **argv, pack_opt_t* options) { - - int opt; - int ret_value = 0; - - /* parse command line options */ - while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { - switch ((char) opt) { - - /* -i for backward compability */ - case 'i': - infile = opt_arg; - has_i_o = 1; - break; - - /* -o for backward compability */ - case 'o': - outfile = opt_arg; - has_i_o = 1; - break; - - case 'h': - usage(h5tools_getprogname()); - h5tools_setstatus(EXIT_SUCCESS); - ret_value = -1; - goto done; - - case 'V': - print_version(h5tools_getprogname()); - h5tools_setstatus(EXIT_SUCCESS); - ret_value = -1; - goto done; - - case 'v': - options->verbose = 1; - break; - - case 'f': - /* parse the -f filter option */ - if (h5repack_addfilter(opt_arg, options) < 0) { - error_msg("in parsing filter\n"); - h5tools_setstatus(EXIT_FAILURE); - ret_value = -1; - goto done; - } - break; - - case 'l': - /* parse the -l layout option */ - if (h5repack_addlayout(opt_arg, options) < 0) { - error_msg("in parsing layout\n"); - h5tools_setstatus(EXIT_FAILURE); - ret_value = -1; - goto done; - } - break; - - case 'm': - options->min_comp = HDstrtoull(opt_arg , NULL, 0); - if ((int) options->min_comp <= 0) { - error_msg("invalid minimum compress size <%s>\n", opt_arg); - h5tools_setstatus(EXIT_FAILURE); - ret_value = -1; - goto done; - } - break; - - case 'e': - ret_value = read_info(opt_arg, options); - if (ret_value < 0) - goto done; - break; - - case 'n': - options->use_native = 1; - break; - - case 'L': - options->latest = 1; - break; - - case 'c': - options->grp_compact = HDatoi( opt_arg ); - if (options->grp_compact > 0) - options->latest = 1; /* must use latest format */ - break; - - case 'd': - options->grp_indexed = HDatoi( opt_arg ); - if (options->grp_indexed > 0) - options->latest = 1; /* must use latest format */ - break; - - case 's': - { - int idx = 0; - int ssize = 0; - char *msgPtr = HDstrchr( opt_arg, ':'); - options->latest = 1; /* must use latest format */ - if (msgPtr == NULL) { - ssize = HDatoi( opt_arg ); - for (idx = 0; idx < 5; idx++) - options->msg_size[idx] = ssize; - } - else { - char msgType[10]; - HDstrcpy(msgType, msgPtr + 1); - msgPtr[0] = '\0'; - ssize = HDatoi( opt_arg ); - if (HDstrncmp(msgType, "dspace",6) == 0) { - options->msg_size[0] = ssize; - } - else if (HDstrncmp(msgType, "dtype", 5) == 0) { - options->msg_size[1] = ssize; - } - else if (HDstrncmp(msgType, "fill", 4) == 0) { - options->msg_size[2] = ssize; - } - else if (HDstrncmp(msgType, "pline", 5) == 0) { - options->msg_size[3] = ssize; - } - else if (HDstrncmp(msgType, "attr", 4) == 0) { - options->msg_size[4] = ssize; - } - } - } - break; - - case 'u': - options->ublock_filename = opt_arg; - break; - - case 'b': - options->ublock_size = (hsize_t) HDatol( opt_arg ); - break; - - case 'M': - options->meta_block_size = (hsize_t) HDatol( opt_arg ); - break; - - case 't': - options->threshold = (hsize_t) HDatol( opt_arg ); - break; - - case 'a': - options->alignment = HDstrtoull(opt_arg , NULL, 0); - if (options->alignment < 1) { - error_msg("invalid alignment size\n", opt_arg); - h5tools_setstatus(EXIT_FAILURE); - ret_value = -1; - goto done; - } - break; - - case 'E': - enable_error_stack = TRUE; - break; +int parse_command_line(int argc, const char **argv, pack_opt_t* options) +{ + int opt; + int ret_value = 0; + + /* parse command line options */ + while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { + switch ((char) opt) { + + /* -i for backward compability */ + case 'i': + infile = opt_arg; + has_i_o = 1; + break; + + /* -o for backward compability */ + case 'o': + outfile = opt_arg; + has_i_o = 1; + break; + + case 'h': + usage(h5tools_getprogname()); + h5tools_setstatus(EXIT_SUCCESS); + ret_value = -1; + goto done; - default: - break; - } /* switch */ + case 'V': + print_version(h5tools_getprogname()); + h5tools_setstatus(EXIT_SUCCESS); + ret_value = -1; + goto done; + + case 'v': + options->verbose = 1; + break; + + case 'f': + /* parse the -f filter option */ + if (h5repack_addfilter(opt_arg, options) < 0) { + error_msg("in parsing filter\n"); + h5tools_setstatus(EXIT_FAILURE); + ret_value = -1; + goto done; + } + break; + + case 'l': + /* parse the -l layout option */ + if (h5repack_addlayout(opt_arg, options) < 0) { + error_msg("in parsing layout\n"); + h5tools_setstatus(EXIT_FAILURE); + ret_value = -1; + goto done; + } + break; + case 'm': + options->min_comp = HDstrtoull(opt_arg , NULL, 0); + if ((int) options->min_comp <= 0) { + error_msg("invalid minimum compress size <%s>\n", opt_arg); + h5tools_setstatus(EXIT_FAILURE); + ret_value = -1; + goto done; + } + break; + + case 'e': + ret_value = read_info(opt_arg, options); + if (ret_value < 0) + goto done; + break; + + case 'n': + options->use_native = 1; + break; + + case 'L': + options->latest = TRUE; + break; + + case 'c': + options->grp_compact = HDatoi( opt_arg ); + if (options->grp_compact > 0) + options->latest = TRUE; /* must use latest format */ + break; + + case 'd': + options->grp_indexed = HDatoi( opt_arg ); + if (options->grp_indexed > 0) + options->latest = TRUE; /* must use latest format */ + break; + + case 's': + { + int idx = 0; + int ssize = 0; + char *msgPtr = HDstrchr( opt_arg, ':'); + options->latest = TRUE; /* must use latest format */ + if (msgPtr == NULL) { + ssize = HDatoi( opt_arg ); + for (idx = 0; idx < 5; idx++) + options->msg_size[idx] = ssize; + } + else { + char msgType[10]; + + HDstrcpy(msgType, msgPtr + 1); + msgPtr[0] = '\0'; + ssize = HDatoi( opt_arg ); + if (HDstrncmp(msgType, "dspace",6) == 0) + options->msg_size[0] = ssize; + else if (HDstrncmp(msgType, "dtype", 5) == 0) + options->msg_size[1] = ssize; + else if (HDstrncmp(msgType, "fill", 4) == 0) + options->msg_size[2] = ssize; + else if (HDstrncmp(msgType, "pline", 5) == 0) + options->msg_size[3] = ssize; + else if (HDstrncmp(msgType, "attr", 4) == 0) + options->msg_size[4] = ssize; + } + } + break; + + case 'u': + options->ublock_filename = opt_arg; + break; + + case 'b': + options->ublock_size = (hsize_t) HDatol( opt_arg ); + break; + + case 'M': + options->meta_block_size = (hsize_t) HDatol( opt_arg ); + break; + + case 't': + options->threshold = (hsize_t) HDatol( opt_arg ); + break; + + case 'a': + options->alignment = HDstrtoull(opt_arg , NULL, 0); + if (options->alignment < 1) { + error_msg("invalid alignment size\n", opt_arg); + h5tools_setstatus(EXIT_FAILURE); + ret_value = -1; + goto done; + } + break; + + case 'E': + enable_error_stack = TRUE; + break; + + default: + break; + } /* switch */ } /* while */ if (has_i_o == 0) { - /* check for file names to be processed */ - if (argc <= opt_ind || argv[opt_ind + 1] == NULL) { - error_msg("missing file names\n"); - usage(h5tools_getprogname()); - h5tools_setstatus(EXIT_FAILURE); - ret_value = -1; - } - } + /* check for file names to be processed */ + if (argc <= opt_ind || argv[opt_ind + 1] == NULL) { + error_msg("missing file names\n"); + usage(h5tools_getprogname()); + h5tools_setstatus(EXIT_FAILURE); + ret_value = -1; + } + } done: - return ret_value; + return ret_value; } /*------------------------------------------------------------------------- @@ -548,16 +539,16 @@ done: * *------------------------------------------------------------------------- */ -int main(int argc, const char **argv) { +int main(int argc, const char **argv) +{ + pack_opt_t options; /*the global options */ H5E_auto2_t func; H5E_auto2_t tools_func; void *edata; void *tools_edata; - pack_opt_t options; /*the global options */ - - h5tools_setprogname(PROGRAMNAME); - h5tools_setstatus(EXIT_SUCCESS); + h5tools_setprogname(PROGRAMNAME); + h5tools_setstatus(EXIT_SUCCESS); /* Disable error reporting */ H5Eget_auto2(H5E_DEFAULT, &func, &edata); @@ -610,12 +601,12 @@ int main(int argc, const char **argv) { } /* pack it */ - h5tools_setstatus(h5repack(infile, outfile, &options)); + h5tools_setstatus(h5repack(infile, outfile, &options)); done: - /* free tables */ - h5repack_end(&options); + /* free tables */ + h5repack_end(&options); - leave(h5tools_getstatus()); + leave(h5tools_getstatus()); } diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c index 004b9e4..6759169 100644 --- a/tools/h5repack/h5repack_parse.c +++ b/tools/h5repack/h5repack_parse.c @@ -47,9 +47,9 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, int k, l, p, q, end_obj = -1, no_param = 0; unsigned j, n; char sobj[MAX_NC_NAME]; - char scomp[10]; - char stype[6]; - char smask[3]; + char scomp[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + char stype[6] = {0, 0, 0, 0, 0, 0}; + char smask[3] = {0, 0, 0}; obj_list_t* obj_list = NULL; unsigned pixels_per_block; @@ -396,6 +396,7 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, error_msg("invalid filter type in <%s>\n", str); HDexit(EXIT_FAILURE); } + break; } } /*i*/ diff --git a/tools/h5repack/h5repack_plugin.sh.in b/tools/h5repack/h5repack_plugin.sh.in index 336b3a4..ce77e43 100644 --- a/tools/h5repack/h5repack_plugin.sh.in +++ b/tools/h5repack/h5repack_plugin.sh.in @@ -1,16 +1,16 @@ #! /bin/sh # -# 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 files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic document set and is -# linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have access -# to either file, you may request a copy from help@hdfgroup.org. +# 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 files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic document set and is +# linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have access +# to either file, you may request a copy from help@hdfgroup.org. # srcdir=@srcdir@ TOP_BUILDDIR=@top_builddir@ @@ -246,9 +246,10 @@ TOOLTEST_DUMP() ############################################################################## # prepare for test COPY_TESTFILES_TO_TESTDIR +version_str=`echo @H5_VERSION@ | awk -F"-" '{print $1}' | sed 's/\./,/g'` # Run the test -arg="h5repack_layout.h5 -v -f UD=260,4,9,1,8,18" +arg="h5repack_layout.h5 -v -f UD=260,4,9,$version_str" TOOLTEST_DUMP plugin_version_test $arg arg="h5repack_layout.h5 -v -f UD=257,1,9" diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c index 60962aa..4993cbd 100644 --- a/tools/h5repack/h5repack_verify.c +++ b/tools/h5repack/h5repack_verify.c @@ -39,11 +39,6 @@ static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *fil * Programmer: Pedro Vicente, pvn@hdfgroup.org * * Date: December 19, 2003 - * Modified: December, 19, 2007 (exactly 4 years later :-) ) - * Separate into 3 cases - * 1) no filter input, get all datasets and compare DCPLs. TO DO - * 2) filter input on selected datasets, get each one trough OBJ and match - * 3) filter input on all datasets, get all objects and match * *------------------------------------------------------------------------- */ @@ -524,7 +519,7 @@ int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter) { case H5Z_FILTER_NONE: - break; + break; case H5Z_FILTER_SHUFFLE: /* 1 private client value is returned by DCPL */ diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c index 8221160..32d69bb 100644 --- a/tools/h5repack/h5repacktst.c +++ b/tools/h5repack/h5repacktst.c @@ -1537,7 +1537,7 @@ int main (void) hid_t fapl; fapl = h5_fileaccess(); - h5_cleanup(H5REPACK_FILENAMES, fapl); + h5_clean_files(H5REPACK_FILENAMES, fapl); } diff --git a/tools/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl b/tools/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl index 9f69270..09b2484 100644 --- a/tools/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl +++ b/tools/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl @@ -11,7 +11,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 8 18 } + PARAMS { 9 1 8 19 } } } FILLVALUE { @@ -33,7 +33,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 8 18 } + PARAMS { 9 1 8 19 } } } FILLVALUE { @@ -55,7 +55,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 8 18 } + PARAMS { 9 1 8 19 } } } FILLVALUE { @@ -77,7 +77,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 8 18 } + PARAMS { 9 1 8 19 } } } FILLVALUE { @@ -99,7 +99,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 8 18 } + PARAMS { 9 1 8 19 } } } FILLVALUE { @@ -121,7 +121,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 8 18 } + PARAMS { 9 1 8 19 } } } FILLVALUE { @@ -143,7 +143,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 8 18 } + PARAMS { 9 1 8 19 } } } FILLVALUE { diff --git a/tools/h5stat/CMakeTests.cmake b/tools/h5stat/CMakeTests.cmake index a3db0fc..12145f8 100644 --- a/tools/h5stat/CMakeTests.cmake +++ b/tools/h5stat/CMakeTests.cmake @@ -63,7 +63,7 @@ ############################################################################## ############################################################################## - MACRO (ADD_H5_TEST resultfile resultcode) + macro (ADD_H5_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5STAT-${resultfile} COMMAND $ ${ARGN}) @@ -86,7 +86,7 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - ENDMACRO () + endmacro () ############################################################################## ############################################################################## diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c index 4cdb816..de406fd 100644 --- a/tools/h5stat/h5stat.c +++ b/tools/h5stat/h5stat.c @@ -293,7 +293,7 @@ ceil_log10(unsigned long x) ret++; } /* end while */ - return(ret); + return ret; } /* ceil_log10() */ diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index d7f5cb5..b275ab8 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -659,7 +659,8 @@ hsize_t h5diff(const char *fname1, { #ifdef H5_HAVE_ASPRINTF /* Use the asprintf() routine, since it does what we're trying to do below */ - HDasprintf(&obj1fullname, "/%s", objname1); + if(HDasprintf(&obj1fullname, "/%s", objname1) < 0) + goto out; #else /* H5_HAVE_ASPRINTF */ /* (malloc 2 more for "/" and end-of-line) */ obj1fullname = (char*)HDmalloc(HDstrlen(objname1) + 2); @@ -1167,7 +1168,8 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, /* make full path for obj1 */ #ifdef H5_HAVE_ASPRINTF /* Use the asprintf() routine, since it does what we're trying to do below */ - HDasprintf(&obj1_fullpath, "%s%s", grp1_path, table->objs[i].name); + if(HDasprintf(&obj1_fullpath, "%s%s", grp1_path, table->objs[i].name) < 0) + goto out; #else /* H5_HAVE_ASPRINTF */ obj1_fullpath = (char*)HDmalloc(HDstrlen(grp1_path) + HDstrlen(table->objs[i].name) + 1); HDstrcpy(obj1_fullpath, grp1_path); @@ -1177,7 +1179,8 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, /* make full path for obj2 */ #ifdef H5_HAVE_ASPRINTF /* Use the asprintf() routine, since it does what we're trying to do below */ - HDasprintf(&obj2_fullpath, "%s%s", grp2_path, table->objs[i].name); + if(HDasprintf(&obj2_fullpath, "%s%s", grp2_path, table->objs[i].name) < 0) + goto out; #else /* H5_HAVE_ASPRINTF */ obj2_fullpath = (char*)HDmalloc(HDstrlen(grp2_path) + HDstrlen(table->objs[i].name) + 1); HDstrcpy(obj2_fullpath, grp2_path); @@ -1471,6 +1474,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, } #endif /* H5_HAVE_PARALLEL */ +out: /* free table */ if (table) trav_table_free(table); diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index c3c9269..3dd8208 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -106,11 +106,9 @@ static void table_attrs_free( table_attrs_t *table ) *------------------------------------------------------------------------*/ static void table_attr_mark_exist(unsigned *exist, char *name, table_attrs_t *table) { - size_t curr_val; - + if(table->nattrs == table->size) { match_attr_t *new_attrs; - if(table->nattrs == table->size) { table->size = MAX(1, table->size * 2); new_attrs = (match_attr_t *)HDrealloc(table->attrs, table->size * sizeof(match_attr_t)); if(new_attrs) @@ -118,6 +116,8 @@ static void table_attr_mark_exist(unsigned *exist, char *name, table_attrs_t *ta } /* end if */ if(table->nattrs < table->size) { + size_t curr_val; + curr_val = table->nattrs; table->attrs[curr_val].exist[0] = exist[0]; table->attrs[curr_val].exist[1] = exist[1]; diff --git a/tools/lib/io_timer.c b/tools/lib/io_timer.c index b8d44de..fc0c782 100644 --- a/tools/lib/io_timer.c +++ b/tools/lib/io_timer.c @@ -199,9 +199,8 @@ set_time(io_time_t *pt, timer_type t, int start_stop) break; default: HDfprintf(stderr, "Unknown time clock type (%d)\n", pt->type); - return (NULL); - break; - } + return NULL; + } /* end switch */ #if 0 /* this does not belong here. Need fix in h5perf code when set_time() is called. -AKC- */ diff --git a/tools/misc/CMakeTests.cmake b/tools/misc/CMakeTests.cmake index ee60bf8..9c38132 100644 --- a/tools/misc/CMakeTests.cmake +++ b/tools/misc/CMakeTests.cmake @@ -69,7 +69,7 @@ ############################################################################## ############################################################################## - MACRO (ADD_H5_TEST resultfile resultcode resultoption) + macro (ADD_H5_TEST resultfile resultcode resultoption) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5MKGRP-${resultfile}-clear-objects @@ -105,9 +105,9 @@ ) set_tests_properties (H5MKGRP-${resultfile}-h5ls PROPERTIES DEPENDS H5MKGRP-${resultfile}) endif () - ENDMACRO () + endmacro () - MACRO (ADD_H5_CMP resultfile resultcode) + macro (ADD_H5_CMP resultfile resultcode) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5MKGRP_CMP-${resultfile} COMMAND $ ${ARGN}) else () @@ -131,7 +131,7 @@ ) set_tests_properties (H5MKGRP_CMP-${resultfile} PROPERTIES DEPENDS H5MKGRP_CMP-${resultfile}-clear-objects) endif () - ENDMACRO () + endmacro () ############################################################################## ############################################################################## diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c index 9c9153a..e37bcb3 100644 --- a/tools/misc/h5debug.c +++ b/tools/misc/h5debug.c @@ -57,15 +57,15 @@ /*------------------------------------------------------------------------- * Function: get_H5B2_class * - * Purpose: Determine the v2 B-tree class from the buffer read in. + * Purpose: Determine the v2 B-tree class from the buffer read in. * B-trees are debugged through the B-tree subclass. The subclass * identifier is two bytes after the B-tree signature. * - * Return: Non-NULL on success/NULL on failure + * Return: Non-NULL on success/NULL on failure * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Sep 11 2008 + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Sep 11 2008 * *------------------------------------------------------------------------- */ @@ -143,16 +143,18 @@ get_H5B2_class(const uint8_t *sig) int main(int argc, char *argv[]) { - hid_t fid, fapl, dxpl; + hid_t fid, fapl, dxpl; H5F_t *f; haddr_t addr = 0, extra = 0, extra2 = 0, extra3 = 0, extra4 = 0; uint8_t sig[H5F_SIGNATURE_LEN]; size_t u; + H5E_auto2_t func; + void *edata; herr_t status = SUCCEED; if(argc == 1) { - HDfprintf(stderr, "Usage: %s filename [signature-addr [extra]]\n", argv[0]); - HDexit(1); + HDfprintf(stderr, "Usage: %s filename [signature-addr [extra]]\n", argv[0]); + HDexit(1); } /* end if */ /* Initialize the library */ @@ -161,6 +163,10 @@ main(int argc, char *argv[]) HDexit(1); } /* end if */ + /* Disable error reporting */ + H5Eget_auto2(H5E_DEFAULT, &func, &edata); + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); + /* * Open the file and get the file descriptor. */ @@ -448,6 +454,8 @@ main(int argc, char *argv[]) H5Pclose(fapl); H5Fclose(fid); + H5Eset_auto2(H5E_DEFAULT, func, edata); + return 0; } /* main() */ diff --git a/tools/misc/h5mkgrp.c b/tools/misc/h5mkgrp.c index 8dee706..4ec923a 100644 --- a/tools/misc/h5mkgrp.c +++ b/tools/misc/h5mkgrp.c @@ -328,9 +328,6 @@ main(int argc, const char *argv[]) leave(EXIT_FAILURE); } /* end if */ - /* Shut down h5tools lib */ - h5tools_close(); - leave(EXIT_SUCCESS); } /* end main() */ diff --git a/tools/misc/h5repart.c b/tools/misc/h5repart.c index ffd52e8..e44c957 100644 --- a/tools/misc/h5repart.c +++ b/tools/misc/h5repart.c @@ -194,27 +194,25 @@ main (int argc, char *argv[]) int src, dst=-1; /*source & destination files */ int need_seek=FALSE; /*destination needs to seek? */ int need_write; /*data needs to be written? */ - /*struct stat sb; temporary file stat buffer */ - /*struct _stati64 sb;*/ - h5_stat_t sb; + h5_stat_t sb; /*temporary file stat buffer */ int verbose=FALSE; /*display file names? */ - const char *src_gen_name; /*general source name */ - char src_name[NAMELEN]; /*source member name */ + const char *src_gen_name; /*general source name */ + char *src_name=NULL; /*source member name */ int src_is_family; /*is source name a family name? */ int src_membno=0; /*source member number */ - const char *dst_gen_name; /*general destination name */ - char dst_name[NAMELEN]; /*destination member name */ + const char *dst_gen_name; /*general destination name */ + char *dst_name=NULL; /*destination member name */ int dst_is_family; /*is dst name a family name? */ int dst_membno=0; /*destination member number */ off_t left_overs=0; /*amount of zeros left over */ off_t src_offset=0; /*offset in source member */ off_t dst_offset=0; /*offset in destination member */ - off_t src_size; /*source logical member size */ + off_t src_size; /*source logical member size */ off_t src_act_size; /*source actual member size */ off_t dst_size=1 GB; /*destination logical memb size */ hid_t fapl; /*file access property list */ @@ -232,24 +230,30 @@ main (int argc, char *argv[]) * Parse switches. */ while (argno=0) { if(H5Fclose(file)<0) { perror ("H5Fclose"); exit (EXIT_FAILURE); - } - } + } /* end if */ + } /* end if */ if(H5Pclose(fapl)<0) { perror ("H5Pclose"); exit (EXIT_FAILURE); - } + } /* end if */ /* Free resources and return */ - HDfree (buf); + HDfree(src_name); + HDfree(dst_name); + HDfree(buf); return EXIT_SUCCESS; -} +} /* end main */ diff --git a/tools/perform/chunk.c b/tools/perform/chunk.c index d16fbd3..b1419ee 100644 --- a/tools/perform/chunk.c +++ b/tools/perform/chunk.c @@ -17,9 +17,9 @@ * Programmer: Robb Matzke * Thursday, May 14, 1998 * - * Purpose: Checks the effect of various I/O request sizes and raw data - * cache sizes. Performance depends on the amount of data read - * from disk and we use a filter to get that number. + * Purpose: Checks the effect of various I/O request sizes and raw data + * cache sizes. Performance depends on the amount of data read + * from disk and we use a filter to get that number. */ /* See H5private.h for how to include headers */ @@ -42,68 +42,68 @@ # define H5_ATTR_UNUSED __attribute__((unused)) #endif -#define FILE_NAME "chunk.h5" -#define LINESPOINTS "lines" -#define CH_SIZE 100 /*squared in terms of bytes */ -#define DS_SIZE 20 /*squared in terms of chunks */ -#define FILTER_COUNTER 305 -#define READ 0 -#define WRITE 1 -#define MIN(X,Y) ((X)<(Y)?(X):(Y)) -#define MAX(X,Y) ((X)>(Y)?(X):(Y)) -#define SQUARE(X) ((X)*(X)) +#define FILE_NAME "chunk.h5" +#define LINESPOINTS "lines" +#define CH_SIZE 100 /*squared in terms of bytes */ +#define DS_SIZE 20 /*squared in terms of chunks */ +#define FILTER_COUNTER 305 +#define READ 0 +#define WRITE 1 +#define MIN(X,Y) ((X)<(Y)?(X):(Y)) +#define MAX(X,Y) ((X)>(Y)?(X):(Y)) +#define SQUARE(X) ((X)*(X)) /* The row-major test */ -#define RM_CACHE_STRT 25 -#define RM_CACHE_END 25 -#define RM_CACHE_DELT 5 -#define RM_START (double)0.50F -#define RM_END (double)5.00F -#define RM_DELTA (double)0.50F -#define RM_W0 0.0F -#define RM_NRDCC 521 +#define RM_CACHE_STRT 25 +#define RM_CACHE_END 25 +#define RM_CACHE_DELT 5 +#define RM_START (double)0.50F +#define RM_END (double)5.00F +#define RM_DELTA (double)0.50F +#define RM_W0 0.0F +#define RM_NRDCC 521 /* Diagonal test */ -#define DIAG_CACHE_STRT 25 -#define DIAG_CACHE_END 25 -#define DIAG_CACHE_DELT 5 -#define DIAG_START (double)0.50F -#define DIAG_END (double)5.00F -#define DIAG_DELTA (double)0.50F -/* #define DIAG_W0 0.65F */ -/* #define DIAG_NRDCC 521 */ - -static size_t nio_g; -static hid_t fapl_g = -1; +#define DIAG_CACHE_STRT 25 +#define DIAG_CACHE_END 25 +#define DIAG_CACHE_DELT 5 +#define DIAG_START (double)0.50F +#define DIAG_END (double)5.00F +#define DIAG_DELTA (double)0.50F +/* #define DIAG_W0 0.65F */ +/* #define DIAG_NRDCC 521 */ + +static size_t nio_g; +static hid_t fapl_g = -1; /* Local function prototypes */ static size_t counter (unsigned H5_ATTR_UNUSED flags, size_t cd_nelmts, - const unsigned *cd_values, size_t nbytes, - size_t *buf_size, void **buf); + const unsigned *cd_values, size_t nbytes, + size_t *buf_size, void **buf); /* This message derives from H5Z */ const H5Z_class2_t H5Z_COUNTER[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - FILTER_COUNTER, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "counter", /* Filter name for debugging */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + FILTER_COUNTER, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "counter", /* Filter name for debugging */ NULL, /* The "can apply" callback */ NULL, /* The "set local" callback */ - counter, /* The actual filter function */ + counter, /* The actual filter function */ }}; /*------------------------------------------------------------------------- - * Function: counter + * Function: counter * - * Purpose: Count number of bytes but don't do anything. + * Purpose: Count number of bytes but don't do anything. * - * Return: Success: src_nbytes-1 + * Return: Success: src_nbytes-1 * - * Failure: never fails + * Failure: never fails * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, May 14, 1998 * * Modifications: @@ -112,8 +112,8 @@ const H5Z_class2_t H5Z_COUNTER[1] = {{ */ static size_t counter (unsigned H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts, - const unsigned H5_ATTR_UNUSED *cd_values, size_t nbytes, - size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf) + const unsigned H5_ATTR_UNUSED *cd_values, size_t nbytes, + size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf) { nio_g += nbytes; return nbytes; @@ -121,16 +121,16 @@ counter (unsigned H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts, /*------------------------------------------------------------------------- - * Function: create_dataset + * Function: create_dataset * - * Purpose: Creates a square dataset with square chunks, registers a - * stupid compress/uncompress pair for counting I/O, and - * initializes the dataset. The chunk size is in bytes, the - * dataset size is in terms of chunks. + * Purpose: Creates a square dataset with square chunks, registers a + * stupid compress/uncompress pair for counting I/O, and + * initializes the dataset. The chunk size is in bytes, the + * dataset size is in terms of chunks. * - * Return: void + * Return: void * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, May 14, 1998 * * Modifications: @@ -140,13 +140,12 @@ counter (unsigned H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts, static void create_dataset (void) { - hid_t file, space, dcpl, dset; - hsize_t size[2]; - signed char *buf; + hid_t file, space, dcpl, dset; + hsize_t size[2]; + signed char *buf; /* The file */ file = H5Fcreate (FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_g); - assert(file>=0); /* The data space */ size[0] = size[1] = DS_SIZE * CH_SIZE; @@ -177,14 +176,14 @@ create_dataset (void) /*------------------------------------------------------------------------- - * Function: test_rowmaj + * Function: test_rowmaj * - * Purpose: Reads the entire dataset using the specified size-squared - * I/O requests in row major order. + * Purpose: Reads the entire dataset using the specified size-squared + * I/O requests in row major order. * - * Return: Efficiency: data requested divided by data actually read. + * Return: Efficiency: data requested divided by data actually read. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, May 14, 1998 * * Modifications: @@ -194,13 +193,13 @@ create_dataset (void) static double test_rowmaj (int op, size_t cache_size, size_t io_size) { - hid_t file, dset, mem_space, file_space; - signed char *buf = (signed char *)calloc (1, (size_t)(SQUARE(io_size))); - hsize_t i, j, hs_size[2]; - hsize_t hs_offset[2]; - int mdc_nelmts; - size_t rdcc_nelmts; - double w0; + hid_t file, dset, mem_space, file_space; + signed char *buf = (signed char *)calloc (1, (size_t)(SQUARE(io_size))); + hsize_t i, j, hs_size[2]; + hsize_t hs_offset[2]; + int mdc_nelmts; + size_t rdcc_nelmts; + double w0; H5Pget_cache (fapl_g, &mdc_nelmts, &rdcc_nelmts, NULL, &w0); #ifdef RM_W0 @@ -210,7 +209,7 @@ test_rowmaj (int op, size_t cache_size, size_t io_size) rdcc_nelmts = RM_NRDCC; #endif H5Pset_cache (fapl_g, mdc_nelmts, rdcc_nelmts, - cache_size*SQUARE (CH_SIZE), w0); + cache_size*SQUARE (CH_SIZE), w0); file = H5Fopen(FILE_NAME, H5F_ACC_RDWR, fapl_g); dset = H5Dopen2(file, "dset", H5P_DEFAULT); file_space = H5Dget_space(dset); @@ -218,27 +217,27 @@ test_rowmaj (int op, size_t cache_size, size_t io_size) for (i=0; i0) nio -= SQUARE (io_size-offset); + hs_offset[0] = hs_offset[1] = i; + hs_size[0] = hs_size[1] = MIN (io_size, CH_SIZE*DS_SIZE-i); + mem_space = H5Screate_simple (2, hs_size, hs_size); + H5Sselect_hyperslab (file_space, H5S_SELECT_SET, hs_offset, NULL, + hs_size, NULL); + if (READ==op) { + H5Dread (dset, H5T_NATIVE_SCHAR, mem_space, file_space, + H5P_DEFAULT, buf); + } else { + H5Dwrite (dset, H5T_NATIVE_SCHAR, mem_space, file_space, + H5P_DEFAULT, buf); + } + H5Sclose (mem_space); + nio += hs_size[0]*hs_size[1]; + if (i>0) nio -= SQUARE (io_size-offset); } free (buf); @@ -326,15 +325,15 @@ test_diag (int op, size_t cache_size, size_t io_size, size_t offset) /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: See file prologue. + * Purpose: See file prologue. * - * Return: Success: + * Return: Success: * - * Failure: + * Failure: * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, May 14, 1998 * * Modifications: @@ -344,11 +343,11 @@ test_diag (int op, size_t cache_size, size_t io_size, size_t offset) int main (void) { - size_t io_size; - double effic, io_percent; - FILE *f, *d; - size_t cache_size; - double w0; + size_t io_size; + double effic, io_percent; + FILE *f, *d; + size_t cache_size; + double w0; /* * Create a global file access property list. @@ -369,41 +368,41 @@ main (void) * windows. */ if (RM_CACHE_STRT==RM_CACHE_END) { - fprintf (f, "set yrange [0:1.2]\n"); - fprintf (f, "set ytics 0, 0.1, 1\n"); - fprintf (f, "set xlabel \"%s\"\n", - "Request size as a fraction of chunk size"); - fprintf (f, "set ylabel \"Efficiency\"\n"); - fprintf (f, "set title \"Cache %d chunks, w0=%g, " - "Size=(total=%d, chunk=%d)\"\n", - RM_CACHE_STRT, w0, DS_SIZE*CH_SIZE, CH_SIZE); + fprintf (f, "set yrange [0:1.2]\n"); + fprintf (f, "set ytics 0, 0.1, 1\n"); + fprintf (f, "set xlabel \"%s\"\n", + "Request size as a fraction of chunk size"); + fprintf (f, "set ylabel \"Efficiency\"\n"); + fprintf (f, "set title \"Cache %d chunks, w0=%g, " + "Size=(total=%d, chunk=%d)\"\n", + RM_CACHE_STRT, w0, DS_SIZE*CH_SIZE, CH_SIZE); } else { - fprintf (f, "set autoscale\n"); - fprintf (f, "set hidden3d\n"); + fprintf (f, "set autoscale\n"); + fprintf (f, "set hidden3d\n"); } fprintf (f, "set terminal postscript\nset output \"x-rowmaj-rd.ps\"\n"); fprintf (f, "%s \"x-rowmaj-rd.dat\" title \"RowMaj-Read\" with %s\n", - RM_CACHE_STRT==RM_CACHE_END?"plot":"splot", - LINESPOINTS); + RM_CACHE_STRT==RM_CACHE_END?"plot":"splot", + LINESPOINTS); fprintf (f, "set terminal x11\nreplot\n"); d = fopen ("x-rowmaj-rd.dat", "w"); for (cache_size=RM_CACHE_STRT; - cache_size<=RM_CACHE_END; - cache_size+=RM_CACHE_DELT) { - for (io_percent=RM_START; io_percent<=RM_END; io_percent+=RM_DELTA) { - io_size = MAX (1, (size_t)(CH_SIZE*io_percent)); - printf ("Rowmaj-rd %8d %8.2f", (int)cache_size, io_percent); - fflush (stdout); - effic = test_rowmaj (READ, cache_size, io_size); - printf (" %8.2f\n", effic); - if (RM_CACHE_STRT==RM_CACHE_END) { - fprintf (d, "%g %g\n", io_percent, effic); - } else { - fprintf (d, "%g\n", effic); - } - } - fprintf (d, "\n"); + cache_size<=RM_CACHE_END; + cache_size+=RM_CACHE_DELT) { + for (io_percent=RM_START; io_percent<=RM_END; io_percent+=RM_DELTA) { + io_size = MAX (1, (size_t)(CH_SIZE*io_percent)); + printf ("Rowmaj-rd %8d %8.2f", (int)cache_size, io_percent); + fflush (stdout); + effic = test_rowmaj (READ, cache_size, io_size); + printf (" %8.2f\n", effic); + if (RM_CACHE_STRT==RM_CACHE_END) { + fprintf (d, "%g %g\n", io_percent, effic); + } else { + fprintf (d, "%g\n", effic); + } + } + fprintf (d, "\n"); } fclose (d); fprintf (f, "pause -1\n"); @@ -415,41 +414,41 @@ main (void) * windows. */ if (RM_CACHE_STRT==RM_CACHE_END) { - fprintf (f, "set yrange [0:1.2]\n"); - fprintf (f, "set ytics 0, 0.1, 1\n"); - fprintf (f, "set xlabel \"%s\"\n", - "Request size as a fraction of chunk size"); - fprintf (f, "set ylabel \"Efficiency\"\n"); - fprintf (f, "set title \"Cache %d chunks,w0=%g, " - "Size=(total=%d, chunk=%d)\"\n", - RM_CACHE_STRT, w0, DS_SIZE*CH_SIZE, CH_SIZE); + fprintf (f, "set yrange [0:1.2]\n"); + fprintf (f, "set ytics 0, 0.1, 1\n"); + fprintf (f, "set xlabel \"%s\"\n", + "Request size as a fraction of chunk size"); + fprintf (f, "set ylabel \"Efficiency\"\n"); + fprintf (f, "set title \"Cache %d chunks,w0=%g, " + "Size=(total=%d, chunk=%d)\"\n", + RM_CACHE_STRT, w0, DS_SIZE*CH_SIZE, CH_SIZE); } else { - fprintf (f, "set autoscale\n"); - fprintf (f, "set hidden3d\n"); + fprintf (f, "set autoscale\n"); + fprintf (f, "set hidden3d\n"); } fprintf (f, "set terminal postscript\nset output \"x-rowmaj-wr.ps\"\n"); fprintf (f, "%s \"x-rowmaj-wr.dat\" title \"RowMaj-Write\" with %s\n", - RM_CACHE_STRT==RM_CACHE_END?"plot":"splot", - LINESPOINTS); + RM_CACHE_STRT==RM_CACHE_END?"plot":"splot", + LINESPOINTS); fprintf (f, "set terminal x11\nreplot\n"); d = fopen ("x-rowmaj-wr.dat", "w"); for (cache_size=RM_CACHE_STRT; - cache_size<=RM_CACHE_END; - cache_size+=RM_CACHE_DELT) { - for (io_percent=RM_START; io_percent<=RM_END; io_percent+=RM_DELTA) { - io_size = MAX (1, (size_t)(CH_SIZE*io_percent)); - printf ("Rowmaj-wr %8d %8.2f", (int)cache_size, io_percent); - fflush (stdout); - effic = test_rowmaj (WRITE, cache_size, io_size); - printf (" %8.2f\n", effic); - if (RM_CACHE_STRT==RM_CACHE_END) { - fprintf (d, "%g %g\n", io_percent, effic); - } else { - fprintf (d, "%g\n", effic); - } - } - fprintf (d, "\n"); + cache_size<=RM_CACHE_END; + cache_size+=RM_CACHE_DELT) { + for (io_percent=RM_START; io_percent<=RM_END; io_percent+=RM_DELTA) { + io_size = MAX (1, (size_t)(CH_SIZE*io_percent)); + printf ("Rowmaj-wr %8d %8.2f", (int)cache_size, io_percent); + fflush (stdout); + effic = test_rowmaj (WRITE, cache_size, io_size); + printf (" %8.2f\n", effic); + if (RM_CACHE_STRT==RM_CACHE_END) { + fprintf (d, "%g %g\n", io_percent, effic); + } else { + fprintf (d, "%g\n", effic); + } + } + fprintf (d, "\n"); } fclose (d); fprintf (f, "pause -1\n"); @@ -460,39 +459,39 @@ main (void) * Test diagonal read */ if (DIAG_CACHE_STRT==DIAG_CACHE_END) { - fprintf (f, "set yrange [0:1.2]\n"); - fprintf (f, "set ytics 0, 0.1, 1\n"); - fprintf (f, "set xlabel \"%s\"\n", - "Request size as a fraction of chunk size"); - fprintf (f, "set ylabel \"Efficiency\"\n"); - fprintf (f, "set title \"Cache %d chunks,w0=%g, " - "Size=(total=%d, chunk=%d)\"\n", - DIAG_CACHE_STRT, w0, DS_SIZE*CH_SIZE, CH_SIZE); + fprintf (f, "set yrange [0:1.2]\n"); + fprintf (f, "set ytics 0, 0.1, 1\n"); + fprintf (f, "set xlabel \"%s\"\n", + "Request size as a fraction of chunk size"); + fprintf (f, "set ylabel \"Efficiency\"\n"); + fprintf (f, "set title \"Cache %d chunks,w0=%g, " + "Size=(total=%d, chunk=%d)\"\n", + DIAG_CACHE_STRT, w0, DS_SIZE*CH_SIZE, CH_SIZE); } else { - fprintf (f, "set autoscale\n"); - fprintf (f, "set hidden3d\n"); + fprintf (f, "set autoscale\n"); + fprintf (f, "set hidden3d\n"); } fprintf (f, "set terminal postscript\nset output \"x-diag-rd.ps\"\n"); fprintf (f, "%s \"x-diag-rd.dat\" title \"Diag-Read\" with %s\n", - DIAG_CACHE_STRT==DIAG_CACHE_END?"plot":"splot", LINESPOINTS); + DIAG_CACHE_STRT==DIAG_CACHE_END?"plot":"splot", LINESPOINTS); fprintf (f, "set terminal x11\nreplot\n"); d = fopen ("x-diag-rd.dat", "w"); for (cache_size=DIAG_CACHE_STRT; - cache_size<=DIAG_CACHE_END; - cache_size+=DIAG_CACHE_DELT) { - for (io_percent=DIAG_START; io_percent<=DIAG_END; io_percent+=DIAG_DELTA) { - io_size = MAX (1, (size_t)(CH_SIZE*io_percent)); - printf ("Diag-rd %8d %8.2f", (int)cache_size, io_percent); - fflush (stdout); - effic = test_diag (READ, cache_size, io_size, MAX (1, io_size/2)); - printf (" %8.2f\n", effic); - if (DIAG_CACHE_STRT==DIAG_CACHE_END) { - fprintf (d, "%g %g\n", io_percent, effic); - } else { - fprintf (d, "%g\n", effic); - } - } - fprintf (d, "\n"); + cache_size<=DIAG_CACHE_END; + cache_size+=DIAG_CACHE_DELT) { + for (io_percent=DIAG_START; io_percent<=DIAG_END; io_percent+=DIAG_DELTA) { + io_size = MAX (1, (size_t)(CH_SIZE*io_percent)); + printf ("Diag-rd %8d %8.2f", (int)cache_size, io_percent); + fflush (stdout); + effic = test_diag (READ, cache_size, io_size, MAX (1, io_size/2)); + printf (" %8.2f\n", effic); + if (DIAG_CACHE_STRT==DIAG_CACHE_END) { + fprintf (d, "%g %g\n", io_percent, effic); + } else { + fprintf (d, "%g\n", effic); + } + } + fprintf (d, "\n"); } fclose (d); fprintf (f, "pause -1\n"); @@ -503,41 +502,41 @@ main (void) * Test diagonal write */ if (DIAG_CACHE_STRT==DIAG_CACHE_END) { - fprintf (f, "set yrange [0:1.2]\n"); - fprintf (f, "set ytics 0, 0.1, 1\n"); - fprintf (f, "set xlabel \"%s\"\n", - "Request size as a fraction of chunk size"); - fprintf (f, "set ylabel \"Efficiency\"\n"); - fprintf (f, "set title \"Cache %d chunks, w0=%g, " - "Size=(total=%d, chunk=%d)\"\n", - DIAG_CACHE_STRT, w0, DS_SIZE*CH_SIZE, CH_SIZE); + fprintf (f, "set yrange [0:1.2]\n"); + fprintf (f, "set ytics 0, 0.1, 1\n"); + fprintf (f, "set xlabel \"%s\"\n", + "Request size as a fraction of chunk size"); + fprintf (f, "set ylabel \"Efficiency\"\n"); + fprintf (f, "set title \"Cache %d chunks, w0=%g, " + "Size=(total=%d, chunk=%d)\"\n", + DIAG_CACHE_STRT, w0, DS_SIZE*CH_SIZE, CH_SIZE); } else { - fprintf (f, "set autoscale\n"); - fprintf (f, "set hidden3d\n"); + fprintf (f, "set autoscale\n"); + fprintf (f, "set hidden3d\n"); } fprintf (f, "set terminal postscript\nset output \"x-diag-wr.ps\"\n"); fprintf (f, "%s \"x-diag-wr.dat\" title \"Diag-Write\" with %s\n", - DIAG_CACHE_STRT==DIAG_CACHE_END?"plot":"splot", LINESPOINTS); + DIAG_CACHE_STRT==DIAG_CACHE_END?"plot":"splot", LINESPOINTS); fprintf (f, "set terminal x11\nreplot\n"); d = fopen ("x-diag-wr.dat", "w"); for (cache_size=DIAG_CACHE_STRT; - cache_size<=DIAG_CACHE_END; - cache_size+=DIAG_CACHE_DELT) { - for (io_percent=DIAG_START; - io_percent<=DIAG_END; - io_percent+=DIAG_DELTA) { - io_size = MAX (1, (size_t)(CH_SIZE*io_percent)); - printf ("Diag-wr %8d %8.2f", (int)cache_size, io_percent); - fflush (stdout); - effic = test_diag (WRITE, cache_size, io_size, MAX (1, io_size/2)); - printf (" %8.2f\n", effic); - if (DIAG_CACHE_STRT==DIAG_CACHE_END) { - fprintf (d, "%g %g\n", io_percent, effic); - } else { - fprintf (d, "%g\n", effic); - } - } - fprintf (d, "\n"); + cache_size<=DIAG_CACHE_END; + cache_size+=DIAG_CACHE_DELT) { + for (io_percent=DIAG_START; + io_percent<=DIAG_END; + io_percent+=DIAG_DELTA) { + io_size = MAX (1, (size_t)(CH_SIZE*io_percent)); + printf ("Diag-wr %8d %8.2f", (int)cache_size, io_percent); + fflush (stdout); + effic = test_diag (WRITE, cache_size, io_size, MAX (1, io_size/2)); + printf (" %8.2f\n", effic); + if (DIAG_CACHE_STRT==DIAG_CACHE_END) { + fprintf (d, "%g %g\n", io_percent, effic); + } else { + fprintf (d, "%g\n", effic); + } + } + fprintf (d, "\n"); } fclose (d); fprintf (f, "pause -1\n"); diff --git a/tools/perform/perf_meta.c b/tools/perform/perf_meta.c index b52871e..2c3a19c 100644 --- a/tools/perform/perf_meta.c +++ b/tools/perform/perf_meta.c @@ -821,7 +821,7 @@ main(int argc, char **argv) if (H5Sclose(space) < 0) goto error; if (H5Sclose(small_space) < 0) goto error; - h5_cleanup(FILENAME, fapl); + h5_clean_files(FILENAME, fapl); #ifdef H5_HAVE_PARALLEL if(facc_type == FACC_MPIO) diff --git a/tools/testfiles/textlinksrc-nodangle-1.ls b/tools/testfiles/textlinksrc-nodangle-1.ls index 9c19957..6d1da9e 100644 --- a/tools/testfiles/textlinksrc-nodangle-1.ls +++ b/tools/testfiles/textlinksrc-nodangle-1.ls @@ -1,5 +1,3 @@ -Error: --no-dangling-links must be used along with --follow-symlinks option! - usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...] OPTIONS -h, -?, --help Print a usage message and exit @@ -58,3 +56,5 @@ usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...] Replaced by --follow-symlinks. -e, --errors Show all HDF5 error reporting Replaced by --enable-error-stack. +Error: --no-dangling-links must be used along with --follow-symlinks option! + diff --git a/tools/testfiles/tgroup-1.ls b/tools/testfiles/tgroup-1.ls index 893c9ce..069d43e 100644 --- a/tools/testfiles/tgroup-1.ls +++ b/tools/testfiles/tgroup-1.ls @@ -1,5 +1,3 @@ -Error: 'recursive' option not compatible with 'group info' option! - usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...] OPTIONS -h, -?, --help Print a usage message and exit @@ -58,3 +56,5 @@ usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...] Replaced by --follow-symlinks. -e, --errors Show all HDF5 error reporting Replaced by --enable-error-stack. +Error: 'recursive' option not compatible with 'group info' option! + -- cgit v0.12