diff --git a/.github/workflows/abi-report.yml b/.github/workflows/abi-report.yml index 47ab4927b14..01a72106711 100644 --- a/.github/workflows/abi-report.yml +++ b/.github/workflows/abi-report.yml @@ -170,7 +170,7 @@ jobs: cp ${{ inputs.file_base }}-hdf5_cpp_compat_report.html ${{ runner.workspace }}/buildabi/hdf5 cp ${{ inputs.file_base }}-java_compat_report.html ${{ runner.workspace }}/buildabi/hdf5 cd "${{ runner.workspace }}/buildabi" - tar -zcvf ${{ inputs.file_base }}.html.abi.reports hdf5 + tar -zcvf ${{ inputs.file_base }}.html.abi.reports.tar.gz hdf5 shell: bash - name: Save output as artifact @@ -178,4 +178,4 @@ jobs: with: name: abi-reports path: | - ${{ runner.workspace }}/buildabi/${{ inputs.file_base }}.html.abi.reports + ${{ runner.workspace }}/buildabi/${{ inputs.file_base }}.html.abi.reports.tar.gz diff --git a/.github/workflows/cmake-bintest.yml b/.github/workflows/cmake-bintest.yml index ffc2c5be0db..f7c01b71ae7 100644 --- a/.github/workflows/cmake-bintest.yml +++ b/.github/workflows/cmake-bintest.yml @@ -129,12 +129,6 @@ jobs: run: | ls -l ${{ github.workspace }}/HDF_Group/HDF5 - - name: Set file base name (Linux) - id: set-file-base - run: | - FILE_NAME_BASE=$(echo "${{ inputs.file_base }}") - echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT - - name: List files for the space (Linux) run: | ls -l ${{ github.workspace }} @@ -187,12 +181,6 @@ jobs: run: | ls -l ${{ github.workspace }}/HDF_Group/HDF5 - - name: Set file base name (MacOS) - id: set-file-base - run: | - FILE_NAME_BASE=$(echo "${{ inputs.file_base }}") - echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT - - name: List files for the space (MacOS) run: | ls ${{ github.workspace }} diff --git a/.github/workflows/cmake-ctest.yml b/.github/workflows/cmake-ctest.yml index 20699b39fc1..99bd7a87d7a 100644 --- a/.github/workflows/cmake-ctest.yml +++ b/.github/workflows/cmake-ctest.yml @@ -4,6 +4,11 @@ name: hdf5 1.14 ctest runs 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 @@ -46,11 +51,11 @@ jobs: run: | FILE_NAME_BASE=$(echo "${{ inputs.file_base }}") echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT - if [[ '${{ inputs.use_environ }}' == 'snapshots' ]] + if [[ '${{ inputs.use_environ }}' == 'release' ]] then - SOURCE_NAME_BASE=$(echo "hdfsrc") + SOURCE_NAME_BASE=$(echo "${{ inputs.snap_name }}") else - SOURCE_NAME_BASE=$(echo "$FILE_NAME_BASE") + SOURCE_NAME_BASE=$(echo "hdfsrc") fi echo "SOURCE_BASE=$SOURCE_NAME_BASE" >> $GITHUB_OUTPUT shell: bash @@ -129,11 +134,11 @@ jobs: run: | FILE_NAME_BASE=$(echo "${{ inputs.file_base }}") echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT - if [[ '${{ inputs.use_environ }}' == 'snapshots' ]] + if [[ '${{ inputs.use_environ }}' == 'release' ]] then - SOURCE_NAME_BASE=$(echo "hdfsrc") + SOURCE_NAME_BASE=$(echo "${{ inputs.snap_name }}") else - SOURCE_NAME_BASE=$(echo "$FILE_NAME_BASE") + SOURCE_NAME_BASE=$(echo "hdfsrc") fi echo "SOURCE_BASE=$SOURCE_NAME_BASE" >> $GITHUB_OUTPUT @@ -253,11 +258,11 @@ jobs: run: | FILE_NAME_BASE=$(echo "${{ inputs.file_base }}") echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT - if [[ '${{ inputs.use_environ }}' == 'snapshots' ]] + if [[ '${{ inputs.use_environ }}' == 'release' ]] then - SOURCE_NAME_BASE=$(echo "hdfsrc") + SOURCE_NAME_BASE=$(echo "${{ inputs.snap_name }}") else - SOURCE_NAME_BASE=$(echo "$FILE_NAME_BASE") + SOURCE_NAME_BASE=$(echo "hdfsrc") fi echo "SOURCE_BASE=$SOURCE_NAME_BASE" >> $GITHUB_OUTPUT @@ -333,11 +338,11 @@ jobs: run: | FILE_NAME_BASE=$(echo "${{ inputs.file_base }}") echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT - if [[ '${{ inputs.use_environ }}' == 'snapshots' ]] + if [[ '${{ inputs.use_environ }}' == 'release' ]] then - SOURCE_NAME_BASE=$(echo "hdfsrc") + SOURCE_NAME_BASE=$(echo "${{ inputs.snap_name }}") else - SOURCE_NAME_BASE=$(echo "$FILE_NAME_BASE") + SOURCE_NAME_BASE=$(echo "hdfsrc") fi echo "SOURCE_BASE=$SOURCE_NAME_BASE" >> $GITHUB_OUTPUT @@ -413,11 +418,11 @@ jobs: run: | FILE_NAME_BASE=$(echo "${{ inputs.file_base }}") echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT - if [[ '${{ inputs.use_environ }}' == 'snapshots' ]] + if [[ '${{ inputs.use_environ }}' == 'release' ]] then - SOURCE_NAME_BASE=$(echo "hdfsrc") + SOURCE_NAME_BASE=$(echo "${{ inputs.snap_name }}") else - SOURCE_NAME_BASE=$(echo "$FILE_NAME_BASE") + SOURCE_NAME_BASE=$(echo "hdfsrc") fi echo "SOURCE_BASE=$SOURCE_NAME_BASE" >> $GITHUB_OUTPUT shell: bash @@ -507,11 +512,11 @@ jobs: run: | FILE_NAME_BASE=$(echo "${{ inputs.file_base }}") echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT - if [[ '${{ inputs.use_environ }}' == 'snapshots' ]] + if [[ '${{ inputs.use_environ }}' == 'release' ]] then - SOURCE_NAME_BASE=$(echo "hdfsrc") + SOURCE_NAME_BASE=$(echo "${{ inputs.snap_name }}") else - SOURCE_NAME_BASE=$(echo "$FILE_NAME_BASE") + SOURCE_NAME_BASE=$(echo "hdfsrc") fi echo "SOURCE_BASE=$SOURCE_NAME_BASE" >> $GITHUB_OUTPUT diff --git a/.github/workflows/daily-build.yml b/.github/workflows/daily-build.yml index b3af5a4404c..f3a19930970 100644 --- a/.github/workflows/daily-build.yml +++ b/.github/workflows/daily-build.yml @@ -35,17 +35,17 @@ jobs: call-workflow-tarball: uses: ./.github/workflows/tarball.yml with: - #use_tag: snapshot-1.14 + use_tag: snapshot-1.14 use_environ: snapshots call-workflow-ctest: needs: call-workflow-tarball uses: ./.github/workflows/cmake-ctest.yml with: - file_base: ${{ needs.call-workflow-tarball.outputs.file_base }} preset_name: ci-StdShar - #use_tag: snapshot-1.14 - #use_environ: snapshots + file_base: ${{ needs.call-workflow-tarball.outputs.file_base }} + use_tag: snapshot-1.14 + use_environ: snapshots if: ${{ needs.call-workflow-tarball.outputs.has_changes == 'true' }} call-workflow-abi: diff --git a/.github/workflows/markdown-link-check.yml b/.github/workflows/markdown-link-check.yml new file mode 100644 index 00000000000..70bb035deaa --- /dev/null +++ b/.github/workflows/markdown-link-check.yml @@ -0,0 +1,14 @@ +name: Check Markdown links + +on: + workflow_dispatch: + push: + pull_request: + branches: [ hdf5_1_14 ] + +jobs: + markdown-link-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - uses: gaurav-nelson/github-action-markdown-link-check@v1 diff --git a/.github/workflows/release-files.yml b/.github/workflows/release-files.yml index 0ae37cc3929..fbd04ef82bb 100644 --- a/.github/workflows/release-files.yml +++ b/.github/workflows/release-files.yml @@ -149,18 +149,18 @@ jobs: - name: Create sha256 sums for files run: | - sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}.doxygen.zip > sha256sums.txt - sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}.tar.gz >> sha256sums.txt - sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}.zip >> sha256sums.txt - sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}-osx12.tar.gz >> sha256sums.txt - sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.tar.gz >> sha256sums.txt - sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.deb >> sha256sums.txt - sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.rpm >> sha256sums.txt - sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc_s3.tar.gz >> sha256sums.txt - sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}-win-vs2022_cl.zip >> sha256sums.txt - sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_intel.tar.gz >> sha256sums.txt - sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}-win-vs2022_intel.zip >> sha256sums.txt - sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}.html.abi.reports >> sha256sums.txt + sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}.doxygen.zip > ${{ steps.get-file-base.outputs.FILE_BASE }}.sha256sums.txt + sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}.tar.gz >> ${{ steps.get-file-base.outputs.FILE_BASE }}.sha256sums.txt + sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}.zip >> ${{ steps.get-file-base.outputs.FILE_BASE }}.sha256sums.txt + sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}-osx12.tar.gz >> ${{ steps.get-file-base.outputs.FILE_BASE }}.sha256sums.txt + sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.tar.gz >> ${{ steps.get-file-base.outputs.FILE_BASE }}.sha256sums.txt + sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.deb >> ${{ steps.get-file-base.outputs.FILE_BASE }}.sha256sums.txt + sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.rpm >> ${{ steps.get-file-base.outputs.FILE_BASE }}.sha256sums.txt + sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc_s3.tar.gz >> ${{ steps.get-file-base.outputs.FILE_BASE }}.sha256sums.txt + sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}-win-vs2022_cl.zip >> ${{ steps.get-file-base.outputs.FILE_BASE }}.sha256sums.txt + sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_intel.tar.gz >> ${{ steps.get-file-base.outputs.FILE_BASE }}.sha256sums.txt + sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}-win-vs2022_intel.zip >> ${{ steps.get-file-base.outputs.FILE_BASE }}.sha256sums.txt + sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}.html.abi.reports.tar.gz >> ${{ steps.get-file-base.outputs.FILE_BASE }}.sha256sums.txt - name: Store snapshot name run: | @@ -197,8 +197,8 @@ jobs: ${{ steps.get-file-base.outputs.FILE_BASE }}-win-vs2022_cl.zip ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_intel.tar.gz ${{ steps.get-file-base.outputs.FILE_BASE }}-win-vs2022_intel.zip - ${{ steps.get-file-base.outputs.FILE_BASE }}.html.abi.reports - sha256sums.txt + ${{ steps.get-file-base.outputs.FILE_BASE }}.html.abi.reports.tar.gz + ${{ steps.get-file-base.outputs.FILE_BASE }}.sha256sums.txt if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` - name: Release tag @@ -221,8 +221,8 @@ jobs: ${{ steps.get-file-base.outputs.FILE_BASE }}-win-vs2022_cl.zip ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_intel.tar.gz ${{ steps.get-file-base.outputs.FILE_BASE }}-win-vs2022_intel.zip - ${{ steps.get-file-base.outputs.FILE_BASE }}.html.abi.reports - sha256sums.txt + ${{ steps.get-file-base.outputs.FILE_BASE }}.html.abi.reports.tar.gz + ${{ steps.get-file-base.outputs.FILE_BASE }}.sha256sums.txt if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` - name: List files for the space (Linux) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a56bf3b083a..4c52077ebe5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,15 +31,16 @@ jobs: needs: log-the-inputs uses: ./.github/workflows/tarball.yml with: -# use_tag: ${{ inputs.use_tag }} + use_tag: ${{ needs.log-the-inputs.outputs.rel_tag }} use_environ: release call-workflow-ctest: needs: call-workflow-tarball uses: ./.github/workflows/cmake-ctest.yml with: - file_base: ${{ needs.call-workflow-tarball.outputs.file_base }} preset_name: ci-StdShar + file_base: ${{ needs.call-workflow-tarball.outputs.file_base }} + snap_name: hdf5-${{ needs.call-workflow-tarball.outputs.source_base }} use_environ: release call-workflow-abi: @@ -58,8 +59,8 @@ jobs: uses: ./.github/workflows/release-files.yml with: file_base: ${{ needs.call-workflow-tarball.outputs.file_base }} - file_branch: ${{ needs.log-the-inputs.outputs.rel_tag }} - file_sha: ${{ needs.log-the-inputs.outputs.rel_tag }} + file_branch: ${{ needs.call-workflow-tarball.outputs.file_branch }} + file_sha: ${{ needs.call-workflow-tarball.outputs.file_sha }} use_tag: ${{ needs.log-the-inputs.outputs.rel_tag }} use_environ: release diff --git a/.github/workflows/remove-files.yml b/.github/workflows/remove-files.yml index c2a897db24d..cc4e44ee38d 100644 --- a/.github/workflows/remove-files.yml +++ b/.github/workflows/remove-files.yml @@ -45,7 +45,8 @@ jobs: token: ${{ github.token }} tag: "${{ inputs.use_tag }}" assets: | - ${{ steps.get-file-base.outputs.FILE_BASE }}.html.abi.reports + ${{ steps.get-file-base.outputs.FILE_BASE }}.sha256sums.txt + ${{ steps.get-file-base.outputs.FILE_BASE }}.html.abi.reports.tar.gz ${{ steps.get-file-base.outputs.FILE_BASE }}.doxygen.zip ${{ steps.get-file-base.outputs.FILE_BASE }}.tar.gz ${{ steps.get-file-base.outputs.FILE_BASE }}.zip diff --git a/.github/workflows/tarball.yml b/.github/workflows/tarball.yml index 44ade534aa6..d2bff33deb7 100644 --- a/.github/workflows/tarball.yml +++ b/.github/workflows/tarball.yml @@ -4,11 +4,11 @@ name: hdf5 1.14 tarball on: workflow_call: inputs: -# use_tag: -# description: 'Release version tag' -# type: string -# required: false -# default: snapshot-1.14 + use_tag: + description: 'Release version tag' + type: string + required: false + default: snapshot-1.14 use_environ: description: 'Environment to locate files' type: string @@ -18,6 +18,9 @@ on: has_changes: description: "Whether there were changes the previous day" value: ${{ jobs.check_commits.outputs.has_changes }} + source_base: + description: "The common base name of the source tarballs" + value: ${{ jobs.create_tarball.outputs.source_base }} file_base: description: "The common base name of the source tarballs" value: ${{ jobs.create_tarball.outputs.file_base }} @@ -80,6 +83,7 @@ jobs: if: ${{ ((inputs.use_environ == 'snapshots') && (needs.check_commits.outputs.has_changes == 'true')) || (inputs.use_environ == 'release') }} outputs: file_base: ${{ steps.set-file-base.outputs.FILE_BASE }} + source_base: ${{ steps.version.outputs.SOURCE_TAG }} steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: Get Sources @@ -96,23 +100,28 @@ jobs: id: version run: | cd "$GITHUB_WORKSPACE/hdfsrc" - echo "TAG_VERSION=$(bin/h5vers)" >> $GITHUB_OUTPUT + echo "SOURCE_TAG=$(bin/h5vers)" >> $GITHUB_OUTPUT - name: Set file base name id: set-file-base run: | - if [[ '${{ inputs.use_environ }}' == 'snapshots' && '${{ needs.check_commits.outputs.has_changes }}' == 'true' ]] + if [[ '${{ inputs.use_environ }}' == 'snapshots' ]] then FILE_NAME_BASE=$(echo "hdf5-${{ needs.check_commits.outputs.branch_ref }}-${{ needs.check_commits.outputs.branch_sha }}") else - FILE_NAME_BASE=$(echo "hdf5-${{ steps.version.outputs.TAG_VERSION }}") + if [[ '${{ inputs.use_tag }}' == 'snapshot' ]] + then + FILE_NAME_BASE=$(echo "snapshot") + else + FILE_NAME_BASE=$(echo "hdf5-${{ steps.version.outputs.SOURCE_TAG }}") + fi fi echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT shell: bash - name: Create snapshot file base name id: create-file-base - if: ${{ (inputs.use_environ == 'snapshots') && (needs.check_commits.outputs.has_changes == 'true') }} + if: ${{ (inputs.use_environ == 'snapshots') }} run: | cd "$GITHUB_WORKSPACE/hdfsrc" bin/release -d $GITHUB_WORKSPACE --branch ${{ needs.check_commits.outputs.branch_ref }} --revision gzip zip @@ -123,7 +132,15 @@ jobs: if: ${{ (inputs.use_environ == 'release') }} run: | cd "$GITHUB_WORKSPACE/hdfsrc" - bin/release -d $GITHUB_WORKSPACE gzip zip cmake-tgz cmake-zip + bin/release -d $GITHUB_WORKSPACE gzip zip + shell: bash + + - name: Rename release file base name + id: ren-basename + if: ${{ (inputs.use_environ == 'release') && (inputs.use_tag == 'snapshot') }} + run: | + mv hdf5-${{ steps.version.outputs.SOURCE_TAG }}.tar.gz ${{ inputs.use_tag }}.tar.gz + mv hdf5-${{ steps.version.outputs.SOURCE_TAG }}.zip ${{ inputs.use_tag }}.zip shell: bash - name: List files in the repository diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0bf32050026..013051dbab1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -122,7 +122,7 @@ Please make sure that you check the items applicable to your pull request: * [ ] If changes were done to Autotools build, were they added to CMake and vice versa? * [ ] Is the pull request applicable to any other branches? If yes, which ones? Please document it in the GitHub issue. * [ ] Is the new code sufficiently documented for future maintenance? - * [ ] Does the new feature require a change to an existing API? See "API Compatibility Macros" document (https://portal.hdfgroup.org/display/HDF5/API+Compatibility+Macros) + * [ ] Does the new feature require a change to an existing API? See "API Compatibility Macros" document (https://docs.hdfgroup.org/hdf5/v1_14/api-compat-macros.html) * Documentation * [ ] Was the change described in the release_docs/RELEASE.txt file? * [ ] Was the new function documented in the corresponding public header file using [Doxygen](https://hdfgroup.github.io/hdf5/v1_14/_r_m_t.html)? diff --git a/HDF5Examples/C/H5D/Makefile.am b/HDF5Examples/C/H5D/Makefile.am index 06cdf66d173..dfccb4b72f9 100644 --- a/HDF5Examples/C/H5D/Makefile.am +++ b/HDF5Examples/C/H5D/Makefile.am @@ -5,12 +5,10 @@ # # This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. +# 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. ## ## Makefile.am ## Run automake to generate a Makefile.in from this file. diff --git a/HDF5Examples/C/H5D/test.sh.in b/HDF5Examples/C/H5D/test.sh.in index f6e84273367..ece230353e1 100755 --- a/HDF5Examples/C/H5D/test.sh.in +++ b/HDF5Examples/C/H5D/test.sh.in @@ -6,12 +6,10 @@ # # This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. +# 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. srcdir=@srcdir@ diff --git a/HDF5Examples/C/H5G/Makefile.am b/HDF5Examples/C/H5G/Makefile.am index 9dc4dcf7797..8ab2b8ac047 100644 --- a/HDF5Examples/C/H5G/Makefile.am +++ b/HDF5Examples/C/H5G/Makefile.am @@ -5,12 +5,10 @@ # # This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. +# 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. ## ## Makefile.am ## Run automake to generate a Makefile.in from this file. diff --git a/HDF5Examples/C/H5G/test.sh.in b/HDF5Examples/C/H5G/test.sh.in index f12c4a507c1..ea05ca3bd2b 100755 --- a/HDF5Examples/C/H5G/test.sh.in +++ b/HDF5Examples/C/H5G/test.sh.in @@ -6,12 +6,10 @@ # # This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. +# 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. srcdir=@srcdir@ diff --git a/HDF5Examples/C/H5T/Makefile.am b/HDF5Examples/C/H5T/Makefile.am index a4f4be5d835..bc0d5d5392d 100644 --- a/HDF5Examples/C/H5T/Makefile.am +++ b/HDF5Examples/C/H5T/Makefile.am @@ -5,12 +5,10 @@ # # This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. +# 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. ## ## Makefile.am ## Run automake to generate a Makefile.in from this file. diff --git a/HDF5Examples/C/H5T/test.sh.in b/HDF5Examples/C/H5T/test.sh.in index dc48ac9903c..d5c453b5010 100755 --- a/HDF5Examples/C/H5T/test.sh.in +++ b/HDF5Examples/C/H5T/test.sh.in @@ -6,12 +6,10 @@ # # This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. +# 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. srcdir=@srcdir@ diff --git a/HDF5Examples/C/H5VDS/Makefile.am b/HDF5Examples/C/H5VDS/Makefile.am index e4f5320b583..d9a5116afc7 100644 --- a/HDF5Examples/C/H5VDS/Makefile.am +++ b/HDF5Examples/C/H5VDS/Makefile.am @@ -5,12 +5,10 @@ # # This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. +# 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. ## ## Makefile.am ## Run automake to generate a Makefile.in from this file. diff --git a/HDF5Examples/C/H5VDS/test.sh.in b/HDF5Examples/C/H5VDS/test.sh.in index 91888f55648..983ef426d1c 100644 --- a/HDF5Examples/C/H5VDS/test.sh.in +++ b/HDF5Examples/C/H5VDS/test.sh.in @@ -6,12 +6,10 @@ # # This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. +# 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. srcdir=@srcdir@ diff --git a/HDF5Examples/C/Makefile.am b/HDF5Examples/C/Makefile.am index 0048db07032..778f802246c 100644 --- a/HDF5Examples/C/Makefile.am +++ b/HDF5Examples/C/Makefile.am @@ -5,12 +5,10 @@ # # This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. +# 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. ## ## Makefile.am ## Run automake to generate a Makefile.in from this file. diff --git a/HDF5Examples/FORTRAN/H5D/Makefile.am b/HDF5Examples/FORTRAN/H5D/Makefile.am index dc98f1fb412..c76ce8590de 100644 --- a/HDF5Examples/FORTRAN/H5D/Makefile.am +++ b/HDF5Examples/FORTRAN/H5D/Makefile.am @@ -5,12 +5,10 @@ # # This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. +# 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. ## ## Makefile.am ## Run automake to generate a Makefile.in from this file. diff --git a/HDF5Examples/FORTRAN/H5D/test.sh.in b/HDF5Examples/FORTRAN/H5D/test.sh.in index 76dbbcde41d..bdd17c283f8 100755 --- a/HDF5Examples/FORTRAN/H5D/test.sh.in +++ b/HDF5Examples/FORTRAN/H5D/test.sh.in @@ -6,12 +6,10 @@ # # This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. +# 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. srcdir=@srcdir@ diff --git a/HDF5Examples/FORTRAN/H5G/Makefile.am b/HDF5Examples/FORTRAN/H5G/Makefile.am index 39f13c615c6..cdf1647fcb7 100644 --- a/HDF5Examples/FORTRAN/H5G/Makefile.am +++ b/HDF5Examples/FORTRAN/H5G/Makefile.am @@ -5,12 +5,10 @@ # # This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. +# 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. ## ## Makefile.am ## Run automake to generate a Makefile.in from this file. diff --git a/HDF5Examples/FORTRAN/H5G/h5ex_g_traverse.F90 b/HDF5Examples/FORTRAN/H5G/h5ex_g_traverse.F90 index 198d437003a..ab401ce9164 100644 --- a/HDF5Examples/FORTRAN/H5G/h5ex_g_traverse.F90 +++ b/HDF5Examples/FORTRAN/H5G/h5ex_g_traverse.F90 @@ -84,7 +84,9 @@ RECURSIVE INTEGER(KIND=C_INT) FUNCTION op_func(loc_id, name, info, operator_data CHARACTER(LEN=10) :: space INTEGER :: spaces ! Number of whitespaces to prepend to output INTEGER :: len + INTEGER :: ret_val_func + ret_val_func = 0 ret_val = 0 name_string(1:10) = " " @@ -140,8 +142,8 @@ RECURSIVE INTEGER(KIND=C_INT) FUNCTION op_func(loc_id, name, info, operator_data ptr2 = C_LOC(nextod%recurs) funptr = C_FUNLOC(op_func) CALL h5literate_by_name_f(loc_id, name_string, H5_INDEX_NAME_F, H5_ITER_NATIVE_F, idx, & - funptr, ptr2, ret_val, status) - + funptr, ptr2, ret_val_func, status) + ret_val = INT(ret_val_func,C_INT) ENDIF WRITE(*,'(A)') space(1:spaces)//"}" RETURN diff --git a/HDF5Examples/FORTRAN/H5G/test.sh.in b/HDF5Examples/FORTRAN/H5G/test.sh.in index e2082e99869..d0906df8b6e 100755 --- a/HDF5Examples/FORTRAN/H5G/test.sh.in +++ b/HDF5Examples/FORTRAN/H5G/test.sh.in @@ -6,12 +6,10 @@ # # This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. +# 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. srcdir=@srcdir@ diff --git a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_dataset.F90 b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_dataset.F90 index f7e4185411a..b5c43a88fa5 100644 --- a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_dataset.F90 +++ b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_dataset.F90 @@ -25,9 +25,10 @@ PROGRAM DATASET ! ! MPI definitions and calls. ! - INTEGER :: mpierror ! MPI error flag - INTEGER :: comm, info - INTEGER :: mpi_size, mpi_rank + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI error flag + INTEGER(KIND=MPI_INTEGER_KIND) :: comm, info + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_rank + comm = MPI_COMM_WORLD info = MPI_INFO_NULL CALL MPI_INIT(mpierror) diff --git a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_file_create.F90 b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_file_create.F90 index b5aa090e643..a6965a1f2a1 100644 --- a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_file_create.F90 +++ b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_file_create.F90 @@ -18,9 +18,9 @@ PROGRAM FILE_CREATE ! ! MPI definitions and calls. ! - INTEGER :: mpierror ! MPI error flag - INTEGER :: comm, info - INTEGER :: mpi_size, mpi_rank + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI error flag + INTEGER(KIND=MPI_INTEGER_KIND) :: comm, info + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_rank comm = MPI_COMM_WORLD info = MPI_INFO_NULL diff --git a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_filtered_writes_no_sel.F90 b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_filtered_writes_no_sel.F90 index ffec2fb54b2..4a34d1f2ed0 100644 --- a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_filtered_writes_no_sel.F90 +++ b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_filtered_writes_no_sel.F90 @@ -27,7 +27,7 @@ MODULE filter INTEGER , PARAMETER :: PATH_MAX = 512 ! Global variables - INTEGER :: mpi_rank, mpi_size + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_rank, mpi_size CONTAINS ! @@ -91,10 +91,11 @@ SUBROUTINE cleanup(filename) LOGICAL :: do_cleanup INTEGER :: status + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror CALL get_environment_variable("HDF5_NOCLEANUP", STATUS=status) IF(status.EQ.0)THEN - CALL MPI_File_delete(filename, MPI_INFO_NULL, status) + CALL MPI_File_delete(filename, MPI_INFO_NULL, mpierror) ENDIF END SUBROUTINE cleanup @@ -241,18 +242,19 @@ PROGRAM main USE filter IMPLICIT NONE - INTEGER :: comm = MPI_COMM_WORLD - INTEGER :: info = MPI_INFO_NULL + INTEGER(KIND=MPI_INTEGER_KIND) :: comm = MPI_COMM_WORLD + INTEGER(KIND=MPI_INTEGER_KIND) :: info = MPI_INFO_NULL INTEGER(hid_t) :: file_id INTEGER(hid_t) :: fapl_id INTEGER(hid_t) :: dxpl_id CHARACTER(LEN=PATH_MAX) :: par_prefix CHARACTER(LEN=PATH_MAX) :: filename INTEGER :: status + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror - CALL MPI_Init(status) - CALL MPI_Comm_size(comm, mpi_size, status) - CALL MPI_Comm_rank(comm, mpi_rank, status) + CALL MPI_Init(mpierror) + CALL MPI_Comm_size(comm, mpi_size, mpierror) + CALL MPI_Comm_rank(comm, mpi_rank, mpierror) ! ! Initialize HDF5 library and Fortran interfaces. @@ -349,6 +351,6 @@ PROGRAM main ! ------------------------------------ CALL cleanup(filename) - CALL MPI_Finalize(status) + CALL MPI_Finalize(mpierror) END PROGRAM main diff --git a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_chunk.F90 b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_chunk.F90 index 7be9389e77d..c4f67fee60c 100644 --- a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_chunk.F90 +++ b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_chunk.F90 @@ -34,9 +34,9 @@ PROGRAM DATASET_BY_CHUNK ! ! MPI definitions and calls. ! - INTEGER :: mpierror ! MPI error flag - INTEGER :: comm, info - INTEGER :: mpi_size, mpi_rank + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI error flag + INTEGER(KIND=MPI_INTEGER_KIND) :: comm, info + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_rank comm = MPI_COMM_WORLD info = MPI_INFO_NULL diff --git a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_col.F90 b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_col.F90 index c439d63829f..b7e0b25de16 100644 --- a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_col.F90 +++ b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_col.F90 @@ -30,9 +30,9 @@ PROGRAM DATASET_BY_COL ! ! MPI definitions and calls. ! - INTEGER :: mpierror ! MPI error flag - INTEGER :: comm, info - INTEGER :: mpi_size, mpi_rank + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI error flag + INTEGER(KIND=MPI_INTEGER_KIND) :: comm, info + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_rank comm = MPI_COMM_WORLD info = MPI_INFO_NULL CALL MPI_INIT(mpierror) diff --git a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_pattern.F90 b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_pattern.F90 index c7e8da13a7a..f94c8192d0c 100644 --- a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_pattern.F90 +++ b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_pattern.F90 @@ -36,9 +36,9 @@ PROGRAM DATASET_BY_PATTERN ! ! MPI definitions and calls. ! - INTEGER :: mpierror ! MPI error flag - INTEGER :: comm, info - INTEGER :: mpi_size, mpi_rank + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI error flag + INTEGER(KIND=MPI_INTEGER_KIND) :: comm, info + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_rank comm = MPI_COMM_WORLD info = MPI_INFO_NULL diff --git a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_row.F90 b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_row.F90 index 66d5b250258..f607b482561 100644 --- a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_row.F90 +++ b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_row.F90 @@ -35,9 +35,9 @@ PROGRAM DATASET_BY_ROW ! ! MPI definitions and calls. ! - INTEGER :: mpierror ! MPI error flag - INTEGER :: comm, info - INTEGER :: mpi_size, mpi_rank + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI error flag + INTEGER(KIND=MPI_INTEGER_KIND) :: comm, info + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_rank comm = MPI_COMM_WORLD info = MPI_INFO_NULL diff --git a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_subfiling.F90 b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_subfiling.F90 index fc30717e1b9..866200f3658 100644 --- a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_subfiling.F90 +++ b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_subfiling.F90 @@ -60,8 +60,8 @@ SUBROUTINE subfiling_write_default(fapl_id, mpi_size, mpi_rank) IMPLICIT NONE INTEGER(HID_T) :: fapl_id - INTEGER :: mpi_size - INTEGER :: mpi_rank + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_rank INTEGER, DIMENSION(:), ALLOCATABLE, TARGET :: wdata INTEGER(hsize_t), DIMENSION(1:EXAMPLE_DSET_DIMS) :: dset_dims @@ -171,8 +171,8 @@ SUBROUTINE subfiling_write_custom(fapl_id, mpi_size, mpi_rank) IMPLICIT NONE INTEGER(HID_T) :: fapl_id - INTEGER :: mpi_size - INTEGER :: mpi_rank + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_rank INTEGER, DIMENSION(:), ALLOCATABLE, TARGET :: wdata @@ -304,8 +304,8 @@ SUBROUTINE subfiling_write_precreate(fapl_id, mpi_size, mpi_rank) IMPLICIT NONE INTEGER(HID_T) :: fapl_id - INTEGER :: mpi_size - INTEGER :: mpi_rank + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_rank INTEGER, DIMENSION(:), ALLOCATABLE, TARGET :: wdata TYPE(H5FD_subfiling_config_t) :: subf_config @@ -320,6 +320,7 @@ SUBROUTINE subfiling_write_precreate(fapl_id, mpi_size, mpi_rank) INTEGER :: status INTEGER(SIZE_T) :: i TYPE(C_PTR) :: f_ptr + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! Make a copy of the FAPL so we don't disturb ! it for the other examples @@ -413,7 +414,7 @@ SUBROUTINE subfiling_write_precreate(fapl_id, mpi_size, mpi_rank) CALL H5Fclose_f(file_id, status) ENDIF - CALL MPI_Barrier(MPI_COMM_WORLD, status) + CALL MPI_Barrier(MPI_COMM_WORLD, mpierror) ! ! Use all MPI ranks to re-open the file and @@ -467,26 +468,27 @@ PROGRAM main USE SUBF IMPLICIT NONE - INTEGER :: comm = MPI_COMM_WORLD - INTEGER :: info = MPI_INFO_NULL + INTEGER(KIND=MPI_INTEGER_KIND) :: comm = MPI_COMM_WORLD + INTEGER(KIND=MPI_INTEGER_KIND) :: info = MPI_INFO_NULL INTEGER(HID_T) :: fapl_id - INTEGER :: mpi_size - INTEGER :: mpi_rank - INTEGER :: required - INTEGER :: provided + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_rank + INTEGER(KIND=MPI_INTEGER_KIND) :: required + INTEGER(KIND=MPI_INTEGER_KIND) :: provided + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror INTEGER :: status ! HDF5 Subfiling VFD requires MPI_Init_thread with MPI_THREAD_MULTIPLE required = MPI_THREAD_MULTIPLE provided = 0 - CALL mpi_init_thread(required, provided, status) + CALL mpi_init_thread(required, provided, mpierror) IF (provided .NE. required) THEN WRITE(*,*) "MPI doesn't support MPI_Init_thread with MPI_THREAD_MULTIPLE *FAILED*" - CALL MPI_Abort(comm, -1, status) + CALL MPI_Abort(comm, -1_MPI_INTEGER_KIND, mpierror) ENDIF - CALL MPI_Comm_size(comm, mpi_size, status) - CALL MPI_Comm_rank(comm, mpi_rank, status) + CALL MPI_Comm_size(comm, mpi_size, mpierror) + CALL MPI_Comm_rank(comm, mpi_rank, mpierror) ! ! Initialize HDF5 library and Fortran interfaces. @@ -516,6 +518,6 @@ PROGRAM main IF(mpi_rank .EQ. 0) WRITE(*,"(A)") "PHDF5 example finished with no errors" - CALL MPI_Finalize(status) + CALL MPI_Finalize(mpierror) END PROGRAM main diff --git a/HDF5Examples/FORTRAN/H5T/Makefile.am b/HDF5Examples/FORTRAN/H5T/Makefile.am index 79321f0e92b..7d9d96a89b6 100644 --- a/HDF5Examples/FORTRAN/H5T/Makefile.am +++ b/HDF5Examples/FORTRAN/H5T/Makefile.am @@ -5,12 +5,10 @@ # # This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. +# 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. ## ## Makefile.am ## Run automake to generate a Makefile.in from this file. diff --git a/HDF5Examples/FORTRAN/H5T/h5ex_t_enum_F03.F90 b/HDF5Examples/FORTRAN/H5T/h5ex_t_enum_F03.F90 index b0ba276dfb9..dd480738f4d 100644 --- a/HDF5Examples/FORTRAN/H5T/h5ex_t_enum_F03.F90 +++ b/HDF5Examples/FORTRAN/H5T/h5ex_t_enum_F03.F90 @@ -74,14 +74,14 @@ PROGRAM main ! Insert enumerated value for memtype. ! val = i - CALL h5tenum_insert_f(memtype, TRIM(names(i+1)), val, hdferr) + f_ptr = C_LOC(val) + CALL h5tenum_insert_f(memtype, TRIM(names(i+1)), f_ptr, hdferr) ! ! Insert enumerated value for filetype. We must first convert ! the numerical value val to the base type of the destination. ! - f_ptr = C_LOC(val) CALL h5tconvert_f (M_BASET, F_BASET, INT(1,SIZE_T), f_ptr, hdferr) - CALL h5tenum_insert_f(filetype, TRIM(names(i+1)), val, hdferr) + CALL h5tenum_insert_f(filetype, TRIM(names(i+1)), f_ptr, hdferr) ENDDO ! ! Create dataspace. Setting maximum size to be the current size. @@ -129,7 +129,7 @@ PROGRAM main ! ! Get the name of the enumeration member. ! - CALL h5tenum_nameof_f( memtype, rdata(i,j), NAME_BUF_SIZE, name, hdferr) + CALL h5tenum_nameof_f( memtype, INT(rdata(i,j)), NAME_BUF_SIZE, name, hdferr) WRITE(*,'(" ", A6," ")', ADVANCE='NO') TRIM(NAME) ENDDO WRITE(*,'("]")') diff --git a/HDF5Examples/FORTRAN/H5T/h5ex_t_enumatt_F03.F90 b/HDF5Examples/FORTRAN/H5T/h5ex_t_enumatt_F03.F90 index ec641b3ede6..13a289bd786 100644 --- a/HDF5Examples/FORTRAN/H5T/h5ex_t_enumatt_F03.F90 +++ b/HDF5Examples/FORTRAN/H5T/h5ex_t_enumatt_F03.F90 @@ -75,14 +75,15 @@ PROGRAM main ! Insert enumerated value for memtype. ! val = i - CALL h5tenum_insert_f(memtype, TRIM(names(i+1)), val, hdferr) + f_ptr = C_LOC(val) + CALL h5tenum_insert_f(memtype, TRIM(names(i+1)), f_ptr, hdferr) ! ! Insert enumerated value for filetype. We must first convert ! the numerical value val to the base type of the destination. ! f_ptr = C_LOC(val) CALL h5tconvert_f(M_BASET, F_BASET, INT(1,SIZE_T), f_ptr, hdferr) - CALL h5tenum_insert_f(filetype, TRIM(names(i+1)), val, hdferr) + CALL h5tenum_insert_f(filetype, TRIM(names(i+1)), f_ptr, hdferr) ENDDO ! ! Create dataspace with a null dataspace. @@ -137,7 +138,7 @@ PROGRAM main ! ! Get the name of the enumeration member. ! - CALL h5tenum_nameof_f( memtype, rdata(i,j), NAME_BUF_SIZE, name, hdferr) + CALL h5tenum_nameof_f( memtype, INT(rdata(i,j)), NAME_BUF_SIZE, name, hdferr) WRITE(*,'(" ",A6," ")', ADVANCE='NO') TRIM(NAME) ENDDO WRITE(*,'("]")') diff --git a/HDF5Examples/FORTRAN/H5T/test.sh.in b/HDF5Examples/FORTRAN/H5T/test.sh.in index 368b75aa360..dc1f434923d 100755 --- a/HDF5Examples/FORTRAN/H5T/test.sh.in +++ b/HDF5Examples/FORTRAN/H5T/test.sh.in @@ -6,12 +6,10 @@ # # This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. +# 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. srcdir=@srcdir@ diff --git a/HDF5Examples/FORTRAN/Makefile.am b/HDF5Examples/FORTRAN/Makefile.am index 0048db07032..778f802246c 100644 --- a/HDF5Examples/FORTRAN/Makefile.am +++ b/HDF5Examples/FORTRAN/Makefile.am @@ -5,12 +5,10 @@ # # This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. +# 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. ## ## Makefile.am ## Run automake to generate a Makefile.in from this file. diff --git a/HDF5Examples/JAVA/H5J/110/HDF5FileStructure.java b/HDF5Examples/JAVA/H5J/110/HDF5FileStructure.java index cddad575852..326d94924cf 100644 --- a/HDF5Examples/JAVA/H5J/110/HDF5FileStructure.java +++ b/HDF5Examples/JAVA/H5J/110/HDF5FileStructure.java @@ -5,12 +5,10 @@ * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * + * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ import hdf.hdf5lib.H5; diff --git a/HDF5Examples/JAVA/H5J/HDF5FileStructure.java b/HDF5Examples/JAVA/H5J/HDF5FileStructure.java index 8ea80a80d8a..1370340be1b 100644 --- a/HDF5Examples/JAVA/H5J/HDF5FileStructure.java +++ b/HDF5Examples/JAVA/H5J/HDF5FileStructure.java @@ -5,12 +5,10 @@ * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * + * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ import hdf.hdf5lib.H5; diff --git a/HDF5Examples/JAVA/H5J/HDF5SubsetSelect.java b/HDF5Examples/JAVA/H5J/HDF5SubsetSelect.java index a00f5bed7bd..e302cd18a0d 100644 --- a/HDF5Examples/JAVA/H5J/HDF5SubsetSelect.java +++ b/HDF5Examples/JAVA/H5J/HDF5SubsetSelect.java @@ -5,12 +5,10 @@ * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * + * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ import hdf.hdf5lib.H5; diff --git a/HDF5Examples/JAVA/H5J/Makefile.am b/HDF5Examples/JAVA/H5J/Makefile.am index 6b615a2fb98..fedb82f9d19 100644 --- a/HDF5Examples/JAVA/H5J/Makefile.am +++ b/HDF5Examples/JAVA/H5J/Makefile.am @@ -4,12 +4,10 @@ # # This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. +# 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. ## ## Makefile.am ## Run automake to generate a Makefile.in from this file. diff --git a/HDF5Examples/JAVA/H5J/runExample.sh.in b/HDF5Examples/JAVA/H5J/runExample.sh.in index 3a42b2b5af3..709613d1590 100644 --- a/HDF5Examples/JAVA/H5J/runExample.sh.in +++ b/HDF5Examples/JAVA/H5J/runExample.sh.in @@ -6,12 +6,10 @@ # # This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. +# 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. # top_builddir=@top_builddir@ diff --git a/HDF5Examples/Makefile.am b/HDF5Examples/Makefile.am index 65d97ebd5c5..d8019c9558c 100644 --- a/HDF5Examples/Makefile.am +++ b/HDF5Examples/Makefile.am @@ -5,15 +5,13 @@ # # This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. +# 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. ## ## Makefile.am ## Run automake to generate a Makefile.in from this file. ## -SUBDIRS = C FORTRAN \ No newline at end of file +SUBDIRS = C FORTRAN diff --git a/HDF5Examples/README.md b/HDF5Examples/README.md index 9a658365245..2f0090ba02c 100644 --- a/HDF5Examples/README.md +++ b/HDF5Examples/README.md @@ -19,7 +19,7 @@ HELP AND SUPPORT ---------------- Information regarding Help Desk and Support services is available at - https://portal.hdfgroup.org/display/support/The+HDF+Help+Desk + https://hdfgroup.atlassian.net/servicedesk/customer/portals @@ -48,7 +48,7 @@ HDF5 SNAPSHOTS, PREVIOUS RELEASES AND SOURCE CODE -------------------------------------------- Full Documentation and Programming Resources for this HDF5 can be found at - https://portal.hdfgroup.org/display/HDF5 + https://portal.hdfgroup.org/documentation/index.html Periodically development code snapshots are provided at the following URL: @@ -56,7 +56,7 @@ Periodically development code snapshots are provided at the following URL: Source packages for current and previous releases are located at: - https://portal.hdfgroup.org/display/support/Downloads + https://portal.hdfgroup.org/downloads/ Development code is available at our Github location: diff --git a/HDF5Examples/Using_CMake.txt b/HDF5Examples/Using_CMake.txt index df761cb28db..78751599b33 100644 --- a/HDF5Examples/Using_CMake.txt +++ b/HDF5Examples/Using_CMake.txt @@ -30,7 +30,7 @@ I. Preconditions 1. We suggest you obtain the latest CMake for windows from the Kitware web site. The HDF5 product requires a minimum CMake version - of 3.12. + of 3.18. 2. You have installed the HDF5 library built with CMake, by executing the HDF Install Utility (the *.msi file in the binary package for @@ -45,7 +45,7 @@ I. Preconditions (Note there are no quote characters used on Windows and all platforms use forward slashes) - 4. Created separate source and build directories. + 4. Create separate source and build directories. (CMake commands are executed in the build directory) diff --git a/HDF5Examples/configure.ac b/HDF5Examples/configure.ac index 80f0b6839e7..babfdecc624 100644 --- a/HDF5Examples/configure.ac +++ b/HDF5Examples/configure.ac @@ -7,12 +7,10 @@ # # This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. +# 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. AC_PREREQ(2.69) AC_INIT(HDF5-examples, 0.1, help@hdfgroup.org) diff --git a/acsite.m4 b/acsite.m4 new file mode 100644 index 00000000000..1782033dc84 --- /dev/null +++ b/acsite.m4 @@ -0,0 +1,53 @@ +dnl ------------------------------------------------------------------------- +dnl ------------------------------------------------------------------------- +dnl +dnl Copyright by The HDF Group. +dnl All rights reserved. +dnl +dnl This file is part of HDF5. The full HDF5 copyright notice, including +dnl terms governing use, modification, and redistribution, is contained in +dnl the COPYING file, which can be found at the root of the source code +dnl dnl distribution tree, or in https://www.hdfgroup.org/licenses. +dnl dnl If you do not have access to either file, you may request a copy from +dnl dnl help@hdfgroup.org. +dnl +dnl Macros for HDF5 Fortran +dnl +dnl ------------------------------------------------------------------------- +dnl ------------------------------------------------------------------------- + +dnl ------------------------------------------------------------------------- +dnl _AC_SYS_LARGEFILE_MACRO_VALUE +dnl +dnl The following macro overrides the autoconf macro of the same name +dnl with this custom definition. This macro performs the same checks as +dnl autoconf's native _AC_SYS_LARGEFILE_MACRO_VALUE, but will also set +dnl AM_CPPFLAGS with the appropriate -D defines so additional configure +dnl sizeof checks do not fail. +dnl +# _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, +# CACHE-VAR, +# DESCRIPTION, +# PROLOGUE, [FUNCTION-BODY]) +# ---------------------------------------------------------- +m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE], +[AC_CACHE_CHECK([for $1 value needed for large files], [$3], +[while :; do + m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])( + [AC_LANG_PROGRAM([$5], [$6])], + [$3=no; break]) + m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])( + [AC_LANG_PROGRAM([@%:@define $1 $2 +$5], [$6])], + [$3=$2; break]) + $3=unknown + break +done]) +case $$3 in #( + no | unknown) ;; + *) AC_DEFINE_UNQUOTED([$1], [$$3], [$4]) + AM_CPPFLAGS="-D$1=$$3 $AM_CPPFLAGS";; +esac +rm -rf conftest*[]dnl +])# _AC_SYS_LARGEFILE_MACRO_VALUE + diff --git a/bin/h5vers b/bin/h5vers index 7a07f68d75c..a23b739511a 100755 --- a/bin/h5vers +++ b/bin/h5vers @@ -184,6 +184,10 @@ die "unable to read file: $README\n" unless -r $file; my $RELEASE = $file; $RELEASE =~ s/[^\/]*$/..\/release_docs\/RELEASE.txt/; die "unable to read file: $RELEASE\n" unless -r $file; +# release_docs/NEWSLETTER.txt +my $NEWS = $file; +$NEWS =~ s/[^\/]*$/..\/release_docs\/NEWSLETTER.txt/; +die "unable to read file: $NEWS\n" unless -r $file; # configure.ac my $CONFIGURE = $file; $CONFIGURE =~ s/[^\/]*$/..\/configure.ac/; @@ -247,6 +251,7 @@ if ($set) { # Nothing to do but print result $README = ""; $RELEASE = ""; + $NEWS = ""; $CONFIGURE = ""; $CPP_DOC_CONFIG = ""; $LT_VERS = ""; @@ -329,6 +334,20 @@ if ($RELEASE) { close FILE; } +# Update the release_docs/NEWSLETTER.txt file +if ($NEWS) { + open FILE, $NEWS or die "$NEWS: $!\n"; + my @contents = ; + close FILE; + $contents[0] = sprintf("HDF5 version %d.%d.%d%s %s", + @newver[0,1,2], + $newver[3] eq "" ? "" : "-".$newver[3], + "currently under development\n"); + open FILE, ">$NEWS" or die "$NEWS: $!\n"; + print FILE @contents; + close FILE; +} + # Update the c++/src/cpp_doc_config file if ($CPP_DOC_CONFIG) { my $data = read_file($CPP_DOC_CONFIG); diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index 2f011d01ac7..5135e0c7fa7 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -1406,17 +1406,23 @@ test_attr_dtype_shared(FileAccPropList &fapl) SUBTEST("Shared Datatypes with Attributes"); try { + h5_stat_size_t empty_filesize = 0; // Size of empty file + bool is_default_vfd_compat = false; + // Create a file H5File fid1(FILE_DTYPE, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl); // Close file fid1.close(); - // Get size of file - h5_stat_size_t empty_filesize; // Size of empty file - empty_filesize = h5_get_file_size(FILE_DTYPE.c_str(), H5P_DEFAULT); - if (empty_filesize < 0) - TestErrPrintf("Line %d: file size wrong!\n", __LINE__); + h5_driver_is_default_vfd_compatible(H5P_DEFAULT, &is_default_vfd_compat); + + if (is_default_vfd_compat) { + // Get size of file + empty_filesize = h5_get_file_size(FILE_DTYPE.c_str(), H5P_DEFAULT); + if (empty_filesize < 0) + TestErrPrintf("Line %d: file size wrong!\n", __LINE__); + } // Open the file again fid1.openFile(FILE_DTYPE, H5F_ACC_RDWR); @@ -1533,10 +1539,12 @@ test_attr_dtype_shared(FileAccPropList &fapl) // Close file fid1.close(); - // Check size of file - filesize = h5_get_file_size(FILE_DTYPE.c_str(), H5P_DEFAULT); - verify_val(static_cast(filesize), static_cast(empty_filesize), "Checking file size", - __LINE__, __FILE__); + if (is_default_vfd_compat) { + // Check size of file + filesize = h5_get_file_size(FILE_DTYPE.c_str(), H5P_DEFAULT); + verify_val(static_cast(filesize), static_cast(empty_filesize), "Checking file size", + __LINE__, __FILE__); + } PASSED(); } // end try block diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 0eee171617f..aea3fd62443 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -119,10 +119,7 @@ CHECK_INCLUDE_FILE_CONCAT ("features.h" ${HDF_PREFIX}_HAVE_FEATURES_H) CHECK_INCLUDE_FILE_CONCAT ("dirent.h" ${HDF_PREFIX}_HAVE_DIRENT_H) CHECK_INCLUDE_FILE_CONCAT ("unistd.h" ${HDF_PREFIX}_HAVE_UNISTD_H) CHECK_INCLUDE_FILE_CONCAT ("pwd.h" ${HDF_PREFIX}_HAVE_PWD_H) -CHECK_INCLUDE_FILE_CONCAT ("globus/common.h" ${HDF_PREFIX}_HAVE_GLOBUS_COMMON_H) -CHECK_INCLUDE_FILE_CONCAT ("pdb.h" ${HDF_PREFIX}_HAVE_PDB_H) CHECK_INCLUDE_FILE_CONCAT ("pthread.h" ${HDF_PREFIX}_HAVE_PTHREAD_H) -CHECK_INCLUDE_FILE_CONCAT ("srbclient.h" ${HDF_PREFIX}_HAVE_SRBCLIENT_H) CHECK_INCLUDE_FILE_CONCAT ("dlfcn.h" ${HDF_PREFIX}_HAVE_DLFCN_H) CHECK_INCLUDE_FILE_CONCAT ("netinet/in.h" ${HDF_PREFIX}_HAVE_NETINET_IN_H) CHECK_INCLUDE_FILE_CONCAT ("netdb.h" ${HDF_PREFIX}_HAVE_NETDB_H) @@ -908,12 +905,24 @@ if (${HDF_PREFIX}_SIZEOF__FLOAT16) # compile a program that will generate these functions to check for _Float16 # support. If we fail to compile this program, we will simply disable # _Float16 support for the time being. + + # Some compilers, notably AppleClang on MacOS 12, will succeed in the + # configure check below when optimization flags like -O3 are manually + # passed in CMAKE_C_FLAGS. However, the build will then fail when it + # reaches compilation of H5Tconv.c because of the issue mentioned above. + # MacOS 13 appears to have fixed this, but, just to be sure, backup and + # clear CMAKE_C_FLAGS before performing these configure checks. + set (cmake_c_flags_backup "${CMAKE_C_FLAGS}") + set (CMAKE_C_FLAGS "") + H5ConversionTests ( ${HDF_PREFIX}_FLOAT16_CONVERSION_FUNCS_LINK FALSE "Checking if compiler can convert _Float16 type with casts" ) + set (CMAKE_C_FLAGS "${cmake_c_flags_backup}") + if (${${HDF_PREFIX}_FLOAT16_CONVERSION_FUNCS_LINK}) # Finally, MacOS 13 appears to have a bug specifically when converting # long double values to _Float16. Release builds of the dt_arith test @@ -922,12 +931,19 @@ if (${HDF_PREFIX}_SIZEOF__FLOAT16) # simply chopping off all the bytes of the value except for the first 2. # These tests pass on MacOS 14, so let's perform a quick test to check # if the hardware conversion is done correctly. + + # Backup and clear CMAKE_C_FLAGS before performing configure checks + set (cmake_c_flags_backup "${CMAKE_C_FLAGS}") + set (CMAKE_C_FLAGS "") + H5ConversionTests ( ${HDF_PREFIX}_LDOUBLE_TO_FLOAT16_CORRECT TRUE "Checking if correctly converting long double to _Float16 values" ) + set (CMAKE_C_FLAGS "${cmake_c_flags_backup}") + if (NOT ${${HDF_PREFIX}_LDOUBLE_TO_FLOAT16_CORRECT}) message (VERBOSE "Conversions from long double to _Float16 appear to be incorrect. These will be emulated through a soft conversion function.") endif () diff --git a/config/cmake/HDF5Macros.cmake b/config/cmake/HDF5Macros.cmake index 54543e0c715..e17d6bc46b2 100644 --- a/config/cmake/HDF5Macros.cmake +++ b/config/cmake/HDF5Macros.cmake @@ -70,8 +70,17 @@ macro (H5_SET_VFD_LIST) split multi family - splitter - #log - log VFD currently has file space allocation bugs + # Splitter VFD currently can't be tested with the h5_fileaccess() + # approach due to it trying to lock the same W/O file when two + # files are created/opened with the same FAPL that has the VFD + # set on it. When tested with the environment variable and a + # default FAPL, the VFD appends "_wo" to the filename when the + # W/O path isn't specified, which works for all the tests. + #splitter + # Log VFD currently has file space allocation bugs + #log + # Onion VFD not currently tested with VFD tests + #onion ) if (H5_HAVE_DIRECT) @@ -82,16 +91,21 @@ macro (H5_SET_VFD_LIST) # list (APPEND VFD_LIST mpio) endif () if (H5_HAVE_MIRROR_VFD) - list (APPEND VFD_LIST mirror) + # Mirror VFD needs network configuration, etc. and isn't easy to set + # reasonable defaults for that info. + # list (APPEND VFD_LIST mirror) endif () if (H5_HAVE_ROS3_VFD) - list (APPEND VFD_LIST ros3) + # This would require a custom test suite + # list (APPEND VFD_LIST ros3) endif () if (H5_HAVE_LIBHDFS) - list (APPEND VFD_LIST hdfs) + # This would require a custom test suite + # list (APPEND VFD_LIST hdfs) endif () if (H5_HAVE_SUBFILING_VFD) - list (APPEND VFD_LIST subfiling) + # Subfiling has a few VFD test failures to be resolved + # list (APPEND VFD_LIST subfiling) endif () if (H5_HAVE_WINDOWS) list (APPEND VFD_LIST windows) diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index 73b4f742b48..f22d8d2c390 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -50,9 +50,15 @@ macro (FORTRAN_RUN FUNCTION_NAME SOURCE_CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR1 else () set (_RUN_OUTPUT_VARIABLE "RUN_OUTPUT_STDOUT_VARIABLE") endif() + if (${FUNCTION_NAME} STREQUAL "SIZEOF NATIVE KINDs") + set(TMP_CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}") + else () + set(TMP_CMAKE_Fortran_FLAGS "") + endif () TRY_RUN (RUN_RESULT_VAR COMPILE_RESULT_VAR ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler1.f90 + CMAKE_FLAGS "${TMP_CMAKE_Fortran_FLAGS}" LINK_LIBRARIES "${HDF5_REQUIRED_LIBRARIES}" ${_RUN_OUTPUT_VARIABLE} OUTPUT_VAR ) @@ -111,6 +117,16 @@ else () set (${HDF_PREFIX}_FORTRAN_C_BOOL_IS_UNIQUE 0) endif () +# Check if the fortran compiler supports the intrinsic module "ISO_FORTRAN_ENV" (F08) + +READ_SOURCE("PROGRAM PROG_FC_ISO_FORTRAN_ENV" "END PROGRAM PROG_FC_ISO_FORTRAN_ENV" SOURCE_CODE) +check_fortran_source_compiles (${SOURCE_CODE} HAVE_ISO_FORTRAN_ENV SRC_EXT f90) +if (${HAVE_ISO_FORTRAN_ENV}) + set (${HDF_PREFIX}_HAVE_ISO_FORTRAN_ENV 1) +else () + set (${HDF_PREFIX}_HAVE_ISO_FORTRAN_ENV 0) +endif () + ## Set the sizeof function for use later in the fortran tests if (${HDF_PREFIX}_FORTRAN_HAVE_STORAGE_SIZE) set (FC_SIZEOF_A "STORAGE_SIZE(a, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)") diff --git a/config/cmake/HDFUseFortran.cmake b/config/cmake/HDFUseFortran.cmake index 2d53a506124..dd35c07531d 100644 --- a/config/cmake/HDFUseFortran.cmake +++ b/config/cmake/HDFUseFortran.cmake @@ -80,7 +80,8 @@ set (CHAR_ALLOC set (ISO_FORTRAN_ENV_CODE " PROGRAM main - USE, INTRINSIC :: ISO_FORTRAN_ENV + USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : atomic_logical_kind + LOGICAL(KIND=atomic_logical_kind) :: state END PROGRAM " ) diff --git a/config/cmake/README.md.cmake.in b/config/cmake/README.md.cmake.in index 5ba93f356ba..7f6af3646a2 100644 --- a/config/cmake/README.md.cmake.in +++ b/config/cmake/README.md.cmake.in @@ -67,7 +67,7 @@ To test the installation with the examples; ctest -S HDF5_Examples.cmake,CTEST_SOURCE_NAME=MyExamples,INSTALLDIR=MyLocation -C Release -V -O test.log When executed, the ctest script will save the results to the log file, test.log, as -indicated by the ctest command. If you wish the to see more build and test information, +indicated by the ctest command. If you wish to see more build and test information, add "-VV" to the ctest command. The output should show; 100% tests passed, 0 tests failed out of 156. diff --git a/config/conclude.am b/config/conclude.am index a1fda99ba35..9b73ae77792 100644 --- a/config/conclude.am +++ b/config/conclude.am @@ -155,15 +155,15 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: if test -n "$(HDF5_VOL_CONNECTOR)"; then \ echo "VOL connector: $(HDF5_VOL_CONNECTOR)" | tee -a $${log}; \ fi; \ - if test -n "$(HDF5_DRIVER)"; then \ - echo "Virtual file driver (VFD): $(HDF5_DRIVER)" | tee -a $${log}; \ + if test -n "$(HDF5_TEST_DRIVER)"; then \ + echo "Virtual file driver (VFD): $(HDF5_TEST_DRIVER)" | tee -a $${log}; \ fi; \ else \ if test -n "$(HDF5_VOL_CONNECTOR)"; then \ echo "VOL connector: $(HDF5_VOL_CONNECTOR)" >> $${log}; \ fi; \ - if test -n "$(HDF5_DRIVER)"; then \ - echo "Virtual file driver (VFD): $(HDF5_DRIVER)" >> $${log}; \ + if test -n "$(HDF5_TEST_DRIVER)"; then \ + echo "Virtual file driver (VFD): $(HDF5_TEST_DRIVER)" >> $${log}; \ fi; \ fi; \ if test -n "$(REALTIMEOUTPUT)"; then \ @@ -276,11 +276,22 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS) echo "===Parallel tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\ fi -VFD_LIST = sec2 stdio core core_paged split multi family splitter +VFD_LIST = sec2 stdio core core_paged split multi family + +# Splitter VFD currently can't be tested with the h5_fileaccess() +# approach due to it trying to lock the same W/O file when two +# files are created/opened with the same FAPL that has the VFD +# set on it. When tested with the environment variable and a +# default FAPL, the VFD appends "_wo" to the filename when the +# W/O path isn't specified, which works for all the tests. +# VFD_LIST += splitter # log VFD currently has file space allocation bugs # VFD_LIST += log +# Not currently tested with VFD tests +# VFD_LIST += onion + if DIRECT_VFD_CONDITIONAL VFD_LIST += direct endif @@ -302,21 +313,20 @@ if HDFS_VFD_CONDITIONAL # VFD_LIST += hdfs endif if SUBFILING_VFD_CONDITIONAL - # Several VFD tests fail with Subfiling since it - # doesn't currently support collective I/O + # Subfiling has a few VFD test failures to be resolved # VFD_LIST += subfiling endif # Run test with different Virtual File Driver check-vfd: $(LIB) $(PROGS) $(chk_TESTS) - @for vfd in $(VFD_LIST) dummy; do \ - if test $$vfd != dummy; then \ - echo "============================"; \ - echo "Testing Virtual File Driver $$vfd"; \ - echo "============================"; \ - $(MAKE) $(AM_MAKEFLAGS) check-clean || exit 1; \ - HDF5_DRIVER=$$vfd $(MAKE) $(AM_MAKEFLAGS) check || exit 1; \ - fi; \ + @for vfd in $(VFD_LIST) dummy; do \ + if test $$vfd != dummy; then \ + echo "============================"; \ + echo "Testing Virtual File Driver $$vfd"; \ + echo "============================"; \ + $(MAKE) $(AM_MAKEFLAGS) check-clean || exit 1; \ + HDF5_TEST_DRIVER=$$vfd $(MAKE) $(AM_MAKEFLAGS) check || exit 1; \ + fi; \ done # Test with just the native connector, with a single pass-through connector diff --git a/configure.ac b/configure.ac index 6e54d8075e5..84e5c3389a3 100644 --- a/configure.ac +++ b/configure.ac @@ -198,21 +198,36 @@ saved_user_CPPFLAGS="$CPPFLAGS" ## ## Regex: ## -## -Werror Literal -Werror -## \( Start optional capturing group -## = Literal equals sign -## [^[:space:]-] Non-space characters -## \+ 1 or more of the above -## \) End optional capturing group -## \? 0 or 1 capturing group matches +## -Werror Literal -Werror +## \( Start optional capturing group +## = Literal equals sign +## [^[:space:]] Non-space characters +## \+ 1 or more of the above +## \) End optional capturing group +## \? 0 or 1 capturing group matches ## -WERROR_SED= "sed -e 's/-Werror\(=[^[:space:]]\+\)\?//g'" - -CFLAGS="`echo $CFLAGS | $WERROR_SED`" -CXXFLAGS="`echo $CXXFLAGS | $WERROR_SED`" -FCFLAGS="`echo $FCFLAGS | $WERROR_SED`" -JAVACFLAGS="`echo $JAVACFLAGS | $WERROR_SED`" -CPPFLAGS="`echo $CPPFLAGS | $WERROR_SED`" +## Note that the outer pair of '[]' ends up getting removed +WERROR_SED='s/-Werror\(=[[^[:space:]]]\+\)\?//g' +CFLAGS_SED="`echo $CFLAGS | sed -e $WERROR_SED`" +if test $? -eq 0; then + CFLAGS="$CFLAGS_SED" +fi +CXXFLAGS_SED="`echo $CXXFLAGS | sed -e $WERROR_SED`" +if test $? -eq 0; then + CXXFLAGS="$CXXFLAGS_SED" +fi +FCFLAGS_SED="`echo $FCFLAGS | sed -e $WERROR_SED`" +if test $? -eq 0; then + FCFLAGS="$FCFLAGS_SED" +fi +JAVACFLAGS_SED="`echo $JAVACFLAGS | sed -e $WERROR_SED`" +if test $? -eq 0; then + JAVACFLAGS="$JAVACFLAGS_SED" +fi +CPPFLAGS_SED="`echo $CPPFLAGS | sed -e $WERROR_SED`" +if test $? -eq 0; then + CPPFLAGS="$CPPFLAGS_SED" +fi ## Support F9X variable to define Fortran compiler if FC variable is ## not used. This should be deprecated in the future. @@ -786,6 +801,15 @@ if test "X$HDF_FORTRAN" = "Xyes"; then ## See if the fortran compiler supports the intrinsic function "STORAGE_SIZE" PAC_PROG_FC_STORAGE_SIZE + ## -------------------------------------------------------------------- + ## Checking if the fortran compiler supports ISO_FORTRAN_ENV (Fortran 2008) + HAVE_ISO_FORTRAN_ENV="0" + PAC_PROG_FC_ISO_FORTRAN_ENV + if test "X$CHECK_ISO_FORTRAN_ENV" = "Xyes"; then + HAVE_ISO_FORTRAN_ENV="1" + AC_DEFINE([HAVE_ISO_FORTRAN_ENV], [1], [Define if Fortran supports ISO_FORTRAN_ENV (F08)]) + fi + ## Set the sizeof function for use later in the fortran tests if test "X$HAVE_STORAGE_SIZE_FORTRAN" = "Xyes";then FC_SIZEOF_A="STORAGE_SIZE(a, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)" @@ -802,8 +826,6 @@ if test "X$HDF_FORTRAN" = "Xyes"; then fi fi - ## See if the fortran compiler supports the intrinsic module "ISO_FORTRAN_ENV" - PAC_PROG_FC_ISO_FORTRAN_ENV ## Check KIND and size of native integer PAC_FC_NATIVE_INTEGER @@ -829,6 +851,7 @@ if test "X$HDF_FORTRAN" = "Xyes"; then AC_SUBST([FORTRAN_HAVE_C_LONG_DOUBLE]) AC_SUBST([FORTRAN_C_LONG_DOUBLE_IS_UNIQUE]) AC_SUBST([FORTRAN_C_BOOL_IS_UNIQUE]) + AC_SUBST([HAVE_ISO_FORTRAN_ENV]) AC_SUBST([H5CONFIG_F_NUM_RKIND]) AC_SUBST([H5CONFIG_F_RKIND]) AC_SUBST([H5CONFIG_F_RKIND_SIZEOF]) @@ -1576,9 +1599,33 @@ if test "X${enable_shared}" = "Xyes"; then fi ## ---------------------------------------------------------------------- -## Set up large file support - -AC_SYS_LARGEFILE +## Use the macro _AC_SYS_LARGEFILE_MACRO_VALUE to test defines +## that might need to be set for largefile support to behave +## correctly. This macro is defined in acsite.m4 and overrides +## the version provided by Autoconf (as of v2.65). The custom +## macro additionally adds the appropriate defines to AM_CPPFLAGS +## so that later configure checks have them visible. +## +## NOTE: AC_SYS_LARGEFILE is buggy on some platforms and will +## NOT set the defines, even though it correctly detects +## the necessary values. These macro hacks are annoying +## but unfortunately will be necessary until we decide +## to drop support for platforms that don't have 64-bit +## off_t defaults. + +## Check for _FILE_OFFSET_BITS +_AC_SYS_LARGEFILE_MACRO_VALUE([_FILE_OFFSET_BITS], [64], + [ac_cv_sys_file_offset_bits], + [Number of bits in a file offset, on hosts where this is settable.], + [_AC_SYS_LARGEFILE_TEST_INCLUDES]) + +## Check for _LARGE_FILES +if test "$ac_cv_sys_file_offset_bits" = unknown; then + _AC_SYS_LARGEFILE_MACRO_VALUE([_LARGE_FILES], [1], + [ac_cv_sys_large_files], + [Define for large files, on AIX-style hosts.], + [_AC_SYS_LARGEFILE_TEST_INCLUDES]) +fi ## ---------------------------------------------------------------------- ## Add necessary defines for Linux Systems. diff --git a/doc/getting-started-with-hdf5-development.md b/doc/getting-started-with-hdf5-development.md index b6771dca76e..687a1ea7cca 100644 --- a/doc/getting-started-with-hdf5-development.md +++ b/doc/getting-started-with-hdf5-development.md @@ -726,7 +726,7 @@ are others in `h5test.h` if you want to emit custom text, dump the HDF5 error stack when it would not normally be triggered, etc. Most tests will be set up to run with arbitrary VFDs. To do this, you set the -fapl ID using the `h5_fileaccess()` function, which will check the `HDF5_DRIVER` +fapl ID using the `h5_fileaccess()` function, which will check the `HDF5_TEST_DRIVER` environment variable and set the fapl's VFD accordingly. The `h5_fixname()` call can then be used to get a VFD-appropriate filename for the `H5Fcreate()`, etc. call. diff --git a/doc/parallel-compression.md b/doc/parallel-compression.md index 25d491164cf..dc68ea4e081 100644 --- a/doc/parallel-compression.md +++ b/doc/parallel-compression.md @@ -154,7 +154,7 @@ optimal performance out of the parallel compression feature. ### Begin with a good chunking strategy -[Starting with a good chunking strategy](https://portal.hdfgroup.org/display/HDF5/Chunking+in+HDF5) +[Starting with a good chunking strategy](https://portal.hdfgroup.org/documentation/hdf5-docs/chunking_in_hdf5.html) will generally have the largest impact on overall application performance. The different chunking parameters can be difficult to fine-tune, but it is essential to start with a well-performing @@ -166,7 +166,7 @@ chosen chunk size becomes a very important factor when compression is involved, as data chunks have to be completely read and re-written to perform partial writes to the chunk. -[Improving I/O performance with HDF5 compressed datasets](https://portal.hdfgroup.org/display/HDF5/Improving+IO+Performance+When+Working+with+HDF5+Compressed+Datasets) +[Improving I/O performance with HDF5 compressed datasets](https://docs.hdfgroup.org/archive/support/HDF5/doc/TechNotes/TechNote-HDF5-ImprovingIOPerformanceCompressedDatasets.pdf) is a useful reference for more information on getting good performance when using a chunked dataset layout. diff --git a/doxygen/aliases b/doxygen/aliases index ad868432bee..71d0d67709a 100644 --- a/doxygen/aliases +++ b/doxygen/aliases @@ -234,14 +234,14 @@ ALIASES += sa_metadata_ops="\sa \li H5Pget_all_coll_metadata_ops() \li H5Pget_co # References ################################################################################ -ALIASES += ref_cons_semantics="Enabling a Strict Consistency Semantics Model in Parallel HDF5" -ALIASES += ref_file_image_ops="HDF5 File Image Operations" +ALIASES += ref_cons_semantics="Enabling a Strict Consistency Semantics Model in Parallel HDF5" +ALIASES += ref_file_image_ops="HDF5 File Image Operations" ALIASES += ref_filter_pipe="Data Flow Pipeline for H5Dread()" -ALIASES += ref_group_impls="Group implementations in HDF5" -ALIASES += ref_h5lib_relver="HDF5 Library Release Version Numbers" +ALIASES += ref_group_impls="Group implementations in HDF5" +ALIASES += ref_h5lib_relver="HDF5 Library Release Version Numbers" ALIASES += ref_mdc_in_hdf5="Metadata Caching in HDF5" ALIASES += ref_mdc_logging="Metadata Cache Logging" -ALIASES += ref_news_112="New Features in HDF5 Release 1.12" +ALIASES += ref_news_112="New Features in HDF5 Release 1.12" ALIASES += ref_h5ocopy="Copying Committed Datatypes with H5Ocopy()" ALIASES += ref_sencode_fmt_change="RFC H5Secnode() / H5Sdecode() Format Change" ALIASES += ref_vlen_strings="\Emph{Creating variable-length string datatypes}" diff --git a/doxygen/dox/About.dox b/doxygen/dox/About.dox index 06fbb3cdb87..e60e0fbdc7a 100644 --- a/doxygen/dox/About.dox +++ b/doxygen/dox/About.dox @@ -81,7 +81,7 @@ as a general reference. All custom commands for this project are located in the aliases -file in the doxygen +file in the doxygen subdirectory of the main HDF5 repo. The custom commands are grouped in sections. Find a suitable section for your command or @@ -124,4 +124,4 @@ version. Talk to your friendly IT-team if you need write access, or you need someone to push an updated version for you! -*/ \ No newline at end of file +*/ diff --git a/doxygen/dox/GettingStarted.dox b/doxygen/dox/GettingStarted.dox index 87f3566361e..58f71f82a4e 100644 --- a/doxygen/dox/GettingStarted.dox +++ b/doxygen/dox/GettingStarted.dox @@ -42,7 +42,7 @@ Parallel HDF5, and the HDF5-1.10 VDS and SWMR new features: diff --git a/doxygen/dox/IntroHDF5.dox b/doxygen/dox/IntroHDF5.dox index afe534be614..4a00b80b2f8 100644 --- a/doxygen/dox/IntroHDF5.dox +++ b/doxygen/dox/IntroHDF5.dox @@ -608,7 +608,7 @@ on the HDF-EOS Tools and Information Center pag \section secHDF5Examples Examples \li \ref LBExamples \li \ref ExAPI -\li Examples in the Source Code +\li Examples in the Source Code \li Other Examples \section secHDF5ExamplesCompile How To Compile diff --git a/doxygen/dox/LearnBasics3.dox b/doxygen/dox/LearnBasics3.dox index 195213b9fd0..67a4b12e106 100644 --- a/doxygen/dox/LearnBasics3.dox +++ b/doxygen/dox/LearnBasics3.dox @@ -166,7 +166,7 @@ created the dataset layout cannot be changed. The h5repack utility can be used t to a new with a new layout. \section secLBDsetLayoutSource Sources of Information -Chunking in HDF5 +Chunking in HDF5 (See the documentation on Advanced Topics in HDF5) \see \ref sec_plist in the HDF5 \ref UG. @@ -184,7 +184,7 @@ certain initial dimensions, then to later increase the size of any of the initia HDF5 requires you to use chunking to define extendible datasets. This makes it possible to extend datasets efficiently without having to excessively reorganize storage. (To use chunking efficiently, -be sure to see the advanced topic, Chunking in HDF5.) +be sure to see the advanced topic, Chunking in HDF5.) The following operations are required in order to extend a dataset: \li Declare the dataspace of the dataset to have unlimited dimensions for all dimensions that might eventually be extended. @@ -224,7 +224,7 @@ Navigate back: \ref index "Main" / \ref GettingStarted / \ref LearnBasics \section secLBComDsetCreate Creating a Compressed Dataset HDF5 requires you to use chunking to create a compressed dataset. (To use chunking efficiently, -be sure to see the advanced topic, Chunking in HDF5.) +be sure to see the advanced topic, Chunking in HDF5.) The following operations are required in order to create a compressed dataset: \li Create a dataset creation property list. @@ -294,12 +294,12 @@ Specifically look at the \ref ExAPI. There are examples for different languages, where examples of using #H5Literate and #H5Ovisit/#H5Lvisit are included. The h5ex_g_traverse example traverses a file using H5Literate: -\li C: h5ex_g_traverse.c -\li F90: h5ex_g_traverse_F03.f90 +\li C: h5ex_g_traverse.c +\li F90: h5ex_g_traverse_F03.f90 The h5ex_g_visit example traverses a file using H5Ovisit and H5Lvisit: -\li C: h5ex_g_visit.c -\li F90: h5ex_g_visit_F03.f90 +\li C: h5ex_g_visit.c +\li F90: h5ex_g_visit_F03.f90
Navigate back: \ref index "Main" / \ref GettingStarted / \ref LearnBasics diff --git a/doxygen/dox/LearnHDFView.dox b/doxygen/dox/LearnHDFView.dox index b1f632caed2..2916db841e6 100644 --- a/doxygen/dox/LearnHDFView.dox +++ b/doxygen/dox/LearnHDFView.dox @@ -7,7 +7,7 @@ This tutorial enables you to get a feel for HDF5 by using the HDFView browser. I any programming experience. \section sec_learn_hv_install HDFView Installation -\li Download and install HDFView. It can be downloaded from the Download HDFView page. +\li Download and install HDFView. It can be downloaded from the Download HDFView page. \li Obtain the storm1.txt text file, used in the tutorial. \section sec_learn_hv_begin Begin Tutorial @@ -246,7 +246,7 @@ in the file). Please note that the chunk sizes used in this topic are for demonstration purposes only. For information on chunking and specifying an appropriate chunk size, see the -Chunking in HDF5 documentation. +Chunking in HDF5 documentation. Also see the HDF5 Tutorial topic on \ref secLBComDsetCreate.
    diff --git a/doxygen/dox/UsersGuide.dox b/doxygen/dox/UsersGuide.dox index b6113ad15bd..3dd26f1a40a 100644 --- a/doxygen/dox/UsersGuide.dox +++ b/doxygen/dox/UsersGuide.dox @@ -374,7 +374,7 @@ These documents provide additional information for the use and tuning of specifi
-Using the High Level APIs +Using the High Level APIs \ref H5LT \ref H5IM \ref H5TB \ref H5PT \ref H5DS @@ -72,7 +72,7 @@ HDF5-1.10 New Features \li Introduction to the Virtual Dataset - VDS -\li Introduction to Single-Writer/Multiple-Reader (SWMR) +\li Introduction to Single-Writer/Multiple-Reader (SWMR)
-

HDF5 Dynamically Loaded Filters

+

HDF5 Dynamically Loaded Filters

Describes how an HDF5 application can apply a filter that is not registered with the HDF5 Library.

@@ -382,7 +382,7 @@ These documents provide additional information for the use and tuning of specifi
-

HDF5 File Image Operations

+

HDF5 File Image Operations

Describes how to work with HDF5 files in memory. Disk I/O is not required when file images are opened, created, read from, or written to.

@@ -390,7 +390,7 @@ These documents provide additional information for the use and tuning of specifi
-

Modified Region Writes

+

Modified Region Writes

Describes how to set write operations for in-memory files so that only modified regions are written to storage. Available when the Core (Memory) VFD is used.

@@ -438,4 +438,4 @@ Previous Chapter \ref sec_plist HDF5 repo, make changes, and create a pull request !\n -*/ \ No newline at end of file +*/ diff --git a/doxygen/dox/VOLConnGuide.dox b/doxygen/dox/VOLConnGuide.dox index fb662a0ef5a..7a03ab1590d 100644 --- a/doxygen/dox/VOLConnGuide.dox +++ b/doxygen/dox/VOLConnGuide.dox @@ -92,7 +92,7 @@ Public header Files you will need to be familiar with include:
Many VOL connectors are listed on The HDF Group's VOL plugin registration page, located at: -Registered VOL Connectors. +Registered VOL Connectors. Not all of these VOL connectors are supported by The HDF Group and the level of completeness varies, but the connectors found there can serve as examples of working implementations @@ -195,7 +195,7 @@ contact help@hdfgroup.org for help with this. We name you've chosen will appear on the registered VOL connectors page. As noted above, registered VOL connectors will be listed at: -Registered VOL Connectors +Registered VOL Connectors A new \b conn_version field has been added to the class struct for 1.13. This field is currently not used by the library so its use is determined by the connector author. Best practices for this field will be determined diff --git a/doxygen/dox/ViewTools.dox b/doxygen/dox/ViewTools.dox index 951605674be..f4c31c83663 100644 --- a/doxygen/dox/ViewTools.dox +++ b/doxygen/dox/ViewTools.dox @@ -48,7 +48,7 @@ Navigate back: \ref index "Main" / \ref GettingStarted \section secViewToolsCommandObtain Obtain Tools and Files (Optional) Pre-built binaries for Linux and Windows are distributed within the respective HDF5 binary release -packages, which can be obtained from the Download HDF5 page. +packages, which can be obtained from the Download HDF5 page. HDF5 files can be obtained from various places such as \ref HDF5Examples and HDF-EOS and Tools and Information Center. Specifically, the following examples are used in this tutorial topic: diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index b2ac81ea0c6..80ee2889bc7 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -69,6 +69,11 @@ if (H5_FORTRAN_HAVE_C_SIZEOF) set (CMAKE_H5_FORTRAN_HAVE_C_SIZEOF 1) endif () +set (CMAKE_H5_HAVE_ISO_FORTRAN_ENV 0) +if (H5_HAVE_ISO_FORTRAN_ENV) + set (CMAKE_H5_HAVE_ISO_FORTRAN_ENV 1) +endif () + set (CMAKE_H5_FORTRAN_HAVE_CHAR_ALLOC 0) if (H5_FORTRAN_HAVE_CHAR_ALLOC) set (CMAKE_H5_FORTRAN_HAVE_CHAR_ALLOC 1) diff --git a/fortran/src/H5Eff.F90 b/fortran/src/H5Eff.F90 index 162a7508085..20f45473a3b 100644 --- a/fortran/src/H5Eff.F90 +++ b/fortran/src/H5Eff.F90 @@ -306,19 +306,16 @@ END SUBROUTINE h5eset_auto_f !! \param arg19 C style format control strings !! \param arg20 C style format control strings !! -!! \note \p arg[1-20] expects C-style format strings, similar to the -!! system and C functions printf() and fprintf(). -!! Furthermore, special characters, such as ANSI escapes, -!! will only be interpreted correctly if the Fortran equivalent -!! is used. For example, to print \p msg "TEXT" in red and has -!! a space after the text would be: +!! \note \p arg[1-20] expects C-style format strings, similar to the system and C functions printf() and fprintf(). +!! Furthermore, special characters, such as ANSI escapes, will only be interpreted correctly if the Fortran +!! equivalent is used. For example, to print \p msg "TEXT" in red would be: !!

!! \code -!! (..., "%s TEXT %s"//C_NEW_LINE, hdferr, ..., arg1=ACHAR(27)//"[31m", arg2=ACHAR(27)//"[0m" ) +!! (..., "%s TEXT %s", hdferr, ..., arg1=ACHAR(27)//"[31m"//C_NULL_CHAR, arg2=ACHAR(27)//"[0m"//C_NULL_CHAR ) !! \endcode !!
Using "\n" instead of C_NEW_LINE will not be interpereted correctly, and similarly, -!! using "\x1B" instead of ACHAR(27) -!! +!! using "\x1B" instead of ACHAR(27). Also, all \p arg[1-20] characters strings must be +!! NULL terminated. !! !! See C API: @ref H5Epush2() !! diff --git a/fortran/src/H5Fff.F90 b/fortran/src/H5Fff.F90 index e8b765b7696..0c8b1d84099 100644 --- a/fortran/src/H5Fff.F90 +++ b/fortran/src/H5Fff.F90 @@ -120,10 +120,10 @@ SUBROUTINE h5fcreate_f(name, access_flags, file_id, hdferr, & INTERFACE INTEGER(HID_T) FUNCTION H5Fcreate(name, access_flags, & creation_prp_default, access_prp_default) BIND(C,NAME='H5Fcreate') - IMPORT :: C_CHAR + IMPORT :: C_CHAR, C_INT IMPORT :: HID_T CHARACTER(KIND=C_CHAR), DIMENSION(*) :: name - INTEGER, VALUE :: access_flags + INTEGER(C_INT), VALUE :: access_flags INTEGER(HID_T), VALUE :: creation_prp_default INTEGER(HID_T), VALUE :: access_prp_default END FUNCTION H5Fcreate @@ -137,7 +137,7 @@ END FUNCTION H5Fcreate IF (PRESENT(creation_prp)) creation_prp_default = creation_prp IF (PRESENT(access_prp)) access_prp_default = access_prp - file_id = h5fcreate(c_name, access_flags, & + file_id = h5fcreate(c_name, INT(access_flags, C_INT), & creation_prp_default, access_prp_default) hdferr = 0 diff --git a/fortran/src/H5Lff.F90 b/fortran/src/H5Lff.F90 index 004e5b23fdd..50a605a67db 100644 --- a/fortran/src/H5Lff.F90 +++ b/fortran/src/H5Lff.F90 @@ -1555,7 +1555,7 @@ INTEGER(C_INT) FUNCTION H5Lvisit(grp_id, idx_type, order, op, op_data) BIND(C, N END FUNCTION H5Lvisit END INTERFACE - return_value_c = INT(H5Lvisit(grp_id, INT(idx_type, C_INT), INT(order, C_INT), op, op_data)) + return_value_c = H5Lvisit(grp_id, INT(idx_type, C_INT), INT(order, C_INT), op, op_data) return_value = INT(return_value_c) IF(return_value.GE.0)THEN @@ -1624,7 +1624,7 @@ END FUNCTION H5Lvisit_by_name lapl_id_default = H5P_DEFAULT_F IF(PRESENT(lapl_id)) lapl_id_default = lapl_id - return_value_c = INT(H5Lvisit_by_name(loc_id, c_name, INT(idx_type, C_INT), INT(order, C_INT), op, op_data, lapl_id_default)) + return_value_c = H5Lvisit_by_name(loc_id, c_name, INT(idx_type, C_INT), INT(order, C_INT), op, op_data, lapl_id_default) return_value = INT(return_value_c) IF(return_value.GE.0)THEN diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index 87e6bfbebe6..17045a25570 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -2931,7 +2931,7 @@ h5pset_fapl_multi_c(hid_t_f *prp_id, int_f *memb_map, hid_t_f *memb_fapl, _fcd m * Check that we got correct values from Fortran for memb_addr array */ for (i = 0; i < H5FD_MEM_NTYPES; i++) { - if (memb_addr[i] >= 1.0f) + if (memb_addr[i] >= (real_f)1.0) return ret_value; } /* @@ -4598,7 +4598,7 @@ h5pget_file_image_c(hid_t_f *fapl_id, void **buf_ptr, size_t_f *buf_len_ptr) * SOURCE */ int_f -h5pset_fapl_mpio_c(hid_t_f *prp_id, int_f *comm, int_f *info) +h5pset_fapl_mpio_c(hid_t_f *prp_id, void *comm, void *info) /******/ { int ret_value = -1; @@ -4606,8 +4606,8 @@ h5pset_fapl_mpio_c(hid_t_f *prp_id, int_f *comm, int_f *info) herr_t ret; MPI_Comm c_comm; MPI_Info c_info; - c_comm = MPI_Comm_f2c(*comm); - c_info = MPI_Info_f2c(*info); + c_comm = MPI_Comm_f2c(*((int *)comm)); + c_info = MPI_Info_f2c(*((int *)info)); /* * Call H5Pset_mpi function. @@ -4633,7 +4633,7 @@ h5pset_fapl_mpio_c(hid_t_f *prp_id, int_f *comm, int_f *info) * SOURCE */ int_f -h5pget_fapl_mpio_c(hid_t_f *prp_id, int_f *comm, int_f *info) +h5pget_fapl_mpio_c(hid_t_f *prp_id, int *comm, int *info) /******/ { int ret_value = -1; @@ -4649,8 +4649,8 @@ h5pget_fapl_mpio_c(hid_t_f *prp_id, int_f *comm, int_f *info) ret = H5Pget_fapl_mpio(c_prp_id, &c_comm, &c_info); if (ret < 0) return ret_value; - *comm = (int_f)MPI_Comm_c2f(c_comm); - *info = (int_f)MPI_Info_c2f(c_info); + *comm = (int)MPI_Comm_c2f(c_comm); + *info = (int)MPI_Info_c2f(c_info); ret_value = 0; return ret_value; } @@ -4669,7 +4669,7 @@ h5pget_fapl_mpio_c(hid_t_f *prp_id, int_f *comm, int_f *info) * SOURCE */ int_f -h5pset_mpi_params_c(hid_t_f *prp_id, int_f *comm, int_f *info) +h5pset_mpi_params_c(hid_t_f *prp_id, void *comm, void *info) /******/ { int ret_value = -1; @@ -4677,8 +4677,8 @@ h5pset_mpi_params_c(hid_t_f *prp_id, int_f *comm, int_f *info) herr_t ret; MPI_Comm c_comm; MPI_Info c_info; - c_comm = MPI_Comm_f2c(*comm); - c_info = MPI_Info_f2c(*info); + c_comm = MPI_Comm_f2c(*((int *)comm)); + c_info = MPI_Info_f2c(*((int *)info)); /* * Call H5Pset_mpi_params. @@ -4705,7 +4705,7 @@ h5pset_mpi_params_c(hid_t_f *prp_id, int_f *comm, int_f *info) * SOURCE */ int_f -h5pget_mpi_params_c(hid_t_f *prp_id, int_f *comm, int_f *info) +h5pget_mpi_params_c(hid_t_f *prp_id, int *comm, int *info) /******/ { int ret_value = -1; @@ -4721,8 +4721,8 @@ h5pget_mpi_params_c(hid_t_f *prp_id, int_f *comm, int_f *info) ret = H5Pget_mpi_params(c_prp_id, &c_comm, &c_info); if (ret < 0) return ret_value; - *comm = (int_f)MPI_Comm_c2f(c_comm); - *info = (int_f)MPI_Info_c2f(c_info); + *comm = (int)MPI_Comm_c2f(c_comm); + *info = (int)MPI_Info_c2f(c_info); ret_value = 0; return ret_value; } diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90 index ab6765a8874..f5e50c90383 100644 --- a/fortran/src/H5Pff.F90 +++ b/fortran/src/H5Pff.F90 @@ -39,6 +39,13 @@ MODULE H5P +#ifdef H5_HAVE_PARALLEL +#ifdef H5_HAVE_MPI_F08 + USE MPI_F08, ONLY : MPI_INTEGER_KIND +#else + USE MPI, ONLY : MPI_INTEGER_KIND +#endif +#endif USE H5GLOBAL USE H5fortkit @@ -50,6 +57,7 @@ MODULE H5P PRIVATE h5pregister_integer, h5pregister_ptr PRIVATE h5pinsert_integer, h5pinsert_char, h5pinsert_ptr #ifdef H5_HAVE_PARALLEL + PRIVATE MPI_INTEGER_KIND PRIVATE h5pset_fapl_mpio_f90, h5pget_fapl_mpio_f90 #ifdef H5_HAVE_MPI_F08 PRIVATE h5pset_fapl_mpio_f08, h5pget_fapl_mpio_f08 @@ -5182,8 +5190,8 @@ END SUBROUTINE h5pget_file_image_f SUBROUTINE h5pset_fapl_mpio_f(prp_id, comm, info, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(IN) :: info + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(IN) :: comm + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(IN) :: info INTEGER, INTENT(OUT) :: hdferr END SUBROUTINE h5pset_fapl_mpio_f !> @@ -5213,17 +5221,17 @@ END SUBROUTINE h5pset_fapl_mpio_f SUBROUTINE h5pset_fapl_mpio_f90(prp_id, comm, info, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(IN) :: info + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(IN) :: comm + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(IN) :: info INTEGER, INTENT(OUT) :: hdferr INTERFACE INTEGER FUNCTION h5pset_fapl_mpio_c(prp_id, comm, info) & BIND(C,NAME='h5pset_fapl_mpio_c') - IMPORT :: HID_T + IMPORT :: HID_T, MPI_INTEGER_KIND IMPLICIT NONE INTEGER(HID_T) :: prp_id - INTEGER :: comm - INTEGER :: info + INTEGER(KIND=MPI_INTEGER_KIND) :: comm + INTEGER(KIND=MPI_INTEGER_KIND) :: info END FUNCTION h5pset_fapl_mpio_c END INTERFACE @@ -5240,7 +5248,7 @@ SUBROUTINE h5pset_fapl_mpio_f08(prp_id, comm, info, hdferr) TYPE(MPI_INFO), INTENT(IN) :: info INTEGER, INTENT(OUT) :: hdferr - CALL h5pset_fapl_mpio_f90(prp_id, comm%mpi_val, info%mpi_val, hdferr) + CALL h5pset_fapl_mpio_f90(prp_id, INT(comm%mpi_val,MPI_INTEGER_KIND), INT(info%mpi_val,MPI_INTEGER_KIND), hdferr) END SUBROUTINE h5pset_fapl_mpio_f08 #endif @@ -5298,21 +5306,28 @@ END SUBROUTINE h5pget_fapl_mpio_f SUBROUTINE h5pget_fapl_mpio_f90(prp_id, comm, info, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id - INTEGER, INTENT(OUT) :: comm - INTEGER, INTENT(OUT) :: info + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(OUT) :: comm + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(OUT) :: info INTEGER, INTENT(OUT) :: hdferr + + INTEGER(KIND=C_INT) :: c_comm + INTEGER(KIND=C_INT) :: c_info + INTERFACE INTEGER FUNCTION h5pget_fapl_mpio_c(prp_id, comm, info) & BIND(C,NAME='h5pget_fapl_mpio_c') - IMPORT :: HID_T + IMPORT :: HID_T, C_INT IMPLICIT NONE INTEGER(HID_T) :: prp_id - INTEGER :: comm - INTEGER :: info + INTEGER(KIND=C_INT) :: comm + INTEGER(KIND=C_INT) :: info END FUNCTION h5pget_fapl_mpio_c END INTERFACE - hdferr = h5pget_fapl_mpio_c(prp_id, comm, info) + hdferr = h5pget_fapl_mpio_c(prp_id, c_comm, c_info) + + comm = INT(c_comm,KIND=MPI_INTEGER_KIND) + info = INT(c_info,KIND=MPI_INTEGER_KIND) END SUBROUTINE h5pget_fapl_mpio_f90 @@ -5325,7 +5340,13 @@ SUBROUTINE h5pget_fapl_mpio_f08(prp_id, comm, info, hdferr) TYPE(MPI_INFO), INTENT(OUT) :: info INTEGER, INTENT(OUT) :: hdferr - CALL h5pget_fapl_mpio_f90(prp_id, comm%mpi_val, info%mpi_val, hdferr) + INTEGER(KIND=MPI_INTEGER_KIND) :: tmp_comm + INTEGER(KIND=MPI_INTEGER_KIND) :: tmp_info + + CALL h5pget_fapl_mpio_f90(prp_id, tmp_comm, tmp_info, hdferr) + + comm%mpi_val = tmp_comm + info%mpi_val = tmp_info END SUBROUTINE h5pget_fapl_mpio_f08 #endif @@ -5532,8 +5553,8 @@ END SUBROUTINE h5pget_mpio_no_collective_cause_f SUBROUTINE H5Pset_mpi_params_f(prp_id, comm, info, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id - INTEGER , INTENT(IN) :: comm - INTEGER , INTENT(IN) :: info + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(IN) :: comm + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(IN) :: info INTEGER , INTENT(OUT) :: hdferr END SUBROUTINE H5Pset_mpi_params_f !> @@ -5563,18 +5584,18 @@ END SUBROUTINE H5Pset_mpi_params_f SUBROUTINE H5Pset_mpi_params_f90(prp_id, comm, info, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id - INTEGER , INTENT(IN) :: comm - INTEGER , INTENT(IN) :: info + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(IN) :: comm + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(IN) :: info INTEGER , INTENT(OUT) :: hdferr INTERFACE INTEGER FUNCTION h5pset_mpi_params_c(prp_id, comm, info) & BIND(C,NAME='h5pset_mpi_params_c') - IMPORT :: HID_T + IMPORT :: HID_T, MPI_INTEGER_KIND IMPLICIT NONE INTEGER(HID_T) :: prp_id - INTEGER :: comm - INTEGER :: info + INTEGER(KIND=MPI_INTEGER_KIND) :: comm + INTEGER(KIND=MPI_INTEGER_KIND) :: info END FUNCTION H5pset_mpi_params_c END INTERFACE @@ -5614,8 +5635,8 @@ END SUBROUTINE H5Pset_mpi_params_f08 SUBROUTINE H5Pget_mpi_params_f(prp_id, comm, info, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id - INTEGER , INTENT(OUT) :: comm - INTEGER , INTENT(OUT) :: info + INTEGER, INTENT(OUT) :: comm + INTEGER, INTENT(OUT) :: info INTEGER , INTENT(OUT) :: hdferr END SUBROUTINE H5Pget_mpi_params_f !> @@ -5647,22 +5668,28 @@ END SUBROUTINE H5Pget_mpi_params_f SUBROUTINE H5Pget_mpi_params_f90(prp_id, comm, info, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id - INTEGER , INTENT(OUT) :: comm - INTEGER , INTENT(OUT) :: info + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(OUT) :: comm + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(OUT) :: info INTEGER , INTENT(OUT) :: hdferr + INTEGER(KIND=C_INT) :: c_comm + INTEGER(KIND=C_INT) :: c_info + INTERFACE INTEGER FUNCTION h5pget_mpi_params_c(prp_id, comm, info) & BIND(C,NAME='h5pget_mpi_params_c') - IMPORT :: HID_T + IMPORT :: HID_T, C_INT IMPLICIT NONE INTEGER(HID_T) :: prp_id - INTEGER :: comm - INTEGER :: info + INTEGER(KIND=C_INT) :: comm + INTEGER(KIND=C_INT) :: info END FUNCTION H5pget_mpi_params_c END INTERFACE - hdferr = H5Pget_mpi_params_c(prp_id, comm, info) + hdferr = H5Pget_mpi_params_c(prp_id, c_comm, c_info) + + comm = INT(c_comm,KIND=MPI_INTEGER_KIND) + info = INT(c_info,KIND=MPI_INTEGER_KIND) END SUBROUTINE H5Pget_mpi_params_f90 @@ -5675,7 +5702,13 @@ SUBROUTINE H5Pget_mpi_params_f08(prp_id, comm, info, hdferr) TYPE(MPI_INFO), INTENT(OUT) :: info INTEGER , INTENT(OUT) :: hdferr - CALL H5Pget_mpi_params_f90(prp_id, comm%mpi_val, info%mpi_val, hdferr) + INTEGER(KIND=MPI_INTEGER_KIND) :: tmp_comm + INTEGER(KIND=MPI_INTEGER_KIND) :: tmp_info + + CALL H5Pget_mpi_params_f90(prp_id, tmp_comm, tmp_info, hdferr) + + comm%mpi_val = tmp_comm + info%mpi_val = tmp_info END SUBROUTINE H5Pget_mpi_params_f08 #endif diff --git a/fortran/src/H5Sf.c b/fortran/src/H5Sf.c index 41616f81dff..22130fc9bd8 100644 --- a/fortran/src/H5Sf.c +++ b/fortran/src/H5Sf.c @@ -55,7 +55,7 @@ h5screate_simple_c(int_f *rank, hsize_t_f *dims, hsize_t_f *maxdims, hid_t_f *sp c_maxdims[i] = maxdims[*rank - i - 1]; } /* end for */ - c_space_id = H5Screate_simple(*rank, c_dims, c_maxdims); + c_space_id = H5Screate_simple((int)*rank, c_dims, c_maxdims); if (c_space_id < 0) HGOTO_DONE(FAIL); diff --git a/fortran/src/H5config_f.inc.cmake b/fortran/src/H5config_f.inc.cmake index 44da2befead..31c149883cf 100644 --- a/fortran/src/H5config_f.inc.cmake +++ b/fortran/src/H5config_f.inc.cmake @@ -79,8 +79,13 @@ ! Define if Fortran C_BOOL is different from default LOGICAL #define H5_FORTRAN_C_BOOL_IS_UNIQUE @H5_FORTRAN_C_BOOL_IS_UNIQUE@ -! Define if the intrinsic module ISO_FORTRAN_ENV exists -#define H5_HAVE_ISO_FORTRAN_ENV @H5_HAVE_ISO_FORTRAN_ENV@ +! Define if Fortran supports ISO_FORTRAN_ENV (F08) +#cmakedefine01 CMAKE_H5_HAVE_ISO_FORTRAN_ENV +#if CMAKE_H5_HAVE_ISO_FORTRAN_ENV == 0 +#undef H5_HAVE_ISO_FORTRAN_ENV +#else +#define H5_HAVE_ISO_FORTRAN_ENV +#endif ! Define the size of C's double #define H5_SIZEOF_DOUBLE @H5_SIZEOF_DOUBLE@ diff --git a/fortran/src/H5config_f.inc.in b/fortran/src/H5config_f.inc.in index cb2ec185735..6e465ca014b 100644 --- a/fortran/src/H5config_f.inc.in +++ b/fortran/src/H5config_f.inc.in @@ -47,7 +47,7 @@ ! Define if Fortran C_BOOL is different from default LOGICAL #undef FORTRAN_C_BOOL_IS_UNIQUE -! Define if the intrinsic module ISO_FORTRAN_ENV exists +! Define if Fortran supports ISO_FORTRAN_ENV (F08) #undef HAVE_ISO_FORTRAN_ENV ! Define the size of C's double diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index 0da371f5e17..71d914c1d26 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -518,10 +518,10 @@ H5_FCDLL int_f h5pget_chunk_cache_c(hid_t_f *dapl_id, size_t_f *rdcc_nslots, siz real_f *rdcc_w0); #ifdef H5_HAVE_PARALLEL H5_FCDLL int_f h5pget_mpio_actual_io_mode_c(hid_t_f *dxpl_id, int_f *actual_io_mode); -H5_FCDLL int_f h5pget_fapl_mpio_c(hid_t_f *prp_id, int_f *comm, int_f *info); -H5_FCDLL int_f h5pset_fapl_mpio_c(hid_t_f *prp_id, int_f *comm, int_f *info); -H5_FCDLL int_f h5pget_mpi_params_c(hid_t_f *prp_id, int_f *comm, int_f *info); -H5_FCDLL int_f h5pset_mpi_params_c(hid_t_f *prp_id, int_f *comm, int_f *info); +H5_FCDLL int_f h5pget_fapl_mpio_c(hid_t_f *prp_id, int *comm, int *info); +H5_FCDLL int_f h5pset_fapl_mpio_c(hid_t_f *prp_id, void *comm, void *info); +H5_FCDLL int_f h5pget_mpi_params_c(hid_t_f *prp_id, int *comm, int *info); +H5_FCDLL int_f h5pset_mpi_params_c(hid_t_f *prp_id, void *comm, void *info); H5_FCDLL int_f h5pget_dxpl_mpio_c(hid_t_f *prp_id, int_f *data_xfer_mode); H5_FCDLL int_f h5pset_dxpl_mpio_c(hid_t_f *prp_id, int_f *data_xfer_mode); #endif diff --git a/fortran/test/tH5A.F90 b/fortran/test/tH5A.F90 index 23b1addd3ce..ff7ee60053e 100644 --- a/fortran/test/tH5A.F90 +++ b/fortran/test/tH5A.F90 @@ -100,12 +100,11 @@ SUBROUTINE attribute_test(cleanup, total_error) CHARACTER(LEN=35), DIMENSION(2) :: aread_data ! Buffer to put read back ! string attr data CHARACTER :: attr_character_data = 'A' - REAL(KIND=Fortran_DOUBLE), DIMENSION(1) :: attr_double_data = 3.459D0 + REAL(KIND=Fortran_DOUBLE), DIMENSION(1) :: attr_double_data = 3.459_Fortran_DOUBLE REAL, DIMENSION(1) :: attr_real_data = 4.0 INTEGER, DIMENSION(1) :: attr_integer_data = 5 INTEGER(HSIZE_T), DIMENSION(7) :: data_dims - CHARACTER :: aread_character_data ! variable to put read back Character attr data INTEGER, DIMENSION(1) :: aread_integer_data ! variable to put read back integer attr data INTEGER, DIMENSION(1) :: aread_null_data = 7 ! variable to put read back null attr data @@ -577,8 +576,6 @@ SUBROUTINE attribute_test(cleanup, total_error) total_error = total_error +1 END IF - - CALL h5sclose_f(attr_space, error) CALL check("h5sclose_f",error,total_error) CALL h5sclose_f(attr2_space, error) diff --git a/fortran/test/tH5E_F03.F90 b/fortran/test/tH5E_F03.F90 index b538e20c530..7060d2ee617 100644 --- a/fortran/test/tH5E_F03.F90 +++ b/fortran/test/tH5E_F03.F90 @@ -298,7 +298,8 @@ SUBROUTINE test_error_stack(total_error) ! push a custom error message onto the stack CALL H5Epush_f(estack_id, file, func, line, & cls_id, major, minor, "%s ERROR TEXT %s %s %s", error, & - arg1=ACHAR(27)//"[31m", arg2=ACHAR(27)//"[0m", arg3=ACHAR(0), arg4=ACHAR(10) ) + arg1=ACHAR(27)//"[31m"//C_NULL_CHAR, arg2=ACHAR(27)//"[0m"//C_NULL_CHAR, & + arg3=ACHAR(0)//C_NULL_CHAR, arg4=ACHAR(10)//C_NULL_CHAR ) CALL check("H5Epush_f", error, total_error) CALL h5eget_num_f(estack_id, count, error) diff --git a/fortran/test/tH5L_F03.F90 b/fortran/test/tH5L_F03.F90 index a8345c3ca58..a4ece4d7fe4 100644 --- a/fortran/test/tH5L_F03.F90 +++ b/fortran/test/tH5L_F03.F90 @@ -162,7 +162,7 @@ INTEGER(KIND=C_INT) FUNCTION lvisit_cb(group, name, link_info, op_data) bind(C) INTEGER :: nlen, i, istart, iend - op_data%n_obj = op_data%n_obj + 1 + op_data%n_obj = op_data%n_obj + 1_C_INT nlen = 1 DO i = 1, MAX_CHAR_LEN diff --git a/fortran/test/tH5O_F03.F90 b/fortran/test/tH5O_F03.F90 index a4cf282ecca..f9cad325f3b 100644 --- a/fortran/test/tH5O_F03.F90 +++ b/fortran/test/tH5O_F03.F90 @@ -118,10 +118,10 @@ INTEGER FUNCTION compare_h5o_info_t( loc_id, oinfo_f, oinfo_c, field, full_f_fie IF((field .EQ. H5O_INFO_TIME_F).OR.(field .EQ. H5O_INFO_ALL_F))THEN - atime(1:8) = h5gmtime(oinfo_c%atime) - btime(1:8) = h5gmtime(oinfo_c%btime) - ctime(1:8) = h5gmtime(oinfo_c%ctime) - mtime(1:8) = h5gmtime(oinfo_c%mtime) + atime(1:8) = INT(h5gmtime(oinfo_c%atime),C_INT) + btime(1:8) = INT(h5gmtime(oinfo_c%btime),C_INT) + ctime(1:8) = INT(h5gmtime(oinfo_c%ctime),C_INT) + mtime(1:8) = INT(h5gmtime(oinfo_c%mtime),C_INT) DO i = 1, 8 IF( (atime(i) .NE. oinfo_f%atime(i)) )THEN diff --git a/fortran/test/tH5T_F03.F90 b/fortran/test/tH5T_F03.F90 index 65804d0d091..a59cd73f751 100644 --- a/fortran/test/tH5T_F03.F90 +++ b/fortran/test/tH5T_F03.F90 @@ -709,8 +709,8 @@ SUBROUTINE test_array_bkg(total_error) DO i = 1, LENGTH DO j = 1, ALEN cf(i)%a(j) = 100*(i+1) + j - cf(i)%b(j) = (100.*(i+1) + 0.01*j) - cf(i)%c(j) = 100.*(i+1) + 0.02*j + cf(i)%b(j) = (100._sp*REAL(i+1,sp) + 0.01_sp*REAL(j,sp)) + cf(i)%c(j) = 100._dp*REAL(i+1,dp) + 0.02_dp*REAL(j,dp) ENDDO ENDDO @@ -855,7 +855,7 @@ SUBROUTINE test_array_bkg(total_error) ! -------------------------------- DO i = 1, LENGTH DO j = 1, ALEN - fld(i)%b(j) = 1.313 + fld(i)%b(j) = 1.313_sp cf(i)%b(j) = fld(i)%b(j) ENDDO ENDDO @@ -2930,8 +2930,8 @@ SUBROUTINE test_nbit(total_error ) ! dataset datatype (no precision loss during datatype conversion) ! REAL(kind=wp), DIMENSION(1:2,1:5), TARGET :: orig_data = & - RESHAPE( (/188384.00, 19.103516, -1.0831790e9, -84.242188, & - 5.2045898, -49140.000, 2350.2500, -3.2110596e-1, 6.4998865e-5, -0.0000000/) , (/2,5/) ) + RESHAPE( (/188384.00_wp, 19.103516_wp, -1.0831790e9_wp, -84.242188_wp, & + 5.2045898_wp, -49140.000_wp, 2350.2500_wp, -3.2110596e-1_wp, 6.4998865e-5_wp, -0.0000000_wp/) , (/2,5/) ) REAL(kind=wp), DIMENSION(1:2,1:5), TARGET :: new_data INTEGER(size_t) :: PRECISION, offset INTEGER :: error diff --git a/fortran/testpar/async.F90 b/fortran/testpar/async.F90 index 5c7411f6ddb..aa2416fd24d 100644 --- a/fortran/testpar/async.F90 +++ b/fortran/testpar/async.F90 @@ -13,9 +13,15 @@ ! Tests async Fortran wrappers. It needs an async VOL. It will skip the tests if ! HDF5_VOL_CONNECTOR is not set or is set to a non-supporting async VOL. ! +#include + MODULE test_async_APIs +#ifdef H5_HAVE_MPI_F08 + USE MPI_F08 +#else USE MPI +#endif USE HDF5 USE TH5_MISC USE TH5_MISC_GEN @@ -40,6 +46,8 @@ MODULE test_async_APIs CHARACTER(LEN=10), TARGET :: app_func = "func_name"//C_NULL_CHAR INTEGER :: app_line = 42 + INTEGER :: mpi_ikind = MPI_INTEGER_KIND + CONTAINS INTEGER(KIND=C_INT) FUNCTION liter_cb(group, name, link_info, op_data) bind(C) @@ -60,7 +68,7 @@ INTEGER(KIND=C_INT) FUNCTION liter_cb(group, name, link_info, op_data) bind(C) CASE(0) liter_cb = 0 CASE(2) - liter_cb = op_data%command*10 + liter_cb = op_data%command*10_C_INT END SELECT op_data%command = op_data_command op_data%type = op_data_type @@ -381,9 +389,14 @@ SUBROUTINE H5D_async_tests(cleanup, total_error) INTEGER, TARGET :: fillvalue = 99 INTEGER :: error ! Error flags - INTEGER :: mpierror ! MPI error flag - INTEGER :: comm, info - INTEGER :: mpi_size, mpi_rank + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI error flag +#ifdef H5_HAVE_MPI_F08 + TYPE(MPI_COMM) :: comm + TYPE(MPI_INFO) :: info +#else + INTEGER(KIND=MPI_INTEGER_KIND) :: comm, info +#endif + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_rank comm = MPI_COMM_WORLD info = MPI_INFO_NULL @@ -399,7 +412,7 @@ SUBROUTINE H5D_async_tests(cleanup, total_error) CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl_id, hdferror) CALL check("h5pcreate_f", hdferror, total_error) - CALL h5pset_fapl_mpio_f(fapl_id, MPI_COMM_WORLD, MPI_INFO_NULL, hdferror) + CALL h5pset_fapl_mpio_f(fapl_id, comm, info, hdferror) CALL check("h5pset_fapl_mpio_f", hdferror, total_error) CALL h5fcreate_async_f(filename, H5F_ACC_TRUNC_F, file_id, es_id, error, access_prp = fapl_id ) @@ -581,9 +594,14 @@ SUBROUTINE H5G_async_tests(cleanup, total_error) TYPE(H5G_info_t), DIMENSION(1:3) :: ginfo INTEGER :: error - INTEGER :: mpierror ! MPI error flag - INTEGER :: comm, info - INTEGER :: mpi_size, mpi_rank + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI error flag +#ifdef H5_HAVE_MPI_F08 + TYPE(MPI_COMM) :: comm + TYPE(MPI_INFO) :: info +#else + INTEGER(KIND=MPI_INTEGER_KIND) :: comm, info +#endif + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_rank comm = MPI_COMM_WORLD info = MPI_INFO_NULL @@ -709,9 +727,14 @@ SUBROUTINE H5F_async_tests(cleanup, total_error) INTEGER(HID_T) :: ret_file_id INTEGER :: error ! Error flags - INTEGER :: mpierror ! MPI error flag - INTEGER :: comm, info - INTEGER :: mpi_size, mpi_rank + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI error flag +#ifdef H5_HAVE_MPI_F08 + TYPE(MPI_COMM) :: comm + TYPE(MPI_INFO) :: info +#else + INTEGER(KIND=MPI_INTEGER_KIND) :: comm, info +#endif + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_rank comm = MPI_COMM_WORLD info = MPI_INFO_NULL @@ -812,12 +835,16 @@ SUBROUTINE H5L_async_tests(cleanup, total_error) TYPE(iter_info), TARGET :: info TYPE(C_FUNPTR) :: f1 TYPE(C_PTR) :: f2 - INTEGER(C_INT) :: ret_value + INTEGER :: ret_value INTEGER :: error ! Error flags - INTEGER :: mpierror ! MPI error flag - INTEGER :: comm - INTEGER :: mpi_size, mpi_rank + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI error flag +#ifdef H5_HAVE_MPI_F08 + TYPE(MPI_COMM) :: comm +#else + INTEGER(KIND=MPI_INTEGER_KIND) :: comm +#endif + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_rank INTEGER(SIZE_T) :: count @@ -1211,10 +1238,10 @@ SUBROUTINE H5O_async_tests(cleanup, total_error) CALL check("H5Oget_info_by_name_async_f", hdferror, total_error) ENDIF - atime(1:8) = h5gmtime(oinfo_f%atime) - btime(1:8) = h5gmtime(oinfo_f%btime) - ctime(1:8) = h5gmtime(oinfo_f%ctime) - mtime(1:8) = h5gmtime(oinfo_f%mtime) + atime(1:8) = INT(h5gmtime(oinfo_f%atime),C_INT) + btime(1:8) = INT(h5gmtime(oinfo_f%btime),C_INT) + ctime(1:8) = INT(h5gmtime(oinfo_f%ctime),C_INT) + mtime(1:8) = INT(h5gmtime(oinfo_f%mtime),C_INT) IF( atime(1) .LT. 2021 .OR. & btime(1).LT. 2021 .OR. & @@ -1244,10 +1271,15 @@ PROGRAM async_test IMPLICIT NONE INTEGER :: total_error = 0 ! sum of the number of errors - INTEGER :: mpierror ! MPI hdferror flag - INTEGER :: mpi_size ! number of processes in the group of communicator - INTEGER :: mpi_rank ! rank of the calling process in the communicator - INTEGER :: required, provided + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI hdferror flag + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size ! number of processes in the group of communicator + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_rank ! rank of the calling process in the communicator + INTEGER(KIND=MPI_INTEGER_KIND) :: required, provided +#ifdef H5_HAVE_MPI_F08 + TYPE(MPI_DATATYPE) :: mpi_int_type +#else + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_int_type +#endif INTEGER(HID_T) :: vol_id INTEGER :: hdferror @@ -1290,7 +1322,7 @@ PROGRAM async_test IF(mpi_rank==0) CALL write_test_status(sum, & 'Testing Initializing mpi_init_thread', total_error) CALL MPI_Barrier(MPI_COMM_WORLD, mpierror) - CALL mpi_abort(MPI_COMM_WORLD, 1, mpierror) + CALL mpi_abort(MPI_COMM_WORLD, 1_MPI_INTEGER_KIND, mpierror) ENDIF IF(mpi_rank==0) CALL write_test_header("ASYNC FORTRAN TESTING") @@ -1408,7 +1440,13 @@ PROGRAM async_test ! CALL h5close_f(hdferror) - CALL MPI_ALLREDUCE(total_error, sum, 1, MPI_INTEGER, MPI_SUM, MPI_COMM_WORLD, mpierror) + IF(h5_sizeof(total_error).EQ.8_size_t)THEN + mpi_int_type=MPI_INTEGER8 + ELSE + mpi_int_type=MPI_INTEGER4 + ENDIF + + CALL MPI_ALLREDUCE(total_error, sum, 1_MPI_INTEGER_KIND, mpi_int_type, MPI_SUM, MPI_COMM_WORLD, mpierror) IF(mpi_rank==0) CALL write_test_footer() @@ -1422,7 +1460,7 @@ PROGRAM async_test ENDIF ELSE WRITE(*,*) 'Errors detected in process ', mpi_rank - CALL mpi_abort(MPI_COMM_WORLD, 1, mpierror) + CALL mpi_abort(MPI_COMM_WORLD, 1_MPI_INTEGER_KIND, mpierror) IF (mpierror .NE. MPI_SUCCESS) THEN WRITE(*,*) "MPI_ABORT *FAILED* Process = ", mpi_rank ENDIF diff --git a/fortran/testpar/hyper.F90 b/fortran/testpar/hyper.F90 index ec3a657afbb..61a3e260797 100644 --- a/fortran/testpar/hyper.F90 +++ b/fortran/testpar/hyper.F90 @@ -25,8 +25,8 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) INTEGER, INTENT(in) :: length ! array length LOGICAL, INTENT(in) :: do_collective ! use collective I/O LOGICAL, INTENT(in) :: do_chunk ! use chunking - INTEGER, INTENT(in) :: mpi_size ! number of processes in the group of communicator - INTEGER, INTENT(in) :: mpi_rank ! rank of the calling process in the communicator + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(in) :: mpi_size ! number of processes in the group of communicator + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(in) :: mpi_rank ! rank of the calling process in the communicator INTEGER, INTENT(inout) :: nerrors ! number of errors INTEGER :: hdferror ! HDF hdferror flag INTEGER(hsize_t), DIMENSION(1) :: dims ! dataset dimensions diff --git a/fortran/testpar/mdset.F90 b/fortran/testpar/mdset.F90 index 6757f4d7491..95e401137e6 100644 --- a/fortran/testpar/mdset.F90 +++ b/fortran/testpar/mdset.F90 @@ -25,8 +25,8 @@ SUBROUTINE multiple_dset_write(length, do_collective, do_chunk, mpi_size, mpi_ra INTEGER, INTENT(in) :: length ! array length LOGICAL, INTENT(in) :: do_collective ! use collective I/O LOGICAL, INTENT(in) :: do_chunk ! use chunking - INTEGER, INTENT(in) :: mpi_size ! number of processes in the group of communicator - INTEGER, INTENT(in) :: mpi_rank ! rank of the calling process in the communicator + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(in) :: mpi_size ! number of processes in the group of communicator + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(in) :: mpi_rank ! rank of the calling process in the communicator INTEGER, INTENT(inout) :: nerrors ! number of errors INTEGER :: hdferror ! HDF hdferror flag INTEGER(hsize_t), DIMENSION(1) :: dims ! dataset dimensions diff --git a/fortran/testpar/mpi_param.F90 b/fortran/testpar/mpi_param.F90 index ba4eaaae963..09a95d47177 100644 --- a/fortran/testpar/mpi_param.F90 +++ b/fortran/testpar/mpi_param.F90 @@ -18,24 +18,32 @@ SUBROUTINE mpi_param_03(nerrors) +#ifdef H5_HAVE_ISO_FORTRAN_ENV + USE, INTRINSIC :: iso_fortran_env, ONLY : atomic_logical_kind +#endif USE MPI USE HDF5 USE TH5_MISC USE TH5_MISC_GEN IMPLICIT NONE + INTEGER, INTENT(inout) :: nerrors ! number of errors INTEGER :: hdferror ! HDF hdferror flag INTEGER(hid_t) :: fapl_id ! file access identifier - INTEGER :: mpi_size, mpi_size_ret ! number of processes in the group of communicator - INTEGER :: mpierror ! MPI hdferror flag - INTEGER :: mpi_rank ! rank of the calling process in the communicator - - INTEGER :: info, info_ret - INTEGER :: comm, comm_ret - INTEGER :: nkeys - LOGICAL :: flag + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_size_ret ! number of processes in the group of communicator + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI hdferror flag + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_rank ! rank of the calling process in the communicator + + INTEGER(KIND=MPI_INTEGER_KIND) :: info, info_ret + INTEGER(KIND=MPI_INTEGER_KIND) :: comm, comm_ret + INTEGER(KIND=MPI_INTEGER_KIND) :: nkeys +#ifdef H5_HAVE_ISO_FORTRAN_ENV + LOGICAL(KIND=atomic_logical_kind) :: flag +#else + LOGICAL(KIND=MPI_INTEGER_KIND) :: flag +#endif INTEGER :: iconfig CHARACTER(LEN=4) , PARAMETER :: in_key="host" CHARACTER(LEN=10), PARAMETER :: in_value="myhost.org" @@ -62,13 +70,13 @@ SUBROUTINE mpi_param_03(nerrors) ! Split the communicator IF(mpi_rank.EQ.0)THEN - CALL MPI_Comm_split(MPI_COMM_WORLD, 1, mpi_rank, comm, mpierror) + CALL MPI_Comm_split(MPI_COMM_WORLD, 1_MPI_INTEGER_KIND, mpi_rank, comm, mpierror) IF (mpierror .NE. MPI_SUCCESS) THEN WRITE(*,*) "MPI_COMM_SPLIT *FAILED* Process = ", mpi_rank nerrors = nerrors + 1 ENDIF ELSE - CALL MPI_Comm_split(MPI_COMM_WORLD, 0, mpi_rank, comm, mpierror) + CALL MPI_Comm_split(MPI_COMM_WORLD, 0_MPI_INTEGER_KIND, mpi_rank, comm, mpierror) IF (mpierror .NE. MPI_SUCCESS) THEN WRITE(*,*) "MPI_COMM_SPLIT *FAILED* Process = ", mpi_rank nerrors = nerrors + 1 @@ -111,9 +119,9 @@ SUBROUTINE mpi_param_03(nerrors) nerrors = nerrors + 1 ENDIF IF (mpi_rank.EQ.0)THEN - CALL VERIFY("h5pget_fapl_mpio_f", mpi_size_ret, 1, hdferror) + CALL VERIFY("h5pget_fapl_mpio_f", mpi_size_ret, 1_MPI_INTEGER_KIND, hdferror) ELSE - CALL VERIFY("h5pget_fapl_mpio_f", mpi_size_ret, mpi_size-1, hdferror) + CALL VERIFY("h5pget_fapl_mpio_f", mpi_size_ret, INT(mpi_size-1,MPI_INTEGER_KIND), hdferror) ENDIF ! Check info returned @@ -122,9 +130,9 @@ SUBROUTINE mpi_param_03(nerrors) WRITE(*,*) "MPI_INFO_GET_NKEYS *FAILED* Process = ", mpi_rank nerrors = nerrors + 1 ENDIF - CALL VERIFY("h5pget_fapl_mpio_f", nkeys, 1, hdferror) + CALL VERIFY("h5pget_fapl_mpio_f", nkeys, 1_MPI_INTEGER_KIND, hdferror) - CALL MPI_Info_get_nthkey(info_ret, 0, key, mpierror) + CALL MPI_Info_get_nthkey(info_ret, 0_MPI_INTEGER_KIND, key, mpierror) IF (mpierror .NE. MPI_SUCCESS) THEN WRITE(*,*) "MPI_INFO_GET_NTHKEY *FAILED* Process = ", mpi_rank nerrors = nerrors + 1 @@ -136,7 +144,7 @@ SUBROUTINE mpi_param_03(nerrors) WRITE(*,*) "MPI_INFO_GET *FAILED* Process = ", mpi_rank nerrors = nerrors + 1 ENDIF - CALL VERIFY("h5pget_fapl_mpio_f", flag, .TRUE., hdferror) + CALL VERIFY("h5pget_fapl_mpio_f", LOGICAL(flag), .TRUE., hdferror) CALL VERIFY("h5pget_fapl_mpio_f", TRIM(value), in_value, hdferror) ! Free the MPI resources @@ -171,6 +179,9 @@ SUBROUTINE mpi_param_08(nerrors) #ifdef H5_HAVE_MPI_F08 +#ifdef H5_HAVE_ISO_FORTRAN_ENV + USE, INTRINSIC :: iso_fortran_env, ONLY : atomic_logical_kind +#endif USE MPI_F08 USE HDF5 USE TH5_MISC @@ -181,14 +192,18 @@ SUBROUTINE mpi_param_08(nerrors) INTEGER :: hdferror ! HDF hdferror flag INTEGER(hid_t) :: fapl_id ! file access identifier - INTEGER :: mpi_size, mpi_size_ret ! number of processes in the group of communicator - INTEGER :: mpierror ! MPI hdferror flag - INTEGER :: mpi_rank ! rank of the calling process in the communicator + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_size_ret ! number of processes in the group of communicator + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI hdferror flag + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_rank ! rank of the calling process in the communicator TYPE(MPI_INFO) :: info, info_ret TYPE(MPI_COMM) :: comm, comm_ret - INTEGER :: nkeys - LOGICAL :: flag + INTEGER(KIND=MPI_INTEGER_KIND) :: nkeys +#ifdef H5_HAVE_ISO_FORTRAN_ENV + LOGICAL(KIND=atomic_logical_kind) :: flag +#else + LOGICAL(KIND=MPI_INTEGER_KIND) :: flag +#endif INTEGER :: iconfig CHARACTER(LEN=4) , PARAMETER :: in_key="host" CHARACTER(LEN=10), PARAMETER :: in_value="myhost.org" @@ -215,13 +230,13 @@ SUBROUTINE mpi_param_08(nerrors) ! Split the communicator IF(mpi_rank.EQ.0)THEN - CALL MPI_Comm_split(MPI_COMM_WORLD, 1, mpi_rank, comm, mpierror) + CALL MPI_Comm_split(MPI_COMM_WORLD, 1_MPI_INTEGER_KIND, mpi_rank, comm, mpierror) IF (mpierror .NE. MPI_SUCCESS) THEN WRITE(*,*) "MPI_COMM_SPLIT *FAILED* Process = ", mpi_rank nerrors = nerrors + 1 ENDIF ELSE - CALL MPI_Comm_split(MPI_COMM_WORLD, 0, mpi_rank, comm, mpierror) + CALL MPI_Comm_split(MPI_COMM_WORLD, 0_MPI_INTEGER_KIND, mpi_rank, comm, mpierror) IF (mpierror .NE. MPI_SUCCESS) THEN WRITE(*,*) "MPI_COMM_SPLIT *FAILED* Process = ", mpi_rank nerrors = nerrors + 1 @@ -264,9 +279,9 @@ SUBROUTINE mpi_param_08(nerrors) nerrors = nerrors + 1 ENDIF IF (mpi_rank.EQ.0)THEN - CALL VERIFY("h5pget_fapl_mpio_f", mpi_size_ret, 1, hdferror) + CALL VERIFY("h5pget_fapl_mpio_f", mpi_size_ret, 1_MPI_INTEGER_KIND, hdferror) ELSE - CALL VERIFY("h5pget_fapl_mpio_f", mpi_size_ret, mpi_size-1, hdferror) + CALL VERIFY("h5pget_fapl_mpio_f", mpi_size_ret, INT(mpi_size-1,MPI_INTEGER_KIND), hdferror) ENDIF ! Check info returned @@ -275,9 +290,9 @@ SUBROUTINE mpi_param_08(nerrors) WRITE(*,*) "MPI_INFO_GET_NKEYS *FAILED* Process = ", mpi_rank nerrors = nerrors + 1 ENDIF - CALL VERIFY("h5pget_fapl_mpio_f", nkeys, 1, hdferror) + CALL VERIFY("h5pget_fapl_mpio_f", nkeys, 1_MPI_INTEGER_KIND, hdferror) - CALL MPI_Info_get_nthkey(info_ret, 0, key, mpierror) + CALL MPI_Info_get_nthkey(info_ret, 0_MPI_INTEGER_KIND, key, mpierror) IF (mpierror .NE. MPI_SUCCESS) THEN WRITE(*,*) "MPI_INFO_GET_NTHKEY *FAILED* Process = ", mpi_rank nerrors = nerrors + 1 @@ -289,7 +304,7 @@ SUBROUTINE mpi_param_08(nerrors) WRITE(*,*) "MPI_INFO_GET *FAILED* Process = ", mpi_rank nerrors = nerrors + 1 ENDIF - CALL VERIFY("h5pget_fapl_mpio_f", flag, .TRUE., hdferror) + CALL VERIFY("h5pget_fapl_mpio_f", LOGICAL(flag), .TRUE., hdferror) CALL VERIFY("h5pget_fapl_mpio_f", TRIM(value), in_value, hdferror) ! Free the MPI resources diff --git a/fortran/testpar/multidsetrw.F90 b/fortran/testpar/multidsetrw.F90 index e39900c9158..62eb5d1e8bb 100644 --- a/fortran/testpar/multidsetrw.F90 +++ b/fortran/testpar/multidsetrw.F90 @@ -25,8 +25,8 @@ SUBROUTINE pmultiple_dset_hyper_rw(do_collective, do_chunk, mpi_size, mpi_rank, LOGICAL, INTENT(in) :: do_collective ! use collective IO LOGICAL, INTENT(in) :: do_chunk ! use chunking - INTEGER, INTENT(in) :: mpi_size ! number of processes in the group of communicator - INTEGER, INTENT(in) :: mpi_rank ! rank of the calling process in the communicator + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(in) :: mpi_size ! number of processes in the group of communicator + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(in) :: mpi_rank ! rank of the calling process in the communicator INTEGER, INTENT(inout) :: nerrors ! number of errors CHARACTER(LEN=80):: dsetname ! Dataset name INTEGER(hsize_t), DIMENSION(1:2) :: cdims ! chunk dimensions @@ -156,6 +156,7 @@ SUBROUTINE pmultiple_dset_hyper_rw(do_collective, do_chunk, mpi_size, mpi_rank, CALL h5dwrite_multi_f(ndsets, dset_id, mem_type_id, mem_space_id, file_space_id, buf_md, error, plist_id) CALL check("h5dwrite_multi_f", error, nerrors) + return CALL h5pget_dxpl_mpio_f(plist_id, data_xfer_mode, error) CALL check("h5pget_dxpl_mpio_f", error, nerrors) diff --git a/fortran/testpar/ptest.F90 b/fortran/testpar/ptest.F90 index d2e9d105703..3d7280bbcf8 100644 --- a/fortran/testpar/ptest.F90 +++ b/fortran/testpar/ptest.F90 @@ -21,12 +21,12 @@ PROGRAM parallel_test IMPLICIT NONE - INTEGER :: mpierror ! MPI hdferror flag + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI hdferror flag INTEGER :: hdferror ! HDF hdferror flag INTEGER :: ret_total_error = 0 ! number of errors in subroutine INTEGER :: total_error = 0 ! sum of the number of errors - INTEGER :: mpi_size ! number of processes in the group of communicator - INTEGER :: mpi_rank ! rank of the calling process in the communicator + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size ! number of processes in the group of communicator + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_rank ! rank of the calling process in the communicator INTEGER :: length = 12000 ! length of array INTEGER :: i,j, sum ! use collective MPI I/O @@ -35,6 +35,7 @@ PROGRAM parallel_test ! use chunking LOGICAL, DIMENSION(1:2) :: do_chunk = (/.FALSE.,.TRUE./) CHARACTER(LEN=10), DIMENSION(1:2) :: chr_chunk =(/"contiguous", "chunk "/) + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_int_type ! ! initialize MPI @@ -71,6 +72,7 @@ PROGRAM parallel_test ! ! test write/read dataset by hyperslabs (contiguous/chunk) with independent/collective MPI I/O ! + DO i = 1, 2 DO j = 1, 2 ret_total_error = 0 @@ -80,10 +82,10 @@ PROGRAM parallel_test total_error) ENDDO ENDDO - ! ! test write/read several datasets (independent MPI I/O) ! + ret_total_error = 0 CALL multiple_dset_write(length, do_collective(1), do_chunk(1), mpi_size, mpi_rank, ret_total_error) IF(mpi_rank==0) CALL write_test_status(ret_total_error, & @@ -105,7 +107,13 @@ PROGRAM parallel_test ! CALL h5close_f(hdferror) - CALL MPI_ALLREDUCE(total_error, sum, 1, MPI_INTEGER, MPI_SUM, MPI_COMM_WORLD, mpierror) + IF(h5_sizeof(total_error).EQ.8_size_t)THEN + mpi_int_type=MPI_INTEGER8 + ELSE + mpi_int_type=MPI_INTEGER4 + ENDIF + + CALL MPI_ALLREDUCE(total_error, sum, 1_MPI_INTEGER_KIND, mpi_int_type, MPI_SUM, MPI_COMM_WORLD, mpierror) IF(mpi_rank==0) CALL write_test_footer() @@ -119,7 +127,7 @@ PROGRAM parallel_test ENDIF ELSE WRITE(*,*) 'Errors detected in process ', mpi_rank - CALL mpi_abort(MPI_COMM_WORLD, 1, mpierror) + CALL mpi_abort(MPI_COMM_WORLD, 1_MPI_INTEGER_KIND, mpierror) IF (mpierror .NE. MPI_SUCCESS) THEN WRITE(*,*) "MPI_ABORT *FAILED* Process = ", mpi_rank ENDIF diff --git a/fortran/testpar/subfiling.F90 b/fortran/testpar/subfiling.F90 index a677bea6121..9bee38bcc6f 100644 --- a/fortran/testpar/subfiling.F90 +++ b/fortran/testpar/subfiling.F90 @@ -18,6 +18,9 @@ PROGRAM subfiling_test USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_INT64_T +#ifdef H5_HAVE_ISO_FORTRAN_ENV + USE, INTRINSIC :: iso_fortran_env, ONLY : atomic_logical_kind +#endif USE HDF5 USE MPI USE TH5_MISC @@ -25,29 +28,33 @@ PROGRAM subfiling_test IMPLICIT NONE INTEGER :: total_error = 0 ! sum of the number of errors - INTEGER :: mpierror ! MPI hdferror flag - INTEGER :: mpi_rank ! rank of the calling process in the communicator + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI hdferror flag + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_rank ! rank of the calling process in the communicator #ifdef H5_HAVE_SUBFILING_VFD CHARACTER(LEN=7), PARAMETER :: filename = "subf.h5" - INTEGER :: hdferror ! HDF hdferror flag - INTEGER :: mpi_size, mpi_size_ret ! number of processes in the group of communicator - INTEGER :: required, provided + INTEGER :: hdferror ! HDF hdferror flag + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_size_ret ! number of processes in the group of communicator + INTEGER(KIND=MPI_INTEGER_KIND) :: required, provided LOGICAL :: file_exists INTEGER(HID_T) :: fapl_id INTEGER(HID_T) :: file_id - INTEGER :: comm, comm_ret - INTEGER :: info, info_ret + INTEGER(KIND=MPI_INTEGER_KIND) :: comm, comm_ret + INTEGER(KIND=MPI_INTEGER_KIND) :: info, info_ret CHARACTER(LEN=3) :: info_val CHARACTER(LEN=180) :: subfname INTEGER :: i, sum INTEGER(C_INT64_T) inode TYPE(H5FD_subfiling_config_t) :: vfd_config TYPE(H5FD_ioc_config_t) :: vfd_config_ioc - LOGICAL :: flag +#ifdef H5_HAVE_ISO_FORTRAN_ENV + LOGICAL(KIND=atomic_logical_kind) :: flag +#else + LOGICAL(KIND=MPI_INTEGER_KIND) :: flag +#endif INTEGER :: nerrors = 0 @@ -56,6 +63,7 @@ PROGRAM subfiling_test CHARACTER(len=8) :: hex1, hex2 CHARACTER(len=1) :: arg + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_int_type ! ! initialize MPI ! @@ -84,7 +92,7 @@ PROGRAM subfiling_test IF(mpi_rank==0) CALL write_test_status(sum, & 'Testing Initializing mpi_init_thread', total_error) CALL MPI_Barrier(MPI_COMM_WORLD, mpierror) - CALL mpi_abort(MPI_COMM_WORLD, 1, mpierror) + CALL mpi_abort(MPI_COMM_WORLD, 1_MPI_INTEGER_KIND, mpierror) ENDIF ! @@ -101,9 +109,9 @@ PROGRAM subfiling_test IF(mpi_size.GT.2)THEN IF (mpi_rank.LE.1)THEN - CALL MPI_Comm_split(MPI_COMM_WORLD, 1, mpi_rank, comm, mpierror) + CALL MPI_Comm_split(MPI_COMM_WORLD, 1_MPI_INTEGER_KIND, mpi_rank, comm, mpierror) ELSE - CALL MPI_Comm_split(MPI_COMM_WORLD, 0, mpi_rank, comm, mpierror) + CALL MPI_Comm_split(MPI_COMM_WORLD, 0_MPI_INTEGER_KIND, mpi_rank, comm, mpierror) ENDIF CALL MPI_Info_create(info, mpierror) @@ -128,8 +136,8 @@ PROGRAM subfiling_test nerrors = nerrors + 1 ENDIF - CALL mpi_info_get(info_ret,"foo", 3, info_val, flag, mpierror) - IF(flag .EQV. .TRUE.)THEN + CALL mpi_info_get(info_ret,"foo", 3_MPI_INTEGER_KIND, info_val, flag, mpierror) + IF(LOGICAL(flag) .EQV. .TRUE.)THEN IF(info_val.NE."bar")THEN IF(mpi_rank.EQ.0) & WRITE(*,*) "Failed H5Pset_mpi_params_f and H5Pget_mpi_params_f sequence" @@ -148,7 +156,13 @@ PROGRAM subfiling_test ENDIF - CALL MPI_REDUCE(nerrors, sum, 1, MPI_INTEGER, MPI_SUM, 0, MPI_COMM_WORLD, mpierror) + IF(h5_sizeof(total_error).EQ.8_size_t)THEN + mpi_int_type=MPI_INTEGER8 + ELSE + mpi_int_type=MPI_INTEGER4 + ENDIF + + CALL MPI_REDUCE(nerrors, sum, 1_MPI_INTEGER_KIND, mpi_int_type, MPI_SUM, 0_MPI_INTEGER_KIND, MPI_COMM_WORLD, mpierror) IF(mpi_rank==0) CALL write_test_status(sum, & 'Testing H5Pset/get_mpi_params_f', total_error) @@ -267,10 +281,10 @@ PROGRAM subfiling_test ! Testing modifying defaults for subfiling FD - vfd_config%magic = H5FD_SUBFILING_FAPL_MAGIC_F - vfd_config%version = H5FD_SUBFILING_CURR_FAPL_VERSION_F + vfd_config%magic = INT(H5FD_SUBFILING_FAPL_MAGIC_F,C_INT32_T) + vfd_config%version = INT(H5FD_SUBFILING_CURR_FAPL_VERSION_F,C_INT32_T) vfd_config%require_ioc = .TRUE. - vfd_config%shared_cfg%ioc_selection = SELECT_IOC_ONE_PER_NODE_F + vfd_config%shared_cfg%ioc_selection = INT(SELECT_IOC_ONE_PER_NODE_F,C_INT) vfd_config%shared_cfg%stripe_size = 16*1024*1024 vfd_config%shared_cfg%stripe_count = 3 @@ -299,8 +313,8 @@ PROGRAM subfiling_test IF(mpi_rank==0) CALL write_test_status(nerrors, & 'Testing H5Pset/get_fapl_subfiling_f with custom settings', total_error) - vfd_config_ioc%magic = H5FD_IOC_FAPL_MAGIC_F - vfd_config_ioc%version = H5FD_IOC_CURR_FAPL_VERSION_F + vfd_config_ioc%magic = INT(H5FD_IOC_FAPL_MAGIC_F,C_INT32_T) + vfd_config_ioc%version = INT(H5FD_IOC_CURR_FAPL_VERSION_F,C_INT32_T) vfd_config_ioc%thread_pool_size = 2 nerrors = 0 @@ -374,7 +388,13 @@ PROGRAM subfiling_test ! CALL h5close_f(hdferror) - CALL MPI_ALLREDUCE(total_error, sum, 1, MPI_INTEGER, MPI_SUM, MPI_COMM_WORLD, mpierror) + IF(h5_sizeof(total_error).EQ.8_size_t)THEN + mpi_int_type=MPI_INTEGER8 + ELSE + mpi_int_type=MPI_INTEGER4 + ENDIF + + CALL MPI_ALLREDUCE(total_error, sum, 1_MPI_INTEGER_KIND, mpi_int_type, MPI_SUM, MPI_COMM_WORLD, mpierror) ! ! close MPI @@ -386,7 +406,7 @@ PROGRAM subfiling_test ENDIF ELSE WRITE(*,*) 'Errors detected in process ', mpi_rank - CALL mpi_abort(MPI_COMM_WORLD, 1, mpierror) + CALL mpi_abort(MPI_COMM_WORLD, 1_MPI_INTEGER_KIND, mpierror) IF (mpierror .NE. MPI_SUCCESS) THEN WRITE(*,*) "MPI_ABORT *FAILED* Process = ", mpi_rank ENDIF diff --git a/hl/test/test_dset_append.c b/hl/test/test_dset_append.c index 0971cf31de1..d3e385532b7 100644 --- a/hl/test/test_dset_append.c +++ b/hl/test/test_dset_append.c @@ -78,6 +78,7 @@ test_dataset_append_notset(hid_t fid) } /* end for */ /* File size when not flushed */ + memset(&sb1, 0, sizeof(h5_stat_t)); if (HDstat(FILENAME, &sb1) < 0) TEST_ERROR; @@ -86,6 +87,7 @@ test_dataset_append_notset(hid_t fid) FAIL_STACK_ERROR; /* File size after flushing */ + memset(&sb2, 0, sizeof(h5_stat_t)); if (HDstat(FILENAME, &sb2) < 0) TEST_ERROR; diff --git a/java/src/jni/exceptionImp.c b/java/src/jni/exceptionImp.c index acc7a5cee77..4cf03ac9f28 100644 --- a/java/src/jni/exceptionImp.c +++ b/java/src/jni/exceptionImp.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index 253358259f9..3a1cfae9798 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ diff --git a/java/src/jni/h5Imp.c b/java/src/jni/h5Imp.c index 8fdf051c4ae..e744e567067 100644 --- a/java/src/jni/h5Imp.c +++ b/java/src/jni/h5Imp.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ diff --git a/java/src/jni/h5aImp.c b/java/src/jni/h5aImp.c index 2e985e78fa8..54c862eff6c 100644 --- a/java/src/jni/h5aImp.c +++ b/java/src/jni/h5aImp.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ @@ -1107,12 +1107,12 @@ Java_hdf_hdf5lib_H5_H5Awrite_1string(JNIEnv *env, jclass clss, jlong attr_id, jl JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5AreadVL(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf) { - jbyte *readBuf = NULL; + void *readBuf = NULL; hsize_t dims[H5S_MAX_RANK]; hid_t sid = H5I_INVALID_HID; size_t typeSize; H5T_class_t type_class; - jsize vl_array_len; + jsize vl_array_len = 0; htri_t vl_data_class; herr_t status = FAIL; htri_t is_variable = 0; @@ -1136,7 +1136,7 @@ Java_hdf_hdf5lib_H5_H5AreadVL(JNIEnv *env, jclass clss, jlong attr_id, jlong mem if (NULL == (readBuf = calloc((size_t)vl_array_len, typeSize))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Aread: failed to allocate raw VL read buffer"); - if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, (void *)readBuf)) < 0) + if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, readBuf)) < 0) H5_LIBRARY_ERROR(ENVONLY); if ((type_class = H5Tget_class((hid_t)mem_type_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1173,12 +1173,12 @@ Java_hdf_hdf5lib_H5_H5AreadVL(JNIEnv *env, jclass clss, jlong attr_id, jlong mem JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5AwriteVL(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf) { - jbyte *writeBuf = NULL; + void *writeBuf = NULL; hsize_t dims[H5S_MAX_RANK]; hid_t sid = H5I_INVALID_HID; size_t typeSize; H5T_class_t type_class; - jsize vl_array_len; + jsize vl_array_len = 0; htri_t vl_data_class; herr_t status = FAIL; htri_t is_variable = 0; diff --git a/java/src/jni/h5dImp.c b/java/src/jni/h5dImp.c index 3453bdef515..f6318b222d4 100644 --- a/java/src/jni/h5dImp.c +++ b/java/src/jni/h5dImp.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ @@ -185,7 +185,7 @@ Java_hdf_hdf5lib_H5_H5Dread(JNIEnv *env, jclass clss, jlong dataset_id, jlong me jbyte *readBuf = NULL; size_t typeSize; H5T_class_t type_class; - jsize vl_array_len; // Only used by vl_data_class types + jsize vl_array_len = 0; // Only used by vl_data_class types htri_t vl_data_class; herr_t status = FAIL; @@ -266,7 +266,7 @@ Java_hdf_hdf5lib_H5_H5Dwrite(JNIEnv *env, jclass clss, jlong dataset_id, jlong m jbyte *writeBuf = NULL; size_t typeSize; H5T_class_t type_class; - jsize vl_array_len; // Only used by vl_data_class types + jsize vl_array_len = 0; // Only used by vl_data_class types htri_t vl_data_class; herr_t status = FAIL; @@ -1134,7 +1134,7 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5DreadVL(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id, jobjectArray buf) { - jbyte *readBuf = NULL; + void *readBuf = NULL; size_t typeSize; H5T_class_t type_class; jsize vl_array_len; @@ -1164,7 +1164,7 @@ Java_hdf_hdf5lib_H5_H5DreadVL(JNIEnv *env, jclass clss, jlong dataset_id, jlong H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5DreadVL: failed to allocate raw VL read buffer"); if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, - (hid_t)xfer_plist_id, (void *)readBuf)) < 0) + (hid_t)xfer_plist_id, readBuf)) < 0) H5_LIBRARY_ERROR(ENVONLY); if ((type_class = H5Tget_class((hid_t)mem_type_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1194,7 +1194,7 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5DwriteVL(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id, jobjectArray buf) { - jbyte *writeBuf = NULL; + void *writeBuf = NULL; size_t typeSize; H5T_class_t type_class; jsize vl_array_len; // Only used by vl_data_class types diff --git a/java/src/jni/h5eImp.c b/java/src/jni/h5eImp.c index a44363e0805..d52a4f72cd0 100644 --- a/java/src/jni/h5eImp.c +++ b/java/src/jni/h5eImp.c @@ -10,12 +10,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ - * - */ - #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ @@ -28,7 +22,7 @@ extern "C" { * analogous arguments and return codes. * * For details of the HDF libraries, see the HDF Documentation at: - * http://www.hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ @@ -461,7 +455,7 @@ Java_hdf_hdf5lib_H5_H5Eget_1msg(JNIEnv *env, jclass clss, jlong msg_id, jintArra H5_LIBRARY_ERROR(ENVONLY); namePtr[buf_size] = '\0'; - theArray[0] = error_msg_type; + theArray[0] = (jint)error_msg_type; if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, namePtr))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); diff --git a/java/src/jni/h5fImp.c b/java/src/jni/h5fImp.c index 4a65a7f352d..9295383ef4d 100644 --- a/java/src/jni/h5fImp.c +++ b/java/src/jni/h5fImp.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ diff --git a/java/src/jni/h5gImp.c b/java/src/jni/h5gImp.c index 6890cd78612..fce68022649 100644 --- a/java/src/jni/h5gImp.c +++ b/java/src/jni/h5gImp.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ diff --git a/java/src/jni/h5iImp.c b/java/src/jni/h5iImp.c index 46e89047db2..de70e1e424f 100644 --- a/java/src/jni/h5iImp.c +++ b/java/src/jni/h5iImp.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ diff --git a/java/src/jni/h5jni.h b/java/src/jni/h5jni.h index 7b1bf9de8b8..ad867083ba9 100644 --- a/java/src/jni/h5jni.h +++ b/java/src/jni/h5jni.h @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ diff --git a/java/src/jni/h5lImp.c b/java/src/jni/h5lImp.c index 13dbc089f3c..0d9ac7dfc01 100644 --- a/java/src/jni/h5lImp.c +++ b/java/src/jni/h5lImp.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ diff --git a/java/src/jni/h5oImp.c b/java/src/jni/h5oImp.c index c97d7da6f38..15daeafde6b 100644 --- a/java/src/jni/h5oImp.c +++ b/java/src/jni/h5oImp.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ diff --git a/java/src/jni/h5pACPLImp.c b/java/src/jni/h5pACPLImp.c index 6290e0ea155..4635fa7373b 100644 --- a/java/src/jni/h5pACPLImp.c +++ b/java/src/jni/h5pACPLImp.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ diff --git a/java/src/jni/h5pDAPLImp.c b/java/src/jni/h5pDAPLImp.c index fdafd4cb307..01c3983c2cc 100644 --- a/java/src/jni/h5pDAPLImp.c +++ b/java/src/jni/h5pDAPLImp.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ diff --git a/java/src/jni/h5pDCPLImp.c b/java/src/jni/h5pDCPLImp.c index d60017701d5..bd44f447bd1 100644 --- a/java/src/jni/h5pDCPLImp.c +++ b/java/src/jni/h5pDCPLImp.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ @@ -77,13 +77,11 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1chunk(JNIEnv *env, jclass clss, jlong plist, jint ndims, jbyteArray dim) { jboolean isCopy; - hsize_t *da = NULL; - hsize_t *lp = NULL; - size_t i; + hsize_t *chunk_dims = NULL; + uint8_t *theArray_p = NULL; size_t rank; jsize arrLen; jbyte *theArray = NULL; - jlong *jlp = NULL; herr_t status = FAIL; UNUSED(clss); @@ -104,22 +102,29 @@ Java_hdf_hdf5lib_H5_H5Pset_1chunk(JNIEnv *env, jclass clss, jlong plist, jint nd PIN_BYTE_ARRAY(ENVONLY, dim, theArray, &isCopy, "H5Pset_chunk: dim array not pinned"); - if (NULL == (da = lp = (hsize_t *)malloc(rank * sizeof(hsize_t)))) + if (NULL == (chunk_dims = malloc(rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pset_chunk: memory allocation failed"); - jlp = (jlong *)theArray; - for (i = 0; i < rank; i++) { - *lp = (hsize_t)*jlp; - lp++; - jlp++; - } /* end if */ + theArray_p = (uint8_t *)theArray; + for (size_t i = 0; i < rank; i++) { + jlong dim_val; - if ((status = H5Pset_chunk((hid_t)plist, (int)ndims, da)) < 0) + memcpy(&dim_val, theArray_p, sizeof(jlong)); + + if (dim_val < 0) + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_chunk: chunk dimensions can't be negative"); + + chunk_dims[i] = (hsize_t)dim_val; + + theArray_p += sizeof(jlong); + } + + if ((status = H5Pset_chunk((hid_t)plist, (int)ndims, chunk_dims)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: - if (da) - free(da); + free(chunk_dims); + if (theArray) UNPIN_BYTE_ARRAY(ENVONLY, dim, theArray, JNI_ABORT); diff --git a/java/src/jni/h5pDXPLImp.c b/java/src/jni/h5pDXPLImp.c index 7926db1192c..31f6d02b860 100644 --- a/java/src/jni/h5pDXPLImp.c +++ b/java/src/jni/h5pDXPLImp.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ diff --git a/java/src/jni/h5pFAPLImp.c b/java/src/jni/h5pFAPLImp.c index 77087564019..af56336fb55 100644 --- a/java/src/jni/h5pFAPLImp.c +++ b/java/src/jni/h5pFAPLImp.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ @@ -1741,15 +1741,15 @@ Java_hdf_hdf5lib_H5_H5Pget_1mdc_1config(JNIEnv *env, jclass clss, jlong plist) args[9].j = (jlong)cacheinfo.max_size; args[10].j = (jlong)cacheinfo.min_size; args[11].j = cacheinfo.epoch_length; - args[12].i = cacheinfo.incr_mode; + args[12].i = (jint)cacheinfo.incr_mode; args[13].d = cacheinfo.lower_hr_threshold; args[14].d = cacheinfo.increment; args[15].z = cacheinfo.apply_max_increment; args[16].j = (jlong)cacheinfo.max_increment; - args[17].i = cacheinfo.flash_incr_mode; + args[17].i = (jint)cacheinfo.flash_incr_mode; args[18].d = cacheinfo.flash_multiple; args[19].d = cacheinfo.flash_threshold; - args[20].i = cacheinfo.decr_mode; + args[20].i = (jint)cacheinfo.decr_mode; args[21].d = cacheinfo.upper_hr_threshold; args[22].d = cacheinfo.decrement; args[23].z = cacheinfo.apply_max_decrement; diff --git a/java/src/jni/h5pFCPLImp.c b/java/src/jni/h5pFCPLImp.c index 9e6845d29dd..7c1b44add5f 100644 --- a/java/src/jni/h5pFCPLImp.c +++ b/java/src/jni/h5pFCPLImp.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ diff --git a/java/src/jni/h5pGAPLImp.c b/java/src/jni/h5pGAPLImp.c index b92e1809d15..0ee65710ac5 100644 --- a/java/src/jni/h5pGAPLImp.c +++ b/java/src/jni/h5pGAPLImp.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ diff --git a/java/src/jni/h5pGCPLImp.c b/java/src/jni/h5pGCPLImp.c index e7d4dd2473f..49d79dc2366 100644 --- a/java/src/jni/h5pGCPLImp.c +++ b/java/src/jni/h5pGCPLImp.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ diff --git a/java/src/jni/h5pImp.c b/java/src/jni/h5pImp.c index e38701ff3ba..c952ccb9dff 100644 --- a/java/src/jni/h5pImp.c +++ b/java/src/jni/h5pImp.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ diff --git a/java/src/jni/h5pLAPLImp.c b/java/src/jni/h5pLAPLImp.c index 2bf2812ec4b..3048c155413 100644 --- a/java/src/jni/h5pLAPLImp.c +++ b/java/src/jni/h5pLAPLImp.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ diff --git a/java/src/jni/h5pLCPLImp.c b/java/src/jni/h5pLCPLImp.c index b5eebd18e96..ecabadd29bc 100644 --- a/java/src/jni/h5pLCPLImp.c +++ b/java/src/jni/h5pLCPLImp.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ diff --git a/java/src/jni/h5pOCPLImp.c b/java/src/jni/h5pOCPLImp.c index 432fbbb6508..7cd9b5c721f 100644 --- a/java/src/jni/h5pOCPLImp.c +++ b/java/src/jni/h5pOCPLImp.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ diff --git a/java/src/jni/h5pOCpyPLImp.c b/java/src/jni/h5pOCpyPLImp.c index b525b680787..c4d2ed7fd14 100644 --- a/java/src/jni/h5pOCpyPLImp.c +++ b/java/src/jni/h5pOCpyPLImp.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ diff --git a/java/src/jni/h5pStrCPLImp.c b/java/src/jni/h5pStrCPLImp.c index a056e3a7599..0045efa342e 100644 --- a/java/src/jni/h5pStrCPLImp.c +++ b/java/src/jni/h5pStrCPLImp.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ diff --git a/java/src/jni/h5plImp.c b/java/src/jni/h5plImp.c index 9283777f52c..3c87fd52a99 100644 --- a/java/src/jni/h5plImp.c +++ b/java/src/jni/h5plImp.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ diff --git a/java/src/jni/h5rImp.c b/java/src/jni/h5rImp.c index 0e26f2a76ad..f97f803f90e 100644 --- a/java/src/jni/h5rImp.c +++ b/java/src/jni/h5rImp.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ #ifdef __cplusplus @@ -204,6 +204,12 @@ Java_hdf_hdf5lib_H5_H5Rdestroy(JNIEnv *env, jclass clss, jbyteArray ref) if ((status = H5Rdestroy(&loc_ref)) < 0) H5_LIBRARY_ERROR(ENVONLY); + /* Reset buffer to 0 to be safe. H5Rdestroy does this, but + * only on our temporary reference object that we copied + * into for alignment reasons. + */ + memset(refBuf, 0, H5R_REF_BUF_SIZE); + done: if (refBuf) UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (status < 0) ? JNI_ABORT : 0); diff --git a/java/src/jni/h5sImp.c b/java/src/jni/h5sImp.c index f0103eded3a..55fb268434f 100644 --- a/java/src/jni/h5sImp.c +++ b/java/src/jni/h5sImp.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ @@ -221,13 +221,11 @@ Java_hdf_hdf5lib_H5_H5Sselect_1elements(JNIEnv *env, jclass clss, jlong space_id jbyteArray coords) { jboolean isCopy; - hsize_t *lp = NULL; - hsize_t *llp = NULL; - jlong *jlp = NULL; - jbyte *P = NULL; + hsize_t *coords_p = NULL; + uint8_t *pinned_arr_p = NULL; + jbyte *pinned_arr = NULL; jsize size; - int ii; - int nlongs; + size_t nlongs; herr_t status = FAIL; UNUSED(clss); @@ -235,35 +233,40 @@ Java_hdf_hdf5lib_H5_H5Sselect_1elements(JNIEnv *env, jclass clss, jlong space_id if (NULL == coords) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Sselect_elements: coords is NULL"); - PIN_BYTE_ARRAY(ENVONLY, coords, P, &isCopy, "H5Sselect_elements: coords not pinned"); + PIN_BYTE_ARRAY(ENVONLY, coords, pinned_arr, &isCopy, "H5Sselect_elements: coords not pinned"); if ((size = ENVPTR->GetArrayLength(ENVONLY, coords)) < 0) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sselect_elements: coords array length < 0"); } - nlongs = (int)((size_t)size / sizeof(jlong)); + nlongs = (size_t)size / sizeof(jlong); - if (NULL == (lp = (hsize_t *)malloc((size_t)nlongs * sizeof(hsize_t)))) + if (NULL == (coords_p = malloc(nlongs * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_elements: failed to allocate coordinate buffer"); - jlp = (jlong *)P; - llp = lp; - for (ii = 0; ii < nlongs; ii++) { - *lp = (hsize_t)*jlp; - lp++; - jlp++; - } /* end for */ + pinned_arr_p = (uint8_t *)pinned_arr; + for (size_t i = 0; i < nlongs; i++) { + jlong coord_elem; + + memcpy(&coord_elem, pinned_arr_p, sizeof(jlong)); + + if (coord_elem < 0) + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sselect_elements: coordinate element can't be negative"); - if ((status = H5Sselect_elements(space_id, (H5S_seloper_t)op, (size_t)num_elemn, (const hsize_t *)llp)) < - 0) + coords_p[i] = (hsize_t)coord_elem; + + pinned_arr_p += sizeof(jlong); + } + + if ((status = H5Sselect_elements(space_id, (H5S_seloper_t)op, (size_t)num_elemn, coords_p)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: - if (llp) - free(llp); - if (P) - UNPIN_BYTE_ARRAY(ENVONLY, coords, P, JNI_ABORT); + free(coords_p); + + if (pinned_arr) + UNPIN_BYTE_ARRAY(ENVONLY, coords, pinned_arr, JNI_ABORT); return (jint)status; } /* end Java_hdf_hdf5lib_H5_H5Sselect_1elements */ @@ -630,49 +633,49 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Soffset_1simple(JNIEnv *env, jclass clss, jlong space_id, jbyteArray offset) { jboolean isCopy; - hssize_t *sa = NULL; - hssize_t *lp = NULL; + hssize_t *offset_dims = NULL; + uint8_t *pinned_arr_p = NULL; + jbyte *pinned_arr = NULL; size_t rank; - jsize i; - jbyte *P = NULL; - jlong *jlp = NULL; herr_t status = FAIL; UNUSED(clss); if (NULL != offset) { - PIN_BYTE_ARRAY(ENVONLY, offset, P, &isCopy, "H5Soffset_simple: offset not pinned"); + jsize size; + + PIN_BYTE_ARRAY(ENVONLY, offset, pinned_arr, &isCopy, "H5Soffset_simple: offset not pinned"); - if ((i = ENVPTR->GetArrayLength(ENVONLY, offset)) < 0) { + if ((size = ENVPTR->GetArrayLength(ENVONLY, offset)) < 0) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Soffset_simple: offset array length < 0"); } - rank = (size_t)i / sizeof(jlong); + rank = (size_t)size / sizeof(jlong); - if (NULL == (sa = lp = (hssize_t *)malloc((size_t)rank * sizeof(hssize_t)))) + if (NULL == (offset_dims = malloc((size_t)rank * sizeof(hssize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Soffset_simple: failed to allocate offset buffer"); - jlp = (jlong *)P; - for (i = 0; (size_t)i < rank; i++) { - *lp = (hssize_t)*jlp; - lp++; - jlp++; - } /* end for */ - } - else { - P = NULL; - sa = (hssize_t *)P; + pinned_arr_p = (uint8_t *)pinned_arr; + for (size_t i = 0; i < rank; i++) { + jlong offset_elem; + + memcpy(&offset_elem, pinned_arr_p, sizeof(jlong)); + + offset_dims[i] = (hssize_t)offset_elem; + + pinned_arr_p += sizeof(jlong); + } } - if ((status = H5Soffset_simple(space_id, sa)) < 0) + if ((status = H5Soffset_simple(space_id, offset_dims)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: - if (sa) - free(sa); - if (P) - UNPIN_BYTE_ARRAY(ENVONLY, offset, P, JNI_ABORT); + free(offset_dims); + + if (pinned_arr) + UNPIN_BYTE_ARRAY(ENVONLY, offset, pinned_arr, JNI_ABORT); return (jint)status; } /* end Java_hdf_hdf5lib_H5_H5Soffset_1simple */ diff --git a/java/src/jni/h5tImp.c b/java/src/jni/h5tImp.c index 60de0c3992f..309454b16e4 100644 --- a/java/src/jni/h5tImp.c +++ b/java/src/jni/h5tImp.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ @@ -447,8 +447,13 @@ Java_hdf_hdf5lib_H5_H5Tget_1fields_1int(JNIEnv *env, jclass clss, jlong type_id, { jboolean isCopy; jsize arrLen; - jint *P = NULL; - herr_t status = FAIL; + size_t spos; + size_t epos; + size_t esize; + size_t mpos; + size_t msize; + jint *pinned_arr = NULL; + herr_t status = FAIL; UNUSED(clss); @@ -462,15 +467,20 @@ Java_hdf_hdf5lib_H5_H5Tget_1fields_1int(JNIEnv *env, jclass clss, jlong type_id, if (arrLen < 5) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tget_fields_int: fields input array < order 5"); - PIN_INT_ARRAY(ENVONLY, fields, P, &isCopy, "H5Tget_fields_int: fields not pinned"); + PIN_INT_ARRAY(ENVONLY, fields, pinned_arr, &isCopy, "H5Tget_fields_int: fields not pinned"); - if ((status = H5Tget_fields((hid_t)type_id, (size_t *)&(P[0]), (size_t *)&(P[1]), (size_t *)&(P[2]), - (size_t *)&(P[3]), (size_t *)&(P[4]))) < 0) + if ((status = H5Tget_fields((hid_t)type_id, &spos, &epos, &esize, &mpos, &msize)) < 0) H5_LIBRARY_ERROR(ENVONLY); + pinned_arr[0] = (jint)spos; + pinned_arr[1] = (jint)epos; + pinned_arr[2] = (jint)esize; + pinned_arr[3] = (jint)mpos; + pinned_arr[4] = (jint)msize; + done: - if (P) - UNPIN_INT_ARRAY(ENVONLY, fields, P, (status < 0) ? JNI_ABORT : 0); + if (pinned_arr) + UNPIN_INT_ARRAY(ENVONLY, fields, pinned_arr, (status < 0) ? JNI_ABORT : 0); return (jint)status; } /* end Java_hdf_hdf5lib_H5_H5Tget_1fields_1int */ diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index d10ab839a44..9c441729a39 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ @@ -82,10 +82,10 @@ void translate_atomic_wbuf(JNIEnv *env, jobject in_obj, jlong mem_type_ void *raw_buf); /* Strings for output */ -#define H5_TOOLS_GROUP "GROUP" -#define H5_TOOLS_DATASET "DATASET" -#define H5_TOOLS_DATATYPE "DATATYPE" -#define H5_TOOLS_ATTRIBUTE "ATTRIBUTE" +#define H5_TOOLS_GROUP "GROUP" +#define H5_TOOLS_DATASET "DATASET" +#define H5_TOOLS_DATATYPE "DATATYPE" +#define H5_TOOLS_MAP "MAP" /** frees memory held by array of strings */ void @@ -241,7 +241,7 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ } #if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE case sizeof(long double): { - long double tmp_ldouble = 0.0; + long double tmp_ldouble = 0.0L; sscanf(token, "%Lg", &tmp_ldouble); memcpy(cptr, &tmp_ldouble, sizeof(long double)); @@ -892,7 +892,7 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i } #if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE case sizeof(long double): { - long double tmp_ldouble = 0.0; + long double tmp_ldouble = 0.0L; memcpy(&tmp_ldouble, cptr, sizeof(long double)); @@ -1221,6 +1221,11 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: snprintf failure"); break; + case H5O_TYPE_MAP: + if (snprintf(this_str, size, "%s %s", H5_TOOLS_MAP, obj_tok_str) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: snprintf failure"); + break; + case H5O_TYPE_UNKNOWN: case H5O_TYPE_NTYPES: default: @@ -1303,6 +1308,12 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i "h5str_sprintf: snprintf failure"); break; + case H5O_TYPE_MAP: + if (snprintf(this_str, this_len, "%s ", H5_TOOLS_MAP) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, + "h5str_sprintf: snprintf failure"); + break; + case H5O_TYPE_UNKNOWN: case H5O_TYPE_NTYPES: default: @@ -4222,6 +4233,9 @@ translate_atomic_rbuf(JNIEnv *env, jlong mem_type_id, H5T_class_t type_class, vo CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); break; } + default: + H5_BAD_ARGUMENT_ERROR(ENVONLY, + "translate_atomic_rbuf: no matching JNI type for integer type"); } break; } /* H5T_INTEGER */ @@ -4246,6 +4260,9 @@ translate_atomic_rbuf(JNIEnv *env, jlong mem_type_id, H5T_class_t type_class, vo CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); break; } + default: + H5_BAD_ARGUMENT_ERROR( + ENVONLY, "translate_atomic_rbuf: no matching JNI type for floating-point type"); } break; } /* H5T_FLOAT */ @@ -4295,6 +4312,9 @@ translate_atomic_rbuf(JNIEnv *env, jlong mem_type_id, H5T_class_t type_class, vo break; } /* H5T_STRING */ + case H5T_TIME: + case H5T_NO_CLASS: + case H5T_NCLASSES: default: H5_UNIMPLEMENTED(ENVONLY, "translate_atomic_rbuf: invalid class type"); break; @@ -4456,6 +4476,9 @@ translate_atomic_wbuf(JNIEnv *env, jobject in_obj, jlong mem_type_id, H5T_class_ memcpy(char_buf, ((char *)&longValue), typeSize); break; } + default: + H5_BAD_ARGUMENT_ERROR(ENVONLY, + "translate_atomic_wbuf: no matching JNI type for integer type"); } break; } /* H5T_INTEGER */ @@ -4472,6 +4495,9 @@ translate_atomic_wbuf(JNIEnv *env, jobject in_obj, jlong mem_type_id, H5T_class_ memcpy(char_buf, ((char *)&doubleValue), typeSize); break; } + default: + H5_BAD_ARGUMENT_ERROR( + ENVONLY, "translate_atomic_wbuf: no matching JNI type for floating-point type"); } break; } /* H5T_FLOAT */ @@ -4510,6 +4536,9 @@ translate_atomic_wbuf(JNIEnv *env, jobject in_obj, jlong mem_type_id, H5T_class_ } break; } /* H5T_STRING */ + case H5T_TIME: + case H5T_NO_CLASS: + case H5T_NCLASSES: default: H5_UNIMPLEMENTED(ENVONLY, "translate_atomic_wbuf: invalid class type"); break; @@ -4729,6 +4758,9 @@ translate_rbuf(JNIEnv *env, jobjectArray ret_buf, jlong mem_type_id, H5T_class_t } break; } + case H5T_TIME: + case H5T_NO_CLASS: + case H5T_NCLASSES: default: H5_UNIMPLEMENTED(ENVONLY, "translate_rbuf: invalid class type"); break; @@ -4888,6 +4920,9 @@ translate_wbuf(JNIEnv *env, jobjectArray in_buf, jlong mem_type_id, H5T_class_t } break; } + case H5T_TIME: + case H5T_NO_CLASS: + case H5T_NCLASSES: default: H5_UNIMPLEMENTED(ENVONLY, "translate_wbuf: invalid class type"); break; diff --git a/java/src/jni/h5util.h b/java/src/jni/h5util.h index d8ecef901cc..5af96afaee9 100644 --- a/java/src/jni/h5util.h +++ b/java/src/jni/h5util.h @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ diff --git a/java/src/jni/h5vlImp.c b/java/src/jni/h5vlImp.c index 090e1ce52bc..2bf0b8d6b0a 100644 --- a/java/src/jni/h5vlImp.c +++ b/java/src/jni/h5vlImp.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ diff --git a/java/src/jni/h5zImp.c b/java/src/jni/h5zImp.c index dbcbe4b3cd0..e6d37bfa3af 100644 --- a/java/src/jni/h5zImp.c +++ b/java/src/jni/h5zImp.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ diff --git a/java/src/jni/nativeData.c b/java/src/jni/nativeData.c index c8f94cf691d..d25951ff436 100644 --- a/java/src/jni/nativeData.c +++ b/java/src/jni/nativeData.c @@ -12,7 +12,7 @@ /* * For details of the HDF libraries, see the HDF Documentation at: - * http://hdfgroup.org/HDF5/doc/ + * https://portal.hdfgroup.org/documentation/index.html * */ /* @@ -49,13 +49,11 @@ Java_hdf_hdf5lib_HDFNativeData_byteToInt___3B(JNIEnv *env, jclass clss, jbyteArr { jintArray rarray = NULL; jboolean bb; + uint8_t *p = NULL; jbyte *barr = NULL; jint *iarray = NULL; - jint *iap = NULL; - char *bp = NULL; - int blen; - int ii; - int len; + jsize ilen; + jsize blen; UNUSED(clss); @@ -69,20 +67,21 @@ Java_hdf_hdf5lib_HDFNativeData_byteToInt___3B(JNIEnv *env, jclass clss, jbyteArr H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToInt: bdata length < 0"); } - len = blen / (int)sizeof(jint); + ilen = blen / (jsize)sizeof(jint); - if (NULL == (rarray = ENVPTR->NewIntArray(ENVONLY, len))) + if (NULL == (rarray = ENVPTR->NewIntArray(ENVONLY, ilen))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); PIN_INT_ARRAY(ENVONLY, rarray, iarray, &bb, "byteToInt: int array not pinned"); - bp = (char *)barr; - iap = iarray; - for (ii = 0; ii < len; ii++) { - *iap = *(jint *)bp; - iap++; - bp += sizeof(jint); - } /* end for */ + p = (uint8_t *)barr; + for (size_t i = 0; i < (size_t)ilen; i++) { + jint val; + + memcpy(&val, p, sizeof(jint)); + iarray[i] = val; + p += sizeof(jint); + } done: if (iarray) @@ -93,57 +92,6 @@ Java_hdf_hdf5lib_HDFNativeData_byteToInt___3B(JNIEnv *env, jclass clss, jbyteArr return rarray; } /* end Java_hdf_hdf5lib_HDFNativeData_byteToInt___3B */ -/* returns float [] */ -JNIEXPORT jfloatArray JNICALL -Java_hdf_hdf5lib_HDFNativeData_byteToFloat___3B(JNIEnv *env, jclass clss, - jbyteArray bdata) /* IN: array of bytes */ -{ - jfloatArray rarray = NULL; - jboolean bb; - jfloat *farray = NULL; - jfloat *iap = NULL; - jbyte *barr = NULL; - char *bp = NULL; - int blen; - int ii; - int len; - - UNUSED(clss); - - if (NULL == bdata) - H5_NULL_ARGUMENT_ERROR(ENVONLY, "byteToFloat: byte array is NULL"); - - PIN_BYTE_ARRAY(ENVONLY, bdata, barr, &bb, "byteToFloat: byte array not pinned"); - - if ((blen = ENVPTR->GetArrayLength(ENVONLY, bdata)) < 0) { - CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToFloat: bdata length < 0"); - } - - len = blen / (int)sizeof(jfloat); - - if (NULL == (rarray = ENVPTR->NewFloatArray(ENVONLY, len))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - - PIN_FLOAT_ARRAY(ENVONLY, rarray, farray, &bb, "byteToFloat: float array not pinned"); - - bp = (char *)barr; - iap = farray; - for (ii = 0; ii < len; ii++) { - *iap = *(jfloat *)bp; - iap++; - bp += sizeof(jfloat); - } /* end for */ - -done: - if (farray) - UNPIN_FLOAT_ARRAY(ENVONLY, rarray, farray, rarray ? 0 : JNI_ABORT); - if (barr) - UNPIN_BYTE_ARRAY(ENVONLY, bdata, barr, JNI_ABORT); - - return rarray; -} /* end Java_hdf_hdf5lib_HDFNativeData_byteToFloat___3B */ - /* returns short [] */ JNIEXPORT jshortArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToShort___3B(JNIEnv *env, jclass clss, @@ -151,13 +99,11 @@ Java_hdf_hdf5lib_HDFNativeData_byteToShort___3B(JNIEnv *env, jclass clss, { jshortArray rarray = NULL; jboolean bb; + uint8_t *p = NULL; jshort *sarray = NULL; - jshort *iap = NULL; jbyte *barr = NULL; - char *bp = NULL; - int blen; - int ii; - int len; + jsize slen; + jsize blen; UNUSED(clss); @@ -171,20 +117,21 @@ Java_hdf_hdf5lib_HDFNativeData_byteToShort___3B(JNIEnv *env, jclass clss, H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToShort: bdata length < 0"); } - len = blen / (int)sizeof(jshort); + slen = blen / (jsize)sizeof(jshort); - if (NULL == (rarray = ENVPTR->NewShortArray(ENVONLY, len))) + if (NULL == (rarray = ENVPTR->NewShortArray(ENVONLY, slen))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); PIN_SHORT_ARRAY(ENVONLY, rarray, sarray, &bb, "byteToShort: short array not pinned"); - bp = (char *)barr; - iap = sarray; - for (ii = 0; ii < len; ii++) { - *iap = *(jshort *)bp; - iap++; - bp += sizeof(jshort); - } /* end for */ + p = (uint8_t *)barr; + for (size_t i = 0; i < (size_t)slen; i++) { + jshort val; + + memcpy(&val, p, sizeof(jshort)); + sarray[i] = val; + p += sizeof(jshort); + } done: if (sarray) @@ -202,13 +149,11 @@ Java_hdf_hdf5lib_HDFNativeData_byteToLong___3B(JNIEnv *env, jclass clss, { jlongArray rarray = NULL; jboolean bb; + uint8_t *p = NULL; jlong *larray = NULL; - jlong *iap = NULL; jbyte *barr = NULL; - char *bp = NULL; - int blen; - int ii; - int len; + jsize llen; + jsize blen; UNUSED(clss); @@ -222,20 +167,21 @@ Java_hdf_hdf5lib_HDFNativeData_byteToLong___3B(JNIEnv *env, jclass clss, H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToLong: bdata length < 0"); } - len = blen / (int)sizeof(jlong); + llen = blen / (jsize)sizeof(jlong); - if (NULL == (rarray = ENVPTR->NewLongArray(ENVONLY, len))) + if (NULL == (rarray = ENVPTR->NewLongArray(ENVONLY, llen))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); PIN_LONG_ARRAY(ENVONLY, rarray, larray, &bb, "byteToLong: long array not pinned"); - bp = (char *)barr; - iap = larray; - for (ii = 0; ii < len; ii++) { - *iap = *(jlong *)bp; - iap++; - bp += sizeof(jlong); - } /* end for */ + p = (uint8_t *)barr; + for (size_t i = 0; i < (size_t)llen; i++) { + jlong val; + + memcpy(&val, p, sizeof(jlong)); + larray[i] = val; + p += sizeof(jlong); + } done: if (larray) @@ -246,6 +192,56 @@ Java_hdf_hdf5lib_HDFNativeData_byteToLong___3B(JNIEnv *env, jclass clss, return rarray; } /* end Java_hdf_hdf5lib_HDFNativeData_byteToLong___3B */ +/* returns float [] */ +JNIEXPORT jfloatArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_byteToFloat___3B(JNIEnv *env, jclass clss, + jbyteArray bdata) /* IN: array of bytes */ +{ + jfloatArray rarray = NULL; + jboolean bb; + uint8_t *p = NULL; + jfloat *farray = NULL; + jbyte *barr = NULL; + jsize flen; + jsize blen; + + UNUSED(clss); + + if (NULL == bdata) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "byteToFloat: byte array is NULL"); + + PIN_BYTE_ARRAY(ENVONLY, bdata, barr, &bb, "byteToFloat: byte array not pinned"); + + if ((blen = ENVPTR->GetArrayLength(ENVONLY, bdata)) < 0) { + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToFloat: bdata length < 0"); + } + + flen = blen / (jsize)sizeof(jfloat); + + if (NULL == (rarray = ENVPTR->NewFloatArray(ENVONLY, flen))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + PIN_FLOAT_ARRAY(ENVONLY, rarray, farray, &bb, "byteToFloat: float array not pinned"); + + p = (uint8_t *)barr; + for (size_t i = 0; i < (size_t)flen; i++) { + jfloat val; + + memcpy(&val, p, sizeof(jfloat)); + farray[i] = val; + p += sizeof(jfloat); + } + +done: + if (farray) + UNPIN_FLOAT_ARRAY(ENVONLY, rarray, farray, rarray ? 0 : JNI_ABORT); + if (barr) + UNPIN_BYTE_ARRAY(ENVONLY, bdata, barr, JNI_ABORT); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_byteToFloat___3B */ + /* returns double [] */ JNIEXPORT jdoubleArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToDouble___3B(JNIEnv *env, jclass clss, @@ -253,13 +249,11 @@ Java_hdf_hdf5lib_HDFNativeData_byteToDouble___3B(JNIEnv *env, jclass clss, { jdoubleArray rarray = NULL; jboolean bb; + uint8_t *p = NULL; jdouble *darray = NULL; - jdouble *iap = NULL; jbyte *barr = NULL; - char *bp = NULL; - int blen; - int ii; - int len; + jsize dlen; + jsize blen; UNUSED(clss); @@ -273,20 +267,21 @@ Java_hdf_hdf5lib_HDFNativeData_byteToDouble___3B(JNIEnv *env, jclass clss, H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToDouble: bdata length < 0"); } - len = blen / (int)sizeof(jdouble); + dlen = blen / (jsize)sizeof(jdouble); - if (NULL == (rarray = ENVPTR->NewDoubleArray(ENVONLY, len))) + if (NULL == (rarray = ENVPTR->NewDoubleArray(ENVONLY, dlen))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); PIN_DOUBLE_ARRAY(ENVONLY, rarray, darray, &bb, "byteToDouble: double array not pinned"); - bp = (char *)barr; - iap = darray; - for (ii = 0; ii < len; ii++) { - *iap = *(jdouble *)bp; - iap++; - bp += sizeof(jdouble); - } /* end for */ + p = (uint8_t *)barr; + for (size_t i = 0; i < (size_t)dlen; i++) { + jdouble val; + + memcpy(&val, p, sizeof(jdouble)); + darray[i] = val; + p += sizeof(jdouble); + } done: if (darray) @@ -304,12 +299,10 @@ Java_hdf_hdf5lib_HDFNativeData_byteToInt__II_3B(JNIEnv *env, jclass clss, jint s { jintArray rarray = NULL; jboolean bb; + uint8_t *p = NULL; jint *iarray = NULL; - jint *iap = NULL; jbyte *barr = NULL; - char *bp = NULL; - int blen; - int ii; + jsize blen; UNUSED(clss); @@ -323,22 +316,22 @@ Java_hdf_hdf5lib_HDFNativeData_byteToInt__II_3B(JNIEnv *env, jclass clss, jint s H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToInt: bdata length < 0"); } - if ((start < 0) || ((int)(start + (len * (int)sizeof(jint))) > blen)) - H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToInt: start < 0 or len exceeded buffer length"); - - bp = (char *)barr + start; + if ((start < 0) || (len < 0) || ((int)(start + (len * (int)sizeof(jint))) > blen)) + H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToInt: start < 0, len < 0 or len exceeded buffer length"); if (NULL == (rarray = ENVPTR->NewIntArray(ENVONLY, len))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); PIN_INT_ARRAY(ENVONLY, rarray, iarray, &bb, "byteToInt: int array not pinned"); - iap = iarray; - for (ii = 0; ii < len; ii++) { - *iap = *(jint *)bp; - iap++; - bp += sizeof(jint); - } /* end for */ + p = (uint8_t *)barr + start; + for (size_t i = 0; i < (size_t)len; i++) { + jint val; + + memcpy(&val, p, sizeof(jint)); + iarray[i] = val; + p += sizeof(jint); + } done: if (iarray) @@ -356,12 +349,10 @@ Java_hdf_hdf5lib_HDFNativeData_byteToShort__II_3B(JNIEnv *env, jclass clss, jint { jshortArray rarray = NULL; jboolean bb; + uint8_t *p = NULL; jshort *sarray = NULL; - jshort *iap = NULL; jbyte *barr = NULL; - char *bp = NULL; - int blen; - int ii; + jsize blen; UNUSED(clss); @@ -375,22 +366,22 @@ Java_hdf_hdf5lib_HDFNativeData_byteToShort__II_3B(JNIEnv *env, jclass clss, jint H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToShort: bdata length < 0"); } - if ((start < 0) || ((int)(start + (len * (int)sizeof(jshort))) > blen)) - H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToShort: start < 0 or len exceeded buffer length"); - - bp = (char *)barr + start; + if ((start < 0) || (len < 0) || ((int)(start + (len * (int)sizeof(jshort))) > blen)) + H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToShort: start < 0, len < 0 or len exceeded buffer length"); if (NULL == (rarray = ENVPTR->NewShortArray(ENVONLY, len))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); PIN_SHORT_ARRAY(ENVONLY, rarray, sarray, &bb, "byteToShort: short array not pinned"); - iap = sarray; - for (ii = 0; ii < len; ii++) { - *iap = *(jshort *)bp; - iap++; - bp += sizeof(jshort); - } /* end for */ + p = (uint8_t *)barr + start; + for (size_t i = 0; i < (size_t)len; i++) { + jshort val; + + memcpy(&val, p, sizeof(jshort)); + sarray[i] = val; + p += sizeof(jshort); + } done: if (sarray) @@ -401,109 +392,105 @@ Java_hdf_hdf5lib_HDFNativeData_byteToShort__II_3B(JNIEnv *env, jclass clss, jint return rarray; } /* end Java_hdf_hdf5lib_HDFNativeData_byteToShort__II_3B */ -/* returns float [] */ -JNIEXPORT jfloatArray JNICALL -Java_hdf_hdf5lib_HDFNativeData_byteToFloat__II_3B(JNIEnv *env, jclass clss, jint start, jint len, - jbyteArray bdata) /* IN: array of bytes */ +/* returns long [] */ +JNIEXPORT jlongArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_byteToLong__II_3B(JNIEnv *env, jclass clss, jint start, jint len, + jbyteArray bdata) /* IN: array of bytes */ { - jfloatArray rarray = NULL; - jboolean bb; - jfloat *farray = NULL; - jfloat *iap = NULL; - jbyte *barr = NULL; - char *bp = NULL; - int blen; - int ii; + jlongArray rarray = NULL; + jboolean bb; + uint8_t *p = NULL; + jlong *larray = NULL; + jbyte *barr = NULL; + jsize blen; UNUSED(clss); if (NULL == bdata) - H5_NULL_ARGUMENT_ERROR(ENVONLY, "byteToFloat: byte array is NULL"); + H5_NULL_ARGUMENT_ERROR(ENVONLY, "byteToLong: byte array is NULL"); - PIN_BYTE_ARRAY(ENVONLY, bdata, barr, &bb, "byteToFloat: byte array not pinned"); + PIN_BYTE_ARRAY(ENVONLY, bdata, barr, &bb, "byteToLong: byte array not pinned"); if ((blen = ENVPTR->GetArrayLength(ENVONLY, bdata)) < 0) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToFloat: bdata length < 0"); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToLong: bdata length < 0"); } - if ((start < 0) || ((int)(start + (len * (int)sizeof(jfloat))) > blen)) - H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToFloat: start < 0 or len exceeded buffer length"); - - bp = (char *)barr + start; + if ((start < 0) || (len < 0) || ((int)(start + (len * (int)sizeof(jlong))) > blen)) + H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToLong: start < 0, len < 0 or len exceeded buffer length"); - if (NULL == (rarray = ENVPTR->NewFloatArray(ENVONLY, len))) + if (NULL == (rarray = ENVPTR->NewLongArray(ENVONLY, len))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - PIN_FLOAT_ARRAY(ENVONLY, rarray, farray, &bb, "byteToFloat: float array not pinned"); + PIN_LONG_ARRAY(ENVONLY, rarray, larray, &bb, "byteToLong: long array not pinned"); - iap = farray; - for (ii = 0; ii < len; ii++) { - *iap = *(jfloat *)bp; - iap++; - bp += sizeof(jfloat); - } /* end for */ + p = (uint8_t *)barr + start; + for (size_t i = 0; i < (size_t)len; i++) { + jlong val; + + memcpy(&val, p, sizeof(jlong)); + larray[i] = val; + p += sizeof(jlong); + } done: - if (farray) - UNPIN_FLOAT_ARRAY(ENVONLY, rarray, farray, rarray ? 0 : JNI_ABORT); + if (larray) + UNPIN_LONG_ARRAY(ENVONLY, rarray, larray, rarray ? 0 : JNI_ABORT); if (barr) UNPIN_BYTE_ARRAY(ENVONLY, bdata, barr, JNI_ABORT); return rarray; -} /* end Java_hdf_hdf5lib_HDFNativeData_byteToFloat__II_3B */ +} /* end Java_hdf_hdf5lib_HDFNativeData_byteToLong__II_3B */ -/* returns long [] */ -JNIEXPORT jlongArray JNICALL -Java_hdf_hdf5lib_HDFNativeData_byteToLong__II_3B(JNIEnv *env, jclass clss, jint start, jint len, - jbyteArray bdata) /* IN: array of bytes */ +/* returns float [] */ +JNIEXPORT jfloatArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_byteToFloat__II_3B(JNIEnv *env, jclass clss, jint start, jint len, + jbyteArray bdata) /* IN: array of bytes */ { - jlongArray rarray = NULL; - jboolean bb; - jlong *larray = NULL; - jlong *iap = NULL; - jbyte *barr = NULL; - char *bp = NULL; - int blen; - int ii; + jfloatArray rarray = NULL; + jboolean bb; + uint8_t *p = NULL; + jfloat *farray = NULL; + jbyte *barr = NULL; + jsize blen; UNUSED(clss); if (NULL == bdata) - H5_NULL_ARGUMENT_ERROR(ENVONLY, "byteToLong: byte array is NULL"); + H5_NULL_ARGUMENT_ERROR(ENVONLY, "byteToFloat: byte array is NULL"); - PIN_BYTE_ARRAY(ENVONLY, bdata, barr, &bb, "byteToLong: byte array not pinned"); + PIN_BYTE_ARRAY(ENVONLY, bdata, barr, &bb, "byteToFloat: byte array not pinned"); if ((blen = ENVPTR->GetArrayLength(ENVONLY, bdata)) < 0) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToLong: bdata length < 0"); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToFloat: bdata length < 0"); } - if ((start < 0) || ((int)(start + (len * (int)sizeof(jlong))) > blen)) - H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToLong: start < 0 or len exceeded buffer length"); - - bp = (char *)barr + start; + if ((start < 0) || (len < 0) || ((int)(start + (len * (int)sizeof(jfloat))) > blen)) + H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToFloat: start < 0, len < 0 or len exceeded buffer length"); - if (NULL == (rarray = ENVPTR->NewLongArray(ENVONLY, len))) + if (NULL == (rarray = ENVPTR->NewFloatArray(ENVONLY, len))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - PIN_LONG_ARRAY(ENVONLY, rarray, larray, &bb, "byteToLong: long array not pinned"); + PIN_FLOAT_ARRAY(ENVONLY, rarray, farray, &bb, "byteToFloat: float array not pinned"); - iap = larray; - for (ii = 0; ii < len; ii++) { - *iap = *(jlong *)bp; - iap++; - bp += sizeof(jlong); - } /* end for */ + p = (uint8_t *)barr + start; + for (size_t i = 0; i < (size_t)len; i++) { + jfloat val; + + memcpy(&val, p, sizeof(jfloat)); + farray[i] = val; + p += sizeof(jfloat); + } done: - if (larray) - UNPIN_LONG_ARRAY(ENVONLY, rarray, larray, rarray ? 0 : JNI_ABORT); + if (farray) + UNPIN_FLOAT_ARRAY(ENVONLY, rarray, farray, rarray ? 0 : JNI_ABORT); if (barr) UNPIN_BYTE_ARRAY(ENVONLY, bdata, barr, JNI_ABORT); return rarray; -} /* end Java_hdf_hdf5lib_HDFNativeData_byteToLong__II_3B */ +} /* end Java_hdf_hdf5lib_HDFNativeData_byteToFloat__II_3B */ /* returns double [] */ JNIEXPORT jdoubleArray JNICALL @@ -512,12 +499,10 @@ Java_hdf_hdf5lib_HDFNativeData_byteToDouble__II_3B(JNIEnv *env, jclass clss, jin { jdoubleArray rarray = NULL; jboolean bb; + uint8_t *p = NULL; jdouble *darray = NULL; - jdouble *iap = NULL; jbyte *barr = NULL; - char *bp = NULL; - int blen; - int ii; + jsize blen; UNUSED(clss); @@ -531,22 +516,22 @@ Java_hdf_hdf5lib_HDFNativeData_byteToDouble__II_3B(JNIEnv *env, jclass clss, jin H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToDouble: bdata length < 0"); } - if ((start < 0) || ((int)(start + (len * (int)sizeof(jdouble))) > blen)) - H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToDouble: start < 0 or len exceeded buffer length"); - - bp = (char *)barr + start; + if ((start < 0) || (len < 0) || ((int)(start + (len * (int)sizeof(jdouble))) > blen)) + H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToDouble: start < 0, len < 0 or len exceeded buffer length"); if (NULL == (rarray = ENVPTR->NewDoubleArray(ENVONLY, len))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); PIN_DOUBLE_ARRAY(ENVONLY, rarray, darray, &bb, "byteToDouble: double array not pinned"); - iap = darray; - for (ii = 0; ii < len; ii++) { - *iap = *(jdouble *)bp; - iap++; - bp += sizeof(jdouble); - } /* end for */ + p = (uint8_t *)barr + start; + for (size_t i = 0; i < (size_t)len; i++) { + jdouble val; + + memcpy(&val, p, sizeof(jdouble)); + darray[i] = val; + p += sizeof(jdouble); + } done: if (darray) diff --git a/m4/aclocal_fc.f90 b/m4/aclocal_fc.f90 index 939988f64aa..9e4bfde3c90 100644 --- a/m4/aclocal_fc.f90 +++ b/m4/aclocal_fc.f90 @@ -21,7 +21,8 @@ ! PROGRAM PROG_FC_ISO_FORTRAN_ENV - USE, INTRINSIC :: ISO_FORTRAN_ENV + USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : atomic_logical_kind + LOGICAL(KIND=atomic_logical_kind) :: state END PROGRAM PROG_FC_ISO_FORTRAN_ENV PROGRAM PROG_FC_SIZEOF diff --git a/m4/aclocal_fc.m4 b/m4/aclocal_fc.m4 index f7427924ee2..6e5703e9132 100644 --- a/m4/aclocal_fc.m4 +++ b/m4/aclocal_fc.m4 @@ -64,11 +64,11 @@ dnl dnl See if the fortran compiler supports the intrinsic module "ISO_FORTRAN_ENV" AC_DEFUN([PAC_PROG_FC_ISO_FORTRAN_ENV],[ - HAVE_ISO_FORTRAN_ENV="no" - AC_MSG_CHECKING([if Fortran compiler supports intrinsic module ISO_FORTRAN_ENV]) + CHECK_ISO_FORTRAN_ENV="no" + AC_MSG_CHECKING([if Fortran compiler supports intrinsic module ISO_FORTRAN_ENV (F08)]) TEST_SRC="`sed -n '/PROGRAM PROG_FC_ISO_FORTRAN_ENV/,/END PROGRAM PROG_FC_ISO_FORTRAN_ENV/p' $srcdir/m4/aclocal_fc.f90`" AC_LINK_IFELSE([$TEST_SRC],[AC_MSG_RESULT([yes]) - HAVE_ISO_FORTRAN_ENV="yes"], + CHECK_ISO_FORTRAN_ENV="yes"], [AC_MSG_RESULT([no])]) ]) @@ -391,6 +391,8 @@ AC_DEFUN([PAC_FC_NATIVE_INTEGER],[ AC_REQUIRE([PAC_FC_AVAIL_KINDS]) AC_MSG_CHECKING([sizeof of native KINDS]) AC_LANG_PUSH([Fortran]) +saved_FCFLAGS=$FCFLAGS +FCFLAGS=$saved_user_FCFLAGS pack_int_sizeof="" rm -f pac_fconftest.out AC_LANG_CONFTEST([ @@ -424,6 +426,7 @@ rm -f pac_fconftest.out pack_int_sizeof="$2" ]) AC_MSG_RESULT([$pack_int_sizeof]) +FCFLAGS=$saved_FCFLAGS AC_LANG_POP([Fortran]) ]) diff --git a/release_docs/NEWSLETTER.txt b/release_docs/NEWSLETTER.txt index ef896457763..19c11ac4b39 100644 --- a/release_docs/NEWSLETTER.txt +++ b/release_docs/NEWSLETTER.txt @@ -1,29 +1,8 @@ -INTRODUCTION +Release of HDF5 1.14.4 Library and Tools is now available from the HDF5 Releases page. -This purpose of this document is to contain entries that can be used to quickly -produce a release newsletter. When something is added to the library that is -"newsletter worthy" (i.e., new feature, CVE fix, etc.) a summary note should -be added here. +This is a maintenance release with a few changes and updates: +---------------------------------------------------------------------------- -The format should look like this: - -* SUMMARY OF NEWSLETTER-WORTHY THING - - Here is where you describe the summary. Summarize the feature, fix, or - change in general language. Remember, RELEASE.txt is for communicating - technical specifics. Text entered here is more like advertising. - - (GitHub #123, #125) - -The GitHub #s could be relevant issues or PRs. They will probably not appear -in the final newsletter, but are so that the person writing the newsletter -has easy access to context if they have questions. - -Every entry in RELEASE.txt does NOT require an entry here. The newsletter is -for communicating major changes that are of interest to anyone. Minor bugfixes, -memory leak fixes, etc. do not require entries. - - * Added support for _Float16 16-bit floating-point datatype Support for the 16-bit floating-point _Float16 C type has been added to @@ -34,3 +13,7 @@ memory leak fixes, etc. do not require entries. data and data of another HDF5 datatype. (GitHub #4065, #2154) + +---------------------------------------------------------------------------- +Please see the full release notes for detailed information regarding this release, +including a detailed list of changes. diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index ac520ba3179..ef3f1af4912 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -461,6 +461,28 @@ Bug Fixes since HDF5-1.14.3 release Library ------- + - Fixed a cache assert with too-large metadata objects + + If the library tries to load a metadata object that is above the + library's hard-coded limits, the size will trip an assert in debug + builds. In HDF5 1.14.4, this can happen if you create a very large + number of links in an old-style group that uses local heaps. + + The library will now emit a normal error when it tries to load a + metadata object that is too large. + + Partially addresses GitHub #3762 + + - Fixed an issue with the Subfiling VFD and multiple opens of a + file + + An issue with the way the Subfiling VFD handles multiple opens + of the same file caused the file structures for the extra opens + to occasionally get mapped to an incorrect subfiling context + object. The VFD now correctly maps the file structures for + additional opens of an already open file to the same context + object. + - Fixed a bug that causes the library to incorrectly identify the endian-ness of 16-bit and smaller C floating-point datatypes diff --git a/release_docs/USING_HDF5_CMake.txt b/release_docs/USING_HDF5_CMake.txt index a691647f51d..8011c5c6ea0 100644 --- a/release_docs/USING_HDF5_CMake.txt +++ b/release_docs/USING_HDF5_CMake.txt @@ -234,7 +234,7 @@ adjust the forward slash to double backslashes, except for the HDF_DIR environment variable. NOTE: this file is available in the HDF5 repository, for more information see: - https://github.com/HDFGroup/hdf5/blob/develop/release_docs/USING_CMake_Examples.txt + https://github.com/HDFGroup/hdf5/blob/hdf5_1_14/release_docs/USING_CMake_Examples.txt ctest -S HDF5_Examples.cmake -C Release -V -O test.log diff --git a/src/H5Centry.c b/src/H5Centry.c index c6892e90e3c..a799c4bb97d 100644 --- a/src/H5Centry.c +++ b/src/H5Centry.c @@ -1216,10 +1216,9 @@ H5C__load_entry(H5F_t *f, assert((dirty == false) || (type->id == 5 || type->id == 6)); - entry->cache_ptr = f->shared->cache; - entry->addr = addr; - entry->size = len; - assert(entry->size < H5C_MAX_ENTRY_SIZE); + entry->cache_ptr = f->shared->cache; + entry->addr = addr; + entry->size = len; entry->image_ptr = image; entry->image_up_to_date = !dirty; entry->type = type; @@ -1289,6 +1288,14 @@ H5C__load_entry(H5F_t *f, H5C__RESET_CACHE_ENTRY_STATS(entry); + /* This is a temporary fix for a problem identified in GitHub #3762, where + * it looks like a local heap entry can grow to a size that is larger + * than the metadata cache will allow. This doesn't fix the underlying + * problem, but it at least prevents the library from crashing. + */ + if (entry->size >= H5C_MAX_ENTRY_SIZE) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "cache entry size is too large"); + ret_value = thing; done: diff --git a/src/H5Dint.c b/src/H5Dint.c index d408ef30c81..8f363ebadbe 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -3977,3 +3977,24 @@ H5D__refresh(H5D_t *dset, hid_t dset_id) FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__refresh() */ + +/*------------------------------------------------------------------------- + * Function: H5D_get_dcpl_id + * + * Purpose: Quick and dirty routine to retrieve the + * dcpl_id (dataset creation property list) from the + * dataset creation operation struct + * + * Return: 'dcpl_id' on success/abort on failure (shouldn't fail) + *------------------------------------------------------------------------- + */ +hid_t +H5D_get_dcpl_id(const H5D_obj_create_t *d) +{ + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + assert(d); + + FUNC_LEAVE_NOAPI(d->dcpl_id); +} /* end H5D_get_dcpl_id() */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 684780e8e85..5a0b586594f 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -578,12 +578,12 @@ typedef enum { } H5D_time_alloc_t; /* Typedef for dataset creation operation */ -typedef struct { +struct H5D_obj_create_t { hid_t type_id; /* Datatype for dataset */ const H5S_t *space; /* Dataspace for dataset */ hid_t dcpl_id; /* Dataset creation property list */ hid_t dapl_id; /* Dataset access property list */ -} H5D_obj_create_t; +}; /* Typedef for filling a buffer with a fill value */ typedef struct H5D_fill_buf_info_t { diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index fa8b0770359..e539d872f9e 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -124,12 +124,19 @@ /* Default virtual dataset list size */ #define H5D_VIRTUAL_DEF_LIST_SIZE 8 +#ifdef H5D_MODULE +#define H5D_OBJ_ID(D) (((H5D_obj_create_t *)(D))->dcpl_id) +#else /* H5D_MODULE */ +#define H5D_OBJ_ID(D) (H5D_get_dcpl_id(D)) +#endif + /****************************/ /* Library Private Typedefs */ /****************************/ /* Typedef for dataset in memory (defined in H5Dpkg.h) */ -typedef struct H5D_t H5D_t; +typedef struct H5D_t H5D_t; +typedef struct H5D_obj_create_t H5D_obj_create_t; /* Typedef for cached dataset creation property list information */ typedef struct H5D_dcpl_cache_t { @@ -171,6 +178,7 @@ H5_DLL H5G_name_t *H5D_nameof(H5D_t *dataset); H5_DLL herr_t H5D_flush_all(H5F_t *f); H5_DLL hid_t H5D_get_create_plist(const H5D_t *dset); H5_DLL hid_t H5D_get_access_plist(const H5D_t *dset); +H5_DLL hid_t H5D_get_dcpl_id(const H5D_obj_create_t *d); /* Functions that operate on chunked storage */ H5_DLL herr_t H5D_chunk_idx_reset(H5O_storage_chunk_t *storage, bool reset_addr); diff --git a/src/H5FDcore.c b/src/H5FDcore.c index f169b6581f2..c74ef5ed28a 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -766,6 +766,7 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr if (fa->backing_store) { if ((fd = HDopen(name, o_flags | O_CREAT, H5_POSIX_CREATE_MODE_RW)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to create file"); + memset(&sb, 0, sizeof(h5_stat_t)); if (HDfstat(fd, &sb) < 0) HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, NULL, "unable to fstat file"); } /* end if */ @@ -776,6 +777,7 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr else if (fa->backing_store || !(H5F_ACC_CREAT & flags)) { if ((fd = HDopen(name, o_flags, H5_POSIX_CREATE_MODE_RW)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file"); + memset(&sb, 0, sizeof(h5_stat_t)); if (HDfstat(fd, &sb) < 0) HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, NULL, "unable to fstat file"); } /* end if */ diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index 5dbd43a9601..dc80a614e6a 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -478,6 +478,7 @@ H5FD__direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad if ((fd = HDopen(name, o_flags, H5_POSIX_CREATE_MODE_RW)) < 0) HSYS_GOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file"); + memset(&sb, 0, sizeof(h5_stat_t)); if (HDfstat(fd, &sb) < 0) HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, NULL, "unable to fstat file"); diff --git a/src/H5FDlog.c b/src/H5FDlog.c index c9ec69941ff..677382552e8 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -513,6 +513,7 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) H5_timer_start(&stat_timer); /* Get the file stats */ + memset(&sb, 0, sizeof(h5_stat_t)); if (HDfstat(fd, &sb) < 0) HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, NULL, "unable to fstat file"); diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index 9abc75ced56..274a8ad3462 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -325,6 +325,7 @@ H5FD__sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr name, myerrno, strerror(myerrno), flags, (unsigned)o_flags); } /* end if */ + memset(&sb, 0, sizeof(h5_stat_t)); if (HDfstat(fd, &sb) < 0) HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, NULL, "unable to fstat file"); diff --git a/src/H5FDsubfiling/H5FDioc.c b/src/H5FDsubfiling/H5FDioc.c index fc581775867..f43f638ff0c 100644 --- a/src/H5FDsubfiling/H5FDioc.c +++ b/src/H5FDsubfiling/H5FDioc.c @@ -843,12 +843,17 @@ H5FD__ioc_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) H5_SUBFILING_GOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open subfiles for file '%s'", name); - /* Initialize I/O concentrator threads if this MPI rank is an I/O concentrator */ + /* + * Initialize I/O concentrator threads if this MPI rank is an I/O + * concentrator and the threads haven't already been initialized by + * a different open of this file + */ sf_context = H5_get_subfiling_object(file_ptr->context_id); - if (sf_context && sf_context->topology->rank_is_ioc) { + if (sf_context && sf_context->topology->rank_is_ioc && !sf_context->threads_inited) { if (initialize_ioc_threads(sf_context) < 0) H5_SUBFILING_GOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to initialize I/O concentrator threads"); + sf_context->threads_inited = true; } ret_value = (H5FD_t *)file_ptr; @@ -917,14 +922,22 @@ H5FD__ioc_close_int(H5FD_ioc_t *file_ptr) if (MPI_SUCCESS != (mpi_code = MPI_Barrier(file_ptr->comm))) H5_SUBFILING_MPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_code); - if (sf_context && sf_context->topology->rank_is_ioc) { - if (finalize_ioc_threads(sf_context) < 0) - /* Note that closing of subfiles is collective */ - H5_SUBFILING_DONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to finalize IOC threads"); + /* Only finalize IOC threads and close subfiles if this is + * the last file holding a reference to the context + */ + if (sf_context && sf_context->file_ref == 1) { + if (sf_context->topology->rank_is_ioc && sf_context->threads_inited) { + if (finalize_ioc_threads(sf_context) < 0) + /* Note that closing of subfiles is collective */ + H5_SUBFILING_DONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, + "unable to finalize IOC threads"); + } + + if (H5_close_subfiles(file_ptr->context_id, file_ptr->comm) < 0) + H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, + "unable to close subfiling file(s)"); } - if (H5_close_subfiles(file_ptr->context_id, file_ptr->comm) < 0) - H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close subfiling file(s)"); file_ptr->context_id = -1; } @@ -1479,6 +1492,7 @@ H5FD__ioc_del(const char *name, hid_t fapl) char *prefix_env = NULL; int num_digits = 0; + memset(&st, 0, sizeof(h5_stat_t)); if (HDstat(name, &st) < 0) H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_SYSERRSTR, FAIL, "HDstat failed"); diff --git a/src/H5FDsubfiling/H5FDioc_threads.c b/src/H5FDsubfiling/H5FDioc_threads.c index 85c2561549d..4358d624ed7 100644 --- a/src/H5FDsubfiling/H5FDioc_threads.c +++ b/src/H5FDsubfiling/H5FDioc_threads.c @@ -1213,6 +1213,7 @@ ioc_file_report_eof(sf_work_request_t *msg, MPI_Comm comm) fd = sf_context->sf_fids[subfile_idx]; + memset(&sb, 0, sizeof(h5_stat_t)); if (HDfstat(fd, &sb) < 0) H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_SYSERRSTR, -1, "HDfstat failed"); diff --git a/src/H5FDsubfiling/H5FDsubfiling.c b/src/H5FDsubfiling/H5FDsubfiling.c index 9594f676a88..9b37463fec2 100644 --- a/src/H5FDsubfiling/H5FDsubfiling.c +++ b/src/H5FDsubfiling/H5FDsubfiling.c @@ -1244,7 +1244,9 @@ H5FD__subfiling_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t ma if (driver->value == H5_VFD_IOC) { /* Get a copy of the context ID for later use */ - file_ptr->context_id = H5_subfile_fid_to_context(file_ptr->file_id); + if (H5_subfile_fid_to_context(file_ptr->file_id, &file_ptr->context_id) < 0) + H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, + "unable to retrieve subfiling context ID for this file"); file_ptr->fa.require_ioc = true; } else if (driver->value == H5_VFD_SEC2) { diff --git a/src/H5FDsubfiling/H5subfiling_common.c b/src/H5FDsubfiling/H5subfiling_common.c index 84e07215d53..0493603f828 100644 --- a/src/H5FDsubfiling/H5subfiling_common.c +++ b/src/H5FDsubfiling/H5subfiling_common.c @@ -38,7 +38,7 @@ static sf_topology_t **sf_topology_cache = NULL; static size_t sf_context_cache_size = 0; static size_t sf_topology_cache_size = 0; -static size_t sf_context_cache_num_entries = 0; +static size_t sf_context_cache_next_index = 0; static size_t sf_topology_cache_num_entries = 0; static file_map_to_context_t *sf_open_file_map = NULL; @@ -67,9 +67,9 @@ static herr_t identify_ioc_ranks(int64_t sf_context_id, sf_topology_t *app_topol static herr_t init_subfiling_context(subfiling_context_t *sf_context, const char *base_filename, uint64_t file_id, H5FD_subfiling_params_t *subfiling_config, sf_topology_t *app_topology, MPI_Comm file_comm); -static herr_t open_subfile_with_context(subfiling_context_t *sf_context, int file_acc_flags); -static herr_t record_fid_to_subfile(uint64_t file_id, int64_t subfile_context_id, int *next_index); -static void clear_fid_map_entry(uint64_t file_id, int64_t sf_context_id); +static herr_t init_open_file_map(void); +static herr_t record_fid_map_entry(uint64_t file_id, int64_t subfile_context_id, int *next_index); +static herr_t clear_fid_map_entry(uint64_t file_id, int64_t sf_context_id); static herr_t ioc_open_files(int64_t file_context_id, int file_acc_flags); static herr_t create_config_file(subfiling_context_t *sf_context, const char *base_filename, const char *config_dir, const char *subfile_dir, bool truncate_if_exists); @@ -92,7 +92,7 @@ H5_new_subfiling_object_id(sf_obj_type_t obj_type) int64_t index_val = 0; if (obj_type == SF_CONTEXT) { - index_val = (int64_t)sf_context_cache_num_entries; + index_val = (int64_t)sf_context_cache_next_index; } else if (obj_type == SF_TOPOLOGY) { index_val = (int64_t)sf_topology_cache_num_entries; @@ -156,8 +156,8 @@ H5_get_subfiling_object(int64_t object_id) if (NULL == (sf_context_cache = calloc(DEFAULT_CONTEXT_CACHE_SIZE, sizeof(*sf_context_cache)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "couldn't allocate space for subfiling context cache"); - sf_context_cache_size = DEFAULT_CONTEXT_CACHE_SIZE; - sf_context_cache_num_entries = 0; + sf_context_cache_size = DEFAULT_CONTEXT_CACHE_SIZE; + sf_context_cache_next_index = 0; } /* Make more space in context cache if needed */ @@ -166,7 +166,7 @@ H5_get_subfiling_object(int64_t object_id) size_t new_size; void *tmp_realloc; - old_num_entries = sf_context_cache_num_entries; + old_num_entries = sf_context_cache_size; new_size = (sf_context_cache_size * 3) / 2; @@ -188,23 +188,27 @@ H5_get_subfiling_object(int64_t object_id) assert((size_t)obj_index < sf_context_cache_size); } - /* - * Since this cache currently just keeps all entries until - * application exit, context entry indices should just be - * consecutive - */ - assert((size_t)obj_index <= sf_context_cache_num_entries); - if ((size_t)obj_index < sf_context_cache_num_entries) - ret_value = sf_context_cache[obj_index]; - else { - assert(!sf_context_cache[sf_context_cache_num_entries]); + ret_value = sf_context_cache[obj_index]; + if (!ret_value) { + size_t next_idx; /* Allocate a new subfiling context object */ - if (NULL == (ret_value = calloc(1, sizeof(subfiling_context_t)))) + if (NULL == (sf_context_cache[obj_index] = calloc(1, sizeof(subfiling_context_t)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "couldn't allocate subfiling context object"); - sf_context_cache[sf_context_cache_num_entries++] = ret_value; + ret_value = sf_context_cache[obj_index]; + + /* Set index for next available cache entry. If all available + * slots are filled, the index will be set to sf_context_cache_size + * and cause a reallocation of the cache the next time a new + * cache entry is created. + */ + next_idx = (size_t)obj_index + 1; + while (next_idx < sf_context_cache_size && sf_context_cache[next_idx]) + next_idx++; + + sf_context_cache_next_index = next_idx; } } else if (obj_type == SF_TOPOLOGY) { @@ -310,13 +314,21 @@ H5_free_subfiling_object(int64_t object_id) H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "couldn't get subfiling context for subfiling object ID"); - if (H5_free_subfiling_object_int(sf_context) < 0) - H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "couldn't free subfiling context object"); + if (sf_context->file_ref == 0 || --sf_context->file_ref == 0) { + if (H5_free_subfiling_object_int(sf_context) < 0) + H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, + "couldn't free subfiling context object"); + + for (size_t idx = 0; idx < sf_context_cache_size; idx++) { + if (sf_context != sf_context_cache[idx]) + continue; + + if (idx < sf_context_cache_next_index) + sf_context_cache_next_index = idx; - assert(sf_context_cache_num_entries > 0); - assert(sf_context == sf_context_cache[sf_context_cache_num_entries - 1]); - sf_context_cache[sf_context_cache_num_entries - 1] = NULL; - sf_context_cache_num_entries--; + sf_context_cache[idx] = NULL; + } + } } else if (obj_type == SF_TOPOLOGY) { sf_topology_t *sf_topology; @@ -358,6 +370,8 @@ H5_free_subfiling_object_int(subfiling_context_t *sf_context) sf_context->sf_context_id = -1; sf_context->h5_file_id = UINT64_MAX; + sf_context->threads_inited = false; + sf_context->file_ref = 0; sf_context->sf_num_fids = 0; sf_context->sf_num_subfiles = -1; sf_context->sf_write_count = 0; @@ -565,6 +579,7 @@ H5_open_subfiling_stub_file(const char *name, unsigned flags, MPI_Comm file_comm HDcompile_assert(sizeof(uint64_t) >= sizeof(ino_t)); /* Retrieve Inode value for stub file */ + memset(&st, 0, sizeof(h5_stat_t)); if (HDstat(name, &st) < 0) { stub_file_id = UINT64_MAX; H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, @@ -610,23 +625,18 @@ H5_open_subfiling_stub_file(const char *name, unsigned flags, MPI_Comm file_comm /*------------------------------------------------------------------------- * Function: H5_open_subfiles * - * Purpose: Wrapper for the internal 'open__subfiles' function - * Similar to the other public wrapper functions, we - * discover (via the sf_context) the number of io concentrators - * and pass that to the internal function so that vector - * storage arrays can be stack based rather than explicitly - * allocated and freed. + * Purpose: Initializes a subfiling context object for a file with the + * given filename and file ID (inode) and opens the associated + * subfiles. As part of this process, information about the + * application topology will be gathered and stored in the + * context object for future use. This includes identifying + * which MPI ranks will act as I/O concentrators and "own" + * one or more of the opened subfiles. The process of + * initializing the subfiling context object also involves + * creating MPI communicators that facilitate messaging + * between HDF5 clients and the I/O concentrators. * - * The Internal function is responsible for sending all IOC - * instances, the (sub)file open requests. - * - * Prior to calling the internal open function, we initialize - * a new subfiling context that contains topology info and - * new MPI communicators that facilitate messaging between - * HDF5 clients and the IOCs. - * - * Return: Success (0) or Failure (non-zero) - * Errors: If MPI operations fail for some reason. + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ @@ -634,8 +644,9 @@ herr_t H5_open_subfiles(const char *base_filename, uint64_t file_id, H5FD_subfiling_params_t *subfiling_config, int file_acc_flags, MPI_Comm file_comm, int64_t *context_id_out) { - subfiling_context_t *sf_context = NULL; - int64_t context_id = -1; + subfiling_context_t *sf_context = NULL; + int64_t context_id = -1; + bool recorded_fid = false; int mpi_code; herr_t ret_value = SUCCEED; @@ -648,21 +659,44 @@ H5_open_subfiles(const char *base_filename, uint64_t file_id, H5FD_subfiling_par if (!context_id_out) H5_SUBFILING_GOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "invalid subfiling context ID pointer"); - /* Initialize new subfiling context ID based on configuration information */ - if (init_subfiling(base_filename, file_id, subfiling_config, file_acc_flags, file_comm, &context_id) < 0) - H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "couldn't initialize subfiling context"); + /* Make sure open file mapping is initialized in case this + * is the first file open call with the VFD + */ + if (init_open_file_map() < 0) + H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "couldn't initialize open file mapping"); - /* Retrieve the subfiling object for the newly-created context ID */ - if (NULL == (sf_context = H5_get_subfiling_object(context_id))) - H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "couldn't get subfiling object from context ID"); + /* Check if this file is already open */ + if (H5_subfile_fid_to_context(file_id, &context_id) < 0) + H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, + "couldn't retrieve context ID from open file mapping"); - /* - * If we're actually using the IOCs, we will - * start the service threads on the identified - * ranks as part of the subfile opening. - */ - if (open_subfile_with_context(sf_context, file_acc_flags) < 0) - H5_SUBFILING_GOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "couldn't open subfiling subfiles"); + if (context_id >= 0) { + /* Retrieve the subfiling object for the cached context ID */ + if (NULL == (sf_context = H5_get_subfiling_object(context_id))) + H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, + "couldn't get subfiling object from context ID"); + } + else { + /* Initialize new subfiling context ID based on configuration information */ + if (init_subfiling(base_filename, file_id, subfiling_config, file_acc_flags, file_comm, &context_id) < + 0) + H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "couldn't initialize subfiling context"); + + /* Retrieve the subfiling object for the newly-created context ID */ + if (NULL == (sf_context = H5_get_subfiling_object(context_id))) + H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, + "couldn't get subfiling object from context ID"); + + /* + * If this rank is an I/O concentrator, actually open + * the subfiles belonging to this IOC rank and start + * the I/O service threads + */ + if (sf_context->topology->rank_is_ioc) { + if (ioc_open_files(sf_context->sf_context_id, file_acc_flags) < 0) + H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "IOC couldn't open subfile"); + } + } #ifdef H5_SUBFILING_DEBUG { @@ -688,6 +722,16 @@ H5_open_subfiles(const char *base_filename, uint64_t file_id, H5FD_subfiling_par } #endif + /* + * Save the HDF5 file ID (e.g., inode) to subfile context mapping. + * There shouldn't be any issue, but check the status and + * return if there was a problem. + */ + if (record_fid_map_entry(sf_context->h5_file_id, sf_context->sf_context_id, NULL) < 0) + H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, + "couldn't record HDF5 file ID to subfile context mapping"); + recorded_fid = true; + *context_id_out = context_id; done: @@ -714,7 +758,9 @@ H5_open_subfiles(const char *base_filename, uint64_t file_id, H5FD_subfiling_par } if (ret_value < 0) { - clear_fid_map_entry(file_id, context_id); + if (recorded_fid && clear_fid_map_entry(file_id, context_id) < 0) + H5_SUBFILING_DONE_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, + "unable to clear entry from file ID to context mapping"); if (context_id >= 0 && H5_free_subfiling_object(context_id) < 0) H5_SUBFILING_DONE_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "couldn't free subfiling object"); @@ -1801,6 +1847,8 @@ init_subfiling_context(subfiling_context_t *sf_context, const char *base_filenam assert(MPI_COMM_NULL != file_comm); sf_context->h5_file_id = file_id; + sf_context->threads_inited = false; + sf_context->file_ref = 0; sf_context->sf_fids = NULL; sf_context->sf_num_fids = 0; sf_context->sf_num_subfiles = subfiling_config->stripe_count; @@ -1937,71 +1985,38 @@ init_subfiling_context(subfiling_context_t *sf_context, const char *base_filenam } /*------------------------------------------------------------------------- - * Function: open_subfile_with_context - * - * Purpose: While we cannot know a priori, whether an HDF client will - * need to access data across the entirety of a file, e.g. - * an individual MPI rank may read or write only small - * segments of the entire file space; this function sends - * a file OPEN_OP to every IO concentrator. - * - * Prior to opening any subfiles, the H5FDopen will have - * created an HDF5 file with the user specified naming. - * A path prefix will be selected and is available as - * an input argument. - * - * The opened HDF5 file handle will contain device and - * inode values, these being constant for all processes - * opening the shared file. The inode value is utilized - * as a key value and is associated with the sf_context - * which we receive as one of the input arguments. - * - * IO Concentrator threads will be initialized on MPI ranks - * which have been identified via application toplogy - * discovery. The number and mapping of IOC to MPI_rank - * is part of the sf_context->topology structure. + * Function: init_open_file_map * - * Return: Success (0) or Failure (non-zero) - * Errors: If MPI operations fail for some reason. + * Purpose: Allocates and initializes an array that keeps a mapping + * between a file's inode value (__ino_t st_ino) and the ID + * of the context object associated with it. + * + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ static herr_t -open_subfile_with_context(subfiling_context_t *sf_context, int file_acc_flags) +init_open_file_map(void) { herr_t ret_value = SUCCEED; - assert(sf_context); - assert(sf_context->h5_file_id != UINT64_MAX); - - /* - * Save the HDF5 file ID (e.g., inode) to subfile context mapping. - * There shouldn't be any issue, but check the status and - * return if there was a problem. - */ - if (record_fid_to_subfile(sf_context->h5_file_id, sf_context->sf_context_id, NULL) < 0) - H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, - "couldn't record HDF5 file ID to subfile context mapping"); + if (!sf_open_file_map) { + if (NULL == (sf_open_file_map = malloc((size_t)DEFAULT_FILE_MAP_ENTRIES * sizeof(*sf_open_file_map)))) + H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate open file mapping"); - /* - * If this rank is an I/O concentrator, actually open - * the subfiles belonging to this IOC rank - */ - if (sf_context->topology->rank_is_ioc) { - if (ioc_open_files(sf_context->sf_context_id, file_acc_flags) < 0) - H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "IOC couldn't open subfile"); + sf_file_map_size = DEFAULT_FILE_MAP_ENTRIES; + for (int i = 0; i < sf_file_map_size; i++) { + sf_open_file_map[i].file_id = UINT64_MAX; + sf_open_file_map[i].sf_context_id = -1; + } } done: - if (ret_value < 0) { - clear_fid_map_entry(sf_context->h5_file_id, sf_context->sf_context_id); - } - H5_SUBFILING_FUNC_LEAVE; } /*------------------------------------------------------------------------- - * Function: record_fid_to_subfile + * Function: record_fid_map_entry * * Purpose: Every opened HDF5 file will have (if utilizing subfiling) * a subfiling context associated with it. It is important that @@ -2019,37 +2034,35 @@ open_subfile_with_context(subfiling_context_t *sf_context, int file_acc_flags) * This function simply records the filesystem handle to * subfiling context mapping. * - * Return: SUCCEED or FAIL. - * Errors: FAILs ONLY if storage for the mapping entry cannot - * be allocated. + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ static herr_t -record_fid_to_subfile(uint64_t file_id, int64_t subfile_context_id, int *next_index) +record_fid_map_entry(uint64_t file_id, int64_t subfile_context_id, int *next_index) { - int index; - herr_t ret_value = SUCCEED; - - if (!sf_open_file_map) { - if (NULL == (sf_open_file_map = malloc((size_t)DEFAULT_FILE_MAP_ENTRIES * sizeof(*sf_open_file_map)))) - H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate open file mapping"); - - sf_file_map_size = DEFAULT_FILE_MAP_ENTRIES; - for (int i = 0; i < sf_file_map_size; i++) { - sf_open_file_map[i].file_id = UINT64_MAX; - sf_open_file_map[i].sf_context_id = -1; - } - } + subfiling_context_t *sf_context = NULL; + int index; + herr_t ret_value = SUCCEED; for (index = 0; index < sf_file_map_size; index++) { - if (sf_open_file_map[index].file_id == file_id) + if (sf_open_file_map[index].file_id == file_id) { + /* Increment file ref. count for this context */ + if (NULL == (sf_context = H5_get_subfiling_object(sf_open_file_map[index].sf_context_id))) + H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "couldn't get subfiling context"); + sf_context->file_ref++; goto done; + } if (sf_open_file_map[index].file_id == UINT64_MAX) { sf_open_file_map[index].file_id = file_id; sf_open_file_map[index].sf_context_id = subfile_context_id; + /* First open of this file - set file ref. count to 1 for this context */ + if (NULL == (sf_context = H5_get_subfiling_object(subfile_context_id))) + H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "couldn't get subfiling context"); + sf_context->file_ref = 1; + if (next_index) { *next_index = index; } @@ -2077,8 +2090,13 @@ record_fid_to_subfile(uint64_t file_id, int64_t subfile_context_id, int *next_in *next_index = index; } - sf_open_file_map[index].file_id = file_id; - sf_open_file_map[index++].sf_context_id = subfile_context_id; + sf_open_file_map[index].file_id = file_id; + sf_open_file_map[index].sf_context_id = subfile_context_id; + + /* First open of this file - set file ref. count to 1 for this context */ + if (NULL == (sf_context = H5_get_subfiling_object(subfile_context_id))) + H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "couldn't get subfiling context"); + sf_context->file_ref = 1; } done: @@ -2091,24 +2109,40 @@ record_fid_to_subfile(uint64_t file_id, int64_t subfile_context_id, int *next_in * Purpose: Remove the map entry associated with the file->inode. * This is done at file close. * - * Return: None - * Errors: Cannot fail. + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ -static void +static herr_t clear_fid_map_entry(uint64_t file_id, int64_t sf_context_id) { - if (sf_open_file_map) { - for (int i = 0; i < sf_file_map_size; i++) { - if ((sf_open_file_map[i].file_id == file_id) && - (sf_open_file_map[i].sf_context_id == sf_context_id)) { - sf_open_file_map[i].file_id = UINT64_MAX; - sf_open_file_map[i].sf_context_id = -1; - return; - } + herr_t ret_value = SUCCEED; + + if (!sf_open_file_map) + H5_SUBFILING_GOTO_DONE(SUCCEED); + + for (int i = 0; i < sf_file_map_size; i++) { + subfiling_context_t *sf_context = NULL; + + if ((sf_open_file_map[i].file_id != file_id) || (sf_open_file_map[i].sf_context_id != sf_context_id)) + continue; + + /* Only clear map entry if this is the last file + * holding a reference to the context + */ + if (NULL == (sf_context = H5_get_subfiling_object(sf_context_id))) + H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "couldn't get subfiling context object"); + + if (sf_context->file_ref == 0 || sf_context->file_ref == 1) { + sf_open_file_map[i].file_id = UINT64_MAX; + sf_open_file_map[i].sf_context_id = -1; } + + break; } + +done: + return ret_value; } /* end clear_fid_map_entry() */ /*------------------------------------------------------------------------- @@ -3012,27 +3046,29 @@ H5_subfiling_get_file_id_prop(H5P_genplist_t *plist_ptr, uint64_t *file_id) * Function: H5_subfile_fid_to_context * * Purpose: This is a basic lookup function which returns the subfiling - * context id associated with the specified file ID. + * context ID associated with the specified file ID. If no + * such context ID exists, `context_id_out` will be set to a + * negative value. * - * Return: Non-negative subfiling context ID if the context exists - * Negative on failure or if the subfiling context doesn't - * exist + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ -int64_t -H5_subfile_fid_to_context(uint64_t file_id) +herr_t +H5_subfile_fid_to_context(uint64_t file_id, int64_t *context_id_out) { - int64_t ret_value = -1; + herr_t ret_value = SUCCEED; - if (!sf_open_file_map) - H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_BADVALUE, -1, "open file map is NULL"); + assert(context_id_out); - for (int i = 0; i < sf_file_map_size; i++) { - if (sf_open_file_map[i].file_id == file_id) { - return sf_open_file_map[i].sf_context_id; - } - } + *context_id_out = -1; + + if (init_open_file_map() < 0) + H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "couldn't initialize open file mapping"); + + for (int i = 0; i < sf_file_map_size; i++) + if (sf_open_file_map[i].file_id == file_id) + *context_id_out = sf_open_file_map[i].sf_context_id; done: H5_SUBFILING_FUNC_LEAVE; @@ -3094,15 +3130,17 @@ H5_subfiling_terminate(void) /* Clean up subfiling context and topology caches */ if (sf_context_cache) { - for (size_t i = 0; i < sf_context_cache_num_entries; i++) { - if (H5_free_subfiling_object_int(sf_context_cache[i]) < 0) - H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, - "couldn't free subfiling context object"); - sf_context_cache[i] = NULL; + for (size_t i = 0; i < sf_context_cache_size; i++) { + if (sf_context_cache[i]) { + if (H5_free_subfiling_object_int(sf_context_cache[i]) < 0) + H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, + "couldn't free subfiling context object"); + sf_context_cache[i] = NULL; + } } - sf_context_cache_size = 0; - sf_context_cache_num_entries = 0; + sf_context_cache_size = 0; + sf_context_cache_next_index = 0; free(sf_context_cache); sf_context_cache = NULL; diff --git a/src/H5FDsubfiling/H5subfiling_common.h b/src/H5FDsubfiling/H5subfiling_common.h index 6b5cfa45c27..2c614cc6803 100644 --- a/src/H5FDsubfiling/H5subfiling_common.h +++ b/src/H5FDsubfiling/H5subfiling_common.h @@ -208,29 +208,31 @@ typedef struct topology { } sf_topology_t; typedef struct { - int64_t sf_context_id; /* Generated context ID which embeds the cache index */ - uint64_t h5_file_id; /* GUID (basically the inode value) */ - int *sf_fids; /* Array of file IDs for subfiles this rank owns */ - int sf_num_fids; /* Number of subfiles this rank owns */ - int sf_num_subfiles; /* Total number of subfiles for logical HDF5 file */ - size_t sf_write_count; /* Statistics: write_count */ - size_t sf_read_count; /* Statistics: read_count */ - haddr_t sf_eof; /* File eof */ - int64_t sf_stripe_size; /* Stripe-depth */ - int64_t sf_blocksize_per_stripe; /* Stripe-depth X n_IOCs */ - int64_t sf_base_addr; /* For an IOC, our base address */ - MPI_Comm sf_msg_comm; /* MPI comm used to send RPC msg */ - MPI_Comm sf_data_comm; /* MPI comm used to move data */ - MPI_Comm sf_eof_comm; /* MPI comm used to communicate EOF */ - MPI_Comm sf_node_comm; /* MPI comm used for intra-node comms */ - MPI_Comm sf_group_comm; /* Not used: for IOC collectives */ - int sf_group_size; /* IOC count (in sf_group_comm) */ - int sf_group_rank; /* IOC rank (in sf_group_comm) */ - char *subfile_prefix; /* If subfiles are node-local */ - char *config_file_prefix; /* Prefix added to config file name */ - char *h5_filename; /* The user supplied file name */ - void *ioc_data; /* Private data for underlying IOC */ - sf_topology_t *topology; /* Pointer to our topology */ + int64_t sf_context_id; /* Generated context ID which embeds the cache index */ + uint64_t h5_file_id; /* GUID (basically the inode value) */ + bool threads_inited; /* Whether the IOC threads for this context were started */ + int file_ref; /* Reference count held by files using this context */ + int *sf_fids; /* Array of file IDs for subfiles this rank owns */ + int sf_num_fids; /* Number of subfiles this rank owns */ + int sf_num_subfiles; /* Total number of subfiles for logical HDF5 file */ + size_t sf_write_count; /* Statistics: write_count */ + size_t sf_read_count; /* Statistics: read_count */ + haddr_t sf_eof; /* File eof */ + int64_t sf_stripe_size; /* Stripe-depth */ + int64_t sf_blocksize_per_stripe; /* Stripe-depth X n_IOCs */ + int64_t sf_base_addr; /* For an IOC, our base address */ + MPI_Comm sf_msg_comm; /* MPI comm used to send RPC msg */ + MPI_Comm sf_data_comm; /* MPI comm used to move data */ + MPI_Comm sf_eof_comm; /* MPI comm used to communicate EOF */ + MPI_Comm sf_node_comm; /* MPI comm used for intra-node comms */ + MPI_Comm sf_group_comm; /* Not used: for IOC collectives */ + int sf_group_size; /* IOC count (in sf_group_comm) */ + int sf_group_rank; /* IOC rank (in sf_group_comm) */ + char *subfile_prefix; /* If subfiles are node-local */ + char *config_file_prefix; /* Prefix added to config file name */ + char *h5_filename; /* The user supplied file name */ + void *ioc_data; /* Private data for underlying IOC */ + sf_topology_t *topology; /* Pointer to our topology */ #ifdef H5_SUBFILING_DEBUG char sf_logfile_name[PATH_MAX]; @@ -274,12 +276,12 @@ H5_DLL herr_t H5_get_subfiling_config_from_file(FILE *config_file, int64_t *str int64_t *num_subfiles); H5_DLL herr_t H5_resolve_pathname(const char *filepath, MPI_Comm comm, char **resolved_filepath); -H5_DLL herr_t H5_subfiling_set_config_prop(H5P_genplist_t *plist_ptr, - const H5FD_subfiling_params_t *vfd_config); -H5_DLL herr_t H5_subfiling_get_config_prop(H5P_genplist_t *plist_ptr, H5FD_subfiling_params_t *vfd_config); -H5_DLL herr_t H5_subfiling_set_file_id_prop(H5P_genplist_t *plist_ptr, uint64_t file_id); -H5_DLL herr_t H5_subfiling_get_file_id_prop(H5P_genplist_t *plist_ptr, uint64_t *file_id); -H5_DLL int64_t H5_subfile_fid_to_context(uint64_t file_id); +H5_DLL herr_t H5_subfiling_set_config_prop(H5P_genplist_t *plist_ptr, + const H5FD_subfiling_params_t *vfd_config); +H5_DLL herr_t H5_subfiling_get_config_prop(H5P_genplist_t *plist_ptr, H5FD_subfiling_params_t *vfd_config); +H5_DLL herr_t H5_subfiling_set_file_id_prop(H5P_genplist_t *plist_ptr, uint64_t file_id); +H5_DLL herr_t H5_subfiling_get_file_id_prop(H5P_genplist_t *plist_ptr, uint64_t *file_id); +H5_DLL herr_t H5_subfile_fid_to_context(uint64_t file_id, int64_t *context_id_out); H5_DLL herr_t H5_subfiling_validate_config(const H5FD_subfiling_params_t *subf_config); diff --git a/src/H5FDtest.c b/src/H5FDtest.c index 694bae482e5..2a48fb5b8cd 100644 --- a/src/H5FDtest.c +++ b/src/H5FDtest.c @@ -67,14 +67,15 @@ * Purpose: Determines if a VFD supports SWMR. * * The function determines SWMR support by inspecting the - * HDF5_DRIVER environment variable, not by checking the - * VFD feature flags (which do not exist until the driver - * is instantiated). + * HDF5_DRIVER and HDF5_TEST_DRIVER environment variables, not + * by checking the VFD feature flags (which do not exist until + * the driver is instantiated). * * This function is only intended for use in the test code. * * Return: true (1) if the VFD supports SWMR I/O or vfd_name is - * NULL or the empty string (which implies the default VFD). + * NULL or the empty string (which implies the default VFD) or + * compares equal to the default VFD's name. * * false (0) if it does not * @@ -89,7 +90,10 @@ H5FD__supports_swmr_test(const char *vfd_name) FUNC_ENTER_NOAPI_NOINIT_NOERR - if (!vfd_name || !strcmp(vfd_name, "") || !strcmp(vfd_name, "nomatch")) + if (!vfd_name) + vfd_name = getenv("HDF5_TEST_DRIVER"); + + if (!vfd_name || !strcmp(vfd_name, "") || !strcmp(vfd_name, H5_DEFAULT_VFD_NAME)) ret_value = true; else ret_value = !strcmp(vfd_name, "log") || !strcmp(vfd_name, "sec2"); diff --git a/src/H5Fint.c b/src/H5Fint.c index 360e78e7a62..325947656bf 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -2783,6 +2783,7 @@ H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *n h5_stat_t lst; /* Stat info from lstat() call */ /* Call lstat() on the file's name */ + memset(&lst, 0, sizeof(h5_stat_t)); if (HDlstat(name, &lst) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stat info for file"); @@ -2825,10 +2826,12 @@ H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *n HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve POSIX file descriptor"); /* Stat the filename we're resolving */ + memset(&st, 0, sizeof(h5_stat_t)); if (HDstat(name, &st) < 0) HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "unable to stat file"); /* Stat the file we opened */ + memset(&fst, 0, sizeof(h5_stat_t)); if (HDfstat(*fd, &fst) < 0) HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "unable to fstat file"); diff --git a/src/H5Fmodule.h b/src/H5Fmodule.h index 91489242164..a5e42aa810c 100644 --- a/src/H5Fmodule.h +++ b/src/H5Fmodule.h @@ -235,10 +235,10 @@ * Note that the root group, indicated above by /, was automatically created when the file was created. * * h5dump is described on the - * Tools + * + * Tools * page under - * - * Libraries and Tools Reference. + * Command-line Tools. * The HDF5 DDL grammar is described in the document \ref DDLBNF114. * * \subsection subsec_file_summary File Function Summaries @@ -888,7 +888,7 @@ * * Additional parameters may be added to these functions in the future. * - * @see + * @see * HDF5 File Image Operations * section for information on more advanced usage of the Memory file driver, and * @see diff --git a/src/H5Gint.c b/src/H5Gint.c index 46559d82291..34072df90e6 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -1377,3 +1377,24 @@ H5G__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t id FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__get_info_by_idx() */ + +/*------------------------------------------------------------------------- + * Function: H5G_get_gcpl_id + * + * Purpose: Quick and dirty routine to retrieve the + * gcpl_id (group creation property list) from the + * group creation operation struct + * + * Return: 'gcpl_id' on success/abort on failure (shouldn't fail) + *------------------------------------------------------------------------- + */ +hid_t +H5G_get_gcpl_id(const H5G_obj_create_t *g) +{ + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + assert(g); + + FUNC_LEAVE_NOAPI(g->gcpl_id); +} /* end H5G_get_gcpl_id() */ diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index 77a8e4c4fff..a90ada92ba9 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -279,11 +279,11 @@ typedef struct H5G_bt2_ud_ins_t { } H5G_bt2_ud_ins_t; /* Typedef for group creation operation */ -typedef struct H5G_obj_create_t { +struct H5G_obj_create_t { hid_t gcpl_id; /* Group creation property list */ H5G_cache_type_t cache_type; /* Type of symbol table entry cache */ H5G_cache_t cache; /* Cached data for symbol table entry */ -} H5G_obj_create_t; +}; /* Callback information for copying groups */ typedef struct H5G_copy_file_ud_t { diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index 8f8da1a23bb..bb172eb2af7 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -94,8 +94,10 @@ /* If the module using this macro is allowed access to the private variables, access them directly */ #ifdef H5G_MODULE #define H5G_MOUNTED(G) ((G)->shared->mounted) +#define H5G_OBJ_ID(G) (((H5G_obj_create_t *)(G))->gcpl_id) #else /* H5G_MODULE */ #define H5G_MOUNTED(G) (H5G_mounted(G)) +#define H5G_OBJ_ID(G) (H5G_get_gcpl_id(G)) #endif /* H5G_MODULE */ /* @@ -109,6 +111,7 @@ #define H5G_TARGET_UDLINK 0x0004 #define H5G_TARGET_EXISTS 0x0008 #define H5G_CRT_INTMD_GROUP 0x0010 +#define H5G_CRT_OBJ 0x0020 /* Type of operation being performed for call to H5G_name_replace() */ typedef enum { @@ -136,6 +139,7 @@ typedef struct H5G_name_t { /* Forward declarations (for prototypes & struct definitions) */ struct H5O_loc_t; struct H5O_link_t; +typedef struct H5G_obj_create_t H5G_obj_create_t; /* * The "location" of an object in a group hierarchy. This points to an object @@ -235,6 +239,7 @@ H5_DLL herr_t H5G_obj_remove_by_idx(const struct H5O_loc_t *grp_oloc, H5RS_str_t H5_DLL herr_t H5G_obj_lookup_by_idx(const struct H5O_loc_t *grp_oloc, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, struct H5O_link_t *lnk); H5_DLL hid_t H5G_get_create_plist(const H5G_t *grp); +H5_DLL hid_t H5G_get_gcpl_id(const H5G_obj_create_t *g); /* * These functions operate on symbol table nodes. diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h index 4c0e2de5699..318098b9081 100644 --- a/src/H5Gpublic.h +++ b/src/H5Gpublic.h @@ -1198,6 +1198,12 @@ H5_DLL ssize_t H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size * the group. This parameter is described in more detail in the * discussion of H5Gget_objname_by_idx(). * + * \note As of 1.12.0, H5Gget_objtype_by_idx() returns the type of the object + * that the link points to, but it has been deprecated for H5Oget_info(). + * Previous behavior for this function returned H5G_LINK for any link type. + * To get the link type, an application may use H5Lget_info_by_idx() + * instead. + * * \version 1.8.0 Function deprecated in this release. * \version 1.6.0 The function return type changed from \c int to the enumerated * type \ref H5G_obj_t. diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index 67f8e479e15..00732c3c987 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -30,6 +30,7 @@ /***********/ #include "H5private.h" /* Generic Functions */ #include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* File access */ #include "H5Gpkg.h" /* Groups */ @@ -613,6 +614,7 @@ H5G__traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, H5G const H5O_linfo_t *linfo; /* Link info settings for new group */ const H5O_pline_t *pline; /* Filter pipeline settings for new group */ H5G_obj_create_t gcrt_info; /* Group creation info */ + H5O_obj_create_t *ocrt_info; /* Object creation info in op_data */ /* Check for the parent group having a group info message */ /* (OK if not found) */ @@ -665,8 +667,15 @@ H5G__traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, H5G pline = &def_pline; /* Create the intermediate group */ - /* XXX: Should we allow user to control the group creation params here? -QAK */ - gcrt_info.gcpl_id = H5P_GROUP_CREATE_DEFAULT; + gcrt_info.gcpl_id = H5P_GROUP_CREATE_DEFAULT; + /* Propagate the object creation properties when creating intermedidate groups */ + if ((target & H5G_CRT_OBJ) && (ocrt_info = H5L_OCRT_INFO(op_data)) != NULL) { + if (ocrt_info->obj_type == H5O_TYPE_GROUP) + gcrt_info.gcpl_id = H5G_OBJ_ID(ocrt_info->crt_info); + else if (ocrt_info->obj_type == H5O_TYPE_DATASET) + gcrt_info.gcpl_id = H5D_OBJ_ID(ocrt_info->crt_info); + } + gcrt_info.cache_type = H5G_NOTHING_CACHED; memset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache)); if (H5G__obj_create_real(grp_oloc.file, ginfo, linfo, pline, &gcrt_info, diff --git a/src/H5Lint.c b/src/H5Lint.c index e33ad939ef8..d02e8c48a48 100644 --- a/src/H5Lint.c +++ b/src/H5Lint.c @@ -91,13 +91,13 @@ typedef struct { } H5L_trav_gnbi_t; /* User data for path traversal callback to creating a link */ -typedef struct { +struct H5L_trav_cr_t { H5F_t *file; /* Pointer to the file */ H5P_genplist_t *lc_plist; /* Link creation property list */ H5G_name_t *path; /* Path to object being linked */ H5O_obj_create_t *ocrt_info; /* Pointer to object creation info */ H5O_link_t *lnk; /* Pointer to link information to insert */ -} H5L_trav_cr_t; +}; /* User data for path traversal routine for moving and renaming a link */ typedef struct { @@ -706,6 +706,9 @@ H5L__create_real(const H5G_loc_t *link_loc, const char *link_name, H5G_name_t *o target_flags |= H5G_CRT_INTMD_GROUP; } /* end if */ + if (ocrt_info != NULL) + target_flags |= H5G_CRT_OBJ; + /* Set up user data * FILE is used to make sure that hard links don't cross files, and * should be NULL for other link types. @@ -2152,3 +2155,22 @@ H5L_iterate(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_iterate() */ + +/*------------------------------------------------------------------------- + * Function: H5L_get_ocrt_info + * + * Purpose: Quick and dirty routine to retrieve the link's object_creation info + * + * Return: 'ocrt_info' on success/abort on failure (shouldn't fail) + *------------------------------------------------------------------------- + */ +H5O_obj_create_t * +H5L_get_ocrt_info(const H5L_trav_cr_t *l) +{ + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + assert(l); + + FUNC_LEAVE_NOAPI(l->ocrt_info); +} /* end H5L_get_ocrt_info() */ diff --git a/src/H5Lprivate.h b/src/H5Lprivate.h index 150a07986e1..ff3ace83dbd 100644 --- a/src/H5Lprivate.h +++ b/src/H5Lprivate.h @@ -47,6 +47,12 @@ /* callback function for external link traversal */ #define H5L_ACS_ELINK_CB_NAME "external link callback" +#ifdef H5L_MODULE +#define H5L_OCRT_INFO(L) (((H5L_trav_cr_t *)(L))->ocrt_info) +#else /* H5L_MODULE */ +#define H5L_OCRT_INFO(L) (H5L_get_ocrt_info(L)) +#endif + /****************************/ /* Library Private Typedefs */ /****************************/ @@ -57,6 +63,8 @@ typedef struct H5L_elink_cb_t { void *user_data; } H5L_elink_cb_t; +typedef struct H5L_trav_cr_t H5L_trav_cr_t; + /*****************************/ /* Library Private Variables */ /*****************************/ @@ -75,6 +83,7 @@ H5_DLL herr_t H5L_get_info(const H5G_loc_t *loc, const char *name, H5L_info2_t * H5_DLL herr_t H5L_register_external(void); H5_DLL herr_t H5L_iterate(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, H5L_iterate2_t op, void *op_data); +H5_DLL H5O_obj_create_t *H5L_get_ocrt_info(const H5L_trav_cr_t *l); /* User-defined link functions */ H5_DLL herr_t H5L_register(const H5L_class_t *cls); diff --git a/src/H5PLpath.c b/src/H5PLpath.c index 4dd4b17afe7..02e7d25d4d5 100644 --- a/src/H5PLpath.c +++ b/src/H5PLpath.c @@ -645,6 +645,7 @@ H5PL__path_table_iterate_process_path(const char *plugin_path, H5PL_iterate_type snprintf(path, len, "%s/%s", plugin_path, dp->d_name); /* Get info for directory entry */ + memset(&my_stat, 0, sizeof(h5_stat_t)); if (HDstat(path, &my_stat) == -1) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5_ITER_ERROR, "can't stat file %s -- error was: %s", path, strerror(errno)); @@ -882,6 +883,7 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, bool *found snprintf(path, len, "%s/%s", dir, dp->d_name); /* Get info for directory entry */ + memset(&my_stat, 0, sizeof(h5_stat_t)); if (HDstat(path, &my_stat) == -1) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't stat file %s -- error was: %s", path, strerror(errno)); diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 903d549ca16..ab809a58654 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -3573,7 +3573,7 @@ H5_DLL herr_t H5Pget_fclose_degree(hid_t fapl_id, H5F_close_degree_t *degree); * \see H5LTopen_file_image(), H5Fget_file_image(), H5Pset_file_image(), * H5Pset_file_image_callbacks(), H5Pget_file_image_callbacks(), * \ref H5FD_file_image_callbacks_t, \ref H5FD_file_image_op_t, - * + * * HDF5 File Image Operations. * * @@ -3613,7 +3613,7 @@ H5_DLL herr_t H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_l * \see H5LTopen_file_image(), H5Fget_file_image(), H5Pset_file_image(), * H5Pset_file_image_callbacks(), H5Pget_file_image_callbacks(), * \ref H5FD_file_image_callbacks_t, \ref H5FD_file_image_op_t, - * + * * HDF5 File Image Operations. * * \since 1.8.9 @@ -4557,7 +4557,7 @@ H5_DLL herr_t H5Pset_fclose_degree(hid_t fapl_id, H5F_close_degree_t degree); * This function is part of the file image * operations feature set. It is highly recommended to study the guide * [HDF5 File Image Operations] - * (https://portal.hdfgroup.org/display/HDF5/HDF5+File+Image+Operations + * (https://portal.hdfgroup.org/documentation/hdf5-docs/advanced_topics/file_image_ops.html * ) before using this feature set. See the “See Also” section below * for links to other elements of HDF5 file image operations. * @@ -4569,9 +4569,9 @@ H5_DLL herr_t H5Pset_fclose_degree(hid_t fapl_id, H5F_close_degree_t degree); * \li H5Pget_file_image_callbacks() * * \li [HDF5 File Image Operations] - * (https://portal.hdfgroup.org/display/HDF5/HDF5+File+Image+Operations) + * (https://portal.hdfgroup.org/documentation/hdf5-docs/advanced_topics/file_image_ops.html) * in [Advanced Topics in HDF5] - * (https://portal.hdfgroup.org/display/HDF5/Advanced+Topics+in+HDF5) + * (https://portal.hdfgroup.org/documentation/hdf5-docs/advanced_topics_list.html) * * \li Within H5Pset_file_image_callbacks(): * \li Callback #H5FD_file_image_callbacks_t @@ -4594,7 +4594,7 @@ H5_DLL herr_t H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len); * **Recommended Reading:** This function is part of the file * image operations feature set. It is highly recommended to study * the guide [HDF5 File Image Operations] - * (https://portal.hdfgroup.org/display/HDF5/HDF5+File+Image+Operations + * (https://portal.hdfgroup.org/documentation/hdf5-docs/advanced_topics/file_image_ops.html * ) before using this feature set. See the “See Also” section below * for links to other elements of HDF5 file image operations. * @@ -4854,201 +4854,131 @@ H5_DLL herr_t H5Pset_gc_references(hid_t fapl_id, unsigned gc_ref); * * * \p low=#H5F_LIBVER_EARLIEST
- * \p high=#H5F_LIBVER_V18 + * \p high= * * \li The library will create objects with the earliest * possible format versions. * \li The library will allow objects to be created with the - * latest format versions available to library release 1.8.x. + * latest format versions available to library release + * specified in the \p high value. * \li API calls that create objects or features that are - * available to versions of the library greater than 1.8.x - * release will fail. - * - * - * \p low=#H5F_LIBVER_EARLIEST
- * \p high=#H5F_LIBVER_V110 - * - * \li The library will create objects with the earliest possible - * format versions. - * \li The library will allow objects to be created with the latest - * format versions available to library release 1.10.x. - * \li API calls that create objects or features that are - * available to versions of the library greater than 1.10.x - * release will fail. - * - * - * \p low=#H5F_LIBVER_EARLIEST
- * \p high=#H5F_LIBVER_V112 - * - * \li The library will create objects with the earliest possible - * format versions. - * \li The library will allow objects to be created with the latest - * format versions available to library release 1.12.x. - * \li API calls that create objects or features that are - * available to versions of the library greater than 1.12.x - * release will fail. - * - * - * \p low=#H5F_LIBVER_EARLIEST
- * \p high=#H5F_LIBVER_V114 - * - * \li The library will create objects with the earliest possible - * format versions. - * \li The library will allow objects to be created with the latest - * format versions available to library release 1.14.x. - * \li API calls that create objects or features that are - * available to versions of the library greater than 1.14.x - * release will fail. - * - * - * \p low=#H5F_LIBVER_V18
- * \p high=#H5F_LIBVER_V18 - * - * \li The library will create objects with the latest format - * versions available to library release 1.8.x. - * \li The library will allow objects to be created with the latest - * format versions available to library release 1.8.x. - * \li The objects written with this setting may be - * accessible to a smaller range of library versions than - * would be the case if low is set to #H5F_LIBVER_EARLIEST. - * \li API calls that create objects or features that are available - * to versions of the library greater than 1.8.x release will - * fail. - * \li Earlier versions of the library may not be able to access - * objects created with this setting. - * - * - * \p low=#H5F_LIBVER_V18
- * \p high=#H5F_LIBVER_V110 - * - * \li The library will create objects with the latest format - * versions available to library release 1.8.x. - * \li The library will allow objects to be created with the latest - * format versions available to library release 1.10.x. - * \li API calls that create objects or features that are - * available to versions of the library greater than 1.10.x - * release will fail. - * \li Earlier versions of the library may not be able to access - * objects created with this setting. - * - * - * \p low=#H5F_LIBVER_V18
- * \p high=#H5F_LIBVER_V112 - * - * \li The library will create objects with the latest format - * versions available to library release 1.8.x. - * \li The library will allow objects to be created with the latest - * format versions available to library release 1.12.x. - * \li API calls that create objects or features that are - * available to versions of the library greater than 1.12.x - * release will fail. - * \li Earlier versions of the library may not be able to access - * objects created with this setting. + * available to versions of the library greater than the + * specified version in \p high will fail. * * * \p low=#H5F_LIBVER_V18
- * \p high=#H5F_LIBVER_V114 + * \p high= * * \li The library will create objects with the latest format * versions available to library release 1.8.x. * \li The library will allow objects to be created with the latest - * format versions available to library release 1.14.x. + * format versions available to library release specified + * in the \p high value. * \li API calls that create objects or features that are - * available to versions of the library greater than 1.14.x - * release will fail. + * available to versions of the library greater than the + * specified version in \p high will fail. * \li Earlier versions of the library may not be able to access * objects created with this setting. * * * \p low=#H5F_LIBVER_V110
- * \p high=#H5F_LIBVER_V110 + * \p high= * * \li The library will create objects with the latest format * versions available to library release 1.10.x. * \li The library will allow objects to be created with the latest - * format versions available to library release 1.10.x. - * \li The objects written with this setting may be - * accessible to a smaller range of library versions than - * would be the case if low is set to #H5F_LIBVER_EARLIEST. + * format versions available to library release specified + * in the \p high value. * \li API calls that create objects or features that are available - * to versions of the library greater than 1.10.x release will - * fail. + * to versions of the library greater than version specified in + * \p high will fail. * \li Earlier versions of the library may not be able to access * objects created with this setting. * * - * \p low=#H5F_LIBVER_V110
- * \p high=#H5F_LIBVER_V112 + * \p low=#H5F_LIBVER_V112
+ * \p high= * * \li The library will create objects with the latest format - * versions available to library release 1.10.x. + * versions available to library release 1.12.x. * \li The library will allow objects to be created with the latest - * format versions available to library release 1.12.x. + * format versions available to library release specified + * in the \p high value. * \li API calls that create objects or features that are available - * to versions of the library greater than 1.12.x release will - * fail. + * to versions of the library greater than version specified in + * \p high will fail. * \li Earlier versions of the library may not be able to access * objects created with this setting. * * - * \p low=#H5F_LIBVER_V110
- * \p high=#H5F_LIBVER_V114 + * \p low=#H5F_LIBVER_V114
+ * \p high= * * \li The library will create objects with the latest format - * versions available to library release 1.10.x. + * versions available to library release 1.14.x. * \li The library will allow objects to be created with the latest - * format versions available to library release 1.14.x. + * format versions available to library release specified + * in the \p high value. * \li API calls that create objects or features that are available - * to versions of the library greater than 1.14.x release will - * fail. + * to versions of the library greater than version specified in + * \p high will fail. * \li Earlier versions of the library may not be able to access * objects created with this setting. * * - * \p low=#H5F_LIBVER_V112
- * \p high=#H5F_LIBVER_V112 - * - * \li The library will create objects with the latest format - * versions available to library release 1.12.x. - * \li The library will allow objects to be created with the latest - * format versions available to library release 1.12.x. - * \li The objects written with this setting may be - * accessible to a smaller range of library versions than - * would be the case if low is set to #H5F_LIBVER_EARLIEST. - * \li API calls that create objects or features that are available - * to versions of the library greater than 1.12.x release will - * fail. - * \li Earlier versions of the library may not be able to access - * objects created with this setting. + * \p low=high + * + * \li The library will create objects with the latest format + * versions available to library release specified. + * \li The objects written with this setting may be + * accessible to a smaller range of library versions than + * would be the case if low is set to #H5F_LIBVER_EARLIEST. + * \li API calls that create objects or features that are available + * to versions of the library greater than the specified + * release will fail. + * \li Earlier versions of the library may not be able to access + * objects created with this setting. * * - * \p low=#H5F_LIBVER_V112
- * \p high=#H5F_LIBVER_V114 - * - * \li The library will create objects with the latest format - * versions available to library release 1.12.x. - * \li The library will allow objects to be created with the latest - * format versions available to library release 1.14.x. - * \li API calls that create objects or features that are available - * to versions of the library greater than 1.14.x release will - * fail. - * \li Earlier versions of the library may not be able to access - * objects created with this setting. + * \p low=#H5F_LIBVER_EARLIEST
+ * \p high=#H5F_LIBVER_LATEST + * + * \li The library will create objects with the earliest possible + * format versions. + * \li The library will allow objects to be created with the latest + * format versions available to the latest release. See + * note #H5F_LIBVER_LATEST below the table. + * \li This is the library default setting and provides the greatest + * format compatibility. * * - * \p low=#H5F_LIBVER_V114
- * \p high=#H5F_LIBVER_V114 + * \p low=
+ * \p high=#H5F_LIBVER_LATEST + * + * \li The library will create objects with the latest format + * versions available to library release \p low. + * \li The library will allow objects to be created with the latest + * format versions available to the latest release. See + * note *H5F_LIBVER_LATEST* below the table. + * \li This setting allows users to take advantage of the latest + * features and performance enhancements in the library. + * \li Earlier versions of the library may not be able to access + * objects created with this setting. + * + * + * \p low=#H5F_LIBVER_LATEST
+ * \p high=#H5F_LIBVER_LATEST * * \li The library will create objects with the latest format - * versions available to library release 1.14.x. + * versions available to the latest release. * \li The library will allow objects to be created with the latest - * format versions available to library release 1.14.x. - * \li The objects written with this setting may be + * format versions available to the latest release. See + * note *H5F_LIBVER_LATEST* below the table. + * \li This setting allows users to take advantage of the latest + * features and performance enhancements in the library. + * However, objects written with this setting may be * accessible to a smaller range of library versions than * would be the case if low is set to #H5F_LIBVER_EARLIEST. - * \li API calls that create objects or features that are available - * to versions of the library greater than 1.14.x release will - * fail. * \li Earlier versions of the library may not be able to access * objects created with this setting. * @@ -6969,7 +6899,7 @@ H5_DLL herr_t H5Pset_szip(hid_t plist_id, unsigned options_mask, unsigned pixels * VDS access time. Example code for many source and virtual dataset mappings * is available in the "Examples of Source to Virtual Dataset Mapping" * chapter in the - * + * * RFC: HDF5 Virtual Dataset. * * @@ -7042,7 +6972,7 @@ H5_DLL herr_t H5Pset_szip(hid_t plist_id, unsigned options_mask, unsigned pixels * If that source file does not exist, the new \p src_file_name * after stripping will be \Code{A.h5} * - * \see + * \see * Virtual Dataset Overview * * \see_virtual @@ -7460,8 +7390,8 @@ H5_DLL herr_t H5Pset_chunk_cache(hid_t dapl_id, size_t rdcc_nslots, size_t rdcc_ * that uses external storage: * * \li The default behavior of the library is to search for the - * dataset's external storage raw data files in the same - * directory as the HDF5 file which contains the dataset. + * dataset's external storage raw data files in the current + * working directory of the program. * \li If the prefix is set to an absolute path, the target * directory will be searched for the dataset's external * storage raw data files. @@ -8893,7 +8823,7 @@ H5_DLL herr_t H5Pset_link_phase_change(hid_t plist_id, unsigned max_compact, uns * must be created and maintained in the original style. This is HDF5's default * behavior. If backward compatibility with pre-1.8.0 libraries is not a concern, * greater efficiencies can be obtained with the new-format compact and indexed - * groups. See Group + * groups. See Group * implementations in HDF5 in the \ref H5G API introduction (at the bottom).\n * H5Pset_local_heap_size_hint() is useful for tuning file size when files * contain original-style groups with either zero members or very large diff --git a/src/H5VLint.c b/src/H5VLint.c index feb2debd947..131856db5e6 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -2249,7 +2249,7 @@ H5VL_set_vol_wrapper(const H5VL_object_t *vol_obj) vol_wrap_ctx->obj_wrap_ctx = obj_wrap_ctx; } /* end if */ else - /* Incremeent ref count on existing wrapper context */ + /* Increment ref count on existing wrapper context */ vol_wrap_ctx->rc++; /* Save the wrapper context */ diff --git a/src/H5VLmodule.h b/src/H5VLmodule.h index 19baf344d57..0cca38cf1db 100644 --- a/src/H5VLmodule.h +++ b/src/H5VLmodule.h @@ -83,7 +83,7 @@ * to be much more common than internal implementations. * * A list of VOL connectors can be found here: - * + * * Registered VOL Connectors * * This list is incomplete and only includes the VOL connectors that have been registered with diff --git a/src/H5VLnative_attr.c b/src/H5VLnative_attr.c index 50aca652b2f..bebd127df23 100644 --- a/src/H5VLnative_attr.c +++ b/src/H5VLnative_attr.c @@ -26,6 +26,7 @@ /***********/ #include "H5private.h" /* Generic Functions */ #include "H5Apkg.h" /* Attributes */ +#include "H5CXprivate.h" /* API Contexts */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* Files */ #include "H5Gprivate.h" /* Groups */ @@ -195,8 +196,7 @@ H5VL__native_attr_open(void *obj, const H5VL_loc_params_t *loc_params, const cha *------------------------------------------------------------------------- */ herr_t -H5VL__native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_t H5_ATTR_UNUSED dxpl_id, - void H5_ATTR_UNUSED **req) +H5VL__native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_t dxpl_id, void H5_ATTR_UNUSED **req) { H5T_t *mem_type; /* Memory datatype */ herr_t ret_value; /* Return value */ @@ -206,6 +206,9 @@ H5VL__native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_t H5_ATTR_UNUS if (NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); + /* Set DXPL for operation */ + H5CX_set_dxpl(dxpl_id); + /* Go write the actual data to the attribute */ if ((ret_value = H5A__read((H5A_t *)attr, mem_type, buf)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute"); @@ -224,8 +227,7 @@ H5VL__native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_t H5_ATTR_UNUS *------------------------------------------------------------------------- */ herr_t -H5VL__native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t H5_ATTR_UNUSED dxpl_id, - void H5_ATTR_UNUSED **req) +H5VL__native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t dxpl_id, void H5_ATTR_UNUSED **req) { H5T_t *mem_type; /* Memory datatype */ herr_t ret_value; /* Return value */ @@ -235,6 +237,9 @@ H5VL__native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t H5_AT if (NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); + /* Set DXPL for operation */ + H5CX_set_dxpl(dxpl_id); + /* Go write the actual data to the attribute */ if ((ret_value = H5A__write((H5A_t *)attr, mem_type, buf)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute"); diff --git a/src/H5private.h b/src/H5private.h index 8cee9586769..a3b37e5d834 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -110,7 +110,8 @@ * H5_init_library(); also, make sure that the initializer for default * VFD does *not* call H5_init_library(). */ -#define H5_DEFAULT_VFD H5FD_SEC2 +#define H5_DEFAULT_VFD H5FD_SEC2 +#define H5_DEFAULT_VFD_NAME "sec2" /* Define the default VOL driver */ #define H5_DEFAULT_VOL H5VL_NATIVE diff --git a/test/API/README.md b/test/API/README.md index 9ee1963fd52..bd09b153aa4 100644 --- a/test/API/README.md +++ b/test/API/README.md @@ -1,7 +1,7 @@ # HDF5 API Tests This directory contains several test applications that exercise HDF5's -public API and serve as regression tests for HDF5 [VOL Connectors](https://portal.hdfgroup.org/display/HDF5/Virtual+Object+Layer). +public API and serve as regression tests for HDF5 [VOL Connectors](https://docs.hdfgroup.org/hdf5/v1_14/_h5_v_l__u_g.html). ## Build Process and options diff --git a/test/CMakeVFDTests.cmake b/test/CMakeVFDTests.cmake index f2466ba40cf..a3b40a6107a 100644 --- a/test/CMakeVFDTests.cmake +++ b/test/CMakeVFDTests.cmake @@ -71,6 +71,9 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD links_env external_env vds_env + mirror_vfd + ros3 + hdfs ) # Skip several tests with subfiling VFD, mostly due diff --git a/test/accum.c b/test/accum.c index 9876998d9b4..cabd4a84c7c 100644 --- a/test/accum.c +++ b/test/accum.c @@ -2049,17 +2049,16 @@ fprintf(stderr, "Random # seed was: %u\n", seed); unsigned test_swmr_write_big(bool newest_format) { - - hid_t fid = H5I_INVALID_HID; /* File ID */ - hid_t fapl = H5I_INVALID_HID; /* File access property list */ - H5F_t *rf = NULL; /* File pointer */ - char filename[1024]; - uint8_t *wbuf2 = NULL, *rbuf = NULL; /* Buffers for reading & writing */ - uint8_t wbuf[1024]; /* Buffer for reading & writing */ - unsigned u; /* Local index variable */ - bool process_success = false; - char *driver = NULL; /* VFD string (from env variable) */ - bool api_ctx_pushed = false; /* Whether API context pushed */ + const char *driver_name = NULL; /* VFD string (from env variable) */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fapl = H5I_INVALID_HID; /* File access property list */ + H5F_t *rf = NULL; /* File pointer */ + char filename[1024]; + uint8_t *wbuf2 = NULL, *rbuf = NULL; /* Buffers for reading & writing */ + uint8_t wbuf[1024]; /* Buffer for reading & writing */ + unsigned u; /* Local index variable */ + bool process_success = false; + bool api_ctx_pushed = false; /* Whether API context pushed */ if (newest_format) TESTING("SWMR write of large metadata: with latest format"); @@ -2077,8 +2076,8 @@ test_swmr_write_big(bool newest_format) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - driver = getenv(HDF5_DRIVER); - if (!H5FD__supports_swmr_test(driver)) { + driver_name = h5_get_test_driver_name(); + if (!H5FD__supports_swmr_test(driver_name)) { SKIPPED(); puts(" Test skipped due to VFD not supporting SWMR I/O."); return 0; diff --git a/test/accum_swmr_reader.c b/test/accum_swmr_reader.c index 5b3ecd8a7fc..a5b16eba860 100644 --- a/test/accum_swmr_reader.c +++ b/test/accum_swmr_reader.c @@ -40,15 +40,15 @@ static const char *FILENAME[] = {"accum", "accum_swmr_big", NULL}; int main(void) { - hid_t fid = H5I_INVALID_HID; /* File ID */ - hid_t fapl = H5I_INVALID_HID; /* file access property list ID */ - H5F_t *f = NULL; /* File pointer */ - char filename[1024]; - unsigned u; /* Local index variable */ - uint8_t rbuf[1024]; /* Buffer for reading */ - uint8_t buf[1024]; /* Buffer for holding the expected data */ - char *driver = NULL; /* VFD string (from env variable) */ - bool api_ctx_pushed = false; /* Whether API context pushed */ + const char *driver_name = NULL; /* VFD string (from env variable) */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fapl = H5I_INVALID_HID; /* file access property list ID */ + H5F_t *f = NULL; /* File pointer */ + char filename[1024]; + unsigned u; /* Local index variable */ + uint8_t rbuf[1024]; /* Buffer for reading */ + uint8_t buf[1024]; /* Buffer for holding the expected data */ + bool api_ctx_pushed = false; /* Whether API context pushed */ /* Testing setup */ h5_reset(); @@ -56,8 +56,8 @@ main(void) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - driver = getenv(HDF5_DRIVER); - if (!H5FD__supports_swmr_test(driver)) + driver_name = h5_get_test_driver_name(); + if (!H5FD__supports_swmr_test(driver_name)) return EXIT_SUCCESS; /* Initialize buffers */ diff --git a/test/app_ref.c b/test/app_ref.c index 729862ee39f..1315f03c86b 100644 --- a/test/app_ref.c +++ b/test/app_ref.c @@ -79,7 +79,7 @@ Abrt_Handler(int H5_ATTR_UNUSED sig) int main(void) { - const char *env_h5_drvr; /* File Driver value from environment */ + const char *driver_name; /* File Driver value from environment */ hid_t ids[T_NUMCLASSES]; hid_t fapl; /* File Access Property List */ int ninc; @@ -94,14 +94,12 @@ main(void) TESTING("library shutdown with reference count > 1"); /* Get the VFD to use */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); /* Don't run this test with the multi/split VFD. A bug in library shutdown * ordering causes problems with the multi VFD when IDs are left dangling. */ - if (!strcmp(env_h5_drvr, "multi") || !strcmp(env_h5_drvr, "split")) { + if (!strcmp(driver_name, "multi") || !strcmp(driver_name, "split")) { puts("\n -- SKIPPED for incompatible VFD --"); return 0; } diff --git a/test/big.c b/test/big.c index ed38251aab9..03c7dd5246f 100644 --- a/test/big.c +++ b/test/big.c @@ -149,6 +149,7 @@ is_sparse(void) return 0; if (HDclose(fd) < 0) return 0; + memset(&sb, 0, sizeof(h5_stat_t)); if (HDstat("x.h5", &sb) < 0) return 0; if (HDremove("x.h5") < 0) diff --git a/test/btree2.c b/test/btree2.c index 3ad30ac9f1a..fc7748c7b27 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -8598,7 +8598,7 @@ gen_l4_btree2(const char *filename, hid_t fapl, const H5B2_create_t *cparam, had *------------------------------------------------------------------------- */ static unsigned -test_remove_lots(const char *env_h5_drvr, hid_t fapl, const H5B2_create_t *cparam) +test_remove_lots(const char *driver_name, hid_t fapl, const H5B2_create_t *cparam) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[1024]; /* Filename to use */ @@ -8656,7 +8656,7 @@ fprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); TEST_ERROR; /* Check for VFD which stores data in multiple files */ - single_file_vfd = !h5_driver_uses_multiple_files(env_h5_drvr, H5_EXCLUDE_NON_MULTIPART_DRIVERS); + single_file_vfd = !h5_driver_uses_multiple_files(driver_name, H5_EXCLUDE_NON_MULTIPART_DRIVERS); if (single_file_vfd) { /* Make a copy of the file in memory, in order to speed up deletion testing */ @@ -8665,6 +8665,7 @@ fprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); TEST_ERROR; /* Retrieve the file's size */ + memset(&sb, 0, sizeof(h5_stat_t)); if (HDfstat(fd, &sb) < 0) TEST_ERROR; @@ -9915,12 +9916,10 @@ main(void) unsigned nerrors = 0; /* Cumulative error count */ unsigned reopen; /* Whether to reopen B-tree during tests */ int ExpressMode; - const char *envval = NULL; + const char *driver_name; bool api_ctx_pushed = false; /* Whether API context pushed */ - envval = getenv(HDF5_DRIVER); - if (envval == NULL) - envval = "nomatch"; + driver_name = h5_get_test_driver_name(); /* Reset library */ h5_reset(); @@ -9928,7 +9927,7 @@ main(void) ExpressMode = GetTestExpress(); /* For the Direct I/O driver, skip intensive tests due to poor performance */ - if (!strcmp(envval, "direct")) + if (!strcmp(driver_name, "direct")) ExpressMode = 2; if (ExpressMode > 1) @@ -10012,7 +10011,7 @@ main(void) if (ExpressMode > 1) printf("***Express test mode on. test_remove_lots skipped\n"); else - nerrors += test_remove_lots(envval, fapl, &cparam); + nerrors += test_remove_lots(driver_name, fapl, &cparam); /* Test more complex B-tree queries */ nerrors += test_find_neighbor(fapl, &cparam, &tparam); diff --git a/test/cache_image.c b/test/cache_image.c index 60e23984366..d2499631878 100644 --- a/test/cache_image.c +++ b/test/cache_image.c @@ -7752,15 +7752,13 @@ evict_on_close_test(bool H5_ATTR_PARALLEL_UNUSED single_file_vfd) int main(void) { - const char *env_h5_drvr; /* File driver value from environment */ + const char *driver_name; /* File driver value from environment */ bool single_file_vfd; /* Whether VFD used stores data in a single file */ unsigned nerrs = 0; int express_test; /* Get the VFD to use */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); H5open(); @@ -7772,7 +7770,7 @@ main(void) printf("=========================================\n"); /* Check for VFD which stores data in multiple files */ - single_file_vfd = !h5_driver_uses_multiple_files(env_h5_drvr, H5_EXCLUDE_NON_MULTIPART_DRIVERS); + single_file_vfd = !h5_driver_uses_multiple_files(driver_name, H5_EXCLUDE_NON_MULTIPART_DRIVERS); nerrs += check_cache_image_ctl_flow_1(single_file_vfd); nerrs += check_cache_image_ctl_flow_2(single_file_vfd); diff --git a/test/cork.c b/test/cork.c index e0a7196b601..65e19d5be55 100644 --- a/test/cork.c +++ b/test/cork.c @@ -2229,13 +2229,12 @@ main(void) for (swmr = 0; swmr <= 1; swmr++) { if (swmr) { - char *driver = NULL; + const char *driver_name = h5_get_test_driver_name(); /* Skip these tests if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - driver = getenv(HDF5_DRIVER); - if (!H5FD__supports_swmr_test(driver)) { + if (!H5FD__supports_swmr_test(driver_name)) { puts("-- SKIPPED SWMR tests for SWMR-incompatible VFD --"); continue; } diff --git a/test/dangle.c b/test/dangle.c index 4079fce6f51..cad7fe202df 100644 --- a/test/dangle.c +++ b/test/dangle.c @@ -623,18 +623,16 @@ test_dangle_force(void) int main(void) { - const char *env_h5_drvr; /* File Driver value from environment */ + const char *driver_name; /* File Driver value from environment */ int nerrors = 0; /* Get the VFD to use */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); /* Don't run this test with the multi/split VFD. A bug in library shutdown * ordering causes problems with the multi VFD when IDs are left dangling. */ - if (!strcmp(env_h5_drvr, "multi") || !strcmp(env_h5_drvr, "split")) { + if (!strcmp(driver_name, "multi") || !strcmp(driver_name, "split")) { puts(" -- SKIPPED for incompatible VFD --"); return 0; } diff --git a/test/dsets.c b/test/dsets.c index 8f2d2c4d528..3cc9ccbeae6 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -526,7 +526,7 @@ test_create(hid_t file) *------------------------------------------------------------------------- */ static herr_t -test_simple_io(const char *env_h5_drvr, hid_t fapl) +test_simple_io(const char *driver_name, hid_t fapl) { char filename[FILENAME_BUF_SIZE]; hid_t file = H5I_INVALID_HID, dataset = H5I_INVALID_HID, space = H5I_INVALID_HID, xfer = H5I_INVALID_HID; @@ -541,8 +541,8 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) TESTING("simple I/O"); /* Can't run this test with multi-file VFDs because of HDopen/read/seek the file directly */ - if (strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0 && - strcmp(env_h5_drvr, "family") != 0) { + if (strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0 && + strcmp(driver_name, "family") != 0) { h5_fixname(FILENAME[4], fapl, filename, sizeof filename); /* Set up data array */ @@ -688,7 +688,7 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static herr_t -test_userblock_offset(const char *env_h5_drvr, hid_t fapl, bool new_format) +test_userblock_offset(const char *driver_name, hid_t fapl, bool new_format) { char filename[FILENAME_BUF_SIZE]; hid_t file = H5I_INVALID_HID, fcpl = H5I_INVALID_HID, dataset = H5I_INVALID_HID, space = H5I_INVALID_HID; @@ -702,8 +702,8 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, bool new_format) TESTING("dataset offset with user block"); /* Can't run this test with multi-file VFDs because of HDopen/read/seek the file directly */ - if (strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0 && - strcmp(env_h5_drvr, "family") != 0) { + if (strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0 && + strcmp(driver_name, "family") != 0) { h5_fixname(FILENAME[2], fapl, filename, sizeof filename); /* Set up data array */ @@ -9630,7 +9630,7 @@ test_big_chunks_bypass_cache(hid_t fapl) *------------------------------------------------------------------------- */ static herr_t -test_chunk_fast(const char *env_h5_driver, hid_t fapl) +test_chunk_fast(const char *driver_name, hid_t fapl) { char filename[FILENAME_BUF_SIZE]; hid_t fid = H5I_INVALID_HID; /* File ID */ @@ -9693,7 +9693,7 @@ test_chunk_fast(const char *env_h5_driver, hid_t fapl) /* Skip this iteration if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - if (swmr && !H5FD__supports_swmr_test(env_h5_driver)) + if (swmr && !H5FD__supports_swmr_test(driver_name)) continue; #ifdef H5_HAVE_FILTER_DEFLATE @@ -12200,7 +12200,7 @@ test_zero_dim_dset(hid_t fapl) *------------------------------------------------------------------------- */ static herr_t -test_swmr_non_latest(const char *env_h5_driver, hid_t fapl) +test_swmr_non_latest(const char *driver_name, hid_t fapl) { char filename[FILENAME_BUF_SIZE]; hid_t fid = H5I_INVALID_HID; /* File ID */ @@ -12221,7 +12221,7 @@ test_swmr_non_latest(const char *env_h5_driver, hid_t fapl) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - if (!H5FD__supports_swmr_test(env_h5_driver)) { + if (!H5FD__supports_swmr_test(driver_name)) { SKIPPED(); puts(" Test skipped due to VFD not supporting SWMR I/O."); return SUCCEED; @@ -12470,7 +12470,7 @@ test_swmr_non_latest(const char *env_h5_driver, hid_t fapl) *------------------------------------------------------------------------- */ static herr_t -test_earray_hdr_fd(const char *env_h5_driver, hid_t fapl) +test_earray_hdr_fd(const char *driver_name, hid_t fapl) { char filename[FILENAME_BUF_SIZE]; hid_t fid = H5I_INVALID_HID; @@ -12491,7 +12491,7 @@ test_earray_hdr_fd(const char *env_h5_driver, hid_t fapl) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - if (!H5FD__supports_swmr_test(env_h5_driver)) { + if (!H5FD__supports_swmr_test(driver_name)) { SKIPPED(); puts(" Test skipped due to VFD not supporting SWMR I/O."); return SUCCEED; @@ -12591,7 +12591,7 @@ test_earray_hdr_fd(const char *env_h5_driver, hid_t fapl) *------------------------------------------------------------------------- */ static herr_t -test_farray_hdr_fd(const char *env_h5_driver, hid_t fapl) +test_farray_hdr_fd(const char *driver_name, hid_t fapl) { char filename[FILENAME_BUF_SIZE]; hid_t fid = H5I_INVALID_HID; @@ -12612,7 +12612,7 @@ test_farray_hdr_fd(const char *env_h5_driver, hid_t fapl) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - if (!H5FD__supports_swmr_test(env_h5_driver)) { + if (!H5FD__supports_swmr_test(driver_name)) { SKIPPED(); puts(" Test skipped due to VFD not supporting SWMR I/O."); return SUCCEED; @@ -12712,7 +12712,7 @@ test_farray_hdr_fd(const char *env_h5_driver, hid_t fapl) *------------------------------------------------------------------------- */ static herr_t -test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl) +test_bt2_hdr_fd(const char *driver_name, hid_t fapl) { char filename[FILENAME_BUF_SIZE]; hid_t fid = H5I_INVALID_HID; @@ -12739,7 +12739,7 @@ test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - if (!H5FD__supports_swmr_test(env_h5_driver)) { + if (!H5FD__supports_swmr_test(driver_name)) { SKIPPED(); puts(" Test skipped due to VFD not supporting SWMR I/O."); return SUCCEED; @@ -15909,18 +15909,16 @@ main(void) size_t rdcc_nbytes; double rdcc_w0; int nerrors = 0; - const char *envval; + const char *driver_name; bool contig_addr_vfd; /* Whether VFD used has a contiguous address space */ bool driver_is_default_compatible; int i; /* Don't run this test using certain file drivers */ - envval = getenv(HDF5_DRIVER); - if (envval == NULL) - envval = "nomatch"; + driver_name = h5_get_test_driver_name(); /* Current VFD that does not support contiguous address space */ - contig_addr_vfd = (bool)(strcmp(envval, "split") != 0 && strcmp(envval, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); /* Set the random # seed */ HDsrandom((unsigned)HDtime(NULL)); @@ -16049,7 +16047,7 @@ main(void) goto error; nerrors += (test_create(file) < 0 ? 1 : 0); - nerrors += (test_simple_io(envval, my_fapl) < 0 ? 1 : 0); + nerrors += (test_simple_io(driver_name, my_fapl) < 0 ? 1 : 0); nerrors += (test_compact_io(my_fapl) < 0 ? 1 : 0); nerrors += (test_max_compact(my_fapl) < 0 ? 1 : 0); nerrors += (test_compact_open_close_dirty(my_fapl) < 0 ? 1 : 0); @@ -16075,7 +16073,7 @@ main(void) nerrors += (test_multiopen(file) < 0 ? 1 : 0); nerrors += (test_types(file) < 0 ? 1 : 0); nerrors += (test_floattypes(file) < 0 ? 1 : 0); - nerrors += (test_userblock_offset(envval, my_fapl, new_format) < 0 ? 1 : 0); + nerrors += (test_userblock_offset(driver_name, my_fapl, new_format) < 0 ? 1 : 0); if (driver_is_default_compatible) { nerrors += (test_missing_filter(file) < 0 ? 1 : 0); @@ -16105,7 +16103,7 @@ main(void) nerrors += (test_huge_chunks(my_fapl) < 0 ? 1 : 0); nerrors += (test_chunk_cache(my_fapl) < 0 ? 1 : 0); nerrors += (test_big_chunks_bypass_cache(my_fapl) < 0 ? 1 : 0); - nerrors += (test_chunk_fast(envval, my_fapl) < 0 ? 1 : 0); + nerrors += (test_chunk_fast(driver_name, my_fapl) < 0 ? 1 : 0); nerrors += (test_reopen_chunk_fast(my_fapl) < 0 ? 1 : 0); nerrors += (test_chunk_fast_bug1(my_fapl) < 0 ? 1 : 0); nerrors += (test_chunk_expand(my_fapl) < 0 ? 1 : 0); @@ -16123,10 +16121,10 @@ main(void) nerrors += (test_storage_size(my_fapl) < 0 ? 1 : 0); nerrors += (test_power2up(my_fapl) < 0 ? 1 : 0); - nerrors += (test_swmr_non_latest(envval, my_fapl) < 0 ? 1 : 0); - nerrors += (test_earray_hdr_fd(envval, my_fapl) < 0 ? 1 : 0); - nerrors += (test_farray_hdr_fd(envval, my_fapl) < 0 ? 1 : 0); - nerrors += (test_bt2_hdr_fd(envval, my_fapl) < 0 ? 1 : 0); + nerrors += (test_swmr_non_latest(driver_name, my_fapl) < 0 ? 1 : 0); + nerrors += (test_earray_hdr_fd(driver_name, my_fapl) < 0 ? 1 : 0); + nerrors += (test_farray_hdr_fd(driver_name, my_fapl) < 0 ? 1 : 0); + nerrors += (test_bt2_hdr_fd(driver_name, my_fapl) < 0 ? 1 : 0); nerrors += (test_downsize_vlen_scalar_dataset(file) < 0 ? 1 : 0); diff --git a/test/dtypes.c b/test/dtypes.c index bebaef0b602..836d6d89eb0 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -6051,7 +6051,7 @@ test__Float16(void) { #ifdef H5_HAVE__FLOAT16 H5T_path_t *path = NULL; - const char *env_h5_driver; + const char *driver_name; hsize_t dims[1]; htri_t is_little_endian; H5T_t *native_dtype = NULL; @@ -6065,9 +6065,7 @@ test__Float16(void) TESTING("_Float16 datatype"); - env_h5_driver = getenv(HDF5_DRIVER); - if (env_h5_driver == NULL) - env_h5_driver = "nomatch"; + driver_name = h5_get_test_driver_name(); /* Check that native macro maps to a valid type */ if (0 == H5Tget_size(H5T_NATIVE_FLOAT16)) { @@ -6402,7 +6400,7 @@ test__Float16(void) if (H5Fclose(fid) < 0) TEST_ERROR; - if (!h5_driver_uses_multiple_files(env_h5_driver, H5_EXCLUDE_NON_MULTIPART_DRIVERS)) { + if (!h5_driver_uses_multiple_files(driver_name, H5_EXCLUDE_NON_MULTIPART_DRIVERS)) { bool is_default_vfd_compat = false; if (h5_driver_is_default_vfd_compatible(H5P_DEFAULT, &is_default_vfd_compat) < 0) diff --git a/test/error_test.c b/test/error_test.c index 57b1eb7a6b3..bb780215574 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -781,14 +781,12 @@ main(void) hid_t fapl = H5I_INVALID_HID; hid_t estack_id = H5I_INVALID_HID; char filename[1024]; - const char *env_h5_drvr; /* File driver value from environment */ + const char *driver_name; /* File driver value from environment */ const char *FUNC_main = "main"; int i; /* Get the VFD to use */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); fprintf(stderr, " This program tests the Error API. There're supposed to be some error messages\n"); @@ -879,7 +877,7 @@ main(void) * the test file was pre-generated. */ h5_fixname(DATAFILE, H5P_DEFAULT, filename, sizeof filename); - if (!h5_using_default_driver(env_h5_drvr) && strcmp(env_h5_drvr, "stdio")) { + if (!h5_using_default_driver(driver_name) && strcmp(driver_name, "stdio")) { /* If not using the library's default VFD or the stdio VFD, force * the library's default VFD here. The test file was pre-generated * and can cause issues with many VFDs. diff --git a/test/fheap.c b/test/fheap.c index 19a1e6adc16..cd1f0c5ec1f 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -15958,17 +15958,15 @@ main(void) unsigned nerrors = 0; /* Cumulative error count */ unsigned num_pb_fs = 1; /* The number of settings to test for page buffering and file space handling */ int ExpressMode; /* Express testing level */ - const char *envval; /* Environment variable */ + const char *driver_name; /* Environment variable */ bool contig_addr_vfd; /* Whether VFD used has a contiguous address space */ bool api_ctx_pushed = false; /* Whether API context pushed */ /* Don't run this test using certain file drivers */ - envval = getenv(HDF5_DRIVER); - if (envval == NULL) - envval = "nomatch"; + driver_name = h5_get_test_driver_name(); /* Current VFD that does not support contiguous address space */ - contig_addr_vfd = (bool)(strcmp(envval, "split") != 0 && strcmp(envval, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); /* Reset library */ h5_reset(); diff --git a/test/file_image.c b/test/file_image.c index 66881c4c129..45bf5af29c7 100644 --- a/test/file_image.c +++ b/test/file_image.c @@ -628,6 +628,7 @@ test_core(void) /* Create file image buffer */ fd = HDopen(copied_filename, O_RDONLY); VERIFY(fd > 0, "open failed"); + memset(&sb, 0, sizeof(h5_stat_t)); ret = HDfstat(fd, &sb); VERIFY(ret == 0, "fstat failed"); size = (size_t)sb.st_size; @@ -705,6 +706,8 @@ test_get_file_image(const char *test_banner, const int file_name_num, hid_t fapl TESTING(test_banner); + memset(&stat_buf, 0, sizeof(h5_stat_t)); + /* set flag if we are dealing with a family file */ driver = H5Pget_driver(fapl); VERIFY(driver >= 0, "H5Pget_driver(fapl) failed"); diff --git a/test/filenotclosed.c b/test/filenotclosed.c index 806a7a498d9..a42e1a8c43e 100644 --- a/test/filenotclosed.c +++ b/test/filenotclosed.c @@ -59,20 +59,18 @@ main(void) hsize_t chunk_dim[1] = {10}; /* Chunk dimension sizes */ int buf[5] = {1, 2, 3, 4, 5}; /* The data to be written to the dataset */ char filename[100]; /* File name */ - const char *env_h5_drvr; /* File Driver value from environment */ + const char *driver_name; /* File Driver value from environment */ bool contig_addr_vfd; /* Contiguous address vfd */ /* Get the VFD to use */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); /* Skip test when using VFDs that has different address spaces for each * type of metadata allocation. * Further investigation is needed to resolve the test failure with the * split/multi driver. Please see HDFFV-10160. */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); if (!contig_addr_vfd) { SKIPPED(); puts(" Temporary skipped for a spilt/multi driver"); diff --git a/test/flush1.c b/test/flush1.c index 566d5614c9c..f9ecb15fa1e 100644 --- a/test/flush1.c +++ b/test/flush1.c @@ -176,20 +176,20 @@ add_dset_to_file(hid_t fid, const char *dset_name) int main(void) { - char *driver = NULL; /* name of current VFD (from env var) */ - bool vfd_supports_swmr; /* whether the current VFD supports SWMR */ - hid_t fid = H5I_INVALID_HID; /* file ID */ - hid_t fapl_id = H5I_INVALID_HID; /* file access proplist ID */ - char filename[1024]; /* filename */ - bool use_swmr; /* whether or not to use SWMR I/O */ + const char *driver_name; /* name of current VFD (from env var) */ + bool vfd_supports_swmr; /* whether the current VFD supports SWMR */ + hid_t fid = H5I_INVALID_HID; /* file ID */ + hid_t fapl_id = H5I_INVALID_HID; /* file access proplist ID */ + char filename[1024]; /* filename */ + bool use_swmr; /* whether or not to use SWMR I/O */ h5_reset(); if ((fapl_id = h5_fileaccess()) < 0) TEST_ERROR; /* Check if the current VFD supports SWMR */ - driver = getenv(HDF5_DRIVER); - vfd_supports_swmr = H5FD__supports_swmr_test(driver); + driver_name = h5_get_test_driver_name(); + vfd_supports_swmr = H5FD__supports_swmr_test(driver_name); /*************************************************/ /* NOTE: Not closing the file ID is intentional! */ diff --git a/test/flush2.c b/test/flush2.c index ccec232e3d7..12daa2be87f 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -223,7 +223,7 @@ clear_status_flags(const char *filename, hid_t fapl_id) int main(void) { - char *driver = NULL; /* name of current VFD (from env var) */ + const char *driver_name; /* name of current VFD (from env var) */ bool vfd_supports_swmr; /* whether the current VFD supports SWMR */ hid_t fapl_id = H5I_INVALID_HID; /* file access proplist ID */ char filename[1024]; /* filename */ @@ -236,8 +236,8 @@ main(void) PUTS_ERROR("bad vfd-dependent fapl"); /* Check if the current VFD supports SWMR */ - driver = getenv(HDF5_DRIVER); - vfd_supports_swmr = H5FD__supports_swmr_test(driver); + driver_name = h5_get_test_driver_name(); + vfd_supports_swmr = H5FD__supports_swmr_test(driver_name); if (h5_driver_is_default_vfd_compatible(fapl_id, &driver_is_default_vfd_compatible) < 0) { printf("Can't check if VFD is compatible with default VFD\n"); diff --git a/test/flushrefresh.c b/test/flushrefresh.c index 297db60e7ac..bab334f1c68 100644 --- a/test/flushrefresh.c +++ b/test/flushrefresh.c @@ -133,7 +133,7 @@ int main(int argc, char *argv[]) { /* Variables */ - const char *envval = NULL; + const char *driver_name = NULL; /* Initialize library */ if (H5open() < 0) @@ -146,9 +146,9 @@ main(int argc, char *argv[]) * anything. */ /* Determine driver being used */ - envval = getenv(HDF5_DRIVER); + driver_name = h5_get_test_driver_name(); - if (envval == NULL || H5FD__supports_swmr_test(envval)) { + if (driver_name == NULL || H5FD__supports_swmr_test(driver_name)) { if (test_flush() != SUCCEED) TEST_ERROR; if (test_refresh() != SUCCEED) diff --git a/test/h5test.c b/test/h5test.c index c9c5c103048..fcba51fa2fc 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -35,8 +35,10 @@ * this test support library. The environment variable is used in preference * to the cpp constant. If neither is defined then use some default value. * - * HDF5_DRIVER: This string describes what low level file driver to - * use for HDF5 file access. + * HDF5_DRIVER/HDF5_TEST_DRIVER: This string describes what low level file + * driver to use for HDF5 file access. The first word in the value is the + * name of the driver and subsequent data is interpreted according to the + * driver. See h5_get_vfd_fapl() for details. * * HDF5_LIBVER_BOUNDS: This string describes what library version bounds to * use for HDF5 file access. See h5_get_libver_fapl() for details. @@ -213,11 +215,8 @@ h5_delete_test_file(const char *base_name, hid_t fapl) void h5_delete_all_test_files(const char *base_name[], hid_t fapl) { - int i; /* iterator */ - - for (i = 0; base_name[i]; i++) { + for (int i = 0; base_name[i]; i++) h5_delete_test_file(base_name[i], fapl); - } /* end for */ } /* end h5_delete_all_test_files() */ @@ -451,7 +450,7 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fu bool nest_printf, bool subst_for_superblock) { const char *prefix = NULL; - const char *driver_env_var = NULL; /* HDF5_DRIVER environment variable */ + const char *driver_env_var = NULL; /* HDF5_DRIVER/HDF5_TEST_DRIVER environment variable */ char *ptr, last = '\0'; const char *suffix = _suffix; size_t i, j; @@ -466,7 +465,7 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fu /* Determine if driver is set by environment variable. If it is, * only generate a suffix if fixing the filename for the superblock * file. */ - driver_env_var = getenv(HDF5_DRIVER); + driver_env_var = h5_get_test_driver_name(); if (driver_env_var && (H5P_DEFAULT == fapl) && subst_for_superblock) fapl = H5P_FILE_ACCESS_DEFAULT; @@ -490,19 +489,16 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fu } else if (H5FD_MULTI == driver) { - /* Check the HDF5_DRIVER environment variable in case - * we are using the split driver since both of those - * use the multi VFD under the hood. + /* Check the HDF5_DRIVER/HDF5_TEST_DRIVER environment + * variable in case we are using the split driver since + * both of those use the multi VFD under the hood. */ -#ifdef HDF5_DRIVER - /* Use the environment variable, then the compile-time constant */ - if (!driver_env_var) - driver_env_var = HDF5_DRIVER; -#endif if (driver_env_var && !strcmp(driver_env_var, "split")) { /* split VFD */ if (subst_for_superblock) suffix = ".h5.meta"; + else + suffix = NULL; } else { /* multi VFD */ @@ -627,6 +623,7 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fu */ h5_stat_t buf; + memset(&buf, 0, sizeof(h5_stat_t)); if (HDstat(fullname, &buf) < 0) /* The directory doesn't exist just yet */ if (HDmkdir(fullname, (mode_t)0755) < 0 && errno != EEXIST) @@ -726,6 +723,10 @@ h5_fileaccess(void) if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) goto error; + /* Attempt to set up a file driver first */ + if (h5_get_vfd_fapl(fapl_id) < 0) + goto error; + /* Check for libver bounds */ if (h5_get_libver_fapl(fapl_id) < 0) goto error; @@ -758,6 +759,10 @@ h5_fileaccess_flags(unsigned flags) if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) goto error; + /* Attempt to set up a file driver first */ + if ((flags & H5_FILEACCESS_VFD) && h5_get_vfd_fapl(fapl_id) < 0) + goto error; + /* Check for libver bounds */ if ((flags & H5_FILEACCESS_LIBVER) && h5_get_libver_fapl(fapl_id) < 0) goto error; @@ -770,6 +775,241 @@ h5_fileaccess_flags(unsigned flags) return H5I_INVALID_HID; } /* end h5_fileaccess_flags() */ +/*------------------------------------------------------------------------- + * Function: h5_get_vfd_fapl + * + * Purpose: Sets the file driver for a FAPL according to the value + * specified in the environment variable "HDF5_DRIVER" or + * "HDF5_TEST_DRIVER". + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +h5_get_vfd_fapl(hid_t fapl) +{ + const char *env = NULL; /* HDF5_DRIVER/HDF5_TEST_DRIVER environment variable */ + const char *tok = NULL; /* strtok pointer */ + char *lasts = NULL; /* Context pointer for strtok_r() call */ + char buf[1024]; /* buffer for tokenizing HDF5_DRIVER */ + + /* Get the environment variable, if it exists */ + env = getenv(HDF5_DRIVER); + if (!env) + env = getenv("HDF5_TEST_DRIVER"); + + /* If the environment variable was not set, just return + * without modifying the FAPL. + */ + if (!env || !*env) + goto done; + + /* Get the first 'word' of the environment variable. + * If it's nothing (environment variable was whitespace) + * just return the default fapl. + */ + strncpy(buf, env, sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; + if (NULL == (tok = HDstrtok_r(buf, " \t\n\r", &lasts))) + goto done; + + if (!strcmp(tok, "sec2")) { + /* POSIX (section 2) read() and write() system calls */ + if (H5Pset_fapl_sec2(fapl) < 0) + goto error; + } + else if (!strcmp(tok, "stdio")) { + /* Standard C fread() and fwrite() system calls */ + if (H5Pset_fapl_stdio(fapl) < 0) + goto error; + } + else if (!strcmp(tok, "core")) { + /* In-memory driver settings (backing store on, 1 MB increment) */ + if (H5Pset_fapl_core(fapl, (size_t)H5_MB, TRUE) < 0) + goto error; + } + else if (!strcmp(tok, "core_paged")) { + /* In-memory driver with write tracking and paging on */ + if (H5Pset_fapl_core(fapl, (size_t)H5_MB, TRUE) < 0) + goto error; + if (H5Pset_core_write_tracking(fapl, TRUE, 4096) < 0) + goto error; + } + else if (!strcmp(tok, "split")) { + /* Split meta data and raw data each using default driver */ + if (H5Pset_fapl_split(fapl, ".meta", H5P_DEFAULT, ".raw", H5P_DEFAULT) < 0) + goto error; + } + else if (!strcmp(tok, "multi")) { + /* Multi-file driver, general case of the split driver */ + H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; + hid_t memb_fapl[H5FD_MEM_NTYPES]; + const char *memb_name[H5FD_MEM_NTYPES]; + char *sv[H5FD_MEM_NTYPES]; + haddr_t memb_addr[H5FD_MEM_NTYPES]; + H5FD_mem_t mt; + const int multi_memname_maxlen = 1024; + + memset(memb_map, 0, sizeof(memb_map)); + memset(memb_fapl, 0, sizeof(memb_fapl)); + memset(memb_name, 0, sizeof(memb_name)); + memset(memb_addr, 0, sizeof(memb_addr)); + + assert(strlen(multi_letters) == H5FD_MEM_NTYPES); + for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { + memb_fapl[mt] = H5P_DEFAULT; + if (NULL == (sv[mt] = malloc(multi_memname_maxlen))) + goto error; + snprintf(sv[mt], multi_memname_maxlen, "%%s-%c.h5", multi_letters[mt]); + memb_name[mt] = sv[mt]; + memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10); + } /* end for */ + + if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0) + goto error; + + for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) + free(sv[mt]); + } + else if (!strcmp(tok, "family")) { + /* Family of files, each 1MB and using the default driver */ + hsize_t fam_size = 100 * 1024 * 1024; /* 100 MB */ + + /* Was a family size specified in the environment variable? */ + if ((tok = HDstrtok_r(NULL, " \t\n\r", &lasts))) + fam_size = (hsize_t)(strtod(tok, NULL) * 1024 * 1024); + if (H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT) < 0) + goto error; + } + else if (!strcmp(tok, "log")) { + /* Log file access */ + unsigned log_flags = H5FD_LOG_LOC_IO | H5FD_LOG_ALLOC; + + /* Were special log file flags specified in the environment variable? */ + if ((tok = HDstrtok_r(NULL, " \t\n\r", &lasts))) + log_flags = (unsigned)strtol(tok, NULL, 0); + + if (H5Pset_fapl_log(fapl, NULL, log_flags, 0) < 0) + goto error; + } +#ifdef H5_HAVE_DIRECT + else if (!strcmp(tok, "direct")) { + /* Linux direct read() and write() system calls. Set memory boundary, + * file block size, and copy buffer size to the default values. + */ + if (H5Pset_fapl_direct(fapl, 1024, 4096, 8 * 4096) < 0) + goto error; + } +#endif + else if (!strcmp(tok, "splitter")) { + H5FD_splitter_vfd_config_t *splitter_config; + static size_t file_count = 0; + + if (NULL == (splitter_config = malloc(sizeof(*splitter_config)))) + goto error; + + splitter_config->magic = H5FD_SPLITTER_MAGIC; + splitter_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION; + splitter_config->ignore_wo_errs = false; + memset(splitter_config->log_file_path, 0, H5FD_SPLITTER_PATH_MAX + 1); + + /* + * We need access to the base filename to generate a unique name + * for the W/O file for this FAPL. Until this is refactored, just + * generate unique names with a counter. + */ + snprintf(splitter_config->wo_path, H5FD_SPLITTER_PATH_MAX + 1, "splitter_wo_file_%zu.h5", + file_count++); + + /* Setup R/W and W/O channel FAPLs since the default FAPL + * has the splitter driver set on it from the environment + */ + if ((splitter_config->rw_fapl_id = H5Pcopy(H5P_FILE_ACCESS_DEFAULT)) < 0) { + free(splitter_config); + goto error; + } + if ((splitter_config->wo_fapl_id = H5Pcopy(H5P_FILE_ACCESS_DEFAULT)) < 0) { + H5Pclose(splitter_config->rw_fapl_id); + free(splitter_config); + goto error; + } + if (H5Pset_fapl_sec2(splitter_config->rw_fapl_id) < 0) { + H5Pclose(splitter_config->rw_fapl_id); + H5Pclose(splitter_config->wo_fapl_id); + free(splitter_config); + goto error; + } + if (H5Pset_fapl_sec2(splitter_config->wo_fapl_id) < 0) { + H5Pclose(splitter_config->rw_fapl_id); + H5Pclose(splitter_config->wo_fapl_id); + free(splitter_config); + goto error; + } + + if (H5Pset_fapl_splitter(fapl, splitter_config) < 0) { + H5Pclose(splitter_config->rw_fapl_id); + H5Pclose(splitter_config->wo_fapl_id); + free(splitter_config); + goto error; + } + + free(splitter_config); + } + else if (!strcmp(tok, "onion")) { + /* TODO */ + return 0; + } +#ifdef H5_HAVE_SUBFILING_VFD + else if (!strcmp(tok, H5FD_SUBFILING_NAME)) { + /* Use default subfiling configuration */ + if (H5Pset_fapl_subfiling(fapl, NULL) < 0) + goto error; + } +#endif +#ifdef H5_HAVE_PARALLEL + else if (!strcmp(tok, "mpio")) { + int mpi_initialized, mpi_finalized; + + MPI_Initialized(&mpi_initialized); + MPI_Finalized(&mpi_finalized); + + if (mpi_initialized && !mpi_finalized) { + if (H5Pset_fapl_mpio(fapl, MPI_COMM_WORLD, MPI_INFO_NULL) < 0) + goto error; + } + } +#endif +#ifdef H5_HAVE_MIRROR_VFD + else if (!strcmp(tok, "mirror")) { + /* TODO */ + return 0; + } +#endif +#ifdef H5_HAVE_LIBHDFS + else if (!strcmp(tok, "hdfs")) { + /* TODO */ + return 0; + } +#endif +#ifdef H5_HAVE_ROS3_VFD + else if (!strcmp(tok, "ros3")) { + /* TODO */ + return 0; + } +#endif + else { + /* Unknown driver */ + goto error; + } + +done: + return 0; + +error: + return -1; +} /* end h5_get_vfd_fapl() */ + /*------------------------------------------------------------------------- * Function: h5_get_libver_fapl * @@ -784,10 +1024,10 @@ h5_fileaccess_flags(unsigned flags) herr_t h5_get_libver_fapl(hid_t fapl) { - const char *env = NULL; /* HDF5_DRIVER environment variable */ + const char *env = NULL; /* HDF5_LIBVER_BOUNDS environment variable */ const char *tok = NULL; /* strtok pointer */ char *lasts = NULL; /* Context pointer for strtok_r() call */ - char buf[1024]; /* buffer for tokenizing HDF5_DRIVER */ + char buf[1024]; /* buffer for tokenizing HDF5_LIBVER_BOUNDS */ /* Get the environment variable, if it exists */ env = getenv("HDF5_LIBVER_BOUNDS"); @@ -1067,6 +1307,8 @@ h5_get_file_size(const char *filename, hid_t fapl) h5_stat_t sb; /* Structure for querying file info */ int j = 0; + memset(&sb, 0, sizeof(h5_stat_t)); + if (fapl == H5P_DEFAULT) { /* Get the file's statistics */ if (0 == HDstat(filename, &sb)) @@ -1095,9 +1337,9 @@ h5_get_file_size(const char *filename, hid_t fapl) else if (driver == H5FD_MULTI) { H5FD_mem_t mt; h5_stat_size_t tot_size = 0; - char *driver_env_var = NULL; + const char *driver_env_var = NULL; - driver_env_var = getenv(HDF5_DRIVER); + driver_env_var = h5_get_test_driver_name(); if (driver_env_var && !strcmp(driver_env_var, "split")) { for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { if (mt != H5FD_MEM_DRAW && mt != H5FD_MEM_SUPER) @@ -1955,13 +2197,13 @@ H5_get_srcdir(void) int h5_duplicate_file_by_bytes(const char *orig, const char *dest) { - FILE *orig_ptr = NULL; - FILE *dest_ptr = NULL; - hsize_t fsize = 0; - hsize_t read_size = 0; - hsize_t max_buf = 0; - void *dup_buf = NULL; - int ret_value = 0; + FILE *orig_ptr = NULL; + FILE *dest_ptr = NULL; + size_t fsize = 0; + size_t read_size = 0; + size_t max_buf = 0; + void *dup_buf = NULL; + int ret_value = 0; max_buf = 4096 * sizeof(char); @@ -1972,7 +2214,7 @@ h5_duplicate_file_by_bytes(const char *orig, const char *dest) } HDfseek(orig_ptr, 0, SEEK_END); - fsize = (hsize_t)HDftell(orig_ptr); + fsize = (size_t)HDftell(orig_ptr); HDrewind(orig_ptr); dest_ptr = fopen(dest, "wb"); @@ -2189,12 +2431,38 @@ h5_using_native_vol(hid_t fapl_id, hid_t obj_id, bool *is_native_vol) return ret_value; } +/*------------------------------------------------------------------------- + * Function: h5_get_test_driver_name + * + * Purpose: Checks the HDF5_DRIVER and HDF5_TEST_DRIVER environment + * variables to see if a driver name has been set for testing. + * + * Return: Driver name if set/NULL otherwise + * + *------------------------------------------------------------------------- + */ +const char * +h5_get_test_driver_name(void) +{ + char *envval; + + assert(H5_DEFAULT_VFD == H5FD_SEC2); + + if ((envval = getenv(HDF5_DRIVER))) + return envval; + else if ((envval = getenv("HDF5_TEST_DRIVER"))) + return envval; + else + return H5_DEFAULT_VFD_NAME; +} + /*------------------------------------------------------------------------- * Function: h5_using_default_driver * * Purpose: Checks if the specified VFD name matches the library's - * default VFD. If `drv_name` is NULL, the HDF5_DRIVER - * environment is checked instead (if it is set). + * default VFD. If `drv_name` is NULL, the HDF5_DRIVER and + * HDF5_TEST_DRIVER environment variables are checked instead + * (if set). * * Return: true/false * @@ -2208,10 +2476,10 @@ h5_using_default_driver(const char *drv_name) assert(H5_DEFAULT_VFD == H5FD_SEC2); if (!drv_name) - drv_name = getenv(HDF5_DRIVER); + drv_name = h5_get_test_driver_name(); if (drv_name) - return (!strcmp(drv_name, "sec2") || !strcmp(drv_name, "nomatch")); + return !strcmp(drv_name, H5_DEFAULT_VFD_NAME); return ret_val; } @@ -2329,7 +2597,7 @@ h5_driver_uses_multiple_files(const char *drv_name, unsigned flags) bool ret_val = false; if (!drv_name) - drv_name = getenv(HDF5_DRIVER); + drv_name = h5_get_test_driver_name(); if (drv_name) { if ((flags & H5_EXCLUDE_MULTIPART_DRIVERS) == 0) { diff --git a/test/h5test.h b/test/h5test.h index 8f785674abc..9ef94943a81 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -230,7 +230,8 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */ #define H5_ALARM_SEC 1200 /* default is 20 minutes */ /* Flags for h5_fileaccess_flags() */ -#define H5_FILEACCESS_LIBVER 0x01 +#define H5_FILEACCESS_VFD 0x01 +#define H5_FILEACCESS_LIBVER 0x02 /* Flags for h5_driver_uses_multiple_files() */ #define H5_EXCLUDE_MULTIPART_DRIVERS 0x01 @@ -292,12 +293,14 @@ H5TEST_DLL int h5_duplicate_file_by_bytes(const char *orig, const cha H5TEST_DLL herr_t h5_check_if_file_locking_enabled(bool *are_enabled); H5TEST_DLL void h5_check_file_locking_env_var(htri_t *use_locks, htri_t *ignore_disabled_locks); H5TEST_DLL herr_t h5_using_native_vol(hid_t fapl_id, hid_t obj_id, bool *is_native_vol); +H5TEST_DLL const char *h5_get_test_driver_name(void); H5TEST_DLL bool h5_using_default_driver(const char *drv_name); H5TEST_DLL herr_t h5_using_parallel_driver(hid_t fapl_id, bool *driver_is_parallel); H5TEST_DLL herr_t h5_driver_is_default_vfd_compatible(hid_t fapl_id, bool *default_vfd_compatible); H5TEST_DLL bool h5_driver_uses_multiple_files(const char *drv_name, unsigned flags); /* Functions that will replace components of a FAPL */ +H5TEST_DLL herr_t h5_get_vfd_fapl(hid_t fapl_id); H5TEST_DLL herr_t h5_get_libver_fapl(hid_t fapl_id); /* h5_clean_files() replacements */ diff --git a/test/istore.c b/test/istore.c index 8da9961cbfd..2062e9486b4 100644 --- a/test/istore.c +++ b/test/istore.c @@ -68,6 +68,7 @@ is_sparse(void) return 0; if (HDclose(fd) < 0) return 0; + memset(&sb, 0, sizeof(h5_stat_t)); if (HDstat("x.h5", &sb) < 0) return 0; if (HDremove("x.h5") < 0) diff --git a/test/links.c b/test/links.c index 87efae8107b..4ea612ebdfd 100644 --- a/test/links.c +++ b/test/links.c @@ -9537,7 +9537,7 @@ external_set_elink_fapl3(bool new_format) *------------------------------------------------------------------------- */ static int -external_set_elink_acc_flags(const char *env_h5_drvr, hid_t fapl, bool new_format) +external_set_elink_acc_flags(const char *driver_name, hid_t fapl, bool new_format) { hid_t file1 = H5I_INVALID_HID, file2 = H5I_INVALID_HID, group = H5I_INVALID_HID, subgroup = H5I_INVALID_HID, gapl = H5I_INVALID_HID; @@ -9671,7 +9671,7 @@ external_set_elink_acc_flags(const char *env_h5_drvr, hid_t fapl, bool new_forma TEST_ERROR; /* Only run this part with VFDs that support SWMR */ - if (H5FD__supports_swmr_test(env_h5_drvr)) { + if (H5FD__supports_swmr_test(driver_name)) { /* Reopen file1, with read-write and SWMR-write access */ /* Only supported under the latest file format */ @@ -12663,7 +12663,7 @@ external_link_strong(hid_t fapl, bool new_format) *------------------------------------------------------------------------- */ static int -external_symlink(const char *env_h5_drvr, hid_t fapl, bool new_format) +external_symlink(const char *driver_name, hid_t fapl, bool new_format) { #ifdef H5_HAVE_SYMLINK hid_t file1 = H5I_INVALID_HID; @@ -12698,8 +12698,7 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, bool new_format) /* Skip test when using VFDs that can't provide a POSIX compatible file * descriptor. */ - have_posix_compat_vfd = (bool)(!strcmp(env_h5_drvr, "sec2") || !strcmp(env_h5_drvr, "core") || - !strcmp(env_h5_drvr, "nomatch")); + have_posix_compat_vfd = (bool)(!strcmp(driver_name, "sec2") || !strcmp(driver_name, "core")); if (!have_posix_compat_vfd) { SKIPPED(); puts(" Current VFD doesn't support POSIX I/O calls"); @@ -23108,12 +23107,10 @@ main(void) unsigned new_format; /* Whether to use the new format or not */ unsigned minimize_dset_oh; unsigned efc; /* Whether to use the external file cache */ - const char *env_h5_drvr; /* File Driver value from environment */ + const char *driver_name; /* File Driver value from environment */ bool driver_is_default_compatible; - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); h5_reset(); fapl = h5_fileaccess(); @@ -23182,7 +23179,7 @@ main(void) #endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Skip external link tests for splitter VFD, which has external link-related bugs */ - if (strcmp(env_h5_drvr, "splitter")) { + if (strcmp(driver_name, "splitter")) { /* tests for external link */ /* Test external file cache first, so it sees the default efc setting on the fapl @@ -23197,7 +23194,7 @@ main(void) /* This test cannot run with the EFC because the EFC cannot currently * reopen a cached file with a different intent */ - nerrors += external_set_elink_acc_flags(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_set_elink_acc_flags(driver_name, my_fapl, new_format) < 0 ? 1 : 0; /* Try external link tests both with and without the external file cache */ for (efc = false; efc <= true; efc++) { @@ -23269,7 +23266,7 @@ main(void) nerrors += external_link_win8(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_win9(my_fapl, new_format) < 0 ? 1 : 0; #endif - nerrors += external_symlink(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_symlink(driver_name, my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_copy_invalid_object(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_dont_fail_to_source(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_open_twice(my_fapl, new_format) < 0 ? 1 : 0; diff --git a/test/links_env.c b/test/links_env.c index 1eae52a5128..ed9c3ba7f0c 100644 --- a/test/links_env.c +++ b/test/links_env.c @@ -144,17 +144,15 @@ external_link_env(hid_t fapl, bool new_format) int main(void) { - const char *env_h5_drvr; /* File driver value from environment */ + const char *driver_name; /* File driver value from environment */ hid_t fapl; /* File access property lists */ int nerrors = 0; /* Error from tests */ /* Get the VFD to use */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); /* Splitter VFD has issues with external links */ - if (!strcmp(env_h5_drvr, "splitter")) { + if (!strcmp(driver_name, "splitter")) { puts(" -- SKIPPED for incompatible VFD --"); exit(EXIT_SUCCESS); } diff --git a/test/mf.c b/test/mf.c index 269419f546c..909a7ec89f1 100644 --- a/test/mf.c +++ b/test/mf.c @@ -108,47 +108,47 @@ typedef enum { static int check_stats(const H5F_t *f, const H5FS_t *frsp, H5FS_stat_t *state); -static unsigned test_mf_eoa(const char *env_h5_drvr, hid_t fapl); -static unsigned test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl); -static unsigned test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl); +static unsigned test_mf_eoa(const char *driver_name, hid_t fapl); +static unsigned test_mf_eoa_shrink(const char *driver_name, hid_t fapl); +static unsigned test_mf_eoa_extend(const char *driver_name, hid_t fapl); static unsigned test_dichotomy(hid_t fapl); static unsigned test_mf_fs_start(hid_t fapl); static unsigned test_mf_fs_alloc_free(hid_t fapl); static unsigned test_mf_fs_extend(hid_t fapl); -static unsigned test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl); -static unsigned test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl); -static unsigned test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl); -static unsigned test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl); -static unsigned test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl); -static unsigned test_mf_aggr_alloc5(const char *env_h5_drvr, hid_t fapl); -static unsigned test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl); -static unsigned test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl); -static unsigned test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl); -static unsigned test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl); -static unsigned test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl); -static unsigned test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl); -static unsigned test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl); -static unsigned test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl); -static unsigned test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl); -static unsigned test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl); -static unsigned test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl); -static unsigned test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl); -static unsigned test_mf_tmp(const char *env_h5_drvr, hid_t fapl, bool new_format); -static unsigned test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, bool new_format); -static unsigned test_mf_strat_thres_gone(const char *env_h5_drvr, hid_t fapl, bool new_format); -static unsigned test_mf_fs_persist(const char *env_h5_drvr, hid_t fapl, bool new_format); -static unsigned test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, bool new_format); +static unsigned test_mf_fs_absorb(const char *driver_name, hid_t fapl); +static unsigned test_mf_aggr_alloc1(const char *driver_name, hid_t fapl); +static unsigned test_mf_aggr_alloc2(const char *driver_name, hid_t fapl); +static unsigned test_mf_aggr_alloc3(const char *driver_name, hid_t fapl); +static unsigned test_mf_aggr_alloc4(const char *driver_name, hid_t fapl); +static unsigned test_mf_aggr_alloc5(const char *driver_name, hid_t fapl); +static unsigned test_mf_aggr_alloc6(const char *driver_name, hid_t fapl); +static unsigned test_mf_aggr_alloc7(const char *driver_name, hid_t fapl); +static unsigned test_mf_aggr_extend(const char *driver_name, hid_t fapl); +static unsigned test_mf_aggr_absorb(const char *driver_name, hid_t fapl); +static unsigned test_mf_align_eoa(const char *driver_name, hid_t fapl, hid_t new_fapl); +static unsigned test_mf_align_fs(const char *driver_name, hid_t fapl, hid_t new_fapl); +static unsigned test_mf_align_alloc1(const char *driver_name, hid_t fapl, hid_t new_fapl); +static unsigned test_mf_align_alloc2(const char *driver_name, hid_t fapl, hid_t new_fapl); +static unsigned test_mf_align_alloc3(const char *driver_name, hid_t fapl, hid_t new_fapl); +static unsigned test_mf_align_alloc4(const char *driver_name, hid_t fapl, hid_t new_fapl); +static unsigned test_mf_align_alloc5(const char *driver_name, hid_t fapl, hid_t new_fapl); +static unsigned test_mf_align_alloc6(const char *driver_name, hid_t fapl, hid_t new_fapl); +static unsigned test_mf_tmp(const char *driver_name, hid_t fapl, bool new_format); +static unsigned test_mf_fs_gone(const char *driver_name, hid_t fapl, bool new_format); +static unsigned test_mf_strat_thres_gone(const char *driver_name, hid_t fapl, bool new_format); +static unsigned test_mf_fs_persist(const char *driver_name, hid_t fapl, bool new_format); +static unsigned test_mf_strat_thres_persist(const char *driver_name, hid_t fapl, bool new_format); #ifdef PB_OUT static unsigned test_mf_fs_persist_split(void); static unsigned test_mf_fs_persist_multi(void); #endif -static unsigned test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl); -static unsigned test_page_small(const char *env_h5_drvr, hid_t fapl); -static unsigned test_page_large(const char *env_h5_drvr, hid_t fapl); -static unsigned test_page_large_try_extend(const char *env_h5_drvr, hid_t fapl); -static unsigned test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl); -static unsigned test_page_try_shrink(const char *env_h5_drvr, hid_t fapl); -static unsigned test_page_alignment(const char *env_h5_drvr, hid_t fapl); +static unsigned test_page_alloc_xfree(const char *driver_name, hid_t fapl); +static unsigned test_page_small(const char *driver_name, hid_t fapl); +static unsigned test_page_large(const char *driver_name, hid_t fapl); +static unsigned test_page_large_try_extend(const char *driver_name, hid_t fapl); +static unsigned test_page_small_try_extend(const char *driver_name, hid_t fapl); +static unsigned test_page_try_shrink(const char *driver_name, hid_t fapl); +static unsigned test_page_alignment(const char *driver_name, hid_t fapl); /* * Verify statistics for the free-space manager @@ -210,7 +210,7 @@ check_stats(const H5F_t *f, const H5FS_t *frsp, H5FS_stat_t *state) *------------------------------------------------------------------------- */ static unsigned -test_mf_eoa(const char *env_h5_drvr, hid_t fapl) +test_mf_eoa(const char *driver_name, hid_t fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ hid_t fapl_new = H5I_INVALID_HID; /* copy of fapl */ @@ -228,8 +228,8 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl) /* Skip test when using VFDs that has different address spaces for each * type of metadata allocation. Also skip test for Direct VFD. */ - suitable_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0 && - strcmp(env_h5_drvr, "direct") != 0); + suitable_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0 && + strcmp(driver_name, "direct") != 0); if (suitable_vfd) { /* Set the filename to use for this test */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -359,7 +359,7 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) +test_mf_eoa_shrink(const char *driver_name, hid_t fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ hid_t fapl_new = H5I_INVALID_HID; /* copy of fapl */ @@ -377,8 +377,8 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) /* Skip test when using VFDs that has different address spaces for each * type of metadata allocation. Also skip test for Direct VFD. */ - suitable_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0 && - strcmp(env_h5_drvr, "direct") != 0); + suitable_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0 && + strcmp(driver_name, "direct") != 0); if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -646,7 +646,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) +test_mf_eoa_extend(const char *driver_name, hid_t fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ hid_t fapl_new = H5I_INVALID_HID; /* copy of fapl */ @@ -665,8 +665,8 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) /* Skip test when using VFDs that has different address spaces for each * type of metadata allocation. Also skip test for Direct VFD. */ - suitable_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0 && - strcmp(env_h5_drvr, "direct") != 0); + suitable_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0 && + strcmp(driver_name, "direct") != 0); if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -861,7 +861,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_tmp(const char *env_h5_drvr, hid_t fapl, bool new_format) +test_mf_tmp(const char *driver_name, hid_t fapl, bool new_format) { hid_t file = H5I_INVALID_HID; /* File ID */ hid_t fapl2 = H5I_INVALID_HID; /* File access property list */ @@ -873,7 +873,7 @@ test_mf_tmp(const char *env_h5_drvr, hid_t fapl, bool new_format) TESTING("'temporary' file space allocation with old library format"); /* Can't run this test with multi-file VFDs */ - if (!h5_driver_uses_multiple_files(env_h5_drvr, 0)) { + if (!h5_driver_uses_multiple_files(driver_name, 0)) { char filename[FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size, new_file_size; /* file size */ @@ -2002,7 +2002,7 @@ test_mf_fs_extend(hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) +test_mf_fs_absorb(const char *driver_name, hid_t fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -2017,7 +2017,7 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) TESTING("A free-space section absorbs an aggregator: test 1"); /* Skip test when using VFDs that don't use the metadata aggregator */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); if (contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -2177,7 +2177,7 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl) +test_mf_aggr_alloc1(const char *driver_name, hid_t fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -2193,8 +2193,8 @@ test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_alloc() of meta/sdata aggregator:test 1"); /* Skip test when using VFDs that don't use the metadata aggregator. Also skip test for Direct VFD. */ - suitable_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0 && - strcmp(env_h5_drvr, "direct") != 0); + suitable_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0 && + strcmp(driver_name, "direct") != 0); if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -2330,7 +2330,7 @@ test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl) +test_mf_aggr_alloc2(const char *driver_name, hid_t fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -2345,8 +2345,8 @@ test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_alloc() of meta/sdata aggregator:test 2"); /* Skip test when using VFDs that don't use the metadata aggregator. Also skip test for Direct VFD. */ - suitable_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0 && - strcmp(env_h5_drvr, "direct") != 0); + suitable_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0 && + strcmp(driver_name, "direct") != 0); if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -2487,7 +2487,7 @@ test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl) +test_mf_aggr_alloc3(const char *driver_name, hid_t fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -2504,7 +2504,7 @@ test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_alloc() of meta/sdata aggregator: test 3"); /* Skip test when using VFDs that don't use the metadata aggregator */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); if (contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -2657,7 +2657,7 @@ test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl) +test_mf_aggr_alloc4(const char *driver_name, hid_t fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -2672,7 +2672,7 @@ test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_alloc() of meta/sdata aggregator:test 4"); /* Skip test when using VFDs that don't use the metadata aggregator */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); if (contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -2806,7 +2806,7 @@ test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_aggr_alloc5(const char *env_h5_drvr, hid_t fapl) +test_mf_aggr_alloc5(const char *driver_name, hid_t fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -2821,7 +2821,7 @@ test_mf_aggr_alloc5(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_alloc() of meta/sdata aggregator:test 5"); /* Skip test when using VFDs that don't use the metadata aggregator */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); if (contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -2943,7 +2943,7 @@ test_mf_aggr_alloc5(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl) +test_mf_aggr_alloc6(const char *driver_name, hid_t fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -2959,7 +2959,7 @@ test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_alloc() of meta/sdata aggregator:test 6"); /* Skip test when using VFDs that don't use the metadata aggregator */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); if (contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -3117,7 +3117,7 @@ test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl) +test_mf_aggr_alloc7(const char *driver_name, hid_t fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -3133,7 +3133,7 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_alloc() of meta/sdata aggregator:test 7"); /* Skip test when using VFDs that don't use the metadata aggregator */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); if (contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -3288,7 +3288,7 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) +test_mf_aggr_extend(const char *driver_name, hid_t fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -3304,7 +3304,7 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_try_extend() of meta/sdata aggregator: test 1"); /* Skip test when using VFDs that don't use the metadata aggregator */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); if (contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -3585,7 +3585,7 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) +test_mf_aggr_absorb(const char *driver_name, hid_t fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -3602,7 +3602,7 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_try_shrink() of meta/sdata aggregator: test 1"); /* Skip test when using VFDs that don't use the metadata aggregator */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); if (contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -3835,7 +3835,7 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) +test_mf_align_eoa(const char *driver_name, hid_t fapl, hid_t new_fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ hid_t fapl1 = H5I_INVALID_HID; @@ -3857,8 +3857,8 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) * don't push mis-aligned space fragments on the file free space list. * Also skip test for Direct VFD. */ - suitable_vfd = (bool)(strcmp(env_h5_drvr, "stdio") != 0 && strcmp(env_h5_drvr, "split") != 0 && - strcmp(env_h5_drvr, "multi") != 0 && strcmp(env_h5_drvr, "direct") != 0); + suitable_vfd = (bool)(strcmp(driver_name, "stdio") != 0 && strcmp(driver_name, "split") != 0 && + strcmp(driver_name, "multi") != 0 && strcmp(driver_name, "direct") != 0); if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -4132,7 +4132,7 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) +test_mf_align_fs(const char *driver_name, hid_t fapl, hid_t new_fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -4307,8 +4307,8 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) * don't push mis-aligned space fragments on the file free space list * Also skip test for Direct VFD. */ - suitable_vfd = (bool)(strcmp(env_h5_drvr, "stdio") != 0 && strcmp(env_h5_drvr, "split") != 0 && - strcmp(env_h5_drvr, "multi") != 0 && strcmp(env_h5_drvr, "direct") != 0); + suitable_vfd = (bool)(strcmp(driver_name, "stdio") != 0 && strcmp(driver_name, "split") != 0 && + strcmp(driver_name, "multi") != 0 && strcmp(driver_name, "direct") != 0); if (suitable_vfd) { if ((file_size = h5_get_file_size(filename, new_fapl)) < 0) TEST_ERROR; @@ -4493,7 +4493,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) +test_mf_align_alloc1(const char *driver_name, hid_t fapl, hid_t new_fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -4514,8 +4514,8 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) * don't push mis-aligned space fragments on the file free space list. * Also skip test for Direct VFD. */ - suitable_vfd = (bool)(strcmp(env_h5_drvr, "stdio") != 0 && strcmp(env_h5_drvr, "split") != 0 && - strcmp(env_h5_drvr, "multi") != 0 && strcmp(env_h5_drvr, "direct") != 0); + suitable_vfd = (bool)(strcmp(driver_name, "stdio") != 0 && strcmp(driver_name, "split") != 0 && + strcmp(driver_name, "multi") != 0 && strcmp(driver_name, "direct") != 0); if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -4757,7 +4757,7 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) +test_mf_align_alloc2(const char *driver_name, hid_t fapl, hid_t new_fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -4777,8 +4777,8 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) * don't push mis-aligned space fragments on the file free space list. * Also skip test for Direct VFD. */ - suitable_vfd = (bool)(strcmp(env_h5_drvr, "stdio") != 0 && strcmp(env_h5_drvr, "split") != 0 && - strcmp(env_h5_drvr, "multi") != 0 && strcmp(env_h5_drvr, "direct") != 0); + suitable_vfd = (bool)(strcmp(driver_name, "stdio") != 0 && strcmp(driver_name, "split") != 0 && + strcmp(driver_name, "multi") != 0 && strcmp(driver_name, "direct") != 0); if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -5102,7 +5102,7 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) +test_mf_align_alloc3(const char *driver_name, hid_t fapl, hid_t new_fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -5123,8 +5123,8 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) * don't push mis-aligned space fragments on the file free space list. * Also skip test for Direct VFD. */ - suitable_vfd = (bool)(strcmp(env_h5_drvr, "stdio") != 0 && strcmp(env_h5_drvr, "split") != 0 && - strcmp(env_h5_drvr, "multi") != 0 && strcmp(env_h5_drvr, "direct") != 0); + suitable_vfd = (bool)(strcmp(driver_name, "stdio") != 0 && strcmp(driver_name, "split") != 0 && + strcmp(driver_name, "multi") != 0 && strcmp(driver_name, "direct") != 0); if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -5417,7 +5417,7 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) +test_mf_align_alloc4(const char *driver_name, hid_t fapl, hid_t new_fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -5437,8 +5437,8 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) * don't push mis-aligned space fragments on the file free space list. * Also skip test for Direct VFD. */ - suitable_vfd = (bool)(strcmp(env_h5_drvr, "stdio") != 0 && strcmp(env_h5_drvr, "split") != 0 && - strcmp(env_h5_drvr, "multi") != 0 && strcmp(env_h5_drvr, "direct") != 0); + suitable_vfd = (bool)(strcmp(driver_name, "stdio") != 0 && strcmp(driver_name, "split") != 0 && + strcmp(driver_name, "multi") != 0 && strcmp(driver_name, "direct") != 0); if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -5635,7 +5635,7 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) +test_mf_align_alloc5(const char *driver_name, hid_t fapl, hid_t new_fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -5656,8 +5656,8 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) * don't push mis-aligned space fragments on the file free space list. * Also skip test for Direct VFD. */ - suitable_vfd = (bool)(strcmp(env_h5_drvr, "stdio") != 0 && strcmp(env_h5_drvr, "split") != 0 && - strcmp(env_h5_drvr, "multi") != 0 && strcmp(env_h5_drvr, "direct") != 0); + suitable_vfd = (bool)(strcmp(driver_name, "stdio") != 0 && strcmp(driver_name, "split") != 0 && + strcmp(driver_name, "multi") != 0 && strcmp(driver_name, "direct") != 0); if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -5906,7 +5906,7 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) +test_mf_align_alloc6(const char *driver_name, hid_t fapl, hid_t new_fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -5927,8 +5927,8 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) * don't push mis-aligned space fragments on the file free space list. * Also skip test for Direct VFD. */ - suitable_vfd = (bool)(strcmp(env_h5_drvr, "stdio") != 0 && strcmp(env_h5_drvr, "split") != 0 && - strcmp(env_h5_drvr, "multi") != 0 && strcmp(env_h5_drvr, "direct") != 0); + suitable_vfd = (bool)(strcmp(driver_name, "stdio") != 0 && strcmp(driver_name, "split") != 0 && + strcmp(driver_name, "multi") != 0 && strcmp(driver_name, "direct") != 0); if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -6116,7 +6116,7 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) * endpoint is extended to allocate an aligned object */ static unsigned -test_mf_bug1(const char *env_h5_drvr, hid_t fapl) +test_mf_bug1(const char *driver_name, hid_t fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ hid_t copied_fapl = H5I_INVALID_HID; /* FAPL to use for this test */ @@ -6147,9 +6147,9 @@ test_mf_bug1(const char *env_h5_drvr, hid_t fapl) TEST_ERROR; /* Check for split or multi driver */ - if (!strcmp(env_h5_drvr, "split")) + if (!strcmp(driver_name, "split")) split = true; - else if (!strcmp(env_h5_drvr, "multi")) + else if (!strcmp(driver_name, "multi")) multi = true; /* Add alignment to member files for split/multi driver */ @@ -6931,7 +6931,7 @@ test_mf_fs_persist_multi(void) *------------------------------------------------------------------------- */ static unsigned -test_mf_fs_persist(const char *env_h5_drvr, hid_t fapl, bool new_format) +test_mf_fs_persist(const char *driver_name, hid_t fapl, bool new_format) { hid_t file = H5I_INVALID_HID; /* File ID */ hid_t fcpl = H5I_INVALID_HID; /* File creation property list ID */ @@ -6949,7 +6949,7 @@ test_mf_fs_persist(const char *env_h5_drvr, hid_t fapl, bool new_format) else TESTING("File's free-space is persistent with old library format"); - if (strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0) { + if (strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0) { /* File creation property list template */ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) @@ -7106,7 +7106,7 @@ test_mf_fs_persist(const char *env_h5_drvr, hid_t fapl, bool new_format) *------------------------------------------------------------------------- */ static unsigned -test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, bool new_format) +test_mf_fs_gone(const char *driver_name, hid_t fapl, bool new_format) { hid_t file = H5I_INVALID_HID; /* File ID */ hid_t fcpl = H5I_INVALID_HID; /* File creation property list */ @@ -7126,7 +7126,7 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, bool new_format) TESTING("File's free-space is going away with old library format"); /* Current VFD that does not support contiguous address space */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); if (contig_addr_vfd) { @@ -7296,7 +7296,7 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, bool new_format) *------------------------------------------------------------------------- */ static unsigned -test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, bool new_format) +test_mf_strat_thres_persist(const char *driver_name, hid_t fapl, bool new_format) { hid_t file = H5I_INVALID_HID; /* File ID */ hid_t fcpl = H5I_INVALID_HID; /* File creation property list template */ @@ -7317,7 +7317,7 @@ test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, bool new_format TESTING("File space strategy/persisting/threshold with old library format"); /* Current VFD that does not support contiguous address space */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -7465,7 +7465,7 @@ test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, bool new_format *------------------------------------------------------------------------- */ static unsigned -test_mf_strat_thres_gone(const char *env_h5_drvr, hid_t fapl, bool new_format) +test_mf_strat_thres_gone(const char *driver_name, hid_t fapl, bool new_format) { hid_t file = H5I_INVALID_HID; /* File ID */ hid_t fcpl = H5I_INVALID_HID; /* File creation property list template */ @@ -7487,7 +7487,7 @@ test_mf_strat_thres_gone(const char *env_h5_drvr, hid_t fapl, bool new_format) TESTING("File space merge/shrink for section size < threshold with old library format"); /* Current VFD that does not support contiguous address space */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -7801,7 +7801,7 @@ set_multi_split(hid_t fapl, hsize_t pagesize, bool is_multi_or_split) *------------------------------------------------------------------------- */ static unsigned -test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) +test_page_alloc_xfree(const char *driver_name, hid_t fapl) { hid_t fid = H5I_INVALID_HID; /* File ID */ @@ -7819,9 +7819,9 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) TESTING("Paged aggregation for file space: H5MF_alloc/H5MF_xfree"); /* Check for split or multi driver */ - if (!strcmp(env_h5_drvr, "split")) + if (!strcmp(driver_name, "split")) split = true; - else if (!strcmp(env_h5_drvr, "multi")) + else if (!strcmp(driver_name, "multi")) multi = true; if (!multi && !split) { @@ -8031,7 +8031,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_page_try_shrink(const char *env_h5_drvr, hid_t fapl) +test_page_try_shrink(const char *driver_name, hid_t fapl) { hid_t fid = H5I_INVALID_HID; /* File ID */ @@ -8048,7 +8048,7 @@ test_page_try_shrink(const char *env_h5_drvr, hid_t fapl) TESTING("Paged aggregation for file space: H5MF_try_shrink()"); /* Current VFD that does not support continuous address space */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); if (contig_addr_vfd) { @@ -8160,7 +8160,7 @@ test_page_try_shrink(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl) +test_page_small_try_extend(const char *driver_name, hid_t fapl) { hid_t fid = H5I_INVALID_HID; /* File ID */ @@ -8175,8 +8175,8 @@ test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl) TESTING("Paged aggregation for file space: H5MF_try_extend() a small block"); /* Current VFD that does not support continuous address space */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0 && - strcmp(env_h5_drvr, "family") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0 && + strcmp(driver_name, "family") != 0); if (contig_addr_vfd) { @@ -8338,7 +8338,7 @@ test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_page_large_try_extend(const char *env_h5_drvr, hid_t fapl) +test_page_large_try_extend(const char *driver_name, hid_t fapl) { hid_t fid = H5I_INVALID_HID; /* File ID */ @@ -8352,7 +8352,7 @@ test_page_large_try_extend(const char *env_h5_drvr, hid_t fapl) TESTING("Paged aggregation for file space: H5MF_try_extend() a large block"); /* Current VFD that does not support continuous address space */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); if (contig_addr_vfd) { @@ -8499,7 +8499,7 @@ test_page_large_try_extend(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_page_large(const char *env_h5_drvr, hid_t fapl) +test_page_large(const char *driver_name, hid_t fapl) { hid_t fid = H5I_INVALID_HID; /* File ID */ @@ -8514,7 +8514,7 @@ test_page_large(const char *env_h5_drvr, hid_t fapl) TESTING("Paged aggregation for file space: large allocations and de-allocations"); /* Current VFD that does not support continuous address space */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); if (contig_addr_vfd) { @@ -8652,7 +8652,7 @@ test_page_large(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_page_small(const char *env_h5_drvr, hid_t fapl) +test_page_small(const char *driver_name, hid_t fapl) { hid_t fid = H5I_INVALID_HID; /* File ID */ hid_t fcpl = H5I_INVALID_HID; /* File creation property list */ @@ -8666,11 +8666,11 @@ test_page_small(const char *env_h5_drvr, hid_t fapl) TESTING("Paged aggregation for file space: small allocations and de-allocations"); - if (!strcmp(env_h5_drvr, "split")) + if (!strcmp(driver_name, "split")) split = true; - else if (!strcmp(env_h5_drvr, "multi")) + else if (!strcmp(driver_name, "multi")) multi = true; - else if (!strcmp(env_h5_drvr, "family")) + else if (!strcmp(driver_name, "family")) family = true; if (!multi && !split) { @@ -8822,7 +8822,7 @@ test_page_small(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_page_alignment(const char *env_h5_drvr, hid_t fapl) +test_page_alignment(const char *driver_name, hid_t fapl) { hid_t fid = H5I_INVALID_HID; /* File ID */ @@ -8839,9 +8839,9 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl) TESTING("Paged aggregation and H5Pset_alignment: verify proper alignment is used"); /* Check for split or multi driver */ - if (!strcmp(env_h5_drvr, "split")) + if (!strcmp(driver_name, "split")) split = true; - else if (!strcmp(env_h5_drvr, "multi")) + else if (!strcmp(driver_name, "multi")) multi = true; if (!multi && !split) { @@ -9130,13 +9130,11 @@ main(void) hid_t new_fapl = H5I_INVALID_HID; /* File access property list for alignment & aggr setting */ unsigned nerrors = 0; /* Cumulative error count */ test_type_t curr_test; /* Current test being worked on */ - const char *env_h5_drvr; /* File Driver value from environment */ + const char *driver_name; /* File Driver value from environment */ bool api_ctx_pushed = false; /* Whether API context pushed */ /* Get the VFD to use */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); h5_reset(); @@ -9151,9 +9149,9 @@ main(void) if ((new_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR; /* For old library format--interaction with file allocation */ - nerrors += test_mf_eoa(env_h5_drvr, fapl); - nerrors += test_mf_eoa_shrink(env_h5_drvr, fapl); - nerrors += test_mf_eoa_extend(env_h5_drvr, fapl); + nerrors += test_mf_eoa(driver_name, fapl); + nerrors += test_mf_eoa_shrink(driver_name, fapl); + nerrors += test_mf_eoa_extend(driver_name, fapl); /* For old library format */ nerrors += test_dichotomy(new_fapl); @@ -9162,18 +9160,18 @@ main(void) nerrors += test_mf_fs_start(fapl); nerrors += test_mf_fs_alloc_free(fapl); nerrors += test_mf_fs_extend(fapl); - nerrors += test_mf_fs_absorb(env_h5_drvr, fapl); + nerrors += test_mf_fs_absorb(driver_name, fapl); /* For old library format--interaction with meta/sdata aggregator */ - nerrors += test_mf_aggr_alloc1(env_h5_drvr, fapl); - nerrors += test_mf_aggr_alloc2(env_h5_drvr, fapl); - nerrors += test_mf_aggr_alloc3(env_h5_drvr, fapl); - nerrors += test_mf_aggr_alloc4(env_h5_drvr, fapl); - nerrors += test_mf_aggr_alloc5(env_h5_drvr, fapl); - nerrors += test_mf_aggr_alloc6(env_h5_drvr, fapl); - nerrors += test_mf_aggr_alloc7(env_h5_drvr, fapl); - nerrors += test_mf_aggr_extend(env_h5_drvr, fapl); - nerrors += test_mf_aggr_absorb(env_h5_drvr, fapl); + nerrors += test_mf_aggr_alloc1(driver_name, fapl); + nerrors += test_mf_aggr_alloc2(driver_name, fapl); + nerrors += test_mf_aggr_alloc3(driver_name, fapl); + nerrors += test_mf_aggr_alloc4(driver_name, fapl); + nerrors += test_mf_aggr_alloc5(driver_name, fapl); + nerrors += test_mf_aggr_alloc6(driver_name, fapl); + nerrors += test_mf_aggr_alloc7(driver_name, fapl); + nerrors += test_mf_aggr_extend(driver_name, fapl); + nerrors += test_mf_aggr_absorb(driver_name, fapl); /* For old library format--tests for alignment */ for (curr_test = TEST_NORMAL; curr_test < TEST_NTESTS; curr_test++) { @@ -9195,43 +9193,43 @@ main(void) break; } /* end switch */ - nerrors += test_mf_align_eoa(env_h5_drvr, fapl, new_fapl); - nerrors += test_mf_align_fs(env_h5_drvr, fapl, new_fapl); - nerrors += test_mf_align_alloc1(env_h5_drvr, fapl, new_fapl); - nerrors += test_mf_align_alloc2(env_h5_drvr, fapl, new_fapl); - nerrors += test_mf_align_alloc3(env_h5_drvr, fapl, new_fapl); - nerrors += test_mf_align_alloc4(env_h5_drvr, fapl, new_fapl); - nerrors += test_mf_align_alloc5(env_h5_drvr, fapl, new_fapl); - nerrors += test_mf_align_alloc6(env_h5_drvr, fapl, new_fapl); + nerrors += test_mf_align_eoa(driver_name, fapl, new_fapl); + nerrors += test_mf_align_fs(driver_name, fapl, new_fapl); + nerrors += test_mf_align_alloc1(driver_name, fapl, new_fapl); + nerrors += test_mf_align_alloc2(driver_name, fapl, new_fapl); + nerrors += test_mf_align_alloc3(driver_name, fapl, new_fapl); + nerrors += test_mf_align_alloc4(driver_name, fapl, new_fapl); + nerrors += test_mf_align_alloc5(driver_name, fapl, new_fapl); + nerrors += test_mf_align_alloc6(driver_name, fapl, new_fapl); } /* end for */ /* For old and new format--interaction with temporary file space allocation */ - nerrors += test_mf_tmp(env_h5_drvr, fapl, false); - nerrors += test_mf_tmp(env_h5_drvr, fapl, true); + nerrors += test_mf_tmp(driver_name, fapl, false); + nerrors += test_mf_tmp(driver_name, fapl, true); /* For old and new format--free-space merge/shrunk away */ /* Temporary: modify to skip testing for multi/split driver: fail file create when persisting free-space or using paged aggregation strategy */ - nerrors += test_mf_fs_gone(env_h5_drvr, fapl, false); - nerrors += test_mf_fs_gone(env_h5_drvr, fapl, true); + nerrors += test_mf_fs_gone(driver_name, fapl, false); + nerrors += test_mf_fs_gone(driver_name, fapl, true); /* Temporary: modify to skip testing multi/split driver: fail file create when persisting free-space or using paged aggregation strategy */ - nerrors += test_mf_strat_thres_gone(env_h5_drvr, fapl, false); - nerrors += test_mf_strat_thres_gone(env_h5_drvr, fapl, true); + nerrors += test_mf_strat_thres_gone(driver_name, fapl, false); + nerrors += test_mf_strat_thres_gone(driver_name, fapl, true); /* For old and new format--persisting free-space */ /* Temporary: Modify to skip testing for multi/split driver: fail file create when persisting free-space or using paged aggregation strategy */ - nerrors += test_mf_fs_persist(env_h5_drvr, fapl, false); - nerrors += test_mf_fs_persist(env_h5_drvr, fapl, true); + nerrors += test_mf_fs_persist(driver_name, fapl, false); + nerrors += test_mf_fs_persist(driver_name, fapl, true); /* Temporary: modify to skip testing for multi/split driver: fail file create when persisting free-space or using paged aggregation strategy */ - nerrors += test_mf_strat_thres_persist(env_h5_drvr, fapl, false); - nerrors += test_mf_strat_thres_persist(env_h5_drvr, fapl, true); + nerrors += test_mf_strat_thres_persist(driver_name, fapl, false); + nerrors += test_mf_strat_thres_persist(driver_name, fapl, true); /* Temporary skipped for multi/split drivers: fail file create when persisting free-space or using paged aggregation strategy */ @@ -9246,16 +9244,16 @@ main(void) */ /* Temporary: The following 7 tests are modified to skip testing for multi/split driver: fail file create when persisting free-space or using paged aggregation strategy */ - nerrors += test_page_small(env_h5_drvr, fapl); - nerrors += test_page_large(env_h5_drvr, fapl); - nerrors += test_page_large_try_extend(env_h5_drvr, fapl); - nerrors += test_page_small_try_extend(env_h5_drvr, fapl); - nerrors += test_page_try_shrink(env_h5_drvr, fapl); - nerrors += test_page_alloc_xfree(env_h5_drvr, fapl); /* can handle multi/split */ - nerrors += test_page_alignment(env_h5_drvr, fapl); /* can handle multi/split */ + nerrors += test_page_small(driver_name, fapl); + nerrors += test_page_large(driver_name, fapl); + nerrors += test_page_large_try_extend(driver_name, fapl); + nerrors += test_page_small_try_extend(driver_name, fapl); + nerrors += test_page_try_shrink(driver_name, fapl); + nerrors += test_page_alloc_xfree(driver_name, fapl); /* can handle multi/split */ + nerrors += test_page_alignment(driver_name, fapl); /* can handle multi/split */ /* tests for specific bugs */ - nerrors += test_mf_bug1(env_h5_drvr, fapl); + nerrors += test_mf_bug1(driver_name, fapl); if (H5Pclose(new_fapl) < 0) FAIL_STACK_ERROR; diff --git a/test/objcopy.c b/test/objcopy.c index 08e7b07fbe5..9205e961c22 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -17124,13 +17124,11 @@ main(void) unsigned max_compact, min_dense; int configuration; /* Configuration of tests. */ int ExpressMode; - const char *env_h5_drvr; /* File Driver value from environment */ + const char *driver_name; /* File Driver value from environment */ bool same_file; /* Whether to run tests that only use one file */ bool driver_is_default_compatible; - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); /* Setup */ h5_reset(); @@ -17292,7 +17290,7 @@ main(void) false, "H5Ocopy(): expand external link"); /* Splitter VFD currently has external link-related bugs */ - if (strcmp(env_h5_drvr, "splitter")) { + if (strcmp(driver_name, "splitter")) { nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl, H5O_COPY_EXPAND_SOFT_LINK_FLAG | H5O_COPY_EXPAND_EXT_LINK_FLAG, false, "H5Ocopy(): expand soft and external links"); diff --git a/test/ohdr.c b/test/ohdr.c index 99b979b0777..87f88f64ac5 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -1827,7 +1827,7 @@ main(void) hid_t fapl = H5I_INVALID_HID; hid_t file = H5I_INVALID_HID; H5F_t *f = NULL; - const char *env_h5_drvr; /* File driver value from environment */ + const char *driver_name; /* File driver value from environment */ bool single_file_vfd; /* Whether VFD used stores data in a single file */ char filename[1024]; H5O_hdr_info_t hdr_info; /* Object info */ @@ -1839,12 +1839,10 @@ main(void) herr_t ret; /* Generic return value */ /* Get the VFD to use */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); /* Check for VFD which stores data in multiple files */ - single_file_vfd = !h5_driver_uses_multiple_files(env_h5_drvr, 0); + single_file_vfd = !h5_driver_uses_multiple_files(driver_name, 0); /* Reset library */ h5_reset(); @@ -2132,7 +2130,7 @@ main(void) if (h5_verify_cached_stabs(FILENAME, fapl) < 0) TEST_ERROR; - if (H5FD__supports_swmr_test(env_h5_drvr)) { + if (H5FD__supports_swmr_test(driver_name)) { /* A test to exercise the re-read of the object header for SWMR access */ if (test_ohdr_swmr(true) < 0) TEST_ERROR; diff --git a/test/onion.c b/test/onion.c index 5b9bb929dc6..1632c410b83 100644 --- a/test/onion.c +++ b/test/onion.c @@ -4908,8 +4908,8 @@ test_integration_create_by_name(void) int main(void) { - const char *env_h5_drvr = NULL; /* VFD value from environment */ - int nerrors = 0; + const char *driver_name; /* VFD value from environment */ + int nerrors = 0; printf("Testing Onion VFD functionality.\n"); @@ -4918,10 +4918,8 @@ main(void) /* The onion VFD only supports the sec2 VFD under the hood, so skip this * test when the environment variable has been set to something else */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; - if ((0 != strcmp(env_h5_drvr, "nomatch")) && (0 != strcmp(env_h5_drvr, "sec2"))) { + driver_name = h5_get_test_driver_name(); + if (0 != strcmp(driver_name, "sec2")) { SKIPPED(); puts("Onion VFD test skipped due to non-sec2 default VFD"); exit(EXIT_SUCCESS); diff --git a/test/page_buffer.c b/test/page_buffer.c index 651e84a348c..8c977fedf44 100644 --- a/test/page_buffer.c +++ b/test/page_buffer.c @@ -39,17 +39,17 @@ /* test routines */ #ifdef H5_HAVE_PARALLEL -static unsigned verify_page_buffering_disabled(hid_t orig_fapl, const char *env_h5_drvr); +static unsigned verify_page_buffering_disabled(hid_t orig_fapl, const char *driver_name); #else #define NUM_DSETS 5 #define NX 100 #define NY 50 -static unsigned test_args(hid_t fapl, const char *env_h5_drvr); -static unsigned test_raw_data_handling(hid_t orig_fapl, const char *env_h5_drvr); -static unsigned test_lru_processing(hid_t orig_fapl, const char *env_h5_drvr); -static unsigned test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr); -static unsigned test_stats_collection(hid_t orig_fapl, const char *env_h5_drvr); +static unsigned test_args(hid_t fapl, const char *driver_name); +static unsigned test_raw_data_handling(hid_t orig_fapl, const char *driver_name); +static unsigned test_lru_processing(hid_t orig_fapl, const char *driver_name); +static unsigned test_min_threshold(hid_t orig_fapl, const char *driver_name); +static unsigned test_stats_collection(hid_t orig_fapl, const char *driver_name); /* helper routines */ static unsigned create_file(char *filename, hid_t fcpl, hid_t fapl); @@ -299,7 +299,7 @@ open_file(char *filename, hid_t fapl, hsize_t page_size, size_t page_buffer_size * */ static unsigned -set_multi_split(const char *env_h5_drvr, hid_t fapl, hsize_t pagesize) +set_multi_split(const char *driver_name, hid_t fapl, hsize_t pagesize) { bool split = false; bool multi = false; @@ -311,9 +311,9 @@ set_multi_split(const char *env_h5_drvr, hid_t fapl, hsize_t pagesize) H5FD_mem_t mt; /* Check for split or multi driver */ - if (!strcmp(env_h5_drvr, "split")) + if (!strcmp(driver_name, "split")) split = true; - else if (!strcmp(env_h5_drvr, "multi")) + else if (!strcmp(driver_name, "multi")) multi = true; if (split || multi) { @@ -374,7 +374,7 @@ set_multi_split(const char *env_h5_drvr, hid_t fapl, hsize_t pagesize) *------------------------------------------------------------------------- */ static unsigned -test_args(hid_t orig_fapl, const char *env_h5_drvr) +test_args(hid_t orig_fapl, const char *driver_name) { char filename[FILENAME_LEN]; /* Filename to use */ hid_t file_id = H5I_INVALID_HID; /* File ID */ @@ -440,7 +440,7 @@ test_args(hid_t orig_fapl, const char *env_h5_drvr) if (ret >= 0) TEST_ERROR; - if (set_multi_split(env_h5_drvr, fapl, 512) != 0) + if (set_multi_split(driver_name, fapl, 512) != 0) TEST_ERROR; /* Test setting a page buffer with a size equal to a single page size */ @@ -477,7 +477,7 @@ test_args(hid_t orig_fapl, const char *env_h5_drvr) if (open_file(filename, fapl, 512, 512) != 0) TEST_ERROR; - if (set_multi_split(env_h5_drvr, fapl, 4194304) != 0) + if (set_multi_split(driver_name, fapl, 4194304) != 0) TEST_ERROR; /* Test setting a large page buffer size and page size */ @@ -496,7 +496,7 @@ test_args(hid_t orig_fapl, const char *env_h5_drvr) if (open_file(filename, fapl, 4194304, 16777216) != 0) TEST_ERROR; - if (set_multi_split(env_h5_drvr, fapl, 1) != 0) + if (set_multi_split(driver_name, fapl, 1) != 0) TEST_ERROR; /* Test setting a 512 byte page buffer size and page size */ @@ -545,7 +545,7 @@ test_args(hid_t orig_fapl, const char *env_h5_drvr) *------------------------------------------------------------------------- */ static unsigned -test_raw_data_handling(hid_t orig_fapl, const char *env_h5_drvr) +test_raw_data_handling(hid_t orig_fapl, const char *driver_name) { char filename[FILENAME_LEN]; /* Filename to use */ hid_t file_id = H5I_INVALID_HID; /* File ID */ @@ -565,7 +565,7 @@ test_raw_data_handling(hid_t orig_fapl, const char *env_h5_drvr) if ((fapl = H5Pcopy(orig_fapl)) < 0) TEST_ERROR; - if (set_multi_split(env_h5_drvr, fapl, sizeof(int) * 200) != 0) + if (set_multi_split(driver_name, fapl, sizeof(int) * 200) != 0) TEST_ERROR; if ((data = (int *)calloc((size_t)num_elements, sizeof(int))) == NULL) @@ -808,7 +808,7 @@ test_raw_data_handling(hid_t orig_fapl, const char *env_h5_drvr) */ static unsigned -test_lru_processing(hid_t orig_fapl, const char *env_h5_drvr) +test_lru_processing(hid_t orig_fapl, const char *driver_name) { char filename[FILENAME_LEN]; /* Filename to use */ hid_t file_id = H5I_INVALID_HID; /* File ID */ @@ -830,7 +830,7 @@ test_lru_processing(hid_t orig_fapl, const char *env_h5_drvr) if ((fapl = H5Pcopy(orig_fapl)) < 0) FAIL_STACK_ERROR; - if (set_multi_split(env_h5_drvr, fapl, sizeof(int) * 200) != 0) + if (set_multi_split(driver_name, fapl, sizeof(int) * 200) != 0) TEST_ERROR; if ((data = (int *)calloc((size_t)num_elements, sizeof(int))) == NULL) @@ -1047,7 +1047,7 @@ test_lru_processing(hid_t orig_fapl, const char *env_h5_drvr) */ static unsigned -test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr) +test_min_threshold(hid_t orig_fapl, const char *driver_name) { char filename[FILENAME_LEN]; /* Filename to use */ hid_t file_id = H5I_INVALID_HID; /* File ID */ @@ -1071,7 +1071,7 @@ test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr) if ((fapl = H5Pcopy(orig_fapl)) < 0) TEST_ERROR; - if (set_multi_split(env_h5_drvr, fapl, sizeof(int) * 200) != 0) + if (set_multi_split(driver_name, fapl, sizeof(int) * 200) != 0) TEST_ERROR; if ((data = (int *)calloc((size_t)num_elements, sizeof(int))) == NULL) @@ -1665,7 +1665,7 @@ test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr) *------------------------------------------------------------------------- */ static unsigned -test_stats_collection(hid_t orig_fapl, const char *env_h5_drvr) +test_stats_collection(hid_t orig_fapl, const char *driver_name) { char filename[FILENAME_LEN]; /* Filename to use */ hid_t file_id = H5I_INVALID_HID; /* File ID */ @@ -1687,7 +1687,7 @@ test_stats_collection(hid_t orig_fapl, const char *env_h5_drvr) if ((fapl = H5Pcopy(orig_fapl)) < 0) TEST_ERROR; - if (set_multi_split(env_h5_drvr, fapl, sizeof(int) * 200) != 0) + if (set_multi_split(driver_name, fapl, sizeof(int) * 200) != 0) TEST_ERROR; if ((data = (int *)calloc((size_t)num_elements, sizeof(int))) == NULL) @@ -1954,7 +1954,7 @@ test_stats_collection(hid_t orig_fapl, const char *env_h5_drvr) #ifdef H5_HAVE_PARALLEL static unsigned -verify_page_buffering_disabled(hid_t orig_fapl, const char *env_h5_drvr) +verify_page_buffering_disabled(hid_t orig_fapl, const char *driver_name) { char filename[FILENAME_LEN]; /* Filename to use */ hid_t file_id = H5I_INVALID_HID; /* File ID */ @@ -1969,7 +1969,7 @@ verify_page_buffering_disabled(hid_t orig_fapl, const char *env_h5_drvr) if ((fapl = H5Pcopy(orig_fapl)) < 0) TEST_ERROR; - if (set_multi_split(env_h5_drvr, fapl, 4096) != 0) + if (set_multi_split(driver_name, fapl, 4096) != 0) TEST_ERROR; if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) @@ -2066,21 +2066,19 @@ main(void) { hid_t fapl = H5I_INVALID_HID; /* File access property list for data files */ unsigned nerrors = 0; /* Cumulative error count */ - const char *env_h5_drvr = NULL; /* File Driver value from environment */ + const char *driver_name = NULL; /* File Driver value from environment */ bool api_ctx_pushed = false; /* Whether API context pushed */ h5_reset(); /* Get the VFD to use */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); /* Temporary skip testing with multi/split drivers: * Page buffering depends on paged aggregation which is * currently disabled for multi/split drivers. */ - if ((0 == strcmp(env_h5_drvr, "multi")) || (0 == strcmp(env_h5_drvr, "split"))) { + if ((0 == strcmp(driver_name, "multi")) || (0 == strcmp(driver_name, "split"))) { SKIPPED(); puts("Skip page buffering test because paged aggregation is disabled for multi/split drivers"); @@ -2100,15 +2098,15 @@ main(void) #ifdef H5_HAVE_PARALLEL puts("Page Buffering is disabled for parallel."); - nerrors += verify_page_buffering_disabled(fapl, env_h5_drvr); + nerrors += verify_page_buffering_disabled(fapl, driver_name); #else /* H5_HAVE_PARALLEL */ - nerrors += test_args(fapl, env_h5_drvr); - nerrors += test_raw_data_handling(fapl, env_h5_drvr); - nerrors += test_lru_processing(fapl, env_h5_drvr); - nerrors += test_min_threshold(fapl, env_h5_drvr); - nerrors += test_stats_collection(fapl, env_h5_drvr); + nerrors += test_args(fapl, driver_name); + nerrors += test_raw_data_handling(fapl, driver_name); + nerrors += test_lru_processing(fapl, driver_name); + nerrors += test_min_threshold(fapl, driver_name); + nerrors += test_stats_collection(fapl, driver_name); #endif /* H5_HAVE_PARALLEL */ diff --git a/test/reserved.c b/test/reserved.c index 5540d044b62..3762bd9deb4 100644 --- a/test/reserved.c +++ b/test/reserved.c @@ -462,16 +462,15 @@ main(void) * (Also, we should try to make this test work with all the VFDs) */ #ifdef BROKEN + const char *driver_name; int num_errs = 0; hid_t fapl; - const char *envval = NULL; - envval = getenv(HDF5_DRIVER); - if (envval == NULL) - envval = "nomatch"; + driver_name = h5_get_test_driver_name(); + /* QAK: should be able to use the core driver? */ - if (strcmp(envval, "core") && strcmp(envval, "split") && strcmp(envval, "multi") && - strcmp(envval, "family")) { + if (strcmp(driver_name, "core") && strcmp(driver_name, "split") && strcmp(driver_name, "multi") && + strcmp(driver_name, "family")) { num_errs += rsrv_ohdr(); num_errs += rsrv_heap(); num_errs += rsrv_vlen(); diff --git a/test/select_io_dset.c b/test/select_io_dset.c index 1ff7fe22f9e..2f440d8eec0 100644 --- a/test/select_io_dset.c +++ b/test/select_io_dset.c @@ -2934,12 +2934,11 @@ test_no_selection_io_cause_mode(const char *filename, hid_t fapl, uint32_t test_ /* Check for (currently) incompatible combinations */ if (test_mode & TEST_PAGE_BUFFER) { - char *env_h5_drvr = NULL; + const char *driver_name = h5_get_test_driver_name(); /* The split and multi driver are not compatible with page buffering. No message since the other * cases aren't skipped. */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr && (!strcmp(env_h5_drvr, "split") || !strcmp(env_h5_drvr, "multi"))) + if (driver_name && (!strcmp(driver_name, "split") || !strcmp(driver_name, "multi"))) return 0; } @@ -3389,9 +3388,19 @@ main(void) h5_cleanup(FILENAME, fapl); + H5Pclose(fapl2); + exit(EXIT_SUCCESS); error: + H5E_BEGIN_TRY + { + H5Pclose(fapl); + H5Pclose(fapl2); + H5Fclose(fid); + } + H5E_END_TRY + nerrors = MAX(1, nerrors); printf("***** %d SELECTION I/O DATASET TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); exit(EXIT_FAILURE); diff --git a/test/set_extent.c b/test/set_extent.c index 6e2b7c5d1bd..018421df45f 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -110,14 +110,13 @@ main(void) unsigned new_format; /* Whether to use the latest file format */ unsigned chunk_cache; /* Whether to enable chunk caching */ int nerrors = 0; - const char *env_h5_drvr; /* File Driver value from environment */ + const char *driver_name; /* File Driver value from environment */ bool contig_addr_vfd; /* Whether VFD used has a contiguous address space */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); + /* Current VFD that does not support contiguous address space */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); /* Initialize random number seed */ HDsrandom((unsigned)HDtime(NULL)); diff --git a/test/stab.c b/test/stab.c index 1b7da018822..357f7682712 100644 --- a/test/stab.c +++ b/test/stab.c @@ -1375,18 +1375,16 @@ main(void) hid_t fapl, fapl2; /* File access property list IDs */ hid_t fcpl, fcpl2; /* File creation property list ID */ unsigned new_format; /* Whether to use the new format or not */ - const char *env_h5_drvr; /* File Driver value from environment */ + const char *driver_name; /* File Driver value from environment */ bool contig_addr_vfd; /* Whether VFD used has a contiguous address space */ bool driver_is_default_compatible; int nerrors = 0; /* Get the VFD to use */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); /* VFD that does not support contiguous address space */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); /* Reset library */ h5_reset(); @@ -1433,8 +1431,8 @@ main(void) nerrors += test_large(my_fcpl, my_fapl, new_format); } /* end for */ - /* New format group specific tests (require new format features) */ if (contig_addr_vfd) { + /* New format group specific tests (require new format features) */ nerrors += lifecycle(fcpl2, fapl2); nerrors += long_compact(fcpl2, fapl2); @@ -1444,10 +1442,10 @@ main(void) nerrors += no_compact(fcpl2, fapl2); nerrors += gcpl_on_root(fapl2); - } - /* Old group API specific tests */ - nerrors += old_api(fapl); + /* Old group API specific tests */ + nerrors += old_api(fapl); + } if (driver_is_default_compatible) { nerrors += corrupt_stab_msg(); diff --git a/test/swmr.c b/test/swmr.c index aacf498b22e..94c98737c59 100644 --- a/test/swmr.c +++ b/test/swmr.c @@ -7729,12 +7729,12 @@ test_multiple_same(hid_t in_fapl, bool new_format) int main(void) { - int nerrors = 0; /* The # of errors */ - hid_t fapl = H5I_INVALID_HID; /* File access property list ID */ - char *driver = NULL; /* VFD string (from env variable) */ - char *lock_env_var = NULL; /* file locking env var pointer */ - bool use_file_locking; /* read from env var */ - bool file_locking_enabled = false; /* Checks if the file system supports locks */ + const char *driver_name = NULL; /* VFD string (from env variable) */ + int nerrors = 0; /* The # of errors */ + hid_t fapl = H5I_INVALID_HID; /* File access property list ID */ + char *lock_env_var = NULL; /* file locking env var pointer */ + bool use_file_locking; /* read from env var */ + bool file_locking_enabled = false; /* Checks if the file system supports locks */ /* Testing setup */ h5_reset(); @@ -7742,8 +7742,8 @@ main(void) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - driver = getenv(HDF5_DRIVER); - if (!H5FD__supports_swmr_test(driver)) { + driver_name = h5_get_test_driver_name(); + if (!H5FD__supports_swmr_test(driver_name)) { printf("This VFD does not support SWMR I/O\n"); return EXIT_SUCCESS; } @@ -7828,7 +7828,7 @@ main(void) /* Tests SWMR VFD compatibility flag. * Only needs to run when the VFD is the default (sec2). */ - if (NULL == driver || !strcmp(driver, "") || !strcmp(driver, "sec2")) + if (NULL == driver_name || !strcmp(driver_name, "") || !strcmp(driver_name, H5_DEFAULT_VFD_NAME)) nerrors += test_swmr_vfd_flag(); /* Test multiple opens via different locking flags */ diff --git a/test/tarray.c b/test/tarray.c index 09f300dc311..0f9e3e44faa 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -1935,6 +1935,14 @@ test_compat(void) * the tarrold.h5 file. */ + /* Check if VFD used is native file format compatible */ + CHECK(h5_driver_is_default_vfd_compatible(H5P_DEFAULT, &driver_is_default_compatible), FAIL, + "h5_driver_is_default_vfd_compatible"); + if (!driver_is_default_compatible) { + MESSAGE(5, (" -- SKIPPED --\n")); + return; + } + /* Open the testfile */ fid1 = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK_I(fid1, "H5Fopen"); @@ -1946,14 +1954,6 @@ test_compat(void) MESSAGE(5, (" -- SKIPPED --\n")); return; } - /* Check if VFD used is native file format compatible */ - CHECK(h5_driver_is_default_vfd_compatible(H5P_DEFAULT, &driver_is_default_compatible), FAIL, - "h5_driver_is_default_vfd_compatible"); - if (!driver_is_default_compatible) { - CHECK(H5Fclose(fid1), FAIL, "H5Fclose"); - MESSAGE(5, (" -- SKIPPED --\n")); - return; - } /* Only try to proceed if the file is around */ if (fid1 >= 0) { diff --git a/test/test_flush_refresh.sh.in b/test/test_flush_refresh.sh.in index ff24913d0ac..14cdfbba6eb 100644 --- a/test/test_flush_refresh.sh.in +++ b/test/test_flush_refresh.sh.in @@ -58,14 +58,14 @@ srcdir=@srcdir@ utils_testdir=@abs_top_builddir@/@H5_UTILS_TEST_BUILDDIR@ testdir=@abs_top_builddir@/@H5_TEST_BUILDDIR@ -# Check to see if the VFD specified by the HDF5_DRIVER environment variable -# supports SWMR. +# Check to see if the VFD specified by the HDF5_DRIVER or HDF5_TEST_DRIVER +# environment variable supports SWMR. $utils_testdir/swmr_check_compat_vfd rc=$? if [ $rc -ne 0 ] ; then echo - echo "The VFD specified by the HDF5_DRIVER environment variable" - echo "does not support SWMR." + echo "The VFD specified by the HDF5_DRIVER or HDF5_TEST_DRIVER" + echo "environment variable does not support SWMR." echo echo "flush/refresh tests skipped" echo diff --git a/test/test_plugin.sh.in b/test/test_plugin.sh.in index 1d04760fb3a..d96aba4e331 100644 --- a/test/test_plugin.sh.in +++ b/test/test_plugin.sh.in @@ -18,7 +18,7 @@ TOP_BUILDDIR=@top_builddir@ EXIT_SUCCESS=0 EXIT_FAILURE=1 -CP="cp -p" # Use -p to preserve mode,ownership, timestamps +CP="cp -rp" # Use -p to preserve mode,ownership, timestamps RM="rm -rf" nerrors=0 diff --git a/test/test_swmr.pwsh.in b/test/test_swmr.pwsh.in index 8f09740c2c5..becebb3d454 100644 --- a/test/test_swmr.pwsh.in +++ b/test/test_swmr.pwsh.in @@ -87,14 +87,14 @@ function Wait-Message { ## ############################################################################### -# Check to see if the VFD specified by the HDF5_DRIVER environment variable -# supports SWMR. +# Check to see if the VFD specified by the HDF5_DRIVER or HDF5_TEST_DRIVER +# environment variable supports SWMR. $testprog = Join-Path -Path $utils_testdir -ChildPath swmr_check_compat_vfd.exe $rp = Start-Process -FilePath $testprog -PassThru -Wait -NoNewWindow if ($rp.ExitCode -ne 0) { Write-Output "" - Write-Output "The VFD specified by the HDF5_DRIVER environment variable" - Write-Output "does not support SWMR." + Write-Output "The VFD specified by the HDF5_DRIVER or HDF5_TEST_DRIVER" + Write-Output "environment variable does not support SWMR." Write-Output "" Write-Output "SWMR acceptance tests skipped" Write-Output "" diff --git a/test/test_swmr.sh.in b/test/test_swmr.sh.in index e4c75466b40..38a32041538 100644 --- a/test/test_swmr.sh.in +++ b/test/test_swmr.sh.in @@ -85,14 +85,14 @@ WAIT_MESSAGE() { ## ############################################################################### -# Check to see if the VFD specified by the HDF5_DRIVER environment variable -# supports SWMR. +# Check to see if the VFD specified by the HDF5_DRIVER or HDF5_TEST_DRIVER +# environment variable supports SWMR. $utils_testdir/swmr_check_compat_vfd rc=$? if [ $rc -ne 0 ] ; then echo - echo "The VFD specified by the HDF5_DRIVER environment variable" - echo "does not support SWMR." + echo "The VFD specified by the HDF5_DRIVER or HDF5_TEST_DRIVER" + echo "environment variable does not support SWMR." echo echo "SWMR acceptance tests skipped" echo diff --git a/test/test_use_cases.sh.in b/test/test_use_cases.sh.in index f1d7ec587f4..2b327f8b5fe 100644 --- a/test/test_use_cases.sh.in +++ b/test/test_use_cases.sh.in @@ -34,14 +34,14 @@ srcdir=@srcdir@ utils_testdir=@abs_top_builddir@/@H5_UTILS_TEST_BUILDDIR@ testdir=@abs_top_builddir@/@H5_TEST_BUILDDIR@ -# Check to see if the VFD specified by the HDF5_DRIVER environment variable -# supports SWMR. +# Check to see if the VFD specified by the HDF5_DRIVER or HDF5_TEST_DRIVER +# environment variable supports SWMR. $utils_testdir/swmr_check_compat_vfd rc=$? if [[ $rc != 0 ]] ; then echo - echo "The VFD specified by the HDF5_DRIVER environment variable" - echo "does not support SWMR" + echo "The VFD specified by the HDF5_DRIVER or HDF5_TEST_DRIVER" + echo "environment variable does not support SWMR." echo echo "SWMR use case tests skipped" echo diff --git a/test/test_vds_swmr.pwsh.in b/test/test_vds_swmr.pwsh.in index bf5aabbd14a..97761935599 100644 --- a/test/test_vds_swmr.pwsh.in +++ b/test/test_vds_swmr.pwsh.in @@ -80,14 +80,14 @@ function Wait-Message { ## Main ############################################################################### -# Check to see if the VFD specified by the HDF5_DRIVER environment variable -# supports SWMR. +# Check to see if the VFD specified by the HDF5_DRIVER or HDF5_TEST_DRIVER +# environment variable supports SWMR. $testprog = Join-Path -Path $utils_testdir -ChildPath swmr_check_compat_vfd.exe $rp = Start-Process -FilePath $testprog -PassThru -Wait -NoNewWindow if ($rp.ExitCode -ne 0) { Write-Output "" - Write-Output "The VFD specified by the HDF5_DRIVER environment variable" - Write-Output "does not support SWMR." + Write-Output "The VFD specified by the HDF5_DRIVER or HDF5_TEST_DRIVER" + Write-Output "environment variable does not support SWMR." Write-Output "" Write-Output "SWMR acceptance tests skipped" Write-Output "" diff --git a/test/test_vds_swmr.sh.in b/test/test_vds_swmr.sh.in index 8eae3edceb8..f5a9043bf06 100644 --- a/test/test_vds_swmr.sh.in +++ b/test/test_vds_swmr.sh.in @@ -77,14 +77,14 @@ WAIT_MESSAGE() { ## Main ############################################################################### -# Check to see if the VFD specified by the HDF5_DRIVER environment variable -# supports SWMR. +# Check to see if the VFD specified by the HDF5_DRIVER or HDF5_TEST_DRIVER +# environment variable supports SWMR. $utils_testdir/swmr_check_compat_vfd rc=$? if [ $rc -ne 0 ] ; then echo - echo "The VFD specified by the HDF5_DRIVER environment variable" - echo "does not support SWMR." + echo "The VFD specified by the HDF5_DRIVER or HDF5_TEST_DRIVER" + echo "environment variable does not support SWMR." echo echo "SWMR acceptance tests skipped" echo diff --git a/test/tfile.c b/test/tfile.c index 98d8a0dee12..028de9a3e94 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -185,8 +185,8 @@ static const char *FILESPACE_NAME[] = {"tfilespace", NULL}; #define DSET_DS1 "DS1" /* Local test function declarations for version bounds */ -static void test_libver_bounds_low_high(const char *env_h5_drvr); -static void test_libver_bounds_super(hid_t fapl, const char *env_h5_drvr); +static void test_libver_bounds_low_high(const char *driver_name); +static void test_libver_bounds_super(hid_t fapl, const char *driver_name); static void test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non_def_fsm); static void test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non_def_fsm); static void test_libver_bounds_obj(hid_t fapl); @@ -533,7 +533,7 @@ test_file_create(void) ** ****************************************************************/ static void -test_file_open(const char *env_h5_drvr) +test_file_open(const char *driver_name) { hid_t fid1, fid2; /*HDF5 File IDs */ hid_t did; /*dataset ID */ @@ -553,7 +553,7 @@ test_file_open(const char *env_h5_drvr) */ /* Only run this test with sec2/default driver */ - if (!h5_using_default_driver(env_h5_drvr)) + if (!h5_using_default_driver(driver_name)) return; /* Output message about test being performed */ @@ -1747,7 +1747,7 @@ test_file_perm2(void) #define FILE_IS_ACCESSIBLE "tfile_is_accessible" #define FILE_IS_ACCESSIBLE_NON_HDF5 "tfile_is_accessible_non_hdf5" static void -test_file_is_accessible(const char *env_h5_drvr) +test_file_is_accessible(const char *driver_name) { hid_t fid = H5I_INVALID_HID; /* File opened with read-write permission */ hid_t fcpl_id = H5I_INVALID_HID; /* File creation property list */ @@ -1832,7 +1832,7 @@ test_file_is_accessible(const char *env_h5_drvr) /* This test is not currently working for the family VFD. * There are failures when creating files with userblocks. */ - if (0 != strcmp(env_h5_drvr, "family")) { + if (0 != strcmp(driver_name, "family")) { /* Create a file creation property list with a non-default user block size */ fcpl_id = H5Pcreate(H5P_FILE_CREATE); CHECK(fcpl_id, H5I_INVALID_HID, "H5Pcreate"); @@ -1918,7 +1918,7 @@ test_file_is_accessible(const char *env_h5_drvr) *****************************************************************/ #ifndef H5_NO_DEPRECATED_SYMBOLS static void -test_file_ishdf5(const char *env_h5_drvr) +test_file_ishdf5(const char *driver_name) { hid_t fid = H5I_INVALID_HID; /* File opened with read-write permission */ hid_t fcpl_id = H5I_INVALID_HID; /* File creation property list */ @@ -1934,7 +1934,7 @@ test_file_ishdf5(const char *env_h5_drvr) bool vol_is_native; herr_t ret; /* Return value from HDF5 calls */ - if (!h5_using_default_driver(env_h5_drvr)) + if (!h5_using_default_driver(driver_name)) return; /* Output message about test being performed */ @@ -3055,7 +3055,7 @@ test_file_double_datatype_open(void) ** *****************************************************************/ static void -test_userblock_file_size(const char *env_h5_drvr) +test_userblock_file_size(const char *driver_name) { hid_t file1_id, file2_id; hid_t group1_id, group2_id; @@ -3069,8 +3069,8 @@ test_userblock_file_size(const char *env_h5_drvr) herr_t ret; /* Generic return value */ /* Don't run with multi/split, family or direct drivers */ - if (!strcmp(env_h5_drvr, "multi") || !strcmp(env_h5_drvr, "split") || !strcmp(env_h5_drvr, "family") || - !strcmp(env_h5_drvr, "direct")) + if (!strcmp(driver_name, "multi") || !strcmp(driver_name, "split") || !strcmp(driver_name, "family") || + !strcmp(driver_name, "direct")) return; /* Output message about test being performed */ @@ -3262,6 +3262,7 @@ cal_chksum(const char *file, uint32_t *chksum) CHECK(fdes, FAIL, "HDopen"); /* Retrieve the file's size */ + memset(&sb, 0, sizeof(h5_stat_t)); ret = HDfstat(fdes, &sb); CHECK(fdes, FAIL, "HDfstat"); @@ -3494,7 +3495,7 @@ test_userblock_alignment_helper2(hid_t fapl, bool open_rw) ** *****************************************************************/ static void -test_userblock_alignment(const char *env_h5_drvr) +test_userblock_alignment(const char *driver_name) { hid_t fid; /* File ID */ hid_t fcpl; /* File creation property list ID */ @@ -3502,7 +3503,7 @@ test_userblock_alignment(const char *env_h5_drvr) herr_t ret; /* Generic return value */ /* Only run with sec2 driver */ - if (!h5_using_default_driver(env_h5_drvr)) + if (!h5_using_default_driver(driver_name)) return; /* Output message about test being performed */ @@ -3714,7 +3715,7 @@ test_userblock_alignment(const char *env_h5_drvr) ** *****************************************************************/ static void -test_userblock_alignment_paged(const char *env_h5_drvr) +test_userblock_alignment_paged(const char *driver_name) { hid_t fid; /* File ID */ hid_t fcpl; /* File creation property list ID */ @@ -3722,7 +3723,7 @@ test_userblock_alignment_paged(const char *env_h5_drvr) herr_t ret; /* Generic return value */ /* Only run with sec2 driver */ - if (!h5_using_default_driver(env_h5_drvr)) + if (!h5_using_default_driver(driver_name)) return; /* Output message about test being performed */ @@ -4138,7 +4139,7 @@ test_userblock_alignment_paged(const char *env_h5_drvr) ** ****************************************************************/ static void -test_filespace_info(const char *env_h5_drvr) +test_filespace_info(const char *driver_name) { hid_t fid; /* File IDs */ hid_t fapl, new_fapl; /* File access property lists */ @@ -4160,7 +4161,7 @@ test_filespace_info(const char *env_h5_drvr) MESSAGE(5, ("Testing file creation public routines: H5Pget/set_file_space_strategy & " "H5Pget/set_file_space_page_size\n")); - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); fapl = h5_fileaccess(); h5_fixname(FILESPACE_NAME[0], fapl, filename, sizeof filename); @@ -4555,7 +4556,7 @@ set_multi_split(hid_t fapl, hsize_t pagesize, bool split) ** *****************************************************************/ static void -test_file_freespace(const char *env_h5_drvr) +test_file_freespace(const char *driver_name) { hid_t file; /* File opened with read-write permission */ h5_stat_size_t empty_filesize; /* Size of file when empty */ @@ -4577,8 +4578,8 @@ test_file_freespace(const char *env_h5_drvr) bool vol_is_native; herr_t ret; /* Return value */ - split_vfd = !strcmp(env_h5_drvr, "split"); - multi_vfd = !strcmp(env_h5_drvr, "multi"); + split_vfd = !strcmp(driver_name, "split"); + multi_vfd = !strcmp(driver_name, "multi"); if (split_vfd || multi_vfd) return; @@ -4730,7 +4731,7 @@ test_file_freespace(const char *env_h5_drvr) ** *****************************************************************/ static void -test_sects_freespace(const char *env_h5_drvr, bool new_format) +test_sects_freespace(const char *driver_name, bool new_format) { char filename[FILENAME_LEN]; /* Filename to use */ hid_t file; /* File ID */ @@ -4761,8 +4762,8 @@ test_sects_freespace(const char *env_h5_drvr, bool new_format) /* Output message about test being performed */ MESSAGE(5, ("Testing H5Fget_free_sections()--free-space section info in the file\n")); - split_vfd = !strcmp(env_h5_drvr, "split"); - multi_vfd = !strcmp(env_h5_drvr, "multi"); + split_vfd = !strcmp(driver_name, "split"); + multi_vfd = !strcmp(driver_name, "multi"); if (split_vfd || multi_vfd) { MESSAGE(5, (" -- SKIPPED --\n")); @@ -5899,7 +5900,7 @@ test_libver_bounds(void) ** **************************************************************************************/ static void -test_libver_bounds_low_high(const char *env_h5_drvr) +test_libver_bounds_low_high(const char *driver_name) { hid_t fapl = H5I_INVALID_HID; /* File access property list */ H5F_libver_t low, high; /* Low and high bounds */ @@ -5947,7 +5948,7 @@ test_libver_bounds_low_high(const char *env_h5_drvr) VERIFY(ret, SUCCEED, "H5Pset_libver_bounds"); /* Tests to verify version bounds */ - test_libver_bounds_super(fapl, env_h5_drvr); + test_libver_bounds_super(fapl, driver_name); test_libver_bounds_obj(fapl); test_libver_bounds_dataset(fapl); test_libver_bounds_dataspace(fapl); @@ -5980,7 +5981,7 @@ test_libver_bounds_low_high(const char *env_h5_drvr) ** *************************************************************************/ static void -test_libver_bounds_super(hid_t fapl, const char *env_h5_drvr) +test_libver_bounds_super(hid_t fapl, const char *driver_name) { hid_t fcpl = H5I_INVALID_HID; /* File creation property list */ herr_t ret; /* The return value */ @@ -5992,13 +5993,13 @@ test_libver_bounds_super(hid_t fapl, const char *env_h5_drvr) /* Verify superblock version when creating a file with input fapl, fcpl #A and with/without SWMR access */ - if (H5FD__supports_swmr_test(env_h5_drvr)) + if (H5FD__supports_swmr_test(driver_name)) test_libver_bounds_super_create(fapl, fcpl, true, false); test_libver_bounds_super_create(fapl, fcpl, false, false); /* Verify superblock version when opening a file which is created with input fapl, fcpl #A and with/without SWMR access */ - if (H5FD__supports_swmr_test(env_h5_drvr)) + if (H5FD__supports_swmr_test(driver_name)) test_libver_bounds_super_open(fapl, fcpl, true, false); test_libver_bounds_super_open(fapl, fcpl, false, false); @@ -6015,13 +6016,13 @@ test_libver_bounds_super(hid_t fapl, const char *env_h5_drvr) /* Verify superblock version when creating a file with input fapl, fcpl #B and with/without SWMR access */ - if (H5FD__supports_swmr_test(env_h5_drvr)) + if (H5FD__supports_swmr_test(driver_name)) test_libver_bounds_super_create(fapl, fcpl, true, false); test_libver_bounds_super_create(fapl, fcpl, false, false); /* Verify superblock version when opening a file which is created with input fapl, fcpl #B and with/without SWMR access */ - if (H5FD__supports_swmr_test(env_h5_drvr)) + if (H5FD__supports_swmr_test(driver_name)) test_libver_bounds_super_open(fapl, fcpl, true, false); test_libver_bounds_super_open(fapl, fcpl, false, false); @@ -6040,13 +6041,13 @@ test_libver_bounds_super(hid_t fapl, const char *env_h5_drvr) /* Verify superblock version when creating a file with input fapl, fcpl #C and with/without SWMR access */ - if (H5FD__supports_swmr_test(env_h5_drvr)) + if (H5FD__supports_swmr_test(driver_name)) test_libver_bounds_super_create(fapl, fcpl, true, false); test_libver_bounds_super_create(fapl, fcpl, false, false); /* Verify superblock version when opening a file which is created with input fapl, fcpl #C and with/without SWMR access */ - if (H5FD__supports_swmr_test(env_h5_drvr)) + if (H5FD__supports_swmr_test(driver_name)) test_libver_bounds_super_open(fapl, fcpl, true, false); test_libver_bounds_super_open(fapl, fcpl, false, false); @@ -6054,7 +6055,7 @@ test_libver_bounds_super(hid_t fapl, const char *env_h5_drvr) ret = H5Pclose(fcpl); CHECK(ret, FAIL, "H5Pclose"); - if (h5_using_default_driver(env_h5_drvr)) { + if (h5_using_default_driver(driver_name)) { /* Create a fcpl with persistent free-space manager enabled: #D */ /* This will result in superblock version 2 */ fcpl = H5Pcreate(H5P_FILE_CREATE); @@ -6064,13 +6065,13 @@ test_libver_bounds_super(hid_t fapl, const char *env_h5_drvr) /* Verify superblock version when creating a file with input fapl, fcpl #D and with/without SWMR access */ - if (H5FD__supports_swmr_test(env_h5_drvr)) + if (H5FD__supports_swmr_test(driver_name)) test_libver_bounds_super_create(fapl, fcpl, true, true); test_libver_bounds_super_create(fapl, fcpl, false, true); /* Verify superblock version when opening a file which is created with input fapl, fcpl #D and with/without SWMR access */ - if (H5FD__supports_swmr_test(env_h5_drvr)) + if (H5FD__supports_swmr_test(driver_name)) test_libver_bounds_super_open(fapl, fcpl, true, true); test_libver_bounds_super_open(fapl, fcpl, false, true); @@ -8102,7 +8103,7 @@ test_min_dset_ohdr(void) ****************************************************************/ #ifndef H5_NO_DEPRECATED_SYMBOLS static void -test_deprec(const char *env_h5_drvr) +test_deprec(const char *driver_name) { hid_t file; /* File IDs for old & new files */ hid_t fcpl; /* File creation property list */ @@ -8165,7 +8166,7 @@ test_deprec(const char *env_h5_drvr) CHECK(ret, FAIL, "H5Fclose"); /* Only run this part of the test with the sec2/default driver */ - if (h5_using_default_driver(env_h5_drvr)) { + if (h5_using_default_driver(driver_name)) { /* Create a file creation property list */ fcpl = H5Pcreate(H5P_FILE_CREATE); CHECK(fcpl, FAIL, "H5Pcreate"); @@ -8340,7 +8341,7 @@ test_deprec(const char *env_h5_drvr) void test_file(void) { - const char *env_h5_drvr; /* File Driver value from environment */ + const char *driver_name; /* File Driver value from environment */ hid_t fapl_id = H5I_INVALID_HID; /* VFD-dependent fapl ID */ bool driver_is_default_compatible; herr_t ret; @@ -8349,9 +8350,7 @@ test_file(void) MESSAGE(5, ("Testing Low-Level File I/O\n")); /* Get the VFD to use */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); /* Improved version of VFD-dependent checks */ fapl_id = h5_fileaccess(); @@ -8361,14 +8360,14 @@ test_file(void) CHECK(ret, FAIL, "h5_driver_is_default_vfd_compatible"); test_file_create(); /* Test file creation(also creation templates)*/ - test_file_open(env_h5_drvr); /* Test file opening */ + test_file_open(driver_name); /* Test file opening */ test_file_reopen(); /* Test file reopening */ test_file_close(); /* Test file close behavior */ test_get_file_id(); /* Test H5Iget_file_id */ test_get_obj_ids(); /* Test H5Fget_obj_ids for Jira Issue 8528 */ test_file_perm(); /* Test file access permissions */ test_file_perm2(); /* Test file access permission again */ - test_file_is_accessible(env_h5_drvr); /* Test detecting HDF5 files correctly */ + test_file_is_accessible(driver_name); /* Test detecting HDF5 files correctly */ test_file_delete(fapl_id); /* Test H5Fdelete */ test_file_open_dot(); /* Test opening objects with "." for a name */ test_file_open_overlap(); /* Test opening files in an overlapping manner */ @@ -8380,7 +8379,7 @@ test_file(void) test_file_double_file_dataset_open(true); test_file_double_file_dataset_open(false); test_userblock_file_size( - env_h5_drvr); /* Tests that files created with a userblock have the correct size */ + driver_name); /* Tests that files created with a userblock have the correct size */ test_cached_stab_info(); /* Tests that files are created with cached stab info in the superblock */ if (driver_is_default_compatible) { @@ -8388,20 +8387,20 @@ test_file(void) } test_userblock_alignment( - env_h5_drvr); /* Tests that files created with a userblock and alignment interact properly */ - test_userblock_alignment_paged(env_h5_drvr); /* Tests files created with a userblock and alignment (via + driver_name); /* Tests that files created with a userblock and alignment interact properly */ + test_userblock_alignment_paged(driver_name); /* Tests files created with a userblock and alignment (via paged aggregation) interact properly */ - test_filespace_info(env_h5_drvr); /* Test file creation public routines: */ + test_filespace_info(driver_name); /* Test file creation public routines: */ /* H5Pget/set_file_space_strategy() & H5Pget/set_file_space_page_size() */ /* Skipped testing for multi/split drivers */ - test_file_freespace(env_h5_drvr); /* Test file public routine H5Fget_freespace() */ + test_file_freespace(driver_name); /* Test file public routine H5Fget_freespace() */ /* Skipped testing for multi/split drivers */ /* Setup for multi/split drivers are there already */ - test_sects_freespace(env_h5_drvr, + test_sects_freespace(driver_name, true); /* Test file public routine H5Fget_free_sections() for new format */ /* Skipped testing for multi/split drivers */ /* Setup for multi/split drivers are there already */ - test_sects_freespace(env_h5_drvr, false); /* Test file public routine H5Fget_free_sections() */ + test_sects_freespace(driver_name, false); /* Test file public routine H5Fget_free_sections() */ /* Skipped testing for multi/split drivers */ if (driver_is_default_compatible) { @@ -8414,14 +8413,14 @@ test_file(void) } test_libver_bounds(); /* Test compatibility for file space management */ - test_libver_bounds_low_high(env_h5_drvr); + test_libver_bounds_low_high(driver_name); test_libver_macros(); /* Test the macros for library version comparison */ test_libver_macros2(); /* Test the macros for library version comparison */ test_incr_filesize(); /* Test H5Fincrement_filesize() and H5Fget_eoa() */ test_min_dset_ohdr(); /* Test dataset object header minimization */ #ifndef H5_NO_DEPRECATED_SYMBOLS - test_file_ishdf5(env_h5_drvr); /* Test detecting HDF5 files correctly */ - test_deprec(env_h5_drvr); /* Test deprecated routines */ + test_file_ishdf5(driver_name); /* Test detecting HDF5 files correctly */ + test_deprec(driver_name); /* Test deprecated routines */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ ret = H5Pclose(fapl_id); diff --git a/test/tmisc.c b/test/tmisc.c index be1cebfcfdf..e08d76cb7ac 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -339,6 +339,7 @@ typedef struct { #define MISC38_FILE "type_conversion_path_table_issue.h5" #define MISC39_FILE "set_est_link_info.h5" +#define MISC40_FILE "obj_props_intermediate.h5" /**************************************************************** ** @@ -1827,6 +1828,14 @@ test_misc10(void) /* Output message about test being performed */ MESSAGE(5, ("Testing using old dataset creation property list\n")); + /* Check if VFD used is native file format compatible */ + CHECK(h5_driver_is_default_vfd_compatible(H5P_DEFAULT, &driver_is_default_compatible), FAIL, + "h5_driver_is_default_vfd_compatible"); + if (!driver_is_default_compatible) { + MESSAGE(5, (" -- SKIPPED --\n")); + return; + } + /* * Open the old file and the dataset and get old settings. */ @@ -1840,14 +1849,6 @@ test_misc10(void) MESSAGE(5, (" -- SKIPPED --\n")); return; } - /* Check if VFD used is native file format compatible */ - CHECK(h5_driver_is_default_vfd_compatible(H5P_DEFAULT, &driver_is_default_compatible), FAIL, - "h5_driver_is_default_vfd_compatible"); - if (!driver_is_default_compatible) { - CHECK(H5Fclose(file), FAIL, "H5Fclose"); - MESSAGE(5, (" -- SKIPPED --\n")); - return; - } fcpl = H5Fget_create_plist(file); CHECK(fcpl, FAIL, "H5Fget_create_plist"); @@ -6640,6 +6641,223 @@ test_misc39(void) } /* end test_misc39() */ +/**************************************************************** +** +** test_misc40(): Test that object creation properties are propagated +** to intermediate groups. +** +****************************************************************/ +static void +test_misc40(void) +{ + hid_t lcpl = H5I_INVALID_HID; + hid_t gcpl = H5I_INVALID_HID; + hid_t gcpl2 = H5I_INVALID_HID; + hid_t def_gcpl = H5I_INVALID_HID; + hid_t dcpl = H5I_INVALID_HID; + hid_t fid = H5I_INVALID_HID; + hid_t gid = H5I_INVALID_HID; + hid_t gid2 = H5I_INVALID_HID; + hid_t def_gid = H5I_INVALID_HID; + hid_t did = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hsize_t dims[1] = {10}; + unsigned cr_order = 0; + bool track_times = false; + herr_t status; + + /* Output message about test being performed */ + MESSAGE(5, ("Testing object creation properties are propagated to intermediate groups\n")); + + lcpl = H5Pcreate(H5P_LINK_CREATE); + CHECK(lcpl, FAIL, "H5Pcreate"); + + status = H5Pset_create_intermediate_group(lcpl, 1); + CHECK(status, FAIL, "H5Pset_create_intermediate_group"); + + fid = H5Fcreate(MISC40_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(fid, FAIL, "H5Fcreate"); + + /* + * Verify default creation properties when creating + * group with intermdiate group + */ + + /* Create groups that use default creation properties */ + def_gid = H5Gcreate2(fid, "def_group1/def_group2", lcpl, H5P_DEFAULT, H5P_DEFAULT); + CHECK(def_gid, FAIL, "H5Gcreate2"); + + status = H5Gclose(def_gid); + CHECK(status, FAIL, "H5Gclose"); + + def_gid = H5Gopen2(fid, "def_group1", H5P_DEFAULT); + CHECK(def_gid, FAIL, "H5Gopen2"); + + def_gcpl = H5Gget_create_plist(def_gid); + CHECK(def_gcpl, FAIL, "H5Gget_create_plist"); + + /* Default is true */ + status = H5Pget_obj_track_times(def_gcpl, &track_times); + CHECK(status, FAIL, "H5Pget_obj_track_times"); + VERIFY(track_times, true, "H5Pget_obj_track_times"); + + /* Default is false */ + status = H5Pget_attr_creation_order(def_gcpl, &cr_order); + CHECK(status, FAIL, "H5Pget_attr_creation_order"); + VERIFY(cr_order, false, "H5Pget_attr_creation_order"); + + status = H5Gclose(def_gid); + CHECK(status, FAIL, "H5Gclose"); + + status = H5Pclose(def_gcpl); + CHECK(status, FAIL, "H5Pclose"); + + /* + * Verify non-default creation properties when creating + * group with intermediate groups + */ + gcpl = H5Pcreate(H5P_GROUP_CREATE); + CHECK(gcpl, FAIL, "H5Pcreate"); + + status = H5Pset_attr_creation_order(gcpl, H5P_CRT_ORDER_TRACKED); + CHECK(status, FAIL, "H5Pset_attr_creation_order"); + + status = H5Pset_obj_track_times(gcpl, false); + CHECK(status, FAIL, "H5Pset_obj_track_times"); + + gid = H5Gcreate2(fid, "group1/group2/group3", lcpl, gcpl, H5P_DEFAULT); + CHECK(gid, FAIL, "H5Gcreate2"); + + status = H5Pclose(gcpl); + CHECK(status, FAIL, "H5Pclose"); + + /* Verify group3 */ + gcpl = H5Gget_create_plist(gid); + CHECK(gcpl, FAIL, "H5Gget_create_plist"); + + status = H5Pget_attr_creation_order(gcpl, &cr_order); + CHECK(status, FAIL, "H5Pget_attr_creation_order"); + VERIFY(cr_order, H5P_CRT_ORDER_TRACKED, "H5Pget_attr_creation_order"); + + status = H5Pget_obj_track_times(gcpl, &track_times); + CHECK(status, FAIL, "H5Pget_obj_track_times"); + VERIFY(track_times, false, "H5Pget_obj_track_times"); + + status = H5Gclose(gid); + CHECK(status, FAIL, "H5Gclose"); + status = H5Pclose(gcpl); + CHECK(status, FAIL, "H5Pclose"); + + /* Verify group1 */ + gid = H5Gopen2(fid, "group1", H5P_DEFAULT); + CHECK(gid, FAIL, "H5Gopen2"); + + gcpl = H5Gget_create_plist(gid); + CHECK(gcpl, FAIL, "H5Gget_create_plist"); + + status = H5Pget_attr_creation_order(gcpl, &cr_order); + CHECK(status, FAIL, "H5Pget_attr_creation_order"); + VERIFY(cr_order, H5P_CRT_ORDER_TRACKED, "H5Pget_attr_creation_order"); + + status = H5Pget_obj_track_times(gcpl, &track_times); + CHECK(status, FAIL, "H5Pget_obj_track_times"); + VERIFY(track_times, false, "H5Pget_obj_track_times"); + + /* Verify group2 */ + gid2 = H5Gopen2(gid, "group2", H5P_DEFAULT); + CHECK(gid2, FAIL, "H5Gopen2"); + + gcpl2 = H5Gget_create_plist(gid2); + CHECK(gcpl2, FAIL, "H5Gget_create_plist"); + + status = H5Pget_attr_creation_order(gcpl2, &cr_order); + CHECK(status, FAIL, "H5Pget_attr_creation_order"); + VERIFY(cr_order, H5P_CRT_ORDER_TRACKED, "H5Pget_attr_creation_order"); + + status = H5Pget_obj_track_times(gcpl2, &track_times); + CHECK(status, FAIL, "H5Pget_obj_track_times"); + VERIFY(track_times, false, "H5Pget_obj_track_times"); + + status = H5Gclose(gid2); + CHECK(status, FAIL, "H5Gclose"); + status = H5Pclose(gcpl2); + CHECK(status, FAIL, "H5Pclose"); + + status = H5Gclose(gid); + CHECK(status, FAIL, "H5Gclose"); + status = H5Pclose(gcpl); + CHECK(status, FAIL, "H5Pclose"); + + /* + * Verify non-default creation properties when creating + * dataset with intermediate group + */ + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + + status = H5Pset_attr_creation_order(dcpl, H5P_CRT_ORDER_TRACKED); + CHECK(status, FAIL, "H5Pset_attr_creation_order"); + + sid = H5Screate_simple(1, dims, NULL); + CHECK(sid, FAIL, "H5Screate_simple"); + + did = H5Dcreate2(fid, "path1/dname", H5T_NATIVE_INT, sid, lcpl, dcpl, H5P_DEFAULT); + CHECK(did, FAIL, "H5Dcreate2"); + + status = H5Dclose(did); + CHECK(status, FAIL, "H5Dclose"); + status = H5Sclose(sid); + CHECK(status, FAIL, "H5Sclose"); + status = H5Pclose(dcpl); + CHECK(status, FAIL, "H5Pclose"); + + /* Verify path1 */ + gid = H5Gopen2(fid, "path1", H5P_DEFAULT); + CHECK(gid, FAIL, "H5Gopen2"); + + gcpl = H5Gget_create_plist(gid); + CHECK(gcpl, FAIL, "H5Gget_create_plist"); + + status = H5Pget_attr_creation_order(gcpl, &cr_order); + CHECK(status, FAIL, "H5Pget_attr_creation_order"); + VERIFY(cr_order, H5P_CRT_ORDER_TRACKED, "H5Pget_attr_creation_order"); + + status = H5Pget_obj_track_times(gcpl, &track_times); + CHECK(status, FAIL, "H5Pget_obj_track_times"); + VERIFY(track_times, true, "H5Pget_obj_track_times"); + + /* Verify dname */ + did = H5Dopen2(gid, "dname", H5P_DEFAULT); + CHECK(did, FAIL, "H5Dopen2"); + + dcpl = H5Dget_create_plist(did); + CHECK(dcpl, FAIL, "H5Dget_create_plist"); + + status = H5Pget_attr_creation_order(dcpl, &cr_order); + VERIFY(cr_order, H5P_CRT_ORDER_TRACKED, "H5Pget_attr_creation_order"); + + status = H5Pget_obj_track_times(dcpl, &track_times); + CHECK(status, FAIL, "H5Pget_obj_track_times"); + VERIFY(track_times, true, "H5Pget_obj_track_times"); + + status = H5Dclose(did); + CHECK(status, FAIL, "H5Dclose"); + status = H5Pclose(dcpl); + CHECK(status, FAIL, "H5Pclose"); + + status = H5Gclose(gid); + CHECK(status, FAIL, "H5Gclose"); + status = H5Pclose(gcpl); + CHECK(status, FAIL, "H5Pclose"); + + status = H5Fclose(fid); + CHECK(status, FAIL, "H5Fclose"); + + status = H5Pclose(lcpl); + CHECK(status, FAIL, "H5Pclose"); + +} /* end test_misc40() */ + /**************************************************************** ** ** test_misc(): Main misc. test routine. @@ -6675,7 +6893,11 @@ test_misc(void) } test_misc14(); /* Test that deleted dataset's data is removed from sieve buffer correctly */ - test_misc15(); /* Test that checking a file's access property list more than once works */ + + if (default_driver) { + test_misc15(); /* Test that checking a file's access property list more than once works */ + } + test_misc16(); /* Test array of fixed-length string */ test_misc17(); /* Test array of ASCII character */ test_misc18(); /* Test new object header information in H5O_info_t struct */ @@ -6710,6 +6932,7 @@ test_misc(void) test_misc37(); /* Test for seg fault failure at file close */ test_misc38(); /* Test for type conversion path table issue */ test_misc39(); /* Ensure H5Pset_est_link_info() handles large values */ + test_misc40(); /* Test object properties propagated to intermediate groups */ } /* test_misc() */ @@ -6767,6 +6990,7 @@ cleanup_misc(void) #endif /* H5_NO_DEPRECATED_SYMBOLS */ H5Fdelete(MISC38_FILE, H5P_DEFAULT); H5Fdelete(MISC39_FILE, H5P_DEFAULT); + H5Fdelete(MISC40_FILE, H5P_DEFAULT); } H5E_END_TRY } /* end cleanup_misc() */ diff --git a/test/trefer.c b/test/trefer.c index b8f91a03363..fc0d8942045 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -3592,15 +3592,13 @@ void test_reference(void) { H5F_libver_t low, high; /* Low and high bounds */ - const char *env_h5_drvr; /* File Driver value from environment */ + const char *driver_name; /* File Driver value from environment */ /* Output message about test being performed */ MESSAGE(5, ("Testing References\n")); /* Get the VFD to use */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); test_reference_params(); /* Test for correct parameter checking */ test_reference_obj(); /* Test basic H5R object reference code */ @@ -3622,7 +3620,7 @@ test_reference(void) } /* end low bound */ /* The following test is currently broken with the Direct VFD */ - if (strcmp(env_h5_drvr, "direct") != 0) { + if (strcmp(driver_name, "direct") != 0) { test_reference_obj_deleted(); /* Test H5R object reference code for deleted objects */ } diff --git a/test/tselect.c b/test/tselect.c index 20b85916739..e07b1b62dfb 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -16078,16 +16078,14 @@ test_select(void) size_t rdcc_nbytes; /* Raw data number of bytes */ double rdcc_w0; /* Raw data write percentage */ hssize_t offset[SPACE7_RANK] = {1, 1}; /* Offset for testing selection offsets */ - const char *env_h5_drvr; /* File Driver value from environment */ + const char *driver_name; /* File Driver value from environment */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Selections\n")); /* Get the VFD to use */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); /* Create a dataset transfer property list */ plist_id = H5Pcreate(H5P_DATASET_XFER); @@ -16152,7 +16150,7 @@ test_select(void) test_select_hyper_valid_combination(); /* Test different input combinations */ /* The following tests are currently broken with the Direct VFD */ - if (strcmp(env_h5_drvr, "direct") != 0) { + if (strcmp(driver_name, "direct") != 0) { test_select_hyper_and_2d(); /* Test hyperslab intersection (AND) code for 2-D dataset */ test_select_hyper_xor_2d(); /* Test hyperslab XOR code for 2-D dataset */ test_select_hyper_notb_2d(); /* Test hyperslab NOTB code for 2-D dataset */ diff --git a/test/tsohm.c b/test/tsohm.c index 542fd688b81..e6b9e0b5e2a 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -3208,7 +3208,7 @@ test_sohm_extlink(void) CHECK_I(ret, "h5_driver_is_default_vfd_compatible"); if (!driver_is_default_compatible) { - printf("-- SKIPPED --\n"); + MESSAGE(5, ("-- SKIPPED --\n")); return; } @@ -3710,7 +3710,7 @@ test_sohm_external_dtype(void) void test_sohm(void) { - const char *env_h5_drvr; + const char *driver_name; bool vol_is_native; bool default_driver; @@ -3724,11 +3724,8 @@ test_sohm(void) } /* Get the VFD to use */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; - - default_driver = h5_using_default_driver(env_h5_drvr); + driver_name = h5_get_test_driver_name(); + default_driver = h5_using_default_driver(driver_name); test_sohm_fcpl(); /* Test SOHMs and file creation plists */ test_sohm_fcpl_errors(); /* Bogus H5P* calls for SOHMs */ diff --git a/test/vds.c b/test/vds.c index c2546e57f00..c08eec09288 100644 --- a/test/vds.c +++ b/test/vds.c @@ -12316,13 +12316,11 @@ main(void) int test_api_config; unsigned bit_config; H5F_libver_t low, high; /* Low and high bounds */ - const char *env_h5_drvr; /* File Driver value from environment */ + const char *driver_name; /* File Driver value from environment */ bool driver_is_parallel; int nerrors = 0; - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); /* Testing setup */ h5_reset(); @@ -12336,7 +12334,7 @@ main(void) * doesn't support parallel reads and the splitter VFD has external * link-related bugs. */ - if (driver_is_parallel || !strcmp(env_h5_drvr, "splitter")) { + if (driver_is_parallel || !strcmp(driver_name, "splitter")) { puts(" -- SKIPPED for incompatible VFD --"); exit(EXIT_SUCCESS); } diff --git a/test/vds_env.c b/test/vds_env.c index e9649566fd9..4432e0aad53 100644 --- a/test/vds_env.c +++ b/test/vds_env.c @@ -327,13 +327,11 @@ main(void) hid_t fapl, my_fapl; unsigned bit_config; H5F_libver_t low, high; /* Low and high bounds */ - const char *env_h5_drvr; /* File Driver value from environment */ + const char *driver_name; /* File Driver value from environment */ bool driver_is_parallel; int nerrors = 0; - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); /* Testing setup */ h5_reset(); @@ -347,7 +345,7 @@ main(void) * doesn't support parallel reads and the splitter VFD has external * link-related bugs. */ - if (driver_is_parallel || !strcmp(env_h5_drvr, "splitter")) { + if (driver_is_parallel || !strcmp(driver_name, "splitter")) { puts(" -- SKIPPED for incompatible VFD --"); exit(EXIT_SUCCESS); } diff --git a/test/vfd.c b/test/vfd.c index 5a86920652e..7025de907df 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -5873,16 +5873,16 @@ test_selection_io(const char *vfd_name) int main(void) { - char *env_h5_drvr = NULL; - int nerrors = 0; + const char *driver_name; + int nerrors = 0; - /* Don't run VFD tests when HDF5_DRIVER is set. These tests expect a - * specific VFD to be set and HDF5_DRIVER being set can interfere - * with that. + /* Don't run VFD tests when HDF5_DRIVER or HDF5_TEST_DRIVER is set. These + * tests expect a specific VFD to be set and HDF5_DRIVER/HDF5_TEST_DRIVER + * being set can interfere with that. */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr) { - printf(" -- SKIPPED VFD tests because %s is set -- \n", HDF5_DRIVER); + driver_name = h5_get_test_driver_name(); + if (driver_name) { + printf(" -- SKIPPED VFD tests because driver environment variable is set -- \n"); exit(EXIT_SUCCESS); } diff --git a/test/vfd_plugin.c b/test/vfd_plugin.c index 8bfc09f07aa..91f8ec50c41 100644 --- a/test/vfd_plugin.c +++ b/test/vfd_plugin.c @@ -19,8 +19,6 @@ #include "null_vfd_plugin.h" -#define DEFAULT_DRIVER_NAME "sec2" - /*------------------------------------------------------------------------- * Function: test_set_by_name() * @@ -301,7 +299,7 @@ test_get_config_str(void) TEST_ERROR; /* Set a new configuration string on the FAPL and retrieve it */ - if (H5Pset_driver_by_name(fapl_id, DEFAULT_DRIVER_NAME, config_str) < 0) + if (H5Pset_driver_by_name(fapl_id, H5_DEFAULT_VFD_NAME, config_str) < 0) TEST_ERROR; if ((config_str_len = H5Pget_driver_config_str(fapl_id, config_str_buf, 128)) < 0) TEST_ERROR; diff --git a/test/vol.c b/test/vol.c index e29c6bb940f..395b164bfe7 100644 --- a/test/vol.c +++ b/test/vol.c @@ -857,7 +857,7 @@ test_native_vol_init(void) *------------------------------------------------------------------------- */ static herr_t -test_basic_file_operation(const char *env_h5_drvr) +test_basic_file_operation(const char *driver_name) { hid_t fid = H5I_INVALID_HID; hid_t fid_reopen = H5I_INVALID_HID; @@ -933,10 +933,10 @@ test_basic_file_operation(const char *env_h5_drvr) TEST_ERROR; /* Can't compare VFD properties for several VFDs */ - if ((bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0 && - strcmp(env_h5_drvr, "family") != 0 && strcmp(env_h5_drvr, "direct") != 0 && - strcmp(env_h5_drvr, "core") != 0 && strcmp(env_h5_drvr, "core_paged") != 0 && - strcmp(env_h5_drvr, "mpio") != 0 && strcmp(env_h5_drvr, "splitter") != 0)) { + if ((bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0 && + strcmp(driver_name, "family") != 0 && strcmp(driver_name, "direct") != 0 && + strcmp(driver_name, "core") != 0 && strcmp(driver_name, "core_paged") != 0 && + strcmp(driver_name, "mpio") != 0 && strcmp(driver_name, "splitter") != 0)) { /* H5Fget_access_plist */ if ((fapl_id2 = H5Fget_access_plist(fid)) < 0) TEST_ERROR; @@ -957,8 +957,8 @@ test_basic_file_operation(const char *env_h5_drvr) TEST_ERROR; /* Can't retrieve VFD handle for split / multi / family VFDs */ - if ((bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0 && - strcmp(env_h5_drvr, "family") != 0)) { + if ((bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0 && + strcmp(driver_name, "family") != 0)) { /* H5Fget_vfd_handle */ if (H5Fget_vfd_handle(fid, H5P_DEFAULT, &os_file_handle) < 0) TEST_ERROR; @@ -997,10 +997,10 @@ test_basic_file_operation(const char *env_h5_drvr) TEST_ERROR; /* Can't compare VFD properties for several VFDs */ - if ((bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0 && - strcmp(env_h5_drvr, "family") != 0 && strcmp(env_h5_drvr, "direct") != 0 && - strcmp(env_h5_drvr, "core") != 0 && strcmp(env_h5_drvr, "core_paged") != 0 && - strcmp(env_h5_drvr, "mpio") != 0 && strcmp(env_h5_drvr, "splitter") != 0)) { + if ((bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0 && + strcmp(driver_name, "family") != 0 && strcmp(driver_name, "direct") != 0 && + strcmp(driver_name, "core") != 0 && strcmp(driver_name, "core_paged") != 0 && + strcmp(driver_name, "mpio") != 0 && strcmp(driver_name, "splitter") != 0)) { /* H5Fget_access_plist */ if ((fapl_id2 = H5Fget_access_plist(fid)) < 0) TEST_ERROR; @@ -1014,10 +1014,10 @@ test_basic_file_operation(const char *env_h5_drvr) TEST_ERROR; /* Can't compare VFD properties for several VFDs */ - if ((bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0 && - strcmp(env_h5_drvr, "family") != 0 && strcmp(env_h5_drvr, "direct") != 0 && - strcmp(env_h5_drvr, "core") != 0 && strcmp(env_h5_drvr, "core_paged") != 0 && - strcmp(env_h5_drvr, "mpio") != 0 && strcmp(env_h5_drvr, "splitter") != 0)) { + if ((bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0 && + strcmp(driver_name, "family") != 0 && strcmp(driver_name, "direct") != 0 && + strcmp(driver_name, "core") != 0 && strcmp(driver_name, "core_paged") != 0 && + strcmp(driver_name, "mpio") != 0 && strcmp(driver_name, "splitter") != 0)) { /* H5Fget_access_plist */ if ((fapl_id2 = H5Fget_access_plist(fid_reopen)) < 0) TEST_ERROR; @@ -2645,13 +2645,11 @@ test_query_optional(void) int main(void) { - const char *env_h5_drvr; /* File driver value from environment */ + const char *driver_name; /* File driver value from environment */ int nerrors = 0; /* Get the VFD to use */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); h5_reset(); @@ -2660,7 +2658,7 @@ main(void) nerrors += test_vol_registration() < 0 ? 1 : 0; nerrors += test_register_opt_operation() < 0 ? 1 : 0; nerrors += test_native_vol_init() < 0 ? 1 : 0; - nerrors += test_basic_file_operation(env_h5_drvr) < 0 ? 1 : 0; + nerrors += test_basic_file_operation(driver_name) < 0 ? 1 : 0; nerrors += test_basic_group_operation() < 0 ? 1 : 0; nerrors += test_basic_dataset_operation() < 0 ? 1 : 0; nerrors += test_basic_attribute_operation() < 0 ? 1 : 0; diff --git a/testpar/t_pflush1.c b/testpar/t_pflush1.c index a61e6749a53..733898f9839 100644 --- a/testpar/t_pflush1.c +++ b/testpar/t_pflush1.c @@ -107,7 +107,7 @@ main(int argc, char *argv[]) hid_t fapl_id = H5I_INVALID_HID; MPI_File *mpifh_p = NULL; char name[1024]; - const char *envval = NULL; + const char *driver_name; int mpi_size; int mpi_rank; MPI_Comm comm = MPI_COMM_WORLD; @@ -121,11 +121,9 @@ main(int argc, char *argv[]) TESTING("H5Fflush (part1)"); /* Don't run using the split VFD */ - envval = getenv(HDF5_DRIVER); - if (envval == NULL) - envval = "nomatch"; + driver_name = h5_get_test_driver_name(); - if (!strcmp(envval, "split")) { + if (!strcmp(driver_name, "split")) { if (mpi_rank == 0) { SKIPPED(); puts(" Test not compatible with current Virtual File Driver"); diff --git a/testpar/t_pflush2.c b/testpar/t_pflush2.c index e1dce1bbfd7..2f860d4417d 100644 --- a/testpar/t_pflush2.c +++ b/testpar/t_pflush2.c @@ -132,12 +132,11 @@ main(int argc, char *argv[]) hid_t fapl_id2 = H5I_INVALID_HID; H5E_auto2_t func; char name[1024]; - const char *envval = NULL; - - int mpi_size; - int mpi_rank; - MPI_Comm comm = MPI_COMM_WORLD; - MPI_Info info = MPI_INFO_NULL; + const char *driver_name; + int mpi_size; + int mpi_rank; + MPI_Comm comm = MPI_COMM_WORLD; + MPI_Info info = MPI_INFO_NULL; MPI_Init(&argc, &argv); MPI_Comm_size(comm, &mpi_size); @@ -147,11 +146,9 @@ main(int argc, char *argv[]) TESTING("H5Fflush (part2 with flush)"); /* Don't run using the split VFD */ - envval = getenv(HDF5_DRIVER); - if (envval == NULL) - envval = "nomatch"; + driver_name = h5_get_test_driver_name(); - if (!strcmp(envval, "split")) { + if (!strcmp(driver_name, "split")) { if (mpi_rank == 0) { SKIPPED(); puts(" Test not compatible with current Virtual File Driver"); diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c index 2a2cfe8fd8b..e6bb35b921b 100644 --- a/testpar/t_shapesame.c +++ b/testpar/t_shapesame.c @@ -3984,7 +3984,8 @@ pause_proc(void) MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); MPI_Get_processor_name(mpi_name, &mpi_namelen); - if (MAINPROCESS) + if (MAINPROCESS) { + memset(&statbuf, 0, sizeof(h5_stat_t)); while ((HDstat(greenlight, &statbuf) == -1) && loops < maxloop) { if (!loops++) { printf("Proc %d (%*s, %d): to debug, attach %d\n", mpi_rank, mpi_namelen, mpi_name, pid, pid); @@ -3992,7 +3993,10 @@ pause_proc(void) printf("waiting(%ds) for file %s ...\n", time_int, greenlight); fflush(stdout); HDsleep(time_int); + + memset(&statbuf, 0, sizeof(h5_stat_t)); } + } MPI_Barrier(MPI_COMM_WORLD); } diff --git a/testpar/t_subfiling_vfd.c b/testpar/t_subfiling_vfd.c index b0628033222..8f0ac52c074 100644 --- a/testpar/t_subfiling_vfd.c +++ b/testpar/t_subfiling_vfd.c @@ -367,6 +367,7 @@ test_config_file(void) char scan_format[256]; int num_digits; + memset(&file_info, 0, sizeof(h5_stat_t)); VRFY((HDstat(SUBF_FILENAME, &file_info) >= 0), "HDstat succeeded"); config_filename = malloc(PATH_MAX); @@ -586,6 +587,7 @@ test_stripe_sizes(void) * Get the current file size to see where we can safely * write to in the file without overwriting the superblock */ + memset(&file_info, 0, sizeof(h5_stat_t)); VRFY((HDstat(SUBF_FILENAME, &file_info) >= 0), "HDstat succeeded"); file_size = (h5_stat_size_t)file_info.st_size; @@ -626,6 +628,7 @@ test_stripe_sizes(void) VRFY((fclose(subfile_ptr) >= 0), "fclose on subfile succeeded"); /* Check file size */ + memset(&subfile_info, 0, sizeof(h5_stat_t)); VRFY((HDstat(tmp_filename, &subfile_info) >= 0), "HDstat succeeded"); subfile_size = (h5_stat_size_t)subfile_info.st_size; @@ -672,6 +675,7 @@ test_stripe_sizes(void) VRFY((fclose(subfile_ptr) >= 0), "fclose on subfile succeeded"); /* Check file size */ + memset(&subfile_info, 0, sizeof(h5_stat_t)); VRFY((HDstat(tmp_filename, &subfile_info) >= 0), "HDstat succeeded"); subfile_size = (h5_stat_size_t)subfile_info.st_size; @@ -736,6 +740,7 @@ test_stripe_sizes(void) * write to in the file without overwriting the superblock */ if (MAINPROCESS) { + memset(&file_info, 0, sizeof(h5_stat_t)); VRFY((HDstat(SUBF_FILENAME, &file_info) >= 0), "HDstat succeeded"); file_size = (h5_stat_size_t)file_info.st_size; @@ -792,6 +797,7 @@ test_stripe_sizes(void) VRFY((fclose(subfile_ptr) >= 0), "fclose on subfile succeeded"); /* Check file size */ + memset(&subfile_info, 0, sizeof(h5_stat_t)); VRFY((HDstat(tmp_filename, &subfile_info) >= 0), "HDstat succeeded"); subfile_size = (h5_stat_size_t)subfile_info.st_size; @@ -849,6 +855,7 @@ test_stripe_sizes(void) VRFY((fclose(subfile_ptr) >= 0), "fclose on subfile succeeded"); /* Check file size */ + memset(&subfile_info, 0, sizeof(h5_stat_t)); VRFY((HDstat(tmp_filename, &subfile_info) >= 0), "HDstat succeeded"); subfile_size = (h5_stat_size_t)subfile_info.st_size; @@ -994,6 +1001,7 @@ test_iovec_translation(void) VRFY((H5Fclose(file_id) >= 0), "H5Fclose succeeded"); /* Retrieve file info to get the file inode for later use */ + memset(&file_info, 0, sizeof(h5_stat_t)); VRFY((HDstat(SUBF_FILENAME, &file_info) >= 0), "HDstat succeeded"); /* Re-open file through H5FDopen for direct writes */ @@ -1044,6 +1052,7 @@ test_iovec_translation(void) VRFY((fclose(subfile_ptr) >= 0), "fclose on subfile succeeded"); /* Check file size */ + memset(&subfile_info, 0, sizeof(h5_stat_t)); VRFY((HDstat(tmp_filename, &subfile_info) >= 0), "HDstat succeeded"); subfile_size = (h5_stat_size_t)subfile_info.st_size; @@ -1100,6 +1109,7 @@ test_iovec_translation(void) VRFY((H5Fclose(file_id) >= 0), "H5Fclose succeeded"); /* Retrieve file info to get the file inode for later use */ + memset(&file_info, 0, sizeof(h5_stat_t)); VRFY((HDstat(SUBF_FILENAME, &file_info) >= 0), "HDstat succeeded"); /* Re-open file through H5FDopen for direct writes */ @@ -1150,6 +1160,7 @@ test_iovec_translation(void) VRFY((fclose(subfile_ptr) >= 0), "fclose on subfile succeeded"); /* Check file size */ + memset(&subfile_info, 0, sizeof(h5_stat_t)); VRFY((HDstat(tmp_filename, &subfile_info) >= 0), "HDstat succeeded"); subfile_size = (h5_stat_size_t)subfile_info.st_size; @@ -1196,6 +1207,7 @@ test_iovec_translation(void) VRFY((H5Fclose(file_id) >= 0), "H5Fclose succeeded"); /* Retrieve file info to get the file inode for later use */ + memset(&file_info, 0, sizeof(h5_stat_t)); VRFY((HDstat(SUBF_FILENAME, &file_info) >= 0), "HDstat succeeded"); /* Re-open file through H5FDopen for direct writes */ @@ -1246,6 +1258,7 @@ test_iovec_translation(void) VRFY((fclose(subfile_ptr) >= 0), "fclose on subfile succeeded"); /* Check file size */ + memset(&subfile_info, 0, sizeof(h5_stat_t)); VRFY((HDstat(tmp_filename, &subfile_info) >= 0), "HDstat succeeded"); subfile_size = (h5_stat_size_t)subfile_info.st_size; @@ -1284,6 +1297,7 @@ test_iovec_translation(void) VRFY((H5Fclose(file_id) >= 0), "H5Fclose succeeded"); /* Retrieve file info to get the file inode for later use */ + memset(&file_info, 0, sizeof(h5_stat_t)); VRFY((HDstat(SUBF_FILENAME, &file_info) >= 0), "HDstat succeeded"); /* Re-open file through H5FDopen for direct writes */ @@ -1334,6 +1348,7 @@ test_iovec_translation(void) VRFY((fclose(subfile_ptr) >= 0), "fclose on subfile succeeded"); /* Check file size */ + memset(&subfile_info, 0, sizeof(h5_stat_t)); VRFY((HDstat(tmp_filename, &subfile_info) >= 0), "HDstat succeeded"); subfile_size = (h5_stat_size_t)subfile_info.st_size; @@ -1378,6 +1393,7 @@ test_iovec_translation(void) VRFY((H5Fclose(file_id) >= 0), "H5Fclose succeeded"); /* Retrieve file info to get the file inode for later use */ + memset(&file_info, 0, sizeof(h5_stat_t)); VRFY((HDstat(SUBF_FILENAME, &file_info) >= 0), "HDstat succeeded"); /* Re-open file through H5FDopen for direct writes */ @@ -1428,6 +1444,7 @@ test_iovec_translation(void) VRFY((fclose(subfile_ptr) >= 0), "fclose on subfile succeeded"); /* Check file size */ + memset(&subfile_info, 0, sizeof(h5_stat_t)); VRFY((HDstat(tmp_filename, &subfile_info) >= 0), "HDstat succeeded"); subfile_size = (h5_stat_size_t)subfile_info.st_size; @@ -1471,6 +1488,7 @@ test_iovec_translation(void) VRFY((H5Fclose(file_id) >= 0), "H5Fclose succeeded"); /* Retrieve file info to get the file inode for later use */ + memset(&file_info, 0, sizeof(h5_stat_t)); VRFY((HDstat(SUBF_FILENAME, &file_info) >= 0), "HDstat succeeded"); /* Re-open file through H5FDopen for direct writes */ @@ -1521,6 +1539,7 @@ test_iovec_translation(void) VRFY((fclose(subfile_ptr) >= 0), "fclose on subfile succeeded"); /* Check file size */ + memset(&subfile_info, 0, sizeof(h5_stat_t)); VRFY((HDstat(tmp_filename, &subfile_info) >= 0), "HDstat succeeded"); subfile_size = (h5_stat_size_t)subfile_info.st_size; @@ -1717,6 +1736,7 @@ test_selection_strategies(void) /* * Get the file inode value so we can construct the subfile names */ + memset(&file_info, 0, sizeof(h5_stat_t)); VRFY((HDstat(SUBF_FILENAME, &file_info) >= 0), "HDstat succeeded"); num_digits = (int)(log10(expected_num_subfiles) + 1); @@ -1881,6 +1901,7 @@ test_read_different_stripe_size(void) int num_subfiles = cfg.stripe_count; int num_digits = (int)(log10(num_subfiles) + 1); + memset(&file_info, 0, sizeof(h5_stat_t)); VRFY((HDstat(SUBF_FILENAME, &file_info) >= 0), "HDstat succeeded"); for (int j = 0; j < num_subfiles; j++) { @@ -1897,6 +1918,7 @@ test_read_different_stripe_size(void) /* Check file size */ if (!enable_compression) { + memset(&subfile_info, 0, sizeof(h5_stat_t)); VRFY((HDstat(tmp_filename, &subfile_info) >= 0), "HDstat succeeded"); subfile_size = (h5_stat_size_t)subfile_info.st_size; @@ -1956,6 +1978,7 @@ test_read_different_stripe_size(void) int num_subfiles = cfg.stripe_count; int num_digits = (int)(log10(num_subfiles / 2) + 1); + memset(&file_info, 0, sizeof(h5_stat_t)); VRFY((HDstat(SUBF_FILENAME, &file_info) >= 0), "HDstat succeeded"); for (int j = 0; j < num_subfiles; j++) { @@ -2104,6 +2127,7 @@ test_subfiling_precreate_rank_0(void) num_subfiles = cfg.stripe_count; num_digits = (int)(log10(num_subfiles) + 1); + memset(&file_info, 0, sizeof(h5_stat_t)); VRFY((HDstat(SUBF_FILENAME, &file_info) >= 0), "HDstat succeeded"); tmp_filename = malloc(PATH_MAX); @@ -2122,6 +2146,7 @@ test_subfiling_precreate_rank_0(void) /* Check file size */ if (!enable_compression) { + memset(&subfile_info, 0, sizeof(h5_stat_t)); VRFY((HDstat(tmp_filename, &subfile_info) >= 0), "HDstat succeeded"); file_size = (h5_stat_size_t)subfile_info.st_size; @@ -2623,6 +2648,7 @@ test_subfiling_h5fuse(void) */ HDcompile_assert(sizeof(uint64_t) >= sizeof(ino_t)); if (MAINPROCESS) { + memset(&file_info, 0, sizeof(h5_stat_t)); VRFY((HDstat(SUBF_FILENAME, &file_info) >= 0), "HDstat succeeded"); file_inode = (uint64_t)file_info.st_ino; @@ -2738,6 +2764,7 @@ test_subfiling_h5fuse(void) /* Verify the size of the fused file */ if (!enable_compression) { + memset(&file_info, 0, sizeof(h5_stat_t)); VRFY((HDstat(SUBF_FILENAME, &file_info) >= 0), "HDstat succeeded"); VRFY(((size_t)file_info.st_size >= target_size), "File size verification succeeded"); } diff --git a/testpar/t_vfd.c b/testpar/t_vfd.c index 9faf1dbe7e8..93fa4992b55 100644 --- a/testpar/t_vfd.c +++ b/testpar/t_vfd.c @@ -29,9 +29,9 @@ static MPI_Comm comm = MPI_COMM_WORLD; static MPI_Info info = MPI_INFO_NULL; -bool pass = true; /* set to false on error */ -bool disp_failure_mssgs = true; /* global force display of failure messages */ -const char *failure_mssg = NULL; +static bool pass = true; /* set to false on error */ +static bool disp_failure_mssgs = true; /* global force display of failure messages */ +static const char *failure_mssg = NULL; const char *FILENAMES[] = {"mpio_vfd_test_file_0", /*0*/ "mpio_vfd_test_file_1", /*1*/ diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index 0b0a67c0a65..54e537f422c 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -73,7 +73,8 @@ pause_proc(void) MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); MPI_Get_processor_name(mpi_name, &mpi_namelen); - if (MAINPROCESS) + if (MAINPROCESS) { + memset(&statbuf, 0, sizeof(h5_stat_t)); while ((HDstat(greenlight, &statbuf) == -1) && loops < maxloop) { if (!loops++) { printf("Proc %d (%*s, %d): to debug, attach %d\n", mpi_rank, mpi_namelen, mpi_name, pid, pid); @@ -81,7 +82,10 @@ pause_proc(void) printf("waiting(%ds) for file %s ...\n", time_int, greenlight); fflush(stdout); HDsleep(time_int); + + memset(&statbuf, 0, sizeof(h5_stat_t)); } + } MPI_Barrier(MPI_COMM_WORLD); } diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 36e304d459e..d9a60c92b50 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -79,20 +79,12 @@ const char *volnames[] = { * */ const char *drivernames[] = { - [SEC2_VFD_IDX] = "sec2", - [DIRECT_VFD_IDX] = "direct", - [LOG_VFD_IDX] = "log", - [WINDOWS_VFD_IDX] = "windows", - [STDIO_VFD_IDX] = "stdio", - [CORE_VFD_IDX] = "core", - [FAMILY_VFD_IDX] = "family", - [SPLIT_VFD_IDX] = "split", - [MULTI_VFD_IDX] = "multi", - [MPIO_VFD_IDX] = "mpio", - [ROS3_VFD_IDX] = "ros3", - [HDFS_VFD_IDX] = "hdfs", - [SUBFILING_VFD_IDX] = H5FD_SUBFILING_NAME, - [ONION_VFD_IDX] = "onion", + [SEC2_VFD_IDX] = "sec2", [DIRECT_VFD_IDX] = "direct", [LOG_VFD_IDX] = "log", + [WINDOWS_VFD_IDX] = "windows", [STDIO_VFD_IDX] = "stdio", [CORE_VFD_IDX] = "core", + [FAMILY_VFD_IDX] = "family", [SPLIT_VFD_IDX] = "split", [MULTI_VFD_IDX] = "multi", + [MPIO_VFD_IDX] = "mpio", [MIRROR_VFD_IDX] = "mirror", [SPLITTER_VFD_IDX] = "splitter", + [ROS3_VFD_IDX] = "ros3", [HDFS_VFD_IDX] = "hdfs", [SUBFILING_VFD_IDX] = H5FD_SUBFILING_NAME, + [ONION_VFD_IDX] = "onion", }; #define NUM_VOLS (sizeof(volnames) / sizeof(volnames[0])) diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index b636806e2e9..b4ace197d7f 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -602,6 +602,8 @@ typedef enum { SPLIT_VFD_IDX, MULTI_VFD_IDX, MPIO_VFD_IDX, + MIRROR_VFD_IDX, + SPLITTER_VFD_IDX, ROS3_VFD_IDX, HDFS_VFD_IDX, SUBFILING_VFD_IDX, diff --git a/tools/libtest/h5tools_test_utils.c b/tools/libtest/h5tools_test_utils.c index 32f109b0caf..369472e8d86 100644 --- a/tools/libtest/h5tools_test_utils.c +++ b/tools/libtest/h5tools_test_utils.c @@ -983,28 +983,28 @@ test_set_configured_fapl(void) "(common) H5P_DEFAULT with no struct should succeed", 1, UTIL_TEST_DEFAULT, - "sec2", + H5_DEFAULT_VFD_NAME, NULL, }, { "(common) H5P_DEFAULT with (ignored) struct should succeed", 1, UTIL_TEST_DEFAULT, - "sec2", + H5_DEFAULT_VFD_NAME, &wrong_fa, }, { "(common) provided fapl entry should not fail", 1, UTIL_TEST_CREATE, - "sec2", + H5_DEFAULT_VFD_NAME, NULL, }, { "(common) provided fapl entry should not fail; ignores struct", 1, UTIL_TEST_CREATE, - "sec2", + H5_DEFAULT_VFD_NAME, &wrong_fa, }, { diff --git a/tools/src/h5jam/h5jam.c b/tools/src/h5jam/h5jam.c index d97d339f98d..f311257e361 100644 --- a/tools/src/h5jam/h5jam.c +++ b/tools/src/h5jam/h5jam.c @@ -245,6 +245,7 @@ main(int argc, char *argv[]) goto done; } + memset(&sbuf, 0, sizeof(h5_stat_t)); res = HDfstat(ufid, &sbuf); if (res < 0) { error_msg("Can't stat file \"%s\"\n", ub_file); @@ -261,6 +262,7 @@ main(int argc, char *argv[]) goto done; } + memset(&sbuf2, 0, sizeof(h5_stat_t)); res = HDfstat(h5fid, &sbuf2); if (res < 0) { error_msg("Can't stat file \"%s\"\n", input_file); @@ -392,6 +394,7 @@ copy_some_to_file(int infid, int outfid, hsize_t starting, hsize_t startout, ssi } /* end if */ if (limit < 0) { + memset(&sbuf, 0, sizeof(h5_stat_t)); res = HDfstat(infid, &sbuf); if (res < 0) { error_msg("Can't stat file \n"); diff --git a/tools/src/h5jam/h5unjam.c b/tools/src/h5jam/h5unjam.c index b2d1e4d8cf0..a93e85120b6 100644 --- a/tools/src/h5jam/h5unjam.c +++ b/tools/src/h5jam/h5unjam.c @@ -241,6 +241,7 @@ main(int argc, char *argv[]) goto done; } + memset(&sbuf, 0, sizeof(h5_stat_t)); res = HDfstat(HDfileno(rawinstream), &sbuf); if (res < 0) { error_msg("Can't stat file \"%s\"\n", input_file); diff --git a/tools/src/h5perf/pio_engine.c b/tools/src/h5perf/pio_engine.c index fc2f0c7d024..8b11f51fc68 100644 --- a/tools/src/h5perf/pio_engine.c +++ b/tools/src/h5perf/pio_engine.c @@ -440,6 +440,7 @@ pio_create_filename(iotype iot, const char *base_name, char *fullname, size_t si * handled below. */ h5_stat_t buf; + memset(&buf, 0, sizeof(h5_stat_t)); if (HDstat(fullname, &buf) < 0) /* The directory doesn't exist just yet */ if (HDmkdir(fullname, (mode_t)0755) < 0 && errno != EEXIST) { diff --git a/tools/src/h5perf/sio_engine.c b/tools/src/h5perf/sio_engine.c index 2363f6a0d99..12305f54a76 100644 --- a/tools/src/h5perf/sio_engine.c +++ b/tools/src/h5perf/sio_engine.c @@ -349,6 +349,7 @@ sio_create_filename(iotype iot, const char *base_name, char *fullname, size_t si * handled below. */ h5_stat_t buf; + memset(&buf, 0, sizeof(h5_stat_t)); if (HDstat(fullname, &buf) < 0) /* The directory doesn't exist just yet */ if (HDmkdir(fullname, 0755) < 0 && errno != EEXIST) { diff --git a/tools/src/misc/h5clear.c b/tools/src/misc/h5clear.c index ea3e07249b1..66931846d76 100644 --- a/tools/src/misc/h5clear.c +++ b/tools/src/misc/h5clear.c @@ -327,6 +327,7 @@ main(int argc, char *argv[]) haddr_t eoa; /* The EOA value */ /* Get the file's EOA and EOF */ + memset(&st, 0, sizeof(h5_stat_t)); if (H5Fget_eoa(fid, &eoa) < 0 || HDstat(fname, &st) < 0) { error_msg("H5Fget_eoa or HDstat\n"); h5tools_setstatus(EXIT_FAILURE); diff --git a/tools/src/misc/h5repart.c b/tools/src/misc/h5repart.c index 12b293273bc..70f53c6d716 100644 --- a/tools/src/misc/h5repart.c +++ b/tools/src/misc/h5repart.c @@ -239,6 +239,7 @@ main(int argc, char *argv[]) exit(EXIT_FAILURE); } + memset(&sb, 0, sizeof(h5_stat_t)); if (HDfstat(src, &sb) < 0) { perror("fstat"); exit(EXIT_FAILURE); @@ -358,6 +359,7 @@ main(int argc, char *argv[]) perror(src_name); exit(EXIT_FAILURE); } + memset(&sb, 0, sizeof(h5_stat_t)); if (HDfstat(src, &sb) < 0) { perror("fstat"); exit(EXIT_FAILURE); diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 46e0f997707..bf0bfd4a251 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -10689,19 +10689,19 @@ gent_compound_complex2(void) { /* Third-level nested compound */ typedef struct { - short deep_nested_short[10]; - int deep_nested_int[10]; - long deep_nested_long[10]; - double deep_nested_double[10]; - float deep_nested_float[10]; + int16_t deep_nested_short[10]; + int32_t deep_nested_int[10]; + int64_t deep_nested_long[10]; + double deep_nested_double[10]; + float deep_nested_float[10]; } third_level_compound; /* Second-level multiply-nested compounds */ typedef struct { - unsigned int multiple_nested_a[5]; - int multiple_nested_b[5]; - unsigned long multiple_nested_c[5]; - long multiple_nested_d[5]; + uint32_t multiple_nested_a[5]; + int32_t multiple_nested_b[5]; + uint64_t multiple_nested_c[5]; + int64_t multiple_nested_d[5]; } further_nested; typedef struct { @@ -10727,8 +10727,8 @@ gent_compound_complex2(void) /* Compound datatype with different member types */ typedef struct { /* Arrays nested inside compound */ - unsigned int a[4]; - int b[6]; + uint32_t a[4]; + int32_t b[6]; float c[2][4]; nested_compound d; /* Compound inside compound */ multiple_nested_compound e; /* Compound inside compound with further nested compound */ diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c index b414f644281..f3b84c4d1fd 100644 --- a/tools/test/h5repack/h5repacktst.c +++ b/tools/test/h5repack/h5repacktst.c @@ -1694,6 +1694,7 @@ main(void) GOERROR; if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) GOERROR; + memset(&file_stat, 0, sizeof(h5_stat_t)); if (HDstat(FNAME4OUT, &file_stat) < 0) GOERROR; fsize1 = file_stat.st_size; @@ -1711,6 +1712,7 @@ main(void) if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0) GOERROR; /* record the file size of the output file */ + memset(&file_stat, 0, sizeof(h5_stat_t)); if (HDstat(FNAME4OUT, &file_stat) < 0) GOERROR; fsize2 = file_stat.st_size; diff --git a/tools/test/perform/overhead.c b/tools/test/perform/overhead.c index 00a35bbfb7c..ecdecb34d54 100644 --- a/tools/test/perform/overhead.c +++ b/tools/test/perform/overhead.c @@ -231,6 +231,7 @@ test(fill_t fill_style, const double splits[], bool verbose, bool use_rdcc) if (verbose) { if (H5Fflush(file, H5F_SCOPE_LOCAL) < 0) goto error; + memset(&sb, 0, sizeof(h5_stat_t)); if (HDfstat(fd, &sb) < 0) goto error; printf("%4lu %8.3f ***\n", (unsigned long)i, @@ -276,6 +277,7 @@ test(fill_t fill_style, const double splits[], bool verbose, bool use_rdcc) break; } + memset(&sb, 0, sizeof(h5_stat_t)); if (HDfstat(fd, &sb) < 0) goto error; printf("%-7s %8.3f\n", sname, diff --git a/tools/test/perform/zip_perf.c b/tools/test/perform/zip_perf.c index 063c1658795..76e455f4ab5 100644 --- a/tools/test/perform/zip_perf.c +++ b/tools/test/perform/zip_perf.c @@ -308,6 +308,7 @@ fill_with_random_data(Bytef *src, uLongf src_len) unsigned u; h5_stat_t stat_buf; + memset(&stat_buf, 0, sizeof(h5_stat_t)); if (HDstat("/dev/urandom", &stat_buf) == 0) { uLongf len = src_len; Bytef *buf = src; diff --git a/utils/test/swmr_check_compat_vfd.c b/utils/test/swmr_check_compat_vfd.c index b5cfb1ba35c..eeaae726f47 100644 --- a/utils/test/swmr_check_compat_vfd.c +++ b/utils/test/swmr_check_compat_vfd.c @@ -10,8 +10,9 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Purpose: This is a small program that checks if the HDF5_DRIVER - * environment variable is set to a value that supports SWMR. +/* Purpose: This is a small program that checks if the HDF5_DRIVER or + * HDF5_TEST_DRIVER environment variable is set to a value that + * supports SWMR. * * It is intended for use in shell scripts. */ @@ -26,9 +27,9 @@ /*------------------------------------------------------------------------- * Function: main * - * Purpose: Inspects the HDF5_DRIVER environment variable, which - * determines the VFD that the test harness will use with - * the majority of the tests. + * Purpose: Inspects the HDF5_DRIVER and HDF5_TEST_DRIVER environment + * variables, which determines the VFD that the test harness + * will use with the majority of the tests. * * Return: VFD supports SWMR: EXIT_SUCCESS * @@ -43,6 +44,8 @@ main(void) char *driver = NULL; driver = getenv(HDF5_DRIVER); + if (!driver) + driver = getenv("HDF5_TEST_DRIVER"); if (H5FD__supports_swmr_test(driver)) return EXIT_SUCCESS; diff --git a/utils/tools/h5dwalk/h5dwalk.c b/utils/tools/h5dwalk/h5dwalk.c index f994a9080bb..58d7463d959 100644 --- a/utils/tools/h5dwalk/h5dwalk.c +++ b/utils/tools/h5dwalk/h5dwalk.c @@ -766,6 +766,7 @@ fill_file_list(mfu_flist new_flist, const char *config_filename, int myrank, int char *eol = strchr(linebuf, '\n'); if (eol) *eol = '\0'; + memset(&statbuf, 0, sizeof(h5_stat_t)); if (HDstat(linebuf, &statbuf) == 0) { if (myrank == (index % size)) { mfu_flist_insert_stat((flist_t *)new_flist, linebuf, O_RDONLY, &statbuf);