From 3d231bd0c018c4ac7a78640a51d404332a712d72 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Tue, 13 Jun 2023 18:14:12 -0500 Subject: merges from develop (#3115) * Fix release action that allows files to be uploaded. * Add autotools h5copy help test. * Update cmake tools.cmake file for clang-tidy. * CMake build is missing H5FDsubfiling.h * Correct snapshot location * Add note for issue 3056 --- .github/workflows/release.yml | 21 ++---- config/cmake/HDFCompilerFlags.cmake | 4 +- config/sanitizer/tools.cmake | 135 +++++++++++++++++------------------- release_docs/RELEASE.txt | 10 ++- src/CMakeLists.txt | 4 +- tools/test/h5copy/testh5copy.sh.in | 42 +++++++++++ 6 files changed, 123 insertions(+), 93 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ac22bdd..0104725 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -45,8 +45,12 @@ jobs: - run: | echo "Tag already present: ${{ steps.tag_create.outputs.tag_exists }}" - getfiles: + PreRelease-getfiles: runs-on: ubuntu-latest + needs: create-tag + environment: snapshots_1_14 + permissions: + contents: write steps: - name: Get file base name id: get-file-base @@ -92,21 +96,6 @@ jobs: name: tgz-ubuntu-2204-binary path: ${{ github.workspace }} - # Get files used by release script - - PreRelease: - runs-on: ubuntu-latest - needs: [create-tag, getfiles] - environment: snapshots_1_14 - permissions: - contents: write - steps: - - name: Get file base name - id: get-file-base - run: | - FILE_NAME_BASE=$(echo "${{ inputs.file_base }}") - echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT - - name: PreRelease tag uses: softprops/action-gh-release@v1 with: diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index 1bbf57c..00850d3 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -54,7 +54,9 @@ if (CMAKE_COMPILER_IS_GNUCC) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Og -ftrapv -fno-common") endif () else () - if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0 AND + NOT CMAKE_C_CLANG_TIDY) + # `clang-tidy` does not understand -fstdarg-opt set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstdarg-opt") endif () if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 10.0) diff --git a/config/sanitizer/tools.cmake b/config/sanitizer/tools.cmake index 3a41ad4..88d3baf 100644 --- a/config/sanitizer/tools.cmake +++ b/config/sanitizer/tools.cmake @@ -14,101 +14,90 @@ # the License. option(CLANG_TIDY "Turns on clang-tidy processing if it is found." OFF) -option(IWYU "Turns on include-what-you-use processing if it is found." OFF) -option(CPPCHECK "Turns on cppcheck processing if it is found." OFF) +if(CLANG_TIDY) + find_program(CLANG_TIDY_EXE NAMES "clang-tidy") + mark_as_advanced(FORCE CLANG_TIDY_EXE) + if(CLANG_TIDY_EXE) + message(STATUS "clang-tidy found: ${CLANG_TIDY_EXE}") + set(CMAKE_C_CLANG_TIDY ${CLANG_TIDY_EXE} --checks=-*,clang-analyzer-*)#${ARGN}) + set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY_EXE} --checks=-*,clang-analyzer-*)#${ARGN}) + else() + message(STATUS "clang-tidy not found!") + set(CMAKE_C_CLANG_TIDY "" CACHE STRING "" FORCE) # delete it + set(CMAKE_CXX_CLANG_TIDY "" CACHE STRING "" FORCE) # delete it + endif() +else() + #message(STATUS "clang-tidy not enabled!") + set(CMAKE_C_CLANG_TIDY + "" + CACHE STRING "" FORCE) # delete it + set(CMAKE_CXX_CLANG_TIDY + "" + CACHE STRING "" FORCE) # delete it +endif() # Adds clang-tidy checks to the compilation, with the given arguments being used # as the options set. macro(clang_tidy) if(CLANG_TIDY AND CLANG_TIDY_EXE) + set(CMAKE_C_CLANG_TIDY ${CLANG_TIDY_EXE} ${ARGN}) set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY_EXE} ${ARGN}) endif() endmacro() +option(IWYU "Turns on include-what-you-use processing if it is found." OFF) +if(IWYU) + find_program(IWYU_EXE NAMES "include-what-you-use") + mark_as_advanced(FORCE IWYU_EXE) + if(IWYU_EXE) + message(STATUS "include-what-you-use found: ${IWYU_EXE}") + else() + message(SEND_ERROR "Cannot enable include-what-you-use, as executable not found!") + set(CMAKE_C_INCLUDE_WHAT_YOU_USE "" CACHE STRING "" FORCE) # delete it + set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "" CACHE STRING "" FORCE) # delete it + endif() +else() + #message(STATUS "include-what-you-use NOT ENABLED via 'IWYU' variable!") + set(CMAKE_C_INCLUDE_WHAT_YOU_USE "" CACHE STRING "" FORCE) # delete it + set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "" CACHE STRING "" FORCE) # delete it +endif() + # Adds include_what_you_use to the compilation, with the given arguments being # used as the options set. macro(include_what_you_use) if(IWYU AND IWYU_EXE) + set(CMAKE_C_INCLUDE_WHAT_YOU_USE ${IWYU_EXE} ${ARGN}) set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${IWYU_EXE} ${ARGN}) endif() endmacro() +option(CPPCHECK "Turns on cppcheck processing if it is found." OFF) +if(CPPCHECK) + if(CPPCHECK_EXE) + message(STATUS "cppcheck found: ${CPPCHECK_EXE}") + set(CMAKE_C_CPPCHECK + "${CPPCHECK_EXE};--enable=warning,performance,portability,missingInclude;--template=\"[{severity}][{id}] {message} {callstack} \(On {file}:{line}\)\";--suppress=missingIncludeSystem;--quiet;--verbose;--force" + ) + set(CMAKE_CXX_CPPCHECK + "${CPPCHECK_EXE};--enable=warning,performance,portability,missingInclude;--template=\"[{severity}][{id}] {message} {callstack} \(On {file}:{line}\)\";--suppress=missingIncludeSystem;--quiet;--verbose;--force" + ) + else() + message(SEND_ERROR "Cannot enable cppcheck, as executable not found!") + set(CMAKE_C_CPPCHECK "" CACHE STRING "" FORCE) # delete it + set(CMAKE_CXX_CPPCHECK "" CACHE STRING "" FORCE) # delete it + endif() +else() + # message(SEND_ERROR "cppcheck NOT ENABLED via 'CPPCHECK' variable!") + set(CMAKE_C_CPPCHECK "" CACHE STRING "" FORCE) # delete it + set(CMAKE_CXX_CPPCHECK "" CACHE STRING "" FORCE) # delete it +endif() + # Adds cppcheck to the compilation, with the given arguments being used as the # options set. macro(cppcheck) if(CPPCHECK AND CPPCHECK_EXE) + set(CMAKE_C_CPPCHECK ${CPPCHECK_EXE} ${ARGN}) set(CMAKE_CXX_CPPCHECK ${CPPCHECK_EXE} ${ARGN}) endif() endmacro() -find_program(CLANG_TIDY_EXE NAMES "clang-tidy") -mark_as_advanced(FORCE CLANG_TIDY_EXE) -if(CLANG_TIDY_EXE) - message(STATUS "clang-tidy found: ${CLANG_TIDY_EXE}") - if(NOT CLANG_TIDY) - message(STATUS "clang-tidy NOT ENABLED via 'CLANG_TIDY' variable!") - set(CMAKE_CXX_CLANG_TIDY - "" - CACHE STRING "" FORCE) # delete it - endif() -elseif(CLANG_TIDY) - message(SEND_ERROR "Cannot enable clang-tidy, as executable not found!") - set(CMAKE_CXX_CLANG_TIDY - "" - CACHE STRING "" FORCE) # delete it -else() - message(STATUS "clang-tidy not found!") - set(CMAKE_CXX_CLANG_TIDY - "" - CACHE STRING "" FORCE) # delete it -endif() - -find_program(IWYU_EXE NAMES "include-what-you-use") -mark_as_advanced(FORCE IWYU_EXE) -if(IWYU_EXE) - message(STATUS "include-what-you-use found: ${IWYU_EXE}") - if(NOT IWYU) - message(STATUS "include-what-you-use NOT ENABLED via 'IWYU' variable!") - set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE - "" - CACHE STRING "" FORCE) # delete it - endif() -elseif(IWYU) - message( - SEND_ERROR "Cannot enable include-what-you-use, as executable not found!") - set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE - "" - CACHE STRING "" FORCE) # delete it -else() - message(STATUS "include-what-you-use not found!") - set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE - "" - CACHE STRING "" FORCE) # delete it -endif() - -find_program(CPPCHECK_EXE NAMES "cppcheck") -mark_as_advanced(FORCE CPPCHECK_EXE) -if(CPPCHECK_EXE) - message(STATUS "cppcheck found: ${CPPCHECK_EXE}") - if(CPPCHECK) - set(CMAKE_CXX_CPPCHECK - "${CPPCHECK_EXE};--enable=warning,performance,portability,missingInclude;--template=\"[{severity}][{id}] {message} {callstack} \(On {file}:{line}\)\";--suppress=missingIncludeSystem;--quiet;--verbose;--force" - ) - endif() - if(NOT CPPCHECK) - message(STATUS "cppcheck NOT ENABLED via 'CPPCHECK' variable!") - set(CMAKE_CXX_CPPCHECK - "" - CACHE STRING "" FORCE) # delete it - endif() -elseif(CPPCHECK) - message(SEND_ERROR "Cannot enable cppcheck, as executable not found!") - set(CMAKE_CXX_CPPCHECK - "" - CACHE STRING "" FORCE) # delete it -else() - message(STATUS "cppcheck not found!") - set(CMAKE_CXX_CPPCHECK - "" - CACHE STRING "" FORCE) # delete it -endif() diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index a163f35..c59aeca 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -114,7 +114,15 @@ Bug Fixes since HDF5-1.14.1 release Java Library ------------ - - + - Fixed switch case 'L' block missing a break statement. + + The HDF5Array.arrayify method is missing a break statement in the case 'L': section + which causes it to fall through and throw an HDF5JavaException when attempting to + read an Array[Array[Long]]. + + The error was fixed by inserting a break statement at the end of the case 'L': sections. + + Fixes GitHub issue #3056 Configuration diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4edcc98..d85ac0f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1230,7 +1230,7 @@ if (BUILD_STATIC_LIBS) add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS} ${H5_MODULE_HEADERS}) target_include_directories (${HDF5_LIB_TARGET} PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" - INTERFACE "$/include>;$" + INTERFACE "$/include>;$" ) target_compile_options(${HDF5_LIB_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_compile_definitions(${HDF5_LIB_TARGET} @@ -1271,7 +1271,7 @@ if (BUILD_SHARED_LIBS) target_include_directories (${HDF5_LIBSH_TARGET} PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" PUBLIC "$<$:${HDFS_INCLUDE_DIR}>" - INTERFACE "$/include>;$" + INTERFACE "$/include>;$" ) target_compile_options(${HDF5_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_compile_definitions(${HDF5_LIBSH_TARGET} diff --git a/tools/test/h5copy/testh5copy.sh.in b/tools/test/h5copy/testh5copy.sh.in index 7587c0e..1f64d15 100644 --- a/tools/test/h5copy/testh5copy.sh.in +++ b/tools/test/h5copy/testh5copy.sh.in @@ -60,6 +60,8 @@ $SRC_H5COPY_TESTFILES/h5copy_extlinks_trg.h5 LIST_OTHER_TEST_FILES=" $SRC_H5COPY_TESTFILES/h5copy_misc1.out $SRC_H5COPY_TESTFILES/h5copy_misc1.err +$SRC_H5COPY_TESTFILES/h5copy_help1.ddl +$SRC_H5COPY_TESTFILES/h5copy_help2.ddl " H5COPY=../../src/h5copy/h5copy # The tool name @@ -483,6 +485,42 @@ H5DIFFTEST_FAIL() fi } +# ADD_HELP_TEST +TOOLTEST_HELP() { + + expect="$TESTDIR/$1" + actual="$TESTDIR/`basename $1 .ddl`.out" + actual_err="$TESTDIR/`basename $1 .ddl`.err" + shift + + # Run test. + TESTING $H5COPY $@ + ( + cd $TESTDIR + $RUNSERIAL $H5COPY_BIN "$@" + ) >$actual 2>$actual_err + + if [ ! -f $expectdata ]; then + # Create the expect data file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect-CREATED + echo " Expected output (*.ddl) missing" + nerrors="`expr $nerrors + 1`" + elif $CMP $expect $actual; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected output (*.ddl) differs from actual output (*.out)" + nerrors="`expr $nerrors + 1`" + fi + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actual_err + fi + +} + # Copy single datasets of various forms from one group to another, # adding object copied to the destination file each time # @@ -607,6 +645,10 @@ fi # prepare for test COPY_TESTFILES_TO_TESTDIR +# check help text +TOOLTEST_HELP h5copy_help1.ddl -h +TOOLTEST_HELP h5copy_help2.ddl --help + # Start tests COPY_OBJECTS COPY_REFERENCES -- cgit v0.12