diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 00000000000..42fd9a7b4c1 --- /dev/null +++ b/.codespellrc @@ -0,0 +1,6 @@ +# Ref: https://github.com/codespell-project/codespell#using-a-config-file +[codespell] +skip = .git,*.svg,.codespellrc,./bin/trace,./hl/tools/h5watch/h5watch.c,./tools/test/h5jam/tellub.c,./config/sanitizer/LICENSE,./config/sanitizer/sanitizers.cmake,./tools/test/h5repack/testfiles/*.dat,./test/API/driver,./configure,./bin/ltmain.sh,./bin/depcomp,./bin/config.guess,./bin/config.sub,./autom4te.cache,./m4/libtool.m4,./c++/src/*.html,./HDF5Examples/depcomp +check-hidden = true +# ignore-regex = +ignore-words-list = ot,isnt,inout,nd,parms,parm,ba,offsetP,ser,ois,had,fiter,fo,clude,refere,minnum,offsetp,creat,ans:,eiter,lastr,ans,isn't,ifset,sur,trun,dne,tthe,hda,filname,te,htmp,ake,gord,numer,ro,oce,msdos diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000000..8b942f5b6e9 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,5 @@ +FROM mcr.microsoft.com/devcontainers/base:debian + +RUN apt-get update && apt-get -y install --no-install-recommends \ + build-essential cmake cmake-curses-gui doxygen git graphviz \ + less libtool-bin libyajl-dev mpi-default-dev valgrind wget \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000000..5e78e038a21 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,26 @@ +{ + "name": "HDF5 Developer", + "build": { + "context": "..", + "dockerfile": "Dockerfile" + }, + "customizations": { + "vscode": { + "extensions": [ + "ms-python.python", + "ms-toolsai.jupyter", + "ms-vscode.cpptools", + "ms-vscode.live-server", + "ms-vscode-remote.remote-containers", + "ms-azuretools.vscode-docker", + "h5web.vscode-h5web", + "davidanson.vscode-markdownlint" + ], + "settings": { + "C_Cpp.default.cppStandard": "c++17", + "C_Cpp.default.cStandard": "c99", + "terminal.integrated.shell.linux": "/bin/bash" + } + } + } +} diff --git a/.devcontainer/noop.txt b/.devcontainer/noop.txt new file mode 100644 index 00000000000..4682d3af0fc --- /dev/null +++ b/.devcontainer/noop.txt @@ -0,0 +1,3 @@ +This file is copied into the container along with environment.yml* from the +parent folder. This file prevents the Dockerfile COPY instruction from failing +if no environment.yml is found. \ No newline at end of file diff --git a/.github/workflows/abi-report.yml b/.github/workflows/abi-report.yml new file mode 100644 index 00000000000..38cb3820a66 --- /dev/null +++ b/.github/workflows/abi-report.yml @@ -0,0 +1,181 @@ +name: hdf5 Check Application Binary Interface (ABI) + +on: + workflow_call: + inputs: + use_tag: + description: 'Release version tag' + type: string + required: false + default: snapshot + use_environ: + description: 'Environment to locate files' + type: string + required: true + default: snapshots + file_base: + description: "The common base name of the binary" + required: true + type: string + file_ref: + description: "The reference name for the release binary" + required: true + type: string + +permissions: + contents: read + +jobs: + check: + runs-on: ubuntu-latest + continue-on-error: true + + steps: + - name: Install System dependencies + run: | + sudo apt update + sudo apt install -q -y abi-compliance-checker abi-dumper + sudo apt install -q -y japi-compliance-checker + + - name: Convert hdf5 reference name (Linux) + id: convert-hdf5lib-refname + run: | + FILE_DOTS=$(echo "${{ inputs.file_ref }}" | sed -r "s/([0-9]+)\_([0-9]+)\_([0-9]+).*/\1\.\2\.\3/") + echo "HDF5R_DOTS=$FILE_DOTS" >> $GITHUB_OUTPUT + + - uses: actions/checkout@v4.1.1 + + - name: Get published binary (Linux) + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + with: + name: tgz-ubuntu-2204_gcc-binary + path: ${{ github.workspace }} + + - name: List files for the space (Linux) + run: | + ls -l ${{ github.workspace }} + + - name: Uncompress gh binary (Linux) + run: tar -zxvf ${{ github.workspace }}/${{ inputs.file_base }}-ubuntu-2204_gcc.tar.gz + + - name: Uncompress hdf5 binary (Linux) + run: | + cd "${{ github.workspace }}/hdf5" + tar -zxvf ${{ github.workspace }}/hdf5/HDF5-*-Linux.tar.gz --strip-components 1 + + - name: List files for the HDF space (Linux) + run: | + ls -l ${{ github.workspace }}/hdf5 + ls -l ${{ github.workspace }}/hdf5/HDF_Group/HDF5 + + - name: set hdf5lib name + id: set-hdf5lib-name + run: | + HDF5DIR=${{ github.workspace }}/hdf5/HDF_Group/HDF5/ + FILE_NAME_HDF5=$(ls ${{ github.workspace }}/hdf5/HDF_Group/HDF5) + FILE_VERS=$(echo "$FILE_NAME_HDF5" | sed -r "s/([0-9]+\.[0-9]+\.[0-9]+).*/\1/") + echo "HDF5_ROOT=$HDF5DIR$FILE_NAME_HDF5" >> $GITHUB_OUTPUT + echo "HDF5_VERS=$FILE_VERS" >> $GITHUB_OUTPUT + + - name: Download reference version + run: | + mkdir "${{ github.workspace }}/hdf5R" + cd "${{ github.workspace }}/hdf5R" + wget -q https://github.com/HDFGroup/hdf5/releases/download/hdf5-${{ inputs.file_ref }}/hdf5-${{ inputs.file_ref }}-ubuntu-2204.tar.gz + tar zxf hdf5-${{ inputs.file_ref }}-ubuntu-2204.tar.gz + + - name: List files for the space (Linux) + run: | + ls -l ${{ github.workspace }}/hdf5R + + - name: Uncompress hdf5 reference binary (Linux) + run: | + cd "${{ github.workspace }}/hdf5R" + tar -zxvf ${{ github.workspace }}/hdf5R/hdf5/HDF5-${{ steps.convert-hdf5lib-refname.outputs.HDF5R_DOTS }}-Linux.tar.gz --strip-components 1 + + - name: List files for the HDFR space (Linux) + run: | + ls -l ${{ github.workspace }}/hdf5R + ls -l ${{ github.workspace }}/hdf5R/HDF_Group/HDF5 + + - name: set hdf5lib reference name + id: set-hdf5lib-refname + run: | + HDF5RDIR=${{ github.workspace }}/hdf5R/HDF_Group/HDF5/ + FILE_NAME_HDF5R=$(ls ${{ github.workspace }}/hdf5R/HDF_Group/HDF5) + echo "HDF5R_ROOT=$HDF5RDIR$FILE_NAME_HDF5R" >> $GITHUB_OUTPUT + echo "HDF5R_VERS=$FILE_NAME_HDF5R" >> $GITHUB_OUTPUT + + - name: List files for the lib spaces (Linux) + run: | + ls -l ${{ steps.set-hdf5lib-name.outputs.HDF5_ROOT }}/lib + ls -l ${{ steps.set-hdf5lib-refname.outputs.HDF5R_ROOT }}/lib + + - name: Run Java API report + run: | + japi-compliance-checker ${{ steps.set-hdf5lib-refname.outputs.HDF5R_ROOT }}/lib/jarhdf5-${{ steps.convert-hdf5lib-refname.outputs.HDF5R_DOTS }}.jar ${{ steps.set-hdf5lib-name.outputs.HDF5_ROOT }}/lib/jarhdf5-${{ steps.set-hdf5lib-name.outputs.HDF5_VERS }}.jar + + - name: Run ABI report + run: | + abi-dumper ${{ steps.set-hdf5lib-refname.outputs.HDF5R_ROOT }}/lib/libhdf5.so -o ABI-0.dump -public-headers ${{ steps.set-hdf5lib-refname.outputs.HDF5R_ROOT }}/include + abi-dumper ${{ steps.set-hdf5lib-name.outputs.HDF5_ROOT }}/lib/libhdf5.so -o ABI-1.dump -public-headers ${{ steps.set-hdf5lib-name.outputs.HDF5_ROOT }}/include + abi-compliance-checker -l ${{ inputs.file_base }} -old ABI-0.dump -new ABI-1.dump + continue-on-error: true + + - name: Run hl ABI report + run: | + abi-dumper ${{ steps.set-hdf5lib-refname.outputs.HDF5R_ROOT }}/lib/libhdf5_hl.so -o ABI-2.dump -public-headers ${{ steps.set-hdf5lib-refname.outputs.HDF5R_ROOT }}/include + abi-dumper ${{ steps.set-hdf5lib-name.outputs.HDF5_ROOT }}/lib/libhdf5_hl.so -o ABI-3.dump -public-headers ${{ steps.set-hdf5lib-name.outputs.HDF5_ROOT }}/include + abi-compliance-checker -l ${{ inputs.file_base }}_hl -old ABI-2.dump -new ABI-3.dump + continue-on-error: true + + - name: Run cpp ABI report + run: | + abi-dumper ${{ steps.set-hdf5lib-refname.outputs.HDF5R_ROOT }}/lib/libhdf5_cpp.so -o ABI-4.dump -public-headers ${{ steps.set-hdf5lib-refname.outputs.HDF5R_ROOT }}/include + abi-dumper ${{ steps.set-hdf5lib-name.outputs.HDF5_ROOT }}/lib/libhdf5_cpp.so -o ABI-5.dump -public-headers ${{ steps.set-hdf5lib-name.outputs.HDF5_ROOT }}/include + abi-compliance-checker -l ${{ inputs.file_base }}_cpp -old ABI-4.dump -new ABI-5.dump + continue-on-error: true + + - name: Run hl_cpp ABI report + run: | + abi-dumper ${{ steps.set-hdf5lib-refname.outputs.HDF5R_ROOT }}/lib/libhdf5_hl_cpp.so -o ABI-6.dump -public-headers ${{ steps.set-hdf5lib-refname.outputs.HDF5R_ROOT }}/include + abi-dumper ${{ steps.set-hdf5lib-name.outputs.HDF5_ROOT }}/lib/libhdf5_hl_cpp.so -o ABI-7.dump -public-headers ${{ steps.set-hdf5lib-name.outputs.HDF5_ROOT }}/include + abi-compliance-checker -l ${{ inputs.file_base }}_hl_cpp -old ABI-6.dump -new ABI-7.dump + continue-on-error: true + + - name: Copy ABI reports + run: | + cp compat_reports/jarhdf5-/${{ steps.set-hdf5lib-refname.outputs.HDF5R_VERS }}_to_${{ steps.set-hdf5lib-name.outputs.HDF5_VERS }}/compat_report.html ${{ inputs.file_base }}-java_compat_report.html + ls -l compat_reports/${{ inputs.file_base }}/X_to_Y + cp compat_reports/${{ inputs.file_base }}/X_to_Y/compat_report.html ${{ inputs.file_base }}-hdf5_compat_report.html + ls -l compat_reports/${{ inputs.file_base }}_hl/X_to_Y + cp compat_reports/${{ inputs.file_base }}_hl/X_to_Y/compat_report.html ${{ inputs.file_base }}-hdf5_hl_compat_report.html + ls -l compat_reports/${{ inputs.file_base }}_cpp/X_to_Y + cp compat_reports/${{ inputs.file_base }}_cpp/X_to_Y/compat_report.html ${{ inputs.file_base }}-hdf5_cpp_compat_report.html +# ls -l compat_reports/${{ inputs.file_base }}_hl_cpp/X_to_Y +# cp compat_reports/${{ inputs.file_base }}_hl_cpp/X_to_Y/compat_report.html ${{ inputs.file_base }}-hdf5_hl_cpp_compat_report.html + + - name: List files for the report spaces (Linux) + run: | + ls -l compat_reports + ls -l *.html + + - name: Publish ABI reports + id: publish-abi-reports + run: | + mkdir "${{ runner.workspace }}/buildabi" + mkdir "${{ runner.workspace }}/buildabi/hdf5" + cp ${{ inputs.file_base }}-hdf5_compat_report.html ${{ runner.workspace }}/buildabi/hdf5 + cp ${{ inputs.file_base }}-hdf5_hl_compat_report.html ${{ runner.workspace }}/buildabi/hdf5 + 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 + shell: bash + + - name: Save output as artifact + uses: actions/upload-artifact@v4 + with: + name: abi-reports + path: | + ${{ runner.workspace }}/buildabi/${{ inputs.file_base }}.html.abi.reports diff --git a/.github/workflows/autotools.yml b/.github/workflows/autotools.yml index d0cf5577738..4075b259d79 100644 --- a/.github/workflows/autotools.yml +++ b/.github/workflows/autotools.yml @@ -17,7 +17,19 @@ jobs: call-parallel-special-autotools: name: "Autotools Parallel Special Workflows" + uses: ./.github/workflows/main-auto-par-spc.yml + + call-debug-parallel-autotools: + name: "Autotools Parallel Workflows" uses: ./.github/workflows/main-auto-par.yml + with: + build_mode: "debug" + + call-release-parallel-autotools: + name: "Autotools Parallel Workflows" + uses: ./.github/workflows/main-auto-par.yml + with: + build_mode: "production" call-debug-thread-autotools: name: "Autotools Debug Thread-Safety Workflows" diff --git a/.github/workflows/clang-format-fix.yml b/.github/workflows/clang-format-fix.yml index 80befa2ea8d..a27db184ad9 100644 --- a/.github/workflows/clang-format-fix.yml +++ b/.github/workflows/clang-format-fix.yml @@ -31,7 +31,7 @@ jobs: inplace: True style: file exclude: './config ./hl/src/H5LTanalyze.c ./hl/src/H5LTparse.c ./hl/src/H5LTparse.h ./src/H5Epubgen.h ./src/H5Einit.h ./src/H5Eterm.h ./src/H5Edefin.h ./src/H5version.h ./src/H5overflow.h' - - uses: EndBug/add-and-commit@1bad3abcf0d6ec49a5857d124b0bfb52dc7bb081 # v9.1.3 + - uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4 with: author_name: github-actions author_email: 41898282+github-actions[bot]@users.noreply.github.com diff --git a/.github/workflows/cmake-bintest.yml b/.github/workflows/cmake-bintest.yml new file mode 100644 index 00000000000..6c1506f9719 --- /dev/null +++ b/.github/workflows/cmake-bintest.yml @@ -0,0 +1,218 @@ +name: hdf5 examples bintest runs + +# Controls when the action will run. Triggers the workflow on a schedule +on: + workflow_call: + inputs: + build_mode: + description: "release vs. debug build" + required: true + type: string + +permissions: + contents: read + +# A workflow run is made up of one or more jobs that can run sequentially or +# in parallel +jobs: + test_binary_win: + # Windows w/ MSVC + CMake + # + name: "Windows MSVC Binary Test" + runs-on: windows-latest + steps: + - name: Install Dependencies (Windows) + run: choco install ninja + + - name: Set up JDK 19 + uses: actions/setup-java@v4 + with: + java-version: '19' + distribution: 'temurin' + + - name: Enable Developer Command Prompt + uses: ilammy/msvc-dev-cmd@v1.13.0 + + # Get files created by cmake-ctest script + - name: Get published binary (Windows) + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + with: + name: zip-vs2022_cl-${{ inputs.build_mode }}-binary + path: ${{ github.workspace }}/hdf5 + + - name: Uncompress hdf5 binary (Win) + working-directory: ${{ github.workspace }}/hdf5 + run: 7z x HDF5-*-win64.zip + shell: bash + + - name: List files for the space (Win) + run: | + ls -l ${{ github.workspace }} + ls -l ${{ github.workspace }}/hdf5 + + - name: create hdf5 location (Win) + working-directory: ${{ github.workspace }}/hdf5 + run: | + New-Item -Path "${{ github.workspace }}/HDF_Group/HDF5" -ItemType Directory + Copy-Item -Path "${{ github.workspace }}/hdf5/HDF*/*" -Destination "${{ github.workspace }}/HDF_Group/HDF5" -Recurse + shell: pwsh + + - name: List files for the space (Win) + run: ls -l ${{ github.workspace }}/HDF_Group/HDF5 + + - name: set hdf5lib name + id: set-hdf5lib-name + run: | + HDF5DIR="${{ github.workspace }}/HDF_Group/HDF5" + echo "HDF5_ROOT=$HDF5DIR$FILE_NAME_HDF5" >> $GITHUB_OUTPUT + echo "HDF5_PLUGIN_PATH=$HDF5_ROOT/lib/plugin" >> $GITHUB_OUTPUT + shell: bash + + - name: List files for the binaries (Win) + run: | + ls -l ${{ github.workspace }}/HDF_Group/HDF5 + + - name: using powershell + shell: pwsh + run: Get-Location + + - name: List files for the space (Windows) + run: | + Get-ChildItem -Path ${{ github.workspace }} + Get-ChildItem -Path ${{ runner.workspace }} + shell: pwsh + + - name: Run ctest (Windows) + env: + HDF5_ROOT: ${{ steps.set-hdf5lib-name.outputs.HDF5_ROOT }} + HDF5_PLUGIN_PATH: ${{ steps.set-hdf5lib-name.outputs.HDF5_PLUGIN_PATH }} + run: | + cd "${{ steps.set-hdf5lib-name.outputs.HDF5_ROOT }}/HDF5Examples" + cmake --workflow --preset=ci-StdShar-MSVC --fresh + shell: bash + + test_binary_linux: + # Linux (Ubuntu) w/ gcc + CMake + # + name: "Ubuntu gcc Binary Test" + runs-on: ubuntu-latest + steps: + - name: Install CMake Dependencies (Linux) + run: sudo apt-get install ninja-build doxygen graphviz + + - name: Set up JDK 19 + uses: actions/setup-java@v4 + with: + java-version: '19' + distribution: 'temurin' + + - name: Get published binary (Linux) + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + with: + name: tgz-ubuntu-2204_gcc-${{ inputs.build_mode }}-binary + path: ${{ github.workspace }} + + - name: Uncompress hdf5 binary (Linux) + run: | + cd "${{ github.workspace }}" + tar -zxvf ${{ github.workspace }}/HDF5-*-Linux.tar.gz --strip-components 1 + + - name: set hdf5lib name + id: set-hdf5lib-name + run: | + HDF5DIR=${{ github.workspace }}/HDF_Group/HDF5/ + FILE_NAME_HDF5=$(ls ${{ github.workspace }}/HDF_Group/HDF5) + echo "HDF5_ROOT=$HDF5DIR$FILE_NAME_HDF5" >> $GITHUB_OUTPUT + echo "HDF5_PLUGIN_PATH=$HDF5_ROOT/lib/plugin" >> $GITHUB_OUTPUT + + - name: List files for the binaries (Linux) + 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 }} + ls ${{ runner.workspace }} + + - name: Run ctest (Linux) + env: + HDF5_ROOT: ${{ steps.set-hdf5lib-name.outputs.HDF5_ROOT }} + HDF5_PLUGIN_PATH: ${{ steps.set-hdf5lib-name.outputs.HDF5_PLUGIN_PATH }} + run: | + cd "${{ steps.set-hdf5lib-name.outputs.HDF5_ROOT }}/share/HDF5Examples" + cmake --workflow --preset=ci-StdShar-GNUC --fresh + shell: bash + + test_binary_mac: + # MacOS w/ Clang + CMake + # + name: "MacOS Clang Binary Test" + runs-on: macos-13 + steps: + - name: Install Dependencies (MacOS) + run: brew install ninja doxygen + + - name: Set up JDK 19 + uses: actions/setup-java@v4 + with: + java-version: '19' + distribution: 'temurin' + + - name: Get published binary (MacOS) + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + with: + name: tgz-osx12-${{ inputs.build_mode }}-binary + path: ${{ github.workspace }} + + - name: Uncompress hdf5 binary (MacOS) + run: | + cd "${{ github.workspace }}" + tar -zxvf ${{ github.workspace }}/HDF5-*-Darwin.tar.gz --strip-components 1 + + - name: set hdf5lib name + id: set-hdf5lib-name + run: | + HDF5DIR=${{ github.workspace }}/HDF_Group/HDF5/ + FILE_NAME_HDF5=$(ls ${{ github.workspace }}/HDF_Group/HDF5) + echo "HDF5_ROOT=$HDF5DIR$FILE_NAME_HDF5" >> $GITHUB_OUTPUT + echo "HDF5_PLUGIN_PATH=$HDF5_ROOT/lib/plugin" >> $GITHUB_OUTPUT + + - name: List files for the binaries (MacOS) + 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 }} + ls ${{ runner.workspace }} + + # symlinks the compiler executables to a common location + - name: Setup GNU Fortran + uses: fortran-lang/setup-fortran@v1 + id: setup-fortran + with: + compiler: gcc + version: 12 + + - name: Run ctest (MacOS) + id: run-ctest + env: + HDF5_ROOT: ${{ steps.set-hdf5lib-name.outputs.HDF5_ROOT }} + HDF5_PLUGIN_PATH: ${{ steps.set-hdf5lib-name.outputs.HDF5_PLUGIN_PATH }} + run: | + cd "${{ steps.set-hdf5lib-name.outputs.HDF5_ROOT }}/share/HDF5Examples" + cmake --workflow --preset=ci-StdShar-OSX-Clang --fresh + shell: bash + diff --git a/.github/workflows/cmake-ctest.yml b/.github/workflows/cmake-ctest.yml index aa13922da64..894416cd598 100644 --- a/.github/workflows/cmake-ctest.yml +++ b/.github/workflows/cmake-ctest.yml @@ -8,6 +8,15 @@ on: description: "The common base name of the source tarballs" required: true type: string + preset_name: + description: "The common base name of the preset configuration name to control the build" + required: true + type: string + use_environ: + description: 'Environment to locate files' + type: string + required: true + default: snapshots permissions: contents: read @@ -24,6 +33,11 @@ jobs: - name: Install Dependencies (Windows) run: choco install ninja + - name: Install Dependencies + uses: ssciwr/doxygen-install@v1 + with: + version: "1.10.0" + - name: Enable Developer Command Prompt uses: ilammy/msvc-dev-cmd@v1.13.0 @@ -32,11 +46,18 @@ jobs: run: | FILE_NAME_BASE=$(echo "${{ inputs.file_base }}") echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT + if [[ '${{ inputs.use_environ }}' == 'snapshots' ]] + then + SOURCE_NAME_BASE=$(echo "hdfsrc") + else + SOURCE_NAME_BASE=$(echo "$FILE_NAME_BASE") + fi + echo "SOURCE_BASE=$SOURCE_NAME_BASE" >> $GITHUB_OUTPUT shell: bash # Get files created by release script - name: Get zip-tarball (Windows) - uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: zip-tarball path: ${{ github.workspace }} @@ -58,8 +79,8 @@ jobs: - name: Run ctest (Windows) run: | - cd "${{ runner.workspace }}/hdf5/hdfsrc" - cmake --workflow --preset=ci-StdShar-MSVC --fresh + cd "${{ runner.workspace }}/hdf5/${{ steps.set-file-base.outputs.SOURCE_BASE }}" + cmake --workflow --preset=${{ inputs.preset_name }}-MSVC --fresh shell: bash - name: Publish binary (Windows) @@ -67,10 +88,10 @@ jobs: run: | mkdir "${{ runner.workspace }}/build" mkdir "${{ runner.workspace }}/build/hdf5" - Copy-Item -Path ${{ runner.workspace }}/hdf5/hdfsrc/COPYING -Destination ${{ runner.workspace }}/build/hdf5/ - Copy-Item -Path ${{ runner.workspace }}/hdf5/hdfsrc/COPYING_LBNL_HDF5 -Destination ${{ runner.workspace }}/build/hdf5/ - Copy-Item -Path ${{ runner.workspace }}/hdf5/hdfsrc/README.md -Destination ${{ runner.workspace }}/build/hdf5/ - Copy-Item -Path ${{ runner.workspace }}/hdf5/build/ci-StdShar-MSVC/* -Destination ${{ runner.workspace }}/build/hdf5/ -Include *.zip + Copy-Item -Path ${{ runner.workspace }}/hdf5/${{ steps.set-file-base.outputs.SOURCE_BASE }}/COPYING -Destination ${{ runner.workspace }}/build/hdf5/ + Copy-Item -Path ${{ runner.workspace }}/hdf5/${{ steps.set-file-base.outputs.SOURCE_BASE }}/COPYING_LBNL_HDF5 -Destination ${{ runner.workspace }}/build/hdf5/ + Copy-Item -Path ${{ runner.workspace }}/hdf5/build/${{ inputs.preset_name }}-MSVC/README.md -Destination ${{ runner.workspace }}/build/hdf5/ + Copy-Item -Path ${{ runner.workspace }}/hdf5/build/${{ inputs.preset_name }}-MSVC/* -Destination ${{ runner.workspace }}/build/hdf5/ -Include *.zip cd "${{ runner.workspace }}/build" 7z a -tzip ${{ steps.set-file-base.outputs.FILE_BASE }}-win-vs2022_cl.zip hdf5 shell: pwsh @@ -96,17 +117,29 @@ jobs: runs-on: ubuntu-latest steps: - name: Install CMake Dependencies (Linux) - run: sudo apt-get install ninja-build doxygen graphviz + run: sudo apt-get install ninja-build graphviz + + - name: Install Dependencies + uses: ssciwr/doxygen-install@v1 + with: + version: "1.10.0" - 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 + if [[ '${{ inputs.use_environ }}' == 'snapshots' ]] + then + SOURCE_NAME_BASE=$(echo "hdfsrc") + else + SOURCE_NAME_BASE=$(echo "$FILE_NAME_BASE") + fi + echo "SOURCE_BASE=$SOURCE_NAME_BASE" >> $GITHUB_OUTPUT # Get files created by release script - name: Get tgz-tarball (Linux) - uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: tgz-tarball path: ${{ github.workspace }} @@ -121,8 +154,8 @@ jobs: - name: Run ctest (Linux) run: | - cd "${{ runner.workspace }}/hdf5/hdfsrc" - cmake --workflow --preset=ci-StdShar-GNUC --fresh + cd "${{ runner.workspace }}/hdf5/${{ steps.set-file-base.outputs.SOURCE_BASE }}" + cmake --workflow --preset=${{ inputs.preset_name }}-GNUC --fresh shell: bash - name: Publish binary (Linux) @@ -130,14 +163,40 @@ jobs: run: | mkdir "${{ runner.workspace }}/build" mkdir "${{ runner.workspace }}/build/hdf5" - cp ${{ runner.workspace }}/hdf5/hdfsrc/COPYING ${{ runner.workspace }}/build/hdf5 - cp ${{ runner.workspace }}/hdf5/hdfsrc/COPYING_LBNL_HDF5 ${{ runner.workspace }}/build/hdf5 - cp ${{ runner.workspace }}/hdf5/hdfsrc/README.md ${{ runner.workspace }}/build/hdf5 - cp ${{ runner.workspace }}/hdf5/build/ci-StdShar-GNUC/*.tar.gz ${{ runner.workspace }}/build/hdf5 + cp ${{ runner.workspace }}/hdf5/${{ steps.set-file-base.outputs.SOURCE_BASE }}/COPYING ${{ runner.workspace }}/build/hdf5 + cp ${{ runner.workspace }}/hdf5/${{ steps.set-file-base.outputs.SOURCE_BASE }}/COPYING_LBNL_HDF5 ${{ runner.workspace }}/build/hdf5 + cp ${{ runner.workspace }}/hdf5/build/${{ inputs.preset_name }}-GNUC/README.md ${{ runner.workspace }}/build/hdf5 + cp ${{ runner.workspace }}/hdf5/build/${{ inputs.preset_name }}-GNUC/*.tar.gz ${{ runner.workspace }}/build/hdf5 cd "${{ runner.workspace }}/build" tar -zcvf ${{ steps.set-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.tar.gz hdf5 shell: bash + - name: Publish deb binary (Linux) + id: publish-ctest-deb-binary + run: | + mkdir "${{ runner.workspace }}/builddeb" + mkdir "${{ runner.workspace }}/builddeb/hdf5" + cp ${{ runner.workspace }}/hdf5/${{ steps.set-file-base.outputs.SOURCE_BASE }}/COPYING ${{ runner.workspace }}/builddeb/hdf5 + cp ${{ runner.workspace }}/hdf5/${{ steps.set-file-base.outputs.SOURCE_BASE }}/COPYING_LBNL_HDF5 ${{ runner.workspace }}/builddeb/hdf5 + cp ${{ runner.workspace }}/hdf5/build/${{ inputs.preset_name }}-GNUC/README.md ${{ runner.workspace }}/builddeb/hdf5 + cp ${{ runner.workspace }}/hdf5/build/${{ inputs.preset_name }}-GNUC/*.deb ${{ runner.workspace }}/builddeb/hdf5 + cd "${{ runner.workspace }}/builddeb" + tar -zcvf ${{ steps.set-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.deb hdf5 + shell: bash + + - name: Publish rpm binary (Linux) + id: publish-ctest-rpm-binary + run: | + mkdir "${{ runner.workspace }}/buildrpm" + mkdir "${{ runner.workspace }}/buildrpm/hdf5" + cp ${{ runner.workspace }}/hdf5/${{ steps.set-file-base.outputs.SOURCE_BASE }}/COPYING ${{ runner.workspace }}/buildrpm/hdf5 + cp ${{ runner.workspace }}/hdf5/${{ steps.set-file-base.outputs.SOURCE_BASE }}/COPYING_LBNL_HDF5 ${{ runner.workspace }}/buildrpm/hdf5 + cp ${{ runner.workspace }}/hdf5/build/${{ inputs.preset_name }}-GNUC/README.md ${{ runner.workspace }}/buildrpm/hdf5 + cp ${{ runner.workspace }}/hdf5/build/${{ inputs.preset_name }}-GNUC/*.rpm ${{ runner.workspace }}/buildrpm/hdf5 + cd "${{ runner.workspace }}/buildrpm" + tar -zcvf ${{ steps.set-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.rpm hdf5 + shell: bash + - name: List files in the space (Linux) run: | ls ${{ github.workspace }} @@ -151,32 +210,60 @@ jobs: path: ${{ runner.workspace }}/build/${{ steps.set-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.tar.gz if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` + # Save files created by ctest script + - name: Save published binary deb (Linux) + uses: actions/upload-artifact@v4 + with: + name: deb-ubuntu-2204_gcc-binary + path: ${{ runner.workspace }}/builddeb/${{ steps.set-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.deb + if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` + + # Save files created by ctest script + - name: Save published binary rpm (Linux) + uses: actions/upload-artifact@v4 + with: + name: rpm-ubuntu-2204_gcc-binary + path: ${{ runner.workspace }}/buildrpm/${{ steps.set-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.rpm + if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` + # Save doxygen files created by ctest script - name: Save published doxygen (Linux) uses: actions/upload-artifact@v4 with: name: docs-doxygen - path: ${{ runner.workspace }}/hdf5/build/ci-StdShar-GNUC/hdf5lib_docs/html + path: ${{ runner.workspace }}/hdf5/build/${{ inputs.preset_name }}-GNUC/hdf5lib_docs/html if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` build_and_test_mac: # MacOS w/ Clang + CMake # name: "MacOS Clang CMake" - runs-on: macos-11 + runs-on: macos-13 steps: - name: Install Dependencies (MacOS) - run: brew install ninja doxygen + run: brew install ninja + + - name: Install Dependencies + uses: ssciwr/doxygen-install@v1 + with: + version: "1.10.0" - 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 + if [[ '${{ inputs.use_environ }}' == 'snapshots' ]] + then + SOURCE_NAME_BASE=$(echo "hdfsrc") + else + SOURCE_NAME_BASE=$(echo "$FILE_NAME_BASE") + fi + echo "SOURCE_BASE=$SOURCE_NAME_BASE" >> $GITHUB_OUTPUT # Get files created by release script - name: Get tgz-tarball (MacOS) - uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: tgz-tarball path: ${{ github.workspace }} @@ -200,8 +287,8 @@ jobs: - name: Run ctest (MacOS) id: run-ctest run: | - cd "${{ runner.workspace }}/hdf5/hdfsrc" - cmake --workflow --preset=ci-StdShar-Clang --fresh + cd "${{ runner.workspace }}/hdf5/${{ steps.set-file-base.outputs.SOURCE_BASE }}" + cmake --workflow --preset=${{ inputs.preset_name }}-OSX-Clang --fresh shell: bash - name: Publish binary (MacOS) @@ -209,10 +296,10 @@ jobs: run: | mkdir "${{ runner.workspace }}/build" mkdir "${{ runner.workspace }}/build/hdf5" - cp ${{ runner.workspace }}/hdf5/hdfsrc/COPYING ${{ runner.workspace }}/build/hdf5 - cp ${{ runner.workspace }}/hdf5/hdfsrc/COPYING_LBNL_HDF5 ${{ runner.workspace }}/build/hdf5 - cp ${{ runner.workspace }}/hdf5/hdfsrc/README.md ${{ runner.workspace }}/build/hdf5 - cp ${{ runner.workspace }}/hdf5/build/ci-StdShar-Clang/*.tar.gz ${{ runner.workspace }}/build/hdf5 + cp ${{ runner.workspace }}/hdf5/${{ steps.set-file-base.outputs.SOURCE_BASE }}/COPYING ${{ runner.workspace }}/build/hdf5 + cp ${{ runner.workspace }}/hdf5/${{ steps.set-file-base.outputs.SOURCE_BASE }}/COPYING_LBNL_HDF5 ${{ runner.workspace }}/build/hdf5 + cp ${{ runner.workspace }}/hdf5/build/${{ inputs.preset_name }}-Clang/README.md ${{ runner.workspace }}/build/hdf5 + cp ${{ runner.workspace }}/hdf5/build/${{ inputs.preset_name }}-Clang/*.tar.gz ${{ runner.workspace }}/build/hdf5 cd "${{ runner.workspace }}/build" tar -zcvf ${{ steps.set-file-base.outputs.FILE_BASE }}-osx12.tar.gz hdf5 shell: bash @@ -249,7 +336,7 @@ jobs: # Get files created by release script - name: Get tgz-tarball (Linux S3) - uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: tgz-tarball path: ${{ github.workspace }} @@ -264,8 +351,8 @@ jobs: - name: Run ctest (Linux S3) run: | - cd "${{ runner.workspace }}/hdf5/hdfsrc" - cmake --workflow --preset=ci-StdShar-GNUC-S3 --fresh + cd "${{ runner.workspace }}/hdf5/${{ steps.set-file-base.outputs.SOURCE_BASE }}" + cmake --workflow --preset=${{ inputs.preset_name }}-GNUC-S3 --fresh shell: bash - name: Publish binary (Linux S3) @@ -273,10 +360,10 @@ jobs: run: | mkdir "${{ runner.workspace }}/build" mkdir "${{ runner.workspace }}/build/hdf5" - cp ${{ runner.workspace }}/hdf5/hdfsrc/COPYING ${{ runner.workspace }}/build/hdf5 - cp ${{ runner.workspace }}/hdf5/hdfsrc/COPYING_LBNL_HDF5 ${{ runner.workspace }}/build/hdf5 - cp ${{ runner.workspace }}/hdf5/hdfsrc/README.md ${{ runner.workspace }}/build/hdf5 - cp ${{ runner.workspace }}/hdf5/build/ci-StdShar-GNUC-S3/*.tar.gz ${{ runner.workspace }}/build/hdf5 + cp ${{ runner.workspace }}/hdf5/${{ steps.set-file-base.outputs.SOURCE_BASE }}/COPYING ${{ runner.workspace }}/build/hdf5 + cp ${{ runner.workspace }}/hdf5/${{ steps.set-file-base.outputs.SOURCE_BASE }}/COPYING_LBNL_HDF5 ${{ runner.workspace }}/build/hdf5 + cp ${{ runner.workspace }}/hdf5/build/${{ inputs.preset_name }}-GNUC-S3/README.md ${{ runner.workspace }}/build/hdf5 + cp ${{ runner.workspace }}/hdf5/build/${{ inputs.preset_name }}-GNUC-S3/*.tar.gz ${{ runner.workspace }}/build/hdf5 cd "${{ runner.workspace }}/build" tar -zcvf ${{ steps.set-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc_s3.tar.gz hdf5 shell: bash @@ -319,11 +406,18 @@ jobs: run: | FILE_NAME_BASE=$(echo "${{ inputs.file_base }}") echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT + if [[ '${{ inputs.use_environ }}' == 'snapshots' ]] + then + SOURCE_NAME_BASE=$(echo "hdfsrc") + else + SOURCE_NAME_BASE=$(echo "$FILE_NAME_BASE") + fi + echo "SOURCE_BASE=$SOURCE_NAME_BASE" >> $GITHUB_OUTPUT shell: bash # Get files created by release script - name: Get zip-tarball (Windows_intel) - uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: zip-tarball path: ${{ github.workspace }} @@ -349,8 +443,8 @@ jobs: CC: ${{ steps.setup-fortran.outputs.cc }} CXX: ${{ steps.setup-fortran.outputs.cxx }} run: | - cd "${{ runner.workspace }}/hdf5/hdfsrc" - cmake --workflow --preset=ci-StdShar-Intel --fresh + cd "${{ runner.workspace }}/hdf5/${{ steps.set-file-base.outputs.SOURCE_BASE }}" + cmake --workflow --preset=${{ inputs.preset_name }}-win-Intel --fresh shell: pwsh - name: Publish binary (Windows_intel) @@ -358,10 +452,10 @@ jobs: run: | mkdir "${{ runner.workspace }}/build" mkdir "${{ runner.workspace }}/build/hdf5" - Copy-Item -Path ${{ runner.workspace }}/hdf5/hdfsrc/COPYING -Destination ${{ runner.workspace }}/build/hdf5/ - Copy-Item -Path ${{ runner.workspace }}/hdf5/hdfsrc/COPYING_LBNL_HDF5 -Destination ${{ runner.workspace }}/build/hdf5/ - Copy-Item -Path ${{ runner.workspace }}/hdf5/hdfsrc/README.md -Destination ${{ runner.workspace }}/build/hdf5/ - Copy-Item -Path ${{ runner.workspace }}/hdf5/build/ci-StdShar-Intel/* -Destination ${{ runner.workspace }}/build/hdf5/ -Include *.zip + Copy-Item -Path ${{ runner.workspace }}/hdf5/${{ steps.set-file-base.outputs.SOURCE_BASE }}/COPYING -Destination ${{ runner.workspace }}/build/hdf5/ + Copy-Item -Path ${{ runner.workspace }}/hdf5/${{ steps.set-file-base.outputs.SOURCE_BASE }}/COPYING_LBNL_HDF5 -Destination ${{ runner.workspace }}/build/hdf5/ + Copy-Item -Path ${{ runner.workspace }}/hdf5/build/${{ inputs.preset_name }}-Intel/README.md -Destination ${{ runner.workspace }}/build/hdf5/ + Copy-Item -Path ${{ runner.workspace }}/hdf5/build/${{ inputs.preset_name }}-Intel/* -Destination ${{ runner.workspace }}/build/hdf5/ -Include *.zip cd "${{ runner.workspace }}/build" 7z a -tzip ${{ steps.set-file-base.outputs.FILE_BASE }}-win-vs2022_intel.zip hdf5 shell: pwsh @@ -401,10 +495,17 @@ jobs: run: | FILE_NAME_BASE=$(echo "${{ inputs.file_base }}") echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT + if [[ '${{ inputs.use_environ }}' == 'snapshots' ]] + then + SOURCE_NAME_BASE=$(echo "hdfsrc") + else + SOURCE_NAME_BASE=$(echo "$FILE_NAME_BASE") + fi + echo "SOURCE_BASE=$SOURCE_NAME_BASE" >> $GITHUB_OUTPUT # Get files created by release script - name: Get tgz-tarball (Linux_intel) - uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: tgz-tarball path: ${{ github.workspace }} @@ -423,8 +524,8 @@ jobs: CC: ${{ steps.setup-fortran.outputs.cc }} CXX: ${{ steps.setup-fortran.outputs.cxx }} run: | - cd "${{ runner.workspace }}/hdf5/hdfsrc" - cmake --workflow --preset=ci-StdShar-Intel --fresh + cd "${{ runner.workspace }}/hdf5/${{ steps.set-file-base.outputs.SOURCE_BASE }}" + cmake --workflow --preset=${{ inputs.preset_name }}-Intel --fresh shell: bash - name: Publish binary (Linux_intel) @@ -432,10 +533,10 @@ jobs: run: | mkdir "${{ runner.workspace }}/build" mkdir "${{ runner.workspace }}/build/hdf5" - cp ${{ runner.workspace }}/hdf5/hdfsrc/COPYING ${{ runner.workspace }}/build/hdf5 - cp ${{ runner.workspace }}/hdf5/hdfsrc/COPYING_LBNL_HDF5 ${{ runner.workspace }}/build/hdf5 - cp ${{ runner.workspace }}/hdf5/hdfsrc/README.md ${{ runner.workspace }}/build/hdf5 - cp ${{ runner.workspace }}/hdf5/build/ci-StdShar-Intel/*.tar.gz ${{ runner.workspace }}/build/hdf5 + cp ${{ runner.workspace }}/hdf5/${{ steps.set-file-base.outputs.SOURCE_BASE }}/COPYING ${{ runner.workspace }}/build/hdf5 + cp ${{ runner.workspace }}/hdf5/${{ steps.set-file-base.outputs.SOURCE_BASE }}/COPYING_LBNL_HDF5 ${{ runner.workspace }}/build/hdf5 + cp ${{ runner.workspace }}/hdf5/build/${{ inputs.preset_name }}-Intel/README.md ${{ runner.workspace }}/build/hdf5 + cp ${{ runner.workspace }}/hdf5/build/${{ inputs.preset_name }}-Intel/*.tar.gz ${{ runner.workspace }}/build/hdf5 cd "${{ runner.workspace }}/build" tar -zcvf ${{ steps.set-file-base.outputs.FILE_BASE }}-ubuntu-2204_intel.tar.gz hdf5 shell: bash diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index c22c753b6d1..7911be7354e 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -19,30 +19,49 @@ jobs: name: "CMake Debug Thread-Safety Workflows" uses: ./.github/workflows/main-cmake.yml with: - thread_safety: true + thread_safety: "TS" build_mode: "Debug" call-release-thread-cmake: name: "CMake Release Thread-Safety Workflows" uses: ./.github/workflows/main-cmake.yml with: - thread_safety: true + thread_safety: "TS" build_mode: "Release" call-debug-cmake: name: "CMake Debug Workflows" uses: ./.github/workflows/main-cmake.yml with: - thread_safety: false + thread_safety: "" build_mode: "Debug" call-release-cmake: name: "CMake Release Workflows" uses: ./.github/workflows/main-cmake.yml with: - thread_safety: false + thread_safety: "" build_mode: "Release" + call-release-bintest: + name: "CMake Test Release Binaries" + needs: call-release-cmake + uses: ./.github/workflows/cmake-bintest.yml + with: + build_mode: "Release" + + call-release-par: + name: "CMake Parallel Release Workflows" + uses: ./.github/workflows/main-cmake-par.yml + with: + build_mode: "Release" + + call-debug-par: + name: "CMake Parallel Debug Workflows" + uses: ./.github/workflows/main-cmake-par.yml + with: + build_mode: "Debug" + call-release-cmake-intel: name: "CMake Intel Workflows" uses: ./.github/workflows/intel-cmake.yml diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml index cb68361aa0c..1477b141d5b 100644 --- a/.github/workflows/codespell.yml +++ b/.github/workflows/codespell.yml @@ -12,6 +12,3 @@ jobs: steps: - uses: actions/checkout@v4.1.1 - uses: codespell-project/actions-codespell@master - with: - skip: ./.github/workflows/codespell.yml,./bin/trace,./hl/tools/h5watch/h5watch.c,./tools/test/h5jam/tellub.c,./config/sanitizer/LICENSE,./config/sanitizer/sanitizers.cmake,./tools/test/h5repack/testfiles/*.dat,./test/API/driver,./configure,./bin/ltmain.sh,./bin/depcomp,./bin/config.guess,./bin/config.sub,./autom4te.cache,./m4/libtool.m4,./c++/src/*.html,./HDF5Examples/depcomp - ignore_words_list: ot,isnt,inout,nd,parms,parm,ba,offsetP,ser,ois,had,fiter,fo,clude,refere,minnum,offsetp,creat,ans:,eiter,lastr,ans,isn't,ifset,sur,trun,dne,tthe,hda,filname,te,htmp,ake,gord,numer,ro,oce,msdos diff --git a/.github/workflows/daily-build.yml b/.github/workflows/daily-build.yml index 5633b3cfbbc..bc25009d7c6 100644 --- a/.github/workflows/daily-build.yml +++ b/.github/workflows/daily-build.yml @@ -12,6 +12,26 @@ permissions: # A workflow run is made up of one or more jobs that can run sequentially or # in parallel. jobs: + get-old-names: + runs-on: ubuntu-latest + outputs: + hdf5-name: ${{ steps.gethdf5base.outputs.HDF5_NAME_BASE }} + + steps: + - uses: actions/checkout@v4.1.1 + + - name: Get hdf5 release base name + uses: dsaltares/fetch-gh-release-asset@master + with: + version: 'tags/snapshot' + file: 'last-file.txt' + + - name: Read base-name file + id: gethdf5base + run: echo "HDF5_NAME_BASE=$(cat last-file.txt)" >> $GITHUB_OUTPUT + + - run: echo "hdf5 base name is ${{ steps.gethdf5base.outputs.HDF5_NAME_BASE }}." + call-workflow-tarball: uses: ./.github/workflows/tarball.yml with: @@ -23,12 +43,23 @@ jobs: uses: ./.github/workflows/cmake-ctest.yml with: file_base: ${{ needs.call-workflow-tarball.outputs.file_base }} + preset_name: ci-StdShar + use_environ: snapshots #use_tag: snapshot - #use_environ: snapshots if: ${{ needs.call-workflow-tarball.outputs.has_changes == 'true' }} - call-workflow-release: + call-workflow-abi: needs: [call-workflow-tarball, call-workflow-ctest] + uses: ./.github/workflows/abi-report.yml + with: + file_ref: '1_14_3' + file_base: ${{ needs.call-workflow-tarball.outputs.file_base }} + use_tag: snapshot + use_environ: snapshots + if: ${{ needs.call-workflow-tarball.outputs.has_changes == 'true' }} + + call-workflow-release: + needs: [call-workflow-tarball, call-workflow-ctest, call-workflow-abi] permissions: contents: write # In order to allow tag creation uses: ./.github/workflows/release-files.yml @@ -40,3 +71,14 @@ jobs: use_environ: snapshots if: ${{ needs.call-workflow-tarball.outputs.has_changes == 'true' }} + call-workflow-remove: + needs: [get-old-names, call-workflow-tarball, call-workflow-ctest, call-workflow-abi, call-workflow-release] + permissions: + contents: write # In order to allow file deletion + uses: ./.github/workflows/remove-files.yml + with: + file_base: ${{ needs.get-old-names.outputs.hdf5-name }} + use_tag: snapshot + use_environ: snapshots + if: ${{ needs.call-workflow-tarball.outputs.has_changes == 'true' }} + diff --git a/.github/workflows/linux-auto-aocc-ompi.yml b/.github/workflows/linux-auto-aocc-ompi.yml index 68f94dd521f..a8c51eac1cd 100644 --- a/.github/workflows/linux-auto-aocc-ompi.yml +++ b/.github/workflows/linux-auto-aocc-ompi.yml @@ -44,7 +44,7 @@ jobs: clang -v - name: Cache OpenMPI 4.1.5 installation id: cache-openmpi-4_1_5 - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: /home/runner/work/hdf5/hdf5/openmpi-4.1.5-install key: ${{ runner.os }}-${{ runner.arch }}-openmpi-4_1_5-cache diff --git a/.github/workflows/main-auto-par-spc.yml b/.github/workflows/main-auto-par-spc.yml new file mode 100644 index 00000000000..f6c3316a638 --- /dev/null +++ b/.github/workflows/main-auto-par-spc.yml @@ -0,0 +1,137 @@ +name: hdf5 dev autotools parallel special CI + +# Controls when the action will run. Triggers the workflow on a call +on: + workflow_call: + +permissions: + contents: read + +# A workflow run is made up of one or more jobs that can run sequentially or +# in parallel. We just have one job, but the matrix items defined below will +# run in parallel. +jobs: + # + # SPECIAL AUTOTOOLS BUILDS + # + # These do not run tests and are not built into the matrix and instead + # become NEW configs as their name would clobber one of the matrix + # names (so make sure the names are UNIQUE). + # + + build_parallel_debug_werror: + name: "gcc DBG parallel -Werror (build only)" + runs-on: ubuntu-latest + steps: + # SETUP + # Only CMake need ninja-build, but we just install it unilaterally + # libssl, etc. are needed for the ros3 VFD + - name: Install Linux Dependencies + run: | + sudo apt update + sudo apt-get install ninja-build doxygen graphviz + sudo apt install libssl3 libssl-dev libcurl4 libcurl4-openssl-dev + sudo apt install gcc-12 g++-12 gfortran-12 + sudo apt install automake autoconf libtool libtool-bin + sudo apt install libaec0 libaec-dev + sudo apt install openmpi-bin openmpi-common mpi-default-dev + echo "CC=mpicc" >> $GITHUB_ENV + echo "FC=mpif90" >> $GITHUB_ENV + + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Get Sources + uses: actions/checkout@v4.1.1 + + # AUTOTOOLS CONFIGURE + - name: Autotools Configure + run: | + sh ./autogen.sh + mkdir "${{ runner.workspace }}/build" + cd "${{ runner.workspace }}/build" + CFLAGS=-Werror $GITHUB_WORKSPACE/configure \ + --enable-build-mode=debug \ + --enable-deprecated-symbols \ + --with-default-api-version=v114 \ + --enable-shared \ + --enable-parallel \ + --enable-subfiling-vfd \ + --disable-cxx \ + --disable-fortran \ + --disable-java \ + --disable-mirror-vfd \ + --enable-direct-vfd \ + --disable-ros3-vfd \ + shell: bash + + # BUILD + - name: Autotools Build + run: make -j3 + working-directory: ${{ runner.workspace }}/build + + # INSTALL (note that this runs even when we don't run the tests) + - name: Autotools Install + run: make install + working-directory: ${{ runner.workspace }}/build + + - name: Autotools Verify Install + run: make check-install + working-directory: ${{ runner.workspace }}/build + + build_parallel_release_werror: + name: "gcc REL parallel -Werror (build only)" + runs-on: ubuntu-latest + steps: + # SETUP + # Only CMake need ninja-build, but we just install it unilaterally + # libssl, etc. are needed for the ros3 VFD + - name: Install Linux Dependencies + run: | + sudo apt update + sudo apt-get install ninja-build doxygen graphviz + sudo apt install libssl3 libssl-dev libcurl4 libcurl4-openssl-dev + sudo apt install gcc-12 g++-12 gfortran-12 + sudo apt install automake autoconf libtool libtool-bin + sudo apt install libaec0 libaec-dev + sudo apt install openmpi-bin openmpi-common mpi-default-dev + echo "CC=mpicc" >> $GITHUB_ENV + echo "FC=mpif90" >> $GITHUB_ENV + + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Get Sources + uses: actions/checkout@v4.1.1 + + # AUTOTOOLS CONFIGURE + - name: Autotools Configure + run: | + sh ./autogen.sh + mkdir "${{ runner.workspace }}/build" + cd "${{ runner.workspace }}/build" + CFLAGS=-Werror $GITHUB_WORKSPACE/configure \ + --enable-build-mode=production \ + --enable-deprecated-symbols \ + --with-default-api-version=v114 \ + --enable-shared \ + --enable-parallel \ + --enable-subfiling-vfd \ + --disable-cxx \ + --disable-fortran \ + --disable-java \ + --disable-mirror-vfd \ + --enable-direct-vfd \ + --disable-ros3-vfd \ + shell: bash + + # BUILD + - name: Autotools Build + run: make -j3 + working-directory: ${{ runner.workspace }}/build + + # INSTALL (note that this runs even when we don't run the tests) + - name: Autotools Install + run: make install + working-directory: ${{ runner.workspace }}/build + + - name: Autotools Verify Install + run: make check-install + working-directory: ${{ runner.workspace }}/build + diff --git a/.github/workflows/main-auto-par.yml b/.github/workflows/main-auto-par.yml index 70cf4bdb667..9f1522a3e58 100644 --- a/.github/workflows/main-auto-par.yml +++ b/.github/workflows/main-auto-par.yml @@ -1,8 +1,13 @@ -name: hdf5 dev autotools CI +name: hdf5 dev autotools parallel CI # Controls when the action will run. Triggers the workflow on a call on: workflow_call: + inputs: + build_mode: + description: "release vs. debug build" + required: true + type: string permissions: contents: read @@ -12,78 +17,23 @@ permissions: # run in parallel. jobs: # - # SPECIAL AUTOTOOLS BUILDS - # - # These do not run tests and are not built into the matrix and instead - # become NEW configs as their name would clobber one of the matrix - # names (so make sure the names are UNIQUE). + # The GitHub runners are inadequate for running parallel HDF5 tests, + # so we catch most issues in daily testing. What we have here is just + # a compile check to make sure nothing obvious is broken. + # A workflow that builds the library + # Parallel Linux (Ubuntu) w/ gcc + Autotools # + Autotools_build_parallel: + name: "Parallel GCC-${{ inputs.build_mode }}" + # Don't run the action if the commit message says to skip CI + if: "!contains(github.event.head_commit.message, 'skip-ci')" - build_parallel_debug_werror: - name: "gcc DBG parallel -Werror (build only)" + # The type of runner that the job will run on runs-on: ubuntu-latest - steps: - # SETUP - # Only CMake need ninja-build, but we just install it unilaterally - # libssl, etc. are needed for the ros3 VFD - - name: Install Linux Dependencies - run: | - sudo apt update - sudo apt-get install ninja-build doxygen graphviz - sudo apt install libssl3 libssl-dev libcurl4 libcurl4-openssl-dev - sudo apt install gcc-12 g++-12 gfortran-12 - sudo apt install automake autoconf libtool libtool-bin - sudo apt install libaec0 libaec-dev - sudo apt install openmpi-bin openmpi-common mpi-default-dev - echo "CC=mpicc" >> $GITHUB_ENV - echo "FC=mpif90" >> $GITHUB_ENV - - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - name: Get Sources - uses: actions/checkout@v4.1.1 - # AUTOTOOLS CONFIGURE - - name: Autotools Configure - run: | - sh ./autogen.sh - mkdir "${{ runner.workspace }}/build" - cd "${{ runner.workspace }}/build" - CFLAGS=-Werror $GITHUB_WORKSPACE/configure \ - --enable-build-mode=debug \ - --enable-deprecated-symbols \ - --with-default-api-version=v114 \ - --enable-shared \ - --enable-parallel \ - --enable-subfiling-vfd \ - --disable-cxx \ - --disable-fortran \ - --disable-java \ - --disable-mirror-vfd \ - --enable-direct-vfd \ - --disable-ros3-vfd \ - shell: bash - - # BUILD - - name: Autotools Build - run: make -j3 - working-directory: ${{ runner.workspace }}/build - - # INSTALL (note that this runs even when we don't run the tests) - - name: Autotools Install - run: make install - working-directory: ${{ runner.workspace }}/build - - - name: Autotools Verify Install - run: make check-install - working-directory: ${{ runner.workspace }}/build - - build_parallel_release_werror: - name: "gcc REL parallel -Werror (build only)" - runs-on: ubuntu-latest + # Steps represent a sequence of tasks that will be executed as part of the job steps: # SETUP - # Only CMake need ninja-build, but we just install it unilaterally - # libssl, etc. are needed for the ros3 VFD - name: Install Linux Dependencies run: | sudo apt update @@ -106,32 +56,22 @@ jobs: sh ./autogen.sh mkdir "${{ runner.workspace }}/build" cd "${{ runner.workspace }}/build" - CFLAGS=-Werror $GITHUB_WORKSPACE/configure \ - --enable-build-mode=production \ + CC=mpicc $GITHUB_WORKSPACE/configure \ + --enable-build-mode=${{ inputs.build_mode }} \ --enable-deprecated-symbols \ --with-default-api-version=v114 \ --enable-shared \ --enable-parallel \ - --enable-subfiling-vfd \ --disable-cxx \ - --disable-fortran \ + --enable-fortran \ --disable-java \ --disable-mirror-vfd \ - --enable-direct-vfd \ + --disable-direct-vfd \ --disable-ros3-vfd \ + --with-szlib=yes shell: bash # BUILD - name: Autotools Build run: make -j3 working-directory: ${{ runner.workspace }}/build - - # INSTALL (note that this runs even when we don't run the tests) - - name: Autotools Install - run: make install - working-directory: ${{ runner.workspace }}/build - - - name: Autotools Verify Install - run: make check-install - working-directory: ${{ runner.workspace }}/build - diff --git a/.github/workflows/main-auto.yml b/.github/workflows/main-auto.yml index 57b1c3d8fd6..51ddfdb628c 100644 --- a/.github/workflows/main-auto.yml +++ b/.github/workflows/main-auto.yml @@ -120,63 +120,3 @@ jobs: - name: Autotools Verify Install run: make check-install working-directory: ${{ runner.workspace }}/build - - # - # The GitHub runners are inadequate for running parallel HDF5 tests, - # so we catch most issues in daily testing. What we have here is just - # a compile check to make sure nothing obvious is broken. - # A workflow that builds the library - # Parallel Linux (Ubuntu) w/ gcc + Autotools - # - Autotools_build_parallel: - name: "Parallel GCC-${{ inputs.build_mode }}-TS=${{ inputs.thread_safety }}d" - # Don't run the action if the commit message says to skip CI - if: "!contains(github.event.head_commit.message, 'skip-ci')" - - # The type of runner that the job will run on - runs-on: ubuntu-latest - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # SETUP - - name: Install Linux Dependencies - run: | - sudo apt update - sudo apt-get install ninja-build doxygen graphviz - sudo apt install libssl3 libssl-dev libcurl4 libcurl4-openssl-dev - sudo apt install gcc-12 g++-12 gfortran-12 - sudo apt install automake autoconf libtool libtool-bin - sudo apt install libaec0 libaec-dev - sudo apt install openmpi-bin openmpi-common mpi-default-dev - echo "CC=mpicc" >> $GITHUB_ENV - echo "FC=mpif90" >> $GITHUB_ENV - - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - name: Get Sources - uses: actions/checkout@v4.1.1 - - # AUTOTOOLS CONFIGURE - - name: Autotools Configure - run: | - sh ./autogen.sh - mkdir "${{ runner.workspace }}/build" - cd "${{ runner.workspace }}/build" - CC=mpicc $GITHUB_WORKSPACE/configure \ - --enable-build-mode=${{ inputs.build_mode }} \ - --enable-deprecated-symbols \ - --with-default-api-version=v114 \ - --enable-shared \ - --enable-parallel \ - --disable-cxx \ - --enable-fortran \ - --disable-java \ - --disable-mirror-vfd \ - --disable-direct-vfd \ - --disable-ros3-vfd \ - --with-szlib=yes - shell: bash - - # BUILD - - name: Autotools Build - run: make -j3 - working-directory: ${{ runner.workspace }}/build diff --git a/.github/workflows/main-cmake-par.yml b/.github/workflows/main-cmake-par.yml new file mode 100644 index 00000000000..faecefcd952 --- /dev/null +++ b/.github/workflows/main-cmake-par.yml @@ -0,0 +1,77 @@ +name: hdf5 dev PAR CMake CI + +# Controls when the action will run. Triggers the workflow on a call +on: + workflow_call: + inputs: + build_mode: + description: "release vs. debug build" + required: true + type: string + +permissions: + contents: read + +# A workflow run is made up of one or more jobs that can run sequentially or +# in parallel. We just have one job, but the matrix items defined below will +# run in parallel. +jobs: + # + # The GitHub runners are inadequate for running parallel HDF5 tests, + # so we catch most issues in daily testing. What we have here is just + # a compile check to make sure nothing obvious is broken. + # A workflow that builds the library + # Parallel Linux (Ubuntu) w/ gcc + Autotools + # + CMake_build_parallel: + name: "Parallel GCC-${{ inputs.build_mode }}" + # Don't run the action if the commit message says to skip CI + if: ${{ inputs.thread_safety != 'TS' }} + + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # SETUP + - name: Install Linux Dependencies + run: | + sudo apt update + sudo apt-get install ninja-build doxygen graphviz + sudo apt install libssl3 libssl-dev libcurl4 libcurl4-openssl-dev + sudo apt install gcc-12 g++-12 gfortran-12 + sudo apt install libaec0 libaec-dev + sudo apt install openmpi-bin openmpi-common mpi-default-dev + echo "CC=mpicc" >> $GITHUB_ENV + echo "FC=mpif90" >> $GITHUB_ENV + + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Get Sources + uses: actions/checkout@v4.1.1 + + # CMAKE CONFIGURE + - name: CMake Configure + run: | + mkdir "${{ runner.workspace }}/build" + cd "${{ runner.workspace }}/build" + CC=mpicc cmake -C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake \ + -DCMAKE_BUILD_TYPE=${{ inputs.build_mode }} \ + -DBUILD_SHARED_LIBS=ON \ + -DHDF5_ENABLE_ALL_WARNINGS=ON \ + -DHDF5_ENABLE_PARALLEL:BOOL=ON \ + -DHDF5_BUILD_CPP_LIB:BOOL=OFF \ + -DHDF5_BUILD_FORTRAN=ON \ + -DHDF5_BUILD_JAVA=OFF \ + -DLIBAEC_USE_LOCALCONTENT=OFF \ + -DZLIB_USE_LOCALCONTENT=OFF \ + -DHDF5_ENABLE_MIRROR_VFD:BOOL=OFF \ + -DHDF5_ENABLE_DIRECT_VFD:BOOL=OFF \ + -DHDF5_ENABLE_ROS3_VFD:BOOL=OFF \ + -DHDF5_PACK_EXAMPLES:BOOL=ON \ + $GITHUB_WORKSPACE + shell: bash + + # BUILD + - name: CMake Build + run: cmake --build . --parallel 3 --config ${{ inputs.build_mode }} + working-directory: ${{ runner.workspace }}/build diff --git a/.github/workflows/main-cmake-spc.yml b/.github/workflows/main-cmake-spc.yml index 9531035b972..fd14b015d40 100644 --- a/.github/workflows/main-cmake-spc.yml +++ b/.github/workflows/main-cmake-spc.yml @@ -48,7 +48,6 @@ jobs: cmake -C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake \ -G Ninja \ -DCMAKE_BUILD_TYPE=Debug \ - -DCMAKE_TOOLCHAIN_FILE=config/toolchain/gcc.cmake \ -DBUILD_SHARED_LIBS=ON \ -DHDF5_ENABLE_ALL_WARNINGS=ON \ -DHDF5_ENABLE_PARALLEL:BOOL=OFF \ @@ -109,7 +108,6 @@ jobs: cmake -C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake \ -G Ninja \ -DCMAKE_BUILD_TYPE=Debug \ - -DCMAKE_TOOLCHAIN_FILE=config/toolchain/gcc.cmake \ -DBUILD_SHARED_LIBS=ON \ -DHDF5_ENABLE_ALL_WARNINGS=ON \ -DHDF5_ENABLE_PARALLEL:BOOL=OFF \ @@ -170,7 +168,6 @@ jobs: cmake -C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake \ -G Ninja \ -DCMAKE_BUILD_TYPE=Debug \ - -DCMAKE_TOOLCHAIN_FILE=config/toolchain/gcc.cmake \ -DBUILD_SHARED_LIBS=ON \ -DHDF5_ENABLE_ALL_WARNINGS=ON \ -DHDF5_ENABLE_PARALLEL:BOOL=OFF \ @@ -231,7 +228,6 @@ jobs: cmake -C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake \ -G Ninja \ -DCMAKE_BUILD_TYPE=Debug \ - -DCMAKE_TOOLCHAIN_FILE=config/toolchain/gcc.cmake \ -DBUILD_SHARED_LIBS=ON \ -DHDF5_ENABLE_ALL_WARNINGS=ON \ -DHDF5_ENABLE_PARALLEL:BOOL=OFF \ diff --git a/.github/workflows/main-cmake.yml b/.github/workflows/main-cmake.yml index 7669bd96caa..ec93d0db554 100644 --- a/.github/workflows/main-cmake.yml +++ b/.github/workflows/main-cmake.yml @@ -5,9 +5,10 @@ on: workflow_call: inputs: thread_safety: - description: "thread-safety on/off" + description: "TS or empty" required: true - type: boolean + type: string + build_mode: description: "release vs. debug build" required: true @@ -47,12 +48,11 @@ jobs: # # No Fortran, parallel, or VFDs that rely on POSIX things - name: "Windows MSVC" - os: windows-2022 - toolchain: "" + os: windows-latest cpp: ON fortran: OFF java: ON - docs: OFF + docs: ON libaecfc: ON localaec: OFF zlibfc: ON @@ -82,7 +82,6 @@ jobs: mirror_vfd: ON direct_vfd: ON ros3_vfd: ON - toolchain: "config/toolchain/gcc.cmake" generator: "-G Ninja" run_tests: true @@ -96,7 +95,7 @@ jobs: cpp: ON fortran: OFF java: ON - docs: OFF + docs: ON libaecfc: ON localaec: OFF zlibfc: ON @@ -105,14 +104,13 @@ jobs: mirror_vfd: ON direct_vfd: OFF ros3_vfd: OFF - toolchain: "config/toolchain/clang.cmake" generator: "-G Ninja" run_tests: true # Sets the job's name from the properties - name: "${{ matrix.name }}-${{ inputs.build_mode }}-TS=${{ inputs.thread_safety }}" + name: "${{ matrix.name }}-${{ inputs.build_mode }}-${{ inputs.thread_safety }}" # Don't run the action if the commit message says to skip CI if: "!contains(github.event.head_commit.message, 'skip-ci')" @@ -136,7 +134,7 @@ jobs: - name: Install Linux Dependencies run: | sudo apt update - sudo apt-get install ninja-build doxygen graphviz + sudo apt-get install ninja-build graphviz sudo apt install libssl3 libssl-dev libcurl4 libcurl4-openssl-dev sudo apt install gcc-12 g++-12 gfortran-12 echo "CC=gcc-12" >> $GITHUB_ENV @@ -151,16 +149,21 @@ jobs: if: matrix.os == 'windows-latest' - name: Install Dependencies (macOS) - run: brew install ninja doxygen + run: brew install ninja if: matrix.os == 'macos-13' + - name: Install Dependencies + uses: ssciwr/doxygen-install@v1 + with: + version: "1.9.7" + - name: Set environment for MSVC (Windows) run: | # Set these environment variables so CMake picks the correct compiler echo "CXX=cl.exe" >> $GITHUB_ENV echo "CC=cl.exe" >> $GITHUB_ENV if: matrix.os == 'windows-latest' - + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: Get Sources uses: actions/checkout@v4.1.1 @@ -176,9 +179,9 @@ jobs: cmake -C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake \ ${{ matrix.generator }} \ -DCMAKE_BUILD_TYPE=${{ inputs.build_mode }} \ - -DCMAKE_TOOLCHAIN_FILE=${{ matrix.toolchain }} \ -DBUILD_SHARED_LIBS=ON \ -DHDF5_ENABLE_ALL_WARNINGS=ON \ + -DHDF5_ENABLE_DOXY_WARNINGS=ON \ -DHDF5_ENABLE_PARALLEL:BOOL=${{ matrix.parallel }} \ -DHDF5_BUILD_CPP_LIB:BOOL=${{ matrix.cpp }} \ -DHDF5_BUILD_FORTRAN=${{ matrix.fortran }} \ @@ -189,9 +192,11 @@ jobs: -DHDF5_ENABLE_MIRROR_VFD:BOOL=${{ matrix.mirror_vfd }} \ -DHDF5_ENABLE_DIRECT_VFD:BOOL=${{ matrix.direct_vfd }} \ -DHDF5_ENABLE_ROS3_VFD:BOOL=${{ matrix.ros3_vfd }} \ + -DHDF5_PACK_EXAMPLES:BOOL=ON \ + -DHDF5_PACKAGE_EXTLIBS:BOOL=ON \ $GITHUB_WORKSPACE shell: bash - if: "! (matrix.thread_safety)" + if: ${{ inputs.thread_safety != 'TS' }} - name: CMake Configure (Thread-Safe) @@ -201,8 +206,8 @@ jobs: cmake -C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake \ ${{ matrix.generator }} \ -DCMAKE_BUILD_TYPE=${{ inputs.build_mode }} \ - -DCMAKE_TOOLCHAIN_FILE=${{ matrix.toolchain }} \ -DBUILD_SHARED_LIBS=ON \ + -DBUILD_STATIC_LIBS=${{ (matrix.os != 'windows-latest') }} \ -DHDF5_ENABLE_ALL_WARNINGS=ON \ -DHDF5_ENABLE_THREADSAFE:BOOL=ON \ -DHDF5_ENABLE_PARALLEL:BOOL=${{ matrix.parallel }} \ @@ -216,9 +221,10 @@ jobs: -DHDF5_ENABLE_MIRROR_VFD:BOOL=${{ matrix.mirror_vfd }} \ -DHDF5_ENABLE_DIRECT_VFD:BOOL=${{ matrix.direct_vfd }} \ -DHDF5_ENABLE_ROS3_VFD:BOOL=${{ matrix.ros3_vfd }} \ + -DHDF5_PACK_EXAMPLES:BOOL=ON \ $GITHUB_WORKSPACE shell: bash - if: (matrix.thread_safety) + if: ${{ inputs.thread_safety == 'TS' }} # # BUILD @@ -237,75 +243,48 @@ jobs: - name: CMake Run Tests run: ctest . --parallel 2 -C ${{ inputs.build_mode }} -V working-directory: ${{ runner.workspace }}/build - if: (matrix.run_tests) && ! (matrix.thread_safety) + if: ${{ matrix.run_tests && (inputs.thread_safety != 'TS') }} # THREAD-SAFE - name: CMake Run Thread-Safe Tests run: ctest . --parallel 2 -C ${{ inputs.build_mode }} -V -R ttsafe working-directory: ${{ runner.workspace }}/build - if: (matrix.run_tests) && (matrix.thread_safety) + if: ${{ matrix.run_tests && (inputs.thread_safety == 'TS') }} # # INSTALL (note that this runs even when we don't run the tests) # - # - # The GitHub runners are inadequate for running parallel HDF5 tests, - # so we catch most issues in daily testing. What we have here is just - # a compile check to make sure nothing obvious is broken. - # A workflow that builds the library - # Parallel Linux (Ubuntu) w/ gcc + Autotools - # - CMake_build_parallel: - name: "Parallel GCC-${{ inputs.build_mode }}-TS=${{ inputs.thread_safety }}" - # Don't run the action if the commit message says to skip CI - if: "!contains(github.event.head_commit.message, 'skip-ci')" - - # The type of runner that the job will run on - runs-on: ubuntu-latest - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # SETUP - - name: Install Linux Dependencies - run: | - sudo apt update - sudo apt-get install ninja-build doxygen graphviz - sudo apt install libssl3 libssl-dev libcurl4 libcurl4-openssl-dev - sudo apt install gcc-12 g++-12 gfortran-12 - sudo apt install libaec0 libaec-dev - sudo apt install openmpi-bin openmpi-common mpi-default-dev - echo "CC=mpicc" >> $GITHUB_ENV - echo "FC=mpif90" >> $GITHUB_ENV - - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - name: Get Sources - uses: actions/checkout@v4.1.1 + - name: CMake Run Package + run: cpack -C ${{ inputs.build_mode }} -V + working-directory: ${{ runner.workspace }}/build - # CMAKE CONFIGURE - - name: CMake Configure + - name: List files in the space run: | - mkdir "${{ runner.workspace }}/build" - cd "${{ runner.workspace }}/build" - CC=mpicc cmake -C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake \ - -DCMAKE_BUILD_TYPE=${{ inputs.build_mode }} \ - -DCMAKE_TOOLCHAIN_FILE=${{ matrix.toolchain }} \ - -DBUILD_SHARED_LIBS=ON \ - -DHDF5_ENABLE_ALL_WARNINGS=ON \ - -DHDF5_ENABLE_PARALLEL:BOOL=ON \ - -DHDF5_BUILD_CPP_LIB:BOOL=OFF \ - -DHDF5_BUILD_FORTRAN=ON \ - -DHDF5_BUILD_JAVA=OFF \ - -DLIBAEC_USE_LOCALCONTENT=OFF \ - -DZLIB_USE_LOCALCONTENT=OFF \ - -DHDF5_ENABLE_MIRROR_VFD:BOOL=OFF \ - -DHDF5_ENABLE_DIRECT_VFD:BOOL=OFF \ - -DHDF5_ENABLE_ROS3_VFD:BOOL=OFF \ - $GITHUB_WORKSPACE - shell: bash - - # BUILD - - name: CMake Build - run: cmake --build . --parallel 3 --config ${{ inputs.build_mode }} - working-directory: ${{ runner.workspace }}/build + ls -l ${{ runner.workspace }}/build + + # Save files created by ctest script + - name: Save published binary (Windows) + uses: actions/upload-artifact@v4 + with: + name: zip-vs2022_cl-${{ inputs.build_mode }}-binary + path: ${{ runner.workspace }}/build/HDF5-*-win64.zip + if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` + if: ${{ (matrix.os == 'windows-latest') && (inputs.thread_safety != 'TS') }} + + - name: Save published binary (linux) + uses: actions/upload-artifact@v4 + with: + name: tgz-ubuntu-2204_gcc-${{ inputs.build_mode }}-binary + path: ${{ runner.workspace }}/build/HDF5-*-Linux.tar.gz + if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` + if: ${{ (matrix.os == 'ubuntu-latest') && (inputs.thread_safety != 'TS') }} + + - name: Save published binary (Mac) + uses: actions/upload-artifact@v4 + with: + name: tgz-osx12-${{ inputs.build_mode }}-binary + path: ${{ runner.workspace }}/build/HDF5-*-Darwin.tar.gz + if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` + if: ${{ (matrix.os == 'macos-13') && (inputs.thread_safety != 'TS') }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 43513c51a26..3f878b1b8fd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -30,7 +30,10 @@ jobs: workflow-autotools: name: "Autotools Workflows" uses: ./.github/workflows/autotools.yml + if: "!contains(github.event.head_commit.message, 'skip-ci')" workflow-cmake: name: "CMake Workflows" uses: ./.github/workflows/cmake.yml + if: "!contains(github.event.head_commit.message, 'skip-ci')" + diff --git a/.github/workflows/nvhpc-cmake.yml b/.github/workflows/nvhpc-cmake.yml index c6b338df8fa..3a78c0610a0 100644 --- a/.github/workflows/nvhpc-cmake.yml +++ b/.github/workflows/nvhpc-cmake.yml @@ -28,13 +28,13 @@ jobs: - name: Install NVHPC shell: bash - run: | + run: | curl https://developer.download.nvidia.com/hpc-sdk/ubuntu/DEB-GPG-KEY-NVIDIA-HPC-SDK | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg echo 'deb [signed-by=/usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg] https://developer.download.nvidia.com/hpc-sdk/ubuntu/amd64 /' | sudo tee /etc/apt/sources.list.d/nvhpc.list sudo apt-get update -y sudo apt-get install -y nvhpc-23-9 - echo "CC=nvc" >> $GITHUB_ENV - echo "FC=nvfortran" >> $GITHUB_ENV + echo "CC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/comm_libs/openmpi4/bin/mpicc" >> $GITHUB_ENV + echo "FC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/comm_libs/openmpi4/bin/mpifort" >> $GITHUB_ENV echo "NVHPCSDK=/opt/nvidia/hpc_sdk" >> $GITHUB_ENV echo "OMPI_CXX=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin/nvc++" >> $GITHUB_ENV echo "OMPI_CC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin/nvc" >> $GITHUB_ENV diff --git a/.github/workflows/release-files.yml b/.github/workflows/release-files.yml index 6e9b60e877d..97f19671d2e 100644 --- a/.github/workflows/release-files.yml +++ b/.github/workflows/release-files.yml @@ -44,9 +44,6 @@ jobs: with: fetch-depth: 0 - - run: | - git checkout ${{ inputs.file_sha }} - - uses: rickstaa/action-create-tag@a1c7777fcb2fee4f19b0f283ba888afa11678b72 # v1.7.2 id: "tag_create" with: @@ -75,7 +72,7 @@ jobs: # Get files created by tarball script - name: Get doxygen (Linux) - uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: docs-doxygen path: ${{ github.workspace }}/${{ steps.get-file-base.outputs.FILE_BASE }}.doxygen @@ -84,65 +81,110 @@ jobs: run: zip -r ${{ steps.get-file-base.outputs.FILE_BASE }}.doxygen.zip ./${{ steps.get-file-base.outputs.FILE_BASE }}.doxygen - name: Get tgz-tarball (Linux) - uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: tgz-tarball path: ${{ github.workspace }} - name: Get zip-tarball (Windows) - uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: zip-tarball path: ${{ github.workspace }} # Get files created by cmake-ctest script - name: Get published binary (Windows) - uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: zip-vs2022_cl-binary path: ${{ github.workspace }} - name: Get published binary (MacOS) - uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: tgz-osx12-binary path: ${{ github.workspace }} - name: Get published binary (Linux) - uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: tgz-ubuntu-2204_gcc-binary path: ${{ github.workspace }} + - name: Get published deb binary (Linux) + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + with: + name: deb-ubuntu-2204_gcc-binary + path: ${{ github.workspace }} + + - name: Get published rpm binary (Linux) + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + with: + name: rpm-ubuntu-2204_gcc-binary + path: ${{ github.workspace }} + - name: Get published binary (Linux S3) - uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: tgz-ubuntu-2204_gcc_s3-binary path: ${{ github.workspace }} - name: Get published binary (Windows_intel) - uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: zip-vs2022_intel-binary path: ${{ github.workspace }} - name: Get published binary (Linux_intel) - uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: tgz-ubuntu-2204_intel-binary path: ${{ github.workspace }} + - name: Get published abi reports (Linux) + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + with: + name: abi-reports + path: ${{ github.workspace }} + + - 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 + - name: Store snapshot name run: | echo "${{ steps.get-file-base.outputs.FILE_BASE }}" > ./last-file.txt + - name: Get NEWSLETTER + uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 + with: + name: NEWSLETTER + path: ${{ github.workspace }} + + - name: Create description file + run: | + cat ${{ github.workspace }}/NEWSLETTER.txt > description.txt + echo "SHA256 sums:" >> description.txt + cat sha256sums.txt >> description.txt + - name: PreRelease tag id: create_prerelease - if: ${{ (inputs.use_environ == 'snapshots') }} uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1 with: tag_name: "${{ inputs.use_tag }}" prerelease: true + body_path: description.txt files: | last-file.txt ${{ steps.get-file-base.outputs.FILE_BASE }}.doxygen.zip @@ -150,30 +192,14 @@ jobs: ${{ steps.get-file-base.outputs.FILE_BASE }}.zip ${{ steps.get-file-base.outputs.FILE_BASE }}-osx12.tar.gz ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.tar.gz + ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.deb + ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.rpm ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc_s3.tar.gz ${{ 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 - if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` - - - name: Release tag - id: create_release - if: ${{ (inputs.use_environ == 'release') }} - uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1 - with: - tag_name: "${{ inputs.use_tag }}" - prerelease: false - #body_path: ${{ github.workspace }}-CHANGELOG.txt - files: | - ${{ 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 - ${{ steps.get-file-base.outputs.FILE_BASE }}-osx12.tar.gz - ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.tar.gz - ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc_s3.tar.gz - ${{ 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 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 28f24258d75..25239a4f721 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,72 +27,37 @@ jobs: TAG: ${{ inputs.use_tag }} run: echo "RELEASE_TAG=$TAG" >> $GITHUB_OUTPUT -# tarball.yml will be used for releases when pre-tag actions are implemented -# call-workflow-tarball: -# needs: log-the-inputs -# uses: ./.github/workflows/tarball.yml -# with: -# use_tag: ${{ inputs.use_tag }} -# use_environ: release - - create-files-ctest: + call-workflow-tarball: needs: log-the-inputs - runs-on: ubuntu-latest - outputs: - file_base: ${{ steps.set-file-base.outputs.FILE_BASE }} - steps: - - name: Set file base name - id: set-file-base - run: | - FILE_NAME_BASE=$(echo "${{ needs.log-the-inputs.outputs.rel_tag }}") - echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT - shell: bash - - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - name: Get Sources - uses: actions/checkout@v4.1.1 - with: - path: hdfsrc - - - name: Zip Folder - run: | - zip -r ${{ steps.set-file-base.outputs.FILE_BASE }}.zip ./hdfsrc - tar -zcvf ${{ steps.set-file-base.outputs.FILE_BASE }}.tar.gz ./hdfsrc - - - name: List files in the repository - run: | - ls -l ${{ github.workspace }} - ls $GITHUB_WORKSPACE - - # Save files created by release script - - name: Save tgz-tarball - uses: actions/upload-artifact@v4 - with: - name: tgz-tarball - path: ${{ steps.set-file-base.outputs.FILE_BASE }}.tar.gz - if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` - - - name: Save zip-tarball - uses: actions/upload-artifact@v4 - with: - name: zip-tarball - path: ${{ steps.set-file-base.outputs.FILE_BASE }}.zip - if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` + uses: ./.github/workflows/tarball.yml + with: +# use_tag: ${{ inputs.use_tag }} + use_environ: release call-workflow-ctest: - needs: create-files-ctest + needs: call-workflow-tarball uses: ./.github/workflows/cmake-ctest.yml with: - file_base: ${{ needs.create-files-ctest.outputs.file_base }} + file_base: ${{ needs.call-workflow-tarball.outputs.file_base }} + preset_name: ci-StdShar + use_environ: release + + call-workflow-abi: + needs: [log-the-inputs, call-workflow-tarball, call-workflow-ctest] + uses: ./.github/workflows/abi-report.yml + with: + file_ref: '1_14_3' + file_base: ${{ needs.call-workflow-tarball.outputs.file_base }} + use_tag: ${{ needs.log-the-inputs.outputs.rel_tag }} + use_environ: release call-workflow-release: - #needs: [call-workflow-tarball, call-workflow-ctest] - needs: [log-the-inputs, create-files-ctest, call-workflow-ctest] + needs: [log-the-inputs, call-workflow-tarball, call-workflow-ctest, call-workflow-abi] permissions: contents: write # In order to allow tag creation uses: ./.github/workflows/release-files.yml with: - file_base: ${{ needs.create-files-ctest.outputs.file_base }} + 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 }} use_tag: ${{ needs.log-the-inputs.outputs.rel_tag }} diff --git a/.github/workflows/remove-files.yml b/.github/workflows/remove-files.yml new file mode 100644 index 00000000000..edac1158c9d --- /dev/null +++ b/.github/workflows/remove-files.yml @@ -0,0 +1,59 @@ +name: hdf5 dev remove-files + +# Controls when the action will run. Triggers the workflow on a schedule +on: + workflow_call: + inputs: + use_tag: + description: 'Release version tag' + type: string + required: false + default: snapshot + use_environ: + description: 'Environment to locate files' + type: string + required: true + default: snapshots + file_base: + description: "The common base name of the source tarballs" + required: true + type: string + +# Minimal permissions to be inherited by any job that doesn't declare its own permissions +permissions: + contents: read + +# Previous workflows must pass to get here so tag the commit that created the files +jobs: + PreRelease-delfiles: + runs-on: ubuntu-latest + environment: ${{ inputs.use_environ }} + permissions: + contents: write + steps: + - name: Get file base name + id: get-file-base + run: | + FILE_NAME_BASE=$(echo "${{ inputs.file_base }}") + echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT + + - name: PreRelease delete from tag + id: delete_prerelease + if: ${{ (inputs.use_environ == 'snapshots') }} + uses: mknejp/delete-release-assets@v1 + with: + 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 }}.doxygen.zip + ${{ steps.get-file-base.outputs.FILE_BASE }}.tar.gz + ${{ steps.get-file-base.outputs.FILE_BASE }}.zip + ${{ steps.get-file-base.outputs.FILE_BASE }}-osx12.tar.gz + ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.tar.gz + ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.deb + ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.rpm + ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc_s3.tar.gz + ${{ 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 diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index d0a70d842f8..3f072d0782a 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -67,6 +67,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@012739e5082ff0c22ca6d6ab32e07c36df03c4a4 # v3.22.12 + uses: github/codeql-action/upload-sarif@8a470fddafa5cbb6266ee11b37ef4d8aae19c571 # v3.24.6 with: sarif_file: results.sarif diff --git a/.github/workflows/tarball.yml b/.github/workflows/tarball.yml index b52adf103b8..a721e1df908 100644 --- a/.github/workflows/tarball.yml +++ b/.github/workflows/tarball.yml @@ -145,3 +145,10 @@ jobs: name: zip-tarball path: ${{ steps.set-file-base.outputs.FILE_BASE }}.zip if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` + + - name: Save NEWSLETTER + uses: actions/upload-artifact@v4 + with: + name: NEWSLETTER + path: ./hdfsrc/release_docs/NEWSLETTER.txt + if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` diff --git a/.github/workflows/vol_adios2.yml b/.github/workflows/vol_adios2.yml index 5349a73adef..3d1d52e64a7 100644 --- a/.github/workflows/vol_adios2.yml +++ b/.github/workflows/vol_adios2.yml @@ -66,7 +66,7 @@ jobs: # still test the connector against changes in HDF5. - name: Restore ADIOS2 (${{ env.ADIOS2_COMMIT_SHORT }}) installation cache id: cache-adios2 - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ runner.workspace }}/adios2-${{ env.ADIOS2_COMMIT_SHORT }}-install key: ${{ runner.os }}-${{ runner.arch }}-adios2-${{ env.ADIOS2_COMMIT }}-${{ inputs.build_mode }}-cache @@ -96,7 +96,7 @@ jobs: make -j2 install - name: Cache ADIOS2 (${{ env.ADIOS2_COMMIT_SHORT }}) installation - uses: actions/cache/save@v3 + uses: actions/cache/save@v4 if: ${{ steps.cache-adios2.outputs.cache-hit != 'true' }} with: path: ${{ runner.workspace }}/adios2-${{ env.ADIOS2_COMMIT_SHORT }}-install diff --git a/.gitignore b/.gitignore index cbaccb29d32..d2fc4c79651 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,4 @@ src/H5version.h /.classpath /CMakeUserPresets.json +HDF5Examples/CMakeUserPresets.json diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 00000000000..4e611a57468 --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,12 @@ +cff-version: 1.2.0 +title: 'Hierarchical Data Format, version 5' +message: >- + If you use this software, please cite it using the + metadata from this file. +type: software +authors: + - name: The HDF Group + website: 'https://www.hdfgroup.org' +repository-code: 'https://github.com/HDFGroup/hdf5' +url: 'https://www.hdfgroup.org/HDF5/' +repository-artifact: 'https://www.hdfgroup.org/downloads/hdf5/' diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index aae6d659f4a..9229c4e1a7e 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -356,7 +356,10 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) endif () elseif (APPLE) list (APPEND CPACK_GENERATOR "STGZ") - list (APPEND CPACK_GENERATOR "DragNDrop") + option (HDF5_PACK_MACOSX_DMG "Package the HDF5 Library using DragNDrop" OFF) + if (HDF5_PACK_MACOSX_DMG) + list (APPEND CPACK_GENERATOR "DragNDrop") + endif () set (CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON) set (CPACK_PACKAGING_INSTALL_PREFIX "/${CPACK_PACKAGE_INSTALL_DIRECTORY}") set (CPACK_PACKAGE_ICON "${HDF_RESOURCES_DIR}/hdf.icns") diff --git a/CMakeLists.txt b/CMakeLists.txt index 9fe0b49f045..a2ebfcbec19 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -482,7 +482,9 @@ set (H5_ENABLE_STATIC_LIB NO) option (BUILD_SHARED_LIBS "Build Shared Libraries" ON) set (H5_ENABLE_SHARED_LIB NO) -# only shared libraries is true if user forces static OFF +option (HDF5_BUILD_STATIC_TOOLS "Build Static Tools NOT Shared Tools" OFF) + +# only shared libraries/tools is true if user forces static OFF if (NOT BUILD_STATIC_LIBS) set (ONLY_SHARED_LIBS ON CACHE BOOL "Only Build Shared Libraries" FORCE) endif () @@ -492,6 +494,15 @@ if (ONLY_SHARED_LIBS) set (H5_ENABLE_STATIC_LIB NO) set (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries" FORCE) set (BUILD_STATIC_LIBS OFF CACHE BOOL "Build Static Libraries" FORCE) + if (HDF5_BUILD_STATIC_TOOLS) + message (WARNING "Cannot build static tools without static libraries. Building shared tools.") + endif () + set (HDF5_BUILD_STATIC_TOOLS OFF CACHE BOOL "Build Static Tools NOT Shared Tools" FORCE) +endif () + +if (NOT BUILD_SHARED_LIBS AND NOT HDF5_BUILD_STATIC_TOOLS) + message (VERBOSE "Cannot build shared tools without shared libraries. Building static tools.") + set (HDF5_BUILD_STATIC_TOOLS ON CACHE BOOL "Build Static Tools NOT Shared Tools" FORCE) endif () if (BUILD_STATIC_LIBS) @@ -503,12 +514,6 @@ endif () set (CMAKE_POSITION_INDEPENDENT_CODE ON) -if (NOT BUILD_SHARED_LIBS) - set (tgt_file_ext "") -else () - set (tgt_file_ext "-shared") -endif () - #----------------------------------------------------------------------------- # perl is used in some optional src and tests, check availability find_package (Perl) @@ -961,7 +966,7 @@ if (HDF5_BUILD_DOC AND EXISTS "${HDF5_DOXYGEN_DIR}" AND IS_DIRECTORY "${HDF5_DOX # check if Doxygen is installed find_package(Doxygen) if (DOXYGEN_FOUND) - option (HDF5_ENABLE_DOXY_WARNINGS "Enable fail if doxygen parsing has warnings." ON) + option (HDF5_ENABLE_DOXY_WARNINGS "Enable fail if doxygen parsing has warnings." OFF) mark_as_advanced (HDF5_ENABLE_DOXY_WARNINGS) if (HDF5_ENABLE_DOXY_WARNINGS) set (HDF5_DOXY_WARNINGS "FAIL_ON_WARNINGS") @@ -1085,6 +1090,13 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for if (MPI_Fortran_LINK_FLAGS) set (CMAKE_Fortran_EXE_LINKER_FLAGS "${MPI_Fortran_LINK_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}") endif () + # Check if MPI-3 Fortran 2008 module mpi_f08 is supported + if (MPI_Fortran_HAVE_F08_MODULE) + set (H5_HAVE_MPI_F08 1) + message (VERBOSE "MPI-3 Fortran 2008 module mpi_f08 is supported") + else () + message (VERBOSE "MPI-3 Fortran 2008 module mpi_f08 is NOT supported") + endif () endif () #option (HDF5_INSTALL_MOD_FORTRAN "Copy FORTRAN mod files to include directory (NO SHARED STATIC)" "NO") @@ -1151,10 +1163,19 @@ endif () if (EXISTS "${HDF5_SOURCE_DIR}/java" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/java") option (HDF5_BUILD_JAVA "Build Java HDF5 Library" OFF) if (HDF5_BUILD_JAVA) - add_subdirectory (java) + if (NOT BUILD_SHARED_LIBS) + message (FATAL_ERROR "\nJava requires shared libraries!\n") + else () + add_subdirectory (java) + endif () endif () endif () +#----------------------------------------------------------------------------- +# Generate the H5pubconf.h file containing user settings needed by compilation +#----------------------------------------------------------------------------- +configure_file (${HDF_RESOURCES_DIR}/H5pubconf.h.in ${HDF5_SRC_BINARY_DIR}/H5pubconf.h @ONLY) + #----------------------------------------------------------------------------- # Option to build examples #----------------------------------------------------------------------------- @@ -1167,9 +1188,4 @@ if (EXISTS "${HDF5_SOURCE_DIR}/HDF5Examples" AND IS_DIRECTORY "${HDF5_SOURCE_DIR endif () endif () -#----------------------------------------------------------------------------- -# Generate the H5pubconf.h file containing user settings needed by compilation -#----------------------------------------------------------------------------- -configure_file (${HDF_RESOURCES_DIR}/H5pubconf.h.in ${HDF5_SRC_BINARY_DIR}/H5pubconf.h @ONLY) - include (CMakeInstallation.cmake) diff --git a/CMakePresets.json b/CMakePresets.json index 65c56d7a831..61afadd7b92 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -242,6 +242,23 @@ "ci-x64-Release-Clang" ] }, + { + "name": "ci-StdShar-OSX-Clang", + "configurePreset": "ci-StdShar-Clang", + "inherits": [ + "ci-x64-Release-Clang" + ], + "execution": { + "noTestsAction": "error", + "timeout": 180, + "jobs": 2 + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + } + }, { "name": "ci-StdShar-GNUC", "configurePreset": "ci-StdShar-GNUC", @@ -257,7 +274,7 @@ ] }, { - "name": "ci-StdShar-Intel", + "name": "ci-StdShar-win-Intel", "configurePreset": "ci-StdShar-Intel", "inherits": [ "ci-x64-Release-Intel" @@ -266,7 +283,19 @@ "exclude": { "name": "H5DUMP-tfloatsattrs" } + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" } + }, + { + "name": "ci-StdShar-Intel", + "configurePreset": "ci-StdShar-Intel", + "inherits": [ + "ci-x64-Release-Intel" + ] } ], "packagePresets": [ @@ -315,6 +344,15 @@ {"type": "package", "name": "ci-StdShar-Clang"} ] }, + { + "name": "ci-StdShar-OSX-Clang", + "steps": [ + {"type": "configure", "name": "ci-StdShar-Clang"}, + {"type": "build", "name": "ci-StdShar-Clang"}, + {"type": "test", "name": "ci-StdShar-OSX-Clang"}, + {"type": "package", "name": "ci-StdShar-Clang"} + ] + }, { "name": "ci-StdShar-GNUC", "steps": [ @@ -341,7 +379,15 @@ {"type": "test", "name": "ci-StdShar-Intel"}, {"type": "package", "name": "ci-StdShar-Intel"} ] + }, + { + "name": "ci-StdShar-win-Intel", + "steps": [ + {"type": "configure", "name": "ci-StdShar-Intel"}, + {"type": "build", "name": "ci-StdShar-Intel"}, + {"type": "test", "name": "ci-StdShar-win-Intel"}, + {"type": "package", "name": "ci-StdShar-Intel"} + ] } ] } - diff --git a/HDF5Examples/C/CMakeLists.txt b/HDF5Examples/C/CMakeLists.txt index 4ac8574724a..12882cfa5fa 100644 --- a/HDF5Examples/C/CMakeLists.txt +++ b/HDF5Examples/C/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required (VERSION 3.12) -project (HDF5Examples_C) +project (HDF5Examples_C C) #----------------------------------------------------------------------------- # Build the C Examples diff --git a/HDF5Examples/C/H5PAR/CMakeLists.txt b/HDF5Examples/C/H5PAR/CMakeLists.txt index 6e569b4dfea..9016220d2a8 100644 --- a/HDF5Examples/C/H5PAR/CMakeLists.txt +++ b/HDF5Examples/C/H5PAR/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required (VERSION 3.12) -PROJECT (H5PAR_C) +project (H5PAR_C C) #----------------------------------------------------------------------------- # Define Sources diff --git a/HDF5Examples/C/H5PAR/ph5_dataset.c b/HDF5Examples/C/H5PAR/ph5_dataset.c index 9b8e8a833b3..0c25fcc6103 100644 --- a/HDF5Examples/C/H5PAR/ph5_dataset.c +++ b/HDF5Examples/C/H5PAR/ph5_dataset.c @@ -53,6 +53,24 @@ main(int argc, char **argv) plist_id = H5Pcreate(H5P_FILE_ACCESS); H5Pset_fapl_mpio(plist_id, comm, info); + /* + * OPTIONAL: It is generally recommended to set collective + * metadata reads on FAPL to perform metadata reads + * collectively, which usually allows datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_all_coll_metadata_ops(plist_id, true); + + /* + * OPTIONAL: It is generally recommended to set collective + * metadata writes on FAPL to perform metadata writes + * collectively, which usually allows datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_coll_metadata_write(plist_id, true); + /* * Create a new file collectively and release property list identifier. */ diff --git a/HDF5Examples/C/H5PAR/ph5_file_create.c b/HDF5Examples/C/H5PAR/ph5_file_create.c index a3bd0a8d026..10938f29b1a 100644 --- a/HDF5Examples/C/H5PAR/ph5_file_create.c +++ b/HDF5Examples/C/H5PAR/ph5_file_create.c @@ -36,6 +36,24 @@ main(int argc, char **argv) plist_id = H5Pcreate(H5P_FILE_ACCESS); H5Pset_fapl_mpio(plist_id, comm, info); + /* + * OPTIONAL: It is generally recommended to set collective + * metadata reads on FAPL to perform metadata reads + * collectively, which usually allows datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_all_coll_metadata_ops(plist_id, true); + + /* + * OPTIONAL: It is generally recommended to set collective + * metadata writes on FAPL to perform metadata writes + * collectively, which usually allows datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_coll_metadata_write(plist_id, true); + /* * Create a new file collectively. */ diff --git a/HDF5Examples/C/H5PAR/ph5_filtered_writes.c b/HDF5Examples/C/H5PAR/ph5_filtered_writes.c index 104704a238a..34ed2fbb0cf 100644 --- a/HDF5Examples/C/H5PAR/ph5_filtered_writes.c +++ b/HDF5Examples/C/H5PAR/ph5_filtered_writes.c @@ -377,13 +377,23 @@ main(int argc, char **argv) H5Pset_fapl_mpio(fapl_id, comm, info); /* - * OPTIONAL: Set collective metadata reads on FAPL to allow - * parallel writes to filtered datasets to perform - * better at scale. While not strictly necessary, - * this is generally recommended. + * OPTIONAL: It is generally recommended to set collective + * metadata reads on FAPL to perform metadata reads + * collectively, which usually allows filtered datasets + * to perform better at scale, although it is not + * strictly necessary. */ H5Pset_all_coll_metadata_ops(fapl_id, true); + /* + * OPTIONAL: It is generally recommended to set collective + * metadata writes on FAPL to perform metadata writes + * collectively, which usually allows filtered datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_coll_metadata_write(fapl_id, true); + /* * OPTIONAL: Set the latest file format version for HDF5 in * order to gain access to different dataset chunk diff --git a/HDF5Examples/C/H5PAR/ph5_filtered_writes_no_sel.c b/HDF5Examples/C/H5PAR/ph5_filtered_writes_no_sel.c index a4d9e169c36..d4f171ff1f8 100644 --- a/HDF5Examples/C/H5PAR/ph5_filtered_writes_no_sel.c +++ b/HDF5Examples/C/H5PAR/ph5_filtered_writes_no_sel.c @@ -271,13 +271,23 @@ main(int argc, char **argv) H5Pset_fapl_mpio(fapl_id, comm, info); /* - * OPTIONAL: Set collective metadata reads on FAPL to allow - * parallel writes to filtered datasets to perform - * better at scale. While not strictly necessary, - * this is generally recommended. + * OPTIONAL: It is generally recommended to set collective + * metadata reads on FAPL to perform metadata reads + * collectively, which usually allows filtered datasets + * to perform better at scale, although it is not + * strictly necessary. */ H5Pset_all_coll_metadata_ops(fapl_id, true); + /* + * OPTIONAL: It is generally recommended to set collective + * metadata writes on FAPL to perform metadata writes + * collectively, which usually allows filtered datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_coll_metadata_write(fapl_id, true); + /* * OPTIONAL: Set the latest file format version for HDF5 in * order to gain access to different dataset chunk diff --git a/HDF5Examples/C/H5PAR/ph5_hyperslab_by_chunk.c b/HDF5Examples/C/H5PAR/ph5_hyperslab_by_chunk.c index a255b96e0e3..e00a0ef663b 100644 --- a/HDF5Examples/C/H5PAR/ph5_hyperslab_by_chunk.c +++ b/HDF5Examples/C/H5PAR/ph5_hyperslab_by_chunk.c @@ -64,6 +64,24 @@ main(int argc, char **argv) plist_id = H5Pcreate(H5P_FILE_ACCESS); H5Pset_fapl_mpio(plist_id, comm, info); + /* + * OPTIONAL: It is generally recommended to set collective + * metadata reads on FAPL to perform metadata reads + * collectively, which usually allows datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_all_coll_metadata_ops(plist_id, true); + + /* + * OPTIONAL: It is generally recommended to set collective + * metadata writes on FAPL to perform metadata writes + * collectively, which usually allows datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_coll_metadata_write(plist_id, true); + /* * Create a new file collectively and release property list identifier. */ diff --git a/HDF5Examples/C/H5PAR/ph5_hyperslab_by_col.c b/HDF5Examples/C/H5PAR/ph5_hyperslab_by_col.c index b397fcff3bf..49e5ce30799 100644 --- a/HDF5Examples/C/H5PAR/ph5_hyperslab_by_col.c +++ b/HDF5Examples/C/H5PAR/ph5_hyperslab_by_col.c @@ -59,6 +59,24 @@ main(int argc, char **argv) plist_id = H5Pcreate(H5P_FILE_ACCESS); H5Pset_fapl_mpio(plist_id, comm, info); + /* + * OPTIONAL: It is generally recommended to set collective + * metadata reads on FAPL to perform metadata reads + * collectively, which usually allows datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_all_coll_metadata_ops(plist_id, true); + + /* + * OPTIONAL: It is generally recommended to set collective + * metadata writes on FAPL to perform metadata writes + * collectively, which usually allows datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_coll_metadata_write(plist_id, true); + /* * Create a new file collectively and release property list identifier. */ diff --git a/HDF5Examples/C/H5PAR/ph5_hyperslab_by_pattern.c b/HDF5Examples/C/H5PAR/ph5_hyperslab_by_pattern.c index 77f3bef27c7..bec3a2f806a 100644 --- a/HDF5Examples/C/H5PAR/ph5_hyperslab_by_pattern.c +++ b/HDF5Examples/C/H5PAR/ph5_hyperslab_by_pattern.c @@ -64,6 +64,24 @@ main(int argc, char **argv) plist_id = H5Pcreate(H5P_FILE_ACCESS); H5Pset_fapl_mpio(plist_id, comm, info); + /* + * OPTIONAL: It is generally recommended to set collective + * metadata reads on FAPL to perform metadata reads + * collectively, which usually allows datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_all_coll_metadata_ops(plist_id, true); + + /* + * OPTIONAL: It is generally recommended to set collective + * metadata writes on FAPL to perform metadata writes + * collectively, which usually allows datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_coll_metadata_write(plist_id, true); + /* * Create a new file collectively and release property list identifier. */ diff --git a/HDF5Examples/C/H5PAR/ph5_hyperslab_by_row.c b/HDF5Examples/C/H5PAR/ph5_hyperslab_by_row.c index 503578676d4..1c08a32d69e 100644 --- a/HDF5Examples/C/H5PAR/ph5_hyperslab_by_row.c +++ b/HDF5Examples/C/H5PAR/ph5_hyperslab_by_row.c @@ -48,6 +48,24 @@ main(int argc, char **argv) plist_id = H5Pcreate(H5P_FILE_ACCESS); H5Pset_fapl_mpio(plist_id, comm, info); + /* + * OPTIONAL: It is generally recommended to set collective + * metadata reads on FAPL to perform metadata reads + * collectively, which usually allows datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_all_coll_metadata_ops(plist_id, true); + + /* + * OPTIONAL: It is generally recommended to set collective + * metadata writes on FAPL to perform metadata writes + * collectively, which usually allows datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_coll_metadata_write(plist_id, true); + /* * Create a new file collectively and release property list identifier. */ diff --git a/HDF5Examples/C/H5PAR/ph5example.c b/HDF5Examples/C/H5PAR/ph5example.c index 5ec2cdc2841..37d5d68ed72 100644 --- a/HDF5Examples/C/H5PAR/ph5example.c +++ b/HDF5Examples/C/H5PAR/ph5example.c @@ -269,6 +269,24 @@ phdf5writeInd(char *filename) assert(ret != FAIL); MESG("H5Pset_fapl_mpio succeed"); + /* + * OPTIONAL: It is generally recommended to set collective + * metadata reads on FAPL to perform metadata reads + * collectively, which usually allows datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_all_coll_metadata_ops(acc_tpl1, true); + + /* + * OPTIONAL: It is generally recommended to set collective + * metadata writes on FAPL to perform metadata writes + * collectively, which usually allows datasets + * to perform better at scale, although it is not + * strictly necessary. + */ + H5Pset_coll_metadata_write(acc_tpl1, true); + /* create the file collectively */ fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl1); assert(fid1 != FAIL); diff --git a/HDF5Examples/C/H5T/CMakeLists.txt b/HDF5Examples/C/H5T/CMakeLists.txt index 8c4084f1a1b..e0d76e83fe8 100644 --- a/HDF5Examples/C/H5T/CMakeLists.txt +++ b/HDF5Examples/C/H5T/CMakeLists.txt @@ -127,7 +127,7 @@ if (HDF5_BUILD_TOOLS) TARGET ${EXAMPLE_VARNAME}_${example_name} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/114/${example_name}.ddl ${example_name}.ddl + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/114/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl ) endif () elseif (${H5_LIBVER_DIR} EQUAL 16) @@ -142,7 +142,7 @@ if (HDF5_BUILD_TOOLS) TARGET ${EXAMPLE_VARNAME}_${example_name} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${example_name}.ddl + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl ) endif () elseif ((${example_name} STREQUAL "h5ex_t_objref" OR ${example_name} STREQUAL "h5ex_t_objrefatt") OR (${example_name} STREQUAL "h5ex_t_regref" OR ${example_name} STREQUAL "h5ex_t_regrefatt")) @@ -153,14 +153,14 @@ if (HDF5_BUILD_TOOLS) TARGET ${EXAMPLE_VARNAME}_${example_name} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}21.ddl ${example_name}.ddl + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}21.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl ) else () add_custom_command ( TARGET ${EXAMPLE_VARNAME}_${example_name} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${example_name}.ddl + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl ) endif () elseif (HDF5_VERSION_MAJOR VERSION_EQUAL "1.10") @@ -169,14 +169,14 @@ if (HDF5_BUILD_TOOLS) TARGET ${EXAMPLE_VARNAME}_${example_name} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/110/${example_name}06.ddl ${example_name}.ddl + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/110/${example_name}06.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl ) else () add_custom_command ( TARGET ${EXAMPLE_VARNAME}_${example_name} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${example_name}.ddl + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl ) endif () elseif (HDF5_VERSION_MAJOR VERSION_GREATER_EQUAL "1.12") @@ -192,7 +192,7 @@ if (HDF5_BUILD_TOOLS) TARGET ${EXAMPLE_VARNAME}_${example_name} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/112/${example_name}.ddl ${example_name}.ddl + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/112/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl ) endif () else () @@ -200,7 +200,7 @@ if (HDF5_BUILD_TOOLS) TARGET ${EXAMPLE_VARNAME}_${example_name} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${example_name}.ddl + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl ) endif () else () @@ -210,14 +210,14 @@ if (HDF5_BUILD_TOOLS) TARGET ${EXAMPLE_VARNAME}_${example_name} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}21.ddl ${example_name}.ddl + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}21.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl ) else () add_custom_command ( TARGET ${EXAMPLE_VARNAME}_${example_name} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${example_name}.ddl + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl ) endif () elseif (HDF5_VERSION_MAJOR VERSION_EQUAL "1.10") @@ -226,14 +226,14 @@ if (HDF5_BUILD_TOOLS) TARGET ${EXAMPLE_VARNAME}_${example_name} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/110/${example_name}06.ddl ${example_name}.ddl + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/110/${example_name}06.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl ) else () add_custom_command ( TARGET ${EXAMPLE_VARNAME}_${example_name} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${example_name}.ddl + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl ) endif () elseif (HDF5_VERSION_MAJOR VERSION_GREATER_EQUAL "1.12") @@ -241,14 +241,14 @@ if (HDF5_BUILD_TOOLS) TARGET ${EXAMPLE_VARNAME}_${example_name} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/112/${example_name}.ddl ${example_name}.ddl + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/112/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl ) else () add_custom_command ( TARGET ${EXAMPLE_VARNAME}_${example_name} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${example_name}.ddl + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl ) endif () endif () @@ -264,7 +264,7 @@ if (HDF5_BUILD_TOOLS) TARGET ${EXAMPLE_VARNAME}_${example_name} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${example_name}.ddl + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl ) endif () endif () diff --git a/HDF5Examples/C/H5T/h5ex_t_convert.c b/HDF5Examples/C/H5T/h5ex_t_convert.c index b6f46b6f8fc..b7036e3e0c5 100644 --- a/HDF5Examples/C/H5T/h5ex_t_convert.c +++ b/HDF5Examples/C/H5T/h5ex_t_convert.c @@ -120,7 +120,7 @@ main(void) * Output the data to the screen. */ for (i = 0; i < DIM0; i++) { - printf("sensor[%d]:\n", i); + printf("sensor[%" PRIuHSIZE "]:\n", i); printf("Serial number : %d\n", sensor[i].serial_no); printf("Location : %s\n", sensor[i].location); printf("Temperature (F) : %f\n", sensor[i].temperature); diff --git a/HDF5Examples/C/H5T/h5ex_t_objref.c b/HDF5Examples/C/H5T/h5ex_t_objref.c index 1109720c30b..660cc110a25 100644 --- a/HDF5Examples/C/H5T/h5ex_t_objref.c +++ b/HDF5Examples/C/H5T/h5ex_t_objref.c @@ -36,7 +36,7 @@ main(void) hid_t ref_type = H5T_STD_REF; /* Reference datatype */ H5R_ref_t wdata[DIM0]; /* buffer to write to disk */ H5R_ref_t *rdata = NULL; /* buffer to read into*/ - H5R_type_t objtype; /* Reference type */ + H5O_type_t objtype; /* Reference type */ #else hid_t ref_type = H5T_STD_REF_OBJ; /* Reference datatype */ hobj_ref_t wdata[DIM0]; /* Write buffer */ diff --git a/HDF5Examples/C/H5T/h5ex_t_objrefatt.c b/HDF5Examples/C/H5T/h5ex_t_objrefatt.c index a464e9e928a..1d9d1feb91a 100644 --- a/HDF5Examples/C/H5T/h5ex_t_objrefatt.c +++ b/HDF5Examples/C/H5T/h5ex_t_objrefatt.c @@ -38,7 +38,7 @@ main(void) hid_t ref_type = H5T_STD_REF; /* Reference datatype */ H5R_ref_t wdata[DIM0]; /* buffer to write to disk */ H5R_ref_t *rdata = NULL; /* buffer to read into*/ - H5R_type_t objtype; /* Reference type */ + H5O_type_t objtype; /* Reference type */ #else hid_t ref_type = H5T_STD_REF_OBJ; /* Reference datatype */ hobj_ref_t wdata[DIM0]; /* Write buffer */ diff --git a/HDF5Examples/C/H5T/h5ex_t_opaque.c b/HDF5Examples/C/H5T/h5ex_t_opaque.c index 085183a1668..11a58aea2e0 100644 --- a/HDF5Examples/C/H5T/h5ex_t_opaque.c +++ b/HDF5Examples/C/H5T/h5ex_t_opaque.c @@ -111,7 +111,7 @@ main(void) */ printf("Datatype tag for %s is: \"%s\"\n", DATASET, tag); for (i = 0; i < dims[0]; i++) { - printf("%s[%u]: ", DATASET, i); + printf("%s[%" PRIuHSIZE "]: ", DATASET, i); for (j = 0; j < len; j++) printf("%c", rdata[j + i * len]); printf("\n"); diff --git a/HDF5Examples/C/H5VDS/h5ex_vds-eiger.c b/HDF5Examples/C/H5VDS/h5ex_vds-eiger.c index 0629d734cb7..8a41de6f269 100644 --- a/HDF5Examples/C/H5VDS/h5ex_vds-eiger.c +++ b/HDF5Examples/C/H5VDS/h5ex_vds-eiger.c @@ -89,7 +89,7 @@ main(void) status = H5Pset_virtual(dcpl, vspace, "f-%b.h5", "/A", src_space); /* Create a virtual dataset */ - dset = H5Dcreate2(file, DATASET, H5T_NATIVE_INT, vspace, H5P_DEFAULT, dcpl, H5P_DEFAULT); + dset = H5Dcreate2(file, DATASET, H5T_STD_I32LE, vspace, H5P_DEFAULT, dcpl, H5P_DEFAULT); status = H5Sclose(vspace); status = H5Sclose(src_space); status = H5Dclose(dset); diff --git a/HDF5Examples/C/H5VDS/h5ex_vds-exc.c b/HDF5Examples/C/H5VDS/h5ex_vds-exc.c index 10bb68c75c2..de26911b342 100644 --- a/HDF5Examples/C/H5VDS/h5ex_vds-exc.c +++ b/HDF5Examples/C/H5VDS/h5ex_vds-exc.c @@ -120,7 +120,7 @@ main(void) } /* Create a virtual dataset */ - dset = H5Dcreate2(file, DATASET, H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); + dset = H5Dcreate2(file, DATASET, H5T_STD_I32LE, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); status = H5Sclose(space); status = H5Sclose(nsrc_space); status = H5Sclose(lsrc_space); diff --git a/HDF5Examples/C/H5VDS/h5ex_vds-exclim.c b/HDF5Examples/C/H5VDS/h5ex_vds-exclim.c index 6bebe76e3c1..61b3078cdbc 100644 --- a/HDF5Examples/C/H5VDS/h5ex_vds-exclim.c +++ b/HDF5Examples/C/H5VDS/h5ex_vds-exclim.c @@ -114,7 +114,7 @@ main(void) } /* Create a virtual dataset */ - dset = H5Dcreate2(file, DATASET, H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); + dset = H5Dcreate2(file, DATASET, H5T_STD_I32LE, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); status = H5Sclose(space); status = H5Sclose(nsrc_space); status = H5Sclose(lsrc_space); diff --git a/HDF5Examples/C/H5VDS/h5ex_vds-percival-unlim-maxmin.c b/HDF5Examples/C/H5VDS/h5ex_vds-percival-unlim-maxmin.c index 8ef996a8e17..9ca030a4052 100644 --- a/HDF5Examples/C/H5VDS/h5ex_vds-percival-unlim-maxmin.c +++ b/HDF5Examples/C/H5VDS/h5ex_vds-percival-unlim-maxmin.c @@ -95,7 +95,7 @@ main(void) src_space = H5Screate_simple(RANK, dims, dims_max); dcpl = H5Pcreate(H5P_DATASET_CREATE); status = H5Pset_chunk(dcpl, RANK, chunk_dims); - dset = H5Dcreate2(file, SRC_DATASET[i], H5T_NATIVE_INT, src_space, H5P_DEFAULT, dcpl, H5P_DEFAULT); + dset = H5Dcreate2(file, SRC_DATASET[i], H5T_STD_I32LE, src_space, H5P_DEFAULT, dcpl, H5P_DEFAULT); status = H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); status = H5Sclose(src_space); status = H5Pclose(dcpl); @@ -145,7 +145,7 @@ main(void) H5Sselect_none(vspace); /* Create a virtual dataset */ - vdset = H5Dcreate2(vfile, DATASET, H5T_NATIVE_INT, vspace, H5P_DEFAULT, dcpl, H5P_DEFAULT); + vdset = H5Dcreate2(vfile, DATASET, H5T_STD_I32LE, vspace, H5P_DEFAULT, dcpl, H5P_DEFAULT); status = H5Sclose(vspace); status = H5Sclose(src_space); status = H5Pclose(dcpl); diff --git a/HDF5Examples/C/H5VDS/h5ex_vds-percival-unlim.c b/HDF5Examples/C/H5VDS/h5ex_vds-percival-unlim.c index fadfb790a5d..71a8ddaac9a 100644 --- a/HDF5Examples/C/H5VDS/h5ex_vds-percival-unlim.c +++ b/HDF5Examples/C/H5VDS/h5ex_vds-percival-unlim.c @@ -92,7 +92,7 @@ main(void) src_space = H5Screate_simple(RANK, dims, dims_max); dcpl = H5Pcreate(H5P_DATASET_CREATE); status = H5Pset_chunk(dcpl, RANK, chunk_dims); - dset = H5Dcreate2(file, SRC_DATASET[i], H5T_NATIVE_INT, src_space, H5P_DEFAULT, dcpl, H5P_DEFAULT); + dset = H5Dcreate2(file, SRC_DATASET[i], H5T_STD_I32LE, src_space, H5P_DEFAULT, dcpl, H5P_DEFAULT); status = H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); status = H5Sclose(src_space); status = H5Pclose(dcpl); @@ -142,7 +142,7 @@ main(void) H5Sselect_none(vspace); /* Create a virtual dataset */ - vdset = H5Dcreate2(vfile, DATASET, H5T_NATIVE_INT, vspace, H5P_DEFAULT, dcpl, H5P_DEFAULT); + vdset = H5Dcreate2(vfile, DATASET, H5T_STD_I32LE, vspace, H5P_DEFAULT, dcpl, H5P_DEFAULT); status = H5Sclose(vspace); status = H5Sclose(src_space); status = H5Pclose(dcpl); diff --git a/HDF5Examples/C/H5VDS/h5ex_vds-percival.c b/HDF5Examples/C/H5VDS/h5ex_vds-percival.c index edbef18a9b0..75e1653da95 100644 --- a/HDF5Examples/C/H5VDS/h5ex_vds-percival.c +++ b/HDF5Examples/C/H5VDS/h5ex_vds-percival.c @@ -80,12 +80,12 @@ main(void) file = H5Fcreate(SRC_FILE[i], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); src_space = H5Screate_simple(RANK, dims, NULL); - dset = H5Dcreate2(file, SRC_DATASET[i], H5T_NATIVE_INT, src_space, H5P_DEFAULT, H5P_DEFAULT, - H5P_DEFAULT); - status = H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - status = H5Sclose(src_space); - status = H5Dclose(dset); - status = H5Fclose(file); + dset = + H5Dcreate2(file, SRC_DATASET[i], H5T_STD_I32LE, src_space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + status = H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); + status = H5Sclose(src_space); + status = H5Dclose(dset); + status = H5Fclose(file); } file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -130,7 +130,7 @@ main(void) H5Sselect_none(vspace); /* Create a virtual dataset */ - dset = H5Dcreate2(file, DATASET, H5T_NATIVE_INT, vspace, H5P_DEFAULT, dcpl, H5P_DEFAULT); + dset = H5Dcreate2(file, DATASET, H5T_STD_I32LE, vspace, H5P_DEFAULT, dcpl, H5P_DEFAULT); status = H5Sclose(vspace); status = H5Sclose(src_space); status = H5Dclose(dset); diff --git a/HDF5Examples/C/H5VDS/h5ex_vds-simpleIO.c b/HDF5Examples/C/H5VDS/h5ex_vds-simpleIO.c index 3bd3133e551..52be8f5da77 100644 --- a/HDF5Examples/C/H5VDS/h5ex_vds-simpleIO.c +++ b/HDF5Examples/C/H5VDS/h5ex_vds-simpleIO.c @@ -69,7 +69,7 @@ main(void) */ file = H5Fcreate(SRC_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); space = H5Screate_simple(RANK, dims, NULL); - dset = H5Dcreate2(file, SRC_DATASET, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + dset = H5Dcreate2(file, SRC_DATASET, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata[0]); status = H5Sclose(space); status = H5Dclose(dset); @@ -94,7 +94,7 @@ main(void) status = H5Pset_virtual(dcpl, vspace, SRC_FILE, SRC_DATASET, src_space); /* Create a virtual dataset */ - dset = H5Dcreate2(file, DATASET, H5T_NATIVE_INT, vspace, H5P_DEFAULT, dcpl, H5P_DEFAULT); + dset = H5Dcreate2(file, DATASET, H5T_STD_I32LE, vspace, H5P_DEFAULT, dcpl, H5P_DEFAULT); status = H5Sclose(vspace); status = H5Sclose(src_space); status = H5Dclose(dset); diff --git a/HDF5Examples/C/H5VDS/h5ex_vds.c b/HDF5Examples/C/H5VDS/h5ex_vds.c index 96a81374de2..77219e87f03 100644 --- a/HDF5Examples/C/H5VDS/h5ex_vds.c +++ b/HDF5Examples/C/H5VDS/h5ex_vds.c @@ -87,7 +87,7 @@ main(void) file = H5Fcreate(SRC_FILE[i], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); space = H5Screate_simple(RANK1, dims, NULL); - dset = H5Dcreate2(file, SRC_DATASET[i], H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + dset = H5Dcreate2(file, SRC_DATASET[i], H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); status = H5Sclose(space); status = H5Dclose(dset); @@ -127,7 +127,7 @@ main(void) } /* Create a virtual dataset. */ - dset = H5Dcreate2(file, DATASET, H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); + dset = H5Dcreate2(file, DATASET, H5T_STD_I32LE, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); status = H5Sclose(space); status = H5Sclose(src_space); status = H5Dclose(dset); diff --git a/HDF5Examples/C/Perf/CMakeLists.txt b/HDF5Examples/C/Perf/CMakeLists.txt index e41def213e5..66f93273629 100644 --- a/HDF5Examples/C/Perf/CMakeLists.txt +++ b/HDF5Examples/C/Perf/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required (VERSION 3.12) -PROJECT (HDF5Examples_C_PERFORM) +project (HDF5Examples_C_PERFORM C) #----------------------------------------------------------------------------- # Define Sources diff --git a/HDF5Examples/CMakePresets.json b/HDF5Examples/CMakePresets.json index 263ff293b41..d9fdd04201a 100644 --- a/HDF5Examples/CMakePresets.json +++ b/HDF5Examples/CMakePresets.json @@ -128,6 +128,23 @@ "ci-x64-Release-Clang" ] }, + { + "name": "ci-StdShar-OSX-Clang", + "configurePreset": "ci-StdShar-Clang", + "inherits": [ + "ci-x64-Release-Clang" + ], + "execution": { + "noTestsAction": "error", + "timeout": 180, + "jobs": 2 + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + } + }, { "name": "ci-StdShar-GNUC", "configurePreset": "ci-StdShar-GNUC", @@ -135,6 +152,23 @@ "ci-x64-Release-GNUC" ] }, + { + "name": "ci-StdShar-win-Intel", + "configurePreset": "ci-StdShar-Intel", + "inherits": [ + "ci-x64-Release-Intel" + ], + "filter": { + "exclude": { + "name": "H5DUMP-tfloatsattrs" + } + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, { "name": "ci-StdShar-Intel", "configurePreset": "ci-StdShar-Intel", @@ -160,6 +194,14 @@ {"type": "test", "name": "ci-StdShar-Clang"} ] }, + { + "name": "ci-StdShar-OSX-Clang", + "steps": [ + {"type": "configure", "name": "ci-StdShar-Clang"}, + {"type": "build", "name": "ci-StdShar-Clang"}, + {"type": "test", "name": "ci-StdShar-OSX-Clang"} + ] + }, { "name": "ci-StdShar-GNUC", "steps": [ @@ -175,6 +217,14 @@ {"type": "build", "name": "ci-StdShar-Intel"}, {"type": "test", "name": "ci-StdShar-Intel"} ] + }, + { + "name": "ci-StdShar-win-Intel", + "steps": [ + {"type": "configure", "name": "ci-StdShar-Intel"}, + {"type": "build", "name": "ci-StdShar-Intel"}, + {"type": "test", "name": "ci-StdShar-win-Intel"} + ] } ] } diff --git a/HDF5Examples/CMakeUserPresets.json b/HDF5Examples/CMakeUserPresets.json deleted file mode 100644 index 5b479beddb4..00000000000 --- a/HDF5Examples/CMakeUserPresets.json +++ /dev/null @@ -1,244 +0,0 @@ -{ - "version": 6, - "configurePresets": [ - { - "name": "my-HDF5114", - "hidden": true, - "environment": { - "HDF5_ROOT": "${sourceParentDir}/temp/HDF_Group/HDF5/1.14.3", - "HDF5_PLUGIN_PATH": "${sourceParentDir}/temp/HDF_Group/HDF5/1.14.3/lib/plugin" - }, - "cacheVariables": { - "HDF5_ROOT": {"type": "STRING", "value": "${sourceParentDir}/temp/HDF_Group/HDF5/1.14.3"}, - "HDF_BUILD_FORTRAN": "ON", - "HDF_BUILD_JAVA": "ON", - "HDF_BUILD_FILTERS": "ON", - "H5EX_BUILD_TESTING": "ON" - } - }, - { - "name": "my-HDF5Dev", - "hidden": true, - "environment": { - "HDF5_ROOT": "${sourceParentDir}/temp/HDF_Group/HDF5/1.15.0", - "HDF5_PLUGIN_PATH": "${sourceParentDir}/temp/HDF_Group/HDF5/1.15.0/lib/plugin" - }, - "cacheVariables": { - "HDF5_ROOT": {"type": "STRING", "value": "${sourceParentDir}/temp/HDF_Group/HDF5/1.15.0"}, - "HDF_BUILD_FORTRAN": "ON", - "HDF_BUILD_JAVA": "ON", - "HDF_BUILD_FILTERS": "ON", - "H5EX_BUILD_TESTING": "ON" - } - }, - { - "name": "my-StdShar", - "hidden": true, - "inherits": ["ci-base", "ci-base-examples", "ci-StdPlugins"], - "cacheVariables": { - "BUILD_SHARED_LIBS": "ON", - "USE_SHARED_LIBS": "ON" - } - }, - { - "name": "my-StdShar-MSVC", - "description": "MSVC Standard Config for x64 (Release)", - "inherits": [ - "ci-x64-Release-MSVC", - "my-StdShar", - "my-HDF5Dev" - ] - }, - { - "name": "my-StdShar-Clang", - "description": "Clang Standard Config for x64 (Release)", - "inherits": [ - "ci-x64-Release-Clang", - "my-StdShar", - "my-HDF5Dev" - ] - }, - { - "name": "my-StdShar-GNUC", - "description": "GNUC Standard Config for x64 (Release)", - "inherits": [ - "ci-x64-Release-GNUC", - "my-StdShar", - "my-HDF5Dev" - ] - }, - { - "name": "my-114Shar-MSVC", - "description": "MSVC 1.14 Config for x64 (Release)", - "inherits": [ - "ci-x64-Release-MSVC", - "my-StdShar", - "my-HDF5114" - ] - }, - { - "name": "my-114Shar-Clang", - "description": "Clang 1.14 Config for x64 (Release)", - "inherits": [ - "ci-x64-Release-Clang", - "my-StdShar", - "my-HDF5114" - ] - }, - { - "name": "my-114Shar-GNUC", - "description": "GNUC 1.14 Config for x64 (Release)", - "inherits": [ - "ci-x64-Release-GNUC", - "my-StdShar", - "my-HDF5114" - ] - } - ], - "buildPresets": [ - { - "name": "my-StdShar-MSVC", - "description": "MSVC Standard Build for x64 (Release)", - "configurePreset": "my-StdShar-MSVC", - "inherits": [ - "ci-x64-Release-MSVC" - ] - }, - { - "name": "my-StdShar-Clang", - "description": "Clang Standard Build for x64 (Release)", - "configurePreset": "my-StdShar-Clang", - "inherits": [ - "ci-x64-Release-Clang" - ] - }, - { - "name": "my-StdShar-GNUC", - "description": "GNUC Standard Build for x64 (Release)", - "configurePreset": "my-StdShar-GNUC", - "verbose": true, - "inherits": [ - "ci-x64-Release-GNUC" - ] - }, - { - "name": "my-114Shar-MSVC", - "description": "MSVC 1.14 Build for x64 (Release)", - "configurePreset": "my-114Shar-MSVC", - "inherits": [ - "ci-x64-Release-MSVC" - ] - }, - { - "name": "my-114Shar-Clang", - "description": "Clang 1.14 Build for x64 (Release)", - "configurePreset": "my-114Shar-Clang", - "inherits": [ - "ci-x64-Release-Clang" - ] - }, - { - "name": "my-114Shar-GNUC", - "description": "GNUC 1.14 Build for x64 (Release)", - "configurePreset": "my-114Shar-GNUC", - "verbose": true, - "inherits": [ - "ci-x64-Release-GNUC" - ] - } - ], - "testPresets": [ - { - "name": "my-StdShar-MSVC", - "configurePreset": "my-StdShar-MSVC", - "inherits": [ - "ci-x64-Release-MSVC" - ] - }, - { - "name": "my-StdShar-Clang", - "configurePreset": "my-StdShar-Clang", - "inherits": [ - "ci-x64-Release-Clang" - ] - }, - { - "name": "my-StdShar-GNUC", - "configurePreset": "my-StdShar-GNUC", - "inherits": [ - "ci-x64-Release-GNUC" - ] - }, - { - "name": "my-114Shar-MSVC", - "configurePreset": "my-114Shar-MSVC", - "inherits": [ - "ci-x64-Release-MSVC" - ] - }, - { - "name": "my-114Shar-Clang", - "configurePreset": "my-114Shar-Clang", - "inherits": [ - "ci-x64-Release-Clang" - ] - }, - { - "name": "my-114Shar-GNUC", - "configurePreset": "my-114Shar-GNUC", - "inherits": [ - "ci-x64-Release-GNUC" - ] - } - ], - "workflowPresets": [ - { - "name": "my-StdShar-MSVC", - "steps": [ - {"type": "configure", "name": "my-StdShar-MSVC"}, - {"type": "build", "name": "my-StdShar-MSVC"}, - {"type": "test", "name": "my-StdShar-MSVC"} - ] - }, - { - "name": "my-StdShar-Clang", - "steps": [ - {"type": "configure", "name": "my-StdShar-Clang"}, - {"type": "build", "name": "my-StdShar-Clang"}, - {"type": "test", "name": "my-StdShar-Clang"} - ] - }, - { - "name": "my-StdShar-GNUC", - "steps": [ - {"type": "configure", "name": "my-StdShar-GNUC"}, - {"type": "build", "name": "my-StdShar-GNUC"}, - {"type": "test", "name": "my-StdShar-GNUC"} - ] - }, - { - "name": "my-114Shar-MSVC", - "steps": [ - {"type": "configure", "name": "my-114Shar-MSVC"}, - {"type": "build", "name": "my-114Shar-MSVC"}, - {"type": "test", "name": "my-114Shar-MSVC"} - ] - }, - { - "name": "my-114Shar-Clang", - "steps": [ - {"type": "configure", "name": "my-114Shar-Clang"}, - {"type": "build", "name": "my-114Shar-Clang"}, - {"type": "test", "name": "my-114Shar-Clang"} - ] - }, - { - "name": "my-114Shar-GNUC", - "steps": [ - {"type": "configure", "name": "my-114Shar-GNUC"}, - {"type": "build", "name": "my-114Shar-GNUC"}, - {"type": "test", "name": "my-114Shar-GNUC"} - ] - } - ] -} \ No newline at end of file diff --git a/HDF5Examples/FORTRAN/H5D/h5ex_d_checksum.F90 b/HDF5Examples/FORTRAN/H5D/h5ex_d_checksum.F90 index b0464a3e884..cab742b7d1a 100644 --- a/HDF5Examples/FORTRAN/H5D/h5ex_d_checksum.F90 +++ b/HDF5Examples/FORTRAN/H5D/h5ex_d_checksum.F90 @@ -120,15 +120,17 @@ PROGRAM main ! nelmts = 0 CALL H5Pget_filter_f(dcpl, 0, flags, nelmts, cd_values, MaxChrLen, name, filter_id, hdferr) - WRITE(*,'("Filter type is: ")', ADVANCE='NO') + WRITE(*,'(A,1X)', ADVANCE='NO') "Filter type is:" IF(filter_id.EQ.H5Z_FILTER_DEFLATE_F)THEN - WRITE(*,'(T2,"H5Z_FILTER_DEFLATE_F")') + WRITE(*,'(A)') "H5Z_FILTER_DEFLATE_F" ELSE IF(filter_id.EQ.H5Z_FILTER_SHUFFLE_F)THEN - WRITE(*,'(T2,"H5Z_FILTER_SHUFFLE_F")') + WRITE(*,'(A)') "H5Z_FILTER_SHUFFLE_F" ELSE IF(filter_id.EQ.H5Z_FILTER_FLETCHER32_F)THEN - WRITE(*,'(T2,"H5Z_FILTER_FLETCHER32_F")') + WRITE(*,'(A)') "H5Z_FILTER_FLETCHER32_F" ELSE IF(filter_id.EQ.H5Z_FILTER_SZIP_F)THEN - WRITE(*,'(T2,"H5Z_FILTER_SZIP_F")') + WRITE(*,'(A)') "H5Z_FILTER_SZIP_F" + ELSE + WRITE(*,'(A)') "UNKNOWN" ENDIF ! ! Read the data using the default properties. diff --git a/HDF5Examples/FORTRAN/H5D/h5ex_d_gzip.F90 b/HDF5Examples/FORTRAN/H5D/h5ex_d_gzip.F90 index b46e3fcd4cc..7e7b6b5a005 100644 --- a/HDF5Examples/FORTRAN/H5D/h5ex_d_gzip.F90 +++ b/HDF5Examples/FORTRAN/H5D/h5ex_d_gzip.F90 @@ -118,15 +118,17 @@ PROGRAM main ! nelmts = 1 CALL H5Pget_filter_f(dcpl, 0, flags, nelmts, cd_values, MaxChrLen, name, filter_id, hdferr) - WRITE(*,'("Filter type is: ")', ADVANCE='NO') + WRITE(*,'(A,1X)', ADVANCE='NO') "Filter type is:" IF(filter_id.EQ.H5Z_FILTER_DEFLATE_F)THEN - WRITE(*,'(T2,"H5Z_FILTER_DEFLATE_F")') + WRITE(*,'(A)') "H5Z_FILTER_DEFLATE_F" ELSE IF(filter_id.EQ.H5Z_FILTER_SHUFFLE_F)THEN - WRITE(*,'(T2,"H5Z_FILTER_SHUFFLE_F")') + WRITE(*,'(A)') "H5Z_FILTER_SHUFFLE_F" ELSE IF(filter_id.EQ.H5Z_FILTER_FLETCHER32_F)THEN - WRITE(*,'(T2,"H5Z_FILTER_FLETCHER32_F")') + WRITE(*,'(A)') "H5Z_FILTER_FLETCHER32_F" ELSE IF(filter_id.EQ.H5Z_FILTER_SZIP_F)THEN - WRITE(*,'(T2,"H5Z_FILTER_SZIP_F")') + WRITE(*,'(A)') "H5Z_FILTER_SZIP_F" + ELSE + WRITE(*,'(A)') "UNKNOWN" ENDIF ! ! Read the data using the default properties. diff --git a/HDF5Examples/FORTRAN/H5D/h5ex_d_nbit.F90 b/HDF5Examples/FORTRAN/H5D/h5ex_d_nbit.F90 index 27e4d52cff6..636898c1ce9 100644 --- a/HDF5Examples/FORTRAN/H5D/h5ex_d_nbit.F90 +++ b/HDF5Examples/FORTRAN/H5D/h5ex_d_nbit.F90 @@ -125,17 +125,19 @@ PROGRAM main ! first filter because we know that we only added one filter. ! CALL H5Pget_filter_f(dcpl, 0, flags, nelmts, cd_values, INT(MaxChrLen, SIZE_T), name, filter_id, hdferr) - WRITE(*,'("Filter type is: ")', ADVANCE='NO') + WRITE(*,'(A,1X)', ADVANCE='NO') "Filter type is:" IF(filter_id.EQ.H5Z_FILTER_DEFLATE_F)THEN - WRITE(*,'(T2,"H5Z_FILTER_DEFLATE_F")') + WRITE(*,'(A)') "H5Z_FILTER_DEFLATE_F" ELSE IF(filter_id.EQ.H5Z_FILTER_SHUFFLE_F)THEN - WRITE(*,'(T2,"H5Z_FILTER_SHUFFLE_F")') + WRITE(*,'(A)') "H5Z_FILTER_SHUFFLE_F" ELSE IF(filter_id.EQ.H5Z_FILTER_FLETCHER32_F)THEN - WRITE(*,'(T2,"H5Z_FILTER_FLETCHER32_F")') + WRITE(*,'(A)') "H5Z_FILTER_FLETCHER32_F" ELSE IF(filter_id.EQ.H5Z_FILTER_SZIP_F)THEN - WRITE(*,'(T2,"H5Z_FILTER_SZIP_F")') + WRITE(*,'(A)') "H5Z_FILTER_SZIP_F" ELSE IF(filter_id.EQ.H5Z_FILTER_NBIT_F)THEN - WRITE(*,'(T2,"H5Z_FILTER_NBIT_F")') + WRITE(*,'(A)') "H5Z_FILTER_NBIT_F" + ELSE + WRITE(*,'(A)') "UNKNOWN" ENDIF ! ! Read the data using the default properties. diff --git a/HDF5Examples/FORTRAN/H5D/h5ex_d_soint.F90 b/HDF5Examples/FORTRAN/H5D/h5ex_d_soint.F90 index 120e8966767..e3bcc9f6859 100644 --- a/HDF5Examples/FORTRAN/H5D/h5ex_d_soint.F90 +++ b/HDF5Examples/FORTRAN/H5D/h5ex_d_soint.F90 @@ -133,19 +133,21 @@ PROGRAM main ! nelmts = 1 CALL H5Pget_filter_f(dcpl, 0, flags, nelmts, cd_values, INT(MaxChrLen, SIZE_T), name, filter_id, hdferr) - WRITE(*,'("Filter type is: ")', ADVANCE='NO') + WRITE(*,'(A,1X)', ADVANCE='NO') "Filter type is:" IF(filter_id.EQ.H5Z_FILTER_DEFLATE_F)THEN - WRITE(*,'(T2,"H5Z_FILTER_DEFLATE_F")') + WRITE(*,'(A)') "H5Z_FILTER_DEFLATE_F" ELSE IF(filter_id.EQ.H5Z_FILTER_SHUFFLE_F)THEN - WRITE(*,'(T2,"H5Z_FILTER_SHUFFLE_F")') + WRITE(*,'(A)') "H5Z_FILTER_SHUFFLE_F" ELSE IF(filter_id.EQ.H5Z_FILTER_FLETCHER32_F)THEN - WRITE(*,'(T2,"H5Z_FILTER_FLETCHER32_F")') + WRITE(*,'(A)') "H5Z_FILTER_FLETCHER32_F" ELSE IF(filter_id.EQ.H5Z_FILTER_SZIP_F)THEN - WRITE(*,'(T2,"H5Z_FILTER_SZIP_F")') + WRITE(*,'(A)') "H5Z_FILTER_SZIP_F" ELSE IF(filter_id.EQ.H5Z_FILTER_NBIT_F)THEN - WRITE(*,'(T2,"H5Z_FILTER_NBIT_F")') + WRITE(*,'(A)') "H5Z_FILTER_NBIT_F" ELSE IF(filter_id.EQ.H5Z_FILTER_SCALEOFFSET_F)THEN - WRITE(*,'(T2,"H5Z_FILTER_SCALEOFFSET_F")') + WRITE(*,'(A)') "H5Z_FILTER_SCALEOFFSET_F" + ELSE + WRITE(*,'(A)') "UNKNOWN" ENDIF ! ! Read the data using the default properties. diff --git a/HDF5Examples/FORTRAN/H5D/h5ex_d_szip.F90 b/HDF5Examples/FORTRAN/H5D/h5ex_d_szip.F90 index f66036e39cf..fdd6ecf29d2 100644 --- a/HDF5Examples/FORTRAN/H5D/h5ex_d_szip.F90 +++ b/HDF5Examples/FORTRAN/H5D/h5ex_d_szip.F90 @@ -119,20 +119,22 @@ PROGRAM main nelmts = 1 CALL H5Pget_filter_f(dcpl, 0, flags, nelmts, cd_values, INT(MaxChrLen,SIZE_T), name, filter_id, hdferr) - WRITE(*,'("Filter type is: ")', ADVANCE='NO') + WRITE(*,'(A,1X)', ADVANCE='NO') "Filter type is:" IF(filter_id.EQ.H5Z_FILTER_DEFLATE_F)THEN - WRITE(*,'(T2,"H5Z_FILTER_DEFLATE_F")') + WRITE(*,'(A)') "H5Z_FILTER_DEFLATE_F" ELSE IF(filter_id.EQ.H5Z_FILTER_SHUFFLE_F)THEN - WRITE(*,'(T2,"H5Z_FILTER_SHUFFLE_F")') + WRITE(*,'(A)') "H5Z_FILTER_SHUFFLE_F" ELSE IF(filter_id.EQ.H5Z_FILTER_FLETCHER32_F)THEN - WRITE(*,'(T2,"H5Z_FILTER_FLETCHER32_F")') + WRITE(*,'(A)') "H5Z_FILTER_FLETCHER32_F" ELSE IF(filter_id.EQ.H5Z_FILTER_SZIP_F)THEN - WRITE(*,'(T2,"H5Z_FILTER_SZIP_F")') + WRITE(*,'(A)') "H5Z_FILTER_SZIP_F" ! DEFINED ONLY IN F2003 hdf5 branch ! ELSE IF(filter_id.EQ.H5Z_FILTER_NBIT_F)THEN -! WRITE(*,'(T2,"H5Z_FILTER_NBIT_F")') +! WRITE(*,'(" H5Z_FILTER_NBIT_F")') ! ELSE IF(filter_id.EQ.H5Z_FILTER_SCALEOFFSET_F)THEN -! WRITE(*,'(T2,"H5Z_FILTER_SCALEOFFSET_F")') +! WRITE(*,'(" H5Z_FILTER_SCALEOFFSET_F")') + ELSE + WRITE(*,'(A)') "UNKNOWN" ENDIF ! ! Read the data using the default properties. diff --git a/HDF5Examples/FORTRAN/H5D/tfiles/18/h5ex_d_checksum.tst b/HDF5Examples/FORTRAN/H5D/tfiles/18/h5ex_d_checksum.tst index 01ed8661b8c..d2690e3edac 100644 --- a/HDF5Examples/FORTRAN/H5D/tfiles/18/h5ex_d_checksum.tst +++ b/HDF5Examples/FORTRAN/H5D/tfiles/18/h5ex_d_checksum.tst @@ -1,2 +1,2 @@ -Filter type is: H5Z_FILTER_FLETCHER32_F +Filter type is: H5Z_FILTER_FLETCHER32_F Maximum value in DS1 is: 1984 diff --git a/HDF5Examples/FORTRAN/H5D/tfiles/18/h5ex_d_gzip.tst b/HDF5Examples/FORTRAN/H5D/tfiles/18/h5ex_d_gzip.tst index 9efcd78a516..6fbaba15ce9 100644 --- a/HDF5Examples/FORTRAN/H5D/tfiles/18/h5ex_d_gzip.tst +++ b/HDF5Examples/FORTRAN/H5D/tfiles/18/h5ex_d_gzip.tst @@ -1,2 +1,2 @@ -Filter type is: H5Z_FILTER_DEFLATE_F +Filter type is: H5Z_FILTER_DEFLATE_F Maximum value in DS1 is: 1890 diff --git a/HDF5Examples/FORTRAN/H5D/tfiles/18/h5ex_d_nbit.tst b/HDF5Examples/FORTRAN/H5D/tfiles/18/h5ex_d_nbit.tst index 90f7a67bb1b..49c46ba7a7f 100644 --- a/HDF5Examples/FORTRAN/H5D/tfiles/18/h5ex_d_nbit.tst +++ b/HDF5Examples/FORTRAN/H5D/tfiles/18/h5ex_d_nbit.tst @@ -1,2 +1,2 @@ -Filter type is: H5Z_FILTER_NBIT_F +Filter type is: H5Z_FILTER_NBIT_F Maximum value in DS1 is: 1890 diff --git a/HDF5Examples/FORTRAN/H5D/tfiles/18/h5ex_d_soint.tst b/HDF5Examples/FORTRAN/H5D/tfiles/18/h5ex_d_soint.tst index ddf8b307ad3..d3dad134ef4 100644 --- a/HDF5Examples/FORTRAN/H5D/tfiles/18/h5ex_d_soint.tst +++ b/HDF5Examples/FORTRAN/H5D/tfiles/18/h5ex_d_soint.tst @@ -1,5 +1,5 @@ Maximum value in write buffer is: 1890 Minimum value in write buffer is: -63 -Filter type is: H5Z_FILTER_SCALEOFFSET_F +Filter type is: H5Z_FILTER_SCALEOFFSET_F Maximum value in DS1 is: 1890 Minimum value in DS1 is: -63 diff --git a/HDF5Examples/FORTRAN/H5D/tfiles/18/h5ex_d_szip.tst b/HDF5Examples/FORTRAN/H5D/tfiles/18/h5ex_d_szip.tst index 8f6ba90206d..bfd93d463fc 100644 --- a/HDF5Examples/FORTRAN/H5D/tfiles/18/h5ex_d_szip.tst +++ b/HDF5Examples/FORTRAN/H5D/tfiles/18/h5ex_d_szip.tst @@ -1,2 +1,2 @@ -Filter type is: H5Z_FILTER_SZIP_F +Filter type is: H5Z_FILTER_SZIP_F Maximum value in DS1 is: 1890 diff --git a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_col.F90 b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_col.F90 index affb7992c26..c439d63829f 100644 --- a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_col.F90 +++ b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_col.F90 @@ -4,10 +4,10 @@ PROGRAM DATASET_BY_COL USE HDF5 ! This module contains all necessary modules + USE mpi IMPLICIT NONE - include 'mpif.h' CHARACTER(LEN=10), PARAMETER :: filename = "sds_col.h5" ! File name CHARACTER(LEN=8), PARAMETER :: dsetname = "IntArray" ! Dataset name diff --git a/HDF5Examples/FORTRAN/H5T/CMakeLists.txt b/HDF5Examples/FORTRAN/H5T/CMakeLists.txt index 4ef22564c3b..ab445a2ea20 100644 --- a/HDF5Examples/FORTRAN/H5T/CMakeLists.txt +++ b/HDF5Examples/FORTRAN/H5T/CMakeLists.txt @@ -122,7 +122,7 @@ if (HDF5_BUILD_TOOLS) TARGET ${EXAMPLE_VARNAME}_f90_${example_name} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${example_name}.ddl + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl ) endforeach () @@ -135,14 +135,14 @@ if (HDF5_BUILD_TOOLS) TARGET ${EXAMPLE_VARNAME}_f90_${example_name} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/114/${example_name}.ddl ${example_name}.ddl + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/114/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl ) else () add_custom_command ( TARGET ${EXAMPLE_VARNAME}_f90_${example_name} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${example_name}.ddl + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl ) endif () elseif ((${example_name} STREQUAL "h5ex_t_objref_F03" OR ${example_name} STREQUAL "h5ex_t_objrefatt_F03") OR (${example_name} STREQUAL "h5ex_t_regref_F03" OR ${example_name} STREQUAL "h5ex_t_regrefatt_F03")) @@ -153,14 +153,14 @@ if (HDF5_BUILD_TOOLS) TARGET ${EXAMPLE_VARNAME}_f90_${example_name} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}21.ddl ${example_name}.ddl + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}21.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl ) else () add_custom_command ( TARGET ${EXAMPLE_VARNAME}_f90_${example_name} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${example_name}.ddl + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl ) endif () elseif (HDF5_VERSION_MAJOR VERSION_EQUAL "1.10") @@ -169,14 +169,14 @@ if (HDF5_BUILD_TOOLS) TARGET ${EXAMPLE_VARNAME}_f90_${example_name} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/110/${example_name}06.ddl ${example_name}.ddl + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/110/${example_name}06.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl ) else () add_custom_command ( TARGET ${EXAMPLE_VARNAME}_f90_${example_name} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${example_name}.ddl + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl ) endif () elseif (HDF5_VERSION_MAJOR VERSION_GREATER_EQUAL "1.12") @@ -184,14 +184,14 @@ if (HDF5_BUILD_TOOLS) TARGET ${EXAMPLE_VARNAME}_f90_${example_name} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/112/${example_name}.ddl ${example_name}.ddl + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/112/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl ) else () add_custom_command ( TARGET ${EXAMPLE_VARNAME}_f90_${example_name} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${example_name}.ddl + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl ) endif () else () @@ -201,14 +201,14 @@ if (HDF5_BUILD_TOOLS) TARGET ${EXAMPLE_VARNAME}_f90_${example_name} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}21.ddl ${example_name}.ddl + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}21.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl ) else () add_custom_command ( TARGET ${EXAMPLE_VARNAME}_f90_${example_name} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${example_name}.ddl + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl ) endif () elseif (HDF5_VERSION_MAJOR VERSION_EQUAL "1.10") @@ -217,14 +217,14 @@ if (HDF5_BUILD_TOOLS) TARGET ${EXAMPLE_VARNAME}_f90_${example_name} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/110/${example_name}06.ddl ${example_name}.ddl + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/110/${example_name}06.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl ) else () add_custom_command ( TARGET ${EXAMPLE_VARNAME}_f90_${example_name} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${example_name}.ddl + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl ) endif () elseif (HDF5_VERSION_MAJOR VERSION_GREATER_EQUAL "1.12") @@ -232,14 +232,14 @@ if (HDF5_BUILD_TOOLS) TARGET ${EXAMPLE_VARNAME}_f90_${example_name} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/112/${example_name}.ddl ${example_name}.ddl + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/112/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl ) else () add_custom_command ( TARGET ${EXAMPLE_VARNAME}_f90_${example_name} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${example_name}.ddl + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl ) endif () endif () @@ -248,7 +248,7 @@ if (HDF5_BUILD_TOOLS) TARGET ${EXAMPLE_VARNAME}_f90_${example_name} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${example_name}.ddl + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl ) endif () endif () diff --git a/HDF5Examples/config/cmake-presets/hidden-presets.json b/HDF5Examples/config/cmake-presets/hidden-presets.json index 8b7f71bff63..590e7ec7e1f 100644 --- a/HDF5Examples/config/cmake-presets/hidden-presets.json +++ b/HDF5Examples/config/cmake-presets/hidden-presets.json @@ -357,37 +357,25 @@ "configurePreset": "ci-x64-Release-MSVC", "hidden": true, "inherits": "ci-base", - "generators": [ - "ZIP" - ], "configurations": ["RelWithDebInfo"] }, { "name": "ci-x64-Release-Clang", "configurePreset": "ci-x64-Release-Clang", "hidden": true, - "inherits": "ci-base", - "generators": [ - "TGZ" - ] + "inherits": "ci-base" }, { "name": "ci-x64-Release-GNUC", "configurePreset": "ci-x64-Release-GNUC", "hidden": true, - "inherits": "ci-base", - "generators": [ - "TGZ" - ] + "inherits": "ci-base" }, { "name": "ci-x64-Release-Intel", "configurePreset": "ci-x64-Release-Intel", "hidden": true, - "inherits": "ci-base", - "generators": [ - "TGZ" - ] + "inherits": "ci-base" } ] } diff --git a/HDF5Examples/config/cmake/HDFExampleMacros.cmake b/HDF5Examples/config/cmake/HDFExampleMacros.cmake index 3bb1d48ded7..5c425dbbe0c 100644 --- a/HDF5Examples/config/cmake/HDFExampleMacros.cmake +++ b/HDF5Examples/config/cmake/HDFExampleMacros.cmake @@ -132,18 +132,6 @@ macro (HDF5_SUPPORT) message (STATUS "HDF5 Fortran libs: static:${HDF5_static_Fortran_FOUND} and shared:${HDF5_shared_Fortran_FOUND}") message (STATUS "HDF5 Java libs: ${HDF5_Java_FOUND}") if (HDF5_FOUND) - if (USE_SHARED_LIBS) - if (NOT TARGET ${HDF5_NAMESPACE}h5dump-shared) - add_executable (${HDF5_NAMESPACE}h5dump-shared IMPORTED) - endif () - set (H5EX_HDF5_DUMP_EXECUTABLE $) - else () - if (NOT TARGET ${HDF5_NAMESPACE}h5dump) - add_executable (${HDF5_NAMESPACE}h5dump IMPORTED) - endif() - set (H5EX_HDF5_DUMP_EXECUTABLE $) - endif() - if (NOT HDF5_static_C_FOUND AND NOT HDF5_shared_C_FOUND) #find library from non-dual-binary package set (FIND_HDF_COMPONENTS C) @@ -177,26 +165,38 @@ macro (HDF5_SUPPORT) if (USE_SHARED_LIBS AND HDF5_shared_C_FOUND) set (H5EX_HDF5_LINK_LIBS ${H5EX_HDF5_LINK_LIBS} ${HDF5_C_SHARED_LIBRARY}) set (HDF5_LIBRARY_PATH ${PACKAGE_PREFIX_DIR}/lib) - set_property (TARGET ${HDF5_NAMESPACE}h5dump-shared PROPERTY IMPORTED_LOCATION "${HDF5_TOOLS_DIR}/h5dump-shared") else () set (H5EX_HDF5_LINK_LIBS ${H5EX_HDF5_LINK_LIBS} ${HDF5_C_STATIC_LIBRARY}) - set_property (TARGET ${HDF5_NAMESPACE}h5dump PROPERTY IMPORTED_LOCATION "${HDF5_TOOLS_DIR}/h5dump") endif () - if (HDF_BUILD_FORTRAN AND ${HDF5_BUILD_FORTRAN}) - if (BUILD_SHARED_LIBS AND HDF5_shared_Fortran_FOUND) - set (H5EX_HDF5_LINK_LIBS ${H5EX_HDF5_LINK_LIBS} ${HDF5_FORTRAN_SHARED_LIBRARY}) - elseif (HDF5_static_Fortran_FOUND) - set (H5EX_HDF5_LINK_LIBS ${H5EX_HDF5_LINK_LIBS} ${HDF5_FORTRAN_STATIC_LIBRARY}) - else () - set (HDF_BUILD_FORTRAN OFF CACHE BOOL "Build FORTRAN support" FORCE) - message (STATUS "HDF5 Fortran libs not found - disable build of Fortran examples") + if (HDF5_VERSION VERSION_LESS "1.14.4" AND NOT HDF5_shared_C_FOUND) + if (NOT TARGET ${HDF5_NAMESPACE}h5dump-shared) + add_executable (${HDF5_NAMESPACE}h5dump-shared IMPORTED) endif () + set (H5EX_HDF5_DUMP_EXECUTABLE $) else () + if (NOT TARGET ${HDF5_NAMESPACE}h5dump) + add_executable (${HDF5_NAMESPACE}h5dump IMPORTED) + endif() + set (H5EX_HDF5_DUMP_EXECUTABLE $) + endif() + + if (NOT HDF5_static_Fortran_FOUND AND NOT HDF5_shared_Fortran_FOUND) set (HDF_BUILD_FORTRAN OFF CACHE BOOL "Build FORTRAN support" FORCE) message (STATUS "HDF5 Fortran libs not found - disable build of Fortran examples") + else () + if (HDF_BUILD_FORTRAN AND ${HDF5_BUILD_FORTRAN}) + if (BUILD_SHARED_LIBS AND HDF5_shared_Fortran_FOUND) + set (H5EX_HDF5_LINK_LIBS ${H5EX_HDF5_LINK_LIBS} ${HDF5_FORTRAN_SHARED_LIBRARY}) + elseif (HDF5_static_Fortran_FOUND) + set (H5EX_HDF5_LINK_LIBS ${H5EX_HDF5_LINK_LIBS} ${HDF5_FORTRAN_STATIC_LIBRARY}) + else () + set (HDF_BUILD_FORTRAN OFF CACHE BOOL "Build FORTRAN support" FORCE) + message (STATUS "HDF5 Fortran libs not found - disable build of Fortran examples") + endif () + endif () endif () - if (HDF_BUILD_JAVA) - if (${HDF5_BUILD_JAVA} AND HDF5_Java_FOUND) + if (HDF_BUILD_JAVA AND HDF5_Java_FOUND) + if (${HDF5_BUILD_JAVA}) set (CMAKE_JAVA_INCLUDE_PATH "${CMAKE_JAVA_INCLUDE_PATH};${HDF5_JAVA_INCLUDE_DIRS}") set (H5EX_JAVA_LIBRARY ${HDF5_JAVA_LIBRARY}) set (H5EX_JAVA_LIBRARIES ${HDF5_JAVA_LIBRARY}) diff --git a/HDF5Examples/config/cmake/HDFMacros.cmake b/HDF5Examples/config/cmake/HDFMacros.cmake index 66a25aab83f..b9ef2df03a7 100644 --- a/HDF5Examples/config/cmake/HDFMacros.cmake +++ b/HDF5Examples/config/cmake/HDFMacros.cmake @@ -90,7 +90,7 @@ macro (HDFTEST_COPY_FILE src dest target) endmacro () macro (HDF_DIR_PATHS package_prefix) - option (H5EX_USE_GNU_DIRS "TRUE to use GNU Coding Standard install directory variables, FALSE to use historical settings" FALSE) + option (H5EX_USE_GNU_DIRS "ON to use GNU Coding Standard install directory variables, OFF to use historical settings" OFF) if (H5EX_USE_GNU_DIRS) include(GNUInstallDirs) if (NOT ${package_prefix}_INSTALL_BIN_DIR) @@ -121,7 +121,7 @@ macro (HDF_DIR_PATHS package_prefix) endif () if (APPLE) - option (${package_prefix}_BUILD_FRAMEWORKS "TRUE to build as frameworks libraries, FALSE to build according to BUILD_SHARED_LIBS" FALSE) + option (${package_prefix}_BUILD_FRAMEWORKS "ON to build as frameworks libraries, OFF to build according to BUILD_SHARED_LIBS" OFF) endif () if (NOT ${package_prefix}_INSTALL_BIN_DIR) @@ -170,10 +170,10 @@ macro (HDF_DIR_PATHS package_prefix) message(STATUS "Final: ${${package_prefix}_INSTALL_DOC_DIR}") # Always use full RPATH, i.e. don't skip the full RPATH for the build tree - set (CMAKE_SKIP_BUILD_RPATH FALSE) + set (CMAKE_SKIP_BUILD_RPATH OFF) # when building, don't use the install RPATH already # (but later on when installing) - set (CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) + set (CMAKE_INSTALL_RPATH_USE_LINK_PATH OFF) # add the automatically determined parts of the RPATH # which point to directories outside the build tree to the install RPATH set (CMAKE_BUILD_WITH_INSTALL_RPATH ON) diff --git a/HDF5Examples/config/cmake/grepTest.cmake b/HDF5Examples/config/cmake/grepTest.cmake index 2ec83872a55..4031a1bde03 100644 --- a/HDF5Examples/config/cmake/grepTest.cmake +++ b/HDF5Examples/config/cmake/grepTest.cmake @@ -70,11 +70,18 @@ message (STATUS "COMMAND Result: ${TEST_RESULT}") message (STATUS "COMMAND Error: ${TEST_ERROR}") # remove special output -file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) -string (FIND TEST_STREAM "_pmi_alps" TEST_FIND_RESULT) -if (TEST_FIND_RESULT GREATER -1) - string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + string (FIND "${TEST_STREAM}" "_pmi_alps" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") + endif () + string (FIND "${TEST_STREAM}" "ulimit -s" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*ulimit -s[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") + endif () endif () # if the TEST_ERRREF exists grep the error output with the error reference diff --git a/HDF5Examples/config/cmake/runTest.cmake b/HDF5Examples/config/cmake/runTest.cmake index d21765a8e36..3507c3482d5 100644 --- a/HDF5Examples/config/cmake/runTest.cmake +++ b/HDF5Examples/config/cmake/runTest.cmake @@ -133,11 +133,18 @@ endif () message (STATUS "COMMAND Error: ${TEST_ERROR}") # remove special output -file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) -string (FIND TEST_STREAM "_pmi_alps" TEST_FIND_RESULT) -if (TEST_FIND_RESULT GREATER -1) - string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + string (FIND "${TEST_STREAM}" "_pmi_alps" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") + endif () + string (FIND "${TEST_STREAM}" "ulimit -s" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*ulimit -s[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") + endif () endif () # remove special error output @@ -148,7 +155,7 @@ else () # the error stack remains in the .err file file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) endif () -string (FIND TEST_STREAM "no version information available" TEST_FIND_RESULT) +string (FIND "${TEST_STREAM}" "no version information available" TEST_FIND_RESULT) if (TEST_FIND_RESULT GREATER -1) string (REGEX REPLACE "^.*no version information available[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") # write back the changes to the original files diff --git a/README.md b/README.md index 29429f33a53..f4bfa69e72c 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,8 @@ HDF5 version 1.15.0 currently under development *Please refer to the release_docs/INSTALL file for installation instructions.* This repository contains a high-performance library's source code and a file format -specification that implement the HDF5® data model. The model has been adopted across -many industries and this implementation has become a de facto data management standard +specification that implements the HDF5® data model. The model has been adopted across +many industries, and this implementation has become a de facto data management standard in science, engineering, and research communities worldwide. The HDF Group is the developer, maintainer, and steward of HDF5 software. Find more @@ -87,7 +87,8 @@ are tentative. | Release | New Features | | ------- | ------------ | -| 1.14.4 | S3 VFD improvements | +| 1.14.4 | native float16 support, cloud-optimized HDF5 improvements | +| 1.14.5 | TBD | | TBD | VFD SWMR | | 2.0.0 | TBD | diff --git a/bin/h5cc.in b/bin/h5cc.in index e3dc988a576..e4d43684e3c 100644 --- a/bin/h5cc.in +++ b/bin/h5cc.in @@ -62,7 +62,7 @@ host_os="@host_os@" prog_name="`basename $0`" -allargs="" +misc_args="" compile_args="" libraries="" link_args="" @@ -202,7 +202,6 @@ for arg in $@ ; do case "$arg" in -c) - allargs="$allargs $arg" compile_args="$compile_args $arg" if test "x$do_link" = "xyes" -a -n "$output_file"; then @@ -213,7 +212,6 @@ for arg in $@ ; do dash_c="yes" ;; -o) - allargs="$allargs $arg" dash_o="yes" if test "x$dash_c" = "xyes"; then @@ -225,14 +223,12 @@ for arg in $@ ; do fi ;; -E|-M|-MT) - allargs="$allargs $arg" compile_args="$compile_args $arg" dash_c="yes" do_link="no" ;; -l*) libraries=" $libraries $arg " - allargs="$allargs $arg" ;; -prefix=*) prefix="`expr "$arg" : '-prefix=\(.*\)'`" @@ -264,14 +260,14 @@ for arg in $@ ; do ;; *\"*) qarg="'"$arg"'" - allargs="$allargs $qarg" + misc_args="$misc_args $qarg" ;; *\'*) - qarg='\"'"$arg"'\"' - allargs="$allargs $qarg" + qarg='"'"$arg"'"' + misc_args="$misc_args $qarg" ;; *) - allargs="$allargs $qarg" + misc_args="$misc_args $qarg" if test -s "$arg"; then ext=`expr "$arg" : '.*\(\..*\)'` @@ -313,7 +309,7 @@ if test "x$do_compile" = "xyes"; then compile_args="-c $compile_args" fi - $SHOW $CC -I$includedir $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $compile_args + $SHOW $CC -I$includedir $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $misc_args $compile_args status=$? if test "$status" != "0"; then diff --git a/bin/release b/bin/release index 26a756ccfe0..5eb8b8c67ce 100755 --- a/bin/release +++ b/bin/release @@ -466,7 +466,7 @@ done # Create the tar file test "$verbose" && echo " Running tar..." 1>&2 -(cd "$tmpdir" && exec tar -ch --exclude-vcs -f "$HDF5_VERS.tar" "./$HDF5_IN_VERS" || exit 1 ) +(cd "$tmpdir" && exec tar -ch --exclude-vcs --exclude=*autom4te* --exclude=.clang-format --exclude=.codespellrc --exclude=.devcontainer --exclude=.git* --exclude=.h5chkright.ini -f "$HDF5_VERS.tar" "./$HDF5_IN_VERS" || exit 1 ) # Compress #SHA256=$HDF5_VERS.sha256 diff --git a/bin/trace b/bin/trace index c620b805368..5941f3a89a8 100755 --- a/bin/trace +++ b/bin/trace @@ -31,6 +31,7 @@ $Source = ""; "H5A_operator1_t" => "Ao", "H5A_operator2_t" => "AO", "hbool_t" => "b", + "bool" => "b", "H5AC_cache_config_t" => "Cc", "H5AC_cache_image_config_t" => "CC", "double" => "d", @@ -74,6 +75,7 @@ $Source = ""; "H5F_file_space_type_t" => "Ft", "H5F_libver_t" => "Fv", "H5G_iterate_t" => "Gi", + "H5G_info_t" => "GI", "H5G_obj_t" => "Go", "H5G_stat_t" => "Gs", "hsize_t" => "h", @@ -199,7 +201,7 @@ $Source = ""; "H5FD_t" => "#", "H5FD_hdfs_fapl_t" => "#", "H5FD_mirror_fapl_t" => "#", - "H5FD_onion_fapl_t" => "#", + "H5FD_onion_fapl_t" => "#", "H5FD_ros3_fapl_t" => "#", "H5FD_splitter_vfd_config_t" => "#", "H5L_class_t" => "#", @@ -305,10 +307,18 @@ sub rewrite_func ($$$$$) { $trace = "H5TRACE0(\"$rettype\", \"\");\n"; $argtrace = "H5ARG_TRACE0(\"\")"; } else { - # Split arguments. First convert `/*in,out*/' to get rid of the - # comma and remove lines beginning with a '#', then split the arguments - # on commas. - $args =~ s/(\/\*\s*in),\s*(out\s*\*\/)/$1_$2/g; # Get rid of comma in 'in,out' + # Split arguments + # + # First remove: + # * /*in*/, /*out*/, /*in_out*/, and /*in,out*/ comments + # * preprocessor lines that start with # + # * H5FL_TRACKING_PARAMS macros (free list code only) + # + # then split the function arguments on commas + $args =~ s/\/\*\s*in\s*\*\///g; # Get rid of /*in*/ + $args =~ s/\/\*\s*out\s*\*\///g; # Get rid of /*out*/ + $args =~ s/\/\*\s*in,\s*out\s*\*\///g; # Get rid of /*in,out*/ + $args =~ s/\/\*\s*in_out\s*\*\///g; # Get rid of /*in_out*/ $args =~ s/H5FL_TRACK_PARAMS//g; # Remove free list macro $args =~ s/\n#.*?\n/\n/g; # Remove lines beginning with '#' my @args = split /,[\s\n]*/, $args; @@ -320,8 +330,7 @@ sub rewrite_func ($$$$$) { next; } unless ($arg=~/^((\s*[a-z_A-Z](\w|\*)*\s+)+(\s*\*\s*|\s*const\s*|\s*volatile\s*)*) - ([a-z_A-Z]\w*)(\[.*?\])? - (\s*\/\*\s*(in|out|in_out)\s*\*\/)?\s*$/x) { + ([a-z_A-Z]\w*)(\[.*?\])?\s*$/x) { errmesg $file, $name, "unable to parse \`$arg\'"; goto error; } else { diff --git a/c++/examples/CMakeTests.cmake b/c++/examples/CMakeTests.cmake index f710204a948..c74ffb58930 100644 --- a/c++/examples/CMakeTests.cmake +++ b/c++/examples/CMakeTests.cmake @@ -43,7 +43,7 @@ set_tests_properties (CPP_ex-clean-objects PROPERTIES ) foreach (example ${examples}) - if (HDF5_ENABLE_USING_MEMCHECKER) + if (HDF5_USING_ANALYSIS_TOOL) add_test (NAME CPP_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME CPP_ex_${example} COMMAND "${CMAKE_COMMAND}" @@ -95,7 +95,7 @@ set_tests_properties (CPP_ex_tutr-clean-objects PROPERTIES ) foreach (example ${tutr_examples}) - if (HDF5_ENABLE_USING_MEMCHECKER) + if (HDF5_USING_ANALYSIS_TOOL) add_test (NAME CPP_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME CPP_ex_${example} COMMAND "${CMAKE_COMMAND}" diff --git a/c++/examples/testh5c++.sh.in b/c++/examples/testh5c++.sh.in index 84c77524f01..f3a973cabc9 100644 --- a/c++/examples/testh5c++.sh.in +++ b/c++/examples/testh5c++.sh.in @@ -47,6 +47,8 @@ prog1_o=${H5TOOL}_prog1.o prog2=${H5TOOL}_prog2.$suffix prog2_o=${H5TOOL}_prog2.o applib=libapp${H5TOOL}.a +args=${H5TOOL}_args.$suffix +args_o=${H5TOOL}_args.o # short hands # Caution: if some *.h5 files must be cleaned here, list them by names. @@ -134,16 +136,38 @@ int main (void) } EOF +# Generate args: +# An application main that test misc command line arguments being passed. +cat > $args < +#include +#include "H5Cpp.h" +#ifndef H5_NO_NAMESPACE +using namespace H5; +#endif + +const H5std_string FILE_NAME( "args.h5" ); + +int main (void) +{ + char c = SGL_QUOTE; // 'H' + char *s = DBL_QUOTE; // "HDF" + int val = MISC; // 42 + + H5File file( FILE_NAME, H5F_ACC_TRUNC ); + return 0; +} +EOF # Parse option # None -# Print a line-line message left justified in a field of 70 characters +# Print a line-line message left justified in a field of 74 characters # beginning with the word "Testing". # TESTING() { SPACES=" " - echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' + echo "Testing $* $SPACES" | cut -c1-74 | tr -d '\012' } @@ -231,6 +255,10 @@ echo "***"Just preprocess, no compile, no link. TOOLTEST -E $hdf5main TOOLTEST -E $appmain $prog1 $prog2 +# HDF5 program that depends on input args. +echo "***"Simple Compile and Link in one step with user-supplied arguments. +TOOLTEST -DSGL_QUOTE=\'H\' -DDBL_QUOTE=\"HDF\" -DMISC=42 $args + ############################################################################## # END ############################################################################## diff --git a/c++/src/H5AbstractDs.cpp b/c++/src/H5AbstractDs.cpp index 7ea107c7f43..ab3fabaeb69 100644 --- a/c++/src/H5AbstractDs.cpp +++ b/c++/src/H5AbstractDs.cpp @@ -316,12 +316,4 @@ AbstractDs::getVarLenType() const } } -//-------------------------------------------------------------------------- -// Function: AbstractDs destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -AbstractDs::~AbstractDs() -{ -} - } // namespace H5 diff --git a/c++/src/H5AbstractDs.h b/c++/src/H5AbstractDs.h index 49bcfebea09..d831bd65791 100644 --- a/c++/src/H5AbstractDs.h +++ b/c++/src/H5AbstractDs.h @@ -67,7 +67,7 @@ class H5_DLLCPP AbstractDs { virtual H5std_string fromClass() const = 0; // Destructor - virtual ~AbstractDs(); + virtual ~AbstractDs() = default; protected: // Default constructor diff --git a/c++/src/H5ArrayType.cpp b/c++/src/H5ArrayType.cpp index c5ad7eaad84..3a2da2bf39f 100644 --- a/c++/src/H5ArrayType.cpp +++ b/c++/src/H5ArrayType.cpp @@ -199,12 +199,4 @@ ArrayType::getArrayDims(hsize_t *dims) const return (ndims); } -//-------------------------------------------------------------------------- -// Function: ArrayType destructor -///\brief Properly terminates access to this array datatype. -//-------------------------------------------------------------------------- -ArrayType::~ArrayType() -{ -} - } // namespace H5 diff --git a/c++/src/H5ArrayType.h b/c++/src/H5ArrayType.h index e9afb9c4534..e02a3a2a0e8 100644 --- a/c++/src/H5ArrayType.h +++ b/c++/src/H5ArrayType.h @@ -60,7 +60,7 @@ class H5_DLLCPP ArrayType : public DataType { ArrayType(const hid_t existing_id); // Noop destructor - virtual ~ArrayType() override; + virtual ~ArrayType() override = default; // Default constructor ArrayType(); diff --git a/c++/src/H5AtomType.cpp b/c++/src/H5AtomType.cpp index db6c8f840a6..f2e037a98bc 100644 --- a/c++/src/H5AtomType.cpp +++ b/c++/src/H5AtomType.cpp @@ -276,14 +276,4 @@ AtomType::setPad(H5T_pad_t lsb, H5T_pad_t msb) const } } -#ifndef DOXYGEN_SHOULD_SKIP_THIS -//-------------------------------------------------------------------------- -// Function: AtomType destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -AtomType::~AtomType() -{ -} -#endif // DOXYGEN_SHOULD_SKIP_THIS - } // namespace H5 diff --git a/c++/src/H5AtomType.h b/c++/src/H5AtomType.h index bb2cf48b338..327604ddd56 100644 --- a/c++/src/H5AtomType.h +++ b/c++/src/H5AtomType.h @@ -67,7 +67,7 @@ class H5_DLLCPP AtomType : public DataType { AtomType(const AtomType &original); // Noop destructor - virtual ~AtomType() override; + virtual ~AtomType() override = default; #endif // DOXYGEN_SHOULD_SKIP_THIS protected: diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index 277ba349e40..d26c83fade0 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -342,14 +342,6 @@ CommonFG::CommonFG() { } -//-------------------------------------------------------------------------- -// Function: CommonFG destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -CommonFG::~CommonFG() -{ -} - //-------------------------------------------------------------------------- // Function: f_DataType_setId - friend // Purpose: This function is friend to class H5::DataType so that it diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h index e6756177a72..6eb01db3bd1 100644 --- a/c++/src/H5CommonFG.h +++ b/c++/src/H5CommonFG.h @@ -72,7 +72,7 @@ class H5_DLLCPP CommonFG { CommonFG(); // Noop destructor. - virtual ~CommonFG(); + virtual ~CommonFG() = default; protected: virtual void p_setId(const hid_t new_id) = 0; diff --git a/c++/src/H5CompType.cpp b/c++/src/H5CompType.cpp index c89fa5c8f28..70bbe66556e 100644 --- a/c++/src/H5CompType.cpp +++ b/c++/src/H5CompType.cpp @@ -527,12 +527,4 @@ CompType::setSize(size_t size) const } } -//-------------------------------------------------------------------------- -// Function: CompType destructor -///\brief Properly terminates access to this compound datatype. -//-------------------------------------------------------------------------- -CompType::~CompType() -{ -} - } // namespace H5 diff --git a/c++/src/H5CompType.h b/c++/src/H5CompType.h index 0675d2041d3..a642b0d5143 100644 --- a/c++/src/H5CompType.h +++ b/c++/src/H5CompType.h @@ -113,7 +113,7 @@ class H5_DLLCPP CompType : public DataType { } // Noop destructor. - virtual ~CompType() override; + virtual ~CompType() override = default; private: // Contains common code that is used by the member functions diff --git a/c++/src/H5DaccProp.cpp b/c++/src/H5DaccProp.cpp index 8b01665c19f..ba4c8ef60b0 100644 --- a/c++/src/H5DaccProp.cpp +++ b/c++/src/H5DaccProp.cpp @@ -153,12 +153,4 @@ DSetAccPropList::getChunkCache(size_t &rdcc_nslots, size_t &rdcc_nbytes, double } } -//-------------------------------------------------------------------------- -// Function: DSetAccPropList destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -DSetAccPropList::~DSetAccPropList() -{ -} - } // namespace H5 diff --git a/c++/src/H5DaccProp.h b/c++/src/H5DaccProp.h index bb404cec407..3f101f3aa70 100644 --- a/c++/src/H5DaccProp.h +++ b/c++/src/H5DaccProp.h @@ -50,7 +50,7 @@ class H5_DLLCPP DSetAccPropList : public LinkAccPropList { DSetAccPropList(const hid_t plist_id); // Noop destructor. - virtual ~DSetAccPropList() override; + virtual ~DSetAccPropList() override = default; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp index 8b199a8091b..8f4ee7e490c 100644 --- a/c++/src/H5DcreatProp.cpp +++ b/c++/src/H5DcreatProp.cpp @@ -754,12 +754,4 @@ DSetCreatPropList::setVirtual(const DataSpace &vspace, const H5std_string src_fn setVirtual(vspace, src_fname.c_str(), src_dsname.c_str(), sspace); } -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -DSetCreatPropList::~DSetCreatPropList() -{ -} - } // namespace H5 diff --git a/c++/src/H5DcreatProp.h b/c++/src/H5DcreatProp.h index 94ecbb53a86..3c8587dbe6b 100644 --- a/c++/src/H5DcreatProp.h +++ b/c++/src/H5DcreatProp.h @@ -140,7 +140,7 @@ class H5_DLLCPP DSetCreatPropList : public ObjCreatPropList { DSetCreatPropList(const hid_t plist_id); // Noop destructor. - virtual ~DSetCreatPropList() override; + virtual ~DSetCreatPropList() override = default; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5DxferProp.cpp b/c++/src/H5DxferProp.cpp index 33e2ff58c19..1b9d6510580 100644 --- a/c++/src/H5DxferProp.cpp +++ b/c++/src/H5DxferProp.cpp @@ -527,12 +527,4 @@ DSetMemXferPropList::getEDCCheck() const return (check); } -//-------------------------------------------------------------------------- -// Function: DSetMemXferPropList destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -DSetMemXferPropList::~DSetMemXferPropList() -{ -} - } // namespace H5 diff --git a/c++/src/H5DxferProp.h b/c++/src/H5DxferProp.h index d0a65c108af..b86202da254 100644 --- a/c++/src/H5DxferProp.h +++ b/c++/src/H5DxferProp.h @@ -112,7 +112,7 @@ class H5_DLLCPP DSetMemXferPropList : public PropList { DSetMemXferPropList(const hid_t plist_id); // Noop destructor - virtual ~DSetMemXferPropList() override; + virtual ~DSetMemXferPropList() override = default; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5EnumType.cpp b/c++/src/H5EnumType.cpp index 03c07d95122..569e56abf47 100644 --- a/c++/src/H5EnumType.cpp +++ b/c++/src/H5EnumType.cpp @@ -317,12 +317,4 @@ EnumType::getMemberValue(unsigned memb_no, void *value) const } } -//-------------------------------------------------------------------------- -// Function: EnumType destructor -///\brief Properly terminates access to this enum datatype. -//-------------------------------------------------------------------------- -EnumType::~EnumType() -{ -} - } // namespace H5 diff --git a/c++/src/H5EnumType.h b/c++/src/H5EnumType.h index a98688ea0be..a5096fcf905 100644 --- a/c++/src/H5EnumType.h +++ b/c++/src/H5EnumType.h @@ -81,7 +81,7 @@ class H5_DLLCPP EnumType : public DataType { // Copy constructor: same as the original EnumType. EnumType(const EnumType &original); - virtual ~EnumType() override; + virtual ~EnumType() override = default; }; // end of EnumType } // namespace H5 diff --git a/c++/src/H5Exception.cpp b/c++/src/H5Exception.cpp index 01b9cc10d03..906bd27e594 100644 --- a/c++/src/H5Exception.cpp +++ b/c++/src/H5Exception.cpp @@ -330,14 +330,6 @@ Exception::printErrorStack(FILE *stream, hid_t err_stack) // Exception::printErrorStack(stream, H5E_DEFAULT); //} -//-------------------------------------------------------------------------- -// Function: Exception destructor -///\brief Noop destructor -//-------------------------------------------------------------------------- -Exception::~Exception() throw() -{ -} - //-------------------------------------------------------------------------- // Subclass: FileIException //-------------------------------------------------------------------------- @@ -359,13 +351,6 @@ FileIException::FileIException(const H5std_string &func, const H5std_string &mes : Exception(func, message) { } -//-------------------------------------------------------------------------- -// Function: FileIException destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -FileIException::~FileIException() throw() -{ -} //-------------------------------------------------------------------------- // Subclass: GroupIException @@ -388,14 +373,6 @@ GroupIException::GroupIException(const H5std_string &func, const H5std_string &m : Exception(func, message) { } -//-------------------------------------------------------------------------- -// Function: GroupIException destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -GroupIException::~GroupIException() throw() -{ -} - //-------------------------------------------------------------------------- // Subclass: DataSpaceIException //-------------------------------------------------------------------------- @@ -417,13 +394,6 @@ DataSpaceIException::DataSpaceIException(const H5std_string &func, const H5std_s : Exception(func, message) { } -//-------------------------------------------------------------------------- -// Function: DataSpaceIException destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -DataSpaceIException::~DataSpaceIException() throw() -{ -} //-------------------------------------------------------------------------- // Subclass: DataTypeIException @@ -446,13 +416,6 @@ DataTypeIException::DataTypeIException(const H5std_string &func, const H5std_str : Exception(func, message) { } -//-------------------------------------------------------------------------- -// Function: DataTypeIException destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -DataTypeIException::~DataTypeIException() throw() -{ -} //-------------------------------------------------------------------------- // Subclass: ObjHeaderIException @@ -475,13 +438,6 @@ ObjHeaderIException::ObjHeaderIException(const H5std_string &func, const H5std_s : Exception(func, message) { } -//-------------------------------------------------------------------------- -// Function: ObjHeaderIException destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -ObjHeaderIException::~ObjHeaderIException() throw() -{ -} //-------------------------------------------------------------------------- // Subclass: PropListIException @@ -504,13 +460,6 @@ PropListIException::PropListIException(const H5std_string &func, const H5std_str : Exception(func, message) { } -//-------------------------------------------------------------------------- -// Function: PropListIException destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -PropListIException::~PropListIException() throw() -{ -} //-------------------------------------------------------------------------- // Subclass: DataSetIException @@ -533,13 +482,6 @@ DataSetIException::DataSetIException(const H5std_string &func, const H5std_strin : Exception(func, message) { } -//-------------------------------------------------------------------------- -// Function: DataSetIException destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -DataSetIException::~DataSetIException() throw() -{ -} //-------------------------------------------------------------------------- // Subclass: AttributeIException @@ -562,13 +504,6 @@ AttributeIException::AttributeIException(const H5std_string &func, const H5std_s : Exception(func, message) { } -//-------------------------------------------------------------------------- -// Function: AttributeIException destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -AttributeIException::~AttributeIException() throw() -{ -} //-------------------------------------------------------------------------- // Subclass: ReferenceException @@ -591,13 +526,6 @@ ReferenceException::ReferenceException(const H5std_string &func, const H5std_str : Exception(func, message) { } -//-------------------------------------------------------------------------- -// Function: ReferenceException destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -ReferenceException::~ReferenceException() throw() -{ -} //-------------------------------------------------------------------------- // Subclass: LibraryIException @@ -620,13 +548,6 @@ LibraryIException::LibraryIException(const H5std_string &func, const H5std_strin : Exception(func, message) { } -//-------------------------------------------------------------------------- -// Function: LibraryIException destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -LibraryIException::~LibraryIException() throw() -{ -} //-------------------------------------------------------------------------- // Subclass: LocationException @@ -649,13 +570,6 @@ LocationException::LocationException(const H5std_string &func, const H5std_strin : Exception(func, message) { } -//-------------------------------------------------------------------------- -// Function: LocationException destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -LocationException::~LocationException() throw() -{ -} //-------------------------------------------------------------------------- // Subclass: IdComponentException @@ -678,12 +592,5 @@ IdComponentException::IdComponentException(const H5std_string &func, const H5std : Exception(func, message) { } -//-------------------------------------------------------------------------- -// Function: IdComponentException destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -IdComponentException::~IdComponentException() throw() -{ -} } // namespace H5 diff --git a/c++/src/H5Exception.h b/c++/src/H5Exception.h index d4533e59d33..6bf51ef893b 100644 --- a/c++/src/H5Exception.h +++ b/c++/src/H5Exception.h @@ -74,7 +74,7 @@ class H5_DLLCPP Exception { Exception(const Exception &orig); // virtual Destructor - virtual ~Exception() throw(); + virtual ~Exception() = default; protected: // Default value for detail_message @@ -89,84 +89,84 @@ class H5_DLLCPP FileIException : public Exception { public: FileIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); FileIException(); - virtual ~FileIException() throw() override; + virtual ~FileIException() override = default; }; class H5_DLLCPP GroupIException : public Exception { public: GroupIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); GroupIException(); - virtual ~GroupIException() throw() override; + virtual ~GroupIException() override = default; }; class H5_DLLCPP DataSpaceIException : public Exception { public: DataSpaceIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); DataSpaceIException(); - virtual ~DataSpaceIException() throw() override; + virtual ~DataSpaceIException() override = default; }; class H5_DLLCPP DataTypeIException : public Exception { public: DataTypeIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); DataTypeIException(); - virtual ~DataTypeIException() throw() override; + virtual ~DataTypeIException() override = default; }; class H5_DLLCPP ObjHeaderIException : public Exception { public: ObjHeaderIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); ObjHeaderIException(); - virtual ~ObjHeaderIException() throw() override; + virtual ~ObjHeaderIException() override = default; }; class H5_DLLCPP PropListIException : public Exception { public: PropListIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); PropListIException(); - virtual ~PropListIException() throw() override; + virtual ~PropListIException() override = default; }; class H5_DLLCPP DataSetIException : public Exception { public: DataSetIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); DataSetIException(); - virtual ~DataSetIException() throw() override; + virtual ~DataSetIException() override = default; }; class H5_DLLCPP AttributeIException : public Exception { public: AttributeIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); AttributeIException(); - virtual ~AttributeIException() throw() override; + virtual ~AttributeIException() override = default; }; class H5_DLLCPP ReferenceException : public Exception { public: ReferenceException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); ReferenceException(); - virtual ~ReferenceException() throw() override; + virtual ~ReferenceException() override = default; }; class H5_DLLCPP LibraryIException : public Exception { public: LibraryIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); LibraryIException(); - virtual ~LibraryIException() throw() override; + virtual ~LibraryIException() override = default; }; class H5_DLLCPP LocationException : public Exception { public: LocationException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); LocationException(); - virtual ~LocationException() throw() override; + virtual ~LocationException() override = default; }; class H5_DLLCPP IdComponentException : public Exception { public: IdComponentException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); IdComponentException(); - virtual ~IdComponentException() throw() override; + virtual ~IdComponentException() override = default; }; // end of IdComponentException } // namespace H5 diff --git a/c++/src/H5FaccProp.cpp b/c++/src/H5FaccProp.cpp index ea5692ac7c3..dc4b949b5b3 100644 --- a/c++/src/H5FaccProp.cpp +++ b/c++/src/H5FaccProp.cpp @@ -769,12 +769,4 @@ FileAccPropList::getLibverBounds(H5F_libver_t &libver_low, H5F_libver_t &libver_ } } -//-------------------------------------------------------------------------- -// Function: FileAccPropList destructor -///\brief Noop destructor -//-------------------------------------------------------------------------- -FileAccPropList::~FileAccPropList() -{ -} - } // namespace H5 diff --git a/c++/src/H5FaccProp.h b/c++/src/H5FaccProp.h index 27028a2bccd..67394f1c3a5 100644 --- a/c++/src/H5FaccProp.h +++ b/c++/src/H5FaccProp.h @@ -149,7 +149,7 @@ class H5_DLLCPP FileAccPropList : public PropList { FileAccPropList(const hid_t plist_id); // Noop destructor - virtual ~FileAccPropList() override; + virtual ~FileAccPropList() override = default; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5FcreatProp.cpp b/c++/src/H5FcreatProp.cpp index fe46dee35ee..66e4ceb886b 100644 --- a/c++/src/H5FcreatProp.cpp +++ b/c++/src/H5FcreatProp.cpp @@ -357,12 +357,4 @@ FileCreatPropList::getFileSpacePagesize() const return (fsp_psize); } -//-------------------------------------------------------------------------- -// Function: FileCreatPropList destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -FileCreatPropList::~FileCreatPropList() -{ -} - } // namespace H5 diff --git a/c++/src/H5FcreatProp.h b/c++/src/H5FcreatProp.h index 399db71d434..76c2ae5b952 100644 --- a/c++/src/H5FcreatProp.h +++ b/c++/src/H5FcreatProp.h @@ -90,7 +90,7 @@ class H5_DLLCPP FileCreatPropList : public PropList { FileCreatPropList(const hid_t plist_id); // Noop destructor - virtual ~FileCreatPropList() override; + virtual ~FileCreatPropList() override = default; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5FloatType.cpp b/c++/src/H5FloatType.cpp index 74170da00a3..41ee8a850bc 100644 --- a/c++/src/H5FloatType.cpp +++ b/c++/src/H5FloatType.cpp @@ -326,12 +326,4 @@ FloatType::setInpad(H5T_pad_t inpad) const } } -//-------------------------------------------------------------------------- -// Function: FloatType destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -FloatType::~FloatType() -{ -} - } // namespace H5 diff --git a/c++/src/H5FloatType.h b/c++/src/H5FloatType.h index 42437ec1154..b804892b0a8 100644 --- a/c++/src/H5FloatType.h +++ b/c++/src/H5FloatType.h @@ -78,7 +78,7 @@ class H5_DLLCPP FloatType : public AtomType { FloatType(const FloatType &original); // Noop destructor. - virtual ~FloatType() override; + virtual ~FloatType() override = default; }; // end of FloatType } // namespace H5 diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp index 93df34391c0..0d15aac7fb9 100644 --- a/c++/src/H5IdComponent.cpp +++ b/c++/src/H5IdComponent.cpp @@ -307,14 +307,6 @@ IdComponent::setId(const hid_t new_id) incRefCount(); } -//-------------------------------------------------------------------------- -// Function: IdComponent destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -IdComponent::~IdComponent() -{ -} - // // Implementation of protected functions for HDF5 Reference Interface // and miscellaneous helpers. diff --git a/c++/src/H5IdComponent.h b/c++/src/H5IdComponent.h index d64bdb5ab7d..2fef96f4137 100644 --- a/c++/src/H5IdComponent.h +++ b/c++/src/H5IdComponent.h @@ -81,7 +81,7 @@ class H5_DLLCPP IdComponent { #endif // DOXYGEN_SHOULD_SKIP_THIS // Destructor - virtual ~IdComponent(); + virtual ~IdComponent() = default; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5IntType.cpp b/c++/src/H5IntType.cpp index 87a287f6743..7c8b7d36ff9 100644 --- a/c++/src/H5IntType.cpp +++ b/c++/src/H5IntType.cpp @@ -182,12 +182,4 @@ IntType::setSign(H5T_sign_t sign) const } } -//-------------------------------------------------------------------------- -// Function: IntType destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -IntType::~IntType() -{ -} - } // namespace H5 diff --git a/c++/src/H5IntType.h b/c++/src/H5IntType.h index 170ed374d4d..1ca0ab147d2 100644 --- a/c++/src/H5IntType.h +++ b/c++/src/H5IntType.h @@ -60,7 +60,7 @@ class H5_DLLCPP IntType : public AtomType { IntType(const IntType &original); // Noop destructor. - virtual ~IntType() override; + virtual ~IntType() override = default; }; // end of IntType } // namespace H5 diff --git a/c++/src/H5LaccProp.cpp b/c++/src/H5LaccProp.cpp index 0285ee7baf9..7a66c13d323 100644 --- a/c++/src/H5LaccProp.cpp +++ b/c++/src/H5LaccProp.cpp @@ -140,12 +140,4 @@ LinkAccPropList::getNumLinks() const return (nlinks); } -//-------------------------------------------------------------------------- -// Function: LinkAccPropList destructor -///\brief Noop destructor -//-------------------------------------------------------------------------- -LinkAccPropList::~LinkAccPropList() -{ -} - } // namespace H5 diff --git a/c++/src/H5LaccProp.h b/c++/src/H5LaccProp.h index 53389e2e68b..6f4b9190f06 100644 --- a/c++/src/H5LaccProp.h +++ b/c++/src/H5LaccProp.h @@ -51,7 +51,7 @@ class H5_DLLCPP LinkAccPropList : public PropList { size_t getNumLinks() const; // Noop destructor - virtual ~LinkAccPropList() override; + virtual ~LinkAccPropList() override = default; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5LcreatProp.cpp b/c++/src/H5LcreatProp.cpp index 2f3437531b8..0dbb0b275c0 100644 --- a/c++/src/H5LcreatProp.cpp +++ b/c++/src/H5LcreatProp.cpp @@ -184,13 +184,4 @@ LinkCreatPropList::getCharEncoding() const return (encoding); } -//-------------------------------------------------------------------------- -// Function: LinkCreatPropList destructor -///\brief Noop destructor -// December, 2016 -//-------------------------------------------------------------------------- -LinkCreatPropList::~LinkCreatPropList() -{ -} - } // namespace H5 diff --git a/c++/src/H5LcreatProp.h b/c++/src/H5LcreatProp.h index 233a98bd92b..272f260b253 100644 --- a/c++/src/H5LcreatProp.h +++ b/c++/src/H5LcreatProp.h @@ -58,7 +58,7 @@ class H5_DLLCPP LinkCreatPropList : public PropList { H5T_cset_t getCharEncoding() const; // Noop destructor - virtual ~LinkCreatPropList() override; + virtual ~LinkCreatPropList() override = default; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5Library.cpp b/c++/src/H5Library.cpp index 019ae67b4cf..c16bd819268 100644 --- a/c++/src/H5Library.cpp +++ b/c++/src/H5Library.cpp @@ -273,14 +273,6 @@ H5Library::setFreeListLimits(int reg_global_lim, int reg_list_lim, int arr_globa H5Library::H5Library() { } - -//-------------------------------------------------------------------------- -// Function: H5Library destructor -///\brief Noop destructor -//-------------------------------------------------------------------------- -H5Library::~H5Library() -{ -} #endif // DOXYGEN_SHOULD_SKIP_THIS } // namespace H5 diff --git a/c++/src/H5Library.h b/c++/src/H5Library.h index 37706391558..10e5536bc14 100644 --- a/c++/src/H5Library.h +++ b/c++/src/H5Library.h @@ -62,7 +62,7 @@ class H5_DLLCPP H5Library { H5Library(); // Destructor - ~H5Library(); + ~H5Library() = default; #endif // DOXYGEN_SHOULD_SKIP_THIS }; // end of H5Library diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index 8befefc5a13..87eac679238 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -2367,12 +2367,4 @@ f_DataSpace_setId(DataSpace *dspace, hid_t new_id) dspace->p_setId(new_id); } -//-------------------------------------------------------------------------- -// Function: H5Location destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -H5Location::~H5Location() -{ -} - } // namespace H5 diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h index ee45d679de6..f10a00531f0 100644 --- a/c++/src/H5Location.h +++ b/c++/src/H5Location.h @@ -333,7 +333,7 @@ class H5_DLLCPP H5Location : public IdComponent { #endif // DOXYGEN_SHOULD_SKIP_THIS // Noop destructor. - virtual ~H5Location() override; + virtual ~H5Location() override = default; }; // end of H5Location } // namespace H5 diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index 2b898e761ba..54114378e85 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -541,14 +541,4 @@ H5Object::getObjName(H5std_string &obj_name, size_t len) const return name_size; } -#ifndef DOXYGEN_SHOULD_SKIP_THIS -//-------------------------------------------------------------------------- -// Function: H5Object destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -H5Object::~H5Object() -{ -} -#endif // DOXYGEN_SHOULD_SKIP_THIS - } // namespace H5 diff --git a/c++/src/H5Object.h b/c++/src/H5Object.h index 1e93c0c8268..b2905842ad7 100644 --- a/c++/src/H5Object.h +++ b/c++/src/H5Object.h @@ -124,7 +124,7 @@ class H5_DLLCPP H5Object : public H5Location { virtual void p_setId(const hid_t new_id) override = 0; // Noop destructor. - virtual ~H5Object() override; + virtual ~H5Object() override = default; #endif // DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5OcreatProp.cpp b/c++/src/H5OcreatProp.cpp index 54808cbf929..0f1da1c5a8d 100644 --- a/c++/src/H5OcreatProp.cpp +++ b/c++/src/H5OcreatProp.cpp @@ -199,12 +199,4 @@ ObjCreatPropList::getAttrCrtOrder() const return (crt_order_flags); } -//-------------------------------------------------------------------------- -// Function: ObjCreatPropList destructor -///\brief Noop destructor -//-------------------------------------------------------------------------- -ObjCreatPropList::~ObjCreatPropList() -{ -} - } // namespace H5 diff --git a/c++/src/H5OcreatProp.h b/c++/src/H5OcreatProp.h index 6d752ed9c90..fbe399197fe 100644 --- a/c++/src/H5OcreatProp.h +++ b/c++/src/H5OcreatProp.h @@ -56,7 +56,7 @@ class H5_DLLCPP ObjCreatPropList : public PropList { ObjCreatPropList(const hid_t plist_id); // Noop destructor - virtual ~ObjCreatPropList() override; + virtual ~ObjCreatPropList() override = default; #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp index 6aa5b170563..0338a01e016 100644 --- a/c++/src/H5PredType.cpp +++ b/c++/src/H5PredType.cpp @@ -108,15 +108,6 @@ PredType::committed() } #endif // DOXYGEN_SHOULD_SKIP_THIS -// Default destructor -//-------------------------------------------------------------------------- -// Function: PredType destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -PredType::~PredType() -{ -} - /***************************************************************************** The following section is regarding the global constants PredType, DataSpace, and PropList. diff --git a/c++/src/H5PredType.h b/c++/src/H5PredType.h index 1e305fc00ae..85b6e96fb0a 100644 --- a/c++/src/H5PredType.h +++ b/c++/src/H5PredType.h @@ -41,7 +41,7 @@ class H5_DLLCPP PredType : public AtomType { PredType(const PredType &original); // Noop destructor - virtual ~PredType() override; + virtual ~PredType() override = default; /*! \brief This dummy function do not inherit from DataType - it will throw a DataTypeIException if invoked. diff --git a/c++/src/H5StrType.cpp b/c++/src/H5StrType.cpp index 2c47809207e..1b45814f4e7 100644 --- a/c++/src/H5StrType.cpp +++ b/c++/src/H5StrType.cpp @@ -290,12 +290,4 @@ StrType::setStrpad(H5T_str_t strpad) const } } -//-------------------------------------------------------------------------- -// Function: StrType destructor -///\brief Properly terminates access to this string datatype. -//-------------------------------------------------------------------------- -StrType::~StrType() -{ -} - } // namespace H5 diff --git a/c++/src/H5StrType.h b/c++/src/H5StrType.h index ccae3e750d4..0f51e759aaf 100644 --- a/c++/src/H5StrType.h +++ b/c++/src/H5StrType.h @@ -72,7 +72,7 @@ class H5_DLLCPP StrType : public AtomType { StrType(const StrType &original); // Noop destructor. - virtual ~StrType() override; + virtual ~StrType() override = default; }; // end of StrType } // namespace H5 diff --git a/c++/src/H5VarLenType.cpp b/c++/src/H5VarLenType.cpp index e8b7cbb8c77..49f2cbdd22b 100644 --- a/c++/src/H5VarLenType.cpp +++ b/c++/src/H5VarLenType.cpp @@ -146,12 +146,4 @@ VarLenType::decode() const return (encoded_vltype); } -//-------------------------------------------------------------------------- -// Function: VarLenType destructor -///\brief Properly terminates access to this datatype. -//-------------------------------------------------------------------------- -VarLenType::~VarLenType() -{ -} - } // namespace H5 diff --git a/c++/src/H5VarLenType.h b/c++/src/H5VarLenType.h index 318681aca3b..d7f0ff1aefe 100644 --- a/c++/src/H5VarLenType.h +++ b/c++/src/H5VarLenType.h @@ -52,7 +52,7 @@ class H5_DLLCPP VarLenType : public DataType { VarLenType(const H5Location &loc, const H5std_string &name); // Noop destructor - virtual ~VarLenType() override; + virtual ~VarLenType() override = default; // Default constructor VarLenType(); diff --git a/c++/src/h5c++.in b/c++/src/h5c++.in index 078fa734fcf..e666ba96b92 100644 --- a/c++/src/h5c++.in +++ b/c++/src/h5c++.in @@ -60,7 +60,7 @@ host_os="@host_os@" prog_name="`basename $0`" -allargs="" +misc_args="" compile_args="" libraries="" link_args="" @@ -198,7 +198,6 @@ for arg in $@ ; do case "$arg" in -c) - allargs="$allargs $arg" compile_args="$compile_args $arg" if test "x$do_link" = "xyes" -a -n "$output_file"; then @@ -209,7 +208,6 @@ for arg in $@ ; do dash_c="yes" ;; -o) - allargs="$allargs $arg" dash_o="yes" if test "x$dash_c" = "xyes"; then @@ -221,14 +219,12 @@ for arg in $@ ; do fi ;; -E|-M|-MT) - allargs="$allargs $arg" compile_args="$compile_args $arg" dash_c="yes" do_link="no" ;; -l*) libraries=" $libraries $arg " - allargs="$allargs $arg" ;; -prefix=*) prefix="`expr "$arg" : '-prefix=\(.*\)'`" @@ -254,15 +250,15 @@ for arg in $@ ; do ;; *\"*) qarg="'"$arg"'" - allargs="$allargs $qarg" + misc_args="$misc_args $qarg" ;; *\'*) - qarg='\"'"$arg"'\"' - allargs="$allargs $qarg" + qarg='"'"$arg"'"' + misc_args="$misc_args $qarg" ;; *) - allargs="$allargs $qarg" + misc_args="$misc_args $qarg" if [ -s "$arg" ] ; then ext=`expr "$arg" : '.*\(\..*\)'` @@ -300,7 +296,7 @@ if test "x$do_compile" = "xyes"; then compile_args="-c $compile_args" fi - $SHOW $CXX -I$includedir $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CXXFLAGS $CXXFLAGS $compile_args + $SHOW $CXX -I$includedir $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CXXFLAGS $CXXFLAGS $misc_args $compile_args status=$? if test "$status" != "0"; then diff --git a/c++/test/CMakeTests.cmake b/c++/test/CMakeTests.cmake index 224b09974d0..7d1b1ff9912 100644 --- a/c++/test/CMakeTests.cmake +++ b/c++/test/CMakeTests.cmake @@ -17,7 +17,7 @@ add_custom_target(cpp_testhdf5_files ALL COMMENT "Copying files needed by cpp_te ### T E S T I N G ### ############################################################################## ############################################################################## -if (HDF5_ENABLE_USING_MEMCHECKER) +if (HDF5_USING_ANALYSIS_TOOL) add_test (NAME CPP_testhdf5 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME CPP_testhdf5 COMMAND "${CMAKE_COMMAND}" diff --git a/c++/test/CMakeVFDTests.cmake b/c++/test/CMakeVFDTests.cmake index 52f8069f390..f1981c8cea2 100644 --- a/c++/test/CMakeVFDTests.cmake +++ b/c++/test/CMakeVFDTests.cmake @@ -23,7 +23,7 @@ H5_CREATE_VFD_DIR() ############################################################################## ############################################################################## macro (ADD_VFD_TEST vfdname resultcode) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME CPP_VFD-${vfdname}-cpp_testhdf5 COMMAND "${CMAKE_COMMAND}" diff --git a/c++/test/h5cpputil.cpp b/c++/test/h5cpputil.cpp index c3feefaef4c..933aa7da264 100644 --- a/c++/test/h5cpputil.cpp +++ b/c++/test/h5cpputil.cpp @@ -197,13 +197,6 @@ InvalidActionException::InvalidActionException(const H5std_string &func, const H { } -//-------------------------------------------------------------------------- -// Function: InvalidActionException destructor -//-------------------------------------------------------------------------- -InvalidActionException::~InvalidActionException() throw() -{ -} - //-------------------------------------------------------------------------- // Function: TestFailedException default constructor //-------------------------------------------------------------------------- @@ -225,10 +218,3 @@ TestFailedException::TestFailedException(const H5std_string &func, const H5std_s : Exception(func, message) { } - -//-------------------------------------------------------------------------- -// Function: TestFailedException destructor -//-------------------------------------------------------------------------- -TestFailedException::~TestFailedException() throw() -{ -} diff --git a/c++/test/h5cpputil.h b/c++/test/h5cpputil.h index 392382deafe..fa6822ad172 100644 --- a/c++/test/h5cpputil.h +++ b/c++/test/h5cpputil.h @@ -49,14 +49,14 @@ class InvalidActionException : public Exception { public: InvalidActionException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); InvalidActionException(); - ~InvalidActionException() throw() override; + ~InvalidActionException() override = default; }; class TestFailedException : public Exception { public: TestFailedException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); TestFailedException(); - ~TestFailedException() throw() override; + ~TestFailedException() override = default; }; // Overloaded/Template functions to verify values and display proper info diff --git a/config/BlankForm b/config/BlankForm index 55a3b49a35c..e297cc385bc 100644 --- a/config/BlankForm +++ b/config/BlankForm @@ -115,21 +115,3 @@ case $CC_BASENAME in PROFILE_CPPFLAGS= ;; esac - - - -# Overriding Configure Tests -# -------------------------- -# -# Values for overriding configuration tests when cross compiling. -# This includes compiling on some machines where the serial front end -# compiles for a parallel back end. - -# Set this to `yes' or `no' depending on whether the target is big -# endian or little endian. -#ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'} - -# Set this to the width required by printf() to print type `long -# long'. For instance, if the format would be `%lld' then set it to -# `ll' or if the format would be `%qd' set it to `q'. -#hdf5_cv_printf_ll=${hdf5_cv_printf_ll='ll'} diff --git a/config/README.md b/config/README.md index 8459b7724ae..75e725ea4fe 100644 --- a/config/README.md +++ b/config/README.md @@ -32,8 +32,6 @@ An Autotools build will first use `$host_cpu`, `$host_os`, etc. to try to find a suitable platform file in `config` to source and start checking compilers. The code that does this is in `configure.ac` (search for `host_os`). For example, MacOS will source the `apple` file and FreeBSD will source the `freebsd` file. -There are a bunch of Linux files, but they all eventually invoke -`linux-gnulibc1`. If you dig into one of these files, the way that they check for compilers is rather crude. Each OS script will simply source the various C, C++, and diff --git a/config/cmake-presets/hidden-presets.json b/config/cmake-presets/hidden-presets.json index 2249651d795..d4e52cab752 100644 --- a/config/cmake-presets/hidden-presets.json +++ b/config/cmake-presets/hidden-presets.json @@ -522,37 +522,25 @@ "configurePreset": "ci-x64-Release-MSVC", "hidden": true, "inherits": "ci-base", - "generators": [ - "ZIP" - ], "configurations": ["RelWithDebInfo"] }, { "name": "ci-x64-Release-Clang", "configurePreset": "ci-x64-Release-Clang", "hidden": true, - "inherits": "ci-base", - "generators": [ - "TGZ" - ] + "inherits": "ci-base" }, { "name": "ci-x64-Release-GNUC", "configurePreset": "ci-x64-Release-GNUC", "hidden": true, - "inherits": "ci-base", - "generators": [ - "TGZ" - ] + "inherits": "ci-base" }, { "name": "ci-x64-Release-Intel", "configurePreset": "ci-x64-Release-Intel", "hidden": true, - "inherits": "ci-base", - "generators": [ - "TGZ" - ] + "inherits": "ci-base" } ] } diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index fe3f7f984ac..59755334d20 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -78,7 +78,6 @@ if (WINDOWS) endif () if (NOT UNIX AND NOT CYGWIN) set (${HDF_PREFIX}_HAVE_GETCONSOLESCREENBUFFERINFO 1) - set (${HDF_PREFIX}_GETTIMEOFDAY_GIVES_TZ 1) if (MSVC_VERSION GREATER_EQUAL 1900) set (${HDF_PREFIX}_HAVE_TIMEZONE 1) endif () @@ -398,7 +397,6 @@ if (MINGW OR NOT WINDOWS) CHECK_FUNCTION_EXISTS (gettimeofday ${HDF_PREFIX}_HAVE_GETTIMEOFDAY) foreach (time_test # HAVE_TIMEZONE - GETTIMEOFDAY_GIVES_TZ HAVE_TM_ZONE HAVE_STRUCT_TM_TM_ZONE ) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 2534b8e2542..33522a44efa 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -53,6 +53,9 @@ /* Define if Fortran C_LONG_DOUBLE is different from C_DOUBLE */ #define H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE @H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE@ +/* 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 we have Fortran C_LONG_DOUBLE */ #define H5_FORTRAN_HAVE_C_LONG_DOUBLE @H5_FORTRAN_HAVE_C_LONG_DOUBLE@ @@ -65,6 +68,9 @@ /* Define if we have Fortran intrinsic STORAGE_SIZE */ #cmakedefine H5_FORTRAN_HAVE_STORAGE_SIZE @H5_FORTRAN_HAVE_STORAGE_SIZE@ +/* Define if Fortran supports allocatable character */ +#cmakedefine H5_FORTRAN_HAVE_CHAR_ALLOC @H5_FORTRAN_HAVE_CHAR_ALLOC@ + /* Determine the size of C long double */ #cmakedefine H5_FORTRAN_SIZEOF_LONG_DOUBLE @H5_FORTRAN_SIZEOF_LONG_DOUBLE@ @@ -243,6 +249,9 @@ /* Define if we have parallel support */ #cmakedefine H5_HAVE_PARALLEL @H5_HAVE_PARALLEL@ +/* Define if MPI Fortran supports mpi_f08 module */ +#cmakedefine H5_HAVE_MPI_F08 @H5_HAVE_MPI_F08@ + /* Define if we have support for writing to filtered datasets in parallel */ #cmakedefine H5_HAVE_PARALLEL_FILTERED_WRITES @H5_HAVE_PARALLEL_FILTERED_WRITES@ diff --git a/config/cmake/HDF5ExampleCache.cmake b/config/cmake/HDF5ExampleCache.cmake index 6ac9cc06e40..9b526ee9f49 100644 --- a/config/cmake/HDF5ExampleCache.cmake +++ b/config/cmake/HDF5ExampleCache.cmake @@ -14,7 +14,7 @@ set (HDF_BUILD_CPP_LIB ${HDF5_BUILD_CPP_LIB} CACHE BOOL "Build HDF5 C++ Library" set (HDF_BUILD_HL_LIB ${HDF5_BUILD_HL_LIB} CACHE BOOL "Build HIGH Level examples" FORCE) set (HDF_ENABLE_THREADSAFE ${HDF5_ENABLE_THREADSAFE} CACHE BOOL "Enable examples thread-safety" FORCE) set (HDF_ENABLE_PARALLEL ${HDF5_ENABLE_PARALLEL} CACHE BOOL "Enable examples parallel build (requires MPI)" FORCE) -set (H5EX_USE_GNU_DIRS ${HDF5_USE_GNU_DIRS} CACHE BOOL "TRUE to use GNU Coding Standard install directory variables, FALSE to use historical settings" FORCE) +set (H5EX_USE_GNU_DIRS ${HDF5_USE_GNU_DIRS} CACHE BOOL "ON to use GNU Coding Standard install directory variables, OFF to use historical settings" FORCE) #preset HDF5 cache vars to this projects libraries instead of searching set (H5EX_HDF5_HEADER "H5pubconf.h" CACHE STRING "Name of HDF5 header" FORCE) @@ -69,6 +69,6 @@ endif () message (STATUS "HDF5 Example link libs: ${H5EX_HDF5_LINK_LIBS} Includes: ${H5EX_HDF5_INCLUDE_DIRS}") set (HDF5_TOOLS_DIR ${CMAKE_TEST_OUTPUT_DIRECTORY} CACHE STRING "HDF5 Directory for all Executables" FORCE) -set (H5EX_HDF5_DUMP_EXECUTABLE $ CACHE STRING "HDF5 h5dump target" FORCE) -set (H5EX_HDF5_REPACK_EXECUTABLE $ CACHE STRING "HDF5 h5repack target" FORCE) +set (H5EX_HDF5_DUMP_EXECUTABLE $ CACHE STRING "HDF5 h5dump target" FORCE) +set (H5EX_HDF5_REPACK_EXECUTABLE $ CACHE STRING "HDF5 h5repack target" FORCE) diff --git a/config/cmake/HDF5PluginCache.cmake b/config/cmake/HDF5PluginCache.cmake index d299d9fd1a0..e96c45db371 100644 --- a/config/cmake/HDF5PluginCache.cmake +++ b/config/cmake/HDF5PluginCache.cmake @@ -15,8 +15,8 @@ set (H5PL_HDF5_LINK_LIBS ${HDF5_LIBSH_TARGET} CACHE STRING "HDF5 target" FORCE) set (H5PL_HDF5_INCLUDE_DIRS "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR}" CACHE PATH "HDF5 include dirs" FORCE) set (H5PL_HDF5_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE STRING "HDF5 build folder" FORCE) -set (H5PL_HDF5_DUMP_EXECUTABLE $ CACHE STRING "HDF5 h5dump target" FORCE) -set (H5PL_HDF5_REPACK_EXECUTABLE $ CACHE STRING "HDF5 h5repack target" FORCE) +set (H5PL_HDF5_DUMP_EXECUTABLE $ CACHE STRING "HDF5 h5dump target" FORCE) +set (H5PL_HDF5_REPACK_EXECUTABLE $ CACHE STRING "HDF5 h5repack target" FORCE) if (NOT DEFINED H5PL_ALLOW_EXTERNAL_SUPPORT) set (H5PL_ALLOW_EXTERNAL_SUPPORT "${HDF5_ALLOW_EXTERNAL_SUPPORT}" CACHE STRING "Allow External Library Building (NO GIT TGZ)" FORCE) @@ -39,4 +39,4 @@ set (H5PL_TGZ_NAME "${PLUGIN_TGZ_NAME}" CACHE STRING "Use plugins from compresse set (PL_PACKAGE_NAME "${PLUGIN_PACKAGE_NAME}" CACHE STRING "Name of plugins package" FORCE) set (H5PL_CPACK_ENABLE OFF CACHE BOOL "Enable CPack include and components" FORCE) -set (H5PL_USE_GNU_DIRS ${HDF5_USE_GNU_DIRS} CACHE BOOL "TRUE to use GNU Coding Standard install directory variables" FORCE) +set (H5PL_USE_GNU_DIRS ${HDF5_USE_GNU_DIRS} CACHE BOOL "ON to use GNU Coding Standard install directory variables, OFF to use historical settings" FORCE) diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index 3e058adbf83..73b4f742b48 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -101,6 +101,16 @@ else () set (${HDF_PREFIX}_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE 0) endif () +# Check to see C_BOOL is different from default LOGICAL + +READ_SOURCE("MODULE l_type_mod" "END PROGRAM PROG_FC_C_BOOL_EQ_LOGICAL" SOURCE_CODE) +check_fortran_source_compiles (${SOURCE_CODE} FORTRAN_C_BOOL_IS_UNIQUE SRC_EXT f90) +if (${FORTRAN_C_BOOL_IS_UNIQUE}) + set (${HDF_PREFIX}_FORTRAN_C_BOOL_IS_UNIQUE 1) +else () + set (${HDF_PREFIX}_FORTRAN_C_BOOL_IS_UNIQUE 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)") @@ -114,6 +124,15 @@ else () message (FATAL_ERROR "Fortran compiler requires either intrinsic functions SIZEOF or STORAGE_SIZE") endif () +# Check to see of Fortran supports allocatable character +READ_SOURCE("PROGRAM PROG_CHAR_ALLOC" "END PROGRAM PROG_CHAR_ALLOC" SOURCE_CODE) +check_fortran_source_compiles (${SOURCE_CODE} FORTRAN_CHAR_ALLOC SRC_EXT f90) +if (${FORTRAN_CHAR_ALLOC}) + set (${HDF_PREFIX}_FORTRAN_HAVE_CHAR_ALLOC 1) +else () + set (${HDF_PREFIX}_FORTRAN_HAVE_CHAR_ALLOC 0) +endif () + #----------------------------------------------------------------------------- # Determine the available KINDs for REALs and INTEGERs #----------------------------------------------------------------------------- @@ -345,7 +364,7 @@ string (REGEX REPLACE "}" "" OUT_VAR2 ${OUT_VAR2}) set (${HDF_PREFIX}_H5CONFIG_F_RKIND_SIZEOF "INTEGER, DIMENSION(1:num_rkinds) :: rkind_sizeof = (/${OUT_VAR2}/)") # Setting definition if there is a 16 byte fortran integer -string (FIND ${PAC_FC_ALL_INTEGER_KINDS_SIZEOF} "16" pos) +string (FIND "${PAC_FC_ALL_INTEGER_KINDS_SIZEOF}" "16" pos) if (${pos} EQUAL -1) set (${HDF_PREFIX}_HAVE_Fortran_INTEGER_SIZEOF_16 0) else () diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index 7bddad0f776..8f9e2a18fcc 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -375,8 +375,6 @@ if (HDF5_ENABLE_DEBUG_APIS) H5D_DEBUG H5D_CHUNK_DEBUG H5F_DEBUG - H5HL_DEBUG - H5I_DEBUG H5MM_DEBUG H5O_DEBUG H5S_DEBUG diff --git a/config/cmake/HDFMacros.cmake b/config/cmake/HDFMacros.cmake index 30c16e6800f..15338272ccf 100644 --- a/config/cmake/HDFMacros.cmake +++ b/config/cmake/HDFMacros.cmake @@ -279,6 +279,7 @@ macro (HDF_README_PROPERTIES target_fortran) if (WIN32) set (BINARY_EXAMPLE_ENDING "zip") set (BINARY_INSTALL_ENDING "msi") + set (BINARY_COMPRESS_ENDING "zip") if (CMAKE_CL_64) set (BINARY_SYSTEM_NAME "win64") else () @@ -330,12 +331,14 @@ macro (HDF_README_PROPERTIES target_fortran) endif () elseif (APPLE) set (BINARY_EXAMPLE_ENDING "tar.gz") + set (BINARY_COMPRESS_ENDING "tar.gz") set (BINARY_INSTALL_ENDING "sh") # if packaging changes - use dmg set (BINARY_PLATFORM "${BINARY_PLATFORM} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR}") set (BINARY_PLATFORM "${BINARY_PLATFORM}, using ${CMAKE_C_COMPILER_ID} C ${CMAKE_C_COMPILER_VERSION}") else () set (BINARY_EXAMPLE_ENDING "tar.gz") - set (BINARY_INSTALL_ENDING "sh") + set (BINARY_COMPRESS_ENDING "tar.gz") + set (BINARY_INSTALL_ENDING "sh/deb/rpm") set (BINARY_PLATFORM "${BINARY_PLATFORM} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR}") set (BINARY_PLATFORM "${BINARY_PLATFORM}, using ${CMAKE_C_COMPILER_ID} C ${CMAKE_C_COMPILER_VERSION}") endif () @@ -369,7 +372,7 @@ macro (HDFTEST_COPY_FILE src dest target) endmacro () macro (HDF_DIR_PATHS package_prefix) - option (HDF5_USE_GNU_DIRS "TRUE to use GNU Coding Standard install directory variables, FALSE to use historical settings" FALSE) + option (HDF5_USE_GNU_DIRS "ON to use GNU Coding Standard install directory variables, OFF to use historical settings" OFF) if (HDF5_USE_GNU_DIRS) include(GNUInstallDirs) if (NOT ${package_prefix}_INSTALL_BIN_DIR) @@ -400,7 +403,7 @@ macro (HDF_DIR_PATHS package_prefix) endif () if (APPLE) - option (${package_prefix}_BUILD_FRAMEWORKS "TRUE to build as frameworks libraries, FALSE to build according to BUILD_SHARED_LIBS" FALSE) + option (${package_prefix}_BUILD_FRAMEWORKS "ON to build as frameworks libraries, OFF to build according to BUILD_SHARED_LIBS" OFF) endif () if (NOT ${package_prefix}_INSTALL_BIN_DIR) @@ -449,10 +452,10 @@ macro (HDF_DIR_PATHS package_prefix) message(STATUS "Final: ${${package_prefix}_INSTALL_DOC_DIR}") # Always use full RPATH, i.e. don't skip the full RPATH for the build tree - set (CMAKE_SKIP_BUILD_RPATH FALSE) + set (CMAKE_SKIP_BUILD_RPATH OFF) # when building, don't use the install RPATH already # (but later on when installing) - set (CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) + set (CMAKE_INSTALL_RPATH_USE_LINK_PATH OFF) # add the automatically determined parts of the RPATH # which point to directories outside the build tree to the install RPATH set (CMAKE_BUILD_WITH_INSTALL_RPATH ON) diff --git a/config/cmake/HDFTests.c b/config/cmake/HDFTests.c index 38973908ee1..095f1134cc2 100644 --- a/config/cmake/HDFTests.c +++ b/config/cmake/HDFTests.c @@ -175,29 +175,6 @@ int main(int argc, char **argv) } #endif -#ifdef GETTIMEOFDAY_GIVES_TZ -#include -#ifdef HAVE_SYS_TIME_H -#include -#endif -int main(void) -{ - struct timeval tv; - struct timezone tz; - - tz.tz_minuteswest = 7777; /* Initialize to an unreasonable number */ - tz.tz_dsttime = 7; - - gettimeofday(&tv, &tz); - - /* Check whether the function returned any value at all */ - if (tz.tz_minuteswest == 7777 && tz.tz_dsttime == 7) - return 1; - else - return 0; -} -#endif - #ifdef HAVE_IOEO #include diff --git a/config/cmake/HDFUseFortran.cmake b/config/cmake/HDFUseFortran.cmake index 61adffd198f..2d53a506124 100644 --- a/config/cmake/HDFUseFortran.cmake +++ b/config/cmake/HDFUseFortran.cmake @@ -19,18 +19,16 @@ set (HDF_PREFIX "H5") include (CheckFortranSourceRuns) include (CheckFortranSourceCompiles) -#------------------------------------------------------------------------------- -# Fix Fortran flags if we are compiling statically on Windows using -# Windows_MT.cmake from config/cmake/UserMacros -#------------------------------------------------------------------------------- -if (BUILD_STATIC_CRT_LIBS) - TARGET_STATIC_CRT_FLAGS () -endif () - #----------------------------------------------------------------------------- # Detect name mangling convention used between Fortran and C #----------------------------------------------------------------------------- include (FortranCInterface) + +#----------------------------------------------------------------------------- +# Verify that the Fortran and C/C++ compilers work together +#----------------------------------------------------------------------------- +FortranCInterface_VERIFY() + FortranCInterface_HEADER ( ${CMAKE_BINARY_DIR}/FCMangle.h MACRO_NAMESPACE "H5_FC_" @@ -38,11 +36,11 @@ FortranCInterface_HEADER ( ) file (STRINGS ${CMAKE_BINARY_DIR}/FCMangle.h CONTENTS REGEX "H5_FC_GLOBAL\\(.*,.*\\) +(.*)") -string (REGEX MATCH "H5_FC_GLOBAL\\(.*,.*\\) +(.*)" RESULT ${CONTENTS}) +string (REGEX MATCH "H5_FC_GLOBAL\\(.*,.*\\) +(.*)" RESULT ${CONTENTS}) set (H5_FC_FUNC "H5_FC_FUNC(name,NAME) ${CMAKE_MATCH_1}") file (STRINGS ${CMAKE_BINARY_DIR}/FCMangle.h CONTENTS REGEX "H5_FC_GLOBAL_\\(.*,.*\\) +(.*)") -string (REGEX MATCH "H5_FC_GLOBAL_\\(.*,.*\\) +(.*)" RESULT ${CONTENTS}) +string (REGEX MATCH "H5_FC_GLOBAL_\\(.*,.*\\) +(.*)" RESULT ${CONTENTS}) set (H5_FC_FUNC_ "H5_FC_FUNC_(name,NAME) ${CMAKE_MATCH_1}") #test code source @@ -72,6 +70,13 @@ set (STORAGE_SIZE_CODE END PROGRAM " ) +set (CHAR_ALLOC + " + PROGRAM main + CHARACTER(:), ALLOCATABLE :: str + END PROGRAM + " +) set (ISO_FORTRAN_ENV_CODE " PROGRAM main @@ -126,6 +131,7 @@ check_fortran_source_compiles (${STORAGE_SIZE_CODE} ${HDF_PREFIX}_FORTRAN_HAVE_S check_fortran_source_compiles (${ISO_FORTRAN_ENV_CODE} ${HDF_PREFIX}_HAVE_ISO_FORTRAN_ENV SRC_EXT f90) check_fortran_source_compiles (${REALISNOTDOUBLE_CODE} ${HDF_PREFIX}_FORTRAN_DEFAULT_REAL_NOT_DOUBLE SRC_EXT f90) check_fortran_source_compiles (${ISO_C_BINDING_CODE} ${HDF_PREFIX}_FORTRAN_HAVE_ISO_C_BINDING SRC_EXT f90) +check_fortran_source_compiles (${CHAR_ALLOC} ${HDF_PREFIX}_FORTRAN_HAVE_CHAR_ALLOC SRC_EXT f90) #----------------------------------------------------------------------------- # Add debug information (intel Fortran : JB) diff --git a/config/cmake/LIBAEC/CMakeLists.txt b/config/cmake/LIBAEC/CMakeLists.txt index e118438a5de..379902b3ec0 100644 --- a/config/cmake/LIBAEC/CMakeLists.txt +++ b/config/cmake/LIBAEC/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.10) +cmake_minimum_required (VERSION 3.18) PROJECT (LIBAEC C) #----------------------------------------------------------------------------- diff --git a/config/cmake/README.md.cmake.in b/config/cmake/README.md.cmake.in index d7e4bc443a9..5ba93f356ba 100644 --- a/config/cmake/README.md.cmake.in +++ b/config/cmake/README.md.cmake.in @@ -2,13 +2,13 @@ ------------------------------------------------------------------------------ This directory contains the binary (release) distribution of -@HDF5_PACKAGE_NAME@ @HDF5_PACKAGE_VERSION_MAJOR@ that was compiled on; +@HDF5_PACKAGE_NAME@ @HDF5_PACKAGE_VERSION_MAJOR@.@HDF5_PACKAGE_VERSION_MINOR@ that was compiled on; @BINARY_PLATFORM@. It was built with the following options: -- @LIB_TYPE@ C/C++/Fortran libraries -- SZIP (encoder enabled) and ZLIB - -- @LIB_TYPE@ HDF5 tools + -- HDF5 tools -- Java @Java_VERSION@ The contents of this directory are: @@ -16,17 +16,12 @@ The contents of this directory are: COPYING - Copyright notice README.md - This file @HDF5_PACKAGE_NAME@-@HDF5_PACKAGE_VERSION@-@BINARY_SYSTEM_NAME@.@BINARY_INSTALL_ENDING@ - HDF5 Install Package + OR + @HDF5_PACKAGE_NAME@-@HDF5_PACKAGE_VERSION@-@BINARY_SYSTEM_NAME@.@BINARY_COMPRESS_ENDING@ - HDF5 Compressed Package This binary was built with the ZLIB and SZIP/Libaec external libraries and are included for convenience. Libaec is an unrestricted open-source replacement for SZIP -(version 1.0.4, Encoder ENABLED). - -The official ZLIB and SZIP/Libaec pages are at: - - ZLIB: https://git.savannah.gnu.org/cgit/gzip.git/ - https://git.savannah.gnu.org/cgit/gzip.git/tree/COPYING - SZIP/Libaec: https://github.com/MathisRosenhauer/libaec - https://github.com/MathisRosenhauer/libaec/blob/master/LICENSE.txt +(Encoder ENABLED). Installation @@ -35,6 +30,11 @@ Installation 2. Follow prompts =========================================================================== +Uncompress +=========================================================================== +1. Extract @HDF5_PACKAGE_NAME@-@HDF5_PACKAGE_VERSION@-@BINARY_SYSTEM_NAME@.@BINARY_COMPRESS_ENDING@ +=========================================================================== + After Installation =========================================================================== The examples folder, HDF5Examples, located in the @@ -75,6 +75,6 @@ For more information see USING_CMake_Examples.txt in the install folder. =========================================================================== Documentation for this release can be found at the following URL: - https://portal.hdfgroup.org/display/HDF5/HDF5 + https://portal.hdfgroup.org/documentation/index.html#hdf5 Bugs should be reported to help@hdfgroup.org. diff --git a/config/cmake/UserMacros/Windows_MT.cmake b/config/cmake/UserMacros/Windows_MT.cmake index c8edbe4a0d1..351c99108e7 100644 --- a/config/cmake/UserMacros/Windows_MT.cmake +++ b/config/cmake/UserMacros/Windows_MT.cmake @@ -20,34 +20,10 @@ # INCLUDE(path_to_file/WINDOWS_MT.cmake) #----------------------------------------------------------------------------- -# Option to Build with Static CRT libraries on Windows -#------------------------------------------------------------------------------- -macro (TARGET_STATIC_CRT_FLAGS) - if (MSVC AND NOT BUILD_SHARED_LIBS) - foreach (flag_var - CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE - CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO - CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE - CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) - if (${flag_var} MATCHES "/MD") - string (REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") - endif () - endforeach () - foreach (flag_var - CMAKE_Fortran_FLAGS CMAKE_Fortran_FLAGS_DEBUG CMAKE_Fortran_FLAGS_RELEASE - CMAKE_Fortran_FLAGS_MINSIZEREL CMAKE_Fortran_FLAGS_RELWITHDEBINFO) - if (${flag_var} MATCHES "/libs:dll") - string (REGEX REPLACE "/libs:dll" "/libs:static" ${flag_var} "${${flag_var}}") - endif () - endforeach () - set (WIN_COMPILE_FLAGS "") - set (WIN_LINK_FLAGS "/NODEFAULTLIB:MSVCRT") - endif () -endmacro () - +# Option to Build with Static CRT libraries on Windows (USE WITH CAUTION!!!) #----------------------------------------------------------------------------- -option (BUILD_STATIC_CRT_LIBS "Build With Static CRT Libraries" OFF) -mark_as_advanced (BUILD_STATIC_CRT_LIBS) -if (BUILD_STATIC_CRT_LIBS) - TARGET_STATIC_CRT_FLAGS () +option (HDF5_BUILD_STATIC_CRT_LIBS "Build With Static Windows CRT Libraries" OFF) +mark_as_advanced (HDF5_BUILD_STATIC_CRT_LIBS) +if (HDF5_BUILD_STATIC_CRT_LIBS) + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") endif () diff --git a/config/cmake/grepTest.cmake b/config/cmake/grepTest.cmake index 2ec83872a55..4031a1bde03 100644 --- a/config/cmake/grepTest.cmake +++ b/config/cmake/grepTest.cmake @@ -70,11 +70,18 @@ message (STATUS "COMMAND Result: ${TEST_RESULT}") message (STATUS "COMMAND Error: ${TEST_ERROR}") # remove special output -file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) -string (FIND TEST_STREAM "_pmi_alps" TEST_FIND_RESULT) -if (TEST_FIND_RESULT GREATER -1) - string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + string (FIND "${TEST_STREAM}" "_pmi_alps" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") + endif () + string (FIND "${TEST_STREAM}" "ulimit -s" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*ulimit -s[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") + endif () endif () # if the TEST_ERRREF exists grep the error output with the error reference diff --git a/config/cmake/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.in index b04b201fa47..987411533af 100644 --- a/config/cmake/hdf5-config.cmake.in +++ b/config/cmake/hdf5-config.cmake.in @@ -52,6 +52,7 @@ set (${HDF5_PACKAGE_NAME}_BUILD_DIMENSION_SCALES_WITH_NEW_REF @DIMENSION_SCALES_ #----------------------------------------------------------------------------- set (${HDF5_PACKAGE_NAME}_BUILD_TOOLS @HDF5_BUILD_TOOLS@) set (${HDF5_PACKAGE_NAME}_BUILD_HL_GIF_TOOLS @HDF5_BUILD_HL_GIF_TOOLS@) +set (${HDF5_PACKAGE_NAME}_BUILD_STATIC_TOOLS @HDF5_BUILD_STATIC_TOOLS@) #----------------------------------------------------------------------------- set (${HDF5_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT @HDF5_ENABLE_Z_LIB_SUPPORT@) set (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT @HDF5_ENABLE_SZIP_SUPPORT@) diff --git a/config/cmake/mccacheinit.cmake b/config/cmake/mccacheinit.cmake index 5b41167a845..9e4d5811bc6 100644 --- a/config/cmake/mccacheinit.cmake +++ b/config/cmake/mccacheinit.cmake @@ -33,13 +33,13 @@ set (HDF5_BUILD_EXAMPLES ON CACHE BOOL "Build HDF5 Library Examples" FORCE) set (HDF5_ENABLE_Z_LIB_SUPPORT ON CACHE BOOL "Enable Zlib Filters" FORCE) -set (HDF5_ENABLE_SZIP_SUPPORT ON CACHE BOOL "Use SZip Filter" FORCE) +set (HDF5_ENABLE_SZIP_SUPPORT OFF CACHE BOOL "Use SZip Filter" FORCE) -set (HDF5_ENABLE_SZIP_ENCODING ON CACHE BOOL "Use SZip Encoding" FORCE) +set (HDF5_ENABLE_SZIP_ENCODING OFF CACHE BOOL "Use SZip Encoding" FORCE) set (MPIEXEC_MAX_NUMPROCS "4" CACHE STRING "Minimum number of processes for HDF parallel tests" FORCE) -set (HDF5_ENABLE_USING_MEMCHECKER ON CACHE BOOL "Indicate that a memory checker is used" FORCE) +set (HDF5_USING_ANALYSIS_TOOL ON CACHE BOOL "Indicate that an analysis checker is used" FORCE) set (HDF5_NO_PACKAGES ON CACHE BOOL "CPACK - Disable packaging" FORCE) diff --git a/config/cmake/runTest.cmake b/config/cmake/runTest.cmake index d21765a8e36..4257c442c6a 100644 --- a/config/cmake/runTest.cmake +++ b/config/cmake/runTest.cmake @@ -133,11 +133,18 @@ endif () message (STATUS "COMMAND Error: ${TEST_ERROR}") # remove special output -file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) -string (FIND TEST_STREAM "_pmi_alps" TEST_FIND_RESULT) -if (TEST_FIND_RESULT GREATER -1) - string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + string (FIND "${TEST_STREAM}" "_pmi_alps" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) + endif () + string (FIND "${TEST_STREAM}" "ulimit -s" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*ulimit -s[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) + endif () endif () # remove special error output @@ -148,7 +155,7 @@ else () # the error stack remains in the .err file file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) endif () -string (FIND TEST_STREAM "no version information available" TEST_FIND_RESULT) +string (FIND "${TEST_STREAM}" "no version information available" TEST_FIND_RESULT) if (TEST_FIND_RESULT GREATER -1) string (REGEX REPLACE "^.*no version information available[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") # write back the changes to the original files diff --git a/config/cygwin b/config/cygwin index 9cc64014474..b028e702670 100644 --- a/config/cygwin +++ b/config/cygwin @@ -17,5 +17,5 @@ # # See BlankForm in this directory for details. -# Use the linux-gnulibc1 file. -. $srcdir/config/linux-gnulibc1 +# Use the linux-gnu file +. $srcdir/config/linux-gnu diff --git a/config/ibm-aix b/config/ibm-aix index b2f5d05b79c..bd486af8e27 100644 --- a/config/ibm-aix +++ b/config/ibm-aix @@ -130,49 +130,3 @@ case $CC_BASENAME in cc_flags_set=yes ;; esac - -#---------------------------------------------------------------------------- -# Values for overriding configuration tests when cross compiling. -# This includes compiling on some machines where the serial front end -# compiles for a parallel back end. - -# Set this to `yes' or `no' depending on whether the target is big -# endian or little endian. -hdf5_cv_printf_ll=${hdf5_cv_printf_ll='ll'} -ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'} -ac_cv_header_stdc=${ac_cv_header_stdc='yes'} -ac_cv_header_sys_ioctl_h=${ac_cv_header_sys_ioctl_h=yes} - -# cache the sizeof of "standard C types" so that configure can run faster. -ac_cv_sizeof_char=${ac_cv_sizeof_char=1} -ac_cv_sizeof_short=${ac_cv_sizeof_short=2} -ac_cv_sizeof_int=${ac_cv_sizeof_int=4} -ac_cv_sizeof_long_long=${ac_cv_sizeof_long_long=8} -ac_cv_sizeof_float=${ac_cv_sizeof_float=4} -ac_cv_sizeof_double=${ac_cv_sizeof_double=8} -ac_cv_sizeof_long_double=${ac_cv_sizeof_long_double=8} -ac_cv_sizeof_int8_t=${ac_cv_sizeof_int8_t=1} -ac_cv_sizeof_uint8_t=${ac_cv_sizeof_uint8_t=1} -ac_cv_sizeof_int_least8_t=${ac_cv_sizeof_int_least8_t=1} -ac_cv_sizeof_uint_least8_t=${ac_cv_sizeof_uint_least8_t=1} -# Do not cache int_fast8_t since the vendor changes often. -ac_cv_sizeof_int16_t=${ac_cv_sizeof_int16_t=2} -ac_cv_sizeof_uint16_t=${ac_cv_sizeof_uint16_t=2} -ac_cv_sizeof_int_least16_t=${ac_cv_sizeof_int_least16_t=2} -ac_cv_sizeof_uint_least16_t=${ac_cv_sizeof_uint_least16_t=2} -# Do not cache int_fast16_t since the vendor changes often. -ac_cv_sizeof_int32_t=${ac_cv_sizeof_int32_t=4} -ac_cv_sizeof_uint32_t=${ac_cv_sizeof_uint32_t=4} -ac_cv_sizeof_int_least32_t=${ac_cv_sizeof_int_least32_t=4} -ac_cv_sizeof_uint_least32_t=${ac_cv_sizeof_uint_least32_t=4} -ac_cv_sizeof_int_fast32_t=${ac_cv_sizeof_int_fast32_t=4} -ac_cv_sizeof_uint_fast32_t=${ac_cv_sizeof_uint_fast32_t=4} -ac_cv_sizeof_int64_t=${ac_cv_sizeof_int64_t=8} -ac_cv_sizeof_uint64_t=${ac_cv_sizeof_uint64_t=8} -ac_cv_sizeof_int_least64_t=${ac_cv_sizeof_int_least64_t=8} -ac_cv_sizeof_uint_least64_t=${ac_cv_sizeof_uint_least64_t=8} -ac_cv_sizeof_int_fast64_t=${ac_cv_sizeof_int_fast64_t=8} -ac_cv_sizeof_uint_fast64_t=${ac_cv_sizeof_uint_fast64_t=8} - -# Don't cache long since it varies between 32 and 64 bits -#ac_cv_sizeof_long=${ac_cv_sizeof_long=4} diff --git a/config/intel-cxxflags b/config/intel-cxxflags index 40a3f0e9d34..8db550dc4a6 100644 --- a/config/intel-cxxflags +++ b/config/intel-cxxflags @@ -166,12 +166,6 @@ if test "X-icpc" = "X-$cxx_vendor"; then H5_CXXFLAGS="$H5_CXXFLAGS $(load_intel_arguments classic/18)" fi - # intel <= 19 - if test $cxx_vers_major -le 19; then - # Use the C warnings as CXX warnings are the same - H5_CXXFLAGS="$H5_CXXFLAGS $(load_intel_arguments classic/general-19)" - fi - ################# # Flags are set # ################# diff --git a/config/intel-flags b/config/intel-flags index 134452cc11d..725ba625128 100644 --- a/config/intel-flags +++ b/config/intel-flags @@ -161,12 +161,6 @@ if test "X-icc" = "X-$cc_vendor"; then H5_CFLAGS="$H5_CFLAGS $(load_intel_arguments classic/18)" fi - # intel <= 19 - # this file has warnings only available before oneapi versions - if test $cc_vers_major -le 19; then - H5_CFLAGS="$H5_CFLAGS $(load_intel_arguments classic/general-19)" - fi - ################# # Flags are set # ################# diff --git a/config/linux-gnu b/config/linux-gnu index 0431f94c174..b4139ee1a58 100644 --- a/config/linux-gnu +++ b/config/linux-gnu @@ -11,6 +11,391 @@ # help@hdfgroup.org. -# This is the same as linux-gnulibc1 +# This file is part of the HDF5 build script. It is processed shortly +# after configure starts and defines, among other things, flags for +# the various compile modes. +# +# See BlankForm in this directory for details. + +# The default compiler is `gcc'. +if test -z "$CC"; then + if test "X-$enable_parallel" = "X-yes"; then + # default to use mpicc which is the defacto MPI compiler name + CC=mpicc + CC_BASENAME=mpicc + else + CC=gcc + CC_BASENAME=gcc + fi +fi + +# Figure out GNU C compiler flags +. $srcdir/config/gnu-flags + +# Figure out PGI C compiler flags +. $srcdir/config/pgi-flags + +# Figure out CCE C compiler flags +. $srcdir/config/cce-flags + +# Figure out Intel oneAPI C compiler flags +. $srcdir/config/oneapi-flags + +# Figure out Intel classic C compiler flags +. $srcdir/config/intel-flags + +# Figure out Clang C compiler flags +. $srcdir/config/clang-flags + +# Figure out NVHPC C compiler flags +. $srcdir/config/nvidia-flags + +# Use default Fortran 90 compiler according to what C compiler is used. +if test "X-" = "X-$FC"; then + case $CC_BASENAME in + gcc*) + FC=gfortran + FC_BASENAME=gfortran + ;; + pgcc*) + FC=pgf90 + FC_BASENAME=pgf90 + ;; + nvc*) + FC=nvfortran + FC_BASENAME=nvfortran + ;; + icx*) + FC=ifx + FC_BASENAME=ifx + ;; + icc*) + FC=ifort + FC_BASENAME=ifort + ;; + mpicc*) + FC=mpif90 + FC_BASENAME=mpif90 + ;; + clang*) + # clang has no fortran compiler. Use gfortran. + FC=gfortran + FC_BASENAME=gfortran + ;; + esac +else + case $FC in + # The PGI and Intel compilers are automatically detected below + ifc*|ifort*|pgf90*|nvfortran*) + ;; + + *f95*) + # Figure out which compiler we are using: pgf90 or Absoft f95 + RM='rm -f' + tmpfile=/tmp/cmpver.$$ + $FC -V >$tmpfile + if test -s "$tmpfile"; then + if( grep -s 'Absoft' $tmpfile > /dev/null) then + FC_BASENAME=f95 + fi + if( grep -s 'pgf90' $tmpfile > /dev/null) then + FC_BASENAME=pgf90 + fi + fi + $RM $tmpfile + fc_version_info=`$FC -V | grep Absoft` + ;; + # The NAG compiler + *nagfor*|*nagftn*) + RM='rm -f' + tmpfile=/tmp/cmpver.$$ + $FC -V >& $tmpfile + if test -s "$tmpfile"; then + if( grep -s 'NAG Fortran' $tmpfile > /dev/null) then + FC_BASENAME=nagfor + fi + fi + fc_version_info=`grep "NAG Fortran" $tmpfile` + echo "compiler '$FC' is $fc_version_info" + $RM $tmpfile + ;; + *) + ;; + esac +fi + +# Figure out GNU FC compiler flags +. $srcdir/config/gnu-fflags + +# Figure out PGI FC compiler flags +. $srcdir/config/pgi-fflags + +# Figure out CCE FC compiler flags +. $srcdir/config/cce-fflags + +# Figure out Intel oneAPI FC compiler flags +. $srcdir/config/oneapi-fflags + +# Figure out Intel classic FC compiler flags +. $srcdir/config/intel-fflags + +# Figure out Clang FC compiler flags +. $srcdir/config/clang-fflags + +# Figure out NVHPC FC compiler flags +. $srcdir/config/nvidia-fflags + +case $FC_BASENAME in + # + # Absoft compiler + # + f95) + # Set required flag for compiling C stubs + H5_CFLAGS="$H5_CFLAGS" + + F9XSUFFIXFLAG="" + H5_FCFLAGS="$H5_FCFLAGS" + FSEARCH_DIRS="" + + # Production + PROD_FCFLAGS= + + # Debug + DEBUG_FCFLAGS= + + # Symbols + SYMBOLS_FCFLAGS="-g" + NO_SYMBOLS_FCFLAGS="-s" + + # Profiling + PROFILE_FCFLAGS="-pg" + + # Optimization + HIGH_OPT_FCFLAGS="-O" + DEBUG_OPT_FCFLAGS= + NO_OPT_FCFLAGS= + + f9x_flags_set=yes + ;; +# +# NAG compiler +# + nagfor) + + F9XSUFFIXFLAG="" + AM_FCFLAGS="$AM_FCFLAGS" + FSEARCH_DIRS="" + + # Production + PROD_FCFLAGS= + + # Debug + DEBUG_FCFLAGS="-C" + + # Symbols + SYMBOLS_FCFLAGS="-g" + NO_SYMBOLS_FCFLAGS="-s" + + # Profiling + PROFILE_FCFLAGS="-pg" + + # Optimization + HIGH_OPT_FCFLAGS="-O" + DEBUG_OPT_FCFLAGS="-O0" + NO_OPT_FCFLAGS="-O0" + + f9x_flags_set=yes + ;; + +esac + +# The default C++ compiler + +# The default compiler is `g++'. +if test -z "$CXX"; then + CXX=g++ + CXX_BASENAME=g++ +fi + +# Figure out Intel oneAPI CXX compiler flags +. $srcdir/config/oneapi-cxxflags + +# Figure out Intel classic CXX compiler flags +# Do this ahead of GNU to avoid icpc being detected as g++ +. $srcdir/config/intel-cxxflags + +# Figure out GNU CXX compiler flags +. $srcdir/config/gnu-cxxflags + +# Figure out PGI CXX compiler flags +. $srcdir/config/pgi-cxxflags + +# Figure out Clang CXX compiler flags +. $srcdir/config/clang-cxxflags + +# Figure out NVHPC CXX compiler flags +. $srcdir/config/nvidia-cxxflags + +# compiler version strings + +# check if the compiler_version_info is already set +if test -z "$cc_version_info"; then + +case $CC in + # whatever matches *pgcc* will also match *gcc*, so this one must come first + *pgcc*) + cc_version_info=`$CC $CFLAGS $H5_CFLAGS -V 2>&1 | grep 'pgcc'` + ;; + + *gcc*) + cc_version_info=`$CC $CFLAGS $H5_CFLAGS --version 2>&1 | grep -v 'PathScale' |\ + grep 'GCC' | sed 's/\(.*(GCC) [-a-z0-9\. ]*\).*/\1/'` + ;; + # this must come before *icc* for the same reason + *mpicc*) + cc_version_info=`$CC $CCFLAGS $H5_CCFLAGS -v 2>&1 | grep 'version' |\ + sed 's/^[a-z0-9]* for //' |\ + sed 's/\"/\\\"/g' |\ + sed 's/^\([a-z]* \)/ built with \1/1'` + cc_version_info=`echo $cc_version_info` + ;; + + *nvc*) + cc_version_info=`$CC $CFLAGS $H5_CFLAGS -V 2>&1 | grep 'nvc'` + ;; + + *icx*) + cc_version_info=`$CC $CCFLAGS $H5_CCFLAGS -V 2>&1 | grep 'Version' |\ + sed 's/\(Intel.* Compiler\).*\( Version [a-z0-9\.]*\).*\( Build [0-9]*\)/\1\2\3/'` + ;; + + *icc*) + cc_version_info=`$CC $CCFLAGS $H5_CCFLAGS -V 2>&1 | grep 'Version' |\ + sed 's/\(Intel.* Compiler\).*\( Version [a-z0-9\.]*\).*\( Build [0-9]*\)/\1\2\3/'` + ;; + + *clang*) + cc_version_info="`$CC $CFLAGS $H5_CFLAGS --version 2>&1 |\ + grep 'clang version' | sed 's/.*clang version \([-a-z0-9\.]*\).*/\1/'`" + ;; + + *) + echo "No match to get cc_version_info for $CC" + ;; +esac + +fi + +# get fortran version info +# check if the compiler_version_info is already set +if test -z "$fc_version_info"; then +case $FC in + *gfortran*) + fc_version_info=`$FC $FCFLAGS $H5_FCFLAGS --version 2>&1 |\ + grep 'GCC' | sed 's/\(.*(GCC) [-a-z0-9\. ]*\).*/\1/'` + ;; + + *mpif90*) + fc_version_info=`$FC $FCFLAGS $H5_FCFLAGS -v 2>&1 | grep 'version' |\ + sed 's/^[a-z0-9]* for //' |\ + sed 's/\"/\\\"/g' |\ + sed 's/^\([a-z]* \)/ built with \1/1'` + fc_version_info=`echo $fc_version_info` + ;; + + *ifx*) + fc_version_info=`$FC $FCFLAGS $H5_FCFLAGS -V 2>&1 | grep 'Version' |\ + sed 's/\(Intel.* Compiler\).*\( Version [a-z0-9\.]*\).*\( Build [0-9]*\)/\1\2\3/'` + ;; + + *ifc*|*ifort*) + fc_version_info=`$FC $FCFLAGS $H5_FCFLAGS -V 2>&1 | grep 'Version' |\ + sed 's/\(Intel.* Compiler\).*\( Version [a-z0-9\.]*\).*\( Build [0-9]*\)/\1\2\3/'` + ;; + + *f95*) + # Figure out which compiler we are using: pgf90 or Absoft f95 + RM='rm -f' + tmpfile=/tmp/cmpver.$$ + $FC -V >$tmpfile + if test -s "$tmpfile"; then + if( grep -s 'Absoft' $tmpfile > /dev/null) then + FC_BASENAME=f95 + fi + fi + $RM $tmpfile + fc_version_info=`$FC -V | grep Absoft` + ;; + + *g95*) + fc_version_info=`$FC $FCFLAGS $H5_FCFLAGS --version 2>&1 |\ + grep 'GCC'` + ;; + + *pgf90*) + fc_version_info=`$FC $FCFLAGS $H5_FCFLAGS -V 2>&1 | grep 'pgf90'` + ;; + + *nvfortran*) + fc_version_info=`$FC $FCFLAGS $H5_FCFLAGS -V 2>&1 | grep 'nvfortran'` + ;; + + *nagfor*|*nagftn*) + RM='rm -f' + tmpfile=/tmp/cmpver.$$ + $FC -V >& $tmpfile + if test -s "$tmpfile"; then + if( grep -s 'NAG Fortran' $tmpfile > /dev/null) then + FC_BASENAME=nagfor + fi + fi + fc_version_info=`grep "NAG Fortran" $tmpfile` + $RM $tmpfile + echo "compiler '$FC' is $fc_version_info" + ;; + + *) + echo "No match to get fc_version_info for $FC" + ;; +esac +fi + +# get c++ version info +# check if the compiler_version_info is already set +if test -z "$cxx_version_info"; then +case $CXX in + *nvc++*) + cxx_version_info=`$CXX $CXXFLAGS $H5_CXXFLAGS -V 2>&1 | grep 'nvc++'` + ;; + *pgc++*) + cxx_version_info=`$CXX $CXXFLAGS $H5_CXXFLAGS -V 2>&1 | grep 'pgc++'` + ;; + *g++*) + cxx_version_info=`$CXX $CXXFLAGS $H5_CXXFLAGS --version 2>&1 |\ + grep 'GCC' | sed 's/\(.*(GCC) [-a-z0-9\. ]*\).*/\1/'` + ;; + *icpx*) + cxx_version_info=`$CXX $CXXFLAGS $H5_CXXFLAGS -V 2>&1 | grep 'Version' |\ + sed 's/\(Intel.* Compiler\).*\( Version [a-z0-9\.]*\).*\( Build [0-9]*\)/\1\2\3/'` + ;; + *icpc*) + cxx_version_info=`$CXX $CXXFLAGS $H5_CXXFLAGS -V 2>&1 | grep 'Version' |\ + sed 's/\(Intel.* Compiler\).*\( Version [a-z0-9\.]*\).*\( Build [0-9]*\)/\1\2\3/'` + ;; + *mpicxx*) + cxx_version_info=`$CXX $CXXFLAGS $H5_CXXFLAGS -v 2>&1 | grep 'version' |\ + sed 's/^[a-z0-9]* for //' |\ + sed 's/^\([a-z]* \)/ built with \1/1'` + cxx_version_info=`echo $cxx_version_info` + ;; + + *clang++*) + cxx_version_info="`$CXX $CXXFLAGS $H5_CXXFLAGS --version 2>&1 |\ + grep 'clang version' | sed 's/.*clang version \([-a-z0-9\.]*\).*/\1/'`" + ;; -. $srcdir/config/linux-gnulibc1 + *) + echo "No match to get cxx_version_info for $CXX" + ;; +esac +fi diff --git a/config/linux-gnuaout b/config/linux-gnuaout deleted file mode 100644 index 0431f94c174..00000000000 --- a/config/linux-gnuaout +++ /dev/null @@ -1,16 +0,0 @@ -# -*- shell-script -*- -# -# Copyright by The HDF Group. -# All rights reserved. -# -# This file is part of HDF5. The full HDF5 copyright notice, including -# terms governing use, modification, and redistribution, is contained in -# the COPYING file, which can be found at the root of the source code -# distribution tree, or in https://www.hdfgroup.org/licenses. -# If you do not have access to either file, you may request a copy from -# help@hdfgroup.org. - - -# This is the same as linux-gnulibc1 - -. $srcdir/config/linux-gnulibc1 diff --git a/config/linux-gnueabihf b/config/linux-gnueabihf deleted file mode 100644 index 596bf3a7030..00000000000 --- a/config/linux-gnueabihf +++ /dev/null @@ -1,16 +0,0 @@ -# -*- shell-script -*- -# -# Copyright by The HDF Group. -# All rights reserved. -# -# This file is part of HDF5. The full HDF5 copyright notice, including -# terms governing use, modification, and redistribution, is contained in -# the COPYING file, which can be found at the root of the source code -# distribution tree, or in https://www.hdfgroup.org/licenses. -# If you do not have access to either file, you may request a copy from -# help@hdfgroup.org. - -# ARM for Raspberry Pi, etc. -# This is the same as linux-gnulibc1 - -. $srcdir/config/linux-gnulibc1 diff --git a/config/linux-gnulibc1 b/config/linux-gnulibc1 deleted file mode 100644 index b4139ee1a58..00000000000 --- a/config/linux-gnulibc1 +++ /dev/null @@ -1,401 +0,0 @@ -# -*- shell-script -*- -# -# Copyright by The HDF Group. -# All rights reserved. -# -# This file is part of HDF5. The full HDF5 copyright notice, including -# terms governing use, modification, and redistribution, is contained in -# the COPYING file, which can be found at the root of the source code -# distribution tree, or in https://www.hdfgroup.org/licenses. -# If you do not have access to either file, you may request a copy from -# help@hdfgroup.org. - - -# This file is part of the HDF5 build script. It is processed shortly -# after configure starts and defines, among other things, flags for -# the various compile modes. -# -# See BlankForm in this directory for details. - -# The default compiler is `gcc'. -if test -z "$CC"; then - if test "X-$enable_parallel" = "X-yes"; then - # default to use mpicc which is the defacto MPI compiler name - CC=mpicc - CC_BASENAME=mpicc - else - CC=gcc - CC_BASENAME=gcc - fi -fi - -# Figure out GNU C compiler flags -. $srcdir/config/gnu-flags - -# Figure out PGI C compiler flags -. $srcdir/config/pgi-flags - -# Figure out CCE C compiler flags -. $srcdir/config/cce-flags - -# Figure out Intel oneAPI C compiler flags -. $srcdir/config/oneapi-flags - -# Figure out Intel classic C compiler flags -. $srcdir/config/intel-flags - -# Figure out Clang C compiler flags -. $srcdir/config/clang-flags - -# Figure out NVHPC C compiler flags -. $srcdir/config/nvidia-flags - -# Use default Fortran 90 compiler according to what C compiler is used. -if test "X-" = "X-$FC"; then - case $CC_BASENAME in - gcc*) - FC=gfortran - FC_BASENAME=gfortran - ;; - pgcc*) - FC=pgf90 - FC_BASENAME=pgf90 - ;; - nvc*) - FC=nvfortran - FC_BASENAME=nvfortran - ;; - icx*) - FC=ifx - FC_BASENAME=ifx - ;; - icc*) - FC=ifort - FC_BASENAME=ifort - ;; - mpicc*) - FC=mpif90 - FC_BASENAME=mpif90 - ;; - clang*) - # clang has no fortran compiler. Use gfortran. - FC=gfortran - FC_BASENAME=gfortran - ;; - esac -else - case $FC in - # The PGI and Intel compilers are automatically detected below - ifc*|ifort*|pgf90*|nvfortran*) - ;; - - *f95*) - # Figure out which compiler we are using: pgf90 or Absoft f95 - RM='rm -f' - tmpfile=/tmp/cmpver.$$ - $FC -V >$tmpfile - if test -s "$tmpfile"; then - if( grep -s 'Absoft' $tmpfile > /dev/null) then - FC_BASENAME=f95 - fi - if( grep -s 'pgf90' $tmpfile > /dev/null) then - FC_BASENAME=pgf90 - fi - fi - $RM $tmpfile - fc_version_info=`$FC -V | grep Absoft` - ;; - # The NAG compiler - *nagfor*|*nagftn*) - RM='rm -f' - tmpfile=/tmp/cmpver.$$ - $FC -V >& $tmpfile - if test -s "$tmpfile"; then - if( grep -s 'NAG Fortran' $tmpfile > /dev/null) then - FC_BASENAME=nagfor - fi - fi - fc_version_info=`grep "NAG Fortran" $tmpfile` - echo "compiler '$FC' is $fc_version_info" - $RM $tmpfile - ;; - *) - ;; - esac -fi - -# Figure out GNU FC compiler flags -. $srcdir/config/gnu-fflags - -# Figure out PGI FC compiler flags -. $srcdir/config/pgi-fflags - -# Figure out CCE FC compiler flags -. $srcdir/config/cce-fflags - -# Figure out Intel oneAPI FC compiler flags -. $srcdir/config/oneapi-fflags - -# Figure out Intel classic FC compiler flags -. $srcdir/config/intel-fflags - -# Figure out Clang FC compiler flags -. $srcdir/config/clang-fflags - -# Figure out NVHPC FC compiler flags -. $srcdir/config/nvidia-fflags - -case $FC_BASENAME in - # - # Absoft compiler - # - f95) - # Set required flag for compiling C stubs - H5_CFLAGS="$H5_CFLAGS" - - F9XSUFFIXFLAG="" - H5_FCFLAGS="$H5_FCFLAGS" - FSEARCH_DIRS="" - - # Production - PROD_FCFLAGS= - - # Debug - DEBUG_FCFLAGS= - - # Symbols - SYMBOLS_FCFLAGS="-g" - NO_SYMBOLS_FCFLAGS="-s" - - # Profiling - PROFILE_FCFLAGS="-pg" - - # Optimization - HIGH_OPT_FCFLAGS="-O" - DEBUG_OPT_FCFLAGS= - NO_OPT_FCFLAGS= - - f9x_flags_set=yes - ;; -# -# NAG compiler -# - nagfor) - - F9XSUFFIXFLAG="" - AM_FCFLAGS="$AM_FCFLAGS" - FSEARCH_DIRS="" - - # Production - PROD_FCFLAGS= - - # Debug - DEBUG_FCFLAGS="-C" - - # Symbols - SYMBOLS_FCFLAGS="-g" - NO_SYMBOLS_FCFLAGS="-s" - - # Profiling - PROFILE_FCFLAGS="-pg" - - # Optimization - HIGH_OPT_FCFLAGS="-O" - DEBUG_OPT_FCFLAGS="-O0" - NO_OPT_FCFLAGS="-O0" - - f9x_flags_set=yes - ;; - -esac - -# The default C++ compiler - -# The default compiler is `g++'. -if test -z "$CXX"; then - CXX=g++ - CXX_BASENAME=g++ -fi - -# Figure out Intel oneAPI CXX compiler flags -. $srcdir/config/oneapi-cxxflags - -# Figure out Intel classic CXX compiler flags -# Do this ahead of GNU to avoid icpc being detected as g++ -. $srcdir/config/intel-cxxflags - -# Figure out GNU CXX compiler flags -. $srcdir/config/gnu-cxxflags - -# Figure out PGI CXX compiler flags -. $srcdir/config/pgi-cxxflags - -# Figure out Clang CXX compiler flags -. $srcdir/config/clang-cxxflags - -# Figure out NVHPC CXX compiler flags -. $srcdir/config/nvidia-cxxflags - -# compiler version strings - -# check if the compiler_version_info is already set -if test -z "$cc_version_info"; then - -case $CC in - # whatever matches *pgcc* will also match *gcc*, so this one must come first - *pgcc*) - cc_version_info=`$CC $CFLAGS $H5_CFLAGS -V 2>&1 | grep 'pgcc'` - ;; - - *gcc*) - cc_version_info=`$CC $CFLAGS $H5_CFLAGS --version 2>&1 | grep -v 'PathScale' |\ - grep 'GCC' | sed 's/\(.*(GCC) [-a-z0-9\. ]*\).*/\1/'` - ;; - # this must come before *icc* for the same reason - *mpicc*) - cc_version_info=`$CC $CCFLAGS $H5_CCFLAGS -v 2>&1 | grep 'version' |\ - sed 's/^[a-z0-9]* for //' |\ - sed 's/\"/\\\"/g' |\ - sed 's/^\([a-z]* \)/ built with \1/1'` - cc_version_info=`echo $cc_version_info` - ;; - - *nvc*) - cc_version_info=`$CC $CFLAGS $H5_CFLAGS -V 2>&1 | grep 'nvc'` - ;; - - *icx*) - cc_version_info=`$CC $CCFLAGS $H5_CCFLAGS -V 2>&1 | grep 'Version' |\ - sed 's/\(Intel.* Compiler\).*\( Version [a-z0-9\.]*\).*\( Build [0-9]*\)/\1\2\3/'` - ;; - - *icc*) - cc_version_info=`$CC $CCFLAGS $H5_CCFLAGS -V 2>&1 | grep 'Version' |\ - sed 's/\(Intel.* Compiler\).*\( Version [a-z0-9\.]*\).*\( Build [0-9]*\)/\1\2\3/'` - ;; - - *clang*) - cc_version_info="`$CC $CFLAGS $H5_CFLAGS --version 2>&1 |\ - grep 'clang version' | sed 's/.*clang version \([-a-z0-9\.]*\).*/\1/'`" - ;; - - *) - echo "No match to get cc_version_info for $CC" - ;; -esac - -fi - -# get fortran version info -# check if the compiler_version_info is already set -if test -z "$fc_version_info"; then -case $FC in - *gfortran*) - fc_version_info=`$FC $FCFLAGS $H5_FCFLAGS --version 2>&1 |\ - grep 'GCC' | sed 's/\(.*(GCC) [-a-z0-9\. ]*\).*/\1/'` - ;; - - *mpif90*) - fc_version_info=`$FC $FCFLAGS $H5_FCFLAGS -v 2>&1 | grep 'version' |\ - sed 's/^[a-z0-9]* for //' |\ - sed 's/\"/\\\"/g' |\ - sed 's/^\([a-z]* \)/ built with \1/1'` - fc_version_info=`echo $fc_version_info` - ;; - - *ifx*) - fc_version_info=`$FC $FCFLAGS $H5_FCFLAGS -V 2>&1 | grep 'Version' |\ - sed 's/\(Intel.* Compiler\).*\( Version [a-z0-9\.]*\).*\( Build [0-9]*\)/\1\2\3/'` - ;; - - *ifc*|*ifort*) - fc_version_info=`$FC $FCFLAGS $H5_FCFLAGS -V 2>&1 | grep 'Version' |\ - sed 's/\(Intel.* Compiler\).*\( Version [a-z0-9\.]*\).*\( Build [0-9]*\)/\1\2\3/'` - ;; - - *f95*) - # Figure out which compiler we are using: pgf90 or Absoft f95 - RM='rm -f' - tmpfile=/tmp/cmpver.$$ - $FC -V >$tmpfile - if test -s "$tmpfile"; then - if( grep -s 'Absoft' $tmpfile > /dev/null) then - FC_BASENAME=f95 - fi - fi - $RM $tmpfile - fc_version_info=`$FC -V | grep Absoft` - ;; - - *g95*) - fc_version_info=`$FC $FCFLAGS $H5_FCFLAGS --version 2>&1 |\ - grep 'GCC'` - ;; - - *pgf90*) - fc_version_info=`$FC $FCFLAGS $H5_FCFLAGS -V 2>&1 | grep 'pgf90'` - ;; - - *nvfortran*) - fc_version_info=`$FC $FCFLAGS $H5_FCFLAGS -V 2>&1 | grep 'nvfortran'` - ;; - - *nagfor*|*nagftn*) - RM='rm -f' - tmpfile=/tmp/cmpver.$$ - $FC -V >& $tmpfile - if test -s "$tmpfile"; then - if( grep -s 'NAG Fortran' $tmpfile > /dev/null) then - FC_BASENAME=nagfor - fi - fi - fc_version_info=`grep "NAG Fortran" $tmpfile` - $RM $tmpfile - echo "compiler '$FC' is $fc_version_info" - ;; - - *) - echo "No match to get fc_version_info for $FC" - ;; -esac -fi - -# get c++ version info -# check if the compiler_version_info is already set -if test -z "$cxx_version_info"; then -case $CXX in - *nvc++*) - cxx_version_info=`$CXX $CXXFLAGS $H5_CXXFLAGS -V 2>&1 | grep 'nvc++'` - ;; - *pgc++*) - cxx_version_info=`$CXX $CXXFLAGS $H5_CXXFLAGS -V 2>&1 | grep 'pgc++'` - ;; - *g++*) - cxx_version_info=`$CXX $CXXFLAGS $H5_CXXFLAGS --version 2>&1 |\ - grep 'GCC' | sed 's/\(.*(GCC) [-a-z0-9\. ]*\).*/\1/'` - ;; - *icpx*) - cxx_version_info=`$CXX $CXXFLAGS $H5_CXXFLAGS -V 2>&1 | grep 'Version' |\ - sed 's/\(Intel.* Compiler\).*\( Version [a-z0-9\.]*\).*\( Build [0-9]*\)/\1\2\3/'` - ;; - *icpc*) - cxx_version_info=`$CXX $CXXFLAGS $H5_CXXFLAGS -V 2>&1 | grep 'Version' |\ - sed 's/\(Intel.* Compiler\).*\( Version [a-z0-9\.]*\).*\( Build [0-9]*\)/\1\2\3/'` - ;; - *mpicxx*) - cxx_version_info=`$CXX $CXXFLAGS $H5_CXXFLAGS -v 2>&1 | grep 'version' |\ - sed 's/^[a-z0-9]* for //' |\ - sed 's/^\([a-z]* \)/ built with \1/1'` - cxx_version_info=`echo $cxx_version_info` - ;; - - *clang++*) - cxx_version_info="`$CXX $CXXFLAGS $H5_CXXFLAGS --version 2>&1 |\ - grep 'clang version' | sed 's/.*clang version \([-a-z0-9\.]*\).*/\1/'`" - ;; - - *) - echo "No match to get cxx_version_info for $CXX" - ;; -esac -fi diff --git a/config/linux-gnulibc2 b/config/linux-gnulibc2 deleted file mode 100644 index f1433bf02b2..00000000000 --- a/config/linux-gnulibc2 +++ /dev/null @@ -1,21 +0,0 @@ -# -*- shell-script -*- -# -# Copyright by The HDF Group. -# All rights reserved. -# -# This file is part of HDF5. The full HDF5 copyright notice, including -# terms governing use, modification, and redistribution, is contained in -# the COPYING file, which can be found at the root of the source code -# distribution tree, or in https://www.hdfgroup.org/licenses. -# If you do not have access to either file, you may request a copy from -# help@hdfgroup.org. - - -# This file is part of the HDF5 build script. It is processed shortly -# after configure starts and defines, among other things, flags for -# the various compile modes. -# -# See BlankForm in this directory for details. - -# Same as with gnulibc1 for now -. $srcdir/config/linux-gnulibc1 diff --git a/config/sanitizer/README.md b/config/sanitizer/README.md index e3141455401..eee157b53e9 100644 --- a/config/sanitizer/README.md +++ b/config/sanitizer/README.md @@ -1,11 +1,10 @@ # CMake Scripts -[![pipeline status](https://git.stabletec.com/other/cmake-scripts/badges/master/pipeline.svg)](https://git.stabletec.com/other/cmake-scripts/commits/master) -[![license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://git.stabletec.com/other/cmake-scripts/blob/master/LICENSE) +[![pipeline status](https://git.stabletec.com/other/cmake-scripts/badges/main/pipeline.svg)](https://git.stabletec.com/other/cmake-scripts/commits/main) +[![license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://git.stabletec.com/other/cmake-scripts/blob/main/LICENSE) This is a collection of quite useful scripts that expand the possibilities for building software with CMake, by making some things easier and otherwise adding new build types -- [C++ Standards `c++-standards.cmake`](#c-standards-c-standardscmake) - [Sanitizer Builds `sanitizers.cmake`](#sanitizer-builds-sanitizerscmake) - [Code Coverage `code-coverage.cmake`](#code-coverage-code-coveragecmake) - [Added Targets](#added-targets) @@ -15,28 +14,15 @@ This is a collection of quite useful scripts that expand the possibilities for b - [1b - Via target commands](#1b---via-target-commands) - [Example 2: Target instrumented, but with regex pattern of files to be excluded from report](#example-2-target-instrumented-but-with-regex-pattern-of-files-to-be-excluded-from-report) - [Example 3: Target added to the 'ccov' and 'ccov-all' targets](#example-3-target-added-to-the-ccov-and-ccov-all-targets) -- [Compiler Options `compiler-options.cmake`](#compiler-options-compiler-optionscmake) +- [AFL Fuzzing Instrumentation `afl-fuzzing.cmake`](#afl-fuzzing-instrumentation-afl-fuzzingcmake) + - [Usage](#usage-1) - [Dependency Graph `dependency-graph.cmake`](#dependency-graph-dependency-graphcmake) - [Required Arguments](#required-arguments) - - [OUTPUT_TYPE *STR*](#output_type-str) + - [OUTPUT\_TYPE *STR*](#output_type-str) - [Optional Arguments](#optional-arguments) - - [ADD_TO_DEP_GRAPH](#add_to_dep_graph) - - [TARGET_NAME *STR*](#target_name-str) - - [OUTPUT_DIR *STR*](#output_dir-str) -- [Doxygen `doxygen.cmake`](#doxygen-doxygencmake) - - [Optional Arguments](#optional-arguments-1) - - [ADD_TO_DOC](#add_to_doc) - - [INSTALLABLE](#installable) - - [PROCESS_DOXYFILE](#process_doxyfile) - - [TARGET_NAME *STR*](#target_name-str-1) - - [OUTPUT_DIR *STR*](#output_dir-str-1) - - [INSTALL_PATH *STR*](#install_path-str) - - [DOXYFILE_PATH *STR*](#doxyfile_path-str) -- [Prepare the Catch Test Framework `prepare_catch.cmake`](#prepare-the-catch-test-framework-prepare_catchcmake) - - [Optional Arguments](#optional-arguments-2) - - [COMPILED_CATCH](#compiled_catch) - - [CATCH1](#catch1) - - [CLONE](#clone) + - [ADD\_TO\_DEP\_GRAPH](#add_to_dep_graph) + - [TARGET\_NAME *STR*](#target_name-str) + - [OUTPUT\_DIR *STR*](#output_dir-str) - [Tools `tools.cmake`](#tools-toolscmake) - [clang-tidy](#clang-tidy) - [include-what-you-use](#include-what-you-use) @@ -45,15 +31,9 @@ This is a collection of quite useful scripts that expand the possibilities for b - [clang-format](#clang-format) - [cmake-format](#cmake-format) -## C++ Standards [`c++-standards.cmake`](c++-standards.cmake) - -Using the functions `cxx_11()`, `cxx_14()`, `cxx_17()` or `cxx_20()` this adds the appropriate flags for both unix and MSVC compilers, even for those before 3.11 with improper support. - -These obviously force the standard to be required, and also disables compiler-specific extensions, ie `--std=gnu++11`. This helps to prevent fragmenting the code base with items not available elsewhere, adhering to the agreed C++ standards only. - ## Sanitizer Builds [`sanitizers.cmake`](sanitizers.cmake) -Sanitizers are tools that perform checks during a program's runtime and return issues, and as such, along with unit testing, code coverage and static analysis, are another tool to add to the programmer's toolbox. And, of course, like the previous tools, they are simple to add to any project using CMake, allowing any project and developer to quickly and easily use them. +Sanitizers are tools that perform checks during a program’s runtime and returns issues, and as such, along with unit testing, code coverage and static analysis, is another tool to add to the programmers toolbox. And of course, like the previous tools, are tragically simple to add into any project using CMake, allowing any project and developer to quickly and easily use. A quick rundown of the tools available, and what they do: - [LeakSanitizer](https://clang.llvm.org/docs/LeakSanitizer.html) detects memory leaks, or issues where memory is allocated and never deallocated, causing programs to slowly consume more and more memory, eventually leading to a crash. @@ -72,20 +52,20 @@ A quick rundown of the tools available, and what they do: - Division by zero - Unreachable code - [MemorySanitizer](https://clang.llvm.org/docs/MemorySanitizer.html) detects uninitialized reads. +- [Control Flow Integrity](https://clang.llvm.org/docs/ControlFlowIntegrity.html) is designed to detect certain forms of undefined behaviour that can potentially allow attackers to subvert the program's control flow. -These are used by declaring the `USE_SANITIZER` CMake variable as one of: +These are used by declaring the `USE_SANITIZER` CMake variable as string containing any of: - Address - Memory - MemoryWithOrigins - Undefined - Thread -- Address;Undefined -- Undefined;Address - Leak +- CFI -## Code Coverage [`code-coverage.cmake`](code-coverage.cmake) +Multiple values are allowed, e.g. `-DUSE_SANITIZER=Address,Leak` but some sanitizers cannot be combined together, e.g.`-DUSE_SANITIZER=Address,Memory` will result in configuration error. The delimiter character is not required and `-DUSE_SANITIZER=AddressLeak` would work as well. -![Code Coverage Examples](img/code-cov.png) +## Code Coverage [`code-coverage.cmake`](code-coverage.cmake) > In computer science, test coverage is a measure used to describe the degree to which the source code of a program is executed when a particular test suite runs. A program with high test coverage, measured as a percentage, has had more of its source code executed during testing, which suggests it has a lower chance of containing undetected software bugs compared to a program with low test coverage. Many different metrics can be used to calculate test coverage; some of the most basic are the percentage of program subroutines and the percentage of program statements called during execution of the test suite. > @@ -101,7 +81,7 @@ To enable, turn on the `CODE_COVERAGE` variable. - GCOV/LCOV: - ccov : Generates HTML code coverage report for every target added with 'AUTO' parameter. - - ccov-${TARNGET_NAME} : Generates HTML code coverage report for the associated named target. + - ccov-${TARGET_NAME} : Generates HTML code coverage report for the associated named target. - ccov-all : Generates HTML code coverage report, merging every target added with 'ALL' parameter into a single detailed report. - ccov-all-capture : Generates an all-merged.info file, for use with coverage dashboards (e.g. codecov.io, coveralls). - LLVM-COV: @@ -156,7 +136,7 @@ target_code_coverage(theExe) # As an executable target, adds the 'ccov-theExe' t ``` add_executable(theExe main.cpp non_covered.cpp) -target_code_coverage(theExe EXCLUDE non_covered.cpp) # As an executable target, the reports will exclude the non-covered.cpp file. +target_code_coverage(theExe EXCLUDE non_covered.cpp) # As an executable target, the reports will exclude the non_covered.cpp file. ``` #### Example 3: Target added to the 'ccov' and 'ccov-all' targets @@ -168,6 +148,40 @@ add_executable(theExe main.cpp non_covered.cpp) target_code_coverage(theExe AUTO ALL EXCLUDE non_covered.cpp test/*) # As an executable target, adds to the 'ccov' and ccov-all' targets, and the reports will exclude the non-covered.cpp file, and any files in a test/ folder. ``` +## AFL Fuzzing Instrumentation [`afl-fuzzing.cmake`](afl-fuzzing.cmake) + +> American fuzzy lop is a security-oriented fuzzer that employs a novel type of compile-time instrumentation and genetic algorithms to automatically discover clean, interesting test cases that trigger new internal states in the targeted binary. This substantially improves the functional coverage for the fuzzed code. The compact synthesized corpora produced by the tool are also useful for seeding other, more labor- or resource-intensive testing regimes down the road. +> +> [american fuzzy lop](https://lcamtuf.coredump.cx/afl/) + +NOTE: This actually works based off the still-developed daughter project [AFL++](https://aflplus.plus/). + +### Usage + +To enable the use of AFL instrumentation, this file needs to be included into the CMake scripts at any point *before* any of the compilers are setup by CMake, typically at/before the first call to project(), or any part before compiler detection/validation occurs. This is since CMake does not support changing the compiler after it has been set: + +``` +cmake_minimum_required(VERSION 3.4) +include(cmake/afl-fuzzing.cmake) +project(Example C CXX) +``` + +Using `-DAFL=ON` will search for and switch to the AFL++ compiler wrappers that will instrument builds, or error if it cannot. + +Using `-DAFL_MODE=` will attempt to use the specified instrumentation type, see [here](https://github.com/AFLplusplus/AFLplusplus/blob/stable/docs/fuzzing_in_depth.md). Options are: +- LTO +- LLVM +- GCC-PLUGIN +- CLANG +- GCC + +Using `-DAFL_ENV_OPTIONS=<...;...>` allows adding any number of AFL++'s instrumentation enabled via environment variables, and these will be prefixed to the build calls (see `afl-cc -hh`). + +As an example, a CMake configuration such as this: +```cmake .. -DAFL_MODE=LTO -DAFL_ENV_OPTIONS=AFL_LLVM_THREADSAFE_INST=1;AFL_LLVM_LAF_ALL=1``` +would result in build commands such as this: +```AFL_LLVM_THREADSAFE_INST=1 AFL_LLVM_LAF_ALL=1 afl-clang-lto --afl-lto <...>``` + ## Compiler Options [`compiler-options.cmake`](compiler-options.cmake) Allows for easy use of some pre-made compiler options for the major compilers. @@ -205,75 +219,62 @@ The name to give the doc target. (Default: doc-${PROJECT_NAME}) #### OUTPUT_DIR *STR* The directory to place the generated output -## Doxygen [`doxygen.cmake`](doxygen.cmake) - -Builds doxygen documentation with a default 'Doxyfile.in' or with a specified one, and can make the results installable (under the `doc` install target) - -This can only be used once per project, as each target generated is as `doc-${PROJECT_NAME}` unless TARGET_NAME is specified. - -### Optional Arguments - -#### ADD_TO_DOC -If specified, adds this generated target to be a dependency of the more general `doc` target. - -#### INSTALLABLE -Adds the generated documentation to the generic `install` target, under the `documentation` installation group. - -#### PROCESS_DOXYFILE -If set, then will process the found Doxyfile through the CMAKE `configure_file` function for macro replacements before using it. (@ONLY) - -#### TARGET_NAME *STR* -The name to give the doc target. (Default: doc-${PROJECT_NAME}) - -#### OUTPUT_DIR *STR* -The directory to place the generated output. (Default: ${CMAKE_CURRENT_BINARY_DIR}/doc) +## Tools [`tools.cmake`](tools.cmake) -#### INSTALL_PATH *STR* -The path to install the documenttation under. (if not specified, defaults to 'share/${PROJECT_NAME}) +The three tools in this are used via two provided functions each, for example for clang-tidy: +``` +add_executable(big_test) -#### DOXYFILE_PATH *STR* -The given doxygen file to use/process. (Defaults to'${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile') +clang_tidy() -## Prepare the Catch Test Framework [`prepare_catch.cmake`](prepare_catch.cmake) +# Sources provided here are run with clang-tidy with no options +add_executable(test2 main2.cpp) +target_sources(big_test test2.c test2.cpp) -The included `prepare_catch` function contained within attempts to add the infrastructure necessary for automatically adding C/C++ tests using the Catch2 library, including either an interface or pre-compiled 'catch' target library. +clang_tidy(-header-filter='${CMAKE_SOURCE_DIR}/*') -It first attempts to find the header on the local machine, and failing that, clones the single header variant for use. It does make the determination between pre-C++11 and will use Catch1.X rather than Catch2 (when cloned), automatically or forced.. Adds a subdirectory of tests/ if it exists from the macro's calling location. +# Sources provided here are run with clang-tidy with the header-filter options provided to it from above +add_execuable(test1 main1.cpp) +target_sources(big_test test1.c test1.cpp) -### Optional Arguments +reset_clang_tidy() -#### COMPILED_CATCH -If this option is specified, then generates the 'catch' target as a library with catch already pre-compiled as part of the library. Otherwise acts just an interface library for the header location. +# Sources provided here are not run with clang-tidy at all +add_executable(test3 main3.cpp) +target_sources(big_test test3.c test3.cpp) -#### CATCH1 -Force the use of Catch1.X, rather than auto-detecting the C++ version in use. +clang_tidy() -#### CLONE -Force cloning of Catch, rather than attempting to use a locally-found variant. - -## Tools [`tools.cmake`](tools.cmake) +# Sources provided here are run with clang-tidy with no options +add_executable(test4 main4.cpp) +target_sources(big_test test4.c test4.cpp) +``` ### clang-tidy > clang-tidy is a clang-based C++ “linter” tool. Its purpose is to provide an extensible framework for diagnosing and fixing typical programming errors, like style violations, interface misuse, or bugs that can be deduced via static analysis. clang-tidy is modular and provides a convenient interface for writing new checks. > -> [clang-tidy page](https://clang.llvm.org/extra/clang-tidy/) - -When detected, [clang-tidy](https://clang.llvm.org/extra/clang-tidy/) can be enabled by using the option of `-DCLANG_TIDY=ON`, as it is disabled by default. +> [clang-tidy](https://clang.llvm.org/extra/clang-tidy/) -To use, add the `clang_tidy()` function, with the arguments being the options to pass to the clang tidy program, such as '-checks=*'. +To use, add the `clang_tidy()` macro, with the arguments being the options passed to the clang-tidy call in the form of `clang-tidy ${ARGS}`. The settings used with clang-tidy can be changed by calling `clang_tidy()` macro again. It can be turned off by calling the `reset_clang_tidy()` macro. ### include-what-you-use -This tool helps to organize headers for all files encompass all items being used in that file, without accidentally relying upon headers deep down a chain of other headers. This is disabled by default, and can be enabled via have the program installed and adding `-DIWYU=ON`. +> "Include what you use" means this: for every symbol (type, function variable, or macro) that you use in foo.cc, either foo.cc or foo.h should #include a .h file that exports the declaration of that symbol. The include-what-you-use tool is a program that can be built with the clang libraries in order to analyze #includes of source files to find include-what-you-use violations, and suggest fixes for them. +> +> The main goal of include-what-you-use is to remove superfluous #includes. It does this both by figuring out what #includes are not actually needed for this file (for both .cc and .h files), and replacing #includes with forward-declares when possible. +> +> [include-what-you-use](https://include-what-you-use.org/) -To use, add the `include_what_you_use()` function, with the arguments being the options to pass to the program. +To use, add the `include_what_you_use()` macro, with the arguments being the options passed to the include_what_you_use call in the form of `include-what-you-use ${ARGS}`. The settings used with include-what-you-use can be changed by calling `include_what_you_use()` macro again. It can be turned off by calling the `reset_include_what_you_use()` macro. ### cppcheck -This tool is another static analyzer in the vein of clang-tidy, which focuses on having no false positives. This is by default disabled, and can be enabled via have the program installed and adding `-DCPPCHECK=ON`. +> Cppcheck is a static analysis tool for C/C++ code. It provides unique code analysis to detect bugs and focuses on detecting undefined behaviour and dangerous coding constructs. The goal is to have very few false positives. Cppcheck is designed to be able to analyze your C/C++ code even if it has non-standard syntax (common in embedded projects). +> +> [cppcheck](http://cppcheck.net/) -To use, add the `cppcheck()` function, with the arguments being the options to pass to the program. +To use, add the `cppcheck()` macro, with the arguments being the options passed to the cppcheck call in the form of `cppcheck ${ARGS}`. The settings used with iwyu can be changed by calling `cppcheck()` macro again. It can be turned off by calling the `reset_cppcheck()` macro. ## Formatting [`formatting.cmake`](formatting.cmake) @@ -305,4 +306,3 @@ file(GLOB_RECURSE CMAKE_FILES cmake_format(TARGET_NAME ${CMAKE_FILES}) ``` - diff --git a/config/sanitizer/afl-fuzzing.cmake b/config/sanitizer/afl-fuzzing.cmake new file mode 100644 index 00000000000..67d3f21f9d3 --- /dev/null +++ b/config/sanitizer/afl-fuzzing.cmake @@ -0,0 +1,108 @@ +# +# Copyright (C) 2022 by George Cave - gcave@stablecoder.ca +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +# USAGE: To enable the use of AFL instrumentation, this file needs to be +# included into the CMake scripts at any point *before* any of the compilers are +# setup by CMake, typically at/before the first call to project(), or any part +# before compiler detection/validation occurs. +# +# This is since CMake does not support changing the compiler after it has been +# set. +# +# For example for CMakeLists.txt: +# ~~~ +# cmake_minimum_required(VERSION 3.15) +# include(cmake/afl-fuzzing.cmake) +# project(FoE-Engine C CXX) +# ~~~ +# And then configuring CMake with: `cmake .. -DAFL_MODE=LTO +# -DAFL_ENV_OPTIONS=AFL_LLVM_THREADSAFE_INST=1;AFL_LLVM_LAF_ALL=1` +# +# Would setup the AFL compiler to use the LTO mode (afl-clang-lto), and prefix +# any build calls to have the two given environment settings, ie: +# `AFL_LLVM_THREADSAFE_INST=1 AFL_LLVM_LAF_ALL=1 afl-clang-lto <...>` +# +# NOTE: If using multiple ENV_OPTIONS, delimit via semi-colons and it will be +# separated correctly. + +# Options +option(AFL "Switch to using an AFL compiler" OFF) +set(AFL_MODE + "" + CACHE + STRING + "Use a specific AFL instrumentation mode: LTO, LLVM, GCC-PLUGIN, CLANG, GCC" +) +set(AFL_ENV_OPTIONS + "" + CACHE STRING + "Add environmental settings to build calls (check `afl-cc -hh`)") + +# Sets up for AFL fuzzing by detecting finding and using AFL compilers and +# setting a few flags and environmental build flags as requested. +if(AFL) + find_program(AFL_C_COMPILER afl-cc) + find_program(AFL_CXX_COMPILER afl-c++) + + if(AFL_C_COMPILER AND AFL_CXX_COMPILER) + if((CMAKE_C_COMPILER AND NOT CMAKE_C_COMPILER STREQUAL AFL_C_COMPILER) + OR (CMAKE_CXX_COMPILER AND NOT CMAKE_CXX_COMPILER STREQUAL + AFL_CXX_COMPILER)) + # CMake doesn't support changing compilers after they've been set + message( + FATAL_ERROR + "Cannot change to AFL compilers after they have been previously set. Clear the cache, reconfigure and ensure setup_afl is called before the first C or CXX compiler is set, typically before the first project() call." + ) + else() + # Set the AFL compiler + message(STATUS "Changed to AFL compiler") + set(CMAKE_C_COMPILER ${AFL_C_COMPILER}) + set(CMAKE_CXX_COMPILER ${AFL_CXX_COMPILER}) + + # Set a specific AFL mode for both compile and link stages + if(AFL_MODE MATCHES "[Ll][Tt][Oo]") + message(STATUS "Set AFL to Clang-LTO mode") + add_compile_options(--afl-lto) + add_link_options(--afl-lto) + elseif(AFL_MODE MATCHES "[Ll][Ll][Vv][Mm]") + message(STATUS "Set AFL to Clang-LLVM mode") + add_compile_options(--afl-llvm) + add_link_options(--afl-llvm) + elseif(AFL_MODE MATCHES "[Gg][Cc][Cc][-_][Pp][Ll][Uu][Gg][Ii][Nn]") + message(STATUS "Set AFL to GCC-Plugin mode") + add_compile_options(--afl-gcc-plugin) + add_link_options(--afl-gcc-plugin) + elseif(AFL_MODE MATCHES "[Ll][Tt][Oo]") + message(STATUS "Set AFL to Clang mode") + add_compile_options(--afl-clang) + add_link_options(--afl-clang) + elseif(AFL_MODE MATCHES "[Ll][Tt][Oo]") + message(STATUS "Set AFL to GCC mode") + add_compile_options(--afl-gcc) + add_link_options(--afl-gcc) + endif() + + # Add specified environment options + if(AFL_ENV_OPTIONS) + set(CMAKE_C_COMPILER_LAUNCHER ${CMAKE_C_COMPILER_LAUNCHER} + ${AFL_ENV_OPTIONS}) + set(CMAKE_CXX_COMPILER_LAUNCHER ${CMAKE_CXX_COMPILER_LAUNCHER} + ${AFL_ENV_OPTIONS}) + endif() + endif() + else() + message(FATAL_ERROR "Usable AFL compiler was not found!") + endif() +endif() diff --git a/config/sanitizer/code-coverage.cmake b/config/sanitizer/code-coverage.cmake index 4a927af5ee8..54a33deda3f 100644 --- a/config/sanitizer/code-coverage.cmake +++ b/config/sanitizer/code-coverage.cmake @@ -1,5 +1,5 @@ # -# Copyright (C) 2018 by George Cave - gcave@stablecoder.ca +# Copyright (C) 2018-2020 by George Cave - gcave@stablecoder.ca # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy of @@ -80,36 +80,44 @@ option( OFF) # Programs -if(WIN32) - find_program(LLVM_COV_PATH llvm-cov PATHS ENV VS2019INSTALLDIR PATH_SUFFIXES "VC/Tools/Llvm/x64/bin") - find_program(LLVM_PROFDATA_PATH llvm-profdata PATHS ENV VS2019INSTALLDIR PATH_SUFFIXES "VC/Tools/Llvm/x64/bin") - find_program(LCOV_PATH lcov PATHS ENV VS2019INSTALLDIR PATH_SUFFIXES "VC/Tools/Llvm/x64/bin") - find_program(GENHTML_PATH genhtml PATHS ENV VS2019INSTALLDIR PATH_SUFFIXES "VC/Tools/Llvm/x64/bin") -else() - find_program(LLVM_COV_PATH llvm-cov) - find_program(LLVM_PROFDATA_PATH llvm-profdata) - find_program(LCOV_PATH lcov) - find_program(GENHTML_PATH genhtml) -endif() +find_program(LLVM_COV_PATH llvm-cov) +find_program(LLVM_PROFDATA_PATH llvm-profdata) +find_program(LCOV_PATH lcov) +find_program(GENHTML_PATH genhtml) +# Hide behind the 'advanced' mode flag for GUI/ccmake +mark_as_advanced(FORCE LLVM_COV_PATH LLVM_PROFDATA_PATH LCOV_PATH GENHTML_PATH) # Variables set(CMAKE_COVERAGE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/ccov) +set_property(GLOBAL PROPERTY JOB_POOLS ccov_serial_pool=1) # Common initialization/checks if(CODE_COVERAGE AND NOT CODE_COVERAGE_ADDED) set(CODE_COVERAGE_ADDED ON) # Common Targets - add_custom_target( - ccov-preprocessing - COMMAND ${CMAKE_COMMAND} -E make_directory - ${CMAKE_COVERAGE_OUTPUT_DIRECTORY} - DEPENDS ccov-clean) + file(MAKE_DIRECTORY ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}) - if(CMAKE_C_COMPILER_ID MATCHES "IntelLLVM" OR CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM" OR CMAKE_C_COMPILER_ID MATCHES "[Cc]lang" OR CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang") - # Messages + if(CMAKE_C_COMPILER_ID MATCHES "IntelLLVM" OR + CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM" OR + CMAKE_C_COMPILER_ID MATCHES "(Apple)?[Cc]lang" + OR CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?[Cc]lang") message(STATUS "Building with llvm Code Coverage Tools") + if(CMAKE_C_COMPILER_ID MATCHES "AppleClang" OR CMAKE_CXX_COMPILER_ID + MATCHES "AppleClang") + # When on macOS and using the Apple-provided toolchain, use the + # XCode-provided llvm toolchain via `xcrun` + message( + STATUS + "Building with XCode-provided llvm code coverage tools (via `xcrun`)") + set(LLVM_COV_PATH xcrun llvm-cov) + set(LLVM_PROFDATA_PATH xcrun llvm-profdata) + else() + # Use the regular llvm toolchain + message(STATUS "Building with llvm code coverage tools") + endif() + if(NOT LLVM_COV_PATH) message(FATAL_ERROR "llvm-cov not found! Aborting.") else() @@ -128,10 +136,21 @@ if(CODE_COVERAGE AND NOT CODE_COVERAGE_ADDED) endif() # Targets - add_custom_target( - ccov-clean - COMMAND rm -f ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list - COMMAND rm -f ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/profraw.list) + if(${CMAKE_VERSION} VERSION_LESS "3.17.0") + add_custom_target( + ccov-clean + COMMAND ${CMAKE_COMMAND} -E remove -f + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list + COMMAND ${CMAKE_COMMAND} -E remove -f + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/profraw.list) + else() + add_custom_target( + ccov-clean + COMMAND ${CMAKE_COMMAND} -E rm -f + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list + COMMAND ${CMAKE_COMMAND} -E rm -f + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/profraw.list) + endif() # Used to get the shared object file list before doing the main all- # processing @@ -189,44 +208,74 @@ endif() # ccov-report : Generates HTML code coverage report for every target added with 'AUTO' parameter. # ccov-${TARGET_NAME} : Generates HTML code coverage report. # ccov-report-${TARGET_NAME} : Prints to command line summary per-file coverage information. +# ccov-export-${TARGET_NAME} : Exports the coverage report to a JSON file. # ccov-show-${TARGET_NAME} : Prints to command line detailed per-line coverage information. # ccov-all : Generates HTML code coverage report, merging every target added with 'ALL' parameter into a single detailed report. # ccov-all-report : Prints summary per-file coverage information for every target added with ALL' parameter to the command line. +# ccov-all-export : Exports the coverage report to a JSON file. # # Required: # TARGET_NAME - Name of the target to generate code coverage for. # Optional: +# PUBLIC - Sets the visibility for added compile options to targets to PUBLIC instead of the default of PRIVATE. +# INTERFACE - Sets the visibility for added compile options to targets to INTERFACE instead of the default of PRIVATE. +# PLAIN - Do not set any target visibility (backward compatibility with old cmake projects) # AUTO - Adds the target to the 'ccov' target so that it can be run in a batch with others easily. Effective on executable targets. # ALL - Adds the target to the 'ccov-all' and 'ccov-all-report' targets, which merge several executable targets coverage data to a single report. Effective on executable targets. # EXTERNAL - For GCC's lcov, allows the profiling of 'external' files from the processing directory -# EXCLUDE - Excludes files of the patterns provided from coverage. **These do not copy to the 'all' targets.** +# COVERAGE_TARGET_NAME - For executables ONLY, changes the outgoing target name so instead of `ccov-${TARGET_NAME}` it becomes `ccov-${COVERAGE_TARGET_NAME}`. +# EXCLUDE - Excludes files of the patterns provided from coverage. Note that GCC/lcov excludes by glob pattern, and clang/LLVM excludes via regex! **These do not copy to the 'all' targets.** # OBJECTS - For executables ONLY, if the provided targets are shared libraries, adds coverage information to the output +# PRE_ARGS - For executables ONLY, prefixes given arguments to the associated ccov-* executable call ($ ccov-*) +# ARGS - For executables ONLY, appends the given arguments to the associated ccov-* executable call (ccov-* $) # ~~~ function(target_code_coverage TARGET_NAME) # Argument parsing - set(options AUTO ALL EXTERNAL) - set(multi_value_keywords EXCLUDE OBJECTS) - cmake_parse_arguments(target_code_coverage "${options}" "" - "${multi_value_keywords}" ${ARGN}) + set(options AUTO ALL EXTERNAL PUBLIC INTERFACE PLAIN) + set(single_value_keywords COVERAGE_TARGET_NAME) + set(multi_value_keywords EXCLUDE OBJECTS PRE_ARGS ARGS) + cmake_parse_arguments( + target_code_coverage "${options}" "${single_value_keywords}" + "${multi_value_keywords}" ${ARGN}) + + # Set the visibility of target functions to PUBLIC, INTERFACE or default to + # PRIVATE. + if(target_code_coverage_PUBLIC) + set(TARGET_VISIBILITY PUBLIC) + set(TARGET_LINK_VISIBILITY PUBLIC) + elseif(target_code_coverage_INTERFACE) + set(TARGET_VISIBILITY INTERFACE) + set(TARGET_LINK_VISIBILITY INTERFACE) + elseif(target_code_coverage_PLAIN) + set(TARGET_VISIBILITY PUBLIC) + set(TARGET_LINK_VISIBILITY) + else() + set(TARGET_VISIBILITY PRIVATE) + set(TARGET_LINK_VISIBILITY PRIVATE) + endif() + + if(NOT target_code_coverage_COVERAGE_TARGET_NAME) + # If a specific name was given, use that instead. + set(target_code_coverage_COVERAGE_TARGET_NAME ${TARGET_NAME}) + endif() if(CODE_COVERAGE) # Add code coverage instrumentation to the target's linker command - if(CMAKE_C_COMPILER_ID MATCHES "IntelLLVM" OR CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM" OR CMAKE_C_COMPILER_ID MATCHES "[Cc]lang" OR CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang") - target_compile_options(${TARGET_NAME} PRIVATE -fprofile-instr-generate - -fcoverage-mapping --coverage) - set_property( - TARGET ${TARGET_NAME} - APPEND_STRING - PROPERTY LINK_FLAGS "-fprofile-instr-generate ") - set_property( - TARGET ${TARGET_NAME} - APPEND_STRING - PROPERTY LINK_FLAGS "-fcoverage-mapping ") - elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") - target_compile_options(${TARGET_NAME} PRIVATE -fprofile-arcs - -ftest-coverage --coverage) - target_link_libraries(${TARGET_NAME} PRIVATE gcov) + if(CMAKE_C_COMPILER_ID MATCHES "IntelLLVM" OR + CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM" OR + CMAKE_C_COMPILER_ID MATCHES "(Apple)?[Cc]lang" OR + CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?[Cc]lang") + target_compile_options(${TARGET_NAME} ${TARGET_VISIBILITY} + -fprofile-instr-generate -fcoverage-mapping) + target_link_options(${TARGET_NAME} ${TARGET_VISIBILITY} + -fprofile-instr-generate -fcoverage-mapping) + elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES + "GNU") + target_compile_options( + ${TARGET_NAME} ${TARGET_VISIBILITY} -fprofile-arcs -ftest-coverage + $<$:-fno-elide-constructors> -fno-default-inline) + target_link_libraries(${TARGET_NAME} ${TARGET_LINK_VISIBILITY} gcov) endif() # Targets @@ -234,12 +283,16 @@ function(target_code_coverage TARGET_NAME) # Add shared library to processing for 'all' targets if(target_type STREQUAL "SHARED_LIBRARY" AND target_code_coverage_ALL) - if(CMAKE_C_COMPILER_ID MATCHES "IntelLLVM" OR CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM" OR CMAKE_C_COMPILER_ID MATCHES "[Cc]lang" OR CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang") + if(CMAKE_C_COMPILER_ID MATCHES "IntelLLVM" OR + CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM" OR + CMAKE_C_COMPILER_ID MATCHES "(Apple)?[Cc]lang" OR + CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?[Cc]lang") add_custom_target( - ccov-run-${TARGET_NAME} - COMMAND echo "-object=$" >> - ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list - DEPENDS ccov-preprocessing ${TARGET_NAME}) + ccov-run-${target_code_coverage_COVERAGE_TARGET_NAME} + COMMAND + ${CMAKE_COMMAND} -E echo "-object=$" >> + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list + DEPENDS ${TARGET_NAME}) if(NOT TARGET ccov-libs) message( @@ -248,13 +301,17 @@ function(target_code_coverage TARGET_NAME) ) endif() - add_dependencies(ccov-libs ccov-run-${TARGET_NAME}) + add_dependencies(ccov-libs + ccov-run-${target_code_coverage_COVERAGE_TARGET_NAME}) endif() endif() # For executables add targets to run and produce output if(target_type STREQUAL "EXECUTABLE") - if(CMAKE_C_COMPILER_ID MATCHES "IntelLLVM" OR CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM" OR CMAKE_C_COMPILER_ID MATCHES "[Cc]lang" OR CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?Cc]lang") + if(CMAKE_C_COMPILER_ID MATCHES "IntelLLVM" OR + CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM" OR + CMAKE_C_COMPILER_ID MATCHES "(Apple)?[Cc]lang" OR + CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?[Cc]lang") # If there are shared objects to also work with, generate the string to # add them here @@ -268,23 +325,34 @@ function(target_code_coverage TARGET_NAME) endif() endforeach() - # Run the executable, generating raw profile data + # Run the executable, generating raw profile data Make the run data + # available for further processing. Separated to allow Windows to run + # this target serially. add_custom_target( - ccov-run-${TARGET_NAME} - COMMAND LLVM_PROFILE_FILE=${TARGET_NAME}.profraw - $ - COMMAND echo "-object=$" >> - ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list - COMMAND echo "${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.profraw " >> - ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/profraw.list - DEPENDS ccov-preprocessing ccov-libs ${TARGET_NAME}) + ccov-run-${target_code_coverage_COVERAGE_TARGET_NAME} + COMMAND + ${CMAKE_COMMAND} -E env ${CMAKE_CROSSCOMPILING_EMULATOR} + ${target_code_coverage_PRE_ARGS} + LLVM_PROFILE_FILE=${target_code_coverage_COVERAGE_TARGET_NAME}.profraw + $ ${target_code_coverage_ARGS} + COMMAND + ${CMAKE_COMMAND} -E echo "-object=$" + ${SO_OBJECTS} >> ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list + COMMAND + ${CMAKE_COMMAND} -E echo + "${CMAKE_CURRENT_BINARY_DIR}/${target_code_coverage_COVERAGE_TARGET_NAME}.profraw" + >> ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/profraw.list + JOB_POOL ccov_serial_pool + DEPENDS ccov-libs ${TARGET_NAME}) # Merge the generated profile data so llvm-cov can process it add_custom_target( - ccov-processing-${TARGET_NAME} - COMMAND ${LLVM_PROFDATA_PATH} merge -sparse ${TARGET_NAME}.profraw -o - ${TARGET_NAME}.profdata - DEPENDS ccov-run-${TARGET_NAME}) + ccov-processing-${target_code_coverage_COVERAGE_TARGET_NAME} + COMMAND + ${LLVM_PROFDATA_PATH} merge -sparse + ${target_code_coverage_COVERAGE_TARGET_NAME}.profraw -o + ${target_code_coverage_COVERAGE_TARGET_NAME}.profdata + DEPENDS ccov-run-${target_code_coverage_COVERAGE_TARGET_NAME}) # Ignore regex only works on LLVM >= 7 if(LLVM_COV_VERSION VERSION_GREATER_EQUAL "7.0.0") @@ -296,40 +364,57 @@ function(target_code_coverage TARGET_NAME) # Print out details of the coverage information to the command line add_custom_target( - ccov-show-${TARGET_NAME} + ccov-show-${target_code_coverage_COVERAGE_TARGET_NAME} COMMAND ${LLVM_COV_PATH} show $ ${SO_OBJECTS} - -instr-profile=${TARGET_NAME}.profdata -show-line-counts-or-regions - ${EXCLUDE_REGEX} - DEPENDS ccov-processing-${TARGET_NAME}) + -instr-profile=${target_code_coverage_COVERAGE_TARGET_NAME}.profdata + -show-line-counts-or-regions ${EXCLUDE_REGEX} + DEPENDS ccov-processing-${target_code_coverage_COVERAGE_TARGET_NAME}) # Print out a summary of the coverage information to the command line add_custom_target( - ccov-report-${TARGET_NAME} - COMMAND ${LLVM_COV_PATH} report $ - ${SO_OBJECTS} -instr-profile=${TARGET_NAME}.profdata - ${EXCLUDE_REGEX} - DEPENDS ccov-processing-${TARGET_NAME}) + ccov-report-${target_code_coverage_COVERAGE_TARGET_NAME} + COMMAND + ${LLVM_COV_PATH} report $ ${SO_OBJECTS} + -instr-profile=${target_code_coverage_COVERAGE_TARGET_NAME}.profdata + ${EXCLUDE_REGEX} + DEPENDS ccov-processing-${target_code_coverage_COVERAGE_TARGET_NAME}) + + # Export coverage information so continuous integration tools (e.g. + # Jenkins) can consume it + add_custom_target( + ccov-export-${target_code_coverage_COVERAGE_TARGET_NAME} + COMMAND + ${LLVM_COV_PATH} export $ ${SO_OBJECTS} + -instr-profile=${target_code_coverage_COVERAGE_TARGET_NAME}.profdata + -format="text" ${EXCLUDE_REGEX} > + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/${target_code_coverage_COVERAGE_TARGET_NAME}.json + DEPENDS ccov-processing-${target_code_coverage_COVERAGE_TARGET_NAME}) # Generates HTML output of the coverage information for perusal add_custom_target( - ccov-${TARGET_NAME} + ccov-${target_code_coverage_COVERAGE_TARGET_NAME} COMMAND ${LLVM_COV_PATH} show $ ${SO_OBJECTS} - -instr-profile=${TARGET_NAME}.profdata -show-line-counts-or-regions - -output-dir=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/${TARGET_NAME} + -instr-profile=${target_code_coverage_COVERAGE_TARGET_NAME}.profdata + -show-line-counts-or-regions + -output-dir=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/${target_code_coverage_COVERAGE_TARGET_NAME} -format="html" ${EXCLUDE_REGEX} - DEPENDS ccov-processing-${TARGET_NAME}) + DEPENDS ccov-processing-${target_code_coverage_COVERAGE_TARGET_NAME}) - elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") + elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES + "GNU") set(COVERAGE_INFO - "${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/${TARGET_NAME}.info") + "${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/${target_code_coverage_COVERAGE_TARGET_NAME}.info" + ) # Run the executable, generating coverage information add_custom_target( - ccov-run-${TARGET_NAME} - COMMAND $ - DEPENDS ccov-preprocessing ${TARGET_NAME}) + ccov-run-${target_code_coverage_COVERAGE_TARGET_NAME} + COMMAND + ${CMAKE_CROSSCOMPILING_EMULATOR} ${target_code_coverage_PRE_ARGS} + $ ${target_code_coverage_ARGS} + DEPENDS ${TARGET_NAME}) # Generate exclusion string for use foreach(EXCLUDE_ITEM ${target_code_coverage_EXCLUDE}) @@ -349,33 +434,52 @@ function(target_code_coverage TARGET_NAME) endif() # Capture coverage data - add_custom_target( - ccov-capture-${TARGET_NAME} - COMMAND ${CMAKE_COMMAND} -E remove ${COVERAGE_INFO} - COMMAND ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --zerocounters - COMMAND $ - COMMAND - ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --base-directory - ${CMAKE_SOURCE_DIR} --capture ${EXTERNAL_OPTION} --output-file - ${COVERAGE_INFO} - COMMAND ${EXCLUDE_COMMAND} - DEPENDS ccov-preprocessing ${TARGET_NAME}) + if(${CMAKE_VERSION} VERSION_LESS "3.17.0") + add_custom_target( + ccov-capture-${target_code_coverage_COVERAGE_TARGET_NAME} + COMMAND ${CMAKE_COMMAND} -E remove -f ${COVERAGE_INFO} + COMMAND ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --zerocounters + COMMAND + ${CMAKE_CROSSCOMPILING_EMULATOR} ${target_code_coverage_PRE_ARGS} + $ ${target_code_coverage_ARGS} + COMMAND + ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --base-directory + ${CMAKE_SOURCE_DIR} --capture ${EXTERNAL_OPTION} --output-file + ${COVERAGE_INFO} + COMMAND ${EXCLUDE_COMMAND} + DEPENDS ${TARGET_NAME}) + else() + add_custom_target( + ccov-capture-${target_code_coverage_COVERAGE_TARGET_NAME} + COMMAND ${CMAKE_COMMAND} -E rm -f ${COVERAGE_INFO} + COMMAND ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --zerocounters + COMMAND + ${CMAKE_CROSSCOMPILING_EMULATOR} ${target_code_coverage_PRE_ARGS} + $ ${target_code_coverage_ARGS} + COMMAND + ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --base-directory + ${CMAKE_SOURCE_DIR} --capture ${EXTERNAL_OPTION} --output-file + ${COVERAGE_INFO} + COMMAND ${EXCLUDE_COMMAND} + DEPENDS ${TARGET_NAME}) + endif() # Generates HTML output of the coverage information for perusal add_custom_target( - ccov-${TARGET_NAME} - COMMAND ${GENHTML_PATH} -o - ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/${TARGET_NAME} - ${COVERAGE_INFO} - DEPENDS ccov-capture-${TARGET_NAME}) + ccov-${target_code_coverage_COVERAGE_TARGET_NAME} + COMMAND + ${GENHTML_PATH} -o + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/${target_code_coverage_COVERAGE_TARGET_NAME} + ${COVERAGE_INFO} + DEPENDS ccov-capture-${target_code_coverage_COVERAGE_TARGET_NAME}) endif() add_custom_command( - TARGET ccov-${TARGET_NAME} + TARGET ccov-${target_code_coverage_COVERAGE_TARGET_NAME} POST_BUILD COMMAND ; COMMENT - "Open ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/${TARGET_NAME}/index.html in your browser to view the coverage report." + "Open ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/${target_code_coverage_COVERAGE_TARGET_NAME}/index.html in your browser to view the coverage report." ) # AUTO @@ -383,13 +487,16 @@ function(target_code_coverage TARGET_NAME) if(NOT TARGET ccov) add_custom_target(ccov) endif() - add_dependencies(ccov ccov-${TARGET_NAME}) + add_dependencies(ccov ccov-${target_code_coverage_COVERAGE_TARGET_NAME}) - if(NOT CMAKE_COMPILER_IS_GNUCXX) + if(NOT CMAKE_C_COMPILER_ID MATCHES "GNU" AND NOT CMAKE_CXX_COMPILER_ID + MATCHES "GNU") if(NOT TARGET ccov-report) add_custom_target(ccov-report) endif() - add_dependencies(ccov-report ccov-report-${TARGET_NAME}) + add_dependencies( + ccov-report + ccov-report-${target_code_coverage_COVERAGE_TARGET_NAME}) endif() endif() @@ -402,7 +509,8 @@ function(target_code_coverage TARGET_NAME) ) endif() - add_dependencies(ccov-all-processing ccov-run-${TARGET_NAME}) + add_dependencies(ccov-all-processing + ccov-run-${target_code_coverage_COVERAGE_TARGET_NAME}) endif() endif() endif() @@ -412,12 +520,20 @@ endfunction() # any subdirectories. To add coverage instrumentation to only specific targets, # use `target_code_coverage`. function(add_code_coverage) - if(CMAKE_C_COMPILER_ID MATCHES "IntelLLVM" OR CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM" OR CMAKE_C_COMPILER_ID MATCHES "[Cc]lang" OR CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang") - add_compile_options(-fprofile-instr-generate -fcoverage-mapping --coverage) - add_link_options(-fprofile-instr-generate -fcoverage-mapping --coverage) - elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") - add_compile_options(-fprofile-arcs -ftest-coverage --coverage) - link_libraries(gcov) + if(CODE_COVERAGE) + if(CMAKE_C_COMPILER_ID MATCHES "IntelLLVM" OR + CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM" OR + CMAKE_C_COMPILER_ID MATCHES "(Apple)?[Cc]lang" OR + CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?[Cc]lang") + add_compile_options(-fprofile-instr-generate -fcoverage-mapping) + add_link_options(-fprofile-instr-generate -fcoverage-mapping) + elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES + "GNU") + add_compile_options( + -fprofile-arcs -ftest-coverage + $<$:-fno-elide-constructors> -fno-default-inline) + link_libraries(gcov) + endif() endif() endfunction() @@ -428,7 +544,7 @@ endfunction() # use with coverage dashboards (e.g. codecov.io, coveralls). # ~~~ # Optional: -# EXCLUDE - Excludes files of the regex patterns provided from coverage. +# EXCLUDE - Excludes files of the patterns provided from coverage. Note that GCC/lcov excludes by glob pattern, and clang/LLVM excludes via regex! # ~~~ function(add_code_coverage_all_targets) # Argument parsing @@ -437,15 +553,28 @@ function(add_code_coverage_all_targets) "${multi_value_keywords}" ${ARGN}) if(CODE_COVERAGE) - if(CMAKE_C_COMPILER_ID MATCHES "IntelLLVM" OR CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM" OR CMAKE_C_COMPILER_ID MATCHES "[Cc]lang" OR CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang") + if(CMAKE_C_COMPILER_ID MATCHES "IntelLLVM" OR + CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM" OR + CMAKE_C_COMPILER_ID MATCHES "(Apple)?[Cc]lang" OR + CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?[Cc]lang") # Merge the profile data for all of the run executables - add_custom_target( - ccov-all-processing - COMMAND - ${LLVM_PROFDATA_PATH} merge -o - ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata -sparse `cat - ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/profraw.list`) + if(WIN32) + add_custom_target( + ccov-all-processing + COMMAND + powershell -Command $$FILELIST = Get-Content + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/profraw.list\; llvm-profdata.exe + merge -o ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata + -sparse $$FILELIST) + else() + add_custom_target( + ccov-all-processing + COMMAND + ${LLVM_PROFDATA_PATH} merge -o + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata -sparse `cat + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/profraw.list`) + endif() # Regex exclude only available for LLVM >= 7 if(LLVM_COV_VERSION VERSION_GREATER_EQUAL "7.0.0") @@ -456,38 +585,77 @@ function(add_code_coverage_all_targets) endif() # Print summary of the code coverage information to the command line - add_custom_target( - ccov-all-report - COMMAND - ${LLVM_COV_PATH} report `cat - ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list` - -instr-profile=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata - ${EXCLUDE_REGEX} - DEPENDS ccov-all-processing) + if(WIN32) + add_custom_target( + ccov-all-report + COMMAND + powershell -Command $$FILELIST = Get-Content + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list\; llvm-cov.exe + report $$FILELIST + -instr-profile=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata + ${EXCLUDE_REGEX} + DEPENDS ccov-all-processing) + else() + add_custom_target( + ccov-all-report + COMMAND + ${LLVM_COV_PATH} report `cat + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list` + -instr-profile=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata + ${EXCLUDE_REGEX} + DEPENDS ccov-all-processing) + endif() # Export coverage information so continuous integration tools (e.g. # Jenkins) can consume it - add_custom_target( - ccov-all-export - COMMAND - ${LLVM_COV_PATH} export `cat - ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list` - -instr-profile=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata - -format="text" ${EXCLUDE_REGEX} > - ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/coverage.json - DEPENDS ccov-all-processing) + if(WIN32) + add_custom_target( + ccov-all-export + COMMAND + powershell -Command $$FILELIST = Get-Content + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list\; llvm-cov.exe + export $$FILELIST + -instr-profile=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata + -format="text" ${EXCLUDE_REGEX} > + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/coverage.json + DEPENDS ccov-all-processing) + else() + add_custom_target( + ccov-all-export + COMMAND + ${LLVM_COV_PATH} export `cat + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list` + -instr-profile=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata + -format="text" ${EXCLUDE_REGEX} > + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/coverage.json + DEPENDS ccov-all-processing) + endif() # Generate HTML output of all added targets for perusal - add_custom_target( - ccov-all - COMMAND - ${LLVM_COV_PATH} show `cat - ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list` - -instr-profile=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata - -show-line-counts-or-regions - -output-dir=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged - -format="html" ${EXCLUDE_REGEX} - DEPENDS ccov-all-processing) + if(WIN32) + add_custom_target( + ccov-all + COMMAND + powershell -Command $$FILELIST = Get-Content + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list\; llvm-cov.exe show + $$FILELIST + -instr-profile=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata + -show-line-counts-or-regions + -output-dir=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged + -format="html" ${EXCLUDE_REGEX} + DEPENDS ccov-all-processing) + else() + add_custom_target( + ccov-all + COMMAND + ${LLVM_COV_PATH} show `cat + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list` + -instr-profile=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata + -show-line-counts-or-regions + -output-dir=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged + -format="html" ${EXCLUDE_REGEX} + DEPENDS ccov-all-processing) + endif() elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") set(COVERAGE_INFO "${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.info") @@ -496,6 +664,7 @@ function(add_code_coverage_all_targets) add_custom_target(ccov-all-processing COMMAND ;) # Exclusion regex string creation + set(EXCLUDE_REGEX) foreach(EXCLUDE_ITEM ${add_code_coverage_all_targets_EXCLUDE}) set(EXCLUDE_REGEX ${EXCLUDE_REGEX} --remove ${COVERAGE_INFO} '${EXCLUDE_ITEM}') @@ -509,19 +678,29 @@ function(add_code_coverage_all_targets) endif() # Capture coverage data - add_custom_target( - ccov-all-capture - COMMAND ${CMAKE_COMMAND} -E remove ${COVERAGE_INFO} - COMMAND ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --capture - --output-file ${COVERAGE_INFO} - COMMAND ${EXCLUDE_COMMAND} - DEPENDS ccov-all-processing) + if(${CMAKE_VERSION} VERSION_LESS "3.17.0") + add_custom_target( + ccov-all-capture + COMMAND ${CMAKE_COMMAND} -E remove -f ${COVERAGE_INFO} + COMMAND ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --capture + --output-file ${COVERAGE_INFO} + COMMAND ${EXCLUDE_COMMAND} + DEPENDS ccov-all-processing) + else() + add_custom_target( + ccov-all-capture + COMMAND ${CMAKE_COMMAND} -E rm -f ${COVERAGE_INFO} + COMMAND ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --capture + --output-file ${COVERAGE_INFO} + COMMAND ${EXCLUDE_COMMAND} + DEPENDS ccov-all-processing) + endif() # Generates HTML output of all targets for perusal add_custom_target( ccov-all COMMAND ${GENHTML_PATH} -o ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged - ${COVERAGE_INFO} + ${COVERAGE_INFO} -p ${CMAKE_SOURCE_DIR} DEPENDS ccov-all-capture) endif() diff --git a/config/sanitizer/dependency-graph.cmake b/config/sanitizer/dependency-graph.cmake new file mode 100644 index 00000000000..bc3446d0e4b --- /dev/null +++ b/config/sanitizer/dependency-graph.cmake @@ -0,0 +1,107 @@ +# +# Copyright (C) 2019 by George Cave - gcave@stablecoder.ca +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +find_program(DOT_EXE "dot") +mark_as_advanced(FORCE DOT_EXE) +if(DOT_EXE) + message(STATUS "dot found: ${DOT_EXE}") +else() + message(STATUS "dot not found!") +endif() + +if(NOT DOT_EXE) + option( + BUILD_DEP_GRAPH + "Builds a visual representation of the dependencies of that included targets" + OFF) +else() + option( + BUILD_DEP_GRAPH + "Builds a visual representation of the dependencies of that included targets" + ON) +endif() + +# Builds a dependency graph of the active code targets using the `dot` +# application +# +# This can only be used once per project, as each target generated is as +# `doc-${PROJECT_NAME}` unless TARGET_NAME is specified. +# ~~~ +# Required Arguments: +# OUTPUT_TYPE +# This is the output type, which doubles as the output file type, such as pdf, png. +# This can be whatever the `dot` application allows. +# +# Options Arguments: +# ADD_TO_DEP_GRAPH +# If specified, add this generated target to be a dependency of the more general +# `dep-graph` target. +# +# TARGET_NAME +# The name to give the doc target. (Default: dep-graph-${PROJECT_NAME}) +# +# OUTPUT_DIR +# The directory to place the generated output +# ~~~ +function(gen_dep_graph OUTPUT_TYPE) + set(OPTIONS ADD_TO_DEP_GRAPH) + set(SINGLE_VALUE_KEYWORDS TARGET_NAME OUTPUT_DIR) + set(MULTI_VALUE_KEYWORDS) + cmake_parse_arguments(gen_dep_graph "${OPTIONS}" "${SINGLE_VALUE_KEYWORDS}" + "${MULTI_VALUE_KEYWORDS}" ${ARGN}) + + if(BUILD_DEP_GRAPH) + if(NOT DOT_EXE) + message(FATAL_ERROR "`dot` is needed to build the dependency graph.") + endif() + + if(gen_dep_graph_TARGET_NAME) + set(TARGET_NAME ${gen_dep_graph_TARGET_NAME}) + else() + set(TARGET_NAME dep-graph-${PROJECT_NAME}) + endif() + + if(gen_dep_graph_OUTPUT_DIR) + set(OUT_DIR ${gen_dep_graph_OUTPUT_DIR}) + else() + set(OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) + endif() + + add_custom_target( + ${TARGET_NAME} + COMMAND ${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR} + --graphviz=${CMAKE_CURRENT_BINARY_DIR}/graphviz/${TARGET_NAME}.dot + COMMAND + ${DOT_EXE} -T${OUTPUT_TYPE} + ${CMAKE_CURRENT_BINARY_DIR}/graphviz/${TARGET_NAME}.dot -o + ${OUT_DIR}/${TARGET_NAME}.${OUTPUT_TYPE}) + + add_custom_command( + TARGET ${TARGET_NAME} + POST_BUILD + COMMAND ; + COMMENT + "Dependency graph for ${TARGET_NAME} generated and located at ${OUT_DIR}/${TARGET_NAME}.${OUTPUT_TYPE}" + ) + + if(gen_dep_graph_ADD_TO_DEP_GRAPH) + if(NOT TARGET dep-graph) + add_custom_target(dep-graph) + endif() + + add_dependencies(dep-graph ${TARGET_NAME}) + endif() + endif() +endfunction() diff --git a/config/sanitizer/formatting.cmake b/config/sanitizer/formatting.cmake index 5aaa2a6532f..181351dd25b 100644 --- a/config/sanitizer/formatting.cmake +++ b/config/sanitizer/formatting.cmake @@ -47,10 +47,7 @@ function(clang_format TARGET_NAME) # If the item is a target, then we'll attempt to grab the associated # source files from it. get_target_property(_TARGET_TYPE ${item} TYPE) - if(NOT - _TARGET_TYPE - STREQUAL - "INTERFACE_LIBRARY") + if(NOT _TARGET_TYPE STREQUAL "INTERFACE_LIBRARY") get_property( _TEMP TARGET ${item} @@ -71,22 +68,69 @@ function(clang_format TARGET_NAME) endforeach() # Make the target + if(FORMAT_FILES) + add_custom_target(${TARGET_NAME} COMMAND ${CLANG_FORMAT_EXE} -i + -style=file ${FORMAT_FILES}) + + if(NOT TARGET format) + add_custom_target(format) + endif() + + add_dependencies(format ${TARGET_NAME}) + endif() + + endif() +endfunction() + +# +# cmake-format +# +find_program(CMAKE_FORMAT_EXE "cmake-format") +mark_as_advanced(FORCE CMAKE_FORMAT_EXE) +if(CMAKE_FORMAT_EXE) + message(STATUS "cmake-format found: ${CMAKE_FORMAT_EXE}") +else() + message(STATUS "cmake-format not found!") +endif() + +# When called, this function will call 'cmake-format' program on all listed +# files (if both the program and the files exist and are found) +# ~~~ +# Required: +# TARGET_NAME - The name of the target to create. +# +# Optional: +# ARGN - Any arguments passed in will be considered as 'files' to perform the +# formatting on. Any items that are not files will be ignored. Both relative and +# absolute paths are accepted. +# ~~~ +function(cmake_format TARGET_NAME) + if(CMAKE_FORMAT_EXE) + set(FORMAT_FILES) + # Determine files that exist + foreach(iter IN LISTS ARGN) + if(EXISTS ${iter}) + set(FORMAT_FILES ${FORMAT_FILES} ${iter}) + elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${iter}) + set(FORMAT_FILES ${FORMAT_FILES} ${CMAKE_CURRENT_SOURCE_DIR}/${iter}) + endif() + endforeach() + + # Generate target if(FORMAT_FILES) if(TARGET ${TARGET_NAME}) message( ERROR - "Cannot create clang-format target '${TARGET_NAME}', already exists.") + "Cannot create cmake-format target '${TARGET_NAME}', already exists.") else() - add_custom_target(${TARGET_NAME} COMMAND ${CLANG_FORMAT_EXE} -i -style=file ${FORMAT_FILES}) + add_custom_target(${TARGET_NAME} COMMAND ${CMAKE_FORMAT_EXE} -i + ${FORMAT_FILES}) - if(NOT TARGET format) - add_custom_target(format) + if(NOT TARGET cmake-format) + add_custom_target(cmake-format) endif() - - add_dependencies(format ${TARGET_NAME}) + add_dependencies(cmake-format ${TARGET_NAME}) endif() endif() - endif() endfunction() - diff --git a/config/sanitizer/sanitizers.cmake b/config/sanitizer/sanitizers.cmake index 4ba043bac08..bf2aad27d7c 100644 --- a/config/sanitizer/sanitizers.cmake +++ b/config/sanitizer/sanitizers.cmake @@ -1,5 +1,5 @@ # -# Copyright (C) 2018 by George Cave - gcave@stablecoder.ca +# Copyright (C) 2018-2022 by George Cave - gcave@stablecoder.ca # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy of @@ -17,7 +17,7 @@ set(USE_SANITIZER "" CACHE STRING - "Compile with a sanitizer. Options are: Address, Memory, MemoryWithOrigins, Undefined, Thread, Leak, 'Address;Undefined'" + "Compile with a sanitizer. Options are: Address, Memory, MemoryWithOrigins, Undefined, Thread, Leak, 'Address;Undefined', CFI" ) function(append value) @@ -28,62 +28,166 @@ function(append value) endforeach(variable) endfunction() +function(append_quoteless value) + foreach(variable ${ARGN}) + set(${variable} + ${${variable}} ${value} + PARENT_SCOPE) + endforeach(variable) +endfunction() + +function(test_san_flags return_var flags) + set(QUIET_BACKUP ${CMAKE_REQUIRED_QUIET}) + set(CMAKE_REQUIRED_QUIET TRUE) + unset(${return_var} CACHE) + set(FLAGS_BACKUP ${CMAKE_REQUIRED_FLAGS}) + set(CMAKE_REQUIRED_FLAGS "${flags}") + check_c_source_compiles("int main() { return 0; }" ${return_var}) + set(CMAKE_REQUIRED_FLAGS "${FLAGS_BACKUP}") + set(CMAKE_REQUIRED_QUIET "${QUIET_BACKUP}") +endfunction() + message(STATUS "USE_SANITIZER=${USE_SANITIZER}, CMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}") if(USE_SANITIZER) if(CMAKE_C_COMPILER_ID MATCHES "IntelLLVM" OR CMAKE_C_COMPILER_ID MATCHES "[Cc]lang") set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + unset(SANITIZER_SELECTED_FLAGS) + if(UNIX) - append("-fno-omit-frame-pointer" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + append("-fno-omit-frame-pointer" CMAKE_C_FLAGS) message(STATUS "Building with sanitize, base flags=${CMAKE_C_SANITIZER_FLAGS}") if(uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG") - append("-O1" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + append("-O1" CMAKE_C_FLAGS) endif() - if(USE_SANITIZER MATCHES "([Aa]ddress);([Uu]ndefined)" - OR USE_SANITIZER MATCHES "([Uu]ndefined);([Aa]ddress)") - message(STATUS "Building with Address, Undefined sanitizers") - append("-fsanitize=address,undefined" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) - set(MEMCHECK_TYPE AddressSanitizer) - elseif(USE_SANITIZER MATCHES "([Aa]ddress)") + if(USE_SANITIZER MATCHES "([Aa]ddress)") # Optional: -fno-optimize-sibling-calls -fsanitize-address-use-after-scope - message(STATUS "Building with Address sanitizer") - append("-fsanitize=address" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) - set(MEMCHECK_TYPE AddressSanitizer) - elseif(USE_SANITIZER MATCHES "([Mm]emory([Ww]ith[Oo]rigins)?)") + message(STATUS "Testing with Address sanitizer") + set(SANITIZER_ADDR_FLAG "-fsanitize=address") + test_san_flags(SANITIZER_ADDR_AVAILABLE ${SANITIZER_ADDR_FLAG}) + if(SANITIZER_ADDR_AVAILABLE) + message(STATUS " Building with Address sanitizer") + append("${SANITIZER_ADDR_FLAG}" SANITIZER_SELECTED_FLAGS) + + if(AFL) + append_quoteless(AFL_USE_ASAN=1 CMAKE_C_COMPILER_LAUNCHER) + endif() + else() + message(FATAL_ERROR "Address sanitizer not available for ${CMAKE_C_COMPILER}") + endif() + endif() + + if(USE_SANITIZER MATCHES "([Mm]emory([Ww]ith[Oo]rigins)?)") # Optional: -fno-optimize-sibling-calls -fsanitize-memory-track-origins=2 - append("-fsanitize=memory" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + set(SANITIZER_MEM_FLAG "-fsanitize=memory") if(USE_SANITIZER MATCHES "([Mm]emory[Ww]ith[Oo]rigins)") - message(STATUS "Building with MemoryWithOrigins sanitizer") - append("-fsanitize-memory-track-origins" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + message(STATUS "Testing with MemoryWithOrigins sanitizer") + append("-fsanitize-memory-track-origins" SANITIZER_MEM_FLAG) else() - message(STATUS "Building with Memory sanitizer") + message(STATUS "Testing with Memory sanitizer") endif() - set(MEMCHECK_TYPE MemorySanitizer) - elseif(USE_SANITIZER MATCHES "([Uu]ndefined)") - message(STATUS "Building with Undefined sanitizer") - append("-fsanitize=undefined" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + test_san_flags(SANITIZER_MEM_AVAILABLE ${SANITIZER_MEM_FLAG}) + if(SANITIZER_MEM_AVAILABLE) + if(USE_SANITIZER MATCHES "([Mm]emory[Ww]ith[Oo]rigins)") + message(STATUS " Building with MemoryWithOrigins sanitizer") + else() + message(STATUS " Building with Memory sanitizer") + endif() + append("${SANITIZER_MEM_FLAG}" SANITIZER_SELECTED_FLAGS) + + if(AFL) + append_quoteless(AFL_USE_MSAN=1 CMAKE_C_COMPILER_LAUNCHER) + endif() + else() + message(FATAL_ERROR "Memory [With Origins] sanitizer not available for ${CMAKE_C_COMPILER}") + endif() + endif() + + if(USE_SANITIZER MATCHES "([Uu]ndefined)") + message(STATUS "Testing with Undefined Behaviour sanitizer") + set(SANITIZER_UB_FLAG "-fsanitize=undefined") if(EXISTS "${BLACKLIST_FILE}") - append("-fsanitize-blacklist=${BLACKLIST_FILE}" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + append("-fsanitize-blacklist=${BLACKLIST_FILE}" SANITIZER_UB_FLAG) endif() - set(MEMCHECK_TYPE UndefinedBehaviorSanitizer) - elseif(USE_SANITIZER MATCHES "([Tt]hread)") - message(STATUS "Building with Thread sanitizer") - append("-fsanitize=thread" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) - set(MEMCHECK_TYPE ThreadSanitizer) - elseif(USE_SANITIZER MATCHES "([Ll]eak)") - message(STATUS "Building with Leak sanitizer") - append("-fsanitize=leak" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) - set(MEMCHECK_TYPE LeakSanitizer) + test_san_flags(SANITIZER_UB_AVAILABLE ${SANITIZER_UB_FLAG}) + if(SANITIZER_UB_AVAILABLE) + message(STATUS " Building with Undefined Behaviour sanitizer") + append("${SANITIZER_UB_FLAG}" SANITIZER_SELECTED_FLAGS) + + if(AFL) + append_quoteless(AFL_USE_UBSAN=1 CMAKE_C_COMPILER_LAUNCHER) + endif() + else() + message(FATAL_ERROR "Undefined Behaviour sanitizer not available for ${CMAKE_C_COMPILER}") + endif() + endif() + + if(USE_SANITIZER MATCHES "([Tt]hread)") + message(STATUS "Testing with Thread sanitizer") + set(SANITIZER_THREAD_FLAG "-fsanitize=thread") + test_san_flags(SANITIZER_THREAD_AVAILABLE ${SANITIZER_THREAD_FLAG}) + if(SANITIZER_THREAD_AVAILABLE) + message(STATUS " Building with Thread sanitizer") + append("${SANITIZER_THREAD_FLAG}" SANITIZER_SELECTED_FLAGS) + + if(AFL) + append_quoteless(AFL_USE_TSAN=1 CMAKE_C_COMPILER_LAUNCHER) + endif() + else() + message(FATAL_ERROR "Thread sanitizer not available for ${CMAKE_C_COMPILER}") + endif() + endif() + + if(USE_SANITIZER MATCHES "([Ll]eak)") + message(STATUS "Testing with Leak sanitizer") + set(SANITIZER_LEAK_FLAG "-fsanitize=leak") + test_san_flags(SANITIZER_LEAK_AVAILABLE ${SANITIZER_LEAK_FLAG}) + if(SANITIZER_LEAK_AVAILABLE) + message(STATUS " Building with Leak sanitizer") + append("${SANITIZER_LEAK_FLAG}" SANITIZER_SELECTED_FLAGS) + + if(AFL) + append_quoteless(AFL_USE_LSAN=1 CMAKE_C_COMPILER_LAUNCHER) + endif() + else() + message(FATAL_ERROR "Thread sanitizer not available for ${CMAKE_C_COMPILER}") + endif() + endif() + + if(USE_SANITIZER MATCHES "([Cc][Ff][Ii])") + message(STATUS "Testing with Control Flow Integrity(CFI) sanitizer") + set(SANITIZER_CFI_FLAG "-fsanitize=cfi") + test_san_flags(SANITIZER_CFI_AVAILABLE ${SANITIZER_CFI_FLAG}) + if(SANITIZER_CFI_AVAILABLE) + message(STATUS " Building with Control Flow Integrity(CFI) sanitizer") + append("${SANITIZER_LEAK_FLAG}" SANITIZER_SELECTED_FLAGS) + + if(AFL) + append_quoteless(AFL_USE_CFISAN=1 CMAKE_C_COMPILER_LAUNCHER) + endif() + else() + message(FATAL_ERROR "Control Flow Integrity(CFI) sanitizer not available for ${CMAKE_C_COMPILER}") + endif() + endif() + + message(STATUS "Sanitizer flags: ${SANITIZER_SELECTED_FLAGS}") + test_san_flags(SANITIZER_SELECTED_COMPATIBLE ${SANITIZER_SELECTED_FLAGS}) + if(SANITIZER_SELECTED_COMPATIBLE) + message(STATUS " Building with ${SANITIZER_SELECTED_FLAGS}") + append("${SANITIZER_SELECTED_FLAGS}" CMAKE_C_FLAGS) else() - message( - FATAL_ERROR "Unsupported value of USE_SANITIZER: ${USE_SANITIZER}") + message(FATAL_ERROR "Unsupported value of USE_SANITIZER: ${USE_SANITIZER}") endif() elseif(MSVC) if(USE_SANITIZER MATCHES "([Aa]ddress)") message(STATUS "Building with Address sanitizer") - append("-fsanitize=address" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + append("-fsanitize=address" CMAKE_C_FLAGS) + + if(AFL) + append_quoteless(AFL_USE_ASAN=1 CMAKE_C_COMPILER_LAUNCHER) + endif() else() message(FATAL_ERROR "This sanitizer not yet supported in the MSVC environment: ${USE_SANITIZER}") endif() @@ -93,7 +197,7 @@ if(USE_SANITIZER) elseif(MSVC) if(USE_SANITIZER MATCHES "([Aa]ddress)") message(STATUS "Building with Address sanitizer") - append("/fsanitize=address" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + append("/fsanitize=address" CMAKE_C_FLAGS) else() message(FATAL_ERROR "This sanitizer not yet supported in the MSVC environment: ${USE_SANITIZER}") endif() diff --git a/config/sanitizer/tools.cmake b/config/sanitizer/tools.cmake index 88d3bafcb59..106f9c5d736 100644 --- a/config/sanitizer/tools.cmake +++ b/config/sanitizer/tools.cmake @@ -1,5 +1,5 @@ # -# Copyright (C) 2018-2020 by George Cave - gcave@stablecoder.ca +# Copyright (C) 2018-2023 by George Cave - gcave@stablecoder.ca # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy of @@ -13,91 +13,148 @@ # License for the specific language governing permissions and limitations under # the License. -option(CLANG_TIDY "Turns on clang-tidy processing if it is found." OFF) -if(CLANG_TIDY) - find_program(CLANG_TIDY_EXE NAMES "clang-tidy") - mark_as_advanced(FORCE CLANG_TIDY_EXE) +# CLANG-TIDY +find_program(CLANG_TIDY_EXE NAMES "clang-tidy") +set(CLANG_TIDY_MESSAGE_OUTPUT # Control output messages to occur only once + FALSE + CACHE INTERNAL FALSE) +mark_as_advanced(FORCE CLANG_TIDY_EXE CMAKE_C_CLANG_TIDY CMAKE_CXX_CLANG_TIDY) + +# Adds clang-tidy to code compiled after this macro. All arguments are added to +# the clang-tidy application call in the form of `clang-tidy ${ARGN}`. +# +# If the clang-tidy application is not found, the macro will cause CMake to +# produce an error and not generate. +# +# Options provided can be changed by calling the macro again with the new +# arguments. +macro(clang_tidy) + # Only want to output whether clang-tidy was found once + if(NOT CLANG_TIDY_MESSAGE_OUTPUT) + set(CLANG_TIDY_MESSAGE_OUTPUT TRUE) + if(CLANG_TIDY_EXE) + message(STATUS "clang-tidy found: ${CLANG_TIDY_EXE}") + else() + message(SEND_ERROR "clang-tidy not found!") + endif() + endif() + + # Only pass the options if the tool was found if(CLANG_TIDY_EXE) - message(STATUS "clang-tidy found: ${CLANG_TIDY_EXE}") - set(CMAKE_C_CLANG_TIDY ${CLANG_TIDY_EXE} --checks=-*,clang-analyzer-*)#${ARGN}) - set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY_EXE} --checks=-*,clang-analyzer-*)#${ARGN}) - else() - message(STATUS "clang-tidy not found!") - set(CMAKE_C_CLANG_TIDY "" CACHE STRING "" FORCE) # delete it - set(CMAKE_CXX_CLANG_TIDY "" CACHE STRING "" FORCE) # delete it + set(CMAKE_C_CLANG_TIDY + ${CLANG_TIDY_EXE} ${ARGN} + CACHE STRING "" FORCE) + set(CMAKE_CXX_CLANG_TIDY + ${CLANG_TIDY_EXE} ${ARGN} + CACHE STRING "" FORCE) endif() -else() - #message(STATUS "clang-tidy not enabled!") +endmacro() + +# Clears clang-tidy so it is not called on any following defined code +# compilation. clang-tidy can be re-enabled by another call to `clang_tidy()`. +macro(reset_clang_tidy) set(CMAKE_C_CLANG_TIDY "" - CACHE STRING "" FORCE) # delete it + CACHE STRING "" FORCE) set(CMAKE_CXX_CLANG_TIDY "" - CACHE STRING "" FORCE) # delete it -endif() + CACHE STRING "" FORCE) +endmacro() -# Adds clang-tidy checks to the compilation, with the given arguments being used -# as the options set. -macro(clang_tidy) - if(CLANG_TIDY AND CLANG_TIDY_EXE) - set(CMAKE_C_CLANG_TIDY ${CLANG_TIDY_EXE} ${ARGN}) - set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY_EXE} ${ARGN}) +# INCLUDE-WHAT-YOU-USE +find_program(IWYU_EXE NAMES "include-what-you-use") +set(IWYU_MESSAGE_OUTPUT # Control output messages to occur only once + FALSE + CACHE INTERNAL FALSE) +mark_as_advanced(FORCE IWYU_EXE CMAKE_C_INCLUDE_WHAT_YOU_USE + CMAKE_CXX_INCLUDE_WHAT_YOU_USE) + +# Adds include-what-you-use to code compiled after this macro. All arguments are +# added to the include-what-you-use application call in the form of +# `include-what-you-use ${ARGN}`. +# +# If the include-what-you-use application is not found, the macro will cause +# CMake to produce an error and not generate. +# +# Options provided can be changed by calling the macro again with the new +# arguments. +macro(include_what_you_use) + # Only want to output whether clang-tidy was found once + if(NOT IWYU_MESSAGE_OUTPUT) + set(IWYU_MESSAGE_OUTPUT TRUE) + if(IWYU_EXE) + message(STATUS "include-what-you-use found: ${IWYU_EXE}") + else() + message(SEND_ERROR "include-what-you-use not found!") + endif() endif() -endmacro() -option(IWYU "Turns on include-what-you-use processing if it is found." OFF) -if(IWYU) - find_program(IWYU_EXE NAMES "include-what-you-use") - mark_as_advanced(FORCE IWYU_EXE) + # Only pass the options if the tool was found if(IWYU_EXE) - message(STATUS "include-what-you-use found: ${IWYU_EXE}") - else() - message(SEND_ERROR "Cannot enable include-what-you-use, as executable not found!") - set(CMAKE_C_INCLUDE_WHAT_YOU_USE "" CACHE STRING "" FORCE) # delete it - set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "" CACHE STRING "" FORCE) # delete it + set(CMAKE_C_INCLUDE_WHAT_YOU_USE + ${IWYU_EXE} ${ARGN} + CACHE STRING "" FORCE) + set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE + ${IWYU_EXE} ${ARGN} + CACHE STRING "" FORCE) endif() -else() - #message(STATUS "include-what-you-use NOT ENABLED via 'IWYU' variable!") - set(CMAKE_C_INCLUDE_WHAT_YOU_USE "" CACHE STRING "" FORCE) # delete it - set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "" CACHE STRING "" FORCE) # delete it -endif() +endmacro() -# Adds include_what_you_use to the compilation, with the given arguments being -# used as the options set. -macro(include_what_you_use) - if(IWYU AND IWYU_EXE) - set(CMAKE_C_INCLUDE_WHAT_YOU_USE ${IWYU_EXE} ${ARGN}) - set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${IWYU_EXE} ${ARGN}) - endif() +# Clears include-what-you-use so it is not called on any following defined code +# compilation. It can be re-enabled by another call to `include_what_you_use()`. +macro(reset_include_what_you_use) + set(CMAKE_C_INCLUDE_WHAT_YOU_USE + "" + CACHE STRING "" FORCE) + set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE + "" + CACHE STRING "" FORCE) endmacro() -option(CPPCHECK "Turns on cppcheck processing if it is found." OFF) -if(CPPCHECK) +# CPPCHECK +find_program(CPPCHECK_EXE NAMES "cppcheck") +set(CPPCHECK_MESSAGE_OUTPUT # Control output messages to occur only once + FALSE + CACHE INTERNAL FALSE) +mark_as_advanced(FORCE CPPCHECK_EXE CMAKE_C_CPPCHECK CMAKE_CXX_CPPCHECK) + +# Adds cppcheck to code compiled after this macro. All arguments are added to +# the cppcheck application call in the form of `cppcheck ${ARGN}`. +# +# If the include-what-you-use application is not found, the macro will cause +# CMake to produce an error and not generate. +# +# Options provided can be changed by calling the macro again with the new +# arguments. +macro(cppcheck) + # Only want to output whether clang-tidy was found once + if(NOT CPPCHECK_MESSAGE_OUTPUT) + set(CPPCHECK_MESSAGE_OUTPUT TRUE) + if(CPPCHECK_EXE) + message(STATUS "cppcheck found: ${CPPCHECK_EXE}") + else() + message(SEND_ERROR "cppcheck not found!") + endif() + endif() + + # Only pass the options if the tool was found if(CPPCHECK_EXE) - message(STATUS "cppcheck found: ${CPPCHECK_EXE}") set(CMAKE_C_CPPCHECK - "${CPPCHECK_EXE};--enable=warning,performance,portability,missingInclude;--template=\"[{severity}][{id}] {message} {callstack} \(On {file}:{line}\)\";--suppress=missingIncludeSystem;--quiet;--verbose;--force" - ) + ${CPPCHECK_EXE} ${ARGN} + CACHE STRING "" FORCE) set(CMAKE_CXX_CPPCHECK - "${CPPCHECK_EXE};--enable=warning,performance,portability,missingInclude;--template=\"[{severity}][{id}] {message} {callstack} \(On {file}:{line}\)\";--suppress=missingIncludeSystem;--quiet;--verbose;--force" - ) - else() - message(SEND_ERROR "Cannot enable cppcheck, as executable not found!") - set(CMAKE_C_CPPCHECK "" CACHE STRING "" FORCE) # delete it - set(CMAKE_CXX_CPPCHECK "" CACHE STRING "" FORCE) # delete it - endif() -else() - # message(SEND_ERROR "cppcheck NOT ENABLED via 'CPPCHECK' variable!") - set(CMAKE_C_CPPCHECK "" CACHE STRING "" FORCE) # delete it - set(CMAKE_CXX_CPPCHECK "" CACHE STRING "" FORCE) # delete it -endif() - -# Adds cppcheck to the compilation, with the given arguments being used as the -# options set. -macro(cppcheck) - if(CPPCHECK AND CPPCHECK_EXE) - set(CMAKE_C_CPPCHECK ${CPPCHECK_EXE} ${ARGN}) - set(CMAKE_CXX_CPPCHECK ${CPPCHECK_EXE} ${ARGN}) + ${CPPCHECK_EXE} ${ARGN} + CACHE STRING "" FORCE) endif() endmacro() +# Clears include-what-you-use so it is not called on any following defined code +# compilation. It can be re-enabled by another call to `cppcheck()`. +macro(reset_cppcheck) + set(CMAKE_C_CPPCHECK + "" + CACHE STRING "" FORCE) + set(CMAKE_CXX_CPPCHECK + "" + CACHE STRING "" FORCE) +endmacro() diff --git a/configure.ac b/configure.ac index 92eff586868..30962b1adcf 100644 --- a/configure.ac +++ b/configure.ac @@ -652,6 +652,8 @@ if test "X$HDF_FORTRAN" = "Xyes"; then if test "X$HAVE_F2003_REQUIREMENTS" = "Xno"; then AC_MSG_ERROR([Fortran compiler lacks required Fortran 2003 features; unsupported Fortran 2003 compiler, remove --enable-fortran]) fi + ## Checking if the compiler supports fortran character being allocatable + PAC_HAVE_CHAR_ALLOC ## -------------------------------------------------------------------- ## Define wrappers for the C compiler to use Fortran function names @@ -710,6 +712,7 @@ if test "X$HDF_FORTRAN" = "Xyes"; then AC_SUBST([HAVE_Fortran_INTEGER_SIZEOF_16]) AC_SUBST([FORTRAN_HAVE_C_LONG_DOUBLE]) AC_SUBST([FORTRAN_C_LONG_DOUBLE_IS_UNIQUE]) + AC_SUBST([FORTRAN_C_BOOL_IS_UNIQUE]) AC_SUBST([H5CONFIG_F_NUM_RKIND]) AC_SUBST([H5CONFIG_F_RKIND]) AC_SUBST([H5CONFIG_F_RKIND_SIZEOF]) @@ -740,6 +743,10 @@ if test "X$HDF_FORTRAN" = "Xyes"; then AC_DEFINE([FORTRAN_HAVE_SIZEOF], [1], [Define if we have Fortran intrinsic SIZEOF]) fi + if test "X$HAVE_CHAR_ALLOC_FORTRAN" = "Xyes"; then + AC_DEFINE([FORTRAN_HAVE_CHAR_ALLOC], [1], [Define if Fortran supports allocatable character]) + fi + ## See if C_LONG_DOUBLE is available PAC_PROG_FC_HAVE_C_LONG_DOUBLE @@ -761,6 +768,16 @@ if test "X$HDF_FORTRAN" = "Xyes"; then fi fi + ## Is C_BOOL different from default LOGICAL + FORTRAN_C_BOOL_IS_UNIQUE="0" + PAC_PROG_FC_C_BOOL_EQ_LOGICAL + if test "X$C_BOOL_IS_UNIQUE_FORTRAN" = "Xyes"; then + FORTRAN_C_BOOL_IS_UNIQUE="1" + AC_DEFINE([FORTRAN_C_BOOL_IS_UNIQUE], [1], [Define if Fortran C_BOOL is different from default LOGICAL]) + else + FORTRAN_C_BOOL_IS_UNIQUE="0" + fi + FORTRAN_SIZEOF_LONG_DOUBLE=${ac_cv_sizeof_long_double} AC_DEFINE_UNQUOTED([FORTRAN_SIZEOF_LONG_DOUBLE], ["${ac_cv_sizeof_long_double}"], [Determine the size of C long double]) @@ -1220,14 +1237,14 @@ AC_MSG_RESULT([$HDF5_DOXYGEN]) ## This needs to be exposed for the library info file. AC_SUBST([HDF5_DOXY_WARNINGS]) -## Default is to consider doxygen warnings as errors +## Default is not to consider doxygen warnings as errors DOXY_ERR=yes AC_MSG_CHECKING([if doxygen warnings as errors is enabled]) AC_ARG_ENABLE([doxygen-errors], [AS_HELP_STRING([--enable-doxygen-errors], - [Error on HDF5 doxygen warnings [default=yes]])], + [Error on HDF5 doxygen warnings [default=no]])], [DOXY_ERR=$enableval]) if test "X$DOXY_ERR" = "Xyes"; then @@ -2555,8 +2572,8 @@ AC_SUBST([INTERNAL_DEBUG_OUTPUT]) ## too specialized or have huge performance hits. These ## are not listed in the "all" packages list. ## -## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,MM,O,S,T,Z" -all_packages="AC,B2,CX,D,F,HL,I,MM,O,S,T,Z" +## all_packages="AC,B,B2,D,F,FA,FL,FS,MM,O,S,T,Z" +all_packages="AC,B2,CX,D,F,MM,O,S,T,Z" case "X-$INTERNAL_DEBUG_OUTPUT" in X-yes|X-all) @@ -2840,6 +2857,25 @@ if test -n "$PARALLEL"; then AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])] ) + + AC_LANG_PUSH([Fortran]) + AC_MSG_CHECKING([for MPI-3 module mpi_f08]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([], + [ + USE mpi_f08 + IMPLICIT NONE + TYPE(MPI_Comm) :: comm + TYPE(MPI_INFO) :: info + ] + ) + ], + [AC_DEFINE([HAVE_MPI_F08], [1], + [Define if mpi_f08 module exist]) + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])] + ) + AC_LANG_POP(Fortran) fi ## ---------------------------------------------------------------------- diff --git a/doc/img/release-schedule.plantuml b/doc/img/release-schedule.plantuml index 57a86b9c3e2..28535b07e6f 100644 --- a/doc/img/release-schedule.plantuml +++ b/doc/img/release-schedule.plantuml @@ -7,36 +7,33 @@ The current script: title HDF5 Release Schedule projectscale monthly -Project starts 2022-01-01 +Project starts 2023-01-01 -[1.8] starts 2022-01-01 and lasts 57 weeks +[1.8] starts 2023-01-01 and lasts 5 weeks [1.8.23] happens 2023-01-31 [1.8] is colored in #F76969 -[1.10] starts 2022-01-01 and lasts 91 weeks -[1.10.9] happens 2022-05-31 +[1.10] starts 2023-01-01 and lasts 39 weeks [1.10.10] happens 2023-03-31 [1.10.11] happens 2023-09-30 -[1.10.10] displays on same row as [1.10.9] -[1.10.11] displays on same row as [1.10.9] +[1.10.11] displays on same row as [1.10.10] [1.10] is colored in #F6DD60 -[1.12] starts 2022-01-01 and lasts 100 weeks -[1.12.2] happens 2022-04-30 +[1.12] starts 2023-01-01 and lasts 48 weeks [1.12.3] happens 2023-11-30 -[1.12.3] displays on same row as [1.12.2] [1.12] is colored in #88CCEE -[1.14] starts at 2023-01-01 and lasts 78 weeks -[1.14.0] happens at 2022-12-31 +[1.14] starts at 2023-01-01 and lasts 104 weeks [1.14.1] happens at 2023-04-30 [1.14.2] happens at 2023-08-31 [1.14.3] happens at 2023-10-31 [1.14.4] happens at 2024-03-31 -[1.14.1] displays on same row as [1.14.0] -[1.14.2] displays on same row as [1.14.0] -[1.14.3] displays on same row as [1.14.0] -[1.14.4] displays on same row as [1.14.0] +[1.14.5] happens at 2024-09-30 +[1.14.1] displays on same row as [1.14.1] +[1.14.2] displays on same row as [1.14.1] +[1.14.3] displays on same row as [1.14.1] +[1.14.4] displays on same row as [1.14.1] +[1.14.5] displays on same row as [1.14.1] [1.14] is colored in #B187CF @endgantt diff --git a/doc/img/release-schedule.png b/doc/img/release-schedule.png old mode 100644 new mode 100755 index dc051ed2b8c..ce69e665d33 Binary files a/doc/img/release-schedule.png and b/doc/img/release-schedule.png differ diff --git a/doc/parallel-compression.md b/doc/parallel-compression.md index efe685c3a65..f55e6b36a82 100644 --- a/doc/parallel-compression.md +++ b/doc/parallel-compression.md @@ -64,9 +64,9 @@ H5Dwrite(..., dxpl_id, ...); The following are two simple examples of using the parallel compression feature: -[ph5_filtered_writes.c](https://github.com/HDFGroup/hdf5/blob/develop/examples/ph5_filtered_writes.c) +[ph5_filtered_writes.c](https://github.com/HDFGroup/hdf5/blob/develop/HDF5Examples/C/H5PAR/ph5_filtered_writes.c) -[ph5_filtered_writes_no_sel.c](https://github.com/HDFGroup/hdf5/blob/develop/examples/ph5_filtered_writes_no_sel.c) +[ph5_filtered_writes_no_sel.c](https://github.com/HDFGroup/hdf5/blob/develop/HDF5Examples/C/H5PAR/ph5_filtered_writes_no_sel.c) The former contains simple examples of using the parallel compression feature to write to compressed datasets, while the diff --git a/doxygen/dox/LearnBasics3.dox b/doxygen/dox/LearnBasics3.dox index abfb7b1c3de..1955f1fc8b8 100644 --- a/doxygen/dox/LearnBasics3.dox +++ b/doxygen/dox/LearnBasics3.dox @@ -288,7 +288,7 @@ is met, at a certain point in the future.) \section secLBContentsProg Programming Example -\subsection subsecLBContentsProgUsing Using #H5Literate, #H5Lvisit and #H5Ovisit +\subsection subsecLBContentsProgUsing Using H5Literate, H5Lvisit and H5Ovisit For example code, see the \ref HDF5Examples page. Specifically look at the \ref ExAPI. There are examples for different languages, where examples of using #H5Literate and #H5Ovisit/#H5Lvisit are included. diff --git a/doxygen/dox/PredefinedDatatypeTables.dox b/doxygen/dox/PredefinedDatatypeTables.dox index fbafa9443e0..0b40516161e 100644 --- a/doxygen/dox/PredefinedDatatypeTables.dox +++ b/doxygen/dox/PredefinedDatatypeTables.dox @@ -1,22 +1,41 @@ /** \page predefined_datatypes_tables HDF5 Predefined Datatypes + * + * \section sec_predefined_datatypes_tables HDF5 Predefined Datatypes * * The following datatypes are predefined in HDF5. - * + *
* \snippet{doc} tables/predefinedDatatypes.dox predefined_ieee_datatypes_table + *
* + *
* \snippet{doc} tables/predefinedDatatypes.dox predefined_std_datatypes_table - * + *
+ * + *
* \snippet{doc} tables/predefinedDatatypes.dox predefined_unix_datatypes_table - * + *
+ * + *
* \snippet{doc} tables/predefinedDatatypes.dox predefined_string_datatypes_table - * + *
+ * + *
* \snippet{doc} tables/predefinedDatatypes.dox predefined_intel_datatypes_table - * + *
+ * + *
* \snippet{doc} tables/predefinedDatatypes.dox predefined_dec_datatypes_table - * + *
+ * + *
* \snippet{doc} tables/predefinedDatatypes.dox predefined_mips_datatypes_table - * + *
+ * + *
* \snippet{doc} tables/predefinedDatatypes.dox predefined_native_datatypes_table - * + *
+ * + *
* \snippet{doc} tables/predefinedDatatypes.dox predefined_c9x_datatypes_table + *
*/ diff --git a/doxygen/examples/H5.format.html b/doxygen/examples/H5.format.html index 832e3fcd79b..7aba5fed440 100644 --- a/doxygen/examples/H5.format.html +++ b/doxygen/examples/H5.format.html @@ -10780,6 +10780,12 @@

IV.A.2.d. The Datatype Message

Class specific information for the Reference class (Class 7):

+

Note that for region references, the stored data is + a Global Heap ID pointing to information + about the region stored in the global heap. +

+ +
- + diff --git a/doxygen/examples/H5E_examples.c b/doxygen/examples/H5E_examples.c index deea838ea6b..bd0ac614fbb 100644 --- a/doxygen/examples/H5E_examples.c +++ b/doxygen/examples/H5E_examples.c @@ -6,6 +6,9 @@ #include #include +#define RESET "\x1b[0m" +#define RED "\x1b[31m" + int main(void) { @@ -34,8 +37,8 @@ main(void) } // push a custom error message onto the default stack - if (H5Epush2(H5E_DEFAULT, __FILE__, __FUNCTION__, __LINE__, cls, major, minor, "Hello, Error!\n") < - 0) { + if (H5Epush2(H5E_DEFAULT, __FILE__, __FUNCTION__, __LINE__, cls, major, minor, "%s Hello, error %s\n", + RED, RESET) < 0) { ret_val = EXIT_FAILURE; goto fail_push; } diff --git a/doxygen/examples/tables/fileDriverLists.dox b/doxygen/examples/tables/fileDriverLists.dox index b1f873f063d..437d32a7b93 100644 --- a/doxygen/examples/tables/fileDriverLists.dox +++ b/doxygen/examples/tables/fileDriverLists.dox @@ -1,5 +1,4 @@ /** File Driver List - * //! [file_driver_table]
@@ -11118,6 +11124,11 @@

IV.A.2.d. The Datatype Message

Class specific information for the Variable-length class (Class 9):

+

Note that data with a variable length type is stored on the global heap. + Locations that would normally store the data directly (e.g. attribute message) + will instead contain a Global Heap ID. +

+
- +
@@ -11276,7 +11287,7 @@

IV.A.2.d. The Datatype Message


Base Type


Parent Type Message

@@ -11294,11 +11305,14 @@

IV.A.2.d. The Datatype Message

Base Type

Parent Type

-

Each variable-length type is based on some parent type. The - information for that parent type is described recursively by - this field. +

Each variable-length type is based on some parent type. + This field contains the datatype message describing that parent type. + In the case of nested variable-length types, this parent datatype message will + recursively contain all parent datatype messages. + + Variable-length strings are considered to have the parent type `H5T_NATIVE_UCHAR`.

@@ -70,7 +69,6 @@
I/O file drivers
//! [file_driver_table] * - * //! [supported_file_driver_table] diff --git a/examples/CMakeTests.cmake b/examples/CMakeTests.cmake index 09f90607054..96578b3db65 100644 --- a/examples/CMakeTests.cmake +++ b/examples/CMakeTests.cmake @@ -74,7 +74,7 @@ if (HDF5_TEST_SERIAL) ) foreach (example ${examples}) - if (HDF5_ENABLE_USING_MEMCHECKER) + if (HDF5_USING_ANALYSIS_TOOL) add_test (NAME EXAMPLES-${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME EXAMPLES-${example} COMMAND "${CMAKE_COMMAND}" diff --git a/examples/testh5cc.sh.in b/examples/testh5cc.sh.in index 40771ec9df3..f95108ddb99 100644 --- a/examples/testh5cc.sh.in +++ b/examples/testh5cc.sh.in @@ -69,6 +69,8 @@ prog1=${H5TOOL}_prog1.$suffix prog1_o=${H5TOOL}_prog1.o prog2=${H5TOOL}_prog2.$suffix prog2_o=${H5TOOL}_prog2.o +args=${H5TOOL}_args.$suffix +args_o=${H5TOOL}_args.o applib=libapp${H5TOOL}.a # short hands @@ -327,16 +329,38 @@ main (void) } EOF +# Generate args: +# An application main that test misc command line arguments being passed. +cat > $args <) else () add_test (NAME f90_ex_${example} COMMAND "${CMAKE_COMMAND}" @@ -77,7 +77,7 @@ if (HDF5_TEST_SERIAL) endforeach () foreach (example ${F2003_examples}) - if (HDF5_ENABLE_USING_MEMCHECKER) + if (HDF5_USING_ANALYSIS_TOOL) add_test (NAME f03_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME f03_ex_${example} COMMAND "${CMAKE_COMMAND}" diff --git a/fortran/examples/testh5fc.sh.in b/fortran/examples/testh5fc.sh.in index 0328bbbaea7..f8f3706a4e7 100644 --- a/fortran/examples/testh5fc.sh.in +++ b/fortran/examples/testh5fc.sh.in @@ -42,11 +42,13 @@ myos=`uname -s` myhostnama=`uname -n` # Generate some source files and library for tests. -suffix=f90 # source file suffix +suffix=F90 # source file suffix hdf5main=${H5TOOL}_hdf5main.$suffix hdf5main_o=${H5TOOL}_hdf5main.o appmain=${H5TOOL}_appmain.$suffix appmain_o=${H5TOOL}_appmain.o +args=${H5TOOL}_args.$suffix +args_o=${H5TOOL}_args.o prog1=${H5TOOL}_prog1.$suffix prog1_o=${H5TOOL}_prog1.o prog2=${H5TOOL}_prog2.$suffix @@ -106,7 +108,7 @@ cat > $hdf5main < $hdf5main < $args < 0) - c_name = (char *)malloc(c_namelen + 1); - - if (!c_name) - HGOTO_DONE(FAIL); - - /* - * Call H5Eget_msg function. - */ - H5Eget_msg((hid_t)*error_no, NULL, c_name, c_namelen); - HD5packFstring((char *)c_name, _fcdtocp(name), c_namelen); - if (!strcmp(c_name, "Invalid major error number")) - HGOTO_DONE(FAIL); - -done: - if (c_name) - free(c_name); - - return ret_value; -} - -/****if* H5Ef/h5eget_minor_c - * NAME - * h5eget_minor_c - * PURPOSE - * Get a character string describing an error specified by a - * minor error number. - * INPUTS - * error_no - Major error number - * OUTPUTS - * name - character string describing the error - * RETURNS - * 0 on success, -1 on failure - * SOURCE - */ -int_f -h5eget_minor_c(int_f *error_no, _fcd name, size_t_f *namelen) -/******/ -{ - char *c_name = NULL; - size_t c_namelen = (size_t)*namelen; - int_f ret_value = 0; - - if (c_namelen > 0) - c_name = (char *)malloc(c_namelen + 1); - - if (!c_name) - HGOTO_DONE(FAIL); - - /* - * Call H5Eget_msg function. - */ - H5Eget_msg((hid_t)*error_no, NULL, c_name, c_namelen); - HD5packFstring((char *)c_name, _fcdtocp(name), c_namelen); - if (!strcmp(c_name, "Invalid minor error number")) - HGOTO_DONE(FAIL); - -done: - if (c_name) - free(c_name); - - return ret_value; -} - /****if* H5Ef/h5eset_auto2_c * NAME * h5eset_auto2_c @@ -221,18 +79,6 @@ h5eget_minor_c(int_f *error_no, _fcd name, size_t_f *namelen) * 0 on success, -1 on failure * SOURCE */ -/* int_f */ -/* h5eset_auto2_c(hid_t_f *estack_id, H5E_auto2_t *func, void *client_data) */ -/* /\******\/ */ -/* { */ -/* int ret_val = -1; */ -/* herr_t status = -1; */ - -/* status = H5Eset_auto2((hid_t)*estack_id, *func, client_data); */ -/* if (status >= 0) ret_val = 0; */ -/* return ret_val; */ -/* } */ - int_f h5eset_auto2_c(int_f *printflag, hid_t_f *estack_id, H5E_auto2_t func, void *client_data) /******/ @@ -251,3 +97,34 @@ h5eset_auto2_c(int_f *printflag, hid_t_f *estack_id, H5E_auto2_t func, void *cli return ret_val; } + +int_f +h5epush_c(hid_t_f *err_stack, hid_t_f *cls_id, hid_t_f *maj_id, hid_t_f *min_id, _fcd msg, size_t_f *msg_len, + char *file, char *func, int *line, const char *arg1, const char *arg2, const char *arg3, + const char *arg4, const char *arg5, const char *arg6, const char *arg7, const char *arg8, + const char *arg9, const char *arg10, const char *arg11, const char *arg12, const char *arg13, + const char *arg14, const char *arg15, const char *arg16, const char *arg17, const char *arg18, + const char *arg19, const char *arg20) +/******/ +{ + + char *c_msg = NULL; /* Buffer to hold C string */ + int_f ret_value = 0; /* Return value */ + + /* + * Convert FORTRAN name to C name + */ + + if (NULL == (c_msg = HD5f2cstring(msg, (size_t)*msg_len))) + HGOTO_DONE(FAIL); + + if (H5Epush2((hid_t)*err_stack, file, func, (unsigned int)*line, (hid_t)*cls_id, (hid_t)*maj_id, + (hid_t)*min_id, c_msg, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, + arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20) < 0) + HGOTO_DONE(FAIL); + +done: + if (c_msg) + free(c_msg); + return ret_value; +} diff --git a/fortran/src/H5Eff.F90 b/fortran/src/H5Eff.F90 index 4ef18c126f3..9ea28079451 100644 --- a/fortran/src/H5Eff.F90 +++ b/fortran/src/H5Eff.F90 @@ -34,15 +34,43 @@ ! to the Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! +! MISSING: H5Eauto_is_v2, H5Eget_auto2 MODULE H5E USE H5GLOBAL + USE H5fortkit IMPLICIT NONE INTEGER, PARAMETER :: PRINTON = 1 !< Turn on automatic printing of errors INTEGER, PARAMETER :: PRINTOFF = 0 !< Turn off automatic printing of errors +!> @brief h5e_error_t derived type + TYPE, BIND(C) :: h5e_error_t + INTEGER(HID_T) :: cls_id !< Class ID + INTEGER(HID_T) :: maj_num !< Major error ID + INTEGER(HID_T) :: min_num !< Minor error number + INTEGER(C_INT) :: line !< Line in file where error occurs + TYPE(C_PTR) :: func_name !< Function in which error occurred + TYPE(C_PTR) :: file_name !< File in which error occurred + TYPE(C_PTR) :: desc !< Optional supplied description + END TYPE h5e_error_t + + INTERFACE h5eprint_f + MODULE PROCEDURE h5eprint1_f + MODULE PROCEDURE h5eprint2_f + END INTERFACE h5eprint_f + + INTERFACE + INTEGER FUNCTION h5eprint_c(err_stack, name, namelen) BIND(C,NAME='h5eprint_c') + IMPORT :: C_CHAR, HID_T, C_PTR + IMPLICIT NONE + INTEGER(HID_T) :: err_stack + CHARACTER(KIND=C_CHAR), DIMENSION(*) :: name + TYPE(C_PTR), VALUE :: namelen + END FUNCTION h5eprint_c + END INTERFACE + CONTAINS !> @@ -62,19 +90,20 @@ SUBROUTINE h5eclear_f(hdferr, estack_id) INTEGER(HID_T) :: estack_id_default INTERFACE - INTEGER FUNCTION h5eclear_c(estack_id_default) BIND(C,NAME='h5eclear_c') - IMPORT :: HID_T + INTEGER(C_INT) FUNCTION H5Eclear(err_stack) BIND(C,NAME='H5Eclear2') + IMPORT :: C_INT, HID_T IMPLICIT NONE - INTEGER(HID_T) :: estack_id_default - END FUNCTION h5eclear_c + INTEGER(HID_T), VALUE :: err_stack + END FUNCTION H5Eclear END INTERFACE estack_id_default = H5E_DEFAULT_F IF(PRESENT(estack_id)) estack_id_default = estack_id - hdferr = h5eclear_c(estack_id_default) + hdferr = INT(H5Eclear(estack_id_default)) END SUBROUTINE h5eclear_f +#ifdef H5_DOXYGEN !> !! \ingroup FH5E !! @@ -83,34 +112,66 @@ END SUBROUTINE h5eclear_f !! \param hdferr \fortran_error !! \param name Name of the file that contains print output !! -!! See C API: @ref H5Eprint2() +!! \note If \p name is not specified, the output will be sent to +!! the standard error (stderr). +!! +!! \attention Deprecated. +!! +!! See C API: @ref H5Eprint1() !! SUBROUTINE h5eprint_f(hdferr, name) CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: name INTEGER, INTENT(OUT) :: hdferr - INTEGER :: namelen + END SUBROUTINE h5eprint_f - INTERFACE - INTEGER FUNCTION h5eprint_c1(name, namelen) BIND(C,NAME='h5eprint_c1') - IMPORT :: C_CHAR - IMPLICIT NONE - INTEGER :: namelen - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name - END FUNCTION h5eprint_c1 - END INTERFACE +!! \ingroup FH5E +!! +!! \brief Prints the error stack in a default manner. +!! +!! \param err_stack Error stack identifier +!! \param hdferr \fortran_error +!! \param name Name of the file that contains print output +!! +!! \note If \p name is not specified, the output will be sent to +!! the standard error (stderr). +!! +!! See C API: @ref H5Eprint2() +!! + SUBROUTINE h5eprint_f(err_stack, hdferr, name) + INTEGER(HID_T) , INTENT(IN) :: err_stack + INTEGER , INTENT(OUT) :: hdferr + CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: name + END SUBROUTINE h5eprint_f - INTERFACE - INTEGER FUNCTION h5eprint_c2() BIND(C,NAME='h5eprint_c2') - END FUNCTION h5eprint_c2 - END INTERFACE +#else + + SUBROUTINE h5eprint1_f(hdferr, name) + CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: name + INTEGER, INTENT(OUT) :: hdferr + + CALL h5eprint2_f(H5E_DEFAULT_F, hdferr, name) + + END SUBROUTINE h5eprint1_f + + SUBROUTINE h5eprint2_f(err_stack, hdferr, name) + INTEGER(HID_T), INTENT(IN) :: err_stack + CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: name + INTEGER, INTENT(OUT) :: hdferr + + INTEGER(SIZE_T), TARGET :: namelen + TYPE(C_PTR) :: c_namelen IF (PRESENT(name)) THEN - namelen = LEN(NAME) - hdferr = h5eprint_c1(name, namelen) + namelen = LEN(NAME, SIZE_T) + c_namelen = C_LOC(namelen) + hdferr = h5eprint_c(err_stack, name, c_namelen) ELSE - hdferr = h5eprint_c2() + hdferr = h5eprint_c(err_stack, C_NULL_CHAR, C_NULL_PTR) ENDIF - END SUBROUTINE h5eprint_f + END SUBROUTINE h5eprint2_f + +#endif + !> !! \ingroup FH5E !! @@ -121,25 +182,23 @@ END SUBROUTINE h5eprint_f !! \param namelen Number of characters in the name buffer. !! \param hdferr \fortran_error !! +!! \attention Deprecated: use H5Eget_msg_f() instead. +!! !! See C API: @ref H5Eget_major() !! SUBROUTINE h5eget_major_f(error_no, name, namelen, hdferr) - INTEGER, INTENT(IN) :: error_no - CHARACTER(LEN=*), INTENT(OUT) :: name - INTEGER(SIZE_T), INTENT(IN) :: namelen + INTEGER(HID_T) , INTENT(IN) :: error_no + CHARACTER(LEN=*), INTENT(OUT) :: name + INTEGER(SIZE_T) , INTENT(INOUT) :: namelen INTEGER, INTENT(OUT) :: hdferr - INTERFACE - INTEGER FUNCTION h5eget_major_c(error_no, name, namelen) BIND(C,NAME='h5eget_major_c') - IMPORT :: C_CHAR - IMPORT :: SIZE_T - IMPLICIT NONE - INTEGER :: error_no - CHARACTER(KIND=C_CHAR), DIMENSION(*) :: name - INTEGER(SIZE_T), INTENT(IN) :: namelen - END FUNCTION h5eget_major_c - END INTERFACE - hdferr = h5eget_major_c(error_no, name, namelen) + INTEGER :: msg_type + INTEGER(SIZE_T) :: namelen2 + + namelen2 = namelen + + CALL H5Eget_msg_f(error_no, msg_type, name, hdferr, namelen2) + END SUBROUTINE h5eget_major_f !> !! \ingroup FH5E @@ -150,23 +209,20 @@ END SUBROUTINE h5eget_major_f !! \param name Character string describing the error. !! \param hdferr \fortran_error !! +!! \attention Deprecated: use H5Eget_msg_f() instead. +!! !! See C API: @ref H5Eget_minor() !! SUBROUTINE h5eget_minor_f(error_no, name, hdferr) - INTEGER, INTENT(IN) :: error_no + INTEGER(HID_T) , INTENT(IN) :: error_no CHARACTER(LEN=*), INTENT(OUT) :: name INTEGER, INTENT(OUT) :: hdferr - INTERFACE - INTEGER FUNCTION h5eget_minor_c(error_no, name) BIND(C,NAME='h5eget_minor_c') - IMPORT :: C_CHAR - INTEGER :: error_no - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(OUT) :: name - END FUNCTION h5eget_minor_c - END INTERFACE - hdferr = h5eget_minor_c(error_no, name) - END SUBROUTINE h5eget_minor_f + INTEGER :: msg_type + CALL H5Eget_msg_f(error_no, msg_type, name, hdferr) + + END SUBROUTINE h5eget_minor_f !> !! \ingroup FH5E !! @@ -214,6 +270,705 @@ END FUNCTION h5eset_auto2_c hdferr = h5eset_auto2_c(printflag, estack_id_default, func_default, client_data_default) END SUBROUTINE h5eset_auto_f +!> +!! \ingroup FH5E +!! +!! \brief Pushes a new error record onto an error stack. +!! +!! \param err_stack Error stack identifier. If the identifier is H5E_DEFAULT_F, the error +!! record will be pushed to the current stack. +!! \param cls_id Error class identifier +!! \param maj_id Major error identifier +!! \param min_id Minor error identifier +!! \param msg Error description string +!! \param hdferr \fortran_error +!! \param file Name of the file in which the error was detected +!! \param func Name of the function in which the error was detected +!! \param line Line number in the file where the error was detected +!! \param arg1 C style format control strings +!! \param arg2 C style format control strings +!! \param arg3 C style format control strings +!! \param arg4 C style format control strings +!! \param arg5 C style format control strings +!! \param arg6 C style format control strings +!! \param arg7 C style format control strings +!! \param arg8 C style format control strings +!! \param arg9 C style format control strings +!! \param arg10 C style format control strings +!! \param arg11 C style format control strings +!! \param arg12 C style format control strings +!! \param arg13 C style format control strings +!! \param arg14 C style format control strings +!! \param arg15 C style format control strings +!! \param arg16 C style format control strings +!! \param arg17 C style format control strings +!! \param arg18 C style format control strings +!! \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: +!!

+!! \code +!! (..., "%s TEXT %s"//C_NEW_LINE, hdferr, ..., arg1=ACHAR(27)//"[31m", arg2=ACHAR(27)//"[0m" ) +!! \endcode +!!
Using "\n" instead of C_NEW_LINE will not be interpereted correctly, and similarly, +!! using "\x1B" instead of ACHAR(27) +!! +!! +!! See C API: @ref H5Epush2() +!! + SUBROUTINE h5epush_f(err_stack, cls_id, maj_id, min_id, msg, hdferr, & + file, func, line, & + arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, & + arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: err_stack + INTEGER(HID_T), INTENT(IN) :: cls_id + INTEGER(HID_T), INTENT(IN) :: maj_id + INTEGER(HID_T), INTENT(IN) :: min_id + CHARACTER(LEN=*), INTENT(IN) :: msg + INTEGER, INTENT(OUT) :: hdferr + + TYPE(C_PTR), OPTIONAL :: file + TYPE(C_PTR), OPTIONAL :: func + TYPE(C_PTR), OPTIONAL :: line + CHARACTER(LEN=*), OPTIONAL, TARGET :: arg1, arg2, arg3, arg4, arg5, & + arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, & + arg16, arg17, arg18, arg19, arg20 + + TYPE(C_PTR) :: file_def = C_NULL_PTR + TYPE(C_PTR) :: func_def = C_NULL_PTR + TYPE(C_PTR) :: line_def = C_NULL_PTR + TYPE(C_PTR) :: arg1_def = C_NULL_PTR, arg2_def = C_NULL_PTR, & + arg3_def = C_NULL_PTR, arg4_def = C_NULL_PTR, & + arg5_def = C_NULL_PTR, arg6_def = C_NULL_PTR, & + arg7_def = C_NULL_PTR, arg8_def = C_NULL_PTR, & + arg9_def = C_NULL_PTR, arg10_def = C_NULL_PTR, & + arg11_def = C_NULL_PTR, arg12_def = C_NULL_PTR, & + arg13_def = C_NULL_PTR, arg14_def = C_NULL_PTR, & + arg15_def = C_NULL_PTR, arg16_def = C_NULL_PTR, & + arg17_def = C_NULL_PTR, arg18_def = C_NULL_PTR, & + arg19_def = C_NULL_PTR, arg20_def = C_NULL_PTR + + INTERFACE + INTEGER FUNCTION h5epush_c(err_stack, cls_id, maj_id, min_id, msg, msg_len, file, func, line, & + arg1, arg2, arg3, arg4, arg5, & + arg6, arg7, arg8, arg9, arg10, & + arg11, arg12, arg13, arg14, arg15, & + arg16, arg17, arg18, arg19, arg20) BIND(C, NAME='h5epush_c') + + IMPORT :: C_CHAR, C_INT, C_PTR + IMPORT :: HID_T + IMPLICIT NONE + INTEGER(HID_T) :: err_stack + INTEGER(HID_T) :: cls_id + INTEGER(HID_T) :: maj_id + INTEGER(HID_T) :: min_id + CHARACTER(KIND=C_CHAR), DIMENSION(*) :: msg + INTEGER :: msg_len + + TYPE(C_PTR), VALUE :: file + TYPE(C_PTR), VALUE :: func + TYPE(C_PTR), VALUE :: line + TYPE(C_PTR), VALUE :: arg1, arg2, arg3, arg4, & + arg5, arg6, arg7, arg8, & + arg9, arg10, arg11, arg12, & + arg13, arg14, arg15, arg16, & + arg17, arg18, arg19, arg20 + + END FUNCTION h5epush_c + END INTERFACE + + IF (PRESENT(file)) file_def = file + IF (PRESENT(func)) func_def = func + IF (PRESENT(line)) line_def = line + + IF (PRESENT(arg1)) arg1_def = C_LOC(arg1(1:1)) + IF (PRESENT(arg2)) arg2_def = C_LOC(arg2(1:1)) + IF (PRESENT(arg3)) arg3_def = C_LOC(arg3(1:1)) + IF (PRESENT(arg4)) arg4_def = C_LOC(arg4(1:1)) + IF (PRESENT(arg5)) arg5_def = C_LOC(arg5(1:1)) + IF (PRESENT(arg6)) arg6_def = C_LOC(arg6(1:1)) + IF (PRESENT(arg7)) arg7_def = C_LOC(arg7(1:1)) + IF (PRESENT(arg8)) arg8_def = C_LOC(arg8(1:1)) + IF (PRESENT(arg9)) arg9_def = C_LOC(arg9(1:1)) + IF (PRESENT(arg10)) arg10_def = C_LOC(arg10(1:1)) + IF (PRESENT(arg11)) arg11_def = C_LOC(arg11(1:1)) + IF (PRESENT(arg12)) arg12_def = C_LOC(arg12(1:1)) + IF (PRESENT(arg13)) arg13_def = C_LOC(arg13(1:1)) + IF (PRESENT(arg14)) arg14_def = C_LOC(arg14(1:1)) + IF (PRESENT(arg15)) arg15_def = C_LOC(arg15(1:1)) + IF (PRESENT(arg16)) arg16_def = C_LOC(arg16(1:1)) + IF (PRESENT(arg17)) arg17_def = C_LOC(arg17(1:1)) + IF (PRESENT(arg18)) arg18_def = C_LOC(arg18(1:1)) + IF (PRESENT(arg19)) arg19_def = C_LOC(arg19(1:1)) + IF (PRESENT(arg20)) arg20_def = C_LOC(arg20(1:1)) + + hdferr = h5epush_c(err_stack, cls_id, maj_id, min_id, msg, LEN(msg), & + file_def, func_def, line_def, & + arg1_def, arg2_def, arg3_def, arg4_def, arg5_def, & + arg6_def, arg7_def, arg8_def, arg9_def, arg10_def, & + arg11_def, arg12_def, arg13_def, arg14_def, arg15_def, & + arg16_def, arg17_def, arg18_def, arg19_def, arg20_def) + + END SUBROUTINE h5epush_f +!> +!! \ingroup FH5E +!! +!! \brief Registers a client library or application program to the HDF5 error API. +!! +!! \param cls_name Name of the error class +!! \param lib_name Name of the client library or application to which the error class belongs +!! \param version Version of the client library or application to which the error class belongs. It can be NULL. +!! \param class_id Class identifier +!! \param hdferr \fortran_error +!! +!! See C API: @ref H5Eregister_class() +!! + SUBROUTINE h5eregister_class_f(cls_name, lib_name, version, class_id, hdferr) + IMPLICIT NONE + CHARACTER(LEN=*), INTENT(IN) :: cls_name + CHARACTER(LEN=*), INTENT(IN) :: lib_name + CHARACTER(LEN=*), INTENT(IN) :: version + INTEGER(HID_T) , INTENT(OUT) :: class_id + INTEGER, INTENT(OUT) :: hdferr + + CHARACTER(LEN=LEN_TRIM(cls_name)+1,KIND=C_CHAR) :: c_cls_name + CHARACTER(LEN=LEN_TRIM(lib_name)+1,KIND=C_CHAR) :: c_lib_name + CHARACTER(LEN=LEN_TRIM(version)+1,KIND=C_CHAR) :: c_version + INTERFACE + INTEGER(HID_T) FUNCTION H5Eregister_class(cls_name, lib_name, version) & + BIND(C,NAME='H5Eregister_class') + IMPORT :: C_CHAR + IMPORT :: HID_T + IMPLICIT NONE + CHARACTER(KIND=C_CHAR), DIMENSION(*) :: cls_name + CHARACTER(KIND=C_CHAR), DIMENSION(*) :: lib_name + CHARACTER(KIND=C_CHAR), DIMENSION(*) :: version + + END FUNCTION H5Eregister_class + END INTERFACE + + c_cls_name = TRIM(cls_name)//C_NULL_CHAR + c_lib_name = TRIM(lib_name)//C_NULL_CHAR + c_version = TRIM(version)//C_NULL_CHAR + + class_id = H5Eregister_class(c_cls_name, c_lib_name, c_version) + + hdferr = 0 + IF(class_id.LT.0) hdferr = -1 + + END SUBROUTINE h5eregister_class_f +!> +!! \ingroup FH5E +!! +!! \brief Removes an error class. +!! +!! \param class_id Class identifier +!! \param hdferr \fortran_error +!! +!! See C API: @ref H5Eunregister_class() +!! + SUBROUTINE h5eunregister_class_f(class_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: class_id + INTEGER, INTENT(OUT) :: hdferr + + INTERFACE + INTEGER(C_INT) FUNCTION H5Eunregister_class(class_id) BIND(C, NAME='H5Eunregister_class') + IMPORT :: HID_T, C_INT + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: class_id + END FUNCTION H5Eunregister_class + END INTERFACE + + hdferr = INT(H5Eunregister_class(class_id)) + + END SUBROUTINE h5eunregister_class_f +!> +!! \ingroup FH5E +!! +!! \brief Adds a major or minor error message to an error class. +!! +!! \param class_id An error class identifier +!! \param msg_type The type of the error message +!! \param msg Error message +!! \param err_id Error identifier +!! \param hdferr \fortran_error +!! +!! See C API: @ref H5Ecreate_msg() +!! + SUBROUTINE h5ecreate_msg_f(class_id, msg_type, msg, err_id, hdferr) + IMPLICIT NONE + + INTEGER(HID_T) , INTENT(IN) :: class_id + INTEGER , INTENT(IN) :: msg_type + CHARACTER(LEN=*), INTENT(IN) :: msg + INTEGER(HID_T) , INTENT(OUT) :: err_id + INTEGER, INTENT(OUT) :: hdferr + + CHARACTER(LEN=LEN_TRIM(msg)+1,KIND=C_CHAR) :: c_msg + + INTERFACE + INTEGER(HID_T) FUNCTION H5Ecreate_msg(class_id, msg_type, msg) & + BIND(C,NAME='H5Ecreate_msg') + IMPORT :: C_CHAR, C_INT + IMPORT :: HID_T + IMPLICIT NONE + INTEGER(HID_T), VALUE :: class_id + INTEGER(C_INT), VALUE :: msg_type + CHARACTER(KIND=C_CHAR), DIMENSION(*) :: msg + END FUNCTION H5Ecreate_msg + END INTERFACE + + c_msg = TRIM(msg)//C_NULL_CHAR + + err_id = H5Ecreate_msg(class_id, INT(msg_type, C_INT), c_msg) + + hdferr = 0 + IF(err_id.LT.0) hdferr = -1 + + END SUBROUTINE h5ecreate_msg_f +!> +!! \ingroup FH5E +!! +!! \brief Closes an error message. +!! +!! \param err_id An error message identifier +!! \param hdferr \fortran_error +!! +!! See C API: @ref H5Eclose_msg() +!! + SUBROUTINE h5eclose_msg_f(err_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: err_id + INTEGER, INTENT(OUT) :: hdferr + + INTERFACE + INTEGER(C_INT) FUNCTION H5Eclose_msg(err_id) BIND(C, NAME='H5Eclose_msg') + IMPORT :: HID_T, C_INT + IMPLICIT NONE + INTEGER(HID_T), VALUE :: err_id + END FUNCTION H5Eclose_msg + END INTERFACE + + hdferr = INT(H5Eclose_msg(err_id)) + + END SUBROUTINE h5eclose_msg_f +!> +!! \ingroup FH5E +!! +!! \brief Retrieves an error message. +!! +!! \param msg_id Error message identifier +!! \param msg_type The type of the error message. Valid values are H5E_MAJOR_F and H5E_MINOR_F. +!! \param msg Error message buffer +!! \param hdferr \fortran_error +!! \param msg_size The length of error message to be returned by this function +!! +!! If \p msg_size is omitted, the API will copy up to the length of \p msg, and it +!! is the application's responsibility to provide a large enough buffer. If \p msg_size +!! is zero, the required buffer size will be returned, and \p msg is not accessed. +!! If \p msg_size is greater than zero, the function will copy up to the length +!! of \p msg_size info \p msg. +!! +!! See C API: @ref H5Eget_msg() +!! + SUBROUTINE H5Eget_msg_f(msg_id, msg_type, msg, hdferr, msg_size) + IMPLICIT NONE + + INTEGER(HID_T) , INTENT(IN) :: msg_id + INTEGER , INTENT(OUT) :: msg_type + CHARACTER(LEN=*) :: msg + INTEGER , INTENT(OUT) :: hdferr + INTEGER(SIZE_T) , INTENT(INOUT), OPTIONAL :: msg_size + + CHARACTER(LEN=1,KIND=C_CHAR), DIMENSION(:), ALLOCATABLE, TARGET :: c_msg + INTEGER(C_INT) :: c_msg_type + TYPE(C_PTR) :: f_ptr + INTEGER(SIZE_T) :: msg_cp_sz + INTEGER(SIZE_T) :: c_msg_size + + INTERFACE + INTEGER(SIZE_T) FUNCTION H5Eget_msg(msg_id, msg_type, msg, size) & + BIND(C,NAME='H5Eget_msg') + IMPORT :: C_CHAR, C_PTR, C_INT + IMPORT :: HID_T, SIZE_T + IMPLICIT NONE + INTEGER(HID_T), VALUE :: msg_id + INTEGER(C_INT) :: msg_type + TYPE(C_PTR) , VALUE :: msg + INTEGER(SIZE_T), VALUE :: size + END FUNCTION H5Eget_msg + END INTERFACE + + hdferr = 0 + msg_cp_sz = 0 + IF(PRESENT(msg_size))THEN + IF(msg_size .EQ. 0)THEN + c_msg_size = H5Eget_msg(msg_id, c_msg_type, C_NULL_PTR, 0_SIZE_T) + + IF(PRESENT(msg_size)) msg_size = c_msg_size + msg_type = INT(c_msg_type) + + IF(c_msg_size.LT.0) hdferr = -1 + RETURN + ELSE + msg_cp_sz = msg_size + ENDIF + ENDIF + + IF(msg_cp_sz.EQ.0) msg_cp_sz = LEN(msg) + + ALLOCATE(c_msg(1:msg_cp_sz+1), stat=hdferr) + IF (hdferr .NE. 0) THEN + hdferr = -1 + RETURN + ENDIF + f_ptr = C_LOC(c_msg(1)(1:1)) + c_msg_size = H5Eget_msg(msg_id, c_msg_type, f_ptr, msg_cp_sz+1) + + CALL HD5c2fstring(msg, c_msg, msg_cp_sz, msg_cp_sz+1_SIZE_T) + + DEALLOCATE(c_msg) + + IF(PRESENT(msg_size))THEN + msg_size = c_msg_size + ENDIF + + msg_type = INT(c_msg_type) + + IF(c_msg_size.LT.0) hdferr = -1 + + END SUBROUTINE H5Eget_msg_f + +!> +!! \ingroup FH5E +!! +!! \brief Retrieves the number of error messages in an error stack. +!! +!! \param error_stack_id An error message identifier +!! \param count Number of error messages in \p err_id +!! \param hdferr \fortran_error +!! +!! See C API: @ref H5Eget_num() +!! + SUBROUTINE h5eget_num_f(error_stack_id, count, hdferr) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: error_stack_id + INTEGER(SIZE_T), INTENT(OUT) :: count + INTEGER , INTENT(OUT) :: hdferr + + INTERFACE + INTEGER(SIZE_T) FUNCTION H5Eget_num(error_stack_id) BIND(C, NAME='H5Eget_num') + IMPORT :: HID_T, SIZE_T + IMPLICIT NONE + INTEGER(HID_T), VALUE :: error_stack_id + END FUNCTION H5Eget_num + END INTERFACE + + count = H5Eget_num(error_stack_id) + + hdferr = 0 + IF(count.LT.0) hdferr = -1 + + END SUBROUTINE h5eget_num_f + +!> +!! \ingroup FH5E +!! +!! \brief Walks the specified error stack, calling the specified function. +!! +!! \param err_stack Error stack identifier +!! \param direction Direction in which the error stack is to be walked +!! \param op Function to be called for each error encountered +!! \param op_data Data to be passed to func +!! \param hdferr \fortran_error +!! +!! See C API: @ref H5Ewalk2() +!! + SUBROUTINE h5ewalk_f(err_stack, direction, op, op_data, hdferr) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: err_stack + INTEGER , INTENT(IN) :: direction + TYPE(C_FUNPTR) , INTENT(IN) :: op + TYPE(C_PTR) , INTENT(INOUT) :: op_data ! Declare INOUT to bypass gfortran 4.8.5 issue + INTEGER , INTENT(OUT) :: hdferr + + INTERFACE + INTEGER(C_INT) FUNCTION H5Ewalk(err_stack, direction, op, op_data) & + BIND(C, NAME='H5Ewalk2') + IMPORT :: HID_T, C_FUNPTR, C_PTR, C_INT + IMPLICIT NONE + INTEGER(HID_T), VALUE :: err_stack + INTEGER(C_INT), VALUE :: direction + TYPE(C_FUNPTR), VALUE :: op + TYPE(C_PTR) , VALUE :: op_data + END FUNCTION H5Ewalk + END INTERFACE + + hdferr = INT(H5Ewalk(err_stack, INT(direction, C_INT), op, op_data)) + + END SUBROUTINE h5ewalk_f + +!> +!! \ingroup FH5E +!! +!! \brief Retrieves an error message. +!! +!! \param class_id Error class identifier +!! \param name Buffer for the error class name +!! \param hdferr \fortran_error +!! \param size The maximum number of characters of the class name to be returned by this function in \p name. +!! +!! If \p size is omitted, the API will copy up to the length of \p name, and it +!! is the application's responsibility to provide a large enough buffer. If \p size +!! is zero, the required buffer size will be returned, and \p name is not accessed. +!! If \p size is greater than zero, the function will copy up to the length +!! of \p size info \p name. +!! +!! See C API: @ref H5Eget_class_name() +!! + SUBROUTINE H5Eget_class_name_f(class_id, name, hdferr, size) + IMPLICIT NONE + + INTEGER(HID_T) , INTENT(IN) :: class_id + CHARACTER(LEN=*) :: name + INTEGER , INTENT(OUT) :: hdferr + INTEGER(SIZE_T) , INTENT(INOUT), OPTIONAL :: size + + CHARACTER(LEN=1,KIND=C_CHAR), DIMENSION(:), ALLOCATABLE, TARGET :: c_name + TYPE(C_PTR) :: f_ptr + INTEGER(SIZE_T) :: name_cp_sz + INTEGER(SIZE_T) :: c_size + + INTERFACE + INTEGER(SIZE_T) FUNCTION H5Eget_class_name(class_id, name, size) & + BIND(C,NAME='H5Eget_class_name') + IMPORT :: C_PTR, C_CHAR + IMPORT :: HID_T, SIZE_T + IMPLICIT NONE + INTEGER(HID_T) , VALUE :: class_id + TYPE(C_PTR) , VALUE :: name + INTEGER(SIZE_T), VALUE :: size + END FUNCTION H5Eget_class_name + END INTERFACE + + hdferr = 0 + name_cp_sz = 0 + IF(PRESENT(size))THEN + IF(size .EQ. 0)THEN + c_size = H5Eget_class_name(class_id, C_NULL_PTR, 0_SIZE_T) + + IF(PRESENT(size)) size = c_size + IF(c_size.LT.0) hdferr = -1 + RETURN + ELSE + name_cp_sz = size + ENDIF + ENDIF + + IF(name_cp_sz.EQ.0) name_cp_sz = LEN(name) + + ALLOCATE(c_name(1:name_cp_sz+1), stat=hdferr) + IF (hdferr .NE. 0) THEN + hdferr = -1 + RETURN + ENDIF + f_ptr = C_LOC(c_name) + c_size = H5Eget_class_name(class_id, f_ptr, name_cp_sz+1_SIZE_T) + + CALL HD5c2fstring(name, c_name, name_cp_sz, name_cp_sz+1_SIZE_T) + DEALLOCATE(c_name) + + IF(PRESENT(size))THEN + size = c_size + ENDIF + + IF(c_size.LT.0) hdferr = -1 + + END SUBROUTINE H5Eget_class_name_f + +!> +!! \ingroup FH5E +!! +!! \brief Appends one error stack to another, optionally closing the source stack. +!! +!! \param dst_stack_id Error stack identifier +!! \param src_stack_id Error stack identifier +!! \param close_source_stack Flag to indicate whether to close the source stack +!! \param hdferr \fortran_error +!! +!! See C API: @ref H5Eappend_stack() +!! + SUBROUTINE H5Eappend_stack_f(dst_stack_id, src_stack_id, close_source_stack, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dst_stack_id + INTEGER(HID_T), INTENT(IN) :: src_stack_id + LOGICAL , INTENT(IN) :: close_source_stack + INTEGER , INTENT(OUT) :: hdferr + + INTERFACE + INTEGER(C_INT) FUNCTION H5Eappend_stack(dst_stack_id, src_stack_id, close_source_stack) & + BIND(C, NAME='H5Eappend_stack') + IMPORT :: HID_T, C_BOOL, C_INT + IMPLICIT NONE + INTEGER(HID_T) , VALUE :: dst_stack_id + INTEGER(HID_T) , VALUE :: src_stack_id + LOGICAL(C_BOOL), VALUE :: close_source_stack + END FUNCTION H5Eappend_stack + END INTERFACE + + hdferr = INT(H5Eappend_stack(dst_stack_id, src_stack_id, LOGICAL(close_source_stack, C_BOOL))) + + END SUBROUTINE H5Eappend_stack_f + +!> +!! \ingroup FH5E +!! +!! \brief Returns a copy of the current error stack. +!! +!! \param err_stack_id Error stack identifier +!! \param hdferr \fortran_error +!! +!! See C API: @ref H5Eget_current_stack() +!! + SUBROUTINE H5Eget_current_stack_f(err_stack_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(OUT) :: err_stack_id + INTEGER , INTENT(OUT) :: hdferr + + INTERFACE + INTEGER(HID_T) FUNCTION H5Eget_current_stack() BIND(C, NAME='H5Eget_current_stack') + IMPORT :: HID_T + IMPLICIT NONE + END FUNCTION H5Eget_current_stack + END INTERFACE + + err_stack_id = H5Eget_current_stack() + + hdferr = 0 + IF(err_stack_id.LT.0) hdferr = -1 + + END SUBROUTINE H5Eget_current_stack_f + +!> +!! \ingroup FH5E +!! +!! \brief Replaces the current error stack. +!! +!! \param err_stack_id Error stack identifier +!! \param hdferr \fortran_error +!! +!! See C API: @ref H5Eset_current_stack() +!! + SUBROUTINE H5Eset_current_stack_f(err_stack_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN ) :: err_stack_id + INTEGER , INTENT(OUT) :: hdferr + + INTERFACE + INTEGER(C_INT) FUNCTION H5Eset_current_stack(err_stack_id) BIND(C, NAME='H5Eset_current_stack') + IMPORT :: C_INT, HID_T + IMPLICIT NONE + INTEGER(HID_T), VALUE :: err_stack_id + END FUNCTION H5Eset_current_stack + END INTERFACE + + hdferr = INT(H5Eset_current_stack(err_stack_id)) + + END SUBROUTINE H5Eset_current_stack_f + +!> +!! \ingroup FH5E +!! +!! \brief Closes an error stack handle. +!! +!! \param err_stack_id Error stack identifier +!! \param hdferr \fortran_error +!! +!! See C API: @ref H5Eclose_stack() +!! + SUBROUTINE H5Eclose_stack_f(err_stack_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN ) :: err_stack_id + INTEGER , INTENT(OUT) :: hdferr + + INTERFACE + INTEGER(C_INT) FUNCTION H5Eclose_stack(err_stack_id) BIND(C, NAME='H5Eclose_stack') + IMPORT :: C_INT, HID_T + IMPLICIT NONE + INTEGER(HID_T), VALUE :: err_stack_id + END FUNCTION H5Eclose_stack + END INTERFACE + + hdferr = INT(H5Eclose_stack(err_stack_id)) + + END SUBROUTINE H5Eclose_stack_f + +!> +!! \ingroup FH5E +!! +!! \brief Creates a new, empty error stack. +!! +!! \param err_stack_id Error stack identifier +!! \param hdferr \fortran_error +!! +!! See C API: @ref H5Ecreate_stack() +!! + SUBROUTINE H5Ecreate_stack_f(err_stack_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(OUT) :: err_stack_id + INTEGER , INTENT(OUT) :: hdferr + + INTERFACE + INTEGER(HID_T) FUNCTION H5Ecreate_stack() BIND(C, NAME='H5Ecreate_stack') + IMPORT :: HID_T + IMPLICIT NONE + END FUNCTION H5Ecreate_stack + END INTERFACE + + err_stack_id = H5Ecreate_stack() + + hdferr = 0 + IF(err_stack_id.LT.0) hdferr = -1 + + END SUBROUTINE H5Ecreate_stack_f + +!> +!! \ingroup FH5E +!! +!! \brief Deletes specified number of error messages from the error stack. +!! +!! \param err_stack_id Error stack identifier +!! \param count The number of error messages to be deleted from the top of error stack +!! \param hdferr \fortran_error +!! +!! See C API: @ref H5Epop() +!! + SUBROUTINE H5Epop_f(err_stack_id, count, hdferr) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN ) :: err_stack_id + INTEGER(SIZE_T), INTENT(IN ) :: count + INTEGER , INTENT(OUT) :: hdferr + + INTERFACE + INTEGER(C_INT) FUNCTION H5Epop(err_stack_id, count) BIND(C, NAME='H5Epop') + IMPORT :: C_INT, HID_T, SIZE_T + IMPLICIT NONE + INTEGER(HID_T) , VALUE :: err_stack_id + INTEGER(SIZE_T), VALUE :: count + END FUNCTION H5Epop + END INTERFACE + + hdferr = INT(H5Epop(err_stack_id, count)) + + END SUBROUTINE H5Epop_f END MODULE H5E diff --git a/fortran/src/H5Fff.F90 b/fortran/src/H5Fff.F90 index fcfde86a20e..e8b765b7696 100644 --- a/fortran/src/H5Fff.F90 +++ b/fortran/src/H5Fff.F90 @@ -1220,6 +1220,9 @@ SUBROUTINE h5fget_intent_f(file_id, intent, hdferr) INTEGER(HID_T), INTENT(IN) :: file_id INTEGER, INTENT(OUT) :: intent INTEGER, INTENT(OUT) :: hdferr + + INTEGER(C_INT) :: c_intent + INTERFACE INTEGER(C_INT) FUNCTION H5Fget_intent(file_id, intent) BIND(C,NAME='H5Fget_intent') IMPORT :: C_INT @@ -1230,7 +1233,8 @@ INTEGER(C_INT) FUNCTION H5Fget_intent(file_id, intent) BIND(C,NAME='H5Fget_inten END FUNCTION H5Fget_intent END INTERFACE - hdferr = INT(H5Fget_intent(file_id, intent)) + hdferr = INT(H5Fget_intent(file_id, c_intent)) + intent = INT(c_intent) END SUBROUTINE h5fget_intent_f diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90 index afd17f3dc32..516c34b99f1 100644 --- a/fortran/src/H5Pff.F90 +++ b/fortran/src/H5Pff.F90 @@ -49,6 +49,12 @@ MODULE H5P PRIVATE h5pget_integer, h5pget_char, h5pget_ptr PRIVATE h5pregister_integer, h5pregister_ptr PRIVATE h5pinsert_integer, h5pinsert_char, h5pinsert_ptr +#ifdef H5_HAVE_PARALLEL + PRIVATE h5pset_fapl_mpio_f90, h5pget_fapl_mpio_f90 +#ifdef H5_HAVE_MPI_F08 + PRIVATE h5pset_fapl_mpio_f08, h5pget_fapl_mpio_f08 +#endif +#endif #ifndef H5_DOXYGEN @@ -101,7 +107,6 @@ MODULE H5P MODULE PROCEDURE h5pinsert_ptr END INTERFACE - INTERFACE INTEGER(C_INT) FUNCTION H5Pset_fill_value(prp_id, type_id, fillvalue) & BIND(C, NAME='H5Pset_fill_value') @@ -182,6 +187,35 @@ END FUNCTION h5pinsert_c #endif #ifdef H5_HAVE_PARALLEL + + INTERFACE h5pset_fapl_mpio_f + MODULE PROCEDURE h5pset_fapl_mpio_f90 +#ifdef H5_HAVE_MPI_F08 + MODULE PROCEDURE h5pset_fapl_mpio_f08 +#endif + END INTERFACE + + INTERFACE h5pget_fapl_mpio_f + MODULE PROCEDURE h5pget_fapl_mpio_f90 +#ifdef H5_HAVE_MPI_F08 + MODULE PROCEDURE h5pget_fapl_mpio_f08 +#endif + END INTERFACE + + INTERFACE H5Pset_mpi_params_f + MODULE PROCEDURE H5Pset_mpi_params_f90 +#ifdef H5_HAVE_MPI_F08 + MODULE PROCEDURE H5Pset_mpi_params_f08 +#endif + END INTERFACE + + INTERFACE H5Pget_mpi_params_f + MODULE PROCEDURE H5Pget_mpi_params_f90 +#ifdef H5_HAVE_MPI_F08 + MODULE PROCEDURE H5Pget_mpi_params_f08 +#endif + END INTERFACE + #ifdef H5_HAVE_SUBFILING_VFD !> \addtogroup FH5P !> @{ @@ -5125,6 +5159,8 @@ END SUBROUTINE h5pget_file_image_f ! ********************************************************************* #ifdef H5_HAVE_PARALLEL + +#ifdef H5_DOXYGEN !> !! \ingroup FH5P !! @@ -5143,21 +5179,69 @@ SUBROUTINE h5pset_fapl_mpio_f(prp_id, comm, info, hdferr) INTEGER, INTENT(IN) :: comm INTEGER, INTENT(IN) :: info INTEGER, INTENT(OUT) :: hdferr + END SUBROUTINE h5pset_fapl_mpio_f +!> +!! \ingroup FH5P +!! +!! \brief Stores MPI IO communicator information to the file access property list. +!! +!! \note Supports MPI Fortran module mpi_f08 +!! +!! \param prp_id File access property list identifier. +!! \param comm MPI-3 communicator. +!! \param info MPI-3 info object. +!! \param hdferr \fortran_error +!! +!! See C API: @ref H5Pset_fapl_mpio() +!! + SUBROUTINE h5pset_fapl_mpio_f(prp_id, comm, info, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id + TYPE(MPI_COMM), INTENT(IN) :: comm + TYPE(MPI_INFO), INTENT(IN) :: info + INTEGER, INTENT(OUT) :: hdferr + END SUBROUTINE h5pset_fapl_mpio_f + +#else + + 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, INTENT(OUT) :: hdferr INTERFACE INTEGER FUNCTION h5pset_fapl_mpio_c(prp_id, comm, info) & BIND(C,NAME='h5pset_fapl_mpio_c') IMPORT :: HID_T IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: prp_id - INTEGER , INTENT(IN) :: comm - INTEGER , INTENT(IN) :: info + INTEGER(HID_T) :: prp_id + INTEGER :: comm + INTEGER :: info END FUNCTION h5pset_fapl_mpio_c END INTERFACE hdferr = h5pset_fapl_mpio_c(prp_id, comm, info) - END SUBROUTINE h5pset_fapl_mpio_f + END SUBROUTINE h5pset_fapl_mpio_f90 +#ifdef H5_HAVE_MPI_F08 + SUBROUTINE h5pset_fapl_mpio_f08(prp_id, comm, info, hdferr) + USE mpi_f08 + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id + TYPE(MPI_COMM), INTENT(IN) :: comm + TYPE(MPI_INFO), INTENT(IN) :: info + INTEGER, INTENT(OUT) :: hdferr + + CALL h5pset_fapl_mpio_f90(prp_id, comm%mpi_val, info%mpi_val, hdferr) + + END SUBROUTINE h5pset_fapl_mpio_f08 +#endif + +#endif + +#ifdef H5_DOXYGEN !> !! \ingroup FH5P !! @@ -5168,9 +5252,44 @@ END SUBROUTINE h5pset_fapl_mpio_f !! \param info MPI-2 info object. !! \param hdferr \fortran_error !! +!! \attention It is the responsibility of the application to free the MPI objects. +!! !! See C API: @ref H5Pget_fapl_mpio() !! - SUBROUTINE h5pget_fapl_mpio_f(prp_id, comm, info, hdferr) +SUBROUTINE h5pget_fapl_mpio_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) :: hdferr +END SUBROUTINE h5pget_fapl_mpio_f +!> +!! \ingroup FH5P +!! +!! \brief Returns MPI communicator information. +!! +!! \note Supports MPI Fortran module mpi_f08 +!! +!! \param prp_id File access property list identifier. +!! \param comm MPI-3 communicator. +!! \param info MPI-3 info object. +!! \param hdferr \fortran_error +!! +!! \attention It is the responsibility of the application to free the MPI objects. +!! +!! See C API: @ref H5Pget_fapl_mpio() +!! +SUBROUTINE h5pget_fapl_mpio_f(prp_id, comm, info, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id + TYPE(MPI_COMM), INTENT(OUT) :: comm + TYPE(MPI_INFO), INTENT(OUT) :: info + INTEGER , INTENT(OUT) :: hdferr +END SUBROUTINE h5pget_fapl_mpio_f + +#else + + SUBROUTINE h5pget_fapl_mpio_f90(prp_id, comm, info, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id INTEGER, INTENT(OUT) :: comm @@ -5181,15 +5300,30 @@ INTEGER FUNCTION h5pget_fapl_mpio_c(prp_id, comm, info) & BIND(C,NAME='h5pget_fapl_mpio_c') IMPORT :: HID_T IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: prp_id - INTEGER , INTENT(OUT) :: comm - INTEGER , INTENT(OUT) :: info + INTEGER(HID_T) :: prp_id + INTEGER :: comm + INTEGER :: info END FUNCTION h5pget_fapl_mpio_c END INTERFACE hdferr = h5pget_fapl_mpio_c(prp_id, comm, info) - END SUBROUTINE h5pget_fapl_mpio_f + END SUBROUTINE h5pget_fapl_mpio_f90 + +#ifdef H5_HAVE_MPI_F08 + SUBROUTINE h5pget_fapl_mpio_f08(prp_id, comm, info, hdferr) + USE mpi_f08 + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id + TYPE(MPI_COMM), INTENT(OUT) :: comm + TYPE(MPI_INFO), INTENT(OUT) :: info + INTEGER, INTENT(OUT) :: hdferr + + CALL h5pget_fapl_mpio_f90(prp_id, comm%mpi_val, info%mpi_val, hdferr) + + END SUBROUTINE h5pget_fapl_mpio_f08 +#endif +#endif #ifdef H5_HAVE_SUBFILING_VFD !> @@ -5376,14 +5510,15 @@ END FUNCTION H5Pget_mpio_no_collective_cause END SUBROUTINE h5pget_mpio_no_collective_cause_f +#ifdef H5_DOXYGEN !> !! \ingroup FH5P !! -!! \brief Set the MPI communicator and info. +!! \brief Set the MPI communicator and information. !! !! \param prp_id File access property list identifier. -!! \param comm The MPI communicator. -!! \param info The MPI info object. +!! \param comm MPI-2 communicator. +!! \param info MPI-2 info object. !! \param hdferr \fortran_error !! !! See C API: @ref H5Pset_mpi_params() @@ -5394,6 +5529,37 @@ SUBROUTINE H5Pset_mpi_params_f(prp_id, comm, info, hdferr) INTEGER , INTENT(IN) :: comm INTEGER , INTENT(IN) :: info INTEGER , INTENT(OUT) :: hdferr + END SUBROUTINE H5Pset_mpi_params_f +!> +!! \ingroup FH5P +!! +!! \brief Set the MPI communicator and information. +!! +!! \note Supports MPI Fortran module mpi_f08 +!! +!! \param prp_id File access property list identifier. +!! \param comm MPI-3 communicator. +!! \param info MPI-3 info object. +!! \param hdferr \fortran_error +!! +!! See C API: @ref H5Pset_mpi_params() +!! + SUBROUTINE H5Pset_mpi_params_f(prp_id, comm, info, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id + TYPE(MPI_COMM), INTENT(IN) :: comm + TYPE(MPI_INFO), INTENT(IN) :: info + INTEGER , INTENT(OUT) :: hdferr + END SUBROUTINE H5Pset_mpi_params_f + +#else + + 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 , INTENT(OUT) :: hdferr INTERFACE INTEGER FUNCTION h5pset_mpi_params_c(prp_id, comm, info) & @@ -5408,16 +5574,33 @@ END FUNCTION H5pset_mpi_params_c hdferr = H5Pset_mpi_params_c(prp_id, comm, info) - END SUBROUTINE H5Pset_mpi_params_f + END SUBROUTINE H5Pset_mpi_params_f90 + +#ifdef H5_HAVE_MPI_F08 + SUBROUTINE H5Pset_mpi_params_f08(prp_id, comm, info, hdferr) + USE mpi_f08 + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id + TYPE(MPI_COMM), INTENT(IN) :: comm + TYPE(MPI_INFO), INTENT(IN) :: info + INTEGER , INTENT(OUT) :: hdferr + + CALL H5Pset_mpi_params_f90(prp_id, comm%mpi_val, info%mpi_val, hdferr) + + END SUBROUTINE H5Pset_mpi_params_f08 +#endif + +#endif +#ifdef H5_DOXYGEN !> !! \ingroup FH5P !! !! \brief Get the MPI communicator and info. !! !! \param prp_id File access property list identifier. -!! \param comm The MPI communicator. -!! \param info The MPI info object. +!! \param comm MPI-2 communicator. +!! \param info MPI-2 info object. !! \param hdferr \fortran_error !! !! See C API: @ref H5Pget_mpi_params() @@ -5428,6 +5611,39 @@ SUBROUTINE H5Pget_mpi_params_f(prp_id, comm, info, hdferr) INTEGER , INTENT(OUT) :: comm INTEGER , INTENT(OUT) :: info INTEGER , INTENT(OUT) :: hdferr + END SUBROUTINE H5Pget_mpi_params_f +!> +!! \ingroup FH5P +!! +!! \brief Get the MPI communicator and information. +!! +!! \note Supports MPI Fortran module mpi_f08 +!! +!! \param prp_id File access property list identifier. +!! \param comm MPI-3 communicator. +!! \param info MPI-3 info object. +!! \param hdferr \fortran_error +!! +!! \attention It is the responsibility of the application to free the MPI objects. +!! +!! See C API: @ref H5Pget_mpi_params() +!! + SUBROUTINE H5Pget_mpi_params_f(prp_id, comm, info, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id + TYPE(MPI_COMM), INTENT(OUT) :: comm + TYPE(MPI_INFO), INTENT(OUT) :: info + INTEGER , INTENT(OUT) :: hdferr + END SUBROUTINE H5Pget_mpi_params_f + +#else + + 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 , INTENT(OUT) :: hdferr INTERFACE INTEGER FUNCTION h5pget_mpi_params_c(prp_id, comm, info) & @@ -5442,7 +5658,23 @@ END FUNCTION H5pget_mpi_params_c hdferr = H5Pget_mpi_params_c(prp_id, comm, info) - END SUBROUTINE H5Pget_mpi_params_f + END SUBROUTINE H5Pget_mpi_params_f90 + +#ifdef H5_HAVE_MPI_F08 + SUBROUTINE H5Pget_mpi_params_f08(prp_id, comm, info, hdferr) + USE mpi_f08 + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id + TYPE(MPI_COMM), INTENT(OUT) :: comm + TYPE(MPI_INFO), INTENT(OUT) :: info + INTEGER , INTENT(OUT) :: hdferr + + CALL H5Pget_mpi_params_f90(prp_id, comm%mpi_val, info%mpi_val, hdferr) + + END SUBROUTINE H5Pget_mpi_params_f08 +#endif + +#endif !> !! \ingroup FH5P @@ -6018,7 +6250,7 @@ END FUNCTION h5pget_virtual_filename IF(INT(h5pget_virtual_filename(dcpl_id, index, f_ptr, INT(LEN(name)+1,SIZE_T)), SIZE_T).LT.0)THEN hdferr = -1 ELSE - CALL HD5c2fstring(name,c_name,LEN(name)) + CALL HD5c2fstring(name, c_name, LEN(name,KIND=SIZE_T), LEN(name,KIND=SIZE_T)+1_SIZE_T ) ENDIF ENDIF @@ -6072,7 +6304,7 @@ END FUNCTION h5pget_virtual_dsetname IF(INT(h5pget_virtual_dsetname(dcpl_id, index, f_ptr, INT(LEN(name)+1,SIZE_T)), SIZE_T).LT.0)THEN hdferr = -1 ELSE - CALL HD5c2fstring(name,c_name,LEN(name)) + CALL HD5c2fstring(name, c_name, LEN(name,KIND=SIZE_T), LEN(name,KIND=SIZE_T)+1_SIZE_T ) ENDIF ENDIF diff --git a/fortran/src/H5Sff.F90 b/fortran/src/H5Sff.F90 index 25b665798c0..5f2f1d260ad 100644 --- a/fortran/src/H5Sff.F90 +++ b/fortran/src/H5Sff.F90 @@ -1533,10 +1533,10 @@ SUBROUTINE h5ssel_iter_get_seq_list_f(sel_iter_id, maxseq, maxbytes, nseq, nbyte INTEGER(HID_T) , INTENT(IN) :: sel_iter_id INTEGER(SIZE_T), INTENT(IN) :: maxseq INTEGER(SIZE_T), INTENT(IN) :: maxbytes - INTEGER(SIZE_T), INTENT(OUT), TARGET :: nseq - INTEGER(SIZE_T), INTENT(OUT), TARGET :: nbytes + INTEGER(SIZE_T), INTENT(OUT) :: nseq + INTEGER(SIZE_T), INTENT(OUT) :: nbytes INTEGER(HSIZE_T), DIMENSION(*), INTENT(OUT) :: off - INTEGER(HSIZE_T), DIMENSION(*), INTENT(OUT) :: len + INTEGER(SIZE_T), DIMENSION(*), INTENT(OUT) :: len INTEGER, INTENT(OUT) :: hdferr INTERFACE @@ -1550,7 +1550,7 @@ INTEGER(C_INT) FUNCTION H5Ssel_iter_get_seq_list(sel_iter_id, maxseq, maxbytes, INTEGER(SIZE_T) :: nseq INTEGER(SIZE_T) :: nbytes INTEGER(HSIZE_T), DIMENSION(*) :: off - INTEGER(HSIZE_T), DIMENSION(*) :: len + INTEGER(SIZE_T), DIMENSION(*) :: len END FUNCTION H5Ssel_iter_get_seq_list END INTERFACE @@ -1576,7 +1576,7 @@ SUBROUTINE h5ssel_iter_reset_f(sel_iter_id, space_id, hdferr) INTEGER, INTENT(OUT) :: hdferr INTERFACE INTEGER(C_INT) FUNCTION H5Ssel_iter_reset(sel_iter_id, space_id) & - BIND(C,NAME='H5Ssel_iter_close') + BIND(C,NAME='H5Ssel_iter_reset') IMPORT :: HID_T, C_INT IMPLICIT NONE INTEGER(HID_T), VALUE :: sel_iter_id diff --git a/fortran/src/H5VLff.F90 b/fortran/src/H5VLff.F90 index 4467a59b171..66d098bfab6 100644 --- a/fortran/src/H5VLff.F90 +++ b/fortran/src/H5VLff.F90 @@ -343,7 +343,7 @@ END FUNCTION H5VLget_connector_name IF(INT(H5VLget_connector_name(obj_id, c_name, l), SIZE_T).LT.0)THEN hdferr = H5I_INVALID_HID_F ELSE - CALL HD5c2fstring(name,c_name,LEN(name)) + CALL HD5c2fstring(name, c_name, LEN(name,KIND=SIZE_T), LEN(name,KIND=SIZE_T)+1_SIZE_T ) ENDIF ENDIF diff --git a/fortran/src/H5config_f.inc.cmake b/fortran/src/H5config_f.inc.cmake index 77ff7071640..44da2befead 100644 --- a/fortran/src/H5config_f.inc.cmake +++ b/fortran/src/H5config_f.inc.cmake @@ -19,6 +19,14 @@ #define H5_HAVE_PARALLEL #endif +! Define if MPI supports mpi_f08 module +#cmakedefine01 CMAKE_H5_HAVE_MPI_F08 +#if CMAKE_H5_HAVE_MPI_F08 == 0 +#undef H5_HAVE_MPI_F08 +#else +#define H5_HAVE_MPI_F08 +#endif + ! Define if there is subfiling support #cmakedefine01 CMAKE_H5_HAVE_SUBFILING_VFD #if CMAKE_H5_HAVE_SUBFILING_VFD == 0 @@ -59,12 +67,18 @@ #define H5_FORTRAN_HAVE_C_SIZEOF #endif +! Define if allocatable character is supported +#define H5_FORTRAN_HAVE_CHAR_ALLOC @H5_FORTRAN_HAVE_CHAR_ALLOC@ + ! Define if the intrinsic function C_LONG_DOUBLE exists #define H5_FORTRAN_HAVE_C_LONG_DOUBLE @H5_FORTRAN_HAVE_C_LONG_DOUBLE@ ! Define if Fortran C_LONG_DOUBLE is different from C_DOUBLE #define H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE @H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE@ +! 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@ diff --git a/fortran/src/H5config_f.inc.in b/fortran/src/H5config_f.inc.in index afcfa6e0f76..cb2ec185735 100644 --- a/fortran/src/H5config_f.inc.in +++ b/fortran/src/H5config_f.inc.in @@ -17,6 +17,9 @@ ! Define if we have parallel support #undef HAVE_PARALLEL +! Define if MPI supports mpi_f08 module +#undef HAVE_MPI_F08 + ! Define if we have subfiling support #undef HAVE_SUBFILING_VFD @@ -32,12 +35,18 @@ ! Define if the intrinsic function C_SIZEOF exists #undef FORTRAN_HAVE_C_SIZEOF +! Define if Fortran supports allocatable character +#undef FORTRAN_HAVE_CHAR_ALLOC + ! Define if the intrinsic function C_LONG_DOUBLE exists #undef FORTRAN_HAVE_C_LONG_DOUBLE ! Define if Fortran C_LONG_DOUBLE is different from C_DOUBLE #undef FORTRAN_C_LONG_DOUBLE_IS_UNIQUE +! 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 #undef HAVE_ISO_FORTRAN_ENV diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index 0fe1b2017a1..4bc8c2fa21d 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -553,12 +553,15 @@ H5_FCDLL int_f h5iis_valid_c(hid_t_f *obj_id, int_f *c_valid); * Functions from H5Ef.c */ -H5_FCDLL int_f h5eclear_c(hid_t_f *estack_id); -H5_FCDLL int_f h5eprint_c1(_fcd name, int_f *namelen); -H5_FCDLL int_f h5eprint_c2(void); -H5_FCDLL int_f h5eget_major_c(int_f *error_no, _fcd name, size_t_f *namelen); -H5_FCDLL int_f h5eget_minor_c(int_f *error_no, _fcd name, size_t_f *namelen); +H5_FCDLL int_f h5eprint_c(hid_t_f *err_stack, _fcd name, size_t_f *namelen); H5_FCDLL int_f h5eset_auto2_c(int_f *printflag, hid_t_f *estack_id, H5E_auto2_t func, void *client_data); +H5_FCDLL int_f h5epush_c(hid_t_f *err_stack, hid_t_f *cls_id, hid_t_f *maj_id, hid_t_f *min_id, _fcd msg, + size_t_f *msg_len, char *file, char *func, int *line, const char *arg1, + const char *arg2, const char *arg3, const char *arg4, const char *arg5, + const char *arg6, const char *arg7, const char *arg8, const char *arg9, + const char *arg10, const char *arg11, const char *arg12, const char *arg13, + const char *arg14, const char *arg15, const char *arg16, const char *arg17, + const char *arg18, const char *arg19, const char *arg20); /* * Functions from H5f.c diff --git a/fortran/src/H5fortkit.F90 b/fortran/src/H5fortkit.F90 index b745c22e5ee..70d7087d65e 100644 --- a/fortran/src/H5fortkit.F90 +++ b/fortran/src/H5fortkit.F90 @@ -25,6 +25,8 @@ !***** MODULE H5fortkit + USE H5FORTRAN_TYPES, ONLY : SIZE_T + CONTAINS !****if* H5fortkit/HD5c2fstring @@ -32,28 +34,35 @@ MODULE H5fortkit ! HD5c2fstring ! INPUTS ! cstring - C string stored as a string array of size 'len' of string size LEN=1 -! len - length of Fortran string +! f_len - length of Fortran string +! c_len - length of C array ! OUTPUT -! fstring - Fortran string array of LEN=1 +! fstring - Fortran string LEN=1 ! PURPOSE -! Copies a Fortran array of strings having a length of one to a fortran string and removes the C Null +! Copies a C array of strings having a length of one to a fortran string and removes the C Null ! terminator. The Null terminator is returned from C when calling the C APIs directly. ! ! The fortran standard does not allow C_LOC to be used on a character string of ! length greater than one, which is why we use the array of characters instead. ! ! SOURCE - SUBROUTINE HD5c2fstring(fstring,cstring,len) + SUBROUTINE HD5c2fstring(fstring,cstring,f_len,c_len) !***** IMPLICIT NONE - INTEGER :: i - INTEGER :: len - CHARACTER(LEN=len) :: fstring - CHARACTER(LEN=1), DIMENSION(1:len) :: cstring + INTEGER(SIZE_T) :: i + INTEGER(SIZE_T) :: f_len + INTEGER(SIZE_T) :: c_len + CHARACTER(*) :: fstring + CHARACTER(LEN=1), DIMENSION(1:c_len) :: cstring + + INTEGER(SIZE_T) :: f_len_max fstring = '' - DO i = 1, len + f_len_max = LEN(fstring, KIND=SIZE_T) + DO i = 1, c_len + IF (i .GT. f_len_max) EXIT + IF (i .GT. f_len) EXIT IF (cstring(i)(1:1)==CHAR(0)) EXIT fstring(i:i) = cstring(i)(1:1) END DO diff --git a/fortran/src/Makefile.am b/fortran/src/Makefile.am index 44561f62c14..8d8396fcbff 100644 --- a/fortran/src/Makefile.am +++ b/fortran/src/Makefile.am @@ -143,10 +143,11 @@ FORTRAN_API=yes # modules they depend upon are actually made. *sigh* H5f90global.lo: $(srcdir)/H5f90global.F90 H5fortran_types.lo H5_buildiface.lo: $(srcdir)/H5_buildiface.F90 +H5fortkit.lo: $(srcdir)/H5fortkit.F90 H5fortran_types.lo H5_ff.lo: $(srcdir)/H5_ff.F90 H5Fff.lo H5f90global.lo H5Aff.lo: $(srcdir)/H5Aff.F90 H5f90global.lo H5Dff.lo: $(srcdir)/H5Dff.F90 H5f90global.lo H5_ff.lo H5Sff.lo -H5Eff.lo: $(srcdir)/H5Eff.F90 H5f90global.lo +H5Eff.lo: $(srcdir)/H5Eff.F90 H5f90global.lo H5fortkit.lo H5ESff.lo: $(srcdir)/H5ESff.F90 H5f90global.lo H5Fff.lo: $(srcdir)/H5Fff.F90 H5f90global.lo H5Gff.lo: $(srcdir)/H5Gff.F90 H5f90global.lo H5Pff.lo diff --git a/fortran/src/h5fc.in b/fortran/src/h5fc.in index c5da815f3f6..6d7329a183a 100644 --- a/fortran/src/h5fc.in +++ b/fortran/src/h5fc.in @@ -60,7 +60,7 @@ host_os="@host_os@" prog_name="`basename $0`" -allargs="" +misc_args="" compile_args="" link_args="" link_objs="" @@ -176,7 +176,6 @@ for arg in $@ ; do case "$arg" in -c) - allargs="$allargs $arg" compile_args="$compile_args $arg" if test "x$do_link" = "xyes" -a -n "$output_file"; then @@ -187,7 +186,6 @@ for arg in $@ ; do dash_c="yes" ;; -o) - allargs="$allargs $arg" dash_o="yes" if test "x$dash_c" = "xyes"; then @@ -199,14 +197,12 @@ for arg in $@ ; do fi ;; -E|-M|-MT) - allargs="$allargs $arg" compile_args="$compile_args $arg" dash_c="yes" do_link="no" ;; -l*) link_args="$link_args $arg" - allargs="$allargs $arg" ;; -prefix=*) prefix="`expr "$arg" : '-prefix=\(.*\)'`" @@ -238,14 +234,14 @@ for arg in $@ ; do ;; *\"*) qarg="'"$arg"'" - allargs="$allargs $qarg" + misc_args="$misc_args $qarg" ;; *\'*) - qarg='\"'"$arg"'\"' - allargs="$allargs $qarg" + qarg='"'"$arg"'"' + misc_args="$misc_args $qarg" ;; - *) allargs="$allargs $arg" + *) misc_args="$misc_args $arg" if [ -s "$arg" ] ; then ext=`expr "$arg" : '.*\(\..*\)'` if [ "$ext" = ".f" -o "$ext" = ".F" -o \ @@ -293,7 +289,7 @@ if test "x$do_compile" = "xyes"; then fi - $SHOW $FC $H5BLD_FCFLAGS $FCFLAGS ${F9XSUFFIXFLAG} ${fmodules} $compile_args + $SHOW $FC $H5BLD_FCFLAGS $FCFLAGS ${F9XSUFFIXFLAG} ${fmodules} $misc_args $compile_args status=$? if test "$status" != "0"; then diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in index ccb770ae362..56f54acbf75 100644 --- a/fortran/src/hdf5_fortrandll.def.in +++ b/fortran/src/hdf5_fortrandll.def.in @@ -106,10 +106,26 @@ H5D_mp_H5DWRITE_CHUNK_F H5D_mp_H5DREAD_CHUNK_F ; H5E H5E_mp_H5ECLEAR_F -H5E_mp_H5EPRINT_F +H5E_mp_H5EPRINT1_F +H5E_mp_H5EPRINT2_F H5E_mp_H5EGET_MAJOR_F H5E_mp_H5EGET_MINOR_F H5E_mp_H5ESET_AUTO_F +H5E_mp_H5EREGISTER_CLASS_F +H5E_mp_H5EUNREGISTER_CLASS_F +H5E_mp_H5ECREATE_MSG_F +H5E_mp_H5ECLOSE_MSG_F +H5E_mp_H5EGET_MSG_F +H5E_mp_H5EPUSH_F +H5E_mp_H5EGET_NUM_F +H5E_mp_H5EWALK_F +H5E_mp_H5EGET_CLASS_NAME_F +H5E_mp_H5EAPPEND_STACK_F +H5E_mp_H5EGET_CURRENT_STACK_F +H5E_mp_H5ESET_CURRENT_STACK_F +H5E_mp_H5ECREATE_STACK_F +H5E_mp_H5ECLOSE_STACK_F +H5E_mp_H5EPOP_F ; H5ES H5ES_mp_H5ESCREATE_F H5ES_mp_H5ESGET_COUNT_F @@ -421,14 +437,18 @@ H5P_mp_H5PSET_FILE_SPACE_PAGE_SIZE_F H5P_mp_H5PGET_FILE_SPACE_PAGE_SIZE_F H5P_mp_H5PGET_ACTUAL_SELECTION_IO_MODE_F ; Parallel -@H5_NOPAREXP@H5P_mp_H5PSET_FAPL_MPIO_F -@H5_NOPAREXP@H5P_mp_H5PGET_FAPL_MPIO_F +@H5_NOPAREXP@H5P_mp_H5PSET_FAPL_MPIO_F90 +@H5_NOPAREXP@@H5_NOMPI_F08@H5P_mp_H5PSET_FAPL_MPIO_F08 +@H5_NOPAREXP@H5P_mp_H5PGET_FAPL_MPIO_F90 +@H5_NOPAREXP@@H5_NOMPI_F08@H5P_mp_H5PGET_FAPL_MPIO_F08 @H5_NOPAREXP@@H5_NOSUBFILING@H5P_mp_H5PSET_FAPL_SUBFILING_F @H5_NOPAREXP@@H5_NOSUBFILING@H5P_mp_H5PGET_FAPL_SUBFILING_F @H5_NOPAREXP@@H5_NOSUBFILING@H5P_mp_H5PSET_FAPL_IOC_F @H5_NOPAREXP@@H5_NOSUBFILING@H5P_mp_H5PGET_FAPL_IOC_F -@H5_NOPAREXP@H5P_mp_H5PSET_MPI_PARAMS_F -@H5_NOPAREXP@H5P_mp_H5PGET_MPI_PARAMS_F +@H5_NOPAREXP@H5P_mp_H5PSET_MPI_PARAMS_F90 +@H5_NOPAREXP@@H5_NOMPI_F08@H5P_mp_H5PSET_MPI_PARAMS_F08 +@H5_NOPAREXP@H5P_mp_H5PGET_MPI_PARAMS_F90 +@H5_NOPAREXP@@H5_NOMPI_F08@H5P_mp_H5PGET_MPI_PARAMS_F08 @H5_NOPAREXP@H5P_mp_H5PSET_DXPL_MPIO_F @H5_NOPAREXP@H5P_mp_H5PGET_DXPL_MPIO_F @H5_NOPAREXP@H5P_mp_H5PGET_MPIO_ACTUAL_IO_MODE_F diff --git a/fortran/test/CMakeTests.cmake b/fortran/test/CMakeTests.cmake index 46b89728bea..4911d623503 100644 --- a/fortran/test/CMakeTests.cmake +++ b/fortran/test/CMakeTests.cmake @@ -73,7 +73,7 @@ set_tests_properties (FORTRAN_testhdf5-clean-objects PROPERTIES WORKING_DIRECTORY ${PROJECT_BINARY_DIR} ) -if (HDF5_ENABLE_USING_MEMCHECKER) +if (HDF5_USING_ANALYSIS_TOOL) add_test (NAME FORTRAN_testhdf5_fortran COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME FORTRAN_testhdf5_fortran COMMAND "${CMAKE_COMMAND}" @@ -99,7 +99,7 @@ if ("FORTRAN_testhdf5_fortran" MATCHES "${HDF5_DISABLE_TESTS_REGEX}") endif () #-- Adding test for testhdf5_fortran_1_8 -if (HDF5_ENABLE_USING_MEMCHECKER) +if (HDF5_USING_ANALYSIS_TOOL) add_test (NAME FORTRAN_testhdf5_fortran_1_8 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME FORTRAN_testhdf5_fortran_1_8 COMMAND "${CMAKE_COMMAND}" @@ -126,7 +126,7 @@ if ("FORTRAN_testhdf5_fortran_1_8" MATCHES "${HDF5_DISABLE_TESTS_REGEX}") endif () #-- Adding test for fortranlib_test_F03 -if (HDF5_ENABLE_USING_MEMCHECKER) +if (HDF5_USING_ANALYSIS_TOOL) add_test (NAME FORTRAN_fortranlib_test_F03 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME FORTRAN_fortranlib_test_F03 COMMAND "${CMAKE_COMMAND}" @@ -153,7 +153,7 @@ if ("FORTRAN_fortranlib_test_F03" MATCHES "${HDF5_DISABLE_TESTS_REGEX}") endif () #-- Adding test for vol_connector -if (HDF5_ENABLE_USING_MEMCHECKER) +if (HDF5_USING_ANALYSIS_TOOL) add_test (NAME FORTRAN_vol_connector COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME FORTRAN_vol_connector COMMAND "${CMAKE_COMMAND}" diff --git a/fortran/test/H5_test_buildiface.F90 b/fortran/test/H5_test_buildiface.F90 index 60f2e4cab76..0b5efebd235 100644 --- a/fortran/test/H5_test_buildiface.F90 +++ b/fortran/test/H5_test_buildiface.F90 @@ -106,6 +106,9 @@ PROGRAM H5_test_buildiface END DO WRITE(11,'(A)') " MODULE PROCEDURE verify_character" WRITE(11,'(A)') " MODULE PROCEDURE verify_logical" +#ifdef H5_FORTRAN_C_BOOL_IS_UNIQUE + WRITE(11,'(A)') " MODULE PROCEDURE verify_c_bool" +#endif WRITE(11,'(A)') " END INTERFACE" WRITE(11,'(A)') ' INTERFACE check_real_eq' @@ -300,6 +303,35 @@ PROGRAM H5_test_buildiface WRITE(11,'(A)') ' ENDIF' WRITE(11,'(A)') ' END SUBROUTINE verify_logical' +#ifdef H5_FORTRAN_C_BOOL_IS_UNIQUE +! DLL definitions for windows + WRITE(11,'(A)') '!DEC$if defined(BUILD_HDF5_TEST_DLL)' + WRITE(11,'(A)') '!DEC$attributes dllexport :: verify_c_bool' + WRITE(11,'(A)') '!DEC$endif' +! Subroutine API + WRITE(11,'(A)') ' SUBROUTINE verify_c_bool(string,value,correct_value,total_error,chck_eq)' + WRITE(11,'(A)') ' IMPLICIT NONE' + WRITE(11,'(A)') ' CHARACTER(LEN=*) :: string' + WRITE(11,'(A)') ' LOGICAL(C_BOOL) :: value, correct_value' + WRITE(11,'(A)') ' INTEGER :: total_error' + WRITE(11,'(A)') ' LOGICAL, OPTIONAL :: chck_eq' + WRITE(11,'(A)') ' LOGICAL :: chck_eq_opt' + WRITE(11,'(A)') ' chck_eq_opt = .TRUE.' + WRITE(11,'(A)') ' IF(PRESENT(chck_eq)) chck_eq_opt = chck_eq' + WRITE(11,'(A)') ' IF(chck_eq_opt .EQV. .TRUE.)THEN' + WRITE(11,'(A)') ' IF (value .NEQV. correct_value) THEN' + WRITE(11,'(A)') ' total_error = total_error + 1' + WRITE(11,'(A)') ' WRITE(*,*) "ERROR: INCORRECT VALIDATION ", string' + WRITE(11,'(A)') ' ENDIF' + WRITE(11,'(A)') ' ELSE' + WRITE(11,'(A)') ' IF (value .EQV. correct_value) THEN' + WRITE(11,'(A)') ' total_error = total_error + 1' + WRITE(11,'(A)') ' WRITE(*,*) "ERROR: INCORRECT VALIDATION ", string' + WRITE(11,'(A)') ' ENDIF' + WRITE(11,'(A)') ' ENDIF' + WRITE(11,'(A)') ' END SUBROUTINE verify_c_bool' +#endif + WRITE(11,'(A)') "END MODULE TH5_MISC_gen" CLOSE(11) diff --git a/fortran/test/fortranlib_test_F03.F90 b/fortran/test/fortranlib_test_F03.F90 index 85ab74432d0..1c38b36fb60 100644 --- a/fortran/test/fortranlib_test_F03.F90 +++ b/fortran/test/fortranlib_test_F03.F90 @@ -55,13 +55,12 @@ PROGRAM fortranlibtest_F03 total_error = total_error + 1 ENDIF - ret_total_error = 0 -! PROBLEMS with C -! CALL test_error(ret_total_error) -! CALL write_test_status(ret_total_error, ' Test error API based on data I/O', total_error) - WRITE(*,*) + ret_total_error = 0 + CALL test_error(ret_total_error) + CALL write_test_status(ret_total_error, ' Test error API based on data I/O', total_error) + ret_total_error = 0 CALL test_array_compound_atomic(ret_total_error) CALL write_test_status(ret_total_error, ' Testing 1-D Array of Compound Datatypes Functionality', total_error) @@ -175,6 +174,10 @@ PROGRAM fortranlibtest_F03 CALL test_obj_info(ret_total_error) CALL write_test_status(ret_total_error, ' Testing object info functions ', total_error) + ret_total_error = 0 + CALL test_error_stack(ret_total_error) + CALL write_test_status(ret_total_error, ' Test error H5E API stack operations', total_error) + ! write(*,*) ! write(*,*) '=========================================' ! write(*,*) 'Testing VDS ' diff --git a/fortran/test/tH5E.F90 b/fortran/test/tH5E.F90 index 0550bc8778e..5cf761477d6 100644 --- a/fortran/test/tH5E.F90 +++ b/fortran/test/tH5E.F90 @@ -48,8 +48,6 @@ SUBROUTINE error_report_test(cleanup, total_error) CHARACTER(LEN=8), PARAMETER :: err_filename = "err_file"! Error output file CHARACTER(LEN=80) :: fix_err_filename - - INTEGER(HID_T) :: file_id ! File identifier INTEGER(HID_T) :: grp_id ! Group identifier INTEGER :: error, tmp_error, err_flag diff --git a/fortran/test/tH5E_F03.F90 b/fortran/test/tH5E_F03.F90 index c2bf74be061..86e77ecc2bb 100644 --- a/fortran/test/tH5E_F03.F90 +++ b/fortran/test/tH5E_F03.F90 @@ -55,40 +55,116 @@ INTEGER FUNCTION my_hdf5_error_handler(estack_id, data_inout) bind(C) ! estack_id is always passed from C as: H5E_DEFAULT INTEGER(HID_T) :: estack_id + ! data that was registered with H5Eset_auto_f - INTEGER :: data_inout + ! INTEGER :: data_inout ! another option + ! or + TYPE(C_PTR), VALUE :: data_inout - PRINT*, " " - PRINT*, " Subtest: H5Eset_auto_f custom error message with callback, WITH DATA" - PRINT*, " -This message should be written to standard out- " - PRINT*, " Data Values Passed In =", data_inout - PRINT*, " " + INTEGER, POINTER :: iunit - data_inout = 10*data_inout + CALL C_F_POINTER(data_inout, iunit) - my_hdf5_error_handler = 1 ! this is not used by the C routine + ! iunit = data_inout - END FUNCTION my_hdf5_error_handler + WRITE(iunit,'(A)') "H5Eset_auto_f_msg" + WRITE(iunit,'(I0)') iunit - INTEGER FUNCTION my_hdf5_error_handler_nodata(estack_id, data_inout) bind(C) + iunit = 10*iunit - ! This error function handle works with only version 2 error stack - - IMPLICIT NONE + my_hdf5_error_handler = 1 ! this is not used by the C routine - ! estack_id is always passed from C as: H5E_DEFAULT - INTEGER(HID_T) :: estack_id - ! data that was registered with H5Eset_auto_f - TYPE(C_PTR) :: data_inout + END FUNCTION my_hdf5_error_handler - PRINT*, " " - PRINT*, " Subtest: H5Eset_auto_f custom error message with callback, NO DATA" - PRINT*, " -This message should be written to standard out- " - PRINT*, " " + !------------------------------------------------------------------------- + ! Function: custom_print_cb + ! + ! Purpose: Callback function to print error stack in customized way. + ! + !------------------------------------------------------------------------- + ! + INTEGER(C_INT) FUNCTION custom_print_cb(n, err_desc, op_data) BIND(C) - my_hdf5_error_handler_nodata = 1 ! this is not used by the C routine + IMPLICIT NONE - END FUNCTION my_hdf5_error_handler_nodata + INTEGER(SIZE_T), PARAMETER :: MSG_SIZE = 64 + + INTEGER(C_INT) :: n + TYPE(h5e_error_t) :: err_desc + TYPE(C_PTR) :: op_data + + CHARACTER(LEN=MSG_SIZE) :: maj + CHARACTER(LEN=MSG_SIZE) :: minn + CHARACTER(LEN=MSG_SIZE) :: cls + INTEGER(SIZE_T) :: size + INTEGER :: msg_type + + INTEGER :: error + + CALL H5Eget_class_name_f(err_desc%cls_id, cls, error) + IF(error .LT.0)THEN + custom_print_cb = -1 + RETURN + ENDIF + + IF(TRIM(cls).NE."Custom error class")THEN + custom_print_cb = -1 + RETURN + ENDIF + + size = 3 + CALL H5Eget_class_name_f(err_desc%cls_id, cls, error, size) + IF(error .LT.0)THEN + custom_print_cb = -1 + RETURN + ENDIF + IF(TRIM(cls).NE."Cus")THEN + custom_print_cb = -1 + RETURN + ENDIF + + size = 0 + CALL H5Eget_class_name_f(err_desc%cls_id, "", error, size) + IF(error .LT.0)THEN + custom_print_cb = -1 + RETURN + ENDIF + IF(size.NE.18)THEN + custom_print_cb = -1 + RETURN + ENDIF + + size = MSG_SIZE + CALL H5Eget_msg_f(err_desc%maj_num, msg_type, maj, error, size) + IF(error .LT.0)THEN + custom_print_cb = -1 + RETURN + ENDIF + + CALL h5eget_major_f(err_desc%maj_num, maj, size, error) + IF("MAJOR MSG".NE.TRIM(maj))THEN + custom_print_cb = -1 + RETURN + ENDIF + + IF(error .LT. 0)THEN + custom_print_cb = -1 + RETURN + ENDIF + + CALL h5eget_minor_f(err_desc%min_num, minn, error) + IF(error .LT. 0)THEN + custom_print_cb = -1 + RETURN + ENDIF + IF("MIN MSG".NE.TRIM(minn))THEN + custom_print_cb = -1 + RETURN + ENDIF + + custom_print_cb = 0 + + END FUNCTION custom_print_cb END MODULE test_my_hdf5_error_handler @@ -103,98 +179,304 @@ SUBROUTINE test_error(total_error) IMPLICIT NONE - INTEGER(hid_t), PARAMETER :: FAKE_ID = -1 INTEGER :: total_error INTEGER(hid_t) :: file - INTEGER(hid_t) :: dataset, space - INTEGER(hsize_t), DIMENSION(1:2) :: dims INTEGER :: error - INTEGER, DIMENSION(:), POINTER :: ptr_data INTEGER, TARGET :: my_hdf5_error_handler_data + INTEGER, TARGET :: iunit TYPE(C_PTR) :: f_ptr TYPE(C_FUNPTR) :: func + CHARACTER(LEN=180) :: chr180 + INTEGER :: idx - TYPE(C_PTR), TARGET :: f_ptr1 + LOGICAL :: status - INTEGER, DIMENSION(1:1) :: array_shape + ! set the error stack to the customized routine - my_hdf5_error_handler_data = 99 - CALL h5fcreate_f("terror.h5", H5F_ACC_TRUNC_F, file, error) - CALL check("h5fcreate_f", error, total_error) + iunit = 12 + OPEN(iunit, FILE="stderr.txt") - ! Create the data space - dims(1) = 10 - dims(2) = 20 - CALL H5Screate_simple_f(2, dims, space, error) - CALL check("h5screate_simple_f", error, total_error) + my_hdf5_error_handler_data = iunit ! ** SET THE CUSTOMIZED PRINTING OF ERROR STACK ** ! set the customized error handling routine - func = c_funloc(my_hdf5_error_handler) + func = C_FUNLOC(my_hdf5_error_handler) ! set the data sent to the customized routine - f_ptr = c_loc(my_hdf5_error_handler_data) + f_ptr = C_LOC(my_hdf5_error_handler_data) - ! turn on automatic printing, and use a custom error routine with input data CALL H5Eset_auto_f(1, error, H5E_DEFAULT_F, func, f_ptr) + CALL check("H5Eset_auto_f", error, total_error) - ! Create the erring dataset - CALL h5dcreate_f(FAKE_ID,"a_dataset",H5T_NATIVE_INTEGER, space, dataset, error) - CALL verify("h5dcreate_f", error, -1, total_error) + CALL h5fopen_f("DOESNOTEXIST", H5F_ACC_RDONLY_F, file, error) + CALL VERIFY("h5fopen_f", error, -1, total_error) -!!$ CALL verify("H5Eset_auto_f",my_hdf5_error_handler_data(1),10, total_error) -!!$ CALL verify("H5Eset_auto_f",my_hdf5_error_handler_data(2),20, total_error) + CLOSE(iunit) -!!$ ! Test enabling and disabling default printing -!!$ -!!$ CALL H5Eget_auto_f(H5E_DEFAULT_F, func1, f_ptr1, error) -!!$ CALL verify("H5Eget_auto_f", error, 0, total_error) + OPEN(iunit, FILE="stderr.txt") - ! PRINT*,c_associated(f_ptr1) + READ(iunit,'(A)') chr180 + idx = INDEX(string=chr180,substring="H5Eset_auto_f_msg") + IF(idx.EQ.0) CALL check("H5Eset_auto_f", -1, total_error) + READ(iunit, *) idx + CALL VERIFY("H5Eset_auto_f", idx, iunit, total_error) + CALL VERIFY("H5Eset_auto_f", my_hdf5_error_handler_data, 10*iunit, total_error) - ALLOCATE(ptr_data(1:2)) - ptr_data = 0 - array_shape(1) = 2 - CALL C_F_POINTER(f_ptr1, ptr_data, array_shape) + CLOSE(iunit, STATUS='delete') - ! ptr_data => f_ptr1(1) + CALL H5Eset_auto_f(0, error) + CALL check("H5Eset_auto_f", error, total_error) - ! PRINT*,ptr_data(1) + CALL h5fopen_f("DOESNOTEXIST", H5F_ACC_RDONLY_F, file, error) + CALL VERIFY("h5fopen_f", error, -1, total_error) -!!$ if(old_data != NULL) -!!$ TEST_ERROR; -!!$#ifdef H5_USE_16_API -!!$ if (old_func != (H5E_auto_t)H5Eprint) -!!$ TEST_ERROR; -!!$#else H5_USE_16_API -!!$ if (old_func != (H5E_auto2_t)H5Eprint2) -!!$ TEST_ERROR; -!!$#endif H5_USE_16_API + INQUIRE(file="H5Etest.txt", EXIST=status) + IF(status)THEN + CALL VERIFY("H5Eset_auto_f", error, -1, total_error) + ENDIF +END SUBROUTINE test_error - ! set the customized error handling routine - func = c_funloc(my_hdf5_error_handler_nodata) - ! set the data sent to the customized routine as null - f_ptr = C_NULL_PTR - ! turn on automatic printing, and use a custom error routine with no input data - CALL H5Eset_auto_f(1, error, H5E_DEFAULT_F, func, f_ptr) +SUBROUTINE test_error_stack(total_error) + + IMPLICIT NONE + + INTEGER :: total_error + INTEGER :: error + INTEGER(HID_T) :: cls_id, major, minor, estack_id, estack_id1, estack_id2 + CHARACTER(LEN=18), TARGET :: file + CHARACTER(LEN=18), TARGET :: func + INTEGER , TARGET :: line + TYPE(C_PTR) :: ptr1, ptr2, ptr3, ptr4 + + INTEGER :: msg_type + CHARACTER(LEN=9) :: maj_mesg = "MAJOR MSG" + CHARACTER(LEN=7) :: min_mesg = "MIN MSG" + !file status + LOGICAL :: status + CHARACTER(LEN=180) :: chr180 + INTEGER :: idx + INTEGER(SIZE_T) :: count + CHARACTER(LEN=64), TARGET :: stderr + TYPE(C_FUNPTR) :: func_ptr + +#ifdef H5_FORTRAN_HAVE_CHAR_ALLOC + CHARACTER(:), ALLOCATABLE :: msg_alloc +#endif + + CHARACTER(LEN=9) :: chr9 + INTEGER(SIZE_T) :: msg_size + + CALL h5eregister_class_f("Custom error class", "H5E_F03", "0.1", cls_id, error) + CALL check("H5Eregister_class_f", error, total_error) + + CALL H5Ecreate_msg_f(cls_id, H5E_MAJOR_F, maj_mesg, major, error) + CALL check("H5Ecreate_msg_f", error, total_error) + CALL H5Ecreate_msg_f(cls_id, H5E_MINOR_F, min_mesg, minor, error) + CALL check("H5Ecreate_msg_f", error, total_error) + + file = "FILE"//C_NULL_CHAR + func = "FUNC"//C_NULL_CHAR + line = 99 + + ptr1 = C_LOC(file(1:1)) + ptr2 = C_LOC(func(1:1)) + ptr3 = C_LOC(line) + + CALL h5ecreate_stack_f(estack_id, error) + CALL check("h5ecreate_stack_f", error, total_error) + + ! push a custom error message onto the stack + CALL H5Epush_f(estack_id, cls_id, major, minor, "%s ERROR TEXT %s"//C_NEW_LINE, error, & + ptr1, ptr2, ptr3, & + arg1=ACHAR(27)//"[31m", arg2=ACHAR(27)//"[0m" ) + CALL check("H5Epush_f", error, total_error) + + CALL h5eget_num_f(estack_id, count, error) + CALL check("h5eget_num_f", error, total_error) + CALL VERIFY("h5eget_num_f", count, 1_SIZE_T, total_error) + + msg_size = 0 + CALL H5Eget_msg_f(major, msg_type, chr9, error, msg_size) + CALL check("H5Eget_msg_f", error, total_error) + CALL VERIFY("H5Eget_msg_f", msg_type, H5E_MAJOR_F, total_error) + CALL VERIFY("H5Eget_msg_f", msg_size, 9_SIZE_T, total_error) + + ! Check when a shorter buffer length is passed as the msg_size + msg_size = 3 + CALL H5Eget_msg_f(major, msg_type, chr9, error, msg_size) + CALL check("H5Eget_msg_f", error, total_error) + CALL VERIFY("H5Eget_msg_f", msg_type, H5E_MAJOR_F, total_error) + CALL VERIFY("H5Eget_msg_f", msg_size, 9_SIZE_T, total_error) + CALL VERIFY("H5Eget_msg_f", TRIM(chr9), maj_mesg(1:3), total_error) + + ! Check when a exact size buffer length is passed as the msg_size + msg_size = 9 + CALL H5Eget_msg_f(major, msg_type, chr9, error, msg_size) + CALL check("H5Eget_msg_f", error, total_error) + CALL VERIFY("H5Eget_msg_f", msg_type, H5E_MAJOR_F, total_error) + CALL VERIFY("H5Eget_msg_f", msg_size, 9_SIZE_T, total_error) + CALL VERIFY("H5Eget_msg_f", TRIM(chr9), maj_mesg(1:9), total_error) + + msg_size = 0 + CALL H5Eget_msg_f(minor, msg_type, chr9, error, msg_size) + CALL check("H5Eget_msg_f", error, total_error) + CALL VERIFY("H5Eget_msg_f", msg_type, H5E_MINOR_F, total_error) + CALL VERIFY("H5Eget_msg_f", msg_size, 7_SIZE_T, total_error) + + ! Check when a shorter buffer length is passed as the msg_size + msg_size = 3 + CALL H5Eget_msg_f(minor, msg_type, chr9, error, msg_size) + CALL check("H5Eget_msg_f", error, total_error) + CALL VERIFY("H5Eget_msg_f", msg_type, H5E_MINOR_F, total_error) + CALL VERIFY("H5Eget_msg_f", msg_size, 7_SIZE_T, total_error) + CALL VERIFY("H5Eget_msg_f", TRIM(chr9), min_mesg(1:3), total_error) + + ! Check when a larger buffer length is passed as the msg_size + msg_size = 9 + CALL H5Eget_msg_f(minor, msg_type, chr9, error, msg_size) + CALL check("H5Eget_msg_f", error, total_error) + CALL VERIFY("H5Eget_msg_f", msg_type, H5E_MINOR_F, total_error) + CALL VERIFY("H5Eget_msg_f", msg_size, 7_SIZE_T, total_error) + CALL VERIFY("H5Eget_msg_f", TRIM(chr9), min_mesg(1:7), total_error) + + ! Check with an allocatable character of the exact size +#ifdef H5_FORTRAN_HAVE_CHAR_ALLOC + msg_size = 0 + CALL H5Eget_msg_f(minor, msg_type, "", error, msg_size) + CALL check("H5Eget_msg_f", error, total_error) + CALL VERIFY("H5Eget_msg_f", msg_type, H5E_MINOR_F, total_error) + CALL VERIFY("H5Eget_msg_f", msg_size, 7_SIZE_T, total_error) + + ALLOCATE(CHARACTER(LEN=msg_size) :: msg_alloc) + CALL H5Eget_msg_f(minor, msg_type, msg_alloc, error) + CALL check("H5Eget_msg_f", error, total_error) + CALL VERIFY("H5Eget_msg_f", msg_type, H5E_MINOR_F, total_error) + CALL VERIFY("H5Eget_msg_f", msg_alloc, min_mesg, total_error) +#endif + + CALL h5eprint_f(H5E_DEFAULT_F, error) + CALL check("h5eprint_f", error, total_error) + CALL h5eprint_f(error) + CALL check("h5eprint_f", error, total_error) + + INQUIRE(file="H5Etest.txt", EXIST=status) + IF(status)THEN + OPEN(UNIT=12, FILE="H5Etest.txt", status='old') + CLOSE(12, STATUS='delete') + ENDIF + + CALL h5eprint_f(estack_id, error, "H5Etest.txt") + CALL check("h5eprint_f", error, total_error) + + INQUIRE(file="H5Etest.txt", EXIST=status) + IF(.NOT.status)THEN + CALL check("h5eprint_f", -1, total_error) + ELSE + OPEN(UNIT=12, FILE="H5Etest.txt", status='old') + + READ(12,'(A)') chr180 + idx = INDEX(string=chr180,substring="Custom error class") + IF(idx.EQ.0) CALL check("h5eprint_f1", -1, total_error) + idx = INDEX(string=chr180,substring="H5E_F03") + IF(idx.EQ.0) CALL check("h5eprint_f2", -1, total_error) + idx = INDEX(string=chr180,substring="0.1") + IF(idx.EQ.0) CALL check("h5eprint_f3", -1, total_error) + + READ(12,'(A)') chr180 + idx = INDEX(string=chr180,substring="FILE") + IF(idx.EQ.0) CALL check("h5eprint_f4", -1, total_error) + idx = INDEX(string=chr180,substring="99") + IF(idx.EQ.0) CALL check("h5eprint_f5", -1, total_error) + idx = INDEX(string=chr180,substring="FUNC") + IF(idx.EQ.0) CALL check("h5eprint_f6", -1, total_error) + idx = INDEX(string=chr180,substring="ERROR TEXT") + IF(idx.EQ.0) CALL check("h5eprint_f7", -1, total_error) + + READ(12,'()') + + READ(12,"(A)") chr180 + idx = INDEX(string=chr180,substring=maj_mesg) + IF(idx.EQ.0) CALL check("h5eprint_f", -1, total_error) + + READ(12,"(A)") chr180 + idx = INDEX(string=chr180,substring=min_mesg) + IF(idx.EQ.0) CALL check("h5eprint_f", -1, total_error) + + CLOSE(12, STATUS='delete') + ENDIF + + stderr = "** Print error stack in customized way **"//C_NULL_CHAR + ptr4 = C_LOC(stderr(1:1)) + func_ptr = C_FUNLOC(custom_print_cb) + + CALL h5ewalk_f(estack_id, H5E_WALK_UPWARD_F, func_ptr, ptr4, error) + CALL check("h5ewalk_f", error, total_error) + + CALL h5eget_num_f(estack_id, count, error) + CALL check("h5eget_num_f", error, total_error) + CALL VERIFY("h5eget_num_f", count, 1_SIZE_T, total_error) + + CALL H5Ecreate_stack_f(estack_id2, error) + CALL check("H5Ecreate_stack_f", error, total_error) + + CALL H5Eappend_stack_f(estack_id2, estack_id, .FALSE., error) + CALL check("H5Eappend_stack_f", error, total_error) + + CALL h5eget_num_f(estack_id2, count, error) + CALL check("h5eget_num_f", error, total_error) + CALL VERIFY("h5eget_num_f", count, 1_SIZE_T, total_error) + + ! Copy error stack, which clears the original + CALL H5Eget_current_stack_f(estack_id1, error) + CALL check("H5Eget_current_stack_f", error, total_error) + + CALL h5eget_num_f(estack_id1, count, error) + CALL check("h5eget_num_f", error, total_error) + CALL VERIFY("h5eget_num_f", count, 0_SIZE_T, total_error) + + CALL H5Eclose_stack_f(estack_id2, error) + CALL check(" H5Eclose_stack_f", error, total_error) + + CALL H5Eclose_stack_f(estack_id, error) + CALL check("H5Eclose_stack_f", error, total_error) + + CALL H5Eclose_stack_f(estack_id1, error) + CALL check("H5Eclose_stack_f", error, total_error) + + CALL h5ecreate_stack_f(estack_id1, error) + CALL check("h5ecreate_stack_f", error, total_error) - CALL h5dcreate_f(FAKE_ID,"a_dataset",H5T_NATIVE_INTEGER, space, dataset, error) - CALL verify("h5dcreate_f", error, -1, total_error) + ! push a custom error message onto the stack + CALL H5Epush_f(estack_id1, cls_id, major, minor, "%s ERROR TEXT %s"//C_NEW_LINE, error, & + ptr1, ptr2, ptr3, & + arg1=ACHAR(27)//"[31m", arg2=ACHAR(27)//"[0m" ) + CALL check("H5Epush_f", error, total_error) + CALL H5Eset_current_stack_f(estack_id1, error) ! API will also close estack_id1 + CALL check("H5Eset_current_stack_f", error, total_error) - ! turn on automatic printing with h5eprint_f which prints an error stack in the default manner. + CALL h5eget_num_f(H5E_DEFAULT_F, count, error) + CALL check("h5eget_num_f", error, total_error) + CALL VERIFY("h5eget_num_f", count, 1_SIZE_T, total_error) - ! func = c_funloc(h5eprint_f) - ! CALL H5Eset_auto_f(0, error, H5E_DEFAULT_F, func, C_NULL_PTR) + CALL h5epop_f(H5E_DEFAULT_F, 1_size_t, total_error) + CALL check("h5epop_f", error, total_error) - CALL H5Eset_auto_f(0, error) - CALL h5dcreate_f(FAKE_ID,"a_dataset",H5T_NATIVE_INTEGER, space, dataset, error) + CALL h5eget_num_f(H5E_DEFAULT_F, count, error) + CALL check("h5eget_num_f", error, total_error) + CALL VERIFY("h5eget_num_f", count, 0_SIZE_T, total_error) - CALL H5Eset_auto_f(1, error) - CALL h5dcreate_f(FAKE_ID,"a_dataset",H5T_NATIVE_INTEGER, space, dataset, error) + CALL H5Eclose_msg_f(major, error) + CALL check("H5Eclose_msg_f", error, total_error) -END SUBROUTINE test_error + CALL H5Eclose_msg_f(minor, error) + CALL check("H5Eclose_msg_f", error, total_error) + + CALL h5eunregister_class_f(cls_id, error) + CALL check("H5Eunregister_class_f", error, total_error) + +END SUBROUTINE test_error_stack END MODULE TH5E_F03 diff --git a/fortran/test/tH5I.F90 b/fortran/test/tH5I.F90 index a5fedb97c95..7d97219b177 100644 --- a/fortran/test/tH5I.F90 +++ b/fortran/test/tH5I.F90 @@ -308,9 +308,12 @@ SUBROUTINE identifier_test(cleanup, total_error) ! Clear the error stack from the file close failure CALL h5eset_auto_f(1, error) CALL h5eclear_f(error) + CALL check("h5eclear_f",error,total_error) + CALL h5eclear_f(error, H5P_DEFAULT_F) + CALL check("h5eclear_f",error,total_error) - if(cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) - CALL check("h5_cleanup_f", error, total_error) + IF(cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) RETURN END SUBROUTINE identifier_test diff --git a/fortran/test/tH5Sselect.F90 b/fortran/test/tH5Sselect.F90 index 7b3a0664b71..bcf254ae2a5 100644 --- a/fortran/test/tH5Sselect.F90 +++ b/fortran/test/tH5Sselect.F90 @@ -405,7 +405,7 @@ SUBROUTINE test_select_iter(cleanup, total_error) CALL VERIFY("H5Ssel_iter_get_seq_list_f", nseq, 4_SIZE_T, total_error) CALL VERIFY("H5Ssel_iter_get_seq_list_f", nbytes, 4_SIZE_T, total_error) CALL VERIFY("H5Ssel_iter_get_seq_list_f", off(NUMP+1), INT(-99,HSIZE_T), total_error) - CALL VERIFY("H5Ssel_iter_get_seq_list_f", ilen(NUMP+1), INT(-99,HSIZE_T), total_error) + CALL VERIFY("H5Ssel_iter_get_seq_list_f", ilen(NUMP+1), INT(-99,SIZE_T), total_error) DO i = 1, NUMP CALL VERIFY("H5Ssel_iter_get_seq_list_f", off(i), INT((i-1)*26+12,HSIZE_T), total_error) CALL VERIFY("H5Ssel_iter_get_seq_list_f", ilen(i), INT(1,SIZE_T), total_error) @@ -414,7 +414,7 @@ SUBROUTINE test_select_iter(cleanup, total_error) CALL VERIFY("H5Ssel_iter_get_seq_list_f", nseq, 4_SIZE_T, total_error) CALL VERIFY("H5Ssel_iter_get_seq_list_f", nbytes, 16_SIZE_T, total_error) CALL VERIFY("H5Ssel_iter_get_seq_list_f", off(NUMP+1), INT(-99,HSIZE_T), total_error) - CALL VERIFY("H5Ssel_iter_get_seq_list_f", ilen(NUMP+1), INT(-99,HSIZE_T), total_error) + CALL VERIFY("H5Ssel_iter_get_seq_list_f", ilen(NUMP+1), INT(-99,SIZE_T), total_error) DO i = 1, NUMP CALL VERIFY("H5Ssel_iter_get_seq_list_f", off(i), INT((i-1)*12,HSIZE_T), total_error) CALL VERIFY("H5Ssel_iter_get_seq_list_f", ilen(i), INT(4,SIZE_T), total_error) @@ -423,21 +423,16 @@ SUBROUTINE test_select_iter(cleanup, total_error) CALL VERIFY("H5Ssel_iter_get_seq_list_f", nseq, 1_SIZE_T, total_error ) CALL VERIFY("H5Ssel_iter_get_seq_list_f", nbytes, 72_SIZE_T, total_error ) CALL VERIFY("H5Ssel_iter_get_seq_list_f", off(1), INT(0,HSIZE_T), total_error) - CALL VERIFY("H5Ssel_iter_get_seq_list_f", ilen(1), INT(72,HSIZE_T), total_error) + CALL VERIFY("H5Ssel_iter_get_seq_list_f", ilen(1), INT(72,SIZE_T), total_error) CALL VERIFY("H5Ssel_iter_get_seq_list_f", off(2), INT(-99,HSIZE_T), total_error) - CALL VERIFY("H5Ssel_iter_get_seq_list_f", ilen(2), INT(-99,HSIZE_T), total_error) + CALL VERIFY("H5Ssel_iter_get_seq_list_f", ilen(2), INT(-99,SIZE_T), total_error) ELSE CALL check("Incorrect selection option", error, total_error) ENDIF ! Reset iterator - !CALL H5Ssel_iter_reset_f(iter_id, sid, error) - !CALL check("H5Ssel_iter_reset_f", error, total_error) - - !off = -99 - !ilen = -99 - !CALL H5Ssel_iter_get_seq_list_f(iter_id, SEL_ITER_MAX_SEQ, 1024_size_t * 1024_size_t, nseq, nbytes, off, ilen, error) - !CALL check("H5Ssel_iter_get_seq_list_f", error, total_error) + CALL H5Ssel_iter_reset_f(iter_id, sid, error) + CALL check("H5Ssel_iter_reset_f", error, total_error) ! Close selection iterator CALL H5Ssel_iter_close_f(iter_id, error) diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt index e8f010721fe..4d3a3309a7f 100644 --- a/fortran/testpar/CMakeLists.txt +++ b/fortran/testpar/CMakeLists.txt @@ -20,6 +20,7 @@ add_executable (parallel_test ptest.F90 hyper.F90 mdset.F90 + mpi_param.F90 multidsetrw.F90 ) target_include_directories (parallel_test diff --git a/fortran/testpar/Makefile.am b/fortran/testpar/Makefile.am index 1c374090601..3df1fee8f09 100644 --- a/fortran/testpar/Makefile.am +++ b/fortran/testpar/Makefile.am @@ -39,7 +39,7 @@ check_PROGRAMS=$(TEST_PROG_PARA) CHECK_CLEANFILES+=parf[12].h5 h5*_tests.h5 subf.h5* *.mod # Test source files -parallel_test_SOURCES=ptest.F90 hyper.F90 mdset.F90 multidsetrw.F90 +parallel_test_SOURCES=ptest.F90 hyper.F90 mdset.F90 multidsetrw.F90 mpi_param.F90 subfiling_test_SOURCES=subfiling.F90 async_test_SOURCES=async.F90 diff --git a/fortran/testpar/async.F90 b/fortran/testpar/async.F90 index 02045cb7d58..5c7411f6ddb 100644 --- a/fortran/testpar/async.F90 +++ b/fortran/testpar/async.F90 @@ -26,9 +26,8 @@ MODULE test_async_APIs LOGICAL :: async_enabled = .TRUE. LOGICAL :: mpi_thread_mult = .TRUE. - INTEGER(C_INT), PARAMETER :: logical_true = 1 - INTEGER(C_INT), PARAMETER :: logical_false = 0 - + LOGICAL(C_BOOL), PARAMETER :: logical_true = .TRUE. + LOGICAL(C_BOOL), PARAMETER :: logical_false = .FALSE. ! Custom group iteration callback data TYPE, bind(c) :: iter_info @@ -178,7 +177,7 @@ SUBROUTINE H5A_async_tests(cleanup, total_error) INTEGER(HID_T) :: space_id INTEGER(HID_T) :: attr_id0, attr_id1, attr_id2 LOGICAL :: exists - INTEGER(C_INT), TARGET :: exists0=logical_false, exists1=logical_false, exists2=logical_false, exists3=logical_false + LOGICAL(C_BOOL), TARGET :: exists0=logical_false, exists1=logical_false, exists2=logical_false, exists3=logical_false TYPE(C_PTR) :: f_ptr, f_ptr1, f_ptr2 CALL H5EScreate_f(es_id, hdferror) @@ -788,7 +787,7 @@ SUBROUTINE H5L_async_tests(cleanup, total_error) INTEGER(hid_t) :: sid = -1 ! Dataspace ID CHARACTER(LEN=12), PARAMETER :: CORDER_GROUP_NAME = "corder_group" CHARACTER(LEN=12), PARAMETER :: CORDER_GROUP_NAME2 = "corder_grp00" - INTEGER(C_INT), TARGET :: exists1, exists2 + LOGICAL(C_BOOL), TARGET :: exists1, exists2 LOGICAL :: exists TYPE(C_PTR) :: f_ptr diff --git a/fortran/testpar/mpi_param.F90 b/fortran/testpar/mpi_param.F90 new file mode 100644 index 00000000000..ba4eaaae963 --- /dev/null +++ b/fortran/testpar/mpi_param.F90 @@ -0,0 +1,326 @@ +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! Copyright by The HDF Group. * +! All rights reserved. * +! * +! This file is part of HDF5. The full HDF5 copyright notice, including * +! terms governing use, modification, and redistribution, is contained in * +! the COPYING file, which can be found at the root of the source code * +! distribution tree, or in https://www.hdfgroup.org/licenses. * +! If you do not have access to either file, you may request a copy from * +! help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + +#include + +! +! writes/reads dataset by hyperslabs +! + +SUBROUTINE mpi_param_03(nerrors) + + 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 :: iconfig + CHARACTER(LEN=4) , PARAMETER :: in_key="host" + CHARACTER(LEN=10), PARAMETER :: in_value="myhost.org" + + CHARACTER(LEN=MPI_MAX_INFO_KEY) :: key, value + + ! Get the original sizes + CALL mpi_comm_rank( MPI_COMM_WORLD, mpi_rank, mpierror ) + IF (mpierror .NE. MPI_SUCCESS) THEN + WRITE(*,*) "MPI_COMM_RANK *FAILED*" + nerrors = nerrors + 1 + ENDIF + CALL mpi_comm_size( MPI_COMM_WORLD, mpi_size, mpierror ) + IF (mpierror .NE. MPI_SUCCESS) THEN + WRITE(*,*) "MPI_COMM_SIZE *FAILED* Process = ", mpi_rank + nerrors = nerrors + 1 + ENDIF + + DO iconfig = 1, 2 + + ! Create the file access property + CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl_id, hdferror) + CALL check("h5pcreate_f", hdferror, nerrors) + + ! Split the communicator + IF(mpi_rank.EQ.0)THEN + CALL MPI_Comm_split(MPI_COMM_WORLD, 1, 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) + IF (mpierror .NE. MPI_SUCCESS) THEN + WRITE(*,*) "MPI_COMM_SPLIT *FAILED* Process = ", mpi_rank + nerrors = nerrors + 1 + ENDIF + ENDIF + + ! Create and set an MPI INFO parameter + + CALL MPI_Info_create(info, mpierror) + IF (mpierror .NE. MPI_SUCCESS) THEN + WRITE(*,*) "MPI_INFO_CREATE *FAILED* Process = ", mpi_rank + nerrors = nerrors + 1 + ENDIF + CALL MPI_Info_set(info, in_key, in_value, mpierror ) + IF (mpierror .NE. MPI_SUCCESS) THEN + WRITE(*,*) "MPI_INFO_SET *FAILED* Process = ", mpi_rank + nerrors = nerrors + 1 + ENDIF + + IF(iconfig.EQ.1)THEN + ! Set and get the MPI parameters + CALL h5pset_fapl_mpio_f(fapl_id, comm, info, hdferror) + CALL check("h5pset_fapl_mpio_f", hdferror, nerrors) + + CALL h5pget_fapl_mpio_f(fapl_id, comm_ret, info_ret, hdferror) + CALL check("h5pget_fapl_mpio_f", hdferror, nerrors) + ELSE + CALL h5pset_mpi_params_f(fapl_id, comm, info, hdferror) + CALL check("h5pset_mpi_params_f", hdferror, nerrors) + + CALL h5pget_mpi_params_f(fapl_id, comm_ret, info_ret, hdferror) + CALL check("h5pget_mpi_params_f", hdferror, nerrors) + ENDIF + + + ! Check comm returned + CALL mpi_comm_size(comm_ret, mpi_size_ret, mpierror) + IF (mpierror .NE. MPI_SUCCESS) THEN + WRITE(*,*) "MPI_COMM_SIZE *FAILED* Process = ", mpi_rank + nerrors = nerrors + 1 + ENDIF + IF (mpi_rank.EQ.0)THEN + CALL VERIFY("h5pget_fapl_mpio_f", mpi_size_ret, 1, hdferror) + ELSE + CALL VERIFY("h5pget_fapl_mpio_f", mpi_size_ret, mpi_size-1, hdferror) + ENDIF + + ! Check info returned + CALL MPI_info_get_nkeys( info_ret, nkeys, mpierror) + IF (mpierror .NE. MPI_SUCCESS) THEN + WRITE(*,*) "MPI_INFO_GET_NKEYS *FAILED* Process = ", mpi_rank + nerrors = nerrors + 1 + ENDIF + CALL VERIFY("h5pget_fapl_mpio_f", nkeys, 1, hdferror) + + CALL MPI_Info_get_nthkey(info_ret, 0, key, mpierror) + IF (mpierror .NE. MPI_SUCCESS) THEN + WRITE(*,*) "MPI_INFO_GET_NTHKEY *FAILED* Process = ", mpi_rank + nerrors = nerrors + 1 + ENDIF + CALL VERIFY("h5pget_fapl_mpio_f", TRIM(key), in_key, hdferror) + + CALL MPI_Info_get(info, key, MPI_MAX_INFO_KEY, value, flag, mpierror) + IF (mpierror .NE. MPI_SUCCESS) THEN + 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", TRIM(value), in_value, hdferror) + + ! Free the MPI resources + CALL MPI_info_free(info_ret, mpierror) + IF (mpierror .NE. MPI_SUCCESS) THEN + WRITE(*,*) "MPI_INFO_FREE *FAILED* Process = ", mpi_rank + nerrors = nerrors + 1 + ENDIF + CALL MPI_comm_free(comm_ret, mpierror) + IF (mpierror .NE. MPI_SUCCESS) THEN + WRITE(*,*) "MPI_COMM_FREE *FAILED* Process = ", mpi_rank + nerrors = nerrors + 1 + ENDIF + CALL MPI_info_free(info, mpierror) + IF (mpierror .NE. MPI_SUCCESS) THEN + WRITE(*,*) "MPI_INFO_FREE *FAILED* Process = ", mpi_rank + nerrors = nerrors + 1 + ENDIF + CALL MPI_comm_free(comm, mpierror) + IF (mpierror .NE. MPI_SUCCESS) THEN + WRITE(*,*) "MPI_COMM_FREE *FAILED* Process = ", mpi_rank + nerrors = nerrors + 1 + ENDIF + + CALL h5pclose_f(fapl_id, hdferror) + CALL check("h5pclose_f", hdferror, nerrors) + ENDDO + +END SUBROUTINE mpi_param_03 + +SUBROUTINE mpi_param_08(nerrors) + +#ifdef H5_HAVE_MPI_F08 + + USE MPI_F08 + 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 + + TYPE(MPI_INFO) :: info, info_ret + TYPE(MPI_COMM) :: comm, comm_ret + INTEGER :: nkeys + LOGICAL :: flag + INTEGER :: iconfig + CHARACTER(LEN=4) , PARAMETER :: in_key="host" + CHARACTER(LEN=10), PARAMETER :: in_value="myhost.org" + + CHARACTER(LEN=MPI_MAX_INFO_KEY) :: key, value + + ! Get the original sizes + CALL mpi_comm_rank( MPI_COMM_WORLD, mpi_rank, mpierror ) + IF (mpierror .NE. MPI_SUCCESS) THEN + WRITE(*,*) "MPI_COMM_RANK *FAILED*" + nerrors = nerrors + 1 + ENDIF + CALL mpi_comm_size( MPI_COMM_WORLD, mpi_size, mpierror ) + IF (mpierror .NE. MPI_SUCCESS) THEN + WRITE(*,*) "MPI_COMM_SIZE *FAILED* Process = ", mpi_rank + nerrors = nerrors + 1 + ENDIF + + DO iconfig = 1, 2 + + ! Create the file access property + CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl_id, hdferror) + CALL check("h5pcreate_f", hdferror, nerrors) + + ! Split the communicator + IF(mpi_rank.EQ.0)THEN + CALL MPI_Comm_split(MPI_COMM_WORLD, 1, 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) + IF (mpierror .NE. MPI_SUCCESS) THEN + WRITE(*,*) "MPI_COMM_SPLIT *FAILED* Process = ", mpi_rank + nerrors = nerrors + 1 + ENDIF + ENDIF + + ! Create and set an MPI INFO parameter + + CALL MPI_Info_create(info, mpierror) + IF (mpierror .NE. MPI_SUCCESS) THEN + WRITE(*,*) "MPI_INFO_CREATE *FAILED* Process = ", mpi_rank + nerrors = nerrors + 1 + ENDIF + CALL MPI_Info_set(info, in_key, in_value, mpierror ) + IF (mpierror .NE. MPI_SUCCESS) THEN + WRITE(*,*) "MPI_INFO_SET *FAILED* Process = ", mpi_rank + nerrors = nerrors + 1 + ENDIF + + IF(iconfig.EQ.1)THEN + ! Set and get the MPI parameters + CALL h5pset_fapl_mpio_f(fapl_id, comm, info, hdferror) + CALL check("h5pset_fapl_mpio_f", hdferror, nerrors) + + CALL h5pget_fapl_mpio_f(fapl_id, comm_ret, info_ret, hdferror) + CALL check("h5pget_fapl_mpio_f", hdferror, nerrors) + ELSE + CALL h5pset_mpi_params_f(fapl_id, comm, info, hdferror) + CALL check("h5pset_mpi_params_f", hdferror, nerrors) + + CALL h5pget_mpi_params_f(fapl_id, comm_ret, info_ret, hdferror) + CALL check("h5pget_mpi_params_f", hdferror, nerrors) + ENDIF + + + ! Check comm returned + CALL mpi_comm_size(comm_ret, mpi_size_ret, mpierror) + IF (mpierror .NE. MPI_SUCCESS) THEN + WRITE(*,*) "MPI_COMM_SIZE *FAILED* Process = ", mpi_rank + nerrors = nerrors + 1 + ENDIF + IF (mpi_rank.EQ.0)THEN + CALL VERIFY("h5pget_fapl_mpio_f", mpi_size_ret, 1, hdferror) + ELSE + CALL VERIFY("h5pget_fapl_mpio_f", mpi_size_ret, mpi_size-1, hdferror) + ENDIF + + ! Check info returned + CALL MPI_info_get_nkeys( info_ret, nkeys, mpierror) + IF (mpierror .NE. MPI_SUCCESS) THEN + WRITE(*,*) "MPI_INFO_GET_NKEYS *FAILED* Process = ", mpi_rank + nerrors = nerrors + 1 + ENDIF + CALL VERIFY("h5pget_fapl_mpio_f", nkeys, 1, hdferror) + + CALL MPI_Info_get_nthkey(info_ret, 0, key, mpierror) + IF (mpierror .NE. MPI_SUCCESS) THEN + WRITE(*,*) "MPI_INFO_GET_NTHKEY *FAILED* Process = ", mpi_rank + nerrors = nerrors + 1 + ENDIF + CALL VERIFY("h5pget_fapl_mpio_f", TRIM(key), in_key, hdferror) + + CALL MPI_Info_get(info, key, MPI_MAX_INFO_KEY, value, flag, mpierror) + IF (mpierror .NE. MPI_SUCCESS) THEN + 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", TRIM(value), in_value, hdferror) + + ! Free the MPI resources + CALL MPI_info_free(info_ret, mpierror) + IF (mpierror .NE. MPI_SUCCESS) THEN + WRITE(*,*) "MPI_INFO_FREE *FAILED* Process = ", mpi_rank + nerrors = nerrors + 1 + ENDIF + CALL MPI_comm_free(comm_ret, mpierror) + IF (mpierror .NE. MPI_SUCCESS) THEN + WRITE(*,*) "MPI_COMM_FREE *FAILED* Process = ", mpi_rank + nerrors = nerrors + 1 + ENDIF + CALL MPI_info_free(info, mpierror) + IF (mpierror .NE. MPI_SUCCESS) THEN + WRITE(*,*) "MPI_INFO_FREE *FAILED* Process = ", mpi_rank + nerrors = nerrors + 1 + ENDIF + CALL MPI_comm_free(comm, mpierror) + IF (mpierror .NE. MPI_SUCCESS) THEN + WRITE(*,*) "MPI_COMM_FREE *FAILED* Process = ", mpi_rank + nerrors = nerrors + 1 + ENDIF + + CALL h5pclose_f(fapl_id, hdferror) + CALL check("h5pclose_f", hdferror, nerrors) + ENDDO +#else + INTEGER, INTENT(inout) :: nerrors ! number of errors + nerrors = -1 ! Skip test +#endif + +END SUBROUTINE mpi_param_08 + diff --git a/fortran/testpar/ptest.F90 b/fortran/testpar/ptest.F90 index b754e297cc0..d2e9d105703 100644 --- a/fortran/testpar/ptest.F90 +++ b/fortran/testpar/ptest.F90 @@ -58,6 +58,16 @@ PROGRAM parallel_test IF(mpi_rank==0) CALL write_test_header("COMPREHENSIVE PARALLEL FORTRAN TESTS") + ret_total_error = 0 + CALL mpi_param_03(ret_total_error) + IF(mpi_rank==0) CALL write_test_status(ret_total_error, & + 'Testing MPI communicator and info (F03)', total_error) + + ret_total_error = 0 + CALL mpi_param_08(ret_total_error) + IF(mpi_rank==0) CALL write_test_status(ret_total_error, & + 'Testing MPI communicator and info (F08)', total_error) + ! ! test write/read dataset by hyperslabs (contiguous/chunk) with independent/collective MPI I/O ! diff --git a/hl/CMakeLists.txt b/hl/CMakeLists.txt index 45a9a22dded..ab4bc79cc3f 100644 --- a/hl/CMakeLists.txt +++ b/hl/CMakeLists.txt @@ -26,6 +26,6 @@ if (HDF5_BUILD_EXAMPLES) endif () #-- Build the Unit testing if requested -if (HDF5_EXTERNALLY_CONFIGURED AND BUILD_TESTING AND HDF5_TEST_SERIAL) +if (NOT HDF5_EXTERNALLY_CONFIGURED AND BUILD_TESTING AND HDF5_TEST_SERIAL) add_subdirectory (test) endif () diff --git a/hl/c++/examples/CMakeTests.cmake b/hl/c++/examples/CMakeTests.cmake index 8b2b4ce21d0..d0a647e1d1c 100644 --- a/hl/c++/examples/CMakeTests.cmake +++ b/hl/c++/examples/CMakeTests.cmake @@ -28,7 +28,7 @@ set_tests_properties (HL_CPP_ex_ptExampleFL-clear-objects PROPERTIES WORKING_DIRECTORY ${PROJECT_BINARY_DIR} ) -if (HDF5_ENABLE_USING_MEMCHECKER) +if (HDF5_USING_ANALYSIS_TOOL) add_test (NAME HL_CPP_ex_ptExampleFL COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME HL_CPP_ex_ptExampleFL COMMAND "${CMAKE_COMMAND}" diff --git a/hl/c++/test/CMakeTests.cmake b/hl/c++/test/CMakeTests.cmake index b07dd6d0a24..3da3e477acd 100644 --- a/hl/c++/test/CMakeTests.cmake +++ b/hl/c++/test/CMakeTests.cmake @@ -28,7 +28,7 @@ set_tests_properties (HL_CPP_ptableTest-clear-objects PROPERTIES WORKING_DIRECTORY ${PROJECT_BINARY_DIR} ) -if (HDF5_ENABLE_USING_MEMCHECKER) +if (HDF5_USING_ANALYSIS_TOOL) add_test (NAME HL_CPP_ptableTest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME HL_CPP_ptableTest COMMAND "${CMAKE_COMMAND}" diff --git a/hl/examples/CMakeTests.cmake b/hl/examples/CMakeTests.cmake index 6a0a6e78afd..ee376cade7b 100644 --- a/hl/examples/CMakeTests.cmake +++ b/hl/examples/CMakeTests.cmake @@ -68,7 +68,7 @@ set_tests_properties (HL_ex-clean-objects PROPERTIES ) foreach (example ${examples}) - if (HDF5_ENABLE_USING_MEMCHECKER) + if (HDF5_USING_ANALYSIS_TOOL) add_test (NAME HL_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME HL_ex_${example} COMMAND "${CMAKE_COMMAND}" diff --git a/hl/fortran/examples/CMakeTests.cmake b/hl/fortran/examples/CMakeTests.cmake index 46827b5c60e..c5273e541f3 100644 --- a/hl/fortran/examples/CMakeTests.cmake +++ b/hl/fortran/examples/CMakeTests.cmake @@ -41,7 +41,7 @@ set_tests_properties (HL_FORTRAN_f90_ex-clean-objects PROPERTIES ) foreach (example ${examples}) - if (HDF5_ENABLE_USING_MEMCHECKER) + if (HDF5_USING_ANALYSIS_TOOL) add_test (NAME HL_FORTRAN_f90_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME HL_FORTRAN_f90_ex_${example} COMMAND "${CMAKE_COMMAND}" diff --git a/hl/fortran/test/CMakeTests.cmake b/hl/fortran/test/CMakeTests.cmake index 84218728db6..0ab8b5a719c 100644 --- a/hl/fortran/test/CMakeTests.cmake +++ b/hl/fortran/test/CMakeTests.cmake @@ -49,7 +49,7 @@ set_tests_properties (HL_FORTRAN_test-clean-objects PROPERTIES ) macro (ADD_H5_FORTRAN_TEST file) - if (HDF5_ENABLE_USING_MEMCHECKER) + if (HDF5_USING_ANALYSIS_TOOL) add_test (NAME HL_FORTRAN_f90_${file} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME HL_FORTRAN_f90_${file} COMMAND "${CMAKE_COMMAND}" diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 6bd13376bf6..099356f7af1 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -286,14 +286,33 @@ image_realloc(void *ptr, size_t size, H5FD_file_image_op_t file_image_op, void * goto out; if (file_image_op == H5FD_FILE_IMAGE_OP_FILE_RESIZE) { + void *tmp_realloc; + if (udata->vfd_image_ptr != ptr) goto out; if (udata->vfd_ref_count != 1) goto out; - if (NULL == (udata->vfd_image_ptr = realloc(ptr, size))) + /* Make sure all the udata structure image pointers + * match each other before we update them + */ + assert(udata->vfd_image_ptr == udata->app_image_ptr); + assert(udata->vfd_image_ptr == udata->fapl_image_ptr); + + tmp_realloc = realloc(ptr, size); + if (tmp_realloc) { + udata->vfd_image_ptr = tmp_realloc; + udata->app_image_ptr = udata->vfd_image_ptr; + udata->fapl_image_ptr = udata->vfd_image_ptr; + } + else { + free(ptr); + udata->vfd_image_ptr = NULL; + udata->app_image_ptr = NULL; + udata->fapl_image_ptr = NULL; goto out; + } udata->vfd_image_size = size; return_value = udata->vfd_image_ptr; @@ -359,11 +378,20 @@ image_free(void *ptr, H5FD_file_image_op_t file_image_op, void *_udata) * references */ if (udata->fapl_ref_count == 0 && udata->vfd_ref_count == 0 && !(udata->flags & H5LT_FILE_IMAGE_DONT_RELEASE)) { + /* Make sure we aren't going to leak memory elsewhere */ + assert(udata->app_image_ptr == udata->vfd_image_ptr || udata->app_image_ptr == NULL); + assert(udata->fapl_image_ptr == udata->vfd_image_ptr || udata->fapl_image_ptr == NULL); + free(udata->vfd_image_ptr); udata->app_image_ptr = NULL; udata->fapl_image_ptr = NULL; udata->vfd_image_ptr = NULL; - } /* end if */ + } + + /* release reference to udata structure */ + if (udata_free(udata) < 0) + goto out; + break; /* added unused labels to keep the compiler quite */ @@ -437,9 +465,15 @@ udata_free(void *_udata) udata->ref_count--; - /* checks that there are no references outstanding before deallocating udata */ - if (udata->ref_count == 0 && udata->fapl_ref_count == 0 && udata->vfd_ref_count == 0) + if (udata->ref_count == 0) { + /* There should not be any outstanding references + * to the udata structure at this point. + */ + assert(udata->fapl_ref_count == 0); + assert(udata->vfd_ref_count == 0); + free(udata); + } return (SUCCEED); @@ -728,13 +762,13 @@ H5LTmake_dataset_string(hid_t loc_id, const char *dset_name, const char *buf) hid_t H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags) { - hid_t fapl = -1, file_id = -1; /* HDF5 identifiers */ - unsigned file_open_flags; /* Flags for image open */ - char file_name[64]; /* Filename buffer */ - size_t alloc_incr; /* Buffer allocation increment */ - size_t min_incr = 65536; /* Minimum buffer increment */ - double buf_prcnt = 0.1; /* Percentage of buffer size to set - as increment */ + H5LT_file_image_ud_t *udata = NULL; /* Pointer to udata structure */ + hid_t fapl = -1, file_id = -1; /* HDF5 identifiers */ + unsigned file_open_flags; /* Flags for image open */ + char file_name[64]; /* Filename buffer */ + size_t alloc_incr; /* Buffer allocation increment */ + size_t min_incr = 65536; /* Minimum buffer increment */ + double buf_prcnt = 0.1; /* Percentage of buffer size to set as increment */ static long file_name_counter; H5FD_file_image_callbacks_t callbacks = {&image_malloc, &image_memcpy, &image_realloc, &image_free, &udata_copy, &udata_free, (void *)NULL}; @@ -765,13 +799,11 @@ H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags) /* Set callbacks for file image ops ONLY if the file image is NOT copied */ if (flags & H5LT_FILE_IMAGE_DONT_COPY) { - H5LT_file_image_ud_t *udata; /* Pointer to udata structure */ - /* Allocate buffer to communicate user data to callbacks */ if (NULL == (udata = (H5LT_file_image_ud_t *)malloc(sizeof(H5LT_file_image_ud_t)))) goto out; - /* Initialize udata with info about app buffer containing file image and flags */ + /* Initialize udata with info about app buffer containing file image and flags */ udata->app_image_ptr = buf_ptr; udata->app_image_size = buf_size; udata->fapl_image_ptr = NULL; @@ -781,17 +813,32 @@ H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags) udata->vfd_image_size = 0; udata->vfd_ref_count = 0; udata->flags = flags; - udata->ref_count = 1; /* corresponding to the first FAPL */ + + /* + * Initialize the udata structure with a reference count of 1. At + * first, nothing holds this reference to the udata structure. The + * call to H5Pset_file_image_callbacks below will associate the + * udata structure with the FAPL, incrementing the structure's + * reference count and causing the FAPL to hold one of the two + * references to the structure in preparation for transfer of + * ownership to the file driver. Once the file has been opened with + * this FAPL and the FAPL is closed, the reference held by the FAPL + * is released and ownership is transferred to the file driver, which + * will then hold the remaining reference to the udata structure. + * The udata structure will then be freed when the file driver calls + * the image_free callback and releases its reference to the structure. + */ + udata->ref_count = 1; /* copy address of udata into callbacks */ callbacks.udata = (void *)udata; /* Set file image callbacks */ if (H5Pset_file_image_callbacks(fapl, &callbacks) < 0) { - free(udata); + udata_free(udata); goto out; - } /* end if */ - } /* end if */ + } + } /* end if */ /* Assign file image in user buffer to FAPL */ if (H5Pset_file_image(fapl, buf_ptr, buf_size) < 0) @@ -821,8 +868,10 @@ H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags) H5E_BEGIN_TRY { H5Pclose(fapl); + H5Fclose(file_id); } H5E_END_TRY + return -1; } /* end H5LTopen_file_image() */ diff --git a/hl/test/CMakeTests.cmake b/hl/test/CMakeTests.cmake index 6ec5f29a534..7f7f27b4b8e 100644 --- a/hl/test/CMakeTests.cmake +++ b/hl/test/CMakeTests.cmake @@ -98,7 +98,7 @@ set_tests_properties (HL_test-clean-objects PROPERTIES # Macro used to add a unit test # -------------------------------------------------------------------- macro (HL_ADD_TEST hl_name) - if (HDF5_ENABLE_USING_MEMCHECKER) + if (HDF5_USING_ANALYSIS_TOOL) add_test (NAME HL_${hl_name} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME HL_${hl_name} COMMAND "${CMAKE_COMMAND}" diff --git a/hl/test/test_dset_append.c b/hl/test/test_dset_append.c index 4b075829dd0..0971cf31de1 100644 --- a/hl/test/test_dset_append.c +++ b/hl/test/test_dset_append.c @@ -13,13 +13,6 @@ #include "h5hltest.h" #include "H5DOpublic.h" -#if defined(H5_HAVE_ZLIB_H) && !defined(H5_ZLIB_HEADER) -#define H5_ZLIB_HEADER "zlib.h" -#endif -#if defined(H5_ZLIB_HEADER) -#include H5_ZLIB_HEADER /* "zlib.h" */ -#endif - #define FILENAME "test_append.h5" #define DNAME_NOTSET "dataset_notset" #define DNAME_UNLIM "dataset_unlim" diff --git a/hl/tools/gif2h5/CMakeLists.txt b/hl/tools/gif2h5/CMakeLists.txt index f3b1fef0567..abef080910c 100644 --- a/hl/tools/gif2h5/CMakeLists.txt +++ b/hl/tools/gif2h5/CMakeLists.txt @@ -14,41 +14,27 @@ set (GIF2H5_SOURCES ) #-- Add gif2hdf5 program -if (BUILD_STATIC_LIBS) - add_executable (gif2h5 ${GIF2H5_SOURCES}) - target_compile_options(gif2h5 PRIVATE "${HDF5_CMAKE_C_FLAGS}") - target_include_directories (gif2h5 PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +add_executable (gif2h5 ${GIF2H5_SOURCES}) +target_compile_options(gif2h5 PRIVATE "${HDF5_CMAKE_C_FLAGS}") +target_include_directories (gif2h5 PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (HDF5_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (gif2h5 STATIC) target_link_libraries (gif2h5 PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) - set_target_properties (gif2h5 PROPERTIES FOLDER tools/hl) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};gif2h5") - set (H5_DEP_EXECUTABLES - gif2h5 - ) -endif () - -if (BUILD_SHARED_LIBS) - add_executable (gif2h5-shared ${GIF2H5_SOURCES}) - target_compile_options(gif2h5-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") - target_include_directories (gif2h5-shared PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (gif2h5-shared SHARED) - target_link_libraries (gif2h5-shared PRIVATE ${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TOOLS_LIBSH_TARGET}) - set_target_properties (gif2h5-shared PROPERTIES FOLDER tools/hl) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};gif2h5-shared") - set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} - gif2h5-shared - ) +else () + TARGET_C_PROPERTIES (gif2h5 SHARED) + target_link_libraries (gif2h5 PRIVATE ${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TOOLS_LIBSH_TARGET}) endif () +set_target_properties (gif2h5 PROPERTIES FOLDER tools/hl) +set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};gif2h5") +set (H5_DEP_EXECUTABLES + gif2h5 +) #----------------------------------------------------------------------------- # Add Target to clang-format #----------------------------------------------------------------------------- if (HDF5_ENABLE_FORMATTERS) - if (BUILD_STATIC_LIBS) - clang_format (HDF5_HL_TOOLS_GIF2H5_FORMAT gif2h5) - else () - clang_format (HDF5_HL_TOOLS_GIF2H5_FORMAT gif2h5-shared) - endif () + clang_format (HDF5_HL_TOOLS_GIF2H5_FORMAT gif2h5) endif () #-- Add h52gif program @@ -56,41 +42,27 @@ set (hdf2gif_SOURCES ${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/hdf2gif.c ${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/hdfgifwr.c ) -if (BUILD_STATIC_LIBS) - add_executable (h52gif ${hdf2gif_SOURCES}) - target_compile_options(h52gif PRIVATE "${HDF5_CMAKE_C_FLAGS}") - target_include_directories (h52gif PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +add_executable (h52gif ${hdf2gif_SOURCES}) +target_compile_options(h52gif PRIVATE "${HDF5_CMAKE_C_FLAGS}") +target_include_directories (h52gif PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (HDF5_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (h52gif STATIC) target_link_libraries (h52gif PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) - set_target_properties (h52gif PROPERTIES FOLDER tools/hl) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h52gif") - set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} - h52gif - ) -endif () - -if (BUILD_SHARED_LIBS) - add_executable (h52gif-shared ${hdf2gif_SOURCES}) - target_compile_options(h52gif-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") - target_include_directories (h52gif-shared PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (h52gif-shared SHARED) - target_link_libraries (h52gif-shared PRIVATE ${HDF5_HL_LIBSH_TARGET} PRIVATE ${HDF5_LIBSH_TARGET} ${HDF5_TOOLS_LIBSH_TARGET}) - set_target_properties (h52gif-shared PROPERTIES FOLDER tools/hl) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h52gif-shared") - set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} - h52gif-shared - ) +else () + TARGET_C_PROPERTIES (h52gif SHARED) + target_link_libraries (h52gif PRIVATE ${HDF5_HL_LIBSH_TARGET} PRIVATE ${HDF5_LIBSH_TARGET} ${HDF5_TOOLS_LIBSH_TARGET}) endif () +set_target_properties (h52gif PROPERTIES FOLDER tools/hl) +set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h52gif") +set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} + h52gif +) #----------------------------------------------------------------------------- # Add Target to clang-format #----------------------------------------------------------------------------- if (HDF5_ENABLE_FORMATTERS) - if (BUILD_STATIC_LIBS) - clang_format (HDF5_HL_TOOLS_H52GIF_FORMAT h52gif) - else () - clang_format (HDF5_HL_TOOLS_H52GIF_FORMAT h52gif-shared) - endif () + clang_format (HDF5_HL_TOOLS_H52GIF_FORMAT h52gif) endif () if (BUILD_TESTING AND HDF5_TEST_SERIAL) diff --git a/hl/tools/gif2h5/CMakeTests.cmake b/hl/tools/gif2h5/CMakeTests.cmake index dd0ccc456a2..be431c1507b 100644 --- a/hl/tools/gif2h5/CMakeTests.cmake +++ b/hl/tools/gif2h5/CMakeTests.cmake @@ -47,29 +47,29 @@ add_test ( ) set_tests_properties (HL_TOOLS-clean-objects PROPERTIES FIXTURES_CLEANUP clear_tools_hl) -add_test (NAME HL_TOOLS_gif2h5 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ testfiles/image1.gif image1.h5) +add_test (NAME HL_TOOLS_gif2h5 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ testfiles/image1.gif image1.h5) set_tests_properties (HL_TOOLS_gif2h5 PROPERTIES FIXTURES_REQUIRED clear_tools_hl ) -add_test (NAME HL_TOOLS_h52gif COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ testfiles/h52giftst.h5 image1.gif -i image) +add_test (NAME HL_TOOLS_h52gif COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ testfiles/h52giftst.h5 image1.gif -i image) set_tests_properties (HL_TOOLS_h52gif PROPERTIES FIXTURES_REQUIRED clear_tools_hl ) -add_test (NAME HL_TOOLS_h52gif_none COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ testfiles/h52giftst.h5 image.gif -i nosuch_image) +add_test (NAME HL_TOOLS_h52gif_none COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ testfiles/h52giftst.h5 image.gif -i nosuch_image) set_tests_properties (HL_TOOLS_h52gif_none PROPERTIES WILL_FAIL "true" FIXTURES_REQUIRED clear_tools_hl ) -#add_test (NAME HL_TOOLS_h52gifpal COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ testfiles/h52giftst.h5 image.gif -i palette) +#add_test (NAME HL_TOOLS_h52gifpal COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ testfiles/h52giftst.h5 image.gif -i palette) #set_tests_properties (HL_TOOLS_h52gifpal PROPERTIES # WILL_FAIL "true" # FIXTURES_REQUIRED clear_tools_hl #) -add_test (NAME HL_TOOLS_h52gif24bits COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ testfiles/ex_image2.h5 image24.gif -i image24bitpixel) +add_test (NAME HL_TOOLS_h52gif24bits COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ testfiles/ex_image2.h5 image24.gif -i image24bitpixel) set_tests_properties (HL_TOOLS_h52gif24bits PROPERTIES WILL_FAIL "true" FIXTURES_REQUIRED clear_tools_hl diff --git a/hl/tools/h5watch/CMakeLists.txt b/hl/tools/h5watch/CMakeLists.txt index 890ac37f5fb..7b00431cae1 100644 --- a/hl/tools/h5watch/CMakeLists.txt +++ b/hl/tools/h5watch/CMakeLists.txt @@ -9,34 +9,24 @@ set (H5WATCH_SOURCES ) #-- Add h5watch program -if (BUILD_STATIC_LIBS) - add_executable (h5watch ${H5WATCH_SOURCES}) - target_compile_options(h5watch PRIVATE "${HDF5_CMAKE_C_FLAGS}") - target_include_directories (h5watch PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +add_executable (h5watch ${H5WATCH_SOURCES}) +target_compile_options(h5watch PRIVATE "${HDF5_CMAKE_C_FLAGS}") +target_include_directories (h5watch PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (HDF5_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (h5watch STATIC) target_link_libraries (h5watch PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) - set_target_properties (h5watch PROPERTIES FOLDER tools/hl) - set (H5_DEP_EXECUTABLES h5watch) -endif () -if (BUILD_SHARED_LIBS) - add_executable (h5watch-shared ${H5WATCH_SOURCES}) - target_compile_options(h5watch-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") - target_include_directories (h5watch-shared PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (h5watch-shared SHARED) - target_link_libraries (h5watch-shared PRIVATE ${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TOOLS_LIBSH_TARGET}) - set_target_properties (h5watch-shared PROPERTIES FOLDER tools/hl) - set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5watch-shared) +else () + TARGET_C_PROPERTIES (h5watch SHARED) + target_link_libraries (h5watch PRIVATE ${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TOOLS_LIBSH_TARGET}) endif () +set_target_properties (h5watch PROPERTIES FOLDER tools/hl) +set (H5_DEP_EXECUTABLES h5watch) #----------------------------------------------------------------------------- # Add Target to clang-format #----------------------------------------------------------------------------- if (HDF5_ENABLE_FORMATTERS) - if (BUILD_STATIC_LIBS) - clang_format (HDF5_HL_TOOLS_H5WATCH_FORMAT h5watch) - else () - clang_format (HDF5_HL_TOOLS_H5WATCH_FORMAT h5watch-shared) - endif () + clang_format (HDF5_HL_TOOLS_H5WATCH_FORMAT h5watch) endif () if (BUILD_TESTING AND HDF5_TEST_SWMR AND HDF5_TEST_SERIAL) @@ -47,7 +37,7 @@ if (BUILD_TESTING AND HDF5_TEST_SWMR AND HDF5_TEST_SERIAL) add_executable (extend_dset ${extend_dset_SOURCES}) target_compile_options(extend_dset PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_include_directories (extend_dset PRIVATE "${HDF5_HL_SRC_DIR}/test;${HDF5_HL_SRC_DIR}/src;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - if (BUILD_STATIC_LIBS) + if (HDF5_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (extend_dset STATIC) target_link_libraries (extend_dset PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) else () @@ -66,7 +56,7 @@ if (BUILD_TESTING AND HDF5_TEST_SWMR AND HDF5_TEST_SERIAL) add_executable (h5watchgentest ${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/h5watchgentest.c) target_compile_options(h5watchgentest PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_include_directories (h5watchgentest PRIVATE "${HDF5_HL_SRC_DIR}/src;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - if (BUILD_STATIC_LIBS) + if (HDF5_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (h5watchgentest STATIC) target_link_libraries (h5watchgentest PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) else () diff --git a/hl/tools/h5watch/CMakeTests.cmake b/hl/tools/h5watch/CMakeTests.cmake index aa4c41a8c11..b807fad6264 100644 --- a/hl/tools/h5watch/CMakeTests.cmake +++ b/hl/tools/h5watch/CMakeTests.cmake @@ -69,12 +69,12 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes ############################################################################## macro (ADD_H5_TEST resultfile resultcode) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5WATCH_ARGS-h5watch-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" @@ -94,19 +94,20 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes endmacro () macro (ADD_H5_ERR_TEST resultfile resultcode) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5WATCH_ARGS-h5watch-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.mty" - -D "TEST_ERRREF=${resultfile}.err" - -P "${HDF_RESOURCES_DIR}/runTest.cmake" + -D "TEST_ERRREF=h5watch error" + -D "TEST_SKIP_COMPARE=true" + -P "${HDF_RESOURCES_DIR}/grepTest.cmake" ) set_tests_properties (H5WATCH_ARGS-h5watch-${resultfile} PROPERTIES DEPENDS ${last_test} @@ -120,12 +121,12 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes endmacro () macro (ADD_H5_WATCH resultfile resultcode) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5WATCH-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" diff --git a/java/src/hdf/hdf5lib/CMakeLists.txt b/java/src/hdf/hdf5lib/CMakeLists.txt index 41cf4e9ab60..69b5a93b664 100644 --- a/java/src/hdf/hdf5lib/CMakeLists.txt +++ b/java/src/hdf/hdf5lib/CMakeLists.txt @@ -10,6 +10,7 @@ SET_GLOBAL_VARIABLE (HDF5_JAVA_SOURCE_PACKAGES ) set (HDF5_JAVA_HDF_HDF5_CALLBACKS_SOURCES + callbacks/Callbacks.java callbacks/H5A_iterate_cb.java callbacks/H5A_iterate_t.java callbacks/H5D_append_cb.java @@ -37,7 +38,6 @@ set (HDF5_JAVA_HDF_HDF5_CALLBACKS_SOURCES callbacks/H5P_prp_set_func_cb.java callbacks/H5P_iterate_cb.java callbacks/H5P_iterate_t.java - callbacks/Callbacks.java ) set (HDF5_JAVADOC_HDF_HDF5_CALLBACKS_SOURCES diff --git a/java/src/hdf/hdf5lib/callbacks/Callbacks.java b/java/src/hdf/hdf5lib/callbacks/Callbacks.java index 3d5fbd152d8..013e0ec0ae7 100644 --- a/java/src/hdf/hdf5lib/callbacks/Callbacks.java +++ b/java/src/hdf/hdf5lib/callbacks/Callbacks.java @@ -28,7 +28,7 @@ * exceptions thrown will be passed to the default callback exception * handler. * - * @defgroup JCALL HDF5 Library Java Callbacks + * @defgroup JCALLBK HDF5 Library Java Callbacks */ public interface Callbacks { } diff --git a/java/src/hdf/hdf5lib/callbacks/H5A_iterate_cb.java b/java/src/hdf/hdf5lib/callbacks/H5A_iterate_cb.java index 9958b3bbab8..2d37044b1e1 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5A_iterate_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5A_iterate_cb.java @@ -20,7 +20,7 @@ */ public interface H5A_iterate_cb extends Callbacks { /** - * @ingroup JCALL + * @ingroup JCALLBK * * application callback for each attribute * diff --git a/java/src/hdf/hdf5lib/callbacks/H5D_append_cb.java b/java/src/hdf/hdf5lib/callbacks/H5D_append_cb.java index 49323a2731f..92024f8f16a 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5D_append_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5D_append_cb.java @@ -18,7 +18,7 @@ */ public interface H5D_append_cb extends Callbacks { /** - * @ingroup JCALL + * @ingroup JCALLBK * * application callback for each dataset access property list * diff --git a/java/src/hdf/hdf5lib/callbacks/H5D_iterate_cb.java b/java/src/hdf/hdf5lib/callbacks/H5D_iterate_cb.java index 5f779987e35..f9ea6a96b3a 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5D_iterate_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5D_iterate_cb.java @@ -18,7 +18,7 @@ */ public interface H5D_iterate_cb extends Callbacks { /** - * @ingroup JCALL + * @ingroup JCALLBK * * application callback for each dataset element * diff --git a/java/src/hdf/hdf5lib/callbacks/H5E_walk_cb.java b/java/src/hdf/hdf5lib/callbacks/H5E_walk_cb.java index a8ef5df9467..a9690a55fe1 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5E_walk_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5E_walk_cb.java @@ -20,7 +20,7 @@ */ public interface H5E_walk_cb extends Callbacks { /** - * @ingroup JCALL + * @ingroup JCALLBK * * application callback for each error stack element * diff --git a/java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java b/java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java index 7342e587d9e..cf0ac0e5b78 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java +++ b/java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java @@ -20,7 +20,7 @@ */ public interface H5L_iterate_t extends Callbacks { /** - * @ingroup JCALL + * @ingroup JCALLBK * * application callback for each group * diff --git a/java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java b/java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java index bfe8c6762ff..f0dd587d88c 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java +++ b/java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java @@ -20,7 +20,7 @@ */ public interface H5O_iterate_t extends Callbacks { /** - * @ingroup JCALL + * @ingroup JCALLBK * * application callback for each group * diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_cb.java index a2358615923..e4f10ccfa33 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_cb.java @@ -18,7 +18,7 @@ */ public interface H5P_cls_close_func_cb extends Callbacks { /** - * @ingroup JCALL + * @ingroup JCALLBK * * application callback for each property list * diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_cb.java index b218e0cca77..bdaad5f9324 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_cb.java @@ -18,7 +18,7 @@ */ public interface H5P_cls_copy_func_cb extends Callbacks { /** - * @ingroup JCALL + * @ingroup JCALLBK * * application callback for each property list * diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_cls_create_func_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_cls_create_func_cb.java index 3d407d05224..0b9ced20059 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5P_cls_create_func_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5P_cls_create_func_cb.java @@ -18,7 +18,7 @@ */ public interface H5P_cls_create_func_cb extends Callbacks { /** - * @ingroup JCALL + * @ingroup JCALLBK * * application callback for each property list * diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_iterate_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_iterate_cb.java index 51a57682cea..941fd150a3e 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5P_iterate_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5P_iterate_cb.java @@ -18,7 +18,7 @@ */ public interface H5P_iterate_cb extends Callbacks { /** - * @ingroup JCALL + * @ingroup JCALLBK * * application callback for each property list * diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_prp_close_func_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_prp_close_func_cb.java index 2ddc980a076..33bde76df4b 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5P_prp_close_func_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5P_prp_close_func_cb.java @@ -18,7 +18,7 @@ */ public interface H5P_prp_close_func_cb extends Callbacks { /** - * @ingroup JCALL + * @ingroup JCALLBK * * application callback for each property list * diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_prp_compare_func_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_prp_compare_func_cb.java index 53caa94f920..3149d171fe1 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5P_prp_compare_func_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5P_prp_compare_func_cb.java @@ -18,7 +18,7 @@ */ public interface H5P_prp_compare_func_cb extends Callbacks { /** - * @ingroup JCALL + * @ingroup JCALLBK * * application callback for each property list * diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_prp_copy_func_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_prp_copy_func_cb.java index 0b2349eca36..d3d6b37365a 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5P_prp_copy_func_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5P_prp_copy_func_cb.java @@ -18,7 +18,7 @@ */ public interface H5P_prp_copy_func_cb extends Callbacks { /** - * @ingroup JCALL + * @ingroup JCALLBK * * application callback for each property list * diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_prp_create_func_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_prp_create_func_cb.java index 6065ce0bf8c..2fe33388f91 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5P_prp_create_func_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5P_prp_create_func_cb.java @@ -18,7 +18,7 @@ */ public interface H5P_prp_create_func_cb extends Callbacks { /** - * @ingroup JCALL + * @ingroup JCALLBK * * application callback for each property list * diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_prp_delete_func_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_prp_delete_func_cb.java index 4384ca74446..30192842d99 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5P_prp_delete_func_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5P_prp_delete_func_cb.java @@ -18,7 +18,7 @@ */ public interface H5P_prp_delete_func_cb extends Callbacks { /** - * @ingroup JCALL + * @ingroup JCALLBK * * application callback for each property list * diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_prp_get_func_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_prp_get_func_cb.java index 999c7b0a5d1..cfc8e314ab6 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5P_prp_get_func_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5P_prp_get_func_cb.java @@ -18,7 +18,7 @@ */ public interface H5P_prp_get_func_cb extends Callbacks { /** - * @ingroup JCALL + * @ingroup JCALLBK * * application callback for each property list * diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_prp_set_func_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_prp_set_func_cb.java index 893344bffeb..22728699782 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5P_prp_set_func_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5P_prp_set_func_cb.java @@ -18,7 +18,7 @@ */ public interface H5P_prp_set_func_cb extends Callbacks { /** - * @ingroup JCALL + * @ingroup JCALLBK * * application callback for each property list * diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index 76c726a874b..bf798b88ee1 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -1192,7 +1192,8 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i * object. */ - if (NULL == (this_str = (char *)malloc(64))) + const size_t size = 64; + if (NULL == (this_str = (char *)malloc(size))) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); if ((obj = H5Rdereference2(container, H5P_DEFAULT, H5R_OBJECT, cptr)) < 0) @@ -1206,25 +1207,25 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i switch (oi.type) { case H5O_TYPE_GROUP: - if (sprintf(this_str, "%s %s", H5_TOOLS_GROUP, obj_tok_str) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: sprintf failure"); + if (snprintf(this_str, size, "%s %s", H5_TOOLS_GROUP, obj_tok_str) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: snprintf failure"); break; case H5O_TYPE_DATASET: - if (sprintf(this_str, "%s %s", H5_TOOLS_DATASET, obj_tok_str) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: sprintf failure"); + if (snprintf(this_str, size, "%s %s", H5_TOOLS_DATASET, obj_tok_str) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: snprintf failure"); break; case H5O_TYPE_NAMED_DATATYPE: - if (sprintf(this_str, "%s %s", H5_TOOLS_DATATYPE, obj_tok_str) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: sprintf failure"); + if (snprintf(this_str, size, "%s %s", H5_TOOLS_DATATYPE, obj_tok_str) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: snprintf failure"); break; case H5O_TYPE_UNKNOWN: case H5O_TYPE_NTYPES: default: - if (sprintf(this_str, "%u-%s", (unsigned)oi.type, obj_tok_str) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: sprintf failure"); + if (snprintf(this_str, size, "%u-%s", (unsigned)oi.type, obj_tok_str) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: snprintf failure"); break; } diff --git a/java/test/TestH5.java b/java/test/TestH5.java index 9457ffdfcf1..d3ce84426ca 100644 --- a/java/test/TestH5.java +++ b/java/test/TestH5.java @@ -423,7 +423,7 @@ public void serializeToDisk() } } - @Test + @Ignore public void testH5export_dataset() { int[][] dset_data = new int[DIM_X][DIM_Y]; @@ -489,7 +489,7 @@ public void testH5export_dataset() _deleteH5file(); } - @Test + @Ignore public void testH5export_region() { int[] dset_data_expect = {66, 69, 72, 75, 78, 81, 96, 99, 102, 105, 108, 111, @@ -532,7 +532,7 @@ public void testH5export_region() dset_indata[row] == dset_data_expect[row]); } - @Test + @Ignore public void testH5export_attribute() { int[] dset_data_expect = {0, 3, 6, 9, 1, 4, 7, 10, 2, 5, 8, 11}; @@ -573,7 +573,7 @@ public void testH5export_attribute() dset_indata[row] == dset_data_expect[row]); } - @Test + @Ignore public void testH5export_regdataset() { int[] dset_data_expect = {66, 69, 72, 75, 78, 81, 96, 99, 102, 105, 108, 111, @@ -616,7 +616,7 @@ public void testH5export_regdataset() dset_indata[row] == dset_data_expect[row]); } - @Test + @Ignore public void testH5export_attrdataset() { int[] dset_data_expect = {66, 69, 72, 75, 78, 81, 96, 99, 102, 105, 108, 111, diff --git a/java/test/testfiles/JUnit-TestH5.txt b/java/test/testfiles/JUnit-TestH5.txt index fb50a578a77..b282a9138c5 100644 --- a/java/test/testfiles/JUnit-TestH5.txt +++ b/java/test/testfiles/JUnit-TestH5.txt @@ -1,14 +1,9 @@ JUnit version 4.11 -.testH5export_region .testH5get_libversion_null_param .testJ2C -.testH5export_dataset .testIsSerializable -.testH5export_attrdataset .testH5garbage_collect .testH5error_off -.testH5export_regdataset -.testH5export_attribute .serializeToDisk .testH5open .testH5check_version @@ -17,5 +12,5 @@ JUnit version 4.11 Time: XXXX -OK (15 tests) +OK (10 tests) diff --git a/m4/aclocal_fc.f90 b/m4/aclocal_fc.f90 index 68a8f1b590c..939988f64aa 100644 --- a/m4/aclocal_fc.f90 +++ b/m4/aclocal_fc.f90 @@ -55,6 +55,35 @@ PROGRAM PROG_FC_HAVE_F2003_REQUIREMENTS ptr = C_LOC(ichr(1:1)) END PROGRAM PROG_FC_HAVE_F2003_REQUIREMENTS +PROGRAM PROG_CHAR_ALLOC + CHARACTER(:), ALLOCATABLE :: str +END PROGRAM PROG_CHAR_ALLOC + +!---- START ----- Check to see C_BOOL is different from LOGICAL +MODULE l_type_mod + USE ISO_C_BINDING + INTERFACE h5t + MODULE PROCEDURE h5t_c_bool + MODULE PROCEDURE h5t_logical + END INTERFACE +CONTAINS + SUBROUTINE h5t_c_bool(lcb) + LOGICAL(KIND=C_BOOL) :: lcb + END SUBROUTINE h5t_c_bool + SUBROUTINE h5t_logical(l) + LOGICAL :: l + END SUBROUTINE h5t_logical +END MODULE l_type_mod +PROGRAM PROG_FC_C_BOOL_EQ_LOGICAL + USE ISO_C_BINDING + USE l_type_mod + LOGICAL(KIND=C_BOOL) :: lcb + LOGICAL :: l + CALL h5t(lcb) + CALL h5t(l) +END PROGRAM PROG_FC_C_BOOL_EQ_LOGICAL +!---- END ------- Check to see C_BOOL is different from LOGICAL + !---- START ----- Check to see C_LONG_DOUBLE is different from C_DOUBLE MODULE type_mod USE ISO_C_BINDING @@ -154,7 +183,7 @@ END PROGRAM FC_AVAIL_KINDS !---- END ----- Determine the available KINDs for REALs and INTEGERs PROGRAM FC_MPI_CHECK - INCLUDE 'mpif.h' + USE mpi INTEGER :: comm, amode, info, fh, ierror CHARACTER(LEN=1) :: filename CALL MPI_File_open( comm, filename, amode, info, fh, ierror) diff --git a/m4/aclocal_fc.m4 b/m4/aclocal_fc.m4 index 5d7bca9be30..49e5732e61d 100644 --- a/m4/aclocal_fc.m4 +++ b/m4/aclocal_fc.m4 @@ -106,6 +106,18 @@ AC_DEFUN([PAC_PROG_FC_STORAGE_SIZE],[ ]) +dnl See if the fortran compiler supports allocatable character + +AC_DEFUN([PAC_HAVE_CHAR_ALLOC],[ + HAVE_CHAR_ALLOC_FORTRAN="no" + AC_MSG_CHECKING([if Fortran compiler supports allocatable character]) + TEST_SRC="`sed -ne '/PROGRAM PROG_CHAR_ALLOC/,/END PROGRAM PROG_CHAR_ALLOC/p' $srcdir/m4/aclocal_fc.f90`" + AC_LINK_IFELSE([$TEST_SRC], [AC_MSG_RESULT([yes]) + HAVE_CHAR_ALLOC_FORTRAN="yes"], + [AC_MSG_RESULT([no])]) + +]) + dnl Check to see C_LONG_DOUBLE is available AC_DEFUN([PAC_PROG_FC_HAVE_C_LONG_DOUBLE],[ @@ -131,6 +143,17 @@ AC_DEFUN([PAC_PROG_FC_C_LONG_DOUBLE_EQ_C_DOUBLE],[ ]) fi +dnl Check if C_BOOL is different from default LOGICAL + +AC_DEFUN([PAC_PROG_FC_C_BOOL_EQ_LOGICAL],[ + C_BOOL_IS_UNIQUE_FORTRAN="no" + AC_MSG_CHECKING([if Fortran C_BOOL is different from default LOGICAL]) + TEST_SRC="`sed -n '/MODULE l_type_mod/,/END PROGRAM PROG_FC_C_BOOL_EQ_LOGICAL/p' $srcdir/m4/aclocal_fc.f90`" + AC_COMPILE_IFELSE([$TEST_SRC], [AC_MSG_RESULT([yes]) + C_BOOL_IS_UNIQUE_FORTRAN="yes"], + [AC_MSG_RESULT([no])]) +]) + dnl Checking if the compiler supports the required Fortran 2003 features and dnl disable Fortran 2003 if it does not. diff --git a/release_docs/INSTALL b/release_docs/INSTALL index dd5ea34435c..0fcbcf71b15 100644 --- a/release_docs/INSTALL +++ b/release_docs/INSTALL @@ -1,3 +1,6 @@ +************************************************************************* +* Installation Instructions for HDF5 * +************************************************************************* Instructions for the Installation of HDF5 Software ================================================== @@ -7,113 +10,36 @@ This file provides instructions for installing the HDF5 software. For help with installing, questions can be posted to the HDF Forum or sent to the HDF Helpdesk: HDF Forum: https://forum.hdfgroup.org/ - HDF Helpdesk: https://portal.hdfgroup.org/display/support/The+HDF+Help+Desk + HDF Helpdesk: https://hdfgroup.atlassian.net/servicedesk/customer/portals CONTENTS -------- 1. Obtaining HDF5 + 2. Third-party Software Requirements + 2.1. Zlib + 2.2 Szip (optional) + 2.3. MPI and MPI-IO - 2. Quick installation - 2.1. Windows - 2.2. RedStorm (Cray XT3) - - 3. HDF5 dependencies - 3.1. Zlib - 3.2 Szip (optional) - 3.3. MPI and MPI-IO - - 4. Full installation instructions for source distributions - 4.1. Unpacking the distribution - 4.1.1. Non-compressed tar archive (*.tar) - 4.1.2. Compressed tar archive (*.tar.Z) - 4.1.3. Gzip'd tar archive (*.tar.gz) - 4.1.4. Bzip'd tar archive (*.tar.bz2) - 4.2. Source versus build directories - 4.3. Configuring - 4.3.1. Specifying the installation directories - 4.3.2. Using an alternate C compiler - 4.3.3. Additional compilation flags - 4.3.4. Compiling HDF5 wrapper libraries - 4.3.5. Specifying other programs - 4.3.6. Specifying other libraries and headers - 4.3.7. Static versus shared linking - 4.3.8. Optimization versus symbolic debugging - 4.3.9. Parallel versus serial library - 4.3.10. Threadsafe capability - 4.3.11. Backward compatibility - 4.4. Building - 4.5. Testing - 4.6. Installing HDF5 - - 5. Using the Library ***************************************************************************** 1. Obtaining HDF5 - The latest supported public release of HDF5 is available from - https://www.hdfgroup.org/downloads/hdf5/. For Unix and UNIX-like - platforms, it is available in tar format compressed with gzip. - For Microsoft Windows, it is in ZIP format. - - -2. Quick installation - For those who don't like to read ;-) the following steps can be used - to configure, build, test, and install the HDF5 library, header files, - and support programs. For example, to install HDF5 version X.Y.Z at - location /usr/local/hdf5, use the following steps. - - $ gunzip < hdf5-X.Y.Z.tar.gz | tar xf - - $ cd hdf5-X.Y.Z - $ ./configure --prefix=/usr/local/hdf5 - $ make - $ make check # run test suite. - $ make install - $ make check-install # verify installation. - - Some versions of the tar command support the -z option. In such cases, - the first step above can be simplified to the following: - - $ tar zxf hdf5-X.Y.Z.tar.gz + The latest supported public releases of HDF5 are available on + https://github.com/HDFGroup/hdf5. - above refers to the configure flags appropriate - to your installation. For example, to install HDF5 with the - Fortran and C++ interfaces and with SZIP compression, the - configure line might read as follows: - - $ ./configure --prefix=/usr/local/hdf5 --enable-fortran \ - --enable-cxx --with-szlib=PATH_TO_SZIP - - In this case, PATH_TO_SZIP would be replaced with the path to the - installed location of the SZIP library. - -2.1. Windows - Users of Microsoft Windows should see the INSTALL_Windows files for - detailed instructions. - -2.2. RedStorm (Cray XT3) - Users of the Red Storm machine, after reading this file, should read - the Red Storm section in the INSTALL_parallel file for specific - instructions for the Red Storm machine. The same instructions would - probably work for other Cray XT3 systems, but they have not been - verified. - - -3. HDF5 dependencies -3.1. Zlib +2. Third-party Software Requirements +2.1. Zlib The HDF5 library includes a predefined compression filter that uses the "deflate" method for chunked datasets. If zlib-1.1.2 or later is found, HDF5 will use it. Otherwise, HDF5's predefined compression method will degenerate to a no-op; the compression filter will succeed but the data will not be compressed. -3.2. Szip (optional) +2.2. Szip (optional) The HDF5 library includes a predefined compression filter that uses the extended-Rice lossless compression algorithm for chunked - datasets. For information on Szip compression, license terms, - and obtaining the Szip source code, see: - - https://portal.hdfgroup.org/display/HDF5/Szip+Compression+in+HDF+Products + datasets. Building instructions are available with the Szip source code. @@ -124,10 +50,6 @@ CONTENTS https://www.hdfgroup.org/downloads/hdf5/ - To configure the HDF5 library with the Szip compression filter, use - the '--with-szlib=/PATH_TO_SZIP' flag. For more information, see - section 4.3.7, "Specifying other libraries and headers." - Please notice that if HDF5 configure cannot find a valid Szip library, configure will not fail; in this case, the compression filter will not be available to the applications. @@ -136,438 +58,22 @@ CONTENTS check the "I/O filters (external):" line in the configure output, summary section, printed to the standard output. -3.3. MPI and MPI-IO +2.3. MPI and MPI-IO The parallel version of the library is built upon the foundation provided by MPI and MPI-IO. If these libraries are not available when HDF5 is configured, only a serial version of HDF5 can be built. +3. HDF5 Source Code and Precompiled Binaries + The HDF Group provides source code and pre-compiled binaries from the + HDF5 github releases page: -4. Full installation instructions for source distributions - -4.1. Unpacking the distribution - The HDF5 source code is distributed in a variety of formats which - can be unpacked with the following commands, each of which creates an - 'hdf5-X.Y.Z' directory, where X.Y.Z is the HDF5 version numbers. - -4.1.1. Non-compressed tar archive (*.tar) - - $ tar xf hdf5-X.Y.Z.tar - -4.1.2. Compressed tar archive (*.tar.Z) - - $ uncompress -c < hdf5-X.Y.Z.tar.Z | tar xf - - Or - $ tar Zxf hdf5-X.Y.Z.tar.Z - -4.1.3. Gzip'd tar archive (*.tar.gz) - - $ gunzip < hdf5-X.Y.Z.tar.gz | tar xf - - Or - $ tar zxf hdf5-X.Y.Z.tar.gz - -4.1.4. Bzip'd tar archive (*.tar.bz2) - - $ bunzip2 < hdf5-X.Y.Z.tar.bz2 | tar xf - - Or - $ tar jxf hdf5-X.Y.Z.tar.bz2 - -4.2. Source versus build directories - On most systems the build can occur in a directory other than the - source directory, allowing multiple concurrent builds and/or - read-only source code. In order to accomplish this, one should - create a build directory, cd into that directory, and run the - `configure' script found in the source directory (configure - details are below). For example, - $ mkdir built-fortran - $ cd build-fortran - $ ../hdf5-X.Y.Z/configure --enable-fortran ... - - -4.3. Configuring - HDF5 uses the GNU autoconf system for configuration, which - detects various features of the host system and creates the - Makefiles. On most systems it should be sufficient to say: - - $ ./configure - Or - $ sh configure - - The configuration process can be controlled through environment - variables, command-line switches, and host configuration files. - For a complete list of switches type: - - $ ./configure --help - - The host configuration files are located in the `config' - directory and are based on architecture name, vendor name, and/or - operating system which are displayed near the beginning of the - `configure' output. The host config file influences the behavior - of configure by setting or augmenting shell variables. - -4.3.1. Specifying the installation directories - The default installation location is the HDF5 directory created in - the build directory. Typing `make install' will install the HDF5 - library, header files, examples, and support programs in hdf5/lib, - hdf5/include, hdf5/doc/hdf5/examples, and hdf5/bin. To use a path - other than hdf5, specify the path with the `--prefix=PATH' switch: - - $ ./configure --prefix=/usr/local - - If shared libraries are being built (the default), the final - home of the shared library must be specified with this switch - before the library and executables are built. - - HDF5 can be installed into a different location than the prefix - specified at configure time; see section 4.6, "Installing HDF5," - for more details. - -4.3.2. Using an alternate C compiler - By default, configure will look for the C compiler by trying - `gcc' and `cc'. However, if the environment variable "CC" is set - then its value is used as the C compiler. For instance, one would - use the following line to specify the native C compiler on a system - that also has the GNU gcc compiler (users of csh and derivatives - will need to prefix the commands below with `env'): - - $ CC=cc ./configure - - A parallel version of HDF5 can be built by specifying `mpicc' - as the C compiler. (The `--enable-parallel' flag documented - below is optional in this case.) Using the `mpicc' compiler - will insure that the correct MPI and MPI-IO header files and - libraries are used. - - $ CC=/usr/local/mpi/bin/mpicc ./configure - - -4.3.3. Additional compilation flags - If additional flags must be passed to the compilation commands, - specify those flags with the CFLAGS variable. For instance, - to enable symbolic debugging of a production version of HDF5, one - might say: - - $ CFLAGS=-g ./configure --enable-build-mode=production - -4.3.4. Compiling HDF5 wrapper libraries - One can optionally build the Fortran, C++, and Java interfaces to - the HDF5 C library. By default, these options are disabled. To build - them, specify '--enable-fortran', '--enable-cxx', or '--enable-java', - respectively. - - $ ./configure --enable-fortran - $ ./configure --enable-cxx - $ ./configure --enable-java - - Configuration will halt if a working Fortran 90 or 95 compiler or - C++ compiler is not found. Currently, the Fortran configure tests - for these compilers in order: f90, pgf90, f95. To use an - alternate compiler specify it with the FC variable: - - $ FC=/usr/local/bin/g95 ./configure --enable-fortran - - -4.3.5. Specifying other programs - The build system has been tuned for use with GNU make but also - works with other versions of make. If the `make' command runs a - non-GNU version but a GNU version is available under a different - name (perhaps `gmake'), then HDF5 can be configured to use it by - setting the MAKE variable. Note that whatever value is used for - MAKE must also be used as the make command when building the - library: - - $ MAKE=gmake ./configure - $ gmake - - The `AR' and `RANLIB' variables can also be set to the names of - the `ar' and `ranlib' (or `:') commands to override values - detected by configure. - - The HDF5 library, include files, and utilities are installed - during `make install' (described below) with a BSD-compatible - install program detected automatically by configure. If none is - found, the shell script bin/install-sh is used. Configure does not - check that the install script actually works; if a bad install is - detected on your system (e.g., on the ASCI blue machine as of - March 2, 1999) you have two choices: - - 1. Copy the bin/install-sh program to your $HOME/bin - directory, name it `install', and make sure that $HOME/bin - is searched before the system bin directories. - - 2. Specify the full path name of the `install-sh' program - as the value of the INSTALL environment variable. Note: do - not use `cp' or some other program in place of install - because the HDF5 makefiles also use the install program to - change file ownership and/or access permissions. - -4.3.6. Specifying other libraries and headers - Configure searches the standard places (those places known by the - systems compiler) for include files and header files. However, - additional directories can be specified by using the CPPFLAGS - and/or LDFLAGS variables: - - $ CPPFLAGS=-I/home/robb/include \ - LDFLAGS=-L/home/robb/lib \ - ./configure - - HDF5 uses the zlib library to support the HDF5 deflate - data compression filter. Configure searches the standard places - (plus those specified above with the CPPFLAGS and LDFLAGS variables) - for the zlib headers and library. The search can be disabled by - specifying `--without-zlib' or alternate directories can be specified - with `--with-zlib=INCDIR,LIBDIR' or through the CPPFLAGS and LDFLAGS - variables: - - $ ./configure --with-zlib=/usr/unsup/include,/usr/unsup/lib - - $ CPPFLAGS=-I/usr/unsup/include \ - LDFLAGS=-L/usr/unsup/lib \ - ./configure - - HDF5 includes Szip as a predefined compression method (see 3.2). - To enable Szip compression, the HDF5 library must be configured - and built using the Szip library: - - $ ./configure --with-szlib=/Szip_Install_Directory - -4.3.7. Static versus shared linking - The build process will create static libraries on all systems and - shared libraries on systems that support dynamic linking to a - sufficient degree. Either form of the library may be suppressed by - saying `--disable-static' or `--disable-shared'. - - $ ./configure --disable-shared - - Shared C++ and Fortran libraries will be built if shared libraries - are enabled. - - To build only statically linked executables on platforms which - support shared libraries, use the `--enable-static-exec' flag. - - $ ./configure --enable-static-exec - -4.3.8. Optimization versus symbolic debugging - The library can be compiled to provide symbolic debugging support - so it can be debugged with gdb, dbx, ddd, etc., or it can be - compiled with various optimizations. To compile for symbolic - debugging (the default for snapshots), say - `--enable-build-mode=debug'; to compile with optimizations - (the default for supported public releases), - say `--enable-build-mode=production'. For a 'clean slate' configuration - with optimization disabled and nothing turned on, - say `--enable-build-mode=clean'. On some systems the - library can also be compiled for profiling with gprof by saying - `--enable-profiling'. - - $ ./configure --enable-build-mode=debug #symbolic debugging - $ ./configure --enable-build-mode=production #optimized code - $ ./configure --enable-build-mode=clean #'clean slate' - $ ./configure --enable-profiling #for use with gprof - - Regardless of whether support for symbolic debugging is enabled, - the library can also perform runtime debugging of certain packages - (such as type conversion execution times and extensive invariant - condition checking). To enable this debugging, supply a - comma-separated list of package names to the `--enable-internal-debug' - switch. - - Debugging can be disabled by saying `--disable-internal-debug'. - The default debugging level for snapshots is a subset of the - available packages; the default for supported releases is no - debugging (debugging can incur a significant runtime penalty). - - $ ./configure --enable-internal-debug=s,t #debug only H5S and H5T - $ ./configure --enable-internal-debug #debug normal packages - $ ./configure --enable-internal-debug=all #debug all packages - $ ./configure --disable-internal-debug #no debugging - - HDF5 can also print a trace of all API function calls, their - arguments, and the return values. To enable or disable the - ability to trace the API say `--enable-trace' (the default for - snapthots) or `--disable-trace' (the default for public releases). - The tracing must also be enabled at runtime to see any output. - -4.3.9. Parallel versus serial library - The HDF5 library can be configured to use MPI and MPI-IO for - parallelism on a distributed multi-processor system. Read the - file INSTALL_parallel for detailed information. - - The threadsafe, C++ and Java interfaces are not compatible - with the parallel option. - Unless --enable-unsupported has been specified on the configure line, - the following options must be disabled: - --enable-threadsafe, --enable-cxx, --enable-java - - -4.3.10. Threadsafe capability - The HDF5 library can be configured to be thread-safe (on a very - large scale) with the `--enable-threadsafe' flag to the configure - script. Some platforms may also require the '-with-pthread=INC,LIB' - (or '--with-pthread=DIR') flag to the configure script. - For further information, see: - - https://portal.hdfgroup.org/display/knowledge/Questions+about+thread-safety+and+concurrent+access - - The high-level, C++, Fortran and Java interfaces are not compatible - with the thread-safety option because the lock is not hoisted - into the higher-level API calls. - Unless --enable-unsupported has been specified on the configure line, - the following options must be disabled: - --enable-hl, --enable-cxx, --enable-fortran, --enable-java - - -4.3.11. Backward compatibility - The 1.15 version of the HDF5 library can be configured to operate - identically to the v1.14 library with the - --with-default-api-version=v114 - identically to the v1.12 library with the - --with-default-api-version=v112 - configure flag, or identically to the v1.10 library with the - --with-default-api-version=v110 - configure flag, or identically to the v1.8 library with the - --with-default-api-version=v18 - configure flag, or identically to the v1.6 library with the - --with-default-api-version=v16 - configure flag. This allows existing code to be compiled with the - v1.15 library without requiring immediate changes to the application - source code. For additional configuration options and other details, - see "API Compatibility Macros": - - https://portal.hdfgroup.org/display/HDF5/API+Compatibility+Macros - -4.4. Building - The library, confidence tests, and programs can be built by - specifying: - - $ make - - Note that if you have supplied some other make command via the MAKE - variable during the configuration step, that same command must be - used here. - - When using GNU make, you can add `-j -l6' to the make command to - compile in parallel on SMP machines. Do not give a number after - the `-j' since GNU make will turn it off for recursive invocations - of make. - - $ make -j -l6 - -4.4. Building doxygen - One can optionally build the doxygen files for the HDF5 C library. - By default, this option is disabled. To build the html files, specify - '--enable-doxygen'. - - $ ./configure --enable-doxygen - - Configuration will halt if the required applications are not available. - To build: - - $ make doxygen - - -4.5. Testing - HDF5 comes with various test suites, all of which can be run by - specifying: - - $ make check - - To run only the tests for the library, change to the `test' - directory before issuing the command. Similarly, tests for the - parallel aspects of the library are in `testpar' and tests for - the support programs are in `tools'. - - The `check' consists of two sub-tests, check-s and check-p, which - are for serial and parallel tests, respectively. Since serial tests - and parallel tests must be run with single and multiple processes - respectively, the two sub-tests work nicely for batch systems in - which the number of processes is fixed per batch job. One may submit - one batch job, requesting 1 process, to run all the serial tests by - "make check-s"; and submit another batch job, requesting multiple - processes, to run all the parallel tests by "make check-p". - - Temporary files will be deleted by each test when it completes, - but may continue to exist in an incomplete state if the test - fails. To prevent deletion of the files, define the HDF5_NOCLEANUP - environment variable. - - The HDF5 tests can take a long time to run on some systems. To perform - a faster (but less thorough) test, set the HDF5TestExpress environment - variable to 2 or 3 (with 3 being the shortest run). To perform a - longer test, set HDF5TestExpress to 0. 3 is the default. - -4.6. Installing HDF5 - The HDF5 library, include files, and support programs can be - installed by specifying `make install'. The files are installed under the - directory specified with `--prefix=DIR' (or if not specified, in 'hdf5' - in the top directory of the HDF5 source code). They will be - placed in directories named `lib', `include', and `bin'. The directories, - if not existing, will be created automatically, provided the mkdir command - supports the -p option. - - If `make install' fails because the install command at your site - somehow fails, you may use the install-sh that comes with the - source. You will need to run ./configure again. - - $ INSTALL="$PWD/bin/install-sh -c" ./configure ... - $ make install - - If you want to install HDF5 in a location other than the location - specified by the `--prefix=DIR' flag during configuration (or - instead of the default location, `hdf5'), you can do that - by running the deploy script: - - $ bin/deploy NEW_DIR - - This will install HDF5 in NEW_DIR. Alternately, you can do this - manually by issuing the command: - - $ make install prefix=NEW_DIR - - where NEW_DIR is the new directory where you wish to install HDF5. - If you do not use the deploy script, you should run h5redeploy in - NEW_DIR/bin directory. This utility will fix the h5cc, h5fc and - h5c++ scripts to reflect the new NEW_DIR location. - - The library can be used without installing it by pointing the - compiler at the `src' and 'src/.libs' directory for include files and - libraries. However, the minimum which must be installed to make - the library publicly available is: - - The library: - ./src/.libs/libhdf5.a - - The public header files: - ./src/H5*public.h, ./src/H5public.h - ./src/H5FD*.h except ./src/H5FDprivate.h, - ./src/H5api_adpt.h - - The main header file: - ./src/hdf5.h - - The configuration information: - ./src/H5pubconf.h - - The support programs that are useful are: - ./tools/h5ls/h5ls (list file contents) - ./tools/h5dump/h5dump (dump file contents) - ./tools/misc/h5repart (repartition file families) - ./tools/misc/h5debug (low-level file debugging) - ./tools/h5import/h5import (imports data to HDF5 file) - ./tools/h5diff/h5diff (compares two HDF5 files) - ./tools/gifconv/h52gif (HDF5 to GIF converter) - ./tools/gifconv/gif2h5 (GIF to HDF5 converter) - - -5. Using the Library - - For information on using HDF5 see the documentation, tutorials and examples - found here: + https://github.com/HDFGroup/hdf5/releases - https://portal.hdfgroup.org/display/HDF5/HDF5 +4. Build and Install HDF5 on Unix and Mac OSX Platforms with autotools + see the release_docs/INSTALL_Autotools.txt file. - A summary of the features included in the built HDF5 installation can be found - in the libhdf5.settings file in the same directory as the static and/or - shared HDF5 libraries. +5. Build and Install HDF5 Libraries and tools with CMake + see the release_docs/INSTALL_CMake.txt file. diff --git a/release_docs/INSTALL_Auto.txt b/release_docs/INSTALL_Auto.txt new file mode 100644 index 00000000000..17700756042 --- /dev/null +++ b/release_docs/INSTALL_Auto.txt @@ -0,0 +1,525 @@ +************************************************************************* +* Installation Instructions for HDF5 using Autotools * +************************************************************************* + + Table of Contents + +Section I. Preconditions +Section II: Unix and Mac OSX Configuration and Build +Section III: Full installation instructions for source distributions +Section IV: Using the Library +Section V: Windows Configuration and Build + +************************************************************************ + +For help with installing, questions can be posted to the HDF Forum or sent to the HDF Helpdesk: + + HDF Forum: https://forum.hdfgroup.org/ + HDF Helpdesk: https://hdfgroup.atlassian.net/servicedesk/customer/portals + + +======================================================================== +I. Preconditions +======================================================================== +Obtaining HDF5 source code + 1. Create a directory for your development; for example, "myhdfstuff". + + 2. Obtain HDF5 source from Github + development branch: https://github.com/HDFGroup/hdf5 + last release: https://github.com/HDFGroup/hdf5/releases/latest + hdf5-1_14_"X".tar.gz or hdf5-1_14_"X".zip + + and put it in "myhdfstuff". + Uncompress the file. There should be a hdf5-1.14."X" folder. + + +======================================================================== +II. Unix and Mac OSX Configuration and Build +======================================================================== + +See RELEASE.txt in the release_notes/ directory for the list of platforms +tested for this release. + +Before You Start: + + 1. Make sure that the ZLIB library is installed on your system. + + 2. Optional: Install the Szip version 2.1 library (you may use + Szip 2.0 binaries). + + 3. Extract the source from the hdf5-X.Y.Z.tar file and change + directory to hdf5-X.Y.Z. + + 4. Quick installation + For those who don't like to read ;-) the following steps can be used + to configure, build, test, and install the HDF5 library, header files, + and support programs. For example, to install HDF5 version X.Y.Z at + location /usr/local/hdf5, use the following steps. + + $ cd hdf5-X.Y.Z + $ ./configure --prefix=/usr/local/hdf5 + $ make + $ make check # run test suite. + $ make install + $ make check-install # verify installation. + + above refers to the configure flags appropriate + to your installation. For example, to install HDF5 with the + Fortran and C++ interfaces and with SZIP compression, the + configure line might read as follows: + + $ ./configure --prefix=/usr/local/hdf5 --enable-fortran \ + --enable-cxx --with-szlib=PATH_TO_SZIP + + In this case, PATH_TO_SZIP would be replaced with the path to the + installed location of the SZIP library. + +======================================================================== +III. Full installation instructions for source distributions +======================================================================== + + 1. Unpacking the distribution + The HDF5 source code is distributed in a variety of formats which + can be unpacked with the following commands, each of which creates an + 'hdf5-X.Y.Z' directory, where X.Y.Z is the HDF5 version numbers. + + 1.1. Non-compressed tar archive (*.tar) + + $ tar xf hdf5-X.Y.Z.tar + + 1.2. Compressed tar archive (*.tar.Z) + + $ uncompress -c < hdf5-X.Y.Z.tar.Z | tar xf - + Or + $ tar Zxf hdf5-X.Y.Z.tar.Z + + 1.3. Gzip'd tar archive (*.tar.gz) + + $ gunzip < hdf5-X.Y.Z.tar.gz | tar xf - + Or + $ tar zxf hdf5-X.Y.Z.tar.gz + + 1.4. Bzip'd tar archive (*.tar.bz2) + + $ bunzip2 < hdf5-X.Y.Z.tar.bz2 | tar xf - + Or + $ tar jxf hdf5-X.Y.Z.tar.bz2 + + 2. Source versus build directories + On most systems the build can occur in a directory other than the + source directory, allowing multiple concurrent builds and/or + read-only source code. In order to accomplish this, one should + create a build directory, cd into that directory, and run the + `configure' script found in the source directory (configure + details are below). For example, + $ mkdir built-fortran + $ cd build-fortran + $ ../hdf5-X.Y.Z/configure --enable-fortran ... + + + 3. Configuring + HDF5 uses the GNU autoconf system for configuration, which + detects various features of the host system and creates the + Makefiles. On most systems it should be sufficient to say: + + $ ./configure + Or + $ sh configure + + The configuration process can be controlled through environment + variables, command-line switches, and host configuration files. + For a complete list of switches type: + + $ ./configure --help + + The host configuration files are located in the `config' + directory and are based on architecture name, vendor name, and/or + operating system which are displayed near the beginning of the + `configure' output. The host config file influences the behavior + of configure by setting or augmenting shell variables. + + 3.1. Specifying the installation directories + The default installation location is the HDF5 directory created in + the build directory. Typing `make install' will install the HDF5 + library, header files, examples, and support programs in hdf5/lib, + hdf5/include, hdf5/doc/hdf5/examples, and hdf5/bin. To use a path + other than hdf5, specify the path with the `--prefix=PATH' switch: + + $ ./configure --prefix=/usr/local + + If shared libraries are being built (the default), the final + home of the shared library must be specified with this switch + before the library and executables are built. + + HDF5 can be installed into a different location than the prefix + specified at configure time; see section 4.6, "Installing HDF5," + for more details. + + 3.2. Using an alternate C compiler + By default, configure will look for the C compiler by trying + `gcc' and `cc'. However, if the environment variable "CC" is set + then its value is used as the C compiler. For instance, one would + use the following line to specify the native C compiler on a system + that also has the GNU gcc compiler (users of csh and derivatives + will need to prefix the commands below with `env'): + + $ CC=cc ./configure + + A parallel version of HDF5 can be built by specifying `mpicc' + as the C compiler. (The `--enable-parallel' flag documented + below is optional in this case.) Using the `mpicc' compiler + will insure that the correct MPI and MPI-IO header files and + libraries are used. + + $ CC=/usr/local/mpi/bin/mpicc ./configure + + + 3.3. Additional compilation flags + If additional flags must be passed to the compilation commands, + specify those flags with the CFLAGS variable. For instance, + to enable symbolic debugging of a production version of HDF5, one + might say: + + $ CFLAGS=-g ./configure --enable-build-mode=production + + 3.4. Compiling HDF5 wrapper libraries + One can optionally build the Fortran, C++, and Java interfaces to + the HDF5 C library. By default, these options are disabled. To build + them, specify '--enable-fortran', '--enable-cxx', or '--enable-java', + respectively. + + $ ./configure --enable-fortran + $ ./configure --enable-cxx + $ ./configure --enable-java + + Configuration will halt if a working Fortran 90 or 95 compiler or + C++ compiler is not found. Currently, the Fortran configure tests + for these compilers in order: f90, pgf90, f95. To use an + alternate compiler specify it with the FC variable: + + $ FC=/usr/local/bin/g95 ./configure --enable-fortran + + + 3.5. Specifying other programs + The build system has been tuned for use with GNU make but also + works with other versions of make. If the `make' command runs a + non-GNU version but a GNU version is available under a different + name (perhaps `gmake'), then HDF5 can be configured to use it by + setting the MAKE variable. Note that whatever value is used for + MAKE must also be used as the make command when building the + library: + + $ MAKE=gmake ./configure + $ gmake + + The `AR' and `RANLIB' variables can also be set to the names of + the `ar' and `ranlib' (or `:') commands to override values + detected by configure. + + The HDF5 library, include files, and utilities are installed + during `make install' (described below) with a BSD-compatible + install program detected automatically by configure. If none is + found, the shell script bin/install-sh is used. Configure does not + check that the install script actually works; if a bad install is + detected on your system (e.g., on the ASCI blue machine as of + March 2, 1999) you have two choices: + + 1. Copy the bin/install-sh program to your $HOME/bin + directory, name it `install', and make sure that $HOME/bin + is searched before the system bin directories. + + 2. Specify the full path name of the `install-sh' program + as the value of the INSTALL environment variable. Note: do + not use `cp' or some other program in place of install + because the HDF5 makefiles also use the install program to + change file ownership and/or access permissions. + + 3.6. Specifying other libraries and headers + Configure searches the standard places (those places known by the + systems compiler) for include files and header files. However, + additional directories can be specified by using the CPPFLAGS + and/or LDFLAGS variables: + + $ CPPFLAGS=-I/home/robb/include \ + LDFLAGS=-L/home/robb/lib \ + ./configure + + HDF5 uses the zlib library to support the HDF5 deflate + data compression filter. Configure searches the standard places + (plus those specified above with the CPPFLAGS and LDFLAGS variables) + for the zlib headers and library. The search can be disabled by + specifying `--without-zlib' or alternate directories can be specified + with `--with-zlib=INCDIR,LIBDIR' or through the CPPFLAGS and LDFLAGS + variables: + + $ ./configure --with-zlib=/usr/unsup/include,/usr/unsup/lib + + $ CPPFLAGS=-I/usr/unsup/include \ + LDFLAGS=-L/usr/unsup/lib \ + ./configure + + HDF5 includes Szip as a predefined compression method (see 3.2). + To enable Szip compression, the HDF5 library must be configured + and built using the Szip library: + + $ ./configure --with-szlib=/Szip_Install_Directory + + 3.7. Static versus shared linking + The build process will create static libraries on all systems and + shared libraries on systems that support dynamic linking to a + sufficient degree. Either form of the library may be suppressed by + saying `--disable-static' or `--disable-shared'. + + $ ./configure --disable-shared + + Shared C++ and Fortran libraries will be built if shared libraries + are enabled. + + To build only statically linked executables on platforms which + support shared libraries, use the `--enable-static-exec' flag. + + $ ./configure --enable-static-exec + + 3.8. Optimization versus symbolic debugging + The library can be compiled to provide symbolic debugging support + so it can be debugged with gdb, dbx, ddd, etc., or it can be + compiled with various optimizations. To compile for symbolic + debugging (the default for snapshots), say + `--enable-build-mode=debug'; to compile with optimizations + (the default for supported public releases), + say `--enable-build-mode=production'. For a 'clean slate' configuration + with optimization disabled and nothing turned on, + say `--enable-build-mode=clean'. On some systems the + library can also be compiled for profiling with gprof by saying + `--enable-profiling'. + + $ ./configure --enable-build-mode=debug #symbolic debugging + $ ./configure --enable-build-mode=production #optimized code + $ ./configure --enable-build-mode=clean #'clean slate' + $ ./configure --enable-profiling #for use with gprof + + Regardless of whether support for symbolic debugging is enabled, + the library can also perform runtime debugging of certain packages + (such as type conversion execution times and extensive invariant + condition checking). To enable this debugging, supply a + comma-separated list of package names to the `--enable-internal-debug' + switch. + + Debugging can be disabled by saying `--disable-internal-debug'. + The default debugging level for snapshots is a subset of the + available packages; the default for supported releases is no + debugging (debugging can incur a significant runtime penalty). + + $ ./configure --enable-internal-debug=s,t #debug only H5S and H5T + $ ./configure --enable-internal-debug #debug normal packages + $ ./configure --enable-internal-debug=all #debug all packages + $ ./configure --disable-internal-debug #no debugging + + HDF5 can also print a trace of all API function calls, their + arguments, and the return values. To enable or disable the + ability to trace the API say `--enable-trace' (the default for + snapthots) or `--disable-trace' (the default for public releases). + The tracing must also be enabled at runtime to see any output. + + 3.9. Parallel versus serial library + The HDF5 library can be configured to use MPI and MPI-IO for + parallelism on a distributed multi-processor system. Read the + file INSTALL_parallel for detailed information. + + The threadsafe, C++ and Java interfaces are not compatible + with the parallel option. + Unless --enable-unsupported has been specified on the configure line, + the following options must be disabled: + --enable-threadsafe, --enable-cxx, --enable-java + + + 3.10. Threadsafe capability + The HDF5 library can be configured to be thread-safe (on a very + large scale) with the `--enable-threadsafe' flag to the configure + script. Some platforms may also require the '-with-pthread=INC,LIB' + (or '--with-pthread=DIR') flag to the configure script. + For further information, see: + + https://portal.hdfgroup.org/display/knowledge/Questions+about+thread-safety+and+concurrent+access + + The high-level, C++, Fortran and Java interfaces are not compatible + with the thread-safety option because the lock is not hoisted + into the higher-level API calls. + Unless --enable-unsupported has been specified on the configure line, + the following options must be disabled: + --enable-hl, --enable-cxx, --enable-fortran, --enable-java + + + 3.11. Backward compatibility + The 1.15 version of the HDF5 library can be configured to operate + identically to the v1.14 library with the + --with-default-api-version=v114 + identically to the v1.12 library with the + --with-default-api-version=v112 + configure flag, or identically to the v1.10 library with the + --with-default-api-version=v110 + configure flag, or identically to the v1.8 library with the + --with-default-api-version=v18 + configure flag, or identically to the v1.6 library with the + --with-default-api-version=v16 + configure flag. This allows existing code to be compiled with the + v1.15 library without requiring immediate changes to the application + source code. For additional configuration options and other details, + see "API Compatibility Macros": + + https://portal.hdfgroup.org/display/HDF5/API+Compatibility+Macros + + 4. Building + The library, confidence tests, and programs can be built by + specifying: + + $ make + + Note that if you have supplied some other make command via the MAKE + variable during the configuration step, that same command must be + used here. + + When using GNU make, you can add `-j -l6' to the make command to + compile in parallel on SMP machines. Do not give a number after + the `-j' since GNU make will turn it off for recursive invocations + of make. + + $ make -j -l6 + + 4. Building doxygen + One can optionally build the doxygen files for the HDF5 C library. + By default, this option is disabled. To build the html files, specify + '--enable-doxygen'. + + $ ./configure --enable-doxygen + + Configuration will halt if the required applications are not available. + To build: + + $ make doxygen + + + 5. Testing + HDF5 comes with various test suites, all of which can be run by + specifying: + + $ make check + + To run only the tests for the library, change to the `test' + directory before issuing the command. Similarly, tests for the + parallel aspects of the library are in `testpar' and tests for + the support programs are in `tools'. + + The `check' consists of two sub-tests, check-s and check-p, which + are for serial and parallel tests, respectively. Since serial tests + and parallel tests must be run with single and multiple processes + respectively, the two sub-tests work nicely for batch systems in + which the number of processes is fixed per batch job. One may submit + one batch job, requesting 1 process, to run all the serial tests by + "make check-s"; and submit another batch job, requesting multiple + processes, to run all the parallel tests by "make check-p". + + Temporary files will be deleted by each test when it completes, + but may continue to exist in an incomplete state if the test + fails. To prevent deletion of the files, define the HDF5_NOCLEANUP + environment variable. + + The HDF5 tests can take a long time to run on some systems. To perform + a faster (but less thorough) test, set the HDF5TestExpress environment + variable to 2 or 3 (with 3 being the shortest run). To perform a + longer test, set HDF5TestExpress to 0. 3 is the default. + + 6. Installing HDF5 + The HDF5 library, include files, and support programs can be + installed by specifying `make install'. The files are installed under the + directory specified with `--prefix=DIR' (or if not specified, in 'hdf5' + in the top directory of the HDF5 source code). They will be + placed in directories named `lib', `include', and `bin'. The directories, + if not existing, will be created automatically, provided the mkdir command + supports the -p option. + + If `make install' fails because the install command at your site + somehow fails, you may use the install-sh that comes with the + source. You will need to run ./configure again. + + $ INSTALL="$PWD/bin/install-sh -c" ./configure ... + $ make install + + If you want to install HDF5 in a location other than the location + specified by the `--prefix=DIR' flag during configuration (or + instead of the default location, `hdf5'), you can do that + by running the deploy script: + + $ bin/deploy NEW_DIR + + This will install HDF5 in NEW_DIR. Alternately, you can do this + manually by issuing the command: + + $ make install prefix=NEW_DIR + + where NEW_DIR is the new directory where you wish to install HDF5. + If you do not use the deploy script, you should run h5redeploy in + NEW_DIR/bin directory. This utility will fix the h5cc, h5fc and + h5c++ scripts to reflect the new NEW_DIR location. + + The library can be used without installing it by pointing the + compiler at the `src' and 'src/.libs' directory for include files and + libraries. However, the minimum which must be installed to make + the library publicly available is: + + The library: + ./src/.libs/libhdf5.a + + The public header files: + ./src/H5*public.h, ./src/H5public.h + ./src/H5FD*.h except ./src/H5FDprivate.h, + ./src/H5api_adpt.h + + The main header file: + ./src/hdf5.h + + The configuration information: + ./src/H5pubconf.h + + The support programs that are useful are: + ./tools/h5ls/h5ls (list file contents) + ./tools/h5dump/h5dump (dump file contents) + ./tools/misc/h5repart (repartition file families) + ./tools/misc/h5debug (low-level file debugging) + ./tools/h5import/h5import (imports data to HDF5 file) + ./tools/h5diff/h5diff (compares two HDF5 files) + ./tools/gifconv/h52gif (HDF5 to GIF converter) + ./tools/gifconv/gif2h5 (GIF to HDF5 converter) + + +======================================================================== +IV. Using the Library +======================================================================== + For information on using HDF5 see the documentation, tutorials and examples + found here: + + https://portal.hdfgroup.org/display/HDF5/HDF5 + + A summary of the features included in the built HDF5 installation can be found + in the libhdf5.settings file in the same directory as the static and/or + shared HDF5 libraries. + + +======================================================================== +V. Windows Configuration and Build +======================================================================== +See RELEASE.txt in the release_notes/ directory for the list of platforms +tested for this release. + +We now recommend that users build, test, and install HDF5 using CMake. + +Instructions for building and testing HDF5 using CMake can be found in the +INSTALL_CMake.txt file found in this folder. + +For instructions on building and testing an application with HDF5, see the +USING_HDF5_CMake.txt file found in this folder. + +Users who want to build and run an application with HDF5 in Visual Studio +without using CMake should consult the USING_HDF5_VS.txt file. + + diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index f9184cf6552..4d4af2423c9 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -15,6 +15,7 @@ Section VII: User Defined Options for HDF5 Libraries with CMake Section VIII: User Defined Compile Flags for HDF5 Libraries with CMake Section IX: Considerations for cross-compiling Section X: Using CMakePresets.json for compiling +Section XI: Autotools Configuration and Build ************************************************************************ @@ -25,14 +26,17 @@ I. Preconditions Obtaining HDF5 source code 1. Create a directory for your development; for example, "myhdfstuff". - 2. Obtain compressed (*.tar or *.zip) HDF5 source from - https://portal.hdfgroup.org/display/support/Building+HDF5+with+CMake + 2. Obtain HDF5 source from Github + development branch: https://github.com/HDFGroup/hdf5 + last release: https://github.com/HDFGroup/hdf5/releases/latest + hdf5-1_15_"X".tar.gz or hdf5-1_15_"X".zip + and put it in "myhdfstuff". Uncompress the file. There should be a hdf5-1.15."X" folder. CMake version 1. We suggest you obtain the latest CMake from the Kitware web site. - The HDF5 1.15."X" product requires a minimum CMake version 3.12, + The HDF5 1.15."X" product requires a minimum CMake version 3.18, where "X" is the current HDF5 release version. If you are using VS2022, the minimum version is 3.21. @@ -46,36 +50,30 @@ Note: II. Quick Step Building HDF5 Libraries with CMake Script Mode ======================================================================== This short set of instructions is written for users who want to quickly -build the HDF5 C and C++ static libraries and tools with SZIP and ZLIB -compression included. This procedure will use the default settings in -the config/cmake/cacheinit.cmake file. +build the HDF5 C, C++ and Fortran shared libraries and tools +from the HDF5 source code package using the CMake tools. This procedure +will use the default settings in the config/cmake/cacheinit.cmake file. HDF Group recommends using the ctest script mode to build HDF5. -The following files referenced below are available at the HDF web site: - https://portal.hdfgroup.org/display/support/Building+HDF5+with+CMake - -Single compressed file with all the files needed, including source: - CMake-hdf5-1.15.X.zip or CMake-hdf5-1.15.X.tar.gz - -Individual files included in the above mentioned compressed files ------------------------------------------------ -CMake build script: +------------------------------------------------------------------------- +------------------------------------------------------------------------- +Individual files needed as mentioned in this document +------------------------------------------------------------------------- +CMake build script from https://github.com/HDFGroup/hdf5/tree/master/config/cmake/scripts: CTestScript.cmake -External compression szip and zlib libraries: - LIBAEC.tar.gz - SZip.tar.gz - ZLib.tar.gz +Configuration files from https://github.com/HDFGroup/hdf5/tree/master/config/cmake/scripts: + HDF5config.cmake + HDF5options.cmake -External compression plugin libraries: +External compression plugin libraries from https://github.com/HDFGroup/hdf5_plugins: hdf5_plugins.tar.gz -Examples Source package: - HDF5Examples-2.0.x-Source.tar.gz - -Configuration files: - HDF5config.cmake - HDF5options.cmake +External compression szip and zlib libraries: + ZLIB "https://github.com/madler/zlib/releases/download/v1.2.13/zlib-1.3.tar.gz" + LIBAEC "https://github.com/MathisRosenhauer/libaec/releases/download/v1.0.6/libaec-1.0.6.tar.gz" +------------------------------------------------------------------------- +------------------------------------------------------------------------- Build scripts for windows or linux ----------------------------------------------- @@ -84,15 +82,15 @@ To build HDF5 with the SZIP and ZLIB external libraries you will need to: 1. Change to the development directory "myhdfstuff". - 2. Download the CMake-hdf5-1.15.X.zip(.tar.gz) file to "myhdfstuff". - Uncompress the file. + 2. Download/copy the individual files mentioned above to "myhdfstuff". + Do not uncompress the tar.gz files. 3. Change to the source directory "hdf5-1.15.x". CTestScript.cmake file should not be modified. 4. Edit the platform configuration file, HDF5options.cmake, if you want to change - the default build environment. - (See https://portal.hdfgroup.org/display/support/How+to+Change+HDF5+CMake+Build+Options) + the default build environment. The file is a compilation of the most used + options and by commenting/uncommenting lines the options can easily be changed. 5. From the "myhdfstuff" directory execute the CTest Script with the following options: @@ -213,7 +211,7 @@ Notes: This short set of instructions is written for users who want to cmake -G "Visual Studio 16 2019" -A Win32 -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTING:BOOL=ON -DHDF5_BUILD_TOOLS:BOOL=ON ..\hdf5-1.15."X" On Windows 64 bit - cmake -G "Visual Studio 16 2019 Win64" -A x64 -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTING:BOOL=ON -DHDF5_BUILD_TOOLS:BOOL=ON ..\hdf5-1.15."X" + cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTING:BOOL=ON -DHDF5_BUILD_TOOLS:BOOL=ON ..\hdf5-1.15."X" On Linux and Mac cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTING:BOOL=ON -DHDF5_BUILD_TOOLS:BOOL=ON ../hdf5-1.15."X" @@ -279,6 +277,7 @@ IV. Further considerations 1. We suggest you obtain the latest CMake for windows from the Kitware web site. The HDF5 1.15."X" product requires a minimum CMake version 3.18. + If you are using VS2022, the CMake minimum version is 3.21. 2. If you plan to use Zlib or Szip: A. Download the binary packages and install them in a central location. @@ -310,7 +309,7 @@ IV. Further considerations CMake options: HDF5_ALLOW_EXTERNAL_SUPPORT:STRING="TGZ" ZLIB_TGZ_NAME:STRING="zlib_src.ext" - LIBAEC_TGZ_NAME:STRING="szaec_src.ext" + LIBAEC_TGZ_NAME:STRING="libaec_src.ext" TGZPATH:STRING="some_location" where "some_location" is the URL or full path to the compressed file and ext is the type of compression file. Also set CMAKE_BUILD_TYPE @@ -335,6 +334,9 @@ IV. Further considerations The files can also be retrieved from a local path if necessary TGZPATH:STRING="some_location" + by setting + ZLIB_USE_LOCALCONTENT:BOOL=ON + LIBAEC_USE_LOCALCONTENT:BOOL=ON 3. If you plan to use compression plugins: A. Use source packages from an GIT server by adding the following CMake @@ -421,11 +423,7 @@ Notes: CMake and HDF5 3. Build and test results can be submitted to our CDash server: The CDash server for community submissions of hdf5 is at - https://cdash.hdfgroup.org. - - Submitters are requested to register their name and contact info and - maintain their test sites. After your first submission, login and go - to your "My CDash" link and claim your site. + https://my.cdash.org. We ask that all submissions include the configuration information and contact information in the CTest Notes Files upload step. See the @@ -508,132 +506,144 @@ These five steps are described in detail below. * :BOOL=[ON | OFF] is: - # This is the CMakeCache file used by HDF Group for daily tests. - ######################## - # EXTERNAL cache entries - ######################## - set (CMAKE_INSTALL_FRAMEWORK_PREFIX "Library/Frameworks" CACHE STRING "Frameworks installation directory" FORCE) - set (HDF_PACKAGE_EXT "" CACHE STRING "Name of HDF package extension" FORCE) - set (HDF_PACKAGE_NAMESPACE "hdf5::" CACHE STRING "Name for HDF package namespace (can be empty)" FORCE) - set (HDF5_BUILD_CPP_LIB ON CACHE BOOL "Build C++ support" FORCE) - set (HDF5_BUILD_FORTRAN ON CACHE BOOL "Build FORTRAN support" FORCE) - set (HDF5_BUILD_JAVA ON CACHE BOOL "Build JAVA support" FORCE) - set (HDF5_INSTALL_MOD_FORTRAN "NO" CACHE STRING "Copy FORTRAN mod files to include directory (NO SHARED STATIC)" FORCE) - set_property (CACHE HDF5_INSTALL_MOD_FORTRAN PROPERTY STRINGS NO SHARED STATIC) - set (HDF5_BUILD_GENERATORS ON CACHE BOOL "Build Test Generators" FORCE) - set (MPIEXEC_MAX_NUMPROCS "4" CACHE STRING "Minimum number of processes for HDF parallel tests" FORCE) - set (HDF5_ENABLE_ALL_WARNINGS ON CACHE BOOL "Enable all warnings" FORCE) - set (HDF_TEST_EXPRESS "2" CACHE STRING "Control testing framework (0-3)" FORCE) - set (HDF5_MINGW_STATIC_GCC_LIBS ON CACHE BOOL "Statically link libgcc/libstdc++" FORCE) - set (HDF5_ALLOW_EXTERNAL_SUPPORT "TGZ" CACHE STRING "Allow External Library Building (NO GIT TGZ)" FORCE) - set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO GIT TGZ) - set (ZLIB_PACKAGE_NAME "zlib" CACHE STRING "Name of ZLIB package" FORCE) - set (ZLIB_TGZ_NAME "zlib-1.3.tar.gz" CACHE STRING "Use HDF5_ZLib from compressed file" FORCE) - set (ZLIB_TGZ_ORIGPATH "https://github.com/madler/zlib/releases/download/v1.3" CACHE STRING "Use ZLIB from original location" FORCE) - set (ZLIB_TGZ_NAME "zlib-1.3.tar.gz" CACHE STRING "Use ZLIB from original compressed file" FORCE) - set (ZLIB_USE_LOCALCONTENT ON CACHE BOOL "Use local file for ZLIB FetchContent" FORCE) - set (LIBAEC_PACKAGE_NAME "libaec" CACHE STRING "Name of AEC SZIP package" FORCE) - set (LIBAEC_TGZ_ORIGPATH "https://github.com/MathisRosenhauer/libaec/releases/download/v1.0.6" CACHE STRING "Use LIBAEC from original location" FORCE) - set (LIBAEC_TGZ_NAME "libaec-1.0.6.tar.gz" CACHE STRING "Use LIBAEC from original compressed file" FORCE) - set (LIBAEC_USE_LOCALCONTENT ON CACHE BOOL "Use local file for LIBAEC FetchContent" FORCE) - ####################### - # filter plugin options - ####################### - set (PLUGIN_TGZ_ORIGPATH "https://github.com/HDFGroup/hdf5_plugins/releases/download/snapshots" CACHE STRING "Use PLUGINS from original location" FORCE) - set (PLUGIN_TGZ_NAME "hdf5_plugins-master.tar.gz" CACHE STRING "Use PLUGINS from compressed file" FORCE) - set (PLUGIN_USE_LOCALCONTENT ON CACHE BOOL "Use local file for PLUGIN FetchContent" FORCE) - set (PLUGIN_PACKAGE_NAME "pl" CACHE STRING "Name of PLUGIN package" FORCE) - ############ - # bitshuffle - ########### - set (BSHUF_GIT_URL "https://github.com/kiyo-masui/bitshuffle.git" CACHE STRING "Use BSHUF from HDF repository" FORCE) - set (BSHUF_GIT_BRANCH "master" CACHE STRING "" FORCE) - set (BSHUF_TGZ_ORIGPATH "https://github.com/kiyo-masui/bitshuffle/archive/refs/tags" CACHE STRING "Use PLUGINS from original location" FORCE) - set (BSHUF_TGZ_NAME "bitshuffle-0.5.1.tar.gz" CACHE STRING "Use BSHUF from compressed file" FORCE) - set (BSHUF_PACKAGE_NAME "bshuf" CACHE STRING "Name of BSHUF package" FORCE) - ####### - # blosc - ####### - set (BLOSC_GIT_URL "https://github.com/Blosc/c-blosc.git" CACHE STRING "Use BLOSC from Github repository" FORCE) - set (BLOSC_GIT_BRANCH "main" CACHE STRING "" FORCE) - set (BLOSC_TGZ_ORIGPATH "https://github.com/Blosc/c-blosc/archive/refs/tags" CACHE STRING "Use PLUGINS from original location" FORCE) - set (BLOSC_TGZ_NAME "c-blosc-1.21.5.tar.gz" CACHE STRING "Use BLOSC from compressed file" FORCE) - set (BLOSC_PACKAGE_NAME "blosc" CACHE STRING "Name of BLOSC package" FORCE) - set (BLOSC_ZLIB_GIT_URL "https://github.com/madler/zlib.git" CACHE STRING "Use ZLIB from GitHub repository" FORCE) - set (BLOSC_ZLIB_GIT_BRANCH "develop" CACHE STRING "" FORCE) - set (BLOSC_ZLIB_TGZ_ORIGPATH "https://github.com/madler/zlib/releases/download/v1.3" CACHE STRING "Use PLUGINS from original location" FORCE) - set (BLOSC_ZLIB_TGZ_NAME "zlib-1.3.tar.gz" CACHE STRING "Use ZLib from compressed file" FORCE) - set (BLOSC_ZLIB_PACKAGE_NAME "zlib" CACHE STRING "Name of BLOSC_ZLIB package" FORCE) - ####### - # bzip2 - ###### - # - set (BZ2_GIT_URL "https://github.com/libarchive/bzip2.git" CACHE STRING "Use BZ2 from GitHub repository" FORCE) - set (BZ2_GIT_BRANCH "master" CACHE STRING "" FORCE) - set (BZ2_TGZ_ORIGPATH "https://github.com/libarchive/bzip2/archive/refs/tags" CACHE STRING "Use PLUGINS from original location" FORCE) - set (BZ2_TGZ_NAME "bzip2-bzip2-1.0.8.tar.gz" CACHE STRING "Use BZ2 from compressed file" FORCE) - set (BZ2_PACKAGE_NAME "bz2" CACHE STRING "Name of BZ2 package" FORCE) - ####### - # fpzip - ####### - set (FPZIP_GIT_URL "https://github.com/LLNL/fpzip.git" CACHE STRING "Use FPZIP from GitHub repository" FORCE) - set (FPZIP_GIT_BRANCH "develop" CACHE STRING "" FORCE) - set (FPZIP_TGZ_ORIGPATH "https://github.com/LLNL/fpzip/releases/download/1.3.0" CACHE STRING "Use PLUGINS from original location" FORCE) - set (FPZIP_TGZ_NAME "fpzip-1.3.0.tar.gz" CACHE STRING "Use FPZIP from compressed file" FORCE) - set (FPZIP_PACKAGE_NAME "fpzip" CACHE STRING "Name of FPZIP package" FORCE) - ###### - # jpeg - ###### - set (JPEG_GIT_URL "No repo www.ijg.org/files" CACHE STRING "Use JPEG from ILG" FORCE) - set (JPEG_GIT_BRANCH "v9e" CACHE STRING "" FORCE) - set (JPEG_TGZ_ORIGPATH "https://www.ijg.org/files" CACHE STRING "Use PLUGINS from original location" FORCE) - set (JPEG_TGZ_NAME "jpegsrc.v9e.tar.gz" CACHE STRING "Use JPEG from compressed file" FORCE) - set (JPEG_PACKAGE_NAME "jpeg" CACHE STRING "Name of JPEG package" FORCE) - ###### - # lz4 - ###### - set (BUILD_LZ4_LIBRARY_SOURCE ON CACHE BOOL "build the lz4 library within the plugin" FORCE) - set (LZ4_GIT_URL "https://github.com/lz4/lz4.git" CACHE STRING "Use LZ4 from GitHub repository" FORCE) - set (LZ4_GIT_BRANCH "dev" CACHE STRING "" FORCE) - set (LZ4_TGZ_ORIGPATH "https://github.com/lz4/lz4/releases/download/v1.9.4" CACHE STRING "Use PLUGINS from original location" FORCE) - set (LZ4_TGZ_NAME "lz4-1.9.4.tar.gz" CACHE STRING "Use LZ4 from compressed file" FORCE) - set (LZ4_PACKAGE_NAME "lz4" CACHE STRING "Name of LZ4 package" FORCE) - ###### - # lzf - ###### - set (LZF_URL "http://software.schmorp.de/pkg/liblzf.html" CACHE STRING "LZF home" FORCE) - set (LZF_TGZ_ORIGPATH "http://dist.schmorp.de/liblzf" CACHE STRING "Use LZF from original location" FORCE) - set (LZF_TGZ_NAME "liblzf-3.6.tar.gz" CACHE STRING "Use LZF from compressed file" FORCE) - set (LZF_PACKAGE_NAME "lzf" CACHE STRING "Name of LZF package" FORCE) - ######## - # mafisc - ######## - #set (BUILD_MAFISC_LIBRARY_SOURCE OFF CACHE BOOL "build the mafisc library within the plugin" FORCE) - #set (MAFISC_PACKAGE_NAME "mafisc" CACHE STRING "Name of MAFISC package" FORCE) - ###### - # szf - ###### - set (SZ_GIT_URL "https://github.com/szcompressor/SZ.git" CACHE STRING "Use SZ filter from GitHub repository" FORCE) - set (SZ_GIT_BRANCH "master" CACHE STRING "" FORCE) - set (SZ_TGZ_ORIGPATH "https://github.com/szcompressor/SZ/releases/download/v2.1.12.5" CACHE STRING "Use PLUGINS from original location" FORCE) - set (SZ_TGZ_NAME "SZ-2.1.12.5.tar.gz" CACHE STRING "Use SZ filter from compressed file" FORCE) - set (SZF_PACKAGE_NAME "szf" CACHE STRING "Name of SZ package" FORCE) - ###### - # zfp - ###### - set (ZFP_GIT_URL "https://github.com/LLNL/zfp.git" CACHE STRING "Use ZFP from GitHub repository" FORCE) - set (ZFP_GIT_BRANCH "develop" CACHE STRING "" FORCE) - set (ZFP_TGZ_ORIGPATH "https://github.com/LLNL/zfp/releases/download/1.0.0" CACHE STRING "Use PLUGINS from original location" FORCE) - set (ZFP_TGZ_NAME "zfp-1.0.0.tar.gz" CACHE STRING "Use ZFP from compressed file" FORCE) - set (ZFP_PACKAGE_NAME "zfp" CACHE STRING "Name of ZFP package" FORCE) - ###### - # zstd - ###### - set (ZSTD_GIT_URL "https://github.com/facebook/zstd.git" CACHE STRING "Use ZSTD from GitHub repository" FORCE) - set (ZSTD_GIT_BRANCH "dev" CACHE STRING "" FORCE) - set (ZSTD_TGZ_ORIGPATH "https://github.com/facebook/zstd/releases/download/v1.5.5" CACHE STRING "Use PLUGINS from original location" FORCE) - set (ZSTD_TGZ_NAME "zstd-1.5.5.tar.gz" CACHE STRING "Use ZSTD from compressed file" FORCE) - set (ZSTD_PACKAGE_NAME "zstd" CACHE STRING "Name of ZSTD package" FORCE) + # This is the CMakeCache file used by HDF Group for daily tests. + set (CMAKE_INSTALL_FRAMEWORK_PREFIX "Library/Frameworks" CACHE STRING "Frameworks installation directory" FORCE) + set (HDF_PACKAGE_EXT "" CACHE STRING "Name of HDF package extension" FORCE) + set (HDF_PACKAGE_NAMESPACE "hdf5::" CACHE STRING "Name for HDF package namespace (can be empty)" FORCE) + set (HDF5_BUILD_CPP_LIB ON CACHE BOOL "Build C++ support" FORCE) + set (HDF5_BUILD_FORTRAN ON CACHE BOOL "Build FORTRAN support" FORCE) + set (HDF5_BUILD_JAVA ON CACHE BOOL "Build JAVA support" FORCE) + set (HDF5_INSTALL_MOD_FORTRAN "NO" CACHE STRING "Copy FORTRAN mod files to include directory (NO SHARED STATIC)" FORCE) + set_property (CACHE HDF5_INSTALL_MOD_FORTRAN PROPERTY STRINGS NO SHARED STATIC) + set (HDF5_BUILD_GENERATORS ON CACHE BOOL "Build Test Generators" FORCE) + set (MPIEXEC_MAX_NUMPROCS "4" CACHE STRING "Minimum number of processes for HDF parallel tests" FORCE) + set (HDF5_ENABLE_ALL_WARNINGS ON CACHE BOOL "Enable all warnings" FORCE) + set (HDF_TEST_EXPRESS "2" CACHE STRING "Control testing framework (0-3)" FORCE) + set (HDF5_MINGW_STATIC_GCC_LIBS ON CACHE BOOL "Statically link libgcc/libstdc++" FORCE) + set (HDF5_ALLOW_EXTERNAL_SUPPORT "TGZ" CACHE STRING "Allow External Library Building (NO GIT TGZ)" FORCE) + set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO GIT TGZ) + ######################## + # compression options + ######################## + set (ZLIB_PACKAGE_NAME "zlib" CACHE STRING "Name of ZLIB package" FORCE) + set (ZLIB_TGZ_NAME "zlib-1.3.tar.gz" CACHE STRING "Use HDF5_ZLib from compressed file" FORCE) + set (ZLIB_TGZ_ORIGPATH "https://github.com/madler/zlib/releases/download/v1.3" CACHE STRING "Use ZLIB from original location" FORCE) + set (ZLIB_USE_LOCALCONTENT ON CACHE BOOL "Use local file for ZLIB FetchContent" FORCE) + set (ZLIB_GIT_URL "https://github.com/madler/zlib.git" CACHE STRING "Use ZLIB from GitHub repository" FORCE) + set (ZLIB_GIT_BRANCH "develop" CACHE STRING "" FORCE) + set (LIBAEC_PACKAGE_NAME "libaec" CACHE STRING "Name of AEC SZIP package" FORCE) + set (LIBAEC_TGZ_NAME "libaec-1.0.6.tar.gz" CACHE STRING "Use SZip AEC from compressed file" FORCE) + set (LIBAEC_TGZ_ORIGPATH "https://github.com/MathisRosenhauer/libaec/releases/download/v1.0.6" CACHE STRING "Use LIBAEC from original location" FORCE) + set (LIBAEC_USE_LOCALCONTENT ON CACHE BOOL "Use local file for LIBAEC FetchContent" FORCE) + set (LIBAEC_GIT_URL "https://github.com/MathisRosenhauer/libaec.git" CACHE STRING "Use LIBAEC from GitHub repository" FORCE) + set (LIBAEC_GIT_BRANCH "v1.0.6" CACHE STRING "" FORCE) + ######################## + # API test options + ######################## + set (KWSYS_TGZ_ORIGPATH "https://gitlab.kitware.com/utils/kwsys/-/archive/master" CACHE STRING "Use KWSYS from original location" FORCE) + set (KWSYS_TGZ_NAME "kwsys-master.tar.gz" CACHE STRING "Use KWSYS from original compressed file" FORCE) + set (KWSYS_USE_LOCALCONTENT OFF CACHE BOOL "Use local file for KWSYS FetchContent" FORCE) + ######################## + # filter plugin options + ######################## + set (PLUGIN_TGZ_ORIGPATH "https://github.com/HDFGroup/hdf5_plugins/releases/download/snapshots" CACHE STRING "Use PLUGINS from original location" FORCE) + set (PLUGIN_TGZ_NAME "hdf5_plugins-master.tar.gz" CACHE STRING "Use PLUGINS from compressed file" FORCE) + set (PLUGIN_USE_LOCALCONTENT ON CACHE BOOL "Use local file for PLUGIN FetchContent" FORCE) + set (PLUGIN_PACKAGE_NAME "pl" CACHE STRING "Name of PLUGIN package" FORCE) + set (PLUGIN_GIT_URL "https://github.com/HDFGroup/hdf5_plugins.git" CACHE STRING "Use plugins from HDF Group repository" FORCE) + set (PLUGIN_GIT_BRANCH "master" CACHE STRING "" FORCE) + ############# + # bitshuffle + ############# + set (BSHUF_GIT_URL "https://github.com/kiyo-masui/bitshuffle.git" CACHE STRING "Use BSHUF from HDF repository" FORCE) + set (BSHUF_GIT_BRANCH "master" CACHE STRING "" FORCE) + set (BSHUF_TGZ_ORIGPATH "https://github.com/kiyo-masui/bitshuffle/archive/refs/tags" CACHE STRING "Use PLUGINS from original location" FORCE) + set (BSHUF_TGZ_NAME "bitshuffle-0.5.1.tar.gz" CACHE STRING "Use BSHUF from compressed file" FORCE) + set (BSHUF_PACKAGE_NAME "bshuf" CACHE STRING "Name of BSHUF package" FORCE) + ######## + # blosc + ######## + set (BLOSC_GIT_URL "https://github.com/Blosc/c-blosc.git" CACHE STRING "Use BLOSC from Github repository" FORCE) + set (BLOSC_GIT_BRANCH "main" CACHE STRING "" FORCE) + set (BLOSC_TGZ_ORIGPATH "https://github.com/Blosc/c-blosc/archive/refs/tags" CACHE STRING "Use PLUGINS from original location" FORCE) + set (BLOSC_TGZ_NAME "c-blosc-1.21.5.tar.gz" CACHE STRING "Use BLOSC from compressed file" FORCE) + set (BLOSC_PACKAGE_NAME "blosc" CACHE STRING "Name of BLOSC package" FORCE) + set (BLOSC_ZLIB_GIT_URL "https://github.com/madler/zlib.git" CACHE STRING "Use ZLIB from GitHub repository" FORCE) + set (BLOSC_ZLIB_GIT_BRANCH "develop" CACHE STRING "" FORCE) + set (BLOSC_ZLIB_TGZ_ORIGPATH "https://github.com/madler/zlib/releases/download/v1.3" CACHE STRING "Use PLUGINS from original location" FORCE) + set (BLOSC_ZLIB_TGZ_NAME "zlib-1.3.tar.gz" CACHE STRING "Use ZLib from compressed file" FORCE) + set (BLOSC_ZLIB_PACKAGE_NAME "zlib" CACHE STRING "Name of BLOSC_ZLIB package" FORCE) + ######## + # bzip2 + ######## + set (BZ2_GIT_URL "https://github.com/libarchive/bzip2.git" CACHE STRING "Use BZ2 from GitHub repository" FORCE) + set (BZ2_GIT_BRANCH "bzip2-1.0.8" CACHE STRING "" FORCE) + set (BZ2_TGZ_ORIGPATH "https://github.com/libarchive/bzip2/archive/refs/tags" CACHE STRING "Use PLUGINS from original location" FORCE) + set (BZ2_TGZ_NAME "bzip2-bzip2-1.0.8.tar.gz" CACHE STRING "Use BZ2 from compressed file" FORCE) + set (BZ2_PACKAGE_NAME "bz2" CACHE STRING "Name of BZ2 package" FORCE) + ######## + # fpzip + ######## + set (FPZIP_GIT_URL "https://github.com/LLNL/fpzip.git" CACHE STRING "Use FPZIP from GitHub repository" FORCE) + set (FPZIP_GIT_BRANCH "develop" CACHE STRING "" FORCE) + set (FPZIP_TGZ_ORIGPATH "https://github.com/LLNL/fpzip/releases/download/1.3.0" CACHE STRING "Use PLUGINS from original location" FORCE) + set (FPZIP_TGZ_NAME "fpzip-1.3.0.tar.gz" CACHE STRING "Use FPZIP from compressed file" FORCE) + set (FPZIP_PACKAGE_NAME "fpzip" CACHE STRING "Name of FPZIP package" FORCE) + ####### + # jpeg + ####### + set (JPEG_GIT_URL "https://github.com/libjpeg-turbo/libjpeg-turbo.git" CACHE STRING "Use JPEG from TurboJPEG" FORCE) + set (JPEG_GIT_BRANCH "jpeg-9e" CACHE STRING "" FORCE) + set (JPEG_TGZ_ORIGPATH "https://www.ijg.org/files" CACHE STRING "Use PLUGINS from original location" FORCE) + set (JPEG_TGZ_NAME "jpegsrc.v9e.tar.gz" CACHE STRING "Use JPEG from compressed file" FORCE) + set (JPEG_PACKAGE_NAME "jpeg" CACHE STRING "Name of JPEG package" FORCE) + ###### + # lz4 + ###### + set (BUILD_LZ4_LIBRARY_SOURCE ON CACHE BOOL "build the lz4 library within the plugin" FORCE) + set (LZ4_GIT_URL "https://github.com/lz4/lz4.git" CACHE STRING "Use LZ4 from GitHub repository" FORCE) + set (LZ4_GIT_BRANCH "dev" CACHE STRING "" FORCE) + set (LZ4_TGZ_ORIGPATH "https://github.com/lz4/lz4/releases/download/v1.9.4" CACHE STRING "Use PLUGINS from original location" FORCE) + set (LZ4_TGZ_NAME "lz4-1.9.4.tar.gz" CACHE STRING "Use LZ4 from compressed file" FORCE) + set (LZ4_PACKAGE_NAME "lz4" CACHE STRING "Name of LZ4 package" FORCE) + ###### + # lzf + ###### + set (LZF_URL "http://software.schmorp.de/pkg/liblzf.html" CACHE STRING "LZF home" FORCE) + set (LZF_TGZ_ORIGPATH "http://dist.schmorp.de/liblzf" CACHE STRING "Use LZF from original location" FORCE) + set (LZF_TGZ_NAME "liblzf-3.6.tar.gz" CACHE STRING "Use LZF from compressed file" FORCE) + set (LZF_PACKAGE_NAME "lzf" CACHE STRING "Name of LZF package" FORCE) + ######### + # mafisc + ######### + #set (BUILD_MAFISC_LIBRARY_SOURCE OFF CACHE BOOL "build the mafisc library within the plugin" FORCE) + #set (MAFISC_TGZ_ORIGPATH "" CACHE STRING "Use PLUGINS from original location" FORCE) + #set (MAFISC_TGZ_NAME ".tar.gz" CACHE STRING "Use MAFISC from compressed file" FORCE) + #set (MAFISC_PACKAGE_NAME "mafisc" CACHE STRING "Name of MAFISC package" FORCE) + ##### + # sz + ##### + set (SZ_GIT_URL "https://github.com/szcompressor/SZ.git" CACHE STRING "Use SZ filter from GitHub repository" FORCE) + set (SZ_GIT_BRANCH "master" CACHE STRING "" FORCE) + set (SZ_TGZ_ORIGPATH "https://github.com/szcompressor/SZ/releases/download/v2.1.12.5" CACHE STRING "Use PLUGINS from original location" FORCE) + set (SZ_TGZ_NAME "SZ-2.1.12.5.tar.gz" CACHE STRING "Use SZ filter from compressed file" FORCE) + set (SZ_PACKAGE_NAME "SZ" CACHE STRING "Name of SZ filter package" FORCE) + ###### + # zfp + ###### + set (ZFP_GIT_URL "https://github.com/LLNL/zfp.git" CACHE STRING "Use ZFP from GitHub repository" FORCE) + set (ZFP_GIT_BRANCH "develop" CACHE STRING "" FORCE) + set (ZFP_TGZ_ORIGPATH "https://github.com/LLNL/zfp/releases/download/1.0.0" CACHE STRING "Use PLUGINS from original location" FORCE) + set (ZFP_TGZ_NAME "zfp-1.0.0.tar.gz" CACHE STRING "Use ZFP from compressed file" FORCE) + set (ZFP_PACKAGE_NAME "zfp" CACHE STRING "Name of ZFP package" FORCE) + ###### + # zstd + ###### + set (ZSTD_GIT_URL "https://github.com/facebook/zstd.git" CACHE STRING "Use ZSTD from GitHub repository" FORCE) + set (ZSTD_GIT_BRANCH "dev" CACHE STRING "" FORCE) + set (ZSTD_TGZ_ORIGPATH "https://github.com/facebook/zstd/releases/download/v1.5.5" CACHE STRING "Use PLUGINS from original location" FORCE) + set (ZSTD_TGZ_NAME "zstd-1.5.5.tar.gz" CACHE STRING "Use ZSTD from compressed file" FORCE) + set (ZSTD_PACKAGE_NAME "zstd" CACHE STRING "Name of ZSTD package" FORCE) 2. Configure the cache settings @@ -657,7 +667,7 @@ These five steps are described in detail below. 2.2 Preferred command line example on Windows in c:\MyHDFstuff\hdf5\build directory: - cmake -C ../config/cmake/cacheinit.cmake -G "Visual Studio 16 2019" "-Ax64"\ + cmake -C ../config/cmake/cacheinit.cmake -G "Visual Studio 16 2019" "-Ax64" \ -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF \ -DCMAKE_BUILD_TYPE:STRING=Release .. @@ -692,11 +702,11 @@ These five steps are described in detail below. -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING="GIT" The options to control the GIT parameters (config/cmake/cacheinit.cmake file) are: - ZLIB_GIT_URL:STRING="http://${git_url}/zlib" + ZLIB_GIT_URL:STRING="https://${git_url}/zlib" ZLIB_GIT_BRANCH="${git_branch}" - SZIP_GIT_URL:STRING="http://${git_url}/szip" + SZIP_GIT_URL:STRING="https://${git_url}/szip" SZIP_GIT_BRANCH="${git_branch}" - PLUGIN_GIT_URL:STRING="http://${git_url}/plugin" + PLUGIN_GIT_URL:STRING="https://${git_url}/plugin" PLUGIN_GIT_BRANCH="${git_branch}" ${git_url} should be changed to your location and ${git_branch} is your branch in the repository. Also define CMAKE_BUILD_TYPE @@ -719,8 +729,7 @@ These five steps are described in detail below. file such as .bz2, .tar, .tar.gz, .tgz, or .zip. Also define CMAKE_BUILD_TYPE to be the configuration type. - NOTE: HDF5 uses the file named by LIBAEC_TGZ_NAME to build SZIP. This - is used to account for the different headers and library names. + NOTE: the file named by LIBAEC_TGZ_NAME is used to build SZIP. 4. Test HDF5 @@ -779,7 +788,7 @@ In the options listed below, there are three columns of information: Option Name, Option Description, and Option Default. The config/cmake/cacheinit.cmake file can override the following values. ----------------- General Build Options --------------------- +---------------- General Build Options ------------------------------------- BUILD_SHARED_LIBS "Build Shared Libraries" ON BUILD_STATIC_LIBS "Build Static Libraries" ON BUILD_STATIC_EXECS "Build Static Executables" OFF @@ -787,16 +796,18 @@ BUILD_TESTING "Build HDF5 Unit Testing" ON if (WINDOWS) DISABLE_PDB_FILES "Do not install PDB files" OFF ----------------- HDF5 Build Options --------------------- -HDF5_BUILD_CPP_LIB "Build HDF5 C++ Library" OFF -HDF5_BUILD_EXAMPLES "Build HDF5 Library Examples" ON -HDF5_BUILD_FORTRAN "Build FORTRAN support" OFF -HDF5_BUILD_JAVA "Build JAVA support" OFF -HDF5_BUILD_HL_LIB "Build HIGH Level HDF5 Library" ON -HDF5_BUILD_TOOLS "Build HDF5 Tools" ON -HDF5_BUILD_HL_GIF_TOOLS "Build HIGH Level HDF5 GIF Tools" OFF - ----------------- HDF5 Folder Build Options --------------------- +---------------- HDF5 Build Options ---------------------------------------- +HDF5_BUILD_CPP_LIB "Build HDF5 C++ Library" OFF +HDF5_BUILD_EXAMPLES "Build HDF5 Library Examples" ON +HDF5_BUILD_FORTRAN "Build FORTRAN support" OFF +HDF5_BUILD_JAVA "Build JAVA support" OFF +HDF5_BUILD_HL_LIB "Build HIGH Level HDF5 Library" ON +HDF5_BUILD_TOOLS "Build HDF5 Tools" ON +HDF5_BUILD_HL_GIF_TOOLS "Build HIGH Level HDF5 GIF Tools" OFF +HDF5_BUILD_PARALLEL_TOOLS "Build Parallel HDF5 Tools" OFF +HDF5_BUILD_STATIC_TOOLS "Build Static Tools Not Shared Tools" OFF + +---------------- HDF5 Folder Build Options --------------------------------- Defaults relative to $ HDF5_INSTALL_BIN_DIR "bin" HDF5_INSTALL_LIB_DIR "lib" @@ -809,8 +820,8 @@ else () HDF5_INSTALL_DATA_DIR "share" HDF5_INSTALL_DOC_DIR "HDF5_INSTALL_DATA_DIR" -HDF5_USE_GNU_DIRS "TRUE to use GNU Coding Standard install directory variables, - FALSE to use historical settings" FALSE +HDF5_USE_GNU_DIRS "ON to use GNU Coding Standard install directory variables, + OFF to use historical settings" OFF Defaults as defined by the `GNU Coding Standards` HDF5_INSTALL_BIN_DIR "bin" HDF5_INSTALL_LIB_DIR "lib" @@ -839,6 +850,7 @@ HDF5_ENABLE_EMBEDDED_LIBINFO "embed library info into executables" HDF5_ENABLE_PREADWRITE "Use pread/pwrite in sec2/log/core VFDs in place of read/write (when available)" ON HDF5_ENABLE_TRACE "Enable API tracing capability" OFF HDF5_ENABLE_USING_MEMCHECKER "Indicate that a memory checker is used" OFF +HDF5_ENABLE_MAP_API "Build the map API" OFF HDF5_GENERATE_HEADERS "Rebuild Generated Files" ON HDF5_BUILD_GENERATORS "Build Test Generators" OFF @@ -872,7 +884,7 @@ HDF5_ENABLE_ANALYZER_TOOLS "enable the use of Clang tools" HDF5_ENABLE_SANITIZERS "execute the Clang sanitizer" OFF HDF5_ENABLE_FORMATTERS "format source files" OFF HDF5_BUILD_DOC "Build documentation" OFF -HDF5_ENABLE_DOXY_WARNINGS "Enable fail if doxygen parsing has warnings." ON +HDF5_ENABLE_DOXY_WARNINGS "Enable fail if doxygen parsing has warnings." OFF ---------------- HDF5 VFD Options --------------------- HDF5_ENABLE_DIRECT_VFD "Build the Direct I/O Virtual File Driver" OFF @@ -900,30 +912,30 @@ if (BUILD_TESTING) HDF5_TEST_FHEAP_VFD "Execute fheap test with different VFDs" ON TEST_SHELL_SCRIPTS "Enable shell script tests" ON HDF5_DISABLE_TESTS_REGEX "Regex pattern to set execution of specific tests to DISABLED" "" - + HDF5_USING_ANALYSIS_TOOL "Indicate that an analysis checker is used" ON ---------------- External Library Options --------------------- -HDF5_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building (NO GIT TGZ)" "NO" -HDF5_ENABLE_PLUGIN_SUPPORT "Enable PLUGIN Filters" OFF -HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" ON -HDF5_ENABLE_Z_LIB_SUPPORT "Enable Zlib Filters" ON +HDF5_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building (NO GIT TGZ)" "NO" +HDF5_ENABLE_PLUGIN_SUPPORT "Enable PLUGIN Filters" OFF +HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" OFF +HDF5_ENABLE_Z_LIB_SUPPORT "Enable Zlib Filters" ON -ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" OFF -ZLIB_TGZ_ORIGPATH "Use ZLIB from original location" "https://github.com/madler/zlib/releases/download/v1.2.13" -ZLIB_TGZ_NAME "Use ZLIB from original compressed file" "zlib-1.2.13.tar.gz" -ZLIB_USE_LOCALCONTENT "Use local file for ZLIB FetchContent" ON +ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" OFF +ZLIB_TGZ_ORIGPATH "Use ZLIB from original location" "https://github.com/madler/zlib/releases/download/v1.2.13" +ZLIB_TGZ_NAME "Use ZLIB from original compressed file" "zlib-1.2.13.tar.gz" +ZLIB_USE_LOCALCONTENT "Use local file for ZLIB FetchContent" ON -SZIP_USE_EXTERNAL "Use External Library Building for SZIP" OFF +SZIP_USE_EXTERNAL "Use External Library Building for SZIP" OFF if (HDF5_ENABLE_SZIP_SUPPORT) - HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" ON -LIBAEC_TGZ_ORIGPATH "Use LIBAEC from original location" "https://github.com/MathisRosenhauer/libaec/releases/download/v1.0.6/libaec-1.0.6.tar.gz" -LIBAEC_TGZ_NAME "Use LIBAEC from original compressed file" "libaec-v1.0.6.tar.gz" -LIBAEC_USE_LOCALCONTENT "Use local file for LIBAEC FetchContent" ON + HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" ON +LIBAEC_TGZ_ORIGPATH "Use LIBAEC from original location" "https://github.com/MathisRosenhauer/libaec/releases/download/v1.0.6" +LIBAEC_TGZ_NAME "Use LIBAEC from original compressed file" "libaec-1.0.6.tar.gz" +LIBAEC_USE_LOCALCONTENT "Use local file for LIBAEC FetchContent" ON -PLUGIN_USE_EXTERNAL "Use External Library Building for PLUGINS" OFF +PLUGIN_USE_EXTERNAL "Use External Library Building for PLUGINS" OFF if (WINDOWS) - H5_DEFAULT_PLUGINDIR "%ALLUSERSPROFILE%/hdf5/lib/plugin" + H5_DEFAULT_PLUGINDIR "%ALLUSERSPROFILE%/hdf5/lib/plugin" else () - H5_DEFAULT_PLUGINDIR "/usr/local/hdf5/lib/plugin" + H5_DEFAULT_PLUGINDIR "/usr/local/hdf5/lib/plugin" endif () NOTE: @@ -956,13 +968,10 @@ VII. User Defined Options for HDF5 Libraries with CMake ======================================================================== Support for User Defined macros and options has been added. The file -UserMacros.cmake has an example of the technique. In the folder, -config/cmake/UserMacros, is an implementation for Windows Visual Studio -users for linking libraries to the static CRT - Windows_MT.cmake. +UserMacros.cmake has an example of the technique. -Copy the contents of the file, both macro and option, into the -UserMacros.cmake file. Then enable the option to the CMake configuration, -build and test process. +Replace the template code with your macro in the UserMacros.cmake file. +Then enable the option to the CMake configuration, build and test process. ======================================================================== @@ -1150,6 +1159,14 @@ For instance, to change the support files to use a local directory, edit CMakeUs Then you can change or add options for your specific case. +======================================================================== +XI. Autotools Configuration and Build +======================================================================== +See RELEASE.txt in the release_notes/ directory for the list of platforms +tested for this release. + +Instructions for building and testing HDF5 using autotools can be found in the +INSTALL_Auto.txt file found in this folder. ======================================================================== diff --git a/release_docs/INSTALL_parallel b/release_docs/INSTALL_parallel index d3d7830a9de..8dabf897324 100644 --- a/release_docs/INSTALL_parallel +++ b/release_docs/INSTALL_parallel @@ -358,11 +358,9 @@ main(int ac, char **av) PROGRAM MPIOEXAMPLE - ! USE MPI + USE mpi IMPLICIT NONE - - INCLUDE 'mpif.h' CHARACTER(LEN=80), PARAMETER :: filename = "filef.h5" ! File name INTEGER :: ierror ! Error flag diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 031e91934e5..e80f5ba5edd 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -47,6 +47,48 @@ New Features Configuration: ------------- + - New option for building with static CRT in Windows + + The following option has been added: + HDF5_BUILD_STATIC_CRT_LIBS "Build With Static Windows CRT Libraries" OFF + Because our minimum CMake is 3.18, the macro to change runtime flags no longer + works as CMake changed the default behavior in CMake 3.15. + + Fixes GitHub issue #3984 + + - Added support for the new MSVC preprocessor + + Microsoft added support for a new, standards-conformant preprocessor + to MSVC, which can be enabled with the /Zc:preprocessor option. This + preprocessor would trip over our HDopen() variadic function-like + macro, which uses a feature that only works with the legacy preprocessor. + + ifdefs have been added that select the correct HDopen() form and + allow building HDF5 with the /Zc:preprocessor option. + + The HDopen() macro is located in an internal header file and only + affects building the HDF5 library from source. + + Fixes GitHub #2515 + + - Renamed HDF5_ENABLE_USING_MEMCHECKER to HDF5_USING_ANALYSIS_TOOL + + The HDF5_USING_ANALYSIS_TOOL is used to indicate to test macros that + an analysis tool is being used and that the tests should not use + the runTest.cmake macros and it's variations. The analysis tools, + like valgrind, test the macro code instead of the program under test. + + HDF5_ENABLE_USING_MEMCHECKER is still used for controlling the HDF5 + define, H5_USING_MEMCHECKER. + + - New option for building and naming tools in CMake + + The following option has been added: + HDF5_BUILD_STATIC_TOOLS "Build Static Tools Not Shared Tools" OFF + + The default will build shared tools unless BUILD_SHARED_LIBS = OFF. + Tools will no longer have "-shared" as only one set of tools will be created. + - Incorporated HDF5 examples repository into HDF5 library. The HDF5Examples folder is equivalent to the repository hdf5-examples. @@ -388,6 +430,17 @@ New Features Fortran Library: ---------------- + - Added Fortran H5E APIs: + h5eregister_class_f, h5eunregister_class_f, h5ecreate_msg_f, h5eclose_msg_f + h5eget_msg_f, h5epush_f, h5eget_num_f, h5ewalk_f, h5eget_class_name_f, + h5eappend_stack_f, h5eget_current_stack_f, h5eset_current_stack_f, h5ecreate_stack_f, + h5eclose_stack_f, h5epop_f, h5eprint_f (C h5eprint v2 signature) + + - Added API support for Fortran MPI_F08 module definitions: + Adds support for MPI's MPI_F08 module datatypes: type(MPI_COMM) and type(MPI_INFO) for HDF5 APIs: + H5PSET_FAPL_MPIO_F, H5PGET_FAPL_MPIO_F, H5PSET_MPI_PARAMS_F, H5PGET_MPI_PARAMS_F + Ref. #3951 + - Added Fortran APIs: H5FGET_INTENT_F, H5SSEL_ITER_CREATE_F, H5SSEL_ITER_GET_SEQ_LIST_F, H5SSEL_ITER_CLOSE_F, H5S_mp_H5SSEL_ITER_RESET_F @@ -476,6 +529,91 @@ Bug Fixes since HDF5-1.14.0 release =================================== Library ------- + - Fixed asserts raised by large values of H5Pset_est_link_info() parameters + + If large values for est_num_entries and/or est_name_len were passed + to H5Pset_est_link_info(), the library would attempt to create an + object header NIL message to reserve enough space to hold the links in + compact form (i.e., concatenated), which could exceed allowable object + header message size limits and trip asserts in the library. + + This bug only occurred when using the HDF5 1.8 file format or later and + required the product of the two values to be ~64k more than the size + of any links written to the group, which would cause the library to + write out a too-large NIL spacer message to reserve the space for the + unwritten links. + + The library now inspects the phase change values to see if the dataset + is likely to be compact and checks the size to ensure any NIL spacer + messages won't be larger than the library allows. + + Fixes GitHub #1632 + + - Fixed a bug where H5Tset_fields does not account for any offset + set for a floating-point datatype when determining if values set + for spos, epos, esize, mpos and msize make sense for the datatype + + Previously, H5Tset_fields did not take datatype offsets into account + when determining if the values set make sense for the datatype. + This would cause the function to fail when the precision for a + datatype is correctly set such that the offset bits are not included. + This has now been fixed. + + - Fixed H5Fget_access_plist so that it returns the file locking + settings for a file + + When H5Fget_access_plist (and the internal H5F_get_access_plist) + is called on a file, the returned File Access Property List has + the library's default file locking settings rather than any + settings set for the file. This causes two problems: + + - Opening an HDF5 file through an external link using H5Gopen, + H5Dopen, etc. with H5P_DEFAULT for the Dataset/Group/etc. + Access Property List will cause the external file to be opened + with the library's default file locking settings rather than + inheriting them from the parent file. This can be surprising + when a file is opened with file locking disabled, but its + external files are opened with file locking enabled. + + - An application cannot make use of the H5Pset_elink_fapl + function to match file locking settings between an external + file and its parent file without knowing the correct setting + ahead of time, as calling H5Fget_access_plist on the parent + file will not return the correct settings. + + This has been fixed by copying a file's file locking settings + into the newly-created File Access Property List in H5F_get_access_plist. + + This fix partially addresses GitHub issue #4011 + + - Memory usage growth issue + + Starting with the HDF5 1.12.1 release, an issue (GitHub issue #1256) + was observed where running a simple program that has a loop of opening + a file, reading from an object with a variable-length datatype and + then closing the file would result in the process fairly quickly + running out of memory. Upon further investigation, it was determined + that this memory was being kept around in the library's datatype + conversion pathway cache that is used to speed up datatype conversions + which are repeatedly used within an HDF5 application's lifecycle. For + conversions involving variable-length or reference datatypes, each of + these cached pathway entries keeps a reference to its associated file + for later use. Since the file was being closed and reopened on each + loop iteration, and since the library compares for equality between + instances of opened files (rather than equality of the actual files) + when determining if it can reuse a cached conversion pathway, it was + determining that no cached conversion pathways could be reused and was + creating a new cache entry on each loop iteration during I/O. This + would lead to constant growth of that cache and the memory it consumed, + as well as constant growth of the memory consumed by each cached entry + for the reference to its associated file. + + To fix this issue, the library now removes any cached datatype + conversion path entries for variable-length or reference datatypes + associated with a particular file when that file is closed. + + Fixes GitHub #1256 + - Suppressed floating-point exceptions in H5T init code The floating-point datatype initialization code in H5Tinit_float.c @@ -903,6 +1041,15 @@ Bug Fixes since HDF5-1.14.0 release Configuration ------------- + - Changed default of 'Error on HDF5 doxygen warnings' DOXYGEN_WARN_AS_ERROR option. + + The default setting of DOXYGEN_WARN_AS_ERROR to 'FAIL_ON_WARNINGS' has been changed + to 'NO'. It was decided that the setting was too aggressive and should be a user choice. + The github actions and scripts have been updated to reflect this. + + * HDF5_ENABLE_DOXY_WARNINGS: ON/OFF (Default: OFF) + * --enable-doxygen-errors: enable/disable (Default: disable) + - Removed an Autotools configure hack that causes problems on MacOS A sed line in configure.ac was added in the past to paper over some @@ -1071,12 +1218,25 @@ Bug Fixes since HDF5-1.14.0 release Fortran API ----------- - - + - Fixed: HDF5 fails to compile with -Werror=lto-type-mismatch + + Removed the use of the offending C stub wrapper. + + Fixes GitHub issue #3987 High-Level Library ------------------ - - + - Fixed a memory leak in H5LTopen_file_image with H5LT_FILE_IMAGE_DONT_COPY flag + + When the H5LT_FILE_IMAGE_DONT_COPY flag is passed to H5LTopen_file_image, the + internally-allocated udata structure gets leaked as the core file driver doesn't + have a way to determine when or if it needs to call the "udata_free" callback. + This has been fixed by freeing the udata structure when the "image_free" callback + gets made during file close, where the file is holding the last reference to the + udata structure. + + Fixes GitHub issue #827 Fortran High-Level APIs @@ -1148,6 +1308,12 @@ Bug Fixes since HDF5-1.14.0 release Platforms Tested =================== + - HDF5 supports the latest macOS versions, including the current and two + preceding releases. As new major macOS versions become available, HDF5 + will discontinue support for the oldest version and add the latest + version to its list of compatible systems, along with the previous two + releases. + Linux 5.16.14-200.fc35 GNU gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9) #1 SMP x86_64 GNU/Linux GNU Fortran (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9) Fedora35 clang version 13.0.0 (Fedora 13.0.0-3.fc35) @@ -1252,7 +1418,7 @@ Platforms Tested Windows 10 x64 Visual Studio 2019 w/ clang 12.0.0 with MSVC-like command-line (C/C++ only - cmake) - Visual Studio 2019 w/ Intel C/C++ only cmake) + Visual Studio 2019 w/ Intel (C/C++ only - cmake) Visual Studio 2022 w/ clang 15.0.1 with MSVC-like command-line (C/C++ only - cmake) Visual Studio 2022 w/ Intel C/C++/Fortran oneAPI 2023 (cmake) @@ -1287,7 +1453,6 @@ Known Problems CMake files do not behave correctly with paths containing spaces. Do not use spaces in paths because the required escaping for handling spaces results in very complex and fragile build files. - ADB - 2019/05/07 At present, metadata cache images may not be generated by parallel applications. Parallel applications can read files with metadata cache @@ -1300,6 +1465,10 @@ Known Problems The subsetting option in ph5diff currently will fail and should be avoided. The subsetting option works correctly in serial h5diff. + Flang Fortran compilation will fail (last check version 17) due to not yet + implemented: (1) derived type argument passed by value (H5VLff.F90), + and (2) support for REAL with KIND = 2 in intrinsic SPACING used in testing. + Several tests currently fail on certain platforms: MPI_TEST-t_bigio fails with spectrum-mpi on ppc64le platforms. diff --git a/release_docs/USING_CMake_Examples.txt b/release_docs/USING_CMake_Examples.txt index 6598876beda..f31a922804d 100644 --- a/release_docs/USING_CMake_Examples.txt +++ b/release_docs/USING_CMake_Examples.txt @@ -67,7 +67,7 @@ Default installation process: 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/release_docs/USING_HDF5_CMake.txt b/release_docs/USING_HDF5_CMake.txt index 27c421b831b..0e35a089353 100644 --- a/release_docs/USING_HDF5_CMake.txt +++ b/release_docs/USING_HDF5_CMake.txt @@ -39,7 +39,7 @@ I. Preconditions 1. We suggest you obtain the latest CMake for your platform from the Kitware web site. The HDF5 1.15.x product requires a minimum CMake version - of 3.18. If you are using VS2022, the minimum version is 3.21. + of 3.18. If you are using VS2022, the minimum CMake version is 3.21. 2. You have installed the HDF5 library built with CMake, by executing the HDF Install Utility (the *.msi file in the binary package for @@ -93,9 +93,6 @@ Go through these steps to build HDF5 applications with CMake. 4. Test HDF5 Applications These steps are described in more detail below. - - - 1. Run CMake The visual CMake executable is named "cmake-gui.exe" on Windows and should be @@ -119,8 +116,6 @@ These steps are described in more detail below. * MinGW Makefiles * NMake Makefiles * Unix Makefiles - * Visual Studio 14 2015 - * Visual Studio 14 2015 Win64 * Visual Studio 15 2017 * Visual Studio 15 2017 Win64 * Visual Studio 16 2019 @@ -138,7 +133,7 @@ These steps are described in more detail below. 2.1 Visual CMake users, click the Configure button. If this is the first time you are running cmake-gui in this directory, you will be prompted for the - generator you wish to use (for example on Windows, Visual Studio 14 2015 Win64). + generator you wish to use (for example on Windows, Visual Studio 16 2019). CMake will read in the CMakeLists.txt files from the source directory and display options for the HDF5 project. After the first configure you can adjust the cache settings and/or specify locations of other programs. @@ -156,7 +151,7 @@ These steps are described in more detail below. 2.2 Alternative command line example on Windows in c:\MyHDFstuff\hdf5\build directory: - cmake -G "Visual Studio 14 2015 Win64" -DBUILD_TESTING:BOOL=ON .. + cmake -G "Visual Studio 16 2019" -A "x64" -DBUILD_TESTING:BOOL=ON .. 3. Build HDF5 Applications @@ -205,7 +200,7 @@ source root. Include the following text in the file: ########################################################## cmake_minimum_required (VERSION 3.18) -project (HDF5MyApp C CXX) +project (HDF5MyApp C) set (LIB_TYPE STATIC) # or SHARED string(TOLOWER ${LIB_TYPE} SEARCH_TYPE) @@ -239,11 +234,10 @@ command line and the build folder is created as a sub-folder. Windows should adjust the forward slash to double backslashes, except for the HDF_DIR environment variable. -NOTE: this file is available at the HDF web site: - https://portal.hdfgroup.org/display/support/Building+HDF5+with+CMake +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 - HDF5_Examples.cmake - HDF5_Examples_options.cmake + ctest -S HDF5_Examples.cmake -C Release -V -O test.log Also available at the HDF web site is a CMake application framework template. You can quickly add files to the framework and execute the script to compile diff --git a/release_docs/USING_HDF5_VS.txt b/release_docs/USING_HDF5_VS.txt index 39c66ea940d..6d69a143bd4 100644 --- a/release_docs/USING_HDF5_VS.txt +++ b/release_docs/USING_HDF5_VS.txt @@ -12,7 +12,7 @@ be found in the USING_HDF5_CMake.txt file found in this folder. NOTE: Building applications with the dynamic/shared hdf5 libraries requires that the "H5_BUILT_AS_DYNAMIC_LIB" compile definition be used. Go to "Project" and select "Properties", find "Configuration Properties", - and then "C/C+±"and then "Preprocessor". + and then "C/C++"and then "Preprocessor". Add H5_BUILT_AS_DYNAMIC_LIB to Preprocessor definitions. The following two sections are helpful if you do not use CMake to build @@ -44,7 +44,9 @@ Using Visual Studio 2010 and above with HDF5 Libraries built with Visual Studio hdf5.lib hdf5_cpp.lib For static linking: - libszaec.lib libaec.lib libzlib.lib libhdf5.lib libhdf5_cpp.lib + HDF5 libraries: libhdf5.lib libhdf5_cpp.lib + Compression libraries: libszaec.lib libaec.lib libzlib.lib + System libraries: shlwapi.lib ========================================================================== @@ -76,7 +78,12 @@ Using Visual Studio 2008 with HDF5 Libraries built with Visual Studio 2008 library, and then optionally the HDF5 High Level, Fortran or C++ libraries. For example, to compile a C++ application, enter: - szip.lib zlib.lib hdf5.lib hdf5_cpp.lib + hdf5.lib hdf5_cpp.lib + + For static linking: + HDF5 libraries: libhdf5.lib libhdf5_cpp.lib + Compression libraries: libszaec.lib libaec.lib libzlib.lib + System libraries: shlwapi.lib ======================================================================== 3. Helpful Pointers @@ -84,10 +91,9 @@ Using Visual Studio 2008 with HDF5 Libraries built with Visual Studio 2008 3.1 FAQ - Many other common questions and hints are located online and being updated - in the HDF Knowledge Base, please see: + Community support forum available, please see: - https://portal.hdfgroup.org/display/knowledge/HDF+Knowledge+Base + https://forum.hdfgroup.org/c/hdf5/8 ************************************************************************ Please send email to help@hdfgroup.org for further assistance. diff --git a/src/H5.c b/src/H5.c index a59c013eac6..8bce0b054fe 100644 --- a/src/H5.c +++ b/src/H5.c @@ -654,7 +654,7 @@ H5get_free_list_sizes(size_t *reg_size /*out*/, size_t *arr_size /*out*/, size_t herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "xxxx", reg_size, arr_size, blk_size, fac_size); + H5TRACE4("e", "*z*z*z*z", reg_size, arr_size, blk_size, fac_size); /* Call the free list function to actually get the sizes */ if (H5FL_get_free_list_sizes(reg_size, arr_size, blk_size, fac_size) < 0) @@ -814,7 +814,7 @@ H5get_libversion(unsigned *majnum /*out*/, unsigned *minnum /*out*/, unsigned *r herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE3("e", "xxx", majnum, minnum, relnum); + H5TRACE3("e", "*Iu*Iu*Iu", majnum, minnum, relnum); /* Set the version information */ if (majnum) @@ -1216,7 +1216,7 @@ H5is_library_threadsafe(bool *is_ts /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE1("e", "x", is_ts); + H5TRACE1("e", "*b", is_ts); if (is_ts) { #ifdef H5_HAVE_THREADSAFE @@ -1251,7 +1251,7 @@ H5is_library_terminating(bool *is_terminating /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE1("e", "x", is_terminating); + H5TRACE1("e", "*b", is_terminating); assert(is_terminating); diff --git a/src/H5A.c b/src/H5A.c index c183c85eec3..a3bcf011520 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -1036,7 +1036,7 @@ H5Aread(hid_t attr_id, hid_t dtype_id, void *buf /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "iix", attr_id, dtype_id, buf); + H5TRACE3("e", "ii*x", attr_id, dtype_id, buf); /* Synchronously read the data */ if (H5A__read_api_common(attr_id, dtype_id, buf, NULL, NULL) < 0) @@ -1064,7 +1064,7 @@ H5Aread_async(const char *app_file, const char *app_func, unsigned app_line, hid herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE7("e", "*s*sIuiixi", app_file, app_func, app_line, attr_id, dtype_id, buf, es_id); + H5TRACE7("e", "*s*sIuii*xi", app_file, app_func, app_line, attr_id, dtype_id, buf, es_id); /* Set up request token pointer for asynchronous operation */ if (H5ES_NONE != es_id) @@ -1078,7 +1078,7 @@ H5Aread_async(const char *app_file, const char *app_func, unsigned app_line, hid if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE7(__func__, "*s*sIuiixi", app_file, app_func, app_line, attr_id, dtype_id, buf, es_id)) < 0) + H5ARG_TRACE7(__func__, "*s*sIuii*xi", app_file, app_func, app_line, attr_id, dtype_id, buf, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set"); @@ -1257,7 +1257,7 @@ H5Aget_name(hid_t attr_id, size_t buf_size, char *buf /*out*/) ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) - H5TRACE3("Zs", "izx", attr_id, buf_size, buf); + H5TRACE3("Zs", "iz*s", attr_id, buf_size, buf); /* check arguments */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) @@ -1308,7 +1308,7 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_i ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE8("Zs", "i*sIiIohxzi", loc_id, obj_name, idx_type, order, n, name, size, lapl_id); + H5TRACE8("Zs", "i*sIiIoh*szi", loc_id, obj_name, idx_type, order, n, name, size, lapl_id); /* Check args */ if (H5I_ATTR == H5I_get_type(loc_id)) @@ -1416,7 +1416,7 @@ H5Aget_info(hid_t attr_id, H5A_info_t *ainfo /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", attr_id, ainfo); + H5TRACE2("e", "i*Ai", attr_id, ainfo); /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) @@ -1458,7 +1458,7 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE5("e", "i*s*sxi", loc_id, obj_name, attr_name, ainfo, lapl_id); + H5TRACE5("e", "i*s*s*Aii", loc_id, obj_name, attr_name, ainfo, lapl_id); /* Check args */ if (H5I_ATTR == H5I_get_type(loc_id)) @@ -1515,7 +1515,7 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_i herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE7("e", "i*sIiIohxi", loc_id, obj_name, idx_type, order, n, ainfo, lapl_id); + H5TRACE7("e", "i*sIiIoh*Aii", loc_id, obj_name, idx_type, order, n, ainfo, lapl_id); /* Check args */ if (H5I_ATTR == H5I_get_type(loc_id)) diff --git a/src/H5AC.c b/src/H5AC.c index 802ccddecd8..b752803ed55 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -459,7 +459,7 @@ H5AC_dest(H5F_t *f) */ if (H5F_ACC_RDWR & H5F_INTENT(f)) { /* enable and load the skip list */ - if (H5C_set_slist_enabled(f->shared->cache, true, false) < 0) + if (H5C_set_slist_enabled(f->shared->cache, true, true) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't enable skip list"); if (H5AC__flush_entries(f) < 0) @@ -1127,7 +1127,7 @@ H5AC_prep_for_file_flush(H5F_t *f) assert(f->shared); assert(f->shared->cache); - if (H5C_set_slist_enabled(f->shared->cache, true, false) < 0) + if (H5C_set_slist_enabled(f->shared->cache, true, true) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't enable skip list"); done: diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 5e23036784b..51f1b358a60 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -312,14 +312,12 @@ typedef struct H5AC_proxy_entry_t { */ #define H5AC__NO_FLAGS_SET H5C__NO_FLAGS_SET -#define H5AC__SET_FLUSH_MARKER_FLAG H5C__SET_FLUSH_MARKER_FLAG #define H5AC__DELETED_FLAG H5C__DELETED_FLAG #define H5AC__DIRTIED_FLAG H5C__DIRTIED_FLAG #define H5AC__PIN_ENTRY_FLAG H5C__PIN_ENTRY_FLAG #define H5AC__UNPIN_ENTRY_FLAG H5C__UNPIN_ENTRY_FLAG #define H5AC__FLUSH_INVALIDATE_FLAG H5C__FLUSH_INVALIDATE_FLAG #define H5AC__FLUSH_CLEAR_ONLY_FLAG H5C__FLUSH_CLEAR_ONLY_FLAG -#define H5AC__FLUSH_MARKED_ENTRIES_FLAG H5C__FLUSH_MARKED_ENTRIES_FLAG #define H5AC__FLUSH_IGNORE_PROTECTED_FLAG H5C__FLUSH_IGNORE_PROTECTED_FLAG #define H5AC__READ_ONLY_FLAG H5C__READ_ONLY_FLAG #define H5AC__FREE_FILE_SPACE_FLAG H5C__FREE_FILE_SPACE_FLAG diff --git a/src/H5Aint.c b/src/H5Aint.c index 853270c8356..170edc10551 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -2456,6 +2456,10 @@ H5A__dense_post_copy_file_cb(const H5A_t *attr_src, void *_udata) assert(udata->file); assert(udata->cpy_info); + /* Set the location of the src datatype */ + if (H5T_set_loc(attr_src->shared->dt, H5F_VOL_OBJ(udata->oloc_src->file), H5T_LOC_DISK) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5_ITER_ERROR, "cannot mark datatype on disk"); + if (NULL == (attr_dst = H5A__attr_copy_file(attr_src, udata->file, udata->recompute_size, udata->cpy_info))) HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy attribute"); @@ -2465,7 +2469,7 @@ H5A__dense_post_copy_file_cb(const H5A_t *attr_src, void *_udata) /* Reset shared location information */ if (H5O_msg_reset_share(H5O_ATTR_ID, attr_dst) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to reset attribute sharing"); + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, H5_ITER_ERROR, "unable to reset attribute sharing"); /* Set COPIED tag for destination object's metadata */ H5_BEGIN_TAG(H5AC__COPIED_TAG) @@ -2479,7 +2483,7 @@ H5A__dense_post_copy_file_cb(const H5A_t *attr_src, void *_udata) done: if (attr_dst && H5A__close(attr_dst) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close destination attribute"); + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5_ITER_ERROR, "can't close destination attribute"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__dense_post_copy_file_cb() */ diff --git a/src/H5C.c b/src/H5C.c index eb6e49ec502..1713e83ef90 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -493,7 +493,7 @@ H5C_dest(H5F_t *f) #endif /* H5AC_DUMP_IMAGE_STATS_ON_CLOSE */ /* Enable the slist, as it is needed in the flush */ - if (H5C_set_slist_enabled(f->shared->cache, true, false) < 0) + if (H5C_set_slist_enabled(f->shared->cache, true, true) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist enabled failed"); /* Flush and invalidate all cache entries */ @@ -567,7 +567,7 @@ H5C_evict(H5F_t *f) assert(f); /* Enable the slist, as it is needed in the flush */ - if (H5C_set_slist_enabled(f->shared->cache, true, false) < 0) + if (H5C_set_slist_enabled(f->shared->cache, true, true) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist enabled failed"); /* Flush and invalidate all cache entries except the pinned entries */ @@ -575,7 +575,7 @@ H5C_evict(H5F_t *f) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict entries in the cache"); /* Disable the slist */ - if (H5C_set_slist_enabled(f->shared->cache, false, true) < 0) + if (H5C_set_slist_enabled(f->shared->cache, false, false) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist disabled failed"); done: @@ -1042,41 +1042,32 @@ H5C_set_evictions_enabled(H5C_t *cache_ptr, bool evictions_enabled) * * 1) Verifies that the slist is empty. * - * 2) Scans the index list, and inserts all dirty entries - * into the slist. + * 2) If the populate_slist parameter is true, scans the + * index list, and inserts all dirty entries into the + * slist. * * 3) Sets cache_ptr->slist_enabled = true. * - * Note that the clear_slist parameter is ignored if - * the slist_enabed parameter is true. - * * * If the slist_enabled_parameter is false, the function - * shuts down the slist. - * - * Normally the slist will be empty at this point, however - * that need not be the case if H5C_flush_cache() has been - * called with the H5C__FLUSH_MARKED_ENTRIES_FLAG. - * - * Thus shutdown proceeds as follows: + * shuts down the slist: * * 1) Test to see if the slist is empty. If it is, proceed * to step 3. * - * 2) Test to see if the clear_slist parameter is true. - * - * If it is, remove all entries from the slist. - * - * If it isn't, throw an error. + * 2) Remove all entries from the slist. * * 3) set cache_ptr->slist_enabled = false. * + * Note that the populate_slist parameter is ignored if + * the slist_enabed parameter is false. + * * Return: SUCCEED on success, and FAIL on failure. * *------------------------------------------------------------------------- */ herr_t -H5C_set_slist_enabled(H5C_t *cache_ptr, bool slist_enabled, bool clear_slist) +H5C_set_slist_enabled(H5C_t *cache_ptr, bool slist_enabled, bool populate_slist) { H5C_cache_entry_t *entry_ptr; herr_t ret_value = SUCCEED; /* Return value */ @@ -1097,40 +1088,30 @@ H5C_set_slist_enabled(H5C_t *cache_ptr, bool slist_enabled, bool clear_slist) */ cache_ptr->slist_enabled = true; - /* scan the index list and insert all dirty entries in the slist */ - entry_ptr = cache_ptr->il_head; - while (entry_ptr != NULL) { - if (entry_ptr->is_dirty) - H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL); - entry_ptr = entry_ptr->il_next; - } + if (populate_slist) { + /* scan the index list and insert all dirty entries in the slist */ + entry_ptr = cache_ptr->il_head; + while (entry_ptr != NULL) { + if (entry_ptr->is_dirty) + H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL); + entry_ptr = entry_ptr->il_next; + } - /* we don't maintain a dirty index len, so we can't do a cross - * check against it. Note that there is no point in cross checking - * against the dirty LRU size, as the dirty LRU may not be maintained, - * and in any case, there is no requirement that all dirty entries - * will reside on the dirty LRU. - */ - assert(cache_ptr->dirty_index_size == cache_ptr->slist_size); + /* we don't maintain a dirty index len, so we can't do a cross + * check against it. Note that there is no point in cross checking + * against the dirty LRU size, as the dirty LRU may not be maintained, + * and in any case, there is no requirement that all dirty entries + * will reside on the dirty LRU. + */ + assert(cache_ptr->dirty_index_size == cache_ptr->slist_size); + } } else { /* take down the skip list */ if (!cache_ptr->slist_enabled) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "slist already disabled?"); - if ((cache_ptr->slist_len != 0) || (cache_ptr->slist_size != 0)) { - if (clear_slist) { - H5SL_node_t *node_ptr; - - node_ptr = H5SL_first(cache_ptr->slist_ptr); - while (node_ptr != NULL) { - entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, false, FAIL); - node_ptr = H5SL_first(cache_ptr->slist_ptr); - } - } - else - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "slist not empty?"); - } + if ((cache_ptr->slist_len != 0) || (cache_ptr->slist_size != 0)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "slist not empty?"); cache_ptr->slist_enabled = false; diff --git a/src/H5Centry.c b/src/H5Centry.c index 2bbf9acdbb5..fec1f4ae755 100644 --- a/src/H5Centry.c +++ b/src/H5Centry.c @@ -503,36 +503,24 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags) if (cache_ptr->slist_enabled) { if (entry_ptr->in_slist) { assert(entry_ptr->is_dirty); - if (entry_ptr->flush_marker && !entry_ptr->is_dirty) + if (!entry_ptr->is_dirty) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry in slist failed sanity checks"); } /* end if */ - else { - assert(!entry_ptr->is_dirty); - assert(!entry_ptr->flush_marker); - if (entry_ptr->is_dirty || entry_ptr->flush_marker) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry failed sanity checks"); - } /* end else */ } - else { /* slist is disabled */ + else /* slist is disabled */ assert(!entry_ptr->in_slist); - if (!entry_ptr->is_dirty) - if (entry_ptr->flush_marker) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "flush marked clean entry?"); - } #endif /* H5C_DO_SANITY_CHECKS */ if (entry_ptr->is_protected) /* Attempt to flush a protected entry -- scream and die. */ HGOTO_ERROR(H5E_CACHE, H5E_PROTECT, FAIL, "Attempt to flush a protected entry"); - /* Set entry_ptr->flush_in_progress = true and set - * entry_ptr->flush_marker = false + /* Set entry_ptr->flush_in_progress = true * * We will set flush_in_progress back to false at the end if the * entry still exists at that point. */ entry_ptr->flush_in_progress = true; - entry_ptr->flush_marker = false; /* Preserve current dirty state for later */ was_dirty = entry_ptr->is_dirty; @@ -1240,7 +1228,6 @@ H5C__load_entry(H5F_t *f, entry->ro_ref_count = 0; entry->is_pinned = false; entry->in_slist = false; - entry->flush_marker = false; #ifdef H5_HAVE_PARALLEL entry->clear_on_unprotect = false; entry->flush_immediately = false; @@ -1897,7 +1884,6 @@ H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t ds_entry_ptr->ro_ref_count = 0; ds_entry_ptr->is_pinned = false; ds_entry_ptr->in_slist = false; - ds_entry_ptr->flush_marker = false; #ifdef H5_HAVE_PARALLEL ds_entry_ptr->clear_on_unprotect = false; ds_entry_ptr->flush_immediately = false; @@ -2095,7 +2081,6 @@ H5C_insert_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *thing, u #ifdef H5_HAVE_PARALLEL bool coll_access = false; /* whether access to the cache entry is done collectively */ #endif /* H5_HAVE_PARALLEL */ - bool set_flush_marker; bool write_permitted = true; size_t empty_space; H5C_cache_entry_t *entry_ptr = NULL; @@ -2125,9 +2110,8 @@ H5C_insert_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *thing, u HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry"); #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - set_flush_marker = ((flags & H5C__SET_FLUSH_MARKER_FLAG) != 0); - insert_pinned = ((flags & H5C__PIN_ENTRY_FLAG) != 0); - flush_last = ((flags & H5C__FLUSH_LAST_FLAG) != 0); + insert_pinned = ((flags & H5C__PIN_ENTRY_FLAG) != 0); + flush_last = ((flags & H5C__FLUSH_LAST_FLAG) != 0); /* Get the ring type from the API context */ ring = H5CX_get_ring(); @@ -2301,7 +2285,6 @@ H5C_insert_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *thing, u /* New entries are presumed to be dirty */ assert(entry_ptr->is_dirty); - entry_ptr->flush_marker = set_flush_marker; H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL); H5C__UPDATE_RP_FOR_INSERTION(cache_ptr, entry_ptr, FAIL); @@ -2497,9 +2480,6 @@ H5C_mark_entry_clean(void *_thing) /* Mark the entry as clean if it isn't already */ entry_ptr->is_dirty = false; - /* Also reset the 'flush_marker' flag, since the entry shouldn't be flushed now */ - entry_ptr->flush_marker = false; - /* Modify cache data structures */ if (was_dirty) H5C__UPDATE_INDEX_FOR_ENTRY_CLEAN(cache_ptr, entry_ptr, FAIL); @@ -3426,7 +3406,6 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags) H5C_t *cache_ptr; bool deleted; bool dirtied; - bool set_flush_marker; bool pin_entry; bool unpin_entry; bool free_file_space; @@ -3441,13 +3420,12 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags) FUNC_ENTER_NOAPI(FAIL) - deleted = ((flags & H5C__DELETED_FLAG) != 0); - dirtied = ((flags & H5C__DIRTIED_FLAG) != 0); - set_flush_marker = ((flags & H5C__SET_FLUSH_MARKER_FLAG) != 0); - pin_entry = ((flags & H5C__PIN_ENTRY_FLAG) != 0); - unpin_entry = ((flags & H5C__UNPIN_ENTRY_FLAG) != 0); - free_file_space = ((flags & H5C__FREE_FILE_SPACE_FLAG) != 0); - take_ownership = ((flags & H5C__TAKE_OWNERSHIP_FLAG) != 0); + deleted = ((flags & H5C__DELETED_FLAG) != 0); + dirtied = ((flags & H5C__DIRTIED_FLAG) != 0); + pin_entry = ((flags & H5C__PIN_ENTRY_FLAG) != 0); + unpin_entry = ((flags & H5C__UNPIN_ENTRY_FLAG) != 0); + free_file_space = ((flags & H5C__FREE_FILE_SPACE_FLAG) != 0); + take_ownership = ((flags & H5C__TAKE_OWNERSHIP_FLAG) != 0); assert(f); assert(f->shared); @@ -3621,15 +3599,10 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags) entry_ptr->is_protected = false; - /* if the entry is dirty, 'or' its flush_marker with the set flush flag, - * and then add it to the skip list if it isn't there already. - */ - if (entry_ptr->is_dirty) { - entry_ptr->flush_marker |= set_flush_marker; - if (!entry_ptr->in_slist) - /* this is a no-op if cache_ptr->slist_enabled is false */ - H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL); - } /* end if */ + /* if the entry is dirty, add it to the skip list if it isn't there already. */ + if (entry_ptr->is_dirty && !entry_ptr->in_slist) + /* this is a no-op if cache_ptr->slist_enabled is false */ + H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL); /* This implementation of the "deleted" option is a bit inefficient, as * we re-insert the entry to be deleted into the replacement policy @@ -4141,7 +4114,6 @@ H5C_remove_entry(void *_entry) /* Additional internal cache consistency checks */ assert(!entry->in_slist); - assert(!entry->flush_marker); assert(!entry->flush_in_progress); /* Note that the algorithm below is (very) similar to the set of operations diff --git a/src/H5Cint.c b/src/H5Cint.c index 31a947a8858..2e79a0da057 100644 --- a/src/H5Cint.c +++ b/src/H5Cint.c @@ -1207,10 +1207,10 @@ H5C__flush_invalidate_ring(H5F_t *f, H5C_ring_t ring, unsigned flags) old_ring_pel_len = cur_ring_pel_len; while (cache_ptr->index_ring_len[ring] > 0) { - /* first, try to flush-destroy any dirty entries. Do this by + /* First, try to flush-destroy any dirty entries. Do this by * making a scan through the slist. Note that new dirty entries - * may be created by the flush call backs. Thus it is possible - * that the slist will not be empty after we finish the scan. + * may be created by the flush call back, thus we may need to + * restart the scan (see below). */ #ifdef H5C_DO_SANITY_CHECKS @@ -1573,7 +1573,6 @@ H5C__flush_ring(H5F_t *f, H5C_ring_t ring, unsigned flags) { H5C_t *cache_ptr = f->shared->cache; bool flushed_entries_last_pass; - bool flush_marked_entries; bool ignore_protected; bool tried_to_flush_protected_entry = false; bool restart_slist_scan; @@ -1603,12 +1602,10 @@ H5C__flush_ring(H5F_t *f, H5C_ring_t ring, unsigned flags) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry"); #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - ignore_protected = ((flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0); - flush_marked_entries = ((flags & H5C__FLUSH_MARKED_ENTRIES_FLAG) != 0); + ignore_protected = ((flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0); - if (!flush_marked_entries) - for (i = (int)H5C_RING_UNDEFINED; i < (int)ring; i++) - assert(cache_ptr->slist_ring_len[i] == 0); + for (i = (int)H5C_RING_UNDEFINED; i < (int)ring; i++) + assert(cache_ptr->slist_ring_len[i] == 0); assert(cache_ptr->flush_in_progress); @@ -1712,9 +1709,7 @@ H5C__flush_ring(H5F_t *f, H5C_ring_t ring, unsigned flags) */ assert(entry_ptr->in_slist); assert(entry_ptr->is_dirty); - - if (!flush_marked_entries || entry_ptr->flush_marker) - assert(entry_ptr->ring >= ring); + assert(entry_ptr->ring >= ring); /* Advance node pointer now, before we delete its target * from the slist. @@ -1727,19 +1722,14 @@ H5C__flush_ring(H5F_t *f, H5C_ring_t ring, unsigned flags) assert(next_entry_ptr->is_dirty); assert(next_entry_ptr->in_slist); - - if (!flush_marked_entries || next_entry_ptr->flush_marker) - assert(next_entry_ptr->ring >= ring); - + assert(next_entry_ptr->ring >= ring); assert(entry_ptr != next_entry_ptr); } /* end if */ else next_entry_ptr = NULL; - if ((!flush_marked_entries || entry_ptr->flush_marker) && - ((!entry_ptr->flush_me_last) || - ((entry_ptr->flush_me_last) && ((cache_ptr->num_last_entries >= cache_ptr->slist_len) || - (flush_marked_entries && entry_ptr->flush_marker)))) && + if (((!entry_ptr->flush_me_last) || + ((entry_ptr->flush_me_last) && cache_ptr->num_last_entries >= cache_ptr->slist_len)) && ((entry_ptr->flush_dep_nchildren == 0) || (entry_ptr->flush_dep_ndirty_children == 0)) && (entry_ptr->ring == ring)) { @@ -1790,10 +1780,8 @@ H5C__flush_ring(H5F_t *f, H5C_ring_t ring, unsigned flags) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "cache has protected items"); #ifdef H5C_DO_SANITY_CHECKS - if (!flush_marked_entries) { - assert(cache_ptr->slist_ring_len[ring] == 0); - assert(cache_ptr->slist_ring_size[ring] == 0); - } /* end if */ + assert(cache_ptr->slist_ring_len[ring] == 0); + assert(cache_ptr->slist_ring_size[ring] == 0); #endif /* H5C_DO_SANITY_CHECKS */ done: diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 5417684a53a..4408774d5f0 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -2168,15 +2168,14 @@ typedef struct H5C_tag_info_t { * insert all dirtly entries in the skip list, and enable operations * on skip list by setting above control flag to true. * + * In the case of a partial flush (i.e. flush tagged entries), we only + * add tagged entries to the skip list, thus avoiding unnecessary scans + * over the entire cache. + * * At the end of a complete flush, we verify that the skip list is empty, * and set the control flag back to false, so as to avoid skip list * maintenance overhead until the next flush or close. * - * In the case of a partial flush (i.e. flush marked entries), we remove - * all remaining entries from the skip list, and then set the control flag - * back to false -- again avoiding skip list maintenance overhead until - * the next flush or close. - * * slist_enabled: Boolean flag used to control operation of the skip * list. If this filed is false, operations on the slist are * no-ops, and the slist must be empty. If it is true, diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 3477e75d7e5..9f123123bc6 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -134,7 +134,6 @@ * * * These flags apply to H5C_insert_entry(): - * H5C__SET_FLUSH_MARKER_FLAG * H5C__PIN_ENTRY_FLAG * H5C__FLUSH_LAST_FLAG ; super block only * H5C__FLUSH_COLLECTIVELY_FLAG ; super block only @@ -145,7 +144,6 @@ * H5C__FLUSH_COLLECTIVELY_FLAG ; super block only * * These flags apply to H5C_unprotect(): - * H5C__SET_FLUSH_MARKER_FLAG * H5C__DELETED_FLAG * H5C__DIRTIED_FLAG * H5C__PIN_ENTRY_FLAG @@ -162,7 +160,6 @@ * These flags apply to H5C_flush_cache(): * H5C__FLUSH_INVALIDATE_FLAG * H5C__FLUSH_CLEAR_ONLY_FLAG - * H5C__FLUSH_MARKED_ENTRIES_FLAG * H5C__FLUSH_IGNORE_PROTECTED_FLAG (can't use this flag in combination * with H5C__FLUSH_INVALIDATE_FLAG) * H5C__DURING_FLUSH_FLAG @@ -170,32 +167,29 @@ * These flags apply to H5C_flush_single_entry(): * H5C__FLUSH_INVALIDATE_FLAG * H5C__FLUSH_CLEAR_ONLY_FLAG - * H5C__FLUSH_MARKED_ENTRIES_FLAG * H5C__TAKE_OWNERSHIP_FLAG * H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG * H5C__GENERATE_IMAGE_FLAG * H5C__UPDATE_PAGE_BUFFER_FLAG */ #define H5C__NO_FLAGS_SET 0x00000 -#define H5C__SET_FLUSH_MARKER_FLAG 0x00001 -#define H5C__DELETED_FLAG 0x00002 -#define H5C__DIRTIED_FLAG 0x00004 -#define H5C__PIN_ENTRY_FLAG 0x00008 -#define H5C__UNPIN_ENTRY_FLAG 0x00010 -#define H5C__FLUSH_INVALIDATE_FLAG 0x00020 -#define H5C__FLUSH_CLEAR_ONLY_FLAG 0x00040 -#define H5C__FLUSH_MARKED_ENTRIES_FLAG 0x00080 -#define H5C__FLUSH_IGNORE_PROTECTED_FLAG 0x00100 -#define H5C__READ_ONLY_FLAG 0x00200 -#define H5C__FREE_FILE_SPACE_FLAG 0x00400 -#define H5C__TAKE_OWNERSHIP_FLAG 0x00800 -#define H5C__FLUSH_LAST_FLAG 0x01000 -#define H5C__FLUSH_COLLECTIVELY_FLAG 0x02000 -#define H5C__EVICT_ALLOW_LAST_PINS_FLAG 0x04000 -#define H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG 0x08000 -#define H5C__DURING_FLUSH_FLAG 0x10000 /* Set when the entire cache is being flushed */ -#define H5C__GENERATE_IMAGE_FLAG 0x20000 /* Set during parallel I/O */ -#define H5C__UPDATE_PAGE_BUFFER_FLAG 0x40000 /* Set during parallel I/O */ +#define H5C__DELETED_FLAG 0x00001 +#define H5C__DIRTIED_FLAG 0x00002 +#define H5C__PIN_ENTRY_FLAG 0x00004 +#define H5C__UNPIN_ENTRY_FLAG 0x00008 +#define H5C__FLUSH_INVALIDATE_FLAG 0x00010 +#define H5C__FLUSH_CLEAR_ONLY_FLAG 0x00020 +#define H5C__FLUSH_IGNORE_PROTECTED_FLAG 0x00040 +#define H5C__READ_ONLY_FLAG 0x00080 +#define H5C__FREE_FILE_SPACE_FLAG 0x00100 +#define H5C__TAKE_OWNERSHIP_FLAG 0x00200 +#define H5C__FLUSH_LAST_FLAG 0x00400 +#define H5C__FLUSH_COLLECTIVELY_FLAG 0x00800 +#define H5C__EVICT_ALLOW_LAST_PINS_FLAG 0x01000 +#define H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG 0x02000 +#define H5C__DURING_FLUSH_FLAG 0x04000 /* Set when the entire cache is being flushed */ +#define H5C__GENERATE_IMAGE_FLAG 0x08000 /* Set during parallel I/O */ +#define H5C__UPDATE_PAGE_BUFFER_FLAG 0x10000 /* Set during parallel I/O */ /* Debugging/sanity checking/statistics settings */ /* #define H5C_DO_SANITY_CHECKS */ @@ -1074,11 +1068,6 @@ typedef int H5C_ring_t; * As a general rule, entries are placed in the list when they are * marked dirty. * - * flush_marker: Boolean flag indicating that the entry is to be flushed - * the next time H5C_flush_cache() is called with the - * H5C__FLUSH_MARKED_ENTRIES_FLAG. The flag is reset when - * the entry is flushed for whatever reason. - * * flush_me_last: Boolean flag indicating that this entry should not be * flushed from the cache until all other entries without the * flush_me_last flag set have been flushed. @@ -1557,7 +1546,6 @@ typedef struct H5C_cache_entry_t { int ro_ref_count; bool is_pinned; bool in_slist; - bool flush_marker; bool flush_me_last; #ifdef H5_HAVE_PARALLEL bool clear_on_unprotect; @@ -2207,7 +2195,7 @@ H5_DLL herr_t H5C_resize_entry(void *thing, size_t new_size); H5_DLL herr_t H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_ptr); H5_DLL herr_t H5C_set_cache_image_config(const H5F_t *f, H5C_t *cache_ptr, H5C_cache_image_ctl_t *config_ptr); H5_DLL herr_t H5C_set_evictions_enabled(H5C_t *cache_ptr, bool evictions_enabled); -H5_DLL herr_t H5C_set_slist_enabled(H5C_t *cache_ptr, bool slist_enabled, bool clear_slist); +H5_DLL herr_t H5C_set_slist_enabled(H5C_t *cache_ptr, bool slist_enabled, bool populate_slist); H5_DLL herr_t H5C_set_prefix(H5C_t *cache_ptr, char *prefix); H5_DLL herr_t H5C_stats(H5C_t *cache_ptr, const char *cache_name, bool display_detailed_stats); H5_DLL void H5C_stats__reset(H5C_t *cache_ptr); diff --git a/src/H5Ctag.c b/src/H5Ctag.c index a1a9f428583..8da6c137fdc 100644 --- a/src/H5Ctag.c +++ b/src/H5Ctag.c @@ -80,8 +80,6 @@ typedef struct { /* Local Prototypes */ /********************/ static herr_t H5C__iter_tagged_entries_real(H5C_t *cache, haddr_t tag, H5C_tag_iter_cb_t cb, void *cb_ctx); -static herr_t H5C__mark_tagged_entries(H5C_t *cache, haddr_t tag); -static herr_t H5C__flush_marked_entries(H5F_t *f); /*********************/ /* Package Variables */ @@ -520,101 +518,6 @@ H5C_evict_tagged_entries(H5F_t *f, haddr_t tag, bool match_global) FUNC_LEAVE_NOAPI(ret_value) } /* H5C_evict_tagged_entries() */ -/*------------------------------------------------------------------------- - * Function: H5C__mark_tagged_entries_cb - * - * Purpose: Callback to set the flush marker on dirty entries in the cache - * - * Return: H5_ITER_CONT (can't fail) - * - *------------------------------------------------------------------------- - */ -static int -H5C__mark_tagged_entries_cb(H5C_cache_entry_t *entry, void H5_ATTR_UNUSED *_ctx) -{ - /* Function enter macro */ - FUNC_ENTER_PACKAGE_NOERR - - /* Sanity checks */ - assert(entry); - - /* We only want to set the flush marker on entries that - * actually need flushed (i.e., dirty ones) */ - if (entry->is_dirty) - entry->flush_marker = true; - - FUNC_LEAVE_NOAPI(H5_ITER_CONT) -} /* H5C__mark_tagged_entries_cb() */ - -/*------------------------------------------------------------------------- - * Function: H5C__mark_tagged_entries - * - * Purpose: Set the flush marker on dirty entries in the cache that have - * the specified tag, as well as all globally tagged entries. - * - * Return: FAIL if error is detected, SUCCEED otherwise. - * - *------------------------------------------------------------------------- - */ -static herr_t -H5C__mark_tagged_entries(H5C_t *cache, haddr_t tag) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - /* Function enter macro */ - FUNC_ENTER_PACKAGE - - /* Sanity check */ - assert(cache); - - /* Iterate through hash table entries, marking those with specified tag, as - * well as any major global entries which should always be flushed - * when flushing based on tag value */ - if (H5C__iter_tagged_entries(cache, tag, true, H5C__mark_tagged_entries_cb, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "Iteration of tagged entries failed"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C__mark_tagged_entries() */ - -/*------------------------------------------------------------------------- - * Function: H5C__flush_marked_entries - * - * Purpose: Flushes all marked entries in the cache. - * - * Return: FAIL if error is detected, SUCCEED otherwise. - * - *------------------------------------------------------------------------- - */ -static herr_t -H5C__flush_marked_entries(H5F_t *f) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_PACKAGE - - /* Assertions */ - assert(f != NULL); - - /* Enable the slist, as it is needed in the flush */ - if (H5C_set_slist_enabled(f->shared->cache, true, false) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist enabled failed"); - - /* Flush all marked entries */ - if (H5C_flush_cache(f, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_IGNORE_PROTECTED_FLAG) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush cache"); - - /* Disable the slist. Set the clear_slist parameter to true - * since we called H5C_flush_cache() with the - * H5C__FLUSH_MARKED_ENTRIES_FLAG. - */ - if (H5C_set_slist_enabled(f->shared->cache, false, true) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "disable slist failed"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C__flush_marked_entries */ - #ifdef H5C_DO_TAGGING_SANITY_CHECKS /*------------------------------------------------------------------------- @@ -684,6 +587,36 @@ H5C_verify_tag(int id, haddr_t tag) } /* H5C_verify_tag */ #endif +/*------------------------------------------------------------------------- + * Function: H5C__flush_tagged_entries_cb + * + * Purpose: Callback to set the flush marker on dirty entries in the cache + * + * Return: H5_ITER_CONT (can't fail) + * + *------------------------------------------------------------------------- + */ +static int +H5C__flush_tagged_entries_cb(H5C_cache_entry_t *entry, void *_ctx) +{ + H5C_t *cache_ptr = (H5C_t *)_ctx; + int ret_value = H5_ITER_CONT; + + /* Function enter macro */ + FUNC_ENTER_PACKAGE + + /* Sanity checks */ + assert(entry); + assert(cache_ptr); + + /* We only want to add entries to the slist that actually need flushed (i.e., dirty ones) */ + if (entry->is_dirty) + H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry, H5_ITER_ERROR); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__flush_tagged_entries_cb() */ + /*------------------------------------------------------------------------- * Function: H5C_flush_tagged_entries * @@ -709,13 +642,22 @@ H5C_flush_tagged_entries(H5F_t *f, haddr_t tag) /* Get cache pointer */ cache = f->shared->cache; - /* Mark all entries with specified tag */ - if (H5C__mark_tagged_entries(cache, tag) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't mark tagged entries"); + /* Enable the slist, as it is needed in the flush */ + if (H5C_set_slist_enabled(f->shared->cache, true, false) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist enabled failed"); + + /* Iterate through hash table entries, adding those with specified tag to the slist, as well as any major + * global entries which should always be flushed when flushing based on tag value */ + if (H5C__iter_tagged_entries(cache, tag, true, H5C__flush_tagged_entries_cb, cache) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "Iteration of tagged entries failed"); + + /* Flush all entries in the slist */ + if (H5C_flush_cache(f, H5C__FLUSH_IGNORE_PROTECTED_FLAG) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush cache"); - /* Flush all marked entries */ - if (H5C__flush_marked_entries(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush marked entries"); + /* Disable the slist */ + if (H5C_set_slist_enabled(f->shared->cache, false, false) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "disable slist failed"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5D.c b/src/H5D.c index c1f662b4bbf..79b945a8e3f 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -679,7 +679,7 @@ H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", dset_id, allocation); + H5TRACE2("e", "i*Ds", dset_id, allocation); /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) @@ -1053,7 +1053,7 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_i herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE6("e", "iiiiix", dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf); + H5TRACE6("e", "iiiii*x", dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf); /* Read the data */ if (H5D__read_api_common(1, &dset_id, &mem_type_id, &mem_space_id, &file_space_id, dxpl_id, &buf, NULL, @@ -1083,7 +1083,7 @@ H5Dread_async(const char *app_file, const char *app_func, unsigned app_line, hid herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE10("e", "*s*sIuiiiiixi", app_file, app_func, app_line, dset_id, mem_type_id, mem_space_id, + H5TRACE10("e", "*s*sIuiiiii*xi", app_file, app_func, app_line, dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, es_id); /* Set up request token pointer for asynchronous operation */ @@ -1099,7 +1099,7 @@ H5Dread_async(const char *app_file, const char *app_func, unsigned app_line, hid if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE10(__func__, "*s*sIuiiiiixi", app_file, app_func, app_line, dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, es_id)) < 0) + H5ARG_TRACE10(__func__, "*s*sIuiiiii*xi", app_file, app_func, app_line, dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "can't insert token into event set"); @@ -1124,7 +1124,7 @@ H5Dread_multi(size_t count, hid_t dset_id[], hid_t mem_type_id[], hid_t mem_spac herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE7("e", "z*i*i*i*iix", count, dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf); + H5TRACE7("e", "z*i*i*i*ii**x", count, dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf); if (count == 0) HGOTO_DONE(SUCCEED); @@ -1159,7 +1159,7 @@ H5Dread_multi_async(const char *app_file, const char *app_func, unsigned app_lin herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE11("e", "*s*sIuz*i*i*i*iixi", app_file, app_func, app_line, count, dset_id, mem_type_id, + H5TRACE11("e", "*s*sIuz*i*i*i*ii**xi", app_file, app_func, app_line, count, dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, es_id); /* Set up request token pointer for asynchronous operation */ @@ -1175,7 +1175,7 @@ H5Dread_multi_async(const char *app_file, const char *app_func, unsigned app_lin if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE11(__func__, "*s*sIuz*i*i*i*iixi", app_file, app_func, app_line, count, dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, es_id)) < 0) + H5ARG_TRACE11(__func__, "*s*sIuz*i*i*i*ii**xi", app_file, app_func, app_line, count, dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "can't insert token into event set"); @@ -1201,7 +1201,7 @@ H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *fil herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE5("e", "ii*h*Iux", dset_id, dxpl_id, offset, filters, buf); + H5TRACE5("e", "ii*h*Iu*x", dset_id, dxpl_id, offset, filters, buf); /* Check arguments */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) @@ -1581,7 +1581,7 @@ H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id, hid_t dst_space_ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE5("e", "DS*xiix", op, op_data, type_id, dst_space_id, dst_buf); + H5TRACE5("e", "DS*xii*x", op, op_data, type_id, dst_space_id, dst_buf); /* Check args */ if (op == NULL) @@ -1674,7 +1674,7 @@ H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id, size_t dst_buf herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE7("e", "i*xizxDg*x", src_space_id, src_buf, type_id, dst_buf_size, dst_buf, op, op_data); + H5TRACE7("e", "i*xiz*xDg*x", src_space_id, src_buf, type_id, dst_buf_size, dst_buf, op, op_data); /* Check args */ if (NULL == (src_space = (H5S_t *)H5I_object_verify(src_space_id, H5I_DATASPACE))) @@ -1906,7 +1906,7 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *s herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "iiix", dataset_id, type_id, space_id, size); + H5TRACE4("e", "iii*h", dataset_id, type_id, space_id, size); /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(dataset_id))) @@ -2201,7 +2201,7 @@ H5Dget_chunk_index_type(hid_t dset_id, H5D_chunk_index_t *idx_type /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", dset_id, idx_type); + H5TRACE2("e", "i*Dk", dset_id, idx_type); /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) @@ -2243,7 +2243,7 @@ H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_n herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "i*hx", dset_id, offset, chunk_nbytes); + H5TRACE3("e", "i*h*h", dset_id, offset, chunk_nbytes); /* Check arguments */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) @@ -2294,7 +2294,7 @@ H5Dget_num_chunks(hid_t dset_id, hid_t fspace_id, hsize_t *nchunks /*out*/) herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE3("e", "iix", dset_id, fspace_id, nchunks); + H5TRACE3("e", "ii*h", dset_id, fspace_id, nchunks); /* Check arguments */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) @@ -2346,7 +2346,7 @@ H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_index, hsize_t *of herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE7("e", "iihxxxx", dset_id, fspace_id, chk_index, offset, filter_mask, addr, size); + H5TRACE7("e", "iih*h*Iu*a*h", dset_id, fspace_id, chk_index, offset, filter_mask, addr, size); /* Check arguments */ if (NULL == offset && NULL == filter_mask && NULL == addr && NULL == size) @@ -2415,7 +2415,7 @@ H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, unsigned *filte herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE5("e", "i*hxxx", dset_id, offset, filter_mask, addr, size); + H5TRACE5("e", "i*h*Iu*a*h", dset_id, offset, filter_mask, addr, size); /* Check arguments */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) diff --git a/src/H5Dmodule.h b/src/H5Dmodule.h index 84d00e89d02..81f197d7147 100644 --- a/src/H5Dmodule.h +++ b/src/H5Dmodule.h @@ -179,10 +179,15 @@ *
Supported file drivers
* * \anchor dcpl_table_tag Dataset creation property list functions (H5P) + *
* \snippet{doc} tables/propertyLists.dox dcpl_table + *
* * \anchor dapl_table_tag Dataset access property list functions (H5P) + * + *
* \snippet{doc} tables/propertyLists.dox dapl_table + *
* * \subsection subsec_dataset_program Programming Model for Datasets * This section explains the programming model for datasets. @@ -863,7 +868,9 @@ * the pipeline processing: the pipeline and filter operations are identical no matter what data access * mechanism is used. * + *
* \snippet{doc} tables/propertyLists.dox lcpl_table + *
* * Each file driver writes/reads contiguous blocks of bytes from a logically contiguous address * space. The file driver is responsible for managing the details of the different physical storage @@ -880,7 +887,9 @@ * Data transfer properties set optional parameters that control parts of the data pipeline. The * function listing below shows transfer properties that control the behavior of the library. * + *
* \snippet{doc} tables/fileDriverLists.dox file_driver_table + *
* * Some filters and file drivers require or use additional parameters from the application program. * These can be passed in the data transfer property list. The table below shows file driver property diff --git a/src/H5E.c b/src/H5E.c index 30fb376e575..6593975ca45 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -534,7 +534,7 @@ H5Eget_class_name(hid_t class_id, char *name /*out*/, size_t size) ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) - H5TRACE3("Zs", "ixz", class_id, name, size); + H5TRACE3("Zs", "i*sz", class_id, name, size); /* Get the error class */ if (NULL == (cls = (H5E_cls_t *)H5I_object_verify(class_id, H5I_ERROR_CLASS))) @@ -774,7 +774,7 @@ H5Eget_msg(hid_t msg_id, H5E_type_t *type /*out*/, char *msg_str /*out*/, size_t ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API_NOCLEAR((-1)) - H5TRACE4("Zs", "ixxz", msg_id, type, msg_str, size); + H5TRACE4("Zs", "i*Et*sz", msg_id, type, msg_str, size); /* Get the message object */ if (NULL == (msg = (H5E_msg_t *)H5I_object_verify(msg_id, H5I_ERROR_MSG))) @@ -1446,7 +1446,7 @@ H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func /*out*/, void **client_data /*ou /* Don't clear the error stack! :-) */ FUNC_ENTER_API_NOCLEAR(FAIL) - H5TRACE3("e", "ixx", estack_id, func, client_data); + H5TRACE3("e", "i*EA**x", estack_id, func, client_data); if (estack_id == H5E_DEFAULT) { if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in diff --git a/src/H5ES.c b/src/H5ES.c index 038b7199ccd..24452f9a3d4 100644 --- a/src/H5ES.c +++ b/src/H5ES.c @@ -161,7 +161,7 @@ H5ESget_count(hid_t es_id, size_t *count /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", es_id, count); + H5TRACE2("e", "i*z", es_id, count); /* Passing H5ES_NONE is valid, but a no-op */ if (H5ES_NONE != es_id) { @@ -202,7 +202,7 @@ H5ESget_op_counter(hid_t es_id, uint64_t *op_counter /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", es_id, op_counter); + H5TRACE2("e", "i*UL", es_id, op_counter); /* Passing H5ES_NONE is valid, but a no-op */ if (H5ES_NONE != es_id) { @@ -252,7 +252,7 @@ H5ESget_requests(hid_t es_id, H5_iter_order_t order, hid_t *connector_ids, void herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE6("e", "iIo*i**xzx", es_id, order, connector_ids, requests, array_len, count); + H5TRACE6("e", "iIo*i**xz*z", es_id, order, connector_ids, requests, array_len, count); /* Check arguments */ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET))) @@ -304,7 +304,7 @@ H5ESwait(hid_t es_id, uint64_t timeout, size_t *num_in_progress /*out*/, hbool_t herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "iULxx", es_id, timeout, num_in_progress, op_failed); + H5TRACE4("e", "iUL*z*b", es_id, timeout, num_in_progress, op_failed); /* Passing H5ES_NONE is valid, but a no-op */ if (H5ES_NONE != es_id) { @@ -344,7 +344,7 @@ H5EScancel(hid_t es_id, size_t *num_not_canceled /*out*/, hbool_t *op_failed /*o herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ixx", es_id, num_not_canceled, op_failed); + H5TRACE3("e", "i*z*b", es_id, num_not_canceled, op_failed); /* Passing H5ES_NONE is valid, but a no-op */ if (H5ES_NONE != es_id) { @@ -384,7 +384,7 @@ H5ESget_err_status(hid_t es_id, hbool_t *err_status /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", es_id, err_status); + H5TRACE2("e", "i*b", es_id, err_status); /* Passing H5ES_NONE is valid, but a no-op */ if (H5ES_NONE != es_id) { @@ -423,7 +423,7 @@ H5ESget_err_count(hid_t es_id, size_t *num_errs /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", es_id, num_errs); + H5TRACE2("e", "i*z", es_id, num_errs); /* Passing H5ES_NONE is valid, but a no-op */ if (H5ES_NONE != es_id) { @@ -467,7 +467,7 @@ H5ESget_err_info(hid_t es_id, size_t num_err_info, H5ES_err_info_t err_info[] /* herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "izxx", es_id, num_err_info, err_info, num_cleared); + H5TRACE4("e", "iz*#*z", es_id, num_err_info, err_info, num_cleared); /* Passing H5ES_NONE is valid, but a no-op */ if (H5ES_NONE != es_id) { diff --git a/src/H5Edeprec.c b/src/H5Edeprec.c index d4a2ee98a42..c5e8a8d88fa 100644 --- a/src/H5Edeprec.c +++ b/src/H5Edeprec.c @@ -317,7 +317,7 @@ H5Eget_auto1(H5E_auto1_t *func /*out*/, void **client_data /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "xx", func, client_data); + H5TRACE2("e", "*Ea**x", func, client_data); /* Retrieve default error stack */ if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in diff --git a/src/H5Epublic.h b/src/H5Epublic.h index a22c9c6efd9..0d5993e84d4 100644 --- a/src/H5Epublic.h +++ b/src/H5Epublic.h @@ -250,12 +250,12 @@ H5_DLL herr_t H5Eclose_msg(hid_t err_id); * -------------------------------------------------------------------------- * \ingroup H5E * - * \brief Adds a major error message to an error class + * \brief Adds a major or minor error message to an error class * * \param[in] cls An error class identifier * \param[in] msg_type The type of the error message - * \param[in] msg Major error message - * \return \herr_t + * \param[in] msg Error message + * \return An error ID (success), H5I_INVALID_HID (failure) * * \details H5Ecreate_msg() adds an error message to an error class defined by * client library or application program. The error message can be @@ -625,7 +625,7 @@ H5_DLL herr_t H5Eauto_is_v2(hid_t err_stack, unsigned *is_stack); * \brief Retrieves an error message * * \param[in] msg_id Error message identifier - * \param[out] type The type of the error message Valid values are #H5E_MAJOR + * \param[out] type The type of the error message. Valid values are #H5E_MAJOR * and #H5E_MINOR. * \param[out] msg Error message buffer * \param[in] size The length of error message to be returned by this function @@ -651,7 +651,8 @@ H5_DLL ssize_t H5Eget_msg(hid_t msg_id, H5E_type_t *type, char *msg, size_t size * \brief Retrieves the number of error messages in an error stack * * \estack_id{error_stack_id} - * \return Returns a non-negative value on success; otherwise returns a negative value. + * \return Returns number of error messages in an error stack on + * success; otherwise returns a negative value. * * \details H5Eget_num() retrieves the number of error records in the error * stack specified by \p error_stack_id (including major, minor @@ -916,7 +917,7 @@ H5_DLL herr_t H5Ewalk1(H5E_direction_t direction, H5E_walk1_t func, void *client * error number * * \param[in] maj Major error number - * \return \herr_t + * \return Pointer to the message (success), or NULL (failure) * * \deprecated 1.8.0 Function deprecated in this release. * @@ -939,7 +940,7 @@ H5_DLL char *H5Eget_major(H5E_major_t maj); * error number * * \param[in] min Minor error number - * \return \herr_t + * \return Pointer to the message (success), or NULL (failure) * * \deprecated 1.8.0 Function deprecated and return type changed in this release. * diff --git a/src/H5F.c b/src/H5F.c index d814503ddf7..ee4fd71af64 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -344,7 +344,7 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list / ssize_t ret_value = 0; /* Return value */ FUNC_ENTER_API((-1)) - H5TRACE4("Zs", "iIuzx", file_id, types, max_objs, oid_list); + H5TRACE4("Zs", "iIuz*i", file_id, types, max_objs, oid_list); /* Check arguments */ if (0 == (types & H5F_OBJ_ALL)) @@ -437,7 +437,7 @@ H5Fget_vfd_handle(hid_t file_id, hid_t fapl_id, void **file_handle /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "iix", file_id, fapl_id, file_handle); + H5TRACE3("e", "ii**x", file_id, fapl_id, file_handle); /* Check args */ if (!file_handle) @@ -1567,7 +1567,7 @@ H5Fget_intent(hid_t file_id, unsigned *intent_flags /*out*/) herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", file_id, intent_flags); + H5TRACE2("e", "i*Iu", file_id, intent_flags); /* If no intent flags were passed in, exit quietly */ if (intent_flags) { @@ -1607,7 +1607,7 @@ H5Fget_fileno(hid_t file_id, unsigned long *fnumber /*out*/) herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", file_id, fnumber); + H5TRACE2("e", "i*Ul", file_id, fnumber); /* If no fnumber pointer was passed in, exit quietly */ if (fnumber) { @@ -1692,7 +1692,7 @@ H5Fget_filesize(hid_t file_id, hsize_t *size /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", file_id, size); + H5TRACE2("e", "i*h", file_id, size); /* Check args */ if (!size) @@ -1760,7 +1760,7 @@ H5Fget_file_image(hid_t file_id, void *buf /*out*/, size_t buf_len) ssize_t ret_value; /* Return value */ FUNC_ENTER_API((-1)) - H5TRACE3("Zs", "ixz", file_id, buf, buf_len); + H5TRACE3("Zs", "i*xz", file_id, buf, buf_len); /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) @@ -1807,7 +1807,7 @@ H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", file_id, config); + H5TRACE2("e", "i*Cc", file_id, config); /* Check args */ if ((NULL == config) || (config->version != H5AC__CURR_CACHE_CONFIG_VERSION)) @@ -1890,7 +1890,7 @@ H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", file_id, hit_rate); + H5TRACE2("e", "i*d", file_id, hit_rate); /* Check args */ if (NULL == hit_rate) @@ -1935,7 +1935,7 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size /*out*/, size_t *min_clean_size herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE5("e", "ixxxx", file_id, max_size, min_clean_size, cur_size, cur_num_entries); + H5TRACE5("e", "i*z*z*z*Is", file_id, max_size, min_clean_size, cur_size, cur_num_entries); /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) @@ -2032,7 +2032,7 @@ H5Fget_name(hid_t obj_id, char *name /*out*/, size_t size) ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) - H5TRACE3("Zs", "ixz", obj_id, name, size); + H5TRACE3("Zs", "i*sz", obj_id, name, size); /* Check the type */ type = H5I_get_type(obj_id); @@ -2085,7 +2085,7 @@ H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", obj_id, finfo); + H5TRACE2("e", "i*FI", obj_id, finfo); /* Check args */ if (!finfo) @@ -2134,7 +2134,7 @@ H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", file_id, info); + H5TRACE2("e", "i*!", file_id, info); /* Check args */ if (!info) @@ -2179,7 +2179,7 @@ H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, H5F_sect_info ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) - H5TRACE4("Zs", "iFmzx", file_id, type, nsects, sect_info); + H5TRACE4("Zs", "iFmz*!", file_id, type, nsects, sect_info); /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) @@ -2400,7 +2400,7 @@ H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled /*out*/, hbool_t *i herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ixx", file_id, is_enabled, is_currently_logging); + H5TRACE3("e", "i*b*b", file_id, is_enabled, is_currently_logging); /* Sanity check */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) @@ -2561,7 +2561,7 @@ H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2] /*out*/, unsigne herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE6("e", "ixxxxx", file_id, accesses, hits, misses, evictions, bypasses); + H5TRACE6("e", "i*Iu*Iu*Iu*Iu*Iu", file_id, accesses, hits, misses, evictions, bypasses); /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) @@ -2608,7 +2608,7 @@ H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr /*out*/, hsize_t *image herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ixx", file_id, image_addr, image_len); + H5TRACE3("e", "i*a*h", file_id, image_addr, image_len); /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) @@ -2646,7 +2646,7 @@ H5Fget_eoa(hid_t file_id, haddr_t *eoa /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", file_id, eoa); + H5TRACE2("e", "i*a", file_id, eoa); /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) @@ -2727,7 +2727,7 @@ H5Fget_dset_no_attrs_hint(hid_t file_id, hbool_t *minimize /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", file_id, minimize); + H5TRACE2("e", "i*b", file_id, minimize); /* Check args */ if (NULL == minimize) diff --git a/src/H5FAcache.c b/src/H5FAcache.c index 6d9e22e6af7..5aa06f6039a 100644 --- a/src/H5FAcache.c +++ b/src/H5FAcache.c @@ -505,7 +505,7 @@ H5FA__cache_hdr_free_icr(void *thing) /* Check arguments */ assert(thing); - /* Release the extensible array header */ + /* Release the fixed array header */ if (H5FA__hdr_dest((H5FA_hdr_t *)thing) < 0) HGOTO_ERROR(H5E_FARRAY, H5E_CANTFREE, FAIL, "can't free fixed array header"); diff --git a/src/H5FAhdr.c b/src/H5FAhdr.c index cfe5001d03f..ef3d689fce2 100644 --- a/src/H5FAhdr.c +++ b/src/H5FAhdr.c @@ -202,7 +202,7 @@ H5FA__hdr_create(H5F_t *f, const H5FA_create_t *cparam, void *ctx_udata) if (HADDR_UNDEF == (hdr->addr = H5MF_alloc(f, H5FD_MEM_FARRAY_HDR, (hsize_t)hdr->size))) HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, HADDR_UNDEF, "file allocation failed for Fixed Array header"); - /* Create 'top' proxy for extensible array entries */ + /* Create 'top' proxy for fixed array entries */ if (hdr->swmr_write) if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create())) HGOTO_ERROR(H5E_FARRAY, H5E_CANTCREATE, HADDR_UNDEF, "can't create fixed array entry proxy"); diff --git a/src/H5FD.c b/src/H5FD.c index ae4b43946d8..f89fdd93b81 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -974,7 +974,7 @@ H5FDquery(const H5FD_t *file, unsigned long *flags /*out*/) int ret_value = 0; FUNC_ENTER_API((-1)) - H5TRACE2("Is", "*#x", file, flags); + H5TRACE2("Is", "*#*Ul", file, flags); /* Check arguments */ if (!file) @@ -1406,7 +1406,7 @@ H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*#Mtiazx", file, type, dxpl_id, addr, size, buf); + H5TRACE6("e", "*#Mtiaz*x", file, type, dxpl_id, addr, size, buf); /* Check arguments */ if (!file) @@ -1508,7 +1508,7 @@ H5FDread_vector(H5FD_t *file, hid_t dxpl_id, uint32_t count, H5FD_mem_t types[], herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE7("e", "*#iIu*Mt*a*zx", file, dxpl_id, count, types, addrs, sizes, bufs); + H5TRACE7("e", "*#iIu*Mt*a*z**x", file, dxpl_id, count, types, addrs, sizes, bufs); /* Check arguments */ if (!file) @@ -1677,7 +1677,7 @@ H5FDread_selection(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uint32_t count, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE9("e", "*#MtiIu*i*i*a*zx", file, type, dxpl_id, count, mem_space_ids, file_space_ids, offsets, + H5TRACE9("e", "*#MtiIu*i*i*a*z**x", file, type, dxpl_id, count, mem_space_ids, file_space_ids, offsets, element_sizes, bufs); /* Check arguments */ @@ -1878,7 +1878,7 @@ H5FDread_vector_from_selection(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uin herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE9("e", "*#MtiIu*i*i*a*zx", file, type, dxpl_id, count, mem_space_ids, file_space_ids, offsets, + H5TRACE9("e", "*#MtiIu*i*i*a*z**x", file, type, dxpl_id, count, mem_space_ids, file_space_ids, offsets, element_sizes, bufs); /* Check arguments */ @@ -2617,7 +2617,7 @@ H5FDget_vfd_handle(H5FD_t *file, hid_t fapl_id, void **file_handle /*out*/) herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE3("e", "*#ix", file, fapl_id, file_handle); + H5TRACE3("e", "*#i**x", file, fapl_id, file_handle); /* Check arguments */ if (!file) @@ -2761,7 +2761,7 @@ H5FDdriver_query(hid_t driver_id, unsigned long *flags /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", driver_id, flags); + H5TRACE2("e", "i*Ul", driver_id, flags); /* Check arguments */ if (NULL == flags) diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 1aa8d4bf19c..37674202839 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -565,7 +565,7 @@ H5Pget_core_write_tracking(hid_t plist_id, hbool_t *is_enabled /*out*/, size_t * herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ixx", plist_id, is_enabled, page_size); + H5TRACE3("e", "i*b*z", plist_id, is_enabled, page_size); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) @@ -642,7 +642,7 @@ H5Pget_fapl_core(hid_t fapl_id, size_t *increment /*out*/, hbool_t *backing_stor herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ixx", fapl_id, increment, backing_store); + H5TRACE3("e", "i*z*b", fapl_id, increment, backing_store); if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index d370cd0b552..08c4a839799 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -298,7 +298,7 @@ H5Pget_fapl_direct(hid_t fapl_id, size_t *boundary /*out*/, size_t *block_size / herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "ixxx", fapl_id, boundary, block_size, cbuf_size); + H5TRACE4("e", "i*z*z*z", fapl_id, boundary, block_size, cbuf_size); if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list"); diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 3f43ae9cc5b..9173e5ba6c9 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -234,27 +234,28 @@ H5FD__family_get_default_printf_filename(const char *old_filename) HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "can't allocate new filename buffer"); /* Determine if filename contains a ".h5" extension. */ - if ((file_extension = strstr(old_filename, ".h5"))) { + file_extension = strstr(old_filename, ".h5"); + if (file_extension) { /* Insert the printf format between the filename and ".h5" extension. */ - strcpy(tmp_buffer, old_filename); - file_extension = strstr(tmp_buffer, ".h5"); - sprintf(file_extension, "%s%s", suffix, ".h5"); + intptr_t beginningLength = file_extension - old_filename; + snprintf(tmp_buffer, new_filename_len, "%.*s%s%s", (int)beginningLength, old_filename, suffix, ".h5"); } - else if ((file_extension = strrchr(old_filename, '.'))) { - char *new_extension_loc = NULL; - + else { /* If the filename doesn't contain a ".h5" extension, but contains * AN extension, just insert the printf format before that extension. */ - strcpy(tmp_buffer, old_filename); - new_extension_loc = strrchr(tmp_buffer, '.'); - sprintf(new_extension_loc, "%s%s", suffix, file_extension); - } - else { - /* If the filename doesn't contain an extension at all, just insert - * the printf format at the end of the filename. - */ - snprintf(tmp_buffer, new_filename_len, "%s%s", old_filename, suffix); + file_extension = strrchr(old_filename, '.'); + if (file_extension) { + intptr_t beginningLength = file_extension - old_filename; + snprintf(tmp_buffer, new_filename_len, "%.*s%s%s", (int)beginningLength, old_filename, suffix, + file_extension); + } + else { + /* If the filename doesn't contain an extension at all, just insert + * the printf format at the end of the filename. + */ + snprintf(tmp_buffer, new_filename_len, "%s%s", old_filename, suffix); + } } ret_value = tmp_buffer; @@ -382,7 +383,7 @@ H5Pget_fapl_family(hid_t fapl_id, hsize_t *msize /*out*/, hid_t *memb_fapl_id /* herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ixx", fapl_id, msize, memb_fapl_id); + H5TRACE3("e", "i*h*i", fapl_id, msize, memb_fapl_id); if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list"); diff --git a/src/H5FDhdfs.c b/src/H5FDhdfs.c index 3bd2502e232..140e5df8f7e 100644 --- a/src/H5FDhdfs.c +++ b/src/H5FDhdfs.c @@ -600,7 +600,7 @@ H5Pget_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa_dst /*out*/) herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", fapl_id, fa_dst); + H5TRACE2("e", "i*#", fapl_id, fa_dst); #if HDFS_DEBUG fprintf(stdout, "called %s.\n", __func__); diff --git a/src/H5FDmirror.c b/src/H5FDmirror.c index 8ddffb09cc1..baf6ed5a7d5 100644 --- a/src/H5FDmirror.c +++ b/src/H5FDmirror.c @@ -1263,7 +1263,7 @@ H5Pget_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa_dst /*out*/) herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", fapl_id, fa_dst); + H5TRACE2("e", "i*#", fapl_id, fa_dst); LOG_OP_CALL(__func__); diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 8aae79e2899..9c8ccdd8de4 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -439,7 +439,7 @@ H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm /*out*/, MPI_Info *info /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ixx", fapl_id, comm, info); + H5TRACE3("e", "i*Mc*Mi", fapl_id, comm, info); /* Set comm and info in case we have problems */ if (comm) @@ -541,7 +541,7 @@ H5Pget_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t *xfer_mode /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", dxpl_id, xfer_mode); + H5TRACE2("e", "i*Dt", dxpl_id, xfer_mode); /* Check arguments */ if (NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) diff --git a/src/H5FDonion.c b/src/H5FDonion.c index a16338b1dc4..65b7fa51dd8 100644 --- a/src/H5FDonion.c +++ b/src/H5FDonion.c @@ -1667,7 +1667,7 @@ H5FDonion_get_revision_count(const char *filename, hid_t fapl_id, uint64_t *revi herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE3("e", "*six", filename, fapl_id, revision_count); + H5TRACE3("e", "*si*UL", filename, fapl_id, revision_count); /* Check args */ if (!filename || !strcmp(filename, "")) diff --git a/src/H5FDros3.c b/src/H5FDros3.c index c6aea0e327a..321a0a0d9bb 100644 --- a/src/H5FDros3.c +++ b/src/H5FDros3.c @@ -35,9 +35,12 @@ #ifdef H5_HAVE_ROS3_VFD -/* toggle function call prints: 1 turns on +/* toggle debugging; pick a level */ -#define ROS3_DEBUG 0 +#define ROS3_DEBUG_NONE 0 +#define ROS3_DEBUG_TRACE_API 1 +#define ROS3_DEBUG_TRACE_INTERNAL 2 +#define ROS3_DEBUG ROS3_DEBUG_NONE /* toggle stats collection and reporting */ @@ -315,18 +318,18 @@ H5FD_ros3_init(void) if (H5I_INVALID_HID == H5FD_ROS3_g) { HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register ros3"); } - } #if ROS3_STATS - /* pre-compute statsbin boundaries - */ - for (bin_i = 0; bin_i < ROS3_STATS_BIN_COUNT; bin_i++) { - unsigned long long value = 0; + /* pre-compute statsbin boundaries */ + /* do it only during initial registration */ + for (bin_i = 0; bin_i < ROS3_STATS_BIN_COUNT; bin_i++) { + unsigned long long value = 0; - ROS3_STATS_POW(bin_i, &value) - ros3_stats_boundaries[bin_i] = value; - } + ROS3_STATS_POW(bin_i, &value) + ros3_stats_boundaries[bin_i] = value; + } #endif + } ret_value = H5FD_ROS3_g; @@ -456,7 +459,7 @@ H5Pget_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t *fa_dst /*out*/) herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", fapl_id, fa_dst); + H5TRACE2("e", "i*#", fapl_id, fa_dst); #if ROS3_DEBUG fprintf(stdout, "H5Pget_fapl_ros3() called.\n"); @@ -605,7 +608,7 @@ H5Pget_fapl_ros3_token(hid_t fapl_id, size_t size, char *token_dst /*out*/) herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE3("e", "izx", fapl_id, size, token_dst); + H5TRACE3("e", "iz*s", fapl_id, size, token_dst); #if ROS3_DEBUG fprintf(stdout, "H5Pget_fapl_ros3_token() called.\n"); @@ -858,7 +861,7 @@ ros3_reset_stats(H5FD_ros3_t *file) FUNC_ENTER_PACKAGE -#if ROS3_DEBUG +#if ROS3_DEBUG >= ROS3_DEBUG_TRACE_INTERNAL printf("ros3_reset_stats() called\n"); #endif @@ -1169,8 +1172,7 @@ ros3_fprint_stats(FILE *stream, const H5FD_ros3_t *file) * PRINT OVERVIEW * ******************/ - fprintf(stream, "TOTAL READS: %llu (%llu meta, %llu raw)\n", count_raw + count_meta, count_meta, - count_raw); + fprintf(stream, "TOTAL READS: %lu (%lu meta, %lu raw)\n", count_raw + count_meta, count_meta, count_raw); fprintf(stream, "TOTAL BYTES: %llu (%llu meta, %llu raw)\n", bytes_raw + bytes_meta, bytes_meta, bytes_raw); @@ -1294,7 +1296,7 @@ ros3_fprint_stats(FILE *stream, const H5FD_ros3_t *file) re_dub /= 1024.0; assert(suffix_i < sizeof(suffixes)); - fprintf(stream, " %8.3f%c %7d %7d %8.3f%c %8.3f%c %8.3f%c %8.3f%c\n", re_dub, + fprintf(stream, " %8.3f%c %7llu %7llu %8.3f%c %8.3f%c %8.3f%c %8.3f%c\n", re_dub, suffixes[suffix_i], /* bin ceiling */ m->count, /* metadata reads */ r->count, /* raw data reads */ @@ -1342,17 +1344,17 @@ H5FD__ros3_close(H5FD_t H5_ATTR_UNUSED *_file) assert(file != NULL); assert(file->s3r_handle != NULL); - /* Close the underlying request handle - */ - if (FAIL == H5FD_s3comms_s3r_close(file->s3r_handle)) - HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close S3 request handle"); - #if ROS3_STATS /* TODO: mechanism to re-target stats printout */ if (ros3_fprint_stats(stdout, file) == FAIL) HGOTO_ERROR(H5E_INTERNAL, H5E_ERROR, FAIL, "problem while writing file statistics"); #endif /* ROS3_STATS */ + /* Close the underlying request handle + */ + if (FAIL == H5FD_s3comms_s3r_close(file->s3r_handle)) + HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close S3 request handle"); + /* Release the file info */ H5MM_xfree(file->cache); file = H5FL_FREE(H5FD_ros3_t, file); @@ -1381,7 +1383,7 @@ H5FD__ros3_close(H5FD_t H5_ATTR_UNUSED *_file) * + fapl secret_id * + fapl secret_key * - * tl;dr -> check URL, check crentials + * tl;dr -> check URL, check credentials * * Return: * @@ -1510,7 +1512,7 @@ H5FD__ros3_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags) { FUNC_ENTER_PACKAGE_NOERR -#if ROS3_DEBUG +#if ROS3_DEBUG >= ROS3_DEBUG_TRACE_INTERNAL fprintf(stdout, "H5FD__ros3_query() called.\n"); #endif @@ -1547,7 +1549,7 @@ H5FD__ros3_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) FUNC_ENTER_PACKAGE_NOERR -#if ROS3_DEBUG +#if ROS3_DEBUG >= ROS3_DEBUG_TRACE_INTERNAL fprintf(stdout, "H5FD__ros3_get_eoa() called.\n"); #endif @@ -1575,7 +1577,7 @@ H5FD__ros3_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) FUNC_ENTER_PACKAGE_NOERR -#if ROS3_DEBUG +#if ROS3_DEBUG >= ROS3_DEBUG_TRACE_INTERNAL fprintf(stdout, "H5FD__ros3_set_eoa() called.\n"); #endif @@ -1606,7 +1608,7 @@ H5FD__ros3_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) FUNC_ENTER_PACKAGE_NOERR -#if ROS3_DEBUG +#if ROS3_DEBUG >= ROS3_DEBUG_TRACE_INTERNAL fprintf(stdout, "H5FD__ros3_get_eof() called.\n"); #endif diff --git a/src/H5FDros3.h b/src/H5FDros3.h index 217af2d01b6..f7d59c83c89 100644 --- a/src/H5FDros3.h +++ b/src/H5FDros3.h @@ -100,7 +100,7 @@ * \def H5FD_ROS3_MAX_SECRET_TOK_LEN * Maximum string length for specifying the session/security token. */ -#define H5FD_ROS3_MAX_SECRET_TOK_LEN 1024 +#define H5FD_ROS3_MAX_SECRET_TOK_LEN 4096 /** *\struct H5FD_ros3_fapl_t diff --git a/src/H5FDs3comms.c b/src/H5FDs3comms.c index dae1149ae60..2b7b5419c61 100644 --- a/src/H5FDs3comms.c +++ b/src/H5FDs3comms.c @@ -47,9 +47,14 @@ #ifdef H5_HAVE_ROS3_VFD -/* toggle debugging (enable with 1) +/* toggle debugging: pick a level */ -#define S3COMMS_DEBUG 0 +#define S3COMMS_DEBUG_NONE 0 +#define S3COMMS_DEBUG_REQUESTS 1 +#define S3COMMS_DEBUG_TRACE_API 2 +#define S3COMMS_DEBUG_TRACE_INTERNAL 3 +#define S3COMMS_DEBUG_HEADERS 4 +#define S3COMMS_DEBUG 0 /* manipulate verbosity of CURL output * operates separately from S3COMMS_DEBUG @@ -213,7 +218,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) FUNC_ENTER_NOAPI_NOINIT -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS fprintf(stdout, "called H5FD_s3comms_hrb_node_set."); printf("NAME: %s\n", name); printf("VALUE: %s\n", value); @@ -292,7 +297,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) if (value == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove node from empty list"); else { -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS printf("CREATE NEW\n"); fflush(stdout); #endif @@ -323,7 +328,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) is_looking = false; if (value == NULL) { -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS printf("REMOVE HEAD\n"); fflush(stdout); #endif @@ -333,39 +338,39 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) *L = node_ptr->next; -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS printf("FREEING CAT (node)\n"); fflush(stdout); #endif H5MM_xfree(node_ptr->cat); -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS printf("FREEING LOWERNAME (node)\n"); fflush(stdout); #endif H5MM_xfree(node_ptr->lowername); -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS printf("FREEING NAME (node)\n"); fflush(stdout); #endif H5MM_xfree(node_ptr->name); -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS printf("FREEING VALUE (node)\n"); fflush(stdout); #endif H5MM_xfree(node_ptr->value); -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS printf("MAGIC OK? %s\n", (node_ptr->magic == S3COMMS_HRB_NODE_MAGIC) ? "YES" : "NO"); fflush(stdout); #endif assert(node_ptr->magic == S3COMMS_HRB_NODE_MAGIC); node_ptr->magic += 1ul; -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS printf("FREEING POINTER\n"); fflush(stdout); #endif H5MM_xfree(node_ptr); -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS printf("FREEING WORKING LOWERNAME\n"); fflush(stdout); #endif @@ -373,7 +378,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) lowername = NULL; } else { -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS printf("MODIFY HEAD\n"); fflush(stdout); #endif @@ -403,7 +408,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) if (value == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove a node 'before' head"); else { -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS printf("PREPEND NEW HEAD\n"); fflush(stdout); #endif @@ -432,7 +437,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) if (value == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove absent node"); else { -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS printf("APPEND A NODE\n"); fflush(stdout); #endif @@ -455,7 +460,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) if (value == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove absent node"); else { -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS printf("INSERT A NODE\n"); fflush(stdout); #endif @@ -484,7 +489,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) hrb_node_t *tmp = node_ptr->next; node_ptr->next = tmp->next; -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS printf("REMOVE A NODE\n"); fflush(stdout); #endif @@ -501,7 +506,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) lowername = NULL; } else { -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS printf("MODIFY A NODE\n"); fflush(stdout); #endif @@ -597,7 +602,7 @@ H5FD_s3comms_hrb_destroy(hrb_t **_buf) FUNC_ENTER_NOAPI_NOINIT -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS fprintf(stdout, "called H5FD_s3comms_hrb_destroy.\n"); #endif @@ -658,7 +663,7 @@ H5FD_s3comms_hrb_init_request(const char *_verb, const char *_resource, const ch FUNC_ENTER_NOAPI_NOINIT -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL fprintf(stdout, "called H5FD_s3comms_hrb_init_request.\n"); #endif @@ -762,7 +767,7 @@ H5FD_s3comms_s3r_close(s3r_t *handle) FUNC_ENTER_NOAPI_NOINIT -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG > S3COMMS_DEBUG_TRACE_API fprintf(stdout, "called H5FD_s3comms_s3r_close.\n"); #endif @@ -863,7 +868,7 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle) FUNC_ENTER_NOAPI_NOINIT -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL fprintf(stdout, "called H5FD_s3comms_s3r_getsize.\n"); #endif @@ -911,7 +916,7 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "HTTP metadata buffer overrun"); else if (sds.size == 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "No HTTP metadata"); -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL else fprintf(stdout, "GETSIZE: OK\n"); #endif @@ -945,8 +950,8 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle) handle->filesize = (size_t)content_length; -#if S3COMMS_DEBUG - fprintf(stdout, "FILESIZE: %zu\n", handle->filesize); +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_REQUESTS + fprintf(stdout, " -- size: %ju\n", content_length); #endif /********************** @@ -1014,7 +1019,7 @@ H5FD_s3comms_s3r_open(const char *url, const char *region, const char *id, const FUNC_ENTER_NOAPI_NOINIT -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_API fprintf(stdout, "called H5FD_s3comms_s3r_open.\n"); #endif @@ -1212,7 +1217,7 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) FUNC_ENTER_NOAPI_NOINIT -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_API fprintf(stdout, "called H5FD_s3comms_s3r_read.\n"); #endif @@ -1273,7 +1278,7 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to format HTTP Range value"); } -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_HEADERS fprintf(stdout, "%s: Bytes %" PRIuHADDR " - %" PRIuHADDR ", Request Size: %zu\n", handle->httpverb, offset, offset + len - 1, len); #endif @@ -1304,7 +1309,7 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) authorization = (char *)H5MM_malloc(512 + H5FD_ROS3_MAX_SECRET_TOK_LEN + 1); if (authorization == NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for authorization variable."); - /* 2048 := approximate max length... + /* 4608 := approximate max length... * 67 * + 8 @@ -1312,7 +1317,7 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) * + 128 * + 20 * + 128 - * + 1024 + * + 4096 */ char buffer2[256 + 1]; /* -> String To Sign -> Credential */ char iso8601now[ISO8601_SIZE]; @@ -1386,6 +1391,10 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) } if (rangebytesstr != NULL) { +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_REQUESTS + fprintf(stdout, " -- request: %lu %zu\n", (size_t)offset, len); + +#endif if (FAIL == H5FD_s3comms_hrb_node_set(&headers, "Range", rangebytesstr)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set range header"); if (headers == NULL) @@ -1495,7 +1504,7 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "curl cannot perform request"); #endif -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL if (dest != NULL) { fprintf(stdout, "len: %d\n", (int)len); fprintf(stdout, "CHECKING FOR BUFFER OVERFLOW\n"); @@ -1645,7 +1654,7 @@ H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, int _cr_size, c size_t sh_size = (size_t)_sh_size; size_t cr_len = 0; /* working length of canonical request str */ size_t sh_len = 0; /* working length of signed headers str */ - char tmpstr[1024]; + char tmpstr[H5FD_ROS3_MAX_SECRET_TOK_LEN]; /* "query params" refers to the optional element in the URL, e.g. * http://bucket.aws.com/myfile.txt?max-keys=2&prefix=J @@ -1659,7 +1668,7 @@ H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, int _cr_size, c FUNC_ENTER_NOAPI_NOINIT -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL fprintf(stdout, "called H5FD_s3comms_aws_canonical_request.\n"); #endif @@ -1691,8 +1700,8 @@ H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, int _cr_size, c assert(node->magic == S3COMMS_HRB_NODE_MAGIC); - ret = snprintf(tmpstr, 1024, "%s:%s\n", node->lowername, node->value); - if (ret < 0 || ret >= 1024) + ret = snprintf(tmpstr, sizeof(tmpstr), "%s:%s\n", node->lowername, node->value); + if (ret < 0 || ret >= (int)sizeof(tmpstr)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to concatenate HTTP header %s:%s", node->lowername, node->value); cr_len += strlen(tmpstr); @@ -1700,8 +1709,8 @@ H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, int _cr_size, c HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not enough space in canonical request"); strcat(canonical_request_dest, tmpstr); - ret = snprintf(tmpstr, 1024, "%s;", node->lowername); - if (ret < 0 || ret >= 1024) + ret = snprintf(tmpstr, sizeof(tmpstr), "%s;", node->lowername); + if (ret < 0 || ret >= (int)sizeof(tmpstr)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to append semicolon to lowername %s", node->lowername); sh_len += strlen(tmpstr); @@ -1765,7 +1774,7 @@ H5FD_s3comms_bytes_to_hex(char *dest, const unsigned char *msg, size_t msg_len, FUNC_ENTER_NOAPI_NOINIT -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL fprintf(stdout, "called H5FD_s3comms_bytes_to_hex.\n"); #endif @@ -1806,7 +1815,7 @@ H5FD_s3comms_free_purl(parsed_url_t *purl) { FUNC_ENTER_NOAPI_NOINIT_NOERR -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL printf("called H5FD_s3comms_free_purl.\n"); #endif @@ -1866,7 +1875,7 @@ H5FD_s3comms_HMAC_SHA256(const unsigned char *key, size_t key_len, const char *m FUNC_ENTER_NOAPI_NOINIT -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL fprintf(stdout, "called H5FD_s3comms_HMAC_SHA256.\n"); #endif @@ -1953,7 +1962,7 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha FUNC_ENTER_PACKAGE -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL fprintf(stdout, "called load_aws_creds_from_file.\n"); #endif @@ -2070,7 +2079,7 @@ H5FD_s3comms_load_aws_profile(const char *profile_name, char *key_id_out, char * FUNC_ENTER_NOAPI_NOINIT -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL fprintf(stdout, "called H5FD_s3comms_load_aws_profile.\n"); #endif @@ -2152,7 +2161,7 @@ H5FD_s3comms_nlowercase(char *dest, const char *s, size_t len) FUNC_ENTER_NOAPI_NOINIT -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL fprintf(stdout, "called H5FD_s3comms_nlowercase.\n"); #endif @@ -2212,7 +2221,7 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl) FUNC_ENTER_NOAPI_NOINIT -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL printf("called H5FD_s3comms_parse_url.\n"); #endif @@ -2419,21 +2428,21 @@ H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr unsigned int i = 0; int chars_written = 0; herr_t ret_value = SUCCEED; -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL unsigned char s[2] = {c, 0}; unsigned char hex[3] = {0, 0, 0}; #endif FUNC_ENTER_NOAPI_NOINIT -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL fprintf(stdout, "called H5FD_s3comms_percent_encode_char.\n"); #endif if (repr == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination `repr`."); -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL H5FD_s3comms_bytes_to_hex((char *)hex, s, 1, false); fprintf(stdout, " CHAR: \'%s\'\n", s); fprintf(stdout, " CHAR-HEX: \"%s\"\n", hex); @@ -2443,7 +2452,7 @@ H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr /* character represented in a single "byte" * and single percent-code */ -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL fprintf(stdout, " SINGLE-BYTE\n"); #endif *repr_len = 3; @@ -2458,7 +2467,7 @@ H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr unsigned int k = 0; /* uint character representation */ unsigned int stack_size = 0; unsigned char stack[4] = {0, 0, 0, 0}; -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL fprintf(stdout, " MULTI-BYTE\n"); #endif stack_size = 0; @@ -2478,7 +2487,7 @@ H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr * UTF-8 byte fields. */ -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL fprintf(stdout, " STACK:\n {\n"); for (i = 0; i < stack_size; i++) { H5FD_s3comms_bytes_to_hex((char *)hex, (&stack[i]), 1, false); @@ -2571,7 +2580,7 @@ H5FD_s3comms_signing_key(unsigned char *md, const char *secret, const char *regi FUNC_ENTER_NOAPI_NOINIT -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL fprintf(stdout, "called H5FD_s3comms_signing_key.\n"); #endif @@ -2660,7 +2669,7 @@ H5FD_s3comms_tostringtosign(char *dest, const char *req, const char *now, const FUNC_ENTER_NOAPI_NOINIT -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL fprintf(stdout, "called H5FD_s3comms_tostringtosign.\n"); #endif @@ -2744,7 +2753,7 @@ H5FD_s3comms_trim(char *dest, char *s, size_t s_len, size_t *n_written) FUNC_ENTER_NOAPI_NOINIT -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL fprintf(stdout, "called H5FD_s3comms_trim.\n"); #endif @@ -2831,7 +2840,7 @@ H5FD_s3comms_uriencode(char *dest, const char *s, size_t s_len, bool encode_slas FUNC_ENTER_NOAPI_NOINIT -#if S3COMMS_DEBUG +#if S3COMMS_DEBUG >= S3COMMS_DEBUG_TRACE_INTERNAL fprintf(stdout, "H5FD_s3comms_uriencode called.\n"); #endif diff --git a/src/H5FDsplitter.c b/src/H5FDsplitter.c index 723b1915289..a4a8eaacb69 100644 --- a/src/H5FDsplitter.c +++ b/src/H5FDsplitter.c @@ -335,7 +335,7 @@ H5Pget_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *config /*out*/) herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", fapl_id, config); + H5TRACE2("e", "i*#", fapl_id, config); H5FD_SPLITTER_LOG_CALL(__func__); @@ -532,27 +532,28 @@ H5FD__splitter_get_default_wo_path(char *new_path, size_t new_path_len, const ch HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "filename exceeds max length"); /* Determine if filename contains a ".h5" extension. */ - if ((file_extension = strstr(base_filename, ".h5"))) { + file_extension = strstr(base_filename, ".h5"); + if (file_extension) { /* Insert the suffix between the filename and ".h5" extension. */ - strcpy(new_path, base_filename); - file_extension = strstr(new_path, ".h5"); - sprintf(file_extension, "%s%s", suffix, ".h5"); + intptr_t beginningLength = file_extension - base_filename; + snprintf(new_path, new_path_len, "%.*s%s%s", (int)beginningLength, base_filename, suffix, ".h5"); } - else if ((file_extension = strrchr(base_filename, '.'))) { - char *new_extension_loc = NULL; - + else { /* If the filename doesn't contain a ".h5" extension, but contains * AN extension, just insert the suffix before that extension. */ - strcpy(new_path, base_filename); - new_extension_loc = strrchr(new_path, '.'); - sprintf(new_extension_loc, "%s%s", suffix, file_extension); - } - else { - /* If the filename doesn't contain an extension at all, just insert - * the suffix at the end of the filename. - */ - snprintf(new_path, new_path_len, "%s%s", base_filename, suffix); + file_extension = strrchr(base_filename, '.'); + if (file_extension) { + intptr_t beginningLength = file_extension - base_filename; + snprintf(new_path, new_path_len, "%.*s%s%s", (int)beginningLength, base_filename, suffix, + file_extension); + } + else { + /* If the filename doesn't contain an extension at all, just insert + * the suffix at the end of the filename. + */ + snprintf(new_path, new_path_len, "%s%s", base_filename, suffix); + } } done: diff --git a/src/H5FDsubfiling/H5FDsubfiling.c b/src/H5FDsubfiling/H5FDsubfiling.c index bf175e6ed3f..71dd4bacd12 100644 --- a/src/H5FDsubfiling/H5FDsubfiling.c +++ b/src/H5FDsubfiling/H5FDsubfiling.c @@ -2828,7 +2828,7 @@ get_iovec_sizes(subfiling_context_t *sf_context, size_t in_count, haddr_t file_o * I/O of a size greater than the block size definitionally * touches all subfiles at least once. */ - cur_max_num_subfiles = (size_t)num_subfiles; + cur_max_num_subfiles = (int64_t)num_subfiles; } else if (data_size < stripe_size) { /* diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c index a3ae1d8958e..bc43ca334e7 100644 --- a/src/H5Fdeprec.c +++ b/src/H5Fdeprec.c @@ -94,7 +94,7 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", obj_id, finfo); + H5TRACE2("e", "i*!", obj_id, finfo); /* Check args */ if (!finfo) diff --git a/src/H5Fint.c b/src/H5Fint.c index 1feada6274e..7b5aeb4c64f 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -79,7 +79,8 @@ static int H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key); static herr_t H5F__build_name(const char *prefix, const char *file_name, char **full_name /*out*/); static char *H5F__getenv_prefix_name(char **env_prefix /*in,out*/); static H5F_t *H5F__new(H5F_shared_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf); -static herr_t H5F__check_if_using_file_locks(H5P_genplist_t *fapl, bool *use_file_locking); +static herr_t H5F__check_if_using_file_locks(H5P_genplist_t *fapl, bool *use_file_locking, + bool *ignore_disabled_locks); static herr_t H5F__dest(H5F_t *f, bool flush, bool free_on_failure); static herr_t H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name, char ** /*out*/ actual_name); @@ -94,7 +95,8 @@ static herr_t H5F__flush_phase2(H5F_t *f, bool closing); * true/false have obvious meanings. FAIL means the environment variable was * not set, so the code should ignore it and use the fapl value instead. */ -htri_t use_locks_env_g = FAIL; +htri_t use_locks_env_g = FAIL; +htri_t ignore_disabled_locks_g = FAIL; /*****************************/ /* Library Private Variables */ @@ -140,7 +142,7 @@ H5F_init(void) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to initialize interface"); /* Check the file locking environment variable */ - if (H5F__parse_file_lock_env_var(&use_locks_env_g) < 0) + if (H5F__parse_file_lock_env_var(&use_locks_env_g, &ignore_disabled_locks_g) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to parse file locking environment variable"); done: @@ -237,7 +239,7 @@ H5F__close_cb(H5VL_object_t *file_vol_obj, void **request) *------------------------------------------------------------------------- */ herr_t -H5F__parse_file_lock_env_var(htri_t *use_locks) +H5F__parse_file_lock_env_var(htri_t *use_locks, htri_t *ignore_disabled_locks) { char *lock_env_var = NULL; /* Environment variable pointer */ @@ -245,13 +247,23 @@ H5F__parse_file_lock_env_var(htri_t *use_locks) /* Check the file locking environment variable */ lock_env_var = getenv(HDF5_USE_FILE_LOCKING); - if (lock_env_var && (!strcmp(lock_env_var, "FALSE") || !strcmp(lock_env_var, "0"))) - *use_locks = false; /* Override: Never use locks */ - else if (lock_env_var && (!strcmp(lock_env_var, "TRUE") || !strcmp(lock_env_var, "BEST_EFFORT") || - !strcmp(lock_env_var, "1"))) - *use_locks = true; /* Override: Always use locks */ - else - *use_locks = FAIL; /* Environment variable not set, or not set correctly */ + if (lock_env_var && (!strcmp(lock_env_var, "FALSE") || !strcmp(lock_env_var, "0"))) { + *use_locks = false; /* Override: Never use locks */ + *ignore_disabled_locks = FAIL; + } + else if (lock_env_var && !strcmp(lock_env_var, "BEST_EFFORT")) { + *use_locks = true; /* Override: Always use locks */ + *ignore_disabled_locks = true; /* Override: Ignore disabled locks */ + } + else if (lock_env_var && (!strcmp(lock_env_var, "TRUE") || !strcmp(lock_env_var, "1"))) { + *use_locks = true; /* Override: Always use locks */ + *ignore_disabled_locks = false; /* Override: Don't ignore disabled locks */ + } + else { + /* Environment variable not set, or not set correctly */ + *use_locks = FAIL; + *ignore_disabled_locks = FAIL; + } FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5F__parse_file_lock_env_var() */ @@ -374,8 +386,13 @@ H5F_get_access_plist(H5F_t *f, bool app_ref) if (H5P_set(new_plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &f->shared->high_bound) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'high' bound for library format versions"); + if (H5P_set(new_plist, H5F_ACS_USE_FILE_LOCKING_NAME, &f->shared->use_file_locking) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set file locking property"); + if (H5P_set(new_plist, H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_NAME, &f->shared->ignore_disabled_locks) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, + "can't set 'ignore disabled file locks' property"); if (H5P_set(new_plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, &(f->shared->read_attempts)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'read attempts ' flag"); + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'read attempts' flag"); if (H5P_set(new_plist, H5F_ACS_OBJECT_FLUSH_CB_NAME, &(f->shared->object_flush)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set object flush callback"); @@ -1644,7 +1661,9 @@ H5F__dest(H5F_t *f, bool flush, bool free_on_failure) /*------------------------------------------------------------------------- * Function: H5F__check_if_using_file_locks * - * Purpose: Determines if this file will use file locks. + * Purpose: Determines if this file will use file locks and whether or + * not to ignore the case where file locking is disabled on + * the file system. * * There are three ways that file locking can be controlled: * @@ -1665,22 +1684,35 @@ H5F__dest(H5F_t *f, bool flush, bool free_on_failure) *------------------------------------------------------------------------- */ static herr_t -H5F__check_if_using_file_locks(H5P_genplist_t *fapl, bool *use_file_locking) +H5F__check_if_using_file_locks(H5P_genplist_t *fapl, bool *use_file_locking, bool *ignore_disabled_locks) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE - /* Make sure the out parameter has a value */ - *use_file_locking = true; + /* Make sure the out parameters have a value */ + *use_file_locking = true; + *ignore_disabled_locks = false; - /* Check the fapl property */ - if (H5P_get(fapl, H5F_ACS_USE_FILE_LOCKING_NAME, use_file_locking) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get use file locking flag"); + /* Check file locking environment variable first */ + if (use_locks_env_g != FAIL) { + *use_file_locking = (use_locks_env_g == true); + } + else { + /* Check the file locking fapl property */ + if (H5P_get(fapl, H5F_ACS_USE_FILE_LOCKING_NAME, use_file_locking) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get use file locking flag"); + } - /* Check the environment variable */ - if (use_locks_env_g != FAIL) - *use_file_locking = (use_locks_env_g == true) ? true : false; + /* Check "ignore disabled file locks" environment variable first */ + if (ignore_disabled_locks_g != FAIL) { + *ignore_disabled_locks = (ignore_disabled_locks_g == true); + } + else { + /* Check the "ignore disabled file locks" fapl property */ + if (H5P_get(fapl, H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_NAME, ignore_disabled_locks) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get ignore disabled file locks property"); + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -1775,10 +1807,11 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) bool set_flag = false; /*set the status_flags in the superblock */ bool clear = false; /*clear the status_flags */ bool evict_on_close; /* evict on close value from plist */ - bool use_file_locking = true; /* Using file locks? */ - bool ci_load = false; /* whether MDC ci load requested */ - bool ci_write = false; /* whether MDC CI write requested */ - H5F_t *ret_value = NULL; /*actual return value */ + bool use_file_locking = true; /* Using file locks? */ + bool ignore_disabled_locks = false; /* Ignore disabled file locks? */ + bool ci_load = false; /* whether MDC ci load requested */ + bool ci_write = false; /* whether MDC CI write requested */ + H5F_t *ret_value = NULL; /*actual return value */ FUNC_ENTER_NOAPI(NULL) @@ -1798,8 +1831,8 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not file access property list"); /* Check if we are using file locking */ - if (H5F__check_if_using_file_locks(a_plist, &use_file_locking) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to get file locking flag"); + if (H5F__check_if_using_file_locks(a_plist, &use_file_locking, &ignore_disabled_locks) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to get file locking flags"); /* * Opening a file is a two step process. First we try to open the @@ -1951,14 +1984,20 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) shared = file->shared; lf = shared->lf; - /* Set the file locking flag. If the file is already open, the file + /* Set the file locking flags. If the file is already open, the file * requested file locking flag must match that of the open file. */ - if (shared->nrefs == 1) - file->shared->use_file_locking = use_file_locking; - else if (shared->nrefs > 1) + if (shared->nrefs == 1) { + file->shared->use_file_locking = use_file_locking; + file->shared->ignore_disabled_locks = ignore_disabled_locks; + } + else if (shared->nrefs > 1) { if (file->shared->use_file_locking != use_file_locking) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "file locking flag values don't match"); + if (file->shared->use_file_locking && (file->shared->ignore_disabled_locks != ignore_disabled_locks)) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, + "file locking 'ignore disabled locks' flag values don't match"); + } /* Check if page buffering is enabled */ if (H5P_get(a_plist, H5F_ACS_PAGE_BUFFER_SIZE_NAME, &page_buf_size) < 0) diff --git a/src/H5Fmodule.h b/src/H5Fmodule.h index b7bb7a0c5a0..bf54976ab14 100644 --- a/src/H5Fmodule.h +++ b/src/H5Fmodule.h @@ -408,14 +408,19 @@ * * * \anchor fcpl_table_tag File creation property list functions (H5P) + *
* \snippet{doc} tables/propertyLists.dox fcpl_table + *
* * \anchor fapl_table_tag File access property list functions (H5P) + *
* \snippet{doc} tables/propertyLists.dox fapl_table + *
* * \anchor fd_pl_table_tag File driver property list functions (H5P) + *
* \snippet{doc} tables/propertyLists.dox fd_pl_table - * + *
* * \subsection subsec_file_create Creating or Opening an HDF5 File * This section describes in more detail how to create and how to open files. @@ -672,7 +677,9 @@ * #H5FD_SEC2. Alternative layouts and drivers are designed to suit the needs of a variety of * systems, environments, and applications. The drivers are listed in the table below. * + *
* \snippet{doc} tables/fileDriverLists.dox supported_file_driver_table + *
* * For more information, see the HDF5 Reference Manual entries for the function calls shown in * the column on the right in the table above. diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index 7a535e90d7d..f570038ddc3 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -326,7 +326,7 @@ H5Fget_mpi_atomicity(hid_t file_id, bool *flag /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", file_id, flag); + H5TRACE2("e", "i*b", file_id, flag); /* Get the file object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index bc5c90bd5da..60de31ebdfd 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -293,16 +293,17 @@ struct H5F_shared_t { hsize_t threshold; /* Threshold for alignment */ hsize_t alignment; /* Alignment */ unsigned gc_ref; /* Garbage-collect references? */ - H5F_libver_t low_bound; /* The 'low' bound of library format versions */ - H5F_libver_t high_bound; /* The 'high' bound of library format versions */ - bool store_msg_crt_idx; /* Store creation index for object header messages? */ - unsigned ncwfs; /* Num entries on cwfs list */ - struct H5HG_heap_t **cwfs; /* Global heap cache */ - struct H5G_t *root_grp; /* Open root group */ - H5FO_t *open_objs; /* Open objects in file */ - H5UC_t *grp_btree_shared; /* Ref-counted group B-tree node info */ - bool use_file_locking; /* Whether or not to use file locking */ - bool closing; /* File is in the process of being closed */ + H5F_libver_t low_bound; /* The 'low' bound of library format versions */ + H5F_libver_t high_bound; /* The 'high' bound of library format versions */ + bool store_msg_crt_idx; /* Store creation index for object header messages? */ + unsigned ncwfs; /* Num entries on cwfs list */ + struct H5HG_heap_t **cwfs; /* Global heap cache */ + struct H5G_t *root_grp; /* Open root group */ + H5FO_t *open_objs; /* Open objects in file */ + H5UC_t *grp_btree_shared; /* Ref-counted group B-tree node info */ + bool use_file_locking; /* Whether or not to use file locking */ + bool ignore_disabled_locks; /* Whether or not to ignore disabled file locking */ + bool closing; /* File is in the process of being closed */ /* Cached VOL connector ID & info */ hid_t vol_id; /* ID of VOL connector for the container */ @@ -391,9 +392,11 @@ H5FL_EXTERN(H5F_t); H5FL_EXTERN(H5F_shared_t); /* Whether or not to use file locking (based on the environment variable) - * FAIL means ignore the environment variable. + * and whether or not to ignore disabled file locking. FAIL means ignore + * the environment variable. */ H5_DLLVAR htri_t use_locks_env_g; +H5_DLLVAR htri_t ignore_disabled_locks_g; /******************************/ /* Package Private Prototypes */ @@ -411,7 +414,7 @@ H5_DLL herr_t H5F__start_swmr_write(H5F_t *f); H5_DLL herr_t H5F__close(H5F_t *f); H5_DLL herr_t H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high); H5_DLL herr_t H5F__get_cont_info(const H5F_t *f, H5VL_file_cont_info_t *info); -H5_DLL herr_t H5F__parse_file_lock_env_var(htri_t *use_locks); +H5_DLL herr_t H5F__parse_file_lock_env_var(htri_t *use_locks, htri_t *ignore_disabled_locks); H5_DLL herr_t H5F__delete(const char *filename, hid_t fapl_id); /* File mount related routines */ diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index 6db1c71a95f..45580ac41ec 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -741,6 +741,13 @@ H5_DLL herr_t H5Fget_intent(hid_t file_id, unsigned *intent); * file identifier \p file_id and the pointer \p fnumber to the file * number. * + * This file number is the same for all open instances of the same + * file, as long as 1. The active VFD implements the file comparison operator, + * and 2. The current filesystem is able to determine if the same file is opened more + * than once. If these conditions are not met, it is the application's + * responsibility to avoid opening multiple handles into the same file, + * which results in undefined behavior. + * * \since 1.12.0 * */ diff --git a/src/H5Ftest.c b/src/H5Ftest.c index 081fbda5f8a..7e34e0af9b9 100644 --- a/src/H5Ftest.c +++ b/src/H5Ftest.c @@ -258,7 +258,7 @@ H5F__reparse_file_lock_variable_test(void) FUNC_ENTER_PACKAGE /* Check the file locking environment variable */ - if (H5F__parse_file_lock_env_var(&use_locks_env_g) < 0) + if (H5F__parse_file_lock_env_var(&use_locks_env_g, &ignore_disabled_locks_g) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to parse file locking environment variable"); done: diff --git a/src/H5G.c b/src/H5G.c index 384eeb2b034..7679da7d80a 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -591,7 +591,7 @@ H5Gget_info(hid_t loc_id, H5G_info_t *group_info /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", loc_id, group_info); + H5TRACE2("e", "i*GI", loc_id, group_info); /* Retrieve group information synchronously */ if (H5G__get_info_api_common(loc_id, group_info, NULL, NULL) < 0) @@ -620,7 +620,7 @@ H5Gget_info_async(const char *app_file, const char *app_func, unsigned app_line, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*s*sIuixi", app_file, app_func, app_line, loc_id, group_info, es_id); + H5TRACE6("e", "*s*sIui*GIi", app_file, app_func, app_line, loc_id, group_info, es_id); /* Set up request token pointer for asynchronous operation */ if (H5ES_NONE != es_id) @@ -634,7 +634,7 @@ H5Gget_info_async(const char *app_file, const char *app_func, unsigned app_line, if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE6(__func__, "*s*sIuixi", app_file, app_func, app_line, loc_id, group_info, es_id)) < 0) + H5ARG_TRACE6(__func__, "*s*sIui*GIi", app_file, app_func, app_line, loc_id, group_info, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert token into event set"); @@ -699,7 +699,7 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *group_info /*out herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "i*sxi", loc_id, name, group_info, lapl_id); + H5TRACE4("e", "i*s*GIi", loc_id, name, group_info, lapl_id); /* Retrieve group information synchronously */ if (H5G__get_info_by_name_api_common(loc_id, name, group_info, lapl_id, NULL, NULL) < 0) @@ -728,7 +728,7 @@ H5Gget_info_by_name_async(const char *app_file, const char *app_func, unsigned a herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE8("e", "*s*sIui*sxii", app_file, app_func, app_line, loc_id, name, group_info, lapl_id, es_id); + H5TRACE8("e", "*s*sIui*s*GIii", app_file, app_func, app_line, loc_id, name, group_info, lapl_id, es_id); /* Set up request token pointer for asynchronous operation */ if (H5ES_NONE != es_id) @@ -742,7 +742,7 @@ H5Gget_info_by_name_async(const char *app_file, const char *app_func, unsigned a if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE8(__func__, "*s*sIui*sxii", app_file, app_func, app_line, loc_id, name, group_info, lapl_id, es_id)) < 0) + H5ARG_TRACE8(__func__, "*s*sIui*s*GIii", app_file, app_func, app_line, loc_id, name, group_info, lapl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert token into event set"); @@ -809,7 +809,7 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5 herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE7("e", "i*sIiIohxi", loc_id, group_name, idx_type, order, n, group_info, lapl_id); + H5TRACE7("e", "i*sIiIoh*GIi", loc_id, group_name, idx_type, order, n, group_info, lapl_id); /* Retrieve group information synchronously */ if (H5G__get_info_by_idx_api_common(loc_id, group_name, idx_type, order, n, group_info, lapl_id, NULL, @@ -840,8 +840,8 @@ H5Gget_info_by_idx_async(const char *app_file, const char *app_func, unsigned ap herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE11("e", "*s*sIui*sIiIohxii", app_file, app_func, app_line, loc_id, group_name, idx_type, order, n, - group_info, lapl_id, es_id); + H5TRACE11("e", "*s*sIui*sIiIoh*GIii", app_file, app_func, app_line, loc_id, group_name, idx_type, order, + n, group_info, lapl_id, es_id); /* Set up request token pointer for asynchronous operation */ if (H5ES_NONE != es_id) @@ -856,7 +856,7 @@ H5Gget_info_by_idx_async(const char *app_file, const char *app_func, unsigned ap if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE11(__func__, "*s*sIui*sIiIohxii", app_file, app_func, app_line, loc_id, group_name, idx_type, order, n, group_info, lapl_id, es_id)) < 0) + H5ARG_TRACE11(__func__, "*s*sIui*sIiIoh*GIii", app_file, app_func, app_line, loc_id, group_name, idx_type, order, n, group_info, lapl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert token into event set"); diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 8b9b5c8dc68..5982c1205ef 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -627,7 +627,7 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "i*szx", loc_id, name, size, buf); + H5TRACE4("e", "i*sz*s", loc_id, name, size, buf); /* Check arguments */ if (!name || !*name) @@ -748,7 +748,7 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf /*out*/ int ret_value; /* Return value */ FUNC_ENTER_API(-1) - H5TRACE4("Is", "i*szx", loc_id, name, bufsize, buf); + H5TRACE4("Is", "i*sz*s", loc_id, name, bufsize, buf); if (!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, -1, "no name specified"); @@ -884,7 +884,7 @@ H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", loc_id, num_objs); + H5TRACE2("e", "i*h", loc_id, num_objs); /* Check args */ id_type = H5I_get_type(loc_id); @@ -933,7 +933,7 @@ H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, H5G_stat_t * herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "i*sbx", loc_id, name, follow_link, statbuf); + H5TRACE4("e", "i*sb*Gs", loc_id, name, follow_link, statbuf); /* Check arguments */ if (!name || !*name) @@ -1148,7 +1148,7 @@ H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name /*out*/, size_t size ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("Zs", "ihxz", loc_id, idx, name, size); + H5TRACE4("Zs", "ih*sz", loc_id, idx, name, size); /* Set up collective metadata if appropriate */ if (H5CX_set_loc(loc_id) < 0) diff --git a/src/H5Gmodule.h b/src/H5Gmodule.h index 4c435eb2e60..c330fcdb400 100644 --- a/src/H5Gmodule.h +++ b/src/H5Gmodule.h @@ -477,7 +477,9 @@ * * * + *
* \snippet{doc} tables/propertyLists.dox gcpl_table + *
* * * diff --git a/src/H5Gobj.c b/src/H5Gobj.c index e701922ab4e..c5bdfc1be46 100644 --- a/src/H5Gobj.c +++ b/src/H5Gobj.c @@ -218,7 +218,25 @@ H5G__obj_create_real(H5F_t *f, const H5O_ginfo_t *ginfo, const H5O_linfo_t *linf assert(link_size); /* Compute size of header to use for creation */ - hdr_size = linfo_size + ginfo_size + pline_size + (ginfo->est_num_entries * link_size); + + /* Basic header size */ + hdr_size = linfo_size + ginfo_size + pline_size; + + /* If this is likely to be a compact group, add space for the link + * messages, unless the size of the link messages is greater than + * the largest allowable object header message size, since the size + * of the link messages is the size of the NIL spacer message that + * would have to be written out to reserve enough space to hold the + * links if the group were left empty. + */ + bool compact = ginfo->est_num_entries <= ginfo->max_compact; + if (compact) { + + size_t size_of_links = ginfo->est_num_entries * link_size; + + if (size_of_links < H5O_MESG_MAX_SIZE) + hdr_size += size_of_links; + } } /* end if */ else hdr_size = (size_t)(4 + 2 * H5F_SIZEOF_ADDR(f)); diff --git a/src/H5HL.c b/src/H5HL.c index bdf46d6ce37..680ef0a15db 100644 --- a/src/H5HL.c +++ b/src/H5HL.c @@ -648,15 +648,8 @@ H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf, size_t *of assert(last_fl->offset == H5HL_ALIGN(last_fl->offset)); assert(last_fl->size == H5HL_ALIGN(last_fl->size)); - if (last_fl->size < H5HL_SIZEOF_FREE(f)) { -#ifdef H5HL_DEBUG - if (H5DEBUG(HL) && last_fl->size) { - fprintf(H5DEBUG(HL), "H5HL: lost %lu bytes at line %d\n", (unsigned long)(last_fl->size), - __LINE__); - } -#endif + if (last_fl->size < H5HL_SIZEOF_FREE(f)) last_fl = H5HL__remove_free(heap, last_fl); - } } else { /* Create a new free list element large enough that we can @@ -675,21 +668,9 @@ H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf, size_t *of if (heap->freelist) heap->freelist->prev = fl; heap->freelist = fl; -#ifdef H5HL_DEBUG - } - else if (H5DEBUG(HL) && need_more > need_size) { - fprintf(H5DEBUG(HL), "H5HL_insert: lost %lu bytes at line %d\n", - (unsigned long)(need_more - need_size), __LINE__); -#endif } } -#ifdef H5HL_DEBUG - if (H5DEBUG(HL)) { - fprintf(H5DEBUG(HL), "H5HL: resize mem buf from %lu to %lu bytes\n", - (unsigned long)(old_dblk_size), (unsigned long)(old_dblk_size + need_more)); - } -#endif if (NULL == (heap->dblk_image = H5FL_BLK_REALLOC(lheap_chunk, heap->dblk_image, heap->dblk_size))) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed"); @@ -822,14 +803,8 @@ H5HL_remove(H5F_t *f, H5HL_t *heap, size_t offset, size_t size) * hold the free list data. If not, the freed chunk is forever * lost. */ - if (size < H5HL_SIZEOF_FREE(f)) { -#ifdef H5HL_DEBUG - if (H5DEBUG(HL)) { - fprintf(H5DEBUG(HL), "H5HL: lost %lu bytes\n", (unsigned long)size); - } -#endif + if (size < H5HL_SIZEOF_FREE(f)) HGOTO_DONE(SUCCEED); - } /* Add an entry to the free list */ if (NULL == (fl = H5FL_MALLOC(H5HL_free_t))) diff --git a/src/H5HLprivate.h b/src/H5HLprivate.h index 5d6959d4867..243d7653a86 100644 --- a/src/H5HLprivate.h +++ b/src/H5HLprivate.h @@ -14,7 +14,7 @@ * * Created: H5HLprivate.h * - * Purpose: Private declarations for the H5HL (local heap) package. + * Purpose: Private declarations for the H5HL (local heap) package * *------------------------------------------------------------------------- */ @@ -26,14 +26,6 @@ #include "H5ACprivate.h" /* Metadata cache */ #include "H5Fprivate.h" /* File access */ -/* - * Feature: Define H5HL_DEBUG on the compiler command line if you want to - * enable diagnostic messages from this layer. - */ -#ifdef NDEBUG -#undef H5HL_DEBUG -#endif - #define H5HL_ALIGN(X) ((((unsigned)X) + 7) & (unsigned)(~0x07)) /* align on 8-byte boundary */ #define H5HL_SIZEOF_FREE(F) \ diff --git a/src/H5I.c b/src/H5I.c index 97e679ce660..a5d3b39f130 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -908,7 +908,7 @@ H5Iget_name(hid_t id, char *name /*out*/, size_t size) ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) - H5TRACE3("Zs", "ixz", id, name, size); + H5TRACE3("Zs", "i*sz", id, name, size); /* Get the object pointer */ if (NULL == (vol_obj = H5VL_vol_object(id))) diff --git a/src/H5Iint.c b/src/H5Iint.c index 1c5321461cc..fe3b90c2454 100644 --- a/src/H5Iint.c +++ b/src/H5Iint.c @@ -373,15 +373,6 @@ H5I__mark_node(void *_info, void H5_ATTR_UNUSED *key, void *_udata) /* Discard the future object */ if ((info->discard_cb)(info->u.object) < 0) { if (udata->force) { -#ifdef H5I_DEBUG - if (H5DEBUG(I)) { - fprintf(H5DEBUG(I), - "H5I: discard type=%d obj=%p " - "failure ignored\n", - (int)udata->type_info->cls->type, info->u.c_object); - } -#endif /* H5I_DEBUG */ - /* Indicate node should be removed from list */ mark = true; } @@ -396,15 +387,6 @@ H5I__mark_node(void *_info, void H5_ATTR_UNUSED *key, void *_udata) if (udata->type_info->cls->free_func && (udata->type_info->cls->free_func)(info->u.object, H5_REQUEST_NULL) < 0) { if (udata->force) { -#ifdef H5I_DEBUG - if (H5DEBUG(I)) { - fprintf(H5DEBUG(I), - "H5I: free type=%d obj=%p " - "failure ignored\n", - (int)udata->type_info->cls->type, info->u.c_object); - } -#endif /* H5I_DEBUG */ - /* Indicate node should be removed from list */ mark = true; } diff --git a/src/H5L.c b/src/H5L.c index 78cf20d4784..49fe1ac4fd7 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -1042,7 +1042,7 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf /*out*/, size_t size, hid_t herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE5("e", "i*sxzi", loc_id, name, buf, size, lapl_id); + H5TRACE5("e", "i*s*xzi", loc_id, name, buf, size, lapl_id); /* Check arguments */ if (!name || !*name) @@ -1100,7 +1100,7 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE8("e", "i*sIiIohxzi", loc_id, group_name, idx_type, order, n, buf, size, lapl_id); + H5TRACE8("e", "i*sIiIoh*xzi", loc_id, group_name, idx_type, order, n, buf, size, lapl_id); /* Check arguments */ if (!group_name || !*group_name) @@ -1272,7 +1272,7 @@ H5Lget_info2(hid_t loc_id, const char *name, H5L_info2_t *linfo /*out*/, hid_t l herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "i*sxi", loc_id, name, linfo, lapl_id); + H5TRACE4("e", "i*s*!i", loc_id, name, linfo, lapl_id); /* Check arguments */ if (!name || !*name) @@ -1325,7 +1325,7 @@ H5Lget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE7("e", "i*sIiIohxi", loc_id, group_name, idx_type, order, n, linfo, lapl_id); + H5TRACE7("e", "i*sIiIoh*!i", loc_id, group_name, idx_type, order, n, linfo, lapl_id); /* Check arguments */ if (!group_name || !*group_name) @@ -1515,7 +1515,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5 ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) - H5TRACE8("Zs", "i*sIiIohxzi", loc_id, group_name, idx_type, order, n, name, size, lapl_id); + H5TRACE8("Zs", "i*sIiIoh*szi", loc_id, group_name, idx_type, order, n, name, size, lapl_id); /* Check arguments */ if (!group_name || !*group_name) diff --git a/src/H5Ldeprec.c b/src/H5Ldeprec.c index 40734e1979c..f057538130c 100644 --- a/src/H5Ldeprec.c +++ b/src/H5Ldeprec.c @@ -311,7 +311,7 @@ H5Lget_info1(hid_t loc_id, const char *name, H5L_info1_t *linfo /*out*/, hid_t l herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "i*sxi", loc_id, name, linfo, lapl_id); + H5TRACE4("e", "i*s*!i", loc_id, name, linfo, lapl_id); /* Check arguments */ if (!name || !*name) @@ -396,7 +396,7 @@ H5Lget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE7("e", "i*sIiIohxi", loc_id, group_name, idx_type, order, n, linfo, lapl_id); + H5TRACE7("e", "i*sIiIoh*!i", loc_id, group_name, idx_type, order, n, linfo, lapl_id); /* Check arguments */ if (!group_name || !*group_name) diff --git a/src/H5M.c b/src/H5M.c index f59e02fa3ee..49842494852 100644 --- a/src/H5M.c +++ b/src/H5M.c @@ -881,7 +881,7 @@ H5Mget_count(hid_t map_id, hsize_t *count /*out*/, hid_t dxpl_id) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) - H5TRACE3("e", "ixi", map_id, count, dxpl_id); + H5TRACE3("e", "i*hi", map_id, count, dxpl_id); /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP))) diff --git a/src/H5O.c b/src/H5O.c index 9087cbecd41..aa43d891b8b 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -1079,7 +1079,7 @@ H5Oget_info3(hid_t loc_id, H5O_info2_t *oinfo /*out*/, unsigned fields) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ixIu", loc_id, oinfo, fields); + H5TRACE3("e", "i*!Iu", loc_id, oinfo, fields); /* Check args */ if (!oinfo) @@ -1171,7 +1171,7 @@ H5Oget_info_by_name3(hid_t loc_id, const char *name, H5O_info2_t *oinfo /*out*/, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE5("e", "i*sxIui", loc_id, name, oinfo, fields, lapl_id); + H5TRACE5("e", "i*s*!Iui", loc_id, name, oinfo, fields, lapl_id); /* Retrieve object information synchronously */ if (H5O__get_info_by_name_api_common(loc_id, name, oinfo, fields, lapl_id, NULL, NULL) < 0) @@ -1201,7 +1201,7 @@ H5Oget_info_by_name_async(const char *app_file, const char *app_func, unsigned a herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE9("e", "*s*sIui*sxIuii", app_file, app_func, app_line, loc_id, name, oinfo, fields, lapl_id, + H5TRACE9("e", "*s*sIui*s*!Iuii", app_file, app_func, app_line, loc_id, name, oinfo, fields, lapl_id, es_id); /* Set up request token pointer for asynchronous operation */ @@ -1216,7 +1216,7 @@ H5Oget_info_by_name_async(const char *app_file, const char *app_func, unsigned a if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE9(__func__, "*s*sIui*sxIuii", app_file, app_func, app_line, loc_id, name, oinfo, fields, lapl_id, es_id)) < 0) + H5ARG_TRACE9(__func__, "*s*sIui*s*!Iuii", app_file, app_func, app_line, loc_id, name, oinfo, fields, lapl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert token into event set"); @@ -1245,7 +1245,7 @@ H5Oget_info_by_idx3(hid_t loc_id, const char *group_name, H5_index_t idx_type, H herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE8("e", "i*sIiIohxIui", loc_id, group_name, idx_type, order, n, oinfo, fields, lapl_id); + H5TRACE8("e", "i*sIiIoh*!Iui", loc_id, group_name, idx_type, order, n, oinfo, fields, lapl_id); /* Check args */ if (!group_name || !*group_name) @@ -1308,7 +1308,7 @@ H5Oget_native_info(hid_t loc_id, H5O_native_info_t *oinfo /*out*/, unsigned fiel herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ixIu", loc_id, oinfo, fields); + H5TRACE3("e", "i*!Iu", loc_id, oinfo, fields); /* Check args */ if (!oinfo) @@ -1359,7 +1359,7 @@ H5Oget_native_info_by_name(hid_t loc_id, const char *name, H5O_native_info_t *oi herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE5("e", "i*sxIui", loc_id, name, oinfo, fields, lapl_id); + H5TRACE5("e", "i*s*!Iui", loc_id, name, oinfo, fields, lapl_id); /* Check args */ if (!name) @@ -1422,7 +1422,7 @@ H5Oget_native_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_t herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE8("e", "i*sIiIohxIui", loc_id, group_name, idx_type, order, n, oinfo, fields, lapl_id); + H5TRACE8("e", "i*sIiIoh*!Iui", loc_id, group_name, idx_type, order, n, oinfo, fields, lapl_id); /* Check args */ if (!group_name || !*group_name) @@ -1602,7 +1602,7 @@ H5Oget_comment(hid_t obj_id, char *comment /*out*/, size_t bufsize) ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) - H5TRACE3("Zs", "ixz", obj_id, comment, bufsize); + H5TRACE3("Zs", "i*sz", obj_id, comment, bufsize); /* Get the object */ if (NULL == (vol_obj = H5VL_vol_object(obj_id))) @@ -1655,7 +1655,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment /*out*/, si ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) - H5TRACE5("Zs", "i*sxzi", loc_id, name, comment, bufsize, lapl_id); + H5TRACE5("Zs", "i*s*szi", loc_id, name, comment, bufsize, lapl_id); /* Check args */ if (!name || !*name) @@ -2196,7 +2196,7 @@ H5Oare_mdc_flushes_disabled(hid_t object_id, bool *are_disabled) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*!", object_id, are_disabled); + H5TRACE2("e", "i*b", object_id, are_disabled); /* Sanity check */ if (!are_disabled) diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c index 10502123cd0..8b82e39e2a6 100644 --- a/src/H5Oainfo.c +++ b/src/H5Oainfo.c @@ -31,7 +31,8 @@ /* PRIVATE PROTOTYPES */ static void *H5O__ainfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O__ainfo_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg); +static herr_t H5O__ainfo_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p, + const void *_mesg); static void *H5O__ainfo_copy(const void *_mesg, void *_dest); static size_t H5O__ainfo_size(const H5F_t *f, bool disable_shared, const void *_mesg); static herr_t H5O__ainfo_free(void *_mesg); @@ -175,7 +176,8 @@ H5O__ainfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUS *------------------------------------------------------------------------- */ static herr_t -H5O__ainfo_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__ainfo_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p, + const void *_mesg) { const H5O_ainfo_t *ainfo = (const H5O_ainfo_t *)_mesg; unsigned char flags; /* Flags for encoding attribute info */ diff --git a/src/H5Oattr.c b/src/H5Oattr.c index e86ec39432a..6852ebc9796 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -380,7 +380,7 @@ H5O__attr_encode(H5F_t *f, uint8_t *p, const void *mesg) p += name_len; /* encode the attribute datatype */ - if ((H5O_MSG_DTYPE->encode)(f, false, p, attr->shared->dt) < 0) + if ((H5O_MSG_DTYPE->encode)(f, false, SIZE_MAX, p, attr->shared->dt) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode attribute datatype"); if (attr->shared->version < H5O_ATTR_VERSION_2) { @@ -391,7 +391,7 @@ H5O__attr_encode(H5F_t *f, uint8_t *p, const void *mesg) p += attr->shared->dt_size; /* encode the attribute dataspace */ - if ((H5O_MSG_SDSPACE->encode)(f, false, p, &(attr->shared->ds->extent)) < 0) + if ((H5O_MSG_SDSPACE->encode)(f, false, SIZE_MAX, p, &(attr->shared->ds->extent)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode attribute dataspace"); if (attr->shared->version < H5O_ATTR_VERSION_2) { diff --git a/src/H5Obogus.c b/src/H5Obogus.c index c9c2196b0f3..4948d61c96d 100644 --- a/src/H5Obogus.c +++ b/src/H5Obogus.c @@ -35,7 +35,8 @@ /* PRIVATE PROTOTYPES */ static void *H5O__bogus_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O__bogus_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg); +static herr_t H5O__bogus_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p, + const void *_mesg); static size_t H5O__bogus_size(const H5F_t *f, bool disable_shared, const void *_mesg); static herr_t H5O__bogus_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth); @@ -142,8 +143,8 @@ H5O__bogus_decode(H5F_t *f, H5O_t H5_ATTR_NDEBUG_UNUSED *open_oh, unsigned H5_AT *------------------------------------------------------------------------- */ static herr_t -H5O__bogus_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, - const void H5_ATTR_UNUSED *mesg) +H5O__bogus_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, size_t H5_ATTR_UNUSED p_size, + uint8_t *p, const void H5_ATTR_UNUSED *mesg) { FUNC_ENTER_PACKAGE_NOERR diff --git a/src/H5Obtreek.c b/src/H5Obtreek.c index 7f56b43245e..42e1ce0c32c 100644 --- a/src/H5Obtreek.c +++ b/src/H5Obtreek.c @@ -24,7 +24,8 @@ static void *H5O__btreek_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O__btreek_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg); +static herr_t H5O__btreek_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p, + const void *_mesg); static void *H5O__btreek_copy(const void *_mesg, void *_dest); static size_t H5O__btreek_size(const H5F_t *f, bool disable_shared, const void *_mesg); static herr_t H5O__btreek_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth); @@ -120,7 +121,8 @@ H5O__btreek_decode(H5F_t H5_ATTR_NDEBUG_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh *------------------------------------------------------------------------- */ static herr_t -H5O__btreek_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__btreek_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, size_t H5_ATTR_UNUSED p_size, + uint8_t *p, const void *_mesg) { const H5O_btreek_t *mesg = (const H5O_btreek_t *)_mesg; diff --git a/src/H5Ocache_image.c b/src/H5Ocache_image.c index 7c71178cc1e..d91b46341c0 100644 --- a/src/H5Ocache_image.c +++ b/src/H5Ocache_image.c @@ -36,7 +36,8 @@ /* Callbacks for message class */ static void *H5O__mdci_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O__mdci_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg); +static herr_t H5O__mdci_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p, + const void *_mesg); static void *H5O__mdci_copy(const void *_mesg, void *_dest); static size_t H5O__mdci_size(const H5F_t *f, bool disable_shared, const void *_mesg); static herr_t H5O__mdci_free(void *mesg); @@ -135,7 +136,8 @@ H5O__mdci_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSE *------------------------------------------------------------------------- */ static herr_t -H5O__mdci_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__mdci_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p, + const void *_mesg) { const H5O_mdci_t *mesg = (const H5O_mdci_t *)_mesg; diff --git a/src/H5Ocont.c b/src/H5Ocont.c index ff082181d4e..6894eca2118 100644 --- a/src/H5Ocont.c +++ b/src/H5Ocont.c @@ -33,7 +33,8 @@ /* PRIVATE PROTOTYPES */ static void *H5O__cont_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O__cont_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg); +static herr_t H5O__cont_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p, + const void *_mesg); static size_t H5O__cont_size(const H5F_t *f, bool disable_shared, const void *_mesg); static herr_t H5O__cont_free(void *mesg); static herr_t H5O__cont_delete(H5F_t *f, H5O_t *open_oh, void *_mesg); @@ -122,7 +123,8 @@ H5O__cont_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSE *------------------------------------------------------------------------- */ static herr_t -H5O__cont_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__cont_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p, + const void *_mesg) { const H5O_cont_t *cont = (const H5O_cont_t *)_mesg; diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c index 3de58185675..3dd01f4029d 100644 --- a/src/H5Odeprec.c +++ b/src/H5Odeprec.c @@ -405,7 +405,7 @@ H5Oget_info1(hid_t loc_id, H5O_info1_t *oinfo /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", loc_id, oinfo); + H5TRACE2("e", "i*!", loc_id, oinfo); /* Check args */ if (!oinfo) @@ -455,7 +455,7 @@ H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info1_t *oinfo /*out*/, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "i*sxi", loc_id, name, oinfo, lapl_id); + H5TRACE4("e", "i*s*!i", loc_id, name, oinfo, lapl_id); /* Check args */ if (!name) @@ -517,7 +517,7 @@ H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE7("e", "i*sIiIohxi", loc_id, group_name, idx_type, order, n, oinfo, lapl_id); + H5TRACE7("e", "i*sIiIoh*!i", loc_id, group_name, idx_type, order, n, oinfo, lapl_id); /* Check args */ if (!group_name || !*group_name) @@ -582,7 +582,7 @@ H5Oget_info2(hid_t loc_id, H5O_info1_t *oinfo /*out*/, unsigned fields) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ixIu", loc_id, oinfo, fields); + H5TRACE3("e", "i*!Iu", loc_id, oinfo, fields); /* Check args */ if (!oinfo) @@ -635,7 +635,7 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info1_t *oinfo /*out*/, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE5("e", "i*sxIui", loc_id, name, oinfo, fields, lapl_id); + H5TRACE5("e", "i*s*!Iui", loc_id, name, oinfo, fields, lapl_id); /* Check args */ if (!name) @@ -700,7 +700,7 @@ H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE8("e", "i*sIiIohxIui", loc_id, group_name, idx_type, order, n, oinfo, fields, lapl_id); + H5TRACE8("e", "i*sIiIoh*!Iui", loc_id, group_name, idx_type, order, n, oinfo, fields, lapl_id); /* Check args */ if (!group_name || !*group_name) diff --git a/src/H5Odrvinfo.c b/src/H5Odrvinfo.c index 4ff98738864..baec777d0f9 100644 --- a/src/H5Odrvinfo.c +++ b/src/H5Odrvinfo.c @@ -23,7 +23,8 @@ static void *H5O__drvinfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O__drvinfo_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg); +static herr_t H5O__drvinfo_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p, + const void *_mesg); static void *H5O__drvinfo_copy(const void *_mesg, void *_dest); static size_t H5O__drvinfo_size(const H5F_t *f, bool disable_shared, const void *_mesg); static herr_t H5O__drvinfo_reset(void *_mesg); @@ -135,8 +136,8 @@ H5O__drvinfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, *------------------------------------------------------------------------- */ static herr_t -H5O__drvinfo_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, - const void *_mesg) +H5O__drvinfo_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, size_t H5_ATTR_UNUSED p_size, + uint8_t *p, const void *_mesg) { const H5O_drvinfo_t *mesg = (const H5O_drvinfo_t *)_mesg; diff --git a/src/H5Oefl.c b/src/H5Oefl.c index c06ecf68694..ebd92a733ba 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -22,7 +22,8 @@ /* PRIVATE PROTOTYPES */ static void *H5O__efl_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O__efl_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg); +static herr_t H5O__efl_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p, + const void *_mesg); static void *H5O__efl_copy(const void *_mesg, void *_dest); static size_t H5O__efl_size(const H5F_t *f, bool disable_shared, const void *_mesg); static herr_t H5O__efl_reset(void *_mesg); @@ -197,7 +198,8 @@ H5O__efl_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED *------------------------------------------------------------------------- */ static herr_t -H5O__efl_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__efl_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p, + const void *_mesg) { const H5O_efl_t *mesg = (const H5O_efl_t *)_mesg; size_t u; /* Local index variable */ diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c index 70f34fe7ad9..f9cb8feb111 100644 --- a/src/H5Ofsinfo.c +++ b/src/H5Ofsinfo.c @@ -30,7 +30,8 @@ /* PRIVATE PROTOTYPES */ static void *H5O__fsinfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O__fsinfo_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg); +static herr_t H5O__fsinfo_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p, + const void *_mesg); static void *H5O__fsinfo_copy(const void *_mesg, void *_dest); static size_t H5O__fsinfo_size(const H5F_t *f, bool disable_shared, const void *_mesg); static herr_t H5O__fsinfo_free(void *mesg); @@ -222,7 +223,8 @@ H5O__fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU *------------------------------------------------------------------------- */ static herr_t -H5O__fsinfo_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__fsinfo_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p, + const void *_mesg) { const H5O_fsinfo_t *fsinfo = (const H5O_fsinfo_t *)_mesg; H5F_mem_page_t ptype; /* Memory type for iteration */ diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c index 72d15afd64f..645c5ff81af 100644 --- a/src/H5Oginfo.c +++ b/src/H5Oginfo.c @@ -29,7 +29,8 @@ /* PRIVATE PROTOTYPES */ static void *H5O__ginfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O__ginfo_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg); +static herr_t H5O__ginfo_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p, + const void *_mesg); static void *H5O__ginfo_copy(const void *_mesg, void *_dest); static size_t H5O__ginfo_size(const H5F_t *f, bool disable_shared, const void *_mesg); static herr_t H5O__ginfo_free(void *_mesg); @@ -158,7 +159,8 @@ H5O__ginfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsign *------------------------------------------------------------------------- */ static herr_t -H5O__ginfo_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__ginfo_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, size_t H5_ATTR_UNUSED p_size, + uint8_t *p, const void *_mesg) { const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *)_mesg; unsigned char flags = 0; /* Flags for encoding group info */ diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 1f2b6862b6e..75456d6e853 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -31,7 +31,8 @@ /* PRIVATE PROTOTYPES */ static void *H5O__layout_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O__layout_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg); +static herr_t H5O__layout_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p, + const void *_mesg); static void *H5O__layout_copy(const void *_mesg, void *_dest); static size_t H5O__layout_size(const H5F_t *f, bool disable_shared, const void *_mesg); static herr_t H5O__layout_reset(void *_mesg); @@ -794,7 +795,8 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU *------------------------------------------------------------------------- */ static herr_t -H5O__layout_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__layout_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p, + const void *_mesg) { const H5O_layout_t *mesg = (const H5O_layout_t *)_mesg; unsigned u; diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c index 9d26483b17e..830e4e3113c 100644 --- a/src/H5Olinfo.c +++ b/src/H5Olinfo.c @@ -33,7 +33,8 @@ /* PRIVATE PROTOTYPES */ static void *H5O__linfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O__linfo_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg); +static herr_t H5O__linfo_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p, + const void *_mesg); static void *H5O__linfo_copy(const void *_mesg, void *_dest); static size_t H5O__linfo_size(const H5F_t *f, bool disable_shared, const void *_mesg); static herr_t H5O__linfo_free(void *_mesg); @@ -183,7 +184,8 @@ H5O__linfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUS *------------------------------------------------------------------------- */ static herr_t -H5O__linfo_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__linfo_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p, + const void *_mesg) { const H5O_linfo_t *linfo = (const H5O_linfo_t *)_mesg; unsigned char index_flags; /* Flags for encoding link index info */ diff --git a/src/H5Olink.c b/src/H5Olink.c index 9d4d6853b0e..6657a500c16 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -35,7 +35,8 @@ /* PRIVATE PROTOTYPES */ static void *H5O__link_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O__link_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg); +static herr_t H5O__link_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p, + const void *_mesg); static void *H5O__link_copy(const void *_mesg, void *_dest); static size_t H5O__link_size(const H5F_t *f, bool disable_shared, const void *_mesg); static herr_t H5O__link_reset(void *_mesg); @@ -289,7 +290,8 @@ H5O__link_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSE *------------------------------------------------------------------------- */ static herr_t -H5O__link_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__link_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p, + const void *_mesg) { const H5O_link_t *lnk = (const H5O_link_t *)_mesg; uint64_t len; /* Length of a string in the message */ diff --git a/src/H5Omessage.c b/src/H5Omessage.c index f6cafdc89ab..bc4381b2dd5 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -1597,7 +1597,7 @@ H5O_msg_encode(H5F_t *f, unsigned type_id, bool disable_shared, unsigned char *b assert(type); /* Encode */ - if ((type->encode)(f, disable_shared, buf, mesg) < 0) + if ((type->encode)(f, disable_shared, SIZE_MAX, buf, mesg) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode message"); done: @@ -1972,7 +1972,7 @@ H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg) } #endif /* NDEBUG */ assert(mesg->type->encode); - if ((mesg->type->encode)(f, false, mesg->raw, mesg->native) < 0) + if ((mesg->type->encode)(f, false, mesg->raw_size, mesg->raw, mesg->native) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode object header message"); } /* end if */ diff --git a/src/H5Omtime.c b/src/H5Omtime.c index 9cf9400f903..864af930b49 100644 --- a/src/H5Omtime.c +++ b/src/H5Omtime.c @@ -24,12 +24,13 @@ static void *H5O__mtime_new_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O__mtime_new_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg); +static herr_t H5O__mtime_new_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p, + const void *_mesg); static size_t H5O__mtime_new_size(const H5F_t *f, bool disable_shared, const void *_mesg); static void *H5O__mtime_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O__mtime_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg); +static herr_t H5O__mtime_encode(H5F_t *f, bool disable_shared, size_t p_size, uint8_t *p, const void *_mesg); static void *H5O__mtime_copy(const void *_mesg, void *_dest); static size_t H5O__mtime_size(const H5F_t *f, bool disable_shared, const void *_mesg); static herr_t H5O__mtime_free(void *_mesg); @@ -221,8 +222,8 @@ H5O__mtime_decode(H5F_t H5_ATTR_NDEBUG_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, *------------------------------------------------------------------------- */ static herr_t -H5O__mtime_new_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, - const void *_mesg) +H5O__mtime_new_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, + size_t H5_ATTR_UNUSED p_size, uint8_t *p, const void *_mesg) { const time_t *mesg = (const time_t *)_mesg; @@ -257,7 +258,8 @@ H5O__mtime_new_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_share *------------------------------------------------------------------------- */ static herr_t -H5O__mtime_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__mtime_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, size_t p_size, uint8_t *p, + const void *_mesg) { const time_t *mesg = (const time_t *)_mesg; struct tm *tm; @@ -271,8 +273,8 @@ H5O__mtime_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, u /* encode */ tm = HDgmtime(mesg); - sprintf((char *)p, "%04d%02d%02d%02d%02d%02d", 1900 + tm->tm_year, 1 + tm->tm_mon, tm->tm_mday, - tm->tm_hour, tm->tm_min, tm->tm_sec); + snprintf((char *)p, p_size, "%04d%02d%02d%02d%02d%02d", 1900 + tm->tm_year, 1 + tm->tm_mon, tm->tm_mday, + tm->tm_hour, tm->tm_min, tm->tm_sec); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__mtime_encode() */ diff --git a/src/H5Oname.c b/src/H5Oname.c index d60013717b7..fc85c0bb9e0 100644 --- a/src/H5Oname.c +++ b/src/H5Oname.c @@ -29,7 +29,8 @@ /* PRIVATE PROTOTYPES */ static void *H5O__name_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O__name_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg); +static herr_t H5O__name_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p, + const void *_mesg); static void *H5O__name_copy(const void *_mesg, void *_dest); static size_t H5O__name_size(const H5F_t *f, bool disable_shared, const void *_mesg); static herr_t H5O__name_reset(void *_mesg); @@ -110,7 +111,8 @@ H5O__name_decode(H5F_t H5_ATTR_NDEBUG_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, *------------------------------------------------------------------------- */ static herr_t -H5O__name_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__name_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, size_t H5_ATTR_UNUSED p_size, + uint8_t *p, const void *_mesg) { const H5O_name_t *mesg = (const H5O_name_t *)_mesg; diff --git a/src/H5Opkg.h b/src/H5Opkg.h index feca86f7d0e..4c719bf340e 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -211,7 +211,7 @@ struct H5O_msg_class_t { size_t native_size; /*size of native message */ unsigned share_flags; /* Message sharing settings */ void *(*decode)(H5F_t *, H5O_t *, unsigned, unsigned *, size_t, const uint8_t *); - herr_t (*encode)(H5F_t *, bool, uint8_t *, const void *); + herr_t (*encode)(H5F_t *, bool, size_t, uint8_t *, const void *); void *(*copy)(const void *, void *); /*copy native value */ size_t (*raw_size)(const H5F_t *, bool, const void *); /*sizeof encoded message */ herr_t (*reset)(void *); /*free nested data structs */ diff --git a/src/H5Opublic.h b/src/H5Opublic.h index f35bdd0e7f5..cee0660c5ce 100644 --- a/src/H5Opublic.h +++ b/src/H5Opublic.h @@ -143,15 +143,16 @@ typedef struct H5O_hdr_info_t { * (For H5Oget_info(), H5Oget_info_by_name(), H5Oget_info_by_idx() version 3) */ typedef struct H5O_info2_t { - unsigned long fileno; /**< File number that object is located in */ - H5O_token_t token; /**< Token representing the object */ - H5O_type_t type; /**< Basic object type (group, dataset, etc.) */ - unsigned rc; /**< Reference count of object */ - time_t atime; /**< Access time */ - time_t mtime; /**< Modification time */ - time_t ctime; /**< Change time */ - time_t btime; /**< Birth time */ - hsize_t num_attrs; /**< Number of attributes attached to object */ + unsigned long + fileno; /**< File number that object is located in. Constant across multiple opens of the same file */ + H5O_token_t token; /**< Token representing the object */ + H5O_type_t type; /**< Basic object type (group, dataset, etc.) */ + unsigned rc; /**< Reference count of object */ + time_t atime; /**< Access time */ + time_t mtime; /**< Modification time */ + time_t ctime; /**< Change time */ + time_t btime; /**< Birth time */ + hsize_t num_attrs; /**< Number of attributes attached to object */ } H5O_info2_t; //! @@ -1717,7 +1718,8 @@ typedef struct H5O_stat_t { * H5Oget_info_by_idx() versions 1 & 2.) */ typedef struct H5O_info1_t { - unsigned long fileno; /**< File number that object is located in */ + unsigned long + fileno; /**< File number that object is located in. Constant across multiple opens of the same file */ haddr_t addr; /**< Object address in file */ H5O_type_t type; /**< Basic object type (group, dataset, etc.) */ unsigned rc; /**< Reference count of object */ diff --git a/src/H5Orefcount.c b/src/H5Orefcount.c index 426d2be4750..a93f4295a86 100644 --- a/src/H5Orefcount.c +++ b/src/H5Orefcount.c @@ -29,7 +29,8 @@ /* PRIVATE PROTOTYPES */ static void *H5O__refcount_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O__refcount_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg); +static herr_t H5O__refcount_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p, + const void *_mesg); static void *H5O__refcount_copy(const void *_mesg, void *_dest); static size_t H5O__refcount_size(const H5F_t *f, bool disable_shared, const void *_mesg); static herr_t H5O__refcount_free(void *_mesg); @@ -126,8 +127,8 @@ H5O__refcount_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, *------------------------------------------------------------------------- */ static herr_t -H5O__refcount_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, - const void *_mesg) +H5O__refcount_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, + size_t H5_ATTR_UNUSED p_size, uint8_t *p, const void *_mesg) { const H5O_refcount_t *refcount = (const H5O_refcount_t *)_mesg; diff --git a/src/H5Oshared.h b/src/H5Oshared.h index 97539baae1a..2813badd339 100644 --- a/src/H5Oshared.h +++ b/src/H5Oshared.h @@ -91,7 +91,7 @@ H5O_SHARED_DECODE(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *iofla *------------------------------------------------------------------------- */ static inline herr_t -H5O_SHARED_ENCODE(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg) +H5O_SHARED_ENCODE(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p, const void *_mesg) { const H5O_shared_t *sh_mesg = (const H5O_shared_t *)_mesg; /* Pointer to shared message portion of actual message */ diff --git a/src/H5Oshmesg.c b/src/H5Oshmesg.c index 50d6652f42a..98f18292c93 100644 --- a/src/H5Oshmesg.c +++ b/src/H5Oshmesg.c @@ -24,7 +24,8 @@ static void *H5O__shmesg_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O__shmesg_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg); +static herr_t H5O__shmesg_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p, + const void *_mesg); static void *H5O__shmesg_copy(const void *_mesg, void *_dest); static size_t H5O__shmesg_size(const H5F_t *f, bool disable_shared, const void *_mesg); static herr_t H5O__shmesg_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth); @@ -113,7 +114,8 @@ H5O__shmesg_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU *------------------------------------------------------------------------- */ static herr_t -H5O__shmesg_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__shmesg_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p, + const void *_mesg) { const H5O_shmesg_table_t *mesg = (const H5O_shmesg_table_t *)_mesg; diff --git a/src/H5Ostab.c b/src/H5Ostab.c index a9c3dd118c9..5000ca84d7d 100644 --- a/src/H5Ostab.c +++ b/src/H5Ostab.c @@ -32,7 +32,8 @@ /* PRIVATE PROTOTYPES */ static void *H5O__stab_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O__stab_encode(H5F_t *f, bool disable_shared, uint8_t *p, const void *_mesg); +static herr_t H5O__stab_encode(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p, + const void *_mesg); static void *H5O__stab_copy(const void *_mesg, void *_dest); static size_t H5O__stab_size(const H5F_t *f, bool disable_shared, const void *_mesg); static herr_t H5O__stab_free(void *_mesg); @@ -123,7 +124,8 @@ H5O__stab_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSE *------------------------------------------------------------------------- */ static herr_t -H5O__stab_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__stab_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p, + const void *_mesg) { const H5O_stab_t *stab = (const H5O_stab_t *)_mesg; diff --git a/src/H5P.c b/src/H5P.c index b9be5a250d0..fc361e8788e 100644 --- a/src/H5P.c +++ b/src/H5P.c @@ -758,7 +758,7 @@ H5Pget_size(hid_t id, const char *name, size_t *size /*out*/) herr_t ret_value; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "i*sx", id, name, size); + H5TRACE3("e", "i*s*z", id, name, size); /* Check arguments. */ if (H5I_GENPROP_LST != H5I_get_type(id) && H5I_GENPROP_CLS != H5I_get_type(id)) @@ -963,7 +963,7 @@ H5Pget_nprops(hid_t id, size_t *nprops /*out*/) herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", id, nprops); + H5TRACE2("e", "i*z", id, nprops); /* Check arguments. */ if (H5I_GENPROP_LST != H5I_get_type(id) && H5I_GENPROP_CLS != H5I_get_type(id)) @@ -1263,7 +1263,7 @@ H5Pget(hid_t plist_id, const char *name, void *value /*out*/) herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "i*sx", plist_id, name, value); + H5TRACE3("e", "i*s*x", plist_id, name, value); /* Check arguments. */ if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) diff --git a/src/H5PL.c b/src/H5PL.c index d01b0f5abc3..218e413eced 100644 --- a/src/H5PL.c +++ b/src/H5PL.c @@ -109,7 +109,7 @@ H5PLget_loading_state(unsigned *plugin_control_mask /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE1("e", "x", plugin_control_mask); + H5TRACE1("e", "*Iu", plugin_control_mask); if (NULL == plugin_control_mask) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_control_mask parameter cannot be NULL"); diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c index 71c79635038..37386265085 100644 --- a/src/H5Pdapl.c +++ b/src/H5Pdapl.c @@ -810,7 +810,7 @@ H5Pget_chunk_cache(hid_t dapl_id, size_t *rdcc_nslots /*out*/, size_t *rdcc_nbyt herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "ixxx", dapl_id, rdcc_nslots, rdcc_nbytes, rdcc_w0); + H5TRACE4("e", "i*z*z*d", dapl_id, rdcc_nslots, rdcc_nbytes, rdcc_w0); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(dapl_id, H5P_DATASET_ACCESS))) @@ -1108,7 +1108,7 @@ H5Pget_virtual_view(hid_t plist_id, H5D_vds_view_t *view /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, view); + H5TRACE2("e", "i*Dv", plist_id, view); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) @@ -1251,7 +1251,7 @@ H5Pget_virtual_printf_gap(hid_t plist_id, hsize_t *gap_size /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, gap_size); + H5TRACE2("e", "i*h", plist_id, gap_size); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) @@ -1353,7 +1353,7 @@ H5Pget_append_flush(hid_t plist_id, unsigned ndims, hsize_t boundary[], H5D_appe herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE5("e", "iIu*hxx", plist_id, ndims, boundary, func, udata); + H5TRACE5("e", "iIu*h*DA**x", plist_id, ndims, boundary, func, udata); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) @@ -1436,7 +1436,7 @@ H5Pget_efile_prefix(hid_t plist_id, char *prefix /*out*/, size_t size) ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("Zs", "ixz", plist_id, prefix, size); + H5TRACE3("Zs", "i*sz", plist_id, prefix, size); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) @@ -1526,7 +1526,7 @@ H5Pget_virtual_prefix(hid_t plist_id, char *prefix /*out*/, size_t size) ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("Zs", "ixz", plist_id, prefix, size); + H5TRACE3("Zs", "i*sz", plist_id, prefix, size); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index ae426ee3f9e..f7175e742f1 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -1980,7 +1980,7 @@ H5Pget_chunk(hid_t plist_id, int max_ndims, hsize_t dim[] /*out*/) int ret_value; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("Is", "iIsx", plist_id, max_ndims, dim); + H5TRACE3("Is", "iIs*h", plist_id, max_ndims, dim); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) @@ -2203,7 +2203,7 @@ H5Pget_virtual_count(hid_t dcpl_id, size_t *count /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", dcpl_id, count); + H5TRACE2("e", "i*z", dcpl_id, count); if (count) { /* Get the plist structure */ @@ -2400,7 +2400,7 @@ H5Pget_virtual_filename(hid_t dcpl_id, size_t idx, char *name /*out*/, size_t si ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("Zs", "izxz", dcpl_id, idx, name, size); + H5TRACE4("Zs", "iz*sz", dcpl_id, idx, name, size); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) @@ -2458,7 +2458,7 @@ H5Pget_virtual_dsetname(hid_t dcpl_id, size_t idx, char *name /*out*/, size_t si ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("Zs", "izxz", dcpl_id, idx, name, size); + H5TRACE4("Zs", "iz*sz", dcpl_id, idx, name, size); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) @@ -2554,7 +2554,7 @@ H5Pget_chunk_opts(hid_t plist_id, unsigned *options /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, options); + H5TRACE2("e", "i*Iu", plist_id, options); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) @@ -2723,7 +2723,7 @@ H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size, char *name /*out herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE6("e", "iIuzxxx", plist_id, idx, name_size, name, offset, size); + H5TRACE6("e", "iIuz*s*o*h", plist_id, idx, name_size, name, offset, size); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) @@ -3176,7 +3176,7 @@ H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "iix", plist_id, type_id, value); + H5TRACE3("e", "ii*x", plist_id, type_id, value); /* Check arguments */ if (NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) @@ -3399,7 +3399,7 @@ H5Pget_alloc_time(hid_t plist_id, H5D_alloc_time_t *alloc_time /*out*/) herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, alloc_time); + H5TRACE2("e", "i*Da", plist_id, alloc_time); /* Get values */ if (alloc_time) { @@ -3481,7 +3481,7 @@ H5Pget_fill_time(hid_t plist_id, H5D_fill_time_t *fill_time /*out*/) herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, fill_time); + H5TRACE2("e", "i*Df", plist_id, fill_time); /* Set values */ if (fill_time) { @@ -3527,7 +3527,7 @@ H5Pget_dset_no_attrs_hint(hid_t dcpl_id, hbool_t *minimize /*out*/) herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", dcpl_id, minimize); + H5TRACE2("e", "i*b", dcpl_id, minimize); if (NULL == minimize) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "receiving pointer cannot be NULL"); diff --git a/src/H5Pdeprec.c b/src/H5Pdeprec.c index 4374730d48e..6e55c72b691 100644 --- a/src/H5Pdeprec.c +++ b/src/H5Pdeprec.c @@ -449,7 +449,7 @@ H5Pget_version(hid_t plist_id, unsigned *super /*out*/, unsigned *freelist /*out herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE5("e", "ixxxx", plist_id, super, freelist, stab, shhdr); + H5TRACE5("e", "i*Iu*Iu*Iu*Iu", plist_id, super, freelist, stab, shhdr); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) @@ -605,7 +605,7 @@ H5Pget_file_space(hid_t plist_id, H5F_file_space_type_t *strategy /*out*/, hsize herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ixx", plist_id, strategy, threshold); + H5TRACE3("e", "i*Ft*h", plist_id, strategy, threshold); /* Get current file space info */ if (H5Pget_file_space_strategy(plist_id, &new_strategy, &new_persist, &new_threshold) < 0) diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index 9adb2d60d3f..344746f6b2f 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -1033,7 +1033,7 @@ H5Pget_data_transform(hid_t plist_id, char *expression /*out*/, size_t size) ssize_t ret_value; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("Zs", "ixz", plist_id, expression, size); + H5TRACE3("Zs", "i*sz", plist_id, expression, size); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) @@ -1129,7 +1129,7 @@ H5Pget_buffer(hid_t plist_id, void **tconv /*out*/, void **bkg /*out*/) size_t ret_value; /* Return value */ FUNC_ENTER_API(0) - H5TRACE3("z", "ixx", plist_id, tconv, bkg); + H5TRACE3("z", "i**x**x", plist_id, tconv, bkg); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) @@ -1387,7 +1387,7 @@ H5Pget_type_conv_cb(hid_t plist_id, H5T_conv_except_func_t *op /*out*/, void **o herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ixx", plist_id, op, operate_data); + H5TRACE3("e", "i*TE**x", plist_id, op, operate_data); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) @@ -1425,7 +1425,7 @@ H5Pget_btree_ratios(hid_t plist_id, double *left /*out*/, double *middle /*out*/ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "ixxx", plist_id, left, middle, right); + H5TRACE4("e", "i*d*d*d", plist_id, left, middle, right); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) @@ -1590,7 +1590,7 @@ H5Pget_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t *alloc_func /*out*/, voi herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE5("e", "ixxxx", plist_id, alloc_func, alloc_info, free_func, free_info); + H5TRACE5("e", "i*Ma**x*Mf**x", plist_id, alloc_func, alloc_info, free_func, free_info); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) @@ -1672,7 +1672,7 @@ H5Pget_hyper_vector_size(hid_t plist_id, size_t *vector_size /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, vector_size); + H5TRACE2("e", "i*z", plist_id, vector_size); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) @@ -1904,7 +1904,7 @@ H5Pget_mpio_actual_chunk_opt_mode(hid_t plist_id, herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, actual_chunk_opt_mode); + H5TRACE2("e", "i*Do", plist_id, actual_chunk_opt_mode); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) @@ -1936,7 +1936,7 @@ H5Pget_mpio_actual_io_mode(hid_t plist_id, H5D_mpio_actual_io_mode_t *actual_io_ herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, actual_io_mode); + H5TRACE2("e", "i*Di", plist_id, actual_io_mode); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) @@ -1968,7 +1968,7 @@ H5Pget_mpio_no_collective_cause(hid_t plist_id, uint32_t *local_no_collective_ca herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ixx", plist_id, local_no_collective_cause, global_no_collective_cause); + H5TRACE3("e", "i*Iu*Iu", plist_id, local_no_collective_cause, global_no_collective_cause); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) @@ -2421,7 +2421,7 @@ H5Pget_selection_io(hid_t plist_id, H5D_selection_io_mode_t *selection_io_mode / herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, selection_io_mode); + H5TRACE2("e", "i*DC", plist_id, selection_io_mode); /* Check arguments */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) @@ -2452,7 +2452,7 @@ H5Pget_no_selection_io_cause(hid_t plist_id, uint32_t *no_selection_io_cause /*o herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, no_selection_io_cause); + H5TRACE2("e", "i*Iu", plist_id, no_selection_io_cause); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) @@ -2485,7 +2485,7 @@ H5Pget_actual_selection_io_mode(hid_t plist_id, uint32_t *actual_selection_io_mo herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, actual_selection_io_mode); + H5TRACE2("e", "i*Iu", plist_id, actual_selection_io_mode); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) @@ -2617,7 +2617,7 @@ H5Pget_modify_write_buf(hid_t plist_id, hbool_t *modify_write_buf /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, modify_write_buf); + H5TRACE2("e", "i*b", plist_id, modify_write_buf); /* Check arguments */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index e7c1fb3acb8..65c21408a3f 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -1106,7 +1106,7 @@ H5Pget_alignment(hid_t fapl_id, hsize_t *threshold /*out*/, hsize_t *alignment / herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ixx", fapl_id, threshold, alignment); + H5TRACE3("e", "i*h*h", fapl_id, threshold, alignment); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) @@ -2028,7 +2028,7 @@ H5Pget_family_offset(hid_t fapl_id, hsize_t *offset /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", fapl_id, offset); + H5TRACE2("e", "i*h", fapl_id, offset); /* Get the plist structure */ if (H5P_DEFAULT == fapl_id) @@ -2100,7 +2100,7 @@ H5Pget_multi_type(hid_t fapl_id, H5FD_mem_t *type /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", fapl_id, type); + H5TRACE2("e", "i*Mt", fapl_id, type); /* Get the plist structure */ if (H5P_DEFAULT == fapl_id) @@ -2189,7 +2189,7 @@ H5Pget_cache(hid_t plist_id, int *mdc_nelmts, size_t *rdcc_nslots /*out*/, size_ herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE5("e", "i*Isxxx", plist_id, mdc_nelmts, rdcc_nslots, rdcc_nbytes, rdcc_w0); + H5TRACE5("e", "i*Is*z*z*d", plist_id, mdc_nelmts, rdcc_nslots, rdcc_nbytes, rdcc_w0); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) @@ -2276,7 +2276,7 @@ H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config /*out* herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, config); + H5TRACE2("e", "i*CC", plist_id, config); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) @@ -2362,7 +2362,7 @@ H5Pget_mdc_config(hid_t plist_id, H5AC_cache_config_t *config /*out*/) herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, config); + H5TRACE2("e", "i*Cc", plist_id, config); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) @@ -2446,7 +2446,7 @@ H5Pget_gc_references(hid_t plist_id, unsigned *gc_ref /*out*/) herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, gc_ref); + H5TRACE2("e", "i*Iu", plist_id, gc_ref); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) @@ -2507,7 +2507,7 @@ H5Pget_fclose_degree(hid_t plist_id, H5F_close_degree_t *degree /*out*/) herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, degree); + H5TRACE2("e", "i*Fd", plist_id, degree); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) @@ -2577,7 +2577,7 @@ H5Pget_meta_block_size(hid_t plist_id, hsize_t *size /*out*/) herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, size); + H5TRACE2("e", "i*h", plist_id, size); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) @@ -2650,7 +2650,7 @@ H5Pget_sieve_buf_size(hid_t plist_id, size_t *size /*out*/) herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, size); + H5TRACE2("e", "i*z", plist_id, size); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) @@ -2722,7 +2722,7 @@ H5Pget_small_data_block_size(hid_t plist_id, hsize_t *size /*out*/) herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, size); + H5TRACE2("e", "i*h", plist_id, size); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) @@ -2892,7 +2892,7 @@ H5Pget_libver_bounds(hid_t plist_id, H5F_libver_t *low /*out*/, H5F_libver_t *hi herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ixx", plist_id, low, high); + H5TRACE3("e", "i*Fv*Fv", plist_id, low, high); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) @@ -2965,7 +2965,7 @@ H5Pget_elink_file_cache_size(hid_t plist_id, unsigned *efc_size /*out*/) herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, efc_size); + H5TRACE2("e", "i*Iu", plist_id, efc_size); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) @@ -3092,7 +3092,7 @@ H5Pget_file_image(hid_t fapl_id, void **buf /*out*/, size_t *buf_len /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ixx", fapl_id, buf, buf_len); + H5TRACE3("e", "i**x*z", fapl_id, buf, buf_len); /* Get the plist structure */ if (NULL == (fapl = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) @@ -3159,9 +3159,10 @@ H5Pget_file_image(hid_t fapl_id, void **buf /*out*/, size_t *buf_len /*out*/) herr_t H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks_ptr) { - H5P_genplist_t *fapl; /* Property list pointer */ - H5FD_file_image_info_t info; /* File image info */ - herr_t ret_value = SUCCEED; /* Return value */ + H5P_genplist_t *fapl; /* Property list pointer */ + H5FD_file_image_info_t info; /* File image info */ + bool copied_udata = false; /* Whether udata structure was copied */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*DI", fapl_id, callbacks_ptr); @@ -3209,11 +3210,18 @@ H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't copy the supplied udata"); } /* end if */ + copied_udata = true; + /* Set values */ if (H5P_poke(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file image info"); done: + if (ret_value < 0) { + if (copied_udata && (callbacks_ptr->udata_free(info.callbacks.udata) < 0)) + HDONE_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "udata_free callback failed"); + } + FUNC_LEAVE_API(ret_value) } /* end H5Pset_file_image_callbacks() */ @@ -3237,7 +3245,7 @@ H5Pget_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", fapl_id, callbacks); + H5TRACE2("e", "i*DI", fapl_id, callbacks); /* Get the plist structure */ if (NULL == (fapl = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) @@ -4431,7 +4439,7 @@ H5Pget_metadata_read_attempts(hid_t plist_id, unsigned *attempts /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, attempts); + H5TRACE2("e", "i*Iu", plist_id, attempts); /* Get values */ if (attempts) { @@ -4513,7 +4521,7 @@ H5Pget_object_flush_cb(hid_t plist_id, H5F_flush_cb_t *func /*out*/, void **udat herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ixx", plist_id, func, udata); + H5TRACE3("e", "i*FF**x", plist_id, func, udata); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) @@ -4596,7 +4604,7 @@ H5Pget_mdc_log_options(hid_t plist_id, hbool_t *is_enabled /*out*/, char *locati herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE5("e", "ixxxx", plist_id, is_enabled, location, location_size, start_on_access); + H5TRACE5("e", "i*b*s*z*b", plist_id, is_enabled, location, location_size, start_on_access); /* Get the property list structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) @@ -4894,7 +4902,7 @@ H5Pget_evict_on_close(hid_t fapl_id, hbool_t *evict_on_close /*out*/) herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", fapl_id, evict_on_close); + H5TRACE2("e", "i*b", fapl_id, evict_on_close); /* Compare the property list's class against the other class */ if (true != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) @@ -4975,10 +4983,12 @@ H5Pget_file_locking(hid_t fapl_id, hbool_t *use_file_locking /*out*/, hbool_t *i herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ixx", fapl_id, use_file_locking, ignore_when_disabled); + H5TRACE3("e", "i*b*b", fapl_id, use_file_locking, ignore_when_disabled); /* Make sure this is a fapl */ - if (true != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) + if (H5P_DEFAULT == fapl_id) + fapl_id = H5P_FILE_ACCESS_DEFAULT; + else if (true != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist"); /* Get the plist structure */ @@ -5133,7 +5143,7 @@ H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective /*out*/) herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, is_collective); + H5TRACE2("e", "i*b", plist_id, is_collective); /* Compare the property list's class against the other class */ /* (Dataset, group, attribute, and named datatype access property lists @@ -5216,7 +5226,7 @@ H5Pget_mpi_params(hid_t plist_id, MPI_Comm *comm /*out*/, MPI_Info *info /*out*/ herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ixx", plist_id, comm, info); + H5TRACE3("e", "i*Mc*Mi", plist_id, comm, info); /* Make sure that the property list is a fapl */ if (true != H5P_isa_class(plist_id, H5P_FILE_ACCESS)) @@ -5660,7 +5670,7 @@ H5Pget_coll_metadata_write(hid_t plist_id, hbool_t *is_collective /*out*/) herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, is_collective); + H5TRACE2("e", "i*b", plist_id, is_collective); /* Compare the property list's class against the other class */ if (true != H5P_isa_class(plist_id, H5P_FILE_ACCESS)) @@ -5742,7 +5752,7 @@ H5Pget_page_buffer_size(hid_t plist_id, size_t *buf_size /*out*/, unsigned *min_ herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "ixxx", plist_id, buf_size, min_meta_perc, min_raw_perc); + H5TRACE4("e", "i*z*Iu*Iu", plist_id, buf_size, min_meta_perc, min_raw_perc); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) @@ -5889,7 +5899,7 @@ H5Pget_vol_id(hid_t plist_id, hid_t *vol_id /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, vol_id); + H5TRACE2("e", "i*i", plist_id, vol_id); if (H5P_DEFAULT == plist_id) plist_id = H5P_FILE_ACCESS_DEFAULT; @@ -5938,7 +5948,7 @@ H5Pget_vol_info(hid_t plist_id, void **vol_info /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, vol_info); + H5TRACE2("e", "i**x", plist_id, vol_info); /* Get property list for ID */ if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c index b15e2c9a699..c622b26b600 100644 --- a/src/H5Pfcpl.c +++ b/src/H5Pfcpl.c @@ -361,7 +361,7 @@ H5Pget_userblock(hid_t plist_id, hsize_t *size /*out*/) herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, size); + H5TRACE2("e", "i*h", plist_id, size); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) @@ -447,7 +447,7 @@ H5Pget_sizes(hid_t plist_id, size_t *sizeof_addr /*out*/, size_t *sizeof_size /* herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ixx", plist_id, sizeof_addr, sizeof_size); + H5TRACE3("e", "i*z*z", plist_id, sizeof_addr, sizeof_size); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) @@ -548,7 +548,7 @@ H5Pget_sym_k(hid_t plist_id, unsigned *ik /*out*/, unsigned *lk /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ixx", plist_id, ik, lk); + H5TRACE3("e", "i*Iu*Iu", plist_id, ik, lk); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) @@ -632,7 +632,7 @@ H5Pget_istore_k(hid_t plist_id, unsigned *ik /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, ik); + H5TRACE2("e", "i*Iu", plist_id, ik); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) @@ -790,7 +790,7 @@ H5Pget_shared_mesg_nindexes(hid_t plist_id, unsigned *nindexes /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, nindexes); + H5TRACE2("e", "i*Iu", plist_id, nindexes); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) @@ -887,7 +887,7 @@ H5Pget_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned *mesg_type herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "iIuxx", plist_id, index_num, mesg_type_flags, min_mesg_size); + H5TRACE4("e", "iIu*Iu*Iu", plist_id, index_num, mesg_type_flags, min_mesg_size); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) @@ -1160,7 +1160,7 @@ H5Pget_shared_mesg_phase_change(hid_t plist_id, unsigned *max_list /*out*/, unsi herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ixx", plist_id, max_list, min_btree); + H5TRACE3("e", "i*Iu*Iu", plist_id, max_list, min_btree); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) @@ -1242,7 +1242,7 @@ H5Pget_file_space_strategy(hid_t plist_id, H5F_fspace_strategy_t *strategy /*out herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "ixxx", plist_id, strategy, persist, threshold); + H5TRACE4("e", "i*Ff*b*h", plist_id, strategy, persist, threshold); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) @@ -1382,7 +1382,7 @@ H5Pget_file_space_page_size(hid_t plist_id, hsize_t *fsp_size /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, fsp_size); + H5TRACE2("e", "i*h", plist_id, fsp_size); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) diff --git a/src/H5Pgcpl.c b/src/H5Pgcpl.c index 364955be901..bcf9e8fc3d6 100644 --- a/src/H5Pgcpl.c +++ b/src/H5Pgcpl.c @@ -187,7 +187,7 @@ H5Pget_local_heap_size_hint(hid_t plist_id, size_t *size_hint /*out*/) herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, size_hint); + H5TRACE2("e", "i*z", plist_id, size_hint); if (size_hint) { H5P_genplist_t *plist; /* Property list pointer */ @@ -282,7 +282,7 @@ H5Pget_link_phase_change(hid_t plist_id, unsigned *max_compact /*out*/, unsigned herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ixx", plist_id, max_compact, min_dense); + H5TRACE3("e", "i*Iu*Iu", plist_id, max_compact, min_dense); /* Get values */ if (max_compact || min_dense) { @@ -380,7 +380,7 @@ H5Pget_est_link_info(hid_t plist_id, unsigned *est_num_entries /*out*/, unsigned herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ixx", plist_id, est_num_entries, est_name_len); + H5TRACE3("e", "i*Iu*Iu", plist_id, est_num_entries, est_name_len); /* Get values */ if (est_num_entries || est_name_len) { @@ -464,7 +464,7 @@ H5Pget_link_creation_order(hid_t plist_id, unsigned *crt_order_flags /*out*/) herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, crt_order_flags); + H5TRACE2("e", "i*Iu", plist_id, crt_order_flags); /* Get values */ if (crt_order_flags) { diff --git a/src/H5Plapl.c b/src/H5Plapl.c index 1057fffa616..6eb2b7326a3 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -893,7 +893,7 @@ H5Pget_nlinks(hid_t plist_id, size_t *nlinks /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, nlinks); + H5TRACE2("e", "i*z", plist_id, nlinks); if (!nlinks) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pointer passed in"); @@ -964,7 +964,7 @@ H5Pget_elink_prefix(hid_t plist_id, char *prefix /*out*/, size_t size) ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("Zs", "ixz", plist_id, prefix, size); + H5TRACE3("Zs", "i*sz", plist_id, prefix, size); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_LINK_ACCESS))) @@ -1109,7 +1109,7 @@ H5Pget_elink_acc_flags(hid_t lapl_id, unsigned *flags /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", lapl_id, flags); + H5TRACE2("e", "i*Iu", lapl_id, flags); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS))) @@ -1184,7 +1184,7 @@ H5Pget_elink_cb(hid_t lapl_id, H5L_elink_traverse_t *func /*out*/, void **op_dat herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ixx", lapl_id, func, op_data); + H5TRACE3("e", "i*Lt**x", lapl_id, func, op_data); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS))) diff --git a/src/H5Plcpl.c b/src/H5Plcpl.c index 536172e1616..65a740c977c 100644 --- a/src/H5Plcpl.c +++ b/src/H5Plcpl.c @@ -172,7 +172,7 @@ H5Pget_create_intermediate_group(hid_t plist_id, unsigned *crt_intmd_group /*out herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, crt_intmd_group); + H5TRACE2("e", "i*Iu", plist_id, crt_intmd_group); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_LINK_CREATE))) diff --git a/src/H5Pmapl.c b/src/H5Pmapl.c index 351bc73ec0b..ffb33d94a13 100644 --- a/src/H5Pmapl.c +++ b/src/H5Pmapl.c @@ -187,7 +187,7 @@ H5Pget_map_iterate_hints(hid_t mapl_id, size_t *key_prefetch_size /*out*/, size_ herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ixx", mapl_id, key_prefetch_size, key_alloc_size); + H5TRACE3("e", "i*z*z", mapl_id, key_prefetch_size, key_alloc_size); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(mapl_id, H5P_MAP_ACCESS))) diff --git a/src/H5Pmodule.h b/src/H5Pmodule.h index ea0b2de5842..ef300f9312a 100644 --- a/src/H5Pmodule.h +++ b/src/H5Pmodule.h @@ -891,48 +891,75 @@ * properties. Property lists are deleted by closing the associated handles. * * \ref PLCR + *
* \snippet{doc} tables/propertyLists.dox plcr_table + *
* * \ref PLCR + *
* \snippet{doc} tables/propertyLists.dox plcra_table + *
* * \ref PLCR / \ref OCPL / \ref GCPL + *
* \snippet{doc} tables/propertyLists.dox fcpl_table + *
* * \ref PLCR + *
* \snippet{doc} tables/propertyLists.dox fapl_table * \snippet{doc} tables/propertyLists.dox fd_pl_table + *
* * \ref PLCR + *
* \snippet{doc} tables/propertyLists.dox lapl_table + *
* * \ref PLCR / \ref OCPL + *
* \snippet{doc} tables/propertyLists.dox dcpl_table + *
* * \ref PLCR / \ref LAPL + *
* \snippet{doc} tables/propertyLists.dox dapl_table + *
* * \ref PLCR / \ref OCPL + *
* \snippet{doc} tables/propertyLists.dox gcpl_table + *
* * \ref PLCR / \ref LAPL + *
* \snippet{doc} tables/propertyLists.dox gapl_table + *
* * \ref PLCR + *
* \snippet{doc} tables/propertyLists.dox ocpl_table + *
* * \ref PLCR + *
* \snippet{doc} tables/propertyLists.dox ocpypl_table + *
* * \ref PLCR + *
* \snippet{doc} tables/propertyLists.dox strcpl_table + *
* * \ref PLCR / \ref STRCPL + *
* \snippet{doc} tables/propertyLists.dox lcpl_table + *
* * \ref PLCR / \ref STRCPL + *
* \snippet{doc} tables/propertyLists.dox acpl_table - * + *
* * \defgroup STRCPL String Creation Properties * \ingroup H5P @@ -941,30 +968,33 @@ * choice of a character encoding, applies to both attributes and links. * The second creation property applies to links only, and advises the library * to automatically create missing intermediate groups when creating new objects. - * + *
* \snippet{doc} tables/propertyLists.dox strcpl_table + *
* * \defgroup LCPL Link Creation Properties * \ingroup STRCPL * This creation property applies to links only, and advises the library * to automatically create missing intermediate groups when creating new objects. - * + *
* \snippet{doc} tables/propertyLists.dox lcpl_table - * + *
* @see STRCPL * * \defgroup ACPL Attribute Creation Properties * \ingroup STRCPL * The creation property, the choice of a character encoding, applies to attributes. - * + *
* \snippet{doc} tables/propertyLists.dox acpl_table + *
* * @see STRCPL * * \defgroup LAPL Link Access Properties * \ingroup H5P - * + *
* \snippet{doc} tables/propertyLists.dox lapl_table + *
* * \defgroup DAPL Dataset Access Properties * \ingroup LAPL @@ -974,8 +1004,9 @@ * dataset file paths, and controlling flush behavior, etc. These properties * are \Emph{not} persisted with datasets, and can be adjusted at runtime before * a dataset is created or opened. - * + *
* \snippet{doc} tables/propertyLists.dox dapl_table + *
* * \defgroup DCPL Dataset Creation Properties * \ingroup OCPL @@ -984,8 +1015,9 @@ * Unlike dataset access and transfer properties, creation properties \Emph{are} * stored with the dataset, and cannot be changed once a dataset has been * created. - * + *
* \snippet{doc} tables/propertyLists.dox dcpl_table + *
* * \defgroup DXPL Dataset Transfer Properties * \ingroup H5P @@ -993,8 +1025,9 @@ * and writing datasets such as transformations, MPI-IO I/O mode, error * detection, etc. These properties are \Emph{not} persisted with datasets, * and can be adjusted at runtime before a dataset is read or written. - * + *
* \snippet{doc} tables/propertyLists.dox dxpl_table + *
* * \defgroup FAPL File Access Properties * \ingroup H5P @@ -1003,9 +1036,10 @@ * file driver (VFD), configuring the metadata cache (MDC), control * file locking, etc. These properties are \Emph{not} persisted with files, and * can be adjusted at runtime before a file is created or opened. - * + *
* \snippet{doc} tables/propertyLists.dox fapl_table * \snippet{doc} tables/propertyLists.dox fd_pl_table + *
* * \defgroup FCPL File Creation Properties * \ingroup GCPL @@ -1014,14 +1048,16 @@ * Unlike file access properties, creation properties \Emph{are} * stored with the file, and cannot be changed once a file has been * created. - * + *
* \snippet{doc} tables/propertyLists.dox fcpl_table + *
* * \defgroup GAPL Group Access Properties * \ingroup LAPL * The functions in this section can be applied to group property lists. - * + *
* \snippet{doc} tables/propertyLists.dox gapl_table + *
* * \defgroup GCPL Group Creation Properties * \ingroup OCPL @@ -1030,32 +1066,37 @@ * Unlike file access properties, creation properties \Emph{are} * stored with the group, and cannot be changed once a group has been * created. - * + *
* \snippet{doc} tables/propertyLists.dox gcpl_table + *
* * \defgroup PLCR Property List Class Root * \ingroup H5P * Use the functions in this module to manage HDF5 property lists. - * + *
* \snippet{doc} tables/propertyLists.dox plcr_table + *
* * \defgroup PLCRA Property List Class Root (Advanced) * \ingroup H5P * You can create and customize user-defined property list classes using the * functions described below. Arbitrary user-defined properties can also * be inserted into existing property lists as so-called temporary properties. - * + *
* \snippet{doc} tables/propertyLists.dox plcra_table + *
* * \defgroup OCPL Object Creation Properties * \ingroup H5P - * + *
* \snippet{doc} tables/propertyLists.dox ocpl_table + *
* * \defgroup OCPYPL Object Copy Properties * \ingroup H5P - * + *
* \snippet{doc} tables/propertyLists.dox ocpypl_table + *
* * \defgroup FMPL File Mount Properties * \ingroup H5P diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c index ca70e1a6204..721e141a38a 100644 --- a/src/H5Pocpl.c +++ b/src/H5Pocpl.c @@ -246,7 +246,7 @@ H5Pget_attr_phase_change(hid_t plist_id, unsigned *max_compact /*out*/, unsigned herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ixx", plist_id, max_compact, min_dense); + H5TRACE3("e", "i*Iu*Iu", plist_id, max_compact, min_dense); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) @@ -330,7 +330,7 @@ H5Pget_attr_creation_order(hid_t plist_id, unsigned *crt_order_flags /*out*/) herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, crt_order_flags); + H5TRACE2("e", "i*Iu", plist_id, crt_order_flags); /* Get values */ if (crt_order_flags) { @@ -427,7 +427,7 @@ H5Pget_obj_track_times(hid_t plist_id, hbool_t *track_times /*out*/) herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, track_times); + H5TRACE2("e", "i*b", plist_id, track_times); /* Get values */ if (track_times) { @@ -756,7 +756,7 @@ H5Pget_nfilters(hid_t plist_id) *------------------------------------------------------------------------- */ H5Z_filter_t -H5Pget_filter2(hid_t plist_id, unsigned idx, unsigned int *flags /*out*/, size_t *cd_nelmts /*in_out*/, +H5Pget_filter2(hid_t plist_id, unsigned idx, unsigned int *flags /*out*/, size_t *cd_nelmts /*in,out*/, unsigned cd_values[] /*out*/, size_t namelen, char name[] /*out*/, unsigned *filter_config /*out*/) { @@ -766,7 +766,8 @@ H5Pget_filter2(hid_t plist_id, unsigned idx, unsigned int *flags /*out*/, size_t H5Z_filter_t ret_value; /* return value */ FUNC_ENTER_API(H5Z_FILTER_ERROR) - H5TRACE8("Zf", "iIux*zxzxx", plist_id, idx, flags, cd_nelmts, cd_values, namelen, name, filter_config); + H5TRACE8("Zf", "iIu*Iu*z*Iuz*s*Iu", plist_id, idx, flags, cd_nelmts, cd_values, namelen, name, + filter_config); /* Check args */ if (cd_nelmts || cd_values) { @@ -837,7 +838,7 @@ H5Pget_filter2(hid_t plist_id, unsigned idx, unsigned int *flags /*out*/, size_t */ herr_t H5P_get_filter_by_id(H5P_genplist_t *plist, H5Z_filter_t id, unsigned int *flags /*out*/, - size_t *cd_nelmts /*in_out*/, unsigned cd_values[] /*out*/, size_t namelen, + size_t *cd_nelmts /*in,out*/, unsigned cd_values[] /*out*/, size_t namelen, char name[] /*out*/, unsigned *filter_config) { H5O_pline_t pline; /* Filter pipeline */ @@ -883,14 +884,15 @@ H5P_get_filter_by_id(H5P_genplist_t *plist, H5Z_filter_t id, unsigned int *flags */ herr_t H5Pget_filter_by_id2(hid_t plist_id, H5Z_filter_t id, unsigned int *flags /*out*/, - size_t *cd_nelmts /*in_out*/, unsigned cd_values[] /*out*/, size_t namelen, + size_t *cd_nelmts /*in,out*/, unsigned cd_values[] /*out*/, size_t namelen, char name[] /*out*/, unsigned *filter_config /*out*/) { H5P_genplist_t *plist; /* Property list */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE8("e", "iZfx*zxzxx", plist_id, id, flags, cd_nelmts, cd_values, namelen, name, filter_config); + H5TRACE8("e", "iZf*Iu*z*Iuz*s*Iu", plist_id, id, flags, cd_nelmts, cd_values, namelen, name, + filter_config); /* Check args */ if (id < 0 || id > H5Z_FILTER_MAX) @@ -1139,7 +1141,7 @@ H5Pset_fletcher32(hid_t plist_id) *------------------------------------------------------------------------- */ herr_t -H5P__get_filter(const H5Z_filter_info_t *filter, unsigned int *flags /*out*/, size_t *cd_nelmts /*in_out*/, +H5P__get_filter(const H5Z_filter_info_t *filter, unsigned int *flags /*out*/, size_t *cd_nelmts /*in,out*/, unsigned cd_values[] /*out*/, size_t namelen, char name[] /*out*/, unsigned *filter_config /*out*/) { @@ -1656,7 +1658,7 @@ H5P__ocrt_pipeline_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED *------------------------------------------------------------------------- */ H5Z_filter_t -H5Pget_filter1(hid_t plist_id, unsigned idx, unsigned int *flags /*out*/, size_t *cd_nelmts /*in_out*/, +H5Pget_filter1(hid_t plist_id, unsigned idx, unsigned int *flags /*out*/, size_t *cd_nelmts /*in,out*/, unsigned cd_values[] /*out*/, size_t namelen, char name[] /*out*/) { H5O_pline_t pline; /* Filter pipeline */ @@ -1665,7 +1667,7 @@ H5Pget_filter1(hid_t plist_id, unsigned idx, unsigned int *flags /*out*/, size_t H5Z_filter_t ret_value; /* return value */ FUNC_ENTER_API(H5Z_FILTER_ERROR) - H5TRACE7("Zf", "iIux*zxzx", plist_id, idx, flags, cd_nelmts, cd_values, namelen, name); + H5TRACE7("Zf", "iIu*Iu*z*Iuz*s", plist_id, idx, flags, cd_nelmts, cd_values, namelen, name); /* Check args */ if (cd_nelmts || cd_values) { @@ -1735,14 +1737,14 @@ H5Pget_filter1(hid_t plist_id, unsigned idx, unsigned int *flags /*out*/, size_t */ herr_t H5Pget_filter_by_id1(hid_t plist_id, H5Z_filter_t id, unsigned int *flags /*out*/, - size_t *cd_nelmts /*in_out*/, unsigned cd_values[] /*out*/, size_t namelen, + size_t *cd_nelmts /*in,out*/, unsigned cd_values[] /*out*/, size_t namelen, char name[] /*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE7("e", "iZfx*zxzx", plist_id, id, flags, cd_nelmts, cd_values, namelen, name); + H5TRACE7("e", "iZf*Iu*z*Iuz*s", plist_id, id, flags, cd_nelmts, cd_values, namelen, name); /* Check args */ if (id < 0 || id > H5Z_FILTER_MAX) diff --git a/src/H5Pocpypl.c b/src/H5Pocpypl.c index 869e36304d2..113caa95769 100644 --- a/src/H5Pocpypl.c +++ b/src/H5Pocpypl.c @@ -646,7 +646,7 @@ H5Pget_copy_object(hid_t plist_id, unsigned *cpy_option /*out*/) herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, cpy_option); + H5TRACE2("e", "i*Iu", plist_id, cpy_option); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY))) @@ -839,7 +839,7 @@ H5Pget_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t *func /*out*/, void * herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ixx", plist_id, func, op_data); + H5TRACE3("e", "i*Os**x", plist_id, func, op_data); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY))) diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 98b7c2f9274..721f3d7628e 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -3360,8 +3360,9 @@ H5_DLL herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, siz * * Valid driver identifiers distributed with HDF5 are listed and * described in the following table. - * + *
* \snippet{doc} tables/fileDriverLists.dox supported_file_driver_table + *
* * This list does not include custom drivers that might be * defined and registered by a user. diff --git a/src/H5Pstrcpl.c b/src/H5Pstrcpl.c index 86c3754844f..b23a6fd6236 100644 --- a/src/H5Pstrcpl.c +++ b/src/H5Pstrcpl.c @@ -175,7 +175,7 @@ H5Pget_char_encoding(hid_t plist_id, H5T_cset_t *encoding /*out*/) herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", plist_id, encoding); + H5TRACE2("e", "i*Tc", plist_id, encoding); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_STRING_CREATE))) diff --git a/src/H5R.c b/src/H5R.c index 8f0717460e2..8c2d88ad7fd 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -980,7 +980,7 @@ H5Rget_obj_type3(H5R_ref_t *ref_ptr, hid_t rapl_id, H5O_type_t *obj_type /*out*/ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "*Rrix", ref_ptr, rapl_id, obj_type); + H5TRACE3("e", "*Rri*Ot", ref_ptr, rapl_id, obj_type); /* Check args */ if (ref_ptr == NULL) @@ -1039,7 +1039,7 @@ H5Rget_file_name(const H5R_ref_t *ref_ptr, char *buf /*out*/, size_t size) ssize_t ret_value; /* Return value */ FUNC_ENTER_API((-1)) - H5TRACE3("Zs", "*Rrxz", ref_ptr, buf, size); + H5TRACE3("Zs", "*Rr*sz", ref_ptr, buf, size); /* Check args */ if (ref_ptr == NULL) @@ -1105,7 +1105,7 @@ H5Rget_obj_name(H5R_ref_t *ref_ptr, hid_t rapl_id, char *buf /*out*/, size_t siz ssize_t ret_value = 0; /* Return value */ FUNC_ENTER_API((-1)) - H5TRACE4("Zs", "*Rrixz", ref_ptr, rapl_id, buf, size); + H5TRACE4("Zs", "*Rri*sz", ref_ptr, rapl_id, buf, size); /* Check args */ if (ref_ptr == NULL) @@ -1167,7 +1167,7 @@ H5Rget_attr_name(const H5R_ref_t *ref_ptr, char *buf /*out*/, size_t size) ssize_t ret_value; /* Return value */ FUNC_ENTER_API((-1)) - H5TRACE3("Zs", "*Rrxz", ref_ptr, buf, size); + H5TRACE3("Zs", "*Rr*sz", ref_ptr, buf, size); /* Check args */ if (ref_ptr == NULL) diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index 1d12ebae25a..0637eae3df0 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -528,7 +528,7 @@ H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, H5O_type_t *obj herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "iRt*xx", id, ref_type, ref, obj_type); + H5TRACE4("e", "iRt*x*Ot", id, ref_type, ref, obj_type); /* Check args */ if (buf == NULL) @@ -766,7 +766,7 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *ref, char *name /*out*/, ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) - H5TRACE5("Zs", "iRt*xxz", id, ref_type, ref, name, size); + H5TRACE5("Zs", "iRt*x*sz", id, ref_type, ref, name, size); /* Check args */ if (buf == NULL) diff --git a/src/H5S.c b/src/H5S.c index 3eb9ecd2284..c58176e3243 100644 --- a/src/H5S.c +++ b/src/H5S.c @@ -877,7 +877,7 @@ H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[] /*out*/, hsize_t maxdim int ret_value = -1; FUNC_ENTER_API((-1)) - H5TRACE3("Is", "ixx", space_id, dims, maxdims); + H5TRACE3("Is", "i*h*h", space_id, dims, maxdims); /* Check args */ if (NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 84944a0677d..344351e05be 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -4821,7 +4821,7 @@ H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock, hsize_t numbloc herr_t ret_value; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "ihhx", spaceid, startblock, numblocks, buf); + H5TRACE4("e", "ihh*[a2]h", spaceid, startblock, numblocks, buf); /* Check args */ if (buf == NULL) @@ -12431,7 +12431,7 @@ H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[] /*out*/, hsize_t stride[ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE5("e", "ixxxx", spaceid, start, stride, count, block); + H5TRACE5("e", "i*h*h*h*h", spaceid, start, stride, count, block); /* Check args */ if (NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE))) diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 48a8a0eaa04..c95429dcfee 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -1625,7 +1625,7 @@ H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint, hsize_t numpoint herr_t ret_value; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "ihhx", spaceid, startpoint, numpoints, buf); + H5TRACE4("e", "ihh*[a2]h", spaceid, startpoint, numpoints, buf); /* Check args */ if (NULL == buf) diff --git a/src/H5Sselect.c b/src/H5Sselect.c index 13440cd64f5..7c1a8eb263f 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -596,7 +596,7 @@ H5Sget_select_bounds(hid_t spaceid, hsize_t start[] /*out*/, hsize_t end[] /*out herr_t ret_value; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ixx", spaceid, start, end); + H5TRACE3("e", "i*h*h", spaceid, start, end); /* Check args */ if (start == NULL || end == NULL) @@ -2901,7 +2901,7 @@ H5Ssel_iter_get_seq_list(hid_t sel_iter_id, size_t maxseq, size_t maxelmts, size herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE7("e", "izzxxxx", sel_iter_id, maxseq, maxelmts, nseq, nelmts, off, len); + H5TRACE7("e", "izz*z*z*h*z", sel_iter_id, maxseq, maxelmts, nseq, nelmts, off, len); /* Check args */ if (NULL == (sel_iter = (H5S_sel_iter_t *)H5I_object_verify(sel_iter_id, H5I_SPACE_SEL_ITER))) diff --git a/src/H5T.c b/src/H5T.c index 09eeff8c2f1..bfe31b8b597 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -2847,7 +2847,7 @@ H5Tfind(hid_t src_id, hid_t dst_id, H5T_cdata_t **pcdata /*out*/) H5T_conv_t ret_value; /* Return value */ FUNC_ENTER_API(NULL) - H5TRACE3("TC", "iix", src_id, dst_id, pcdata); + H5TRACE3("TC", "ii**!", src_id, dst_id, pcdata); /* Check args */ if (NULL == (src = (H5T_t *)H5I_object_verify(src_id, H5I_DATATYPE)) || diff --git a/src/H5Tarray.c b/src/H5Tarray.c index 423baf9d209..fefc57472d9 100644 --- a/src/H5Tarray.c +++ b/src/H5Tarray.c @@ -245,7 +245,7 @@ H5Tget_array_dims2(hid_t type_id, hsize_t dims[] /*out*/) int ret_value; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("Is", "ix", type_id, dims); + H5TRACE2("Is", "i*h", type_id, dims); /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) @@ -364,7 +364,7 @@ H5Tget_array_dims1(hid_t type_id, hsize_t dims[] /*out*/, int H5_ATTR_UNUSED per int ret_value; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("Is", "ixx", type_id, dims, perm); + H5TRACE3("Is", "i*h*Is", type_id, dims, perm); /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) diff --git a/src/H5Tenum.c b/src/H5Tenum.c index 09407b12aee..94db1553dc8 100644 --- a/src/H5Tenum.c +++ b/src/H5Tenum.c @@ -222,7 +222,7 @@ H5Tget_member_value(hid_t type, unsigned membno, void *value /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "iIux", type, membno, value); + H5TRACE3("e", "iIu*x", type, membno, value); if (NULL == (dt = (H5T_t *)H5I_object_verify(type, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); @@ -289,7 +289,7 @@ H5Tenum_nameof(hid_t type, const void *value, char *name /*out*/, size_t size) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "i*xxz", type, value, name, size); + H5TRACE4("e", "i*x*sz", type, value, name, size); /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type, H5I_DATATYPE))) @@ -420,7 +420,7 @@ H5Tenum_valueof(hid_t type, const char *name, void *value /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "i*sx", type, name, value); + H5TRACE3("e", "i*s*x", type, name, value); /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type, H5I_DATATYPE))) diff --git a/src/H5Tfloat.c b/src/H5Tfloat.c index 01a5607261e..c580e227b6a 100644 --- a/src/H5Tfloat.c +++ b/src/H5Tfloat.c @@ -47,7 +47,7 @@ H5Tget_fields(hid_t type_id, size_t *spos /*out*/, size_t *epos /*out*/, size_t herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE6("e", "ixxxxx", type_id, spos, epos, esize, mpos, msize); + H5TRACE6("e", "i*z*z*z*z*z", type_id, spos, epos, esize, mpos, msize); /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) @@ -106,11 +106,11 @@ H5Tset_fields(hid_t type_id, size_t spos, size_t epos, size_t esize, size_t mpos dt = dt->shared->parent; /*defer to parent*/ if (H5T_FLOAT != dt->shared->type) HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "operation not defined for datatype class"); - if (epos + esize > dt->shared->u.atomic.prec) + if (epos + esize - dt->shared->u.atomic.offset > dt->shared->u.atomic.prec) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "exponent bit field size/location is invalid"); - if (mpos + msize > dt->shared->u.atomic.prec) + if (mpos + msize - dt->shared->u.atomic.offset > dt->shared->u.atomic.prec) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mantissa bit field size/location is invalid"); - if (spos >= dt->shared->u.atomic.prec) + if (spos - dt->shared->u.atomic.offset >= dt->shared->u.atomic.prec) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sign location is not valid"); /* Check for overlap */ diff --git a/src/H5Tmodule.h b/src/H5Tmodule.h index b4f9289ec71..f1b7b175f2e 100644 --- a/src/H5Tmodule.h +++ b/src/H5Tmodule.h @@ -3892,30 +3892,42 @@ filled according to the value of this property. The padding can be: * \details CPU-specific datatypes * \defgroup PDTALPHA DEC Alpha * \ingroup PDTCPU + *
* \snippet{doc} tables/predefinedDatatypes.dox predefined_dec_datatypes_table + *
* \defgroup PDTX86 AMD & INTEL * \ingroup PDTCPU + *
* \snippet{doc} tables/predefinedDatatypes.dox predefined_intel_datatypes_table + *
* \defgroup PDTMIPS SGI MIPS * \ingroup PDTCPU + *
* \snippet{doc} tables/predefinedDatatypes.dox predefined_mips_datatypes_table + *
* * \defgroup PDTIEEE IEEE * \ingroup PDT * \details The IEEE floating point types in big- and little-endian byte orders. + *
* \snippet{doc} tables/predefinedDatatypes.dox predefined_ieee_datatypes_table + *
* * \defgroup PDTSTD Standard Datatypes * \ingroup PDT * \details These are "standard" types. For instance, signed (2's complement) * and unsigned integers of various sizes in big- and little-endian * byte orders. + *
* \snippet{doc} tables/predefinedDatatypes.dox predefined_std_datatypes_table + *
* * \defgroup PDTUNIX UNIX-specific Datatypes * \ingroup PDT * \details Types which are particular to Unix. + *
* \snippet{doc} tables/predefinedDatatypes.dox predefined_unix_datatypes_table + *
* * \defgroup PDTNAT Native Datatypes * \ingroup PDT @@ -3928,16 +3940,22 @@ filled according to the value of this property. The padding can be: * \li The datatype \c LLONG corresponds C's \Code{long long} and * \c LDOUBLE is \Code{long double}. These types might be the same * as \c LONG and \c DOUBLE, respectively. + *
* \snippet{doc} tables/predefinedDatatypes.dox predefined_native_datatypes_table + *
* * \defgroup PDTC9x C9x Integer Datatypes * \ingroup PDTNAT * \details C9x integer types + *
* \snippet{doc} tables/predefinedDatatypes.dox predefined_c9x_datatypes_table + *
* * \defgroup PDTS Strings * \ingroup PDT + *
* \snippet{doc} tables/predefinedDatatypes.dox predefined_string_datatypes_table + *
* */ diff --git a/src/H5Tpad.c b/src/H5Tpad.c index 6487138bd03..6e164f883cf 100644 --- a/src/H5Tpad.c +++ b/src/H5Tpad.c @@ -40,7 +40,7 @@ H5Tget_pad(hid_t type_id, H5T_pad_t *lsb /*out*/, H5T_pad_t *msb /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ixx", type_id, lsb, msb); + H5TRACE3("e", "i*Tp*Tp", type_id, lsb, msb); /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h index a1170755f43..abf64d970ef 100644 --- a/src/H5Tpublic.h +++ b/src/H5Tpublic.h @@ -2568,6 +2568,17 @@ H5_DLL herr_t H5Tset_sign(hid_t type_id, H5T_sign_t sign); * Fields are not allowed to extend beyond the number of bits of * precision, nor are they allowed to overlap with one another. * + * \note The size and precision of, as well as any offset for, a floating-point + * datatype should generally be set appropriately before calling + * H5Tset_fields(). Otherwise, H5Tset_fields() may fail when checking that + * the values make sense for the datatype. However, if the precision of a + * floating-point datatype will be decreased during its creation with a call + * to H5Tset_precision(), then H5Tset_fields() should instead be called + * first to set appropriate values for \p spos, \p epos, \p esize, \p mpos + * and \p msize before reducing the precision of the datatype with + * H5Tset_precision(). This is of particular concern if another floating-point + * datatype was copied as a starting point. + * * \since 1.0.0 * */ diff --git a/src/H5VL.c b/src/H5VL.c index 1b5186bf793..8e68f018e8b 100644 --- a/src/H5VL.c +++ b/src/H5VL.c @@ -420,7 +420,7 @@ H5VLget_connector_name(hid_t obj_id, char *name /*out*/, size_t size) ssize_t ret_value = -1; FUNC_ENTER_API(FAIL) - H5TRACE3("Zs", "ixz", obj_id, name, size); + H5TRACE3("Zs", "i*sz", obj_id, name, size); /* Call internal routine */ if ((ret_value = H5VL__get_connector_name(obj_id, name, size)) < 0) @@ -770,7 +770,7 @@ H5VLretrieve_lib_state(void **state /*out*/) /* Must use this, to avoid modifying the API context stack in FUNC_ENTER */ FUNC_ENTER_API_NOINIT - H5TRACE1("e", "x", state); + H5TRACE1("e", "**x", state); /* Check args */ if (NULL == state) @@ -938,7 +938,7 @@ H5VLquery_optional(hid_t obj_id, H5VL_subclass_t subcls, int opt_type, uint64_t herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "iVSIsx", obj_id, subcls, opt_type, flags); + H5TRACE4("e", "iVSIs*UL", obj_id, subcls, opt_type, flags); /* Check args */ if (NULL == flags) @@ -989,7 +989,7 @@ H5VLregister_opt_operation(H5VL_subclass_t subcls, const char *op_name, int *op_ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "VS*sx", subcls, op_name, op_val); + H5TRACE3("e", "VS*s*Is", subcls, op_name, op_val); /* Check args */ if (NULL == op_val) @@ -1028,7 +1028,7 @@ H5VLfind_opt_operation(H5VL_subclass_t subcls, const char *op_name, int *op_val herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "VS*sx", subcls, op_name, op_val); + H5TRACE3("e", "VS*s*Is", subcls, op_name, op_val); /* Check args */ if (NULL == op_val) diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index fe0f0aae150..0d7cd1b96bf 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -284,7 +284,7 @@ H5VLget_cap_flags(hid_t connector_id, uint64_t *cap_flags /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE2("e", "ix", connector_id, cap_flags); + H5TRACE2("e", "i*UL", connector_id, cap_flags); /* Check args */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) @@ -315,7 +315,7 @@ H5VLget_value(hid_t connector_id, H5VL_class_value_t *value /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE2("e", "ix", connector_id, value); + H5TRACE2("e", "i*VC", connector_id, value); /* Check args */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) @@ -663,7 +663,7 @@ H5VLconnector_str_to_info(const char *str, hid_t connector_id, void **info /*out herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE3("e", "*six", str, connector_id, info); + H5TRACE3("e", "*si**x", str, connector_id, info); /* Call internal routine */ if (H5VL__connector_str_to_info(str, connector_id, info) < 0) @@ -763,7 +763,7 @@ H5VLget_wrap_ctx(void *obj, hid_t connector_id, void **wrap_ctx /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE3("e", "*xix", obj, connector_id, wrap_ctx); + H5TRACE3("e", "*xi**x", obj, connector_id, wrap_ctx); /* Check args and get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) @@ -1060,8 +1060,8 @@ H5VLattr_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_ void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE10("*x", "*x*#i*siiiiix", obj, loc_params, connector_id, name, type_id, space_id, acpl_id, aapl_id, - dxpl_id, req); + H5TRACE10("*x", "*x*#i*siiiii**x", obj, loc_params, connector_id, name, type_id, space_id, acpl_id, + aapl_id, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -1163,7 +1163,7 @@ H5VLattr_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE7("*x", "*x*#i*siix", obj, loc_params, connector_id, name, aapl_id, dxpl_id, req); + H5TRACE7("*x", "*x*#i*sii**x", obj, loc_params, connector_id, name, aapl_id, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -1260,7 +1260,7 @@ H5VLattr_read(void *obj, hid_t connector_id, hid_t mem_type_id, void *buf, hid_t herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xii*xix", obj, connector_id, mem_type_id, buf, dxpl_id, req); + H5TRACE6("e", "*xii*xi**x", obj, connector_id, mem_type_id, buf, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -1359,7 +1359,7 @@ H5VLattr_write(void *obj, hid_t connector_id, hid_t mem_type_id, const void *buf herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xii*xix", obj, connector_id, mem_type_id, buf, dxpl_id, req); + H5TRACE6("e", "*xii*xi**x", obj, connector_id, mem_type_id, buf, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -1456,7 +1456,7 @@ H5VLattr_get(void *obj, hid_t connector_id, H5VL_attr_get_args_t *args, hid_t dx herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); + H5TRACE5("e", "*xi*!i**x", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -1561,7 +1561,7 @@ H5VLattr_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req); + H5TRACE6("e", "*x*#i*!i**x", obj, loc_params, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -1662,7 +1662,7 @@ H5VLattr_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); + H5TRACE5("e", "*xi*!i**x", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -1796,7 +1796,7 @@ H5VLattr_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE4("e", "*xiix", obj, connector_id, dxpl_id, req); + H5TRACE4("e", "*xii**x", obj, connector_id, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -1902,7 +1902,7 @@ H5VLdataset_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connect void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE11("*x", "*x*#i*siiiiiix", obj, loc_params, connector_id, name, lcpl_id, type_id, space_id, + H5TRACE11("*x", "*x*#i*siiiiii**x", obj, loc_params, connector_id, name, lcpl_id, type_id, space_id, dcpl_id, dapl_id, dxpl_id, req); /* Check args and get class pointer */ @@ -2005,7 +2005,7 @@ H5VLdataset_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE7("*x", "*x*#i*siix", obj, loc_params, connector_id, name, dapl_id, dxpl_id, req); + H5TRACE7("*x", "*x*#i*sii**x", obj, loc_params, connector_id, name, dapl_id, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -2182,7 +2182,7 @@ H5VLdataset_read(size_t count, void *obj[], hid_t connector_id, hid_t mem_type_i herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE9("e", "z**xi*i*i*ii**xx", count, obj, connector_id, mem_type_id, mem_space_id, file_space_id, + H5TRACE9("e", "z**xi*i*i*ii**x**x", count, obj, connector_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req); /* Check args and get class pointer */ @@ -2372,7 +2372,7 @@ H5VLdataset_write(size_t count, void *obj[], hid_t connector_id, hid_t mem_type_ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE9("e", "z**xi*i*i*ii**xx", count, obj, connector_id, mem_type_id, mem_space_id, file_space_id, + H5TRACE9("e", "z**xi*i*i*ii**x**x", count, obj, connector_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req); /* Check args and get class pointer */ @@ -2483,7 +2483,7 @@ H5VLdataset_get(void *obj, hid_t connector_id, H5VL_dataset_get_args_t *args, hi herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); + H5TRACE5("e", "*xi*!i**x", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -2583,7 +2583,7 @@ H5VLdataset_specific(void *obj, hid_t connector_id, H5VL_dataset_specific_args_t herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); + H5TRACE5("e", "*xi*!i**x", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -2682,7 +2682,7 @@ H5VLdataset_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); + H5TRACE5("e", "*xi*!i**x", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -2832,7 +2832,7 @@ H5VLdataset_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*out herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE4("e", "*xiix", obj, connector_id, dxpl_id, req); + H5TRACE4("e", "*xii**x", obj, connector_id, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -2936,8 +2936,8 @@ H5VLdatatype_commit(void *obj, const H5VL_loc_params_t *loc_params, hid_t connec void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE10("*x", "*x*#i*siiiiix", obj, loc_params, connector_id, name, type_id, lcpl_id, tcpl_id, tapl_id, - dxpl_id, req); + H5TRACE10("*x", "*x*#i*siiiii**x", obj, loc_params, connector_id, name, type_id, lcpl_id, tcpl_id, + tapl_id, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -3039,7 +3039,7 @@ H5VLdatatype_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE7("*x", "*x*#i*siix", obj, loc_params, connector_id, name, tapl_id, dxpl_id, req); + H5TRACE7("*x", "*x*#i*sii**x", obj, loc_params, connector_id, name, tapl_id, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -3138,7 +3138,7 @@ H5VLdatatype_get(void *obj, hid_t connector_id, H5VL_datatype_get_args_t *args, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); + H5TRACE5("e", "*xi*!i**x", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -3238,7 +3238,7 @@ H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_args herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); + H5TRACE5("e", "*xi*!i**x", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -3381,7 +3381,7 @@ H5VLdatatype_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); + H5TRACE5("e", "*xi*!i**x", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -3525,7 +3525,7 @@ H5VLdatatype_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*ou herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE4("e", "*xiix", obj, connector_id, dxpl_id, req); + H5TRACE4("e", "*xii**x", obj, connector_id, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -3628,7 +3628,7 @@ H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("*x", "*sIuiiix", name, flags, fcpl_id, fapl_id, dxpl_id, req); + H5TRACE6("*x", "*sIuiii**x", name, flags, fcpl_id, fapl_id, dxpl_id, req); /* Get the VOL info from the fapl */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) @@ -3889,7 +3889,7 @@ H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, vo void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("*x", "*sIuiix", name, flags, fapl_id, dxpl_id, req); + H5TRACE5("*x", "*sIuii**x", name, flags, fapl_id, dxpl_id, req); /* Get the VOL info from the fapl */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) @@ -3990,7 +3990,7 @@ H5VLfile_get(void *obj, hid_t connector_id, H5VL_file_get_args_t *args, hid_t dx herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); + H5TRACE5("e", "*xi*!i**x", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -4125,7 +4125,7 @@ H5VLfile_specific(void *obj, hid_t connector_id, H5VL_file_specific_args_t *args herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); + H5TRACE5("e", "*xi*!i**x", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) @@ -4221,7 +4221,7 @@ H5VLfile_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); + H5TRACE5("e", "*xi*!i**x", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -4365,7 +4365,7 @@ H5VLfile_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE4("e", "*xiix", obj, connector_id, dxpl_id, req); + H5TRACE4("e", "*xii**x", obj, connector_id, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -4467,7 +4467,7 @@ H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE9("*x", "*x*#i*siiiix", obj, loc_params, connector_id, name, lcpl_id, gcpl_id, gapl_id, dxpl_id, + H5TRACE9("*x", "*x*#i*siiii**x", obj, loc_params, connector_id, name, lcpl_id, gcpl_id, gapl_id, dxpl_id, req); /* Check args and get class pointer */ @@ -4570,7 +4570,7 @@ H5VLgroup_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_i void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE7("*x", "*x*#i*siix", obj, loc_params, connector_id, name, gapl_id, dxpl_id, req); + H5TRACE7("*x", "*x*#i*sii**x", obj, loc_params, connector_id, name, gapl_id, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -4667,7 +4667,7 @@ H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_args_t *args, hid_t herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); + H5TRACE5("e", "*xi*!i**x", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -4766,7 +4766,7 @@ H5VLgroup_specific(void *obj, hid_t connector_id, H5VL_group_specific_args_t *ar herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); + H5TRACE5("e", "*xi*!i**x", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -4867,7 +4867,7 @@ H5VLgroup_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hi herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); + H5TRACE5("e", "*xi*!i**x", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -5012,7 +5012,7 @@ H5VLgroup_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*out*/ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE4("e", "*xiix", obj, connector_id, dxpl_id, req); + H5TRACE4("e", "*xii**x", obj, connector_id, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -5127,7 +5127,7 @@ H5VLlink_create(H5VL_link_create_args_t *args, void *obj, const H5VL_loc_params_ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE8("e", "*!*x*#iiiix", args, obj, loc_params, connector_id, lcpl_id, lapl_id, dxpl_id, req); + H5TRACE8("e", "*!*x*#iiii**x", args, obj, loc_params, connector_id, lcpl_id, lapl_id, dxpl_id, req); /* Get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) @@ -5233,8 +5233,8 @@ H5VLlink_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE9("e", "*x*#*x*#iiiix", src_obj, loc_params1, dst_obj, loc_params2, connector_id, lcpl_id, lapl_id, - dxpl_id, req); + H5TRACE9("e", "*x*#*x*#iiii**x", src_obj, loc_params1, dst_obj, loc_params2, connector_id, lcpl_id, + lapl_id, dxpl_id, req); /* Get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) @@ -5340,8 +5340,8 @@ H5VLlink_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE9("e", "*x*#*x*#iiiix", src_obj, loc_params1, dst_obj, loc_params2, connector_id, lcpl_id, lapl_id, - dxpl_id, req); + H5TRACE9("e", "*x*#*x*#iiii**x", src_obj, loc_params1, dst_obj, loc_params2, connector_id, lcpl_id, + lapl_id, dxpl_id, req); /* Get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) @@ -5439,7 +5439,7 @@ H5VLlink_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req); + H5TRACE6("e", "*x*#i*!i**x", obj, loc_params, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -5542,7 +5542,7 @@ H5VLlink_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req); + H5TRACE6("e", "*x*#i*!i**x", obj, loc_params, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -5643,7 +5643,7 @@ H5VLlink_optional(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req); + H5TRACE6("e", "*x*#i*!i**x", obj, loc_params, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -5805,7 +5805,7 @@ H5VLobject_open(void *obj, const H5VL_loc_params_t *params, hid_t connector_id, void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("*x", "*x*#i*Itix", obj, params, connector_id, opened_type, dxpl_id, req); + H5TRACE6("*x", "*x*#i*Iti**x", obj, params, connector_id, opened_type, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -5915,8 +5915,8 @@ H5VLobject_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, const ch herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE11("e", "*x*#*s*x*#*siiiix", src_obj, src_loc_params, src_name, dst_obj, dst_loc_params, dst_name, - connector_id, ocpypl_id, lcpl_id, dxpl_id, req); + H5TRACE11("e", "*x*#*s*x*#*siiii**x", src_obj, src_loc_params, src_name, dst_obj, dst_loc_params, + dst_name, connector_id, ocpypl_id, lcpl_id, dxpl_id, req); /* Check args and get class pointers */ if (NULL == src_obj || NULL == dst_obj) @@ -6017,7 +6017,7 @@ H5VLobject_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_i herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req); + H5TRACE6("e", "*x*#i*!i**x", obj, loc_params, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -6120,7 +6120,7 @@ H5VLobject_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connec herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req); + H5TRACE6("e", "*x*#i*!i**x", obj, loc_params, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -6221,7 +6221,7 @@ H5VLobject_optional(void *obj, const H5VL_loc_params_t *loc_params, hid_t connec herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req); + H5TRACE6("e", "*x*#i*!i**x", obj, loc_params, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -6392,7 +6392,7 @@ H5VLintrospect_get_conn_cls(void *obj, hid_t connector_id, H5VL_get_conn_lvl_t l herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE4("e", "*xiVLx", obj, connector_id, lvl, conn_cls); + H5TRACE4("e", "*xiVL**#", obj, connector_id, lvl, conn_cls); /* Check args */ if (NULL == obj) @@ -6464,7 +6464,7 @@ H5VLintrospect_get_cap_flags(const void *info, hid_t connector_id, uint64_t *cap herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE3("e", "*xix", info, connector_id, cap_flags); + H5TRACE3("e", "*xi*UL", info, connector_id, cap_flags); /* Check args */ if (NULL == cap_flags) @@ -6568,7 +6568,7 @@ H5VLintrospect_opt_query(void *obj, hid_t connector_id, H5VL_subclass_t subcls, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xiVSIsx", obj, connector_id, subcls, opt_type, flags); + H5TRACE5("e", "*xiVSIs*UL", obj, connector_id, subcls, opt_type, flags); /* Get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) @@ -6671,7 +6671,7 @@ H5VLrequest_wait(void *req, hid_t connector_id, uint64_t timeout, H5VL_request_s herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE4("e", "*xiULx", req, connector_id, timeout, status); + H5TRACE4("e", "*xiUL*#", req, connector_id, timeout, status); /* Get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) @@ -6878,7 +6878,7 @@ H5VLrequest_cancel(void *req, hid_t connector_id, H5VL_request_status_t *status herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE3("e", "*xix", req, connector_id, status); + H5TRACE3("e", "*xi*#", req, connector_id, status); /* Get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) @@ -7415,7 +7415,7 @@ H5VLblob_get(void *obj, hid_t connector_id, const void *blob_id, void *buf /*out herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xi*xxz*x", obj, connector_id, blob_id, buf, size, ctx); + H5TRACE6("e", "*xi*x*xz*x", obj, connector_id, blob_id, buf, size, ctx); /* Get class pointer */ if (NULL == obj) @@ -8038,7 +8038,7 @@ H5VLoptional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dx herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); + H5TRACE5("e", "*xi*!i**x", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) diff --git a/src/H5VLmodule.h b/src/H5VLmodule.h index 546b31e577a..19baf344d57 100644 --- a/src/H5VLmodule.h +++ b/src/H5VLmodule.h @@ -606,15 +606,21 @@ * fact, implement some of this functionality as it is possible to mimic the native * HDF5 connector, however this will probably not be true for most non-native * VOL connectors. + *
* \snippet{doc} tables/volAPIs.dox vol_native_table + *
* * \subsubsection subsubsec_vol_compat_indep List of HDF5 VOL-Independent API Calls * These HDF5 API calls do not depend on a particular VOL connector being loaded. + *
* \snippet{doc} tables/volAPIs.dox vol_independent_table + *
* * \subsubsection subsubsec_vol_compat_opt List of Native VOL Optional Operation Values By Subclass * These values can be passed to the opt type parameter of H5VLquery optional(). + *
* \snippet{doc} tables/volAPIs.dox vol_optional_table + *
* * * diff --git a/src/H5Z.c b/src/H5Z.c index 720aa439c36..7bfb1344c19 100644 --- a/src/H5Z.c +++ b/src/H5Z.c @@ -1713,7 +1713,7 @@ H5Zget_filter_info(H5Z_filter_t filter, unsigned *filter_config_flags /*out*/) herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE2("e", "Zfx", filter, filter_config_flags); + H5TRACE2("e", "Zf*Iu", filter, filter_config_flags); /* Get the filter info */ if (H5Z_get_filter_info(filter, filter_config_flags) < 0) diff --git a/src/H5checksum.c b/src/H5checksum.c index 66a6c86c6e3..6eafc0dbe35 100644 --- a/src/H5checksum.c +++ b/src/H5checksum.c @@ -345,7 +345,7 @@ the return value. Two keys differing by one or two bits will have totally different hash values. The best hash table sizes are powers of 2. There is no need to do -mod a prime (mod is sooo slow!). If you need less than 32 bits, +mod a prime (mod is so slow!). If you need less than 32 bits, use a bitmask. For example, if you need only 10 bits, do h = (h & hashmask(10)); In which case, the hash table should have hashsize(10) elements. diff --git a/src/H5trace.c b/src/H5trace.c index 7657356ba33..86cf92ecb07 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -23,7 +23,7 @@ /* Module Setup */ /****************/ #include "H5module.h" /* This source code file is part of the H5 module */ -#define H5I_FRIEND /*suppress error about including H5Ipkg */ +#define H5I_FRIEND /* Suppress error about including H5Ipkg */ /***********/ /* Headers */ @@ -40,7 +40,7 @@ #include "H5VLprivate.h" /* Virtual Object Layer */ #ifdef H5_HAVE_PARALLEL -/* datatypes of predefined drivers needed by H5_trace() */ +/* Datatypes of predefined drivers needed by H5_trace() */ #include "H5FDmpio.h" #endif /* H5_HAVE_PARALLEL */ @@ -79,7 +79,7 @@ static herr_t H5_trace_args_close_degree(H5RS_str_t *rs, H5F_close_degree_t degr * Function: H5_trace_args_bool * * Purpose: This routine formats an bool and adds the output to - * the refcounted string (RS) argument. + * the refcounted string (RS) argument. * * Return: SUCCEED / FAIL * @@ -104,7 +104,7 @@ H5_trace_args_bool(H5RS_str_t *rs, bool val) * Function: H5_trace_args_cset * * Purpose: This routine formats an H5T_cset_t and adds the output to - * the refcounted string (RS) argument. + * the refcounted string (RS) argument. * * Return: SUCCEED / FAIL * @@ -148,7 +148,7 @@ H5_trace_args_cset(H5RS_str_t *rs, H5T_cset_t cset) default: H5RS_asprintf_cat(rs, "%ld", (long)cset); break; - } /* end switch */ + } return SUCCEED; } /* end H5_trace_args_cset() */ @@ -197,14 +197,14 @@ H5_trace_args_close_degree(H5RS_str_t *rs, H5F_close_degree_t degree) * Function: H5_trace_args * * Purpose: This routine formats a set of function arguments, placing the - * resulting string in the refcounted string (RS) argument. + * resulting string in the refcounted string (RS) argument. * - * The TYPE argument is a string which gives the type of each of + * The TYPE argument is a string which gives the type of each of * the following argument pairs. Each type begins with zero or - * more asterisks (one for each level of indirection, although - * some types have one level of indirection already implied) - * followed by either one letter (lower case) or two letters - * (first one uppercase). + * more asterisks (one for each level of indirection, although + * some types have one level of indirection already implied) + * followed by either one letter (lower case) or two letters + * (first one uppercase). * * The variable argument list consists of pairs of values. Each * pair is a string which is the formal argument name in the @@ -1480,8 +1480,40 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) H5G_iterate_t git = (H5G_iterate_t)va_arg(ap, H5G_iterate_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)git); - } /* end block */ - break; + } break; + + case 'I': /* H5G_info_t */ + { + H5G_info_t ginfo = va_arg(ap, H5G_info_t); + + H5RS_acat(rs, "{"); + switch (ginfo.storage_type) { + case H5G_STORAGE_TYPE_UNKNOWN: + H5RS_asprintf_cat(rs, "H5G_STORAGE_TYPE_UNKNOWN"); + break; + + case H5G_STORAGE_TYPE_SYMBOL_TABLE: + H5RS_asprintf_cat(rs, "H5G_STORAGE_TYPE_SYMBOL_TABLE"); + break; + + case H5G_STORAGE_TYPE_COMPACT: + H5RS_asprintf_cat(rs, "H5G_STORAGE_TYPE_COMPACT"); + break; + + case H5G_STORAGE_TYPE_DENSE: + H5RS_asprintf_cat(rs, "H5G_STORAGE_TYPE_DENSE"); + break; + + default: + H5RS_asprintf_cat(rs, "%ld", (long)ginfo.storage_type); + break; + } + H5RS_asprintf_cat(rs, ", "); + H5RS_asprintf_cat(rs, "%" PRIuHSIZE ", ", ginfo.nlinks); + H5RS_asprintf_cat(rs, "%" PRId64 ", ", ginfo.max_corder); + H5_trace_args_bool(rs, ginfo.mounted); + H5RS_asprintf_cat(rs, "}"); + } break; case 'o': /* H5G_obj_t */ { diff --git a/src/H5win32defs.h b/src/H5win32defs.h index a9a462860aa..9630c5e2d42 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -50,12 +50,18 @@ struct timezone { #define HDlstat(S, B) _lstati64(S, B) #define HDmkdir(S, M) _mkdir(S) -/* Note that the variadic HDopen macro is using a VC++ extension - * where the comma is dropped if nothing is passed to the ellipsis. +/* Note that with the traditional MSVC preprocessor, the variadic + * HDopen macro uses an MSVC-specific extension where the comma + * is dropped if nothing is passed to the ellipsis. + * + * MinGW and the newer, conforming MSVC preprocessor do not exhibit this + * behavior. */ -#ifndef H5_HAVE_MINGW +#if (defined(_MSC_VER) && !defined(_MSVC_TRADITIONAL)) || _MSVC_TRADITIONAL +/* Using the MSVC traditional preprocessor */ #define HDopen(S, F, ...) Wopen_utf8(S, F, __VA_ARGS__) #else +/* Using a standards conformant preprocessor */ #define HDopen(S, F, ...) Wopen_utf8(S, F, ##__VA_ARGS__) #endif diff --git a/src/Makefile.am b/src/Makefile.am index 2272389c218..e6625777712 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -56,7 +56,7 @@ libhdf5_la_SOURCES= H5.c H5build_settings.c H5checksum.c H5dbg.c H5system.c \ H5FD.c H5FDcore.c H5FDfamily.c H5FDint.c H5FDlog.c H5FDmulti.c \ H5FDonion.c H5FDonion_header.c H5FDonion_history.c H5FDonion_index.c \ H5FDperform.c H5FDsec2.c H5FDspace.c \ - H5FDsplitter.c H5FDstdio.c H5FDtest.c \ + H5FDsplitter.c H5FDstdio.c H5FDtest.c H5FDwindows.c \ H5FL.c H5FO.c H5FS.c H5FScache.c H5FSdbg.c H5FSint.c H5FSsection.c \ H5FSstat.c H5FStest.c \ H5G.c H5Gbtree2.c H5Gcache.c H5Gcompact.c H5Gdense.c H5Gdeprec.c \ diff --git a/test/API/H5_api_async_test.c b/test/API/H5_api_async_test.c index 7777e108acc..6bcbe8d1105 100644 --- a/test/API/H5_api_async_test.c +++ b/test/API/H5_api_async_test.c @@ -369,7 +369,7 @@ test_multi_dataset_io(void) /* Loop over datasets */ for (i = 0; i < 5; i++) { /* Set dataset name */ - sprintf(dset_name, "dset%d", i); + snprintf(dset_name, sizeof(dset_name), "dset%d", i); /* Create the dataset asynchronously */ if ((dset_id[i] = H5Dcreate_async(file_id, dset_name, H5T_NATIVE_INT, space_id, H5P_DEFAULT, @@ -450,7 +450,7 @@ test_multi_dataset_io(void) /* Loop over datasets */ for (i = 0; i < 5; i++) { /* Set dataset name */ - sprintf(dset_name, "dset%d", i); + snprintf(dset_name, sizeof(dset_name), "dset%d", i); /* Open the dataset asynchronously */ if ((dset_id[0] = H5Dopen_async(file_id, dset_name, H5P_DEFAULT, es_id)) < 0) @@ -479,7 +479,7 @@ test_multi_dataset_io(void) /* Loop over datasets */ for (i = 0; i < 5; i++) { /* Set dataset name */ - sprintf(dset_name, "dset%d", i); + snprintf(dset_name, sizeof(dset_name), "dset%d", i); /* Open the dataset asynchronously */ if ((dset_id[0] = H5Dopen_async(file_id, dset_name, H5P_DEFAULT, es_id)) < 0) @@ -619,7 +619,7 @@ test_multi_file_dataset_io(void) /* Loop over files */ for (i = 0; i < 5; i++) { /* Set file name */ - sprintf(file_name, ASYNC_API_TEST_FILE_PRINTF, i); + snprintf(file_name, sizeof(file_name), ASYNC_API_TEST_FILE_PRINTF, i); /* Create file asynchronously */ if ((file_id[i] = @@ -761,7 +761,7 @@ test_multi_file_dataset_io(void) /* Loop over files */ for (i = 0; i < 5; i++) { /* Set file name */ - sprintf(file_name, ASYNC_API_TEST_FILE_PRINTF, i); + snprintf(file_name, sizeof(file_name), ASYNC_API_TEST_FILE_PRINTF, i); /* Open the file asynchronously */ if ((file_id[0] = H5Fopen_async(file_name, H5F_ACC_RDWR, H5P_DEFAULT, es_id)) < 0) @@ -799,7 +799,7 @@ test_multi_file_dataset_io(void) /* Loop over files */ for (i = 0; i < 5; i++) { /* Set file name */ - sprintf(file_name, ASYNC_API_TEST_FILE_PRINTF, i); + snprintf(file_name, sizeof(file_name), ASYNC_API_TEST_FILE_PRINTF, i); /* Open the file asynchronously */ if ((file_id[0] = H5Fopen_async(file_name, H5F_ACC_RDONLY, H5P_DEFAULT, es_id)) < 0) @@ -929,7 +929,7 @@ test_multi_file_grp_dset_io(void) /* Loop over files */ for (i = 0; i < 5; i++) { /* Set file name */ - sprintf(file_name, ASYNC_API_TEST_FILE_PRINTF, i); + snprintf(file_name, sizeof(file_name), ASYNC_API_TEST_FILE_PRINTF, i); /* Create file asynchronously */ if ((file_id = H5Fcreate_async(file_name, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT, es_id)) < @@ -981,7 +981,7 @@ test_multi_file_grp_dset_io(void) /* Loop over files */ for (i = 0; i < 5; i++) { /* Set file name */ - sprintf(file_name, ASYNC_API_TEST_FILE_PRINTF, i); + snprintf(file_name, sizeof(file_name), ASYNC_API_TEST_FILE_PRINTF, i); /* Open the file asynchronously */ if ((file_id = H5Fopen_async(file_name, H5F_ACC_RDONLY, H5P_DEFAULT, es_id)) < 0) @@ -1039,7 +1039,7 @@ test_multi_file_grp_dset_io(void) /* Loop over files */ for (i = 0; i < 5; i++) { /* Set file name */ - sprintf(file_name, ASYNC_API_TEST_FILE_PRINTF, i); + snprintf(file_name, sizeof(file_name), ASYNC_API_TEST_FILE_PRINTF, i); /* Create file asynchronously */ if ((file_id = H5Fcreate_async(file_name, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT, es_id)) < @@ -1096,7 +1096,7 @@ test_multi_file_grp_dset_io(void) /* Loop over files */ for (i = 0; i < 5; i++) { /* Set file name */ - sprintf(file_name, ASYNC_API_TEST_FILE_PRINTF, i); + snprintf(file_name, sizeof(file_name), ASYNC_API_TEST_FILE_PRINTF, i); /* Open the file asynchronously */ if ((file_id = H5Fopen_async(file_name, H5F_ACC_RDONLY, H5P_DEFAULT, es_id)) < 0) @@ -2676,7 +2676,7 @@ cleanup_files(void) H5Fdelete(ASYNC_API_TEST_FILE, H5P_DEFAULT); for (i = 0; i <= max_printf_file; i++) { - snprintf(file_name, 64, ASYNC_API_TEST_FILE_PRINTF, i); + snprintf(file_name, sizeof(file_name), ASYNC_API_TEST_FILE_PRINTF, i); H5Fdelete(file_name, H5P_DEFAULT); } /* end for */ } diff --git a/test/API/H5_api_attribute_test.c b/test/API/H5_api_attribute_test.c index 680ee4389f6..fd56be82989 100644 --- a/test/API/H5_api_attribute_test.c +++ b/test/API/H5_api_attribute_test.c @@ -51,6 +51,8 @@ static int test_attribute_iterate_datatype(void); static int test_attribute_iterate_index_saving(void); static int test_attribute_iterate_invalid_params(void); static int test_attribute_iterate_0_attributes(void); +static int test_attribute_compound_subset(void); +static int test_attribute_string_encodings(void); static int test_delete_attribute(void); static int test_delete_attribute_invalid_params(void); static int test_attribute_exists(void); @@ -99,6 +101,8 @@ static int (*attribute_tests[])(void) = {test_create_attribute_on_root, test_attribute_iterate_index_saving, test_attribute_iterate_invalid_params, test_attribute_iterate_0_attributes, + test_attribute_compound_subset, + test_attribute_string_encodings, test_delete_attribute, test_delete_attribute_invalid_params, test_attribute_exists, @@ -8333,6 +8337,535 @@ test_attribute_iterate_0_attributes(void) return 1; } +/* A compound type for test_attribute_compound_subset */ +typedef struct attribute_compound_io_t { + int a; + int b; +} attribute_compound_io_t; + +/* + * A test to ensure that data is read back correctly from a attribute after it has + * been written, using subsets of compound datatypes + */ +static int +test_attribute_compound_subset(void) +{ + hsize_t dims[1] = {ATTRIBUTE_COMPOUND_IO_ATTR_DIMS}; + size_t i; + hid_t file_id = H5I_INVALID_HID; + hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; + hid_t attr_id = H5I_INVALID_HID; + hid_t space_id = H5I_INVALID_HID; + hid_t full_type_id = H5I_INVALID_HID; + hid_t a_type_id = H5I_INVALID_HID; + hid_t b_type_id = H5I_INVALID_HID; + attribute_compound_io_t wbuf[ATTRIBUTE_COMPOUND_IO_ATTR_DIMS]; + attribute_compound_io_t rbuf[ATTRIBUTE_COMPOUND_IO_ATTR_DIMS]; + attribute_compound_io_t fbuf[ATTRIBUTE_COMPOUND_IO_ATTR_DIMS]; + attribute_compound_io_t erbuf[ATTRIBUTE_COMPOUND_IO_ATTR_DIMS]; + + TESTING_MULTIPART( + "verification of attribute data using H5Awrite then H5Aread with compound type subsets"); + + /* Make sure the connector supports the API functions being tested */ + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { + SKIPPED(); + printf( + " API functions for basic file, group, or attribute aren't supported with this connector\n"); + return 0; + } + + TESTING_2("test setup"); + + if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't open file '%s'\n", H5_api_test_filename); + goto error; + } + + if ((container_group = H5Gopen2(file_id, ATTRIBUTE_TEST_GROUP_NAME, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't open container group '%s'\n", ATTRIBUTE_TEST_GROUP_NAME); + goto error; + } + + if ((group_id = H5Gcreate2(container_group, ATTRIBUTE_COMPOUND_IO_TEST_GROUP_NAME, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't create container sub-group '%s'\n", ATTRIBUTE_COMPOUND_IO_TEST_GROUP_NAME); + goto error; + } + + if ((space_id = H5Screate_simple(1, dims, NULL)) < 0) + TEST_ERROR; + + if ((full_type_id = H5Tcreate(H5T_COMPOUND, sizeof(attribute_compound_io_t))) < 0) + TEST_ERROR; + if (H5Tinsert(full_type_id, "a", HOFFSET(attribute_compound_io_t, a), H5T_NATIVE_INT) < 0) + TEST_ERROR; + if (H5Tinsert(full_type_id, "b", HOFFSET(attribute_compound_io_t, b), H5T_NATIVE_INT) < 0) + TEST_ERROR; + + if ((a_type_id = H5Tcreate(H5T_COMPOUND, sizeof(attribute_compound_io_t))) < 0) + TEST_ERROR; + if (H5Tinsert(a_type_id, "a", HOFFSET(attribute_compound_io_t, a), H5T_NATIVE_INT) < 0) + TEST_ERROR; + + if ((b_type_id = H5Tcreate(H5T_COMPOUND, sizeof(attribute_compound_io_t))) < 0) + TEST_ERROR; + if (H5Tinsert(b_type_id, "b", HOFFSET(attribute_compound_io_t, b), H5T_NATIVE_INT) < 0) + TEST_ERROR; + + if ((attr_id = H5Acreate2(group_id, ATTRIBUTE_COMPOUND_IO_TEST_ATTR_NAME, full_type_id, space_id, + H5P_DEFAULT, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't create attribute '%s'\n", ATTRIBUTE_COMPOUND_IO_TEST_ATTR_NAME); + goto error; + } + + PASSED(); + + BEGIN_MULTIPART + { + PART_BEGIN(write_full_read_full) + { + TESTING_2("H5Awrite then H5Aread with all compound members"); + + /* Initialize wbuf */ + for (i = 0; i < ATTRIBUTE_COMPOUND_IO_ATTR_DIMS; i++) { + wbuf[i].a = (int)(2 * i); + wbuf[i].b = (int)(2 * i + 1); + } + + /* Write data */ + if (H5Awrite(attr_id, full_type_id, wbuf) < 0) + PART_TEST_ERROR(write_full_read_full); + + /* Update fbuf to match file state */ + for (i = 0; i < ATTRIBUTE_COMPOUND_IO_ATTR_DIMS; i++) { + fbuf[i].a = wbuf[i].a; + fbuf[i].b = wbuf[i].b; + } + + /* Initialize rbuf to -1 */ + for (i = 0; i < ATTRIBUTE_COMPOUND_IO_ATTR_DIMS; i++) { + rbuf[i].a = -1; + rbuf[i].b = -1; + } + + /* Set erbuf (simply match file state since we're reading the whole + * thing) */ + for (i = 0; i < ATTRIBUTE_COMPOUND_IO_ATTR_DIMS; i++) { + erbuf[i].a = fbuf[i].a; + erbuf[i].b = fbuf[i].b; + } + + /* Read data */ + if (H5Aread(attr_id, full_type_id, rbuf) < 0) + PART_TEST_ERROR(write_full_read_full); + + /* Verify data */ + for (i = 0; i < ATTRIBUTE_COMPOUND_IO_ATTR_DIMS; i++) { + if (rbuf[i].a != erbuf[i].a) + PART_TEST_ERROR(write_full_read_full); + if (rbuf[i].b != erbuf[i].b) + PART_TEST_ERROR(write_full_read_full); + } + + PASSED(); + } + PART_END(write_full_read_full); + + PART_BEGIN(read_a) + { + TESTING_2("H5Aread with compound member a"); + + /* Initialize rbuf to -1 */ + for (i = 0; i < ATTRIBUTE_COMPOUND_IO_ATTR_DIMS; i++) { + rbuf[i].a = -1; + rbuf[i].b = -1; + } + + /* Set erbuf (element a comes from the file, element b in untouched) + */ + for (i = 0; i < ATTRIBUTE_COMPOUND_IO_ATTR_DIMS; i++) { + erbuf[i].a = fbuf[i].a; + erbuf[i].b = rbuf[i].b; + } + + /* Read data */ + if (H5Aread(attr_id, a_type_id, rbuf) < 0) + PART_TEST_ERROR(read_a); + + /* Verify data */ + for (i = 0; i < ATTRIBUTE_COMPOUND_IO_ATTR_DIMS; i++) { + if (rbuf[i].a != erbuf[i].a) + PART_TEST_ERROR(read_a); + if (rbuf[i].b != erbuf[i].b) + PART_TEST_ERROR(read_a); + } + + PASSED(); + } + PART_END(read_a); + + PART_BEGIN(write_b_read_full) + { + TESTING_2("H5Awrite with compound member b then H5Aread with all compound members"); + + /* Initialize wbuf */ + for (i = 0; i < ATTRIBUTE_COMPOUND_IO_ATTR_DIMS; i++) { + wbuf[i].a = (int)(2 * ATTRIBUTE_COMPOUND_IO_ATTR_DIMS + 2 * i); + wbuf[i].b = (int)(2 * ATTRIBUTE_COMPOUND_IO_ATTR_DIMS + 2 * i + 1); + } + + /* Write data */ + if (H5Awrite(attr_id, b_type_id, wbuf) < 0) + PART_TEST_ERROR(write_b_read_full); + + /* Update fbuf to match file state - only element b was updated */ + for (i = 0; i < ATTRIBUTE_COMPOUND_IO_ATTR_DIMS; i++) { + fbuf[i].b = wbuf[i].b; + } + + /* Initialize rbuf to -1 */ + for (i = 0; i < ATTRIBUTE_COMPOUND_IO_ATTR_DIMS; i++) { + rbuf[i].a = -1; + rbuf[i].b = -1; + } + + /* Set erbuf (simply match file state since we're reading the whole + * thing) */ + for (i = 0; i < ATTRIBUTE_COMPOUND_IO_ATTR_DIMS; i++) { + erbuf[i].a = fbuf[i].a; + erbuf[i].b = fbuf[i].b; + } + + /* Read data */ + if (H5Aread(attr_id, full_type_id, rbuf) < 0) + PART_TEST_ERROR(write_b_read_full); + + /* Verify data */ + for (i = 0; i < ATTRIBUTE_COMPOUND_IO_ATTR_DIMS; i++) { + if (rbuf[i].a != erbuf[i].a) + PART_TEST_ERROR(write_b_read_full); + if (rbuf[i].b != erbuf[i].b) + PART_TEST_ERROR(write_b_read_full); + } + + PASSED(); + } + PART_END(write_b_read_full); + } + END_MULTIPART; + + TESTING_2("test cleanup"); + + if (H5Sclose(space_id) < 0) + TEST_ERROR; + if (H5Aclose(attr_id) < 0) + TEST_ERROR; + if (H5Gclose(group_id) < 0) + TEST_ERROR; + if (H5Gclose(container_group) < 0) + TEST_ERROR; + if (H5Fclose(file_id) < 0) + TEST_ERROR; + if (H5Tclose(full_type_id) < 0) + TEST_ERROR; + if (H5Tclose(a_type_id) < 0) + TEST_ERROR; + if (H5Tclose(b_type_id) < 0) + TEST_ERROR; + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY + { + H5Sclose(space_id); + H5Aclose(attr_id); + H5Gclose(group_id); + H5Gclose(container_group); + H5Fclose(file_id); + H5Tclose(full_type_id); + H5Tclose(a_type_id); + H5Tclose(b_type_id); + } + H5E_END_TRY; + + return 1; +} + +/* + * A test to check that attributes preserve data + * correctness for strings with ASCII or UTF-8 char sets + */ +static int +test_attribute_string_encodings(void) +{ + hid_t file_id = H5I_INVALID_HID; + hid_t container_group = H5I_INVALID_HID; + hid_t dset_id1 = H5I_INVALID_HID; + hid_t dset_id2 = H5I_INVALID_HID; + hid_t type_id1 = H5I_INVALID_HID; + hid_t type_id2 = H5I_INVALID_HID; + hid_t space_id = H5I_INVALID_HID; + hid_t attr_id1 = H5I_INVALID_HID; + hid_t attr_id2 = H5I_INVALID_HID; + hsize_t dims[ATTRIBUTE_STRING_ENCODINGS_RANK] = {ATTRIBUTE_STRING_ENCODINGS_EXTENT}; + size_t ascii_str_size = 0; + size_t utf8_str_size = 0; + char *write_buf = NULL; + char *read_buf = NULL; + + TESTING_MULTIPART("string encoding read/write correctness on attributes"); + + /* Make sure the connector supports the API functions being tested */ + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { + SKIPPED(); + printf(" API functions for basic file, group, basic or more dataset aren't supported with this " + "connector\n"); + return 0; + } + + TESTING_2("test setup"); + + ascii_str_size = strlen(ATTRIBUTE_STRING_ENCODINGS_ASCII_STRING); + utf8_str_size = strlen(ATTRIBUTE_STRING_ENCODINGS_UTF8_STRING); + + if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't open file '%s'\n", H5_api_test_filename); + goto error; + } + + if ((container_group = H5Gopen2(file_id, ATTRIBUTE_TEST_GROUP_NAME, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't open container group '%s'\n", ATTRIBUTE_TEST_GROUP_NAME); + goto error; + } + + if ((space_id = H5Screate_simple(ATTRIBUTE_STRING_ENCODINGS_RANK, dims, NULL)) < 0) { + H5_FAILED(); + printf(" couldn't create dataspace\n"); + goto error; + } + + if ((type_id1 = H5Tcopy(H5T_C_S1)) < 0) { + H5_FAILED(); + printf(" couldn't copy builtin string datatype\n"); + goto error; + } + + if ((H5Tset_size(type_id1, ascii_str_size)) < 0) { + H5_FAILED(); + printf(" couldn't set size of string datatype\n"); + goto error; + } + + if ((H5Tset_cset(type_id1, H5T_CSET_ASCII)) < 0) { + H5_FAILED(); + printf(" couldn't set character set of string to ASCII\n"); + goto error; + } + + if ((dset_id1 = H5Dcreate(container_group, ATTRIBUTE_STRING_ENCODINGS_DSET_NAME1, type_id1, space_id, + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't create dataset with ascii string\n"); + goto error; + } + + if ((attr_id1 = H5Acreate(dset_id1, ATTRIBUTE_STRING_ENCODINGS_ATTR_NAME1, type_id1, space_id, + H5P_DEFAULT, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't create attribute with ascii string\n"); + goto error; + } + + if ((type_id2 = H5Tcopy(H5T_C_S1)) < 0) { + H5_FAILED(); + printf(" couldn't copy builtin string datatype\n"); + goto error; + } + + if ((H5Tset_size(type_id2, utf8_str_size)) < 0) { + H5_FAILED(); + printf(" couldn't set size of string datatype\n"); + goto error; + } + + if ((H5Tset_cset(type_id2, H5T_CSET_UTF8)) < 0) { + H5_FAILED(); + printf(" couldn't set character set of string to UTF-8\n"); + goto error; + } + + if ((dset_id2 = H5Dcreate(container_group, ATTRIBUTE_STRING_ENCODINGS_DSET_NAME2, type_id2, space_id, + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't create dataset with UTF-8 string\n"); + goto error; + } + + if ((attr_id2 = H5Acreate(dset_id2, ATTRIBUTE_STRING_ENCODINGS_ATTR_NAME2, type_id2, space_id, + H5P_DEFAULT, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't create attribute with ascii string\n"); + goto error; + } + + PASSED(); + + BEGIN_MULTIPART + { + PART_BEGIN(ASCII_cset) + { + TESTING_2("ASCII character set"); + if ((write_buf = calloc(1, ascii_str_size + 1)) == NULL) { + H5_FAILED(); + printf(" couldn't allocate memory for write buffer\n"); + PART_ERROR(ASCII_cset); + } + + memcpy(write_buf, ATTRIBUTE_STRING_ENCODINGS_ASCII_STRING, ascii_str_size); + + if ((read_buf = calloc(1, ascii_str_size + 1)) == NULL) { + H5_FAILED(); + printf(" couldn't allocate memory for read buffer\n"); + PART_ERROR(ASCII_cset); + } + + if (H5Awrite(attr_id1, type_id1, write_buf) < 0) { + H5_FAILED(); + printf(" couldn't write to attribute with ASCII string\n"); + PART_ERROR(ASCII_cset); + } + + if (H5Aread(attr_id1, type_id1, read_buf) < 0) { + H5_FAILED(); + printf(" couldn't read from attribute with ASCII string\n"); + PART_ERROR(ASCII_cset); + } + + if (strncmp(write_buf, read_buf, ascii_str_size)) { + H5_FAILED(); + printf(" incorrect data read from attribute with ASCII string\n"); + PART_ERROR(ASCII_cset); + } + + free(write_buf); + write_buf = NULL; + + free(read_buf); + read_buf = NULL; + + PASSED(); + } + PART_END(ASCII_cset); + + PART_BEGIN(UTF8_cset) + { + TESTING_2("UTF-8 character set"); + + if ((write_buf = calloc(1, utf8_str_size + 1)) == NULL) { + H5_FAILED(); + printf(" couldn't allocate memory for write buffer\n"); + PART_ERROR(UTF8_cset); + } + + memcpy(write_buf, ATTRIBUTE_STRING_ENCODINGS_UTF8_STRING, utf8_str_size); + + if ((read_buf = calloc(1, utf8_str_size + 1)) == NULL) { + H5_FAILED(); + printf(" couldn't allocate memory for read buffer\n"); + PART_ERROR(UTF8_cset); + } + + if (H5Awrite(attr_id2, type_id2, write_buf) < 0) { + H5_FAILED(); + printf(" couldn't write to attribute with UTF-8 string\n"); + PART_ERROR(UTF8_cset); + } + + if (H5Aread(attr_id2, type_id2, read_buf) < 0) { + H5_FAILED(); + printf(" couldn't read from attribute with UTF-8 string\n"); + PART_ERROR(UTF8_cset); + } + + if (strncmp(write_buf, read_buf, utf8_str_size)) { + H5_FAILED(); + printf(" incorrect data read from attribute with UTF-8 string\n"); + PART_ERROR(UTF8_cset); + } + + free(write_buf); + write_buf = NULL; + + free(read_buf); + read_buf = NULL; + + PASSED(); + } + PART_END(UTF8_cset); + + PASSED(); + } + END_MULTIPART; + + TESTING_2("test cleanup"); + + if (H5Fclose(file_id) < 0) + TEST_ERROR; + if (H5Gclose(container_group) < 0) + TEST_ERROR; + if (H5Dclose(dset_id1) < 0) + TEST_ERROR; + if (H5Dclose(dset_id2) < 0) + TEST_ERROR; + if (H5Tclose(type_id1) < 0) + TEST_ERROR; + if (H5Tclose(type_id2) < 0) + TEST_ERROR; + if (H5Aclose(attr_id1) < 0) + TEST_ERROR; + if (H5Aclose(attr_id2) < 0) + TEST_ERROR; + if (write_buf) + free(write_buf); + if (read_buf) + free(read_buf); + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY + { + H5Fclose(file_id); + H5Gclose(container_group); + H5Dclose(dset_id1); + H5Dclose(dset_id2); + H5Tclose(type_id1); + H5Tclose(type_id2); + H5Aclose(attr_id1); + H5Aclose(attr_id2); + if (write_buf) + free(write_buf); + if (read_buf) + free(read_buf); + } + H5E_END_TRY; + + return 1; +} + /* * A test to check that an attribute can be deleted * using H5Adelete(_by_idx). @@ -10457,7 +10990,7 @@ test_attribute_many(void) /* Create many attributes */ for (u = 0; u < ATTRIBUTE_MANY_NUMB; u++) { - sprintf(attrname, "many-%06u", u); + snprintf(attrname, sizeof(attrname), "many-%06u", u); if ((attr_id = H5Acreate2(group_id, attrname, attr_dtype, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); diff --git a/test/API/H5_api_attribute_test.h b/test/API/H5_api_attribute_test.h index dd83e732491..7b455dcaa1a 100644 --- a/test/API/H5_api_attribute_test.h +++ b/test/API/H5_api_attribute_test.h @@ -156,6 +156,19 @@ int H5_api_attribute_test(void); #define ATTRIBUTE_ITERATE_TEST_0_ATTRIBUTES_SUBGROUP_NAME "attribute_iterate_test_0_attributes" #define ATTRIBUTE_ITERATE_TEST_0_ATTRIBUTES_DSET_NAME "attribute_iterate_dset" +#define ATTRIBUTE_COMPOUND_IO_ATTR_DIMS 10 +#define ATTRIBUTE_COMPOUND_IO_TEST_GROUP_NAME "attribute_compound_io_test_group" +#define ATTRIBUTE_COMPOUND_IO_TEST_ATTR_NAME "attribute_compound_io_test_attr" + +#define ATTRIBUTE_STRING_ENCODINGS_RANK 1 +#define ATTRIBUTE_STRING_ENCODINGS_EXTENT 1 +#define ATTRIBUTE_STRING_ENCODINGS_DSET_NAME1 "encoding_dset1" +#define ATTRIBUTE_STRING_ENCODINGS_DSET_NAME2 "encoding_dset2" +#define ATTRIBUTE_STRING_ENCODINGS_ASCII_STRING "asciistr" +#define ATTRIBUTE_STRING_ENCODINGS_UTF8_STRING "αaααaaaα" +#define ATTRIBUTE_STRING_ENCODINGS_ATTR_NAME1 "encoding_attr1" +#define ATTRIBUTE_STRING_ENCODINGS_ATTR_NAME2 "encoding_attr2" + #define ATTRIBUTE_ITERATE_INVALID_PARAMS_TEST_ATTR_SPACE_RANK 1 #define ATTRIBUTE_ITERATE_INVALID_PARAMS_TEST_SUBGROUP_NAME "attribute_iterate_invalid_params_test" #define ATTRIBUTE_ITERATE_INVALID_PARAMS_TEST_ATTR_NAME "invalid_params_iter_attr1" diff --git a/test/API/H5_api_dataset_test.c b/test/API/H5_api_dataset_test.c index df22fefc53a..abe1fc8c9d7 100644 --- a/test/API/H5_api_dataset_test.c +++ b/test/API/H5_api_dataset_test.c @@ -63,8 +63,11 @@ static int test_write_multi_dataset_small_hyperslab(void); static int test_write_multi_dataset_small_point_selection(void); static int test_write_multi_dataset_data_verification(void); static int test_write_dataset_invalid_params(void); +static int test_dataset_string_encodings(void); static int test_dataset_builtin_type_conversion(void); +static int test_dataset_real_to_int_conversion(void); static int test_dataset_compound_partial_io(void); +static int test_dataset_vlen_io(void); static int test_dataset_set_extent_chunked_unlimited(void); static int test_dataset_set_extent_chunked_fixed(void); static int test_dataset_set_extent_data(void); @@ -133,6 +136,7 @@ static int (*dataset_tests[])(void) = { test_read_multi_dataset_small_point_selection, test_dataset_io_point_selections, test_read_dataset_invalid_params, + test_dataset_string_encodings, test_write_dataset_small_all, test_write_dataset_small_hyperslab, test_write_dataset_small_point_selection, @@ -143,7 +147,9 @@ static int (*dataset_tests[])(void) = { test_write_multi_dataset_data_verification, test_write_dataset_invalid_params, test_dataset_builtin_type_conversion, + test_dataset_real_to_int_conversion, test_dataset_compound_partial_io, + test_dataset_vlen_io, test_dataset_set_extent_chunked_unlimited, test_dataset_set_extent_chunked_fixed, test_dataset_set_extent_data, @@ -166,6 +172,9 @@ static int (*dataset_tests[])(void) = { test_get_vlen_buf_size, }; +size_t filter(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts, + const unsigned int H5_ATTR_UNUSED cd_values[], size_t nbytes, size_t H5_ATTR_UNUSED *buf_size, + void H5_ATTR_UNUSED **buf); /* * A test to check that a dataset can be * created under the root group. @@ -1211,7 +1220,7 @@ test_create_dataset_random_shapes(void) goto error; } - sprintf(name, "%s%zu", DATASET_SHAPE_TEST_DSET_BASE_NAME, i + 1); + snprintf(name, sizeof(name), "%s%zu", DATASET_SHAPE_TEST_DSET_BASE_NAME, i + 1); if ((dset_id = H5Dcreate2(group_id, name, dset_dtype, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { @@ -1309,7 +1318,7 @@ test_create_dataset_predefined_types(void) generate_random_dataspace(DATASET_PREDEFINED_TYPE_TEST_SPACE_RANK, NULL, NULL, false)) < 0) TEST_ERROR; - sprintf(name, "%s%zu", DATASET_PREDEFINED_TYPE_TEST_BASE_NAME, i); + snprintf(name, sizeof(name), "%s%zu", DATASET_PREDEFINED_TYPE_TEST_BASE_NAME, i); if ((dset_id = H5Dcreate2(group_id, name, predefined_type_test_table[i], fspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { @@ -2041,6 +2050,15 @@ test_create_dataset_array_types(void) return 1; } +size_t +filter(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts, + const unsigned int H5_ATTR_UNUSED cd_values[], size_t nbytes, size_t H5_ATTR_UNUSED *buf_size, + void H5_ATTR_UNUSED **buf) +{ + *buf_size = 0; + return nbytes; +} + /* * A test to check the functionality of the different * dataset creation properties. @@ -2048,15 +2066,21 @@ test_create_dataset_array_types(void) static int test_create_dataset_creation_properties(void) { - hsize_t dims[DATASET_CREATION_PROPERTIES_TEST_SHAPE_RANK]; - hsize_t chunk_dims[DATASET_CREATION_PROPERTIES_TEST_SHAPE_RANK]; - size_t i; - hid_t file_id = H5I_INVALID_HID; - hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; - hid_t dset_id = H5I_INVALID_HID, dcpl_id = H5I_INVALID_HID; - hid_t dset_dtype = H5I_INVALID_HID, compact_dtype = H5I_INVALID_HID; - hid_t fspace_id = H5I_INVALID_HID, compact_fspace_id = H5I_INVALID_HID; - + hsize_t dims[DATASET_CREATION_PROPERTIES_TEST_SHAPE_RANK]; + hsize_t chunk_dims[DATASET_CREATION_PROPERTIES_TEST_SHAPE_RANK]; + size_t i; + hid_t file_id = H5I_INVALID_HID; + hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; + hid_t dset_id = H5I_INVALID_HID, dcpl_id = H5I_INVALID_HID; + hid_t dset_dtype = H5I_INVALID_HID, compact_dtype = H5I_INVALID_HID; + hid_t fspace_id = H5I_INVALID_HID, compact_fspace_id = H5I_INVALID_HID; + void *read_buf = NULL; + unsigned int filter_params[DATASET_CREATION_PROPERTIES_TEST_UD_FILTER_NUM_PARAMS] = {1, 2, 3}; + unsigned int filter_params_out[DATASET_CREATION_PROPERTIES_TEST_UD_FILTER_NUM_PARAMS]; + char ud_filter_name[sizeof(DATASET_CREATION_PROPERTIES_TEST_UD_FILTER_NAME)]; + int nfilters = 0; + H5Z_filter_t retrieved_filter_id = H5I_INVALID_HID; + size_t num_filter_params = DATASET_CREATION_PROPERTIES_TEST_UD_FILTER_NUM_PARAMS; TESTING_MULTIPART("dataset creation properties"); /* Make sure the connector supports the API functions being tested */ @@ -2132,7 +2156,8 @@ test_create_dataset_creation_properties(void) PART_ERROR(DCPL_alloc_time_test); } - sprintf(name, "%s%zu", DATASET_CREATION_PROPERTIES_TEST_ALLOC_TIMES_BASE_NAME, i); + snprintf(name, sizeof(name), "%s%zu", DATASET_CREATION_PROPERTIES_TEST_ALLOC_TIMES_BASE_NAME, + i); if ((dset_id = H5Dcreate2(group_id, name, dset_dtype, fspace_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) { @@ -2208,7 +2233,8 @@ test_create_dataset_creation_properties(void) PART_ERROR(DCPL_attr_crt_order_test); } - sprintf(name, "%s%zu", DATASET_CREATION_PROPERTIES_TEST_CRT_ORDER_BASE_NAME, i); + snprintf(name, sizeof(name), "%s%zu", DATASET_CREATION_PROPERTIES_TEST_CRT_ORDER_BASE_NAME, + i); if ((dset_id = H5Dcreate2(group_id, name, dset_dtype, fspace_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) { @@ -2341,7 +2367,8 @@ test_create_dataset_creation_properties(void) PART_ERROR(DCPL_fill_time_property_test); } - sprintf(name, "%s%zu", DATASET_CREATION_PROPERTIES_TEST_FILL_TIMES_BASE_NAME, i); + snprintf(name, sizeof(name), "%s%zu", DATASET_CREATION_PROPERTIES_TEST_FILL_TIMES_BASE_NAME, + i); if ((dset_id = H5Dcreate2(group_id, name, dset_dtype, fspace_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) { @@ -2388,7 +2415,275 @@ test_create_dataset_creation_properties(void) } PART_END(DCPL_fill_time_property_test); - /* TODO: Test the fill value property */ + PART_BEGIN(DCPL_fill_value_test) + { + TESTING_2("fill values"); + + int int_fill_value = DATASET_FILL_VALUE_TEST_INT_FILL_VALUE; + double double_fill_value = DATASET_FILL_VALUE_TEST_DOUBLE_FILL_VALUE; + + void *val = NULL; + size_t num_elems = 1; + hid_t type_id = H5I_INVALID_HID; + + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILL_VALUES)) { + SKIPPED(); + printf(" dataset fill values are not supported by this VOL connector\n"); + PART_EMPTY(DCPL_fill_value_test); + } + + /* Integer Fill Value */ + if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) { + H5_FAILED(); + printf(" couldn't create DCPL\n"); + PART_ERROR(DCPL_fill_value_test); + } + + if (H5Pset_fill_value(dcpl_id, DATASET_FILL_VALUE_TEST_INT_TYPE, (const void *)&int_fill_value) < + 0) { + H5_FAILED(); + printf(" couldn't set integer fill value in property list"); + PART_ERROR(DCPL_fill_value_test); + } + + if ((dset_id = + H5Dcreate(group_id, DATASET_FILL_VALUE_TEST_DSET_NAME1, DATASET_FILL_VALUE_TEST_INT_TYPE, + fspace_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't create dataset with integer fill value"); + PART_ERROR(DCPL_fill_value_test); + } + + if ((H5Sget_simple_extent_dims(fspace_id, dims, NULL)) < 0) { + H5_FAILED(); + printf(" couldn't get dataspace dimensions"); + PART_ERROR(DCPL_fill_value_test); + } + + for (i = 0; i < DATASET_CREATION_PROPERTIES_TEST_SHAPE_RANK; i++) + num_elems *= (size_t)dims[i]; + + if ((read_buf = calloc(num_elems, sizeof(DATASET_FILL_VALUE_TEST_INT_TYPE))) == NULL) { + H5_FAILED(); + printf(" couldn't allocate memory for read buffer"); + PART_ERROR(DCPL_fill_value_test); + } + + if (H5Dread(dset_id, DATASET_FILL_VALUE_TEST_INT_TYPE, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf) < + 0) { + H5_FAILED(); + printf(" couldn't read from dataset"); + PART_ERROR(DCPL_fill_value_test); + } + + for (i = 0; i < num_elems; i++) { + val = (int *)(read_buf) + i; + + if (*(int *)val != DATASET_FILL_VALUE_TEST_INT_FILL_VALUE) { + H5_FAILED(); + printf(" incorrect value read from dataset"); + PART_ERROR(DCPL_fill_value_test); + } + } + + if (H5Dclose(dset_id) < 0) { + H5_FAILED(); + printf(" couldn't close integer fill value dataset"); + PART_ERROR(DCPL_fill_value_test); + } + + if (H5Pclose(dcpl_id) < 0) { + H5_FAILED(); + printf(" couldn't close dcpl"); + PART_ERROR(DCPL_fill_value_test); + } + + /* Re-open integer dataset */ + if ((dset_id = H5Dopen2(group_id, DATASET_FILL_VALUE_TEST_DSET_NAME1, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't open integer fill value dataset"); + PART_ERROR(DCPL_fill_value_test); + } + + if (H5Dclose(dset_id) < 0) { + H5_FAILED(); + printf(" couldn't close opened integer fill value dataset"); + PART_ERROR(DCPL_fill_value_test); + } + + free(read_buf); + read_buf = NULL; + + /* Double fill value */ + if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) == H5I_INVALID_HID) { + H5_FAILED(); + printf(" couldn't create dcpl"); + PART_ERROR(DCPL_fill_value_test); + } + + if ((H5Pset_fill_value(dcpl_id, DATASET_FILL_VALUE_TEST_DOUBLE_TYPE, + (const void *)&double_fill_value)) < 0) { + H5_FAILED(); + printf(" couldn't set double fill value in property list"); + PART_ERROR(DCPL_fill_value_test); + } + + if ((dset_id = H5Dcreate2(group_id, DATASET_FILL_VALUE_TEST_DSET_NAME2, + DATASET_FILL_VALUE_TEST_DOUBLE_TYPE, fspace_id, H5P_DEFAULT, dcpl_id, + H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't create dataset with double fill value"); + PART_ERROR(DCPL_fill_value_test); + } + + if ((read_buf = calloc(num_elems, sizeof(DATASET_FILL_VALUE_TEST_DOUBLE_TYPE))) == NULL) { + H5_FAILED(); + printf(" couldn't allocate memory for read buffer"); + PART_ERROR(DCPL_fill_value_test); + } + + if (H5Dread(dset_id, DATASET_FILL_VALUE_TEST_DOUBLE_TYPE, H5S_ALL, H5S_ALL, H5P_DEFAULT, + read_buf) < 0) { + H5_FAILED(); + printf(" couldn't read from dataset"); + PART_ERROR(DCPL_fill_value_test); + } + + for (i = 0; i < num_elems; i++) { + val = (double *)(read_buf) + i; + + if (!(H5_DBL_REL_EQUAL(*(double *)val, DATASET_FILL_VALUE_TEST_DOUBLE_FILL_VALUE, + 0.0000001))) { + H5_FAILED(); + printf(" incorrect value read from dataset"); + PART_ERROR(DCPL_fill_value_test); + } + } + + if (H5Dclose(dset_id) < 0) { + H5_FAILED(); + printf(" couldn't close double fill value dataset"); + PART_ERROR(DCPL_fill_value_test); + } + + if (H5Pclose(dcpl_id) < 0) { + H5_FAILED(); + printf(" couldn't close dcpl"); + PART_ERROR(DCPL_fill_value_test); + } + + /* Re-open double dataset */ + if ((dset_id = H5Dopen2(group_id, DATASET_FILL_VALUE_TEST_DSET_NAME2, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't open double fill value dataset"); + PART_ERROR(DCPL_fill_value_test); + } + + if (H5Dclose(dset_id) < 0) { + H5_FAILED(); + printf(" couldn't close opened double fill value dataset"); + PART_ERROR(DCPL_fill_value_test); + } + + free(read_buf); + read_buf = NULL; + + /* Fixed-length string fill value */ + if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) == H5I_INVALID_HID) { + H5_FAILED(); + printf(" couldn't create dcpl"); + PART_ERROR(DCPL_fill_value_test); + } + + if ((type_id = H5Tcopy(H5T_C_S1)) < 0) { + H5_FAILED(); + printf(" couldn't copy string datatype"); + PART_ERROR(DCPL_fill_value_test); + } + + if ((H5Tset_size(type_id, DATASET_FILL_VALUE_TEST_STRING_SIZE)) < 0) { + H5_FAILED(); + printf(" couldn't set size of string datatype"); + PART_ERROR(DCPL_fill_value_test); + } + + if ((H5Pset_fill_value(dcpl_id, type_id, + (const void *)DATASET_FILL_VALUE_TEST_STRING_FILL_VALUE)) < 0) { + H5_FAILED(); + printf(" couldn't set string fill value in property list"); + PART_ERROR(DCPL_fill_value_test); + } + + if ((dset_id = H5Dcreate2(group_id, DATASET_FILL_VALUE_TEST_DSET_NAME3, type_id, fspace_id, + H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't create dataset with string fill value"); + PART_ERROR(DCPL_fill_value_test); + } + + if ((read_buf = calloc(num_elems, DATASET_FILL_VALUE_TEST_STRING_SIZE)) == NULL) { + H5_FAILED(); + printf(" couldn't allocate memory for read buffer"); + PART_ERROR(DCPL_fill_value_test); + } + + if (H5Dread(dset_id, type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf) < 0) { + H5_FAILED(); + printf(" couldn't read from dataset"); + PART_ERROR(DCPL_fill_value_test); + } + + for (i = 0; i < num_elems; i++) { + char val_str[DATASET_FILL_VALUE_TEST_STRING_SIZE + 1]; + + memcpy(val_str, ((char *)read_buf) + i * DATASET_FILL_VALUE_TEST_STRING_SIZE, + DATASET_FILL_VALUE_TEST_STRING_SIZE); + val_str[DATASET_FILL_VALUE_TEST_STRING_SIZE] = '\0'; + + if (strcmp(val_str, DATASET_FILL_VALUE_TEST_STRING_FILL_VALUE)) { + H5_FAILED(); + printf(" incorrect value read from string dataset"); + PART_ERROR(DCPL_fill_value_test); + } + } + + if (H5Dclose(dset_id) < 0) { + H5_FAILED(); + printf(" couldn't close string fill value dataset"); + PART_ERROR(DCPL_fill_value_test); + } + + if (H5Pclose(dcpl_id) < 0) { + H5_FAILED(); + printf(" couldn't close dcpl"); + PART_ERROR(DCPL_fill_value_test); + } + + if (H5Tclose(type_id) < 0) { + H5_FAILED(); + printf(" couldn't close string type"); + PART_ERROR(DCPL_fill_value_test); + } + + free(read_buf); + read_buf = NULL; + + /* Re-open string dataset */ + if ((dset_id = H5Dopen2(group_id, DATASET_FILL_VALUE_TEST_DSET_NAME3, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't open string fill value dataset"); + PART_ERROR(DCPL_fill_value_test); + } + + if (H5Dclose(dset_id) < 0) { + H5_FAILED(); + printf(" couldn't close opened string fill value dataset"); + PART_ERROR(DCPL_fill_value_test); + } + + PASSED(); + } + PART_END(DCPL_fill_value_test); /* Test filters */ PART_BEGIN(DCPL_filters_test) @@ -2490,6 +2785,120 @@ test_create_dataset_creation_properties(void) } PART_END(DCPL_filters_test); + /* Test a user-defined filter */ + PART_BEGIN(DCPL_user_defined_filter_test) + { + TESTING_2("user-defined dataset filters"); + /* Create user-defined filter and register with library */ + const H5Z_class2_t filter_cls[1] = { + {H5Z_CLASS_T_VERS, DATASET_CREATION_PROPERTIES_TEST_UD_FILTER_ID, 1, 1, + DATASET_CREATION_PROPERTIES_TEST_UD_FILTER_NAME, NULL, NULL, &filter}}; + + if (H5Zregister((const void *)&filter_cls) < 0) { + H5_FAILED(); + printf(" couldn't register filter\n"); + PART_ERROR(DCPL_user_defined_filter_test); + } + + if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) { + H5_FAILED(); + printf(" couldn't create DCPL\n"); + PART_ERROR(DCPL_user_defined_filter_test); + } + + if (H5Pset_chunk(dcpl_id, DATASET_CREATION_PROPERTIES_TEST_SHAPE_RANK, chunk_dims) < 0) { + H5_FAILED(); + printf(" couldn't set chunking on DCPL\n"); + PART_ERROR(DCPL_user_defined_filter_test); + } + + /* Set user-defined filter on the DCPL */ + if (H5Pset_filter(dcpl_id, (H5Z_filter_t)DATASET_CREATION_PROPERTIES_TEST_UD_FILTER_ID, + H5Z_FLAG_MANDATORY, 3, filter_params) < 0) { + H5_FAILED(); + printf(" couldn't set user-defined filter on DCPL\n"); + PART_ERROR(DCPL_user_defined_filter_test); + } + + /* Use a simple datatype, as not all filters support all datatypes. */ + if ((dset_id = H5Dcreate2(group_id, DATASET_CREATION_PROPERTIES_TEST_UD_FILTER_DSET_NAME, + H5T_NATIVE_INT, fspace_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't create dataset '%s'\n", + DATASET_CREATION_PROPERTIES_TEST_UD_FILTER_DSET_NAME); + PART_ERROR(DCPL_user_defined_filter_test); + } + + if (dset_id >= 0) { + H5E_BEGIN_TRY + { + H5Dclose(dset_id); + } + H5E_END_TRY; + dset_id = H5I_INVALID_HID; + } + + if ((dset_id = H5Dopen2(group_id, DATASET_CREATION_PROPERTIES_TEST_UD_FILTER_DSET_NAME, + H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't open dataset '%s'\n", + DATASET_CREATION_PROPERTIES_TEST_UD_FILTER_DSET_NAME); + PART_ERROR(DCPL_user_defined_filter_test); + } + + if (dcpl_id >= 0) { + H5E_BEGIN_TRY + { + H5Pclose(dcpl_id); + } + H5E_END_TRY; + dcpl_id = H5I_INVALID_HID; + } + + /* Test that parameters are preserved in the DCPL */ + memset(filter_params_out, 0, + sizeof(unsigned int) * DATASET_CREATION_PROPERTIES_TEST_UD_FILTER_NUM_PARAMS); + + if ((dcpl_id = H5Dget_create_plist(dset_id)) < 0) { + H5_FAILED(); + printf(" couldn't retrieve DCPL\n"); + PART_ERROR(DCPL_user_defined_filter_test); + } + + if ((nfilters = H5Pget_nfilters(dcpl_id)) != 1) { + H5_FAILED(); + printf(" retrieved incorrect number of filters from DCPL\n"); + PART_ERROR(DCPL_user_defined_filter_test); + } + + if ((retrieved_filter_id = H5Pget_filter2( + dcpl_id, 0, H5Z_FLAG_MANDATORY, &num_filter_params, filter_params_out, + strlen(DATASET_CREATION_PROPERTIES_TEST_UD_FILTER_NAME), ud_filter_name, NULL)) < 0) { + H5_FAILED(); + printf(" retrieved incorrect user-defined filter ID\n"); + PART_ERROR(DCPL_user_defined_filter_test); + } + + for (i = 0; i < DATASET_CREATION_PROPERTIES_TEST_UD_FILTER_NUM_PARAMS; i++) + if (filter_params[i] != filter_params_out[i]) { + H5_FAILED(); + printf(" retrieved incorrect parameter value from DCPL\n"); + PART_ERROR(DCPL_user_defined_filter_test); + } + + if (dset_id >= 0) { + H5E_BEGIN_TRY + { + H5Dclose(dset_id); + } + H5E_END_TRY; + dset_id = H5I_INVALID_HID; + } + + PASSED(); + } + PART_END(DCPL_user_defined_filter_test) + /* Test the dataset storage layout property */ PART_BEGIN(DCPL_storage_layout_test) { @@ -2527,7 +2936,7 @@ test_create_dataset_creation_properties(void) } } - sprintf(name, "%s%zu", DATASET_CREATION_PROPERTIES_TEST_LAYOUTS_BASE_NAME, i); + snprintf(name, sizeof(name), "%s%zu", DATASET_CREATION_PROPERTIES_TEST_LAYOUTS_BASE_NAME, i); if ((dset_id = H5Dcreate2(group_id, name, (H5D_COMPACT == layouts[i]) ? compact_dtype : dset_dtype, @@ -2689,6 +3098,11 @@ test_create_dataset_creation_properties(void) TESTING_2("test cleanup"); + if (read_buf) { + free(read_buf); + read_buf = NULL; + } + if (H5Sclose(compact_fspace_id) < 0) TEST_ERROR; if (H5Sclose(fspace_id) < 0) @@ -2711,6 +3125,10 @@ test_create_dataset_creation_properties(void) error: H5E_BEGIN_TRY { + if (read_buf) { + free(read_buf); + } + H5Sclose(compact_fspace_id); H5Sclose(fspace_id); H5Tclose(compact_dtype); @@ -2720,10 +3138,11 @@ test_create_dataset_creation_properties(void) H5Gclose(group_id); H5Gclose(container_group); H5Fclose(file_id); - } - H5E_END_TRY - return 1; + H5E_END_TRY + + return 1; + } } /* @@ -2778,7 +3197,7 @@ test_create_many_dataset(void) printf("\n"); for (i = 0; i < DATASET_NUMB; i++) { printf("\r %u/%u", i + 1, DATASET_NUMB); - sprintf(dset_name, "dset_%02u", i); + snprintf(dset_name, sizeof(dset_name), "dset_%02u", i); data = i % 256; if ((dset_id = H5Dcreate2(group_id, dset_name, H5T_NATIVE_UCHAR, dataspace_id, H5P_DEFAULT, @@ -3652,8 +4071,8 @@ test_dataset_property_lists(void) { TESTING_2("H5Dget_create_plist"); - /* Try to receive copies of the two property lists, one which has the property set and one which - * does not */ + /* Try to receive copies of the two property lists, one which has the property set and one + * which does not */ if ((dcpl_id1 = H5Dget_create_plist(dset_id1)) < 0) { H5_FAILED(); printf(" couldn't get property list\n"); @@ -3743,8 +4162,8 @@ test_dataset_property_lists(void) dapl_id1 = H5I_INVALID_HID; } - /* Try to receive copies of the two property lists, one which has the property set and one which - * does not */ + /* Try to receive copies of the two property lists, one which has the property set and one + * which does not */ if ((dapl_id1 = H5Dget_access_plist(dset_id3)) < 0) { H5_FAILED(); printf(" couldn't get property list\n"); @@ -4721,7 +5140,7 @@ test_read_multi_dataset_small_point_selection(void) hid_t dset_id_arr[DATASET_MULTI_COUNT]; hid_t mspace_id_arr[DATASET_MULTI_COUNT], fspace_id_arr[DATASET_MULTI_COUNT]; hid_t dtype_arr[DATASET_MULTI_COUNT]; - void *data[DATASET_MULTI_COUNT]; + void *read_buf[DATASET_MULTI_COUNT]; TESTING("small multi read from datasets with point selections"); @@ -4735,7 +5154,7 @@ test_read_multi_dataset_small_point_selection(void) /* Prevent uninitialized memory usage on test failure */ for (i = 0; i < DATASET_MULTI_COUNT; i++) { - data[i] = NULL; + read_buf[i] = NULL; dset_id_arr[i] = H5I_INVALID_HID; } @@ -4797,7 +5216,7 @@ test_read_multi_dataset_small_point_selection(void) goto error; } - if (NULL == (data[i] = malloc(data_size))) + if (NULL == (read_buf[i] = malloc(data_size))) TEST_ERROR; dtype_arr[i] = DATASET_SMALL_READ_TEST_POINT_SELECTION_DSET_DTYPE; @@ -4806,16 +5225,16 @@ test_read_multi_dataset_small_point_selection(void) } if (H5Dread_multi(DATASET_MULTI_COUNT, dset_id_arr, dtype_arr, mspace_id_arr, fspace_id_arr, H5P_DEFAULT, - data) < 0) { + read_buf) < 0) { H5_FAILED(); printf(" couldn't read from dataset '%s'\n", DATASET_SMALL_READ_TEST_POINT_SELECTION_DSET_NAME); goto error; } for (i = 0; i < DATASET_MULTI_COUNT; i++) { - if (data[i]) { - free(data[i]); - data[i] = NULL; + if (read_buf[i]) { + free(read_buf[i]); + read_buf[i] = NULL; } if (H5Dclose(dset_id_arr[i]) < 0) TEST_ERROR; @@ -4840,9 +5259,9 @@ test_read_multi_dataset_small_point_selection(void) H5E_BEGIN_TRY { for (i = 0; i < DATASET_MULTI_COUNT; i++) { - if (data[i]) { - free(data[i]); - data[i] = NULL; + if (read_buf[i]) { + free(read_buf[i]); + read_buf[i] = NULL; } H5Dclose(dset_id_arr[i]); } @@ -5228,8 +5647,8 @@ test_dataset_io_point_selections(void) for (i = 0; i < DATASET_IO_POINT_DIM_0; i++) for (j = 0; j < DATASET_IO_POINT_DIM_1; j++) if (buf_all[i][j] != file_state[i][j]) - FAIL_PUTS_ERROR( - "Incorrect data found after writing from hyperslab in memory to points in dataset"); + FAIL_PUTS_ERROR("Incorrect data found after writing from hyperslab in memory to " + "points in dataset"); PASSED(); @@ -5302,8 +5721,8 @@ test_dataset_io_point_selections(void) for (i = 0; i < DATASET_IO_POINT_DIM_0; i++) for (j = 0; j < DATASET_IO_POINT_DIM_1; j++) if (buf_all[i][j] != file_state[i][j]) - FAIL_PUTS_ERROR( - "Incorrect data found after writing from points in memory to hyperslab in dataset"); + FAIL_PUTS_ERROR("Incorrect data found after writing from points in memory to " + "hyperslab in dataset"); if (!do_chunk) PASSED(); @@ -6501,22 +6920,24 @@ test_write_dataset_data_verification(void) static int test_write_multi_dataset_small_all(void) { - hssize_t space_npoints; - hsize_t dims[DATASET_SMALL_WRITE_TEST_ALL_DSET_SPACE_RANK] = {10, 5, 3}; - size_t i; - hid_t file_id = H5I_INVALID_HID; - hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; - hid_t dset_id_arr[DATASET_MULTI_COUNT]; - hid_t fspace_id = H5I_INVALID_HID, fspace_id_arr[DATASET_MULTI_COUNT]; - hid_t dtype_id_arr[DATASET_MULTI_COUNT]; - void *data[DATASET_MULTI_COUNT]; + hssize_t space_npoints; + hsize_t dims[DATASET_SMALL_WRITE_TEST_ALL_DSET_SPACE_RANK] = {10, 5, 3}; + size_t i; + hid_t file_id = H5I_INVALID_HID; + hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; + hid_t dset_id_arr[DATASET_MULTI_COUNT]; + hid_t fspace_id = H5I_INVALID_HID, fspace_id_arr[DATASET_MULTI_COUNT]; + hid_t dtype_id_arr[DATASET_MULTI_COUNT]; + const void *write_buf[DATASET_MULTI_COUNT]; + void *wbuf_temp[DATASET_MULTI_COUNT]; TESTING("small multi write to datasets with H5S_ALL"); /* Prevent uninitialized memory usage on test failure */ for (i = 0; i < DATASET_MULTI_COUNT; i++) { dset_id_arr[i] = H5I_INVALID_HID; - data[i] = NULL; + write_buf[i] = NULL; + wbuf_temp[i] = NULL; } /* Make sure the connector supports the API functions being tested */ @@ -6600,23 +7021,26 @@ test_write_multi_dataset_small_all(void) dtype_id_arr[i] = DATASET_SMALL_WRITE_TEST_ALL_DSET_DTYPE; fspace_id_arr[i] = H5S_ALL; - if (NULL == (data[i] = malloc((hsize_t)space_npoints * DATASET_SMALL_WRITE_TEST_ALL_DSET_DTYPESIZE))) + if (NULL == + (wbuf_temp[i] = malloc((hsize_t)space_npoints * DATASET_SMALL_WRITE_TEST_ALL_DSET_DTYPESIZE))) TEST_ERROR; for (size_t j = 0; j < (size_t)space_npoints; j++) - ((int **)data)[i][j] = (int)i; + ((int **)wbuf_temp)[i][j] = (int)i; + + write_buf[i] = wbuf_temp[i]; } if (H5Dwrite_multi(DATASET_MULTI_COUNT, dset_id_arr, dtype_id_arr, fspace_id_arr, fspace_id_arr, - H5P_DEFAULT, (const void **)data) < 0) { + H5P_DEFAULT, write_buf) < 0) { H5_FAILED(); printf(" couldn't write to dataset '%s'\n", DATASET_SMALL_WRITE_MULTI_TEST_ALL_DSET_NAME); goto error; } for (i = 0; i < DATASET_MULTI_COUNT; i++) { - free(data[i]); - data[i] = NULL; + free(wbuf_temp[i]); + wbuf_temp[i] = NULL; if (H5Dclose(dset_id_arr[i]) < 0) TEST_ERROR; } @@ -6637,8 +7061,8 @@ test_write_multi_dataset_small_all(void) H5E_BEGIN_TRY { for (i = 0; i < DATASET_MULTI_COUNT; i++) { - if (data[i]) - free(data[i]); + if (wbuf_temp[i]) + free(wbuf_temp[i]); H5Dclose(dset_id_arr[i]); } @@ -6659,19 +7083,20 @@ test_write_multi_dataset_small_all(void) static int test_write_multi_dataset_small_hyperslab(void) { - hsize_t start[DATASET_SMALL_WRITE_TEST_HYPERSLAB_DSET_SPACE_RANK]; - hsize_t stride[DATASET_SMALL_WRITE_TEST_HYPERSLAB_DSET_SPACE_RANK]; - hsize_t count[DATASET_SMALL_WRITE_TEST_HYPERSLAB_DSET_SPACE_RANK]; - hsize_t block[DATASET_SMALL_WRITE_TEST_HYPERSLAB_DSET_SPACE_RANK]; - hsize_t dims[DATASET_SMALL_WRITE_TEST_HYPERSLAB_DSET_SPACE_RANK] = {10, 5, 3}; - size_t i, data_size; - hid_t file_id = H5I_INVALID_HID; - hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; - hid_t dset_id_arr[DATASET_MULTI_COUNT]; - hid_t mspace_id = H5I_INVALID_HID, fspace_id = H5I_INVALID_HID; - hid_t mspace_id_arr[DATASET_MULTI_COUNT], fspace_id_arr[DATASET_MULTI_COUNT]; - hid_t dtype_id_arr[DATASET_MULTI_COUNT]; - void *data[DATASET_MULTI_COUNT]; + hsize_t start[DATASET_SMALL_WRITE_TEST_HYPERSLAB_DSET_SPACE_RANK]; + hsize_t stride[DATASET_SMALL_WRITE_TEST_HYPERSLAB_DSET_SPACE_RANK]; + hsize_t count[DATASET_SMALL_WRITE_TEST_HYPERSLAB_DSET_SPACE_RANK]; + hsize_t block[DATASET_SMALL_WRITE_TEST_HYPERSLAB_DSET_SPACE_RANK]; + hsize_t dims[DATASET_SMALL_WRITE_TEST_HYPERSLAB_DSET_SPACE_RANK] = {10, 5, 3}; + size_t i, data_size; + hid_t file_id = H5I_INVALID_HID; + hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; + hid_t dset_id_arr[DATASET_MULTI_COUNT]; + hid_t mspace_id = H5I_INVALID_HID, fspace_id = H5I_INVALID_HID; + hid_t mspace_id_arr[DATASET_MULTI_COUNT], fspace_id_arr[DATASET_MULTI_COUNT]; + hid_t dtype_id_arr[DATASET_MULTI_COUNT]; + const void *write_buf[DATASET_MULTI_COUNT]; + void *wbuf_temp[DATASET_MULTI_COUNT]; TESTING("small multi write to datasets with hyperslab selections"); @@ -6685,7 +7110,8 @@ test_write_multi_dataset_small_hyperslab(void) for (i = 0; i < DATASET_MULTI_COUNT; i++) { dset_id_arr[i] = H5I_INVALID_HID; - data[i] = NULL; + write_buf[i] = NULL; + wbuf_temp[i] = NULL; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -6732,11 +7158,13 @@ test_write_multi_dataset_small_hyperslab(void) goto error; } - if (NULL == (data[i] = malloc(data_size))) + if (NULL == (wbuf_temp[i] = malloc(data_size))) TEST_ERROR; for (size_t j = 0; j < data_size / DATASET_SMALL_WRITE_TEST_HYPERSLAB_DSET_DTYPESIZE; j++) - ((int **)data)[i][j] = (int)i; + ((int **)wbuf_temp)[i][j] = (int)i; + + write_buf[i] = (const void *)wbuf_temp[i]; } for (i = 0; i < DATASET_SMALL_WRITE_TEST_HYPERSLAB_DSET_SPACE_RANK; i++) { @@ -6758,16 +7186,16 @@ test_write_multi_dataset_small_hyperslab(void) } if (H5Dwrite_multi(DATASET_MULTI_COUNT, dset_id_arr, dtype_id_arr, mspace_id_arr, fspace_id_arr, - H5P_DEFAULT, (const void **)data) < 0) { + H5P_DEFAULT, (const void **)write_buf) < 0) { H5_FAILED(); printf(" couldn't write to dataset '%s'\n", DATASET_SMALL_WRITE_MULTI_TEST_HYPERSLAB_DSET_NAME); goto error; } for (i = 0; i < DATASET_MULTI_COUNT; i++) { - if (data[i]) { - free(data[i]); - data[i] = NULL; + if (wbuf_temp[i]) { + free(wbuf_temp[i]); + wbuf_temp[i] = NULL; } if (H5Dclose(dset_id_arr[i]) < 0) TEST_ERROR; @@ -6792,9 +7220,9 @@ test_write_multi_dataset_small_hyperslab(void) H5E_BEGIN_TRY { for (i = 0; i < DATASET_MULTI_COUNT; i++) { - if (data[i]) { - free(data[i]); - data[i] = NULL; + if (wbuf_temp[i]) { + free(wbuf_temp[i]); + wbuf_temp[i] = NULL; } H5Dclose(dset_id_arr[i]); } @@ -6816,18 +7244,19 @@ test_write_multi_dataset_small_hyperslab(void) static int test_write_multi_dataset_small_point_selection(void) { - hsize_t points[DATASET_SMALL_WRITE_TEST_POINT_SELECTION_NUM_POINTS * + hsize_t points[DATASET_SMALL_WRITE_TEST_POINT_SELECTION_NUM_POINTS * DATASET_SMALL_WRITE_TEST_POINT_SELECTION_DSET_SPACE_RANK]; - hsize_t dims[DATASET_SMALL_WRITE_TEST_POINT_SELECTION_DSET_SPACE_RANK] = {10, 10, 10}; - hsize_t mdims[] = {DATASET_SMALL_WRITE_TEST_POINT_SELECTION_NUM_POINTS}; - size_t i, data_size; - hid_t file_id = H5I_INVALID_HID; - hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; - hid_t dset_id_arr[DATASET_MULTI_COUNT]; - hid_t fspace_id = H5I_INVALID_HID, fspace_id_arr[DATASET_MULTI_COUNT]; - hid_t mspace_id = H5I_INVALID_HID, mspace_id_arr[DATASET_MULTI_COUNT]; - hid_t dtype_id_arr[DATASET_MULTI_COUNT]; - void *data[DATASET_MULTI_COUNT]; + hsize_t dims[DATASET_SMALL_WRITE_TEST_POINT_SELECTION_DSET_SPACE_RANK] = {10, 10, 10}; + hsize_t mdims[] = {DATASET_SMALL_WRITE_TEST_POINT_SELECTION_NUM_POINTS}; + size_t i, data_size; + hid_t file_id = H5I_INVALID_HID; + hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; + hid_t dset_id_arr[DATASET_MULTI_COUNT]; + hid_t fspace_id = H5I_INVALID_HID, fspace_id_arr[DATASET_MULTI_COUNT]; + hid_t mspace_id = H5I_INVALID_HID, mspace_id_arr[DATASET_MULTI_COUNT]; + hid_t dtype_id_arr[DATASET_MULTI_COUNT]; + const void *write_buf[DATASET_MULTI_COUNT]; + void *wbuf_temp[DATASET_MULTI_COUNT]; TESTING("small multi write to datasets with point selections"); @@ -6840,7 +7269,8 @@ test_write_multi_dataset_small_point_selection(void) } for (i = 0; i < DATASET_MULTI_COUNT; i++) { - data[i] = NULL; + write_buf[i] = NULL; + wbuf_temp[i] = NULL; dset_id_arr[i] = H5I_INVALID_HID; } @@ -6888,11 +7318,13 @@ test_write_multi_dataset_small_point_selection(void) goto error; } - if (NULL == (data[i] = malloc(data_size))) + if (NULL == (wbuf_temp[i] = malloc(data_size))) TEST_ERROR; for (size_t j = 0; j < data_size / DATASET_SMALL_WRITE_TEST_POINT_SELECTION_DSET_DTYPESIZE; j++) - ((int **)data)[i][j] = (int)i; + ((int **)wbuf_temp)[i][j] = (int)i; + + write_buf[i] = (const void *)wbuf_temp[i]; } for (i = 0; i < DATASET_SMALL_WRITE_TEST_POINT_SELECTION_NUM_POINTS; i++) { @@ -6916,16 +7348,16 @@ test_write_multi_dataset_small_point_selection(void) } if (H5Dwrite_multi(DATASET_MULTI_COUNT, dset_id_arr, dtype_id_arr, mspace_id_arr, fspace_id_arr, - H5P_DEFAULT, (const void **)data) < 0) { + H5P_DEFAULT, (const void **)write_buf) < 0) { H5_FAILED(); printf(" couldn't write to multiple datasets\n"); goto error; } for (i = 0; i < DATASET_MULTI_COUNT; i++) { - if (data[i]) { - free(data[i]); - data[i] = NULL; + if (wbuf_temp[i]) { + free(wbuf_temp[i]); + wbuf_temp[i] = NULL; } if (H5Dclose(dset_id_arr[i]) < 0) @@ -6951,8 +7383,8 @@ test_write_multi_dataset_small_point_selection(void) H5E_BEGIN_TRY { for (i = 0; i < DATASET_MULTI_COUNT; i++) { - if (data[i]) - free(data[i]); + if (wbuf_temp[i]) + free(wbuf_temp[i]); H5Dclose(dset_id_arr[i]); } @@ -6992,9 +7424,10 @@ test_write_multi_dataset_data_verification(void) hid_t mspace_id = H5I_INVALID_HID, mspace_id_arr[DATASET_MULTI_COUNT]; hid_t select_all_arr[DATASET_MULTI_COUNT]; void *data[DATASET_MULTI_COUNT]; - void *write_buf[DATASET_MULTI_COUNT]; - void *read_buf[DATASET_MULTI_COUNT]; - char dset_names[DATASET_MULTI_COUNT][DSET_NAME_BUF_SIZE]; + const void *write_buf[DATASET_MULTI_COUNT]; + void *wbuf_temp[DATASET_MULTI_COUNT]; + void *read_buf[DATASET_MULTI_COUNT]; + char dset_names[DATASET_MULTI_COUNT][DSET_NAME_BUF_SIZE]; TESTING_MULTIPART("verification of datasets' data using H5Dwrite_multi then H5Dread_multi"); @@ -7013,6 +7446,7 @@ test_write_multi_dataset_data_verification(void) select_all_arr[i] = H5S_ALL; read_buf[i] = NULL; write_buf[i] = NULL; + wbuf_temp[i] = NULL; data[i] = NULL; } @@ -7062,6 +7496,8 @@ test_write_multi_dataset_data_verification(void) for (size_t j = 0; j < data_size / DATASET_DATA_VERIFY_WRITE_TEST_DSET_DTYPESIZE; j++) ((int **)data)[i][j] = (int)j; + + write_buf[i] = (const void *)data[i]; } PASSED(); @@ -7073,7 +7509,7 @@ test_write_multi_dataset_data_verification(void) TESTING_2("H5Dwrite_multi using H5S_ALL then H5Dread_multi"); if (H5Dwrite_multi(DATASET_MULTI_COUNT, dset_id_arr, dtype_id_arr, select_all_arr, select_all_arr, - H5P_DEFAULT, (const void **)data) < 0) { + H5P_DEFAULT, (const void **)write_buf) < 0) { H5_FAILED(); printf(" couldn't write to datasets"); PART_ERROR(H5Dwrite_multi_all_read); @@ -7170,14 +7606,14 @@ test_write_multi_dataset_data_verification(void) for (i = 0; i < DATASET_MULTI_COUNT; i++) { data_size = dims[1] * 2 * DATASET_DATA_VERIFY_WRITE_TEST_DSET_DTYPESIZE; - if (NULL == (write_buf[i] = malloc(data_size))) { + if (NULL == (wbuf_temp[i] = malloc(data_size))) { H5_FAILED(); printf(" couldn't allocate buffer for dataset write\n"); PART_ERROR(H5Dwrite_multi_hyperslab_read); } for (size_t j = 0; j < data_size / DATASET_DATA_VERIFY_WRITE_TEST_DSET_DTYPESIZE; j++) { - ((int *)write_buf[i])[j] = 56; + ((int *)wbuf_temp[i])[j] = 56; } data_size = 1; @@ -7190,6 +7626,8 @@ test_write_multi_dataset_data_verification(void) printf(" couldn't allocate buffer for datasets' data verification\n"); PART_ERROR(H5Dwrite_multi_hyperslab_read); } + + write_buf[i] = (const void *)wbuf_temp[i]; } if (H5Dread_multi(DATASET_MULTI_COUNT, dset_id_arr, dtype_id_arr, select_all_arr, select_all_arr, @@ -7316,9 +7754,9 @@ test_write_multi_dataset_data_verification(void) data[i] = NULL; } - if (write_buf[i]) { - free(write_buf[i]); - write_buf[i] = NULL; + if (wbuf_temp[i]) { + free(wbuf_temp[i]); + wbuf_temp[i] = NULL; } if (read_buf[i]) { @@ -7332,14 +7770,9 @@ test_write_multi_dataset_data_verification(void) PART_END(H5Dwrite_multi_hyperslab_read); for (i = 0; i < DATASET_MULTI_COUNT; i++) { - if (data[i]) { - free(data[i]); - data[i] = NULL; - } - - if (write_buf[i]) { - free(write_buf[i]); - write_buf[i] = NULL; + if (wbuf_temp[i]) { + free(wbuf_temp[i]); + wbuf_temp[i] = NULL; } if (read_buf[i]) { @@ -7356,14 +7789,16 @@ test_write_multi_dataset_data_verification(void) DATASET_DATA_VERIFY_WRITE_TEST_NUM_POINTS * DATASET_DATA_VERIFY_WRITE_TEST_DSET_DTYPESIZE; for (i = 0; i < DATASET_MULTI_COUNT; i++) { - if (NULL == (write_buf[i] = malloc(data_size))) { + if (NULL == (wbuf_temp[i] = malloc(data_size))) { H5_FAILED(); printf(" couldn't allocate buffer for dataset write\n"); PART_ERROR(H5Dwrite_multi_point_sel_read); } for (size_t j = 0; j < data_size / DATASET_DATA_VERIFY_WRITE_TEST_DSET_DTYPESIZE; j++) - ((int **)write_buf)[i][j] = 13; + ((int **)wbuf_temp)[i][j] = 13; + + write_buf[i] = (const void *)wbuf_temp[i]; data_size = 1; @@ -7516,9 +7951,9 @@ test_write_multi_dataset_data_verification(void) data[i] = NULL; } - if (write_buf[i]) { - free(write_buf[i]); - write_buf[i] = NULL; + if (wbuf_temp[i]) { + free(wbuf_temp[i]); + wbuf_temp[i] = NULL; } if (read_buf[i]) { @@ -7549,8 +7984,8 @@ test_write_multi_dataset_data_verification(void) for (i = 0; i < DATASET_MULTI_COUNT; i++) { if (data[i]) free(data[i]); - if (write_buf[i]) - free(write_buf[i]); + if (wbuf_temp[i]) + free(wbuf_temp[i]); if (read_buf[i]) free(read_buf[i]); @@ -7809,6 +8244,251 @@ test_write_dataset_invalid_params(void) return 1; } +/* + * A test to ensure that strings of any encoding + * can be written to and read from a dataset + */ +static int +test_dataset_string_encodings(void) +{ + hid_t file_id = H5I_INVALID_HID; + hid_t container_group = H5I_INVALID_HID; + hid_t dset_id1 = H5I_INVALID_HID; + hid_t dset_id2 = H5I_INVALID_HID; + hid_t type_id1 = H5I_INVALID_HID; + hid_t type_id2 = H5I_INVALID_HID; + hid_t space_id = H5I_INVALID_HID; + hsize_t dims[DATASET_STRING_ENCODINGS_RANK] = {DATASET_STRING_ENCODINGS_EXTENT}; + size_t ascii_str_size = 0; + size_t utf8_str_size = 0; + char *write_buf = NULL; + char *read_buf = NULL; + + TESTING_MULTIPART("string encoding read/write correctness on datasets"); + + /* Make sure the connector supports the API functions being tested */ + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { + SKIPPED(); + printf(" API functions for basic file, group, basic or more dataset aren't supported with this " + "connector\n"); + return 0; + } + + TESTING_2("test setup"); + + ascii_str_size = strlen(DATASET_STRING_ENCODINGS_ASCII_STRING); + utf8_str_size = strlen(DATASET_STRING_ENCODINGS_UTF8_STRING); + + if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't open file '%s'\n", H5_api_test_filename); + goto error; + } + + if ((container_group = H5Gopen2(file_id, DATASET_TEST_GROUP_NAME, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't open container group '%s'\n", DATASET_TEST_GROUP_NAME); + goto error; + } + + if ((space_id = H5Screate_simple(DATASET_STRING_ENCODINGS_RANK, dims, NULL)) < 0) { + H5_FAILED(); + printf(" couldn't create dataspace\n"); + goto error; + } + + if ((type_id1 = H5Tcopy(H5T_C_S1)) < 0) { + H5_FAILED(); + printf(" couldn't copy builtin string datatype\n"); + goto error; + } + + if ((H5Tset_size(type_id1, ascii_str_size)) < 0) { + H5_FAILED(); + printf(" couldn't set size of string datatype\n"); + goto error; + } + + if ((H5Tset_cset(type_id1, H5T_CSET_ASCII)) < 0) { + H5_FAILED(); + printf(" couldn't set character set of string to ASCII\n"); + goto error; + } + + if ((dset_id1 = H5Dcreate(container_group, DATASET_STRING_ENCODINGS_DSET_NAME1, type_id1, space_id, + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't create dataset with ascii string\n"); + goto error; + } + + if ((type_id2 = H5Tcopy(H5T_C_S1)) < 0) { + H5_FAILED(); + printf(" couldn't copy builtin string datatype\n"); + goto error; + } + + if ((H5Tset_size(type_id2, utf8_str_size)) < 0) { + H5_FAILED(); + printf(" couldn't set size of string datatype\n"); + goto error; + } + + if ((H5Tset_cset(type_id2, H5T_CSET_UTF8)) < 0) { + H5_FAILED(); + printf(" couldn't set character set of string to UTF-8\n"); + goto error; + } + + if ((dset_id2 = H5Dcreate(container_group, DATASET_STRING_ENCODINGS_DSET_NAME2, type_id2, space_id, + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't create dataset with UTF-8 string\n"); + goto error; + } + + PASSED(); + + BEGIN_MULTIPART + { + PART_BEGIN(ASCII_cset) + { + TESTING_2("ASCII character set"); + /* Dataset with ASCII string datatype */ + if ((write_buf = calloc(1, ascii_str_size + 1)) == NULL) { + H5_FAILED(); + printf(" couldn't allocate memory for write buffer\n"); + PART_ERROR(ASCII_cset); + } + + memcpy(write_buf, DATASET_STRING_ENCODINGS_ASCII_STRING, ascii_str_size); + + if ((H5Dwrite(dset_id1, type_id1, H5S_ALL, H5S_ALL, H5P_DEFAULT, write_buf)) < 0) { + H5_FAILED(); + printf(" couldn't write to dataset with ASCII string\n"); + PART_ERROR(ASCII_cset); + } + + if ((read_buf = calloc(1, ascii_str_size + 1)) == NULL) { + H5_FAILED(); + printf(" couldn't allocate memory for read buffer\n"); + PART_ERROR(ASCII_cset); + } + + if ((H5Dread(dset_id1, type_id1, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf)) < 0) { + H5_FAILED(); + printf(" couldn't read from dataset with ASCII string\n"); + PART_ERROR(ASCII_cset); + } + + if (strncmp(write_buf, read_buf, ascii_str_size)) { + H5_FAILED(); + printf(" incorrect data read from dataset with ASCII string\n"); + PART_ERROR(ASCII_cset); + } + + free(write_buf); + write_buf = NULL; + + free(read_buf); + read_buf = NULL; + + PASSED(); + } + PART_END(ASCII_cset); + + PART_BEGIN(UTF8_cset) + { + TESTING_2("UTF-8 character set"); + /* Dataset with UTF-8 string datatype */ + if ((write_buf = calloc(1, utf8_str_size + 1)) == NULL) { + H5_FAILED(); + printf(" couldn't allocate memory for write buffer\n"); + PART_ERROR(UTF8_cset); + } + + memcpy(write_buf, DATASET_STRING_ENCODINGS_UTF8_STRING, utf8_str_size); + + if ((H5Dwrite(dset_id2, type_id2, H5S_ALL, H5S_ALL, H5P_DEFAULT, write_buf)) < 0) { + H5_FAILED(); + printf(" couldn't write to dataset with ASCII string\n"); + PART_ERROR(UTF8_cset); + } + + if ((read_buf = calloc(1, utf8_str_size + 1)) == NULL) { + H5_FAILED(); + printf(" couldn't allocate memory for read buffer\n"); + PART_ERROR(UTF8_cset); + } + + if ((H5Dread(dset_id2, type_id2, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf)) < 0) { + H5_FAILED(); + printf(" couldn't read from dataset with ASCII string\n"); + PART_ERROR(UTF8_cset); + } + + if (strncmp(write_buf, read_buf, utf8_str_size)) { + H5_FAILED(); + printf(" incorrect data read from dataset with ASCII string\n"); + PART_ERROR(UTF8_cset); + } + + free(write_buf); + write_buf = NULL; + + free(read_buf); + read_buf = NULL; + + PASSED(); + } + PART_END(UTF8_cset); + + PASSED(); + } + END_MULTIPART; + + TESTING_2("test cleanup"); + + if (H5Fclose(file_id) < 0) + TEST_ERROR; + if (H5Gclose(container_group) < 0) + TEST_ERROR; + if (H5Dclose(dset_id1) < 0) + TEST_ERROR; + if (H5Dclose(dset_id2) < 0) + TEST_ERROR; + if (H5Tclose(type_id1) < 0) + TEST_ERROR; + if (H5Tclose(type_id2) < 0) + TEST_ERROR; + if (write_buf) + free(write_buf); + if (read_buf) + free(read_buf); + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY + { + H5Fclose(file_id); + H5Gclose(container_group); + H5Dclose(dset_id1); + H5Dclose(dset_id2); + H5Tclose(type_id1); + H5Tclose(type_id2); + if (write_buf) + free(write_buf); + if (read_buf) + free(read_buf); + } + H5E_END_TRY; + + return 1; +} + /* * A test to ensure that data is read back correctly from a dataset after it has * been written, using type conversion with builtin types. @@ -8347,40 +9027,37 @@ test_dataset_builtin_type_conversion(void) return 1; } -/* - * A test to ensure that data is read back correctly from a dataset after it has - * been written, using partial element I/O with compound types - */ -typedef struct dataset_compount_partial_io_t { - int a; - int b; -} dataset_compount_partial_io_t; - static int -test_dataset_compound_partial_io(void) +test_dataset_real_to_int_conversion(void) { - hsize_t dims[1] = {DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS}; - size_t i; - hid_t file_id = H5I_INVALID_HID; - hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; - hid_t dset_id = H5I_INVALID_HID; - hid_t space_id = H5I_INVALID_HID; - hid_t full_type_id = H5I_INVALID_HID; - hid_t a_type_id = H5I_INVALID_HID; - hid_t b_type_id = H5I_INVALID_HID; - dataset_compount_partial_io_t wbuf[DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS]; - dataset_compount_partial_io_t rbuf[DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS]; - dataset_compount_partial_io_t fbuf[DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS]; - dataset_compount_partial_io_t erbuf[DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS]; + hssize_t space_npoints; + hsize_t dims[DATASET_DATA_REAL_CONVERSION_TEST_DSET_SPACE_RANK] = {10, 10, 10}; + hsize_t start[DATASET_DATA_REAL_CONVERSION_TEST_DSET_SPACE_RANK]; + hsize_t stride[DATASET_DATA_REAL_CONVERSION_TEST_DSET_SPACE_RANK]; + hsize_t count[DATASET_DATA_REAL_CONVERSION_TEST_DSET_SPACE_RANK]; + hsize_t block[DATASET_DATA_REAL_CONVERSION_TEST_DSET_SPACE_RANK]; + hsize_t points[DATASET_DATA_REAL_CONVERSION_TEST_NUM_POINTS * + DATASET_DATA_REAL_CONVERSION_TEST_DSET_SPACE_RANK]; + size_t i, data_size; + hid_t file_id = H5I_INVALID_HID; + hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; + hid_t dset_id = H5I_INVALID_HID; + hid_t fspace_id = H5I_INVALID_HID; + hid_t mspace_id = H5I_INVALID_HID; + hid_t real_type_id = DATASET_DATA_REAL_CONVERSION_TEST_REAL_TYPE; + void *data = NULL; + void *write_buf = NULL; + void *read_buf = NULL; TESTING_MULTIPART( - "verification of dataset data using H5Dwrite then H5Dread with partial element compound type I/O"); + "verification of dataset data using H5Dwrite then H5Dread with real <-> integer type conversion"); /* Make sure the connector supports the API functions being tested */ if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); - printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); + printf(" API functions for basic file, group, basic or more dataset aren't supported with this " + "connector\n"); return 0; } @@ -8398,211 +9075,1404 @@ test_dataset_compound_partial_io(void) goto error; } - if ((group_id = H5Gcreate2(container_group, DATASET_DATA_COMPOUND_PARTIAL_IO_TEST_GROUP_NAME, H5P_DEFAULT, + if ((group_id = H5Gcreate2(container_group, DATASET_DATA_REAL_CONVERSION_TEST_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); printf(" couldn't create container sub-group '%s'\n", - DATASET_DATA_COMPOUND_PARTIAL_IO_TEST_GROUP_NAME); + DATASET_DATA_REAL_CONVERSION_TEST_GROUP_NAME); goto error; } - if ((space_id = H5Screate_simple(1, dims, NULL)) < 0) - TEST_ERROR; - - if ((full_type_id = H5Tcreate(H5T_COMPOUND, sizeof(dataset_compount_partial_io_t))) < 0) - TEST_ERROR; - if (H5Tinsert(full_type_id, "a", HOFFSET(dataset_compount_partial_io_t, a), H5T_NATIVE_INT) < 0) - TEST_ERROR; - if (H5Tinsert(full_type_id, "b", HOFFSET(dataset_compount_partial_io_t, b), H5T_NATIVE_INT) < 0) - TEST_ERROR; - - if ((a_type_id = H5Tcreate(H5T_COMPOUND, sizeof(dataset_compount_partial_io_t))) < 0) - TEST_ERROR; - if (H5Tinsert(a_type_id, "a", HOFFSET(dataset_compount_partial_io_t, a), H5T_NATIVE_INT) < 0) - TEST_ERROR; - - if ((b_type_id = H5Tcreate(H5T_COMPOUND, sizeof(dataset_compount_partial_io_t))) < 0) - TEST_ERROR; - if (H5Tinsert(b_type_id, "b", HOFFSET(dataset_compount_partial_io_t, b), H5T_NATIVE_INT) < 0) + if ((fspace_id = H5Screate_simple(DATASET_DATA_REAL_CONVERSION_TEST_DSET_SPACE_RANK, dims, NULL)) < 0) TEST_ERROR; - if ((dset_id = H5Dcreate2(group_id, DATASET_DATA_COMPOUND_PARTIAL_IO_TEST_DSET_NAME, full_type_id, - space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + if ((dset_id = H5Dcreate2(group_id, DATASET_DATA_REAL_CONVERSION_TEST_DSET_NAME, real_type_id, fspace_id, + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" couldn't create dataset '%s'\n", DATASET_DATA_COMPOUND_PARTIAL_IO_TEST_DSET_NAME); + printf(" couldn't create dataset '%s'\n", DATASET_DATA_REAL_CONVERSION_TEST_DSET_NAME); goto error; } + for (i = 0, data_size = 1; i < DATASET_DATA_REAL_CONVERSION_TEST_DSET_SPACE_RANK; i++) + data_size *= dims[i]; + data_size *= DATASET_DATA_REAL_CONVERSION_TEST_INT_DTYPESIZE; + + if (NULL == (data = malloc(data_size))) + TEST_ERROR; + + for (i = 0; i < data_size / DATASET_DATA_REAL_CONVERSION_TEST_INT_DTYPESIZE; i++) + ((int *)data)[i] = (int)i; + + PASSED(); + + BEGIN_MULTIPART + { + PART_BEGIN(H5Dwrite_all_read) + { + TESTING_2("write then read int from real dataset with H5S_ALL selection"); + + if (H5Dwrite(dset_id, DATASET_DATA_REAL_CONVERSION_TEST_INT_TYPE, H5S_ALL, H5S_ALL, H5P_DEFAULT, + data) < 0) { + H5_FAILED(); + printf(" couldn't write to dataset '%s'\n", DATASET_DATA_REAL_CONVERSION_TEST_DSET_NAME); + PART_ERROR(H5Dwrite_all_read); + } + + if (data) { + free(data); + data = NULL; + } + + if (fspace_id >= 0) { + H5E_BEGIN_TRY + { + H5Sclose(fspace_id); + } + H5E_END_TRY; + fspace_id = H5I_INVALID_HID; + } + if (dset_id >= 0) { + H5E_BEGIN_TRY + { + H5Dclose(dset_id); + } + H5E_END_TRY; + dset_id = H5I_INVALID_HID; + } + + if ((dset_id = H5Dopen2(group_id, DATASET_DATA_REAL_CONVERSION_TEST_DSET_NAME, H5P_DEFAULT)) < + 0) { + H5_FAILED(); + printf(" couldn't open dataset '%s'\n", DATASET_DATA_REAL_CONVERSION_TEST_DSET_NAME); + PART_ERROR(H5Dwrite_all_read); + } + + if ((fspace_id = H5Dget_space(dset_id)) < 0) { + H5_FAILED(); + printf(" couldn't get dataset dataspace\n"); + PART_ERROR(H5Dwrite_all_read); + } + + if ((space_npoints = H5Sget_simple_extent_npoints(fspace_id)) < 0) { + H5_FAILED(); + printf(" couldn't get dataspace num points\n"); + PART_ERROR(H5Dwrite_all_read); + } + + if (NULL == + (data = malloc((hsize_t)space_npoints * DATASET_DATA_REAL_CONVERSION_TEST_INT_DTYPESIZE))) { + H5_FAILED(); + printf(" couldn't allocate buffer for dataset read\n"); + PART_ERROR(H5Dwrite_all_read); + } + + if (H5Dread(dset_id, DATASET_DATA_REAL_CONVERSION_TEST_INT_TYPE, H5S_ALL, H5S_ALL, H5P_DEFAULT, + data) < 0) { + H5_FAILED(); + printf(" couldn't read from dataset '%s'\n", DATASET_DATA_REAL_CONVERSION_TEST_DSET_NAME); + PART_ERROR(H5Dwrite_all_read); + } + + for (i = 0; i < (hsize_t)space_npoints; i++) + if (((int *)data)[i] != (int)i) { + H5_FAILED(); + printf(" H5S_ALL selection data verification failed\n"); + PART_ERROR(H5Dwrite_all_read); + } + + if (data) { + free(data); + data = NULL; + } + + PASSED(); + } + PART_END(H5Dwrite_all_read); + + if (data) { + free(data); + data = NULL; + } + + if (write_buf) { + free(write_buf); + write_buf = NULL; + } + + if (read_buf) { + free(read_buf); + read_buf = NULL; + } + + PART_BEGIN(H5Dwrite_hyperslab_read) + { + TESTING_2("write then read int from real dataset with hyperslab selection"); + + data_size = dims[1] * 2 * DATASET_DATA_REAL_CONVERSION_TEST_INT_DTYPESIZE; + + if (NULL == (write_buf = malloc(data_size))) { + H5_FAILED(); + printf(" couldn't allocate buffer for dataset write\n"); + PART_ERROR(H5Dwrite_hyperslab_read); + } + + for (i = 0; i < data_size / DATASET_DATA_REAL_CONVERSION_TEST_INT_DTYPESIZE; i++) + ((int *)write_buf)[i] = 56; + + for (i = 0, data_size = 1; i < DATASET_DATA_REAL_CONVERSION_TEST_DSET_SPACE_RANK; i++) + data_size *= dims[i]; + data_size *= DATASET_DATA_REAL_CONVERSION_TEST_INT_DTYPESIZE; + + if (NULL == (data = calloc(1, data_size))) { + H5_FAILED(); + printf(" couldn't allocate buffer for dataset data verification\n"); + PART_ERROR(H5Dwrite_hyperslab_read); + } + + for (i = 0; i < dims[0] * dims[1] * dims[2]; i++) + ((int *)data)[i] = (int)i; + + for (i = 0; i < 2; i++) { + size_t j; + + for (j = 0; j < dims[1]; j++) + ((int *)data)[(i * dims[1] * dims[2]) + (j * dims[2])] = 56; + } + + /* Write to first two rows of dataset */ + start[0] = start[1] = start[2] = 0; + stride[0] = stride[1] = stride[2] = 1; + count[0] = 2; + count[1] = dims[1]; + count[2] = 1; + block[0] = block[1] = block[2] = 1; + + if (H5Sselect_hyperslab(fspace_id, H5S_SELECT_SET, start, stride, count, block) < 0) { + H5_FAILED(); + printf(" couldn't select hyperslab for dataset write\n"); + PART_ERROR(H5Dwrite_hyperslab_read); + } + + { + hsize_t mdims[] = {(hsize_t)2 * dims[1]}; + + if ((mspace_id = H5Screate_simple(1, mdims, NULL)) < 0) { + H5_FAILED(); + printf(" couldn't create memory dataspace\n"); + PART_ERROR(H5Dwrite_hyperslab_read); + } + } + + if (H5Dwrite(dset_id, DATASET_DATA_REAL_CONVERSION_TEST_INT_TYPE, mspace_id, fspace_id, + H5P_DEFAULT, write_buf) < 0) { + H5_FAILED(); + printf(" couldn't write to dataset '%s'\n", DATASET_DATA_REAL_CONVERSION_TEST_DSET_NAME); + PART_ERROR(H5Dwrite_hyperslab_read); + } + + if (mspace_id >= 0) { + H5E_BEGIN_TRY + { + H5Sclose(mspace_id); + } + H5E_END_TRY; + mspace_id = H5I_INVALID_HID; + } + if (fspace_id >= 0) { + H5E_BEGIN_TRY + { + H5Sclose(fspace_id); + } + H5E_END_TRY; + fspace_id = H5I_INVALID_HID; + } + if (dset_id >= 0) { + H5E_BEGIN_TRY + { + H5Dclose(dset_id); + } + H5E_END_TRY; + dset_id = H5I_INVALID_HID; + } + + if ((dset_id = H5Dopen2(group_id, DATASET_DATA_REAL_CONVERSION_TEST_DSET_NAME, H5P_DEFAULT)) < + 0) { + H5_FAILED(); + printf(" couldn't open dataset '%s'\n", DATASET_DATA_REAL_CONVERSION_TEST_DSET_NAME); + PART_ERROR(H5Dwrite_hyperslab_read); + } + + if ((fspace_id = H5Dget_space(dset_id)) < 0) { + H5_FAILED(); + printf(" couldn't get dataset dataspace\n"); + PART_ERROR(H5Dwrite_hyperslab_read); + } + + if ((space_npoints = H5Sget_simple_extent_npoints(fspace_id)) < 0) { + H5_FAILED(); + printf(" couldn't get dataspace num points\n"); + PART_ERROR(H5Dwrite_hyperslab_read); + } + + if (NULL == (read_buf = malloc((hsize_t)space_npoints * + DATASET_DATA_REAL_CONVERSION_TEST_INT_DTYPESIZE))) { + H5_FAILED(); + printf(" couldn't allocate buffer for dataset read\n"); + PART_ERROR(H5Dwrite_hyperslab_read); + } + + if (H5Dread(dset_id, DATASET_DATA_REAL_CONVERSION_TEST_INT_TYPE, H5S_ALL, H5S_ALL, H5P_DEFAULT, + read_buf) < 0) { + H5_FAILED(); + printf(" couldn't read from dataset '%s'\n", DATASET_DATA_REAL_CONVERSION_TEST_DSET_NAME); + PART_ERROR(H5Dwrite_hyperslab_read); + } + + if (memcmp(data, read_buf, data_size)) { + H5_FAILED(); + printf(" hyperslab selection data verification failed\n"); + PART_ERROR(H5Dwrite_hyperslab_read); + } + + if (data) { + free(data); + data = NULL; + } + + if (write_buf) { + free(write_buf); + write_buf = NULL; + } + + if (read_buf) { + free(read_buf); + read_buf = NULL; + } + + PASSED(); + } + PART_END(H5Dwrite_hyperslab_read); + + if (data) { + free(data); + data = NULL; + } + + if (write_buf) { + free(write_buf); + write_buf = NULL; + } + + if (read_buf) { + free(read_buf); + read_buf = NULL; + } + + PART_BEGIN(H5Dwrite_point_sel_read) + { + TESTING_2("write then read int from real dataset with point selection"); + + data_size = DATASET_DATA_REAL_CONVERSION_TEST_NUM_POINTS * + DATASET_DATA_REAL_CONVERSION_TEST_INT_DTYPESIZE; + + if (NULL == (write_buf = malloc(data_size))) { + H5_FAILED(); + printf(" couldn't allocate buffer for dataset write\n"); + PART_ERROR(H5Dwrite_point_sel_read); + } + + for (i = 0; i < data_size / DATASET_DATA_REAL_CONVERSION_TEST_INT_DTYPESIZE; i++) + ((int *)write_buf)[i] = 13; + + for (i = 0, data_size = 1; i < DATASET_DATA_REAL_CONVERSION_TEST_DSET_SPACE_RANK; i++) + data_size *= dims[i]; + data_size *= DATASET_DATA_REAL_CONVERSION_TEST_INT_DTYPESIZE; + + if (NULL == (data = malloc(data_size))) { + H5_FAILED(); + printf(" couldn't allocate buffer for dataset data verification\n"); + PART_ERROR(H5Dwrite_point_sel_read); + } + + if (H5Dread(dset_id, DATASET_DATA_REAL_CONVERSION_TEST_INT_TYPE, H5S_ALL, H5S_ALL, H5P_DEFAULT, + data) < 0) { + H5_FAILED(); + printf(" couldn't read from dataset '%s'\n", DATASET_DATA_REAL_CONVERSION_TEST_DSET_NAME); + PART_ERROR(H5Dwrite_point_sel_read); + } + + for (i = 0; i < dims[0]; i++) { + size_t j; + + for (j = 0; j < dims[1]; j++) { + size_t k; + + for (k = 0; k < dims[2]; k++) { + if (i == j && j == k) + ((int *)data)[(i * dims[1] * dims[2]) + (j * dims[2]) + k] = 13; + } + } + } + + /* Select a series of 10 points in the dataset */ + for (i = 0; i < DATASET_DATA_REAL_CONVERSION_TEST_NUM_POINTS; i++) { + size_t j; + + for (j = 0; j < DATASET_DATA_REAL_CONVERSION_TEST_DSET_SPACE_RANK; j++) + points[(i * DATASET_DATA_REAL_CONVERSION_TEST_DSET_SPACE_RANK) + j] = i; + } + + if (H5Sselect_elements(fspace_id, H5S_SELECT_SET, DATASET_DATA_REAL_CONVERSION_TEST_NUM_POINTS, + points) < 0) { + H5_FAILED(); + printf(" couldn't select elements in dataspace\n"); + PART_ERROR(H5Dwrite_point_sel_read); + } + + { + hsize_t mdims[] = {(hsize_t)DATASET_DATA_REAL_CONVERSION_TEST_NUM_POINTS}; + + if ((mspace_id = H5Screate_simple(1, mdims, NULL)) < 0) { + H5_FAILED(); + printf(" couldn't create memory dataspace\n"); + PART_ERROR(H5Dwrite_point_sel_read); + } + } + + if (H5Dwrite(dset_id, DATASET_DATA_REAL_CONVERSION_TEST_INT_TYPE, mspace_id, fspace_id, + H5P_DEFAULT, write_buf) < 0) { + H5_FAILED(); + printf(" couldn't write to dataset '%s'\n", DATASET_DATA_REAL_CONVERSION_TEST_DSET_NAME); + PART_ERROR(H5Dwrite_point_sel_read); + } + + if (mspace_id >= 0) { + H5E_BEGIN_TRY + { + H5Sclose(mspace_id); + } + H5E_END_TRY; + mspace_id = H5I_INVALID_HID; + } + if (fspace_id >= 0) { + H5E_BEGIN_TRY + { + H5Sclose(fspace_id); + } + H5E_END_TRY; + fspace_id = H5I_INVALID_HID; + } + if (dset_id >= 0) { + H5E_BEGIN_TRY + { + H5Dclose(dset_id); + } + H5E_END_TRY; + dset_id = H5I_INVALID_HID; + } + + if ((dset_id = H5Dopen2(group_id, DATASET_DATA_REAL_CONVERSION_TEST_DSET_NAME, H5P_DEFAULT)) < + 0) { + H5_FAILED(); + printf(" couldn't open dataset '%s'\n", DATASET_DATA_REAL_CONVERSION_TEST_DSET_NAME); + PART_ERROR(H5Dwrite_point_sel_read); + } + + if ((fspace_id = H5Dget_space(dset_id)) < 0) { + H5_FAILED(); + printf(" couldn't get dataset dataspace\n"); + PART_ERROR(H5Dwrite_point_sel_read); + } + + if ((space_npoints = H5Sget_simple_extent_npoints(fspace_id)) < 0) { + H5_FAILED(); + printf(" couldn't get dataspace num points\n"); + PART_ERROR(H5Dwrite_point_sel_read); + } + + if (NULL == (read_buf = malloc((hsize_t)space_npoints * + DATASET_DATA_REAL_CONVERSION_TEST_INT_DTYPESIZE))) { + H5_FAILED(); + printf(" couldn't allocate buffer for dataset read\n"); + PART_ERROR(H5Dwrite_point_sel_read); + } + + if (H5Dread(dset_id, DATASET_DATA_REAL_CONVERSION_TEST_INT_TYPE, H5S_ALL, H5S_ALL, H5P_DEFAULT, + read_buf) < 0) { + H5_FAILED(); + printf(" couldn't read from dataset '%s'\n", DATASET_DATA_REAL_CONVERSION_TEST_DSET_NAME); + PART_ERROR(H5Dwrite_point_sel_read); + } + + if (memcmp(data, read_buf, data_size)) { + H5_FAILED(); + printf(" point selection data verification failed\n"); + PART_ERROR(H5Dwrite_point_sel_read); + } + + PASSED(); + } + PART_END(H5Dwrite_point_sel_read); + } + END_MULTIPART; + + TESTING_2("test cleanup"); + + if (data) { + free(data); + data = NULL; + } + + if (write_buf) { + free(write_buf); + write_buf = NULL; + } + + if (read_buf) { + free(read_buf); + read_buf = NULL; + } + + if (H5Sclose(fspace_id) < 0) + TEST_ERROR; + if (H5Dclose(dset_id) < 0) + TEST_ERROR; + if (H5Gclose(group_id) < 0) + TEST_ERROR; + if (H5Gclose(container_group) < 0) + TEST_ERROR; + if (H5Fclose(file_id) < 0) + TEST_ERROR; + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY + { + if (data) + free(data); + if (write_buf) + free(write_buf); + if (read_buf) + free(read_buf); + H5Sclose(mspace_id); + H5Sclose(fspace_id); + H5Dclose(dset_id); + H5Gclose(group_id); + H5Gclose(container_group); + H5Fclose(file_id); + } + H5E_END_TRY; + + return 1; +} + +/* + * A test to ensure that data is read back correctly from a dataset after it has + * been written, using partial element I/O with compound types + */ +typedef struct dataset_compount_partial_io_t { + int a; + int b; +} dataset_compount_partial_io_t; + +static int +test_dataset_compound_partial_io(void) +{ + hsize_t dims[1] = {DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS}; + size_t i; + hid_t file_id = H5I_INVALID_HID; + hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; + hid_t dset_id = H5I_INVALID_HID; + hid_t space_id = H5I_INVALID_HID; + hid_t full_type_id = H5I_INVALID_HID; + hid_t a_type_id = H5I_INVALID_HID; + hid_t b_type_id = H5I_INVALID_HID; + dataset_compount_partial_io_t wbuf[DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS]; + dataset_compount_partial_io_t rbuf[DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS]; + dataset_compount_partial_io_t fbuf[DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS]; + dataset_compount_partial_io_t erbuf[DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS]; + + TESTING_MULTIPART("verification of dataset data using H5Dwrite then H5Dread with partial element " + "compound type I/O"); + + /* Make sure the connector supports the API functions being tested */ + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { + SKIPPED(); + printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); + return 0; + } + + TESTING_2("test setup"); + + if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't open file '%s'\n", H5_api_test_filename); + goto error; + } + + if ((container_group = H5Gopen2(file_id, DATASET_TEST_GROUP_NAME, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't open container group '%s'\n", DATASET_TEST_GROUP_NAME); + goto error; + } + + if ((group_id = H5Gcreate2(container_group, DATASET_DATA_COMPOUND_PARTIAL_IO_TEST_GROUP_NAME, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't create container sub-group '%s'\n", + DATASET_DATA_COMPOUND_PARTIAL_IO_TEST_GROUP_NAME); + goto error; + } + + if ((space_id = H5Screate_simple(1, dims, NULL)) < 0) + TEST_ERROR; + + if ((full_type_id = H5Tcreate(H5T_COMPOUND, sizeof(dataset_compount_partial_io_t))) < 0) + TEST_ERROR; + if (H5Tinsert(full_type_id, "a", HOFFSET(dataset_compount_partial_io_t, a), H5T_NATIVE_INT) < 0) + TEST_ERROR; + if (H5Tinsert(full_type_id, "b", HOFFSET(dataset_compount_partial_io_t, b), H5T_NATIVE_INT) < 0) + TEST_ERROR; + + if ((a_type_id = H5Tcreate(H5T_COMPOUND, sizeof(dataset_compount_partial_io_t))) < 0) + TEST_ERROR; + if (H5Tinsert(a_type_id, "a", HOFFSET(dataset_compount_partial_io_t, a), H5T_NATIVE_INT) < 0) + TEST_ERROR; + + if ((b_type_id = H5Tcreate(H5T_COMPOUND, sizeof(dataset_compount_partial_io_t))) < 0) + TEST_ERROR; + if (H5Tinsert(b_type_id, "b", HOFFSET(dataset_compount_partial_io_t, b), H5T_NATIVE_INT) < 0) + TEST_ERROR; + + if ((dset_id = H5Dcreate2(group_id, DATASET_DATA_COMPOUND_PARTIAL_IO_TEST_DSET_NAME, full_type_id, + space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't create dataset '%s'\n", DATASET_DATA_COMPOUND_PARTIAL_IO_TEST_DSET_NAME); + goto error; + } + + PASSED(); + + BEGIN_MULTIPART + { + PART_BEGIN(write_full_read_full) + { + TESTING_2("H5Dwrite then H5Dread with all compound members"); + + /* Initialize wbuf */ + for (i = 0; i < DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS; i++) { + wbuf[i].a = (int)(2 * i); + wbuf[i].b = (int)(2 * i + 1); + } + + /* Write data */ + if (H5Dwrite(dset_id, full_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) + PART_TEST_ERROR(write_full_read_full); + + /* Update fbuf to match file state */ + for (i = 0; i < DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS; i++) { + fbuf[i].a = wbuf[i].a; + fbuf[i].b = wbuf[i].b; + } + + /* Initialize rbuf to -1 */ + for (i = 0; i < DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS; i++) { + rbuf[i].a = -1; + rbuf[i].b = -1; + } + + /* Set erbuf (simply match file state since we're reading the whole + * thing) */ + for (i = 0; i < DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS; i++) { + erbuf[i].a = fbuf[i].a; + erbuf[i].b = fbuf[i].b; + } + + /* Read data */ + if (H5Dread(dset_id, full_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) + PART_TEST_ERROR(write_full_read_full); + + /* Verify data */ + for (i = 0; i < DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS; i++) { + if (rbuf[i].a != erbuf[i].a) + PART_TEST_ERROR(write_full_read_full); + if (rbuf[i].b != erbuf[i].b) + PART_TEST_ERROR(write_full_read_full); + } + + PASSED(); + } + PART_END(write_full_read_full); + + PART_BEGIN(read_a) + { + TESTING_2("H5Dread with compound member a"); + + /* Initialize rbuf to -1 */ + for (i = 0; i < DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS; i++) { + rbuf[i].a = -1; + rbuf[i].b = -1; + } + + /* Set erbuf (element a comes from the file, element b in untouched) + */ + for (i = 0; i < DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS; i++) { + erbuf[i].a = fbuf[i].a; + erbuf[i].b = rbuf[i].b; + } + + /* Read data */ + if (H5Dread(dset_id, a_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) + PART_TEST_ERROR(read_a); + + /* Verify data */ + for (i = 0; i < DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS; i++) { + if (rbuf[i].a != erbuf[i].a) + PART_TEST_ERROR(read_a); + if (rbuf[i].b != erbuf[i].b) + PART_TEST_ERROR(read_a); + } + + PASSED(); + } + PART_END(read_a); + + PART_BEGIN(write_b_read_full) + { + TESTING_2("H5Dwrite with compound member b then H5Dread with all compound members"); + + /* Initialize wbuf */ + for (i = 0; i < DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS; i++) { + wbuf[i].a = (int)(2 * DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS + 2 * i); + wbuf[i].b = (int)(2 * DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS + 2 * i + 1); + } + + /* Write data */ + if (H5Dwrite(dset_id, b_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) + PART_TEST_ERROR(write_b_read_full); + + /* Update fbuf to match file state - only element b was updated */ + for (i = 0; i < DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS; i++) { + fbuf[i].b = wbuf[i].b; + } + + /* Initialize rbuf to -1 */ + for (i = 0; i < DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS; i++) { + rbuf[i].a = -1; + rbuf[i].b = -1; + } + + /* Set erbuf (simply match file state since we're reading the whole + * thing) */ + for (i = 0; i < DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS; i++) { + erbuf[i].a = fbuf[i].a; + erbuf[i].b = fbuf[i].b; + } + + /* Read data */ + if (H5Dread(dset_id, full_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) + PART_TEST_ERROR(write_b_read_full); + + /* Verify data */ + for (i = 0; i < DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS; i++) { + if (rbuf[i].a != erbuf[i].a) + PART_TEST_ERROR(write_b_read_full); + if (rbuf[i].b != erbuf[i].b) + PART_TEST_ERROR(write_b_read_full); + } + + PASSED(); + } + PART_END(write_b_read_full); + } + END_MULTIPART; + + TESTING_2("test cleanup"); + + if (H5Sclose(space_id) < 0) + TEST_ERROR; + if (H5Dclose(dset_id) < 0) + TEST_ERROR; + if (H5Gclose(group_id) < 0) + TEST_ERROR; + if (H5Gclose(container_group) < 0) + TEST_ERROR; + if (H5Fclose(file_id) < 0) + TEST_ERROR; + if (H5Tclose(full_type_id) < 0) + TEST_ERROR; + if (H5Tclose(a_type_id) < 0) + TEST_ERROR; + if (H5Tclose(b_type_id) < 0) + TEST_ERROR; + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY + { + H5Sclose(space_id); + H5Dclose(dset_id); + H5Gclose(group_id); + H5Gclose(container_group); + H5Fclose(file_id); + H5Tclose(full_type_id); + H5Tclose(a_type_id); + H5Tclose(b_type_id); + } + H5E_END_TRY + + return 1; +} + +/* A test to check that vlen sequences can be written and read back + * with basic parent types and selections */ +static int +test_dataset_vlen_io(void) +{ + hid_t file_id = H5I_INVALID_HID; + hid_t container_group = H5I_INVALID_HID; + hid_t space_id = H5I_INVALID_HID; + hid_t dset_int = H5I_INVALID_HID; + hid_t dset_float = H5I_INVALID_HID; + hid_t dset_string = H5I_INVALID_HID; + hid_t vlen_int = H5I_INVALID_HID; + hid_t vlen_float = H5I_INVALID_HID; + hid_t vlen_string = H5I_INVALID_HID; + hid_t str_base_type = H5I_INVALID_HID; + + hsize_t dims[1] = {DATASET_VLEN_IO_DSET_DIMS}; + hsize_t point_coords[DATASET_VLEN_IO_DSET_DIMS / 2]; + + hvl_t wbuf[DATASET_VLEN_IO_DSET_DIMS]; + hvl_t rbuf[DATASET_VLEN_IO_DSET_DIMS]; + + TESTING_MULTIPART( + "verification of dataset data with H5Dwrite and then H5D read with variable length sequence data"); + + /* Make sure the connector supports the API functions being tested */ + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { + SKIPPED(); + printf(" API functions for basic file, group, or dataset aren't supported with this " + "connector\n"); + return 0; + } + + TESTING_2("test setup"); + + if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't open file '%s'\n", H5_api_test_filename); + goto error; + } + + if ((container_group = H5Gopen2(file_id, DATASET_TEST_GROUP_NAME, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't open container group '%s'\n", DATASET_TEST_GROUP_NAME); + goto error; + } + + if ((space_id = H5Screate_simple(1, dims, NULL)) < 0) { + H5_FAILED(); + printf(" couldn't create dataspace"); + goto error; + } + + if ((vlen_int = H5Tvlen_create(H5T_NATIVE_INT)) < 0) { + H5_FAILED(); + printf(" couldn't create vlen integer sequence"); + goto error; + } + + if ((vlen_float = H5Tvlen_create(H5T_NATIVE_FLOAT)) < 0) { + H5_FAILED(); + printf(" couldn't create vlen float sequence"); + goto error; + } + + if ((str_base_type = H5Tcopy(H5T_C_S1)) < 0) + TEST_ERROR; + + if ((H5Tset_size(str_base_type, DATASET_VLEN_IO_STR_LEN)) < 0) + TEST_ERROR; + + if ((vlen_string = H5Tvlen_create(str_base_type)) < 0) { + H5_FAILED(); + printf(" couldn't create vlen string sequence"); + goto error; + } + + if ((dset_int = H5Dcreate2(container_group, DATASET_VLEN_IO_DSET_NAME "_int", vlen_int, space_id, + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't create dataset with vlen integer sequence datatype"); + goto error; + } + + if ((dset_float = H5Dcreate2(container_group, DATASET_VLEN_IO_DSET_NAME "_float", vlen_float, space_id, + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't create dataset with vlen float sequence datatype"); + goto error; + } + + if ((dset_string = H5Dcreate2(container_group, DATASET_VLEN_IO_DSET_NAME "_string", vlen_string, space_id, + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't create dataset with vlen string sequence datatype"); + goto error; + } + + /* Close datasets until individual tests */ + if (H5Dclose(dset_int) < 0) { + H5_FAILED(); + printf(" couldn't close dataset with vlen integer sequence datatype"); + } + + dset_int = H5I_INVALID_HID; + + if (H5Dclose(dset_float) < 0) { + H5_FAILED(); + printf(" couldn't close dataset with vlen float sequence datatype"); + } + + dset_float = H5I_INVALID_HID; + + if (H5Dclose(dset_string) < 0) { + H5_FAILED(); + printf(" couldn't close dataset with vlen string sequence datatype"); + } + + dset_string = H5I_INVALID_HID; + + memset(wbuf, 0, sizeof(hvl_t) * DATASET_VLEN_IO_DSET_DIMS); + memset(rbuf, 0, sizeof(hvl_t) * DATASET_VLEN_IO_DSET_DIMS); + PASSED(); BEGIN_MULTIPART { - PART_BEGIN(write_full_read_full) + PART_BEGIN(rw_all_int) { - TESTING_2("H5Dwrite then H5Dread with all compound members"); + TESTING_2("write and read entire dataspace with integer sequence"); + /* Set up write buffer */ + for (size_t i = 0; i < DATASET_VLEN_IO_DSET_DIMS; i++) { + if ((wbuf[i].p = calloc(i + 1, sizeof(int) * (i + 1))) == NULL) + PART_TEST_ERROR(rw_all_int); - /* Initialize wbuf */ - for (i = 0; i < DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS; i++) { - wbuf[i].a = (int)(2 * i); - wbuf[i].b = (int)(2 * i + 1); + for (size_t j = 0; j < i + 1; j++) { + ((int *)wbuf[i].p)[j] = (int)(i * j + 1); + } + + wbuf[i].len = i + 1; } - /* Write data */ - if (H5Dwrite(dset_id, full_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) - PART_TEST_ERROR(write_full_read_full); + /* Open dataset */ + if ((dset_int = H5Dopen2(container_group, DATASET_VLEN_IO_DSET_NAME "_int", H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_all_int); - /* Update fbuf to match file state */ - for (i = 0; i < DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS; i++) { - fbuf[i].a = wbuf[i].a; - fbuf[i].b = wbuf[i].b; - } + /* Perform write */ + if ((H5Dwrite(dset_int, vlen_int, space_id, H5S_ALL, H5P_DEFAULT, (const void *)wbuf)) < 0) + PART_TEST_ERROR(rw_all_int); - /* Initialize rbuf to -1 */ - for (i = 0; i < DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS; i++) { - rbuf[i].a = -1; - rbuf[i].b = -1; + /* Close and reopen file objects to flush cache */ + if (H5Dclose(dset_int) < 0) + PART_TEST_ERROR(rw_all_int); + + dset_int = H5I_INVALID_HID; + + if (H5Gclose(container_group) < 0) + PART_TEST_ERROR(rw_all_int); + + container_group = H5I_INVALID_HID; + + if (H5Fclose(file_id) < 0) + PART_TEST_ERROR(rw_all_int); + + file_id = H5I_INVALID_HID; + + if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_all_int); + + if ((container_group = H5Gopen(file_id, DATASET_TEST_GROUP_NAME, H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_all_int); + + if ((dset_int = H5Dopen2(container_group, DATASET_VLEN_IO_DSET_NAME "_int", H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_all_int); + + /* Perform read */ + if ((H5Dread(dset_int, vlen_int, space_id, H5S_ALL, H5P_DEFAULT, (void *)rbuf)) < 0) + PART_TEST_ERROR(rw_all_int); + + /* Verify data */ + for (size_t i = 0; i < DATASET_VLEN_IO_DSET_DIMS; i++) { + if (!rbuf[i].p) + PART_TEST_ERROR(rw_all_int); + + if (rbuf[i].len != wbuf[i].len) + PART_TEST_ERROR(rw_all_int); + + for (size_t j = 0; j < i + 1; j++) + if (((int *)rbuf[i].p)[j] != ((int *)wbuf[i].p)[j]) + PART_TEST_ERROR(rw_all_int); } - /* Set erbuf (simply match file state since we're reading the whole - * thing) */ - for (i = 0; i < DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS; i++) { - erbuf[i].a = fbuf[i].a; - erbuf[i].b = fbuf[i].b; + /* Close before use in selection tests */ + if (H5Dclose(dset_int) < 0) + PART_TEST_ERROR(rw_all_int); + + dset_int = H5I_INVALID_HID; + + /* Reset buffers */ + if (H5Treclaim(vlen_int, space_id, H5P_DEFAULT, rbuf) < 0) + PART_TEST_ERROR(rw_all_int); + + if (H5Treclaim(vlen_int, space_id, H5P_DEFAULT, wbuf) < 0) + PART_TEST_ERROR(rw_all_int); + + memset(wbuf, 0, sizeof(hvl_t) * DATASET_VLEN_IO_DSET_DIMS); + memset(rbuf, 0, sizeof(hvl_t) * DATASET_VLEN_IO_DSET_DIMS); + + PASSED(); + } + PART_END(rw_all_int) + PART_BEGIN(rw_all_float) + { + TESTING_2("write and read entire dataspace with float sequence"); + /* Set up write buffer */ + for (size_t i = 0; i < DATASET_VLEN_IO_DSET_DIMS; i++) { + if ((wbuf[i].p = calloc(i + 1, sizeof(float) * (i + 1))) == NULL) + PART_TEST_ERROR(rw_all_float); + + for (size_t j = 0; j < i + 1; j++) { + ((float *)wbuf[i].p)[j] = (float)(i * j + 1); + } + + wbuf[i].len = i + 1; } - /* Read data */ - if (H5Dread(dset_id, full_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - PART_TEST_ERROR(write_full_read_full); + /* Open dataset */ + if ((dset_float = H5Dopen2(container_group, DATASET_VLEN_IO_DSET_NAME "_float", H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_all_float); + + /* Perform write */ + if ((H5Dwrite(dset_float, vlen_float, space_id, H5S_ALL, H5P_DEFAULT, (const void *)wbuf)) < 0) + PART_TEST_ERROR(rw_all_float); + + /* Close and reopen file objects to flush cache */ + if (H5Dclose(dset_float) < 0) + PART_TEST_ERROR(rw_all_float); + + dset_float = H5I_INVALID_HID; + + if (H5Gclose(container_group) < 0) + PART_TEST_ERROR(rw_all_float); + + container_group = H5I_INVALID_HID; + + if (H5Fclose(file_id) < 0) + PART_TEST_ERROR(rw_all_float); + + file_id = H5I_INVALID_HID; + + if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_all_float); + + if ((container_group = H5Gopen2(file_id, DATASET_TEST_GROUP_NAME, H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_all_float); + + if ((dset_float = H5Dopen2(container_group, DATASET_VLEN_IO_DSET_NAME "_float", H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_all_float); + + /* Perform read */ + if ((H5Dread(dset_float, vlen_float, space_id, H5S_ALL, H5P_DEFAULT, (void *)rbuf)) < 0) + PART_TEST_ERROR(rw_all_float); /* Verify data */ - for (i = 0; i < DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS; i++) { - if (rbuf[i].a != erbuf[i].a) - PART_TEST_ERROR(write_full_read_full); - if (rbuf[i].b != erbuf[i].b) - PART_TEST_ERROR(write_full_read_full); + for (size_t i = 0; i < DATASET_VLEN_IO_DSET_DIMS; i++) { + if (!rbuf[i].p) + PART_TEST_ERROR(rw_all_float); + + if (rbuf[i].len != wbuf[i].len) + PART_TEST_ERROR(rw_all_float); + + for (size_t j = 0; j < i + 1; j++) { + float expected = ((float *)wbuf[i].p)[j]; + float actual = ((float *)rbuf[i].p)[j]; + + if (!(H5_DBL_REL_EQUAL(expected, actual, 0.001))) + PART_TEST_ERROR(rw_all_float); + } } + /* Reset buffers */ + + if (H5Treclaim(vlen_float, space_id, H5P_DEFAULT, rbuf) < 0) + PART_TEST_ERROR(rw_all_float); + + if (H5Treclaim(vlen_float, space_id, H5P_DEFAULT, wbuf) < 0) + PART_TEST_ERROR(rw_all_float); + + memset(wbuf, 0, sizeof(hvl_t) * DATASET_VLEN_IO_DSET_DIMS); + memset(rbuf, 0, sizeof(hvl_t) * DATASET_VLEN_IO_DSET_DIMS); + PASSED(); } - PART_END(write_full_read_full); + PART_END(rw_all_float); - PART_BEGIN(read_a) + PART_BEGIN(rw_all_string) { - TESTING_2("H5Dread with compound member a"); + TESTING_2("write and read entire dataspace with string sequence"); + /* Set up write buffer */ + for (size_t i = 0; i < DATASET_VLEN_IO_DSET_DIMS; i++) { + if ((wbuf[i].p = calloc(i + 1, DATASET_VLEN_IO_STR_LEN)) == NULL) + PART_TEST_ERROR(rw_all_string); - /* Initialize rbuf to -1 */ - for (i = 0; i < DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS; i++) { - rbuf[i].a = -1; - rbuf[i].b = -1; - } + for (size_t j = 0; j < i + 1; j++) { + char *str_ptr = ((char *)wbuf[i].p) + DATASET_VLEN_IO_STR_LEN * j; + memcpy(str_ptr, DATASET_VLEN_IO_STR_VALUE, DATASET_VLEN_IO_STR_LEN); + } - /* Set erbuf (element a comes from the file, element b in untouched) - */ - for (i = 0; i < DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS; i++) { - erbuf[i].a = fbuf[i].a; - erbuf[i].b = rbuf[i].b; + wbuf[i].len = i + 1; } - /* Read data */ - if (H5Dread(dset_id, a_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - PART_TEST_ERROR(read_a); + /* Open the dataset */ + if ((dset_string = H5Dopen2(container_group, DATASET_VLEN_IO_DSET_NAME "_string", H5P_DEFAULT)) < + 0) + PART_TEST_ERROR(rw_all_string); + + /* Perform write */ + if ((H5Dwrite(dset_string, vlen_string, space_id, H5S_ALL, H5P_DEFAULT, (const void *)wbuf)) < 0) + PART_TEST_ERROR(rw_all_string); + + /* Close and reopen file objects to flush cache */ + if (H5Dclose(dset_string) < 0) + PART_TEST_ERROR(rw_all_string); + + dset_string = H5I_INVALID_HID; + + if (H5Gclose(container_group) < 0) + PART_TEST_ERROR(rw_all_string); + + container_group = H5I_INVALID_HID; + + if (H5Fclose(file_id) < 0) + PART_TEST_ERROR(rw_all_string); + + file_id = H5I_INVALID_HID; + + if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_all_string); + + if ((container_group = H5Gopen2(file_id, DATASET_TEST_GROUP_NAME, H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_all_string); + + if ((dset_string = H5Dopen2(container_group, DATASET_VLEN_IO_DSET_NAME "_string", H5P_DEFAULT)) < + 0) + PART_TEST_ERROR(rw_all_string); + + /* Perform read */ + if ((H5Dread(dset_string, vlen_string, space_id, H5S_ALL, H5P_DEFAULT, (void *)rbuf)) < 0) + PART_TEST_ERROR(rw_all_string); /* Verify data */ - for (i = 0; i < DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS; i++) { - if (rbuf[i].a != erbuf[i].a) - PART_TEST_ERROR(read_a); - if (rbuf[i].b != erbuf[i].b) - PART_TEST_ERROR(read_a); + for (size_t i = 0; i < DATASET_VLEN_IO_DSET_DIMS; i++) { + if (!rbuf[i].p) + PART_TEST_ERROR(rw_all_string); + + if (rbuf[i].len != wbuf[i].len) + PART_TEST_ERROR(rw_all_string); + + for (size_t j = 0; j < i + 1; j++) { + char str_buf[DATASET_VLEN_IO_STR_LEN + 1]; + char *str_ptr = (char *)rbuf[i].p + DATASET_VLEN_IO_STR_LEN * j; + memcpy(str_buf, str_ptr, DATASET_VLEN_IO_STR_LEN); + str_buf[DATASET_VLEN_IO_STR_LEN] = '\0'; + + if (strcmp(str_buf, DATASET_VLEN_IO_STR_VALUE)) + PART_TEST_ERROR(rw_all_string); + } } + /* Reset buffers */ + + if (H5Treclaim(vlen_string, space_id, H5P_DEFAULT, rbuf) < 0) + PART_TEST_ERROR(rw_all_string); + + if (H5Treclaim(vlen_string, space_id, H5P_DEFAULT, wbuf) < 0) + PART_TEST_ERROR(rw_all_string); + + memset(wbuf, 0, sizeof(hvl_t) * DATASET_VLEN_IO_DSET_DIMS); + memset(rbuf, 0, sizeof(hvl_t) * DATASET_VLEN_IO_DSET_DIMS); + PASSED(); } - PART_END(read_a); + PART_END(rw_all_string); - PART_BEGIN(write_b_read_full) + PART_BEGIN(rw_point_selection) { - TESTING_2("H5Dwrite with compound member b then H5Dread with all compound members"); + /* Select even-indexed points */ + for (size_t i = 0; i < DATASET_VLEN_IO_DSET_DIMS / 2; i++) + point_coords[i] = i * 2; - /* Initialize wbuf */ - for (i = 0; i < DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS; i++) { - wbuf[i].a = (int)(2 * DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS + 2 * i); - wbuf[i].b = (int)(2 * DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS + 2 * i + 1); - } + /* Select points on dataspace */ + if (H5Sselect_elements(space_id, H5S_SELECT_SET, DATASET_VLEN_IO_DSET_DIMS / 2, + (const hsize_t *)point_coords) < 0) + PART_TEST_ERROR(rw_point_selection); - /* Write data */ - if (H5Dwrite(dset_id, b_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) - PART_TEST_ERROR(write_full_read_full); + /* Set up write buffer */ + for (size_t i = 0; i < DATASET_VLEN_IO_DSET_DIMS; i++) { + if ((wbuf[i].p = calloc(i + 1, sizeof(int) * (i + 1))) == NULL) + PART_TEST_ERROR(rw_point_selection); - /* Update fbuf to match file state - only element b was updated */ - for (i = 0; i < DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS; i++) { - fbuf[i].b = wbuf[i].b; + for (size_t j = 0; j < i + 1; j++) { + ((int *)wbuf[i].p)[j] = (int)(i * j + 1); + } + + wbuf[i].len = i + 1; } - /* Initialize rbuf to -1 */ - for (i = 0; i < DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS; i++) { - rbuf[i].a = -1; - rbuf[i].b = -1; + /* Open dataset */ + if ((dset_int = H5Dopen2(container_group, DATASET_VLEN_IO_DSET_NAME "_int", H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_point_selection); + + /* Perform write */ + if ((H5Dwrite(dset_int, vlen_int, space_id, space_id, H5P_DEFAULT, (const void *)wbuf)) < 0) + PART_TEST_ERROR(rw_point_selection); + + /* Close and reopen file objects to flush cache */ + if (H5Dclose(dset_int) < 0) + PART_TEST_ERROR(rw_point_selection); + dset_int = H5I_INVALID_HID; + + if (H5Gclose(container_group) < 0) + PART_TEST_ERROR(rw_point_selection); + container_group = H5I_INVALID_HID; + + if (H5Fclose(file_id) < 0) + PART_TEST_ERROR(rw_point_selection); + file_id = H5I_INVALID_HID; + + if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_point_selection); + + if ((container_group = H5Gopen2(file_id, DATASET_TEST_GROUP_NAME, H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_point_selection); + + if ((dset_int = H5Dopen2(container_group, DATASET_VLEN_IO_DSET_NAME "_int", H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_point_selection); + + /* Perform read */ + if ((H5Dread(dset_int, vlen_int, space_id, space_id, H5P_DEFAULT, (void *)rbuf)) < 0) + PART_TEST_ERROR(rw_point_selection); + + /* Verify data */ + for (size_t i = 0; i < DATASET_VLEN_IO_DSET_DIMS; i++) { + if (i % 2 == 0) { + if (!rbuf[i].p) + PART_TEST_ERROR(rw_point_selection); + + if (rbuf[i].len != wbuf[i].len) + PART_TEST_ERROR(rw_point_selection); + + for (size_t j = 0; j < i + 1; j++) + if (((int *)rbuf[i].p)[j] != ((int *)wbuf[i].p)[j]) + PART_TEST_ERROR(rw_point_selection); + } + else { + /* Odd positions in buffer should still read 0 */ + if (rbuf[i].p) + PART_TEST_ERROR(rw_point_selection); + if (rbuf[i].len) + PART_TEST_ERROR(rw_point_selection); + } } - /* Set erbuf (simply match file state since we're reading the whole - * thing) */ - for (i = 0; i < DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS; i++) { - erbuf[i].a = fbuf[i].a; - erbuf[i].b = fbuf[i].b; + if (H5Dclose(dset_int) < 0) + PART_TEST_ERROR(rw_point_selection); + dset_int = H5I_INVALID_HID; + + /* Reset buffers */ + if (H5Treclaim(vlen_int, space_id, H5P_DEFAULT, rbuf) < 0) + PART_TEST_ERROR(rw_point_selection); + + if (H5Treclaim(vlen_int, space_id, H5P_DEFAULT, wbuf) < 0) + PART_TEST_ERROR(rw_point_selection); + + memset(wbuf, 0, sizeof(hvl_t) * DATASET_VLEN_IO_DSET_DIMS); + memset(rbuf, 0, sizeof(hvl_t) * DATASET_VLEN_IO_DSET_DIMS); + + PASSED(); + } + PART_END(rw_point_selection); + + PART_BEGIN(rw_hyperslab_selection) + { + /* Select hyperslab of every 3rd element */ + const hsize_t start[1] = {0}; + const hsize_t stride[1] = {3}; + const hsize_t count[1] = {1 + (DATASET_VLEN_IO_DSET_DIMS / stride[0])}; + const hsize_t block[1] = {1}; + + if ((H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start, stride, count, block)) < 0) + PART_TEST_ERROR(rw_hyperslab_selection); + + /* Set up write buffer */ + for (size_t i = 0; i < DATASET_VLEN_IO_DSET_DIMS; i++) { + if ((wbuf[i].p = calloc(i + 1, sizeof(int) * (i + 1))) == NULL) + PART_TEST_ERROR(rw_hyperslab_selection); + + for (size_t j = 0; j < i + 1; j++) { + ((int *)wbuf[i].p)[j] = (int)(i * j + 1); + } + + wbuf[i].len = i + 1; } - /* Read data */ - if (H5Dread(dset_id, full_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - PART_TEST_ERROR(write_b_read_full); + /* Open dataset */ + if ((dset_int = H5Dopen2(container_group, DATASET_VLEN_IO_DSET_NAME "_int", H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_hyperslab_selection); + + /* Perform write */ + if ((H5Dwrite(dset_int, vlen_int, space_id, space_id, H5P_DEFAULT, (const void *)wbuf)) < 0) + PART_TEST_ERROR(rw_hyperslab_selection); + + /* Close and reopen file objects to flush cache */ + if (H5Dclose(dset_int) < 0) + PART_TEST_ERROR(rw_hyperslab_selection); + dset_int = H5I_INVALID_HID; + + if (H5Gclose(container_group) < 0) + PART_TEST_ERROR(rw_hyperslab_selection); + container_group = H5I_INVALID_HID; + + if (H5Fclose(file_id) < 0) + PART_TEST_ERROR(rw_hyperslab_selection); + file_id = H5I_INVALID_HID; + + if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_hyperslab_selection); + + if ((container_group = H5Gopen2(file_id, DATASET_TEST_GROUP_NAME, H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_hyperslab_selection); + + if ((dset_int = H5Dopen2(container_group, DATASET_VLEN_IO_DSET_NAME "_int", H5P_DEFAULT)) < 0) + PART_TEST_ERROR(rw_hyperslab_selection); + + /* Perform read */ + if ((H5Dread(dset_int, vlen_int, space_id, space_id, H5P_DEFAULT, (void *)rbuf)) < 0) + PART_TEST_ERROR(rw_hyperslab_selection); /* Verify data */ - for (i = 0; i < DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS; i++) { - if (rbuf[i].a != erbuf[i].a) - PART_TEST_ERROR(write_b_read_full); - if (rbuf[i].b != erbuf[i].b) - PART_TEST_ERROR(write_b_read_full); + for (size_t i = 0; i < DATASET_VLEN_IO_DSET_DIMS; i++) { + if (i % stride[0] == 0) { + if (!rbuf[i].p) + PART_TEST_ERROR(rw_hyperslab_selection); + + if (rbuf[i].len != wbuf[i].len) + PART_TEST_ERROR(rw_hyperslab_selection); + + for (size_t j = 0; j < i + 1; j++) + if (((int *)rbuf[i].p)[j] != ((int *)wbuf[i].p)[j]) + PART_TEST_ERROR(rw_hyperslab_selection); + } + else { + /* Unread positions should still be 0 */ + if (rbuf[i].p) + PART_TEST_ERROR(rw_hyperslab_selection); + if (rbuf[i].len) + PART_TEST_ERROR(rw_hyperslab_selection); + } } + /* Reset buffers */ + if (H5Treclaim(vlen_int, space_id, H5P_DEFAULT, rbuf) < 0) + PART_TEST_ERROR(rw_hyperslab_selection); + + if (H5Treclaim(vlen_int, space_id, H5P_DEFAULT, wbuf) < 0) + PART_TEST_ERROR(rw_hyperslab_selection); + + memset(wbuf, 0, sizeof(hvl_t) * DATASET_VLEN_IO_DSET_DIMS); + memset(rbuf, 0, sizeof(hvl_t) * DATASET_VLEN_IO_DSET_DIMS); + PASSED(); } - PART_END(write_b_read_full); + PART_END(rw_hyperslab_selection); } END_MULTIPART; TESTING_2("test cleanup"); - if (H5Sclose(space_id) < 0) + if (H5Fclose(file_id) < 0) TEST_ERROR; - if (H5Dclose(dset_id) < 0) + if (H5Gclose(container_group) < 0) TEST_ERROR; - if (H5Gclose(group_id) < 0) + if (H5Dclose(dset_int) < 0) TEST_ERROR; - if (H5Gclose(container_group) < 0) + if (H5Dclose(dset_float) < 0) TEST_ERROR; - if (H5Fclose(file_id) < 0) + if (H5Dclose(dset_string) < 0) TEST_ERROR; - if (H5Tclose(full_type_id) < 0) + if (H5Sclose(space_id) < 0) TEST_ERROR; - if (H5Tclose(a_type_id) < 0) + /* In case of memory allocation error, not all hvl_t buffers in array may be allocated. + * Free one-by-one */ + for (size_t i = 0; i < DATASET_VLEN_IO_DSET_DIMS; i++) { + if (wbuf[i].p) { + free(wbuf[i].p); + wbuf[i].p = NULL; + } + } + + for (size_t i = 0; i < DATASET_VLEN_IO_DSET_DIMS; i++) { + if (rbuf[i].p) { + free(rbuf[i].p); + rbuf[i].p = NULL; + } + } + + if (H5Tclose(vlen_int) < 0) TEST_ERROR; - if (H5Tclose(b_type_id) < 0) + if (H5Tclose(vlen_float) < 0) + TEST_ERROR; + if (H5Tclose(vlen_string) < 0) TEST_ERROR; PASSED(); - return 0; - error: + H5E_BEGIN_TRY { - H5Sclose(space_id); - H5Dclose(dset_id); - H5Gclose(group_id); - H5Gclose(container_group); H5Fclose(file_id); - H5Tclose(full_type_id); - H5Tclose(a_type_id); - H5Tclose(b_type_id); + H5Gclose(container_group); + H5Dclose(dset_int); + H5Dclose(dset_float); + H5Dclose(dset_string); + H5Sclose(space_id); + for (size_t i = 0; i < DATASET_VLEN_IO_DSET_DIMS; i++) { + if (wbuf[i].p) { + free(wbuf[i].p); + wbuf[i].p = NULL; + } + } + + for (size_t i = 0; i < DATASET_VLEN_IO_DSET_DIMS; i++) { + if (rbuf[i].p) { + free(rbuf[i].p); + rbuf[i].p = NULL; + } + } + H5Tclose(vlen_int); + H5Tclose(vlen_float); + H5Tclose(vlen_string); } H5E_END_TRY @@ -11999,10 +13869,10 @@ test_read_partial_chunk_all_selection(void) for (j = 0; j < FIXED_DIMSIZE; j++) if (read_buf[i][j] != (int)((i * FIXED_DIMSIZE) + j)) { H5_FAILED(); - printf( - " data verification failed for read buffer element %lld: expected %lld but was %lld\n", - (long long)((i * FIXED_DIMSIZE) + j), (long long)((i * FIXED_DIMSIZE) + j), - (long long)read_buf[i][j]); + printf(" data verification failed for read buffer element %lld: expected %lld but was " + "%lld\n", + (long long)((i * FIXED_DIMSIZE) + j), (long long)((i * FIXED_DIMSIZE) + j), + (long long)read_buf[i][j]); goto error; } diff --git a/test/API/H5_api_dataset_test.h b/test/API/H5_api_dataset_test.h index bba30737afa..12a111a5972 100644 --- a/test/API/H5_api_dataset_test.h +++ b/test/API/H5_api_dataset_test.h @@ -42,6 +42,13 @@ int H5_api_dataset_test(void); #define DATASET_CREATE_ANONYMOUS_INVALID_PARAMS_GROUP_NAME "anon_dset_creation_invalid_params_test" #define DATASET_CREATE_ANONYMOUS_INVALID_PARAMS_SPACE_RANK 2 +#define DATASET_STRING_ENCODINGS_RANK 1 +#define DATASET_STRING_ENCODINGS_EXTENT 1 +#define DATASET_STRING_ENCODINGS_DSET_NAME1 "encoding_dset1" +#define DATASET_STRING_ENCODINGS_DSET_NAME2 "encoding_dset2" +#define DATASET_STRING_ENCODINGS_ASCII_STRING "asciistr" +#define DATASET_STRING_ENCODINGS_UTF8_STRING "αaααaaaα" + #define DATASET_CREATE_NULL_DATASPACE_TEST_SUBGROUP_NAME "dataset_with_null_space_test" #define DATASET_CREATE_NULL_DATASPACE_TEST_DSET_NAME "dataset_with_null_space" @@ -53,7 +60,7 @@ int H5_api_dataset_test(void); #define ZERO_DIM_DSET_TEST_DSET_NAME "zero_dim_dset" #define DATASET_MANY_CREATE_GROUP_NAME "group_for_many_datasets" -#define DSET_NAME_BUF_SIZE 64u +#define DSET_NAME_BUF_SIZE 64 #define DATASET_NUMB 100u #define DATASET_SHAPE_TEST_DSET_BASE_NAME "dataset_shape_test" @@ -106,6 +113,10 @@ int H5_api_dataset_test(void); #define DATASET_CREATION_PROPERTIES_TEST_MAX_COMPACT 12 #define DATASET_CREATION_PROPERTIES_TEST_MIN_DENSE 8 #define DATASET_CREATION_PROPERTIES_TEST_SHAPE_RANK 3 +#define DATASET_CREATION_PROPERTIES_TEST_UD_FILTER_ID 32004 +#define DATASET_CREATION_PROPERTIES_TEST_UD_FILTER_NAME "lz4" +#define DATASET_CREATION_PROPERTIES_TEST_UD_FILTER_DSET_NAME "ud_filter_test" +#define DATASET_CREATION_PROPERTIES_TEST_UD_FILTER_NUM_PARAMS 3 #define DATASET_OPEN_INVALID_PARAMS_SPACE_RANK 2 #define DATASET_OPEN_INVALID_PARAMS_GROUP_NAME "dataset_open_test" @@ -126,6 +137,24 @@ int H5_api_dataset_test(void); #define DATASET_PROPERTY_LIST_TEST_DSET_NAME3 "property_list_test_dataset3" #define DATASET_PROPERTY_LIST_TEST_DSET_NAME4 "property_list_test_dataset4" +#define DATASET_STORAGE_SIZE_TEST_ALL_DSET_SPACE_RANK 2 +#define DATASET_STORAGE_SIZE_TEST_ALL_DSET_EXTENT 10 +#define DATASET_STORAGE_SIZE_TEST_GROUP_NAME "dataset_get_storage_size_test" +#define DATASET_STORAGE_SIZE_TEST_DSET_CONTIGUOUS_NAME "dataset_contiguous" +#define DATASET_STORAGE_SIZE_TEST_DSET_CHUNKED_NAME "dataset_chunked" +#define DATASET_STORAGE_SIZE_TEST_DSET_FILTERED_NAME "dataset_filtered" +#define DATASET_STORAGE_SIZE_TEST_TYPE H5T_NATIVE_INT + +#define DATASET_FILL_VALUE_TEST_DSET_NAME1 "dataset_fill_value_test_dataset1" +#define DATASET_FILL_VALUE_TEST_DSET_NAME2 "dataset_fill_value_test_dataset2" +#define DATASET_FILL_VALUE_TEST_DSET_NAME3 "dataset_fill_value_test_dataset3" +#define DATASET_FILL_VALUE_TEST_INT_TYPE H5T_NATIVE_INT +#define DATASET_FILL_VALUE_TEST_INT_FILL_VALUE 1 +#define DATASET_FILL_VALUE_TEST_DOUBLE_TYPE H5T_NATIVE_DOUBLE +#define DATASET_FILL_VALUE_TEST_DOUBLE_FILL_VALUE 2.002 +#define DATASET_FILL_VALUE_TEST_STRING_FILL_VALUE "abcdefgh" +#define DATASET_FILL_VALUE_TEST_STRING_SIZE 8 /* No null terminator for fixed length string*/ + #define DATASET_SMALL_READ_TEST_ALL_DSET_SPACE_RANK 3 #define DATASET_SMALL_READ_TEST_ALL_DSET_DTYPESIZE sizeof(int) #define DATASET_SMALL_READ_TEST_ALL_DSET_DTYPE H5T_NATIVE_INT @@ -214,10 +243,24 @@ int H5_api_dataset_test(void); #define DATASET_DATA_BUILTIN_CONVERSION_TEST_GROUP_NAME "dataset_builtin_conversion_verification_test" #define DATASET_DATA_BUILTIN_CONVERSION_TEST_DSET_NAME "dataset_builtin_conversion_verification_dset" +#define DATASET_DATA_REAL_CONVERSION_TEST_DSET_SPACE_RANK 3 +#define DATASET_DATA_REAL_CONVERSION_TEST_NUM_POINTS 10 +#define DATASET_DATA_REAL_CONVERSION_TEST_GROUP_NAME "dataset_real_conversion_verification_test" +#define DATASET_DATA_REAL_CONVERSION_TEST_DSET_NAME "dataset_real_conversion_verification_dset" +#define DATASET_DATA_REAL_CONVERSION_TEST_INT_DTYPESIZE sizeof(int) +#define DATASET_DATA_REAL_CONVERSION_TEST_INT_TYPE H5T_NATIVE_INT +#define DATASET_DATA_REAL_CONVERSION_TEST_REAL_DTYPESIZE sizeof(double) +#define DATASET_DATA_REAL_CONVERSION_TEST_REAL_TYPE H5T_NATIVE_DOUBLE + #define DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS 10 #define DATASET_DATA_COMPOUND_PARTIAL_IO_TEST_GROUP_NAME "dataset_compound_partial_io_test" #define DATASET_DATA_COMPOUND_PARTIAL_IO_TEST_DSET_NAME "dataset_compound_partial_io_test" +#define DATASET_VLEN_IO_DSET_DIMS 100 +#define DATASET_VLEN_IO_DSET_NAME "vlen_dset" +#define DATASET_VLEN_IO_STR_LEN 8 +#define DATASET_VLEN_IO_STR_VALUE "abcdefgh" + #define DATASET_SET_EXTENT_CHUNKED_UNLIMITED_TEST_SPACE_RANK 2 #define DATASET_SET_EXTENT_CHUNKED_UNLIMITED_TEST_NUM_PASSES 3 #define DATASET_SET_EXTENT_CHUNKED_UNLIMITED_TEST_GROUP_NAME "set_extent_chunked_unlimited_test" diff --git a/test/API/H5_api_file_test.c b/test/API/H5_api_file_test.c index 804b3bd1c58..5b9155118f4 100644 --- a/test/API/H5_api_file_test.c +++ b/test/API/H5_api_file_test.c @@ -948,7 +948,7 @@ test_flush_file(void) } for (u = 0; u < 10; u++) { - sprintf(dset_name, "Dataset %u", u); + snprintf(dset_name, sizeof(dset_name), "Dataset %u", u); if ((dset_id = H5Dcreate2(file_id, dset_name, H5T_STD_U32LE, dspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { diff --git a/test/API/H5_api_group_test.c b/test/API/H5_api_group_test.c index 4132f64b797..0203ebe3af2 100644 --- a/test/API/H5_api_group_test.c +++ b/test/API/H5_api_group_test.c @@ -229,7 +229,7 @@ test_create_many_groups(void) printf("\n"); for (i = 0; i < GROUP_NUMB_MANY; i++) { printf("\r %u/%u", i + 1, GROUP_NUMB_MANY); - sprintf(group_name, "group %02u", i); + snprintf(group_name, sizeof(group_name), "group %02u", i); if ((child_group_id = H5Gcreate2(parent_group_id, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -342,11 +342,11 @@ create_group_recursive(hid_t parent_gid, unsigned counter) printf("\r %u/%u", counter, GROUP_DEPTH); if (counter == 1) - sprintf(gname, "2nd_child_group"); + snprintf(gname, sizeof(gname), "2nd_child_group"); else if (counter == 2) - sprintf(gname, "3rd_child_group"); + snprintf(gname, sizeof(gname), "3rd_child_group"); else - sprintf(gname, "%dth_child_group", counter + 1); + snprintf(gname, sizeof(gname), "%dth_child_group", counter + 1); if ((child_gid = H5Gcreate2(parent_gid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); printf(" couldn't create group '%s'\n", gname); diff --git a/test/API/H5_api_link_test.c b/test/API/H5_api_link_test.c index b6ae512f226..e6810846e3f 100644 --- a/test/API/H5_api_link_test.c +++ b/test/API/H5_api_link_test.c @@ -374,6 +374,7 @@ test_create_hard_link_many(void) hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID; hid_t group_id = H5I_INVALID_HID, group_id2 = H5I_INVALID_HID; + bool valid_name_matched = FALSE; char objname[HARD_LINK_TEST_GROUP_MANY_NAME_BUF_SIZE]; /* Object name */ TESTING("hard link creation of many links"); @@ -505,6 +506,7 @@ test_create_hard_link_many(void) HARD_LINK_TEST_GROUP_MANY_FINAL_NAME); goto error; } + /* Check name */ if (H5Iget_name(group_id2, objname, (size_t)HARD_LINK_TEST_GROUP_MANY_NAME_BUF_SIZE) < 0) { H5_FAILED(); @@ -512,9 +514,23 @@ test_create_hard_link_many(void) goto error; } - if (strcmp(objname, "/" LINK_TEST_GROUP_NAME "/" HARD_LINK_TEST_GROUP_MANY_NAME "/hard21")) { + for (size_t i = 1; (i < HARD_LINK_TEST_GROUP_MANY_NUM_HARD_LINKS + 1 && !valid_name_matched); i++) { + char name_possibility[H5_API_TEST_FILENAME_MAX_LENGTH]; + + snprintf(name_possibility, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%zu", + "/" LINK_TEST_GROUP_NAME "/" HARD_LINK_TEST_GROUP_MANY_NAME "/hard", i); + + valid_name_matched |= !strcmp(objname, name_possibility); + } + + valid_name_matched |= !strcmp(objname, "/" LINK_TEST_GROUP_NAME "/" HARD_LINK_TEST_GROUP_MANY_NAME + "/" HARD_LINK_TEST_GROUP_MANY_FINAL_NAME); + + if (!valid_name_matched) { H5_FAILED(); - printf(" wrong name of the object '%s'\n", objname); + printf(" H5Iget_name failed to retrieve a valid name for '%s'\n", + HARD_LINK_TEST_GROUP_MANY_FINAL_NAME); + goto error; } @@ -900,7 +916,8 @@ test_create_hard_link_invalid_params(void) { TESTING_2("H5Lcreate_hard across files"); - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((ext_file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -1555,11 +1572,12 @@ test_create_soft_link_long_name(void) static int test_create_soft_link_many(void) { - htri_t link_exists; - hid_t file_id = H5I_INVALID_HID; - hid_t container_group = H5I_INVALID_HID; - hid_t group_id = H5I_INVALID_HID; - hid_t object_id = H5I_INVALID_HID; + htri_t link_exists = FAIL; + bool valid_name_matched = FALSE; + hid_t file_id = H5I_INVALID_HID; + hid_t container_group = H5I_INVALID_HID; + hid_t group_id = H5I_INVALID_HID; + hid_t object_id = H5I_INVALID_HID; char objname[SOFT_LINK_TEST_GROUP_MANY_NAME_BUF_SIZE]; /* Object name */ TESTING("soft link creation of many links"); @@ -1709,9 +1727,23 @@ test_create_soft_link_many(void) goto error; } - if (strcmp(objname, "/" LINK_TEST_GROUP_NAME "/" SOFT_LINK_TEST_GROUP_MANY_NAME "/soft16")) { + for (size_t i = 1; (i < SOFT_LINK_TEST_GROUP_MANY_NAME_SOFT_LINK_COUNT + 1 && !valid_name_matched); i++) { + char name_possibility[H5_API_TEST_FILENAME_MAX_LENGTH]; + + snprintf(name_possibility, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%zu", + "/" LINK_TEST_GROUP_NAME "/" SOFT_LINK_TEST_GROUP_MANY_NAME "/soft", i); + + valid_name_matched |= !strcmp(objname, name_possibility); + } + + valid_name_matched |= !strcmp(objname, "/" LINK_TEST_GROUP_NAME "/" SOFT_LINK_TEST_GROUP_MANY_NAME + "/" SOFT_LINK_TEST_GROUP_MANY_FINAL_NAME); + + if (!valid_name_matched) { H5_FAILED(); - printf(" wrong name of the object '%s'\n", objname); + printf(" H5Iget_name failed to retrieve a valid name for '%s'\n", + "/" LINK_TEST_GROUP_NAME "/" SOFT_LINK_TEST_GROUP_MANY_NAME + "/" SOFT_LINK_TEST_GROUP_MANY_FINAL_NAME); goto error; } @@ -1999,7 +2031,8 @@ test_create_external_link(void) return 0; } - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -2107,7 +2140,8 @@ test_create_external_link_dangling(void) return 0; } - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((ext_file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -2248,7 +2282,8 @@ test_create_external_link_multi(void) { TESTING_2("Create the first external file to be pointed to"); - snprintf(ext_link_filename1, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename1, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((file_id = H5Fcreate(ext_link_filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -2308,7 +2343,7 @@ test_create_external_link_multi(void) { TESTING_2("Create the second external file to be pointed to"); - snprintf(ext_link_filename2, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", + snprintf(ext_link_filename2, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, EXTERNAL_LINK_TEST_FILE_NAME2); if ((file_id = H5Fcreate(ext_link_filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { @@ -2365,7 +2400,7 @@ test_create_external_link_multi(void) { TESTING_2("Create the third external file to be pointed to"); - snprintf(ext_link_filename3, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", + snprintf(ext_link_filename3, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, EXTERNAL_LINK_TEST_FILE_NAME3); if ((file_id = H5Fcreate(ext_link_filename3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { @@ -2462,9 +2497,10 @@ test_create_external_link_multi(void) PART_ERROR(H5Lcreate_external_final_file); } - if (strcmp(objname, "/A/B/C")) { + if (strcmp(objname, "/A/B/C") && strcmp(objname, "/D/E/F") && strcmp(objname, "/G/H/I") && + strcmp(objname, "/" LINK_TEST_GROUP_NAME "/" EXTERNAL_LINK_TEST_MULTI_NAME "/ext_link")) { H5_FAILED(); - printf(" wrong name of the object '%s'\n", objname); + printf(" H5Iget_name failed to retrieve a valid name for the object '%s'\n", "/A/B/C"); PART_ERROR(H5Lcreate_external_final_file); } @@ -2532,9 +2568,13 @@ test_create_external_link_multi(void) PART_ERROR(H5Lcreate_external_object_created); } - if (strcmp(objname, "/A/B/C/new_group")) { + if (strcmp(objname, "/A/B/C/new_group") && strcmp(objname, "/D/E/F/new_group") && + strcmp(objname, "/G/H/I/new_group") && + strcmp(objname, + "/" LINK_TEST_GROUP_NAME "/" EXTERNAL_LINK_TEST_MULTI_NAME "/ext_link/new_group")) { H5_FAILED(); - printf(" wrong name of the object '%s'\n", objname); + printf(" H5Iget_name was unable to retrieve a valid name for the object '%s'\n", + "/A/B/C/new_group"); PART_ERROR(H5Lcreate_external_object_created); } @@ -2587,9 +2627,10 @@ test_create_external_link_multi(void) static int test_create_external_link_ping_pong(void) { - hid_t file_id = H5I_INVALID_HID; - hid_t group_id = H5I_INVALID_HID; - hid_t group_id2 = H5I_INVALID_HID; + hid_t file_id = H5I_INVALID_HID; + hid_t group_id = H5I_INVALID_HID; + hid_t group_id2 = H5I_INVALID_HID; + bool valid_name_matched = false; char ext_link_filename1[H5_API_TEST_FILENAME_MAX_LENGTH]; char ext_link_filename2[H5_API_TEST_FILENAME_MAX_LENGTH]; char objname[EXTERNAL_LINK_TEST_MULTI_NAME_BUF_SIZE]; @@ -2605,8 +2646,10 @@ test_create_external_link_ping_pong(void) return 0; } - snprintf(ext_link_filename1, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_PING_PONG_NAME1); - snprintf(ext_link_filename2, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_PING_PONG_NAME2); + snprintf(ext_link_filename1, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_PING_PONG_NAME1); + snprintf(ext_link_filename2, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_PING_PONG_NAME2); BEGIN_MULTIPART { @@ -2735,9 +2778,19 @@ test_create_external_link_ping_pong(void) PART_ERROR(H5Lcreate_external_verify); } - if (strcmp(objname, "/final")) { + for (size_t i = 1; i < EXTERNAL_LINK_TEST_PING_PONG_NUM_LINKS + 1 && !valid_name_matched; i++) { + char name_possibility[H5_API_TEST_FILENAME_MAX_LENGTH]; + + snprintf(name_possibility, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%zu", "/link", i); + + valid_name_matched |= !strcmp(name_possibility, objname); + } + + valid_name_matched |= !strcmp(objname, "/final"); + + if (!valid_name_matched) { H5_FAILED(); - printf(" wrong name of the object '%s'\n", objname); + printf(" H5Iget_name was unable to retrieve a valid name for the object '%s'\n", "/final"); PART_ERROR(H5Lcreate_external_verify); } @@ -2795,9 +2848,20 @@ test_create_external_link_ping_pong(void) PART_ERROR(H5Lcreate_external_verify_again); } - if (strcmp(objname, "/final/new_group")) { + for (size_t i = 1; i < EXTERNAL_LINK_TEST_PING_PONG_NUM_LINKS + 1 && !valid_name_matched; i++) { + char name_possibility[H5_API_TEST_FILENAME_MAX_LENGTH]; + + snprintf(name_possibility, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%zu%s", "/link", i, + "/new_group"); + + valid_name_matched |= !strcmp(objname, name_possibility); + } + + valid_name_matched |= !strcmp(objname, "/final/new_group"); + + if (!valid_name_matched) { H5_FAILED(); - printf(" wrong name of the object '%s'\n", objname); + printf(" H5Iget_name was unable to find a valid name for '%s'\n", "/final/new_group"); PART_ERROR(H5Lcreate_external_verify_again); } @@ -2860,7 +2924,7 @@ test_create_external_link_invalid_params(void) TESTING_2("test setup"); - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, EXTERNAL_LINK_INVALID_PARAMS_TEST_FILE_NAME); if ((file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { @@ -3751,7 +3815,8 @@ test_delete_link(void) { TESTING_2("H5Ldelete on external link"); - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((ext_file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -5714,7 +5779,8 @@ test_delete_link(void) } /* Create file for external link to reference */ - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((ext_file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -5995,7 +6061,8 @@ test_delete_link(void) } /* Create file for external link to reference */ - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((ext_file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -6270,7 +6337,8 @@ test_delete_link(void) TESTING_2("H5Ldelete_by_idx on external link by alphabetical order in increasing order"); /* Create file for external link to reference */ - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((ext_file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -6545,7 +6613,8 @@ test_delete_link(void) TESTING_2("H5Ldelete_by_idx on external link by alphabetical order in decreasing order"); /* Create file for external link to reference */ - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((ext_file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -8253,7 +8322,8 @@ test_copy_link(void) { TESTING_2("H5Lcopy on external link (copied link's properties not checked)"); - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((ext_file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -8361,7 +8431,8 @@ test_copy_link(void) TESTING_2("H5Lcopy on external link (copied link's properties checked)"); - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((ext_file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -8564,7 +8635,8 @@ test_copy_link(void) { TESTING_2("H5Lcopy on external link using H5L_SAME_LOC"); - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((ext_file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -9081,7 +9153,8 @@ test_copy_link_invalid_params(void) { TESTING_2("H5Lcopy invalid across files"); - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((ext_file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -9175,7 +9248,8 @@ test_move_link(void) TESTING_2("test setup"); - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -10056,7 +10130,8 @@ test_move_link(void) { TESTING_2("H5Lmove on external link (moved link's properties not checked)"); - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((ext_file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -10164,7 +10239,8 @@ test_move_link(void) TESTING_2("H5Lmove on external link (moved link's properties checked)"); - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((ext_file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -10367,7 +10443,8 @@ test_move_link(void) { TESTING_2("H5Lmove on external link using H5L_SAME_LOC"); - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((ext_file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -10505,7 +10582,8 @@ test_move_link(void) { TESTING_2("H5Lmove to rename external link without moving it"); - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((ext_file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -11389,7 +11467,8 @@ test_move_link_invalid_params(void) { TESTING_2("H5Lmove into another file"); - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((ext_file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -11628,7 +11707,8 @@ test_get_link_val(void) memset(&link_info, 0, sizeof(link_info)); - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((ext_file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -12526,7 +12606,8 @@ test_get_link_val(void) PART_EMPTY(H5Lget_val_by_idx_external_crt_order_increasing); } - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((ext_file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -12775,7 +12856,8 @@ test_get_link_val(void) PART_EMPTY(H5Lget_val_by_idx_external_crt_order_decreasing); } - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((ext_file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -13018,7 +13100,8 @@ test_get_link_val(void) TESTING_2("H5Lget_val_by_idx on external link by alphabetical order in increasing order"); - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((ext_file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -13261,7 +13344,8 @@ test_get_link_val(void) TESTING_2("H5Lget_val_by_idx on external link by alphabetical order in decreasing order"); - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((ext_file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -14168,7 +14252,8 @@ test_get_link_info(void) memset(&link_info, 0, sizeof(link_info)); - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((ext_file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -15733,7 +15818,8 @@ test_get_link_info(void) PART_EMPTY(H5Lget_info_by_idx_external_crt_order_increasing); } - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((ext_file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -15936,7 +16022,8 @@ test_get_link_info(void) PART_EMPTY(H5Lget_info_by_idx_external_crt_order_decreasing); } - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((ext_file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -16133,7 +16220,8 @@ test_get_link_info(void) { TESTING_2("H5Lget_info_by_idx2 on external link by alphabetical order in increasing order"); - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((ext_file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -16336,7 +16424,8 @@ test_get_link_info(void) { TESTING_2("H5Lget_info_by_idx2 on external link by alphabetical order in decreasing order"); - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((ext_file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -18362,7 +18451,8 @@ test_get_link_name(void) } /* Create file for external link to reference */ - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((ext_file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -18550,7 +18640,8 @@ test_get_link_name(void) } /* Create file for external link to reference */ - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((ext_file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -18732,7 +18823,8 @@ test_get_link_name(void) TESTING_2("H5Lget_name_by_idx on external link by alphabetical order in increasing order"); /* Create file for external link to reference */ - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((ext_file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -18914,7 +19006,8 @@ test_get_link_name(void) TESTING_2("H5Lget_name_by_idx on external link by alphabetical order in decreasing order"); /* Create file for external link to reference */ - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((ext_file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -19580,6 +19673,14 @@ test_link_iterate_hard_links(void) { TESTING_2("H5Literate2 by link name in increasing order"); + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_EXTERNAL_LINKS) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_UD_LINKS)) { + SKIPPED(); + printf(" API functions for external or user-defined link aren't supported with this " + "connector\n"); + PART_EMPTY(H5Literate_link_name_increasing); + } + i = 0; /* Test basic link iteration capability using both index types and both index orders */ @@ -20215,7 +20316,8 @@ test_link_iterate_external_links(void) TESTING_2("test setup"); - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -20301,6 +20403,12 @@ test_link_iterate_external_links(void) { TESTING_2("H5Literate2 by link name in increasing order"); + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_EXTERNAL_LINKS)) { + SKIPPED(); + printf(" external link API is not supported with this VOL connector\n"); + PART_EMPTY(H5Literate_link_name_increasing); + } + i = 0; /* Test basic link iteration capability using both index types and both index orders */ @@ -20325,6 +20433,12 @@ test_link_iterate_external_links(void) { TESTING_2("H5Literate2 by link name in decreasing order"); + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_EXTERNAL_LINKS)) { + SKIPPED(); + printf(" external link API is not supported with this VOL connector\n"); + PART_EMPTY(H5Literate_link_name_decreasing); + } + /* Reset the counter to the appropriate value for the next test */ i = LINK_ITER_EXT_LINKS_TEST_NUM_LINKS; @@ -20349,9 +20463,11 @@ test_link_iterate_external_links(void) { TESTING_2("H5Literate2 by creation order in increasing order"); - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_CREATION_ORDER)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_CREATION_ORDER) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_EXTERNAL_LINKS)) { SKIPPED(); - printf(" creation order tracking isn't supported with this VOL connector\n"); + printf(" creation order tracking or the external link API aren't supported with this VOL " + "connector\n"); PART_EMPTY(H5Literate_link_creation_increasing); } @@ -20379,9 +20495,11 @@ test_link_iterate_external_links(void) { TESTING_2("H5Literate2 by creation order in decreasing order"); - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_CREATION_ORDER)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_CREATION_ORDER) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_EXTERNAL_LINKS)) { SKIPPED(); - printf(" creation order tracking isn't supported with this VOL connector\n"); + printf(" creation order tracking or the external link API aren't supported with this VOL " + "connector\n"); PART_EMPTY(H5Literate_link_creation_decreasing); } @@ -20409,6 +20527,12 @@ test_link_iterate_external_links(void) { TESTING_2("H5Literate_by_name2 by link name in increasing order"); + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_EXTERNAL_LINKS)) { + SKIPPED(); + printf(" the external link API is not supported with this VOL connector\n"); + PART_EMPTY(H5Literate_by_name_link_name_increasing); + } + /* Reset the counter to the appropriate value for the next test */ i = 0; @@ -20434,6 +20558,13 @@ test_link_iterate_external_links(void) { TESTING_2("H5Literate_by_name2 by link name in decreasing order"); + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_EXTERNAL_LINKS)) { + SKIPPED(); + printf(" creation order tracking or the external link API aren't supported with this VOL " + "connector\n"); + PART_EMPTY(H5Literate_by_name_creation_decreasing); + } + /* Reset the counter to the appropriate value for the next test */ i = LINK_ITER_EXT_LINKS_TEST_NUM_LINKS; @@ -20459,9 +20590,11 @@ test_link_iterate_external_links(void) { TESTING_2("H5Literate_by_name2 by creation order in increasing order"); - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_CREATION_ORDER)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_CREATION_ORDER) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_EXTERNAL_LINKS)) { SKIPPED(); - printf(" creation order tracking isn't supported with this VOL connector\n"); + printf(" creation order tracking or the external link API aren't supported with this VOL " + "connector\n"); PART_EMPTY(H5Literate_by_name_creation_increasing); } @@ -20491,9 +20624,11 @@ test_link_iterate_external_links(void) { TESTING_2("H5Literate_by_name2 by creation order in decreasing order"); - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_CREATION_ORDER)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_CREATION_ORDER) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_EXTERNAL_LINKS)) { SKIPPED(); - printf(" creation order tracking isn't supported with this VOL connector\n"); + printf(" creation order tracking or the external link API are not supported with this VOL " + "connector\n"); PART_EMPTY(H5Literate_by_name_creation_decreasing); } @@ -20612,7 +20747,8 @@ test_link_iterate_mixed_links(void) TESTING_2("test setup"); - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -20737,6 +20873,14 @@ test_link_iterate_mixed_links(void) { TESTING_2("H5Literate2 by link name in increasing order"); + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_EXTERNAL_LINKS) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_UD_LINKS)) { + SKIPPED(); + printf(" creation order tracking, external links, or user-defined links aren't supported " + "with this VOL connector\n"); + PART_EMPTY(H5Literate_link_name_increasing); + } + i = 0; /* Test basic link iteration capability using both index types and both index orders */ @@ -20760,6 +20904,14 @@ test_link_iterate_mixed_links(void) { TESTING_2("H5Literate2 by link name in decreasing order"); + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_EXTERNAL_LINKS) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_UD_LINKS)) { + SKIPPED(); + printf(" creation order tracking, external links, or user-defined links aren't supported " + "with this VOL connector\n"); + PART_EMPTY(H5Literate_link_name_decreasing); + } + /* Reset the counter to the appropriate value for the next test */ i = LINK_ITER_MIXED_LINKS_TEST_NUM_LINKS; @@ -20783,9 +20935,12 @@ test_link_iterate_mixed_links(void) { TESTING_2("H5Literate2 by creation order in increasing order"); - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_CREATION_ORDER)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_CREATION_ORDER) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_EXTERNAL_LINKS) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_UD_LINKS)) { SKIPPED(); - printf(" creation order tracking isn't supported with this VOL connector\n"); + printf(" creation order tracking, external links, or user-defined links aren't supported " + "with this VOL connector\n"); PART_EMPTY(H5Literate_link_creation_increasing); } @@ -20813,9 +20968,12 @@ test_link_iterate_mixed_links(void) { TESTING_2("H5Literate2 by creation order in decreasing order"); - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_CREATION_ORDER)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_CREATION_ORDER) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_EXTERNAL_LINKS) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_UD_LINKS)) { SKIPPED(); - printf(" creation order tracking isn't supported with this VOL connector\n"); + printf(" creation order tracking, external links, or user-defined links aren't supported " + "with this VOL connector\n"); PART_EMPTY(H5Literate_link_creation_decreasing); } @@ -20843,6 +21001,13 @@ test_link_iterate_mixed_links(void) { TESTING_2("H5Literate_by_name2 by link name in increasing order"); + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_EXTERNAL_LINKS) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_UD_LINKS)) { + SKIPPED(); + printf(" external links or user-defined links aren't supported with this VOL connector\n"); + PART_EMPTY(H5Literate_by_name_link_name_increasing); + } + i = 0; if (H5Literate_by_name2( @@ -20867,6 +21032,13 @@ test_link_iterate_mixed_links(void) { TESTING_2("H5Literate_by_name2 by link name in decreasing order"); + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_EXTERNAL_LINKS) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_UD_LINKS)) { + SKIPPED(); + printf(" external links or user-defined links aren't supported with this VOL connector\n"); + PART_EMPTY(H5Literate_by_name_link_name_decreasing); + } + /* Reset the counter to the appropriate value for the next test */ i = LINK_ITER_MIXED_LINKS_TEST_NUM_LINKS; @@ -20892,9 +21064,12 @@ test_link_iterate_mixed_links(void) { TESTING_2("H5Literate_by_name2 by creation order in increasing order"); - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_CREATION_ORDER)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_CREATION_ORDER) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_EXTERNAL_LINKS) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_UD_LINKS)) { SKIPPED(); - printf(" creation order tracking isn't supported with this VOL connector\n"); + printf(" creation order tracking, external links, or user-defined links aren't supported " + "with this VOL connector\n"); PART_EMPTY(H5Literate_by_name_creation_increasing); } @@ -20923,9 +21098,12 @@ test_link_iterate_mixed_links(void) { TESTING_2("H5Literate_by_name2 by creation order in decreasing order"); - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_CREATION_ORDER)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_CREATION_ORDER) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_EXTERNAL_LINKS) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_UD_LINKS)) { SKIPPED(); - printf(" creation order tracking isn't supported with this VOL connector\n"); + printf(" creation order tracking, external links, or user-defined links aren't supported " + "with this VOL connector\n"); PART_EMPTY(H5Literate_by_name_creation_decreasing); } @@ -20954,9 +21132,12 @@ test_link_iterate_mixed_links(void) { TESTING_2("H5Literate2 index-saving capabilities in increasing order"); - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_CREATION_ORDER)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_CREATION_ORDER) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_EXTERNAL_LINKS) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_UD_LINKS)) { SKIPPED(); - printf(" creation order tracking isn't supported with this VOL connector\n"); + printf(" creation order tracking, external links, or user-defined links aren't supported " + "with this VOL connector\n"); PART_EMPTY(H5Literate_index_saving_increasing); } @@ -20992,9 +21173,12 @@ test_link_iterate_mixed_links(void) { TESTING_2("H5Literate2 index-saving capabilities in decreasing order"); - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_CREATION_ORDER)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_CREATION_ORDER) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_EXTERNAL_LINKS) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_UD_LINKS)) { SKIPPED(); - printf(" creation order tracking isn't supported with this VOL connector\n"); + printf(" creation order tracking, external links, or user-defined links aren't supported " + "with this VOL connector\n"); PART_EMPTY(H5Literate_index_saving_decreasing); } @@ -21098,7 +21282,8 @@ test_link_iterate_invalid_params(void) TESTING_2("test setup"); - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -22525,7 +22710,8 @@ test_link_visit_external_links_no_cycles(void) TESTING_2("test setup"); - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -22953,7 +23139,8 @@ test_link_visit_mixed_links_no_cycles(void) TESTING_2("test setup"); - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -24593,7 +24780,8 @@ test_link_visit_mixed_links_cycles(void) TESTING_2("test setup"); - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -25030,7 +25218,8 @@ test_link_visit_invalid_params(void) TESTING_2("test setup"); - snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s", EXTERNAL_LINK_TEST_FILE_NAME); + snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + EXTERNAL_LINK_TEST_FILE_NAME); if ((file_id = H5Fcreate(ext_link_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -25829,7 +26018,6 @@ link_iter_external_links_cb(hid_t group_id, const char *name, const H5L_info2_t herr_t ret_val = H5_ITER_CONT; if (!(vol_cap_flags_g & H5VL_CAP_FLAG_EXTERNAL_LINKS)) { - SKIPPED(); printf(" API functions for external links aren't supported with this " "connector\n"); return 1; @@ -25894,7 +26082,6 @@ link_iter_mixed_links_cb(hid_t group_id, const char *name, const H5L_info2_t *in herr_t ret_val = 0; if (!(vol_cap_flags_g & H5VL_CAP_FLAG_EXTERNAL_LINKS) || !(vol_cap_flags_g & H5VL_CAP_FLAG_UD_LINKS)) { - SKIPPED(); printf(" API functions for external or user-defined link aren't supported with this " "connector\n"); return 1; @@ -25983,7 +26170,6 @@ link_iter_idx_saving_cb(hid_t group_id, const char *name, const H5L_info2_t *inf int *broken = (int *)op_data; if (!(vol_cap_flags_g & H5VL_CAP_FLAG_EXTERNAL_LINKS) || !(vol_cap_flags_g & H5VL_CAP_FLAG_UD_LINKS)) { - SKIPPED(); printf(" API functions for external or user-defined link aren't supported with this " "connector\n"); return 1; diff --git a/test/API/H5_api_link_test.h b/test/API/H5_api_link_test.h index c068f4ff59d..02514cd5877 100644 --- a/test/API/H5_api_link_test.h +++ b/test/API/H5_api_link_test.h @@ -29,9 +29,10 @@ int H5_api_link_test(void); #define HARD_LINK_TEST_GROUP_LONG_NAME "hard_link_long_name" #define MAX_NAME_LEN ((64 * 1024) + 1024) -#define HARD_LINK_TEST_GROUP_MANY_NAME "hard_link_many_name" -#define HARD_LINK_TEST_GROUP_MANY_FINAL_NAME "hard_link_final" -#define HARD_LINK_TEST_GROUP_MANY_NAME_BUF_SIZE 1024 +#define HARD_LINK_TEST_GROUP_MANY_NAME "hard_link_many_name" +#define HARD_LINK_TEST_GROUP_MANY_FINAL_NAME "hard_link_final" +#define HARD_LINK_TEST_GROUP_MANY_NAME_BUF_SIZE 1024 +#define HARD_LINK_TEST_GROUP_MANY_NUM_HARD_LINKS 21 #define H5L_SAME_LOC_TEST_GROUP_NAME "h5l_same_loc_test_group" #define H5L_SAME_LOC_TEST_LINK_NAME1 "h5l_same_loc_test_link1" @@ -58,9 +59,10 @@ int H5_api_link_test(void); #define SOFT_LINK_TEST_GROUP_LONG_NAME "soft_link_long_name" #define SOFT_LINK_TEST_LONG_OBJECT_NAME "soft_link_object_name" -#define SOFT_LINK_TEST_GROUP_MANY_NAME "soft_link_many_name" -#define SOFT_LINK_TEST_GROUP_MANY_FINAL_NAME "soft_link_final" -#define SOFT_LINK_TEST_GROUP_MANY_NAME_BUF_SIZE 1024 +#define SOFT_LINK_TEST_GROUP_MANY_NAME "soft_link_many_name" +#define SOFT_LINK_TEST_GROUP_MANY_FINAL_NAME "soft_link_final" +#define SOFT_LINK_TEST_GROUP_MANY_NAME_BUF_SIZE 1024 +#define SOFT_LINK_TEST_GROUP_MANY_NAME_SOFT_LINK_COUNT 16 #define SOFT_LINK_INVALID_PARAMS_TEST_GROUP_NAME "soft_link_creation_invalid_params_test" #define SOFT_LINK_INVALID_PARAMS_TEST_LINK_NAME "soft_link_to_root" @@ -82,6 +84,7 @@ int H5_api_link_test(void); #define EXTERNAL_LINK_TEST_PING_PONG_NAME1 "ext_link_file_ping_pong_1.h5" #define EXTERNAL_LINK_TEST_PING_PONG_NAME2 "ext_link_file_ping_pong_2.h5" #define EXTERNAL_LINK_TEST_PING_PONG_NAME_BUF_SIZE 1024 +#define EXTERNAL_LINK_TEST_PING_PONG_NUM_LINKS 6 #define EXTERNAL_LINK_INVALID_PARAMS_TEST_GROUP_NAME "external_link_creation_invalid_params_test" #define EXTERNAL_LINK_INVALID_PARAMS_TEST_FILE_NAME "ext_link_invalid_params_file.h5" diff --git a/test/API/H5_api_object_test.c b/test/API/H5_api_object_test.c index d861661774a..77af8c9cfc2 100644 --- a/test/API/H5_api_object_test.c +++ b/test/API/H5_api_object_test.c @@ -51,6 +51,8 @@ static herr_t object_copy_soft_link_expand_callback(hid_t group, const char *nam void *op_data); static herr_t object_visit_callback(hid_t o_id, const char *name, const H5O_info2_t *object_info, void *op_data); +static herr_t object_visit_simple_callback(hid_t o_id, const char *name, const H5O_info2_t *object_info, + void *op_data); static herr_t object_visit_dset_callback(hid_t o_id, const char *name, const H5O_info2_t *object_info, void *op_data); static herr_t object_visit_dtype_callback(hid_t o_id, const char *name, const H5O_info2_t *object_info, @@ -5048,15 +5050,23 @@ test_object_comments_invalid_params(void) static int test_object_visit(void) { - size_t i; - hid_t file_id = H5I_INVALID_HID; - hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; - hid_t group_id2 = H5I_INVALID_HID; - hid_t gcpl_id = H5I_INVALID_HID; - hid_t type_id = H5I_INVALID_HID; - hid_t dset_id = H5I_INVALID_HID; - hid_t dset_dtype = H5I_INVALID_HID; - hid_t fspace_id = H5I_INVALID_HID; + size_t i; + hid_t file_id = H5I_INVALID_HID; + hid_t file_id2 = H5I_INVALID_HID; + hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; + hid_t group_id2 = H5I_INVALID_HID; + hid_t gcpl_id = H5I_INVALID_HID; + hid_t type_id = H5I_INVALID_HID; + hid_t dset_id = H5I_INVALID_HID; + hid_t dset_dtype = H5I_INVALID_HID; + hid_t fspace_id = H5I_INVALID_HID; + hid_t attr_id = H5I_INVALID_HID; + hid_t group_id3 = H5I_INVALID_HID; + hid_t group_id4 = H5I_INVALID_HID; + hid_t group_id5 = H5I_INVALID_HID; + hssize_t num_elems = 0; + size_t elem_size = 0; + char visit_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; TESTING_MULTIPART("object visiting"); @@ -5079,6 +5089,15 @@ test_object_visit(void) goto error; } + snprintf(visit_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + OBJECT_VISIT_TEST_FILE_NAME); + + if ((file_id2 = H5Fcreate(visit_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't open file '%s'\n", OBJECT_VISIT_TEST_FILE_NAME); + goto error; + } + if ((container_group = H5Gopen2(file_id, OBJECT_TEST_GROUP_NAME, H5P_DEFAULT)) < 0) { H5_FAILED(); printf(" couldn't open container group '%s'\n", OBJECT_TEST_GROUP_NAME); @@ -5106,18 +5125,44 @@ test_object_visit(void) goto error; } - if ((fspace_id = generate_random_dataspace(OBJECT_VISIT_TEST_SPACE_RANK, NULL, NULL, false)) < 0) - TEST_ERROR; + /* Make sure not to generate too much data for an attribute to hold */ + do { + if (fspace_id != H5I_INVALID_HID) + H5Sclose(fspace_id); - if ((dset_dtype = generate_random_datatype(H5T_NO_CLASS, false)) < 0) - TEST_ERROR; + if (dset_dtype != H5I_INVALID_HID) + H5Tclose(dset_dtype); + + if ((fspace_id = generate_random_dataspace(OBJECT_VISIT_TEST_SPACE_RANK, NULL, NULL, FALSE)) < 0) { + TEST_ERROR; + } + + if ((dset_dtype = generate_random_datatype(H5T_NO_CLASS, FALSE)) < 0) { + TEST_ERROR; + } - if ((type_id = generate_random_datatype(H5T_NO_CLASS, false)) < 0) { + if ((num_elems = H5Sget_simple_extent_npoints(fspace_id)) < 0) + TEST_ERROR; + + if ((elem_size = H5Tget_size(dset_dtype)) == 0) + TEST_ERROR; + + } while (((long unsigned int)num_elems * elem_size) > OBJECT_VISIT_TEST_TOTAL_DATA_SIZE_LIMIT); + + if ((type_id = generate_random_datatype(H5T_NO_CLASS, FALSE)) < 0) { H5_FAILED(); printf(" couldn't create datatype '%s'\n", OBJECT_VISIT_TEST_TYPE_NAME); goto error; } + if ((attr_id = H5Acreate2(group_id, OBJECT_VISIT_TEST_ATTR_NAME, dset_dtype, fspace_id, H5P_DEFAULT, + H5P_DEFAULT)) == H5I_INVALID_HID) { + H5_FAILED(); + printf(" couldn't create attribute '%s' on group '%s'\n", OBJECT_VISIT_TEST_ATTR_NAME, + OBJECT_VISIT_TEST_SUBGROUP_NAME); + goto error; + } + if ((group_id2 = H5Gcreate2(group_id, OBJECT_VISIT_TEST_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -5125,6 +5170,27 @@ test_object_visit(void) goto error; } + if ((group_id3 = H5Gcreate2(file_id2, OBJECT_VISIT_TEST_GROUP_NAME_PARENT, H5P_DEFAULT, gcpl_id, + H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't create group '%s'\n", OBJECT_VISIT_TEST_GROUP_NAME_PARENT); + goto error; + } + + if ((group_id4 = H5Gcreate2(group_id3, OBJECT_VISIT_TEST_GROUP_NAME_CHILD, H5P_DEFAULT, gcpl_id, + H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't create group '%s'\n", OBJECT_VISIT_TEST_GROUP_NAME_CHILD); + goto error; + } + + if ((group_id5 = H5Gcreate2(group_id4, OBJECT_VISIT_TEST_GROUP_NAME_GRANDCHILD, H5P_DEFAULT, gcpl_id, + H5P_DEFAULT)) < 0) { + H5_FAILED(); + printf(" couldn't create group '%s'\n", OBJECT_VISIT_TEST_GROUP_NAME_GRANDCHILD); + goto error; + } + if ((dset_id = H5Dcreate2(group_id, OBJECT_VISIT_TEST_DSET_NAME, dset_dtype, fspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); @@ -5257,16 +5323,49 @@ test_object_visit(void) } PART_END(H5Ovisit_create_order_decreasing); + PART_BEGIN(H5Ovisit_group) + { + TESTING_2("H5Ovisit on a group"); + + i = 0; + + if (H5Ovisit3(group_id3, H5_INDEX_CRT_ORDER, H5_ITER_INC, object_visit_simple_callback, &i, + H5O_INFO_ALL) < 0) { + H5_FAILED(); + printf(" H5Ovisit on a group failed!\n"); + PART_ERROR(H5Ovisit_group); + } + + if (i != OBJECT_VISIT_TEST_SUBGROUP_LAYERS) { + H5_FAILED(); + printf(" some objects were not visited!\n"); + PART_ERROR(H5Ovisit_group); + } + + PASSED(); + } + PART_END(H5Ovisit_group); + PART_BEGIN(H5Ovisit_file) { TESTING_2("H5Ovisit on a file ID"); - /* - * XXX: - */ + i = 0; + + if (H5Ovisit3(file_id2, H5_INDEX_CRT_ORDER, H5_ITER_INC, object_visit_simple_callback, &i, + H5O_INFO_ALL) < 0) { + H5_FAILED(); + printf(" H5Ovisit on a file ID failed!\n"); + PART_ERROR(H5Ovisit_file); + } + + if (i != OBJECT_VISIT_TEST_NUM_OBJS_VISITED) { + H5_FAILED(); + printf(" some objects were not visited!\n"); + PART_ERROR(H5Ovisit_file); + } - SKIPPED(); - PART_EMPTY(H5Ovisit_file); + PASSED(); } PART_END(H5Ovisit_file); @@ -5300,6 +5399,30 @@ test_object_visit(void) } PART_END(H5Ovisit_dtype); + PART_BEGIN(H5Ovisit_attr) + { + TESTING_2("H5Ovisit on an attribute"); + + i = 0; + + if (H5Ovisit3(attr_id, H5_INDEX_CRT_ORDER, H5_ITER_INC, object_visit_simple_callback, &i, + H5O_INFO_ALL) < 0) { + H5_FAILED(); + printf(" H5Ovisit on an attribute failed!\n"); + PART_ERROR(H5Ovisit_attr); + } + + /* Should have same effect as calling H5Ovisit on group_id */ + if (i != OBJECT_VISIT_TEST_NUM_OBJS_VISITED) { + H5_FAILED(); + printf(" some objects were not visited!\n"); + PART_ERROR(H5Ovisit_attr); + } + + PASSED(); + } + PART_END(H5Ovisit_attr); + PART_BEGIN(H5Ovisit_by_name_obj_name_increasing) { TESTING_2("H5Ovisit_by_name by object name in increasing order"); @@ -5480,12 +5603,22 @@ test_object_visit(void) { TESTING_2("H5Ovisit_by_name on a file ID"); - /* - * XXX: - */ + i = 0; + + if (H5Ovisit_by_name3(file_id2, "/", H5_INDEX_CRT_ORDER, H5_ITER_INC, + object_visit_simple_callback, &i, H5O_INFO_ALL, H5P_DEFAULT) < 0) { + H5_FAILED(); + printf(" H5Ovisit on a file ID failed!\n"); + PART_ERROR(H5Ovisit_by_name_file); + } - SKIPPED(); - PART_EMPTY(H5Ovisit_by_name_file); + if (i != OBJECT_VISIT_TEST_NUM_OBJS_VISITED) { + H5_FAILED(); + printf(" some objects were not visited!\n"); + PART_ERROR(H5Ovisit_by_name_file); + } + + PASSED(); } PART_END(H5Ovisit_by_name_file); @@ -5518,6 +5651,30 @@ test_object_visit(void) PASSED(); } PART_END(H5Ovisit_by_name_dtype); + + PART_BEGIN(H5Ovisit_by_name_attr) + { + TESTING_2("H5Ovisit_by_name on an attribute"); + + i = 0; + + if (H5Ovisit_by_name(attr_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, object_visit_simple_callback, + &i, H5O_INFO_ALL, H5P_DEFAULT) < 0) { + H5_FAILED(); + printf(" H5Ovisit_by_name on an attribute failed!\n"); + PART_ERROR(H5Ovisit_by_name_attr); + } + + /* Should have same effect as calling H5Ovisit on group_id */ + if (i != OBJECT_VISIT_TEST_NUM_OBJS_VISITED) { + H5_FAILED(); + printf(" some objects were not visited!\n"); + PART_ERROR(H5Ovisit_by_name_attr); + } + + PASSED(); + } + PART_END(H5Ovisit_by_name_attr); } END_MULTIPART; @@ -5535,12 +5692,22 @@ test_object_visit(void) TEST_ERROR; if (H5Gclose(group_id2) < 0) TEST_ERROR; + if (H5Gclose(group_id3) < 0) + TEST_ERROR; + if (H5Gclose(group_id4) < 0) + TEST_ERROR; + if (H5Gclose(group_id5) < 0) + TEST_ERROR; + if (H5Aclose(attr_id) < 0) + TEST_ERROR; if (H5Gclose(group_id) < 0) TEST_ERROR; if (H5Gclose(container_group) < 0) TEST_ERROR; if (H5Fclose(file_id) < 0) TEST_ERROR; + if (H5Fclose(file_id2) < 0) + TEST_ERROR; PASSED(); @@ -5555,11 +5722,16 @@ test_object_visit(void) H5Dclose(dset_id); H5Pclose(gcpl_id); H5Gclose(group_id2); + H5Gclose(group_id3); + H5Gclose(group_id4); + H5Gclose(group_id5); + H5Aclose(attr_id); H5Gclose(group_id); H5Gclose(container_group); H5Fclose(file_id); + H5Fclose(file_id2); } - H5E_END_TRY + H5E_END_TRY; return 1; } @@ -7067,6 +7239,29 @@ object_visit_callback(hid_t o_id, const char *name, const H5O_info2_t *object_in return ret_val; } +/* + * H5Ovisit callback to count the number of visited objects + */ +static herr_t +object_visit_simple_callback(hid_t o_id, const char *name, const H5O_info2_t *object_info, void *op_data) +{ + size_t *i = (size_t *)op_data; + herr_t ret_val = 0; + + UNUSED(o_id); + UNUSED(object_info); + + if (name) + goto done; + + ret_val = -1; + +done: + (*i)++; + + return ret_val; +} + /* * H5Ovisit callback for visiting a singular dataset. */ @@ -7128,6 +7323,14 @@ object_visit_soft_link_callback(hid_t o_id, const char *name, const H5O_info2_t UNUSED(o_id); + if (!strcmp(name, OBJECT_VISIT_TEST_GROUP_NAME_PARENT) || + !strcmp(name, OBJECT_VISIT_TEST_GROUP_NAME_PARENT "/" OBJECT_VISIT_TEST_GROUP_NAME_CHILD) || + !strcmp(name, OBJECT_VISIT_TEST_GROUP_NAME_PARENT "/" OBJECT_VISIT_TEST_GROUP_NAME_CHILD + "/" OBJECT_VISIT_TEST_GROUP_NAME_GRANDCHILD)) { + (*i)--; + goto done; + } + if (!strncmp(name, ".", strlen(".") + 1) && (counter_val <= 5)) { if (H5O_TYPE_GROUP == object_info->type) goto done; @@ -7166,7 +7369,15 @@ object_visit_noop_callback(hid_t o_id, const char *name, const H5O_info2_t *obje static void cleanup_files(void) { - H5Fdelete(OBJECT_COPY_BETWEEN_FILES_TEST_FILE_NAME, H5P_DEFAULT); + char filename[H5_API_TEST_FILENAME_MAX_LENGTH]; + + snprintf(filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + OBJECT_COPY_BETWEEN_FILES_TEST_FILE_NAME); + H5Fdelete(filename, H5P_DEFAULT); + + snprintf(filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, + OBJECT_VISIT_TEST_FILE_NAME); + H5Fdelete(filename, H5P_DEFAULT); } int diff --git a/test/API/H5_api_object_test.h b/test/API/H5_api_object_test.h index 75c39613100..68d89d08431 100644 --- a/test/API/H5_api_object_test.h +++ b/test/API/H5_api_object_test.h @@ -121,12 +121,19 @@ int H5_api_object_test(void); #define OBJECT_COPY_INVALID_PARAMS_TEST_GROUP_NAME "object_copy_invalid_params_group" #define OBJECT_COPY_INVALID_PARAMS_TEST_GROUP_NAME2 "object_copy_invalid_params_group_copy" -#define OBJECT_VISIT_TEST_NUM_OBJS_VISITED 4 -#define OBJECT_VISIT_TEST_SUBGROUP_NAME "object_visit_test" -#define OBJECT_VISIT_TEST_SPACE_RANK 2 -#define OBJECT_VISIT_TEST_GROUP_NAME "object_visit_test_group" -#define OBJECT_VISIT_TEST_DSET_NAME "object_visit_test_dset" -#define OBJECT_VISIT_TEST_TYPE_NAME "object_visit_test_type" +#define OBJECT_VISIT_TEST_NUM_OBJS_VISITED 4 +#define OBJECT_VISIT_TEST_SUBGROUP_NAME "object_visit_test" +#define OBJECT_VISIT_TEST_SPACE_RANK 2 +#define OBJECT_VISIT_TEST_GROUP_NAME "object_visit_test_group" +#define OBJECT_VISIT_TEST_DSET_NAME "object_visit_test_dset" +#define OBJECT_VISIT_TEST_TYPE_NAME "object_visit_test_type" +#define OBJECT_VISIT_TEST_ATTR_NAME "object_visit_test_attr" +#define OBJECT_VISIT_TEST_FILE_NAME "object_visit_test_file" +#define OBJECT_VISIT_TEST_SUBGROUP_LAYERS 3 +#define OBJECT_VISIT_TEST_GROUP_NAME_PARENT "object_visit_test_group_parent" +#define OBJECT_VISIT_TEST_GROUP_NAME_CHILD "object_visit_test_group_child" +#define OBJECT_VISIT_TEST_GROUP_NAME_GRANDCHILD "object_visit_test_group_grandchild" +#define OBJECT_VISIT_TEST_TOTAL_DATA_SIZE_LIMIT 32000 #define OBJECT_VISIT_SOFT_LINK_TEST_NUM_OBJS_VISITED 1 #define OBJECT_VISIT_SOFT_LINK_TEST_SUBGROUP_NAME "object_visit_soft_link" diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 385d2c0b378..a9b935e80a8 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -344,7 +344,7 @@ set (H5TEST_SEPARATE_TESTS ) foreach (h5_test ${H5_TESTS}) if (NOT h5_test IN_LIST H5TEST_SEPARATE_TESTS) - if (HDF5_ENABLE_USING_MEMCHECKER) + if (HDF5_USING_ANALYSIS_TOOL) add_test (NAME H5TEST-${h5_test} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) set_tests_properties (H5TEST-${h5_test} PROPERTIES FIXTURES_REQUIRED clear_H5TEST @@ -403,7 +403,7 @@ if (NOT CYGWIN) WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) set_tests_properties (H5TEST-cache-clean-objects PROPERTIES FIXTURES_CLEANUP clear_cache) - if (HDF5_ENABLE_USING_MEMCHECKER) + if (HDF5_USING_ANALYSIS_TOOL) add_test (NAME H5TEST-cache COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME H5TEST-cache COMMAND "${CMAKE_COMMAND}" @@ -477,7 +477,7 @@ add_test ( WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) set_tests_properties (H5TEST-external_env-clean-objects PROPERTIES FIXTURES_CLEANUP clear_external_env) -if (HDF5_ENABLE_USING_MEMCHECKER) +if (HDF5_USING_ANALYSIS_TOOL) add_test (NAME H5TEST-external_env COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME H5TEST-external_env COMMAND "${CMAKE_COMMAND}" @@ -512,7 +512,7 @@ add_test ( ${HDF5_TEST_BINARY_DIR}/H5TEST ) set_tests_properties (H5TEST-vds_env-clean-objects PROPERTIES FIXTURES_CLEANUP clear_vds_env) -if (HDF5_ENABLE_USING_MEMCHECKER) +if (HDF5_USING_ANALYSIS_TOOL) add_test (NAME H5TEST-vds_env COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME H5TEST-vds_env COMMAND "${CMAKE_COMMAND}" @@ -559,7 +559,7 @@ add_test (NAME H5TEST-flush-clean-objects WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) set_tests_properties (H5TEST-flush-clean-objects PROPERTIES FIXTURES_CLEANUP clear_flush) -if (HDF5_ENABLE_USING_MEMCHECKER) +if (HDF5_USING_ANALYSIS_TOOL) add_test (NAME H5TEST-flush1 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME H5TEST-flush1 COMMAND "${CMAKE_COMMAND}" @@ -581,7 +581,7 @@ set_tests_properties (H5TEST-flush1 PROPERTIES if ("H5TEST-flush1" MATCHES "${HDF5_DISABLE_TESTS_REGEX}") set_tests_properties (H5TEST-flush1 PROPERTIES DISABLED true) endif () -if (HDF5_ENABLE_USING_MEMCHECKER) +if (HDF5_USING_ANALYSIS_TOOL) add_test (NAME H5TEST-flush2 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME H5TEST-flush2 COMMAND "${CMAKE_COMMAND}" @@ -815,7 +815,7 @@ add_test (NAME H5TEST-links_env-clean-objects ${HDF5_TEST_BINARY_DIR}/H5TEST ) set_tests_properties (H5TEST-links_env-clean-objects PROPERTIES FIXTURES_CLEANUP clear_links_env) -if (HDF5_ENABLE_USING_MEMCHECKER) +if (HDF5_USING_ANALYSIS_TOOL) add_test (NAME H5TEST-links_env COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME H5TEST-links_env COMMAND "${CMAKE_COMMAND}" diff --git a/test/cache.c b/test/cache.c index 4e6288679b7..09d6a1f0998 100644 --- a/test/cache.c +++ b/test/cache.c @@ -2779,16 +2779,14 @@ check_insert_entry(unsigned paged) if (pass) { insert_entry(file_ptr, entry_type, 0, H5C__NO_FLAGS_SET); - insert_entry(file_ptr, entry_type, 1, H5C__SET_FLUSH_MARKER_FLAG); - insert_entry(file_ptr, entry_type, 2, H5C__PIN_ENTRY_FLAG); - insert_entry(file_ptr, entry_type, 3, (H5C__SET_FLUSH_MARKER_FLAG | H5C__PIN_ENTRY_FLAG)); + insert_entry(file_ptr, entry_type, 1, H5C__PIN_ENTRY_FLAG); } /* Verify that the entries are inserted as desired. */ i = 0; base_addr = entries[0]; - while (pass && (i < 4)) { + while (pass && (i < 2)) { entry_ptr = &(base_addr[i]); /* Start by checking everything we can via H5C_get_entry_status() */ @@ -2815,7 +2813,7 @@ check_insert_entry(unsigned paged) if (pass) { /* verify that the pinned flag got set correctly */ - if ((i == 2) || (i == 3)) { + if (i == 1) { if (!is_pinned) { @@ -2839,24 +2837,6 @@ check_insert_entry(unsigned paged) * Now start looking at the cache data structures directly. */ - if (pass) { - - /* Verify that the flush marker got set correctly */ - if ((i == 1) || (i == 3)) { - - if (!((entry_ptr->header).flush_marker)) { - - pass = false; - failure_mssg = "Unexpected insert results 5."; - } - } - else if ((entry_ptr->header).flush_marker) { - - pass = false; - failure_mssg = "Unexpected insert results 6."; - } - } - if (pass) { /* Verify that pinned entries are in the pinned entry list */ @@ -2927,15 +2907,15 @@ check_insert_entry(unsigned paged) if (pass) { - if ((cache_ptr->index_len != 4) || (cache_ptr->index_size != 4 * entry_sizes[entry_type]) || + if ((cache_ptr->index_len != 2) || (cache_ptr->index_size != 2 * entry_sizes[entry_type]) || ((cache_ptr->slist_enabled) && - ((cache_ptr->slist_len != 4) || (cache_ptr->slist_size != 4 * entry_sizes[entry_type]))) || - (cache_ptr->pl_len != 0) || (cache_ptr->pl_size != (size_t)0) || (cache_ptr->pel_len != 2) || - (cache_ptr->pel_size != 2 * entry_sizes[entry_type]) || (cache_ptr->LRU_list_len != 2) || - (cache_ptr->LRU_list_size != 2 * entry_sizes[entry_type]) + ((cache_ptr->slist_len != 2) || (cache_ptr->slist_size != 2 * entry_sizes[entry_type]))) || + (cache_ptr->pl_len != 0) || (cache_ptr->pl_size != (size_t)0) || (cache_ptr->pel_len != 1) || + (cache_ptr->pel_size != 1 * entry_sizes[entry_type]) || (cache_ptr->LRU_list_len != 1) || + (cache_ptr->LRU_list_size != 1 * entry_sizes[entry_type]) #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS - || (cache_ptr->dLRU_list_len != 2) || - (cache_ptr->dLRU_list_size != 2 * entry_sizes[entry_type]) || (cache_ptr->cLRU_list_len != 0) || + || (cache_ptr->dLRU_list_len != 1) || + (cache_ptr->dLRU_list_size != 1 * entry_sizes[entry_type]) || (cache_ptr->cLRU_list_len != 0) || (cache_ptr->cLRU_list_size != (size_t)0) #endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ ) { @@ -2951,14 +2931,12 @@ check_insert_entry(unsigned paged) #if H5C_COLLECT_CACHE_STATS if (pass) { - if ((cache_ptr->insertions[entry_type] != 4) || (cache_ptr->pinned_insertions[entry_type] != 2) || - (cache_ptr->pins[entry_type] != 2) || (cache_ptr->unpins[entry_type] != 0) || - (cache_ptr->dirty_pins[entry_type] != 0) || (cache_ptr->max_index_len != 4) || - (cache_ptr->max_index_size != 4 * entry_sizes[entry_type]) || - ((cache_ptr->slist_enabled) && - ((cache_ptr->slist_len != 4) || (cache_ptr->slist_size != 4 * entry_sizes[entry_type]))) || - (cache_ptr->max_pl_len != 0) || (cache_ptr->max_pl_size != (size_t)0) || - (cache_ptr->max_pel_len != 2) || (cache_ptr->max_pel_size != 2 * entry_sizes[entry_type])) { + if ((cache_ptr->insertions[entry_type] != 2) || (cache_ptr->pinned_insertions[entry_type] != 1) || + (cache_ptr->pins[entry_type] != 1) || (cache_ptr->unpins[entry_type] != 0) || + (cache_ptr->dirty_pins[entry_type] != 0) || (cache_ptr->max_index_len != 2) || + (cache_ptr->max_index_size != 2 * entry_sizes[entry_type]) || (cache_ptr->max_pl_len != 0) || + (cache_ptr->max_pl_size != (size_t)0) || (cache_ptr->max_pel_len != 1) || + (cache_ptr->max_pel_size != 1 * entry_sizes[entry_type])) { pass = false; failure_mssg = "Unexpected insert results 11."; @@ -2970,8 +2948,7 @@ check_insert_entry(unsigned paged) if (pass) { - unpin_entry(entry_type, 2); - unpin_entry(entry_type, 3); + unpin_entry(entry_type, 1); } if (pass) { @@ -3130,12 +3107,6 @@ check_flush_cache__empty_cache(H5F_t *file_ptr) "flush with flags = 0x08 failed on empty cache.\n") } - if (pass) { - - H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_MARKED_ENTRIES_FLAG, - "flush with flags = 0x10 failed on empty cache.\n") - } - } /* check_flush_cache__empty_cache() */ /*------------------------------------------------------------------------- @@ -3169,12 +3140,382 @@ check_flush_cache__multi_entry(H5F_t *file_ptr) int test_num = 1; unsigned int flush_flags = H5C__NO_FLAGS_SET; unsigned int spec_size = 8; - struct flush_cache_test_spec spec[8] = { + struct flush_cache_test_spec spec[8] = {{/* entry_num = */ 0, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 100, + /* insert_flag = */ false, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_deserialized = */ true, + /* expected_serialized = */ false, + /* expected_destroyed = */ false}, + {/* entry_num = */ 1, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 75, + /* insert_flag = */ false, + /* flags = */ H5C__DIRTIED_FLAG, + /* expected_deserialized = */ true, + /* expected_serialized = */ true, + /* expected_destroyed = */ false}, + {/* entry_num = */ 2, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 25, + /* insert_flag = */ true, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_deserialized = */ false, + /* expected_serialized = */ true, + /* expected_destroyed = */ false}, + {/* entry_num = */ 3, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 50, + /* insert_flag = */ true, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_deserialized = */ false, + /* expected_serialized = */ true, + /* expected_destroyed = */ false}, + {/* entry_num = */ 4, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 10, + /* insert_flag = */ false, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_deserialized = */ true, + /* expected_serialized = */ false, + /* expected_destroyed = */ false}, + {/* entry_num = */ 5, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 20, + /* insert_flag = */ false, + /* flags = */ H5C__DIRTIED_FLAG, + /* expected_deserialized = */ true, + /* expected_serialized = */ true, + /* expected_destroyed = */ false}, + {/* entry_num = */ 6, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 30, + /* insert_flag = */ true, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_deserialized = */ false, + /* expected_serialized = */ true, + /* expected_destroyed = */ false}, + {/* entry_num = */ 7, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 40, + /* insert_flag = */ true, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_deserialized = */ false, + /* expected_serialized = */ true, + /* expected_destroyed = */ false}}; + + check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); + } + + if (pass) { + int test_num = 2; + unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; + unsigned int spec_size = 8; + struct flush_cache_test_spec spec[8] = {{/* entry_num = */ 0, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 100, + /* insert_flag = */ false, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_deserialized = */ true, + /* expected_serialized = */ false, + /* expected_destroyed = */ true}, + {/* entry_num = */ 1, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 75, + /* insert_flag = */ false, + /* flags = */ H5C__DIRTIED_FLAG, + /* expected_deserialized = */ true, + /* expected_serialized = */ true, + /* expected_destroyed = */ true}, + {/* entry_num = */ 2, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 25, + /* insert_flag = */ true, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_deserialized = */ false, + /* expected_serialized = */ true, + /* expected_destroyed = */ true}, + {/* entry_num = */ 3, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 50, + /* insert_flag = */ true, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_deserialized = */ false, + /* expected_serialized = */ true, + /* expected_destroyed = */ true}, + {/* entry_num = */ 4, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 10, + /* insert_flag = */ false, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_deserialized = */ true, + /* expected_serialized = */ false, + /* expected_destroyed = */ true}, + {/* entry_num = */ 5, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 20, + /* insert_flag = */ false, + /* flags = */ H5C__DIRTIED_FLAG, + /* expected_deserialized = */ true, + /* expected_serialized = */ true, + /* expected_destroyed = */ true}, + {/* entry_num = */ 6, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 30, + /* insert_flag = */ true, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_deserialized = */ false, + /* expected_serialized = */ true, + /* expected_destroyed = */ true}, + {/* entry_num = */ 7, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 40, + /* insert_flag = */ true, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_deserialized = */ false, + /* expected_serialized = */ true, + /* expected_destroyed = */ true}}; + + check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); + } + + if (pass) { + int test_num = 3; + unsigned int flush_flags = H5C__FLUSH_CLEAR_ONLY_FLAG; + unsigned int spec_size = 8; + struct flush_cache_test_spec spec[8] = {{/* entry_num = */ 0, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 100, + /* insert_flag = */ false, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_deserialized = */ true, + /* expected_serialized = */ false, + /* expected_destroyed = */ false}, + {/* entry_num = */ 1, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 75, + /* insert_flag = */ false, + /* flags = */ H5C__DIRTIED_FLAG, + /* expected_deserialized = */ true, + /* expected_serialized = */ false, + /* expected_destroyed = */ false}, + {/* entry_num = */ 2, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 25, + /* insert_flag = */ true, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_deserialized = */ false, + /* expected_serialized = */ false, + /* expected_destroyed = */ false}, + {/* entry_num = */ 3, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 50, + /* insert_flag = */ true, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_deserialized = */ false, + /* expected_serialized = */ false, + /* expected_destroyed = */ false}, + {/* entry_num = */ 4, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 10, + /* insert_flag = */ false, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_deserialized = */ true, + /* expected_serialized = */ false, + /* expected_destroyed = */ false}, + {/* entry_num = */ 5, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 20, + /* insert_flag = */ false, + /* flags = */ H5C__DIRTIED_FLAG, + /* expected_deserialized = */ true, + /* expected_serialized = */ false, + /* expected_destroyed = */ false}, + {/* entry_num = */ 6, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 30, + /* insert_flag = */ true, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_deserialized = */ false, + /* expected_serialized = */ false, + /* expected_destroyed = */ false}, + {/* entry_num = */ 7, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 40, + /* insert_flag = */ true, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_deserialized = */ false, + /* expected_serialized = */ false, + /* expected_destroyed = */ false}}; + + check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); + } + + if (pass) { + int test_num = 4; + unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG; + unsigned int spec_size = 8; + struct flush_cache_test_spec spec[8] = {{/* entry_num = */ 0, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 100, + /* insert_flag = */ false, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_deserialized = */ true, + /* expected_serialized = */ false, + /* expected_destroyed = */ true}, + {/* entry_num = */ 1, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 75, + /* insert_flag = */ false, + /* flags = */ H5C__DIRTIED_FLAG, + /* expected_deserialized = */ true, + /* expected_serialized = */ false, + /* expected_destroyed = */ true}, + {/* entry_num = */ 2, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 25, + /* insert_flag = */ true, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_deserialized = */ false, + /* expected_serialized = */ false, + /* expected_destroyed = */ true}, + {/* entry_num = */ 3, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 50, + /* insert_flag = */ true, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_deserialized = */ false, + /* expected_serialized = */ false, + /* expected_destroyed = */ true}, + {/* entry_num = */ 4, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 10, + /* insert_flag = */ false, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_deserialized = */ true, + /* expected_serialized = */ false, + /* expected_destroyed = */ true}, + {/* entry_num = */ 5, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 20, + /* insert_flag = */ false, + /* flags = */ H5C__DIRTIED_FLAG, + /* expected_deserialized = */ true, + /* expected_serialized = */ false, + /* expected_destroyed = */ true}, + {/* entry_num = */ 6, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 30, + /* insert_flag = */ true, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_deserialized = */ false, + /* expected_serialized = */ false, + /* expected_destroyed = */ true}, + {/* entry_num = */ 7, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 40, + /* insert_flag = */ true, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_deserialized = */ false, + /* expected_serialized = */ false, + /* expected_destroyed = */ true}}; + + check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); + } + + /* verify that all other flags are ignored */ + if (pass) { + int test_num = 5; + unsigned int flush_flags = (unsigned)~(H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG); + unsigned int spec_size = 8; + struct flush_cache_test_spec spec[8] = {{/* entry_num = */ 0, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 100, + /* insert_flag = */ false, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_deserialized = */ true, + /* expected_serialized = */ false, + /* expected_destroyed = */ false}, + {/* entry_num = */ 1, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 75, + /* insert_flag = */ false, + /* flags = */ H5C__DIRTIED_FLAG, + /* expected_deserialized = */ true, + /* expected_serialized = */ true, + /* expected_destroyed = */ false}, + {/* entry_num = */ 2, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 25, + /* insert_flag = */ true, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_deserialized = */ false, + /* expected_serialized = */ true, + /* expected_destroyed = */ false}, + {/* entry_num = */ 3, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 50, + /* insert_flag = */ true, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_deserialized = */ false, + /* expected_serialized = */ true, + /* expected_destroyed = */ false}, + {/* entry_num = */ 4, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 10, + /* insert_flag = */ false, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_deserialized = */ true, + /* expected_serialized = */ false, + /* expected_destroyed = */ false}, + {/* entry_num = */ 5, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 20, + /* insert_flag = */ false, + /* flags = */ H5C__DIRTIED_FLAG, + /* expected_deserialized = */ true, + /* expected_serialized = */ true, + /* expected_destroyed = */ false}, + {/* entry_num = */ 6, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 30, + /* insert_flag = */ true, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_deserialized = */ false, + /* expected_serialized = */ true, + /* expected_destroyed = */ false}, + {/* entry_num = */ 7, + /* entry_type = */ MONSTER_ENTRY_TYPE, + /* entry_index = */ 40, + /* insert_flag = */ true, + /* flags = */ H5C__NO_FLAGS_SET, + /* expected_deserialized = */ false, + /* expected_serialized = */ true, + /* expected_destroyed = */ false}}; + + check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); + } + + /* Now do pinned entry tests: + * + * For the most part, this test is directed at testing the ability + * of the flush routine to unravel collections of pinned entries. + */ + + if (pass) { + int test_num = 1; + unsigned int flush_flags = H5C__NO_FLAGS_SET; + unsigned int spec_size = 8; + struct pe_flush_cache_test_spec spec[8] = { {/* entry_num = */ 0, /* entry_type = */ PICO_ENTRY_TYPE, /* entry_index = */ 100, /* insert_flag = */ false, /* flags = */ H5C__NO_FLAGS_SET, + /* num_pins = */ 0, + /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ true, /* expected_serialized = */ false, /* expected_destroyed = */ false}, @@ -3183,6 +3524,9 @@ check_flush_cache__multi_entry(H5F_t *file_ptr) /* entry_index = */ 75, /* insert_flag = */ false, /* flags = */ H5C__DIRTIED_FLAG, + /* num_pins = */ 1, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ true, /* expected_serialized = */ true, /* expected_destroyed = */ false}, @@ -3191,6 +3535,9 @@ check_flush_cache__multi_entry(H5F_t *file_ptr) /* entry_index = */ 25, /* insert_flag = */ true, /* flags = */ H5C__NO_FLAGS_SET, + /* num_pins = */ 2, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, 75, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ false, /* expected_serialized = */ true, /* expected_destroyed = */ false}, @@ -3199,6 +3546,10 @@ check_flush_cache__multi_entry(H5F_t *file_ptr) /* entry_index = */ 50, /* insert_flag = */ true, /* flags = */ H5C__NO_FLAGS_SET, + /* num_pins = */ 3, + /* pin_type[MAX_PINS] = */ + {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, 75, 25, -1, -1, -1, -1, -1}, /* expected_deserialized = */ false, /* expected_serialized = */ true, /* expected_destroyed = */ false}, @@ -3206,7 +3557,11 @@ check_flush_cache__multi_entry(H5F_t *file_ptr) /* entry_type = */ MONSTER_ENTRY_TYPE, /* entry_index = */ 10, /* insert_flag = */ false, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* flags = */ H5C__NO_FLAGS_SET, + /* num_pins = */ 4, + /* pin_type[MAX_PINS] = */ + {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, -1, -1, -1, -1}, /* expected_deserialized = */ true, /* expected_serialized = */ false, /* expected_destroyed = */ false}, @@ -3214,7 +3569,12 @@ check_flush_cache__multi_entry(H5F_t *file_ptr) /* entry_type = */ MONSTER_ENTRY_TYPE, /* entry_index = */ 20, /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG, + /* flags = */ H5C__DIRTIED_FLAG, + /* num_pins = */ 5, + /* pin_type[MAX_PINS] = */ + {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, MONSTER_ENTRY_TYPE, -1, -1, + -1}, + /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, 10, -1, -1, -1}, /* expected_deserialized = */ true, /* expected_serialized = */ true, /* expected_destroyed = */ false}, @@ -3222,7 +3582,12 @@ check_flush_cache__multi_entry(H5F_t *file_ptr) /* entry_type = */ MONSTER_ENTRY_TYPE, /* entry_index = */ 30, /* insert_flag = */ true, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* flags = */ H5C__NO_FLAGS_SET, + /* num_pins = */ 6, + /* pin_type[MAX_PINS] = */ + {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, MONSTER_ENTRY_TYPE, + MONSTER_ENTRY_TYPE, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, 10, 20, -1, -1}, /* expected_deserialized = */ false, /* expected_serialized = */ true, /* expected_destroyed = */ false}, @@ -3230,24 +3595,32 @@ check_flush_cache__multi_entry(H5F_t *file_ptr) /* entry_type = */ MONSTER_ENTRY_TYPE, /* entry_index = */ 40, /* insert_flag = */ true, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* flags = */ H5C__NO_FLAGS_SET, + /* num_pins = */ 7, + /* pin_type[MAX_PINS] = */ + {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, MONSTER_ENTRY_TYPE, + MONSTER_ENTRY_TYPE, MONSTER_ENTRY_TYPE, -1}, + /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, 10, 20, 30, -1}, /* expected_deserialized = */ false, /* expected_serialized = */ true, /* expected_destroyed = */ false}}; - check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); + check_flush_cache__pe_multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); } if (pass) { - int test_num = 2; - unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; - unsigned int spec_size = 8; - struct flush_cache_test_spec spec[8] = { + int test_num = 2; + unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; + unsigned int spec_size = 8; + struct pe_flush_cache_test_spec spec[8] = { {/* entry_num = */ 0, /* entry_type = */ PICO_ENTRY_TYPE, /* entry_index = */ 100, /* insert_flag = */ false, /* flags = */ H5C__NO_FLAGS_SET, + /* num_pins = */ 0, + /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ true, /* expected_serialized = */ false, /* expected_destroyed = */ true}, @@ -3256,6 +3629,9 @@ check_flush_cache__multi_entry(H5F_t *file_ptr) /* entry_index = */ 75, /* insert_flag = */ false, /* flags = */ H5C__DIRTIED_FLAG, + /* num_pins = */ 1, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ true, /* expected_serialized = */ true, /* expected_destroyed = */ true}, @@ -3264,6 +3640,9 @@ check_flush_cache__multi_entry(H5F_t *file_ptr) /* entry_index = */ 25, /* insert_flag = */ true, /* flags = */ H5C__NO_FLAGS_SET, + /* num_pins = */ 2, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, 75, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ false, /* expected_serialized = */ true, /* expected_destroyed = */ true}, @@ -3272,6 +3651,10 @@ check_flush_cache__multi_entry(H5F_t *file_ptr) /* entry_index = */ 50, /* insert_flag = */ true, /* flags = */ H5C__NO_FLAGS_SET, + /* num_pins = */ 3, + /* pin_type[MAX_PINS] = */ + {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, 75, 25, -1, -1, -1, -1, -1}, /* expected_deserialized = */ false, /* expected_serialized = */ true, /* expected_destroyed = */ true}, @@ -3279,7 +3662,10 @@ check_flush_cache__multi_entry(H5F_t *file_ptr) /* entry_type = */ MONSTER_ENTRY_TYPE, /* entry_index = */ 10, /* insert_flag = */ false, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* flags = */ H5C__NO_FLAGS_SET, + /* num_pins = */ 0, + /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ true, /* expected_serialized = */ false, /* expected_destroyed = */ true}, @@ -3287,7 +3673,10 @@ check_flush_cache__multi_entry(H5F_t *file_ptr) /* entry_type = */ MONSTER_ENTRY_TYPE, /* entry_index = */ 20, /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG, + /* flags = */ H5C__DIRTIED_FLAG, + /* num_pins = */ 1, + /* pin_type[MAX_PINS] = */ {MONSTER_ENTRY_TYPE, -1, -1, -1, -1 - 1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {10, -1, -1, -1 - 1, -1, -1, -1}, /* expected_deserialized = */ true, /* expected_serialized = */ true, /* expected_destroyed = */ true}, @@ -3295,7 +3684,10 @@ check_flush_cache__multi_entry(H5F_t *file_ptr) /* entry_type = */ MONSTER_ENTRY_TYPE, /* entry_index = */ 30, /* insert_flag = */ true, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* flags = */ H5C__NO_FLAGS_SET, + /* num_pins = */ 2, + /* pin_type[MAX_PINS] = */ {MONSTER_ENTRY_TYPE, MONSTER_ENTRY_TYPE, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {10, 20, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ false, /* expected_serialized = */ true, /* expected_destroyed = */ true}, @@ -3303,1038 +3695,274 @@ check_flush_cache__multi_entry(H5F_t *file_ptr) /* entry_type = */ MONSTER_ENTRY_TYPE, /* entry_index = */ 40, /* insert_flag = */ true, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* flags = */ H5C__NO_FLAGS_SET, + /* num_pins = */ 3, + /* pin_type[MAX_PINS] = */ + {MONSTER_ENTRY_TYPE, MONSTER_ENTRY_TYPE, MONSTER_ENTRY_TYPE, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {10, 20, 30, -1, -1, -1, -1, -1}, /* expected_deserialized = */ false, /* expected_serialized = */ true, /* expected_destroyed = */ true}}; - check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); + check_flush_cache__pe_multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); } if (pass) { - int test_num = 3; - unsigned int flush_flags = H5C__FLUSH_CLEAR_ONLY_FLAG; - unsigned int spec_size = 8; - struct flush_cache_test_spec spec[8] = { + int test_num = 3; + unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG; + unsigned int spec_size = 8; + struct pe_flush_cache_test_spec spec[8] = { {/* entry_num = */ 0, /* entry_type = */ PICO_ENTRY_TYPE, /* entry_index = */ 100, /* insert_flag = */ false, /* flags = */ H5C__NO_FLAGS_SET, + /* num_pins = */ 0, + /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ true, /* expected_serialized = */ false, - /* expected_destroyed = */ false}, + /* expected_destroyed = */ true}, {/* entry_num = */ 1, /* entry_type = */ PICO_ENTRY_TYPE, /* entry_index = */ 75, /* insert_flag = */ false, /* flags = */ H5C__DIRTIED_FLAG, + /* num_pins = */ 1, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ true, /* expected_serialized = */ false, - /* expected_destroyed = */ false}, + /* expected_destroyed = */ true}, {/* entry_num = */ 2, /* entry_type = */ PICO_ENTRY_TYPE, /* entry_index = */ 25, /* insert_flag = */ true, /* flags = */ H5C__NO_FLAGS_SET, + /* num_pins = */ 1, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ false, /* expected_serialized = */ false, - /* expected_destroyed = */ false}, + /* expected_destroyed = */ true}, {/* entry_num = */ 3, /* entry_type = */ PICO_ENTRY_TYPE, /* entry_index = */ 50, /* insert_flag = */ true, /* flags = */ H5C__NO_FLAGS_SET, + /* num_pins = */ 1, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ false, /* expected_serialized = */ false, - /* expected_destroyed = */ false}, + /* expected_destroyed = */ true}, {/* entry_num = */ 4, /* entry_type = */ MONSTER_ENTRY_TYPE, /* entry_index = */ 10, /* insert_flag = */ false, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* flags = */ H5C__NO_FLAGS_SET, + /* num_pins = */ 0, + /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ true, /* expected_serialized = */ false, - /* expected_destroyed = */ false}, + /* expected_destroyed = */ true}, {/* entry_num = */ 5, /* entry_type = */ MONSTER_ENTRY_TYPE, /* entry_index = */ 20, /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG, + /* flags = */ H5C__DIRTIED_FLAG, + /* num_pins = */ 0, + /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ true, /* expected_serialized = */ false, - /* expected_destroyed = */ false}, + /* expected_destroyed = */ true}, {/* entry_num = */ 6, /* entry_type = */ MONSTER_ENTRY_TYPE, /* entry_index = */ 30, /* insert_flag = */ true, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* flags = */ H5C__NO_FLAGS_SET, + /* num_pins = */ 0, + /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ false, /* expected_serialized = */ false, - /* expected_destroyed = */ false}, + /* expected_destroyed = */ true}, {/* entry_num = */ 7, /* entry_type = */ MONSTER_ENTRY_TYPE, /* entry_index = */ 40, /* insert_flag = */ true, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, + /* flags = */ H5C__NO_FLAGS_SET, + /* num_pins = */ 0, + /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ false, /* expected_serialized = */ false, - /* expected_destroyed = */ false}}; + /* expected_destroyed = */ true}}; - check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); + check_flush_cache__pe_multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); } - if (pass) { - int test_num = 4; - unsigned int flush_flags = H5C__FLUSH_MARKED_ENTRIES_FLAG; - unsigned int spec_size = 8; - struct flush_cache_test_spec spec[8] = { - {/* entry_num = */ 0, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 100, - /* insert_flag = */ false, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ false}, - {/* entry_num = */ 1, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 75, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ false}, - {/* entry_num = */ 2, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 25, - /* insert_flag = */ true, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_deserialized = */ false, - /* expected_serialized = */ false, - /* expected_destroyed = */ false}, - {/* entry_num = */ 3, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 50, - /* insert_flag = */ true, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_deserialized = */ false, - /* expected_serialized = */ false, - /* expected_destroyed = */ false}, - {/* entry_num = */ 4, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 10, - /* insert_flag = */ false, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ false}, - {/* entry_num = */ 5, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 20, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ false}, - {/* entry_num = */ 6, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 30, - /* insert_flag = */ true, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_deserialized = */ false, - /* expected_serialized = */ true, - /* expected_destroyed = */ false}, - {/* entry_num = */ 7, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 40, - /* insert_flag = */ true, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_deserialized = */ false, - /* expected_serialized = */ true, - /* expected_destroyed = */ false}}; +} /* check_flush_cache__multi_entry() */ - check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); +/*------------------------------------------------------------------------- + * Function: check_flush_cache__multi_entry_test() + * + * Purpose : Run a multi entry flush cache test. + * + * Return: void + * + *------------------------------------------------------------------------- + */ + +static void +check_flush_cache__multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int flush_flags, + unsigned int spec_size, struct flush_cache_test_spec spec[]) +{ + H5C_t *cache_ptr = file_ptr->shared->cache; + static char msg[128]; + unsigned u; + size_t total_entry_size = 0; + test_entry_t *base_addr; + test_entry_t *entry_ptr; + + if (cache_ptr == NULL) { + + pass = false; + snprintf(msg, (size_t)128, "cache_ptr NULL on entry to single entry test #%d.", test_num); + failure_mssg = msg; } + else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) { - if (pass) { - int test_num = 5; - unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG; - unsigned int spec_size = 8; - struct flush_cache_test_spec spec[8] = { - {/* entry_num = */ 0, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 100, - /* insert_flag = */ false, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 1, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 75, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 2, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 25, - /* insert_flag = */ true, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_deserialized = */ false, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 3, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 50, - /* insert_flag = */ true, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_deserialized = */ false, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 4, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 10, - /* insert_flag = */ false, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 5, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 20, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 6, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 30, - /* insert_flag = */ true, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_deserialized = */ false, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 7, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 40, - /* insert_flag = */ true, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_deserialized = */ false, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}}; + pass = false; - check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); + snprintf(msg, (size_t)128, "cache not empty at beginning of multi entry test #%d.", test_num); + failure_mssg = msg; } + else if ((spec_size < 1) || (spec == NULL)) { - if (pass) { - int test_num = 6; - unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_MARKED_ENTRIES_FLAG; - unsigned int spec_size = 8; - struct flush_cache_test_spec spec[8] = { - {/* entry_num = */ 0, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 100, - /* insert_flag = */ false, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 1, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 75, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ true}, - {/* entry_num = */ 2, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 25, - /* insert_flag = */ true, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_deserialized = */ false, - /* expected_serialized = */ true, - /* expected_destroyed = */ true}, - {/* entry_num = */ 3, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 50, - /* insert_flag = */ true, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_deserialized = */ false, - /* expected_serialized = */ true, - /* expected_destroyed = */ true}, - {/* entry_num = */ 4, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 10, - /* insert_flag = */ false, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 5, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 20, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ true}, - {/* entry_num = */ 6, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 30, - /* insert_flag = */ true, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_deserialized = */ false, - /* expected_serialized = */ true, - /* expected_destroyed = */ true}, - {/* entry_num = */ 7, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 40, - /* insert_flag = */ true, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_deserialized = */ false, - /* expected_serialized = */ true, - /* expected_destroyed = */ true}}; + pass = false; + snprintf(msg, (size_t)128, "missing/bad test spec on entry to multi entry test #%d.", test_num); + failure_mssg = msg; + } - check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); + u = 0; + while (pass && (u < spec_size)) { + + if (((unsigned)spec[u].entry_num != u) || (spec[u].entry_type < 0) || + (spec[u].entry_type >= NUMBER_OF_ENTRY_TYPES) || (spec[u].entry_index < 0) || + (spec[u].entry_index > max_indices[spec[u].entry_type])) { + + pass = false; + snprintf(msg, (size_t)128, "bad data in spec[%u] on entry to multi entry test #%d.", u, test_num); + failure_mssg = msg; + } + u++; } - if (pass) { - int test_num = 7; - unsigned int flush_flags = H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__FLUSH_MARKED_ENTRIES_FLAG; - unsigned int spec_size = 8; - struct flush_cache_test_spec spec[8] = { - {/* entry_num = */ 0, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 100, - /* insert_flag = */ false, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ false}, - {/* entry_num = */ 1, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 75, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ false}, - {/* entry_num = */ 2, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 25, - /* insert_flag = */ true, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_deserialized = */ false, - /* expected_serialized = */ false, - /* expected_destroyed = */ false}, - {/* entry_num = */ 3, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 50, - /* insert_flag = */ true, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_deserialized = */ false, - /* expected_serialized = */ false, - /* expected_destroyed = */ false}, - {/* entry_num = */ 4, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 10, - /* insert_flag = */ false, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ false}, - {/* entry_num = */ 5, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 20, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ false}, - {/* entry_num = */ 6, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 30, - /* insert_flag = */ true, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_deserialized = */ false, - /* expected_serialized = */ false, - /* expected_destroyed = */ false}, - {/* entry_num = */ 7, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 40, - /* insert_flag = */ true, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_deserialized = */ false, - /* expected_serialized = */ false, - /* expected_destroyed = */ false}}; + u = 0; + while (pass && (u < spec_size)) { - check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); + if (spec[u].insert_flag) { + + insert_entry(file_ptr, spec[u].entry_type, spec[u].entry_index, spec[u].flags); + } + else { + + protect_entry(file_ptr, spec[u].entry_type, spec[u].entry_index); + + unprotect_entry(file_ptr, spec[u].entry_type, spec[u].entry_index, spec[u].flags); + } + + total_entry_size += entry_sizes[spec[u].entry_type]; + + u++; } if (pass) { - int test_num = 8; - unsigned int flush_flags = - H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__FLUSH_MARKED_ENTRIES_FLAG; - unsigned int spec_size = 8; - struct flush_cache_test_spec spec[8] = { - {/* entry_num = */ 0, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 100, - /* insert_flag = */ false, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 1, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 75, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 2, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 25, - /* insert_flag = */ true, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_deserialized = */ false, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 3, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 50, - /* insert_flag = */ true, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_deserialized = */ false, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 4, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 10, - /* insert_flag = */ false, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 5, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 20, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 6, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 30, - /* insert_flag = */ true, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_deserialized = */ false, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 7, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 40, - /* insert_flag = */ true, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_deserialized = */ false, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}}; - check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); - } + H5C_FLUSH_CACHE(file_ptr, flush_flags, "dummy failure message.\n") - /* verify that all other flags are ignored */ - if (pass) { - int test_num = 9; - unsigned int flush_flags = (unsigned)~(H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG | - H5C__FLUSH_MARKED_ENTRIES_FLAG); - unsigned int spec_size = 8; - struct flush_cache_test_spec spec[8] = { - {/* entry_num = */ 0, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 100, - /* insert_flag = */ false, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ false}, - {/* entry_num = */ 1, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 75, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ false}, - {/* entry_num = */ 2, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 25, - /* insert_flag = */ true, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_deserialized = */ false, - /* expected_serialized = */ true, - /* expected_destroyed = */ false}, - {/* entry_num = */ 3, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 50, - /* insert_flag = */ true, - /* flags = */ H5C__NO_FLAGS_SET, - /* expected_deserialized = */ false, - /* expected_serialized = */ true, - /* expected_destroyed = */ false}, - {/* entry_num = */ 4, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 10, - /* insert_flag = */ false, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ false}, - {/* entry_num = */ 5, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 20, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ false}, - {/* entry_num = */ 6, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 30, - /* insert_flag = */ true, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_deserialized = */ false, - /* expected_serialized = */ true, - /* expected_destroyed = */ false}, - {/* entry_num = */ 7, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 40, - /* insert_flag = */ true, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* expected_deserialized = */ false, - /* expected_serialized = */ true, - /* expected_destroyed = */ false}}; + if (!pass) { - check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); + snprintf(msg, (size_t)128, "flush with flags 0x%x failed in multi entry test #%d.", flush_flags, + test_num); + failure_mssg = msg; + } } - /* Now do pinned entry tests: - * - * For the most part, this test is directed at testing the ability - * of the flush routine to unravel collections of pinned entries. - */ + u = 0; + while (pass && (u < spec_size)) { + base_addr = entries[spec[u].entry_type]; + entry_ptr = &(base_addr[spec[u].entry_index]); - if (pass) { - int test_num = 1; - unsigned int flush_flags = H5C__NO_FLAGS_SET; - unsigned int spec_size = 8; - struct pe_flush_cache_test_spec spec[8] = { - {/* entry_num = */ 0, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 100, - /* insert_flag = */ false, - /* flags = */ H5C__NO_FLAGS_SET, - /* num_pins = */ 0, - /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ false}, - {/* entry_num = */ 1, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 75, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ false}, - {/* entry_num = */ 2, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 25, - /* insert_flag = */ true, - /* flags = */ H5C__NO_FLAGS_SET, - /* num_pins = */ 2, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, 75, -1, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ false, - /* expected_serialized = */ true, - /* expected_destroyed = */ false}, - {/* entry_num = */ 3, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 50, - /* insert_flag = */ true, - /* flags = */ H5C__NO_FLAGS_SET, - /* num_pins = */ 3, - /* pin_type[MAX_PINS] = */ - {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, 75, 25, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ false, - /* expected_serialized = */ true, - /* expected_destroyed = */ false}, - {/* entry_num = */ 4, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 10, - /* insert_flag = */ false, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 4, - /* pin_type[MAX_PINS] = */ - {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, -1, -1, -1, -1}, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ false}, - {/* entry_num = */ 5, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 20, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 5, - /* pin_type[MAX_PINS] = */ - {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, MONSTER_ENTRY_TYPE, -1, -1, - -1}, - /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, 10, -1, -1, -1}, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ false}, - {/* entry_num = */ 6, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 30, - /* insert_flag = */ true, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 6, - /* pin_type[MAX_PINS] = */ - {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, MONSTER_ENTRY_TYPE, - MONSTER_ENTRY_TYPE, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, 10, 20, -1, -1}, - /* expected_deserialized = */ false, - /* expected_serialized = */ true, - /* expected_destroyed = */ false}, - {/* entry_num = */ 7, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 40, - /* insert_flag = */ true, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 7, - /* pin_type[MAX_PINS] = */ - {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, MONSTER_ENTRY_TYPE, - MONSTER_ENTRY_TYPE, MONSTER_ENTRY_TYPE, -1}, - /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, 10, 20, 30, -1}, - /* expected_deserialized = */ false, - /* expected_serialized = */ true, - /* expected_destroyed = */ false}}; + if ((entry_ptr->deserialized != spec[u].expected_deserialized) || + (entry_ptr->serialized != spec[u].expected_serialized) || + (entry_ptr->destroyed != spec[u].expected_destroyed)) { - check_flush_cache__pe_multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); + pass = false; + snprintf(msg, (size_t)128, "Bad status on entry %u after flush in multi entry test #%d.", u, + test_num); + failure_mssg = msg; + } + u++; } if (pass) { - int test_num = 2; - unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; - unsigned int spec_size = 8; - struct pe_flush_cache_test_spec spec[8] = { - {/* entry_num = */ 0, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 100, - /* insert_flag = */ false, - /* flags = */ H5C__NO_FLAGS_SET, - /* num_pins = */ 0, - /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 1, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 75, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ true}, - {/* entry_num = */ 2, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 25, - /* insert_flag = */ true, - /* flags = */ H5C__NO_FLAGS_SET, - /* num_pins = */ 2, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, 75, -1, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ false, - /* expected_serialized = */ true, - /* expected_destroyed = */ true}, - {/* entry_num = */ 3, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 50, - /* insert_flag = */ true, - /* flags = */ H5C__NO_FLAGS_SET, - /* num_pins = */ 3, - /* pin_type[MAX_PINS] = */ - {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, 75, 25, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ false, - /* expected_serialized = */ true, - /* expected_destroyed = */ true}, - {/* entry_num = */ 4, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 10, - /* insert_flag = */ false, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 0, - /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 5, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 20, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {MONSTER_ENTRY_TYPE, -1, -1, -1, -1 - 1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {10, -1, -1, -1 - 1, -1, -1, -1}, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ true}, - {/* entry_num = */ 6, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 30, - /* insert_flag = */ true, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 2, - /* pin_type[MAX_PINS] = */ {MONSTER_ENTRY_TYPE, MONSTER_ENTRY_TYPE, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {10, 20, -1, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ false, - /* expected_serialized = */ true, - /* expected_destroyed = */ true}, - {/* entry_num = */ 7, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 40, - /* insert_flag = */ true, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 3, - /* pin_type[MAX_PINS] = */ - {MONSTER_ENTRY_TYPE, MONSTER_ENTRY_TYPE, MONSTER_ENTRY_TYPE, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {10, 20, 30, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ false, - /* expected_serialized = */ true, - /* expected_destroyed = */ true}}; - check_flush_cache__pe_multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); + if ((((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0) && + ((cache_ptr->index_len != spec_size) || (cache_ptr->index_size != total_entry_size))) || + (((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0) && + ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)))) { + + pass = false; + snprintf(msg, (size_t)128, "Unexpected cache len/size after flush in multi entry test #%d.", + test_num); + failure_mssg = msg; + } } + /* clean up the cache to prep for the next test */ if (pass) { - int test_num = 3; - unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG; - unsigned int spec_size = 8; - struct pe_flush_cache_test_spec spec[8] = { - {/* entry_num = */ 0, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 100, - /* insert_flag = */ false, - /* flags = */ H5C__NO_FLAGS_SET, - /* num_pins = */ 0, - /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 1, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 75, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 2, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 25, - /* insert_flag = */ true, - /* flags = */ H5C__NO_FLAGS_SET, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ false, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 3, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 50, - /* insert_flag = */ true, - /* flags = */ H5C__NO_FLAGS_SET, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ false, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 4, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 10, - /* insert_flag = */ false, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 0, - /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 5, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 20, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 0, - /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 6, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 30, - /* insert_flag = */ true, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 0, - /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ false, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 7, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 40, - /* insert_flag = */ true, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 0, - /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ false, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}}; - check_flush_cache__pe_multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, "dummy mssg.\n") + + if (!pass) { + + pass = false; + snprintf(msg, (size_t)128, "Flush failed on cleanup in multi entry test #%d.", test_num); + failure_mssg = msg; + } + else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) { + + pass = false; + snprintf(msg, (size_t)128, "Unexpected cache len/size after cleanup in multi entry test #%d.", + test_num); + failure_mssg = msg; + } } - if (pass) { - int test_num = 4; - unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_MARKED_ENTRIES_FLAG; - unsigned int spec_size = 8; - struct pe_flush_cache_test_spec spec[8] = { - {/* entry_num = */ 0, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 100, - /* insert_flag = */ false, - /* flags = */ H5C__NO_FLAGS_SET, - /* num_pins = */ 0, - /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 1, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 75, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ true}, - {/* entry_num = */ 2, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 25, - /* insert_flag = */ true, - /* flags = */ H5C__NO_FLAGS_SET, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ false, - /* expected_serialized = */ true, - /* expected_destroyed = */ true}, - {/* entry_num = */ 3, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 50, - /* insert_flag = */ true, - /* flags = */ H5C__NO_FLAGS_SET, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ false, - /* expected_serialized = */ true, - /* expected_destroyed = */ true}, - {/* entry_num = */ 4, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 10, - /* insert_flag = */ false, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 0, - /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 5, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 20, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG, - /* num_pins = */ 4, - /* pin_type[MAX_PINS] = */ - {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, -1, -1, -1, -1}, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ true}, - {/* entry_num = */ 6, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 30, - /* insert_flag = */ true, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 4, - /* pin_type[MAX_PINS] = */ - {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, -1, -1, -1, -1}, - /* expected_deserialized = */ false, - /* expected_serialized = */ true, - /* expected_destroyed = */ true}, - {/* entry_num = */ 7, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 40, - /* insert_flag = */ true, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 0, - /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ false, - /* expected_serialized = */ true, - /* expected_destroyed = */ true}}; + u = 0; + while (pass && (u < spec_size)) { - check_flush_cache__pe_multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); - } + base_addr = entries[spec[u].entry_type]; + entry_ptr = &(base_addr[spec[u].entry_index]); - if (pass) { - int test_num = 5; - unsigned int flush_flags = - H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__FLUSH_MARKED_ENTRIES_FLAG; - unsigned int spec_size = 8; - struct pe_flush_cache_test_spec spec[8] = { - {/* entry_num = */ 0, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 100, - /* insert_flag = */ false, - /* flags = */ H5C__NO_FLAGS_SET, - /* num_pins = */ 0, - /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 1, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 75, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 2, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 25, - /* insert_flag = */ true, - /* flags = */ H5C__NO_FLAGS_SET, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ false, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 3, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 50, - /* insert_flag = */ true, - /* flags = */ H5C__NO_FLAGS_SET, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ false, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 4, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 10, - /* insert_flag = */ false, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 5, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 20, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 6, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 30, - /* insert_flag = */ true, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ false, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}, - {/* entry_num = */ 7, - /* entry_type = */ MONSTER_ENTRY_TYPE, - /* entry_index = */ 40, - /* insert_flag = */ true, - /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, - /* expected_deserialized = */ false, - /* expected_serialized = */ false, - /* expected_destroyed = */ true}}; + entry_ptr->deserialized = false; + entry_ptr->serialized = false; + entry_ptr->destroyed = false; - check_flush_cache__pe_multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec); + u++; } -} /* check_flush_cache__multi_entry() */ +} /* check_flush_cache__multi_entry_test() */ /*------------------------------------------------------------------------- - * Function: check_flush_cache__multi_entry_test() * - * Purpose : Run a multi entry flush cache test. + * Function: check_flush_cache__pe_multi_entry_test() + * + * Purpose: Run a multi entry flush cache test. * * Return: void * @@ -4342,12 +3970,13 @@ check_flush_cache__multi_entry(H5F_t *file_ptr) */ static void -check_flush_cache__multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int flush_flags, - unsigned int spec_size, struct flush_cache_test_spec spec[]) +check_flush_cache__pe_multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int flush_flags, + unsigned int spec_size, struct pe_flush_cache_test_spec spec[]) { H5C_t *cache_ptr = file_ptr->shared->cache; static char msg[128]; unsigned u; + int j; size_t total_entry_size = 0; test_entry_t *base_addr; test_entry_t *entry_ptr; @@ -4355,20 +3984,20 @@ check_flush_cache__multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int if (cache_ptr == NULL) { pass = false; - snprintf(msg, (size_t)128, "cache_ptr NULL on entry to single entry test #%d.", test_num); + snprintf(msg, (size_t)128, "cache_ptr NULL on entry to pe multi entry test #%d.", test_num); failure_mssg = msg; } else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) { pass = false; - snprintf(msg, (size_t)128, "cache not empty at beginning of multi entry test #%d.", test_num); + snprintf(msg, (size_t)128, "cache not empty at beginning of pe multi entry test #%d.", test_num); failure_mssg = msg; } else if ((spec_size < 1) || (spec == NULL)) { pass = false; - snprintf(msg, (size_t)128, "missing/bad test spec on entry to multi entry test #%d.", test_num); + snprintf(msg, (size_t)128, "missing/bad test spec on entry to pe multi entry test #%d.", test_num); failure_mssg = msg; } @@ -4377,10 +4006,12 @@ check_flush_cache__multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int if (((unsigned)spec[u].entry_num != u) || (spec[u].entry_type < 0) || (spec[u].entry_type >= NUMBER_OF_ENTRY_TYPES) || (spec[u].entry_index < 0) || - (spec[u].entry_index > max_indices[spec[u].entry_type])) { + (spec[u].entry_index > max_indices[spec[u].entry_type]) || (spec[u].num_pins < 0) || + (spec[u].num_pins > MAX_PINS)) { pass = false; - snprintf(msg, (size_t)128, "bad data in spec[%u] on entry to multi entry test #%d.", u, test_num); + snprintf(msg, (size_t)128, "bad data in spec[%u] on entry to pe multi entry test #%d.", u, + test_num); failure_mssg = msg; } u++; @@ -4388,7 +4019,6 @@ check_flush_cache__multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int u = 0; while (pass && (u < spec_size)) { - if (spec[u].insert_flag) { insert_entry(file_ptr, spec[u].entry_type, spec[u].entry_index, spec[u].flags); @@ -4402,6 +4032,12 @@ check_flush_cache__multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int total_entry_size += entry_sizes[spec[u].entry_type]; + for (j = 0; j < spec[u].num_pins; j++) { + + create_pinned_entry_dependency(file_ptr, spec[u].entry_type, spec[u].entry_index, + spec[u].pin_type[j], spec[u].pin_idx[j]); + } + u++; } @@ -4411,14 +4047,15 @@ check_flush_cache__multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int if (!pass) { - snprintf(msg, (size_t)128, "flush with flags 0x%x failed in multi entry test #%d.", flush_flags, - test_num); + snprintf(msg, (size_t)128, "flush with flags 0x%x failed in pe multi entry test #%d.", + flush_flags, test_num); failure_mssg = msg; } } u = 0; while (pass && (u < spec_size)) { + base_addr = entries[spec[u].entry_type]; entry_ptr = &(base_addr[spec[u].entry_index]); @@ -4427,7 +4064,7 @@ check_flush_cache__multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int (entry_ptr->destroyed != spec[u].expected_destroyed)) { pass = false; - snprintf(msg, (size_t)128, "Bad status on entry %u after flush in multi entry test #%d.", u, + snprintf(msg, (size_t)128, "Bad status on entry %u after flush in pe multi entry test #%d.", u, test_num); failure_mssg = msg; } @@ -4442,7 +4079,7 @@ check_flush_cache__multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)))) { pass = false; - snprintf(msg, (size_t)128, "Unexpected cache len/size after flush in multi entry test #%d.", + snprintf(msg, (size_t)128, "Unexpected cache len/size after flush in pe multi entry test #%d.", test_num); failure_mssg = msg; } @@ -4456,13 +4093,13 @@ check_flush_cache__multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int if (!pass) { pass = false; - snprintf(msg, (size_t)128, "Flush failed on cleanup in multi entry test #%d.", test_num); + snprintf(msg, (size_t)128, "Flush failed on cleanup in pe multi entry test #%d.", test_num); failure_mssg = msg; } else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) { pass = false; - snprintf(msg, (size_t)128, "Unexpected cache len/size after cleanup in multi entry test #%d.", + snprintf(msg, (size_t)128, "Unexpected cache len/size after cleanup in pe multi entry test #%d.", test_num); failure_mssg = msg; } @@ -4481,237 +4118,75 @@ check_flush_cache__multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int u++; } -} /* check_flush_cache__multi_entry_test() */ +} /* check_flush_cache__pe_multi_entry_test() */ /*------------------------------------------------------------------------- + * Function: check_flush_cache__flush_ops() * - * Function: check_flush_cache__pe_multi_entry_test() + * Purpose: Run the flush ops cache tests. * - * Purpose: Run a multi entry flush cache test. + * These are tests that test the cache's ability to handle + * the case in which the flush callback dirties, resizes, + * and/or moves entries. * - * Return: void + * Do nothing if pass is false on entry. + * + * Return: void * *------------------------------------------------------------------------- */ static void -check_flush_cache__pe_multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int flush_flags, - unsigned int spec_size, struct pe_flush_cache_test_spec spec[]) +check_flush_cache__flush_ops(H5F_t *file_ptr) { - H5C_t *cache_ptr = file_ptr->shared->cache; - static char msg[128]; - unsigned u; - int j; - size_t total_entry_size = 0; - test_entry_t *base_addr; - test_entry_t *entry_ptr; + const int max_num_spec = 10; + const int max_num_check = 4; + struct fo_flush_cache_test_spec *spec = NULL; + struct fo_flush_entry_check *checks = NULL; + H5C_t *cache_ptr = file_ptr->shared->cache; if (cache_ptr == NULL) { - pass = false; - snprintf(msg, (size_t)128, "cache_ptr NULL on entry to pe multi entry test #%d.", test_num); - failure_mssg = msg; + pass = false; + failure_mssg = "cache_ptr NULL on entry to flush ops test."; } else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) { - pass = false; - - snprintf(msg, (size_t)128, "cache not empty at beginning of pe multi entry test #%d.", test_num); - failure_mssg = msg; + pass = false; + failure_mssg = "cache not empty at beginning of flush ops test."; } - else if ((spec_size < 1) || (spec == NULL)) { - pass = false; - snprintf(msg, (size_t)128, "missing/bad test spec on entry to pe multi entry test #%d.", test_num); - failure_mssg = msg; - } + spec = malloc((size_t)max_num_spec * sizeof(struct fo_flush_cache_test_spec)); + if (spec == NULL) { - u = 0; - while (pass && (u < spec_size)) { + pass = false; + failure_mssg = "couldn't allocate flush ops test spec array"; + } - if (((unsigned)spec[u].entry_num != u) || (spec[u].entry_type < 0) || - (spec[u].entry_type >= NUMBER_OF_ENTRY_TYPES) || (spec[u].entry_index < 0) || - (spec[u].entry_index > max_indices[spec[u].entry_type]) || (spec[u].num_pins < 0) || - (spec[u].num_pins > MAX_PINS)) { + checks = malloc((size_t)max_num_check * sizeof(struct fo_flush_entry_check)); + if (checks == NULL) { - pass = false; - snprintf(msg, (size_t)128, "bad data in spec[%u] on entry to pe multi entry test #%d.", u, - test_num); - failure_mssg = msg; - } - u++; + pass = false; + failure_mssg = "couldn't allocate flush ops test check array"; } - u = 0; - while (pass && (u < spec_size)) { - if (spec[u].insert_flag) { + if (pass) /* test #1 */ + { + /* start with a very simple test, in which there are two entries + * resident in cache, and the second entry dirties the first in + * the flush callback. No size changes, and no flush flags. + */ + int test_num = 1; + unsigned int flush_flags = H5C__NO_FLAGS_SET; + int spec_size = 2; + int check_size = 0; + unsigned init_expected_index_len = 2; + size_t init_expected_index_size = 2 * PICO_ENTRY_SIZE; + unsigned expected_index_len = 2; + size_t expected_index_size = 2 * PICO_ENTRY_SIZE; - insert_entry(file_ptr, spec[u].entry_type, spec[u].entry_index, spec[u].flags); - } - else { - - protect_entry(file_ptr, spec[u].entry_type, spec[u].entry_index); - - unprotect_entry(file_ptr, spec[u].entry_type, spec[u].entry_index, spec[u].flags); - } - - total_entry_size += entry_sizes[spec[u].entry_type]; - - for (j = 0; j < spec[u].num_pins; j++) { - - create_pinned_entry_dependency(file_ptr, spec[u].entry_type, spec[u].entry_index, - spec[u].pin_type[j], spec[u].pin_idx[j]); - } - - u++; - } - - if (pass) { - - H5C_FLUSH_CACHE(file_ptr, flush_flags, "dummy failure message.\n") - - if (!pass) { - - snprintf(msg, (size_t)128, "flush with flags 0x%x failed in pe multi entry test #%d.", - flush_flags, test_num); - failure_mssg = msg; - } - } - - u = 0; - while (pass && (u < spec_size)) { - - base_addr = entries[spec[u].entry_type]; - entry_ptr = &(base_addr[spec[u].entry_index]); - - if ((entry_ptr->deserialized != spec[u].expected_deserialized) || - (entry_ptr->serialized != spec[u].expected_serialized) || - (entry_ptr->destroyed != spec[u].expected_destroyed)) { - - pass = false; - snprintf(msg, (size_t)128, "Bad status on entry %u after flush in pe multi entry test #%d.", u, - test_num); - failure_mssg = msg; - } - u++; - } - - if (pass) { - - if ((((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0) && - ((cache_ptr->index_len != spec_size) || (cache_ptr->index_size != total_entry_size))) || - (((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0) && - ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)))) { - - pass = false; - snprintf(msg, (size_t)128, "Unexpected cache len/size after flush in pe multi entry test #%d.", - test_num); - failure_mssg = msg; - } - } - - /* clean up the cache to prep for the next test */ - if (pass) { - - H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, "dummy mssg.\n") - - if (!pass) { - - pass = false; - snprintf(msg, (size_t)128, "Flush failed on cleanup in pe multi entry test #%d.", test_num); - failure_mssg = msg; - } - else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) { - - pass = false; - snprintf(msg, (size_t)128, "Unexpected cache len/size after cleanup in pe multi entry test #%d.", - test_num); - failure_mssg = msg; - } - } - - u = 0; - while (pass && (u < spec_size)) { - - base_addr = entries[spec[u].entry_type]; - entry_ptr = &(base_addr[spec[u].entry_index]); - - entry_ptr->deserialized = false; - entry_ptr->serialized = false; - entry_ptr->destroyed = false; - - u++; - } - -} /* check_flush_cache__pe_multi_entry_test() */ - -/*------------------------------------------------------------------------- - * Function: check_flush_cache__flush_ops() - * - * Purpose: Run the flush ops cache tests. - * - * These are tests that test the cache's ability to handle - * the case in which the flush callback dirties, resizes, - * and/or moves entries. - * - * Do nothing if pass is false on entry. - * - * Return: void - * - *------------------------------------------------------------------------- - */ - -static void -check_flush_cache__flush_ops(H5F_t *file_ptr) -{ - const int max_num_spec = 10; - const int max_num_check = 4; - struct fo_flush_cache_test_spec *spec = NULL; - struct fo_flush_entry_check *checks = NULL; - H5C_t *cache_ptr = file_ptr->shared->cache; - - if (cache_ptr == NULL) { - - pass = false; - failure_mssg = "cache_ptr NULL on entry to flush ops test."; - } - else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) { - - pass = false; - failure_mssg = "cache not empty at beginning of flush ops test."; - } - - spec = malloc((size_t)max_num_spec * sizeof(struct fo_flush_cache_test_spec)); - if (spec == NULL) { - - pass = false; - failure_mssg = "couldn't allocate flush ops test spec array"; - } - - checks = malloc((size_t)max_num_check * sizeof(struct fo_flush_entry_check)); - if (checks == NULL) { - - pass = false; - failure_mssg = "couldn't allocate flush ops test check array"; - } - - if (pass) /* test #1 */ - { - /* start with a very simple test, in which there are two entries - * resident in cache, and the second entry dirties the first in - * the flush callback. No size changes, and no flush flags. - */ - int test_num = 1; - unsigned int flush_flags = H5C__NO_FLAGS_SET; - int spec_size = 2; - int check_size = 0; - unsigned init_expected_index_len = 2; - size_t init_expected_index_size = 2 * PICO_ENTRY_SIZE; - unsigned expected_index_len = 2; - size_t expected_index_size = 2 * PICO_ENTRY_SIZE; - - assert(spec_size <= max_num_spec); - assert(check_size <= max_num_check); + assert(spec_size <= max_num_spec); + assert(check_size <= max_num_check); spec[0] = (struct fo_flush_cache_test_spec){ /* entry_num = */ 0, @@ -5927,28 +5402,24 @@ check_flush_cache__flush_ops(H5F_t *file_ptr) if (pass) /* test #21 */ { - /* Now mix things up a bit. + /* Mix things up some more. * - * Load several entries, two of which have flush functions that + * Load lots of entries, some of which have flush functions that * resize, dirty, and move two entries that are not in the - * cache. Mark only one of these entries, and then flush the - * cache with the flush marked entries flag. + * cache. * - * This is the only test in which we test the - * H5C__FLUSH_MARKED_ENTRIES_FLAG. The hope is that since - * we test the two features extensively by themselves, so - * it should be sufficient to verify that they play together - * as expected. + * Also load entries that have flush ops on entries that are in + * cache. */ int test_num = 21; - unsigned int flush_flags = H5C__FLUSH_MARKED_ENTRIES_FLAG; - int spec_size = 4; + unsigned int flush_flags = H5C__NO_FLAGS_SET; + int spec_size = 6; int check_size = 4; - unsigned init_expected_index_len = 4; - size_t init_expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (2 * PICO_ENTRY_SIZE); - unsigned expected_index_len = 6; - size_t expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (VARIABLE_ENTRY_SIZE / 4) + - (VARIABLE_ENTRY_SIZE / 2) + (2 * PICO_ENTRY_SIZE); + unsigned init_expected_index_len = 6; + size_t init_expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (4 * PICO_ENTRY_SIZE); + unsigned expected_index_len = 10; + size_t expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (2 * (VARIABLE_ENTRY_SIZE / 4)) + + (2 * (VARIABLE_ENTRY_SIZE / 2)) + (4 * PICO_ENTRY_SIZE); assert(spec_size <= max_num_spec); assert(check_size <= max_num_check); @@ -5958,7 +5429,7 @@ check_flush_cache__flush_ops(H5F_t *file_ptr) /* entry_type = */ VARIABLE_ENTRY_TYPE, /* entry_index = */ 1, /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG, + /* flags = */ H5C__DIRTIED_FLAG, /* resize_flag = */ false, /* new_size = */ 0, /* num_pins = */ 0, @@ -6005,14 +5476,14 @@ check_flush_cache__flush_ops(H5F_t *file_ptr) {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, /* expected_deserialized = */ true, - /* expected_serialized = */ false, + /* expected_serialized = */ true, /* expected_destroyed = */ false}; spec[2] = (struct fo_flush_cache_test_spec){ /* entry_num = */ 2, /* entry_type = */ PICO_ENTRY_TYPE, /* entry_index = */ 0, /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG, + /* flags = */ H5C__NO_FLAGS_SET, /* resize_flag = */ false, /* new_size = */ 0, /* num_pins = */ 0, @@ -6039,7 +5510,7 @@ check_flush_cache__flush_ops(H5F_t *file_ptr) /* entry_type = */ PICO_ENTRY_TYPE, /* entry_index = */ 1, /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG, + /* flags = */ H5C__NO_FLAGS_SET, /* resize_flag = */ false, /* new_size = */ 0, /* num_pins = */ 0, @@ -6061,6 +5532,60 @@ check_flush_cache__flush_ops(H5F_t *file_ptr) /* expected_deserialized = */ true, /* expected_serialized = */ false, /* expected_destroyed = */ false}; + spec[4] = (struct fo_flush_cache_test_spec){ + /* entry_num = */ 4, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 10, + /* insert_flag = */ false, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ false, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 1, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + {{FLUSH_OP__DIRTY, PICO_ENTRY_TYPE, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, + /* expected_deserialized = */ true, + /* expected_serialized = */ true, + /* expected_destroyed = */ false}; + spec[5] = (struct fo_flush_cache_test_spec){ + /* entry_num = */ 5, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 20, + /* insert_flag = */ false, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ false, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 1, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + {{FLUSH_OP__DIRTY, PICO_ENTRY_TYPE, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, + /* expected_deserialized = */ true, + /* expected_serialized = */ true, + /* expected_destroyed = */ false}; checks[0] = (struct fo_flush_entry_check){/* entry_num = */ 0, /* entry_type = */ VARIABLE_ENTRY_TYPE, @@ -6068,11 +5593,11 @@ check_flush_cache__flush_ops(H5F_t *file_ptr) /* expected_size = */ VARIABLE_ENTRY_SIZE / 4, /* in_cache = */ true, /* at_main_addr = */ false, - /* is_dirty = */ true, + /* is_dirty = */ false, /* is_protected = */ false, /* is_pinned = */ false, /* expected_deserialized = */ true, - /* expected_serialized = */ false, + /* expected_serialized = */ true, /* expected_destroyed = */ false}; checks[1] = (struct fo_flush_entry_check){/* entry_num = */ 1, /* entry_type = */ VARIABLE_ENTRY_TYPE, @@ -6080,272 +5605,30 @@ check_flush_cache__flush_ops(H5F_t *file_ptr) /* expected_size = */ VARIABLE_ENTRY_SIZE / 2, /* in_cache = */ true, /* at_main_addr = */ false, - /* is_dirty = */ true, + /* is_dirty = */ false, /* is_protected = */ false, /* is_pinned = */ false, /* expected_deserialized = */ true, - /* expected_serialized = */ false, + /* expected_serialized = */ true, /* expected_destroyed = */ false}; checks[2] = (struct fo_flush_entry_check){/* entry_num = */ 2, /* entry_type = */ VARIABLE_ENTRY_TYPE, /* entry_index = */ 10, - /* expected_size = */ VARIABLE_ENTRY_SIZE, - /* in_cache = */ false, - /* at_main_addr = */ true, + /* expected_size = */ VARIABLE_ENTRY_SIZE / 4, + /* in_cache = */ true, + /* at_main_addr = */ false, /* is_dirty = */ false, /* is_protected = */ false, /* is_pinned = */ false, - /* expected_deserialized = */ false, - /* expected_serialized = */ false, + /* expected_deserialized = */ true, + /* expected_serialized = */ true, /* expected_destroyed = */ false}; checks[3] = (struct fo_flush_entry_check){/* entry_num = */ 3, /* entry_type = */ VARIABLE_ENTRY_TYPE, /* entry_index = */ 12, - /* expected_size = */ VARIABLE_ENTRY_SIZE, - /* in_cache = */ false, - /* at_main_addr = */ true, - /* is_dirty = */ false, - /* is_protected = */ false, - /* is_pinned = */ false, - /* expected_deserialized = */ false, - /* expected_serialized = */ false, - /* expected_destroyed = */ false}; - - check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec, - init_expected_index_len, init_expected_index_size, - expected_index_len, expected_index_size, check_size, checks); - reset_entries(); - } - - if (pass) /* test #22 */ - { - /* Mix things up some more. - * - * Load lots of entries, some of which have flush functions that - * resize, dirty, and move two entries that are not in the - * cache. - * - * Also load entries that have flush ops on entries that are in - * cache. - */ - int test_num = 22; - unsigned int flush_flags = H5C__NO_FLAGS_SET; - int spec_size = 6; - int check_size = 4; - unsigned init_expected_index_len = 6; - size_t init_expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (4 * PICO_ENTRY_SIZE); - unsigned expected_index_len = 10; - size_t expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (2 * (VARIABLE_ENTRY_SIZE / 4)) + - (2 * (VARIABLE_ENTRY_SIZE / 2)) + (4 * PICO_ENTRY_SIZE); - - assert(spec_size <= max_num_spec); - assert(check_size <= max_num_check); - - spec[0] = (struct fo_flush_cache_test_spec){ - /* entry_num = */ 0, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 1, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ false, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 6, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - {{FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, false, VARIABLE_ENTRY_SIZE / 4, NULL}, - {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, false, 0, NULL}, - {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, false, 0, NULL}, - {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, false, 0, NULL}, - {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, false, VARIABLE_ENTRY_SIZE / 2, NULL}, - {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ false}; - spec[1] = (struct fo_flush_cache_test_spec){ - /* entry_num = */ 1, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 11, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ false, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 6, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - {{FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 10, false, VARIABLE_ENTRY_SIZE / 4, NULL}, - {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 10, false, 0, NULL}, - {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 10, false, 0, NULL}, - {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 12, false, 0, NULL}, - {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 12, false, VARIABLE_ENTRY_SIZE / 2, NULL}, - {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 12, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ false}; - spec[2] = (struct fo_flush_cache_test_spec){ - /* entry_num = */ 2, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 0, - /* insert_flag = */ false, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ false, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 0, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - {{FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ false}; - spec[3] = (struct fo_flush_cache_test_spec){ - /* entry_num = */ 3, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 1, - /* insert_flag = */ false, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ false, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 0, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - {{FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, - /* expected_deserialized = */ true, - /* expected_serialized = */ false, - /* expected_destroyed = */ false}; - spec[4] = (struct fo_flush_cache_test_spec){ - /* entry_num = */ 4, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 10, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ false, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 1, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - {{FLUSH_OP__DIRTY, PICO_ENTRY_TYPE, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ false}; - spec[5] = (struct fo_flush_cache_test_spec){ - /* entry_num = */ 5, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 20, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ false, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 1, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - {{FLUSH_OP__DIRTY, PICO_ENTRY_TYPE, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ false}; - - checks[0] = (struct fo_flush_entry_check){/* entry_num = */ 0, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 0, - /* expected_size = */ VARIABLE_ENTRY_SIZE / 4, - /* in_cache = */ true, - /* at_main_addr = */ false, - /* is_dirty = */ false, - /* is_protected = */ false, - /* is_pinned = */ false, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ false}; - checks[1] = (struct fo_flush_entry_check){/* entry_num = */ 1, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 2, - /* expected_size = */ VARIABLE_ENTRY_SIZE / 2, - /* in_cache = */ true, - /* at_main_addr = */ false, - /* is_dirty = */ false, - /* is_protected = */ false, - /* is_pinned = */ false, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ false}; - checks[2] = (struct fo_flush_entry_check){/* entry_num = */ 2, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 10, - /* expected_size = */ VARIABLE_ENTRY_SIZE / 4, - /* in_cache = */ true, - /* at_main_addr = */ false, - /* is_dirty = */ false, - /* is_protected = */ false, - /* is_pinned = */ false, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ false}; - checks[3] = (struct fo_flush_entry_check){/* entry_num = */ 3, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 12, - /* expected_size = */ VARIABLE_ENTRY_SIZE / 2, - /* in_cache = */ true, - /* at_main_addr = */ false, + /* expected_size = */ VARIABLE_ENTRY_SIZE / 2, + /* in_cache = */ true, + /* at_main_addr = */ false, /* is_dirty = */ false, /* is_protected = */ false, /* is_pinned = */ false, @@ -6359,9 +5642,9 @@ check_flush_cache__flush_ops(H5F_t *file_ptr) reset_entries(); } - if (pass) /* test #23 */ + if (pass) /* test #22 */ { - /* Repeat test #23 with the flush invalidate flag set. + /* Repeat test #21 with the flush invalidate flag set. * * Mix things up some more. * @@ -6372,7 +5655,7 @@ check_flush_cache__flush_ops(H5F_t *file_ptr) * Also load entries that have flush ops on entries that are in * cache. */ - int test_num = 23; + int test_num = 22; unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; int spec_size = 6; int check_size = 4; @@ -6606,12 +5889,12 @@ check_flush_cache__flush_ops(H5F_t *file_ptr) * * Now create some tests mixing flush ops and pins. */ - if (pass) /* test #24 */ + if (pass) /* test #23 */ { /* Pico entries 50 and 150 pin pico entry 100, and also dirty * pico entry 100 on flush. */ - int test_num = 24; + int test_num = 23; unsigned int flush_flags = H5C__NO_FLAGS_SET; int spec_size = 3; int check_size = 0; @@ -6723,14 +6006,14 @@ check_flush_cache__flush_ops(H5F_t *file_ptr) expected_index_len, expected_index_size, check_size, checks); } - if (pass) /* test #25 */ + if (pass) /* test #24 */ { /* Repeat the previous test with the flush invalidate flag. * * Pico entries 50 and 150 pin pico entry 100, and also dirty * pico entry 100 on flush. */ - int test_num = 25; + int test_num = 24; unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; int spec_size = 3; int check_size = 0; @@ -6842,7 +6125,7 @@ check_flush_cache__flush_ops(H5F_t *file_ptr) expected_index_len, expected_index_size, check_size, checks); } - if (pass) /* test #26 */ + if (pass) /* test #25 */ { /* This one is complex. * @@ -6919,7 +6202,7 @@ check_flush_cache__flush_ops(H5F_t *file_ptr) * dirties (VET, 650) * dirties (VET, 750) */ - int test_num = 26; + int test_num = 25; unsigned int flush_flags = H5C__NO_FLAGS_SET; int spec_size = 10; int check_size = 3; @@ -7246,9 +6529,9 @@ check_flush_cache__flush_ops(H5F_t *file_ptr) reset_entries(); } - if (pass) /* test #27 */ + if (pass) /* test #26 */ { - /* Repeat test #26 with the flush invalidate flag. + /* Repeat test #25 with the flush invalidate flag. * * In the following overview table, VET stands for * VARIABLE_ENTRY_TYPE. @@ -7327,7 +6610,7 @@ check_flush_cache__flush_ops(H5F_t *file_ptr) * dirties (VET, 650) * dirties (VET, 750) */ - int test_num = 27; + int test_num = 26; unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; int spec_size = 10; int check_size = 3; @@ -7547,1790 +6830,1139 @@ check_flush_cache__flush_ops(H5F_t *file_ptr) {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 650, false, VARIABLE_ENTRY_SIZE / 4, NULL}, {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, - /* expected_deserialized = */ false, - /* expected_serialized = */ true, - /* expected_destroyed = */ true}; - spec[8] = (struct fo_flush_cache_test_spec){ - /* entry_num = */ 8, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 750, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ false, - /* new_size = */ 0, - /* num_pins = */ 2, - /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 3, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, false, 0, NULL}, - {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, false, 0, NULL}, - {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 750, false, VARIABLE_ENTRY_SIZE / 4, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ true}; - spec[9] = (struct fo_flush_cache_test_spec){ - /* entry_num = */ 9, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 500, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ false, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 4, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 350, false, 0, NULL}, - {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 450, false, 0, NULL}, - {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 650, false, 0, NULL}, - {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 750, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ true}; - - checks[0] = (struct fo_flush_entry_check){/* entry_num = */ 0, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 100, - /* expected_size = */ VARIABLE_ENTRY_SIZE, - /* in_cache = */ false, - /* at_main_addr = */ true, - /* is_dirty = */ false, - /* is_protected = */ false, - /* is_pinned = */ false, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ true}; - checks[1] = (struct fo_flush_entry_check){/* entry_num = */ 1, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 300, - /* expected_size = */ VARIABLE_ENTRY_SIZE, - /* in_cache = */ false, - /* at_main_addr = */ false, - /* is_dirty = */ false, - /* is_protected = */ false, - /* is_pinned = */ false, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ true}; - checks[2] = (struct fo_flush_entry_check){/* entry_num = */ 2, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 2200, - /* expected_size = */ VARIABLE_ENTRY_SIZE / 2, - /* in_cache = */ false, - /* at_main_addr = */ true, - /* is_dirty = */ false, - /* is_protected = */ false, - /* is_pinned = */ false, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ true}; - - check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec, - init_expected_index_len, init_expected_index_size, - expected_index_len, expected_index_size, check_size, checks); - - reset_entries(); - } - - if (pass) /* test #28 */ - { - /* Test the expected fheap case, in which an entry dirties - * and resizes itself, and dirties an entry which it has - * pinned. - */ - int test_num = 28; - unsigned int flush_flags = H5C__NO_FLAGS_SET; - int spec_size = 5; - int check_size = 0; - unsigned init_expected_index_len = 5; - size_t init_expected_index_size = 3 * VARIABLE_ENTRY_SIZE; - unsigned expected_index_len = 5; - size_t expected_index_size = 4 * VARIABLE_ENTRY_SIZE; - - assert(spec_size <= max_num_spec); - assert(check_size <= max_num_check); - - spec[0] = (struct fo_flush_cache_test_spec){ - /* entry_num = */ 0, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 100, - /* insert_flag = */ false, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ false, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 0, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - {{FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ false}; - spec[1] = (struct fo_flush_cache_test_spec){ - /* entry_num = */ 1, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 200, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ true, - /* new_size = */ VARIABLE_ENTRY_SIZE / 2, - /* num_pins = */ 1, - /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 3, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, false, 0, NULL}, - {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 200, false, VARIABLE_ENTRY_SIZE, NULL}, - {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 200, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ false}; - spec[2] = (struct fo_flush_cache_test_spec){ - /* entry_num = */ 2, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 300, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ true, - /* new_size = */ VARIABLE_ENTRY_SIZE / 4, - /* num_pins = */ 1, - /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {400, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 3, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 400, false, 0, NULL}, - {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 300, false, VARIABLE_ENTRY_SIZE / 2, NULL}, - {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 300, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ false}; - spec[3] = (struct fo_flush_cache_test_spec){ - /* entry_num = */ 3, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 400, - /* insert_flag = */ false, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ false, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 0, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - {{FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ false}; - spec[4] = (struct fo_flush_cache_test_spec){ - /* entry_num = */ 4, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 500, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ true, - /* new_size = */ VARIABLE_ENTRY_SIZE / 4, - /* num_pins = */ 1, - /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 3, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, false, 0, NULL}, - {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 500, false, VARIABLE_ENTRY_SIZE / 2, NULL}, - {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 500, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ false}; - - checks[0] = (struct fo_flush_entry_check){/* entry_num = */ 0, - /* entry_type = */ 0, - /* entry_index = */ 0, - /* expected_size = */ 0, - /* in_cache = */ false, - /* at_main_addr = */ false, - /* is_dirty = */ false, - /* is_protected = */ false, - /* is_pinned = */ false, - /* expected_deserialized = */ false, - /* expected_serialized = */ false, - /* expected_destroyed = */ false}; - - check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec, - init_expected_index_len, init_expected_index_size, - expected_index_len, expected_index_size, check_size, checks); - - reset_entries(); - } - - if (pass) /* test #29 */ - { - /* Repeat test #28 with the flush invalidate flag. - * - * Test the expected fheap case, in which an entry dirties - * and resizes itself, and dirties an entry which it has - * pinned. - */ - int test_num = 29; - unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; - int spec_size = 5; - int check_size = 0; - unsigned init_expected_index_len = 5; - size_t init_expected_index_size = 3 * VARIABLE_ENTRY_SIZE; - unsigned expected_index_len = 0; - size_t expected_index_size = 0; - - assert(spec_size <= max_num_spec); - assert(check_size <= max_num_check); - - spec[0] = (struct fo_flush_cache_test_spec){ - /* entry_num = */ 0, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 100, - /* insert_flag = */ false, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ false, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 0, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - {{FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ true}; - spec[1] = (struct fo_flush_cache_test_spec){ - /* entry_num = */ 1, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 200, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ true, - /* new_size = */ VARIABLE_ENTRY_SIZE / 2, - /* num_pins = */ 1, - /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 3, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, false, 0, NULL}, - {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 200, false, VARIABLE_ENTRY_SIZE, NULL}, - {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 200, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ true}; - spec[2] = (struct fo_flush_cache_test_spec){ - /* entry_num = */ 2, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 300, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ true, - /* new_size = */ VARIABLE_ENTRY_SIZE / 4, - /* num_pins = */ 1, - /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {400, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 3, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 400, false, 0, NULL}, - {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 300, false, VARIABLE_ENTRY_SIZE / 2, NULL}, - {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 300, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ true}; - spec[3] = (struct fo_flush_cache_test_spec){ - /* entry_num = */ 3, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 400, - /* insert_flag = */ false, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ false, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 0, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - {{FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ true}; - spec[4] = (struct fo_flush_cache_test_spec){ - /* entry_num = */ 4, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 500, - /* insert_flag = */ false, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ true, - /* new_size = */ VARIABLE_ENTRY_SIZE / 4, - /* num_pins = */ 1, - /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 3, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, false, 0, NULL}, - {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 500, false, VARIABLE_ENTRY_SIZE / 2, NULL}, - {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 500, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, - {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, - /* expected_deserialized = */ true, - /* expected_serialized = */ true, - /* expected_destroyed = */ true}; - - checks[0] = (struct fo_flush_entry_check){/* entry_num = */ 0, - /* entry_type = */ 0, - /* entry_index = */ 0, - /* expected_size = */ 0, - /* in_cache = */ false, - /* at_main_addr = */ false, - /* is_dirty = */ false, - /* is_protected = */ false, - /* is_pinned = */ false, - /* expected_deserialized = */ false, - /* expected_serialized = */ false, - /* expected_destroyed = */ false}; - - check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec, - init_expected_index_len, init_expected_index_size, - expected_index_len, expected_index_size, check_size, checks); - - reset_entries(); - } - - free(checks); - free(spec); - - /* finally finish up with the flush ops eviction test */ - check_flush_cache__flush_op_eviction_test(file_ptr); - -} /* check_flush_cache__flush_ops() */ - -/*------------------------------------------------------------------------- - * Function: check_flush_cache__flush_op_test() - * - * Purpose: Run a flush op flush cache test. Of the nature of - * flush operations, this is a multi-entry test. - * - * Return: void - * - *------------------------------------------------------------------------- - */ - -static void -check_flush_cache__flush_op_test(H5F_t *file_ptr, int test_num, unsigned int flush_flags, int spec_size, - const struct fo_flush_cache_test_spec spec[], - unsigned init_expected_index_len, size_t init_expected_index_size, - unsigned expected_index_len, size_t expected_index_size, int check_size, - struct fo_flush_entry_check check[]) -{ - H5C_t *cache_ptr = file_ptr->shared->cache; - static char msg[128]; - int i; - int j; - test_entry_t *base_addr; - test_entry_t *entry_ptr; - - if (cache_ptr == NULL) { - - pass = false; - snprintf(msg, (size_t)128, "cache_ptr NULL on entry to flush op test #%d.", test_num); - failure_mssg = msg; - } - else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) { - - pass = false; - - snprintf(msg, (size_t)128, "cache not empty at beginning of flush op test #%d.", test_num); - failure_mssg = msg; - } - else if ((spec_size < 1) || (spec == NULL)) { - - pass = false; - snprintf(msg, (size_t)128, "missing/bad test spec on entry to flush op test #%d.", test_num); - failure_mssg = msg; - } - - i = 0; - while (pass && (i < spec_size)) { - - if ((spec[i].entry_num != i) || (spec[i].entry_type < 0) || - (spec[i].entry_type >= NUMBER_OF_ENTRY_TYPES) || (spec[i].entry_index < 0) || - (spec[i].entry_index > max_indices[spec[i].entry_type]) || (spec[i].num_pins < 0) || - (spec[i].num_pins > MAX_PINS) || (spec[i].num_flush_ops < 0) || - (spec[i].num_flush_ops > MAX_FLUSH_OPS)) { - - pass = false; - snprintf(msg, (size_t)128, "bad data in spec[%d] on entry to flush op test #%d.", i, test_num); - failure_mssg = msg; - } - i++; - } - - i = 0; - while (pass && (i < check_size)) { - - if ((check[i].entry_num != i) || (check[i].entry_type < 0) || - (check[i].entry_type >= NUMBER_OF_ENTRY_TYPES) || (check[i].entry_index < 0) || - (check[i].entry_index > max_indices[check[i].entry_type]) || - (check[i].expected_size <= (size_t)0)) { - - pass = false; - snprintf(msg, (size_t)128, "bad data in check[%d] on entry to flush op test #%d.", i, test_num); - failure_mssg = msg; - } - i++; - } - - i = 0; - while (pass && (i < spec_size)) { - - if (spec[i].insert_flag) { - - insert_entry(file_ptr, spec[i].entry_type, spec[i].entry_index, spec[i].flags); - } - else { - - protect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index); - - if (spec[i].resize_flag) - resize_entry(file_ptr, spec[i].entry_type, spec[i].entry_index, spec[i].new_size, true); - - unprotect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index, spec[i].flags); - } - - for (j = 0; j < spec[i].num_pins; j++) { - create_pinned_entry_dependency(file_ptr, spec[i].entry_type, spec[i].entry_index, - spec[i].pin_type[j], spec[i].pin_idx[j]); - } - - for (j = 0; j < spec[i].num_flush_ops; j++) { - - add_flush_op(spec[i].entry_type, spec[i].entry_index, spec[i].flush_ops[j].op_code, - spec[i].flush_ops[j].type, spec[i].flush_ops[j].idx, spec[i].flush_ops[j].flag, - spec[i].flush_ops[j].size, spec[i].flush_ops[j].order_ptr); - } - - i++; - } - - if (pass) { - - if ((cache_ptr->index_len != init_expected_index_len) || - (cache_ptr->index_size != init_expected_index_size)) { - - pass = false; - snprintf(msg, (size_t)128, "Unexpected cache len/size before flush in flush op test #%d.", - test_num); - failure_mssg = msg; - } - } - - if (pass) { - - H5C_FLUSH_CACHE(file_ptr, flush_flags, "dummy failure message") - - if (!pass) { - - pass = false; - snprintf(msg, (size_t)128, "flush with flags 0x%x failed in flush op test #%d.", flush_flags, - test_num); - failure_mssg = msg; - } - } - - i = 0; - while (pass && (i < spec_size)) { - - base_addr = entries[spec[i].entry_type]; - entry_ptr = &(base_addr[spec[i].entry_index]); - - if ((entry_ptr->deserialized != spec[i].expected_deserialized) || - (entry_ptr->serialized != spec[i].expected_serialized) || - (entry_ptr->destroyed != spec[i].expected_destroyed)) { - - pass = false; - snprintf(msg, (size_t)128, "Bad status on entry %d after flush op test #%d.", i, test_num); - failure_mssg = msg; - } - i++; - } - - if (pass) { - - i = 0; - while (pass && (i < check_size)) { - - if (check[i].in_cache != entry_in_cache(cache_ptr, check[i].entry_type, check[i].entry_index)) { - - pass = false; - snprintf(msg, (size_t)128, "Check1 failed on entry %d after flush op test #%d.", i, test_num); - failure_mssg = msg; - } - - base_addr = entries[check[i].entry_type]; - entry_ptr = &(base_addr[check[i].entry_index]); - - if ((entry_ptr->size != check[i].expected_size) || - ((!entry_ptr->header.destroy_in_progress) && (check[i].in_cache) && - (entry_ptr->header.size != check[i].expected_size)) || - (entry_ptr->at_main_addr != check[i].at_main_addr) || - (entry_ptr->is_dirty != check[i].is_dirty) || - (entry_ptr->header.is_dirty != check[i].is_dirty) || - (entry_ptr->is_protected != check[i].is_protected) || - (entry_ptr->header.is_protected != check[i].is_protected) || - (entry_ptr->is_pinned != check[i].is_pinned) || - (entry_ptr->header.is_pinned != check[i].is_pinned) || - (entry_ptr->deserialized != check[i].expected_deserialized) || - (entry_ptr->serialized != check[i].expected_serialized) || - (entry_ptr->destroyed != check[i].expected_destroyed)) { - - pass = false; - snprintf(msg, (size_t)128, "Check2 failed on entry %d after flush op test #%d.", i, test_num); - failure_mssg = msg; - } - i++; - } - } - - if (pass) { - - if ((((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0) && - ((cache_ptr->index_len != expected_index_len) || - (cache_ptr->index_size != expected_index_size))) || - (((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0) && - ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)))) { - - pass = false; - snprintf(msg, (size_t)128, "Unexpected cache len/size after flush in flush op test #%d.", - test_num); - failure_mssg = msg; - } - } - - /* clean up the cache to prep for the next test */ - if (pass) { - - H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, "dummy mssg.") - - if (!pass) { - - snprintf(msg, (size_t)128, "Flush failed on cleanup in flush op test #%d.", test_num); - failure_mssg = msg; - } - else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0) || - (cache_ptr->clean_index_size != 0) || (cache_ptr->dirty_index_size != 0)) { - - pass = false; - snprintf(msg, (size_t)128, "Unexpected cache len/size/cs/ds after cleanup in flush op test #%d.", - test_num); - failure_mssg = msg; - } - } - - i = 0; - while (pass && (i < spec_size)) { - - base_addr = entries[spec[i].entry_type]; - entry_ptr = &(base_addr[spec[i].entry_index]); + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, + /* expected_deserialized = */ false, + /* expected_serialized = */ true, + /* expected_destroyed = */ true}; + spec[8] = (struct fo_flush_cache_test_spec){ + /* entry_num = */ 8, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 750, + /* insert_flag = */ false, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ false, + /* new_size = */ 0, + /* num_pins = */ 2, + /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 3, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, false, 0, NULL}, + {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, false, 0, NULL}, + {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 750, false, VARIABLE_ENTRY_SIZE / 4, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, + /* expected_deserialized = */ true, + /* expected_serialized = */ true, + /* expected_destroyed = */ true}; + spec[9] = (struct fo_flush_cache_test_spec){ + /* entry_num = */ 9, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 500, + /* insert_flag = */ false, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ false, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 4, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 350, false, 0, NULL}, + {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 450, false, 0, NULL}, + {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 650, false, 0, NULL}, + {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 750, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, + /* expected_deserialized = */ true, + /* expected_serialized = */ true, + /* expected_destroyed = */ true}; - entry_ptr->size = entry_sizes[spec[i].entry_type]; + checks[0] = (struct fo_flush_entry_check){/* entry_num = */ 0, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 100, + /* expected_size = */ VARIABLE_ENTRY_SIZE, + /* in_cache = */ false, + /* at_main_addr = */ true, + /* is_dirty = */ false, + /* is_protected = */ false, + /* is_pinned = */ false, + /* expected_deserialized = */ true, + /* expected_serialized = */ true, + /* expected_destroyed = */ true}; + checks[1] = (struct fo_flush_entry_check){/* entry_num = */ 1, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 300, + /* expected_size = */ VARIABLE_ENTRY_SIZE, + /* in_cache = */ false, + /* at_main_addr = */ false, + /* is_dirty = */ false, + /* is_protected = */ false, + /* is_pinned = */ false, + /* expected_deserialized = */ true, + /* expected_serialized = */ true, + /* expected_destroyed = */ true}; + checks[2] = (struct fo_flush_entry_check){/* entry_num = */ 2, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 2200, + /* expected_size = */ VARIABLE_ENTRY_SIZE / 2, + /* in_cache = */ false, + /* at_main_addr = */ true, + /* is_dirty = */ false, + /* is_protected = */ false, + /* is_pinned = */ false, + /* expected_deserialized = */ true, + /* expected_serialized = */ true, + /* expected_destroyed = */ true}; - entry_ptr->deserialized = false; - entry_ptr->serialized = false; - entry_ptr->destroyed = false; + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec, + init_expected_index_len, init_expected_index_size, + expected_index_len, expected_index_size, check_size, checks); - i++; + reset_entries(); } - i = 0; - while (pass && (i < check_size)) { - - base_addr = entries[check[i].entry_type]; - entry_ptr = &(base_addr[check[i].entry_index]); - - entry_ptr->size = entry_sizes[check[i].entry_type]; - - entry_ptr->deserialized = false; - entry_ptr->serialized = false; - entry_ptr->destroyed = false; - - i++; - } + if (pass) /* test #27 */ + { + /* Test the expected fheap case, in which an entry dirties + * and resizes itself, and dirties an entry which it has + * pinned. + */ + int test_num = 27; + unsigned int flush_flags = H5C__NO_FLAGS_SET; + int spec_size = 5; + int check_size = 0; + unsigned init_expected_index_len = 5; + size_t init_expected_index_size = 3 * VARIABLE_ENTRY_SIZE; + unsigned expected_index_len = 5; + size_t expected_index_size = 4 * VARIABLE_ENTRY_SIZE; -} /* check_flush_cache__flush_op_test() */ + assert(spec_size <= max_num_spec); + assert(check_size <= max_num_check); -/*------------------------------------------------------------------------- - * Function: check_flush_cache__flush_op_eviction_test() - * - * Purpose: Verify that flush operations work as expected when an - * entry is evicted. - * - * Do nothing if pass is false on entry. - * - * Return: void - * - *------------------------------------------------------------------------- - */ + spec[0] = (struct fo_flush_cache_test_spec){ + /* entry_num = */ 0, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 100, + /* insert_flag = */ false, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ false, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 0, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + {{FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, + /* expected_deserialized = */ true, + /* expected_serialized = */ true, + /* expected_destroyed = */ false}; + spec[1] = (struct fo_flush_cache_test_spec){ + /* entry_num = */ 1, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 200, + /* insert_flag = */ false, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ true, + /* new_size = */ VARIABLE_ENTRY_SIZE / 2, + /* num_pins = */ 1, + /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 3, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, false, 0, NULL}, + {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 200, false, VARIABLE_ENTRY_SIZE, NULL}, + {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 200, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, + /* expected_deserialized = */ true, + /* expected_serialized = */ true, + /* expected_destroyed = */ false}; + spec[2] = (struct fo_flush_cache_test_spec){ + /* entry_num = */ 2, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 300, + /* insert_flag = */ false, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ true, + /* new_size = */ VARIABLE_ENTRY_SIZE / 4, + /* num_pins = */ 1, + /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {400, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 3, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 400, false, 0, NULL}, + {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 300, false, VARIABLE_ENTRY_SIZE / 2, NULL}, + {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 300, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, + /* expected_deserialized = */ true, + /* expected_serialized = */ true, + /* expected_destroyed = */ false}; + spec[3] = (struct fo_flush_cache_test_spec){ + /* entry_num = */ 3, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 400, + /* insert_flag = */ false, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ false, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 0, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + {{FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, + /* expected_deserialized = */ true, + /* expected_serialized = */ true, + /* expected_destroyed = */ false}; + spec[4] = (struct fo_flush_cache_test_spec){ + /* entry_num = */ 4, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 500, + /* insert_flag = */ false, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ true, + /* new_size = */ VARIABLE_ENTRY_SIZE / 4, + /* num_pins = */ 1, + /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 3, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, false, 0, NULL}, + {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 500, false, VARIABLE_ENTRY_SIZE / 2, NULL}, + {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 500, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, + /* expected_deserialized = */ true, + /* expected_serialized = */ true, + /* expected_destroyed = */ false}; -static void -check_flush_cache__flush_op_eviction_test(H5F_t *file_ptr) -{ - struct expected_entry_status *expected = NULL; - H5C_t *cache_ptr = file_ptr->shared->cache; - int i; - const int num_variable_entries = 10; - const int num_monster_entries = 31; - int num_large_entries = 14; - const int num_total_entries = num_variable_entries + num_monster_entries + num_large_entries; - test_entry_t *entry_ptr; - test_entry_t *base_addr; + checks[0] = (struct fo_flush_entry_check){/* entry_num = */ 0, + /* entry_type = */ 0, + /* entry_index = */ 0, + /* expected_size = */ 0, + /* in_cache = */ false, + /* at_main_addr = */ false, + /* is_dirty = */ false, + /* is_protected = */ false, + /* is_pinned = */ false, + /* expected_deserialized = */ false, + /* expected_serialized = */ false, + /* expected_destroyed = */ false}; - expected = malloc((size_t)num_total_entries * sizeof(struct expected_entry_status)); - if (expected == NULL) { + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec, + init_expected_index_len, init_expected_index_size, + expected_index_len, expected_index_size, check_size, checks); - pass = false; - failure_mssg = "couldn't allocate expected entry status array\n"; + reset_entries(); } - if (expected) { - /* the expected array is used to maintain a table of the expected status of every - * entry used in this test. Note that since the function that processes this - * array only processes as much of it as it is told to, we don't have to - * worry about maintaining the status of entries that we haven't used yet. + if (pass) /* test #28 */ + { + /* Repeat test #27 with the flush invalidate flag. + * + * Test the expected fheap case, in which an entry dirties + * and resizes itself, and dirties an entry which it has + * pinned. */ - for (i = 0; i < num_variable_entries; i++) { - expected[i].entry_type = VARIABLE_ENTRY_TYPE; - expected[i].entry_index = (int)(i); - expected[i].size = VARIABLE_ENTRY_SIZE; - expected[i].in_cache = true; - expected[i].at_main_addr = true; - expected[i].is_dirty = true; - expected[i].is_protected = false; - expected[i].is_pinned = false; - expected[i].deserialized = true; - expected[i].serialized = false; - expected[i].destroyed = false; - - memset(expected[i].flush_dep_par_type, 0, sizeof(expected[i].flush_dep_par_type)); - memset(expected[i].flush_dep_par_idx, 0, sizeof(expected[i].flush_dep_par_idx)); - - expected[i].flush_dep_npar = 0; - expected[i].flush_dep_nchd = 0; - expected[i].flush_dep_ndirty_chd = 0; - expected[i].flush_order = -1; - expected[i].is_corked = false; - } - - /* NOTE: special cases for particular variable entries */ - expected[0].size = VARIABLE_ENTRY_SIZE / 4; - expected[0].is_pinned = true; - - expected[1].size = VARIABLE_ENTRY_SIZE / 4; - - expected[2].is_dirty = false; - - expected[3].size = VARIABLE_ENTRY_SIZE / 4; + int test_num = 28; + unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; + int spec_size = 5; + int check_size = 0; + unsigned init_expected_index_len = 5; + size_t init_expected_index_size = 3 * VARIABLE_ENTRY_SIZE; + unsigned expected_index_len = 0; + size_t expected_index_size = 0; - expected[4].is_dirty = false; + assert(spec_size <= max_num_spec); + assert(check_size <= max_num_check); - expected[5].size = VARIABLE_ENTRY_SIZE / 4; + spec[0] = (struct fo_flush_cache_test_spec){ + /* entry_num = */ 0, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 100, + /* insert_flag = */ false, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ false, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 0, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + {{FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, + /* expected_deserialized = */ true, + /* expected_serialized = */ true, + /* expected_destroyed = */ true}; + spec[1] = (struct fo_flush_cache_test_spec){ + /* entry_num = */ 1, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 200, + /* insert_flag = */ false, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ true, + /* new_size = */ VARIABLE_ENTRY_SIZE / 2, + /* num_pins = */ 1, + /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 3, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, false, 0, NULL}, + {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 200, false, VARIABLE_ENTRY_SIZE, NULL}, + {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 200, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, + /* expected_deserialized = */ true, + /* expected_serialized = */ true, + /* expected_destroyed = */ true}; + spec[2] = (struct fo_flush_cache_test_spec){ + /* entry_num = */ 2, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 300, + /* insert_flag = */ false, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ true, + /* new_size = */ VARIABLE_ENTRY_SIZE / 4, + /* num_pins = */ 1, + /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {400, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 3, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 400, false, 0, NULL}, + {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 300, false, VARIABLE_ENTRY_SIZE / 2, NULL}, + {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 300, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, + /* expected_deserialized = */ true, + /* expected_serialized = */ true, + /* expected_destroyed = */ true}; + spec[3] = (struct fo_flush_cache_test_spec){ + /* entry_num = */ 3, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 400, + /* insert_flag = */ false, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ false, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 0, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + {{FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, + /* expected_deserialized = */ true, + /* expected_serialized = */ true, + /* expected_destroyed = */ true}; + spec[4] = (struct fo_flush_cache_test_spec){ + /* entry_num = */ 4, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 500, + /* insert_flag = */ false, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ true, + /* new_size = */ VARIABLE_ENTRY_SIZE / 4, + /* num_pins = */ 1, + /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 3, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, false, 0, NULL}, + {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 500, false, VARIABLE_ENTRY_SIZE / 2, NULL}, + {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 500, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}, + {FLUSH_OP__NO_OP, 0, 0, false, 0, NULL}}, + /* expected_deserialized = */ true, + /* expected_serialized = */ true, + /* expected_destroyed = */ true}; - expected[6].size = VARIABLE_ENTRY_SIZE / 2; + checks[0] = (struct fo_flush_entry_check){/* entry_num = */ 0, + /* entry_type = */ 0, + /* entry_index = */ 0, + /* expected_size = */ 0, + /* in_cache = */ false, + /* at_main_addr = */ false, + /* is_dirty = */ false, + /* is_protected = */ false, + /* is_pinned = */ false, + /* expected_deserialized = */ false, + /* expected_serialized = */ false, + /* expected_destroyed = */ false}; - expected[7].size = VARIABLE_ENTRY_SIZE / 2; + check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec, + init_expected_index_len, init_expected_index_size, + expected_index_len, expected_index_size, check_size, checks); - expected[8].is_dirty = false; + reset_entries(); + } - expected[9].is_dirty = false; - expected[9].is_pinned = true; + free(checks); + free(spec); - for (; i < num_variable_entries + num_monster_entries; i++) { - expected[i].entry_type = MONSTER_ENTRY_TYPE; - expected[i].entry_index = (int)(i - num_variable_entries); - expected[i].size = MONSTER_ENTRY_SIZE; - expected[i].in_cache = true; - expected[i].at_main_addr = true; - expected[i].is_dirty = true; - expected[i].is_protected = false; - expected[i].is_pinned = false; - expected[i].deserialized = true; - expected[i].serialized = false; - expected[i].destroyed = false; + /* finally finish up with the flush ops eviction test */ + check_flush_cache__flush_op_eviction_test(file_ptr); - memset(expected[i].flush_dep_par_type, 0, sizeof(expected[i].flush_dep_par_type)); - memset(expected[i].flush_dep_par_idx, 0, sizeof(expected[i].flush_dep_par_idx)); +} /* check_flush_cache__flush_ops() */ - expected[i].flush_dep_npar = 0; - expected[i].flush_dep_nchd = 0; - expected[i].flush_dep_ndirty_chd = 0; - expected[i].flush_order = -1; - expected[i].is_corked = false; - } +/*------------------------------------------------------------------------- + * Function: check_flush_cache__flush_op_test() + * + * Purpose: Run a flush op flush cache test. Of the nature of + * flush operations, this is a multi-entry test. + * + * Return: void + * + *------------------------------------------------------------------------- + */ - for (; i < num_total_entries; i++) { - expected[i].entry_type = LARGE_ENTRY_TYPE; - expected[i].entry_index = (int)(i - num_monster_entries - num_variable_entries); - expected[i].size = LARGE_ENTRY_SIZE; - expected[i].in_cache = true; - expected[i].at_main_addr = true; - expected[i].is_dirty = true; - expected[i].is_protected = false; - expected[i].is_pinned = false; - expected[i].deserialized = true; - expected[i].serialized = false; - expected[i].destroyed = false; +static void +check_flush_cache__flush_op_test(H5F_t *file_ptr, int test_num, unsigned int flush_flags, int spec_size, + const struct fo_flush_cache_test_spec spec[], + unsigned init_expected_index_len, size_t init_expected_index_size, + unsigned expected_index_len, size_t expected_index_size, int check_size, + struct fo_flush_entry_check check[]) +{ + H5C_t *cache_ptr = file_ptr->shared->cache; + static char msg[128]; + int i; + int j; + test_entry_t *base_addr; + test_entry_t *entry_ptr; - memset(expected[i].flush_dep_par_type, 0, sizeof(expected[i].flush_dep_par_type)); - memset(expected[i].flush_dep_par_idx, 0, sizeof(expected[i].flush_dep_par_idx)); + if (cache_ptr == NULL) { - expected[i].flush_dep_npar = 0; - expected[i].flush_dep_nchd = 0; - expected[i].flush_dep_ndirty_chd = 0; - expected[i].flush_order = -1; - expected[i].is_corked = false; - } + pass = false; + snprintf(msg, (size_t)128, "cache_ptr NULL on entry to flush op test #%d.", test_num); + failure_mssg = msg; + } + else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) { - assert(i == num_total_entries); + pass = false; - pass = true; + snprintf(msg, (size_t)128, "cache not empty at beginning of flush op test #%d.", test_num); + failure_mssg = msg; } + else if ((spec_size < 1) || (spec == NULL)) { - if (pass) { + pass = false; + snprintf(msg, (size_t)128, "missing/bad test spec on entry to flush op test #%d.", test_num); + failure_mssg = msg; + } - if (cache_ptr == NULL) { + i = 0; + while (pass && (i < spec_size)) { - pass = false; - failure_mssg = "cache_ptr NULL on entry to flush ops test."; - } - else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) { + if ((spec[i].entry_num != i) || (spec[i].entry_type < 0) || + (spec[i].entry_type >= NUMBER_OF_ENTRY_TYPES) || (spec[i].entry_index < 0) || + (spec[i].entry_index > max_indices[spec[i].entry_type]) || (spec[i].num_pins < 0) || + (spec[i].num_pins > MAX_PINS) || (spec[i].num_flush_ops < 0) || + (spec[i].num_flush_ops > MAX_FLUSH_OPS)) { - pass = false; - failure_mssg = "cache not empty at start of flush ops eviction test."; + pass = false; + snprintf(msg, (size_t)128, "bad data in spec[%d] on entry to flush op test #%d.", i, test_num); + failure_mssg = msg; } - else if ((cache_ptr->max_cache_size != (2 * 1024 * 1024)) || - (cache_ptr->min_clean_size != (1 * 1024 * 1024))) { + i++; + } - pass = false; - failure_mssg = "unexpected cache config at start of flush op eviction test."; - } - else { + i = 0; + while (pass && (i < check_size)) { - /* set min clean size to zero for this test as it simplifies - * computing the expected cache size after each operation. - */ + if ((check[i].entry_num != i) || (check[i].entry_type < 0) || + (check[i].entry_type >= NUMBER_OF_ENTRY_TYPES) || (check[i].entry_index < 0) || + (check[i].entry_index > max_indices[check[i].entry_type]) || + (check[i].expected_size <= (size_t)0)) { - cache_ptr->min_clean_size = 0; + pass = false; + snprintf(msg, (size_t)128, "bad data in check[%d] on entry to flush op test #%d.", i, test_num); + failure_mssg = msg; } + i++; } - if (pass) { - - /* the basic idea in this test is to insert a bunch of entries - * with flush operations associated with them, and then load - * other entries into the cache until the cache is full. At - * that point, load yet more entries into the cache, and see - * if the flush operations are performed as expected. - * - * To make things a bit more interesting, we also include a - * couple of pins. - */ - - /* reset the stats before we start. If stats are enabled, we will - * check to see if they are as expected at the end. - */ - H5C_stats__reset(cache_ptr); - - /* load a few entries with pin relationships and flush ops. - * Start by just loading the entries. - */ + i = 0; + while (pass && (i < spec_size)) { - protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 0); - resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 0, (VARIABLE_ENTRY_SIZE / 4), true); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 0, H5C__DIRTIED_FLAG); + if (spec[i].insert_flag) { - protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 1); - resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 1, (VARIABLE_ENTRY_SIZE / 4), true); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 1, H5C__DIRTIED_FLAG); + insert_entry(file_ptr, spec[i].entry_type, spec[i].entry_index, spec[i].flags); + } + else { - protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 2); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 2, H5C__NO_FLAGS_SET); + protect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index); - protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 3); - resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 3, (VARIABLE_ENTRY_SIZE / 4), true); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 3, H5C__DIRTIED_FLAG); + if (spec[i].resize_flag) + resize_entry(file_ptr, spec[i].entry_type, spec[i].entry_index, spec[i].new_size, true); - protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 4); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 4, H5C__NO_FLAGS_SET); + unprotect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index, spec[i].flags); + } - protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 5); - resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 5, (VARIABLE_ENTRY_SIZE / 4), true); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 5, H5C__DIRTIED_FLAG); + for (j = 0; j < spec[i].num_pins; j++) { + create_pinned_entry_dependency(file_ptr, spec[i].entry_type, spec[i].entry_index, + spec[i].pin_type[j], spec[i].pin_idx[j]); + } - protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 6); - resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 6, (VARIABLE_ENTRY_SIZE / 2), true); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 6, H5C__DIRTIED_FLAG); + for (j = 0; j < spec[i].num_flush_ops; j++) { - protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 7); - resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 7, (VARIABLE_ENTRY_SIZE / 2), true); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 7, H5C__DIRTIED_FLAG); + add_flush_op(spec[i].entry_type, spec[i].entry_index, spec[i].flush_ops[j].op_code, + spec[i].flush_ops[j].type, spec[i].flush_ops[j].idx, spec[i].flush_ops[j].flag, + spec[i].flush_ops[j].size, spec[i].flush_ops[j].order_ptr); + } - protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 8); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 8, H5C__NO_FLAGS_SET); + i++; + } - protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 9); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 9, H5C__NO_FLAGS_SET); + if (pass) { - if ((cache_ptr->index_len != 10) || - (cache_ptr->index_size != - (4 * (VARIABLE_ENTRY_SIZE / 4)) + (2 * (VARIABLE_ENTRY_SIZE / 2)) + (4 * VARIABLE_ENTRY_SIZE))) { + if ((cache_ptr->index_len != init_expected_index_len) || + (cache_ptr->index_size != init_expected_index_size)) { - pass = false; - failure_mssg = "unexpected size/len in flush op eviction test 1."; + pass = false; + snprintf(msg, (size_t)128, "Unexpected cache len/size before flush in flush op test #%d.", + test_num); + failure_mssg = msg; } } if (pass) { - /* Now set up the pinning relationships: - * - * Briefly, (VET, 0) is pinned by (VET, 1), (VET, 3), and (VET, 5) - * (VET, 9) is pinned by (VET, 5), and (VET, 7) - */ - create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 1, VARIABLE_ENTRY_TYPE, 0); - create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 3, VARIABLE_ENTRY_TYPE, 0); - create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 5, VARIABLE_ENTRY_TYPE, 0); - create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 5, VARIABLE_ENTRY_TYPE, 9); - create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 7, VARIABLE_ENTRY_TYPE, 9); + H5C_FLUSH_CACHE(file_ptr, flush_flags, "dummy failure message") - /* Next, set up the flush operations: - * - * Briefly, (VET, 1) dirties (VET, 0) - * resizes (VET, 0) to 3/4 VARIABLE_ENTRY_SIZE - * - * (VET, 3) dirties (VET, 0) - * resizes (VET, 0) to VARIABLE_ENTRY_SIZE - * moves (VET, 0) to its alternate address - * - * (VET, 5) dirties (VET, 0) - * resizes itself to VARIABLE_ENTRY_SIZE / 2 - * - * (VET, 7) dirties (VET, 9) - * - * (VET, 9) dirties (VET, 8) - */ - add_flush_op(VARIABLE_ENTRY_TYPE, 1, FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, false, (size_t)0, NULL); - add_flush_op(VARIABLE_ENTRY_TYPE, 1, FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, true, - 3 * VARIABLE_ENTRY_SIZE / 4, NULL); + if (!pass) { + + pass = false; + snprintf(msg, (size_t)128, "flush with flags 0x%x failed in flush op test #%d.", flush_flags, + test_num); + failure_mssg = msg; + } + } - add_flush_op(VARIABLE_ENTRY_TYPE, 3, FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, false, (size_t)0, NULL); - add_flush_op(VARIABLE_ENTRY_TYPE, 3, FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, true, - VARIABLE_ENTRY_SIZE, NULL); - add_flush_op(VARIABLE_ENTRY_TYPE, 3, FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, false, (size_t)0, NULL); + i = 0; + while (pass && (i < spec_size)) { - add_flush_op(VARIABLE_ENTRY_TYPE, 5, FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, false, (size_t)0, NULL); - add_flush_op(VARIABLE_ENTRY_TYPE, 5, FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 5, true, - VARIABLE_ENTRY_SIZE / 2, NULL); + base_addr = entries[spec[i].entry_type]; + entry_ptr = &(base_addr[spec[i].entry_index]); - add_flush_op(VARIABLE_ENTRY_TYPE, 7, FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 9, false, (size_t)0, NULL); + if ((entry_ptr->deserialized != spec[i].expected_deserialized) || + (entry_ptr->serialized != spec[i].expected_serialized) || + (entry_ptr->destroyed != spec[i].expected_destroyed)) { - add_flush_op(VARIABLE_ENTRY_TYPE, 9, FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 8, false, (size_t)0, NULL); + pass = false; + snprintf(msg, (size_t)128, "Bad status on entry %d after flush op test #%d.", i, test_num); + failure_mssg = msg; + } + i++; } if (pass) { - /* to summarize, at present the following variable size entries - * are in cache with the following characteristics: - * - * in - * entry: cache? size: dirty? pinned? pins: flush operations: - * - * (VET, 0) Y 2.5 KB Y Y - - - * - * (VET, 1) Y 2.5 KB Y N 0 dirty (VET, 0), - * resize (VET, 0) to 7.5 KB - * - * (VET, 2) Y 10 KB N N - - - * - * - * (VET, 3) Y 2.5 KB N N 0 dirty (VET, 0) - * resize (VET, 0) to 10 KB - * move (VET, 0) to its alternate address - * - * (VET, 4) Y 10 KB N N - - - * - * - * (VET, 5) Y 2.5 KB Y N 0, 9 dirty (VET, 0) - * resize (VET, 5) to 5 KB - * - * (VET, 6) Y 5 KB Y N - - - * - * (VET, 7) Y 5 KB Y N 9 dirty (VET, 9) - * - * (VET, 8) Y 10 KB N N - - - * - * (VET, 9) Y 10 KB N N - dirty (VET, 8) - * - * Recall that in this test bed, flush operations are executed the - * first time the associated entry is flushed, and are then - * deleted. - */ + i = 0; + while (pass && (i < check_size)) { - /* Now fill up the cache with other, unrelated entries */ - for (i = 0; i < 31; i++) { - protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); - unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); - } + if (check[i].in_cache != entry_in_cache(cache_ptr, check[i].entry_type, check[i].entry_index)) { - for (i = 0; i < 1; i++) { - protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); - } + pass = false; + snprintf(msg, (size_t)128, "Check1 failed on entry %d after flush op test #%d.", i, test_num); + failure_mssg = msg; + } - /* The cache should now be exactly full */ - if ((cache_ptr->index_len != 42) || (cache_ptr->index_size != 2 * 1024 * 1024) || - (cache_ptr->index_size != - ((4 * VARIABLE_ENTRY_SIZE / 4) + (2 * VARIABLE_ENTRY_SIZE / 2) + (4 * VARIABLE_ENTRY_SIZE) + - (31 * MONSTER_ENTRY_SIZE) + (1 * LARGE_ENTRY_SIZE)))) { + base_addr = entries[check[i].entry_type]; + entry_ptr = &(base_addr[check[i].entry_index]); - pass = false; - failure_mssg = "unexpected size/len in flush op eviction test 2."; - } - else { + if ((entry_ptr->size != check[i].expected_size) || + ((!entry_ptr->header.destroy_in_progress) && (check[i].in_cache) && + (entry_ptr->header.size != check[i].expected_size)) || + (entry_ptr->at_main_addr != check[i].at_main_addr) || + (entry_ptr->is_dirty != check[i].is_dirty) || + (entry_ptr->header.is_dirty != check[i].is_dirty) || + (entry_ptr->is_protected != check[i].is_protected) || + (entry_ptr->header.is_protected != check[i].is_protected) || + (entry_ptr->is_pinned != check[i].is_pinned) || + (entry_ptr->header.is_pinned != check[i].is_pinned) || + (entry_ptr->deserialized != check[i].expected_deserialized) || + (entry_ptr->serialized != check[i].expected_serialized) || + (entry_ptr->destroyed != check[i].expected_destroyed)) { - /* verify the expected status of all entries we have loaded to date: */ - num_large_entries = 1; - verify_entry_status(cache_ptr, 0, - (num_variable_entries + num_monster_entries + num_large_entries), expected); + pass = false; + snprintf(msg, (size_t)128, "Check2 failed on entry %d after flush op test #%d.", i, test_num); + failure_mssg = msg; + } + i++; } } if (pass) { - /* Now load a large entry. This should result in the eviction - * of (VET,2), and the increase in the size of (VET, 0) from .25 - * VARIABLE_ENTRY_SIZE to .75 VARIABLE_ENTRY_SIZE. - * - * The following table illustrates the intended state of affairs - * after the eviction: - * - * in - * entry: cache? size: dirty? pinned? pins: flush operations: - * - * (VET, 0) Y 7.5 KB Y Y - - - * - * (VET, 1) Y 2.5 KB N N - - - * - * (VET, 2) N 10 KB N N - - - * - * (VET, 3) Y 2.5 KB Y N 0 dirty (VET, 0) - * resize (VET, 0) to 10 KB - * move (VET, 0) to its alternate address - * - * (VET, 4) Y 10 KB N N - - - * - * (VET, 5) Y 2.5 KB Y N 0, 9 dirty (VET, 0) - * resize (VET, 5) to 5 KB - * - * (VET, 6) Y 5 KB Y N - - - * - * (VET, 7) Y 5 KB Y N 9 dirty (VET, 9) - * - * (VET, 8) Y 10 KB N N - - - * - * (VET, 9) Y 10 KB N Y - dirty (VET, 8) - * - * Start by updating the expected table for the expected changes in entry status: - */ - expected[0].size = 3 * VARIABLE_ENTRY_SIZE / 4; - expected[1].is_dirty = false; - expected[1].serialized = true; - expected[2].in_cache = false; - expected[2].destroyed = true; + if ((((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0) && + ((cache_ptr->index_len != expected_index_len) || + (cache_ptr->index_size != expected_index_size))) || + (((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0) && + ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)))) { - num_large_entries = 2; + pass = false; + snprintf(msg, (size_t)128, "Unexpected cache len/size after flush in flush op test #%d.", + test_num); + failure_mssg = msg; + } + } - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 1); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 1, H5C__DIRTIED_FLAG); + /* clean up the cache to prep for the next test */ + if (pass) { - if ((cache_ptr->index_len != 42) || - (cache_ptr->index_size != - (2 * 1024 * 1024) - (VARIABLE_ENTRY_SIZE) + (VARIABLE_ENTRY_SIZE / 2) + (LARGE_ENTRY_SIZE)) || - (cache_ptr->index_size != ((1 * (3 * VARIABLE_ENTRY_SIZE / 4)) + (3 * VARIABLE_ENTRY_SIZE / 4) + - (2 * VARIABLE_ENTRY_SIZE / 2) + (3 * VARIABLE_ENTRY_SIZE) + - (31 * MONSTER_ENTRY_SIZE) + (2 * LARGE_ENTRY_SIZE)))) { - pass = false; - failure_mssg = "unexpected size/len in flush op eviction test 3."; + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, "dummy mssg.") + + if (!pass) { + + snprintf(msg, (size_t)128, "Flush failed on cleanup in flush op test #%d.", test_num); + failure_mssg = msg; } + else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0) || + (cache_ptr->clean_index_size != 0) || (cache_ptr->dirty_index_size != 0)) { - /* verify entry status */ - verify_entry_status(cache_ptr, 1, (num_variable_entries + num_monster_entries + num_large_entries), - expected); + pass = false; + snprintf(msg, (size_t)128, "Unexpected cache len/size/cs/ds after cleanup in flush op test #%d.", + test_num); + failure_mssg = msg; + } } - if (pass) { + i = 0; + while (pass && (i < spec_size)) { - /* Now load another large entry. This should result in the eviction - * of (VET, 4), the increase in the size of (VET, 0) from .75 - * VARIABLE_ENTRY_SIZE to 1.0 VARIABLE_ENTRY_SIZE, and the renaming - * of (VET, 0) to its alternate address. - * - * The following table shows the expected states of the variable - * size entries after the test. - * - * in - * entry: cache? size: dirty? pinned? pins: flush operations: - * - * (VET, 0) Y 10 KB Y Y - - - * - * (VET, 1) Y 2.5 KB N N - - - * - * (VET, 2) N 10 KB N N - - - * - * (VET, 3) Y 2.5 KB N N - - - * - * (VET, 4) N 10 KB N N - - - * - * (VET, 5) Y 2.5 KB Y N 0, 9 dirty (VET, 0) - * resize (VET, 5) to 5 KB - * - * (VET, 6) Y 5 KB Y N - - - * - * (VET, 7) Y 5 KB Y N 9 dirty (VET, 9) - * - * (VET, 8) Y 10 KB N N - - - * - * (VET, 9) Y 10 KB N Y - dirty (VET, 8) - * - * Start by updating the expected table for the expected changes in entry status: - */ - expected[0].size = VARIABLE_ENTRY_SIZE; - expected[0].at_main_addr = false; - expected[3].is_dirty = false; - expected[3].serialized = true; - expected[4].in_cache = false; - expected[4].destroyed = true; + base_addr = entries[spec[i].entry_type]; + entry_ptr = &(base_addr[spec[i].entry_index]); - num_large_entries = 3; + entry_ptr->size = entry_sizes[spec[i].entry_type]; - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 2); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 2, H5C__DIRTIED_FLAG); + entry_ptr->deserialized = false; + entry_ptr->serialized = false; + entry_ptr->destroyed = false; - if ((cache_ptr->index_len != 42) || - (cache_ptr->index_size != (2 * 1024 * 1024) - (2 * VARIABLE_ENTRY_SIZE) + - (3 * VARIABLE_ENTRY_SIZE / 4) + (2 * LARGE_ENTRY_SIZE)) || - (cache_ptr->index_size != - ((3 * VARIABLE_ENTRY_SIZE / 4) + (2 * VARIABLE_ENTRY_SIZE / 2) + (3 * VARIABLE_ENTRY_SIZE) + - (31 * MONSTER_ENTRY_SIZE) + (3 * LARGE_ENTRY_SIZE)))) { + i++; + } + + i = 0; + while (pass && (i < check_size)) { + + base_addr = entries[check[i].entry_type]; + entry_ptr = &(base_addr[check[i].entry_index]); + + entry_ptr->size = entry_sizes[check[i].entry_type]; - pass = false; - failure_mssg = "unexpected size/len in flush op eviction test 4."; - } + entry_ptr->deserialized = false; + entry_ptr->serialized = false; + entry_ptr->destroyed = false; - /* verify entry status */ - verify_entry_status(cache_ptr, 2, (num_variable_entries + num_monster_entries + num_large_entries), - expected); + i++; } - if (pass) { +} /* check_flush_cache__flush_op_test() */ - /* load two more large entries. This should result in (VET, 5) being - * flushed, and increasing its size from 1/4 VARIABLE_ENTRY_SIZE to - * VARIABLE_ENTRY_SIZE. - * - * As a result of this size increase, the cache will have to look - * for another entry to evict. After flushing (VET, 6) and (VET, 7), - * it should evict (VET, 8), yielding the needed memory and dirtying - * (VET, 9). - * - * The following table shows the expected states of the variable - * size entries after the test. - * - * in - * entry: cache? size: dirty? pinned? pins: flush operations: - * - * (VET, 0) Y 10 KB Y Y - - - * - * (VET, 1) Y 2.5 KB N N - - - * - * (VET, 2) N 10 KB N N - - - * - * (VET, 3) Y 2.5 KB N N - - - * - * (VET, 4) N 10 KB N N - - - * - * (VET, 5) Y 5 KB N N 0, 9 - - * - * (VET, 6) Y 5 KB N N - - - * - * (VET, 7) Y 5 KB N N 9 - - * - * (VET, 8) N 10 KB N N - - - * - * (VET, 9) Y 10 KB N Y - dirty (VET, 8) - * - * Start by updating the expected table for the expected changes in entry status: - */ +/*------------------------------------------------------------------------- + * Function: check_flush_cache__flush_op_eviction_test() + * + * Purpose: Verify that flush operations work as expected when an + * entry is evicted. + * + * Do nothing if pass is false on entry. + * + * Return: void + * + *------------------------------------------------------------------------- + */ - expected[5].size = VARIABLE_ENTRY_SIZE / 2; - expected[5].is_dirty = false; - expected[5].serialized = true; - expected[6].is_dirty = false; - expected[6].serialized = true; - expected[7].is_dirty = false; - expected[7].serialized = true; - expected[8].in_cache = false; - expected[8].destroyed = true; - expected[9].is_dirty = true; +static void +check_flush_cache__flush_op_eviction_test(H5F_t *file_ptr) +{ + struct expected_entry_status *expected = NULL; + H5C_t *cache_ptr = file_ptr->shared->cache; + int i; + const int num_variable_entries = 10; + const int num_monster_entries = 31; + int num_large_entries = 14; + const int num_total_entries = num_variable_entries + num_monster_entries + num_large_entries; + test_entry_t *entry_ptr; + test_entry_t *base_addr; - num_large_entries = 5; + expected = malloc((size_t)num_total_entries * sizeof(struct expected_entry_status)); + if (expected == NULL) { - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 3, H5C__DIRTIED_FLAG); + pass = false; + failure_mssg = "couldn't allocate expected entry status array\n"; + } - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 4); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 4, H5C__DIRTIED_FLAG); + if (expected) { + /* the expected array is used to maintain a table of the expected status of every + * entry used in this test. Note that since the function that processes this + * array only processes as much of it as it is told to, we don't have to + * worry about maintaining the status of entries that we haven't used yet. + */ + for (i = 0; i < num_variable_entries; i++) { + expected[i].entry_type = VARIABLE_ENTRY_TYPE; + expected[i].entry_index = (int)(i); + expected[i].size = VARIABLE_ENTRY_SIZE; + expected[i].in_cache = true; + expected[i].at_main_addr = true; + expected[i].is_dirty = true; + expected[i].is_protected = false; + expected[i].is_pinned = false; + expected[i].deserialized = true; + expected[i].serialized = false; + expected[i].destroyed = false; - /* verify cache size */ - if ((cache_ptr->index_len != 43) || - (cache_ptr->index_size != (2 * 1024 * 1024) - (3 * VARIABLE_ENTRY_SIZE) + - (1 * VARIABLE_ENTRY_SIZE / 4) + (3 * VARIABLE_ENTRY_SIZE / 4) + - (4 * LARGE_ENTRY_SIZE)) || - (cache_ptr->index_size != - ((2 * VARIABLE_ENTRY_SIZE / 4) + (3 * VARIABLE_ENTRY_SIZE / 2) + (2 * VARIABLE_ENTRY_SIZE) + - (31 * MONSTER_ENTRY_SIZE) + (5 * LARGE_ENTRY_SIZE)))) { + memset(expected[i].flush_dep_par_type, 0, sizeof(expected[i].flush_dep_par_type)); + memset(expected[i].flush_dep_par_idx, 0, sizeof(expected[i].flush_dep_par_idx)); - pass = false; - failure_mssg = "unexpected size/len in flush op eviction test 5."; + expected[i].flush_dep_npar = 0; + expected[i].flush_dep_nchd = 0; + expected[i].flush_dep_ndirty_chd = 0; + expected[i].flush_order = -1; + expected[i].is_corked = false; } - /* verify entry status */ - verify_entry_status(cache_ptr, 3, (num_variable_entries + num_monster_entries + num_large_entries), - expected); - } + /* NOTE: special cases for particular variable entries */ + expected[0].size = VARIABLE_ENTRY_SIZE / 4; + expected[0].is_pinned = true; - if (pass) { + expected[1].size = VARIABLE_ENTRY_SIZE / 4; - /* now touch all the non VARIABLE_ENTRY_TYPE entries in the - * cache to bring all the VARIABLE_ENTRY_TYPE entries to the - * end of the LRU list. - * - * Note that we don't have to worry about (VET, 0) and (VET, 9) - * as they are pinned and thus not in the LRU list to begin with. - */ - for (i = 0; i < 31; i++) { - protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); - unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); - } + expected[2].is_dirty = false; - for (i = 0; i < 5; i++) { - protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); - } + expected[3].size = VARIABLE_ENTRY_SIZE / 4; - /* verify cache size */ - if ((cache_ptr->index_len != 43) || - (cache_ptr->index_size != (2 * 1024 * 1024) - (3 * VARIABLE_ENTRY_SIZE) + - (1 * VARIABLE_ENTRY_SIZE / 4) + (3 * VARIABLE_ENTRY_SIZE / 4) + - (4 * LARGE_ENTRY_SIZE)) || - (cache_ptr->index_size != - ((2 * VARIABLE_ENTRY_SIZE / 4) + (3 * VARIABLE_ENTRY_SIZE / 2) + (2 * VARIABLE_ENTRY_SIZE) + - (31 * MONSTER_ENTRY_SIZE) + (5 * LARGE_ENTRY_SIZE)))) { + expected[4].is_dirty = false; - pass = false; - failure_mssg = "unexpected size/len in flush op eviction test 6."; - } + expected[5].size = VARIABLE_ENTRY_SIZE / 4; - /* verify entry status */ - verify_entry_status(cache_ptr, 4, (num_variable_entries + num_monster_entries + num_large_entries), - expected); - } + expected[6].size = VARIABLE_ENTRY_SIZE / 2; - if (pass) { + expected[7].size = VARIABLE_ENTRY_SIZE / 2; - /* Now load three more large entries. This should result - * in the evictions of (VET, 1), (VET, 3), and (VET, 5), and the - * unpinning of (VET, 0) - * - * The following table shows the expected states of the variable - * size entries after the test. - * - * in - * entry: cache? size: dirty? pinned? pins: flush operations: - * - * (VET, 0) Y 10 KB Y N - - - * - * (VET, 1) N 2.5 KB N N - - - * - * (VET, 2) N 10 KB N N - - - * - * (VET, 3) N 2.5 KB N N - - - * - * (VET, 4) N 10 KB N N - - - * - * (VET, 5) N 5 KB N N - - - * - * (VET, 6) Y 5 KB N N - - - * - * (VET, 7) Y 5 KB N N 9 - - * - * (VET, 8) N 10 KB N N - - - * - * (VET, 9) Y 10 KB N Y - dirty (VET, 8) - * - * Start by updating the expected table for the expected changes in entry status: - */ + expected[8].is_dirty = false; - expected[0].is_pinned = false; - expected[1].in_cache = false; - expected[1].destroyed = true; - expected[3].in_cache = false; - expected[3].destroyed = true; - expected[5].in_cache = false; - expected[5].destroyed = true; + expected[9].is_dirty = false; + expected[9].is_pinned = true; - num_large_entries = 8; + for (; i < num_variable_entries + num_monster_entries; i++) { + expected[i].entry_type = MONSTER_ENTRY_TYPE; + expected[i].entry_index = (int)(i - num_variable_entries); + expected[i].size = MONSTER_ENTRY_SIZE; + expected[i].in_cache = true; + expected[i].at_main_addr = true; + expected[i].is_dirty = true; + expected[i].is_protected = false; + expected[i].is_pinned = false; + expected[i].deserialized = true; + expected[i].serialized = false; + expected[i].destroyed = false; - for (i = 5; i < 8; i++) { - protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); + memset(expected[i].flush_dep_par_type, 0, sizeof(expected[i].flush_dep_par_type)); + memset(expected[i].flush_dep_par_idx, 0, sizeof(expected[i].flush_dep_par_idx)); + + expected[i].flush_dep_npar = 0; + expected[i].flush_dep_nchd = 0; + expected[i].flush_dep_ndirty_chd = 0; + expected[i].flush_order = -1; + expected[i].is_corked = false; } - /* verify cache size */ - if ((cache_ptr->index_len != 43) || - (cache_ptr->index_size != (2 * 1024 * 1024) - (4 * VARIABLE_ENTRY_SIZE) + - (1 * VARIABLE_ENTRY_SIZE / 4) + (3 * VARIABLE_ENTRY_SIZE / 4) + - (7 * LARGE_ENTRY_SIZE)) || - (cache_ptr->index_size != ((2 * VARIABLE_ENTRY_SIZE / 2) + (2 * VARIABLE_ENTRY_SIZE) + - (31 * MONSTER_ENTRY_SIZE) + (8 * LARGE_ENTRY_SIZE)))) { + for (; i < num_total_entries; i++) { + expected[i].entry_type = LARGE_ENTRY_TYPE; + expected[i].entry_index = (int)(i - num_monster_entries - num_variable_entries); + expected[i].size = LARGE_ENTRY_SIZE; + expected[i].in_cache = true; + expected[i].at_main_addr = true; + expected[i].is_dirty = true; + expected[i].is_protected = false; + expected[i].is_pinned = false; + expected[i].deserialized = true; + expected[i].serialized = false; + expected[i].destroyed = false; - pass = false; - failure_mssg = "unexpected size/len in flush op eviction test 7."; + memset(expected[i].flush_dep_par_type, 0, sizeof(expected[i].flush_dep_par_type)); + memset(expected[i].flush_dep_par_idx, 0, sizeof(expected[i].flush_dep_par_idx)); + + expected[i].flush_dep_npar = 0; + expected[i].flush_dep_nchd = 0; + expected[i].flush_dep_ndirty_chd = 0; + expected[i].flush_order = -1; + expected[i].is_corked = false; } - /* verify entry status */ - verify_entry_status(cache_ptr, 5, (num_variable_entries + num_monster_entries + num_large_entries), - expected); + assert(i == num_total_entries); + + pass = true; } if (pass) { - /* load another large entry. (VET, 6) should be evicted. - * - * The following table shows the expected states of the variable - * size entries after the test. - * - * in - * entry: cache? size: dirty? pinned? pins: flush operations: - * - * (VET, 0) Y 10 KB Y N - - - * - * (VET, 1) N 2.5 KB N N - - - * - * (VET, 2) N 10 KB N N - - - * - * (VET, 3) N 2.5 KB N N - - - * - * (VET, 4) N 10 KB N N - - - * - * (VET, 5) N 5 KB N N - - - * - * (VET, 6) N 5 KB N N - - - * - * (VET, 7) Y 5 KB N N 9 - - * - * (VET, 8) N 10 KB N N - - - * - * (VET, 9) Y 10 KB N Y - dirty (VET, 8) - * - * Start by updating the expected table for the expected changes in entry status: - */ - - expected[6].in_cache = false; - expected[6].destroyed = true; - - num_large_entries = 9; + if (cache_ptr == NULL) { - for (i = 8; i < 9; i++) { - protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); + pass = false; + failure_mssg = "cache_ptr NULL on entry to flush ops test."; } + else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) { - /* verify cache size */ - if ((cache_ptr->index_len != 43) || - (cache_ptr->index_size != (2 * 1024 * 1024) - (3 * VARIABLE_ENTRY_SIZE) - - (VARIABLE_ENTRY_SIZE / 2) + (8 * LARGE_ENTRY_SIZE)) || - (cache_ptr->index_size != ((1 * VARIABLE_ENTRY_SIZE / 2) + (2 * VARIABLE_ENTRY_SIZE) + - (31 * MONSTER_ENTRY_SIZE) + (9 * LARGE_ENTRY_SIZE)))) { + pass = false; + failure_mssg = "cache not empty at start of flush ops eviction test."; + } + else if ((cache_ptr->max_cache_size != (2 * 1024 * 1024)) || + (cache_ptr->min_clean_size != (1 * 1024 * 1024))) { pass = false; - failure_mssg = "unexpected size/len in flush op eviction test 8."; + failure_mssg = "unexpected cache config at start of flush op eviction test."; } + else { - /* verify entry status */ - verify_entry_status(cache_ptr, 6, (num_variable_entries + num_monster_entries + num_large_entries), - expected); + /* set min clean size to zero for this test as it simplifies + * computing the expected cache size after each operation. + */ + + cache_ptr->min_clean_size = 0; + } } if (pass) { - /* Load another large entry. - * - * (VET, 7) should be evicted, and (VET, 9) should be unpinned. - * - * The following table shows the expected states of the variable - * size entries after the test. - * - * in - * entry: cache? size: dirty? pinned? pins: flush operations: - * - * (VET, 0) Y 10 KB Y N - - - * - * (VET, 1) N 2.5 KB N N - - - * - * (VET, 2) N 10 KB N N - - - * - * (VET, 3) N 2.5 KB N N - - - * - * (VET, 4) N 10 KB N N - - - * - * (VET, 5) N 5 KB N N - - - * - * (VET, 6) N 5 KB N N - - - * - * (VET, 7) N 5 KB N N - - - * - * (VET, 8) N 10 KB N N - - - * - * (VET, 9) Y 10 KB Y N - dirty (VET, 8) + /* the basic idea in this test is to insert a bunch of entries + * with flush operations associated with them, and then load + * other entries into the cache until the cache is full. At + * that point, load yet more entries into the cache, and see + * if the flush operations are performed as expected. * - * Start by updating the expected table for the expected changes in entry status: + * To make things a bit more interesting, we also include a + * couple of pins. */ - expected[7].in_cache = false; - expected[7].destroyed = true; - expected[9].is_pinned = false; + /* reset the stats before we start. If stats are enabled, we will + * check to see if they are as expected at the end. + */ + H5C_stats__reset(cache_ptr); - num_large_entries = 10; + /* load a few entries with pin relationships and flush ops. + * Start by just loading the entries. + */ - for (i = 9; i < 10; i++) { - protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); - } + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 0); + resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 0, (VARIABLE_ENTRY_SIZE / 4), true); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 0, H5C__DIRTIED_FLAG); - /* verify cache size */ - if ((cache_ptr->index_len != 43) || - (cache_ptr->index_size != - (2 * 1024 * 1024) - (4 * VARIABLE_ENTRY_SIZE) + (9 * LARGE_ENTRY_SIZE)) || - (cache_ptr->index_size != - ((2 * VARIABLE_ENTRY_SIZE) + (31 * MONSTER_ENTRY_SIZE) + (10 * LARGE_ENTRY_SIZE)))) { + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 1); + resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 1, (VARIABLE_ENTRY_SIZE / 4), true); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 1, H5C__DIRTIED_FLAG); - pass = false; - failure_mssg = "unexpected size/len in flush op eviction test 9."; - } + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 2); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 2, H5C__NO_FLAGS_SET); - /* verify entry status */ - verify_entry_status(cache_ptr, 7, (num_variable_entries + num_monster_entries + num_large_entries), - expected); - } + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 3); + resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 3, (VARIABLE_ENTRY_SIZE / 4), true); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 3, H5C__DIRTIED_FLAG); - if (pass) { + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 4); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 4, H5C__NO_FLAGS_SET); - /* Again, touch all the non VARIABLE_ENTRY_TYPE entries in the - * cache to bring all the VARIABLE_ENTRY_TYPE entries to the - * end of the LRU list. - * - * Both (VET, 0) and (VET, 7) have been unpinned, so they are - * now in the LRU list. - */ - for (i = 0; i < 31; i++) { - protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); - unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); - } + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 5); + resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 5, (VARIABLE_ENTRY_SIZE / 4), true); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 5, H5C__DIRTIED_FLAG); - for (i = 0; i < 10; i++) { - protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); - } + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 6); + resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 6, (VARIABLE_ENTRY_SIZE / 2), true); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 6, H5C__DIRTIED_FLAG); - /* verify cache size */ - if ((cache_ptr->index_len != 43) || - (cache_ptr->index_size != - (2 * 1024 * 1024) - (4 * VARIABLE_ENTRY_SIZE) + (9 * LARGE_ENTRY_SIZE)) || + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 7); + resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 7, (VARIABLE_ENTRY_SIZE / 2), true); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 7, H5C__DIRTIED_FLAG); + + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 8); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 8, H5C__NO_FLAGS_SET); + + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 9); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 9, H5C__NO_FLAGS_SET); + + if ((cache_ptr->index_len != 10) || (cache_ptr->index_size != - ((2 * VARIABLE_ENTRY_SIZE) + (31 * MONSTER_ENTRY_SIZE) + (10 * LARGE_ENTRY_SIZE)))) { + (4 * (VARIABLE_ENTRY_SIZE / 4)) + (2 * (VARIABLE_ENTRY_SIZE / 2)) + (4 * VARIABLE_ENTRY_SIZE))) { pass = false; - failure_mssg = "unexpected size/len in flush op eviction test 10."; + failure_mssg = "unexpected size/len in flush op eviction test 1."; } - - /* verify entry status */ - verify_entry_status(cache_ptr, 8, (num_variable_entries + num_monster_entries + num_large_entries), - expected); } if (pass) { - /* load two more large entries. Things get a bit complicated here, - * so I'll go through the operation step by step. - * - * Initially, the cache has 4 KB of empty space, so the first entry - * (LET, 10) is loaded via calls to H5C_protect() H5C_unprotect() - * without causing any evictions. - * - * However, this is not the case for the call of H5C_protect() on - * (LET, 11). - * - * Before inserting (LET, 11), H5C_protect(LET, 11) must try to - * free up at least 4 KB of space. To do this, it starts scanning - * up the LRU list to find entries to evict. - * - * (VET, 0) is at the bottom of the LRU list, and thus is the first - * entry considered. However, it is dirty, so it flushed to disk, - * moved to the top of the LRU list, and marked clean. - * - * (VET, 9) is the next entry on the bottom of the LRU list. It is - * dirty too, calls its serialize callback function to construct an - * on disk image of the entry, and moves it to the top of the LRU - * list after the serialize callback returns. - * - * However, (VET 9)'s serialize function needs to modify (VET, 8), - * which is currently not in cache. Thus it calls H5C_protect(VET, 8) - * to gain access to it. H5C_protect(VET, 8) loads (VET, 8), and - * then attempts to evict entries to make space for it. - * - * However, H5C_make_space_in_cache() now exits without taking - * any action on re-entrant calls. Thus H5C_protect(VET, 8) simply - * loads the entry into the cache -- resulting in a cache that is - * 10 KB oversize. The subsequent unprotect puts (VET, 8) at the - * head of the LRU and marks it dirty. - * - * After (VET, 9) is serialized, it is flushed, and moved to the - * head of the LRU. - * - * At this point, the H5C_make_space_in_cache() call made by - * H5C_protect(LET, 11) now has 14 KB of space to make. - * - * The next entries on the LRU are (MET, 0) thru (MET, 30), - * (LET, 0) thru (LET, 10), and (VET, 8) -- all of which are dirty, - * and are therefore flushed and moved to the head of the LRU list. + /* Now set up the pinning relationships: * - * The next entry on the bottom of the LRU list is (VET, 0), which - * is clean, and is therefore evicted, leaving H5C_make_space_in_cache() - * with 4 KB of space to create. + * Briefly, (VET, 0) is pinned by (VET, 1), (VET, 3), and (VET, 5) + * (VET, 9) is pinned by (VET, 5), and (VET, 7) + */ + create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 1, VARIABLE_ENTRY_TYPE, 0); + create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 3, VARIABLE_ENTRY_TYPE, 0); + create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 5, VARIABLE_ENTRY_TYPE, 0); + create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 5, VARIABLE_ENTRY_TYPE, 9); + create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 7, VARIABLE_ENTRY_TYPE, 9); + + /* Next, set up the flush operations: * - * This space is sufficient, so H5C_protect(VET, 8) inserts - * (VET, 8) into the cache's index, marks it as protected, and - * returns to the serialize function for (VET, 9). + * Briefly, (VET, 1) dirties (VET, 0) + * resizes (VET, 0) to 3/4 VARIABLE_ENTRY_SIZE * - * When the serialize function for (VET, 9) is done with (VET, 8), it - * calls H5C_unprotect(VET, 8), which marks (VET, 8) as dirty and - * unprotected, and places it at the head of the LRU. + * (VET, 3) dirties (VET, 0) + * resizes (VET, 0) to VARIABLE_ENTRY_SIZE + * moves (VET, 0) to its alternate address * - * (VET, 0) is the next item on the LRU -- it is clean and is therefore - * evicted -- leaving 6 KB of free space after (LET, 11) is inserted - * into the cache. + * (VET, 5) dirties (VET, 0) + * resizes itself to VARIABLE_ENTRY_SIZE / 2 * - * H5C_unprotect(LET, 11) marks (LET, 11) as unprotected, and then - * returns as well. + * (VET, 7) dirties (VET, 9) * - * The following table shows the expected states of the variable - * size entries after the test. + * (VET, 9) dirties (VET, 8) + */ + add_flush_op(VARIABLE_ENTRY_TYPE, 1, FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, false, (size_t)0, NULL); + add_flush_op(VARIABLE_ENTRY_TYPE, 1, FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, true, + 3 * VARIABLE_ENTRY_SIZE / 4, NULL); + + add_flush_op(VARIABLE_ENTRY_TYPE, 3, FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, false, (size_t)0, NULL); + add_flush_op(VARIABLE_ENTRY_TYPE, 3, FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, true, + VARIABLE_ENTRY_SIZE, NULL); + add_flush_op(VARIABLE_ENTRY_TYPE, 3, FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, false, (size_t)0, NULL); + + add_flush_op(VARIABLE_ENTRY_TYPE, 5, FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, false, (size_t)0, NULL); + add_flush_op(VARIABLE_ENTRY_TYPE, 5, FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 5, true, + VARIABLE_ENTRY_SIZE / 2, NULL); + + add_flush_op(VARIABLE_ENTRY_TYPE, 7, FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 9, false, (size_t)0, NULL); + + add_flush_op(VARIABLE_ENTRY_TYPE, 9, FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 8, false, (size_t)0, NULL); + } + + if (pass) { + + /* to summarize, at present the following variable size entries + * are in cache with the following characteristics: * * in * entry: cache? size: dirty? pinned? pins: flush operations: * - * (VET, 0) N 10 KB N N - - + * (VET, 0) Y 2.5 KB Y Y - - * - * (VET, 1) N 2.5 KB N N - - + * (VET, 1) Y 2.5 KB Y N 0 dirty (VET, 0), + * resize (VET, 0) to 7.5 KB * - * (VET, 2) N 10 KB N N - - + * (VET, 2) Y 10 KB N N - - * - * (VET, 3) N 2.5 KB N N - - * - * (VET, 4) N 10 KB N N - - + * (VET, 3) Y 2.5 KB N N 0 dirty (VET, 0) + * resize (VET, 0) to 10 KB + * move (VET, 0) to its alternate address * - * (VET, 5) N 5 KB N N - - + * (VET, 4) Y 10 KB N N - - * - * (VET, 6) N 5 KB N N - - * - * (VET, 7) N 5 KB N N - - + * (VET, 5) Y 2.5 KB Y N 0, 9 dirty (VET, 0) + * resize (VET, 5) to 5 KB * - * (VET, 8) Y 10 KB N N - - + * (VET, 6) Y 5 KB Y N - - * - * (VET, 9) N 10 KB N N - - + * (VET, 7) Y 5 KB Y N 9 dirty (VET, 9) * - * Start by updating the expected table for the expected changes in - * entry status: + * (VET, 8) Y 10 KB N N - - * - * Note that we reset the loaded, flushed, and destroyed - * fields of (VET,8) so we can track what is happening. + * (VET, 9) Y 10 KB N N - dirty (VET, 8) + * + * Recall that in this test bed, flush operations are executed the + * first time the associated entry is flushed, and are then + * deleted. */ - base_addr = entries[VARIABLE_ENTRY_TYPE]; - entry_ptr = &(base_addr[8]); - entry_ptr->deserialized = false; - entry_ptr->deserialized = false; - entry_ptr->destroyed = false; - - expected[0].in_cache = false; - expected[0].is_dirty = false; - expected[0].serialized = true; - expected[0].destroyed = true; - expected[8].in_cache = true; - expected[8].is_dirty = false; - expected[8].deserialized = true; - expected[8].serialized = true; - expected[8].destroyed = false; - expected[9].in_cache = false; - expected[9].is_dirty = false; - expected[9].serialized = true; - expected[9].destroyed = true; - - expected[10].in_cache = true; - expected[10].is_dirty = false; - expected[10].serialized = true; - expected[10].destroyed = false; - - num_large_entries = 12; - for (i = num_variable_entries; i < num_variable_entries + num_monster_entries + num_large_entries - 1; - i++) { - expected[i].is_dirty = false; - expected[i].serialized = true; + /* Now fill up the cache with other, unrelated entries */ + for (i = 0; i < 31; i++) { + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); } - for (i = 10; i < 12; i++) { + for (i = 0; i < 1; i++) { protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); } - /* verify cache size */ - if ((cache_ptr->index_len != 44) || - (cache_ptr->index_size != (2 * 1024 * 1024) - (2 * 1024) - (1 * LARGE_ENTRY_SIZE)) || + /* The cache should now be exactly full */ + if ((cache_ptr->index_len != 42) || (cache_ptr->index_size != 2 * 1024 * 1024) || (cache_ptr->index_size != - ((1 * VARIABLE_ENTRY_SIZE) + (31 * MONSTER_ENTRY_SIZE) + (12 * LARGE_ENTRY_SIZE)))) { + ((4 * VARIABLE_ENTRY_SIZE / 4) + (2 * VARIABLE_ENTRY_SIZE / 2) + (4 * VARIABLE_ENTRY_SIZE) + + (31 * MONSTER_ENTRY_SIZE) + (1 * LARGE_ENTRY_SIZE)))) { pass = false; - failure_mssg = "unexpected size/len in flush op eviction test 11."; + failure_mssg = "unexpected size/len in flush op eviction test 2."; } + else { - /* verify entry status */ - verify_entry_status(cache_ptr, 9, (num_variable_entries + num_monster_entries + num_large_entries), - expected); + /* verify the expected status of all entries we have loaded to date: */ + num_large_entries = 1; + verify_entry_status(cache_ptr, 0, + (num_variable_entries + num_monster_entries + num_large_entries), expected); + } } if (pass) { - /* protect and unprotect VET 9 to evict MET 0 */ - protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 9); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 9, H5C__NO_FLAGS_SET); - - /* protect and unprotect VET 8 to dirty it and move it to the - * top of the LRU. Since we are dirtying it again, reset its - * serialized flag. - */ - base_addr = entries[VARIABLE_ENTRY_TYPE]; - entry_ptr = &(base_addr[8]); - entry_ptr->serialized = false; - - protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 8); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 8, H5C__DIRTIED_FLAG); - - /* Again, touch all the non VARIABLE_ENTRY_TYPE entries in the - * cache to evict VET 9 and move VET 8 to the bottom of the LRU. + /* Now load a large entry. This should result in the eviction + * of (VET,2), and the increase in the size of (VET, 0) from .25 + * VARIABLE_ENTRY_SIZE to .75 VARIABLE_ENTRY_SIZE. * - * Must do this twice to get the desired result. - */ - - /* skip MET 0 in first pass so that we evict VET 9 when we - * reload MET 0 + * The following table illustrates the intended state of affairs + * after the eviction: * - * Since we are reloading MET 0, reset its destroyed flag. - */ - base_addr = entries[MONSTER_ENTRY_TYPE]; - entry_ptr = &(base_addr[0]); - entry_ptr->destroyed = false; - - for (i = 1; i < num_monster_entries; i++) { - protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); - unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); - } - - for (i = 0; i < num_large_entries; i++) { - protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); - } - - for (i = 0; i < num_monster_entries; i++) { - protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); - unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); - } - - for (i = 0; i < num_large_entries; i++) { - protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); - } - - /* update the expected array to mark all these entries dirty again. */ - for (i = num_variable_entries; i < num_variable_entries + num_monster_entries + num_large_entries - 1; - i++) { - expected[i].is_dirty = true; - } - - /* update MET 0 to set its in cache flag, and reset - * its destroyed flag + * in + * entry: cache? size: dirty? pinned? pins: flush operations: + * + * (VET, 0) Y 7.5 KB Y Y - - + * + * (VET, 1) Y 2.5 KB N N - - + * + * (VET, 2) N 10 KB N N - - + * + * (VET, 3) Y 2.5 KB Y N 0 dirty (VET, 0) + * resize (VET, 0) to 10 KB + * move (VET, 0) to its alternate address + * + * (VET, 4) Y 10 KB N N - - + * + * (VET, 5) Y 2.5 KB Y N 0, 9 dirty (VET, 0) + * resize (VET, 5) to 5 KB + * + * (VET, 6) Y 5 KB Y N - - + * + * (VET, 7) Y 5 KB Y N 9 dirty (VET, 9) + * + * (VET, 8) Y 10 KB N N - - + * + * (VET, 9) Y 10 KB N Y - dirty (VET, 8) + * + * Start by updating the expected table for the expected changes in entry status: */ - expected[10].in_cache = true; + expected[0].size = 3 * VARIABLE_ENTRY_SIZE / 4; + expected[1].is_dirty = false; + expected[1].serialized = true; + expected[2].in_cache = false; + expected[2].destroyed = true; - /* pass through non variable entries will flush VET 8, and evict VET 9. - * Update accordingly. - */ - expected[8].in_cache = true; - expected[8].is_dirty = true; - expected[8].serialized = false; - expected[8].destroyed = false; - expected[9].in_cache = false; - expected[9].is_dirty = false; - expected[9].serialized = true; - expected[9].destroyed = true; + num_large_entries = 2; - /* verify cache size */ - if ((cache_ptr->index_len != 44) || - (cache_ptr->index_size != - (2 * 1024 * 1024) - (5 * VARIABLE_ENTRY_SIZE) + (11 * LARGE_ENTRY_SIZE)) || - (cache_ptr->index_size != - ((1 * VARIABLE_ENTRY_SIZE) + (31 * MONSTER_ENTRY_SIZE) + (12 * LARGE_ENTRY_SIZE)))) { + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 1); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 1, H5C__DIRTIED_FLAG); + if ((cache_ptr->index_len != 42) || + (cache_ptr->index_size != + (2 * 1024 * 1024) - (VARIABLE_ENTRY_SIZE) + (VARIABLE_ENTRY_SIZE / 2) + (LARGE_ENTRY_SIZE)) || + (cache_ptr->index_size != ((1 * (3 * VARIABLE_ENTRY_SIZE / 4)) + (3 * VARIABLE_ENTRY_SIZE / 4) + + (2 * VARIABLE_ENTRY_SIZE / 2) + (3 * VARIABLE_ENTRY_SIZE) + + (31 * MONSTER_ENTRY_SIZE) + (2 * LARGE_ENTRY_SIZE)))) { pass = false; - failure_mssg = "unexpected size/len in flush op eviction test 12."; + failure_mssg = "unexpected size/len in flush op eviction test 3."; } - /* modifications to the H5C__flush_single_entry() function have - * changed the behavior of the cache slightly, causing - * this test to fail. Comment out for now -- come back and - * fix if all goes well. - */ - /* verify entry status */ - verify_entry_status(cache_ptr, 10, (num_variable_entries + num_monster_entries + num_large_entries), + verify_entry_status(cache_ptr, 1, (num_variable_entries + num_monster_entries + num_large_entries), expected); } if (pass) { - /* Load two more large entries. - * - * Since (VET, 8) is dirty, at first this will just cause (VET, 8) - * to be flushed. - * - * But all other entries in the cache are dirty, so the cache will - * flush them all, and then evict (VET, 8) on the second pass. + /* Now load another large entry. This should result in the eviction + * of (VET, 4), the increase in the size of (VET, 0) from .75 + * VARIABLE_ENTRY_SIZE to 1.0 VARIABLE_ENTRY_SIZE, and the renaming + * of (VET, 0) to its alternate address. * * The following table shows the expected states of the variable * size entries after the test. @@ -9338,947 +7970,872 @@ check_flush_cache__flush_op_eviction_test(H5F_t *file_ptr) * in * entry: cache? size: dirty? pinned? pins: flush operations: * - * (VET, 0) N 10 KB N N - - + * (VET, 0) Y 10 KB Y Y - - * - * (VET, 1) N 2.5 KB N N - - + * (VET, 1) Y 2.5 KB N N - - * * (VET, 2) N 10 KB N N - - * - * (VET, 3) N 2.5 KB N N - - + * (VET, 3) Y 2.5 KB N N - - * * (VET, 4) N 10 KB N N - - * - * (VET, 5) N 5 KB N N - - + * (VET, 5) Y 2.5 KB Y N 0, 9 dirty (VET, 0) + * resize (VET, 5) to 5 KB * - * (VET, 6) N 5 KB N N - - + * (VET, 6) Y 5 KB Y N - - * - * (VET, 7) N 5 KB N N - - + * (VET, 7) Y 5 KB Y N 9 dirty (VET, 9) * - * (VET, 8) N 10 KB N N - - + * (VET, 8) Y 10 KB N N - - * - * (VET, 9) N 10 KB N N - - + * (VET, 9) Y 10 KB N Y - dirty (VET, 8) * - * Start by updating the expected table for the expected changes in - * entry status: + * Start by updating the expected table for the expected changes in entry status: */ + expected[0].size = VARIABLE_ENTRY_SIZE; + expected[0].at_main_addr = false; + expected[3].is_dirty = false; + expected[3].serialized = true; + expected[4].in_cache = false; + expected[4].destroyed = true; - expected[8].in_cache = false; - expected[8].is_dirty = false; - expected[8].serialized = true; - expected[8].destroyed = true; - - num_large_entries = 14; - - /* a newly loaded entry is not inserted in the cache until after - * space has been made for it. Thus (LET, 13) will not be flushed. - */ - for (i = num_variable_entries; i < num_variable_entries + num_monster_entries + num_large_entries - 1; - i++) { - expected[i].is_dirty = false; - expected[i].serialized = true; - } + num_large_entries = 3; - for (i = 12; i < 14; i++) { - protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); - } + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 2); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 2, H5C__DIRTIED_FLAG); - /* verify cache size */ - if ((cache_ptr->index_len != 45) || + if ((cache_ptr->index_len != 42) || + (cache_ptr->index_size != (2 * 1024 * 1024) - (2 * VARIABLE_ENTRY_SIZE) + + (3 * VARIABLE_ENTRY_SIZE / 4) + (2 * LARGE_ENTRY_SIZE)) || (cache_ptr->index_size != - (2 * 1024 * 1024) - (6 * VARIABLE_ENTRY_SIZE) + (13 * LARGE_ENTRY_SIZE)) || - (cache_ptr->index_size != ((31 * MONSTER_ENTRY_SIZE) + (14 * LARGE_ENTRY_SIZE)))) { + ((3 * VARIABLE_ENTRY_SIZE / 4) + (2 * VARIABLE_ENTRY_SIZE / 2) + (3 * VARIABLE_ENTRY_SIZE) + + (31 * MONSTER_ENTRY_SIZE) + (3 * LARGE_ENTRY_SIZE)))) { pass = false; - failure_mssg = "unexpected size/len in flush op eviction test 13."; + failure_mssg = "unexpected size/len in flush op eviction test 4."; } - /* modifications to the H5C__flush_single_entry() function have - * changed the behavior of the cache slightly, causing - * this test to fail. Comment out for now -- come back and - * fix if all goes well. - */ - /* verify entry status */ - verify_entry_status(cache_ptr, 11, (num_variable_entries + num_monster_entries + num_large_entries), + verify_entry_status(cache_ptr, 2, (num_variable_entries + num_monster_entries + num_large_entries), expected); } - /* at this point we have cycled all the variable size entries through - * the cache. - * - * flush the cache and end the test. - */ - - if (pass) { - - H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, - "Cache flush invalidate failed after flush op eviction test") - - if ((pass) && ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0))) { - - pass = false; - failure_mssg = "Unexpected cache len/size after cleanup of flush op eviction test"; - } - } - -#if H5C_COLLECT_CACHE_STATS - /* If we are collecting stats, check to see if we get the expected - * values. - * - * Testing the stats code is fairly new, but given the extent - * to which I find myself depending on the stats, I've decided - * to start testing the stats whenever it is convenient to do - * so. - */ - if (pass) { - - if ((cache_ptr->insertions[VARIABLE_ENTRY_TYPE] != 0) || - (cache_ptr->pinned_insertions[VARIABLE_ENTRY_TYPE] != 0) || - (cache_ptr->clears[VARIABLE_ENTRY_TYPE] != 0) || (cache_ptr->flushes[VARIABLE_ENTRY_TYPE] != 9) || - (cache_ptr->evictions[VARIABLE_ENTRY_TYPE] != 12) || - (cache_ptr->take_ownerships[VARIABLE_ENTRY_TYPE] != 0) || - (cache_ptr->moves[VARIABLE_ENTRY_TYPE] != 1) || - (cache_ptr->entry_flush_moves[VARIABLE_ENTRY_TYPE] != 0) || - (cache_ptr->cache_flush_moves[VARIABLE_ENTRY_TYPE] != 0) || - (cache_ptr->pins[VARIABLE_ENTRY_TYPE] != 2) || (cache_ptr->unpins[VARIABLE_ENTRY_TYPE] != 2) || - (cache_ptr->dirty_pins[VARIABLE_ENTRY_TYPE] != 2) || - (cache_ptr->pinned_flushes[VARIABLE_ENTRY_TYPE] != 0) || - (cache_ptr->pinned_clears[VARIABLE_ENTRY_TYPE] != 0) || - (cache_ptr->size_increases[VARIABLE_ENTRY_TYPE] != 3) || - (cache_ptr->size_decreases[VARIABLE_ENTRY_TYPE] != 6) || - (cache_ptr->entry_flush_size_changes[VARIABLE_ENTRY_TYPE] != 1) || - (cache_ptr->cache_flush_size_changes[VARIABLE_ENTRY_TYPE] != 0)) { - - pass = false; - failure_mssg = - "Unexpected variable size entry stats in check_flush_cache__flush_op_eviction_test()."; - } - } - - if (pass) { - - if ((cache_ptr->insertions[LARGE_ENTRY_TYPE] != 0) || - (cache_ptr->pinned_insertions[LARGE_ENTRY_TYPE] != 0) || - (cache_ptr->clears[LARGE_ENTRY_TYPE] != 0) || (cache_ptr->flushes[LARGE_ENTRY_TYPE] != 25) || - (cache_ptr->evictions[LARGE_ENTRY_TYPE] != 14) || - (cache_ptr->take_ownerships[LARGE_ENTRY_TYPE] != 0) || - (cache_ptr->moves[LARGE_ENTRY_TYPE] != 0) || - (cache_ptr->entry_flush_moves[LARGE_ENTRY_TYPE] != 0) || - (cache_ptr->cache_flush_moves[LARGE_ENTRY_TYPE] != 0) || - (cache_ptr->pins[LARGE_ENTRY_TYPE] != 0) || (cache_ptr->unpins[LARGE_ENTRY_TYPE] != 0) || - (cache_ptr->dirty_pins[LARGE_ENTRY_TYPE] != 0) || - (cache_ptr->pinned_flushes[LARGE_ENTRY_TYPE] != 0) || - (cache_ptr->pinned_clears[LARGE_ENTRY_TYPE] != 0) || - (cache_ptr->size_increases[LARGE_ENTRY_TYPE] != 0) || - (cache_ptr->size_decreases[LARGE_ENTRY_TYPE] != 0) || - (cache_ptr->entry_flush_size_changes[LARGE_ENTRY_TYPE] != 0) || - (cache_ptr->cache_flush_size_changes[LARGE_ENTRY_TYPE] != 0)) { - - pass = false; - failure_mssg = "Unexpected large entry stats in check_flush_cache__flush_op_eviction_test()."; - } - } - - if (pass) { - - if ((cache_ptr->insertions[MONSTER_ENTRY_TYPE] != 0) || - (cache_ptr->pinned_insertions[MONSTER_ENTRY_TYPE] != 0) || - (cache_ptr->clears[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->flushes[MONSTER_ENTRY_TYPE] != 62) || - (cache_ptr->evictions[MONSTER_ENTRY_TYPE] != 32) || - (cache_ptr->take_ownerships[MONSTER_ENTRY_TYPE] != 0) || - (cache_ptr->moves[MONSTER_ENTRY_TYPE] != 0) || - (cache_ptr->entry_flush_moves[MONSTER_ENTRY_TYPE] != 0) || - (cache_ptr->cache_flush_moves[MONSTER_ENTRY_TYPE] != 0) || - (cache_ptr->pins[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->unpins[MONSTER_ENTRY_TYPE] != 0) || - (cache_ptr->dirty_pins[MONSTER_ENTRY_TYPE] != 0) || - (cache_ptr->pinned_flushes[MONSTER_ENTRY_TYPE] != 0) || - (cache_ptr->pinned_clears[MONSTER_ENTRY_TYPE] != 0) || - (cache_ptr->size_increases[MONSTER_ENTRY_TYPE] != 0) || - (cache_ptr->size_decreases[MONSTER_ENTRY_TYPE] != 0) || - (cache_ptr->entry_flush_size_changes[MONSTER_ENTRY_TYPE] != 0) || - (cache_ptr->cache_flush_size_changes[MONSTER_ENTRY_TYPE] != 0)) { - - pass = false; - failure_mssg = "Unexpected monster entry stats in check_flush_cache__flush_op_eviction_test()."; - } - } -#endif /* H5C_COLLECT_CACHE_STATS */ - if (pass) { - reset_entries(); - } - - free(expected); - -} /* check_flush_cache__flush_op_eviction_test() */ - -/*------------------------------------------------------------------------- - * Function: check_flush_cache__single_entry() - * - * Purpose: Verify that flush_cache behaves as expected when the cache - * contains only one element. - * - * Return: void - * - *------------------------------------------------------------------------- - */ - -static void -check_flush_cache__single_entry(H5F_t *file_ptr) -{ - H5C_t *cache_ptr = file_ptr->shared->cache; - - if (cache_ptr == NULL) { - - pass = false; - failure_mssg = "cache_ptr NULL on entry to single entry case."; - } - else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) { - - pass = false; - failure_mssg = "cache not empty at beginning of single entry case."; - } - - if (pass) { + /* load two more large entries. This should result in (VET, 5) being + * flushed, and increasing its size from 1/4 VARIABLE_ENTRY_SIZE to + * VARIABLE_ENTRY_SIZE. + * + * As a result of this size increase, the cache will have to look + * for another entry to evict. After flushing (VET, 6) and (VET, 7), + * it should evict (VET, 8), yielding the needed memory and dirtying + * (VET, 9). + * + * The following table shows the expected states of the variable + * size entries after the test. + * + * in + * entry: cache? size: dirty? pinned? pins: flush operations: + * + * (VET, 0) Y 10 KB Y Y - - + * + * (VET, 1) Y 2.5 KB N N - - + * + * (VET, 2) N 10 KB N N - - + * + * (VET, 3) Y 2.5 KB N N - - + * + * (VET, 4) N 10 KB N N - - + * + * (VET, 5) Y 5 KB N N 0, 9 - + * + * (VET, 6) Y 5 KB N N - - + * + * (VET, 7) Y 5 KB N N 9 - + * + * (VET, 8) N 10 KB N N - - + * + * (VET, 9) Y 10 KB N Y - dirty (VET, 8) + * + * Start by updating the expected table for the expected changes in entry status: + */ - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 1, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__NO_FLAGS_SET, - /* expected_deserialized */ true, - /* expected_serialized */ false, - /* expected_destroyed */ false); - } + expected[5].size = VARIABLE_ENTRY_SIZE / 2; + expected[5].is_dirty = false; + expected[5].serialized = true; + expected[6].is_dirty = false; + expected[6].serialized = true; + expected[7].is_dirty = false; + expected[7].serialized = true; + expected[8].in_cache = false; + expected[8].destroyed = true; + expected[9].is_dirty = true; - if (pass) { + num_large_entries = 5; - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 2, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__DIRTIED_FLAG, - /* flush_flags */ H5C__NO_FLAGS_SET, - /* expected_deserialized */ true, - /* expected_serialized */ true, - /* expected_destroyed */ false); - } + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 3, H5C__DIRTIED_FLAG); - if (pass) { + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 4); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 4, H5C__DIRTIED_FLAG); - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 3, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_deserialized */ true, - /* expected_serialized */ false, - /* expected_destroyed */ false); - } + /* verify cache size */ + if ((cache_ptr->index_len != 43) || + (cache_ptr->index_size != (2 * 1024 * 1024) - (3 * VARIABLE_ENTRY_SIZE) + + (1 * VARIABLE_ENTRY_SIZE / 4) + (3 * VARIABLE_ENTRY_SIZE / 4) + + (4 * LARGE_ENTRY_SIZE)) || + (cache_ptr->index_size != + ((2 * VARIABLE_ENTRY_SIZE / 4) + (3 * VARIABLE_ENTRY_SIZE / 2) + (2 * VARIABLE_ENTRY_SIZE) + + (31 * MONSTER_ENTRY_SIZE) + (5 * LARGE_ENTRY_SIZE)))) { - if (pass) { + pass = false; + failure_mssg = "unexpected size/len in flush op eviction test 5."; + } - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 4, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__DIRTIED_FLAG, - /* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_deserialized */ true, - /* expected_serialized */ false, - /* expected_destroyed */ false); + /* verify entry status */ + verify_entry_status(cache_ptr, 3, (num_variable_entries + num_monster_entries + num_large_entries), + expected); } if (pass) { - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 5, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG, - /* expected_deserialized */ true, - /* expected_serialized */ false, - /* expected_destroyed */ true); - } + /* now touch all the non VARIABLE_ENTRY_TYPE entries in the + * cache to bring all the VARIABLE_ENTRY_TYPE entries to the + * end of the LRU list. + * + * Note that we don't have to worry about (VET, 0) and (VET, 9) + * as they are pinned and thus not in the LRU list to begin with. + */ + for (i = 0; i < 31; i++) { + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); + } - if (pass) { + for (i = 0; i < 5; i++) { + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); + } - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 6, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__DIRTIED_FLAG, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG, - /* expected_deserialized */ true, - /* expected_serialized */ true, - /* expected_destroyed */ true); - } + /* verify cache size */ + if ((cache_ptr->index_len != 43) || + (cache_ptr->index_size != (2 * 1024 * 1024) - (3 * VARIABLE_ENTRY_SIZE) + + (1 * VARIABLE_ENTRY_SIZE / 4) + (3 * VARIABLE_ENTRY_SIZE / 4) + + (4 * LARGE_ENTRY_SIZE)) || + (cache_ptr->index_size != + ((2 * VARIABLE_ENTRY_SIZE / 4) + (3 * VARIABLE_ENTRY_SIZE / 2) + (2 * VARIABLE_ENTRY_SIZE) + + (31 * MONSTER_ENTRY_SIZE) + (5 * LARGE_ENTRY_SIZE)))) { - if (pass) { + pass = false; + failure_mssg = "unexpected size/len in flush op eviction test 6."; + } - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 7, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG, - /* expected_deserialized */ true, - /* expected_serialized */ false, - /* expected_destroyed */ false); + /* verify entry status */ + verify_entry_status(cache_ptr, 4, (num_variable_entries + num_monster_entries + num_large_entries), + expected); } if (pass) { - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 8, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__DIRTIED_FLAG, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG, - /* expected_deserialized */ true, - /* expected_serialized */ false, - /* expected_destroyed */ false); - } + /* Now load three more large entries. This should result + * in the evictions of (VET, 1), (VET, 3), and (VET, 5), and the + * unpinning of (VET, 0) + * + * The following table shows the expected states of the variable + * size entries after the test. + * + * in + * entry: cache? size: dirty? pinned? pins: flush operations: + * + * (VET, 0) Y 10 KB Y N - - + * + * (VET, 1) N 2.5 KB N N - - + * + * (VET, 2) N 10 KB N N - - + * + * (VET, 3) N 2.5 KB N N - - + * + * (VET, 4) N 10 KB N N - - + * + * (VET, 5) N 5 KB N N - - + * + * (VET, 6) Y 5 KB N N - - + * + * (VET, 7) Y 5 KB N N 9 - + * + * (VET, 8) N 10 KB N N - - + * + * (VET, 9) Y 10 KB N Y - dirty (VET, 8) + * + * Start by updating the expected table for the expected changes in entry status: + */ - if (pass) { + expected[0].is_pinned = false; + expected[1].in_cache = false; + expected[1].destroyed = true; + expected[3].in_cache = false; + expected[3].destroyed = true; + expected[5].in_cache = false; + expected[5].destroyed = true; - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 9, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_deserialized */ true, - /* expected_serialized */ false, - /* expected_destroyed */ true); - } + num_large_entries = 8; - if (pass) { + for (i = 5; i < 8; i++) { + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); + } - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 10, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__DIRTIED_FLAG, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_deserialized */ true, - /* expected_serialized */ false, - /* expected_destroyed */ true); - } + /* verify cache size */ + if ((cache_ptr->index_len != 43) || + (cache_ptr->index_size != (2 * 1024 * 1024) - (4 * VARIABLE_ENTRY_SIZE) + + (1 * VARIABLE_ENTRY_SIZE / 4) + (3 * VARIABLE_ENTRY_SIZE / 4) + + (7 * LARGE_ENTRY_SIZE)) || + (cache_ptr->index_size != ((2 * VARIABLE_ENTRY_SIZE / 2) + (2 * VARIABLE_ENTRY_SIZE) + + (31 * MONSTER_ENTRY_SIZE) + (8 * LARGE_ENTRY_SIZE)))) { - if (pass) { + pass = false; + failure_mssg = "unexpected size/len in flush op eviction test 7."; + } - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 11, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_deserialized */ true, - /* expected_serialized */ false, - /* expected_destroyed */ false); + /* verify entry status */ + verify_entry_status(cache_ptr, 5, (num_variable_entries + num_monster_entries + num_large_entries), + expected); } if (pass) { - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 12, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__DIRTIED_FLAG, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_deserialized */ true, - /* expected_serialized */ false, - /* expected_destroyed */ false); - } + /* load another large entry. (VET, 6) should be evicted. + * + * The following table shows the expected states of the variable + * size entries after the test. + * + * in + * entry: cache? size: dirty? pinned? pins: flush operations: + * + * (VET, 0) Y 10 KB Y N - - + * + * (VET, 1) N 2.5 KB N N - - + * + * (VET, 2) N 10 KB N N - - + * + * (VET, 3) N 2.5 KB N N - - + * + * (VET, 4) N 10 KB N N - - + * + * (VET, 5) N 5 KB N N - - + * + * (VET, 6) N 5 KB N N - - + * + * (VET, 7) Y 5 KB N N 9 - + * + * (VET, 8) N 10 KB N N - - + * + * (VET, 9) Y 10 KB N Y - dirty (VET, 8) + * + * Start by updating the expected table for the expected changes in entry status: + */ - if (pass) { + expected[6].in_cache = false; + expected[6].destroyed = true; - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 13, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_INVALIDATE_FLAG, - /* expected_deserialized */ true, - /* expected_serialized */ false, - /* expected_destroyed */ true); - } + num_large_entries = 9; - if (pass) { + for (i = 8; i < 9; i++) { + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); + } - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 14, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__DIRTIED_FLAG, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_INVALIDATE_FLAG, - /* expected_deserialized */ true, - /* expected_serialized */ true, - /* expected_destroyed */ true); - } + /* verify cache size */ + if ((cache_ptr->index_len != 43) || + (cache_ptr->index_size != (2 * 1024 * 1024) - (3 * VARIABLE_ENTRY_SIZE) - + (VARIABLE_ENTRY_SIZE / 2) + (8 * LARGE_ENTRY_SIZE)) || + (cache_ptr->index_size != ((1 * VARIABLE_ENTRY_SIZE / 2) + (2 * VARIABLE_ENTRY_SIZE) + + (31 * MONSTER_ENTRY_SIZE) + (9 * LARGE_ENTRY_SIZE)))) { - if (pass) { + pass = false; + failure_mssg = "unexpected size/len in flush op eviction test 8."; + } - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 15, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG | - H5C__FLUSH_MARKED_ENTRIES_FLAG, - /* expected_deserialized */ true, - /* expected_serialized */ false, - /* expected_destroyed */ true); + /* verify entry status */ + verify_entry_status(cache_ptr, 6, (num_variable_entries + num_monster_entries + num_large_entries), + expected); } if (pass) { - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 16, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__DIRTIED_FLAG, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG | - H5C__FLUSH_MARKED_ENTRIES_FLAG, - /* expected_deserialized */ true, - /* expected_serialized */ false, - /* expected_destroyed */ true); - } + /* Load another large entry. + * + * (VET, 7) should be evicted, and (VET, 9) should be unpinned. + * + * The following table shows the expected states of the variable + * size entries after the test. + * + * in + * entry: cache? size: dirty? pinned? pins: flush operations: + * + * (VET, 0) Y 10 KB Y N - - + * + * (VET, 1) N 2.5 KB N N - - + * + * (VET, 2) N 10 KB N N - - + * + * (VET, 3) N 2.5 KB N N - - + * + * (VET, 4) N 10 KB N N - - + * + * (VET, 5) N 5 KB N N - - + * + * (VET, 6) N 5 KB N N - - + * + * (VET, 7) N 5 KB N N - - + * + * (VET, 8) N 10 KB N N - - + * + * (VET, 9) Y 10 KB Y N - dirty (VET, 8) + * + * Start by updating the expected table for the expected changes in entry status: + */ - if (pass) { + expected[7].in_cache = false; + expected[7].destroyed = true; + expected[9].is_pinned = false; - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 17, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__NO_FLAGS_SET, - /* expected_deserialized */ true, - /* expected_serialized */ false, - /* expected_destroyed */ false); - } + num_large_entries = 10; - if (pass) { + for (i = 9; i < 10; i++) { + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); + } - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 18, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__NO_FLAGS_SET, - /* expected_deserialized */ true, - /* expected_serialized */ true, - /* expected_destroyed */ false); - } + /* verify cache size */ + if ((cache_ptr->index_len != 43) || + (cache_ptr->index_size != + (2 * 1024 * 1024) - (4 * VARIABLE_ENTRY_SIZE) + (9 * LARGE_ENTRY_SIZE)) || + (cache_ptr->index_size != + ((2 * VARIABLE_ENTRY_SIZE) + (31 * MONSTER_ENTRY_SIZE) + (10 * LARGE_ENTRY_SIZE)))) { - if (pass) { + pass = false; + failure_mssg = "unexpected size/len in flush op eviction test 9."; + } - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 19, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_deserialized */ true, - /* expected_serialized */ false, - /* expected_destroyed */ false); + /* verify entry status */ + verify_entry_status(cache_ptr, 7, (num_variable_entries + num_monster_entries + num_large_entries), + expected); } if (pass) { - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 20, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_deserialized */ true, - /* expected_serialized */ false, - /* expected_destroyed */ false); + /* Again, touch all the non VARIABLE_ENTRY_TYPE entries in the + * cache to bring all the VARIABLE_ENTRY_TYPE entries to the + * end of the LRU list. + * + * Both (VET, 0) and (VET, 7) have been unpinned, so they are + * now in the LRU list. + */ + for (i = 0; i < 31; i++) { + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); + } + + for (i = 0; i < 10; i++) { + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); + } + + /* verify cache size */ + if ((cache_ptr->index_len != 43) || + (cache_ptr->index_size != + (2 * 1024 * 1024) - (4 * VARIABLE_ENTRY_SIZE) + (9 * LARGE_ENTRY_SIZE)) || + (cache_ptr->index_size != + ((2 * VARIABLE_ENTRY_SIZE) + (31 * MONSTER_ENTRY_SIZE) + (10 * LARGE_ENTRY_SIZE)))) { + + pass = false; + failure_mssg = "unexpected size/len in flush op eviction test 10."; + } + + /* verify entry status */ + verify_entry_status(cache_ptr, 8, (num_variable_entries + num_monster_entries + num_large_entries), + expected); } if (pass) { - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 21, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG, - /* expected_deserialized */ true, - /* expected_serialized */ false, - /* expected_destroyed */ true); - } + /* load two more large entries. Things get a bit complicated here, + * so I'll go through the operation step by step. + * + * Initially, the cache has 4 KB of empty space, so the first entry + * (LET, 10) is loaded via calls to H5C_protect() H5C_unprotect() + * without causing any evictions. + * + * However, this is not the case for the call of H5C_protect() on + * (LET, 11). + * + * Before inserting (LET, 11), H5C_protect(LET, 11) must try to + * free up at least 4 KB of space. To do this, it starts scanning + * up the LRU list to find entries to evict. + * + * (VET, 0) is at the bottom of the LRU list, and thus is the first + * entry considered. However, it is dirty, so it flushed to disk, + * moved to the top of the LRU list, and marked clean. + * + * (VET, 9) is the next entry on the bottom of the LRU list. It is + * dirty too, calls its serialize callback function to construct an + * on disk image of the entry, and moves it to the top of the LRU + * list after the serialize callback returns. + * + * However, (VET 9)'s serialize function needs to modify (VET, 8), + * which is currently not in cache. Thus it calls H5C_protect(VET, 8) + * to gain access to it. H5C_protect(VET, 8) loads (VET, 8), and + * then attempts to evict entries to make space for it. + * + * However, H5C_make_space_in_cache() now exits without taking + * any action on re-entrant calls. Thus H5C_protect(VET, 8) simply + * loads the entry into the cache -- resulting in a cache that is + * 10 KB oversize. The subsequent unprotect puts (VET, 8) at the + * head of the LRU and marks it dirty. + * + * After (VET, 9) is serialized, it is flushed, and moved to the + * head of the LRU. + * + * At this point, the H5C_make_space_in_cache() call made by + * H5C_protect(LET, 11) now has 14 KB of space to make. + * + * The next entries on the LRU are (MET, 0) thru (MET, 30), + * (LET, 0) thru (LET, 10), and (VET, 8) -- all of which are dirty, + * and are therefore flushed and moved to the head of the LRU list. + * + * The next entry on the bottom of the LRU list is (VET, 0), which + * is clean, and is therefore evicted, leaving H5C_make_space_in_cache() + * with 4 KB of space to create. + * + * This space is sufficient, so H5C_protect(VET, 8) inserts + * (VET, 8) into the cache's index, marks it as protected, and + * returns to the serialize function for (VET, 9). + * + * When the serialize function for (VET, 9) is done with (VET, 8), it + * calls H5C_unprotect(VET, 8), which marks (VET, 8) as dirty and + * unprotected, and places it at the head of the LRU. + * + * (VET, 0) is the next item on the LRU -- it is clean and is therefore + * evicted -- leaving 6 KB of free space after (LET, 11) is inserted + * into the cache. + * + * H5C_unprotect(LET, 11) marks (LET, 11) as unprotected, and then + * returns as well. + * + * The following table shows the expected states of the variable + * size entries after the test. + * + * in + * entry: cache? size: dirty? pinned? pins: flush operations: + * + * (VET, 0) N 10 KB N N - - + * + * (VET, 1) N 2.5 KB N N - - + * + * (VET, 2) N 10 KB N N - - + * + * (VET, 3) N 2.5 KB N N - - + * + * (VET, 4) N 10 KB N N - - + * + * (VET, 5) N 5 KB N N - - + * + * (VET, 6) N 5 KB N N - - + * + * (VET, 7) N 5 KB N N - - + * + * (VET, 8) Y 10 KB N N - - + * + * (VET, 9) N 10 KB N N - - + * + * Start by updating the expected table for the expected changes in + * entry status: + * + * Note that we reset the loaded, flushed, and destroyed + * fields of (VET,8) so we can track what is happening. + */ + base_addr = entries[VARIABLE_ENTRY_TYPE]; + entry_ptr = &(base_addr[8]); + entry_ptr->deserialized = false; + entry_ptr->deserialized = false; + entry_ptr->destroyed = false; - if (pass) { + expected[0].in_cache = false; + expected[0].is_dirty = false; + expected[0].serialized = true; + expected[0].destroyed = true; + expected[8].in_cache = true; + expected[8].is_dirty = false; + expected[8].deserialized = true; + expected[8].serialized = true; + expected[8].destroyed = false; + expected[9].in_cache = false; + expected[9].is_dirty = false; + expected[9].serialized = true; + expected[9].destroyed = true; - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 22, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG, - /* expected_deserialized */ true, - /* expected_serialized */ true, - /* expected_destroyed */ true); - } + expected[10].in_cache = true; + expected[10].is_dirty = false; + expected[10].serialized = true; + expected[10].destroyed = false; - if (pass) { + num_large_entries = 12; - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 23, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG, - /* expected_deserialized */ true, - /* expected_serialized */ false, - /* expected_destroyed */ false); - } + for (i = num_variable_entries; i < num_variable_entries + num_monster_entries + num_large_entries - 1; + i++) { + expected[i].is_dirty = false; + expected[i].serialized = true; + } - if (pass) { + for (i = 10; i < 12; i++) { + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); + } - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 24, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG, - /* expected_deserialized */ true, - /* expected_serialized */ true, - /* expected_destroyed */ false); - } + /* verify cache size */ + if ((cache_ptr->index_len != 44) || + (cache_ptr->index_size != (2 * 1024 * 1024) - (2 * 1024) - (1 * LARGE_ENTRY_SIZE)) || + (cache_ptr->index_size != + ((1 * VARIABLE_ENTRY_SIZE) + (31 * MONSTER_ENTRY_SIZE) + (12 * LARGE_ENTRY_SIZE)))) { - if (pass) { + pass = false; + failure_mssg = "unexpected size/len in flush op eviction test 11."; + } - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 25, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_deserialized */ true, - /* expected_serialized */ false, - /* expected_destroyed */ true); + /* verify entry status */ + verify_entry_status(cache_ptr, 9, (num_variable_entries + num_monster_entries + num_large_entries), + expected); } if (pass) { - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 26, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_deserialized */ true, - /* expected_serialized */ false, - /* expected_destroyed */ true); - } + /* protect and unprotect VET 9 to evict MET 0 */ + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 9); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 9, H5C__NO_FLAGS_SET); - if (pass) { + /* protect and unprotect VET 8 to dirty it and move it to the + * top of the LRU. Since we are dirtying it again, reset its + * serialized flag. + */ + base_addr = entries[VARIABLE_ENTRY_TYPE]; + entry_ptr = &(base_addr[8]); + entry_ptr->serialized = false; - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 27, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_deserialized */ true, - /* expected_serialized */ false, - /* expected_destroyed */ false); - } + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 8); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 8, H5C__DIRTIED_FLAG); - if (pass) { + /* Again, touch all the non VARIABLE_ENTRY_TYPE entries in the + * cache to evict VET 9 and move VET 8 to the bottom of the LRU. + * + * Must do this twice to get the desired result. + */ - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 28, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_deserialized */ true, - /* expected_serialized */ false, - /* expected_destroyed */ false); - } + /* skip MET 0 in first pass so that we evict VET 9 when we + * reload MET 0 + * + * Since we are reloading MET 0, reset its destroyed flag. + */ + base_addr = entries[MONSTER_ENTRY_TYPE]; + entry_ptr = &(base_addr[0]); + entry_ptr->destroyed = false; - if (pass) { + for (i = 1; i < num_monster_entries; i++) { + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); + } - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 29, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_INVALIDATE_FLAG, - /* expected_deserialized */ true, - /* expected_serialized */ false, - /* expected_destroyed */ true); - } + for (i = 0; i < num_large_entries; i++) { + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); + } - if (pass) { + for (i = 0; i < num_monster_entries; i++) { + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); + } - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 30, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_INVALIDATE_FLAG, - /* expected_deserialized */ true, - /* expected_serialized */ true, - /* expected_destroyed */ true); - } + for (i = 0; i < num_large_entries; i++) { + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); + } - if (pass) { + /* update the expected array to mark all these entries dirty again. */ + for (i = num_variable_entries; i < num_variable_entries + num_monster_entries + num_large_entries - 1; + i++) { + expected[i].is_dirty = true; + } - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 31, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG | - H5C__FLUSH_MARKED_ENTRIES_FLAG, - /* expected_deserialized */ true, - /* expected_serialized */ false, - /* expected_destroyed */ true); - } + /* update MET 0 to set its in cache flag, and reset + * its destroyed flag + */ + expected[10].in_cache = true; - if (pass) { + /* pass through non variable entries will flush VET 8, and evict VET 9. + * Update accordingly. + */ + expected[8].in_cache = true; + expected[8].is_dirty = true; + expected[8].serialized = false; + expected[8].destroyed = false; + expected[9].in_cache = false; + expected[9].is_dirty = false; + expected[9].serialized = true; + expected[9].destroyed = true; - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 32, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ false, - /* flags */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG | - H5C__FLUSH_MARKED_ENTRIES_FLAG, - /* expected_deserialized */ true, - /* expected_serialized */ false, - /* expected_destroyed */ true); - } + /* verify cache size */ + if ((cache_ptr->index_len != 44) || + (cache_ptr->index_size != + (2 * 1024 * 1024) - (5 * VARIABLE_ENTRY_SIZE) + (11 * LARGE_ENTRY_SIZE)) || + (cache_ptr->index_size != + ((1 * VARIABLE_ENTRY_SIZE) + (31 * MONSTER_ENTRY_SIZE) + (12 * LARGE_ENTRY_SIZE)))) { - if (pass) { + pass = false; + failure_mssg = "unexpected size/len in flush op eviction test 12."; + } - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 33, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ true, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__NO_FLAGS_SET, - /* expected_deserialized */ false, - /* expected_serialized */ true, - /* expected_destroyed */ false); + /* modifications to the H5C__flush_single_entry() function have + * changed the behavior of the cache slightly, causing + * this test to fail. Comment out for now -- come back and + * fix if all goes well. + */ + + /* verify entry status */ + verify_entry_status(cache_ptr, 10, (num_variable_entries + num_monster_entries + num_large_entries), + expected); } if (pass) { - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 34, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ true, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__NO_FLAGS_SET, - /* expected_deserialized */ false, - /* expected_serialized */ true, - /* expected_destroyed */ false); - } + /* Load two more large entries. + * + * Since (VET, 8) is dirty, at first this will just cause (VET, 8) + * to be flushed. + * + * But all other entries in the cache are dirty, so the cache will + * flush them all, and then evict (VET, 8) on the second pass. + * + * The following table shows the expected states of the variable + * size entries after the test. + * + * in + * entry: cache? size: dirty? pinned? pins: flush operations: + * + * (VET, 0) N 10 KB N N - - + * + * (VET, 1) N 2.5 KB N N - - + * + * (VET, 2) N 10 KB N N - - + * + * (VET, 3) N 2.5 KB N N - - + * + * (VET, 4) N 10 KB N N - - + * + * (VET, 5) N 5 KB N N - - + * + * (VET, 6) N 5 KB N N - - + * + * (VET, 7) N 5 KB N N - - + * + * (VET, 8) N 10 KB N N - - + * + * (VET, 9) N 10 KB N N - - + * + * Start by updating the expected table for the expected changes in + * entry status: + */ - if (pass) { + expected[8].in_cache = false; + expected[8].is_dirty = false; + expected[8].serialized = true; + expected[8].destroyed = true; - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 35, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ true, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_deserialized */ false, - /* expected_serialized */ false, - /* expected_destroyed */ false); - } + num_large_entries = 14; - if (pass) { + /* a newly loaded entry is not inserted in the cache until after + * space has been made for it. Thus (LET, 13) will not be flushed. + */ + for (i = num_variable_entries; i < num_variable_entries + num_monster_entries + num_large_entries - 1; + i++) { + expected[i].is_dirty = false; + expected[i].serialized = true; + } - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 36, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ true, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_deserialized */ false, - /* expected_serialized */ false, - /* expected_destroyed */ false); - } + for (i = 12; i < 14; i++) { + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); + } - if (pass) { + /* verify cache size */ + if ((cache_ptr->index_len != 45) || + (cache_ptr->index_size != + (2 * 1024 * 1024) - (6 * VARIABLE_ENTRY_SIZE) + (13 * LARGE_ENTRY_SIZE)) || + (cache_ptr->index_size != ((31 * MONSTER_ENTRY_SIZE) + (14 * LARGE_ENTRY_SIZE)))) { - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 37, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ true, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG, - /* expected_deserialized */ false, - /* expected_serialized */ true, - /* expected_destroyed */ true); - } + pass = false; + failure_mssg = "unexpected size/len in flush op eviction test 13."; + } - if (pass) { + /* modifications to the H5C__flush_single_entry() function have + * changed the behavior of the cache slightly, causing + * this test to fail. Comment out for now -- come back and + * fix if all goes well. + */ - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 38, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ true, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG, - /* expected_deserialized */ false, - /* expected_serialized */ true, - /* expected_destroyed */ true); + /* verify entry status */ + verify_entry_status(cache_ptr, 11, (num_variable_entries + num_monster_entries + num_large_entries), + expected); } + /* at this point we have cycled all the variable size entries through + * the cache. + * + * flush the cache and end the test. + */ + if (pass) { - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 39, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ true, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG, - /* expected_deserialized */ false, - /* expected_serialized */ false, - /* expected_destroyed */ false); - } + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, + "Cache flush invalidate failed after flush op eviction test") - if (pass) { + if ((pass) && ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0))) { - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 40, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ true, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG, - /* expected_deserialized */ false, - /* expected_serialized */ false, - /* expected_destroyed */ false); + pass = false; + failure_mssg = "Unexpected cache len/size after cleanup of flush op eviction test"; + } } +#if H5C_COLLECT_CACHE_STATS + /* If we are collecting stats, check to see if we get the expected + * values. + * + * Testing the stats code is fairly new, but given the extent + * to which I find myself depending on the stats, I've decided + * to start testing the stats whenever it is convenient to do + * so. + */ if (pass) { - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 41, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ true, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_deserialized */ false, - /* expected_serialized */ false, - /* expected_destroyed */ true); + if ((cache_ptr->insertions[VARIABLE_ENTRY_TYPE] != 0) || + (cache_ptr->pinned_insertions[VARIABLE_ENTRY_TYPE] != 0) || + (cache_ptr->clears[VARIABLE_ENTRY_TYPE] != 0) || (cache_ptr->flushes[VARIABLE_ENTRY_TYPE] != 9) || + (cache_ptr->evictions[VARIABLE_ENTRY_TYPE] != 12) || + (cache_ptr->take_ownerships[VARIABLE_ENTRY_TYPE] != 0) || + (cache_ptr->moves[VARIABLE_ENTRY_TYPE] != 1) || + (cache_ptr->entry_flush_moves[VARIABLE_ENTRY_TYPE] != 0) || + (cache_ptr->cache_flush_moves[VARIABLE_ENTRY_TYPE] != 0) || + (cache_ptr->pins[VARIABLE_ENTRY_TYPE] != 2) || (cache_ptr->unpins[VARIABLE_ENTRY_TYPE] != 2) || + (cache_ptr->dirty_pins[VARIABLE_ENTRY_TYPE] != 2) || + (cache_ptr->pinned_flushes[VARIABLE_ENTRY_TYPE] != 0) || + (cache_ptr->pinned_clears[VARIABLE_ENTRY_TYPE] != 0) || + (cache_ptr->size_increases[VARIABLE_ENTRY_TYPE] != 3) || + (cache_ptr->size_decreases[VARIABLE_ENTRY_TYPE] != 6) || + (cache_ptr->entry_flush_size_changes[VARIABLE_ENTRY_TYPE] != 1) || + (cache_ptr->cache_flush_size_changes[VARIABLE_ENTRY_TYPE] != 0)) { + + pass = false; + failure_mssg = + "Unexpected variable size entry stats in check_flush_cache__flush_op_eviction_test()."; + } } if (pass) { - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 42, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ true, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_deserialized */ false, - /* expected_serialized */ false, - /* expected_destroyed */ true); + if ((cache_ptr->insertions[LARGE_ENTRY_TYPE] != 0) || + (cache_ptr->pinned_insertions[LARGE_ENTRY_TYPE] != 0) || + (cache_ptr->clears[LARGE_ENTRY_TYPE] != 0) || (cache_ptr->flushes[LARGE_ENTRY_TYPE] != 25) || + (cache_ptr->evictions[LARGE_ENTRY_TYPE] != 14) || + (cache_ptr->take_ownerships[LARGE_ENTRY_TYPE] != 0) || + (cache_ptr->moves[LARGE_ENTRY_TYPE] != 0) || + (cache_ptr->entry_flush_moves[LARGE_ENTRY_TYPE] != 0) || + (cache_ptr->cache_flush_moves[LARGE_ENTRY_TYPE] != 0) || + (cache_ptr->pins[LARGE_ENTRY_TYPE] != 0) || (cache_ptr->unpins[LARGE_ENTRY_TYPE] != 0) || + (cache_ptr->dirty_pins[LARGE_ENTRY_TYPE] != 0) || + (cache_ptr->pinned_flushes[LARGE_ENTRY_TYPE] != 0) || + (cache_ptr->pinned_clears[LARGE_ENTRY_TYPE] != 0) || + (cache_ptr->size_increases[LARGE_ENTRY_TYPE] != 0) || + (cache_ptr->size_decreases[LARGE_ENTRY_TYPE] != 0) || + (cache_ptr->entry_flush_size_changes[LARGE_ENTRY_TYPE] != 0) || + (cache_ptr->cache_flush_size_changes[LARGE_ENTRY_TYPE] != 0)) { + + pass = false; + failure_mssg = "Unexpected large entry stats in check_flush_cache__flush_op_eviction_test()."; + } } if (pass) { - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 43, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ true, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_deserialized */ false, - /* expected_serialized */ false, - /* expected_destroyed */ false); + if ((cache_ptr->insertions[MONSTER_ENTRY_TYPE] != 0) || + (cache_ptr->pinned_insertions[MONSTER_ENTRY_TYPE] != 0) || + (cache_ptr->clears[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->flushes[MONSTER_ENTRY_TYPE] != 62) || + (cache_ptr->evictions[MONSTER_ENTRY_TYPE] != 32) || + (cache_ptr->take_ownerships[MONSTER_ENTRY_TYPE] != 0) || + (cache_ptr->moves[MONSTER_ENTRY_TYPE] != 0) || + (cache_ptr->entry_flush_moves[MONSTER_ENTRY_TYPE] != 0) || + (cache_ptr->cache_flush_moves[MONSTER_ENTRY_TYPE] != 0) || + (cache_ptr->pins[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->unpins[MONSTER_ENTRY_TYPE] != 0) || + (cache_ptr->dirty_pins[MONSTER_ENTRY_TYPE] != 0) || + (cache_ptr->pinned_flushes[MONSTER_ENTRY_TYPE] != 0) || + (cache_ptr->pinned_clears[MONSTER_ENTRY_TYPE] != 0) || + (cache_ptr->size_increases[MONSTER_ENTRY_TYPE] != 0) || + (cache_ptr->size_decreases[MONSTER_ENTRY_TYPE] != 0) || + (cache_ptr->entry_flush_size_changes[MONSTER_ENTRY_TYPE] != 0) || + (cache_ptr->cache_flush_size_changes[MONSTER_ENTRY_TYPE] != 0)) { + + pass = false; + failure_mssg = "Unexpected monster entry stats in check_flush_cache__flush_op_eviction_test()."; + } } +#endif /* H5C_COLLECT_CACHE_STATS */ if (pass) { - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 44, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ true, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_deserialized */ false, - /* expected_serialized */ false, - /* expected_destroyed */ false); + reset_entries(); } - if (pass) { + free(expected); - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 45, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ true, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_INVALIDATE_FLAG, - /* expected_deserialized */ false, - /* expected_serialized */ true, - /* expected_destroyed */ true); - } +} /* check_flush_cache__flush_op_eviction_test() */ - if (pass) { +/*------------------------------------------------------------------------- + * Function: check_flush_cache__single_entry() + * + * Purpose: Verify that flush_cache behaves as expected when the cache + * contains only one element. + * + * Return: void + * + *------------------------------------------------------------------------- + */ - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 46, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ true, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_INVALIDATE_FLAG, - /* expected_deserialized */ false, - /* expected_serialized */ true, - /* expected_destroyed */ true); - } +static void +check_flush_cache__single_entry(H5F_t *file_ptr) +{ + H5C_t *cache_ptr = file_ptr->shared->cache; - if (pass) { + if (cache_ptr == NULL) { - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 47, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ true, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG | - H5C__FLUSH_MARKED_ENTRIES_FLAG, - /* expected_deserialized */ false, - /* expected_serialized */ false, - /* expected_destroyed */ true); + pass = false; + failure_mssg = "cache_ptr NULL on entry to single entry case."; } + else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) { - if (pass) { - - check_flush_cache__single_entry_test( - /* file_ptr */ file_ptr, - /* test_num */ 48, - /* entry_type */ PICO_ENTRY_TYPE, - /* entry_idx */ 0, - /* insert_flag */ true, - /* flags */ H5C__NO_FLAGS_SET, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG | - H5C__FLUSH_MARKED_ENTRIES_FLAG, - /* expected_deserialized */ false, - /* expected_serialized */ false, - /* expected_destroyed */ true); + pass = false; + failure_mssg = "cache not empty at beginning of single entry case."; } if (pass) { check_flush_cache__single_entry_test( /* file_ptr */ file_ptr, - /* test_num */ 49, + /* test_num */ 1, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, - /* insert_flag */ true, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* insert_flag */ false, + /* flags */ H5C__NO_FLAGS_SET, /* flush_flags */ H5C__NO_FLAGS_SET, - /* expected_deserialized */ false, - /* expected_serialized */ true, + /* expected_deserialized */ true, + /* expected_serialized */ false, /* expected_destroyed */ false); } @@ -10286,13 +8843,13 @@ check_flush_cache__single_entry(H5F_t *file_ptr) check_flush_cache__single_entry_test( /* file_ptr */ file_ptr, - /* test_num */ 50, + /* test_num */ 2, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, - /* insert_flag */ true, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* insert_flag */ false, + /* flags */ H5C__DIRTIED_FLAG, /* flush_flags */ H5C__NO_FLAGS_SET, - /* expected_deserialized */ false, + /* expected_deserialized */ true, /* expected_serialized */ true, /* expected_destroyed */ false); } @@ -10301,13 +8858,13 @@ check_flush_cache__single_entry(H5F_t *file_ptr) check_flush_cache__single_entry_test( /* file_ptr */ file_ptr, - /* test_num */ 51, + /* test_num */ 3, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, - /* insert_flag */ true, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* insert_flag */ false, + /* flags */ H5C__NO_FLAGS_SET, /* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_deserialized */ false, + /* expected_deserialized */ true, /* expected_serialized */ false, /* expected_destroyed */ false); } @@ -10316,13 +8873,13 @@ check_flush_cache__single_entry(H5F_t *file_ptr) check_flush_cache__single_entry_test( /* file_ptr */ file_ptr, - /* test_num */ 52, + /* test_num */ 4, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, - /* insert_flag */ true, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* insert_flag */ false, + /* flags */ H5C__DIRTIED_FLAG, /* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG, - /* expected_deserialized */ false, + /* expected_deserialized */ true, /* expected_serialized */ false, /* expected_destroyed */ false); } @@ -10331,14 +8888,14 @@ check_flush_cache__single_entry(H5F_t *file_ptr) check_flush_cache__single_entry_test( /* file_ptr */ file_ptr, - /* test_num */ 53, + /* test_num */ 5, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, - /* insert_flag */ true, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* insert_flag */ false, + /* flags */ H5C__NO_FLAGS_SET, /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG, - /* expected_deserialized */ false, - /* expected_serialized */ true, + /* expected_deserialized */ true, + /* expected_serialized */ false, /* expected_destroyed */ true); } @@ -10346,13 +8903,13 @@ check_flush_cache__single_entry(H5F_t *file_ptr) check_flush_cache__single_entry_test( /* file_ptr */ file_ptr, - /* test_num */ 54, + /* test_num */ 6, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, - /* insert_flag */ true, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, + /* insert_flag */ false, + /* flags */ H5C__DIRTIED_FLAG, /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG, - /* expected_deserialized */ false, + /* expected_deserialized */ true, /* expected_serialized */ true, /* expected_destroyed */ true); } @@ -10361,72 +8918,72 @@ check_flush_cache__single_entry(H5F_t *file_ptr) check_flush_cache__single_entry_test( /* file_ptr */ file_ptr, - /* test_num */ 55, + /* test_num */ 7, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, - /* insert_flag */ true, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG, - /* expected_deserialized */ false, - /* expected_serialized */ true, - /* expected_destroyed */ false); + /* insert_flag */ false, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, + /* expected_deserialized */ true, + /* expected_serialized */ false, + /* expected_destroyed */ true); } if (pass) { check_flush_cache__single_entry_test( /* file_ptr */ file_ptr, - /* test_num */ 56, + /* test_num */ 8, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, - /* insert_flag */ true, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG, - /* expected_deserialized */ false, - /* expected_serialized */ true, - /* expected_destroyed */ false); + /* insert_flag */ false, + /* flags */ H5C__DIRTIED_FLAG, + /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, + /* expected_deserialized */ true, + /* expected_serialized */ false, + /* expected_destroyed */ true); } if (pass) { check_flush_cache__single_entry_test( /* file_ptr */ file_ptr, - /* test_num */ 57, + /* test_num */ 9, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, /* insert_flag */ true, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__NO_FLAGS_SET, /* expected_deserialized */ false, - /* expected_serialized */ false, - /* expected_destroyed */ true); + /* expected_serialized */ true, + /* expected_destroyed */ false); } if (pass) { check_flush_cache__single_entry_test( /* file_ptr */ file_ptr, - /* test_num */ 58, + /* test_num */ 10, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, /* insert_flag */ true, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__NO_FLAGS_SET, /* expected_deserialized */ false, - /* expected_serialized */ false, - /* expected_destroyed */ true); + /* expected_serialized */ true, + /* expected_destroyed */ false); } if (pass) { check_flush_cache__single_entry_test( /* file_ptr */ file_ptr, - /* test_num */ 59, + /* test_num */ 11, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, /* insert_flag */ true, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG, /* expected_deserialized */ false, /* expected_serialized */ false, /* expected_destroyed */ false); @@ -10436,12 +8993,12 @@ check_flush_cache__single_entry(H5F_t *file_ptr) check_flush_cache__single_entry_test( /* file_ptr */ file_ptr, - /* test_num */ 60, + /* test_num */ 12, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, /* insert_flag */ true, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG, /* expected_deserialized */ false, /* expected_serialized */ false, /* expected_destroyed */ false); @@ -10451,12 +9008,12 @@ check_flush_cache__single_entry(H5F_t *file_ptr) check_flush_cache__single_entry_test( /* file_ptr */ file_ptr, - /* test_num */ 61, + /* test_num */ 13, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, /* insert_flag */ true, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_INVALIDATE_FLAG, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG, /* expected_deserialized */ false, /* expected_serialized */ true, /* expected_destroyed */ true); @@ -10466,12 +9023,12 @@ check_flush_cache__single_entry(H5F_t *file_ptr) check_flush_cache__single_entry_test( /* file_ptr */ file_ptr, - /* test_num */ 62, + /* test_num */ 14, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, /* insert_flag */ true, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_INVALIDATE_FLAG, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG, /* expected_deserialized */ false, /* expected_serialized */ true, /* expected_destroyed */ true); @@ -10481,13 +9038,12 @@ check_flush_cache__single_entry(H5F_t *file_ptr) check_flush_cache__single_entry_test( /* file_ptr */ file_ptr, - /* test_num */ 63, + /* test_num */ 15, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, /* insert_flag */ true, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG | - H5C__FLUSH_MARKED_ENTRIES_FLAG, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, /* expected_deserialized */ false, /* expected_serialized */ false, /* expected_destroyed */ true); @@ -10497,13 +9053,12 @@ check_flush_cache__single_entry(H5F_t *file_ptr) check_flush_cache__single_entry_test( /* file_ptr */ file_ptr, - /* test_num */ 64, + /* test_num */ 16, /* entry_type */ PICO_ENTRY_TYPE, /* entry_idx */ 0, /* insert_flag */ true, - /* flags */ H5C__SET_FLUSH_MARKER_FLAG, - /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG | - H5C__FLUSH_MARKED_ENTRIES_FLAG, + /* flags */ H5C__NO_FLAGS_SET, + /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, /* expected_deserialized */ false, /* expected_serialized */ false, /* expected_destroyed */ true); @@ -10523,13 +9078,9 @@ check_flush_cache__single_entry(H5F_t *file_ptr) * * 5) Marked dirty by call to H5C_mark_entry_dirty() while pinned or not. * - * 6) Entry marked for flush or not. - * - * 7) Call flush with H5C__FLUSH_MARKED_ENTRIES_FLAG or not. + * 6) Call flush with H5C__FLUSH_CLEAR_ONLY_FLAG or not. * - * 8) Call flush with H5C__FLUSH_CLEAR_ONLY_FLAG or not. - * - * This yields a total of 256 tests. + * This yields a total of 64 tests. * * The tests and their expected results are given in the spec table * below. The values assigned to the expected_serialized, @@ -10548,24 +9099,10 @@ check_flush_cache__single_entry(H5F_t *file_ptr) * was adapted from, and it doesn't do any particular harm. * * In general, we expect an entry to be flushed if it is dirty, and - * flush in invoked WITHOUT the H5C__FLUSH_CLEAR_ONLY_FLAG. However, - * there are exceptions: If flush is invoked with the - * H5C__FLUSH_MARKED_ENTRIES_FLAG, only marked entries will be flushed. - * - * Further, unprotecting an entry with the H5C__SET_FLUSH_MARKER_FLAG - * will NOT mark the entry unless the entry has either been marked - * dirty either before or durting the unprotect call. This results in - * some counterintuitive entries in the table. It make be useful to - * look in the test code to see the exact order of operations. + * flush in invoked WITHOUT the H5C__FLUSH_CLEAR_ONLY_FLAG. * * Similarly, we expect an entry to be cleared if it is dirty, and - * flush is invoked WITH the H5C__FLUSH_CLEAR_ONLY_FLAG. Again, there - * are exceptions -- If flush is also invoked with the - * H5C__FLUSH_MARKED_ENTRIES_FLAG, only the marked entries will be - * cleared. - * - * The above comments about applying unprotect with the - * H5C__SET_FLUSH_MARKER_FLAG apply here as well. + * flush is invoked WITH the H5C__FLUSH_CLEAR_ONLY_FLAG. */ if (pass) { @@ -10573,14 +9110,14 @@ check_flush_cache__single_entry(H5F_t *file_ptr) struct pinned_single_entry_test_spec *spec = NULL; size_t i; - spec = malloc(256 * sizeof(struct pinned_single_entry_test_spec)); + spec = malloc(64 * sizeof(struct pinned_single_entry_test_spec)); if (spec == NULL) { pass = false; failure_mssg = "couldn't allocated pinned single entry test spec array"; } - for (i = 0; i < 256; i++) { + for (i = 0; i < 64; i++) { int test_num; int entry_type; int entry_idx; @@ -10605,32 +9142,20 @@ check_flush_cache__single_entry(H5F_t *file_ptr) pop_mark_dirty_pinned = (i / 2) % 2; unprotect_unpin = i % 2; - /* Generate alternating sequences of H5C__NO_FLAGS_SET - * and H5C__SET_FLUSH_MARKER_FLAG + /* Flags are not used for this test */ - if ((i / 32) % 2) - flags = H5C__SET_FLUSH_MARKER_FLAG; - else - flags = H5C__NO_FLAGS_SET; + flags = H5C__NO_FLAGS_SET; /* - * Generate sequences of H5C__NO_FLAGS_SET, - * H5C__FLUSH_MARKED_ENTRIES_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG - * and H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG + * Generate sequences of H5C__NO_FLAGS_SET, and H5C__FLUSH_CLEAR_ONLY_FLAG */ - switch (i / 64) { + switch (i / 32) { case 0: flush_flags = H5C__NO_FLAGS_SET; break; case 1: - flush_flags = H5C__FLUSH_MARKED_ENTRIES_FLAG; - break; - case 2: flush_flags = H5C__FLUSH_CLEAR_ONLY_FLAG; break; - case 3: - flush_flags = H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG; - break; default: flush_flags = H5C__NO_FLAGS_SET; break; @@ -10638,20 +9163,8 @@ check_flush_cache__single_entry(H5F_t *file_ptr) expected_serialized = false; if (0 == (flush_flags & H5C__FLUSH_CLEAR_ONLY_FLAG)) { - if (flush_flags & H5C__FLUSH_MARKED_ENTRIES_FLAG) { - if (flags & H5C__SET_FLUSH_MARKER_FLAG) { - if (mark_dirty && pop_mark_dirty_prot) { - expected_serialized = true; - } - else if (dirty_flag || pop_mark_dirty_prot) { - expected_serialized = true; - } - } - } - else { - if (dirty_flag || mark_dirty || pop_mark_dirty_prot || pop_mark_dirty_pinned) - expected_serialized = true; - } + if (dirty_flag || mark_dirty || pop_mark_dirty_prot || pop_mark_dirty_pinned) + expected_serialized = true; } expected_destroyed = false; @@ -10673,7 +9186,7 @@ check_flush_cache__single_entry(H5F_t *file_ptr) } i = 0; - while (pass && (i < 256)) { + while (pass && (i < 64)) { check_flush_cache__pinned_single_entry_test( /* file_ptr */ file_ptr, /* test_num */ spec[i].test_num, @@ -13715,7 +12228,7 @@ check_flush_protected_err(unsigned paged) protect_entry(file_ptr, 0, 0); /* enable slist prior to flush */ - if ((pass) && (H5C_set_slist_enabled(cache_ptr, true, false) < 0)) { + if ((pass) && (H5C_set_slist_enabled(cache_ptr, true, true) < 0)) { pass = false; failure_mssg = "unable to enable slist prior to flush.\n"; diff --git a/test/cache_common.h b/test/cache_common.h index a9a8dbb45a9..2e8a4632a57 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -126,11 +126,6 @@ * for it to setup the slist on entry, and take it down * on exit. * - * Note that the slist need not be empty if the flags - * indicate a partial flush (i.e. - * H5C__FLUSH_MARKED_ENTRIES_FLAG). Compute clear_slist - * and pass it into H5C_set_slist_enabled as appropriate. - * * On error, set pass to false, and set failure_mssg * to the supplied error message. * @@ -140,12 +135,9 @@ #define H5C_FLUSH_CACHE(file, flags, fail_mssg) \ { \ - bool clear_slist; \ herr_t rslt; \ \ - clear_slist = ((flags & H5C__FLUSH_MARKED_ENTRIES_FLAG) != 0); \ - \ - rslt = H5C_set_slist_enabled((file)->shared->cache, true, false); \ + rslt = H5C_set_slist_enabled((file)->shared->cache, true, true); \ \ if (rslt >= 0) { \ \ @@ -154,7 +146,7 @@ \ if (rslt >= 0) { \ \ - rslt = H5C_set_slist_enabled((file)->shared->cache, false, clear_slist); \ + rslt = H5C_set_slist_enabled((file)->shared->cache, false, false); \ } \ \ if (rslt < 0) { \ diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 61b1dbe571d..9a86b8ab75d 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -264,10 +264,7 @@ reset_all_entries_investigated(hid_t fid) * * Purpose: Asserts that there is an entry in the specified cache with * the provided entry id and provided tag. The function will - * fail if this is not the case. If found, this function will - * set the entry's flush_marker flag, so future verification - * attempts can skip over this entry, knowing it has already been - * checked. + * fail if this is not the case. * * Return: 0 on Success, -1 on Failure * @@ -328,7 +325,7 @@ evict_entries(hid_t fid) mark_all_entries_investigated(fid); /* setup the skip list prior to calling H5C_flush_cache() */ - if (H5C_set_slist_enabled(f->shared->cache, true, false) < 0) + if (H5C_set_slist_enabled(f->shared->cache, true, true) < 0) TEST_ERROR; /* Evict all we can from the cache to examine full tag creation tree */ @@ -337,8 +334,8 @@ evict_entries(hid_t fid) */ H5C_flush_cache(f, H5C__FLUSH_INVALIDATE_FLAG); - /* shutdown the slist -- allow it to be non-empty */ - if (H5C_set_slist_enabled(f->shared->cache, false, true) < 0) + /* shutdown the slist */ + if (H5C_set_slist_enabled(f->shared->cache, false, false) < 0) TEST_ERROR; return 0; diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index 460c8ae7564..227b0c3bae9 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -450,9 +450,12 @@ test_select_src_subset(char *fname, hid_t fapl, hid_t in_dxpl, unsigned set_fill hsize_t dims[2] = {NX, NY}; hsize_t chunk_dims[2] = {NX / 10, NY / 10}; unsigned char *rew_buf = NULL, *save_rew_buf = NULL, *rbuf = NULL; - int fillvalue = (-1); + stype1 fillvalue; size_t ss, ss1, ss2; + /* Initialize the fill value */ + memset(&fillvalue, 0, sizeof(stype1)); + /* Create the file for this test */ if ((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; @@ -625,9 +628,12 @@ test_select_dst_subset(char *fname, hid_t fapl, hid_t in_dxpl, unsigned set_fill hsize_t dims[2] = {NX, NY}; hsize_t chunk_dims[2] = {NX / 10, NY / 10}; unsigned char *rew_buf = NULL, *save_rew_buf = NULL, *rbuf = NULL; - int fillvalue = (-1); + stype2 fillvalue; size_t ss, ss1, ss2; + /* Initialize the fill value */ + memset(&fillvalue, 0, sizeof(stype2)); + /* Create the file for this test */ if ((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; @@ -810,17 +816,22 @@ test_select_compound(char *fname, hid_t fapl, hid_t in_dxpl, unsigned set_fillva /* Other variables */ unsigned int i; - hid_t fid = H5I_INVALID_HID; - hid_t did = H5I_INVALID_HID; - hid_t sid = H5I_INVALID_HID; - hid_t dcpl = H5I_INVALID_HID; - hid_t dxpl = H5I_INVALID_HID; - hid_t array_dt = H5I_INVALID_HID; - static hsize_t dim[] = {NX, NY}; - int fillvalue = (-1); + hid_t fid = H5I_INVALID_HID; + hid_t did = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hid_t dcpl = H5I_INVALID_HID; + hid_t dxpl = H5I_INVALID_HID; + hid_t array_dt = H5I_INVALID_HID; + static hsize_t dim[] = {NX, NY}; + s1_t fillvalue1; + s7_t fillvalue7; size_t ss = 0, ss1 = 0, ss2 = 0; hsize_t memb_size[1] = {4}; + /* Initialize the fill values */ + memset(&fillvalue1, 0, sizeof(s1_t)); + memset(&fillvalue7, 0, sizeof(s7_t)); + /* Allocate buffers */ if (NULL == (s1 = (s1_t *)calloc(NX * NY, sizeof(s1_t)))) goto error; @@ -900,7 +911,7 @@ test_select_compound(char *fname, hid_t fapl, hid_t in_dxpl, unsigned set_fillva /* Set fill value accordingly */ if (set_fillvalue) { - if (H5Pset_fill_value(dcpl, s1_tid, &fillvalue) < 0) + if (H5Pset_fill_value(dcpl, s1_tid, &fillvalue1) < 0) goto error; } @@ -1022,7 +1033,7 @@ test_select_compound(char *fname, hid_t fapl, hid_t in_dxpl, unsigned set_fillva /* Set fill value accordingly */ if (set_fillvalue) { - if (H5Pset_fill_value(dcpl, s7_tid, &fillvalue) < 0) + if (H5Pset_fill_value(dcpl, s7_tid, &fillvalue7) < 0) goto error; } @@ -1115,6 +1126,7 @@ test_select_compound(char *fname, hid_t fapl, hid_t in_dxpl, unsigned set_fillva /* Release buffers */ free(s1); + free(save_s1); free(s3); free(save_s3); free(rbuf1); @@ -1145,30 +1157,19 @@ test_select_compound(char *fname, hid_t fapl, hid_t in_dxpl, unsigned set_fillva H5E_END_TRY /* Release resources */ - if (s1) - free(s1); - if (s3) - free(s3); - if (save_s3) - free(save_s3); - if (rbuf1) - free(rbuf1); - if (rbuf3) - free(rbuf3); - if (s7) - free(s7); - if (save_s7) - free(save_s7); - if (s8) - free(s8); - if (save_s8) - free(save_s8); - if (rbuf7) - free(rbuf7); - if (rbuf8) - free(rbuf8); - if (save_rbuf8) - free(save_rbuf8); + free(s1); + free(save_s1); + free(s3); + free(save_s3); + free(rbuf1); + free(rbuf3); + free(s7); + free(save_s7); + free(s8); + free(save_s8); + free(rbuf7); + free(rbuf8); + free(save_rbuf8); printf("\n*** SELECT COMPOUND DATASET TESTS FAILED ***\n"); return 1; diff --git a/test/dsets.c b/test/dsets.c index aba1f1e3996..09037b356c7 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -5681,6 +5681,306 @@ test_multiopen(hid_t file) return FAIL; } /* end test_multiopen() */ +/*------------------------------------------------------------------------- + * Function: test_floattypes + * + * Purpose: Make some datasets with various float types. + * + * Return: Success: 0 + * + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_floattypes(hid_t file) +{ + hid_t dataset = H5I_INVALID_HID; + hid_t datatype = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; + const hsize_t size[2] = {2, 5}; + size_t i, j; + size_t precision, offset; + + puts("Testing float datatypes"); + + /* float */ + { + /* orig_data[] are initialized to be within the range that can be represented by + * dataset datatype (no precision loss during datatype conversion) + */ + float orig_data[2][5] = {{188384.0F, 19.103516F, -1.0831790e9F, -84.242188F, 5.2045898F}, + {-49140.0F, 2350.25F, -3.2110596e-1F, 6.4998865e-5F, -0.0F}}; + float new_data[2][5]; + + TESTING(" float (setup)"); + + /* Define user-defined single-precision floating-point type for dataset */ + datatype = H5Tcopy(H5T_IEEE_F32BE); + if (H5Tset_fields(datatype, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0) + goto error; + offset = 7; + if (H5Tset_offset(datatype, offset) < 0) + goto error; + precision = 20; + if (H5Tset_precision(datatype, precision) < 0) + goto error; + if (H5Tset_size(datatype, (size_t)4) < 0) + goto error; + if (H5Tset_ebias(datatype, (size_t)31) < 0) + goto error; + + /* Create the data space */ + if ((space = H5Screate_simple(2, size, NULL)) < 0) + goto error; + + /* Create the dataset */ + if ((dataset = + H5Dcreate2(file, "float_type)", datatype, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + PASSED(); + + /*---------------------------------------------------------------------- + * STEP 1: Test writing to it. + *---------------------------------------------------------------------- + */ + TESTING(" float (write)"); + + if (H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0) + goto error; + + PASSED(); + + /*---------------------------------------------------------------------- + * STEP 2: Try to read the data we just wrote. + *---------------------------------------------------------------------- + */ + TESTING(" float (read)"); + + /* Read the dataset back */ + if (H5Dread(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0) + goto error; + + /* Check that the values read are the same as the values written + * Assume size of int = size of float + */ + for (i = 0; i < (size_t)size[0]; i++) { + for (j = 0; j < (size_t)size[1]; j++) { + if (isnan(orig_data[i][j])) + continue; /* skip if value is NaN */ + if (!H5_FLT_ABS_EQUAL(new_data[i][j], orig_data[i][j])) { + H5_FAILED(); + printf(" Read different values than written.\n"); + printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); + goto error; + } + } + } + + PASSED(); + + /*---------------------------------------------------------------------- + * Cleanup + *---------------------------------------------------------------------- + */ + if (H5Tclose(datatype) < 0) + goto error; + if (H5Sclose(space) < 0) + goto error; + if (H5Dclose(dataset) < 0) + goto error; + } + + /* double */ + { + double orig_data[2][5] = { + {(double)1.6081706885101836e+60L, (double)-255.32099170994480, (double)1.2677579992621376e-61L, + (double)64568.289448797700, (double)-1.0619721778839084e-75L}, + {(double)2.1499497833454840e+56L, (double)6.6562295504670740e-3, (double)-1.5747263393432150, + (double)1.0711093225222612, (double)-9.8971679387636870e-1}}; + double new_data[2][5]; + + TESTING(" double (setup)"); + + /* Define user-defined double-precision floating-point type for dataset */ + datatype = H5Tcopy(H5T_IEEE_F64BE); + if (H5Tset_fields(datatype, (size_t)55, (size_t)46, (size_t)9, (size_t)5, (size_t)41) < 0) + goto error; + offset = 5; + if (H5Tset_offset(datatype, offset) < 0) + goto error; + precision = 51; + if (H5Tset_precision(datatype, precision) < 0) + goto error; + if (H5Tset_size(datatype, (size_t)8) < 0) + goto error; + if (H5Tset_ebias(datatype, (size_t)255) < 0) + goto error; + + /* Create the data space */ + if ((space = H5Screate_simple(2, size, NULL)) < 0) + goto error; + + /* Create the dataset */ + if ((dataset = + H5Dcreate2(file, "double_type", datatype, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + + PASSED(); + + /*---------------------------------------------------------------------- + * STEP 1: Test writing to it. + *---------------------------------------------------------------------- + */ + TESTING(" double (write)"); + + if (H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0) + goto error; + PASSED(); + + /*---------------------------------------------------------------------- + * STEP 2: Try to read the data we just wrote. + *---------------------------------------------------------------------- + */ + TESTING(" double (read)"); + + /* Read the dataset back */ + if (H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0) + goto error; + + /* Check that the values read are the same as the values written + * Assume size of long long = size of double + */ + for (i = 0; i < (size_t)size[0]; i++) { + for (j = 0; j < (size_t)size[1]; j++) { + if (isnan(orig_data[i][j])) + continue; /* skip if value is NaN */ + if (!H5_DBL_ABS_EQUAL(new_data[i][j], orig_data[i][j])) { + H5_FAILED(); + printf(" Read different values than written.\n"); + printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); + goto error; + } + } + } + + PASSED(); + + /*---------------------------------------------------------------------- + * Cleanup + *---------------------------------------------------------------------- + */ + if (H5Tclose(datatype) < 0) + goto error; + if (H5Sclose(space) < 0) + goto error; + if (H5Dclose(dataset) < 0) + goto error; + } +#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE + /* long double */ + { + long double orig_data[2][5] = { + {(long double)1.6081706885101836e+600L, (long double)-255.3209917099448032099170994480, + (long double)1.2677579992621376e-610L, (long double)64568.289448797700289448797700, + (long double)-1.0619721778839084e-750L}, + {(long double)2.1499497833454840991499497833454840e+560L, + (long double)6.6562295504670740996562295504670740e-3, + (long double)-1.5747263393432150995747263393432150, + (long double)1.0711093225222612990711093225222612, + (long double)-9.8971679387636870998971679387636870e-1}}; + long double new_data[2][5]; + + TESTING(" long double (setup)"); + + /* Define user-defined quad-precision floating-point type for dataset */ + datatype = H5Tcopy(H5T_NATIVE_LDOUBLE); + precision = 128; + if (H5Tset_precision(datatype, precision) < 0) + goto error; + if (H5Tset_fields(datatype, (size_t)127, (size_t)112, (size_t)15, (size_t)5, (size_t)107) < 0) + goto error; + offset = 5; + if (H5Tset_offset(datatype, offset) < 0) + goto error; + if (H5Tset_size(datatype, (size_t)16) < 0) + goto error; + if (H5Tset_ebias(datatype, (size_t)255) < 0) + goto error; + + /* Create the data space */ + if ((space = H5Screate_simple(2, size, NULL)) < 0) + goto error; + + /* Create the dataset */ + if ((dataset = H5Dcreate2(file, "long_double_type", datatype, space, H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT)) < 0) + goto error; + + PASSED(); + + /*---------------------------------------------------------------------- + * STEP 1: Test writing to it. + *---------------------------------------------------------------------- + */ + TESTING(" long double (write)"); + + if (H5Dwrite(dataset, H5T_NATIVE_LDOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0) + goto error; + PASSED(); + + /*---------------------------------------------------------------------- + * STEP 2: Try to read the data we just wrote. + *---------------------------------------------------------------------- + */ + TESTING(" long double (read)"); + + /* Read the dataset back */ + if (H5Dread(dataset, H5T_NATIVE_LDOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0) + goto error; + + /* Check that the values read are the same as the values written */ + for (i = 0; i < (size_t)size[0]; i++) { + for (j = 0; j < (size_t)size[1]; j++) { + if (isnan(orig_data[i][j])) + continue; /* skip if value is NaN */ + if (!H5_LDBL_ABS_EQUAL(new_data[i][j], orig_data[i][j])) { + H5_FAILED(); + printf(" Read different values than written.\n"); + printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); + goto error; + } + } + } + + PASSED(); + + /*---------------------------------------------------------------------- + * Cleanup + *---------------------------------------------------------------------- + */ + if (H5Tclose(datatype) < 0) + goto error; + if (H5Sclose(space) < 0) + goto error; + if (H5Dclose(dataset) < 0) + goto error; + } +#endif + + return SUCCEED; + +error: + H5E_BEGIN_TRY + { + H5Tclose(datatype); + H5Sclose(space); + H5Dclose(dataset); + } + H5E_END_TRY + return FAIL; +} /* end test_floattypes() */ + /*------------------------------------------------------------------------- * Function: test_types * @@ -15583,6 +15883,7 @@ main(void) nerrors += (test_scaleoffset_double_2(file) < 0 ? 1 : 0); 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); if (driver_is_default_compatible) { diff --git a/test/dt_arith.c b/test/dt_arith.c index d3147cbd577..4a99811ae53 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -3307,6 +3307,7 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst) return MAX((int)fails_all_tests, 1); else if (run_test == TEST_DENORM || run_test == TEST_SPECIAL) return 1; + return 1; #endif } diff --git a/test/dtypes.c b/test/dtypes.c index ac8697eba60..7aa3b17c726 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -4156,6 +4156,89 @@ test_query(void) return 1; } +/*------------------------------------------------------------------------- + * Function: test_set_fields_offset + * + * Purpose: Tests for a bug in H5Tset_fields in which the function + * didn't account for an offset set for a floating-point + * datatype when checking whether the values set for the + * floating-point fields make sense for the datatype. + * + * Return: Success: 0 + * Failure: number of errors + * + *------------------------------------------------------------------------- + */ +static int +test_set_fields_offset(void) +{ + hid_t tid = H5I_INVALID_HID; + + if ((tid = H5Tcopy(H5T_NATIVE_FLOAT)) < 0) { + H5_FAILED(); + printf("Can't copy datatype\n"); + goto error; + } + + /* Create a custom 128-bit floating-point datatype */ + if (H5Tset_size(tid, 16) < 0) { + H5_FAILED(); + printf("Can't set datatype size\n"); + goto error; + } + + /* We will have 7 bytes of MSB padding + 5 bytes of offset padding */ + if (H5Tset_precision(tid, 116) < 0) { + H5_FAILED(); + printf("Can't set datatype size\n"); + goto error; + } + + if (H5Tset_offset(tid, 5) < 0) { + H5_FAILED(); + printf("Can't set datatype offset\n"); + goto error; + } + + if (H5Tset_ebias(tid, 16383) < 0) { + H5_FAILED(); + printf("Can't set datatype exponent bias\n"); + goto error; + } + + /* + * Floating-point type with the following: + * + * - 5 bits of LSB padding (bits 0 - 4) + * - 100-bit mantissa starting at bit 5 + * - 15-bit exponent starting at bit 105 + * - 1 sign bit at bit 120 + * - 7 bits of MSB padding + */ + if (H5Tset_fields(tid, 120, 105, 15, 5, 100) < 0) { + H5_FAILED(); + printf("Can't set datatype's floating-point fields\n"); + goto error; + } + + if (H5Tclose(tid) < 0) { + H5_FAILED(); + printf("Can't close datatype\n"); + goto error; + } + + return 0; + +error: + H5E_BEGIN_TRY + { + H5Tclose(tid); + } + H5E_END_TRY; + + return 1; +} + /*------------------------------------------------------------------------- * Function: test_transient * @@ -9032,6 +9115,7 @@ main(void) nerrors += test_detect(); nerrors += test_compound_1(); nerrors += test_query(); + nerrors += test_set_fields_offset(); nerrors += test_transient(fapl); nerrors += test_named(fapl); nerrors += test_encode(); diff --git a/test/filter_plugin.c b/test/filter_plugin.c index 1571bf22787..9207d9e847c 100644 --- a/test/filter_plugin.c +++ b/test/filter_plugin.c @@ -847,10 +847,7 @@ test_creating_groups_using_plugins(hid_t fid) /* Create multiple groups under the top-level group */ for (i = 0; i < N_SUBGROUPS; i++) { - char *sp = subgroup_name; - - sp += snprintf(subgroup_name, sizeof(subgroup_name), SUBGROUP_PREFIX); - sprintf(sp, "%d", i); + snprintf(subgroup_name, sizeof(subgroup_name), SUBGROUP_PREFIX "%d", i); if ((sub_gid = H5Gcreate2(gid, subgroup_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; @@ -906,10 +903,7 @@ test_opening_groups_using_plugins(hid_t fid) /* Open all the sub-groups under the top-level group */ for (i = 0; i < N_SUBGROUPS; i++) { - char *sp = subgroup_name; - - sp += snprintf(subgroup_name, sizeof(subgroup_name), SUBGROUP_PREFIX); - sprintf(sp, "%d", i); + snprintf(subgroup_name, sizeof(subgroup_name), SUBGROUP_PREFIX "%d", i); if ((sub_gid = H5Gopen2(gid, subgroup_name, H5P_DEFAULT)) < 0) TEST_ERROR; diff --git a/test/h5test.c b/test/h5test.c index 77a65c23797..1cca57a5679 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -2067,6 +2067,49 @@ h5_check_if_file_locking_enabled(bool *is_enabled) return FAIL; } /* end h5_check_if_file_locking_enabled() */ +/*------------------------------------------------------------------------- + * Function: h5_check_file_locking_env_var + * + * Purpose: Checks if the HDF5_USE_FILE_LOCKING file locking + * environment variable is set and parses its value if so. + * + * If the environment variable is not set, both `use_locks` + * and `ignore_disabled_locks` will be set to FAIL to indicate + * this. Otherwise, they will each be set appropriately based + * on the setting for the environment variable. + * + * Return: Nothing + * + *------------------------------------------------------------------------- + */ +void +h5_check_file_locking_env_var(htri_t *use_locks, htri_t *ignore_disabled_locks) +{ + char *lock_env_var = NULL; + + assert(use_locks); + assert(ignore_disabled_locks); + + lock_env_var = getenv(HDF5_USE_FILE_LOCKING); + if (lock_env_var && (!strcmp(lock_env_var, "FALSE") || !strcmp(lock_env_var, "0"))) { + *use_locks = false; /* Override: Never use locks */ + *ignore_disabled_locks = FAIL; + } + else if (lock_env_var && !strcmp(lock_env_var, "BEST_EFFORT")) { + *use_locks = true; /* Override: Always use locks */ + *ignore_disabled_locks = true; /* Override: Ignore disabled locks */ + } + else if (lock_env_var && (!strcmp(lock_env_var, "TRUE") || !strcmp(lock_env_var, "1"))) { + *use_locks = true; /* Override: Always use locks */ + *ignore_disabled_locks = false; /* Override: Don't ignore disabled locks */ + } + else { + /* Environment variable not set, or not set correctly */ + *use_locks = FAIL; + *ignore_disabled_locks = FAIL; + } +} + /*------------------------------------------------------------------------- * Function: h5_using_native_vol * diff --git a/test/h5test.h b/test/h5test.h index 8115207a674..8f785674abc 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -290,6 +290,7 @@ H5TEST_DLL const char *h5_get_version_string(H5F_libver_t libver); H5TEST_DLL int h5_compare_file_bytes(char *fname1, char *fname2); H5TEST_DLL int h5_duplicate_file_by_bytes(const char *orig, const char *dest); 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 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); diff --git a/test/links.c b/test/links.c index e068d71be8e..299a7c2d758 100644 --- a/test/links.c +++ b/test/links.c @@ -100,6 +100,8 @@ static const char *FILENAME[] = {"links0", TMPDIR "extlinks21D", /* 49: */ TMPDIR "extlinks21E", /* 50: */ "extlinks21E", /* 51: (same as #50, only without the TMPDIR prefix) */ + "extlinks22", /* 52: */ + "extlinks22A", /* 53: */ NULL}; #define FAMILY_SIZE 1024 @@ -9820,6 +9822,225 @@ external_set_elink_acc_flags(const char *env_h5_drvr, hid_t fapl, bool new_forma return FAIL; } /* end external_set_elink_acc_flags() */ +/*------------------------------------------------------------------------- + * Function: external_link_inherit_locking + * + * Purpose: Test that opening a file through an external link using a + * default FAPL will cause that file to inherit the parent + * file's file locking settings. + * + * Return: Success: 0 + * Failure: 1 + * + *------------------------------------------------------------------------- + */ +static int +external_link_inherit_locking(hid_t fapl_id, bool new_format) +{ + htri_t use_locking_env = FAIL; + htri_t ignore_disabled_env = FAIL; + hid_t fid = H5I_INVALID_HID; + hid_t tmp_fid = H5I_INVALID_HID; + hid_t gid = H5I_INVALID_HID; + hid_t ext_fid = H5I_INVALID_HID; + hid_t file_fapl = H5I_INVALID_HID; + hid_t tmp_fapl = H5I_INVALID_HID; + bool use_locking = true; + bool ignore_disabled_locking = false; + char *filename = NULL; + char *ext_filename = NULL; + + if (new_format) + TESTING("inheriting of file locking settings (w/new group format)"); + else + TESTING("inheriting of file locking settings"); + + /* Get the settings for the file locking environment variables */ + h5_check_file_locking_env_var(&use_locking_env, &ignore_disabled_env); + + /* Check that external links are registered with the library */ + if (H5Lis_registered(H5L_TYPE_EXTERNAL) != true) + TEST_ERROR; + + if (NULL == (filename = malloc(NAME_BUF_SIZE))) + TEST_ERROR; + if (NULL == (ext_filename = malloc(NAME_BUF_SIZE))) + TEST_ERROR; + + if ((file_fapl = H5Pcopy(fapl_id)) < 0) + TEST_ERROR; + + /* Create external file */ + h5_fixname(FILENAME[53], file_fapl, ext_filename, NAME_BUF_SIZE); + if ((ext_fid = H5Fcreate(ext_filename, H5F_ACC_TRUNC, H5P_DEFAULT, file_fapl)) < 0) + TEST_ERROR; + if (H5Fclose(ext_fid) < 0) + TEST_ERROR; + + /* Create main file and link to external file */ + h5_fixname(FILENAME[52], file_fapl, filename, NAME_BUF_SIZE); + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, file_fapl)) < 0) + TEST_ERROR; + if (H5Lcreate_external(ext_filename, "/", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR; + if (H5Fclose(fid) < 0) + TEST_ERROR; + + /* Test for file locking on unless disabled by environment variable */ + if (use_locking_env != false) { + /* Set file locking on */ + if (H5Pset_file_locking(file_fapl, true, true) < 0) + TEST_ERROR; + + /* Open main file */ + if ((fid = H5Fopen(filename, H5F_ACC_RDWR, file_fapl)) < 0) + TEST_ERROR; + + /* Make sure that locking setting retrieved from access plist + * matches what we set. + */ + if ((tmp_fapl = H5Fget_access_plist(fid)) < 0) + TEST_ERROR; + if (H5Pget_file_locking(tmp_fapl, &use_locking, &ignore_disabled_locking) < 0) + TEST_ERROR; + if (use_locking != true) + TEST_ERROR; + /* Check for "ignore disabled file locks" setting being on, unless + * disabled by environment variable + */ + if (ignore_disabled_env != false && ignore_disabled_locking != true) + TEST_ERROR; + if (H5Pclose(tmp_fapl) < 0) + TEST_ERROR; + + /* Open external file through link */ + if ((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Get file ID for external file */ + if ((tmp_fid = H5Iget_file_id(gid)) < 0) + TEST_ERROR; + + /* Make sure that locking setting retrieved from external file's + * access plist matches what we set. + */ + if ((tmp_fapl = H5Fget_access_plist(tmp_fid)) < 0) + TEST_ERROR; + if (H5Pget_file_locking(tmp_fapl, &use_locking, &ignore_disabled_locking) < 0) + TEST_ERROR; + if (use_locking != true) + TEST_ERROR; + /* Check for "ignore disabled file locks" setting being on, unless + * disabled by environment variable + */ + if (ignore_disabled_env != false && ignore_disabled_locking != true) + TEST_ERROR; + if (H5Pclose(tmp_fapl) < 0) + TEST_ERROR; + + if (H5Gclose(gid) < 0) + TEST_ERROR; + if (H5Fclose(tmp_fid) < 0) + TEST_ERROR; + if (H5Fclose(fid) < 0) + TEST_ERROR; + } + + /* Test for file locking off unless force enabled by environment variable */ + if (use_locking_env != true) { + /* Set file locking off */ + if (H5Pset_file_locking(file_fapl, false, false) < 0) + TEST_ERROR; + + /* Open main file */ + if ((fid = H5Fopen(filename, H5F_ACC_RDWR, file_fapl)) < 0) + TEST_ERROR; + + /* Make sure that locking setting retrieved from access plist + * matches what we set. + */ + if ((tmp_fapl = H5Fget_access_plist(fid)) < 0) + TEST_ERROR; + if (H5Pget_file_locking(tmp_fapl, &use_locking, &ignore_disabled_locking) < 0) + TEST_ERROR; + if (use_locking != false) + TEST_ERROR; + /* Check for "ignore disabled file locks" setting being off, unless + * force enabled by environment variable + */ + if (ignore_disabled_env != true && ignore_disabled_locking != false) + TEST_ERROR; + if (H5Pclose(tmp_fapl) < 0) + TEST_ERROR; + + /* Open external file through link */ + if ((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Get file ID for external file */ + if ((tmp_fid = H5Iget_file_id(gid)) < 0) + TEST_ERROR; + + /* Make sure that locking setting retrieved from external file's + * access plist matches what we set. + */ + if ((tmp_fapl = H5Fget_access_plist(tmp_fid)) < 0) + TEST_ERROR; + if (H5Pget_file_locking(tmp_fapl, &use_locking, &ignore_disabled_locking) < 0) + TEST_ERROR; + if (use_locking != false) + TEST_ERROR; + /* Check for "ignore disabled file locks" setting being off, unless + * force enabled by environment variable + */ + if (ignore_disabled_env != true && ignore_disabled_locking != false) + TEST_ERROR; + if (H5Pclose(tmp_fapl) < 0) + TEST_ERROR; + + if (H5Gclose(gid) < 0) + TEST_ERROR; + if (H5Fclose(tmp_fid) < 0) + TEST_ERROR; + if (H5Fclose(fid) < 0) + TEST_ERROR; + } + + if (H5Fdelete(ext_filename, file_fapl) < 0) + TEST_ERROR; + if (H5Fdelete(filename, file_fapl) < 0) + TEST_ERROR; + + if (H5Pclose(file_fapl) < 0) + TEST_ERROR; + + free(ext_filename); + ext_filename = NULL; + free(filename); + filename = NULL; + + PASSED(); + + return SUCCEED; + +error: + H5E_BEGIN_TRY + { + H5Pclose(tmp_fapl); + H5Pclose(file_fapl); + H5Fclose(ext_fid); + H5Gclose(gid); + H5Fclose(tmp_fid); + H5Fclose(fid); + } + H5E_END_TRY + + free(ext_filename); + free(filename); + + return FAIL; +} + /*------------------------------------------------------------------------- * Function: external_set_elink_cb * @@ -23034,6 +23255,7 @@ main(void) nerrors += external_set_elink_fapl2(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_set_elink_fapl3(new_format) < 0 ? 1 : 0; + nerrors += external_link_inherit_locking(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_set_elink_cb(my_fapl, new_format) < 0 ? 1 : 0; #ifdef H5_HAVE_WINDOW_PATH nerrors += external_link_win1(my_fapl, new_format) < 0 ? 1 : 0; diff --git a/test/select_io_dset.c b/test/select_io_dset.c index 33b1c843d09..1ff7fe22f9e 100644 --- a/test/select_io_dset.c +++ b/test/select_io_dset.c @@ -773,7 +773,10 @@ test_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) s2_t *s2_wbuf_bak = NULL; s2_t *s2_rbuf = NULL; char dset_name[DSET_NAME_LEN]; - int fillvalue = -1; + s1_t fillvalue; + + /* Initialize the fill value */ + memset(&fillvalue, 0, sizeof(s1_t)); /* Create dataset transfer property list */ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) diff --git a/test/tmisc.c b/test/tmisc.c index ddebc3d648f..4f337582a1c 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -338,6 +338,7 @@ typedef struct { #define CVE_2020_10812_FILENAME "cve_2020_10812.h5" #define MISC38_FILE "type_conversion_path_table_issue.h5" +#define MISC39_FILE "set_est_link_info.h5" /**************************************************************** ** @@ -6445,6 +6446,103 @@ test_misc38(void) CHECK(ret, FAIL, "H5Sclose"); } +/**************************************************************** +** +** test_misc39(): Ensure H5Pset_est_link_info() handles large +** values +** +** H5Pset_est_link_info() values can be set to large values, +** which could cause the library to attempt to create large +** object headers that exceed limits and trip asserts in +** the library. +** +** This test ensures that the library doesn't error regardless +** of the values passed to H5Pset_est_link_info() and +** H5Pset_link_phase_change(). +** +****************************************************************/ +static void +test_misc39(void) +{ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t gid = H5I_INVALID_HID; /* Group ID */ + hid_t fapl = H5I_INVALID_HID; /* File access property list ID */ + hid_t gcpl = H5I_INVALID_HID; /* Group creation property list ID */ + herr_t ret = H5I_INVALID_HID; /* Generic return value */ + + /* Output message about test being performed */ + MESSAGE(5, ("Ensure H5Pset_est_link_info handles large values\n")); + + /* Compose file access property list + * + * NOTE: The bug in question only occurs in new-style groups + */ + fapl = H5Pcreate(H5P_FILE_ACCESS); + CHECK(fapl, H5I_INVALID_HID, "H5Pcreate"); + ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); + CHECK(ret, FAIL, "H5Pset_libver_bounds"); + + /* Create the file */ + fid = H5Fcreate(MISC39_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); + + /* Compose group creation property list */ + gcpl = H5Pcreate(H5P_GROUP_CREATE); + CHECK(gcpl, H5I_INVALID_HID, "H5Pcreate"); + + /* Set the estimated link info values to large numbers */ + ret = H5Pset_est_link_info(gcpl, UINT16_MAX, UINT16_MAX); + CHECK(ret, FAIL, "H5Pset_est_link_info"); + + /* Create a group */ + gid = H5Gcreate2(fid, "foo", H5P_DEFAULT, gcpl, H5P_DEFAULT); + CHECK(gid, H5I_INVALID_HID, "H5Gcreate2"); + + /* Close the group */ + ret = H5Gclose(gid); + CHECK(ret, FAIL, "H5Gclose"); + + /* Close the file. Asserts typically occur here, when the metadata cache + * objects are flushed. + */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + + /* Re-open the file */ + fid = H5Fopen(MISC25C_FILE, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(fid, H5I_INVALID_HID, "H5Fopen"); + + /* Set the compact/dense value high, to see if we can trick the + * library into creating a dense group object header that is + * larger than the maximum allowed size. + */ + ret = H5Pset_link_phase_change(gcpl, UINT16_MAX, UINT16_MAX); + CHECK(ret, FAIL, "H5Pset_link_phase_change"); + + /* Set the estimated link info values to large numbers */ + ret = H5Pset_est_link_info(gcpl, UINT16_MAX / 2, UINT16_MAX); + CHECK(ret, FAIL, "H5Pset_est_link_info"); + + /* Create another group */ + gid = H5Gcreate2(fid, "bar", H5P_DEFAULT, gcpl, H5P_DEFAULT); + CHECK(gid, H5I_INVALID_HID, "H5Gcreate2"); + + /* Close the group */ + ret = H5Gclose(gid); + CHECK(ret, FAIL, "H5Gclose"); + + /* Close the file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + + /* Close the property lists */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + ret = H5Pclose(gcpl); + CHECK(ret, FAIL, "H5Pclose"); + +} /* end test_misc39() */ + /**************************************************************** ** ** test_misc(): Main misc. test routine. @@ -6514,6 +6612,7 @@ test_misc(void) test_misc36(); /* Exercise H5atclose and H5is_library_terminating */ 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_misc() */ @@ -6570,6 +6669,7 @@ cleanup_misc(void) H5Fdelete(MISC31_FILE, H5P_DEFAULT); #endif /* H5_NO_DEPRECATED_SYMBOLS */ H5Fdelete(MISC38_FILE, H5P_DEFAULT); + H5Fdelete(MISC39_FILE, H5P_DEFAULT); } H5E_END_TRY } /* end cleanup_misc() */ diff --git a/test/vol.c b/test/vol.c index 43336c6c978..e29c6bb940f 100644 --- a/test/vol.c +++ b/test/vol.c @@ -865,6 +865,8 @@ test_basic_file_operation(const char *env_h5_drvr) hid_t fapl_id2 = H5I_INVALID_HID; hid_t fcpl_id = H5I_INVALID_HID; + htri_t use_locking_env = FAIL; + htri_t ignore_disabled_env = FAIL; char filename[1024]; ssize_t obj_count; hid_t obj_id_list[1]; @@ -894,6 +896,24 @@ test_basic_file_operation(const char *env_h5_drvr) if (H5Pset_metadata_read_attempts(fapl_id, 9) < 0) TEST_ERROR; + /* Similar to the above, make sure the FAPL has an appropriate file locking + * setting if the HDF5_USE_FILE_LOCKING environment variable was set so that + * the H5Pequal call will work correctly. + */ + h5_check_file_locking_env_var(&use_locking_env, &ignore_disabled_env); + if (use_locking_env != FAIL) { + hbool_t default_use_locking = true; + hbool_t default_ignore_disabled_locks = true; + + if (H5Pget_file_locking(H5P_DEFAULT, &default_use_locking, &default_ignore_disabled_locks) < 0) + TEST_ERROR; + + if (H5Pset_file_locking(fapl_id, (bool)use_locking_env, + (ignore_disabled_env == FAIL) ? default_ignore_disabled_locks + : (bool)ignore_disabled_env) < 0) + TEST_ERROR; + } + /* H5Fcreate */ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) TEST_ERROR; diff --git a/testpar/API/H5_api_async_test_parallel.c b/testpar/API/H5_api_async_test_parallel.c index 79327d0ea03..768bbc2ab07 100644 --- a/testpar/API/H5_api_async_test_parallel.c +++ b/testpar/API/H5_api_async_test_parallel.c @@ -542,7 +542,7 @@ test_multi_dataset_io(void) size_t buf_end_idx; /* Set dataset name */ - sprintf(dset_name, "dset%d", (int)i); + snprintf(dset_name, sizeof(dset_name), "dset%d", (int)i); /* Create the dataset asynchronously */ if ((dset_id[i] = H5Dcreate_async(file_id, dset_name, H5T_NATIVE_INT, space_id, H5P_DEFAULT, @@ -611,7 +611,7 @@ test_multi_dataset_io(void) size_t buf_end_idx; /* Set dataset name */ - sprintf(dset_name, "dset%d", (int)i); + snprintf(dset_name, sizeof(dset_name), "dset%d", (int)i); /* Open the dataset asynchronously */ if ((dset_id[0] = H5Dopen_async(file_id, dset_name, H5P_DEFAULT, es_id)) < 0) @@ -641,7 +641,7 @@ test_multi_dataset_io(void) /* Loop over datasets */ for (i = 0; i < MULTI_DATASET_IO_TEST_NDSETS; i++) { /* Set dataset name */ - sprintf(dset_name, "dset%d", (int)i); + snprintf(dset_name, sizeof(dset_name), "dset%d", (int)i); /* Open the dataset asynchronously */ if ((dset_id[0] = H5Dopen_async(file_id, dset_name, H5P_DEFAULT, es_id)) < 0) @@ -864,7 +864,7 @@ test_multi_file_dataset_io(void) size_t buf_end_idx; /* Set file name */ - sprintf(file_name, PAR_ASYNC_API_TEST_FILE_PRINTF, (int)i); + snprintf(file_name, sizeof(file_name), PAR_ASYNC_API_TEST_FILE_PRINTF, (int)i); /* Create file asynchronously */ if ((file_id[i] = H5Fcreate_async(file_name, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id, es_id)) < 0) @@ -1018,7 +1018,7 @@ test_multi_file_dataset_io(void) size_t buf_end_idx; /* Set file name */ - sprintf(file_name, PAR_ASYNC_API_TEST_FILE_PRINTF, (int)i); + snprintf(file_name, sizeof(file_name), PAR_ASYNC_API_TEST_FILE_PRINTF, (int)i); /* Open the file asynchronously */ if ((file_id[0] = H5Fopen_async(file_name, H5F_ACC_RDWR, fapl_id, es_id)) < 0) @@ -1057,7 +1057,7 @@ test_multi_file_dataset_io(void) /* Loop over files */ for (i = 0; i < MULTI_FILE_DATASET_IO_TEST_NFILES; i++) { /* Set file name */ - sprintf(file_name, PAR_ASYNC_API_TEST_FILE_PRINTF, (int)i); + snprintf(file_name, sizeof(file_name), PAR_ASYNC_API_TEST_FILE_PRINTF, (int)i); /* Open the file asynchronously */ if ((file_id[0] = H5Fopen_async(file_name, H5F_ACC_RDONLY, fapl_id, es_id)) < 0) @@ -1287,7 +1287,7 @@ test_multi_file_grp_dset_io(void) size_t buf_end_idx; /* Set file name */ - sprintf(file_name, PAR_ASYNC_API_TEST_FILE_PRINTF, (int)i); + snprintf(file_name, sizeof(file_name), PAR_ASYNC_API_TEST_FILE_PRINTF, (int)i); /* Create file asynchronously */ if ((file_id = H5Fcreate_async(file_name, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id, es_id)) < 0) @@ -1339,7 +1339,7 @@ test_multi_file_grp_dset_io(void) /* Loop over files */ for (i = 0; i < MULTI_FILE_GRP_DSET_IO_TEST_NFILES; i++) { /* Set file name */ - sprintf(file_name, PAR_ASYNC_API_TEST_FILE_PRINTF, (int)i); + snprintf(file_name, sizeof(file_name), PAR_ASYNC_API_TEST_FILE_PRINTF, (int)i); /* Open the file asynchronously */ if ((file_id = H5Fopen_async(file_name, H5F_ACC_RDONLY, fapl_id, es_id)) < 0) @@ -1401,7 +1401,7 @@ test_multi_file_grp_dset_io(void) size_t buf_end_idx; /* Set file name */ - sprintf(file_name, PAR_ASYNC_API_TEST_FILE_PRINTF, (int)i); + snprintf(file_name, sizeof(file_name), PAR_ASYNC_API_TEST_FILE_PRINTF, (int)i); /* Create file asynchronously */ if ((file_id = H5Fcreate_async(file_name, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id, es_id)) < 0) @@ -1459,7 +1459,7 @@ test_multi_file_grp_dset_io(void) /* Loop over files */ for (i = 0; i < MULTI_FILE_GRP_DSET_IO_TEST_NFILES; i++) { /* Set file name */ - sprintf(file_name, PAR_ASYNC_API_TEST_FILE_PRINTF, (int)i); + snprintf(file_name, sizeof(file_name), PAR_ASYNC_API_TEST_FILE_PRINTF, (int)i); /* Open the file asynchronously */ if ((file_id = H5Fopen_async(file_name, H5F_ACC_RDONLY, fapl_id, es_id)) < 0) @@ -3582,7 +3582,7 @@ cleanup_files(void) if (MAINPROCESS) { H5Fdelete(PAR_ASYNC_API_TEST_FILE, H5P_DEFAULT); for (i = 0; i <= max_printf_file; i++) { - snprintf(file_name, 64, PAR_ASYNC_API_TEST_FILE_PRINTF, i); + snprintf(file_name, sizeof(file_name), PAR_ASYNC_API_TEST_FILE_PRINTF, i); H5Fdelete(file_name, H5P_DEFAULT); } /* end for */ } diff --git a/testpar/CMakeVFDTests.cmake b/testpar/CMakeVFDTests.cmake index cdec5f75c25..63b5d3d49da 100644 --- a/testpar/CMakeVFDTests.cmake +++ b/testpar/CMakeVFDTests.cmake @@ -28,7 +28,7 @@ set (H5P_VFD_subfiling_TESTS_SKIP ) macro (ADD_VFD_TEST vfdname resultcode) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) foreach (h5_test ${H5P_VFD_TESTS}) if (NOT "${h5_test}" IN_LIST H5P_VFD_${vfdname}_TESTS_SKIP) add_test ( diff --git a/testpar/t_vfd.c b/testpar/t_vfd.c index 79b7e0149d8..cce5cf775e8 100644 --- a/testpar/t_vfd.c +++ b/testpar/t_vfd.c @@ -3987,17 +3987,20 @@ vector_write_test_7(int file_name_id, int mpi_rank, int mpi_size, H5FD_mpio_xfer if (xfer_mode == H5FD_MPIO_INDEPENDENT) { - sprintf(test_title, "parallel vector write test 7 -- %s / independent", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector write test 7 -- %s / independent", + vfd_name); } else if (coll_opt_mode == H5FD_MPIO_INDIVIDUAL_IO) { - sprintf(test_title, "parallel vector write test 7 -- %s / col op / ind I/O", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector write test 7 -- %s / col op / ind I/O", + vfd_name); } else { assert(coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO); - sprintf(test_title, "parallel vector write test 7 -- %s / col op / col I/O", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector write test 7 -- %s / col op / col I/O", + vfd_name); } TESTING(test_title); diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 15f2a1428bf..bdbda6e74bc 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -116,7 +116,7 @@ print_incoming_data(void) MPI_Recv(data, PRINT_DATA_MAX_SIZE, MPI_CHAR, Status.MPI_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &Status); - printf("%s", data); + parallel_print("%s", data); } } while (incomingMessage); } @@ -1247,7 +1247,8 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, hid_t file2_id, /*Set up args to pass to worker task. */ if (strlen(obj1_fullpath) > 255 || strlen(obj2_fullpath) > 255) { - printf("The parallel diff only supports object names up to 255 characters\n"); + fprintf(stderr, + "The parallel diff only supports object names up to 255 characters\n"); MPI_Abort(MPI_COMM_WORLD, 0); } /* end if */ @@ -1392,7 +1393,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, hid_t file2_id, MPI_COMM_WORLD); } /* end else-if */ else { - printf("ERROR: Invalid tag (%d) received \n", Status.MPI_TAG); + fprintf(stderr, "ERROR: Invalid tag (%d) received \n", Status.MPI_TAG); MPI_Abort(MPI_COMM_WORLD, 0); MPI_Finalize(); } /* end else */ @@ -1477,10 +1478,10 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, hid_t file2_id, MPI_Recv(data, PRINT_DATA_MAX_SIZE, MPI_CHAR, Status.MPI_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &Status); - printf("%s", data); + parallel_print("%s", data); } /* end else-if */ else { - printf("ph5diff-manager: ERROR!! Invalid tag (%d) received \n", Status.MPI_TAG); + fprintf(stderr, "ph5diff-manager: ERROR!! Invalid tag (%d) received \n", Status.MPI_TAG); MPI_Abort(MPI_COMM_WORLD, 0); } /* end else */ } /* end while */ diff --git a/tools/libtest/h5tools_test_utils.c b/tools/libtest/h5tools_test_utils.c index 6f3c0a6bae5..32f109b0caf 100644 --- a/tools/libtest/h5tools_test_utils.c +++ b/tools/libtest/h5tools_test_utils.c @@ -544,7 +544,7 @@ test_populate_ros3_fa(void) #ifndef H5_HAVE_ROS3_VFD puts(" -SKIP-"); - puts(" Read-Only S3 VFD not enabled"); + puts(" Test is skipped unless HDF5 is configured and built with the Read-Only S3 VFD enabled."); fflush(stdout); return 0; #else diff --git a/tools/src/h5copy/CMakeLists.txt b/tools/src/h5copy/CMakeLists.txt index 5b79a85b9fd..6263fe64503 100644 --- a/tools/src/h5copy/CMakeLists.txt +++ b/tools/src/h5copy/CMakeLists.txt @@ -4,39 +4,26 @@ project (HDF5_TOOLS_SRC_H5COPY C) # -------------------------------------------------------------------- # Add the h5copy and test executables # -------------------------------------------------------------------- -if (BUILD_STATIC_LIBS) - add_executable (h5copy ${HDF5_TOOLS_SRC_H5COPY_SOURCE_DIR}/h5copy.c) - target_include_directories (h5copy PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - target_compile_options(h5copy PRIVATE "${HDF5_CMAKE_C_FLAGS}") +add_executable (h5copy ${HDF5_TOOLS_SRC_H5COPY_SOURCE_DIR}/h5copy.c) +target_include_directories (h5copy PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +target_compile_options(h5copy PRIVATE "${HDF5_CMAKE_C_FLAGS}") +if (HDF5_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (h5copy STATIC) target_link_libraries (h5copy PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) - set_target_properties (h5copy PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5copy") - - set (H5_DEP_EXECUTABLES h5copy) +else () + TARGET_C_PROPERTIES (h5copy SHARED) + target_link_libraries (h5copy PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) endif () +set_target_properties (h5copy PROPERTIES FOLDER tools) +set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5copy") -if (BUILD_SHARED_LIBS) - add_executable (h5copy-shared ${HDF5_TOOLS_SRC_H5COPY_SOURCE_DIR}/h5copy.c) - target_include_directories (h5copy-shared PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - target_compile_options(h5copy-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") - TARGET_C_PROPERTIES (h5copy-shared SHARED) - target_link_libraries (h5copy-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - set_target_properties (h5copy-shared PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5copy-shared") - - set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5copy-shared) -endif () +set (H5_DEP_EXECUTABLES h5copy) #----------------------------------------------------------------------------- # Add Target to clang-format #----------------------------------------------------------------------------- if (HDF5_ENABLE_FORMATTERS) - if (BUILD_STATIC_LIBS) - clang_format (HDF5_H5COPY_SRC_FORMAT h5copy) - else () - clang_format (HDF5_H5COPY_SRC_FORMAT h5copy-shared) - endif () + clang_format (HDF5_H5COPY_SRC_FORMAT h5copy) endif () ############################################################################## diff --git a/tools/src/h5diff/CMakeLists.txt b/tools/src/h5diff/CMakeLists.txt index 8de7c61f6a7..e6802b16d90 100644 --- a/tools/src/h5diff/CMakeLists.txt +++ b/tools/src/h5diff/CMakeLists.txt @@ -4,77 +4,50 @@ project (HDF5_TOOLS_SRC_H5DIFF C) # -------------------------------------------------------------------- # Add the h5diff executables # -------------------------------------------------------------------- -if (BUILD_STATIC_LIBS) - add_executable (h5diff - ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c - ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c - ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.h - ) - target_include_directories (h5diff PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - target_compile_options(h5diff PRIVATE "${HDF5_CMAKE_C_FLAGS}") - #target_compile_definitions (h5diff PRIVATE H5_TOOLS_DEBUG) +add_executable (h5diff + ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c + ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c + ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.h +) +target_include_directories (h5diff PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +target_compile_options(h5diff PRIVATE "${HDF5_CMAKE_C_FLAGS}") +#target_compile_definitions (h5diff PRIVATE H5_TOOLS_DEBUG) +if (HDF5_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (h5diff STATIC) target_link_libraries (h5diff PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) - set_target_properties (h5diff PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5diff") - - set (H5_DEP_EXECUTABLES h5diff) +else () + TARGET_C_PROPERTIES (h5diff SHARED) + target_link_libraries (h5diff PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) endif () -if (BUILD_SHARED_LIBS) - add_executable (h5diff-shared - ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c - ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c - ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.h - ) - target_include_directories (h5diff-shared PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - target_compile_options(h5diff-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") - #target_compile_definitions (h5diff-shared PRIVATE H5_TOOLS_DEBUG) - TARGET_C_PROPERTIES (h5diff-shared SHARED) - target_link_libraries (h5diff-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - set_target_properties (h5diff-shared PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5diff-shared") +set_target_properties (h5diff PROPERTIES FOLDER tools) +set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5diff") - set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5diff-shared) -endif () +set (H5_DEP_EXECUTABLES h5diff) #----------------------------------------------------------------------------- # Add Target to clang-format #----------------------------------------------------------------------------- if (HDF5_ENABLE_FORMATTERS) - if (BUILD_STATIC_LIBS) - clang_format (HDF5_H5DIFF_SRC_FORMAT h5diff) - else () - clang_format (HDF5_H5DIFF_SRC_FORMAT h5diff-shared) - endif () + clang_format (HDF5_H5DIFF_SRC_FORMAT h5diff) endif () if (H5_HAVE_PARALLEL) - if (BUILD_STATIC_LIBS) - add_executable (ph5diff - ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c - ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/ph5diff_main.c - ) - target_include_directories (ph5diff PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - target_compile_options(ph5diff PRIVATE "${HDF5_CMAKE_C_FLAGS}") + add_executable (ph5diff + ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c + ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/ph5diff_main.c + ) + target_include_directories (ph5diff PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(ph5diff PRIVATE "${HDF5_CMAKE_C_FLAGS}") + if (HDF5_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (ph5diff STATIC) target_link_libraries (ph5diff PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$:MPI::MPI_C>") - set_target_properties (ph5diff PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};ph5diff") - set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} ph5diff) - endif () - if (BUILD_SHARED_LIBS) - add_executable (ph5diff-shared - ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c - ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/ph5diff_main.c - ) - target_include_directories (ph5diff-shared PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - target_compile_options(ph5diff-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") - TARGET_C_PROPERTIES (ph5diff-shared SHARED) - target_link_libraries (ph5diff-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} "$<$:MPI::MPI_C>") - set_target_properties (ph5diff-shared PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};ph5diff-shared") - set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} ph5diff-shared) + else () + TARGET_C_PROPERTIES (ph5diff SHARED) + target_link_libraries (ph5diff PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} "$<$:MPI::MPI_C>") endif () + set_target_properties (ph5diff PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};ph5diff") + set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} ph5diff) endif () ############################################################################## diff --git a/tools/src/h5diff/ph5diff_main.c b/tools/src/h5diff/ph5diff_main.c index f90bd484ac8..98e0c1da1b7 100644 --- a/tools/src/h5diff/ph5diff_main.c +++ b/tools/src/h5diff/ph5diff_main.c @@ -85,8 +85,9 @@ main(int argc, char *argv[]) MPI_Barrier(MPI_COMM_WORLD); - print_info(&opts); print_manager_output(); + + print_info(&opts); } /* All other tasks become workers and wait for assignments. */ else { diff --git a/tools/src/h5dump/CMakeLists.txt b/tools/src/h5dump/CMakeLists.txt index 32849496852..3cdffa21db8 100644 --- a/tools/src/h5dump/CMakeLists.txt +++ b/tools/src/h5dump/CMakeLists.txt @@ -4,57 +4,35 @@ project (HDF5_TOOLS_SRC_H5DUMP C) # -------------------------------------------------------------------- # Add the h5dump executables # -------------------------------------------------------------------- -if (BUILD_STATIC_LIBS) - add_executable (h5dump - ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump.c - ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.c - ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.c - ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump.h - ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_defines.h - ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_extern.h - ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.h - ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.h - ) - target_include_directories (h5dump PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - target_compile_options(h5dump PRIVATE "${HDF5_CMAKE_C_FLAGS}") +add_executable (h5dump + ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump.c + ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.c + ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.c + ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump.h + ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_defines.h + ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_extern.h + ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.h + ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.h +) +target_include_directories (h5dump PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +target_compile_options(h5dump PRIVATE "${HDF5_CMAKE_C_FLAGS}") +if (HDF5_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (h5dump STATIC) target_link_libraries (h5dump PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) - set_target_properties (h5dump PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5dump") - - set (H5_DEP_EXECUTABLES h5dump) +else () + TARGET_C_PROPERTIES (h5dump SHARED) + target_link_libraries (h5dump PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) endif () +set_target_properties (h5dump PROPERTIES FOLDER tools) +set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5dump") -if (BUILD_SHARED_LIBS) - add_executable (h5dump-shared - ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump.c - ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.c - ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.c - ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump.h - ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_defines.h - ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_extern.h - ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.h - ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.h - ) - target_include_directories (h5dump-shared PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - target_compile_options(h5dump-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") - TARGET_C_PROPERTIES (h5dump-shared SHARED) - target_link_libraries (h5dump-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - set_target_properties (h5dump-shared PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5dump-shared") - - set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5dump-shared) -endif () +set (H5_DEP_EXECUTABLES h5dump) #----------------------------------------------------------------------------- # Add Target to clang-format #----------------------------------------------------------------------------- if (HDF5_ENABLE_FORMATTERS) - if (BUILD_STATIC_LIBS) - clang_format (HDF5_H5DUMP_SRC_FORMAT h5dump) - else () - clang_format (HDF5_H5DUMP_SRC_FORMAT h5dump-shared) - endif () + clang_format (HDF5_H5DUMP_SRC_FORMAT h5dump) endif () ############################################################################## diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c index 8f2c4068598..40041e3aec9 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -326,11 +326,15 @@ usage(const char *prog) " (Alternate compact form of subsetting is described in the Reference Manual)\n"); PRINTVALSTREAM(rawoutstream, "\n"); PRINTVALSTREAM(rawoutstream, "--------------- Option Argument Conventions ---------------\n"); - PRINTVALSTREAM(rawoutstream, " D - is the file driver to use in opening the file. Acceptable values\n"); PRINTVALSTREAM( rawoutstream, - " are \"sec2\", \"family\", \"split\", \"multi\", \"direct\", and \"stream\". Without\n"); - PRINTVALSTREAM(rawoutstream, " the file driver flag, the file will be opened with each driver in\n"); + " D - is the file driver to use in opening the file. Acceptable values are available from\n"); + PRINTVALSTREAM( + rawoutstream, + " " + "https://portal.hdfgroup.org/documentation/hdf5-docs/registered_virtual_file_drivers_vfds.html.\n"); + PRINTVALSTREAM(rawoutstream, + " Without the file driver flag, the file will be opened with each driver in\n"); PRINTVALSTREAM(rawoutstream, " turn and in the order specified above until one driver succeeds\n"); PRINTVALSTREAM(rawoutstream, " in opening the file.\n"); PRINTVALSTREAM(rawoutstream, @@ -1169,7 +1173,8 @@ parse_command_line(int argc, const char *const *argv) vfd_info_g.info = &ros3_fa_g; #else - error_msg("Read-Only S3 VFD not enabled.\n"); + error_msg( + "Read-Only S3 VFD is not available unless enabled when HDF5 is configured and built.\n"); h5tools_setstatus(EXIT_FAILURE); goto done; #endif @@ -1188,7 +1193,7 @@ parse_command_line(int argc, const char *const *argv) vfd_info_g.info = &hdfs_fa_g; #else - error_msg("HDFS VFD not enabled.\n"); + error_msg("HDFS VFD is not available unless enabled when HDF5 is configured and built.\n"); h5tools_setstatus(EXIT_FAILURE); goto done; #endif @@ -1469,7 +1474,7 @@ main(int argc, char *argv[]) xml_dtd_uri_g); } else { - /* TO DO: make -url option work in this case (may need new option) */ + /* TODO: make -url option work in this case (may need new option) */ char *ns; char *indx; diff --git a/tools/src/h5format_convert/CMakeLists.txt b/tools/src/h5format_convert/CMakeLists.txt index 2a7e3cb32bd..4e48ad54ac0 100644 --- a/tools/src/h5format_convert/CMakeLists.txt +++ b/tools/src/h5format_convert/CMakeLists.txt @@ -4,38 +4,26 @@ project (HDF5_TOOLS_SRC_H5FC C) # -------------------------------------------------------------------- # Add the h5format_convert executables # -------------------------------------------------------------------- -if (BUILD_STATIC_LIBS) - add_executable (h5format_convert ${HDF5_TOOLS_SRC_H5FC_SOURCE_DIR}/h5format_convert.c) - target_include_directories (h5format_convert PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - target_compile_options(h5format_convert PRIVATE "${HDF5_CMAKE_C_FLAGS}") +add_executable (h5format_convert ${HDF5_TOOLS_SRC_H5FC_SOURCE_DIR}/h5format_convert.c) +target_include_directories (h5format_convert PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +target_compile_options(h5format_convert PRIVATE "${HDF5_CMAKE_C_FLAGS}") +if (HDF5_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (h5format_convert STATIC) target_link_libraries (h5format_convert PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) - set_target_properties (h5format_convert PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5format_convert") - - set (H5_DEP_EXECUTABLES h5format_convert) +else () + TARGET_C_PROPERTIES (h5format_convert SHARED) + target_link_libraries (h5format_convert PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) endif () -if (BUILD_SHARED_LIBS) - add_executable (h5format_convert-shared ${HDF5_TOOLS_SRC_H5FC_SOURCE_DIR}/h5format_convert.c) - target_include_directories (h5format_convert-shared PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - target_compile_options(h5format_convert-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") - TARGET_C_PROPERTIES (h5format_convert-shared SHARED) - target_link_libraries (h5format_convert-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - set_target_properties (h5format_convert-shared PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5format_convert-shared") +set_target_properties (h5format_convert PROPERTIES FOLDER tools) +set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5format_convert") - set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5format_convert-shared) -endif () +set (H5_DEP_EXECUTABLES h5format_convert) #----------------------------------------------------------------------------- # Add Target to clang-format #----------------------------------------------------------------------------- if (HDF5_ENABLE_FORMATTERS) - if (BUILD_STATIC_LIBS) - clang_format (HDF5_H5FORMAT_SRC_FORMAT h5format_convert) - else () - clang_format (HDF5_H5FORMAT_SRC_FORMAT h5format_convert-shared) - endif () + clang_format (HDF5_H5FORMAT_SRC_FORMAT h5format_convert) endif () ############################################################################## diff --git a/tools/src/h5import/CMakeLists.txt b/tools/src/h5import/CMakeLists.txt index f8268a1b020..4d231adeb14 100644 --- a/tools/src/h5import/CMakeLists.txt +++ b/tools/src/h5import/CMakeLists.txt @@ -4,39 +4,26 @@ project (HDF5_TOOLS_SRC_H5IMPORT C) # -------------------------------------------------------------------- # Add the h5import executables # -------------------------------------------------------------------- -if (BUILD_STATIC_LIBS) - add_executable (h5import ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.c ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.h) - target_include_directories (h5import PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +add_executable (h5import ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.c ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.h) +target_include_directories (h5import PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (HDF5_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (h5import STATIC) target_link_libraries (h5import PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) - #set_target_properties (h5import PROPERTIES COMPILE_DEFINITIONS H5DEBUGIMPORT) - set_target_properties (h5import PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5import") - - set (H5_DEP_EXECUTABLES h5import) +else () + TARGET_C_PROPERTIES (h5import SHARED) + target_link_libraries (h5import PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) endif () +#set_target_properties (h5import PROPERTIES COMPILE_DEFINITIONS H5DEBUGIMPORT) +set_target_properties (h5import PROPERTIES FOLDER tools) +set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5import") -if (BUILD_SHARED_LIBS) - add_executable (h5import-shared ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.c ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.h) - target_include_directories (h5import-shared PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (h5import-shared SHARED) - target_link_libraries (h5import-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - #set_target_properties (h5import-shared PROPERTIES COMPILE_DEFINITIONS H5DEBUGIMPORT) - set_target_properties (h5import-shared PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5import-shared") - - set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5import-shared) -endif () +set (H5_DEP_EXECUTABLES h5import) #----------------------------------------------------------------------------- # Add Target to clang-format #----------------------------------------------------------------------------- if (HDF5_ENABLE_FORMATTERS) - if (BUILD_STATIC_LIBS) - clang_format (HDF5_H5IMPORT_SRC_FORMAT h5import) - else () - clang_format (HDF5_H5IMPORT_SRC_FORMAT h5import-shared) - endif () + clang_format (HDF5_H5IMPORT_SRC_FORMAT h5import) endif () ############################################################################## diff --git a/tools/src/h5jam/CMakeLists.txt b/tools/src/h5jam/CMakeLists.txt index 7efd0d8462c..bcd7eca69ee 100644 --- a/tools/src/h5jam/CMakeLists.txt +++ b/tools/src/h5jam/CMakeLists.txt @@ -4,59 +4,41 @@ project (HDF5_TOOLS_SRC_H5JAM C) # -------------------------------------------------------------------- # Add the h5jam executables # -------------------------------------------------------------------- -if (BUILD_STATIC_LIBS) - add_executable (h5jam ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5jam.c) - target_include_directories (h5jam PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +add_executable (h5jam ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5jam.c) +target_include_directories (h5jam PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (HDF5_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (h5jam STATIC) target_link_libraries (h5jam PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) - set_target_properties (h5jam PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5jam") +else () + TARGET_C_PROPERTIES (h5jam SHARED) + target_link_libraries (h5jam PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +endif () +set_target_properties (h5jam PROPERTIES FOLDER tools) +set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5jam") - add_executable (h5unjam ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5unjam.c) - target_include_directories (h5unjam PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +add_executable (h5unjam ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5unjam.c) +target_include_directories (h5unjam PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (HDF5_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (h5unjam STATIC) target_link_libraries (h5unjam PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) - set_target_properties (h5unjam PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5unjam") - - set (H5_DEP_EXECUTABLES - h5jam - h5unjam - ) +else () + TARGET_C_PROPERTIES (h5unjam SHARED) + target_link_libraries (h5unjam PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) endif () +set_target_properties (h5unjam PROPERTIES FOLDER tools) +set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5unjam") -if (BUILD_SHARED_LIBS) - add_executable (h5jam-shared ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5jam.c) - target_include_directories (h5jam-shared PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (h5jam-shared SHARED) - target_link_libraries (h5jam-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - set_target_properties (h5jam-shared PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5jam-shared") - - add_executable (h5unjam-shared ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5unjam.c) - target_include_directories (h5unjam-shared PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (h5unjam-shared SHARED) - target_link_libraries (h5unjam-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - set_target_properties (h5unjam-shared PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5unjam-shared") - - set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} - h5jam-shared - h5unjam-shared - ) -endif () +set (H5_DEP_EXECUTABLES + h5jam + h5unjam +) #----------------------------------------------------------------------------- # Add Target to clang-format #----------------------------------------------------------------------------- if (HDF5_ENABLE_FORMATTERS) - if (BUILD_STATIC_LIBS) - clang_format (HDF5_H5JAM_SRC_FORMAT h5jam) - clang_format (HDF5_H5UNJAM_SRC_FORMAT h5unjam) - else () - clang_format (HDF5_H5JAM_SRC_FORMAT h5jam-shared) - clang_format (HDF5_H5UNJAM_SRC_FORMAT h5unjam-shared) - endif () + clang_format (HDF5_H5JAM_SRC_FORMAT h5jam) + clang_format (HDF5_H5UNJAM_SRC_FORMAT h5unjam) endif () ############################################################################## diff --git a/tools/src/h5ls/CMakeLists.txt b/tools/src/h5ls/CMakeLists.txt index 67122a10d5a..f8f7fff41a7 100644 --- a/tools/src/h5ls/CMakeLists.txt +++ b/tools/src/h5ls/CMakeLists.txt @@ -4,41 +4,27 @@ project (HDF5_TOOLS_SRC_H5LS C) #----------------------------------------------------------------------------- # Add the h5ls executable #----------------------------------------------------------------------------- -if (BUILD_STATIC_LIBS) - add_executable (h5ls ${HDF5_TOOLS_SRC_H5LS_SOURCE_DIR}/h5ls.c) - target_include_directories (h5ls PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - target_compile_options(h5ls PRIVATE "${HDF5_CMAKE_C_FLAGS}") - #target_compile_definitions(h5ls PRIVATE H5_TOOLS_DEBUG) +add_executable (h5ls ${HDF5_TOOLS_SRC_H5LS_SOURCE_DIR}/h5ls.c) +target_include_directories (h5ls PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +target_compile_options(h5ls PRIVATE "${HDF5_CMAKE_C_FLAGS}") +#target_compile_definitions(h5ls PRIVATE H5_TOOLS_DEBUG) +if (HDF5_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (h5ls STATIC) target_link_libraries (h5ls PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) - set_target_properties (h5ls PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5ls") - - set (H5_DEP_EXECUTABLES h5ls) +else () + TARGET_C_PROPERTIES (h5ls SHARED) + target_link_libraries (h5ls PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) endif () +set_target_properties (h5ls PROPERTIES FOLDER tools) +set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5ls") -if (BUILD_SHARED_LIBS) - add_executable (h5ls-shared ${HDF5_TOOLS_SRC_H5LS_SOURCE_DIR}/h5ls.c) - target_include_directories (h5ls-shared PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - target_compile_options(h5ls-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") - #target_compile_definitions(h5ls-shared PRIVATE H5_TOOLS_DEBUG) - TARGET_C_PROPERTIES (h5ls-shared SHARED) - target_link_libraries (h5ls-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - set_target_properties (h5ls-shared PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5ls-shared") - - set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5ls-shared) -endif () +set (H5_DEP_EXECUTABLES h5ls) #----------------------------------------------------------------------------- # Add Target to clang-format #----------------------------------------------------------------------------- if (HDF5_ENABLE_FORMATTERS) - if (BUILD_STATIC_LIBS) - clang_format (HDF5_H5LS_SRC_FORMAT h5ls) - else () - clang_format (HDF5_H5LS_SRC_FORMAT h5ls-shared) - endif () + clang_format (HDF5_H5LS_SRC_FORMAT h5ls) endif () ############################################################################## diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index 04c5ff3c02b..b3488d5982b 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -2858,7 +2858,8 @@ main(int argc, char *argv[]) vfd_info.info = &ros3_fa; #else - fprintf(rawerrorstream, "Error: Read-Only S3 VFD is not enabled\n\n"); + fprintf(rawerrorstream, "Error: Read-Only S3 VFD is not available unless enabled when HDF5 is " + "configured and built.\n\n"); usage(); leave(EXIT_FAILURE); #endif @@ -2881,7 +2882,9 @@ main(int argc, char *argv[]) vfd_info.info = &hdfs_fa; #else - fprintf(rawerrorstream, "Error: The HDFS VFD is not enabled\n\n"); + fprintf( + rawerrorstream, + "Error: The HDFS VFD is not available unless enabled when HDF5 is configured and built.\n\n"); usage(); leave(EXIT_FAILURE); #endif diff --git a/tools/src/h5perf/CMakeLists.txt b/tools/src/h5perf/CMakeLists.txt index 6ff52002bb3..2237f74e7fa 100644 --- a/tools/src/h5perf/CMakeLists.txt +++ b/tools/src/h5perf/CMakeLists.txt @@ -10,7 +10,7 @@ set (h5perf_serial_SOURCES ) add_executable (h5perf_serial ${h5perf_serial_SOURCES}) target_include_directories (h5perf_serial PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -if (BUILD_STATIC_LIBS) +if (HDF5_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (h5perf_serial STATIC) target_link_libraries (h5perf_serial PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) else () @@ -36,7 +36,7 @@ if (H5_HAVE_PARALLEL) ) add_executable (h5perf ${h5perf_SOURCES}) target_include_directories (h5perf PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - if (BUILD_STATIC_LIBS) + if (HDF5_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (h5perf STATIC) target_link_libraries (h5perf PRIVATE ${LINK_LIBS} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$:MPI::MPI_C>") else () @@ -46,7 +46,7 @@ if (H5_HAVE_PARALLEL) set_target_properties (h5perf PROPERTIES FOLDER perform) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5perf") - set (H5_DEP_EXECUTABLES h5perf) + set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5perf) if (HDF5_ENABLE_FORMATTERS) clang_format (HDF5_TOOLS_SRC_H5PERF_h5perf_FORMAT h5perf) diff --git a/tools/src/h5repack/CMakeLists.txt b/tools/src/h5repack/CMakeLists.txt index ea1ee8092d2..f215b05893e 100644 --- a/tools/src/h5repack/CMakeLists.txt +++ b/tools/src/h5repack/CMakeLists.txt @@ -15,39 +15,26 @@ set (REPACK_COMMON_SOURCES ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack.h ) -if (BUILD_STATIC_LIBS) - add_executable (h5repack ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_main.c) - target_include_directories (h5repack PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - target_compile_options(h5repack PRIVATE "${HDF5_CMAKE_C_FLAGS}") +add_executable (h5repack ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_main.c) +target_include_directories (h5repack PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +target_compile_options(h5repack PRIVATE "${HDF5_CMAKE_C_FLAGS}") +if (HDF5_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (h5repack STATIC) target_link_libraries (h5repack PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) - set_target_properties (h5repack PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repack") - - set (H5_DEP_EXECUTABLES h5repack) +else () + TARGET_C_PROPERTIES (h5repack SHARED) + target_link_libraries (h5repack PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) endif () +set_target_properties (h5repack PROPERTIES FOLDER tools) +set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repack") -if (BUILD_SHARED_LIBS) - add_executable (h5repack-shared ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_main.c) - target_include_directories (h5repack-shared PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - target_compile_options(h5repack-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") - TARGET_C_PROPERTIES (h5repack-shared SHARED) - target_link_libraries (h5repack-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - set_target_properties (h5repack-shared PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repack-shared") - - set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5repack-shared) -endif () +set (H5_DEP_EXECUTABLES h5repack) #----------------------------------------------------------------------------- # Add Target to clang-format #----------------------------------------------------------------------------- if (HDF5_ENABLE_FORMATTERS) - if (BUILD_STATIC_LIBS) - clang_format (HDF5_H5REPACK_SRC_FORMAT h5repack) - else () - clang_format (HDF5_H5REPACK_SRC_FORMAT h5repack-shared) - endif () + clang_format (HDF5_H5REPACK_SRC_FORMAT h5repack) endif () ############################################################################## diff --git a/tools/src/h5stat/CMakeLists.txt b/tools/src/h5stat/CMakeLists.txt index c3aef5fd990..a7b8e5cd67b 100644 --- a/tools/src/h5stat/CMakeLists.txt +++ b/tools/src/h5stat/CMakeLists.txt @@ -4,39 +4,26 @@ project (HDF5_TOOLS_SRC_H5STAT C) # -------------------------------------------------------------------- # Add the h5stat executables # -------------------------------------------------------------------- -if (BUILD_STATIC_LIBS) - add_executable (h5stat ${HDF5_TOOLS_SRC_H5STAT_SOURCE_DIR}/h5stat.c) - target_include_directories (h5stat PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - target_compile_options(h5stat PRIVATE "${HDF5_CMAKE_C_FLAGS}") +add_executable (h5stat ${HDF5_TOOLS_SRC_H5STAT_SOURCE_DIR}/h5stat.c) +target_include_directories (h5stat PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +target_compile_options(h5stat PRIVATE "${HDF5_CMAKE_C_FLAGS}") +if (HDF5_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (h5stat STATIC) target_link_libraries (h5stat PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) - set_target_properties (h5stat PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5stat") - - set (H5_DEP_EXECUTABLES h5stat) +else () + TARGET_C_PROPERTIES (h5stat SHARED) + target_link_libraries (h5stat PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) endif () +set_target_properties (h5stat PROPERTIES FOLDER tools) +set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5stat") -if (BUILD_SHARED_LIBS) - add_executable (h5stat-shared ${HDF5_TOOLS_SRC_H5STAT_SOURCE_DIR}/h5stat.c) - target_include_directories (h5stat-shared PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - target_compile_options(h5stat-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") - TARGET_C_PROPERTIES (h5stat-shared SHARED) - target_link_libraries (h5stat-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - set_target_properties (h5stat-shared PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5stat-shared") - - set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5stat-shared) -endif () +set (H5_DEP_EXECUTABLES h5stat) #----------------------------------------------------------------------------- # Add Target to clang-format #----------------------------------------------------------------------------- if (HDF5_ENABLE_FORMATTERS) - if (BUILD_STATIC_LIBS) - clang_format (HDF5_H5STAT_SRC_FORMAT h5stat) - else () - clang_format (HDF5_H5STAT_SRC_FORMAT h5stat-shared) - endif () + clang_format (HDF5_H5STAT_SRC_FORMAT h5stat) endif () ############################################################################## diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c index 15232e419a3..a90ef5e5e8f 100644 --- a/tools/src/h5stat/h5stat.c +++ b/tools/src/h5stat/h5stat.c @@ -947,7 +947,8 @@ parse_command_line(int argc, const char *const *argv, struct handler_t **hand_re drivername = drivernames[ROS3_VFD_IDX]; #else - error_msg("Read-Only S3 VFD not enabled.\n"); + error_msg( + "Read-Only S3 VFD is not available unless enabled when HDF5 is configured and built.\n"); goto error; #endif break; @@ -961,7 +962,7 @@ parse_command_line(int argc, const char *const *argv, struct handler_t **hand_re drivername = drivernames[HDFS_VFD_IDX]; #else - error_msg("HDFS VFD not enabled.\n"); + error_msg("HDFS VFD is not available unless enabled when HDF5 is configured and built.\n"); goto error; #endif break; diff --git a/tools/src/misc/CMakeLists.txt b/tools/src/misc/CMakeLists.txt index 62bd443b64f..1b4524658ba 100644 --- a/tools/src/misc/CMakeLists.txt +++ b/tools/src/misc/CMakeLists.txt @@ -5,122 +5,88 @@ project (HDF5_TOOLS_SRC_MISC C) # Add the misc executables # -------------------------------------------------------------------- #-- Misc Executables -if (BUILD_STATIC_LIBS) - add_executable (h5debug ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5debug.c) - target_include_directories (h5debug PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - target_compile_options(h5debug PRIVATE "${HDF5_CMAKE_C_FLAGS}") +add_executable (h5debug ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5debug.c) +target_include_directories (h5debug PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +target_compile_options(h5debug PRIVATE "${HDF5_CMAKE_C_FLAGS}") +if (HDF5_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (h5debug STATIC) target_link_libraries (h5debug PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) - set_target_properties (h5debug PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5debug") +else () + TARGET_C_PROPERTIES (h5debug SHARED) + target_link_libraries (h5debug PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +endif () +set_target_properties (h5debug PROPERTIES FOLDER tools) +set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5debug") - add_executable (h5repart ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5repart.c) - target_include_directories (h5repart PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - target_compile_options(h5repart PRIVATE "${HDF5_CMAKE_C_FLAGS}") +add_executable (h5repart ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5repart.c) +target_include_directories (h5repart PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +target_compile_options(h5repart PRIVATE "${HDF5_CMAKE_C_FLAGS}") +if (HDF5_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (h5repart STATIC) target_link_libraries (h5repart PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) - set_target_properties (h5repart PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repart") +else () + TARGET_C_PROPERTIES (h5repart SHARED) + target_link_libraries (h5repart PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +endif () +set_target_properties (h5repart PROPERTIES FOLDER tools) +set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repart") - add_executable (h5mkgrp ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5mkgrp.c) - target_include_directories (h5mkgrp PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - target_compile_options(h5mkgrp PRIVATE "${HDF5_CMAKE_C_FLAGS}") +add_executable (h5mkgrp ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5mkgrp.c) +target_include_directories (h5mkgrp PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +target_compile_options(h5mkgrp PRIVATE "${HDF5_CMAKE_C_FLAGS}") +if (HDF5_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (h5mkgrp STATIC) target_link_libraries (h5mkgrp PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) - set_target_properties (h5mkgrp PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5mkgrp") +else () + TARGET_C_PROPERTIES (h5mkgrp SHARED) + target_link_libraries (h5mkgrp PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +endif () +set_target_properties (h5mkgrp PROPERTIES FOLDER tools) +set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5mkgrp") - add_executable (h5clear ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5clear.c) - target_include_directories (h5clear PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - target_compile_options(h5clear PRIVATE "${HDF5_CMAKE_C_FLAGS}") +add_executable (h5clear ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5clear.c) +target_include_directories (h5clear PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +target_compile_options(h5clear PRIVATE "${HDF5_CMAKE_C_FLAGS}") +if (HDF5_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (h5clear STATIC) target_link_libraries (h5clear PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) - set_target_properties (h5clear PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5clear") +else () + TARGET_C_PROPERTIES (h5clear SHARED) + target_link_libraries (h5clear PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +endif () +set_target_properties (h5clear PROPERTIES FOLDER tools) +set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5clear") - add_executable (h5delete ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5delete.c) - target_include_directories (h5delete PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - target_compile_options(h5delete PRIVATE "${HDF5_CMAKE_C_FLAGS}") +add_executable (h5delete ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5delete.c) +target_include_directories (h5delete PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +target_compile_options(h5delete PRIVATE "${HDF5_CMAKE_C_FLAGS}") +if (HDF5_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (h5delete STATIC) target_link_libraries (h5delete PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) - set_target_properties (h5delete PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5delete") - - set (H5_DEP_EXECUTABLES - h5debug - h5repart - h5mkgrp - h5clear - h5delete - ) +else () + TARGET_C_PROPERTIES (h5delete SHARED) + target_link_libraries (h5delete PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) endif () -if (BUILD_SHARED_LIBS) - add_executable (h5debug-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5debug.c) - target_include_directories (h5debug-shared PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (h5debug-shared SHARED) - target_compile_options(h5debug-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") - target_link_libraries (h5debug-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - set_target_properties (h5debug-shared PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5debug-shared") +set_target_properties (h5delete PROPERTIES FOLDER tools) +set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5delete") - add_executable (h5repart-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5repart.c) - target_include_directories (h5repart-shared PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - target_compile_options(h5repart-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") - TARGET_C_PROPERTIES (h5repart-shared SHARED) - target_link_libraries (h5repart-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - set_target_properties (h5repart-shared PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repart-shared") - - add_executable (h5mkgrp-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5mkgrp.c) - target_include_directories (h5mkgrp-shared PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - target_compile_options(h5mkgrp-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") - TARGET_C_PROPERTIES (h5mkgrp-shared SHARED) - target_link_libraries (h5mkgrp-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - set_target_properties (h5mkgrp-shared PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5mkgrp-shared") - - add_executable (h5clear-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5clear.c) - target_include_directories (h5clear-shared PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - target_compile_options(h5clear-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") - TARGET_C_PROPERTIES (h5clear-shared SHARED) - target_link_libraries (h5clear-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - set_target_properties (h5clear-shared PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5clear-shared") - - add_executable (h5delete-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5delete.c) - target_include_directories (h5delete-shared PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - target_compile_options(h5delete-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") - TARGET_C_PROPERTIES (h5delete-shared SHARED) - target_link_libraries (h5delete-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - set_target_properties (h5delete-shared PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5delete-shared") - - set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} - h5debug-shared - h5repart-shared - h5mkgrp-shared - h5clear-shared - h5delete-shared - ) -endif () +set (H5_DEP_EXECUTABLES + h5debug + h5repart + h5mkgrp + h5clear + h5delete +) #----------------------------------------------------------------------------- # Add Target to clang-format #----------------------------------------------------------------------------- if (HDF5_ENABLE_FORMATTERS) - if (BUILD_STATIC_LIBS) - clang_format (HDF5_H5DEBUG_SRC_FORMAT h5debug) - clang_format (HDF5_H5REPART_SRC_FORMAT h5repart) - clang_format (HDF5_H5MKGRP_SRC_FORMAT h5mkgrp) - clang_format (HDF5_H5CLEAR_SRC_FORMAT h5clear) - clang_format (HDF5_H5DELETE_SRC_FORMAT h5delete) - else () - clang_format (HDF5_H5DEBUG_SRC_FORMAT h5debug-shared) - clang_format (HDF5_H5REPART_SRC_FORMAT h5repart-shared) - clang_format (HDF5_H5MKGRP_SRC_FORMAT h5mkgrp-shared) - clang_format (HDF5_H5CLEAR_SRC_FORMAT h5clear-shared) - clang_format (HDF5_H5DELETE_SRC_FORMAT h5delete-shared) - endif () + clang_format (HDF5_H5DEBUG_SRC_FORMAT h5debug) + clang_format (HDF5_H5REPART_SRC_FORMAT h5repart) + clang_format (HDF5_H5MKGRP_SRC_FORMAT h5mkgrp) + clang_format (HDF5_H5CLEAR_SRC_FORMAT h5clear) + clang_format (HDF5_H5DELETE_SRC_FORMAT h5delete) endif () ############################################################################## diff --git a/tools/test/h5copy/CMakeTests.cmake b/tools/test/h5copy/CMakeTests.cmake index b4daa87c8ed..03a783e8666 100644 --- a/tools/test/h5copy/CMakeTests.cmake +++ b/tools/test/h5copy/CMakeTests.cmake @@ -68,7 +68,7 @@ add_test ( NAME H5COPY_F-${testname} - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -f ${fparam} -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -f ${fparam} -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} ) set_tests_properties (H5COPY_F-${testname} PROPERTIES DEPENDS H5COPY_F-${testname}-clear-objects) if ("H5COPY_F-${testname}" MATCHES "${HDF5_DISABLE_TESTS_REGEX}") @@ -79,7 +79,7 @@ if (NOT "${resultcode}" STREQUAL "2") add_test ( NAME H5COPY_F-${testname}-DIFF - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY_F-${testname}-DIFF PROPERTIES DEPENDS H5COPY_F-${testname}) if ("${resultcode}" STREQUAL "1") @@ -109,7 +109,7 @@ add_test ( NAME H5COPY-${testname} - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} ) set_tests_properties (H5COPY-${testname} PROPERTIES DEPENDS H5COPY-${testname}-clear-objects) if ("H5COPY-${testname}" MATCHES "${HDF5_DISABLE_TESTS_REGEX}") @@ -120,7 +120,7 @@ if (NOT "${resultcode}" STREQUAL "2") add_test ( NAME H5COPY-${testname}-DIFF - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname}) if ("${resultcode}" STREQUAL "1") @@ -142,7 +142,7 @@ endmacro () macro (ADD_SKIP_H5_TEST testname skipresultfile) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5COPY-${testname}-${skipresultfile} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${testname}-${skipresultfile} ${ARGN}" @@ -160,7 +160,7 @@ add_test ( NAME H5COPY-${testname}-prefill - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam} ) set_tests_properties (H5COPY-${testname}-prefill PROPERTIES DEPENDS H5COPY-${testname}-clear-objects) if ("H5COPY-${testname}-prefill" MATCHES "${HDF5_DISABLE_TESTS_REGEX}") @@ -169,7 +169,7 @@ add_test ( NAME H5COPY-${testname} - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} ) set_tests_properties (H5COPY-${testname} PROPERTIES DEPENDS H5COPY-${testname}-prefill) if ("H5COPY-${testname}" MATCHES "${HDF5_DISABLE_TESTS_REGEX}") @@ -179,7 +179,7 @@ if (NOT "${resultcode}" STREQUAL "2") add_test ( NAME H5COPY-${testname}-DIFF - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname}) if ("${resultcode}" STREQUAL "1") @@ -209,7 +209,7 @@ add_test ( NAME H5COPY_SAME-${testname}-prefill - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ./testfiles/${pfile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ./testfiles/${pfile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam} ) set_tests_properties (H5COPY_SAME-${testname}-prefill PROPERTIES DEPENDS H5COPY_SAME-${testname}-clear-objects) if ("H5COPY_SAME-${testname}-prefill" MATCHES "${HDF5_DISABLE_TESTS_REGEX}") @@ -218,7 +218,7 @@ add_test ( NAME H5COPY_SAME-${testname} - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ./testfiles/${testname}.out.h5 -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ./testfiles/${testname}.out.h5 -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} ) set_tests_properties (H5COPY_SAME-${testname} PROPERTIES DEPENDS H5COPY_SAME-${testname}-prefill) if ("H5COPY_SAME-${testname}" MATCHES "${HDF5_DISABLE_TESTS_REGEX}") @@ -228,7 +228,7 @@ if (NOT "${resultcode}" STREQUAL "2") add_test ( NAME H5COPY_SAME-${testname}-DIFF - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -v ./testfiles/${testname}.out.h5 ./testfiles/${testname}.out.h5 ${srcname} ${dstname} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -v ./testfiles/${testname}.out.h5 ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY_SAME-${testname}-DIFF PROPERTIES DEPENDS H5COPY_SAME-${testname}) if ("${resultcode}" STREQUAL "1") @@ -253,15 +253,15 @@ # Similar to ADD_H5_TEST macro. Compare to outputs from source & target # files instead of checking with h5ls. # - macro (ADD_H5_CMP_TEST testname resultcode infile vparam sparam srcname dparam dstname) + macro (ADD_H5_CMP_TEST testname resultcode result_errcheck infile vparam sparam srcname dparam dstname) # Remove any output file left over from previous test run add_test ( NAME H5COPY-CMP-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}.out.h5 ) # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5COPY-CMP-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}) + if (HDF5_USING_ANALYSIS_TOOL) + add_test (NAME H5COPY-CMP-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}) if ("${resultcode}" STREQUAL "1") set_tests_properties (H5COPY-CMP-${testname} PROPERTIES WILL_FAIL "true") endif () @@ -270,15 +270,15 @@ NAME H5COPY-CMP-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=-i;./testfiles/${infile};-o;./testfiles/${testname}.out.h5;${vparam};${sparam};${srcname};${dparam};${dstname}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=./testfiles/${testname}.out.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=./testfiles/${testname}.out" - -D "TEST_ERRREF=./testfiles/${testname}.err" + -D "TEST_ERRREF=${result_errcheck}" -D "TEST_MASK=true" - -P "${HDF_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/grepTest.cmake" ) endif () set_tests_properties (H5COPY-CMP-${testname} PROPERTIES DEPENDS H5COPY-CMP-${testname}-clear-objects) @@ -293,7 +293,7 @@ endmacro () macro (ADD_H5_UD_TEST testname resultcode infile sparam srcname dparam dstname cmpfile) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) # Remove any output file left over from previous test run add_test ( NAME H5COPY_UD-${testname}-clear-objects @@ -304,7 +304,7 @@ NAME H5COPY_UD-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-v;-i;./testfiles/${infile};-o;./testfiles/${testname}.out.h5;${sparam};${srcname};${dparam};${dstname}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=./testfiles/${infile}.out" @@ -321,7 +321,7 @@ NAME H5COPY_UD-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-v;-i;./testfiles/${infile};-o;./testfiles/${testname}.out.h5;${sparam};${srcname};${dparam};${dstname}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=./testfiles/${infile}.out" @@ -342,7 +342,7 @@ NAME H5COPY_UD-${testname}-DIFF COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-v;./testfiles/${cmpfile};./testfiles/${testname}.out.h5;${srcname};${dstname}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=./testfiles/${testname}.out.h5.out" @@ -367,7 +367,7 @@ endmacro () macro (ADD_H5_UD_ERR_TEST testname resultcode infile sparam srcname dparam dstname cmpfile) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) # Remove any output file left over from previous test run add_test ( NAME H5COPY_UD_ERR-${testname}-clear-objects @@ -378,7 +378,7 @@ NAME H5COPY_UD_ERR-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-v;--enable-error-stack;-i;./testfiles/${infile};-o;./testfiles/${testname}_ERR.out.h5;${sparam};${srcname};${dparam};${dstname}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=./testfiles/${infile}_ERR.out" @@ -396,7 +396,7 @@ NAME H5COPY_UD_ERR-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-v;--enable-error-stack;-i;./testfiles/${infile};-o;./testfiles/${testname}_ERR.out.h5;${sparam};${srcname};${dparam};${dstname}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=./testfiles/${infile}_ERR.out" @@ -418,7 +418,7 @@ NAME H5COPY_UD_ERR-${testname}-DIFF COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-v;./testfiles/${cmpfile};./testfiles/${testname}_ERR.out.h5;${srcname};${dstname}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=./testfiles/${testname}_ERR.out.h5.out" @@ -444,17 +444,17 @@ macro (ADD_SIMPLE_TEST resultfile resultcode) # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5COPY-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) + if (HDF5_USING_ANALYSIS_TOOL) + add_test (NAME H5COPY-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) if (${resultcode}) set_tests_properties (H5COPY-${resultfile} PROPERTIES WILL_FAIL "true") endif () - else (HDF5_ENABLE_USING_MEMCHECKER) + else (HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5COPY-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=./testfiles/${resultfile}.out" @@ -598,7 +598,7 @@ #----------------------------------------------------------------- # "Test copying object into group which doesn't exist, without -p" # - ADD_H5_CMP_TEST (h5copy_misc1 1 ${HDF_FILE1}.h5 -v -s /simple -d /g1/g2/simple) + ADD_H5_CMP_TEST (h5copy_misc1 1 "h5copy error" ${HDF_FILE1}.h5 -v -s /simple -d /g1/g2/simple) #------------------------------------------- # "Test copying objects to the same file " diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index f993f4b40c4..3d867c7ddee 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -414,8 +414,8 @@ macro (ADD_SH5_TEST resultfile resultcode) # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DIFF-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) + if (HDF5_USING_ANALYSIS_TOOL) + add_test (NAME H5DIFF-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) if (${resultcode}) set_tests_properties (H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true") endif () @@ -424,7 +424,7 @@ NAME H5DIFF-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" @@ -444,8 +444,8 @@ macro (ADD_PH5_TEST resultfile resultcode) # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME MPI_TEST_H5DIFF-${resultfile} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $ ${MPIEXEC_POSTFLAGS} ${ARGN}) + if (HDF5_USING_ANALYSIS_TOOL) + add_test (NAME MPI_TEST_H5DIFF-${resultfile} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $ ${MPIEXEC_POSTFLAGS} ${ARGN}) set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/PAR/testfiles") if (${resultcode}) set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true") @@ -455,7 +455,7 @@ NAME MPI_TEST_H5DIFF-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=${MPIEXEC_EXECUTABLE}" - -D "TEST_ARGS:STRING=${MPIEXEC_NUMPROC_FLAG};${MPIEXEC_MAX_NUMPROCS};${MPIEXEC_PREFLAGS};$;${MPIEXEC_POSTFLAGS};${ARGN}" + -D "TEST_ARGS:STRING=${MPIEXEC_NUMPROC_FLAG};${MPIEXEC_MAX_NUMPROCS};${MPIEXEC_PREFLAGS};$;${MPIEXEC_POSTFLAGS};${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/PAR/testfiles" -D "TEST_OUTPUT=${resultfile}.out" #-D "TEST_EXPECT=${resultcode}" @@ -478,13 +478,13 @@ endmacro () macro (ADD_H5_UD_TEST testname resultcode resultfile) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) if ("${resultcode}" STREQUAL "2") add_test ( NAME H5DIFF_UD-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" @@ -501,7 +501,7 @@ NAME H5DIFF_UD-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index e997aa8dd9f..d7f39e1bb56 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -441,14 +441,14 @@ macro (ADD_HELP_TEST testname resultcode) # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) + if (HDF5_USING_ANALYSIS_TOOL) + add_test (NAME H5DUMP-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) else () add_test ( NAME H5DUMP-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=h5dump-${testname}.out" @@ -467,7 +467,7 @@ macro (ADD_SKIP_H5_TEST skipresultfile skipresultcode testtype) if ("${testtype}" STREQUAL "SKIP") - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5DUMP-${skipresultfile} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${skipresultfile} ${ARGN}" @@ -481,8 +481,8 @@ macro (ADD_H5_TEST resultfile resultcode) # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) + if (HDF5_USING_ANALYSIS_TOOL) + add_test (NAME H5DUMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") endif () @@ -494,7 +494,7 @@ NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${resultfile}.out" @@ -521,8 +521,8 @@ WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" ) # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-N-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) + if (HDF5_USING_ANALYSIS_TOOL) + add_test (NAME H5DUMP-N-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) if (${resultcode}) set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES WILL_FAIL "true") endif () @@ -534,7 +534,7 @@ NAME H5DUMP-N-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${resultfile}-N.out" @@ -570,8 +570,8 @@ WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" ) # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${resultfile}.txt ${targetfile}) + if (HDF5_USING_ANALYSIS_TOOL) + add_test (NAME H5DUMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${resultfile}.txt ${targetfile}) if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") endif () @@ -583,7 +583,7 @@ NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};${resultfile}.txt;${targetfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${resultfile}.out" @@ -615,7 +615,7 @@ COMMAND ${CMAKE_COMMAND} -E remove ${resultfile}.txt ) - if (HDF5_ENABLE_USING_MEMCHECKER) + if (HDF5_USING_ANALYSIS_TOOL) set_tests_properties (H5DUMP-${resultfile}-clean-objects PROPERTIES DEPENDS H5DUMP-${resultfile} WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" @@ -639,8 +639,8 @@ WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" ) # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --ddl=${ddlfile}.txt ${ARGN} ${resultfile}.txt ${targetfile}) + if (HDF5_USING_ANALYSIS_TOOL) + add_test (NAME H5DUMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --ddl=${ddlfile}.txt ${ARGN} ${resultfile}.txt ${targetfile}) if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") endif () @@ -653,7 +653,7 @@ NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=--ddl=${ddlfile}.txt;${ARGN};${resultfile}.txt;${targetfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${resultfile}.out" @@ -694,7 +694,7 @@ ${ddlfile}.txt ${resultfile}.txt ) - if (HDF5_ENABLE_USING_MEMCHECKER) + if (HDF5_USING_ANALYSIS_TOOL) set_tests_properties (H5DUMP-${resultfile}-clean-objects PROPERTIES DEPENDS H5DUMP-${resultfile} WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" @@ -708,7 +708,7 @@ endmacro () macro (ADD_H5_EXPORT_TEST resultfile targetfile resultcode) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5DUMP-output-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove @@ -719,7 +719,7 @@ ) add_test ( NAME H5DUMP-output-${resultfile} - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${resultfile}.txt ${targetfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${resultfile}.txt ${targetfile} ) set_tests_properties (H5DUMP-output-${resultfile} PROPERTIES DEPENDS H5DUMP-output-${resultfile}-clear-objects @@ -752,12 +752,12 @@ endmacro () macro (ADD_H5_MASK_TEST resultfile resultcode) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${resultfile}.out" @@ -776,12 +776,12 @@ endmacro () macro (ADD_H5_GREP_TEST resultfile resultcode result_check) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${resultfile}.out" @@ -799,12 +799,12 @@ endmacro () macro (ADD_H5ERR_MASK_TEST resultfile resultcode result_errcheck) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${resultfile}.out" @@ -823,12 +823,12 @@ endmacro () macro (ADD_H5ERR_MASK_ENV_TEST resultfile resultcode result_errcheck envvar envval) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${resultfile}.out" @@ -849,7 +849,7 @@ endmacro () macro (ADD_H5_BIN_EXPORT conffile resultcode testfile) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5DUMP-BIN_EXPORT-${conffile}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove @@ -862,7 +862,7 @@ NAME H5DUMP-BIN_EXPORT-${conffile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};-o;${conffile}.bin;${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${conffile}.out" @@ -890,7 +890,7 @@ macro (ADD_H5_TEST_IMPORT conffile resultfile testfile resultcode) # If using memchecker add tests without using scripts - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5DUMP-IMPORT-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove @@ -904,7 +904,7 @@ NAME H5DUMP-IMPORT-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};-o;${resultfile}.bin;${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${conffile}.out" @@ -919,7 +919,7 @@ if ("H5DUMP-IMPORT-${resultfile}" MATCHES "${HDF5_DISABLE_TESTS_REGEX}") set_tests_properties (H5DUMP-IMPORT-${resultfile} PROPERTIES DISABLED true) endif () - add_test (NAME H5DUMP-IMPORT-h5import-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${resultfile}.bin -c ${conffile}.out -o ${resultfile}.h5) + add_test (NAME H5DUMP-IMPORT-h5import-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${resultfile}.bin -c ${conffile}.out -o ${resultfile}.h5) set_tests_properties (H5DUMP-IMPORT-h5import-${resultfile} PROPERTIES DEPENDS H5DUMP-IMPORT-${resultfile} WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" @@ -927,7 +927,7 @@ if ("H5DUMP-IMPORT-h5import-${resultfile}" MATCHES "${HDF5_DISABLE_TESTS_REGEX}") set_tests_properties (H5DUMP-IMPORT-h5import-${resultfile} PROPERTIES DISABLED true) endif () - add_test (NAME H5DUMP-IMPORT-h5diff-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${testfile} ${resultfile}.h5 /integer /integer) + add_test (NAME H5DUMP-IMPORT-h5diff-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${testfile} ${resultfile}.h5 /integer /integer) set_tests_properties (H5DUMP-IMPORT-h5diff-${resultfile} PROPERTIES DEPENDS H5DUMP-IMPORT-h5import-${resultfile} WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std" @@ -949,12 +949,12 @@ endmacro () macro (ADD_H5_UD_TEST testname resultcode resultfile) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5DUMP_UD-${testname}-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${resultfile}.out" @@ -1315,14 +1315,14 @@ # NATIVE default. the NATIVE test can be validated with h5import/h5diff # ADD_H5_TEST_IMPORT (tbin1 out1D tbinary.h5 0 --enable-error-stack -d integer -b) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) ADD_H5_BIN_EXPORT (tbin2 0 tbinary.h5 --enable-error-stack -b BE -d float) endif () # the NATIVE test can be validated with h5import/h5diff # ADD_H5_TEST_IMPORT (tbin3 out3D tbinary.h5 0 --enable-error-stack -d integer -b NATIVE) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) ADD_H5_BIN_EXPORT (tbin4 0 tbinary.h5 --enable-error-stack -d double -b FILE) endif () diff --git a/tools/test/h5dump/CMakeTestsPBITS.cmake b/tools/test/h5dump/CMakeTestsPBITS.cmake index 310484611e3..4ae68846a5e 100644 --- a/tools/test/h5dump/CMakeTestsPBITS.cmake +++ b/tools/test/h5dump/CMakeTestsPBITS.cmake @@ -117,8 +117,8 @@ macro (ADD_H5_PBITS_TEST resultfile resultcode) # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) + if (HDF5_USING_ANALYSIS_TOOL) + add_test (NAME H5DUMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") endif () @@ -127,7 +127,7 @@ NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/pbits" -D "TEST_OUTPUT=${resultfile}.out" diff --git a/tools/test/h5dump/CMakeTestsVDS.cmake b/tools/test/h5dump/CMakeTestsVDS.cmake index 1589e70c159..d1dc5411a28 100644 --- a/tools/test/h5dump/CMakeTestsVDS.cmake +++ b/tools/test/h5dump/CMakeTestsVDS.cmake @@ -108,8 +108,8 @@ macro (ADD_H5_VDS_TEST resultfile resultcode) # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) + if (HDF5_USING_ANALYSIS_TOOL) + add_test (NAME H5DUMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") endif () @@ -118,7 +118,7 @@ NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/vds" -D "TEST_OUTPUT=${resultfile}.out" @@ -137,8 +137,8 @@ macro (ADD_H5_VDS_PREFIX_TEST resultfile resultcode) # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP_PREFIX-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) + if (HDF5_USING_ANALYSIS_TOOL) + add_test (NAME H5DUMP_PREFIX-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES ENVIRONMENT "HDF5_VDS_PREFIX=${PROJECT_BINARY_DIR}/testfiles/vds/" WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix" @@ -154,7 +154,7 @@ NAME H5DUMP_PREFIX-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/vds/prefix" -D "TEST_OUTPUT=${resultfile}.out" @@ -172,8 +172,8 @@ macro (ADD_H5_VDS_LAYOUT resultfile resultcode) # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -p ${ARGN}) + if (HDF5_USING_ANALYSIS_TOOL) + add_test (NAME H5DUMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -p ${ARGN}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") @@ -186,7 +186,7 @@ NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-p;${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/vds" -D "TEST_OUTPUT=${resultfile}.out" diff --git a/tools/test/h5dump/CMakeTestsXML.cmake b/tools/test/h5dump/CMakeTestsXML.cmake index ae7cd8f11c8..b322d764734 100644 --- a/tools/test/h5dump/CMakeTestsXML.cmake +++ b/tools/test/h5dump/CMakeTestsXML.cmake @@ -167,7 +167,7 @@ macro (ADD_XML_SKIP_H5_TEST skipresultfile skipresultcode testtype) if ("${testtype}" STREQUAL "SKIP") - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5DUMP_XML-${skipresultfile} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${skipresultfile}.xml --xml ${ARGN}" @@ -180,8 +180,8 @@ endmacro () macro (ADD_XML_H5_TEST resultfile resultcode) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP_XML-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --xml ${ARGN}) + if (HDF5_USING_ANALYSIS_TOOL) + add_test (NAME H5DUMP_XML-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --xml ${ARGN}) if (${resultcode}) set_tests_properties (H5DUMP_XML-${resultfile} PROPERTIES WILL_FAIL "true") endif () @@ -190,7 +190,7 @@ NAME H5DUMP_XML-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=--xml;${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/xml" -D "TEST_OUTPUT=${resultfile}.out" diff --git a/tools/test/h5dump/CMakeVFDTests.cmake b/tools/test/h5dump/CMakeVFDTests.cmake index 01187254764..aabcb6dec90 100644 --- a/tools/test/h5dump/CMakeVFDTests.cmake +++ b/tools/test/h5dump/CMakeVFDTests.cmake @@ -24,7 +24,42 @@ set (HDF5_VFD_H5DUMP_FILES packedbits ) +set (HDF5_SF_VFD_H5DUMP_FILES + test_subfiling_stripe_sizes.h5 +) + +set (HDF5_SF2_VFD_H5DUMP_FILES + test_subfiling_precreate_rank_0.h5 +) + foreach (vfdtest ${VFD_LIST}) + if (vfdtest STREQUAL "subfiling") + foreach (h5_tfile ${HDF5_SF_VFD_H5DUMP_FILES}) + file(COPY "${PROJECT_SOURCE_DIR}/testfiles/${h5_tfile}" DESTINATION "${PROJECT_BINARY_DIR}/${vfdtest}") + execute_process( + COMMAND ls -i ${PROJECT_BINARY_DIR}/${vfdtest}/${h5_tfile} + OUTPUT_VARIABLE OUTPUT_VALUE + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + string(REGEX MATCH "^ *([0-9]+) *" INODE_VALUE "${OUTPUT_VALUE}") + string(STRIP ${INODE_VALUE} INODE_STR) + HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/${h5_tfile}.subfile_1_of_1" "${PROJECT_BINARY_DIR}/${vfdtest}/${h5_tfile}.subfile_${INODE_STR}_1_of_1" "HDF5_SF_VFD_H5DUMP_files") + HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/${h5_tfile}.subfile.config" "${PROJECT_BINARY_DIR}/${vfdtest}/${h5_tfile}.subfile_${INODE_STR}.config" "HDF5_SF_VFD_H5DUMP_files") + endforeach () + foreach (h5_tfile ${HDF5_SF2_VFD_H5DUMP_FILES}) + file(COPY "${PROJECT_SOURCE_DIR}/testfiles/${h5_tfile}" DESTINATION "${PROJECT_BINARY_DIR}/${vfdtest}") + execute_process( + COMMAND ls -i ${PROJECT_BINARY_DIR}/${vfdtest}/${h5_tfile} + OUTPUT_VARIABLE OUTPUT_VALUE + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + string(REGEX MATCH "^ *([0-9]+) *" INODE_VALUE "${OUTPUT_VALUE}") + string(STRIP ${INODE_VALUE} INODE_STR) + HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/${h5_tfile}.subfile_1_of_2" "${PROJECT_BINARY_DIR}/${vfdtest}/${h5_tfile}.subfile_${INODE_STR}_1_of_2" "HDF5_SF2_VFD_H5DUMP_files") + HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/${h5_tfile}.subfile_2_of_2" "${PROJECT_BINARY_DIR}/${vfdtest}/${h5_tfile}.subfile_${INODE_STR}_2_of_2" "HDF5_SF2_VFD_H5DUMP_files") + HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/${h5_tfile}.subfile.config" "${PROJECT_BINARY_DIR}/${vfdtest}/${h5_tfile}.subfile_${INODE_STR}.config" "HDF5_SF2_VFD_H5DUMP_files") + endforeach () + endif () foreach (h5_tfile ${HDF5_VFD_H5DUMP_FILES}) HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/${h5_tfile}.h5" "${PROJECT_BINARY_DIR}/${vfdtest}/${h5_tfile}.h5" "HDF5_VFD_H5DUMP_files") HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/expected/${h5_tfile}.ddl" "${PROJECT_BINARY_DIR}/${vfdtest}/${h5_tfile}.ddl" "HDF5_VFD_H5DUMP_files") @@ -32,6 +67,8 @@ foreach (vfdtest ${VFD_LIST}) endforeach () add_custom_target(HDF5_VFD_H5DUMP_files ALL COMMENT "Copying files needed by HDF5_VFD_H5DUMP tests" DEPENDS ${HDF5_VFD_H5DUMP_files_list}) +add_custom_target(HDF5_SF_VFD_H5DUMP_files ALL COMMENT "Copying files needed by HDF5_SF_VFD_H5DUMP tests" DEPENDS ${HDF5_SF_VFD_H5DUMP_files_list}) +add_custom_target(HDF5_SF2_VFD_H5DUMP_files ALL COMMENT "Copying files needed by HDF5_SF2_VFD_H5DUMP tests" DEPENDS ${HDF5_SF2_VFD_H5DUMP_files_list}) ############################################################################## ############################################################################## @@ -40,12 +77,12 @@ add_custom_target(HDF5_VFD_H5DUMP_files ALL COMMENT "Copying files needed by HDF ############################################################################## macro (ADD_VFD_H5DUMP_TEST vfdname resultfile resultcode) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5DUMP_VFD-${vfdname}-${resultfile}-h5dump COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_VFD:STRING=${vfdname}" -D "TEST_EXPECT=${resultcode}" @@ -69,6 +106,12 @@ endmacro () # Run test with different Virtual File Driver foreach (vfd ${VFD_LIST}) - # test for signed/unsigned datasets + if (vfd STREQUAL "subfiling") + ADD_VFD_H5DUMP_TEST (${vfd} filedriver_subfiling 0 --enable-error-stack=2 --filedriver=subfiling test_subfiling_stripe_sizes.h5) + ADD_VFD_H5DUMP_TEST (${vfd} vfd_name_subfiling 0 --enable-error-stack=2 --vfd-name=subfiling test_subfiling_stripe_sizes.h5) + ADD_VFD_H5DUMP_TEST (${vfd} vfd_value_subfiling 0 --enable-error-stack=2 --vfd-value=12 test_subfiling_stripe_sizes.h5) + ADD_VFD_H5DUMP_TEST (${vfd} vfd_value_subfiling_2 0 --enable-error-stack=2 --vfd-value=12 -d DSET -s 0 -S 100 -c 10 test_subfiling_precreate_rank_0.h5) + endif () + # test for signed/unsigned datasets ADD_VFD_H5DUMP_TEST (${vfd} packedbits 0 --enable-error-stack packedbits.h5) endforeach () diff --git a/tools/test/h5dump/expected/h5dump-help.txt b/tools/test/h5dump/expected/h5dump-help.txt index 9274600ce03..45beb63d23b 100644 --- a/tools/test/h5dump/expected/h5dump-help.txt +++ b/tools/test/h5dump/expected/h5dump-help.txt @@ -103,9 +103,9 @@ usage: h5dump [OPTIONS] files (Alternate compact form of subsetting is described in the Reference Manual) --------------- Option Argument Conventions --------------- - D - is the file driver to use in opening the file. Acceptable values - are "sec2", "family", "split", "multi", "direct", and "stream". Without - the file driver flag, the file will be opened with each driver in + D - is the file driver to use in opening the file. Acceptable values are available from + https://portal.hdfgroup.org/documentation/hdf5-docs/registered_virtual_file_drivers_vfds.html. + Without the file driver flag, the file will be opened with each driver in turn and in the order specified above until one driver succeeds in opening the file. See examples below for family, split, and multi driver special file name usage. diff --git a/tools/test/h5dump/expected/pbits/tnofilename-with-packed-bits.ddl b/tools/test/h5dump/expected/pbits/tnofilename-with-packed-bits.ddl index 9274600ce03..45beb63d23b 100644 --- a/tools/test/h5dump/expected/pbits/tnofilename-with-packed-bits.ddl +++ b/tools/test/h5dump/expected/pbits/tnofilename-with-packed-bits.ddl @@ -103,9 +103,9 @@ usage: h5dump [OPTIONS] files (Alternate compact form of subsetting is described in the Reference Manual) --------------- Option Argument Conventions --------------- - D - is the file driver to use in opening the file. Acceptable values - are "sec2", "family", "split", "multi", "direct", and "stream". Without - the file driver flag, the file will be opened with each driver in + D - is the file driver to use in opening the file. Acceptable values are available from + https://portal.hdfgroup.org/documentation/hdf5-docs/registered_virtual_file_drivers_vfds.html. + Without the file driver flag, the file will be opened with each driver in turn and in the order specified above until one driver succeeds in opening the file. See examples below for family, split, and multi driver special file name usage. diff --git a/tools/test/h5dump/expected/pbits/tpbitsIncomplete.ddl b/tools/test/h5dump/expected/pbits/tpbitsIncomplete.ddl index 9274600ce03..45beb63d23b 100644 --- a/tools/test/h5dump/expected/pbits/tpbitsIncomplete.ddl +++ b/tools/test/h5dump/expected/pbits/tpbitsIncomplete.ddl @@ -103,9 +103,9 @@ usage: h5dump [OPTIONS] files (Alternate compact form of subsetting is described in the Reference Manual) --------------- Option Argument Conventions --------------- - D - is the file driver to use in opening the file. Acceptable values - are "sec2", "family", "split", "multi", "direct", and "stream". Without - the file driver flag, the file will be opened with each driver in + D - is the file driver to use in opening the file. Acceptable values are available from + https://portal.hdfgroup.org/documentation/hdf5-docs/registered_virtual_file_drivers_vfds.html. + Without the file driver flag, the file will be opened with each driver in turn and in the order specified above until one driver succeeds in opening the file. See examples below for family, split, and multi driver special file name usage. diff --git a/tools/test/h5dump/expected/pbits/tpbitsLengthExceeded.ddl b/tools/test/h5dump/expected/pbits/tpbitsLengthExceeded.ddl index 9274600ce03..45beb63d23b 100644 --- a/tools/test/h5dump/expected/pbits/tpbitsLengthExceeded.ddl +++ b/tools/test/h5dump/expected/pbits/tpbitsLengthExceeded.ddl @@ -103,9 +103,9 @@ usage: h5dump [OPTIONS] files (Alternate compact form of subsetting is described in the Reference Manual) --------------- Option Argument Conventions --------------- - D - is the file driver to use in opening the file. Acceptable values - are "sec2", "family", "split", "multi", "direct", and "stream". Without - the file driver flag, the file will be opened with each driver in + D - is the file driver to use in opening the file. Acceptable values are available from + https://portal.hdfgroup.org/documentation/hdf5-docs/registered_virtual_file_drivers_vfds.html. + Without the file driver flag, the file will be opened with each driver in turn and in the order specified above until one driver succeeds in opening the file. See examples below for family, split, and multi driver special file name usage. diff --git a/tools/test/h5dump/expected/pbits/tpbitsLengthPositive.ddl b/tools/test/h5dump/expected/pbits/tpbitsLengthPositive.ddl index 9274600ce03..45beb63d23b 100644 --- a/tools/test/h5dump/expected/pbits/tpbitsLengthPositive.ddl +++ b/tools/test/h5dump/expected/pbits/tpbitsLengthPositive.ddl @@ -103,9 +103,9 @@ usage: h5dump [OPTIONS] files (Alternate compact form of subsetting is described in the Reference Manual) --------------- Option Argument Conventions --------------- - D - is the file driver to use in opening the file. Acceptable values - are "sec2", "family", "split", "multi", "direct", and "stream". Without - the file driver flag, the file will be opened with each driver in + D - is the file driver to use in opening the file. Acceptable values are available from + https://portal.hdfgroup.org/documentation/hdf5-docs/registered_virtual_file_drivers_vfds.html. + Without the file driver flag, the file will be opened with each driver in turn and in the order specified above until one driver succeeds in opening the file. See examples below for family, split, and multi driver special file name usage. diff --git a/tools/test/h5dump/expected/pbits/tpbitsMaxExceeded.ddl b/tools/test/h5dump/expected/pbits/tpbitsMaxExceeded.ddl index 9274600ce03..45beb63d23b 100644 --- a/tools/test/h5dump/expected/pbits/tpbitsMaxExceeded.ddl +++ b/tools/test/h5dump/expected/pbits/tpbitsMaxExceeded.ddl @@ -103,9 +103,9 @@ usage: h5dump [OPTIONS] files (Alternate compact form of subsetting is described in the Reference Manual) --------------- Option Argument Conventions --------------- - D - is the file driver to use in opening the file. Acceptable values - are "sec2", "family", "split", "multi", "direct", and "stream". Without - the file driver flag, the file will be opened with each driver in + D - is the file driver to use in opening the file. Acceptable values are available from + https://portal.hdfgroup.org/documentation/hdf5-docs/registered_virtual_file_drivers_vfds.html. + Without the file driver flag, the file will be opened with each driver in turn and in the order specified above until one driver succeeds in opening the file. See examples below for family, split, and multi driver special file name usage. diff --git a/tools/test/h5dump/expected/pbits/tpbitsOffsetExceeded.ddl b/tools/test/h5dump/expected/pbits/tpbitsOffsetExceeded.ddl index 9274600ce03..45beb63d23b 100644 --- a/tools/test/h5dump/expected/pbits/tpbitsOffsetExceeded.ddl +++ b/tools/test/h5dump/expected/pbits/tpbitsOffsetExceeded.ddl @@ -103,9 +103,9 @@ usage: h5dump [OPTIONS] files (Alternate compact form of subsetting is described in the Reference Manual) --------------- Option Argument Conventions --------------- - D - is the file driver to use in opening the file. Acceptable values - are "sec2", "family", "split", "multi", "direct", and "stream". Without - the file driver flag, the file will be opened with each driver in + D - is the file driver to use in opening the file. Acceptable values are available from + https://portal.hdfgroup.org/documentation/hdf5-docs/registered_virtual_file_drivers_vfds.html. + Without the file driver flag, the file will be opened with each driver in turn and in the order specified above until one driver succeeds in opening the file. See examples below for family, split, and multi driver special file name usage. diff --git a/tools/test/h5dump/expected/pbits/tpbitsOffsetNegative.ddl b/tools/test/h5dump/expected/pbits/tpbitsOffsetNegative.ddl index 9274600ce03..45beb63d23b 100644 --- a/tools/test/h5dump/expected/pbits/tpbitsOffsetNegative.ddl +++ b/tools/test/h5dump/expected/pbits/tpbitsOffsetNegative.ddl @@ -103,9 +103,9 @@ usage: h5dump [OPTIONS] files (Alternate compact form of subsetting is described in the Reference Manual) --------------- Option Argument Conventions --------------- - D - is the file driver to use in opening the file. Acceptable values - are "sec2", "family", "split", "multi", "direct", and "stream". Without - the file driver flag, the file will be opened with each driver in + D - is the file driver to use in opening the file. Acceptable values are available from + https://portal.hdfgroup.org/documentation/hdf5-docs/registered_virtual_file_drivers_vfds.html. + Without the file driver flag, the file will be opened with each driver in turn and in the order specified above until one driver succeeds in opening the file. See examples below for family, split, and multi driver special file name usage. diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index aed3eda04e2..e12690c5d45 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -3884,7 +3884,7 @@ gent_multi(void) for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { memb_fapl[mt] = H5P_DEFAULT; memb_map[mt] = mt; - sprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); + snprintf(sv[mt], 1024, "%%s-%c.h5", multi_letters[mt]); memb_name[mt] = sv[mt]; /*printf("memb_name[%d]=%s, memb_map[%d]=%d; ", mt, memb_name[mt], mt, memb_map[mt]);*/ memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10); diff --git a/tools/test/h5dump/testfiles/test_subfiling_precreate_rank_0.h5 b/tools/test/h5dump/testfiles/test_subfiling_precreate_rank_0.h5 new file mode 100644 index 00000000000..92abb7800ca Binary files /dev/null and b/tools/test/h5dump/testfiles/test_subfiling_precreate_rank_0.h5 differ diff --git a/tools/test/h5dump/testfiles/test_subfiling_precreate_rank_0.h5.subfile.config b/tools/test/h5dump/testfiles/test_subfiling_precreate_rank_0.h5.subfile.config new file mode 100644 index 00000000000..fb7392736ee --- /dev/null +++ b/tools/test/h5dump/testfiles/test_subfiling_precreate_rank_0.h5.subfile.config @@ -0,0 +1,2 @@ +stripe_size=22495773 +subfile_count=2 diff --git a/tools/test/h5dump/testfiles/test_subfiling_precreate_rank_0.h5.subfile_1_of_2 b/tools/test/h5dump/testfiles/test_subfiling_precreate_rank_0.h5.subfile_1_of_2 new file mode 100644 index 00000000000..0f7d3174e9e Binary files /dev/null and b/tools/test/h5dump/testfiles/test_subfiling_precreate_rank_0.h5.subfile_1_of_2 differ diff --git a/tools/test/h5dump/testfiles/test_subfiling_precreate_rank_0.h5.subfile_2_of_2 b/tools/test/h5dump/testfiles/test_subfiling_precreate_rank_0.h5.subfile_2_of_2 new file mode 100644 index 00000000000..fc78f6a9236 Binary files /dev/null and b/tools/test/h5dump/testfiles/test_subfiling_precreate_rank_0.h5.subfile_2_of_2 differ diff --git a/tools/test/h5dump/testfiles/test_subfiling_stripe_sizes.h5 b/tools/test/h5dump/testfiles/test_subfiling_stripe_sizes.h5 new file mode 100644 index 00000000000..d04021528dd Binary files /dev/null and b/tools/test/h5dump/testfiles/test_subfiling_stripe_sizes.h5 differ diff --git a/tools/test/h5dump/testfiles/test_subfiling_stripe_sizes.h5.subfile.config b/tools/test/h5dump/testfiles/test_subfiling_stripe_sizes.h5.subfile.config new file mode 100644 index 00000000000..8b8b5972487 --- /dev/null +++ b/tools/test/h5dump/testfiles/test_subfiling_stripe_sizes.h5.subfile.config @@ -0,0 +1,2 @@ +stripe_size=12149997 +subfile_count=1 diff --git a/tools/test/h5dump/testfiles/test_subfiling_stripe_sizes.h5.subfile_1_of_1 b/tools/test/h5dump/testfiles/test_subfiling_stripe_sizes.h5.subfile_1_of_1 new file mode 100644 index 00000000000..ba79d7c3496 Binary files /dev/null and b/tools/test/h5dump/testfiles/test_subfiling_stripe_sizes.h5.subfile_1_of_1 differ diff --git a/tools/test/h5format_convert/CMakeTests.cmake b/tools/test/h5format_convert/CMakeTests.cmake index ecf16bfcdf7..49b9bbc26c5 100644 --- a/tools/test/h5format_convert/CMakeTests.cmake +++ b/tools/test/h5format_convert/CMakeTests.cmake @@ -99,7 +99,7 @@ macro (ADD_H5_OUTPUT testname resultfile resultcode testfile) # If using memchecker add tests without using scripts - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5FC-${testname}-${testfile}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}-tmp.h5 @@ -116,7 +116,7 @@ NAME H5FC-${testname}-${testfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN};${testname}-tmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}-${testfile}.out" @@ -137,7 +137,7 @@ NAME H5FC-${testname}-${testfile}-NA COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}-${testfile}.out" @@ -164,7 +164,7 @@ macro (ADD_H5_NOERR_OUTPUT testname resultfile resultcode testfile) # If using memchecker add tests without using scripts - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5FC-${testname}-${testfile}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}-tmp.h5 @@ -180,7 +180,7 @@ NAME H5FC-${testname}-${testfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN};${testname}-tmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}-${testfile}.out" @@ -206,7 +206,7 @@ macro (ADD_H5_MASK_OUTPUT testname resultfile resultcode result_errcheck testfile) # If using memchecker add tests without using scripts - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5FC-${testname}-${testfile}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}-tmp.h5 @@ -222,7 +222,7 @@ NAME H5FC-${testname}-${testfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN};${testname}-tmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}-${testfile}.out" @@ -249,7 +249,7 @@ macro (ADD_H5_TEST testname resultcode testfile) # If using memchecker add tests without using scripts - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5FC-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove @@ -278,7 +278,7 @@ NAME H5FC-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN};./testfiles/${testname}-tmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=testfiles/${testname}.out" @@ -298,7 +298,7 @@ macro (ADD_H5_CHECK_IDX dependtest testname) # If using memchecker add tests without using scripts - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5FC_CHECK_IDX-${dependtest}-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ./testfiles/${dependtest}-tmp.h5 ${ARGN} @@ -315,7 +315,7 @@ macro (ADD_H5_TEST_CHECK_IDX testname resultcode testfile) # If using memchecker add tests without using scripts - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5FC_TEST_CHECK_IDX-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove @@ -332,7 +332,7 @@ NAME H5FC_TEST_CHECK_IDX-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=-d;${ARGN};./testfiles/${testname}-tmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=testfiles/${testname}.out" @@ -369,7 +369,7 @@ macro (ADD_H5_H5DUMP_CHECK testname) # If using memchecker skip tests - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5FC_H5DUMP_CHECK-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove @@ -386,7 +386,7 @@ NAME H5FC_H5DUMP_CHECK-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN};./testfiles/${testname}-tmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=testfiles/${testname}.out" @@ -404,7 +404,7 @@ NAME H5FC_H5DUMP_CHECK-${testname}-dump COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-BH;${testname}-tmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}_chk.out" diff --git a/tools/test/h5import/CMakeTests.cmake b/tools/test/h5import/CMakeTests.cmake index 71c042137f9..9bcc617d737 100644 --- a/tools/test/h5import/CMakeTests.cmake +++ b/tools/test/h5import/CMakeTests.cmake @@ -113,7 +113,7 @@ FIXTURES_REQUIRED set_h5importtest ) - add_test (NAME H5IMPORT-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${importfile} -c ${conffile} -o ${testfile}) + add_test (NAME H5IMPORT-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${importfile} -c ${conffile} -o ${testfile}) set_tests_properties (H5IMPORT-${testname} PROPERTIES DEPENDS H5IMPORT-${testname}-clear-objects FIXTURES_REQUIRED set_h5importtest @@ -122,12 +122,12 @@ set_tests_properties (H5IMPORT-${testname} PROPERTIES DISABLED true) endif () # If using memchecker skip macro based tests - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5IMPORT-${testname}-H5DMP COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${testfile}.new" @@ -148,7 +148,7 @@ NAME H5IMPORT-${testname}-H5DMP_CMP COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=testfiles/${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${testfile}.out" @@ -180,7 +180,7 @@ macro (ADD_H5_DUMPTEST testname datasetname testfile) # If using memchecker skip tests - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5IMPORT-DUMP-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove @@ -198,7 +198,7 @@ NAME H5IMPORT-DUMP-${testname}-H5DMP COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-p;-d;${datasetname};-o;d${testfile}.bin;-b;NATIVE;testfiles/${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=d${testfile}.dmp" @@ -212,7 +212,7 @@ NAME H5IMPORT-DUMP-${testname}-H5DMP COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-p;-d;${datasetname};-o;d${testfile}.bin;-y;--width=1;testfiles/${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=d${testfile}.dmp" @@ -234,7 +234,7 @@ NAME H5IMPORT-DUMP-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=d${testfile}.bin;-c;d${testfile}.dmp;-o;d${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=d${testfile}.imp" @@ -254,7 +254,7 @@ NAME H5IMPORT-DUMP-${testname}-H5DFF COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-r;d${testfile};testfiles/${testfile};${datasetname};${datasetname}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=d${testfile}.dff" @@ -287,7 +287,7 @@ macro (ADD_H5_DUMPSUBTEST testname testfile datasetname) # If using memchecker skip tests - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5IMPORT_SUB-DUMP-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove @@ -303,7 +303,7 @@ NAME H5IMPORT_SUB-DUMP-${testname}-H5DMP COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-p;-d;${datasetname};${ARGN};-o;ds${testname}.bin;-b;NATIVE;testfiles/${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=ds${testname}.dmp" @@ -324,7 +324,7 @@ NAME H5IMPORT_SUB-DUMP-${testname}-H5IMP COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=ds${testname}.bin;-c;ds${testname}.dmp;-o;ds${testname}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=ds${testname}.imp" @@ -343,7 +343,7 @@ NAME H5IMPORT_SUB-DUMP-${testname}-CMP COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-p;ds${testname}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=ds${testname}.dmp" @@ -374,7 +374,7 @@ endmacro () macro (ADD_H5_SKIP_DUMPTEST testname datasetname testfile) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5IMPORT-DUMP-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${testname} ${datasetname} ${testfile} --- DEFLATE filter not available" @@ -396,7 +396,7 @@ ############################################################################## ############################################################################## - if (HDF5_ENABLE_USING_MEMCHECKER) + if (HDF5_USING_ANALYSIS_TOOL) # Remove any output file left over from previous test run add_test ( NAME H5IMPORT-clear-objects diff --git a/tools/test/h5jam/CMakeTests.cmake b/tools/test/h5jam/CMakeTests.cmake index d87899a604d..2b82e79c15c 100644 --- a/tools/test/h5jam/CMakeTests.cmake +++ b/tools/test/h5jam/CMakeTests.cmake @@ -53,8 +53,8 @@ # macro (TEST_H5JAM_OUTPUT expectfile resultcode) # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5JAM-${expectfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) + if (HDF5_USING_ANALYSIS_TOOL) + add_test (NAME H5JAM-${expectfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) if (${resultcode}) set_tests_properties (H5JAM-${expectfile} PROPERTIES WILL_FAIL "true") endif () @@ -63,7 +63,7 @@ NAME H5JAM-${expectfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${expectfile}.out" @@ -85,8 +85,8 @@ # macro (TEST_H5UNJAM_OUTPUT expectfile resultcode) # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5JAM-UNJAM-${expectfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) + if (HDF5_USING_ANALYSIS_TOOL) + add_test (NAME H5JAM-UNJAM-${expectfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) if (${resultcode}) set_tests_properties (H5JAM-UNJAM-${expectfile} PROPERTIES WILL_FAIL "true") endif () @@ -95,7 +95,7 @@ NAME H5JAM-UNJAM-${expectfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${expectfile}.out" @@ -111,12 +111,12 @@ macro (CHECKFILE testname testdepends expected actual) # If using memchecker add tests without using scripts - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5JAM-${testname}-CHECKFILE-H5DMP COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=testfiles/${expected}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${actual}.new" @@ -133,7 +133,7 @@ NAME H5JAM-${testname}-CHECKFILE-H5DMP_CMP COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${actual}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${actual}.out" @@ -150,7 +150,7 @@ endmacro() macro (UNJAMTEST testname setfile infile ufile chkfile outfile) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5JAM-${testname}-UNJAM-SETUP-clear-objects COMMAND ${CMAKE_COMMAND} -E remove ${infile} @@ -171,7 +171,7 @@ COMMAND ${CMAKE_COMMAND} -E remove ${ufile} ) set_tests_properties (H5JAM-${testname}-UNJAM_D-clear-objects PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects) - add_test (NAME H5JAM-${testname}-UNJAM COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ${infile} -u ${ufile} -o ${outfile}) + add_test (NAME H5JAM-${testname}-UNJAM COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ${infile} -u ${ufile} -o ${outfile}) set_tests_properties (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM_D-clear-objects) set (compare_test ${ufile}) else () @@ -180,7 +180,7 @@ NAME H5JAM-${testname}-UNJAM COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-i;${infile};-o;${outfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${outfile}.ufile.txt" @@ -191,7 +191,7 @@ set_tests_properties (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects) set (compare_test "${outfile}.ufile.txt") else () - add_test (NAME H5JAM-${testname}-UNJAM COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ${infile} -o ${outfile}) + add_test (NAME H5JAM-${testname}-UNJAM COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ${infile} -o ${outfile}) set_tests_properties (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects) set (compare_test "") endif () @@ -256,17 +256,17 @@ endmacro() macro (JAMTEST testname jamfile infile chkfile outfile) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5JAM-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove ${outfile} ${infile}.cpy.h5 ) endif () - add_test (NAME H5JAM-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -u testfiles/${jamfile} -i testfiles/${infile} -o ${outfile} ${ARGN}) + add_test (NAME H5JAM-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -u testfiles/${jamfile} -i testfiles/${infile} -o ${outfile} ${ARGN}) if ("H5JAM-${testname}" MATCHES "${HDF5_DISABLE_TESTS_REGEX}") set_tests_properties (H5JAM-${testname} PROPERTIES DISABLED true) endif () - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) set_tests_properties (H5JAM-${testname} PROPERTIES DEPENDS H5JAM-${testname}-clear-objects) set (compare_test ${outfile}) set (compare_orig testfiles/${infile}) @@ -305,7 +305,7 @@ endmacro () macro (JAMTEST_NONE testname jamfile infile setfile chkfile) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5JAM-${testname}_NONE-clear-objects COMMAND ${CMAKE_COMMAND} -E remove @@ -326,7 +326,7 @@ set_tests_properties (H5JAM-${testname}_NONE_COPY PROPERTIES DISABLED true) endif () - add_test (NAME H5JAM-${testname}_NONE COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -u testfiles/${jamfile} -i ${chkfile} ${ARGN}) + add_test (NAME H5JAM-${testname}_NONE COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -u testfiles/${jamfile} -i ${chkfile} ${ARGN}) set_tests_properties (H5JAM-${testname}_NONE PROPERTIES DEPENDS H5JAM-${testname}_NONE_COPY) if ("H5JAM-${testname}_NONE" MATCHES "${HDF5_DISABLE_TESTS_REGEX}") set_tests_properties (H5JAM-${testname}_NONE PROPERTIES DISABLED true) diff --git a/tools/test/h5ls/CMakeTests.cmake b/tools/test/h5ls/CMakeTests.cmake index 629f3241ed8..02b1dfe00a8 100644 --- a/tools/test/h5ls/CMakeTests.cmake +++ b/tools/test/h5ls/CMakeTests.cmake @@ -143,8 +143,8 @@ macro (ADD_H5_TEST resultfile resultcode) # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5LS-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) + if (HDF5_USING_ANALYSIS_TOOL) + add_test (NAME H5LS-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" ) @@ -157,7 +157,7 @@ NAME H5LS-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" @@ -174,10 +174,10 @@ endif () endmacro () - macro (ADD_H5_ERR_TEST resultfile resultcode) + macro (ADD_H5_ERR_TEST resultfile resultcode result_errcheck) # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5LS-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) + if (HDF5_USING_ANALYSIS_TOOL) + add_test (NAME H5LS-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if ("${resultcode}" STREQUAL "1") set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true") @@ -187,14 +187,15 @@ NAME H5LS-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ls" - -D "TEST_ERRREF=${resultfile}.err" - -P "${HDF_RESOURCES_DIR}/runTest.cmake" + -D "TEST_ERRREF=${result_errcheck}" + -D "TEST_SKIP_COMPARE=true" + -P "${HDF_RESOURCES_DIR}/grepTest.cmake" ) endif () set_tests_properties (H5LS-${resultfile} PROPERTIES @@ -206,12 +207,12 @@ endmacro () macro (ADD_H5_UD_TEST testname resultcode resultfile) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5LS_UD-${testname}-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" @@ -264,7 +265,7 @@ # test for displaying groups # The following combination of arguments is expected to return an error message # and return value 1 - ADD_H5_ERR_TEST (tgroup-1 1 -w80 -r -g tgroup.h5) + ADD_H5_ERR_TEST (tgroup-1 1 "option not compatible" -w80 -r -g tgroup.h5) ADD_H5_TEST (tgroup-2 0 -w80 -g tgroup.h5/g1) # test for files with groups that have long comments @@ -305,7 +306,7 @@ # tests for no-dangling-links # if this option is given on dangling link, h5ls should return exit code 1 # when used alone , expect to print out help and return exit code 1 - ADD_H5_ERR_TEST (textlinksrc-nodangle-1 1 -w80 --no-dangling-links textlinksrc.h5) + ADD_H5_ERR_TEST (textlinksrc-nodangle-1 1 "no-dangling-links must be used" -w80 --no-dangling-links textlinksrc.h5) # external dangling link - expected exit code 1 ADD_H5_TEST (textlinksrc-nodangle-2 1 -w80 --follow-symlinks --no-dangling-links textlinksrc.h5) # soft dangling link - expected exit code 1 @@ -367,7 +368,7 @@ endif () # test for non-existing file - ADD_H5_ERR_TEST (nosuchfile 1 nosuchfile.h5) + ADD_H5_ERR_TEST (nosuchfile 1 "unable to open file" nosuchfile.h5) # test for variable length data types in verbose mode if (H5_WORDS_BIGENDIAN) diff --git a/tools/test/h5ls/CMakeTestsVDS.cmake b/tools/test/h5ls/CMakeTestsVDS.cmake index 9bf40420b58..4658bdc233b 100644 --- a/tools/test/h5ls/CMakeTestsVDS.cmake +++ b/tools/test/h5ls/CMakeTestsVDS.cmake @@ -83,8 +83,8 @@ macro (ADD_H5_VDS_TEST resultfile resultcode) # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5LS-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) + if (HDF5_USING_ANALYSIS_TOOL) + add_test (NAME H5LS-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") if ("${resultcode}" STREQUAL "1") set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true") @@ -94,7 +94,7 @@ NAME H5LS-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/vds" -D "TEST_OUTPUT=${resultfile}.out" @@ -110,8 +110,8 @@ macro (ADD_H5_VDS_PREFIX_TEST resultfile resultcode) # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5LS_PREFIX-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) + if (HDF5_USING_ANALYSIS_TOOL) + add_test (NAME H5LS_PREFIX-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES ENVIRONMENT "HDF5_VDS_PREFIX=\${ORIGIN}" WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" @@ -124,7 +124,7 @@ NAME H5LS_PREFIX-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=vds/prefix/${resultfile}.out" diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake index 3fb5d569743..b4a92e77ef2 100644 --- a/tools/test/h5repack/CMakeTests.cmake +++ b/tools/test/h5repack/CMakeTests.cmake @@ -248,14 +248,14 @@ macro (ADD_HELP_TEST testname resultcode) # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5REPACK-h5repack-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) + if (HDF5_USING_ANALYSIS_TOOL) + add_test (NAME H5REPACK-h5repack-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) else () add_test ( NAME H5REPACK-h5repack-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=h5repack-${testname}.out" @@ -273,7 +273,7 @@ endmacro () macro (ADD_H5_TEST_OLD testname testtype testfile) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) if ("${testtype}" STREQUAL "SKIP") add_test ( NAME H5REPACK_OLD-${testname} @@ -287,7 +287,7 @@ ) add_test ( NAME H5REPACK_OLD-${testname} - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK_OLD-${testname} PROPERTIES DEPENDS H5REPACK_OLD-${testname}-clear-objects @@ -297,7 +297,7 @@ endif () add_test ( NAME H5REPACK_OLD-${testname}_DFF - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK_OLD-${testname}_DFF PROPERTIES DEPENDS H5REPACK_OLD-${testname} @@ -318,7 +318,7 @@ macro (ADD_H5_TEST testname testtype testfile) if ("${testtype}" STREQUAL "SKIP") - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5REPACK-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}" @@ -332,7 +332,7 @@ ) add_test ( NAME H5REPACK-${testname} - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --enable-error-stack ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --enable-error-stack ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK-${testname} PROPERTIES DEPENDS H5REPACK-${testname}-clear-objects @@ -342,7 +342,7 @@ endif () add_test ( NAME H5REPACK-${testname}_DFF - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK-${testname}_DFF PROPERTIES DEPENDS H5REPACK-${testname} @@ -362,7 +362,7 @@ macro (ADD_H5_FILTER_TEST testname testfilter testtype resultcode resultfile) if ("${testtype}" STREQUAL "SKIP") - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5REPACK_CMP-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" @@ -375,10 +375,10 @@ COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${resultfile} ) # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) + if (HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5REPACK_CMP-${testname} - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} ) set_tests_properties (H5REPACK_CMP-${testname} PROPERTIES DEPENDS H5REPACK_CMP-${testname}-clear-objects @@ -388,7 +388,7 @@ NAME H5REPACK_CMP-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};${resultfile};out-${testname}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}-${testname}.out" @@ -416,7 +416,7 @@ macro (ADD_H5_MASK_TEST testname testtype resultcode result_errcheck resultfile) if ("${testtype}" STREQUAL "SKIP") - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5REPACK_MASK-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" @@ -429,17 +429,17 @@ COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${resultfile} ) # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) + if (HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5REPACK_MASK-${testname} - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} ) - else (HDF5_ENABLE_USING_MEMCHECKER) + else (HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5REPACK_MASK-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};${resultfile};out-${testname}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}-${testname}.out" @@ -468,7 +468,7 @@ macro (ADD_H5_DMP_TEST testname testtype resultcode resultfile) if ("${testtype}" STREQUAL "SKIP") - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5REPACK_DMP-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" @@ -482,7 +482,7 @@ ) add_test ( NAME H5REPACK_DMP-${testname} - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} ) set_tests_properties (H5REPACK_DMP-${testname} PROPERTIES DEPENDS H5REPACK_DMP-${testname}-clear-objects @@ -490,12 +490,12 @@ if ("H5REPACK_DMP-${testname}" MATCHES "${HDF5_DISABLE_TESTS_REGEX}") set_tests_properties (H5REPACK_DMP-${testname} PROPERTIES DISABLED true) endif () - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5REPACK_DMP-h5dump-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-q;creation_order;-pH;out-${testname}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}-${testname}.out" @@ -530,7 +530,7 @@ macro (ADD_H5_DMP_NO_OPT_TEST testname testtype resultcode resultfile) if ("${testtype}" STREQUAL "SKIP") - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5REPACK_DMP-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" @@ -547,7 +547,7 @@ ) add_test ( NAME H5REPACK_DMP-${testname} - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} ) set_tests_properties (H5REPACK_DMP-${testname} PROPERTIES DEPENDS H5REPACK_DMP-${testname}-clear-objects @@ -555,12 +555,12 @@ if ("H5REPACK_DMP-${testname}" MATCHES "${HDF5_DISABLE_TESTS_REGEX}") set_tests_properties (H5REPACK_DMP-${testname} PROPERTIES DISABLED true) endif () - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5REPACK_DMP-h5dump-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=out-${testname}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}-${testname}.out" @@ -580,7 +580,7 @@ macro (ADD_H5_DIFF_TEST testname testtype resultcode testfile) if ("${testtype}" STREQUAL "SKIP") - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5REPACK_DIFF-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}" @@ -594,7 +594,7 @@ ) add_test ( NAME H5REPACK_DIFF-${testname} - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --enable-error-stack ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --enable-error-stack ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK_DIFF-${testname} PROPERTIES DEPENDS H5REPACK_DIFF-${testname}-clear-objects @@ -606,7 +606,7 @@ NAME H5REPACK_DIFF-${testname}_DFF COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-v;--enable-error-stack;${testfile};out-${testname}.${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=out-${testname}.${testfile}.out" @@ -632,7 +632,7 @@ macro (ADD_H5_STAT_TEST testname testtype resultcode statarg resultfile) if ("${testtype}" STREQUAL "SKIP") - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5REPACK_STAT-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${statarg}.${resultfile}" @@ -646,7 +646,7 @@ ) add_test ( NAME H5REPACK_STAT-${testname} - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${statarg}.${resultfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${statarg}.${resultfile} ) set_tests_properties (H5REPACK_STAT-${testname} PROPERTIES DEPENDS H5REPACK_STAT-${testname}-clear-objects @@ -654,12 +654,12 @@ if ("H5REPACK_STAT-${testname}" MATCHES "${HDF5_DISABLE_TESTS_REGEX}") set_tests_properties (H5REPACK_STAT-${testname} PROPERTIES DISABLED true) endif () - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5REPACK_STAT-h5stat-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-S;-s;out-${statarg}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}-${testname}.out" @@ -694,7 +694,7 @@ macro (ADD_H5_VERIFY_TEST testname testtype resultcode testfile testdset testfilter) if ("${testtype}" STREQUAL "SKIP") - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP -d ${testdset} -pH ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" @@ -702,14 +702,14 @@ set_property(TEST H5REPACK_VERIFY_LAYOUT-${testname} PROPERTY DISABLED true) endif () else () - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${testfile} ) add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname} - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname} PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}-clear-objects @@ -719,7 +719,7 @@ endif () add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname}_DFF - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DFF PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname} @@ -732,7 +732,7 @@ NAME H5REPACK_VERIFY_LAYOUT-${testname}_DMP COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-d;${testdset};-pH;out-${testname}.${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testfile}-${testname}-v.out" @@ -758,7 +758,7 @@ NAME H5REPACK_VERIFY_LAYOUT-${testname}_DMP COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-pH;out-${testname}.${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testfile}-${testname}-v.out" @@ -787,7 +787,7 @@ macro (ADD_H5_VERIFY_VDS testname testtype resultcode testfile testdset testfilter) if ("${testtype}" STREQUAL "SKIP") - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP -d ${testdset} -pH ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" @@ -795,7 +795,7 @@ set_property(TEST H5REPACK_VERIFY_LAYOUT_VDS-${testname} PROPERTY DISABLED true) endif () else () - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) # Remove any output file left over from previous test run add_test ( NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname}-clear-objects @@ -803,7 +803,7 @@ ) add_test ( NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname} - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" @@ -816,7 +816,7 @@ NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname}_DMP COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-d;${testdset};-p;out-${testname}.${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testfile}-${testname}-v.out" @@ -844,14 +844,14 @@ # VERIFY_SUPERBLOCK macro (ADD_H5_VERIFY_SUPERBLOCK testname testfile lowbound highbound superblock) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5REPACK_VERIFY_SUPERBLOCK-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${testfile} ) add_test ( NAME H5REPACK_VERIFY_SUPERBLOCK-${testname} - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname} PROPERTIES DEPENDS H5REPACK_VERIFY_SUPERBLOCK-${testname}-clear-objects @@ -863,7 +863,7 @@ NAME H5REPACK_VERIFY_SUPERBLOCK-${testname}_DMP COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-H;-B;out-${testname}.${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testfile}-${testname}-v.out" @@ -895,7 +895,7 @@ ) add_test ( NAME ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname} - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname} PROPERTIES DEPENDS ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}-clear-objects @@ -923,7 +923,7 @@ ) add_test ( NAME H5REPACK_META-${testname}_N - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5 ) set_tests_properties (H5REPACK_META-${testname}_N PROPERTIES DEPENDS H5REPACK_META-${testname}-clear-objects @@ -935,7 +935,7 @@ NAME H5REPACK_META-${testname}_N_DFF COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-v;${testfile};out-${testname}_N.${testname}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=out-${testname}_N.${testname}.out" @@ -951,7 +951,7 @@ endif () add_test ( NAME H5REPACK_META-${testname}_M - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_M.${testname}.h5 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_M.${testname}.h5 ) set_tests_properties (H5REPACK_META-${testname}_M PROPERTIES DEPENDS H5REPACK_META-${testname}_N_DFF @@ -963,7 +963,7 @@ NAME H5REPACK_META-${testname}_M_DFF COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-v;${testfile};out-${testname}_M.${testname}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=out-${testname}_M.${testname}.out" @@ -1003,7 +1003,7 @@ endmacro () macro (ADD_H5_UD_TEST testname resultcode resultfile) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) # Remove any output file left over from previous test run add_test ( NAME H5REPACK_UD-${testname}-clear-objects @@ -1013,7 +1013,7 @@ NAME H5REPACK_UD-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};${resultfile};out-${testname}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_EXPECT=${resultcode}" @@ -1035,7 +1035,7 @@ NAME H5REPACK_UD-${testname}-h5dump COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-pH;out-${testname}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}-${testname}.out" @@ -1063,7 +1063,7 @@ endmacro () macro (ADD_H5_EXTERNAL_TEST testname testtype testfile) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) # canonical file = h5repack_${testfile}.h5 - preexist # external file = h5repack_${testfile}_ex.h5 - preexist # repacked file = h5repack_${testfile}_rp.h5 - created @@ -1098,7 +1098,7 @@ # comparison of known files add_test ( NAME H5REPACK_EXTERNAL-${testname}_DFF1 - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}.h5 ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}_ex.h5 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}.h5 ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}_ex.h5 ) set_tests_properties (H5REPACK_EXTERNAL-${testname}_DFF1 PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" @@ -1110,7 +1110,7 @@ # repack the external file to the repacked file add_test ( NAME H5REPACK_EXTERNAL-${testname} - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --enable-error-stack ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}_ex.h5 ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}_rp.h5 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --enable-error-stack ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}_ex.h5 ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}_rp.h5 ) set_tests_properties (H5REPACK_EXTERNAL-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" @@ -1122,7 +1122,7 @@ # comparison of repacked file to known files add_test ( NAME H5REPACK_EXTERNAL-${testname}_DFF2 - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}_rp.h5 ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}.h5 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}_rp.h5 ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}.h5 ) set_tests_properties (H5REPACK_EXTERNAL-${testname}_DFF2 PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" @@ -1133,7 +1133,7 @@ endif () add_test ( NAME H5REPACK_EXTERNAL-${testname}_DFF3 - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}_rp.h5 ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}_ex.h5 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}_rp.h5 ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}_ex.h5 ) set_tests_properties (H5REPACK_EXTERNAL-${testname}_DFF3 PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" @@ -1157,7 +1157,7 @@ # verify comparison of repacked file to known file add_test ( NAME H5REPACK_EXTERNAL-${testname}_DFF4 - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}_rp.h5 ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}.h5 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}_rp.h5 ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}.h5 ) set_tests_properties (H5REPACK_EXTERNAL-${testname}_DFF4 PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" @@ -1169,7 +1169,7 @@ # verify comparison of repacked file to known external file fails add_test ( NAME H5REPACK_EXTERNAL-${testname}_DFF_FAIL - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}_rp.h5 ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}_ex.h5 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}_rp.h5 ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}_ex.h5 ) set_tests_properties (H5REPACK_EXTERNAL-${testname}_DFF_FAIL PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" diff --git a/tools/test/h5repack/CMakeVFDTests.cmake b/tools/test/h5repack/CMakeVFDTests.cmake index e992029ab33..3e2ef603417 100644 --- a/tools/test/h5repack/CMakeVFDTests.cmake +++ b/tools/test/h5repack/CMakeVFDTests.cmake @@ -60,7 +60,7 @@ set (H5REPACK_CLEANFILES h5repack_paged_persist.h5 ) macro (ADD_VFD_TEST vfdname resultcode) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5REPACK-${vfdname}-h5repacktest-clear-objects COMMAND ${CMAKE_COMMAND} -E remove ${H5REPACK_CLEANFILES} diff --git a/tools/test/h5stat/CMakeTests.cmake b/tools/test/h5stat/CMakeTests.cmake index 2b47cd03573..ed45e9302ab 100644 --- a/tools/test/h5stat/CMakeTests.cmake +++ b/tools/test/h5stat/CMakeTests.cmake @@ -95,17 +95,17 @@ macro (ADD_H5_TEST resultfile resultcode) # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5STAT-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) + if (HDF5_USING_ANALYSIS_TOOL) + add_test (NAME H5STAT-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) if (${resultcode}) set_tests_properties (H5STAT-${resultfile} PROPERTIES WILL_FAIL "true") endif () - else (HDF5_ENABLE_USING_MEMCHECKER) + else (HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5STAT-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${resultfile}.out" @@ -124,17 +124,17 @@ macro (ADD_H5_ERR_TEST resultfile resultcode) # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5STAT-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) + if (HDF5_USING_ANALYSIS_TOOL) + add_test (NAME H5STAT-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) if (${resultcode}) set_tests_properties (H5STAT-${resultfile} PROPERTIES WILL_FAIL "true") endif () - else (HDF5_ENABLE_USING_MEMCHECKER) + else (HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5STAT-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${resultfile}.out" diff --git a/tools/test/misc/CMakeTestsClear.cmake b/tools/test/misc/CMakeTestsClear.cmake index cfe237d6017..63f1d6a66c1 100644 --- a/tools/test/misc/CMakeTestsClear.cmake +++ b/tools/test/misc/CMakeTestsClear.cmake @@ -89,12 +89,12 @@ # Need special dependencies for tests that use the same reference file # This is an issue on Windows macro (ADD_H5_CMP testname resultfile resultcode) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5CLEAR_CMP-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}.out" @@ -112,20 +112,21 @@ endif () endmacro () - macro (ADD_H5_ERR_CMP testname resultfile resultcode) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + macro (ADD_H5_ERR_CMP testname resultfile resultcode result_errcheck) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5CLEAR_CMP-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.mty" - -D "TEST_ERRREF=${resultfile}.err" - -P "${HDF_RESOURCES_DIR}/runTest.cmake" + -D "TEST_ERRREF=${result_errcheck}" + -D "TEST_SKIP_COMPARE=true" + -P "${HDF_RESOURCES_DIR}/grepTest.cmake" ) if ("H5CLEAR_CMP-${testname}" MATCHES "${HDF5_DISABLE_TESTS_REGEX}") set_tests_properties (H5CLEAR_CMP-${testname} PROPERTIES DISABLED true) @@ -138,7 +139,7 @@ endmacro () macro (ADD_H5_CMP_WITH_COPY testname resultcode resultfile testfile) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5CLEAR_CMP-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove testfiles/${testfile} @@ -155,7 +156,7 @@ NAME H5CLEAR_CMP-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}.out" @@ -173,7 +174,7 @@ endmacro () macro (ADD_H5_ERR_CMP_WITH_COPY testname resultcode resultfile testfile) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5CLEAR_CMP-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove testfiles/${testfile} @@ -190,7 +191,7 @@ NAME H5CLEAR_CMP-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}.out" @@ -209,10 +210,10 @@ endmacro () macro (ADD_H5_RETTEST testname resultcode) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5CLEAR_RET-${testname} - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ) set_tests_properties (H5CLEAR_RET-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" @@ -225,7 +226,7 @@ endmacro () macro (ADD_H5_FILESIZE_TEST testname resultcode resultfile incr_size) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5CLEAR_FILESIZE_TEST-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove testfiles/${testname}.h5 @@ -242,7 +243,7 @@ NAME H5CLEAR_FILESIZE_CMP-${testname}_before_size COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=--filesize;${testname}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}_before_size.out" @@ -259,12 +260,12 @@ if (NOT ${incr_size} MATCHES "NONE") add_test ( NAME H5CLEAR_FILESIZE_INCR-${testname} - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --increment=${incr_size} ${testname}.h5 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --increment=${incr_size} ${testname}.h5 ) else () add_test ( NAME H5CLEAR_FILESIZE_INCR-${testname} - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --increment ${testname}.h5 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --increment ${testname}.h5 ) endif () set_tests_properties (H5CLEAR_FILESIZE_INCR-${testname} PROPERTIES @@ -279,7 +280,7 @@ NAME H5CLEAR_FILESIZE_CMP-${testname}_after_size COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=--filesize;${testname}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}_after_size.out" @@ -297,7 +298,7 @@ endmacro () macro (ADD_H5_FILESIZE_FAIL_TEST testname resultcode resultfile incr_size) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5CLEAR_FILESIZE_FAIL_TEST-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove testfiles/${testname}.h5 @@ -317,7 +318,7 @@ NAME H5CLEAR_FILESIZE_FAIL_CMP-${testname}_before_size COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=--filesize;${testname}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}_before_size.out" @@ -334,12 +335,12 @@ if (NOT ${incr_size} MATCHES "NONE") add_test ( NAME H5CLEAR_FILESIZE_FAIL_INCR-${testname} - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -s --increment=${incr_size} ${testname}.h5 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -s --increment=${incr_size} ${testname}.h5 ) else () add_test ( NAME H5CLEAR_FILESIZE_FAIL_INCR-${testname} - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -s --increment ${testname}.h5 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -s --increment ${testname}.h5 ) endif () set_tests_properties (H5CLEAR_FILESIZE_FAIL_INCR-${testname} PROPERTIES @@ -353,7 +354,7 @@ NAME H5CLEAR_FILESIZE_FAIL_CMP-${testname}_after_size COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=--filesize;${testname}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}_after_size.out" @@ -371,7 +372,7 @@ endmacro () macro (ADD_H5_TEST testname testfile resultcode) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5CLEAR-clr_open_chk-copy_${testname}.h5 COMMAND ${CMAKE_COMMAND} -E copy_if_different @@ -396,7 +397,7 @@ # After "h5clear" the file, the subsequent file open succeeds add_test ( NAME H5CLEAR-h5clr-${testname} - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -s ${testfile}.h5 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -s ${testfile}.h5 ) set_tests_properties (H5CLEAR-h5clr-${testname} PROPERTIES DEPENDS H5CLEAR-clr_open_chk-${testname}_${resultcode} @@ -443,11 +444,11 @@ ADD_H5_CMP (h5clr_usage_junk h5clear_usage 1 "" junk.h5) ADD_H5_CMP (h5clr_usage_none h5clear_usage 1 "" orig_h5clear_sec2_v3.h5) ADD_H5_CMP (h5clr_missing_file_m h5clear_missing_file 1 "-m") - ADD_H5_ERR_CMP (h5clr_open_fail_s h5clear_open_fail 1 "-s" junk.h5) + ADD_H5_ERR_CMP (h5clr_open_fail_s h5clear_open_fail 1 "h5clear error" "-s" junk.h5) ADD_H5_CMP (h5clr_missing_file_ms h5clear_missing_file 1 "-m" "-s") - ADD_H5_ERR_CMP (h5clr_open_fail_ms h5clear_open_fail 1 "-m" "-s" junk.h5) - ADD_H5_ERR_CMP (h5clr_no_mdc_image_m h5clear_no_mdc_image 0 "-m" orig_h5clear_sec2_v2.h5) - ADD_H5_ERR_CMP (h5clr_no_mdc_image_ms h5clear_no_mdc_image 0 "-s" "-m" orig_h5clear_sec2_v0.h5) + ADD_H5_ERR_CMP (h5clr_open_fail_ms h5clear_open_fail 1 "h5clear error" "-m" "-s" junk.h5) + ADD_H5_ERR_CMP (h5clr_no_mdc_image_m h5clear_no_mdc_image 0 "h5clear warning" "-m" orig_h5clear_sec2_v2.h5) + ADD_H5_ERR_CMP (h5clr_no_mdc_image_ms h5clear_no_mdc_image 0 "h5clear warning" "-s" "-m" orig_h5clear_sec2_v0.h5) # # # @@ -478,8 +479,8 @@ # # # h5clear_mdc_image.h5 already has cache image removed earlier, verify the expected warning from h5clear: - ADD_H5_ERR_CMP (h5clr_mdc_image_m h5clear_no_mdc_image 0 "-m" mod_h5clear_mdc_image.h5) - ADD_H5_ERR_CMP (h5clr_mdc_image_sm h5clear_no_mdc_image 0 "-s" "-m" mod_h5clear_mdc_image2.h5) + ADD_H5_ERR_CMP (h5clr_mdc_image_m h5clear_no_mdc_image 0 "h5clear warning" "-m" mod_h5clear_mdc_image.h5) + ADD_H5_ERR_CMP (h5clr_mdc_image_sm h5clear_no_mdc_image 0 "h5clear warning" "-s" "-m" mod_h5clear_mdc_image2.h5) # # # diff --git a/tools/test/misc/CMakeTestsMkgrp.cmake b/tools/test/misc/CMakeTestsMkgrp.cmake index e583b7f0a4b..50618fa8c05 100644 --- a/tools/test/misc/CMakeTestsMkgrp.cmake +++ b/tools/test/misc/CMakeTestsMkgrp.cmake @@ -55,10 +55,10 @@ ############################################################################## macro (ADD_H5_TEST resultfile resultcode resultoption) - if (HDF5_ENABLE_USING_MEMCHECKER) + if (HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5MKGRP-${resultfile} - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${resultoption} ${resultfile}.h5 ${ARGN} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${resultoption} ${resultfile}.h5 ${ARGN} ) if ("H5MKGRP-${resultfile}" MATCHES "${HDF5_DISABLE_TESTS_REGEX}") set_tests_properties (H5MKGRP-${resultfile} PROPERTIES DISABLED true) @@ -73,7 +73,7 @@ ) add_test ( NAME H5MKGRP-${resultfile} - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${resultoption} ${resultfile}.h5 ${ARGN} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${resultoption} ${resultfile}.h5 ${ARGN} ) set_tests_properties (H5MKGRP-${resultfile} PROPERTIES DEPENDS H5MKGRP-${resultfile}-clear-objects @@ -86,7 +86,7 @@ NAME H5MKGRP-${resultfile}-h5ls COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-v;-r;${resultfile}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" @@ -103,8 +103,8 @@ endmacro () macro (ADD_H5_CMP resultfile resultcode) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5MKGRP_CMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) + if (HDF5_USING_ANALYSIS_TOOL) + add_test (NAME H5MKGRP_CMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) else () add_test ( NAME H5MKGRP_CMP-${resultfile}-clear-objects @@ -117,7 +117,7 @@ NAME H5MKGRP_CMP-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" @@ -139,7 +139,7 @@ ### T H E T E S T S ### ############################################################################## ############################################################################## - if (HDF5_ENABLE_USING_MEMCHECKER) + if (HDF5_USING_ANALYSIS_TOOL) add_test ( NAME H5MKGRP-clearall-objects COMMAND ${CMAKE_COMMAND} -E remove diff --git a/tools/test/misc/CMakeTestsRepart.cmake b/tools/test/misc/CMakeTestsRepart.cmake index 81e8cc6c703..9b3e44e73e8 100644 --- a/tools/test/misc/CMakeTestsRepart.cmake +++ b/tools/test/misc/CMakeTestsRepart.cmake @@ -89,7 +89,7 @@ # repartition family member size to 20,000 bytes. add_test ( NAME H5REPART-h5repart_20K - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -m 20000 family_file%05d.h5 fst_family%05d.h5 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -m 20000 family_file%05d.h5 fst_family%05d.h5 ) set_tests_properties (H5REPART-h5repart_20K PROPERTIES FIXTURES_REQUIRED clear_testrepart @@ -101,7 +101,7 @@ # repartition family member size to 5 KB. add_test ( NAME H5REPART-h5repart_5K - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -m 5k family_file%05d.h5 scd_family%05d.h5 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -m 5k family_file%05d.h5 scd_family%05d.h5 ) set_tests_properties (H5REPART-h5repart_5K PROPERTIES FIXTURES_REQUIRED clear_testrepart @@ -113,7 +113,7 @@ # convert family file to sec2 file of 20,000 bytes add_test ( NAME H5REPART-h5repart_single - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -m 20000 -family_to_single family_file%05d.h5 family_to_single.h5 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -m 20000 -family_to_single family_file%05d.h5 family_to_single.h5 ) set_tests_properties (H5REPART-h5repart_single PROPERTIES FIXTURES_REQUIRED clear_testrepart @@ -125,7 +125,7 @@ # convert family file to sec2 file of 20,000 bytes (old argument) add_test ( NAME H5REPART-h5repart_sec2 - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -m 20000 -family_to_sec2 family_file%05d.h5 family_to_sec2.h5 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -m 20000 -family_to_sec2 family_file%05d.h5 family_to_sec2.h5 ) set_tests_properties (H5REPART-h5repart_sec2 PROPERTIES FIXTURES_REQUIRED clear_testrepart diff --git a/tools/test/perform/CMakeTests.cmake b/tools/test/perform/CMakeTests.cmake index 714713e5569..8123e2f344d 100644 --- a/tools/test/perform/CMakeTests.cmake +++ b/tools/test/perform/CMakeTests.cmake @@ -50,7 +50,7 @@ if (HDF5_TEST_SERIAL) ) set_tests_properties (PERFORM_h5perform-clean-objects PROPERTIES FIXTURES_CLEANUP clear_perform) - if (HDF5_ENABLE_USING_MEMCHECKER) + if (HDF5_USING_ANALYSIS_TOOL) add_test (NAME PERFORM_h5perf_serial COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME PERFORM_h5perf_serial COMMAND "${CMAKE_COMMAND}" @@ -73,7 +73,7 @@ if (HDF5_TEST_SERIAL) set_tests_properties (PERFORM_h5perf_serial PROPERTIES DISABLED true) endif () - if (HDF5_ENABLE_USING_MEMCHECKER) + if (HDF5_USING_ANALYSIS_TOOL) add_test (NAME PERFORM_chunk COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME PERFORM_chunk COMMAND "${CMAKE_COMMAND}" @@ -95,7 +95,7 @@ if (HDF5_TEST_SERIAL) set_tests_properties (PERFORM_chunk PROPERTIES DISABLED true) endif () - if (HDF5_ENABLE_USING_MEMCHECKER) + if (HDF5_USING_ANALYSIS_TOOL) add_test (NAME PERFORM_iopipe COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME PERFORM_iopipe COMMAND "${CMAKE_COMMAND}" @@ -117,7 +117,7 @@ if (HDF5_TEST_SERIAL) set_tests_properties (PERFORM_iopipe PROPERTIES DISABLED true) endif () - if (HDF5_ENABLE_USING_MEMCHECKER) + if (HDF5_USING_ANALYSIS_TOOL) add_test (NAME PERFORM_overhead COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME PERFORM_overhead COMMAND "${CMAKE_COMMAND}" @@ -139,7 +139,7 @@ if (HDF5_TEST_SERIAL) set_tests_properties (PERFORM_overhead PROPERTIES DISABLED true) endif () - if (HDF5_ENABLE_USING_MEMCHECKER) + if (HDF5_USING_ANALYSIS_TOOL) add_test (NAME PERFORM_perf_meta COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME PERFORM_perf_meta COMMAND "${CMAKE_COMMAND}" @@ -161,7 +161,7 @@ if (HDF5_TEST_SERIAL) set_tests_properties (PERFORM_perf_meta PROPERTIES DISABLED true) endif () - if (HDF5_ENABLE_USING_MEMCHECKER) + if (HDF5_USING_ANALYSIS_TOOL) add_test (NAME PERFORM_zip_perf_help COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ "-h") else () add_test (NAME PERFORM_zip_perf_help COMMAND "${CMAKE_COMMAND}" @@ -183,7 +183,7 @@ if (HDF5_TEST_SERIAL) set_tests_properties (PERFORM_zip_perf_help PROPERTIES DISABLED true) endif () - if (HDF5_ENABLE_USING_MEMCHECKER) + if (HDF5_USING_ANALYSIS_TOOL) add_test (NAME PERFORM_zip_perf COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ tfilters.h5) else () add_test (NAME PERFORM_zip_perf COMMAND "${CMAKE_COMMAND}" diff --git a/utils/tools/h5dwalk/CMakeLists.txt b/utils/tools/h5dwalk/CMakeLists.txt index f0611e0b0c4..c520eca2ed3 100644 --- a/utils/tools/h5dwalk/CMakeLists.txt +++ b/utils/tools/h5dwalk/CMakeLists.txt @@ -4,42 +4,29 @@ project (HDF5_UTILS_TOOLS_H5DWALK C) # -------------------------------------------------------------------- # Add the h5dwalk and test executables # -------------------------------------------------------------------- -if (BUILD_STATIC_LIBS) - add_executable (h5dwalk ${HDF5_UTILS_TOOLS_H5DWALK_SOURCE_DIR}/h5dwalk.c) -# add_custom_target(generate_demo ALL -# DEPENDS "${HDF5_TOOLS_ROOT_DIR}/test/demo_destfiles.test" -# ) - target_include_directories (h5dwalk PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};${CIRCLE_INCLUDE_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - target_compile_options(h5dwalk PRIVATE "${HDF5_CMAKE_C_FLAGS}") +add_executable (h5dwalk ${HDF5_UTILS_TOOLS_H5DWALK_SOURCE_DIR}/h5dwalk.c) +#add_custom_target(generate_demo ALL +# DEPENDS "${HDF5_TOOLS_ROOT_DIR}/test/demo_destfiles.test" +#) +target_include_directories (h5dwalk PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};${CIRCLE_INCLUDE_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +target_compile_options(h5dwalk PRIVATE "${HDF5_CMAKE_C_FLAGS}") +if (HDF5_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (h5dwalk STATIC) target_link_libraries (h5dwalk PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} ${MFU_LIBRARY} "$<$:MPI::MPI_C>") - set_target_properties (h5dwalk PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5dwalk") - - set (H5_DEP_EXECUTABLES h5dwalk) +else () + TARGET_C_PROPERTIES (h5dwalk SHARED) + target_link_libraries (h5dwalk PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${MFU_LIBRARY} "$<$:MPI::MPI_C>") endif () +set_target_properties (h5dwalk PROPERTIES FOLDER tools) +set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5dwalk") -if (BUILD_SHARED_LIBS) - add_executable (h5dwalk-shared ${HDF5_UTILS_TOOLS_H5DWALK_SOURCE_DIR}/h5dwalk.c) - target_include_directories (h5dwalk-shared PRIVATE "${HDF5_TOOLS_ROOT_DIR}/lib;${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};${CIRCLE_INCLUDE_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - target_compile_options(h5dwalk-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") - TARGET_C_PROPERTIES (h5dwalk-shared SHARED) - target_link_libraries (h5dwalk-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${MFU_LIBRARY} "$<$:MPI::MPI_C>") - set_target_properties (h5dwalk-shared PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5dwalk-shared") - - set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5dwalk-shared) -endif () +set (H5_DEP_EXECUTABLES h5dwalk) #----------------------------------------------------------------------------- # Add Target to clang-format #----------------------------------------------------------------------------- if (HDF5_ENABLE_FORMATTERS) - if (BUILD_STATIC_LIBS) - clang_format (HDF5_H5DWALK_SRC_FORMAT h5dwalk) - else () - clang_format (HDF5_H5DWALK_SRC_FORMAT h5dwalk-shared) - endif () + clang_format (HDF5_H5DWALK_SRC_FORMAT h5dwalk) endif () ############################################################################## diff --git a/utils/tools/h5dwalk/h5dwalk.c b/utils/tools/h5dwalk/h5dwalk.c index b510f3e6d08..f994a9080bb 100644 --- a/utils/tools/h5dwalk/h5dwalk.c +++ b/utils/tools/h5dwalk/h5dwalk.c @@ -1209,10 +1209,10 @@ MFU_PRED_EXEC(mfu_flist flist, uint64_t idx, void *arg) snprintf(cmdline, sizeof(cmdline), "\n---------\nCommand:"); b_offset = strlen(cmdline); for (k = 0; k < count; k++) { - sprintf(&cmdline[b_offset], " %s", argv[k]); + snprintf(&cmdline[b_offset], sizeof(cmdline) - b_offset, " %s", argv[k]); b_offset = strlen(cmdline); } - sprintf(&cmdline[b_offset], "\n"); + snprintf(&cmdline[b_offset], sizeof(cmdline) - b_offset, "\n"); run_command(count, argv, cmdline, fname); mfu_free(argv); diff --git a/utils/tools/test/h5dwalk/CMakeTests.cmake b/utils/tools/test/h5dwalk/CMakeTests.cmake index 6cf2dbe7f5d..a024f760fee 100644 --- a/utils/tools/test/h5dwalk/CMakeTests.cmake +++ b/utils/tools/test/h5dwalk/CMakeTests.cmake @@ -27,9 +27,9 @@ macro (ADD_H5_TEST resultfile resultcode) # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) + if (HDF5_USING_ANALYSIS_TOOL) message("Entered ADD_H5_TEST - 0") - add_test (NAME H5DWALK-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) + add_test (NAME H5DWALK-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5DWALK-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if ("${resultcode}" STREQUAL "1") @@ -41,7 +41,7 @@ NAME H5DWALK-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out"
Other external link functions