From eeaee6df624391d884aa9683ee3be9a60f1ef079 Mon Sep 17 00:00:00 2001 From: "H. Joe Lee" Date: Thu, 2 May 2024 07:06:45 -0500 Subject: [PATCH 1/7] Fix grammar in VOL guide (#4452) --- doxygen/dox/VOLConnGuide.dox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doxygen/dox/VOLConnGuide.dox b/doxygen/dox/VOLConnGuide.dox index e30a48428a8..d1b78506fbe 100644 --- a/doxygen/dox/VOLConnGuide.dox +++ b/doxygen/dox/VOLConnGuide.dox @@ -230,7 +230,7 @@ The initialization and terminate callbacks: \endcode \subsection subsecVOLMap Map Storage to HDF5 File Objects -The most difficult part of designing a new VOL connector is going to determining how to support HDF5 +The most difficult part of designing a new VOL connector is determining how to support HDF5 file objects and operations using your storage system. There isn't much specific advice to give here, as each connector will have unique needs, but a forthcoming "tutorial" connector will set up a simple connector and demonstrate this process. From 76211b2c81eb14e901492638f42217a9ea7f70b5 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 2 May 2024 07:23:52 -0500 Subject: [PATCH 2/7] Fix bug in MPI-IO VFD (#4456) Corrects incorrect usage of the vector_was_sorted parameter in H5FD__mpio_vector_build_types() --- src/H5FDmpio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 5f88d37668c..0819bd68f7e 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -1804,7 +1804,7 @@ H5FD__mpio_vector_build_types(uint32_t count, H5FD_mem_t types[], haddr_t addrs[ /* Determine size of this vector element */ if (!fixed_size) { if ((*s_sizes)[i] == 0) { - assert(vector_was_sorted); + assert(*vector_was_sorted); assert(i > 0); fixed_size = true; size = sizes[i - 1]; @@ -1951,7 +1951,7 @@ H5FD__mpio_vector_build_types(uint32_t count, H5FD_mem_t types[], haddr_t addrs[ done: /* free sorted vectors if they exist */ - if (!vector_was_sorted) + if (!*vector_was_sorted) if (s_types) { free(s_types); s_types = NULL; From 0da5af4737284e81999780a560d3e80dd79ae472 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 May 2024 05:33:32 -0700 Subject: [PATCH 3/7] Bump the github-actions group with 3 updates (#4455) Bumps the github-actions group with 3 updates: [actions/download-artifact](https://github.com/actions/download-artifact), [peaceiris/actions-gh-pages](https://github.com/peaceiris/actions-gh-pages) and [github/codeql-action](https://github.com/github/codeql-action). Updates `actions/download-artifact` from 4.1.4 to 4.1.7 - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/c850b930e6ba138125429b7e5c93fc707a7f8427...65a9edc5881444af0b9093a5e628f2fe47ea3b2e) Updates `peaceiris/actions-gh-pages` from 3.9.3 to 4.0.0 - [Release notes](https://github.com/peaceiris/actions-gh-pages/releases) - [Changelog](https://github.com/peaceiris/actions-gh-pages/blob/main/CHANGELOG.md) - [Commits](https://github.com/peaceiris/actions-gh-pages/compare/373f7f263a76c20808c831209c920827a82a2847...4f9cc6602d3f66b9c108549d475ec49e8ef4d45e) Updates `github/codeql-action` from 3.24.9 to 3.25.3 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/1b1aada464948af03b950897e5eb522f92603cc2...d39d31e687223d841ef683f52467bd88e9b21c14) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions - dependency-name: peaceiris/actions-gh-pages dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/abi-report.yml | 2 +- .github/workflows/cmake-bintest.yml | 6 +++--- .github/workflows/cmake-ctest.yml | 12 ++++++------ .github/workflows/release-files.yml | 28 ++++++++++++++-------------- .github/workflows/scorecard.yml | 2 +- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/.github/workflows/abi-report.yml b/.github/workflows/abi-report.yml index 52355524aff..055f373031d 100644 --- a/.github/workflows/abi-report.yml +++ b/.github/workflows/abi-report.yml @@ -46,7 +46,7 @@ jobs: - uses: actions/checkout@v4.1.1 - name: Get published binary (Linux) - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: tgz-ubuntu-2204_gcc-binary path: ${{ github.workspace }} diff --git a/.github/workflows/cmake-bintest.yml b/.github/workflows/cmake-bintest.yml index 7c5c5c409dc..deed6335b5c 100644 --- a/.github/workflows/cmake-bintest.yml +++ b/.github/workflows/cmake-bintest.yml @@ -35,7 +35,7 @@ jobs: # Get files created by cmake-ctest script - name: Get published binary (Windows) - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: zip-vs2022_cl-${{ inputs.build_mode }}-binary path: ${{ github.workspace }}/hdf5 @@ -109,7 +109,7 @@ jobs: distribution: 'temurin' - name: Get published binary (Linux) - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: tgz-ubuntu-2204_gcc-${{ inputs.build_mode }}-binary path: ${{ github.workspace }} @@ -161,7 +161,7 @@ jobs: distribution: 'temurin' - name: Get published binary (MacOS) - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: tgz-osx12-${{ inputs.build_mode }}-binary path: ${{ github.workspace }} diff --git a/.github/workflows/cmake-ctest.yml b/.github/workflows/cmake-ctest.yml index 1efe6ba5c43..20a121c29ff 100644 --- a/.github/workflows/cmake-ctest.yml +++ b/.github/workflows/cmake-ctest.yml @@ -62,7 +62,7 @@ jobs: # Get files created by release script - name: Get zip-tarball (Windows) - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: zip-tarball path: ${{ github.workspace }} @@ -146,7 +146,7 @@ jobs: # Get files created by release script - name: Get tgz-tarball (Linux) - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: tgz-tarball path: ${{ github.workspace }} @@ -270,7 +270,7 @@ jobs: # Get files created by release script - name: Get tgz-tarball (MacOS) - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: tgz-tarball path: ${{ github.workspace }} @@ -351,7 +351,7 @@ jobs: # Get files created by release script - name: Get tgz-tarball (Linux S3) - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: tgz-tarball path: ${{ github.workspace }} @@ -432,7 +432,7 @@ jobs: # Get files created by release script - name: Get zip-tarball (Windows_intel) - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: zip-tarball path: ${{ github.workspace }} @@ -522,7 +522,7 @@ jobs: # Get files created by release script - name: Get tgz-tarball (Linux_intel) - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: tgz-tarball path: ${{ github.workspace }} diff --git a/.github/workflows/release-files.yml b/.github/workflows/release-files.yml index 9c454414d8f..2e7554717e7 100644 --- a/.github/workflows/release-files.yml +++ b/.github/workflows/release-files.yml @@ -73,7 +73,7 @@ jobs: # Get files created by tarball script - name: Get doxygen (Linux) - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: docs-doxygen path: ${{ github.workspace }}/${{ steps.get-file-base.outputs.FILE_BASE }}.doxygen @@ -82,68 +82,68 @@ jobs: run: zip -r ${{ steps.get-file-base.outputs.FILE_BASE }}.doxygen.zip ./${{ steps.get-file-base.outputs.FILE_BASE }}.doxygen - name: Get tgz-tarball (Linux) - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: tgz-tarball path: ${{ github.workspace }} - name: Get zip-tarball (Windows) - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: zip-tarball path: ${{ github.workspace }} # Get files created by cmake-ctest script - name: Get published binary (Windows) - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: zip-vs2022_cl-binary path: ${{ github.workspace }} - name: Get published binary (MacOS) - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: tgz-osx12-binary path: ${{ github.workspace }} - name: Get published binary (Linux) - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: tgz-ubuntu-2204_gcc-binary path: ${{ github.workspace }} - name: Get published deb binary (Linux) - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: deb-ubuntu-2204_gcc-binary path: ${{ github.workspace }} - name: Get published rpm binary (Linux) - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: rpm-ubuntu-2204_gcc-binary path: ${{ github.workspace }} - name: Get published binary (Linux S3) - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: tgz-ubuntu-2204_gcc_s3-binary path: ${{ github.workspace }} - name: Get published binary (Windows_intel) - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: zip-vs2022_intel-binary path: ${{ github.workspace }} - name: Get published binary (Linux_intel) - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: tgz-ubuntu-2204_intel-binary path: ${{ github.workspace }} - name: Get published abi reports (Linux) - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: abi-reports path: ${{ github.workspace }} @@ -168,7 +168,7 @@ jobs: echo "${{ steps.get-file-base.outputs.FILE_BASE }}" > ./last-file.txt - name: Get NEWSLETTER - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: NEWSLETTER path: ${{ github.workspace }} @@ -232,7 +232,7 @@ jobs: ls ${{ runner.workspace }} - name: dev-only-docs - uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # v3.9.3 + uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ${{ github.workspace }}/${{ steps.get-file-base.outputs.FILE_BASE }}.doxygen diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 338cac1b096..10e50caef1d 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -67,6 +67,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9 + uses: github/codeql-action/upload-sarif@d39d31e687223d841ef683f52467bd88e9b21c14 # v3.25.3 with: sarif_file: results.sarif From dfc6295c1d48ab7197f78f6fc26dda10f31cdda6 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Thu, 2 May 2024 15:33:20 -0500 Subject: [PATCH 4/7] Fixed failures with xl compilers. (#4458) * type cast constant * fixed return types --- fortran/src/H5Rff.F90 | 6 +++--- fortran/test/tH5R.F90 | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fortran/src/H5Rff.F90 b/fortran/src/H5Rff.F90 index f9e7f719c05..ab803a7596a 100644 --- a/fortran/src/H5Rff.F90 +++ b/fortran/src/H5Rff.F90 @@ -1111,7 +1111,7 @@ SUBROUTINE h5rget_obj_name_f( ref_ptr, name, hdferr, rapl_id, name_len) INTEGER(SIZE_T) :: l INTERFACE - INTEGER FUNCTION H5Rget_obj_name(ref_ptr, rapl_id, name, size_default) & + INTEGER(SIZE_T) FUNCTION H5Rget_obj_name(ref_ptr, rapl_id, name, size_default) & BIND(C, NAME='H5Rget_obj_name') IMPORT :: c_char, c_ptr IMPORT :: HID_T, SIZE_T @@ -1164,7 +1164,7 @@ SUBROUTINE h5rget_attr_name_f(ref_ptr, name, hdferr, name_len) INTEGER(SIZE_T) :: l INTERFACE - INTEGER FUNCTION H5Rget_attr_name(ref_ptr, name, size_default) & + INTEGER(SIZE_T) FUNCTION H5Rget_attr_name(ref_ptr, name, size_default) & BIND(C, NAME='H5Rget_attr_name') IMPORT :: c_char, c_ptr IMPORT :: HID_T, SIZE_T @@ -1217,7 +1217,7 @@ SUBROUTINE h5rget_file_name_f(ref_ptr, name, hdferr, name_len) INTEGER(SIZE_T) :: l INTERFACE - INTEGER FUNCTION H5Rget_file_name(ref_ptr, name, size_default) & + INTEGER(SIZE_T) FUNCTION H5Rget_file_name(ref_ptr, name, size_default) & BIND(C, NAME='H5Rget_file_name') IMPORT :: c_char, c_ptr IMPORT :: HID_T, SIZE_T diff --git a/fortran/test/tH5R.F90 b/fortran/test/tH5R.F90 index a3ccd9001c7..8eb8d8d2f9a 100644 --- a/fortran/test/tH5R.F90 +++ b/fortran/test/tH5R.F90 @@ -650,7 +650,7 @@ SUBROUTINE v3reftest(cleanup, total_error) CALL h5rget_obj_name_f(C_LOC(ref_ptr(3)), "", error, H5P_DEFAULT_F, buf_size) CALL check("h5rget_obj_name_f", error, total_error) - CALL verify("h5rget_obj_name_f", buf_size, LEN(dsetnamei,KIND=SIZE_T)+1, total_error) + CALL verify("h5rget_obj_name_f", buf_size, LEN(dsetnamei,KIND=SIZE_T)+1_SIZE_T, total_error) CALL h5rget_obj_name_f(C_LOC(ref_ptr(1)), "", error, H5P_DEFAULT_F, buf_size) CALL check("h5rget_obj_name_f", error, total_error) CALL verify("h5rget_obj_name_f", buf_size, 7_SIZE_T, total_error) From 1b6ae84d15a999e67f588c709fcc84358a6fab5d Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Fri, 3 May 2024 05:29:53 -0500 Subject: [PATCH 5/7] Convert ERR test to use grep (#4451) * Convert ERR test to use grep * Eliminate use of .err files in CMake * Show error output if grep fails * Turn off cuda in NVHPC CI --- .github/workflows/nvhpc-cmake.yml | 1 + config/cmake/grepTest.cmake | 43 +++-- config/cmake/runTest.cmake | 3 +- tools/test/h5copy/CMakeTests.cmake | 1 - tools/test/h5diff/CMakeTests.cmake | 84 +++++++++- tools/test/h5dump/CMakeTests.cmake | 51 ++---- tools/test/h5dump/CMakeTestsPBITS.cmake | 167 +++++++++---------- tools/test/h5format_convert/CMakeTests.cmake | 13 +- tools/test/h5ls/CMakeTests.cmake | 10 -- tools/test/h5stat/CMakeTests.cmake | 72 ++++---- tools/test/misc/CMakeTestsClear.cmake | 7 - 11 files changed, 254 insertions(+), 198 deletions(-) diff --git a/.github/workflows/nvhpc-cmake.yml b/.github/workflows/nvhpc-cmake.yml index 3e31a7d4966..4fb340716f2 100644 --- a/.github/workflows/nvhpc-cmake.yml +++ b/.github/workflows/nvhpc-cmake.yml @@ -59,6 +59,7 @@ jobs: -DHDF5_BUILD_FORTRAN:BOOL=ON \ -DHDF5_BUILD_JAVA:BOOL=OFF \ -DMPIEXEC_MAX_NUMPROCS:STRING="2" \ + -DMPIEXEC_PREFLAGS:STRING="--mca;opal_warn_on_missing_libcuda;0" \ $GITHUB_WORKSPACE - name: CMake Build diff --git a/config/cmake/grepTest.cmake b/config/cmake/grepTest.cmake index 4031a1bde03..529649e4e7c 100644 --- a/config/cmake/grepTest.cmake +++ b/config/cmake/grepTest.cmake @@ -11,6 +11,7 @@ # # grepTest.cmake executes a command and captures the output in a file. File is then compared # against a reference file. Exit status of command can also be compared. +cmake_policy(SET CMP0007 NEW) # arguments checking if (NOT TEST_PROGRAM) @@ -67,6 +68,11 @@ execute_process ( message (STATUS "COMMAND Result: ${TEST_RESULT}") +# append the test result status with a predefined text +if (TEST_APPEND) + file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_APPEND} ${TEST_RESULT}\n") +endif () + message (STATUS "COMMAND Error: ${TEST_ERROR}") # remove special output @@ -75,15 +81,22 @@ if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") string (FIND "${TEST_STREAM}" "_pmi_alps" TEST_FIND_RESULT) if (TEST_FIND_RESULT GREATER -1) string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) endif () string (FIND "${TEST_STREAM}" "ulimit -s" TEST_FIND_RESULT) if (TEST_FIND_RESULT GREATER -1) string (REGEX REPLACE "^.*ulimit -s[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) endif () endif () +if (TEST_REF_FILTER) + #message (STATUS "TEST_REF_FILTER: ${TEST_APPEND}${TEST_REF_FILTER}") + file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) + string (REGEX REPLACE "${TEST_REF_APPEND}" "${TEST_REF_FILTER}" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") +endif () + # if the TEST_ERRREF exists grep the error output with the error reference set (TEST_ERRREF_RESULT 0) if (TEST_ERRREF) @@ -96,26 +109,25 @@ if (TEST_ERRREF) string (REGEX MATCH "${TEST_ERRREF}" TEST_MATCH ${TEST_ERR_STREAM}) string (COMPARE EQUAL "${TEST_ERRREF}" "${TEST_MATCH}" TEST_ERRREF_RESULT) if (NOT TEST_ERRREF_RESULT) + # dump the output unless nodisplay option is set + if (NOT TEST_NO_DISPLAY) + execute_process ( + COMMAND ${CMAKE_COMMAND} -E echo ${TEST_ERR_STREAM} + RESULT_VARIABLE TEST_ERRREF_RESULT + ) + endif () message (FATAL_ERROR "Failed: The error output of ${TEST_PROGRAM} did not contain ${TEST_ERRREF}") endif () endif () endif () - #always compare output file to reference unless this must be skipped + # compare output files to references unless this must be skipped set (TEST_COMPARE_RESULT 0) if (NOT TEST_SKIP_COMPARE) if (EXISTS "${TEST_FOLDER}/${TEST_REFERENCE}") file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) list (LENGTH TEST_STREAM test_len) if (test_len GREATER 0) - if (WIN32) - configure_file(${TEST_FOLDER}/${TEST_REFERENCE} ${TEST_FOLDER}/${TEST_REFERENCE}.tmp NEWLINE_STYLE CRLF) - if (EXISTS "${TEST_FOLDER}/${TEST_REFERENCE}.tmp") - file(RENAME ${TEST_FOLDER}/${TEST_REFERENCE}.tmp ${TEST_FOLDER}/${TEST_REFERENCE}) - endif () - #file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) - #file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") - endif () if (NOT TEST_SORT_COMPARE) # now compare the output with the reference execute_process ( @@ -138,7 +150,14 @@ if (TEST_ERRREF) list (LENGTH test_act len_act) file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref) list (LENGTH test_ref len_ref) + if (NOT len_act EQUAL len_ref) + set (TEST_COMPARE_RESULT 1) + endif () if (len_act GREATER 0 AND len_ref GREATER 0) + if (TEST_SORT_COMPARE) + list (SORT test_act) + list (SORT test_ref) + endif () math (EXPR _FP_LEN "${len_ref} - 1") foreach (line RANGE 0 ${_FP_LEN}) list (GET test_act ${line} str_act) @@ -200,7 +219,7 @@ if (TEST_FILTER) endif () if (NOT DEFINED ENV{HDF5_NOCLEANUP}) - if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") + if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}" AND NOT TEST_SAVE) file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}) endif () diff --git a/config/cmake/runTest.cmake b/config/cmake/runTest.cmake index ff9732e0821..efb03e7c115 100644 --- a/config/cmake/runTest.cmake +++ b/config/cmake/runTest.cmake @@ -49,7 +49,7 @@ endif () if (TEST_ENV_VAR) set (ENV{${TEST_ENV_VAR}} "${TEST_ENV_VALUE}") - #message (STATUS "ENV:${TEST_ENV_VAR}=$ENV{${TEST_ENV_VAR}}") + message (TRACE "ENV:${TEST_ENV_VAR}=$ENV{${TEST_ENV_VAR}}") endif () if (NOT TEST_INPUT) @@ -233,7 +233,6 @@ if (NOT TEST_SKIP_COMPARE) file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) list (LENGTH TEST_STREAM test_len) if (test_len GREATER 0) - if (NOT TEST_SORT_COMPARE) # now compare the output with the reference execute_process ( diff --git a/tools/test/h5copy/CMakeTests.cmake b/tools/test/h5copy/CMakeTests.cmake index 2d7f5f7b04d..0069eaf6aea 100644 --- a/tools/test/h5copy/CMakeTests.cmake +++ b/tools/test/h5copy/CMakeTests.cmake @@ -30,7 +30,6 @@ set (LIST_OTHER_TEST_FILES h5copy_misc1.out - h5copy_misc1.err tudfilter.h5.txt tudfilter.h5_ERR.txt h5copy_plugin_fail_ERR.out.h5.txt diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index 3d867c7ddee..3324aa3be53 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -192,7 +192,6 @@ h5diff_452.txt h5diff_453.txt h5diff_454.txt - dangling_link.err h5diff_455.txt h5diff_456.txt h5diff_457.txt @@ -254,7 +253,6 @@ h5diff_63.txt h5diff_600.txt h5diff_601.txt - h5diff_601_ERR.err h5diff_603.txt h5diff_604.txt h5diff_605.txt @@ -313,7 +311,6 @@ h5diff_8639.txt h5diff_reg.txt h5diff_ud.txt - h5diff_udfail.err h5diff_udfail.txt h5diff_v1.txt h5diff_v2.txt @@ -477,6 +474,82 @@ endif () endmacro () + macro (ADD_H5_CMP_TEST resultfile resultcode result_errcheck) + if (HDF5_TEST_SERIAL) + ADD_SH5_CMP_TEST (${resultfile} ${resultcode} ${result_errcheck} ${ARGN}) + endif () + if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL) + ADD_PH5_CMP_TEST (${resultfile} ${resultcode} ${result_errcheck} ${ARGN}) + endif () + endmacro () + + macro (ADD_SH5_CMP_TEST resultfile resultcode result_errcheck) + # If using memchecker add tests without using scripts + if (HDF5_USING_ANALYSIS_TOOL) + add_test (NAME H5DIFF-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) + if (${resultcode}) + set_tests_properties (H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true") + endif () + else () + add_test ( + NAME H5DIFF-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.txt" + -D "TEST_ERRREF=${result_errcheck}" + -D "TEST_APPEND=EXIT CODE:" + -P "${HDF_RESOURCES_DIR}/grepTest.cmake" + ) + endif () + set_tests_properties (H5DIFF-${resultfile} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + ) + if ("H5DIFF-${resultfile}" MATCHES "${HDF5_DISABLE_TESTS_REGEX}") + set_tests_properties (H5DIFF-${resultfile} PROPERTIES DISABLED true) + endif () + endmacro () + + macro (ADD_PH5_CMP_TEST resultfile resultcode result_errcheck) + # If using memchecker add tests without using scripts + if (HDF5_USING_ANALYSIS_TOOL) + add_test (NAME MPI_TEST_H5DIFF-${resultfile} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $ ${MPIEXEC_POSTFLAGS} ${ARGN}) + set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/PAR/testfiles") + if (${resultcode}) + set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true") + endif () + else () + add_test ( + NAME MPI_TEST_H5DIFF-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=${MPIEXEC_EXECUTABLE}" + -D "TEST_ARGS:STRING=${MPIEXEC_NUMPROC_FLAG};${MPIEXEC_MAX_NUMPROCS};${MPIEXEC_PREFLAGS};$;${MPIEXEC_POSTFLAGS};${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/PAR/testfiles" + -D "TEST_OUTPUT=${resultfile}.out" + #-D "TEST_EXPECT=${resultcode}" + -D "TEST_EXPECT=0" # ph5diff currently always exits with a zero status code due to + # output from some MPI implementations from a non-zero exit code + -D "TEST_REFERENCE=${resultfile}.txt" + -D "TEST_ERRREF=${result_errcheck}" + -D "TEST_APPEND=EXIT CODE:" + -D "TEST_REF_APPEND=EXIT CODE: [0-9]" + -D "TEST_REF_FILTER=EXIT CODE: 0" + -D "TEST_SORT_COMPARE=TRUE" + -P "${HDF_RESOURCES_DIR}/grepTest.cmake" + ) + endif () + set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/PAR/testfiles" + ) + if ("MPI_TEST_H5DIFF-${resultfile}" MATCHES "${HDF5_DISABLE_TESTS_REGEX}") + set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES DISABLED true) + endif () + endmacro () + macro (ADD_H5_UD_TEST testname resultcode resultfile) if (NOT HDF5_USING_ANALYSIS_TOOL) if ("${resultcode}" STREQUAL "2") @@ -490,11 +563,12 @@ -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.txt" + -D "TEST_ERRREF=user defined filter is not available" -D "TEST_APPEND=EXIT CODE:" -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}" -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" - -P "${HDF_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/grepTest.cmake" ) else () add_test ( @@ -734,7 +808,7 @@ ADD_H5_TEST (h5diff_63 1 -v ${STRINGS1} ${STRINGS2} string4 string4) ADD_H5_TEST (h5diff_600 1 ${FILE1}) # 6.1: Check if non-exist object name is specified -ADD_H5_TEST (h5diff_601 2 ${FILE1} ${FILE1} nono_obj) +ADD_H5_CMP_TEST (h5diff_601 2 "Object could not be found" ${FILE1} ${FILE1} nono_obj) # ############################################################################## # # -d diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index a4b43eee4e3..546cfcbf011 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -370,33 +370,6 @@ tst_onion_dset_1d.h5 tst_onion_dset_1d.h5.onion ) - set (HDF5_ERROR_REFERENCE_TEST_FILES - filter_fail.err - non_existing.err - infinite_loop.err - tall-1.err - tall-2A.err - tall-2A0.err - tall-2B.err - tarray1_big.err - tattrregR.err - tattr-3.err - tcomp-3.err - tdataregR.err - tdset-2.err - texceedsubblock.err - texceedsubcount.err - texceedsubstart.err - texceedsubstride.err - textlink.err - textlinkfar.err - textlinksrc.err - torderlinks1.err - torderlinks2.err - tgroup-2.err - tperror.err - tslink-D.err - ) # make test dir file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") @@ -420,10 +393,6 @@ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/expected/${tst_h5N_file}" "${PROJECT_BINARY_DIR}/testfiles/std/${tst_h5N_file}-N" "h5dump_std_files") endforeach () - foreach (tst_error_file ${HDF5_ERROR_REFERENCE_TEST_FILES}) - HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/errfiles/${tst_error_file}" "${PROJECT_BINARY_DIR}/testfiles/std/${tst_error_file}" "h5dump_std_files") - endforeach () - # -------------------------------------------------------------------- # Special file handling # -------------------------------------------------------------------- @@ -1269,10 +1238,10 @@ ADD_H5_TEST (tindicessub4 0 --enable-error-stack -d 4d -s 0,0,1,2 -c 2,2,3,2 -S 1,1,3,3 -k 1,1,2,2 taindices.h5) # Exceed the dimensions for subsetting - ADD_H5_TEST (texceedsubstart 1 --enable-error-stack -d 1d -s 1,3 taindices.h5) - ADD_H5_TEST (texceedsubcount 1 --enable-error-stack -d 1d -c 1,3 taindices.h5) - ADD_H5_TEST (texceedsubstride 1 --enable-error-stack -d 1d -S 1,3 taindices.h5) - ADD_H5_TEST (texceedsubblock 1 --enable-error-stack -d 1d -k 1,3 taindices.h5) + ADD_H5ERR_MASK_TEST (texceedsubstart 1 "exceed dataset dims" --enable-error-stack -d 1d -s 1,3 taindices.h5) + ADD_H5ERR_MASK_TEST (texceedsubcount 1 "exceed dataset dims" --enable-error-stack -d 1d -c 1,3 taindices.h5) + ADD_H5ERR_MASK_TEST (texceedsubstride 1 "exceed dataset dims" --enable-error-stack -d 1d -S 1,3 taindices.h5) + ADD_H5ERR_MASK_TEST (texceedsubblock 1 "exceed dataset dims" --enable-error-stack -d 1d -k 1,3 taindices.h5) # tests for filters # SZIP @@ -1424,24 +1393,24 @@ ADD_H5_TEST_EXPORT (tall-6 tall.h5 0 --enable-error-stack -d /g1/g1.1/dset1.1.1 -y -o) # test for non-existing file - ADD_H5_TEST (non_existing 1 --enable-error-stack tgroup.h5 non_existing.h5) + ADD_H5ERR_MASK_TEST (non_existing 1 "unable to open file" --enable-error-stack tgroup.h5 non_existing.h5) # test to verify github issue#3790: infinite loop closing library - ADD_H5_TEST (infinite_loop 1 3790_infinite_loop.h5) + ADD_H5ERR_MASK_TEST (infinite_loop 1 "unable to open file" 3790_infinite_loop.h5) # test to verify HDFFV-10333: error similar to H5O_attr_decode in the jira issue - ADD_H5_TEST (err_attr_dspace 1 err_attr_dspace.h5) + ADD_H5ERR_MASK_TEST (err_attr_dspace 1 "error getting attribute information" err_attr_dspace.h5) # test to verify HDFFV-9407: long double full precision # ADD_H5_GREP_TEST (t128bit_float 1 "1.123456789012345" -m %.35Lg t128bit_float.h5) # test to verify HDFFV-10480: out of bounds read in H5O_fill_new[old]_decode - ADD_H5_TEST (tCVE_2018_11206_fill_old 1 tCVE_2018_11206_fill_old.h5) - ADD_H5_TEST (tCVE_2018_11206_fill_new 1 tCVE_2018_11206_fill_new.h5) + ADD_H5ERR_MASK_TEST (tCVE_2018_11206_fill_old 1 "" tCVE_2018_11206_fill_old.h5) + ADD_H5ERR_MASK_TEST (tCVE_2018_11206_fill_new 1 "" tCVE_2018_11206_fill_new.h5) # test to verify fix for CVE-2021-37501: multiplication overflow in H5O__attr_decode() # https://github.com/ST4RF4LL/Something_Found/blob/main/HDF5_v1.13.0_h5dump_heap_overflow.assets/poc - ADD_H5_TEST (tCVE-2021-37501_attr_decode 1 tCVE-2021-37501_attr_decode.h5) + ADD_H5ERR_MASK_TEST (tCVE-2021-37501_attr_decode 1 "error getting attribute information" tCVE-2021-37501_attr_decode.h5) # onion VFD tests ADD_H5_TEST (tst_onion_objs 0 --enable-error-stack --vfd-name onion --vfd-info 3 tst_onion_objs.h5) diff --git a/tools/test/h5dump/CMakeTestsPBITS.cmake b/tools/test/h5dump/CMakeTestsPBITS.cmake index 4ae68846a5e..9e72ae10f1f 100644 --- a/tools/test/h5dump/CMakeTestsPBITS.cmake +++ b/tools/test/h5dump/CMakeTestsPBITS.cmake @@ -80,21 +80,6 @@ tarray1.h5 tcompound.h5 ) - set (HDF5_ERROR_REFERENCE_PBITS - tnofilename-with-packed-bits.err - tpbitsCharLengthExceeded.err - tpbitsCharOffsetExceeded.err - tpbitsIncomplete.err - tpbitsIntLengthExceeded.err - tpbitsIntOffsetExceeded.err - tpbitsLengthExceeded.err - tpbitsLengthPositive.err - tpbitsLongLengthExceeded.err - tpbitsLongOffsetExceeded.err - tpbitsMaxExceeded.err - tpbitsOffsetExceeded.err - tpbitsOffsetNegative.err - ) foreach (pbits_h5_file ${HDF5_REFERENCE_TEST_PBITS}) HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/${pbits_h5_file}" "${PROJECT_BINARY_DIR}/testfiles/pbits/${pbits_h5_file}" "h5dump_pbits_files") @@ -103,10 +88,6 @@ foreach (ddl_pbits ${HDF5_REFERENCE_PBITS}) HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/expected/pbits/${ddl_pbits}" "${PROJECT_BINARY_DIR}/testfiles/pbits/${ddl_pbits}" "h5dump_pbits_files") endforeach () - - foreach (ddl_err_pbits ${HDF5_ERROR_REFERENCE_PBITS}) - HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/errfiles/pbits/${ddl_err_pbits}" "${PROJECT_BINARY_DIR}/testfiles/pbits/${ddl_err_pbits}" "h5dump_pbits_files") - endforeach () add_custom_target(h5dump_pbits_files ALL COMMENT "Copying files needed by h5dump_pbits tests" DEPENDS ${h5dump_pbits_files_list}) ############################################################################## @@ -115,7 +96,7 @@ ############################################################################## ############################################################################## - macro (ADD_H5_PBITS_TEST resultfile resultcode) + macro (ADD_H5_PBITS_TEST resultfile resultcode result_errcheck) # If using memchecker add tests without using scripts if (HDF5_USING_ANALYSIS_TOOL) add_test (NAME H5DUMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) @@ -123,18 +104,34 @@ set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") endif () else () - add_test ( - NAME H5DUMP-${resultfile} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=${ARGN}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/pbits" - -D "TEST_OUTPUT=${resultfile}.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=${resultfile}.ddl" - -P "${HDF_RESOURCES_DIR}/runTest.cmake" - ) + if (${resultcode}) + add_test ( + NAME H5DUMP-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/pbits" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.ddl" + -D "TEST_ERRREF=${result_errcheck}" + -P "${HDF_RESOURCES_DIR}/grepTest.cmake" + ) + else () + add_test ( + NAME H5DUMP-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/pbits" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.ddl" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" + ) + endif () endif () set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/pbits" @@ -152,7 +149,7 @@ # test failure handling # Missing file name - ADD_H5_PBITS_TEST (tnofilename-with-packed-bits 1 --enable-error-stack) + ADD_H5_PBITS_TEST (tnofilename-with-packed-bits 1 "missing file name" --enable-error-stack) # Limits: # Maximum number of packed bits is 8 (for now). # Maximum integer size is 8*sizeof(long long). @@ -162,69 +159,69 @@ # Normal operation on both signed and unsigned int datasets. # Sanity check # Their rawdata output should be the same. - ADD_H5_PBITS_TEST (tpbitsSignedWhole 0 --enable-error-stack -d /DS08BITS -M 0,8 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsUnsignedWhole 0 --enable-error-stack -d /DU08BITS -M 0,8 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsSignedIntWhole 0 --enable-error-stack -d /DS16BITS -M 0,16 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsUnsignedIntWhole 0 --enable-error-stack -d /DU16BITS -M 0,16 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsSignedLongWhole 0 --enable-error-stack -d /DS32BITS -M 0,32 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsUnsignedLongWhole 0 --enable-error-stack -d /DU32BITS -M 0,32 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsSignedLongLongWhole 0 --enable-error-stack -d /DS64BITS -M 0,64 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsUnsignedLongLongWhole 0 --enable-error-stack -d /DU64BITS -M 0,64 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsSignedLongLongWhole63 0 --enable-error-stack -d /DS64BITS -M 0,63 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsUnsignedLongLongWhole63 0 --enable-error-stack -d /DU64BITS -M 0,63 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsSignedLongLongWhole1 0 --enable-error-stack -d /DS64BITS -M 1,63 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsUnsignedLongLongWhole1 0 --enable-error-stack -d /DU64BITS -M 1,63 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsSignedWhole 0 "" --enable-error-stack -d /DS08BITS -M 0,8 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsUnsignedWhole 0 "" --enable-error-stack -d /DU08BITS -M 0,8 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsSignedIntWhole 0 "" --enable-error-stack -d /DS16BITS -M 0,16 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsUnsignedIntWhole 0 "" --enable-error-stack -d /DU16BITS -M 0,16 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsSignedLongWhole 0 "" --enable-error-stack -d /DS32BITS -M 0,32 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsUnsignedLongWhole 0 "" --enable-error-stack -d /DU32BITS -M 0,32 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsSignedLongLongWhole 0 "" --enable-error-stack -d /DS64BITS -M 0,64 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsUnsignedLongLongWhole 0 "" --enable-error-stack -d /DU64BITS -M 0,64 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsSignedLongLongWhole63 0 "" --enable-error-stack -d /DS64BITS -M 0,63 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsUnsignedLongLongWhole63 0 "" --enable-error-stack -d /DU64BITS -M 0,63 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsSignedLongLongWhole1 0 "" --enable-error-stack -d /DS64BITS -M 1,63 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsUnsignedLongLongWhole1 0 "" --enable-error-stack -d /DU64BITS -M 1,63 packedbits.h5) # Half sections - ADD_H5_PBITS_TEST (tpbitsSigned4 0 --enable-error-stack -d /DS08BITS -M 0,4,4,4 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsUnsigned4 0 --enable-error-stack -d /DU08BITS -M 0,4,4,4 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsSignedInt8 0 --enable-error-stack -d /DS16BITS -M 0,8,8,8 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsUnsignedInt8 0 --enable-error-stack -d /DU16BITS -M 0,8,8,8 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsSignedLong16 0 --enable-error-stack -d /DS32BITS -M 0,16,16,16 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsUnsignedLong16 0 --enable-error-stack -d /DU32BITS -M 0,16,16,16 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsSignedLongLong32 0 --enable-error-stack -d /DS64BITS -M 0,32,32,32 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsUnsignedLongLong32 0 --enable-error-stack -d /DU64BITS -M 0,32,32,32 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsSigned4 0 "" --enable-error-stack -d /DS08BITS -M 0,4,4,4 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsUnsigned4 0 "" --enable-error-stack -d /DU08BITS -M 0,4,4,4 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsSignedInt8 0 "" --enable-error-stack -d /DS16BITS -M 0,8,8,8 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsUnsignedInt8 0 "" --enable-error-stack -d /DU16BITS -M 0,8,8,8 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsSignedLong16 0 "" --enable-error-stack -d /DS32BITS -M 0,16,16,16 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsUnsignedLong16 0 "" --enable-error-stack -d /DU32BITS -M 0,16,16,16 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsSignedLongLong32 0 "" --enable-error-stack -d /DS64BITS -M 0,32,32,32 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsUnsignedLongLong32 0 "" --enable-error-stack -d /DU64BITS -M 0,32,32,32 packedbits.h5) # Quarter sections - ADD_H5_PBITS_TEST (tpbitsSigned2 0 --enable-error-stack -d /DS08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsUnsigned2 0 --enable-error-stack -d /DU08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsSignedInt4 0 --enable-error-stack -d /DS16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsUnsignedInt4 0 --enable-error-stack -d /DU16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsSignedLong8 0 --enable-error-stack -d /DS32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsUnsignedLong8 0 --enable-error-stack -d /DU32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsSignedLongLong16 0 --enable-error-stack -d /DS64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsUnsignedLongLong16 0 --enable-error-stack -d /DU64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsSigned2 0 "" --enable-error-stack -d /DS08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsUnsigned2 0 "" --enable-error-stack -d /DU08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsSignedInt4 0 "" --enable-error-stack -d /DS16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsUnsignedInt4 0 "" --enable-error-stack -d /DU16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsSignedLong8 0 "" --enable-error-stack -d /DS32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsUnsignedLong8 0 "" --enable-error-stack -d /DU32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsSignedLongLong16 0 "" --enable-error-stack -d /DS64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsUnsignedLongLong16 0 "" --enable-error-stack -d /DU64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5) # Begin and End - ADD_H5_PBITS_TEST (tpbitsSigned 0 --enable-error-stack -d /DS08BITS -M 0,2,2,6 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsUnsigned 0 --enable-error-stack -d /DU08BITS -M 0,2,2,6 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsSignedInt 0 --enable-error-stack -d /DS16BITS -M 0,2,10,6 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsUnsignedInt 0 --enable-error-stack -d /DU16BITS -M 0,2,10,6 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsSignedLong 0 --enable-error-stack -d /DS32BITS -M 0,2,26,6 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsUnsignedLong 0 --enable-error-stack -d /DU32BITS -M 0,2,26,6 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsSignedLongLong 0 --enable-error-stack -d /DS64BITS -M 0,2,58,6 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsUnsignedLongLong 0 --enable-error-stack -d /DU64BITS -M 0,2,58,6 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsSigned 0 "" --enable-error-stack -d /DS08BITS -M 0,2,2,6 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsUnsigned 0 "" --enable-error-stack -d /DU08BITS -M 0,2,2,6 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsSignedInt 0 "" --enable-error-stack -d /DS16BITS -M 0,2,10,6 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsUnsignedInt 0 "" --enable-error-stack -d /DU16BITS -M 0,2,10,6 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsSignedLong 0 "" --enable-error-stack -d /DS32BITS -M 0,2,26,6 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsUnsignedLong 0 "" --enable-error-stack -d /DU32BITS -M 0,2,26,6 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsSignedLongLong 0 "" --enable-error-stack -d /DS64BITS -M 0,2,58,6 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsUnsignedLongLong 0 "" --enable-error-stack -d /DU64BITS -M 0,2,58,6 packedbits.h5) # Overlapped packed bits. - ADD_H5_PBITS_TEST (tpbitsOverlapped 0 --enable-error-stack -d /DS08BITS -M 0,1,1,1,2,1,0,3 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsOverlapped 0 "" --enable-error-stack -d /DS08BITS -M 0,1,1,1,2,1,0,3 packedbits.h5) # Maximum number of packed bits. - ADD_H5_PBITS_TEST (tpbitsMax 0 --enable-error-stack -d /DS08BITS -M 0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsMax 0 "" --enable-error-stack -d /DS08BITS -M 0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1 packedbits.h5) # Compound type. - ADD_H5_PBITS_TEST (tpbitsCompound 0 --enable-error-stack -d /dset1 -M 0,1,1,1 tcompound.h5) + ADD_H5_PBITS_TEST (tpbitsCompound 0 "" --enable-error-stack -d /dset1 -M 0,1,1,1 tcompound.h5) # Array type. - ADD_H5_PBITS_TEST (tpbitsArray 0 --enable-error-stack -d /Dataset1 -M 0,1,1,1 tarray1.h5) + ADD_H5_PBITS_TEST (tpbitsArray 0 "" --enable-error-stack -d /Dataset1 -M 0,1,1,1 tarray1.h5) # Test Error handling. # Too many packed bits requested. Max is 8 for now. - ADD_H5_PBITS_TEST (tpbitsMaxExceeded 1 --enable-error-stack -d /DS08BITS -M 0,1,0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsMaxExceeded 1 "Too many masks requested" --enable-error-stack -d /DS08BITS -M 0,1,0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1 packedbits.h5) # Offset too large. Max is 8*sizeof(long long. - ADD_H5_PBITS_TEST (tpbitsOffsetExceeded 1 --enable-error-stack -d /DS08BITS -M 64,1 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsCharOffsetExceeded 0 --enable-error-stack -d /DS08BITS -M 8,1 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsIntOffsetExceeded 0 --enable-error-stack -d /DS16BITS -M 16,1 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsLongOffsetExceeded 0 --enable-error-stack -d /DS32BITS -M 32,1 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsOffsetExceeded 1 "must be between 0 and 63" --enable-error-stack -d /DS08BITS -M 64,1 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsCharOffsetExceeded 0 "" --enable-error-stack -d /DS08BITS -M 8,1 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsIntOffsetExceeded 0 "" --enable-error-stack -d /DS16BITS -M 16,1 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsLongOffsetExceeded 0 "" --enable-error-stack -d /DS32BITS -M 32,1 packedbits.h5) # Bad offset, must not be negative. - ADD_H5_PBITS_TEST (tpbitsOffsetNegative 1 --enable-error-stack -d /DS08BITS -M -1,1 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsOffsetNegative 1 "Bad mask list" --enable-error-stack -d /DS08BITS -M -1,1 packedbits.h5) # Bad length, must not be positive. - ADD_H5_PBITS_TEST (tpbitsLengthPositive 1 --enable-error-stack -d /DS08BITS -M 4,0 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsLengthPositive 1 "must be positive" --enable-error-stack -d /DS08BITS -M 4,0 packedbits.h5) # Offset+Length is too large. Max is 8*sizeof(long long). - ADD_H5_PBITS_TEST (tpbitsLengthExceeded 1 --enable-error-stack -d /DS08BITS -M 37,28 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsCharLengthExceeded 0 --enable-error-stack -d /DS08BITS -M 2,7 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsIntLengthExceeded 0 --enable-error-stack -d /DS16BITS -M 10,7 packedbits.h5) - ADD_H5_PBITS_TEST (tpbitsLongLengthExceeded 0 --enable-error-stack -d /DS32BITS -M 26,7 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsLengthExceeded 1 "too large" --enable-error-stack -d /DS08BITS -M 37,28 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsCharLengthExceeded 0 "" --enable-error-stack -d /DS08BITS -M 2,7 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsIntLengthExceeded 0 "" --enable-error-stack -d /DS16BITS -M 10,7 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsLongLengthExceeded 0 "" --enable-error-stack -d /DS32BITS -M 26,7 packedbits.h5) # Incomplete pair of packed bits request. - ADD_H5_PBITS_TEST (tpbitsIncomplete 1 --enable-error-stack -d /DS08BITS -M 0,2,2,1,0,2,2, packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsIncomplete 1 "Bad mask list" --enable-error-stack -d /DS08BITS -M 0,2,2,1,0,2,2, packedbits.h5) diff --git a/tools/test/h5format_convert/CMakeTests.cmake b/tools/test/h5format_convert/CMakeTests.cmake index 49b9bbc26c5..cb0879f3993 100644 --- a/tools/test/h5format_convert/CMakeTests.cmake +++ b/tools/test/h5format_convert/CMakeTests.cmake @@ -45,13 +45,10 @@ old_h5fc_ext2_sf.ddl old_h5fc_ext3_isf.ddl h5fc_v_err.ddl - h5fc_v_err.ddl.err ) set (HDF5_REFERENCE_ERR_FILES - h5fc_d_file.ddl.err h5fc_dname.err h5fc_nonexistfile.ddl.err - h5fc_nonexistdset_file.ddl.err ) set (HDF5_REFERENCE_TEST_FILES h5fc_non_v3.h5 @@ -266,7 +263,6 @@ set_tests_properties (H5FC_CHECK_IDX-${testname}-clean-objects PROPERTIES FIXTURES_CLEANUP clear_H5FC-${testname} ) - add_test ( NAME H5FC-${testname}-tmpfile COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/${testname}-tmp.h5 @@ -440,17 +436,20 @@ # h5format_convert nonexist.h5 (no options, file does not exist) ADD_H5_OUTPUT (h5fc_help h5fc_help.ddl 0 "" --help) ADD_H5_OUTPUT (h5fc_nooption h5fc_nooption.ddl 1 "") +# ADD_H5_MASK_OUTPUT (h5fc_nooption h5fc_nooption.ddl 1 "" "") ADD_H5_OUTPUT (h5fc_nonexistfile h5fc_nonexistfile.ddl 1 "" nonexist.h5) +# ADD_H5_MASK_OUTPUT (h5fc_nonexistfile h5fc_nonexistfile.ddl 1 "unable to open file" "" nonexist.h5) # # # h5format_convert -d old_h5fc_ext_none.h5 (just -d option, file exists) # h5format_convert --dname old_h5fc_ext_none.h5 (just --dname option, file exists) # h5format_convert --dname (just --dname option) # h5format_convert --dname=nonexist old_h5fc_ext_none.h5 (dataset does not exist, file exists) - ADD_H5_OUTPUT (h5fc_d_file-d h5fc_d_file.ddl 1 old_h5fc_ext_none.h5 -d) - ADD_H5_OUTPUT (h5fc_d_file h5fc_d_file.ddl 1 old_h5fc_ext_none.h5 --dname) + ADD_H5_MASK_OUTPUT (h5fc_d_file-d h5fc_d_file.ddl 1 "missing file name" old_h5fc_ext_none.h5 -d) + ADD_H5_MASK_OUTPUT (h5fc_d_file h5fc_d_file.ddl 1 "missing file name" old_h5fc_ext_none.h5 --dname) ADD_H5_OUTPUT (h5fc_dname h5fc_dname.ddl 1 "" --dname) - ADD_H5_OUTPUT (h5fc_nonexistdset_file h5fc_nonexistdset_file.ddl 1 old_h5fc_ext_none.h5 --dname=nonexist) +# ADD_H5_MASK_OUTPUT (h5fc_dname h5fc_dname.ddl 1 "missing file name" "" --dname) + ADD_H5_MASK_OUTPUT (h5fc_nonexistdset_file h5fc_nonexistdset_file.ddl 1 "unable to open dataset" old_h5fc_ext_none.h5 --dname=nonexist) # # # diff --git a/tools/test/h5ls/CMakeTests.cmake b/tools/test/h5ls/CMakeTests.cmake index 2aefdb65715..e47c254f465 100644 --- a/tools/test/h5ls/CMakeTests.cmake +++ b/tools/test/h5ls/CMakeTests.cmake @@ -51,13 +51,6 @@ tudlink.h5 tvldtypes1.h5 ) - - set (LIST_ERR_TEST_FILES - nosuchfile.err - textlinksrc-nodangle-1.err - tgroup-1.err - ) - set (LIST_OTHER_TEST_FILES help-1.ls help-2.ls @@ -136,9 +129,6 @@ foreach (listothers ${LIST_OTHER_TEST_FILES}) HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/expected/${listothers}" "${PROJECT_BINARY_DIR}/testfiles/${listothers}" "h5ls_files") endforeach () - foreach (listerrfiles ${LIST_ERR_TEST_FILES}) - HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/errfiles/${listerrfiles}" "${PROJECT_BINARY_DIR}/testfiles/${listerrfiles}" "h5ls_files") - endforeach () add_custom_target(h5ls_files ALL COMMENT "Copying files needed by h5ls tests" DEPENDS ${h5ls_files_list}) ############################################################################## diff --git a/tools/test/h5stat/CMakeTests.cmake b/tools/test/h5stat/CMakeTests.cmake index ed45e9302ab..cfd9be7f6d3 100644 --- a/tools/test/h5stat/CMakeTests.cmake +++ b/tools/test/h5stat/CMakeTests.cmake @@ -52,17 +52,6 @@ h5stat_numattrs3 h5stat_numattrs4 ) - set (HDF5_REFERENCE_ERR_FILES - h5stat_err_refcount - h5stat_err_old_layout - h5stat_err_old_fill - h5stat_err1_dims - h5stat_err1_links - h5stat_err1_numattrs - h5stat_err2_numattrs - h5stat_notexist - h5stat_nofile - ) set (HDF5_REFERENCE_TEST_FILES h5stat_err_refcount.h5 h5stat_err_old_layout.h5 @@ -78,10 +67,6 @@ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/expected/${ddl_file}.ddl" "${PROJECT_BINARY_DIR}/${ddl_file}.ddl" "h5stat_files") endforeach () - foreach (h5_file ${HDF5_REFERENCE_ERR_FILES}) - HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/expected/${h5_file}.err" "${PROJECT_BINARY_DIR}/${h5_file}.err" "h5stat_files") - endforeach () - foreach (h5_file ${HDF5_REFERENCE_TEST_FILES}) HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/${h5_file}" "h5stat_files") endforeach () @@ -122,7 +107,7 @@ endif () endmacro () - macro (ADD_H5_ERR_TEST resultfile resultcode) + macro (ADD_H5_ERR_TEST resultfile resultcode errtext) # If using memchecker add tests without using scripts if (HDF5_USING_ANALYSIS_TOOL) add_test (NAME H5STAT-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) @@ -135,13 +120,44 @@ COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" - -D "TEST_ARGS=${ARGN}" + -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.mty" - -D "TEST_ERRREF=${resultfile}.err" - -P "${HDF_RESOURCES_DIR}/runTest.cmake" + -D "TEST_ERRREF=${errtext}" + -D "TEST_SKIP_COMPARE=true" + -P "${HDF_RESOURCES_DIR}/grepTest.cmake" + ) + endif () + set_tests_properties (H5STAT-${resultfile} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}" + ) + if ("H5STAT-${resultfile}" MATCHES "${HDF5_DISABLE_TESTS_REGEX}") + set_tests_properties (H5STAT-${resultfile} PROPERTIES DISABLED true) + endif () + endmacro () + + macro (ADD_H5_CMP_TEST resultfile resultcode errtext) + # If using memchecker add tests without using scripts + if (HDF5_USING_ANALYSIS_TOOL) + add_test (NAME H5STAT-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) + if (${resultcode}) + set_tests_properties (H5STAT-${resultfile} PROPERTIES WILL_FAIL "true") + endif () + else (HDF5_USING_ANALYSIS_TOOL) + add_test ( + NAME H5STAT-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.ddl" + -D "TEST_ERRREF=${errtext}" + -P "${HDF_RESOURCES_DIR}/grepTest.cmake" ) endif () set_tests_properties (H5STAT-${resultfile} PROPERTIES @@ -163,8 +179,8 @@ ADD_H5_TEST (h5stat_help2 0 --help) # Test when h5stat a file that does not exist - ADD_H5_TEST (h5stat_notexist 1 notexist.h5) - ADD_H5_TEST (h5stat_nofile 1 '') + ADD_H5_CMP_TEST (h5stat_notexist 1 "unable to open file" notexist.h5) + ADD_H5_CMP_TEST (h5stat_nofile 1 "missing file name" '') # Test file with groups, compressed datasets, user-applied filters, etc. # h5stat_filters.h5 is a copy of ../../testfiles/tfilters.h5 as of release 1.8.0-alpha4 @@ -191,7 +207,7 @@ # -g -l 8 # --links=8 # --links=20 -g - ADD_H5_ERR_TEST (h5stat_err1_links 1 -l 0 h5stat_threshold.h5) + ADD_H5_ERR_TEST (h5stat_err1_links 1 "Invalid threshold for small groups" -l 0 h5stat_threshold.h5) ADD_H5_TEST (h5stat_links1 0 -g -l 8 h5stat_threshold.h5) ADD_H5_TEST (h5stat_links2 0 --links=8 h5stat_threshold.h5) ADD_H5_TEST (h5stat_links3 0 --links=20 -g h5stat_threshold.h5) @@ -206,7 +222,7 @@ # -d --dims=-1 (incorrect threshold value) # -gd -m 5 # -d --di=15 - ADD_H5_ERR_TEST (h5stat_err1_dims 1 -d --dims=-1 h5stat_threshold.h5) + ADD_H5_ERR_TEST (h5stat_err1_dims 1 "Invalid threshold for small datasets" -d --dims=-1 h5stat_threshold.h5) ADD_H5_TEST (h5stat_dims1 0 -gd -m 5 h5stat_threshold.h5) ADD_H5_TEST (h5stat_dims2 0 -d --dims=15 h5stat_threshold.h5) # @@ -216,8 +232,8 @@ # -AS -a 10 # -a 1 # -A --numattrs=25 - ADD_H5_ERR_TEST (h5stat_err1_numattrs 1 -a -2 h5stat_threshold.h5) - ADD_H5_ERR_TEST (h5stat_err2_numattrs 1 --numattrs h5stat_threshold.h5) + ADD_H5_ERR_TEST (h5stat_err1_numattrs 1 "Invalid threshold for small # of attributes" -a -2 h5stat_threshold.h5) + ADD_H5_ERR_TEST (h5stat_err2_numattrs 1 "Invalid threshold for small # of attributes" --numattrs h5stat_threshold.h5) ADD_H5_TEST (h5stat_numattrs1 0 -AS -a 10 h5stat_threshold.h5) ADD_H5_TEST (h5stat_numattrs2 0 -a 1 h5stat_threshold.h5) ADD_H5_TEST (h5stat_numattrs3 0 -A --numattrs=25 h5stat_threshold.h5) @@ -229,8 +245,8 @@ # Tests to verify HDFFV-10333: # h5stat_err_refcount.h5 is generated by h5stat_gentest.c # h5stat_err_old_layout.h5 and h5stat_err_old_fill.h5: see explanation in h5stat_gentest.c - ADD_H5_TEST (h5stat_err_refcount 1 h5stat_err_refcount.h5) - ADD_H5_TEST (h5stat_err_old_layout 1 h5stat_err_old_layout.h5) - ADD_H5_TEST (h5stat_err_old_fill 1 h5stat_err_old_fill.h5) + ADD_H5_CMP_TEST (h5stat_err_refcount 1 "unable to traverse objects" h5stat_err_refcount.h5) + ADD_H5_CMP_TEST (h5stat_err_old_layout 1 "unable to traverse objects" h5stat_err_old_layout.h5) + ADD_H5_CMP_TEST (h5stat_err_old_fill 1 "unable to traverse objects" h5stat_err_old_fill.h5) # # diff --git a/tools/test/misc/CMakeTestsClear.cmake b/tools/test/misc/CMakeTestsClear.cmake index 63f1d6a66c1..9ad371bd5ac 100644 --- a/tools/test/misc/CMakeTestsClear.cmake +++ b/tools/test/misc/CMakeTestsClear.cmake @@ -58,10 +58,6 @@ h5clear_user_less_after_size.ddl h5clear_user_less_before_size.ddl ) - set (HDF5_REFERENCE_ERR_FILES - h5clear_no_mdc_image.err - h5clear_open_fail.err - ) foreach (h5_file ${HDF5_TEST_FILES} ${HDF5_SEC2_TEST_FILES}) HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" "h5clear_files") @@ -69,9 +65,6 @@ foreach (h5_file ${HDF5_REFERENCE_TEST_FILES}) HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/expected/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" "h5clear_files") endforeach () - foreach (h5_file ${HDF5_REFERENCE_ERR_FILES}) - HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/expected/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" "h5clear_files") - endforeach () # make second copy of h5clear_sec2.h5 foreach (h5_file ${HDF5_SEC2_TEST_FILES}) HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/orig_${h5_file}" "h5clear_files") From 63fcd583d0215aa28ec24a6d61b5fde18bad8329 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 3 May 2024 05:30:45 -0500 Subject: [PATCH 6/7] Removed "function/code stack" debugging configure option (#4454) Easily replaced w/third-party tools, e.g. libbacktrace (https://github.com/ianlancetaylor/libbacktrace) --- bin/trace | 2 - config/cmake/ConfigureChecks.cmake | 10 - config/cmake/H5pubconf.h.in | 3 - config/cmake/HDF5DeveloperBuild.cmake | 13 +- config/cmake/libhdf5.settings.cmake.in | 1 - configure.ac | 34 --- release_docs/INSTALL_CMake.txt | 1 - release_docs/RELEASE.txt | 10 + src/CMakeLists.txt | 11 - src/H5CS.c | 295 ------------------- src/H5CSprivate.h | 30 -- src/H5FL.c | 375 +++---------------------- src/H5FLprivate.h | 101 ++----- src/H5build_settings.autotools.c.in | 1 - src/H5build_settings.cmake.c.in | 1 - src/H5private.h | 66 ----- src/Makefile.am | 1 - src/libhdf5.settings.in | 1 - 18 files changed, 73 insertions(+), 883 deletions(-) delete mode 100644 src/H5CS.c delete mode 100644 src/H5CSprivate.h diff --git a/bin/trace b/bin/trace index f86b2ee7874..d37c87a596b 100755 --- a/bin/trace +++ b/bin/trace @@ -307,14 +307,12 @@ sub rewrite_func ($$$$$) { # First remove: # * /*in*/, /*out*/, /*in_out*/, and /*in,out*/ comments # * preprocessor lines that start with # - # * H5FL_TRACKING_PARAMS macros (free list code only) # # then split the function arguments on commas $args =~ s/\/\*\s*in\s*\*\///g; # Get rid of /*in*/ $args =~ s/\/\*\s*out\s*\*\///g; # Get rid of /*out*/ $args =~ s/\/\*\s*in,\s*out\s*\*\///g; # Get rid of /*in,out*/ $args =~ s/\/\*\s*in_out\s*\*\///g; # Get rid of /*in_out*/ - $args =~ s/H5FL_TRACK_PARAMS//g; # Remove free list macro $args =~ s/\n#.*?\n/\n/g; # Remove lines beginning with '#' my @args = split /,[\s\n]*/, $args; my $argno = 0; diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 56e91cddc93..af2d13e5180 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -495,16 +495,6 @@ if (HDF5_WANT_DCONV_EXCEPTION) endif () MARK_AS_ADVANCED (HDF5_WANT_DCONV_EXCEPTION) -# ---------------------------------------------------------------------- -# Check if they would like the function stack support compiled in -#----------------------------------------------------------------------------- -option (HDF5_ENABLE_CODESTACK "Enable the function stack tracing (for developer debugging)." OFF) -mark_as_advanced (HDF5_ENABLE_CODESTACK) -if (HDF5_ENABLE_CODESTACK) - set (${HDF_PREFIX}_HAVE_CODESTACK 1) -endif () -MARK_AS_ADVANCED (HDF5_ENABLE_CODESTACK) - # ---------------------------------------------------------------------- # Check if they would like to show all warnings (not suppressed internally) #----------------------------------------------------------------------------- diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index af80d0b545b..c6e3a619162 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -110,9 +110,6 @@ /* Define to 1 if CLOCK_MONOTONIC_COARSE is available */ #cmakedefine H5_HAVE_CLOCK_MONOTONIC_COARSE @H5_HAVE_CLOCK_MONOTONIC_COARSE@ -/* Define if the function stack tracing code is to be compiled in */ -#cmakedefine H5_HAVE_CODESTACK @H5_HAVE_CODESTACK@ - /* Define to 1 if you have the header file. */ #cmakedefine H5_HAVE_CURL_CURL_H @H5_HAVE_CURL_H@ diff --git a/config/cmake/HDF5DeveloperBuild.cmake b/config/cmake/HDF5DeveloperBuild.cmake index f8ccc2f7bef..a8c128d7e70 100644 --- a/config/cmake/HDF5DeveloperBuild.cmake +++ b/config/cmake/HDF5DeveloperBuild.cmake @@ -157,17 +157,6 @@ if (HDF5_ENABLE_DEBUG_H5C_SANITY_CHECKS) # list (APPEND HDF5_DEBUG_APIS H5C_DO_MEMORY_SANITY_CHECKS=1) endif () -option (HDF5_ENABLE_DEBUG_H5FL_TRACK "Enable tracking of free list allocations" OFF) -mark_as_advanced (HDF5_ENABLE_DEBUG_H5FL_TRACK) -if (HDF5_ENABLE_DEBUG_H5FL_TRACK) - list (APPEND HDF5_DEBUG_APIS H5FL_TRACK) - - # Free list tracking requires the codestack functionality - set (HDF5_ENABLE_CODESTACK ON CACHE BOOL "Enable the function stack tracing (for developer debugging)." FORCE) -else () - unset (HDF5_ENABLE_CODESTACK CACHE) -endif () - option (HDF5_ENABLE_DEBUG_H5FS_ASSERT "Enable extra debugging of H5FS module" OFF) mark_as_advanced (HDF5_ENABLE_DEBUG_H5FS_ASSERT) if (HDF5_ENABLE_DEBUG_H5FS_ASSERT) @@ -178,7 +167,7 @@ endif () # free lists entirely for developer build modes, as they can # make certain types of issues (like references to stale pointers) # much more difficult to debug -if (NOT HDF5_ENABLE_DEBUG_H5FL AND NOT HDF5_ENABLE_DEBUG_H5FL_TRACK) +if (NOT HDF5_ENABLE_DEBUG_H5FL) list (APPEND HDF5_DEVELOPER_DEFS H5_NO_FREE_LISTS) endif () diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in index deb07ed82d6..c9f3e4d413c 100644 --- a/config/cmake/libhdf5.settings.cmake.in +++ b/config/cmake/libhdf5.settings.cmake.in @@ -88,7 +88,6 @@ Dimension scales w/ new references: @DIMENSION_SCALES_WITH_NEW_REF@ Packages w/ extra debug output: @INTERNAL_DEBUG_OUTPUT@ API Tracing: @HDF5_ENABLE_TRACE@ Using memory checker: @HDF5_ENABLE_USING_MEMCHECKER@ - Function Stack Tracing: @HDF5_ENABLE_CODESTACK@ Use file locking: @HDF5_FILE_LOCKING_SETTING@ Strict File Format Checks: @HDF5_STRICT_FORMAT_CHECKS@ Optimization Instrumentation: @HDF5_Enable_Instrument@ diff --git a/configure.ac b/configure.ac index 04bb2f25116..e4201bb0824 100644 --- a/configure.ac +++ b/configure.ac @@ -2884,40 +2884,6 @@ if test -n "$DEBUG_PKG_LIST"; then done fi -## ---------------------------------------------------------------------- -## Check if they would like the function stack support compiled in -## -AC_MSG_CHECKING([whether function stack tracking is enabled]) -AC_ARG_ENABLE([codestack], - [AS_HELP_STRING([--enable-codestack], - [Enable the function stack tracing (for developer debugging). - [default=no] - ])], - [CODESTACK=$enableval]) - -## Set the default level. -if test "X-$CODESTACK" = X- ; then - CODESTACK=no -fi - -## Allow this variable to be substituted in -## other files (src/libhdf5.settings.in, etc.) -AC_SUBST([CODESTACK]) - -case "X-$CODESTACK" in - X-yes) - AC_MSG_RESULT([yes]) - AC_DEFINE([HAVE_CODESTACK], [1], - [Define if the function stack tracing code is to be compiled in]) - ;; - X-no) - AC_MSG_RESULT([no]) - ;; - *) - AC_MSG_ERROR([Unrecognized value: $CODESTACK]) - ;; -esac - ## ---------------------------------------------------------------------- ## Enable tracing of the API ## diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 4a215d3c68f..bb5d85fae92 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -842,7 +842,6 @@ HDF5_EXTERNAL_LIB_PREFIX "Use prefix for custom library naming." HDF5_DISABLE_COMPILER_WARNINGS "Disable compiler warnings" OFF HDF5_ENABLE_ALL_WARNINGS "Enable all warnings" OFF HDF5_SHOW_ALL_WARNINGS "Show all warnings (i.e. not suppress "noisy" ones internally)" OFF -HDF5_ENABLE_CODESTACK "Enable the function stack tracing (for developer debugging)." OFF HDF5_ENABLE_COVERAGE "Enable code coverage for Libraries and Programs" OFF HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF HDF5_ENABLE_DEPRECATED_SYMBOLS "Enable deprecated public API symbols" ON diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 9218e108e82..a121ed372ac 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -47,6 +47,16 @@ New Features Configuration: ------------- + - Removed "function/code stack" debugging configuration option: + + CMake: HDF5_ENABLE_CODESTACK + Autotools: --enable-codestack + + This was used to debug memory leaks internal to the library, but has been + broken for >1.5 years and is now easily replaced with third-party tools + (e.g. libbacktrace: https://github.com/ianlancetaylor/libbacktrace) on an + as-needed basis when debugging an issue. + - Added configure options for enabling/disabling non-standard programming language features diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 51464d53f5e..8ff62e8c9f9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -99,14 +99,6 @@ set (H5C_HDRS IDE_GENERATED_PROPERTIES ("H5C" "${H5C_HDRS}" "${H5C_SOURCES}" ) -set (H5CS_SOURCES - ${HDF5_SRC_DIR}/H5CS.c -) -set (H5CS_HDRS -) -IDE_GENERATED_PROPERTIES ("H5CS" "${H5CS_HDRS}" "${H5CS_SOURCES}" ) - - set (H5CX_SOURCES ${HDF5_SRC_DIR}/H5CX.c ) @@ -777,7 +769,6 @@ set (common_SRCS ${H5B_SOURCES} ${H5B2_SOURCES} ${H5C_SOURCES} - ${H5CS_SOURCES} ${H5CX_SOURCES} ${H5D_SOURCES} ${H5E_SOURCES} @@ -872,8 +863,6 @@ set (H5_PRIVATE_HEADERS ${HDF5_SRC_DIR}/H5Cpkg.h ${HDF5_SRC_DIR}/H5Cprivate.h - ${HDF5_SRC_DIR}/H5CSprivate.h - ${HDF5_SRC_DIR}/H5CXprivate.h ${HDF5_SRC_DIR}/H5Dpkg.h diff --git a/src/H5CS.c b/src/H5CS.c deleted file mode 100644 index 4172b0fe6bd..00000000000 --- a/src/H5CS.c +++ /dev/null @@ -1,295 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://www.hdfgroup.org/licenses. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * Purpose: Provides internal function tracing in the form of a stack. - * The FUNC_ENTER() macro adds the function name to the function - * stack whenever a function is entered. - * As the functions return with FUNC_LEAVE, - * entries are removed from the stack. - * - * A function stack has a fixed maximum size. If this size is - * exceeded then the stack will be truncated and only the - * first called functions will have entries on the stack. This is - * expected to be a rare condition. - * - */ - -#include "H5private.h" /* Generic Functions */ -#include "H5CSprivate.h" /* Function stack */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5MMprivate.h" /* Memory management */ - -#ifdef H5_HAVE_CODESTACK - -#define H5CS_MIN_NSLOTS 16 /* Minimum number of records in an function stack */ - -/* A function stack */ -typedef struct H5CS_t { - unsigned nused; /* Number of records currently used in stack */ - unsigned nalloc; /* Number of records current allocated for stack */ - const char **rec; /* Array of function records */ -} H5CS_t; - -#ifdef H5_HAVE_THREADSAFE -/* - * The per-thread function stack. pthread_once() initializes a special - * key that will be used by all threads to create a stack specific to - * each thread individually. The association of stacks to threads will - * be handled by the pthread library. - * - * In order for this macro to work, H5CS_get_my_stack() must be preceded - * by "H5CS_t *fstack =". - */ -static H5CS_t *H5CS__get_stack(void); -#define H5CS_get_my_stack() H5CS__get_stack() -#else /* H5_HAVE_THREADSAFE */ -/* - * The function stack. Eventually we'll have some sort of global table so each - * thread has it's own stack. The stacks will be created on demand when the - * thread first calls H5CS_push(). */ -H5CS_t H5CS_stack_g[1]; -#define H5CS_get_my_stack() (H5CS_stack_g + 0) -#endif /* H5_HAVE_THREADSAFE */ - -#ifdef H5_HAVE_THREADSAFE -/*------------------------------------------------------------------------- - * Function: H5CS__get_stack - * - * Purpose: Support function for H5CS_get_my_stack() to initialize and - * acquire per-thread function stack. - * - * Return: Success: function stack (H5CS_t *) - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -static H5CS_t * -H5CS__get_stack(void) -{ - H5CS_t *fstack; - - FUNC_ENTER_PACKAGE_NOERR_NOFS - - fstack = H5TS_get_thread_local_value(H5TS_funcstk_key_g); - if (!fstack) { - /* No associated value with current thread - create one */ -#ifdef H5_HAVE_WIN_THREADS - fstack = (H5CS_t *)LocalAlloc( - LPTR, sizeof(H5CS_t)); /* Win32 has to use LocalAlloc to match the LocalFree in DllMain */ -#else - fstack = - (H5CS_t *)malloc(sizeof(H5CS_t)); /* Don't use H5MM_malloc() here, it causes infinite recursion */ -#endif /* H5_HAVE_WIN_THREADS */ - assert(fstack); - - /* Set the thread-specific info */ - fstack->nused = 0; - fstack->nalloc = 0; - fstack->rec = NULL; - - /* (It's not necessary to release this in this API, it is - * released by the "key destructor" set up in the H5TS - * routines. See calls to pthread_key_create() in H5TS.c -QAK) - */ - H5TS_set_thread_local_value(H5TS_funcstk_key_g, (void *)fstack); - } /* end if */ - - FUNC_LEAVE_NOAPI_NOFS(fstack) -} /* end H5CS__get_stack() */ -#endif /* H5_HAVE_THREADSAFE */ - -/*------------------------------------------------------------------------- - * Function: H5CS_print_stack - * - * Purpose: Prints a function stack. - * - * Return: Non-negative on success/Negative on failure - * - *------------------------------------------------------------------------- - */ -herr_t -H5CS_print_stack(const H5CS_t *fstack, FILE *stream) -{ - const int indent = 2; /* Indentation level */ - int i; /* Local index ariable */ - - /* Don't push this function on the function stack... :-) */ - FUNC_ENTER_NOAPI_NOERR_NOFS - - /* Sanity check */ - assert(fstack); - - /* Default to outputting information to stderr */ - if (!stream) - stream = stderr; - - fprintf(stream, "HDF5-DIAG: Function stack from %s", H5_lib_vers_info_g); - /* try show the process or thread id in multiple processes cases*/ -#ifdef H5_HAVE_THREADSAFE - fprintf(stream, " thread %" PRIu64 ".", H5TS_thread_id()); -#endif - if (fstack && fstack->nused > 0) - fprintf(stream, " Back trace follows."); - fputc('\n', stream); - - for (i = fstack->nused - 1; i >= 0; --i) - fprintf(stream, "%*s#%03d: Routine: %s\n", indent, "", i, fstack->rec[i]); - - FUNC_LEAVE_NOAPI_NOFS(SUCCEED) -} /* end H5CS_print_stack() */ - -/*------------------------------------------------------------------------- - * Function: H5CS_push - * - * Purpose: Pushes a new record onto function stack for the current - * thread. - * - * Return: Non-negative on success/Negative on failure - * - *------------------------------------------------------------------------- - */ -herr_t -H5CS_push(const char *func_name) -{ - H5CS_t *fstack = H5CS_get_my_stack(); /* Current function stack for library */ - - /* Don't push this function on the function stack... :-) */ - FUNC_ENTER_NOAPI_NOERR_NOFS - - /* Sanity check */ - assert(fstack); - assert(fstack->nused <= fstack->nalloc); - assert(func_name); - - /* Check if we need to expand the stack of records */ - if (fstack->nused == fstack->nalloc) { - size_t na = MAX((fstack->nalloc * 2), H5CS_MIN_NSLOTS); - - /* Don't use H5MM_realloc here */ - const char **x = (const char **)realloc(fstack->rec, na * sizeof(const char *)); - - /* (Avoid returning an error from this routine, currently -QAK) */ - assert(x); - fstack->rec = x; - fstack->nalloc = na; - } /* end if */ - - /* Push the function name */ - fstack->rec[fstack->nused] = func_name; - fstack->nused++; - - FUNC_LEAVE_NOAPI_NOFS(SUCCEED) -} /* end H5CS_push() */ - -/*------------------------------------------------------------------------- - * Function: H5CS_pop - * - * Purpose: Pops a record off function stack for the current thread. - * - * Return: Non-negative on success/Negative on failure - * - *------------------------------------------------------------------------- - */ -herr_t -H5CS_pop(void) -{ - H5CS_t *fstack = H5CS_get_my_stack(); - - /* Don't push this function on the function stack... :-) */ - FUNC_ENTER_NOAPI_NOERR_NOFS - - /* Sanity check */ - assert(fstack); - assert(fstack->nused > 0); - - /* Pop the function. */ - fstack->nused--; - - FUNC_LEAVE_NOAPI_NOFS(SUCCEED) -} /* end H5CS_pop() */ - -/*------------------------------------------------------------------------- - * Function: H5CS_copy_stack - * - * Purpose: Makes a copy of the current stack - * - * Return: Non-negative on success/Negative on failure - * - *------------------------------------------------------------------------- - */ -H5CS_t * -H5CS_copy_stack(void) -{ - H5CS_t *old_stack = H5CS_get_my_stack(); /* Existing function stack for library */ - H5CS_t *new_stack; /* New function stack, for copy */ - H5CS_t *ret_value = NULL; /* Return value */ - - /* Don't push this function on the function stack... :-) */ - FUNC_ENTER_NOAPI_NOFS - - /* Sanity check */ - assert(old_stack); - - /* Allocate a new stack */ - /* (Don't use library allocate code, since this code stack supports it) */ - if (NULL == (new_stack = calloc(1, sizeof(H5CS_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't allocate function stack"); - if (NULL == (new_stack->rec = calloc(old_stack->nused, sizeof(const char *)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't allocate function stack records"); - - /* Copy pointers on old stack to new one */ - /* (Strings don't need to be duplicated, they are statically allocated) */ - H5MM_memcpy(new_stack->rec, old_stack->rec, sizeof(char *) * old_stack->nused); - new_stack->nused = new_stack->nalloc = old_stack->nused; - - /* Set the return value */ - ret_value = new_stack; - -done: - FUNC_LEAVE_NOAPI_NOFS(ret_value) -} /* end H5CS_copy_stack() */ - -/*------------------------------------------------------------------------- - * Function: H5CS_close_stack - * - * Purpose: Closes and frees a copy of a stack - * - * Return: Non-negative on success/Negative on failure - * - *------------------------------------------------------------------------- - */ -herr_t -H5CS_close_stack(H5CS_t *stack) -{ - /* Don't push this function on the function stack... :-) */ - FUNC_ENTER_NOAPI_NOERR_NOFS - - /* Sanity check */ - assert(stack); - - /* Free stack */ - /* The function name string are statically allocated (by the compiler) - * and are not allocated, so there's no need to free them. - */ - if (stack->rec) { - free(stack->rec); - stack->rec = NULL; - } /* end if */ - if (stack) - free(stack); - - FUNC_LEAVE_NOAPI_NOFS(SUCCEED) -} /* end H5CS_close_stack() */ - -#endif /* H5_HAVE_CODESTACK */ diff --git a/src/H5CSprivate.h b/src/H5CSprivate.h deleted file mode 100644 index 5cdf2d5fdd3..00000000000 --- a/src/H5CSprivate.h +++ /dev/null @@ -1,30 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://www.hdfgroup.org/licenses. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * Header file for function stacks, etc. - */ -#ifndef H5CSprivate_H -#define H5CSprivate_H - -/* Private headers needed by this file */ -#include "H5private.h" - -/* Forward declarations for structure fields */ -struct H5CS_t; -H5_DLL herr_t H5CS_push(const char *func_name); -H5_DLL herr_t H5CS_pop(void); -H5_DLL herr_t H5CS_print_stack(const struct H5CS_t *stack, FILE *stream); -H5_DLL struct H5CS_t *H5CS_copy_stack(void); -H5_DLL herr_t H5CS_close_stack(struct H5CS_t *stack); - -#endif /* H5CSprivate_H */ diff --git a/src/H5FL.c b/src/H5FL.c index 3415996e430..cdcdc0cbda9 100644 --- a/src/H5FL.c +++ b/src/H5FL.c @@ -113,15 +113,6 @@ struct H5FL_fac_node_t { /* The head of the list of factory things to garbage collect */ static H5FL_fac_gc_list_t H5FL_fac_gc_head = {0, NULL}; -#ifdef H5FL_TRACK - -/* Extra headers needed */ -#include "H5CSprivate.h" /* Function stack */ - -/* Head of "outstanding allocations" list */ -static H5FL_track_t *H5FL_out_head_g = NULL; -#endif /* H5FL_TRACK */ - /* Forward declarations of local static functions */ static void *H5FL__malloc(size_t mem_size); static herr_t H5FL__reg_init(H5FL_reg_head_t *head); @@ -187,25 +178,6 @@ H5FL_term_package(void) n += H5FL__arr_term(); n += H5FL__blk_term(); -#ifdef H5FL_TRACK - /* If we haven't freed all the allocated memory, dump out the list now */ - if (n > 0 && H5FL_out_head_g) { - H5FL_track_t *trk = H5FL_out_head_g; - - /* Dump information about all the outstanding allocations */ - while (trk != NULL) { - /* Print information about the outstanding block */ - fprintf(stderr, "%s: Outstanding allocation:\n", __func__); - fprintf(stderr, "\tPtr: %p, File: %s, Function: %s, Line: %d\n", - (((unsigned char *)trk) + sizeof(H5FL_track_t)), trk->file, trk->func, trk->line); - H5CS_print_stack(trk->stack, stderr); - - /* Advance to next node */ - trk = trk->next; - } /* end while */ - } /* end if */ -#endif /* H5FL_TRACK */ - FUNC_LEAVE_NOAPI(n) } /* end H5FL_term_package() */ @@ -279,11 +251,6 @@ H5FL__reg_init(H5FL_reg_head_t *head) if (head->size < sizeof(H5FL_reg_node_t)) head->size = sizeof(H5FL_reg_node_t); - /* Make certain there's room for tracking information, if any */ -#ifdef H5FL_TRACK - head->size += sizeof(H5FL_track_t); -#endif /* H5FL_TRACK */ - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL__reg_init() */ @@ -310,32 +277,6 @@ H5FL_reg_free(H5FL_reg_head_t *head, void *obj) assert(head); assert(obj); -#ifdef H5FL_TRACK - { - H5FL_track_t *trk = obj = ((unsigned char *)obj) - sizeof(H5FL_track_t); - - /* Free tracking information about the allocation location */ - H5CS_close_stack(trk->stack); - /* The 'func' & 'file' strings are statically allocated (by the compiler) - * and are not allocated, so there's no need to free them. - */ - trk->file = NULL; - trk->func = NULL; - - /* Remove from "outstanding allocations" list */ - if (trk == H5FL_out_head_g) { - H5FL_out_head_g = H5FL_out_head_g->next; - if (H5FL_out_head_g) - H5FL_out_head_g->prev = NULL; - } /* end if */ - else { - trk->prev->next = trk->next; - if (trk->next) - trk->next->prev = trk->prev; - } /* end else */ - } -#endif /* H5FL_TRACK */ - #ifdef H5FL_DEBUG memset(obj, 255, head->size); #endif /* H5FL_DEBUG */ @@ -381,7 +322,7 @@ H5FL_reg_free(H5FL_reg_head_t *head, void *obj) *------------------------------------------------------------------------- */ void * -H5FL_reg_malloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS) +H5FL_reg_malloc(H5FL_reg_head_t *head) { void *ret_value = NULL; /* Pointer to object to return */ @@ -418,28 +359,6 @@ H5FL_reg_malloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS) head->allocated++; } /* end else */ -#ifdef H5FL_TRACK - /* Copy allocation location information */ - ((H5FL_track_t *)ret_value)->stack = H5CS_copy_stack(); - assert(((H5FL_track_t *)ret_value)->stack); - /* The 'call_func' & 'call_file' strings are statically allocated (by the compiler) - * there's no need to duplicate them. - */ - ((H5FL_track_t *)ret_value)->file = call_file; - ((H5FL_track_t *)ret_value)->func = call_func; - ((H5FL_track_t *)ret_value)->line = call_line; - - /* Add to "outstanding allocations" list */ - ((H5FL_track_t *)ret_value)->prev = NULL; - ((H5FL_track_t *)ret_value)->next = H5FL_out_head_g; - if (H5FL_out_head_g) - H5FL_out_head_g->prev = (H5FL_track_t *)ret_value; - H5FL_out_head_g = (H5FL_track_t *)ret_value; - - /* Adjust for allocation tracking information */ - ret_value = ((unsigned char *)ret_value) + sizeof(H5FL_track_t); -#endif /* H5FL_TRACK */ - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL_reg_malloc() */ @@ -455,7 +374,7 @@ H5FL_reg_malloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS) *------------------------------------------------------------------------- */ void * -H5FL_reg_calloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS) +H5FL_reg_calloc(H5FL_reg_head_t *head) { void *ret_value = NULL; /* Pointer to object to return */ @@ -465,12 +384,11 @@ H5FL_reg_calloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS) assert(head); /* Allocate the block */ - if (NULL == (ret_value = H5FL_reg_malloc(head H5FL_TRACK_INFO_INT))) + if (NULL == (ret_value = H5FL_reg_malloc(head))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Clear to zeros */ - /* (Accommodate tracking information, if present) */ - memset(ret_value, 0, head->size - H5FL_TRACK_SIZE); + memset(ret_value, 0, head->size); done: FUNC_LEAVE_NOAPI(ret_value) @@ -803,7 +721,7 @@ H5FL_blk_free_block_avail(H5FL_blk_head_t *head, size_t size) *------------------------------------------------------------------------- */ void * -H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS) +H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size) { H5FL_blk_node_t *free_list; /* The free list of nodes of correct size */ H5FL_blk_list_t *temp; /* Temp. ptr to the new native list allocated */ @@ -844,8 +762,7 @@ H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS) assert(free_list); /* Allocate new node, with room for the page info header and the actual page data */ - if (NULL == - (temp = (H5FL_blk_list_t *)H5FL__malloc(sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE + size))) + if (NULL == (temp = (H5FL_blk_list_t *)H5FL__malloc(sizeof(H5FL_blk_list_t) + size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for chunk"); /* Increment the number of blocks of this size */ @@ -861,28 +778,6 @@ H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS) /* Set the return value to the block itself */ ret_value = ((char *)temp) + sizeof(H5FL_blk_list_t); -#ifdef H5FL_TRACK - /* Copy allocation location information */ - ((H5FL_track_t *)ret_value)->stack = H5CS_copy_stack(); - assert(((H5FL_track_t *)ret_value)->stack); - /* The 'call_func' & 'call_file' strings are statically allocated (by the compiler) - * there's no need to duplicate them. - */ - ((H5FL_track_t *)ret_value)->file = call_file; - ((H5FL_track_t *)ret_value)->func = call_func; - ((H5FL_track_t *)ret_value)->line = call_line; - - /* Add to "outstanding allocations" list */ - ((H5FL_track_t *)ret_value)->prev = NULL; - ((H5FL_track_t *)ret_value)->next = H5FL_out_head_g; - if (H5FL_out_head_g) - H5FL_out_head_g->prev = (H5FL_track_t *)ret_value; - H5FL_out_head_g = (H5FL_track_t *)ret_value; - - /* Adjust for allocation tracking information */ - ret_value = ((unsigned char *)ret_value) + sizeof(H5FL_track_t); -#endif /* H5FL_TRACK */ - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL_blk_malloc() */ @@ -902,7 +797,7 @@ H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS) *------------------------------------------------------------------------- */ void * -H5FL_blk_calloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS) +H5FL_blk_calloc(H5FL_blk_head_t *head, size_t size) { void *ret_value = NULL; /* Pointer to the block to return to the user */ @@ -913,7 +808,7 @@ H5FL_blk_calloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS) assert(size); /* Allocate the block */ - if (NULL == (ret_value = H5FL_blk_malloc(head, size H5FL_TRACK_INFO_INT))) + if (NULL == (ret_value = H5FL_blk_malloc(head, size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Clear the block to zeros */ @@ -952,46 +847,14 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block) assert(head); assert(block); -#ifdef H5FL_TRACK - { - unsigned char *block_ptr = ((unsigned char *)block) - sizeof(H5FL_track_t); - H5FL_track_t trk; - - H5MM_memcpy(&trk, block_ptr, sizeof(H5FL_track_t)); - - /* Free tracking information about the allocation location */ - H5CS_close_stack(trk.stack); - /* The 'func' & 'file' strings are statically allocated (by the compiler) - * and are not allocated, so there's no need to free them. - */ - trk.file = NULL; - trk.func = NULL; - - /* Remove from "outstanding allocations" list */ - if ((void *)block_ptr == (void *)H5FL_out_head_g) { - H5FL_out_head_g = H5FL_out_head_g->next; - if (H5FL_out_head_g) - H5FL_out_head_g->prev = NULL; - } /* end if */ - else { - trk.prev->next = trk.next; - if (trk.next) - trk.next->prev = trk.prev; - } /* end else */ - - H5MM_memcpy(block_ptr, &trk, sizeof(H5FL_track_t)); - } -#endif /* H5FL_TRACK */ - /* Get the pointer to the native block info header in front of the native block to free */ - temp = - (H5FL_blk_list_t *)((void *)((unsigned char *)block - (sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE))); + temp = (H5FL_blk_list_t *)((void *)((unsigned char *)block - sizeof(H5FL_blk_list_t))); /* Save the block's size for later */ free_size = temp->size; #ifdef H5FL_DEBUG - memset(temp, 255, free_size + sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE); + memset(temp, 255, free_size + sizeof(H5FL_blk_list_t)); #endif /* H5FL_DEBUG */ /* Check if there is a free list for native blocks of this size */ @@ -1041,7 +904,7 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block) *------------------------------------------------------------------------- */ void * -H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, size_t new_size H5FL_TRACK_PARAMS) +H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, size_t new_size) { void *ret_value = NULL; /* Return value */ @@ -1056,54 +919,24 @@ H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, size_t new_size H5FL_TRACK_ H5FL_blk_list_t *temp; /* Temp. ptr to the new block node allocated */ /* Get the pointer to the chunk info header in front of the chunk to free */ - temp = (H5FL_blk_list_t *)((void *)((unsigned char *)block - - (sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE))); + temp = (H5FL_blk_list_t *)((void *)((unsigned char *)block - sizeof(H5FL_blk_list_t))); /* check if we are actually changing the size of the buffer */ if (new_size != temp->size) { size_t blk_size; /* Temporary block size */ - if ((ret_value = H5FL_blk_malloc(head, new_size H5FL_TRACK_INFO_INT)) == NULL) + if (NULL == (ret_value = H5FL_blk_malloc(head, new_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for block"); blk_size = MIN(new_size, temp->size); H5MM_memcpy(ret_value, block, blk_size); H5FL_blk_free(head, block); } /* end if */ - else { -#ifdef H5FL_TRACK - { - unsigned char *block_ptr = ((unsigned char *)block) - sizeof(H5FL_track_t); - H5FL_track_t trk; - - H5MM_memcpy(&trk, block_ptr, sizeof(H5FL_track_t)); - - /* Release previous tracking information */ - H5CS_close_stack(trk.stack); - /* The 'func' & 'file' strings are statically allocated (by the compiler) - * and are not allocated, so there's no need to free them. - */ - trk.file = NULL; - trk.func = NULL; - - /* Store new tracking information */ - trk.stack = H5CS_copy_stack(); - assert(trk.stack); - /* The 'call_func' & 'call_file' strings are statically allocated (by the compiler) - * there's no need to duplicate them. - */ - trk.file = call_file; - trk.func = call_func; - trk.line = call_line; - - H5MM_memcpy(block_ptr, &trk, sizeof(H5FL_track_t)); - } -#endif /* H5FL_TRACK */ + else ret_value = block; - } /* end if */ - } /* end if */ + } /* end if */ /* Not re-allocating, just allocate a fresh block */ else - ret_value = H5FL_blk_malloc(head, new_size H5FL_TRACK_INFO_INT); + ret_value = H5FL_blk_malloc(head, new_size); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1371,39 +1204,8 @@ H5FL_arr_free(H5FL_arr_head_t *head, void *obj) /* Make certain that the free list is initialized */ assert(head->init); -#ifdef H5FL_TRACK - { - unsigned char *block_ptr = ((unsigned char *)obj) - sizeof(H5FL_track_t); - H5FL_track_t trk; - - H5MM_memcpy(&trk, block_ptr, sizeof(H5FL_track_t)); - - /* Free tracking information about the allocation location */ - H5CS_close_stack(trk.stack); - /* The 'func' & 'file' strings are statically allocated (by the compiler) - * and are not allocated, so there's no need to free them. - */ - trk.file = NULL; - trk.func = NULL; - - /* Remove from "outstanding allocations" list */ - if ((void *)block_ptr == H5FL_out_head_g) { - H5FL_out_head_g = H5FL_out_head_g->next; - if (H5FL_out_head_g) - H5FL_out_head_g->prev = NULL; - } /* end if */ - else { - trk.prev->next = trk.next; - if (trk.next) - trk.next->prev = trk.prev; - } /* end else */ - - H5MM_memcpy(block_ptr, &trk, sizeof(H5FL_track_t)); - } -#endif - /* Get the pointer to the info header in front of the block to free */ - temp = (H5FL_arr_list_t *)((void *)((unsigned char *)obj - (sizeof(H5FL_arr_list_t) + H5FL_TRACK_SIZE))); + temp = (H5FL_arr_list_t *)((void *)((unsigned char *)obj - sizeof(H5FL_arr_list_t))); /* Get the number of elements */ free_nelem = temp->nelem; @@ -1453,7 +1255,7 @@ H5FL_arr_free(H5FL_arr_head_t *head, void *obj) *------------------------------------------------------------------------- */ void * -H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem H5FL_TRACK_PARAMS) +H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem) { H5FL_arr_list_t *new_obj; /* Pointer to the new free list node allocated */ size_t mem_size; /* Size of memory block being recycled */ @@ -1494,8 +1296,7 @@ H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem H5FL_TRACK_PARAMS) } /* end if */ /* Otherwise allocate a node */ else { - if (NULL == - (new_obj = (H5FL_arr_list_t *)H5FL__malloc(sizeof(H5FL_arr_list_t) + H5FL_TRACK_SIZE + mem_size))) + if (NULL == (new_obj = (H5FL_arr_list_t *)H5FL__malloc(sizeof(H5FL_arr_list_t) + mem_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Increment the number of blocks of this size */ @@ -1511,28 +1312,6 @@ H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem H5FL_TRACK_PARAMS) /* Get a pointer to the new block */ ret_value = ((char *)new_obj) + sizeof(H5FL_arr_list_t); -#ifdef H5FL_TRACK - /* Copy allocation location information */ - ((H5FL_track_t *)ret_value)->stack = H5CS_copy_stack(); - assert(((H5FL_track_t *)ret_value)->stack); - /* The 'call_func' & 'call_file' strings are statically allocated (by the compiler) - * there's no need to duplicate them. - */ - ((H5FL_track_t *)ret_value)->file = call_file; - ((H5FL_track_t *)ret_value)->func = call_func; - ((H5FL_track_t *)ret_value)->line = call_line; - - /* Add to "outstanding allocations" list */ - ((H5FL_track_t *)ret_value)->prev = NULL; - ((H5FL_track_t *)ret_value)->next = H5FL_out_head_g; - if (H5FL_out_head_g) - H5FL_out_head_g->prev = (H5FL_track_t *)ret_value; - H5FL_out_head_g = (H5FL_track_t *)ret_value; - - /* Adjust for allocation tracking information */ - ret_value = ((unsigned char *)ret_value) + sizeof(H5FL_track_t); -#endif - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL_arr_malloc() */ @@ -1548,7 +1327,7 @@ H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem H5FL_TRACK_PARAMS) *------------------------------------------------------------------------- */ void * -H5FL_arr_calloc(H5FL_arr_head_t *head, size_t elem H5FL_TRACK_PARAMS) +H5FL_arr_calloc(H5FL_arr_head_t *head, size_t elem) { void *ret_value = NULL; /* Pointer to the block to return */ @@ -1559,7 +1338,7 @@ H5FL_arr_calloc(H5FL_arr_head_t *head, size_t elem H5FL_TRACK_PARAMS) assert(elem); /* Allocate the array */ - if (NULL == (ret_value = H5FL_arr_malloc(head, elem H5FL_TRACK_INFO_INT))) + if (NULL == (ret_value = H5FL_arr_malloc(head, elem))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Clear to zeros */ @@ -1580,7 +1359,7 @@ H5FL_arr_calloc(H5FL_arr_head_t *head, size_t elem H5FL_TRACK_PARAMS) *------------------------------------------------------------------------- */ void * -H5FL_arr_realloc(H5FL_arr_head_t *head, void *obj, size_t new_elem H5FL_TRACK_PARAMS) +H5FL_arr_realloc(H5FL_arr_head_t *head, void *obj, size_t new_elem) { void *ret_value = NULL; /* Pointer to the block to return */ @@ -1592,7 +1371,7 @@ H5FL_arr_realloc(H5FL_arr_head_t *head, void *obj, size_t new_elem H5FL_TRACK_PA /* Check if we are really allocating the object */ if (obj == NULL) - ret_value = H5FL_arr_malloc(head, new_elem H5FL_TRACK_INFO_INT); + ret_value = H5FL_arr_malloc(head, new_elem); else { H5FL_arr_list_t *temp; /* Temp. ptr to the new free list node allocated */ @@ -1600,15 +1379,14 @@ H5FL_arr_realloc(H5FL_arr_head_t *head, void *obj, size_t new_elem H5FL_TRACK_PA assert((int)new_elem <= head->maxelem); /* Get the pointer to the info header in front of the block to free */ - temp = - (H5FL_arr_list_t *)((void *)((unsigned char *)obj - (sizeof(H5FL_arr_list_t) + H5FL_TRACK_SIZE))); + temp = (H5FL_arr_list_t *)((void *)((unsigned char *)obj - sizeof(H5FL_arr_list_t))); /* Check if the size is really changing */ if (temp->nelem != new_elem) { size_t blk_size; /* Size of block */ /* Get the new array of objects */ - ret_value = H5FL_arr_malloc(head, new_elem H5FL_TRACK_INFO_INT); + ret_value = H5FL_arr_malloc(head, new_elem); /* Copy the appropriate amount of elements */ blk_size = head->list_arr[MIN(temp->nelem, new_elem)].size; @@ -1617,35 +1395,8 @@ H5FL_arr_realloc(H5FL_arr_head_t *head, void *obj, size_t new_elem H5FL_TRACK_PA /* Free the old block */ H5FL_arr_free(head, obj); } /* end if */ - else { -#ifdef H5FL_TRACK - unsigned char *block_ptr = ((unsigned char *)obj) - sizeof(H5FL_track_t); - H5FL_track_t trk; - - H5MM_memcpy(&trk, block_ptr, sizeof(H5FL_track_t)); - - /* Release previous tracking information */ - H5CS_close_stack(trk.stack); - /* The 'func' & 'file' strings are statically allocated (by the compiler) - * and are not allocated, so there's no need to free them. - */ - trk.file = NULL; - trk.func = NULL; - - /* Store new tracking information */ - trk.stack = H5CS_copy_stack(); - assert(trk.stack); - /* The 'call_func' & 'call_file' strings are statically allocated (by the compiler) - * there's no need to duplicate them. - */ - trk.file = call_file; - trk.func = call_func; - trk.line = call_line; - - H5MM_memcpy(block_ptr, &trk, sizeof(H5FL_track_t)); -#endif + else ret_value = obj; - } } /* end else */ FUNC_LEAVE_NOAPI(ret_value) @@ -1851,7 +1602,7 @@ H5FL_seq_free(H5FL_seq_head_t *head, void *obj) *------------------------------------------------------------------------- */ void * -H5FL_seq_malloc(H5FL_seq_head_t *head, size_t elem H5FL_TRACK_PARAMS) +H5FL_seq_malloc(H5FL_seq_head_t *head, size_t elem) { void *ret_value = NULL; /* Pointer to the block to return */ @@ -1862,7 +1613,7 @@ H5FL_seq_malloc(H5FL_seq_head_t *head, size_t elem H5FL_TRACK_PARAMS) assert(elem); /* Use block routine */ - ret_value = H5FL_blk_malloc(&(head->queue), head->size * elem H5FL_TRACK_INFO_INT); + ret_value = H5FL_blk_malloc(&(head->queue), head->size * elem); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL_seq_malloc() */ @@ -1878,7 +1629,7 @@ H5FL_seq_malloc(H5FL_seq_head_t *head, size_t elem H5FL_TRACK_PARAMS) *------------------------------------------------------------------------- */ void * -H5FL_seq_calloc(H5FL_seq_head_t *head, size_t elem H5FL_TRACK_PARAMS) +H5FL_seq_calloc(H5FL_seq_head_t *head, size_t elem) { void *ret_value = NULL; /* Pointer to the block to return */ @@ -1889,7 +1640,7 @@ H5FL_seq_calloc(H5FL_seq_head_t *head, size_t elem H5FL_TRACK_PARAMS) assert(elem); /* Use block routine */ - ret_value = H5FL_blk_calloc(&(head->queue), head->size * elem H5FL_TRACK_INFO_INT); + ret_value = H5FL_blk_calloc(&(head->queue), head->size * elem); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL_seq_calloc() */ @@ -1905,7 +1656,7 @@ H5FL_seq_calloc(H5FL_seq_head_t *head, size_t elem H5FL_TRACK_PARAMS) *------------------------------------------------------------------------- */ void * -H5FL_seq_realloc(H5FL_seq_head_t *head, void *obj, size_t new_elem H5FL_TRACK_PARAMS) +H5FL_seq_realloc(H5FL_seq_head_t *head, void *obj, size_t new_elem) { void *ret_value = NULL; /* Pointer to the block to return */ @@ -1916,7 +1667,7 @@ H5FL_seq_realloc(H5FL_seq_head_t *head, void *obj, size_t new_elem H5FL_TRACK_PA assert(new_elem); /* Use block routine */ - ret_value = H5FL_blk_realloc(&(head->queue), obj, head->size * new_elem H5FL_TRACK_INFO_INT); + ret_value = H5FL_blk_realloc(&(head->queue), obj, head->size * new_elem); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL_seq_realloc() */ @@ -1968,11 +1719,6 @@ H5FL_fac_init(size_t size) if (factory->size < sizeof(H5FL_fac_node_t)) factory->size = sizeof(H5FL_fac_node_t); - /* Make certain there's room for tracking information, if any */ -#ifdef H5FL_TRACK - factory->size += sizeof(H5FL_track_t); -#endif /* H5FL_TRACK */ - /* Indicate that the free list is initialized */ factory->init = true; @@ -2011,32 +1757,6 @@ H5FL_fac_free(H5FL_fac_head_t *head, void *obj) assert(head); assert(obj); -#ifdef H5FL_TRACK - { - H5FL_track_t *trk = obj = ((unsigned char *)obj) - sizeof(H5FL_track_t); - - /* Free tracking information about the allocation location */ - H5CS_close_stack(trk->stack); - /* The 'func' & 'file' strings are statically allocated (by the compiler) - * and are not allocated, so there's no need to free them. - */ - trk->file = NULL; - trk->func = NULL; - - /* Remove from "outstanding allocations" list */ - if (trk == H5FL_out_head_g) { - H5FL_out_head_g = H5FL_out_head_g->next; - if (H5FL_out_head_g) - H5FL_out_head_g->prev = NULL; - } /* end if */ - else { - trk->prev->next = trk->next; - if (trk->next) - trk->next->prev = trk->prev; - } /* end else */ - } -#endif /* H5FL_TRACK */ - #ifdef H5FL_DEBUG memset(obj, 255, head->size); #endif /* H5FL_DEBUG */ @@ -2082,7 +1802,7 @@ H5FL_fac_free(H5FL_fac_head_t *head, void *obj) *------------------------------------------------------------------------- */ void * -H5FL_fac_malloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS) +H5FL_fac_malloc(H5FL_fac_head_t *head) { void *ret_value = NULL; /* Pointer to the block to return */ @@ -2116,28 +1836,6 @@ H5FL_fac_malloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS) head->allocated++; } /* end else */ -#ifdef H5FL_TRACK - /* Copy allocation location information */ - ((H5FL_track_t *)ret_value)->stack = H5CS_copy_stack(); - assert(((H5FL_track_t *)ret_value)->stack); - /* The 'call_func' & 'call_file' strings are statically allocated (by the compiler) - * there's no need to duplicate them. - */ - ((H5FL_track_t *)ret_value)->file = call_file; - ((H5FL_track_t *)ret_value)->func = call_func; - ((H5FL_track_t *)ret_value)->line = call_line; - - /* Add to "outstanding allocations" list */ - ((H5FL_track_t *)ret_value)->prev = NULL; - ((H5FL_track_t *)ret_value)->next = H5FL_out_head_g; - if (H5FL_out_head_g) - H5FL_out_head_g->prev = (H5FL_track_t *)ret_value; - H5FL_out_head_g = (H5FL_track_t *)ret_value; - - /* Adjust for allocation tracking information */ - ret_value = ((unsigned char *)ret_value) + sizeof(H5FL_track_t); -#endif /* H5FL_TRACK */ - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL_fac_malloc() */ @@ -2153,7 +1851,7 @@ H5FL_fac_malloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS) *------------------------------------------------------------------------- */ void * -H5FL_fac_calloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS) +H5FL_fac_calloc(H5FL_fac_head_t *head) { void *ret_value = NULL; /* Pointer to the block to return */ @@ -2164,12 +1862,11 @@ H5FL_fac_calloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS) assert(head); /* Allocate the block */ - if (NULL == (ret_value = H5FL_fac_malloc(head H5FL_TRACK_INFO_INT))) + if (NULL == (ret_value = H5FL_fac_malloc(head))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Clear to zeros */ - /* (Accommodate tracking information, if present) */ - memset(ret_value, 0, head->size - H5FL_TRACK_SIZE); + memset(ret_value, 0, head->size); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5FLprivate.h b/src/H5FLprivate.h index 348cfda542d..823e0fda61e 100644 --- a/src/H5FLprivate.h +++ b/src/H5FLprivate.h @@ -35,52 +35,6 @@ #define H5_NO_FAC_FREE_LISTS #endif /* H5_NO_FREE_LISTS */ -/* Macro to track location where block was allocated from */ -/* Uncomment next line to turn on tracking, but don't leave it on after - * debugging is done because of the extra overhead it imposes. - */ -/* NOTE: This hasn't been extended to all the free-list allocation routines - * yet. -QAK - */ -/* #define H5FL_TRACK */ -#ifdef H5FL_TRACK - -#ifndef H5_HAVE_CODESTACK -#error "Free list tracking requires code stack to be enabled" -#endif - -/* Macro for inclusion in the free list allocation calls */ -#define H5FL_TRACK_INFO , __FILE__, __func__, __LINE__ - -/* Macro for inclusion in internal free list allocation calls */ -#define H5FL_TRACK_INFO_INT , call_file, call_func, call_line - -/* Macro for inclusion in the free list allocation parameters */ -#define H5FL_TRACK_PARAMS , const char *call_file, const char *call_func, int call_line - -/* Forward declarations for structure fields */ -struct H5CS_t; - -/* Tracking information for each block */ -typedef struct H5FL_track_t { - struct H5CS_t *stack; /* Function stack */ - char *file; /* Name of file containing calling function */ - char *func; /* Name of calling function */ - int line; /* Line # within calling function */ - struct H5FL_track_t *next; /* Pointer to next tracking block */ - struct H5FL_track_t *prev; /* Pointer to previous tracking block */ -} H5FL_track_t; - -/* Macro for size of tracking information */ -#define H5FL_TRACK_SIZE sizeof(H5FL_track_t) - -#else /* H5FL_TRACK */ -#define H5FL_TRACK_INFO -#define H5FL_TRACK_INFO_INT -#define H5FL_TRACK_PARAMS -#define H5FL_TRACK_SIZE 0 -#endif /* H5FL_TRACK */ - /* * Private datatypes. */ @@ -118,10 +72,10 @@ typedef struct H5FL_reg_head_t { #define H5FL_DEFINE_STATIC(t) static H5FL_DEFINE_COMMON(t) /* Allocate an object of type 't' */ -#define H5FL_MALLOC(t) (t *)H5FL_reg_malloc(&(H5FL_REG_NAME(t))H5FL_TRACK_INFO) +#define H5FL_MALLOC(t) (t *)H5FL_reg_malloc(&(H5FL_REG_NAME(t))) /* Allocate an object of type 't' and clear it to all zeros */ -#define H5FL_CALLOC(t) (t *)H5FL_reg_calloc(&(H5FL_REG_NAME(t))H5FL_TRACK_INFO) +#define H5FL_CALLOC(t) (t *)H5FL_reg_calloc(&(H5FL_REG_NAME(t))) /* Free an object of type 't' */ #define H5FL_FREE(t, obj) (t *)H5FL_reg_free(&(H5FL_REG_NAME(t)), obj) @@ -189,17 +143,16 @@ typedef struct H5FL_blk_head_t { #define H5FL_BLK_DEFINE_STATIC(t) static H5FL_BLK_DEFINE_COMMON(t) /* Allocate a block of type 't' */ -#define H5FL_BLK_MALLOC(t, size) (uint8_t *)H5FL_blk_malloc(&(H5FL_BLK_NAME(t)), size H5FL_TRACK_INFO) +#define H5FL_BLK_MALLOC(t, size) (uint8_t *)H5FL_blk_malloc(&(H5FL_BLK_NAME(t)), (size)) /* Allocate a block of type 't' and clear it to zeros */ -#define H5FL_BLK_CALLOC(t, size) (uint8_t *)H5FL_blk_calloc(&(H5FL_BLK_NAME(t)), size H5FL_TRACK_INFO) +#define H5FL_BLK_CALLOC(t, size) (uint8_t *)H5FL_blk_calloc(&(H5FL_BLK_NAME(t)), (size)) /* Free a block of type 't' */ #define H5FL_BLK_FREE(t, blk) (uint8_t *)H5FL_blk_free(&(H5FL_BLK_NAME(t)), blk) /* Re-allocate a block of type 't' */ -#define H5FL_BLK_REALLOC(t, blk, new_size) \ - (uint8_t *)H5FL_blk_realloc(&(H5FL_BLK_NAME(t)), blk, new_size H5FL_TRACK_INFO) +#define H5FL_BLK_REALLOC(t, blk, new_size) (uint8_t *)H5FL_blk_realloc(&(H5FL_BLK_NAME(t)), (blk), (new_size)) /* Check if there is a free block available to reuse */ #define H5FL_BLK_AVAIL(t, size) H5FL_blk_free_block_avail(&(H5FL_BLK_NAME(t)), size) @@ -272,17 +225,16 @@ typedef struct H5FL_arr_head_t { #define H5FL_BARR_DEFINE_STATIC(b, t, m) static H5FL_ARR_DEFINE_COMMON(sizeof(b), t, m) /* Allocate an array of type 't' */ -#define H5FL_ARR_MALLOC(t, elem) H5FL_arr_malloc(&(H5FL_ARR_NAME(t)), elem H5FL_TRACK_INFO) +#define H5FL_ARR_MALLOC(t, elem) H5FL_arr_malloc(&(H5FL_ARR_NAME(t)), (elem)) /* Allocate an array of type 't' and clear it to all zeros */ -#define H5FL_ARR_CALLOC(t, elem) H5FL_arr_calloc(&(H5FL_ARR_NAME(t)), elem H5FL_TRACK_INFO) +#define H5FL_ARR_CALLOC(t, elem) H5FL_arr_calloc(&(H5FL_ARR_NAME(t)), (elem)) /* Free an array of type 't' */ #define H5FL_ARR_FREE(t, obj) (t *)H5FL_arr_free(&(H5FL_ARR_NAME(t)), obj) /* Re-allocate an array of type 't' */ -#define H5FL_ARR_REALLOC(t, obj, new_elem) \ - H5FL_arr_realloc(&(H5FL_ARR_NAME(t)), obj, new_elem H5FL_TRACK_INFO) +#define H5FL_ARR_REALLOC(t, obj, new_elem) H5FL_arr_realloc(&(H5FL_ARR_NAME(t)), obj, (new_elem)) #else /* H5_NO_ARR_FREE_LISTS */ /* Common macro for H5FL_ARR_DEFINE & H5FL_ARR_DEFINE_STATIC (and H5FL_BARR variants) */ @@ -327,17 +279,16 @@ typedef struct H5FL_seq_head_t { #define H5FL_SEQ_DEFINE_STATIC(t) static H5FL_SEQ_DEFINE_COMMON(t) /* Allocate a sequence of type 't' */ -#define H5FL_SEQ_MALLOC(t, elem) (t *)H5FL_seq_malloc(&(H5FL_SEQ_NAME(t)), elem H5FL_TRACK_INFO) +#define H5FL_SEQ_MALLOC(t, elem) (t *)H5FL_seq_malloc(&(H5FL_SEQ_NAME(t)), (elem)) /* Allocate a sequence of type 't' and clear it to all zeros */ -#define H5FL_SEQ_CALLOC(t, elem) (t *)H5FL_seq_calloc(&(H5FL_SEQ_NAME(t)), elem H5FL_TRACK_INFO) +#define H5FL_SEQ_CALLOC(t, elem) (t *)H5FL_seq_calloc(&(H5FL_SEQ_NAME(t)), (elem)) /* Free a sequence of type 't' */ #define H5FL_SEQ_FREE(t, obj) (t *)H5FL_seq_free(&(H5FL_SEQ_NAME(t)), obj) /* Re-allocate a sequence of type 't' */ -#define H5FL_SEQ_REALLOC(t, obj, new_elem) \ - (t *)H5FL_seq_realloc(&(H5FL_SEQ_NAME(t)), obj, new_elem H5FL_TRACK_INFO) +#define H5FL_SEQ_REALLOC(t, obj, new_elem) (t *)H5FL_seq_realloc(&(H5FL_SEQ_NAME(t)), obj, (new_elem)) #else /* H5_NO_SEQ_FREE_LISTS */ /* Common macro for H5FL_SEQ_DEFINE & H5FL_SEQ_DEFINE_STATIC */ @@ -375,10 +326,10 @@ typedef struct H5FL_fac_head_t { */ #ifndef H5_NO_FAC_FREE_LISTS /* Allocate a block from a factory */ -#define H5FL_FAC_MALLOC(f) H5FL_fac_malloc(f H5FL_TRACK_INFO) +#define H5FL_FAC_MALLOC(f) H5FL_fac_malloc(f) /* Allocate a block from a factory and clear it to all zeros */ -#define H5FL_FAC_CALLOC(f) H5FL_fac_calloc(f H5FL_TRACK_INFO) +#define H5FL_FAC_CALLOC(f) H5FL_fac_calloc(f) /* Return a block to a factory */ #define H5FL_FAC_FREE(f, obj) H5FL_fac_free(f, obj) @@ -393,33 +344,33 @@ typedef struct H5FL_fac_head_t { * Library prototypes. */ /* Block free lists */ -H5_DLL void *H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS) H5_ATTR_MALLOC; -H5_DLL void *H5FL_blk_calloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS) H5_ATTR_MALLOC; +H5_DLL void *H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size) H5_ATTR_MALLOC; +H5_DLL void *H5FL_blk_calloc(H5FL_blk_head_t *head, size_t size) H5_ATTR_MALLOC; H5_DLL void *H5FL_blk_free(H5FL_blk_head_t *head, void *block); -H5_DLL void *H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, size_t new_size H5FL_TRACK_PARAMS); +H5_DLL void *H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, size_t new_size); H5_DLL htri_t H5FL_blk_free_block_avail(H5FL_blk_head_t *head, size_t size); /* Regular free lists */ -H5_DLL void *H5FL_reg_malloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS) H5_ATTR_MALLOC; -H5_DLL void *H5FL_reg_calloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS) H5_ATTR_MALLOC; +H5_DLL void *H5FL_reg_malloc(H5FL_reg_head_t *head) H5_ATTR_MALLOC; +H5_DLL void *H5FL_reg_calloc(H5FL_reg_head_t *head) H5_ATTR_MALLOC; H5_DLL void *H5FL_reg_free(H5FL_reg_head_t *head, void *obj); /* Array free lists */ -H5_DLL void *H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem H5FL_TRACK_PARAMS) H5_ATTR_MALLOC; -H5_DLL void *H5FL_arr_calloc(H5FL_arr_head_t *head, size_t elem H5FL_TRACK_PARAMS) H5_ATTR_MALLOC; +H5_DLL void *H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem) H5_ATTR_MALLOC; +H5_DLL void *H5FL_arr_calloc(H5FL_arr_head_t *head, size_t elem) H5_ATTR_MALLOC; H5_DLL void *H5FL_arr_free(H5FL_arr_head_t *head, void *obj); -H5_DLL void *H5FL_arr_realloc(H5FL_arr_head_t *head, void *obj, size_t new_elem H5FL_TRACK_PARAMS); +H5_DLL void *H5FL_arr_realloc(H5FL_arr_head_t *head, void *obj, size_t new_elem); /* Sequence free lists */ -H5_DLL void *H5FL_seq_malloc(H5FL_seq_head_t *head, size_t elem H5FL_TRACK_PARAMS) H5_ATTR_MALLOC; -H5_DLL void *H5FL_seq_calloc(H5FL_seq_head_t *head, size_t elem H5FL_TRACK_PARAMS) H5_ATTR_MALLOC; +H5_DLL void *H5FL_seq_malloc(H5FL_seq_head_t *head, size_t elem) H5_ATTR_MALLOC; +H5_DLL void *H5FL_seq_calloc(H5FL_seq_head_t *head, size_t elem) H5_ATTR_MALLOC; H5_DLL void *H5FL_seq_free(H5FL_seq_head_t *head, void *obj); -H5_DLL void *H5FL_seq_realloc(H5FL_seq_head_t *head, void *obj, size_t new_elem H5FL_TRACK_PARAMS); +H5_DLL void *H5FL_seq_realloc(H5FL_seq_head_t *head, void *obj, size_t new_elem); /* Factory free lists */ H5_DLL H5FL_fac_head_t *H5FL_fac_init(size_t size); -H5_DLL void *H5FL_fac_malloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS) H5_ATTR_MALLOC; -H5_DLL void *H5FL_fac_calloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS) H5_ATTR_MALLOC; +H5_DLL void *H5FL_fac_malloc(H5FL_fac_head_t *head) H5_ATTR_MALLOC; +H5_DLL void *H5FL_fac_calloc(H5FL_fac_head_t *head) H5_ATTR_MALLOC; H5_DLL void *H5FL_fac_free(H5FL_fac_head_t *head, void *obj); H5_DLL herr_t H5FL_fac_term(H5FL_fac_head_t *head); diff --git a/src/H5build_settings.autotools.c.in b/src/H5build_settings.autotools.c.in index edde377b43a..614fd1199b7 100644 --- a/src/H5build_settings.autotools.c.in +++ b/src/H5build_settings.autotools.c.in @@ -109,7 +109,6 @@ const char H5build_settings[]= " Packages w/ extra debug output: @INTERNAL_DEBUG_OUTPUT@\n" " API tracing: @TRACE_API@\n" " Using memory checker: @USINGMEMCHECKER@\n" - " Function stack tracing: @CODESTACK@\n" " Use file locking: @DESIRED_FILE_LOCKING@\n" " Strict file format checks: @STRICT_FORMAT_CHECKS@\n" " Optimization instrumentation: @INSTRUMENT_LIBRARY@\n" diff --git a/src/H5build_settings.cmake.c.in b/src/H5build_settings.cmake.c.in index c1139b465e6..8889ebf8d6f 100644 --- a/src/H5build_settings.cmake.c.in +++ b/src/H5build_settings.cmake.c.in @@ -108,7 +108,6 @@ const char H5build_settings[]= " Packages w/ extra debug output: @INTERNAL_DEBUG_OUTPUT@\n" " API tracing: @HDF5_ENABLE_TRACE@\n" " Using memory checker: @HDF5_ENABLE_USING_MEMCHECKER@\n" - " Function stack tracing: @HDF5_ENABLE_CODESTACK@\n" " Use file locking: @HDF5_FILE_LOCKING_SETTING@\n" " Strict file format checks: @HDF5_STRICT_FORMAT_CHECKS@\n" " Optimization instrumentation: @HDF5_Enable_Instrument@\n" diff --git a/src/H5private.h b/src/H5private.h index 148ac884072..8e7b7a60c23 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1197,18 +1197,6 @@ extern bool H5_libterm_g; /* Is the library being shutdown? */ #endif /* H5_HAVE_THREADSAFE */ -#ifdef H5_HAVE_CODESTACK - -/* Include required function stack header */ -#include "H5CSprivate.h" - -#define H5_PUSH_FUNC H5CS_push(__func__); -#define H5_POP_FUNC H5CS_pop(); -#else /* H5_HAVE_CODESTACK */ -#define H5_PUSH_FUNC /* void */ -#define H5_POP_FUNC /* void */ -#endif /* H5_HAVE_CODESTACK */ - /* Forward declaration of H5CXpush() / H5CXpop() */ /* (Including H5CXprivate.h creates bad circular dependencies - QAK, 3/18/2018) */ H5_DLL herr_t H5CX_push(void); @@ -1261,9 +1249,6 @@ H5_DLL herr_t H5CX_pop(bool update_dxpl_props); } #define FUNC_ENTER_API_PUSH(err) \ - /* Push the name of this function on the function stack */ \ - H5_PUSH_FUNC \ - \ /* Push the API context */ \ if (H5_UNLIKELY(H5CX_push() < 0)) \ HGOTO_ERROR(H5E_FUNC, H5E_CANTSET, err, "can't set API context"); \ @@ -1309,7 +1294,6 @@ H5_DLL herr_t H5CX_pop(bool update_dxpl_props); { \ { \ FUNC_ENTER_API_COMMON \ - H5_PUSH_FUNC \ { /* @@ -1366,14 +1350,12 @@ H5_DLL herr_t H5CX_pop(bool update_dxpl_props); #define FUNC_ENTER_NOAPI(err) \ { \ FUNC_ENTER_COMMON(!H5_IS_API(__func__)); \ - H5_PUSH_FUNC \ { /* Use this macro for all non-API functions, which propagate errors, but don't issue them */ #define FUNC_ENTER_NOAPI_NOERR \ { \ FUNC_ENTER_COMMON_NOERR(!H5_IS_API(__func__)); \ - H5_PUSH_FUNC \ { /* @@ -1387,7 +1369,6 @@ H5_DLL herr_t H5CX_pop(bool update_dxpl_props); #define FUNC_ENTER_NOAPI_NOINIT \ { \ FUNC_ENTER_COMMON(!H5_IS_API(__func__)); \ - H5_PUSH_FUNC \ { /* @@ -1400,32 +1381,6 @@ H5_DLL herr_t H5CX_pop(bool update_dxpl_props); * - functions that propagate, but don't issue errors */ #define FUNC_ENTER_NOAPI_NOINIT_NOERR \ - { \ - FUNC_ENTER_COMMON_NOERR(!H5_IS_API(__func__)); \ - H5_PUSH_FUNC \ - { - -/* - * Use this macro for non-API functions which fall into these categories: - * - functions which shouldn't push their name on the function stack - * (so far, just the H5CS routines themselves) - * - */ -#define FUNC_ENTER_NOAPI_NOFS \ - { \ - FUNC_ENTER_COMMON(!H5_IS_API(__func__)); \ - { - -/* - * Use this macro for non-API functions which fall into these categories: - * - functions which shouldn't push their name on the function stack - * (so far, just the H5CS routines themselves) - * - * This macro is used for functions which fit the above categories _and_ - * also don't use the 'FUNC' variable (i.e. don't push errors on the error stack) - * - */ -#define FUNC_ENTER_NOAPI_NOERR_NOFS \ { \ FUNC_ENTER_COMMON_NOERR(!H5_IS_API(__func__)); \ { @@ -1450,7 +1405,6 @@ H5_DLL herr_t H5CX_pop(bool update_dxpl_props); \ FUNC_ENTER_COMMON(!H5_IS_API(__func__)); \ H5AC_tag(tag, &prev_tag); \ - H5_PUSH_FUNC \ { #define FUNC_ENTER_NOAPI_NOINIT_TAG(tag) \ @@ -1459,21 +1413,18 @@ H5_DLL herr_t H5CX_pop(bool update_dxpl_props); \ FUNC_ENTER_COMMON(!H5_IS_API(__func__)); \ H5AC_tag(tag, &prev_tag); \ - H5_PUSH_FUNC \ { /* Use this macro for all "normal" package-level functions */ #define FUNC_ENTER_PACKAGE \ { \ FUNC_ENTER_COMMON(H5_IS_PKG(__func__)); \ - H5_PUSH_FUNC \ { /* Use this macro for package-level functions which propagate errors, but don't issue them */ #define FUNC_ENTER_PACKAGE_NOERR \ { \ FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(__func__)); \ - H5_PUSH_FUNC \ { /* Use the following macro as replacement for the FUNC_ENTER_PACKAGE @@ -1484,7 +1435,6 @@ H5_DLL herr_t H5CX_pop(bool update_dxpl_props); \ FUNC_ENTER_COMMON(H5_IS_PKG(__func__)); \ H5AC_tag(tag, &prev_tag); \ - H5_PUSH_FUNC \ { /* Use this macro for staticly-scoped functions which propagate errors, but don't issue them */ @@ -1522,7 +1472,6 @@ H5_DLL herr_t H5CX_pop(bool update_dxpl_props); (void)H5CX_pop(true); \ api_ctx_pushed = false; \ } \ - H5_POP_FUNC \ if (H5_UNLIKELY(err_occurred)) \ (void)H5E_dump_api_stack(); \ FUNC_LEAVE_API_THREADSAFE \ @@ -1534,7 +1483,6 @@ H5_DLL herr_t H5CX_pop(bool update_dxpl_props); #define FUNC_LEAVE_API_NOINIT(ret_value) \ ; \ } /*end scope from end of FUNC_ENTER*/ \ - H5_POP_FUNC \ if (H5_UNLIKELY(err_occurred)) \ (void)H5E_dump_api_stack(); \ FUNC_LEAVE_API_THREADSAFE \ @@ -1583,28 +1531,15 @@ H5_DLL herr_t H5CX_pop(bool update_dxpl_props); #define FUNC_LEAVE_NOAPI(ret_value) \ ; \ } /*end scope from end of FUNC_ENTER*/ \ - H5_POP_FUNC \ return (ret_value); \ } /*end scope from beginning of FUNC_ENTER*/ #define FUNC_LEAVE_NOAPI_VOID \ ; \ } /*end scope from end of FUNC_ENTER*/ \ - H5_POP_FUNC \ return; \ } /*end scope from beginning of FUNC_ENTER*/ -/* - * Use this macro for non-API functions which fall into these categories: - * - functions which didn't push their name on the function stack - * (so far, just the H5CS routines themselves) - */ -#define FUNC_LEAVE_NOAPI_NOFS(ret_value) \ - ; \ - } /*end scope from end of FUNC_ENTER*/ \ - return (ret_value); \ - } /*end scope from beginning of FUNC_ENTER*/ - /* Use these macros to match the FUNC_ENTER_NOAPI_NAMECHECK_ONLY macro */ #define FUNC_LEAVE_NOAPI_NAMECHECK_ONLY(ret_value) \ return (ret_value); \ @@ -1618,7 +1553,6 @@ H5_DLL herr_t H5CX_pop(bool update_dxpl_props); ; \ } /*end scope from end of FUNC_ENTER*/ \ H5AC_tag(prev_tag, NULL); \ - H5_POP_FUNC \ return (ret_value); \ } /*end scope from beginning of FUNC_ENTER*/ diff --git a/src/Makefile.am b/src/Makefile.am index 5e081a38275..29706101001 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -38,7 +38,6 @@ libhdf5_la_SOURCES= H5.c H5build_settings.c H5checksum.c H5dbg.c H5system.c \ H5C.c H5Cdbg.c H5Centry.c H5Cepoch.c H5Cimage.c H5Cint.c \ H5Clog.c H5Clog_json.c H5Clog_trace.c \ H5Cprefetched.c H5Cquery.c H5Ctag.c H5Ctest.c \ - H5CS.c \ H5CX.c \ H5D.c H5Dbtree.c H5Dbtree2.c H5Dchunk.c H5Dcompact.c H5Dcontig.c \ H5Ddbg.c H5Ddeprec.c H5Dearray.c H5Defl.c H5Dfarray.c H5Dfill.c \ diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in index 87219969bf3..3854d72e411 100644 --- a/src/libhdf5.settings.in +++ b/src/libhdf5.settings.in @@ -90,7 +90,6 @@ Dimension scales w/ new references: @DIMENSION_SCALES_WITH_NEW_REF@ Packages w/ extra debug output: @INTERNAL_DEBUG_OUTPUT@ API tracing: @TRACE_API@ Using memory checker: @USINGMEMCHECKER@ - Function stack tracing: @CODESTACK@ Use file locking: @DESIRED_FILE_LOCKING@ Strict file format checks: @STRICT_FORMAT_CHECKS@ Optimization instrumentation: @INSTRUMENT_LIBRARY@ From e4f079e27b21e437e4af9851f983165516d1a875 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 3 May 2024 05:31:38 -0500 Subject: [PATCH 7/7] Clean up memory leaks in t_vfd (#4457) --- testpar/t_vfd.c | 87 +++++++++++++++++++++++++++---------------------- 1 file changed, 48 insertions(+), 39 deletions(-) diff --git a/testpar/t_vfd.c b/testpar/t_vfd.c index 93fa4992b55..3b924784ee3 100644 --- a/testpar/t_vfd.c +++ b/testpar/t_vfd.c @@ -4216,22 +4216,21 @@ static unsigned vector_write_test_8(int file_name_id, int mpi_rank, int mpi_size, H5FD_mpio_xfer_t xfer_mode, H5FD_mpio_collective_opt_t coll_opt_mode, const char *vfd_name) { - const char *fcn_name = "vector_write_test_8()"; - char test_title[120]; - char filename[512]; - haddr_t eoa; - haddr_t base_addr; - bool show_progress = false; - hid_t fapl_id = H5I_INVALID_HID; /* file access property list ID */ - hid_t dxpl_id = H5I_INVALID_HID; /* data access property list ID */ - H5FD_t *lf = NULL; /* VFD struct ptr */ - int cp = 0; - int i; - int base_index; - uint32_t count = 0; - size_t sizes[4]; - H5FD_mem_t types[2]; - + const char *fcn_name = "vector_write_test_8()"; + char test_title[120]; + char filename[512]; + haddr_t eoa; + haddr_t base_addr; + bool show_progress = false; + hid_t fapl_id = H5I_INVALID_HID; /* file access property list ID */ + hid_t dxpl_id = H5I_INVALID_HID; /* data access property list ID */ + H5FD_t *lf = NULL; /* VFD struct ptr */ + int cp = 0; + int i; + int base_index; + uint32_t count = 0; + size_t sizes[4]; + H5FD_mem_t types[2]; haddr_t *tt_addrs = NULL; /* For storing addrs */ const void **tt_bufs = NULL; /* For storing buf pointers */ @@ -4629,6 +4628,9 @@ test_vector_io(int mpi_rank, int mpi_size) H5FD_SUBFILING_NAME); #endif + /* discard the file image buffers */ + free_file_images(); + nerrors += (int)nerrs; /* return(nerrs);*/ @@ -5955,15 +5957,14 @@ test_selection_io_types_1d(int mpi_rank, int mpi_size, H5FD_t *lf, hid_t dxpl, H static void test_selection_io_real(int mpi_rank, int mpi_size, H5FD_t *lf, hid_t dxpl) { - hid_t mem_spaces[2] = {H5I_INVALID_HID, H5I_INVALID_HID}; /* memory dataspaces vector */ - hid_t file_spaces[2] = {H5I_INVALID_HID, H5I_INVALID_HID}; /* file dataspaces vector */ - hsize_t dims1[1]; /* 1d dimension sizes */ - hsize_t dims2[2]; /* 2d dimension sizes */ - - H5FD_mem_t type; /* File type */ - haddr_t addrs[2]; /* File allocation address */ - size_t element_sizes[2] = {sizeof(int), sizeof(int)}; /* Element size */ - size_t bufsize; /* Buffer size */ + hid_t mem_spaces[2] = {H5I_INVALID_HID, H5I_INVALID_HID}; /* memory dataspaces vector */ + hid_t file_spaces[2] = {H5I_INVALID_HID, H5I_INVALID_HID}; /* file dataspaces vector */ + hsize_t dims1[1]; /* 1d dimension sizes */ + hsize_t dims2[2]; /* 2d dimension sizes */ + H5FD_mem_t type; /* File type */ + haddr_t addrs[2]; /* File allocation address */ + size_t element_sizes[2] = {sizeof(int), sizeof(int)}; /* Element size */ + size_t bufsize; /* Buffer size */ int i; int j; @@ -6059,18 +6060,30 @@ test_selection_io_real(int mpi_rank, int mpi_size, H5FD_t *lf, hid_t dxpl) } /* Free the buffers */ - if (wbuf1) + if (wbuf1) { free(wbuf1); - if (wbuf2) + wbuf1 = NULL; + } + if (wbuf2) { free(wbuf2); - if (fbuf1) + wbuf2 = NULL; + } + if (fbuf1) { free(fbuf1); - if (fbuf2) + fbuf1 = NULL; + } + if (fbuf2) { free(fbuf2); - if (erbuf1) + fbuf2 = NULL; + } + if (erbuf1) { free(erbuf1); - if (erbuf2) + erbuf1 = NULL; + } + if (erbuf2) { free(erbuf2); + erbuf2 = NULL; + } CHECK_PASSED(); @@ -6085,11 +6098,10 @@ test_selection_io_real(int mpi_rank, int mpi_size, H5FD_t *lf, hid_t dxpl) static void test_selection_io(int mpi_rank, int mpi_size) { - H5FD_t *lf = NULL; /* VFD struct ptr */ - hid_t fapl = H5I_INVALID_HID; /* File access property list */ - char filename[1024]; /* Test file name */ - unsigned flags = 0; /* File access flags */ - + H5FD_t *lf = NULL; /* VFD struct ptr */ + hid_t fapl = H5I_INVALID_HID; /* File access property list */ + char filename[1024]; /* Test file name */ + unsigned flags = 0; /* File access flags */ unsigned collective; /* Types of I/O for testing */ hid_t dxpl = H5I_INVALID_HID; /* Dataset transfer property list */ hid_t def_dxpl = H5I_INVALID_HID; /* dxpl: independent access */ @@ -6309,9 +6321,6 @@ main(int argc, char **argv) printf("===================================\n"); } - /* discard the file image buffers */ - free_file_images(); - /* close HDF5 library */ H5close();