diff --git a/.github/workflows/cmake-analysis.yml b/.github/workflows/cmake-analysis.yml new file mode 100644 index 00000000000..58eb6ce584f --- /dev/null +++ b/.github/workflows/cmake-analysis.yml @@ -0,0 +1,419 @@ +name: hdf5 dev ctest analysis runs + +# Triggers the workflow on a call from another workflow +on: + workflow_call: + inputs: + snap_name: + description: 'The name in the source tarballs' + type: string + required: false + default: hdfsrc + file_base: + description: "The common base name of the source tarballs" + required: true + type: string + use_environ: + description: 'Environment to locate files' + type: string + required: true + default: snapshots + +permissions: + contents: read + +jobs: + coverage_test_linux_GCC: + # Linux (Ubuntu) w/ gcc + coverage + # + name: "Ubuntu GCC Coverage" + runs-on: ubuntu-latest + steps: + - name: Install CMake Dependencies (Linux_coverage) + run: | + sudo apt update + sudo apt-get install ninja-build doxygen graphviz curl libncurses5 build-essential + sudo apt install libssl3 libssl-dev libcurl4 libcurl4-openssl-dev + sudo apt-get install lcov -q -y + + - name: Set file base name (Linux_coverage) + id: set-file-base + run: | + FILE_NAME_BASE=$(echo "${{ inputs.file_base }}") + echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT + if [[ '${{ inputs.use_environ }}' == 'release' ]] + then + SOURCE_NAME_BASE=$(echo "${{ inputs.snap_name }}") + else + SOURCE_NAME_BASE=$(echo "hdfsrc") + fi + echo "SOURCE_BASE=$SOURCE_NAME_BASE" >> $GITHUB_OUTPUT + + # Get files created by release script + - name: Get tgz-tarball (Linux_coverage) + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + name: tgz-tarball + path: ${{ github.workspace }} + + - name: List files for the space (Linux_coverage) + run: | + ls -l ${{ github.workspace }} + ls ${{ runner.workspace }} + + - name: Uncompress source (Linux_coverage) + run: tar -zxvf ${{ github.workspace }}/${{ steps.set-file-base.outputs.FILE_BASE }}.tar.gz + + - name: Copy script files for the space (Linux_coverage) + run: | + cp ${{ github.workspace }}/${{ steps.set-file-base.outputs.SOURCE_BASE }}/config/cmake/scripts/CTestScript.cmake ${{ runner.workspace }}/hdf5 + cp ${{ github.workspace }}/${{ steps.set-file-base.outputs.SOURCE_BASE }}/config/cmake/scripts/HDF5config.cmake ${{ runner.workspace }}/hdf5 + + - name: List files for the hdf5 (Linux_coverage) + run: | + ls ${{ runner.workspace }}/hdf5 + + - name: Create options file (Linux_coverage) + uses: "DamianReeves/write-file-action@master" + with: + path: ${{ runner.workspace }}/hdf5/HDF5options.cmake + write-mode: overwrite + contents: | + set (CTEST_DROP_SITE_INIT "my.cdash.org") + # Change following line to submit to your CDash dashboard to a different CDash project + set (SITE_BUILDNAME_SUFFIX "${{ steps.set-file-base.outputs.FILE_BASE }}") + #set (CTEST_DROP_LOCATION_INIT "/submit.php?project=HDF5") + set (LOCAL_COVERAGE_TEST "TRUE") + set (LOCAL_USE_GCOV "TRUE") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} --log-level=VERBOSE") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_STATIC_LIBS:BOOL=ON") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=ON") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=ON") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_COVERAGE:BOOL=ON") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCODE_COVERAGE:BOOL=ON") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=ON") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=ON") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PLUGIN_SUPPORT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLIBAEC_USE_LOCALCONTENT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_USE_LOCALCONTENT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACK_EXAMPLES:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACKAGE_EXTLIBS:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_NO_PACKAGES:BOOL=ON") + + - name: Run ctest (Linux_coverage) + run: | + cd "${{ runner.workspace }}/hdf5" + ctest -S HDF5config.cmake,CTEST_SITE_EXT=GH_COV,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Debug -VV -O hdf5.log + shell: bash + continue-on-error: true + + # Save log files created by ctest script + - name: Save log (Linux_coverage) + uses: actions/upload-artifact@v4 + with: + name: clang-coverage-log + path: ${{ runner.workspace }}/hdf5/hdf5.log + if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` + + build_and_test_linux_LeakSanitizer: + # Linux (Ubuntu) w/ clang + LeakSanitizer + # + name: "Ubuntu Clang LeakSanitizer" + runs-on: ubuntu-latest + steps: + - name: Install CMake Dependencies (Linux_Leak) + run: | + sudo apt update + sudo apt-get install ninja-build doxygen graphviz curl libncurses5 + + - name: add clang to env + uses: KyleMayes/install-llvm-action@v2.0.5 + id: setup-clang + with: + env: true + version: '18' + + - name: Set file base name (Linux_Leak) + id: set-file-base + run: | + FILE_NAME_BASE=$(echo "${{ inputs.file_base }}") + echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT + if [[ '${{ inputs.use_environ }}' == 'release' ]] + then + SOURCE_NAME_BASE=$(echo "${{ inputs.snap_name }}") + else + SOURCE_NAME_BASE=$(echo "hdfsrc") + fi + echo "SOURCE_BASE=$SOURCE_NAME_BASE" >> $GITHUB_OUTPUT + + # Get files created by release script + - name: Get tgz-tarball (Linux_Leak) + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + name: tgz-tarball + path: ${{ github.workspace }} + + - name: List files for the space (Linux_Leak) + run: | + ls -l ${{ github.workspace }} + ls ${{ runner.workspace }} + + - name: Uncompress source (Linux_Leak) + run: tar -zxvf ${{ github.workspace }}/${{ steps.set-file-base.outputs.FILE_BASE }}.tar.gz + + - name: Copy script files for the space (Linux_Leak) + run: | + cp ${{ github.workspace }}/${{ steps.set-file-base.outputs.SOURCE_BASE }}/config/cmake/scripts/CTestScript.cmake ${{ runner.workspace }}/hdf5 + cp ${{ github.workspace }}/${{ steps.set-file-base.outputs.SOURCE_BASE }}/config/cmake/scripts/HDF5config.cmake ${{ runner.workspace }}/hdf5 + + - name: List files for the hdf5 (Linux_Leak) + run: | + ls ${{ runner.workspace }}/hdf5 + + - name: Create options file (Linux_Leak) + uses: "DamianReeves/write-file-action@master" + with: + path: ${{ runner.workspace }}/hdf5/HDF5options.cmake + write-mode: overwrite + contents: | + set (CTEST_DROP_SITE_INIT "my.cdash.org") + # Change following line to submit to your CDash dashboard to a different CDash project + set (SITE_BUILDNAME_SUFFIX "${{ steps.set-file-base.outputs.FILE_BASE }}") + #set (CTEST_DROP_LOCATION_INIT "/submit.php?project=HDF5") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} --log-level=VERBOSE") + set (MODEL "Sanitize") + set (GROUP "Sanitize") + set (LOCAL_MEMCHECK_TEST "TRUE") + set (CTEST_MEMORYCHECK_TYPE "LeakSanitizer") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} --log-level=VERBOSE") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=ON") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_STATIC_LIBS:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=ON") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SANITIZERS:BOOL=ON") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DUSE_SANITIZER:STRING=Leak") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PLUGIN_SUPPORT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLIBAEC_USE_LOCALCONTENT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_USE_LOCALCONTENT:BOOL=OFF") + + - name: Run ctest (Linux_Leak) + run: | + cd "${{ runner.workspace }}/hdf5" + ctest -S HDF5config.cmake,CTEST_SITE_EXT=GH-LEAK,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Debug -VV -O hdf5.log + shell: bash + continue-on-error: true + + # Save log files created by ctest script + - name: Save log (Linux_Leak) + uses: actions/upload-artifact@v4 + with: + name: leak-ubuntu-log + path: ${{ runner.workspace }}/hdf5/hdf5.log + if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` + + build_and_test_linux_AddressSanitizer: + # Linux (Ubuntu) w/ clang + AddressSanitizer + # + name: "Ubuntu Clang AddressSanitizer" + runs-on: ubuntu-latest + steps: + - name: Install CMake Dependencies (Linux_Address) + run: | + sudo apt update + sudo apt-get install ninja-build doxygen graphviz curl libncurses5 + + - name: add clang to env + uses: KyleMayes/install-llvm-action@v2.0.5 + id: setup-clang + with: + env: true + version: '18' + + - name: Set file base name (Linux_Address) + id: set-file-base + run: | + FILE_NAME_BASE=$(echo "${{ inputs.file_base }}") + echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT + if [[ '${{ inputs.use_environ }}' == 'release' ]] + then + SOURCE_NAME_BASE=$(echo "${{ inputs.snap_name }}") + else + SOURCE_NAME_BASE=$(echo "hdfsrc") + fi + echo "SOURCE_BASE=$SOURCE_NAME_BASE" >> $GITHUB_OUTPUT + + # Get files created by release script + - name: Get tgz-tarball (Linux_Address) + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + name: tgz-tarball + path: ${{ github.workspace }} + + - name: List files for the space (Linux_Address) + run: | + ls -l ${{ github.workspace }} + ls ${{ runner.workspace }} + + - name: Uncompress source (Linux_Address) + run: tar -zxvf ${{ github.workspace }}/${{ steps.set-file-base.outputs.FILE_BASE }}.tar.gz + + - name: Copy script files for the space (Linux_Address) + run: | + cp ${{ github.workspace }}/${{ steps.set-file-base.outputs.SOURCE_BASE }}/config/cmake/scripts/CTestScript.cmake ${{ runner.workspace }}/hdf5 + cp ${{ github.workspace }}/${{ steps.set-file-base.outputs.SOURCE_BASE }}/config/cmake/scripts/HDF5config.cmake ${{ runner.workspace }}/hdf5 + + - name: List files for the hdf5 (Linux_Address) + run: | + ls ${{ runner.workspace }}/hdf5 + + - name: Create options file (Linux_Address) + uses: "DamianReeves/write-file-action@master" + with: + path: ${{ runner.workspace }}/hdf5/HDF5options.cmake + write-mode: overwrite + contents: | + set (CTEST_DROP_SITE_INIT "my.cdash.org") + # Change following line to submit to your CDash dashboard to a different CDash project + set (SITE_BUILDNAME_SUFFIX "${{ steps.set-file-base.outputs.FILE_BASE }}") + #set (CTEST_DROP_LOCATION_INIT "/submit.php?project=HDF5") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} --log-level=VERBOSE") + set (MODEL "Sanitize") + set (GROUP "Sanitize") + set (LOCAL_MEMCHECK_TEST "TRUE") + set (CTEST_MEMORYCHECK_TYPE "AddressSanitizer") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} --log-level=VERBOSE") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=ON") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_STATIC_LIBS:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=ON") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SANITIZERS:BOOL=ON") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DUSE_SANITIZER:STRING=Address") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PLUGIN_SUPPORT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLIBAEC_USE_LOCALCONTENT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_USE_LOCALCONTENT:BOOL=OFF") + + - name: Run ctest (Linux_Address) + run: | + cd "${{ runner.workspace }}/hdf5" + ctest -S HDF5config.cmake,CTEST_SITE_EXT=GH-ADDR,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Debug -VV -O hdf5.log + shell: bash + continue-on-error: true + + # Save log files created by ctest script + - name: Save log (Linux_Address) + uses: actions/upload-artifact@v4 + with: + name: address-ubuntu-log + path: ${{ runner.workspace }}/hdf5/hdf5.log + if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` + + build_and_test_linux_UndefinedBehaviorSanitizer: + # Linux (Ubuntu) w/ clang + UndefinedBehaviorSanitizer + # + name: "Ubuntu Clang UndefinedBehaviorSanitizer" + runs-on: ubuntu-latest + steps: + - name: Install CMake Dependencies (Linux_UndefinedBehavior) + run: | + sudo apt update + sudo apt-get install ninja-build doxygen graphviz curl libncurses5 + + - name: add clang to env + uses: KyleMayes/install-llvm-action@v2.0.5 + id: setup-clang + with: + env: true + version: '18' + + - name: Set file base name (Linux_UndefinedBehavior) + id: set-file-base + run: | + FILE_NAME_BASE=$(echo "${{ inputs.file_base }}") + echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT + if [[ '${{ inputs.use_environ }}' == 'release' ]] + then + SOURCE_NAME_BASE=$(echo "${{ inputs.snap_name }}") + else + SOURCE_NAME_BASE=$(echo "hdfsrc") + fi + echo "SOURCE_BASE=$SOURCE_NAME_BASE" >> $GITHUB_OUTPUT + + # Get files created by release script + - name: Get tgz-tarball (Linux_UndefinedBehavior) + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + name: tgz-tarball + path: ${{ github.workspace }} + + - name: List files for the space (Linux_UndefinedBehavior) + run: | + ls -l ${{ github.workspace }} + ls ${{ runner.workspace }} + + - name: Uncompress source (Linux_UndefinedBehavior) + run: tar -zxvf ${{ github.workspace }}/${{ steps.set-file-base.outputs.FILE_BASE }}.tar.gz + + - name: Copy script files for the space (Linux_UndefinedBehavior) + run: | + cp ${{ github.workspace }}/${{ steps.set-file-base.outputs.SOURCE_BASE }}/config/cmake/scripts/CTestScript.cmake ${{ runner.workspace }}/hdf5 + cp ${{ github.workspace }}/${{ steps.set-file-base.outputs.SOURCE_BASE }}/config/cmake/scripts/HDF5config.cmake ${{ runner.workspace }}/hdf5 + + - name: List files for the hdf5 (Linux_UndefinedBehavior) + run: | + ls ${{ runner.workspace }}/hdf5 + + - name: Create options file (Linux_UndefinedBehavior) + uses: "DamianReeves/write-file-action@master" + with: + path: ${{ runner.workspace }}/hdf5/HDF5options.cmake + write-mode: overwrite + contents: | + set (CTEST_DROP_SITE_INIT "my.cdash.org") + # Change following line to submit to your CDash dashboard to a different CDash project + set (SITE_BUILDNAME_SUFFIX "${{ steps.set-file-base.outputs.FILE_BASE }}") + #set (CTEST_DROP_LOCATION_INIT "/submit.php?project=HDF5") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} --log-level=VERBOSE") + set (MODEL "Sanitize") + set (GROUP "Sanitize") + set (LOCAL_MEMCHECK_TEST "TRUE") + set (CTEST_MEMORYCHECK_TYPE "UndefinedBehaviorSanitizer") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} --log-level=VERBOSE") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=ON") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_STATIC_LIBS:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=ON") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SANITIZERS:BOOL=ON") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DUSE_SANITIZER:STRING=Undefined") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PLUGIN_SUPPORT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLIBAEC_USE_LOCALCONTENT:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_USE_LOCALCONTENT:BOOL=OFF") + + - name: Run ctest (Linux_UndefinedBehavior) + run: | + cd "${{ runner.workspace }}/hdf5" + ctest -S HDF5config.cmake,CTEST_SITE_EXT=GH-UNDEF,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Debug -VV -O hdf5.log + shell: bash + continue-on-error: true + + # Save log files created by ctest script + - name: Save log (Linux_UndefinedBehavior) + uses: actions/upload-artifact@v4 + with: + name: undefined-ubuntu-log + path: ${{ runner.workspace }}/hdf5/hdf5.log + if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` diff --git a/.github/workflows/cmake-script.yml b/.github/workflows/cmake-script.yml index 35541279595..f30504f10da 100644 --- a/.github/workflows/cmake-script.yml +++ b/.github/workflows/cmake-script.yml @@ -490,9 +490,7 @@ jobs: env: FC: ${{ steps.setup-fortran.outputs.fc }} CC: ${{ steps.setup-fortran.outputs.cc }} - CXX: ${{ steps.setup-fortran.outputs.cxx }} - BINSIGN: ${{ needs.check-secret.outputs.sign-state }} - SIGNTOOLDIR: ${{ github.workspace }}/Microsoft.Windows.SDK.BuildTools/bin/10.0.22621.0/x64 + CXX: ${{ steps.setup-fortran.outputs.cc }} run: | cd "${{ runner.workspace }}/hdf5" ctest -S HDF5config.cmake,CTEST_SITE_EXT=GH-Intel,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=VS202264,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Release -VV -O hdf5.log @@ -603,110 +601,6 @@ jobs: if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` ####### clang builds - build_and_test_win_clang: - # Windows w/ clang + CMake - # - name: "Windows ClangCL CTest" - runs-on: windows-latest - steps: - - name: Install Dependencies (Windows_clang) - run: choco install ninja - - - name: add clang to env - uses: KyleMayes/install-llvm-action@v2.0.5 - id: setup-clang - with: - env: true - version: '18' - - - name: Set file base name (Windows_clang) - id: set-file-base - run: | - FILE_NAME_BASE=$(echo "${{ inputs.file_base }}") - echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT - if [[ '${{ inputs.use_environ }}' == 'release' ]] - then - SOURCE_NAME_BASE=$(echo "${{ inputs.snap_name }}") - else - SOURCE_NAME_BASE=$(echo "hdfsrc") - fi - echo "SOURCE_BASE=$SOURCE_NAME_BASE" >> $GITHUB_OUTPUT - shell: bash - - # Get files created by release script - - name: Get zip-tarball (Windows_clang) - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: zip-tarball - path: ${{ github.workspace }} - - - name: using powershell - shell: pwsh - run: Get-Location - - - name: List files for the space (Windows_clang) - run: | - Get-ChildItem -Path ${{ github.workspace }} - Get-ChildItem -Path ${{ runner.workspace }} - shell: pwsh - - - name: Uncompress source (Windows_clang) - working-directory: ${{ github.workspace }} - run: 7z x ${{ steps.set-file-base.outputs.FILE_BASE }}.zip - shell: bash - - - name: Copy script files for the space (Windows_clang) - run: | - Copy-Item -Path ${{ runner.workspace }}/hdf5/${{ steps.set-file-base.outputs.SOURCE_BASE }}/config/cmake/scripts/CTestScript.cmake -Destination ${{ runner.workspace }}/hdf5/ - Copy-Item -Path ${{ runner.workspace }}/hdf5/${{ steps.set-file-base.outputs.SOURCE_BASE }}/config/cmake/scripts/HDF5config.cmake -Destination ${{ runner.workspace }}/hdf5/ - shell: pwsh - - - name: List files for the hdf5 (Windows_clang) - run: | - Get-ChildItem -Path ${{ runner.workspace }}/hdf5 - shell: pwsh - - - name: Create options file (Windows_clang) - uses: "DamianReeves/write-file-action@master" - with: - path: ${{ runner.workspace }}/hdf5/HDF5options.cmake - write-mode: overwrite - contents: | - set (CTEST_DROP_SITE_INIT "my.cdash.org") - # Change following line to submit to your CDash dashboard to a different CDash project - #set (CTEST_DROP_LOCATION_INIT "/submit.php?project=HDF5") - set (SITE_BUILDNAME_SUFFIX "${{ steps.set-file-base.outputs.FILE_BASE }}") - #set (CMAKE_GENERATOR_TOOLSET "ClangCL") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} --log-level=VERBOSE") - #set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/clang.cmake") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=ON") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=ON") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=ON") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=ON") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PLUGIN_SUPPORT:BOOL=ON") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLIBAEC_USE_LOCALCONTENT:BOOL=OFF") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_USE_LOCALCONTENT:BOOL=OFF") - - - name: Run ctest (Windows_clang) with clang - env: - BINSIGN: ${{ needs.check-secret.outputs.sign-state }} - SIGNTOOLDIR: ${{ github.workspace }}/Microsoft.Windows.SDK.BuildTools/bin/10.0.22621.0/x64 - run: | - cd "${{ runner.workspace }}/hdf5" - ctest -S HDF5config.cmake,CTEST_SITE_EXT=GH-Clang,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=VS202264,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Release -VV -O hdf5.log - shell: pwsh - continue-on-error: true - - # Save log files created by ctest script - - name: Save log (Windows_clang) - uses: actions/upload-artifact@v4 - with: - name: clang-win-log - path: ${{ runner.workspace }}/hdf5/hdf5.log - if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` - build_and_test_linux_clang: # Linux (Ubuntu) w/ clang + CMake # diff --git a/.github/workflows/daily-build.yml b/.github/workflows/daily-build.yml index ef98e353ab2..65150c5f3ec 100644 --- a/.github/workflows/daily-build.yml +++ b/.github/workflows/daily-build.yml @@ -1,6 +1,7 @@ name: hdf5 dev daily build -# Triggers the workflow on a schedule or on demand +# Triggers the workflow on demand or on a call from another workflow +# NOTE: inputs must be duplicated between triggers on: workflow_dispatch: inputs: @@ -9,8 +10,13 @@ on: type: string required: false default: check - schedule: - - cron: "6 0 * * *" + workflow_call: + inputs: + use_ignore: + description: 'Ignore has_changes check' + type: string + required: false + default: check permissions: contents: read @@ -61,6 +67,14 @@ jobs: use_environ: snapshots if: ${{ ((needs.call-workflow-tarball.outputs.has_changes == 'true') || (needs.get-old-names.outputs.run-ignore == 'ignore')) }} + call-workflow-sanitizers: + needs: [get-old-names, call-workflow-tarball] + uses: ./.github/workflows/cmake-analysis.yml + with: + file_base: ${{ needs.call-workflow-tarball.outputs.file_base }} + use_environ: snapshots + if: ${{ ((needs.call-workflow-tarball.outputs.has_changes == 'true') || (needs.get-old-names.outputs.run-ignore == 'ignore')) }} + call-workflow-ctest: needs: [get-old-names, call-workflow-tarball] uses: ./.github/workflows/cmake-ctest.yml diff --git a/.github/workflows/daily-schedule.yml b/.github/workflows/daily-schedule.yml new file mode 100644 index 00000000000..83486c97696 --- /dev/null +++ b/.github/workflows/daily-schedule.yml @@ -0,0 +1,16 @@ +name: hdf5 dev daily build on schedule + +# Triggers the workflow on a schedule or on demand +on: + workflow_dispatch: + schedule: + - cron: "6 0 * * *" + +permissions: + contents: write # In order to allow tag creation and file deletion + +jobs: + daily-build: + uses: ./.github/workflows/daily-build.yml + with: + use_ignore: check diff --git a/.github/workflows/main-cmake.yml b/.github/workflows/main-cmake.yml index 9c58f0ba8e2..3c953409740 100644 --- a/.github/workflows/main-cmake.yml +++ b/.github/workflows/main-cmake.yml @@ -270,11 +270,3 @@ jobs: path: ${{ runner.workspace }}/build/HDF5-*-Darwin.tar.gz if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` if: ${{ (matrix.os == 'macos-latest') && (inputs.thread_safety != 'TS') }} - - - name: Save published dmg binary (Mac_latest) - uses: actions/upload-artifact@v4 - with: - name: tgz-macos14_clang-${{ inputs.build_mode }}-dmg-binary - path: ${{ runner.workspace }}/build/HDF5-*-Darwin.dmg - if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` - if: ${{ (matrix.os == 'macos-latest') && (inputs.thread_safety != 'TS') }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e41b30c4d37..5f750a08f7e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -55,7 +55,7 @@ jobs: needs: [log-the-inputs, call-workflow-tarball, call-workflow-ctest] uses: ./.github/workflows/abi-report.yml with: - file_ref: '1.14.4.3' + file_ref: '1.14.5' file_base: ${{ needs.call-workflow-tarball.outputs.file_base }} use_tag: ${{ needs.log-the-inputs.outputs.rel_tag }} use_environ: release diff --git a/CMakeLists.txt b/CMakeLists.txt index 2dc3af4a8ef..5522dc35aad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -600,8 +600,10 @@ option (HDF5_ENABLE_COVERAGE "Enable code coverage for Libraries and Programs" O if (HDF5_ENABLE_COVERAGE) include (${HDF5_SOURCE_DIR}/config/sanitizer/code-coverage.cmake) if(CODE_COVERAGE AND CODE_COVERAGE_ADDED) + message(VERBOSE "Add instrumentation to all targets") add_code_coverage () # Adds instrumentation to all targets else () + message(VERBOSE "Use --coverage option") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 --coverage -fprofile-arcs -ftest-coverage") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g --coverage -O0 -fprofile-arcs -ftest-coverage") if (CMAKE_C_COMPILER_ID STREQUAL "GNU") diff --git a/README.md b/README.md index 37c45ad022d..e5c4d917305 100644 --- a/README.md +++ b/README.md @@ -90,12 +90,10 @@ are tentative. | Release | New Features | | ------- | ------------ | -| 1.14.5 | oss-fuzz fixes, ros3 VFD improvements | -| 1.14.6 | Last maintenance release of 1.14 | -| 1.16.0 | Complex number support, updated library defaults (cache sizes, etc.) | -| 2.0.0 | Multi-threaded HDF5, crashproofing / metadata journaling, Full (VFD) SWMR, encryption, digital signatures, sparse datasets, improved storage for variable-length datatypes, better Unicode support (especially on Windows), semantic versioning | +| 2.0.0 | Drop Autotools support, complex number support, updated library defaults (cache sizes, etc.), semantic versioning | +| FUTURE | Multi-threaded HDF5, crashproofing / metadata journaling, Full (VFD) SWMR, encryption, digital signatures, sparse datasets, improved storage for variable-length datatypes, better Unicode support (especially on Windows) | -Some HDF5 2.0.0 features listed here may be released in a 1.16.x release. +NOTE: In the March 2025 release we will begin using semantic versioning (https://semver.org/) and the previously announced 1.16.0 version will instead be numbered 2.0.0. This list of feature release versions is also tentative, and the specific release in which a feature is introduced may change. diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index bd7d96422e8..7f3406a60b8 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -759,7 +759,7 @@ test_libver_bounds() /* Run the tests */ test_libver_bounds_real(H5F_LIBVER_EARLIEST, H5O_VERSION_1, H5F_LIBVER_LATEST, H5O_VERSION_2); - test_libver_bounds_real(H5F_LIBVER_LATEST, H5O_VERSION_2, H5F_LIBVER_EARLIEST, H5O_VERSION_2); + test_libver_bounds_real(H5F_LIBVER_LATEST, H5O_VERSION_2, H5F_LIBVER_EARLIEST, H5O_VERSION_1); PASSED(); } /* end test_libver_bounds() */ diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 6db82bb9229..c13334c5f8c 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -67,6 +67,8 @@ if (WIN32 AND NOT MINGW) set (${HDF_PREFIX}_HAVE_VISUAL_STUDIO 1) endif () endif () + message (TRACE "MSVC=${MSVC}") + message (TRACE "HAVE_VISUAL_STUDIO=${${HDF_PREFIX}_HAVE_VISUAL_STUDIO}") endif () if (WINDOWS) @@ -79,13 +81,12 @@ if (WINDOWS) endif () if (NOT UNIX AND NOT CYGWIN) set (${HDF_PREFIX}_HAVE_GETCONSOLESCREENBUFFERINFO 1) - if (MSVC_VERSION GREATER_EQUAL 1900) - set (${HDF_PREFIX}_HAVE_TIMEZONE 1) - endif () + set (${HDF_PREFIX}_HAVE_TIMEZONE 1) set (${HDF_PREFIX}_HAVE_GETTIMEOFDAY 1) set (${HDF_PREFIX}_HAVE_LIBWS2_32 1) set (${HDF_PREFIX}_HAVE_LIBWSOCK32 1) endif () + message (TRACE "HAVE_TIMEZONE=${${HDF_PREFIX}_HAVE_TIMEZONE}") endif () # ---------------------------------------------------------------------- diff --git a/config/sanitizer/code-coverage.cmake b/config/sanitizer/code-coverage.cmake index 54a33deda3f..5249ed05af1 100644 --- a/config/sanitizer/code-coverage.cmake +++ b/config/sanitizer/code-coverage.cmake @@ -81,9 +81,13 @@ option( # Programs find_program(LLVM_COV_PATH llvm-cov) +message(VERBOSE "program llvm-cov=${LLVM_COV_PATH}") find_program(LLVM_PROFDATA_PATH llvm-profdata) +message(VERBOSE "program llvm-profdata=${LLVM_PROFDATA_PATH}") find_program(LCOV_PATH lcov) +message(VERBOSE "program lcov=${LCOV_PATH}") find_program(GENHTML_PATH genhtml) +message(VERBOSE "program genhtml=${GENHTML_PATH}") # Hide behind the 'advanced' mode flag for GUI/ccmake mark_as_advanced(FORCE LLVM_COV_PATH LLVM_PROFDATA_PATH LCOV_PATH GENHTML_PATH) diff --git a/config/toolchain/intel.cmake b/config/toolchain/intel.cmake index f8f60b28b46..f5b227ba2a0 100644 --- a/config/toolchain/intel.cmake +++ b/config/toolchain/intel.cmake @@ -4,7 +4,11 @@ set(CMAKE_COMPILER_VENDOR "intel") set(CMAKE_C_COMPILER icx) -set(CMAKE_CXX_COMPILER icpx) +if(WIN32) + set(CMAKE_CXX_COMPILER icx) +else() + set(CMAKE_CXX_COMPILER icpx) +endif() set(CMAKE_Fortran_COMPILER ifx) # the following is used if cross-compiling diff --git a/doc/img/release-schedule.plantuml b/doc/img/release-schedule.plantuml index d0fd79b1426..c7e45c18b4c 100644 --- a/doc/img/release-schedule.plantuml +++ b/doc/img/release-schedule.plantuml @@ -23,26 +23,24 @@ Project starts 2023-01-01 [1.12.3] happens 2023-11-30 [1.12] is colored in #88CCEE -[1.14] starts at 2023-01-01 and lasts 118 weeks +[1.14] starts at 2023-01-01 and lasts 92 weeks [1.14.1] happens at 2023-04-30 [1.14.2] happens at 2023-08-31 [1.14.3] happens at 2023-10-31 [1.14.4.2] happens at 2024-04-15 [1.14.4.3] happens at 2024-05-22 [1.14.5] happens at 2024-09-30 -[1.14.6] happens at 2025-03-31 [1.14.1] displays on same row as [1.14.1] [1.14.2] displays on same row as [1.14.1] [1.14.3] displays on same row as [1.14.1] [1.14.4.2] displays on same row as [1.14.1] [1.14.5] displays on same row as [1.14.1] -[1.14.6] displays on same row as [1.14.1] [1.14] is colored in #B187CF -[1.16] starts at 2025-03-31 and lasts 35 weeks -[1.16.0] happens at 2025-03-31 -[1.16.1] happens at 2025-09-30 -[1.16.1] displays on same row as [1.16.0] -[1.16] is colored in #02BFA0 +[2.0] starts at 2024-09-30 and lasts 53 weeks +[2.0.0] happens at 2025-03-31 +[2.1.0] happens at 2025-09-30 +[2.1.0] displays on same row as [2.0.0] +[2.0] is colored in #02BFA0 @endgantt diff --git a/doc/img/release-schedule.png b/doc/img/release-schedule.png index 20a0a55986d..ec65bfa595d 100644 Binary files a/doc/img/release-schedule.png and b/doc/img/release-schedule.png differ diff --git a/fortran/src/H5Rff.F90 b/fortran/src/H5Rff.F90 index cad9d3c8a0e..75933e28fb4 100644 --- a/fortran/src/H5Rff.F90 +++ b/fortran/src/H5Rff.F90 @@ -856,13 +856,13 @@ INTEGER(C_INT) FUNCTION H5Requal(ref1_ptr, ref2_ptr) & END FUNCTION H5Requal END INTERFACE - c_equal = INT(H5Requal(ref1_ptr, ref2_ptr)) + c_equal = INT(H5Requal(ref1_ptr, ref2_ptr), C_INT) hdferr = 0 equal = .FALSE. - IF(c_equal .EQ. 1)THEN + IF(c_equal .EQ. 1_C_INT)THEN equal = .TRUE. - ELSE IF(c_equal .LT. 0)THEN + ELSE IF(c_equal .LT. 0_C_INT)THEN hdferr = -1 ENDIF diff --git a/fortran/src/H5VLff.F90 b/fortran/src/H5VLff.F90 index b07e1389f21..e1629328ce2 100644 --- a/fortran/src/H5VLff.F90 +++ b/fortran/src/H5VLff.F90 @@ -419,7 +419,8 @@ SUBROUTINE H5VLcmp_connector_cls_f(are_same, conn_id1, conn_id2, hdferr) INTEGER(HID_T), INTENT(IN) :: conn_id1 INTEGER(HID_T), INTENT(IN) :: conn_id2 INTEGER, INTENT(OUT) :: hdferr - INTEGER :: are_same_c + + INTEGER(C_INT) :: are_same_c INTERFACE INTEGER(C_INT) FUNCTION H5VLcmp_connector_cls(cmp_value, conn_id1, conn_id2) BIND(C, NAME='H5VLcmp_connector_cls') @@ -432,7 +433,7 @@ END FUNCTION H5VLcmp_connector_cls are_same = .FALSE. hdferr = INT(H5VLcmp_connector_cls(are_same_c, conn_id1, conn_id2)) - IF(are_same_c .EQ. 0) are_same = .TRUE. + IF(are_same_c .EQ. 0_C_INT) are_same = .TRUE. END SUBROUTINE H5VLcmp_connector_cls_f diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 36de830a71c..cf9b65cc086 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -132,7 +132,19 @@ Bug Fixes since HDF5-1.16.0 release =================================== Library ------- - - + - Only clear FE_INVALID when that symbol is present on the system + + When we initialize the floating-point types at library startup, it's + possible to raise floating-point exceptions when we check which things + are supported. Normally, we clear these floating-point exceptions via + feclearexcept(FE_INVALID), but FE_INVALID may not be present on all + systems. Specifically, this was reported as being a problem when using + Emscripten 3.1.68 to compile HDF5 1.14.5 to WebAssembly. + + We've added an #ifdef FE_INVALID block around the exception clearing + code to correct this. + + Fixes GitHub issue #4952 Java Library diff --git a/src/H5Fint.c b/src/H5Fint.c index add4bcfc043..9fc0499ad9a 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -3213,7 +3213,8 @@ H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high) assert(f->shared); /* Set the bounds only if the existing setting is different from the inputs */ - if (f->shared->low_bound != low || f->shared->high_bound != high) { + if ((f->shared->low_bound != low || f->shared->high_bound != high) && + !(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE)) { /* Call the flush routine, for this file */ /* Note: This is done in case the binary format for representing a * metadata entry class changes when the file format low / high @@ -3736,6 +3737,7 @@ H5F_get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info) * --only allow datasets and groups without attributes * --disallow named datatype with/without attributes * --disallow opened attributes attached to objects + * --disallow opened objects below 1.10 * * NOTE: Currently, only opened groups and datasets are allowed * when enabling SWMR via H5Fstart_swmr_write(). @@ -3778,7 +3780,7 @@ H5F__start_swmr_write(H5F_t *f) if (f->shared->sblock->super_vers < HDF5_SUPERBLOCK_VERSION_3) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "file superblock version - should be at least 3"); - /* Check for correct file format version */ + /* Check for correct file format version to start SWMR writing */ if ((f->shared->low_bound < H5F_LIBVER_V110) || (f->shared->high_bound < H5F_LIBVER_V110)) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "file format version does not support SWMR - needs to be 1.10 or greater"); @@ -3815,6 +3817,31 @@ H5F__start_swmr_write(H5F_t *f) /* Allocate space for group and object locations */ if ((obj_ids = (hid_t *)H5MM_malloc(grp_dset_count * sizeof(hid_t))) == NULL) HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "can't allocate buffer for hid_t"); + + /* Get the list of opened object ids (groups & datasets) */ + if (H5F_get_obj_ids(f, H5F_OBJ_GROUP | H5F_OBJ_DATASET, grp_dset_count, obj_ids, false, + &grp_dset_count) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "H5F_get_obj_ids failed"); + + /* Ensure that there's no old-style opened objects */ + for (u = 0; u < grp_dset_count; u++) { + H5O_native_info_t ninfo; + H5O_loc_t *oloc; + uint8_t version; + + if (NULL == (oloc = H5O_get_loc(obj_ids[u]))) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "H5O_get_loc() failed"); + + if (H5O_get_native_info(oloc, &ninfo, H5O_NATIVE_INFO_HDR) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "H5O_get_native_info() failed"); + + if (H5O_get_version_bound(f->shared->low_bound, &version) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "H5O_get_version_bound() failed"); + + if (ninfo.hdr.version < version) + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "disallow opened objects below 1.10"); + } + if ((obj_glocs = (H5G_loc_t *)H5MM_malloc(grp_dset_count * sizeof(H5G_loc_t))) == NULL) HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "can't allocate buffer for object group locations"); if ((obj_olocs = (H5O_loc_t *)H5MM_malloc(grp_dset_count * sizeof(H5O_loc_t))) == NULL) @@ -3829,11 +3856,6 @@ H5F__start_swmr_write(H5F_t *f) HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "can't allocate buffer for hid_t"); assert(obj_apl_ids[0] == H5P_DEFAULT); - /* Get the list of opened object ids (groups & datasets) */ - if (H5F_get_obj_ids(f, H5F_OBJ_GROUP | H5F_OBJ_DATASET, grp_dset_count, obj_ids, false, - &grp_dset_count) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "H5F_get_obj_ids failed"); - /* Save the VOL connector and the object wrapping context for the refresh step */ if (grp_dset_count > 0) { H5VL_object_t *vol_obj; diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 39c92f34b17..28b21ed01b3 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -432,45 +432,27 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, bool initial_read) HGOTO_ERROR(H5E_FILE, H5E_CANTPROTECT, FAIL, "unable to load superblock"); /* - * When opening a file with SWMR-write access, the library will first - * check to ensure that superblock version 3 is used. Otherwise fail - * file open. - * - * Then the library will upgrade the file's low_bound depending on - * superblock version as follows: - * --version 0 or 1: no change to low_bound - * --version 2: upgrade low_bound to at least V18 - * --version 3: upgrade low_bound to at least V110 + * When opening a file with SWMR-write access, the library will check to + * ensure that: + * --superblock version 3 is used + * --superblock version does not exceed the version allowed by high bound + * --upgrade low_bound to at least V110 + * Otherwise fail file open for SMWR-write access * * Upgrading low_bound will give the best format versions available for * that superblock version. Due to the possible upgrade, the fapl returned * from H5Fget_access_plist() might indicate a low_bound higher than what * the user originally set. * - * After upgrading low_bound, the library will check to ensure that the - * superblock version does not exceed the version allowed by high_bound. - * Otherwise fail file open. - * * For details, please see RFC:Setting Bounds for Object Creation in HDF5 1.10.0. */ - - /* Check to ensure that superblock version 3 is used for SWMR-write access */ if (H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) { if (sblock->super_vers < HDF5_SUPERBLOCK_VERSION_3) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "superblock version for SWMR is less than 3"); - } - - /* Upgrade low_bound to at least V18 when encountering version 2 superblock */ - if (sblock->super_vers == HDF5_SUPERBLOCK_VERSION_2) - f->shared->low_bound = MAX(H5F_LIBVER_V18, f->shared->low_bound); - - /* Upgrade low_bound to at least V110 when encountering version 3 superblock */ - if (sblock->super_vers >= HDF5_SUPERBLOCK_VERSION_3) + if (sblock->super_vers > HDF5_superblock_ver_bounds[f->shared->high_bound]) + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "superblock version exceeds high bound"); f->shared->low_bound = MAX(H5F_LIBVER_V110, f->shared->low_bound); - - /* Version bounds check */ - if (sblock->super_vers > HDF5_superblock_ver_bounds[f->shared->high_bound]) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "superblock version exceeds high bound"); + } /* Pin the superblock in the cache */ if (H5AC_pin_protected_entry(sblock) < 0) diff --git a/src/H5Oint.c b/src/H5Oint.c index cca6ccd161a..2ac622dd106 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -2984,3 +2984,20 @@ H5O_has_chksum(const H5O_t *oh) FUNC_LEAVE_NOAPI(H5O_SIZEOF_CHKSUM_OH(oh) > 0) } /* end H5O_has_chksum() */ + +/*------------------------------------------------------------------------- + * Function: H5O_get_version_bound + * + * Purpose: Retrieve the version for a given bound from object version array + * + *------------------------------------------------------------------------- + */ +herr_t +H5O_get_version_bound(H5F_libver_t bound, uint8_t *version) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + *version = (uint8_t)H5O_obj_ver_bounds[bound]; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5O_get_version_bound() */ diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index a5eebcf3985..4b1f4e07940 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -933,6 +933,7 @@ H5_DLL uint8_t H5O_get_oh_version(const H5O_t *oh); H5_DLL herr_t H5O_get_rc_and_type(const H5O_loc_t *oloc, unsigned *rc, H5O_type_t *otype); H5_DLL H5AC_proxy_entry_t *H5O_get_proxy(const H5O_t *oh); H5_DLL bool H5O_has_chksum(const H5O_t *oh); +H5_DLL herr_t H5O_get_version_bound(H5F_libver_t bound, uint8_t *version); /* Object header message routines */ H5_DLL herr_t H5O_msg_create(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags, diff --git a/src/H5Tinit_float.c b/src/H5Tinit_float.c index de959b49735..39deda03625 100644 --- a/src/H5Tinit_float.c +++ b/src/H5Tinit_float.c @@ -608,9 +608,13 @@ H5T__init_native_float_types(void) #endif done: - /* Clear any FE_INVALID exceptions from NaN handling */ + /* Clear any FE_INVALID exceptions from NaN handling. FE_INVALID is C99/C11, + * but may not be present on all systems. + */ +#ifdef FE_INVALID if (feclearexcept(FE_INVALID) != 0) HSYS_GOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't clear floating-point exceptions"); +#endif /* Restore the original environment */ if (feupdateenv(&saved_fenv) != 0) diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c index 8c1de0e6d96..14274ed86c9 100644 --- a/src/H5VLpassthru.c +++ b/src/H5VLpassthru.c @@ -49,13 +49,6 @@ /* (Uncomment to enable) */ /* #define ENABLE_PASSTHRU_LOGGING */ -/* Hack for missing va_copy() in old Visual Studio editions - * (from H5win2_defs.h - used on VS2012 and earlier) - */ -#if defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER < 1800) -#define va_copy(D, S) ((D) = (S)) -#endif - /************/ /* Typedefs */ /************/ diff --git a/src/H5system.c b/src/H5system.c index 21135bc5da9..2da53d82e55 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -173,14 +173,10 @@ Nflock(int H5_ATTR_UNUSED fd, int H5_ATTR_UNUSED operation) time_t H5_make_time(struct tm *tm) { - time_t the_time; /* The converted time */ -#if defined(H5_HAVE_VISUAL_STUDIO) && (_MSC_VER >= 1900) /* VS 2015 */ - /* In gcc and in Visual Studio prior to VS 2015 'timezone' is a global - * variable declared in time.h. That variable was deprecated and in - * VS 2015 is removed, with _get_timezone replacing it. - */ + time_t the_time; /* The converted time */ +#if defined(H5_HAVE_VISUAL_STUDIO) long timezone = 0; -#endif /* defined(H5_HAVE_VISUAL_STUDIO) && (_MSC_VER >= 1900) */ +#endif time_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -203,13 +199,9 @@ H5_make_time(struct tm *tm) /* BSD-like systems */ the_time += tm->tm_gmtoff; #elif defined(H5_HAVE_TIMEZONE) -#if defined(H5_HAVE_VISUAL_STUDIO) && (_MSC_VER >= 1900) /* VS 2015 */ - /* In gcc and in Visual Studio prior to VS 2015 'timezone' is a global - * variable declared in time.h. That variable was deprecated and in - * VS 2015 is removed, with _get_timezone replacing it. - */ +#if defined(H5_HAVE_VISUAL_STUDIO) _get_timezone(&timezone); -#endif /* defined(H5_HAVE_VISUAL_STUDIO) && (_MSC_VER >= 1900) */ +#endif the_time -= timezone - (tm->tm_isdst ? 3600 : 0); #else diff --git a/test/swmr.c b/test/swmr.c index cb99917756a..ce9d73e272c 100644 --- a/test/swmr.c +++ b/test/swmr.c @@ -1554,20 +1554,26 @@ test_metadata_read_retry_info(hid_t in_fapl) * Should fail to enable SWMR as the file is already in SWMR writing mode * Close the file * - * (B) Opening a file - * Open the file with write + non-latest-format - * --file has v3 superblock and all latest version support enabled - * Open dataset "dataset1" 3 times--keep it open - * Write to "dataset1" - * Create a group in the file - * Create a chunked dataset "dataset2" in the group--should be using latest chunk indexing--keep it open - * Should succeed in enabling SWMR - * Should succeed in reading from multiple opens of "dataset1" - * Close multiple opens of "dataset1" - * Close "dataset2" - * Create "dataset3"--should be using latest chunk indexing - * Close "dataset3" - * Close the group and file + * (B) Open the file with write + non-latest-format (earliest, latest) + * --file has v3 superblock + * Create a group in the file + * Create a chunked dataset "dataset2" in the group--keep it open + * Verify "dataset2" is using v1 btree indexing + * Should fail to enable SWMR writing + * + * (C) Open a file with write + non-latest format (V110, latest) + * Open the old style group "/group/dataset2" in the file + * Should fail to enable SWMR writing + * + * (D) Open a file with write + non-latest format (V110, latest) + * Open the old style group "/group" + * Open the new style group "/dataset1" in the file + * Should fail to enable SWMR writing + * + * (E) Open a file with write + non-latest format (V110, latest) + * Open the new style group "/dataset1" in the file + * Should succeed to enable SWMR writing + * */ static int test_start_swmr_write(hid_t in_fapl, bool new_format) @@ -1707,11 +1713,11 @@ test_start_swmr_write(hid_t in_fapl, bool new_format) FAIL_STACK_ERROR; /* - * Case B: when opening a file + * Case B: when opening a file with (earliest, latest) */ - /* Open the file again with write + non-latest-format */ - if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + /* Open the file again with write + non-latest-format (earliest, latest) */ + if ((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR; /* Get the file's access_property list */ @@ -1730,23 +1736,6 @@ test_start_swmr_write(hid_t in_fapl, bool new_format) if (H5Pclose(file_fapl) < 0) FAIL_STACK_ERROR; - /* open "dataset1", keep it open */ - if ((did1 = H5Dopen2(fid, "dataset1", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; - - /* open "dataset1" second time */ - if ((did1_a = H5Dopen2(fid, "dataset1", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; - - /* open "dataset1" third time */ - if ((did1_b = H5Dopen2(fid, "dataset1", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; - - /* Write to "dataset1" */ - wdata = 88; - if (H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0) - FAIL_STACK_ERROR; - /* Create a group */ if ((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR; @@ -1764,99 +1753,112 @@ test_start_swmr_write(hid_t in_fapl, bool new_format) /* Get the chunk index type for "dataset2" */ if (H5D__layout_idx_type_test(did2, &idx_type) < 0) FAIL_STACK_ERROR; - if (idx_type != H5D_CHUNK_IDX_BT2) - FAIL_PUTS_ERROR("should be using v2 B-tree chunk indexing"); - - /* Should succeed in enabling SWMR writing */ - if (H5Fstart_swmr_write(fid) < 0) - FAIL_STACK_ERROR; - - /* Get the file's access_property list */ - if ((file_fapl = H5Fget_access_plist(fid)) < 0) - FAIL_STACK_ERROR; + if (idx_type != H5D_CHUNK_IDX_BTREE) + FAIL_PUTS_ERROR("should be using v1 B-tree chunk indexing"); - /* Retrieve the # of read attempts */ - if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0) - FAIL_STACK_ERROR; + /* Should fail in enabling SWMR writing since file is opened with (earliest/latest) */ + H5E_BEGIN_TRY + { + ret = H5Fstart_swmr_write(fid); + } + H5E_END_TRY + if (ret >= 0) + TEST_ERROR; - /* Should be 100 */ - if (attempts != H5F_SWMR_METADATA_READ_ATTEMPTS) + if (H5Gclose(gid) < 0) + TEST_ERROR; + if (H5Dclose(did2) < 0) + TEST_ERROR; + if (H5Fclose(fid) < 0) TEST_ERROR; - /* Close the property list */ - if (H5Pclose(file_fapl) < 0) - FAIL_STACK_ERROR; + /* + * Case C: when opening a file with (V110, latest) + */ - rdata = 0; - /* Read from "dataset1" via did1_b (multiple opens) */ - if (H5Dread(did1_b, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) - FAIL_STACK_ERROR; - if (wdata != rdata) - FAIL_STACK_ERROR; - if (H5Dclose(did1_b) < 0) + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_V110, H5F_LIBVER_LATEST) < 0) FAIL_STACK_ERROR; - /* Read from "dataset1" */ - rdata = 0; - if (H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) - FAIL_STACK_ERROR; - if (wdata != rdata) - FAIL_STACK_ERROR; - if (H5Dclose(did1) < 0) + /* Open the file again with write + non-latest-format (V110, latest) */ + if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR; - rdata = 0; - /* Read from "dataset1" via did1_a (multiple opens) */ - if (H5Dread(did1_a, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) - FAIL_STACK_ERROR; - if (wdata != rdata) + /* Open the old style dataset: /group/datset2 */ + if ((did2 = H5Dopen2(fid, "/group/dataset2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR; - if (H5Dclose(did1_a) < 0) + + /* Open the new style dataset */ + if ((did1 = H5Dopen2(fid, "dataset1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR; - /* Close "dataset2", dataspace, dataset creation property list */ + /* Should fail in enabling SWMR writing since there are old style objects opened */ + H5E_BEGIN_TRY + { + ret = H5Fstart_swmr_write(fid); + } + H5E_END_TRY + if (ret >= 0) + TEST_ERROR; + if (H5Dclose(did2) < 0) - FAIL_STACK_ERROR; - if (H5Sclose(sid2) < 0) - FAIL_STACK_ERROR; - if (H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; + if (H5Dclose(did1) < 0) + TEST_ERROR; + if (H5Fclose(fid) < 0) + TEST_ERROR; - /* Create "dataset3" */ - if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR; - if (H5Pset_chunk(dcpl, 2, chunk_dim2) < 0) - FAIL_STACK_ERROR; - if ((sid3 = H5Screate_simple(2, dim2, max_dim2)) < 0) - FAIL_STACK_ERROR; - if ((did3 = H5Dcreate2(fid, "dataset3", H5T_NATIVE_INT, sid3, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + /* + * Case D: when opening a file with (V110, latest) + */ - /* Get the chunk index type for "dataset3" */ - if (H5D__layout_idx_type_test(did3, &idx_type) < 0) + /* Open the file again with write + non-latest-format (V110, latest) */ + if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR; - if (idx_type != H5D_CHUNK_IDX_BT2) - FAIL_PUTS_ERROR("should be using v2 B-tree as index"); - /* Close "dataset3", dataspace, dataset creation property list */ - if (H5Dclose(did3) < 0) - FAIL_STACK_ERROR; - if (H5Sclose(sid3) < 0) + /* Open the old style group: /group */ + if ((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR; - if (H5Pclose(dcpl) < 0) + + /* Open the new style dataset */ + if ((did1 = H5Dopen2(fid, "dataset1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR; - /* Close the group */ + /* Should fail in enabling SWMR writing since there are old style objects opened */ + H5E_BEGIN_TRY + { + ret = H5Fstart_swmr_write(fid); + } + H5E_END_TRY + if (ret >= 0) + TEST_ERROR; + if (H5Gclose(gid) < 0) + TEST_ERROR; + if (H5Dclose(did1) < 0) + TEST_ERROR; + if (H5Fclose(fid) < 0) + TEST_ERROR; + + /* + * Case E: when opening a file with (V110, latest) + */ + + /* Open the file again with write + non-latest-format (V110, latest) */ + if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR; - /* Close the file access property list */ - if (H5Pclose(fapl) < 0) + /* Open the new style dataset */ + if ((did1 = H5Dopen2(fid, "dataset1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR; - /* Close the file */ + /* Should succeed in enabling SWMR writing */ + if (H5Fstart_swmr_write(fid) < 0) + TEST_ERROR; + + if (H5Dclose(did1) < 0) + TEST_ERROR; if (H5Fclose(fid) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; PASSED(); @@ -1915,12 +1917,12 @@ test_start_swmr_write(hid_t in_fapl, bool new_format) * --Enable SWMR writing mode twice * --First time succeed, second time fail * --Close the file - (2) --Open the file with write + with/without latest format + * (2) --Open the file with write + with/without latest format * --Succeed to enable SWMR writing mode * --Reopen the same file * --fail to enable SWMR writing mode for the reopened file * --Close the file - (3) --Open the file with write + with/without latest format + * (3) --Open the file with write + with/without latest format * --Open the same file again * --succeed to enable SWMR for the first opened file * --fail to enable SWMR for the second opened file @@ -1931,7 +1933,6 @@ test_start_swmr_write(hid_t in_fapl, bool new_format) * --fail to open due to superblock version not 3 * (2) Open the file with SWMR write+non-latest-format * --fail to open due to superblock version not 3 - * (3) Open the file with write+latest format * --fail to enable SWMR due to superblock version not 3 * (4) Open the file with write+non-latest-format @@ -2164,8 +2165,18 @@ test_err_start_swmr_write(hid_t in_fapl, bool new_format) if (H5Aclose(aid) < 0) FAIL_STACK_ERROR; - /* Should succeed in enabling SWMR writing */ - if (H5Fstart_swmr_write(fid) < 0) + /* Should succeed in enabling SWMR writing when new_format */ + /* Should fail in enabling SWMR writing when !new_format */ + H5E_BEGIN_TRY + { + ret = H5Fstart_swmr_write(fid); + } + H5E_END_TRY + if (new_format) { + if (ret < 0) + TEST_ERROR; + } + else if (ret >= 0) TEST_ERROR; /* Close the dataspace */ @@ -2195,8 +2206,18 @@ test_err_start_swmr_write(hid_t in_fapl, bool new_format) if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR; - /* Should succeed in enabling SWMR writing mode */ - if (H5Fstart_swmr_write(fid) < 0) + /* Should succeed when new_format */ + /* Should fail when !new_format */ + H5E_BEGIN_TRY + { + ret = H5Fstart_swmr_write(fid); + } + H5E_END_TRY + if (new_format) { + if (ret < 0) + TEST_ERROR; + } + else if (ret >= 0) TEST_ERROR; /* Should fail for a second call to enable SWMR writing mode */ @@ -2218,8 +2239,18 @@ test_err_start_swmr_write(hid_t in_fapl, bool new_format) if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR; - /* Should succeed in enabling SWMR writing mode */ - if (H5Fstart_swmr_write(fid) < 0) + /* Should succeed when new_format */ + /* Should fail when !new_format */ + H5E_BEGIN_TRY + { + ret = H5Fstart_swmr_write(fid); + } + H5E_END_TRY + if (new_format) { + if (ret < 0) + TEST_ERROR; + } + else if (ret >= 0) TEST_ERROR; /* Re-open the same file */ @@ -2251,8 +2282,18 @@ test_err_start_swmr_write(hid_t in_fapl, bool new_format) if ((fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR; - /* Should succeed in enabling SWMR writing for fid */ - if (H5Fstart_swmr_write(fid) < 0) + /* Should succeed when new_format */ + /* Should fail when !new_format */ + H5E_BEGIN_TRY + { + ret = H5Fstart_swmr_write(fid); + } + H5E_END_TRY + if (new_format) { + if (ret < 0) + TEST_ERROR; + } + else if (ret >= 0) TEST_ERROR; /* Should fail to enable SWMR writing for fid2 */ @@ -2500,6 +2541,11 @@ test_start_swmr_write_concur(hid_t in_fapl, bool new_format) * will fail without H5Fstart_swmr_write() */ + if (!new_format) { + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_V110, H5F_LIBVER_LATEST) < 0) + FAIL_STACK_ERROR; + } + /* Fork child process */ if ((childpid = fork()) < 0) FAIL_STACK_ERROR; @@ -7429,6 +7475,11 @@ test_multiple_same(hid_t in_fapl, bool new_format) if ((fapl = H5Pcopy(in_fapl)) < 0) FAIL_STACK_ERROR; + if (!new_format) { + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_V110, H5F_LIBVER_LATEST) < 0) + FAIL_STACK_ERROR; + } + /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); diff --git a/test/tfile.c b/test/tfile.c index 0915ef78ba3..9ffedc0f001 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -5649,19 +5649,18 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, H5F * *------------------------------------------------------------------------- */ -#define VERBFNAME "tverbounds_dspace.h5" +#define VFNAME "verbounds.h5" #define VERBDSNAME "dataset 1" #define SPACE1_DIM1 3 static void test_libver_bounds_open(void) { - hid_t file = H5I_INVALID_HID; /* File ID */ - hid_t space = H5I_INVALID_HID; /* Dataspace ID */ - hid_t dset = H5I_INVALID_HID; /* Dataset ID */ - hid_t fapl = H5I_INVALID_HID; /* File access property list ID */ - hid_t new_fapl = H5I_INVALID_HID; /* File access property list ID for reopened file */ - hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list ID */ - hsize_t dim[1] = {SPACE1_DIM1}; /* Dataset dimensions */ + hid_t file = H5I_INVALID_HID; /* File ID */ + hid_t space = H5I_INVALID_HID; /* Dataspace ID */ + hid_t dset = H5I_INVALID_HID; /* Dataset ID */ + hid_t fapl = H5I_INVALID_HID; /* File access property list ID */ + hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list ID */ + hsize_t dim[1] = {SPACE1_DIM1}; /* Dataset dimensions */ H5F_libver_t low, high; /* File format bounds */ hsize_t chunk_dim[1] = {SPACE1_DIM1}; /* Chunk dimensions */ bool vol_is_native; @@ -5707,7 +5706,7 @@ test_libver_bounds_open(void) CHECK(ret, FAIL, "H5Pset_libver_bounds"); /* Create the file */ - file = H5Fcreate(VERBFNAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + file = H5Fcreate(VFNAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(file, FAIL, "H5Fcreate"); /* Create dataset */ @@ -5720,49 +5719,36 @@ test_libver_bounds_open(void) ret = H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); - /* Attempt to open latest file with (earliest, v18), should fail */ + /* Attempt to open latest file with (earliest, v18) should succeed */ ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_V18); - H5E_BEGIN_TRY - { - file = H5Fopen(VERBFNAME, H5F_ACC_RDONLY, fapl); - } - H5E_END_TRY - VERIFY(file, FAIL, "Attempted to open latest file with earliest version"); + CHECK(ret, FAIL, "H5Pset_libver_bounds"); + + if ((file = H5Fopen(VFNAME, H5F_ACC_RDONLY, fapl)) < 0) + VERIFY((file >= 0), true, "Attempt to open latest file with earliest version should succeed"); + ret = H5Fclose(file); + CHECK(ret, FAIL, "H5Fclose"); /* Attempt to open latest file with (v18, v18), should fail */ ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_V18, H5F_LIBVER_V18); - H5E_BEGIN_TRY - { - file = H5Fopen(VERBFNAME, H5F_ACC_RDONLY, fapl); - } - H5E_END_TRY - VERIFY(file, FAIL, "Attempted to open latest file with v18 bounds"); + CHECK(ret, FAIL, "H5Pset_libver_bounds"); + + file = H5Fopen(VFNAME, H5F_ACC_RDONLY, fapl); + VERIFY((file >= 0), true, "Attempt to open latest file with v18 bounds should succeed"); + ret = H5Fclose(file); + CHECK(ret, FAIL, "H5Fclose"); - /* Opening VERBFNAME in these combination should succeed. - For each low bound, verify that it is upgraded properly */ + /* Opening VERBFNAME in these combination should succeed */ high = H5F_LIBVER_LATEST; for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { - H5F_libver_t new_low = H5F_LIBVER_EARLIEST; /* Set version bounds for opening file */ ret = H5Pset_libver_bounds(fapl, low, high); CHECK(ret, FAIL, "H5Pset_libver_bounds"); /* Open the file */ - file = H5Fopen(VERBFNAME, H5F_ACC_RDONLY, fapl); - CHECK(file, FAIL, "H5Fopen"); - - /* Get the new file access property */ - new_fapl = H5Fget_access_plist(file); - CHECK(new_fapl, FAIL, "H5Fget_access_plist"); - - /* Get new low bound and verify that it has been upgraded properly */ - ret = H5Pget_libver_bounds(new_fapl, &new_low, NULL); - CHECK(ret, FAIL, "H5Pget_libver_bounds"); - VERIFY(new_low >= H5F_LIBVER_V110, true, "Low bound should be upgraded to at least H5F_LIBVER_V110"); + file = H5Fopen(VFNAME, H5F_ACC_RDONLY, fapl); + VERIFY(file >= 0, true, "H5Fopen should succeed"); - ret = H5Pclose(new_fapl); - CHECK(ret, FAIL, "H5Pclose"); ret = H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); } /* for low */ @@ -5886,9 +5872,10 @@ test_libver_bounds(void) /* Run the tests */ test_libver_bounds_real(H5F_LIBVER_EARLIEST, 1, H5F_LIBVER_LATEST, 2); - test_libver_bounds_real(H5F_LIBVER_LATEST, 2, H5F_LIBVER_EARLIEST, 2); + test_libver_bounds_real(H5F_LIBVER_LATEST, 2, H5F_LIBVER_EARLIEST, 1); test_libver_bounds_open(); test_libver_bounds_copy(); + } /* end test_libver_bounds() */ /************************************************************************************** @@ -6251,7 +6238,7 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t n ** ** (A) Opening a file with write access ** -** Superblock version 0, 1 +** Superblock version 0, 1, 2, 3 ** -------------------------------------------------------------------------------- ** | (earliest, v18) | (earliest, v110) | (v18, v18) | (v18, v110) | (v110, v110) | ** |______________________________________________________________________________| @@ -6261,26 +6248,6 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t n ** |______________________________________________________________________________| ** ** -** Superblock version 2 -** -------------------------------------------------------------------------------- -** | (earliest, v18) | (earliest, v110) | (v18, v18) | (v18, v110) | (v110, v110) | -** |______________________________________________________________________________| -** File's low bound | -->v18 | no change | -** |------------------------------------------------------------------------------| -** File open | succeed | -** |______________________________________________________________________________| -** -** Superblock version 3 -** -------------------------------------------------------------------------------- -** | (earliest, v18) | (earliest, v110) | (v18, v18) | (v18, v110) | (v110, v110) | -** |______________________________________________________________________________| -** File's low bound | -- | -->v110 | -- | -->v110 | no change | -** |------------------------------------------------------------------------------| -** File open | fail | succeed | fail | succeed | succeed | -** |______________________________________________________________________________| -** -** -** ** (B) Opening a file with SWMR-write access ** ** Superblock version 0, 1, 2 @@ -6316,9 +6283,7 @@ static void test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non_def_fsm) { hid_t fid = H5I_INVALID_HID; /* File ID */ - H5F_t *f = NULL; /* Internal file pointer */ hid_t new_fapl = H5I_INVALID_HID; /* File access property list */ - unsigned super_vers; /* Superblock version */ H5F_libver_t low, high; /* Low and high bounds */ herr_t ret; /* Return value */ @@ -6339,13 +6304,6 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non else { VERIFY(fid >= 0, true, "H5Fcreate"); - /* Get the internal file pointer */ - f = (H5F_t *)H5VL_object(fid); - CHECK_PTR(f, "H5VL_object"); - - /* The file's superblock version */ - super_vers = f->shared->sblock->super_vers; - /* Close the file */ ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); @@ -6374,66 +6332,18 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non } H5E_END_TRY - if (non_def_fsm && high < H5F_LIBVER_V110) { - VERIFY(fid, H5I_INVALID_HID, "H5Fopen"); - continue; - } - /* Get the internal file pointer if the open succeeds */ if (fid >= 0) { - f = (H5F_t *)H5VL_object(fid); - CHECK_PTR(f, "H5VL_object"); + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); } + else { - /* Verify the file open succeeds or fails */ - switch (super_vers) { - case 3: - if (high >= H5F_LIBVER_V110) { - /* Should succeed */ - VERIFY(fid >= 0, true, "H5Fopen"); - VERIFY(f->shared->low_bound >= H5F_LIBVER_V110, true, - "HDF5_superblock_ver_bounds"); - - /* Close the file */ - ret = H5Fclose(fid); - CHECK(ret, FAIL, "H5Fclose"); - } - else /* Should fail */ - VERIFY(fid >= 0, false, "H5Fopen"); - break; - - case 2: - if (is_swmr) /* Should fail */ - VERIFY(fid >= 0, false, "H5Fopen"); - else { /* Should succeed */ - VERIFY(fid >= 0, true, "H5Fopen"); - VERIFY(f->shared->low_bound >= H5F_LIBVER_V18, true, - "HDF5_superblock_ver_bounds"); - - /* Close the file */ - ret = H5Fclose(fid); - CHECK(ret, FAIL, "H5Fclose"); - } - break; - - case 1: - case 0: - if (is_swmr) /* Should fail */ - VERIFY(fid >= 0, false, "H5Fopen"); - else { /* Should succeed */ - VERIFY(fid >= 0, true, "H5Fopen"); - VERIFY(f->shared->low_bound, low, "HDF5_superblock_ver_bounds"); - - ret = H5Fclose(fid); - CHECK(ret, FAIL, "H5Fclose"); - } - break; + VERIFY((is_swmr || (non_def_fsm && (high < H5F_LIBVER_V110))), true, "H5Fopen"); + } - default: - break; - } /* end switch */ - } /* end for */ - } /* end for */ + } /* end for */ + } /* end for */ /* Close the file access property list */ ret = H5Pclose(new_fapl); @@ -6555,6 +6465,7 @@ test_libver_bounds_obj(hid_t fapl) fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl); } H5E_END_TRY + VERIFY((fid >= 0), true, "File open should succeed"); if (fid >= 0) { /* The file open succeeds */ @@ -6773,6 +6684,7 @@ test_libver_bounds_dataset(hid_t fapl) fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl); } H5E_END_TRY + VERIFY((fid >= 0), true, "File open should succeed"); if (fid >= 0) { /* The file open succeeds */ @@ -7002,6 +6914,7 @@ test_libver_bounds_dataspace(hid_t fapl) fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl); } H5E_END_TRY + VERIFY((fid >= 0), true, "File open should succeed"); if (fid >= 0) { /* The file open succeeds */ @@ -7338,6 +7251,7 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid) fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl); } H5E_END_TRY + VERIFY((fid >= 0), true, "File open should succeed"); if (fid >= 0) { /* The file open succeeds */ @@ -7666,6 +7580,7 @@ test_libver_bounds_attributes(hid_t fapl) fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl); } H5E_END_TRY + VERIFY((fid >= 0), true, "File open should succeed"); if (fid >= 0) { /* The file open succeeds */ @@ -7686,7 +7601,7 @@ test_libver_bounds_attributes(hid_t fapl) CHECK_PTR(attr, "H5VL_object"); /* Verify the attribute message version */ - VERIFY(attr->shared->version, H5O_attr_ver_bounds[f->shared->low_bound], + VERIFY(attr->shared->version >= H5O_attr_ver_bounds[f->shared->low_bound], true, "H5O_attr_ver_bounds"); /* Close the attribute */ diff --git a/test/tmisc.c b/test/tmisc.c index 8c73aa61949..a368aa0fa96 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -6868,7 +6868,7 @@ test_misc40(void) CHECK(ret, FAIL, "H5Fclose"); /* Re-open the file */ - fid = H5Fopen(MISC25C_FILE, H5F_ACC_RDWR, H5P_DEFAULT); + fid = H5Fopen(MISC25C_FILE, H5F_ACC_RDWR, fapl); CHECK(fid, H5I_INVALID_HID, "H5Fopen"); /* Set the compact/dense value high, to see if we can trick the