From 7741170bdd225da130f3ab98c454c118b5511b14 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Tue, 5 Mar 2024 08:52:09 -0600 Subject: Sync develop branch changes since 2/16 to hdf5_1_14 branch (#4058) * Remove oneapi return value warning. (#4028) * Replaced last sprintf with snprintf (#4007) * Replaced last sprintf with snprintf To have the size of the buffer, it was required to change a function signature, and change all users of it. In most cases, determining the buffer size wasn't trivial and so SIZE_MAX is passed. But at least this improves the infrastructure. Someone can later figure out the correct sizes. * Test vlen sequence IO in API tests (#4027) * Check argument for CMake REGEX FCMangle.h. (#4029) * Replace deprecated Fortran 'include mpif.h' with 'USE mpi' (#4031) With MPI 4.1 the use of the mpif.h include file has been deprecated. Codes should transition to USE mpi or USE mpi_f08. Signed-off-by: Christoph Niethammer * Fix H5F_get_access_plist to copy file locking settings (#4030) H5F_get_access_plist previously did not copy over the file locking settings from a file into the new File Access Property List that it creates. This would make it difficult to match the file locking settings between an external file and its parent file. * Fix missing NOT from if check in HL folder (#4036) * Fix the datatype passed to H5*exists_async APIs in tests. (#4033) Add a new testing function to verify C_BOOL values. * Add deb and rpm binaries to snapshots (#4035) * Update and Add general INSTALL (#4016) * Improve performance of flushing single objects (#4017) Improve performance of flushing a single object, and remove metadata cache flush markers * Fix memory leak in H5LTopen_file_image when H5LT_FILE_IMAGE_DONT_COPY flag is used (#4021) 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. * Fix allocating too much memory in dset API test (#4041) * Don't try to load general-19 warnings file for icc (#4042) The Autools Classic Intel compiler configuration attempts to load a file named `general-19` from the intel-warnings/classic directory, which does not exist. This removes the attempted load of the file. * Remove unused AIX cross-compile cache overrides (#4043) The ibm-aix Autotools config file had some unmaintained and unnecessary Autoconf cache overrides. These have been removed. * Consolidate Autotools linux files (#4044) There are many architecture-specific linux files in the config directory, all of which simply redirect to linux-gnulibc1. This change renames linux-gnulibc1 to linux-gnu and deletes the more specific files. * Remove check for gettimeofday + tz in CMake (#4045) This is not used in the library * Remove limitations on preset generators (#4051) * Fix issue with FAPL file locking setting inheriting test (#4053) Fixes an issue where the HDF5_USE_FILE_LOCKING environment variable being set can interfere with the file locking setting that the test expects to be returned. * Bump the github-actions group with 2 updates (#4054) Bumps the github-actions group with 2 updates: [actions/download-artifact](https://github.com/actions/download-artifact) and [github/codeql-action](https://github.com/github/codeql-action). * Fix VOL-compatibility issues in External Link API test (#4039) Fix link API tests with incorrect filename * Add upddated cmake tools from source location (#4040) * Add options to allow tools type selection and naming (#4046) * Improve error messages when tools attempt to use non-enabled S3 and HDFS VFDs. (#4047) * Correct several 1.15/1.15.0 references to 1.14/1.14.4. * Ignore HDF5Examples/CMakeUserPresets.json --- .github/workflows/abi-report.yml | 2 +- .github/workflows/cmake-bintest.yml | 6 +- .github/workflows/cmake-ctest.yml | 54 +- .github/workflows/release-files.yml | 36 +- .github/workflows/remove-files.yml | 2 + .github/workflows/scorecard.yml | 72 + .gitignore | 1 + CMakeLists.txt | 25 +- HDF5Examples/CMakeUserPresets.json | 244 - .../FORTRAN/H5PAR/ph5_f90_hyperslab_by_col.F90 | 2 +- .../config/cmake-presets/hidden-presets.json | 18 +- HDF5Examples/config/cmake/HDFExampleMacros.cmake | 26 +- HDF5Examples/config/cmake/HDFMacros.cmake | 4 +- config/BlankForm | 18 - config/README.md | 2 - config/cmake-presets/hidden-presets.json | 16 +- config/cmake/ConfigureChecks.cmake | 2 - config/cmake/H5pubconf.h.in | 3 + config/cmake/HDF5ExampleCache.cmake | 4 +- config/cmake/HDF5PluginCache.cmake | 4 +- config/cmake/HDF5UseFortran.cmake | 10 + config/cmake/HDFTests.c | 23 - config/cmake/HDFUseFortran.cmake | 10 +- config/cmake/LIBAEC/CMakeLists.txt | 2 +- config/cmake/hdf5-config.cmake.in | 1 + config/cygwin | 4 +- config/ibm-aix | 46 - config/intel-cxxflags | 6 - config/intel-flags | 6 - config/linux-gnu | 389 +- config/linux-gnuaout | 16 - config/linux-gnueabihf | 16 - config/linux-gnulibc1 | 401 -- config/linux-gnulibc2 | 21 - config/sanitizer/README.md | 166 +- config/sanitizer/afl-fuzzing.cmake | 108 + config/sanitizer/code-coverage.cmake | 483 +- config/sanitizer/dependency-graph.cmake | 107 + config/sanitizer/formatting.cmake | 68 +- config/sanitizer/sanitizers.cmake | 180 +- config/sanitizer/tools.cmake | 195 +- configure.ac | 11 + fortran/src/H5config_f.inc.cmake | 3 + fortran/src/H5config_f.inc.in | 3 + fortran/test/H5_test_buildiface.F90 | 32 + fortran/testpar/async.F90 | 9 +- hl/CMakeLists.txt | 2 +- hl/src/H5LT.c | 85 +- hl/test/test_dset_append.c | 7 - hl/tools/gif2h5/CMakeLists.txt | 80 +- hl/tools/gif2h5/CMakeTests.cmake | 10 +- hl/tools/h5watch/CMakeLists.txt | 34 +- hl/tools/h5watch/CMakeTests.cmake | 6 +- m4/aclocal_fc.f90 | 27 +- m4/aclocal_fc.m4 | 11 + release_docs/INSTALL | 79 + release_docs/INSTALL_Auto.txt | 215 +- release_docs/INSTALL_CMake.txt | 67 +- release_docs/INSTALL_parallel | 4 +- release_docs/RELEASE.txt | 46 +- release_docs/USING_CMake_Examples.txt | 2 +- release_docs/USING_HDF5_VS.txt | 4 +- src/H5AC.c | 4 +- src/H5ACprivate.h | 2 - src/H5C.c | 79 +- src/H5Centry.c | 58 +- src/H5Cint.c | 36 +- src/H5Cpkg.h | 9 +- src/H5Cprivate.h | 48 +- src/H5Ctag.c | 148 +- src/H5Fint.c | 103 +- src/H5Fpkg.h | 27 +- src/H5Ftest.c | 2 +- src/H5Oainfo.c | 6 +- src/H5Oattr.c | 4 +- src/H5Obogus.c | 7 +- src/H5Obtreek.c | 6 +- src/H5Ocache_image.c | 6 +- src/H5Ocont.c | 6 +- src/H5Odrvinfo.c | 7 +- src/H5Oefl.c | 6 +- src/H5Ofsinfo.c | 6 +- src/H5Oginfo.c | 6 +- src/H5Olayout.c | 6 +- src/H5Olinfo.c | 6 +- src/H5Olink.c | 6 +- src/H5Omessage.c | 4 +- src/H5Omtime.c | 16 +- src/H5Oname.c | 6 +- src/H5Opkg.h | 2 +- src/H5Orefcount.c | 7 +- src/H5Oshared.h | 2 +- src/H5Oshmesg.c | 6 +- src/H5Ostab.c | 6 +- src/H5Pfapl.c | 18 +- test/API/H5_api_dataset_test.c | 480 ++ test/API/H5_api_dataset_test.h | 5 + test/API/H5_api_link_test.c | 362 +- test/API/H5_api_link_test.h | 15 +- test/cache.c | 6477 ++++++++------------ test/cache_common.h | 12 +- test/cache_tagging.c | 11 +- test/dt_arith.c | 1 + test/h5test.c | 43 + test/h5test.h | 1 + test/links.c | 222 + test/vol.c | 20 + tools/libtest/h5tools_test_utils.c | 2 +- tools/src/h5copy/CMakeLists.txt | 35 +- tools/src/h5diff/CMakeLists.txt | 85 +- tools/src/h5dump/CMakeLists.txt | 62 +- tools/src/h5dump/h5dump.c | 5 +- tools/src/h5format_convert/CMakeLists.txt | 34 +- tools/src/h5import/CMakeLists.txt | 35 +- tools/src/h5jam/CMakeLists.txt | 64 +- tools/src/h5ls/CMakeLists.txt | 38 +- tools/src/h5ls/h5ls.c | 7 +- tools/src/h5perf/CMakeLists.txt | 6 +- tools/src/h5repack/CMakeLists.txt | 35 +- tools/src/h5stat/CMakeLists.txt | 35 +- tools/src/h5stat/h5stat.c | 5 +- tools/src/misc/CMakeLists.txt | 156 +- tools/test/h5copy/CMakeTests.cmake | 40 +- tools/test/h5diff/CMakeTests.cmake | 12 +- tools/test/h5dump/CMakeTests.cmake | 40 +- tools/test/h5dump/CMakeTestsPBITS.cmake | 4 +- tools/test/h5dump/CMakeTestsVDS.cmake | 12 +- tools/test/h5dump/CMakeTestsXML.cmake | 4 +- tools/test/h5dump/CMakeVFDTests.cmake | 2 +- tools/test/h5format_convert/CMakeTests.cmake | 16 +- tools/test/h5import/CMakeTests.cmake | 20 +- tools/test/h5jam/CMakeTests.cmake | 22 +- tools/test/h5ls/CMakeTests.cmake | 10 +- tools/test/h5ls/CMakeTestsVDS.cmake | 8 +- tools/test/h5repack/CMakeTests.cmake | 78 +- tools/test/h5stat/CMakeTests.cmake | 8 +- tools/test/misc/CMakeTestsClear.cmake | 28 +- tools/test/misc/CMakeTestsMkgrp.cmake | 10 +- tools/test/misc/CMakeTestsRepart.cmake | 8 +- utils/tools/h5dwalk/CMakeLists.txt | 41 +- utils/tools/test/h5dwalk/CMakeTests.cmake | 4 +- 141 files changed, 6271 insertions(+), 6546 deletions(-) create mode 100644 .github/workflows/scorecard.yml delete mode 100644 HDF5Examples/CMakeUserPresets.json delete mode 100644 config/linux-gnuaout delete mode 100644 config/linux-gnueabihf delete mode 100644 config/linux-gnulibc1 delete mode 100644 config/linux-gnulibc2 create mode 100644 config/sanitizer/afl-fuzzing.cmake create mode 100644 config/sanitizer/dependency-graph.cmake create mode 100644 release_docs/INSTALL diff --git a/.github/workflows/abi-report.yml b/.github/workflows/abi-report.yml index 93b9adb..6760b16 100644 --- a/.github/workflows/abi-report.yml +++ b/.github/workflows/abi-report.yml @@ -46,7 +46,7 @@ jobs: - uses: actions/checkout@v4.1.1 - name: Get published binary (Linux) - uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: tgz-ubuntu-2204_gcc-binary path: ${{ github.workspace }} diff --git a/.github/workflows/cmake-bintest.yml b/.github/workflows/cmake-bintest.yml index 3306c0a..ffc2c5b 100644 --- a/.github/workflows/cmake-bintest.yml +++ b/.github/workflows/cmake-bintest.yml @@ -35,7 +35,7 @@ jobs: # Get files created by cmake-ctest script - name: Get published binary (Windows) - uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: zip-vs2022_cl-${{ inputs.build_mode }}-binary path: ${{ github.workspace }}/hdf5 @@ -107,7 +107,7 @@ jobs: distribution: 'temurin' - name: Get published binary (Linux) - uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: tgz-ubuntu-2204_gcc-${{ inputs.build_mode }}-binary path: ${{ github.workspace }} @@ -165,7 +165,7 @@ jobs: distribution: 'temurin' - name: Get published binary (MacOS) - uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: tgz-osx12-${{ inputs.build_mode }}-binary path: ${{ github.workspace }} diff --git a/.github/workflows/cmake-ctest.yml b/.github/workflows/cmake-ctest.yml index 3fc112f..2d1bf12 100644 --- a/.github/workflows/cmake-ctest.yml +++ b/.github/workflows/cmake-ctest.yml @@ -45,7 +45,7 @@ jobs: # Get files created by release script - name: Get zip-tarball (Windows) - uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: zip-tarball path: ${{ github.workspace }} @@ -120,7 +120,7 @@ jobs: # Get files created by release script - name: Get tgz-tarball (Linux) - uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: tgz-tarball path: ${{ github.workspace }} @@ -152,6 +152,32 @@ jobs: 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/hdfsrc/COPYING ${{ runner.workspace }}/builddeb/hdf5 + cp ${{ runner.workspace }}/hdf5/hdfsrc/COPYING_LBNL_HDF5 ${{ runner.workspace }}/builddeb/hdf5 + cp ${{ runner.workspace }}/hdf5/hdfsrc/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/hdfsrc/COPYING ${{ runner.workspace }}/buildrpm/hdf5 + cp ${{ runner.workspace }}/hdf5/hdfsrc/COPYING_LBNL_HDF5 ${{ runner.workspace }}/buildrpm/hdf5 + cp ${{ runner.workspace }}/hdf5/hdfsrc/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 }} @@ -165,6 +191,22 @@ jobs: path: ${{ runner.workspace }}/build114/${{ 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 @@ -195,7 +237,7 @@ jobs: # Get files created by release script - name: Get tgz-tarball (MacOS) - uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: tgz-tarball path: ${{ github.workspace }} @@ -269,7 +311,7 @@ jobs: # Get files created by release script - name: Get tgz-tarball (Linux S3) - uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: tgz-tarball path: ${{ github.workspace }} @@ -343,7 +385,7 @@ jobs: # Get files created by release script - name: Get zip-tarball (Windows_intel) - uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: zip-tarball path: ${{ github.workspace }} @@ -429,7 +471,7 @@ jobs: # Get files created by release script - name: Get tgz-tarball (Linux_intel) - uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: tgz-tarball path: ${{ github.workspace }} diff --git a/.github/workflows/release-files.yml b/.github/workflows/release-files.yml index e443588..c5254c1 100644 --- a/.github/workflows/release-files.yml +++ b/.github/workflows/release-files.yml @@ -75,7 +75,7 @@ jobs: # Get files created by tarball script - name: Get doxygen (Linux) - uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: docs-doxygen path: ${{ github.workspace }}/${{ steps.get-file-base.outputs.FILE_BASE }}.doxygen @@ -84,56 +84,68 @@ jobs: run: zip -r ${{ steps.get-file-base.outputs.FILE_BASE }}.doxygen.zip ./${{ steps.get-file-base.outputs.FILE_BASE }}.doxygen - name: Get tgz-tarball (Linux) - uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: tgz-tarball path: ${{ github.workspace }} - name: Get zip-tarball (Windows) - uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 + 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@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 + 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@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 + 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@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 + 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@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 + 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@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 + 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@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 + 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@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: abi-reports path: ${{ github.workspace }} @@ -160,6 +172,8 @@ 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 @@ -184,6 +198,8 @@ 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 diff --git a/.github/workflows/remove-files.yml b/.github/workflows/remove-files.yml index 1d72362..737c9b4 100644 --- a/.github/workflows/remove-files.yml +++ b/.github/workflows/remove-files.yml @@ -54,6 +54,8 @@ 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 diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml new file mode 100644 index 0000000..3f072d0 --- /dev/null +++ b/.github/workflows/scorecard.yml @@ -0,0 +1,72 @@ +# This workflow uses actions that are not certified by GitHub. They are provided +# by a third-party and are governed by separate terms of service, privacy +# policy, and support documentation. + +name: Scorecard supply-chain security +on: + # For Branch-Protection check. Only the default branch is supported. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection + branch_protection_rule: + # To guarantee Maintained check is occasionally updated. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained + schedule: + - cron: '36 22 * * 4' + push: + branches: [ "develop" ] + +# Declare default permissions as read only. +permissions: read-all + +jobs: + analysis: + name: Scorecard analysis + runs-on: ubuntu-latest + permissions: + # Needed to upload the results to code-scanning dashboard. + security-events: write + # Needed to publish results and get a badge (see publish_results below). + id-token: write + # Uncomment the permissions below if installing in a private repository. + # contents: read + # actions: read + + steps: + - name: "Checkout code" + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + persist-credentials: false + + - name: "Run analysis" + uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1 + with: + results_file: results.sarif + results_format: sarif + # (Optional) "write" PAT token. Uncomment the `repo_token` line below if: + # - you want to enable the Branch-Protection check on a *public* repository, or + # - you are installing Scorecard on a *private* repository + # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat. + # repo_token: ${{ secrets.SCORECARD_TOKEN }} + + # Public repositories: + # - Publish results to OpenSSF REST API for easy access by consumers + # - Allows the repository to include the Scorecard badge. + # - See https://github.com/ossf/scorecard-action#publishing-results. + # For private repositories: + # - `publish_results` will always be set to `false`, regardless + # of the value entered here. + publish_results: true + + # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF + # format to the repository Actions tab. + - name: "Upload artifact" + uses: actions/upload-artifact@v4 + with: + name: SARIF file + path: results.sarif + retention-days: 5 + + # Upload the results to GitHub's code scanning dashboard. + - name: "Upload to code-scanning" + uses: github/codeql-action/upload-sarif@8a470fddafa5cbb6266ee11b37ef4d8aae19c571 # v3.24.6 + with: + sarif_file: results.sarif diff --git a/.gitignore b/.gitignore index cbaccb2..d2fc4c7 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,4 @@ src/H5version.h /.classpath /CMakeUserPresets.json +HDF5Examples/CMakeUserPresets.json diff --git a/CMakeLists.txt b/CMakeLists.txt index 2446958..36bb53b 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) @@ -1150,7 +1155,11 @@ 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 () diff --git a/HDF5Examples/CMakeUserPresets.json b/HDF5Examples/CMakeUserPresets.json deleted file mode 100644 index 5b479be..0000000 --- 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/H5PAR/ph5_f90_hyperslab_by_col.F90 b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_col.F90 index affb799..c439d63 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/config/cmake-presets/hidden-presets.json b/HDF5Examples/config/cmake-presets/hidden-presets.json index 8b7f71b..590e7ec 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 245003c..5c425db 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,11 +165,21 @@ 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 (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") diff --git a/HDF5Examples/config/cmake/HDFMacros.cmake b/HDF5Examples/config/cmake/HDFMacros.cmake index 59efbfb..b9ef2df 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 "ON to use GNU Coding Standard install directory variables, OFF to use historical settings" OFF) + 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 "ON to build as frameworks libraries, OFF to build according to BUILD_SHARED_LIBS" OFF) + 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) diff --git a/config/BlankForm b/config/BlankForm index 55a3b49..e297cc3 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 8459b77..75e725e 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 df27de0..64ccfb9 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" - ] } ] } diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index df28f76..37f306e 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) set (${HDF_PREFIX}_HAVE_TIMEZONE 1) set (${HDF_PREFIX}_HAVE_GETTIMEOFDAY 1) set (${HDF_PREFIX}_HAVE_LIBWS2_32 1) @@ -396,7 +395,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 f8756e9..2ca5027 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@ diff --git a/config/cmake/HDF5ExampleCache.cmake b/config/cmake/HDF5ExampleCache.cmake index 7c3bf13..9b526ee 100644 --- a/config/cmake/HDF5ExampleCache.cmake +++ b/config/cmake/HDF5ExampleCache.cmake @@ -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 7cdaf02..e96c45d 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) diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index 7f125f1..d34876c 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)") diff --git a/config/cmake/HDFTests.c b/config/cmake/HDFTests.c index 3897390..095f113 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 61adffd..1389aaf 100644 --- a/config/cmake/HDFUseFortran.cmake +++ b/config/cmake/HDFUseFortran.cmake @@ -31,6 +31,12 @@ 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 +44,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 diff --git a/config/cmake/LIBAEC/CMakeLists.txt b/config/cmake/LIBAEC/CMakeLists.txt index e118438..379902b 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/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.in index b04b201..9874115 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/cygwin b/config/cygwin index 9cc6401..b028e70 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 b2f5d05..bd486af 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 40a3f0e..8db550d 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 134452c..725ba62 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 0431f94..b4139ee 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 0431f94..0000000 --- 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 596bf3a..0000000 --- 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 b4139ee..0000000 --- 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 f1433bf..0000000 --- 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 e314145..eee157b 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 0000000..67d3f21 --- /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 4a927af..54a33de 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 0000000..bc3446d --- /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 5aaa2a6..181351d 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} @@ -72,21 +69,68 @@ function(clang_format TARGET_NAME) # 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 4ba043b..53591d2 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 @@ -13,11 +13,13 @@ # License for the specific language governing permissions and limitations under # the License. +include(CheckCXXSourceCompiles) + 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 +30,164 @@ function(append value) endforeach(variable) endfunction() -message(STATUS "USE_SANITIZER=${USE_SANITIZER}, CMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}") +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_cxx_source_compiles("int main() { return 0; }" ${return_var}) + set(CMAKE_REQUIRED_FLAGS "${FLAGS_BACKUP}") + set(CMAKE_REQUIRED_QUIET "${QUIET_BACKUP}") +endfunction() + 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) - message(STATUS "Building with sanitize, base flags=${CMAKE_C_SANITIZER_FLAGS}") + append("-fno-omit-frame-pointer" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) if(uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG") - append("-O1" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + append("-O1" CMAKE_C_FLAGS CMAKE_CXX_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 CMAKE_CXX_COMPILER_LAUNCHER) + endif() + else() + message(FATAL_ERROR "Address sanitizer not available for ${CMAKE_CXX_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 CMAKE_CXX_COMPILER_LAUNCHER) + endif() + else() + message(FATAL_ERROR "Memory [With Origins] sanitizer not available for ${CMAKE_CXX_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 CMAKE_CXX_COMPILER_LAUNCHER) + endif() + else() + message(FATAL_ERROR "Undefined Behaviour sanitizer not available for ${CMAKE_CXX_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 CMAKE_CXX_COMPILER_LAUNCHER) + endif() + else() + message(FATAL_ERROR "Thread sanitizer not available for ${CMAKE_CXX_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 CMAKE_CXX_COMPILER_LAUNCHER) + endif() + else() + message(FATAL_ERROR "Thread sanitizer not available for ${CMAKE_CXX_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 CMAKE_CXX_COMPILER_LAUNCHER) + endif() + else() + message(FATAL_ERROR "Control Flow Integrity(CFI) sanitizer not available for ${CMAKE_CXX_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 CMAKE_CXX_FLAGS) else() - message( - FATAL_ERROR "Unsupported value of USE_SANITIZER: ${USE_SANITIZER}") + message(FATAL_ERROR " Sanitizer flags ${SANITIZER_SELECTED_FLAGS} are not compatible.") 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 CMAKE_CXX_FLAGS) + + if(AFL) + append_quoteless(AFL_USE_ASAN=1 CMAKE_C_COMPILER_LAUNCHER CMAKE_CXX_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 CMAKE_CXX_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 88d3baf..106f9c5 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 44dc430..1045255 100644 --- a/configure.ac +++ b/configure.ac @@ -710,6 +710,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]) @@ -761,6 +762,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]) diff --git a/fortran/src/H5config_f.inc.cmake b/fortran/src/H5config_f.inc.cmake index e6fa7b9..4330ca2 100644 --- a/fortran/src/H5config_f.inc.cmake +++ b/fortran/src/H5config_f.inc.cmake @@ -73,6 +73,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 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 7f52255..65fd68a 100644 --- a/fortran/src/H5config_f.inc.in +++ b/fortran/src/H5config_f.inc.in @@ -41,6 +41,9 @@ ! 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/test/H5_test_buildiface.F90 b/fortran/test/H5_test_buildiface.F90 index 60f2e4c..0b5efeb 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/testpar/async.F90 b/fortran/testpar/async.F90 index 02045cb..5c7411f 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 @@ CONTAINS 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 @@ CONTAINS 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/hl/CMakeLists.txt b/hl/CMakeLists.txt index 45a9a22..ab4bc79 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/src/H5LT.c b/hl/src/H5LT.c index 6bd1337..099356f 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 @@ out: 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 @@ out: H5E_BEGIN_TRY { H5Pclose(fapl); + H5Fclose(file_id); } H5E_END_TRY + return -1; } /* end H5LTopen_file_image() */ diff --git a/hl/test/test_dset_append.c b/hl/test/test_dset_append.c index 4b07582..0971cf3 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 f3b1fef..abef080 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 dd0ccc4..be431c1 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 890ac37..7b00431 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 ce0e10e..fd40010 100644 --- a/hl/tools/h5watch/CMakeTests.cmake +++ b/hl/tools/h5watch/CMakeTests.cmake @@ -74,7 +74,7 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes 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" @@ -99,7 +99,7 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes 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" @@ -126,7 +126,7 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes 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/m4/aclocal_fc.f90 b/m4/aclocal_fc.f90 index 68a8f1b..d485f77 100644 --- a/m4/aclocal_fc.f90 +++ b/m4/aclocal_fc.f90 @@ -55,6 +55,31 @@ PROGRAM PROG_FC_HAVE_F2003_REQUIREMENTS ptr = C_LOC(ichr(1:1)) END PROGRAM PROG_FC_HAVE_F2003_REQUIREMENTS +!---- 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 +179,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 5d7bca9..5e47626 100644 --- a/m4/aclocal_fc.m4 +++ b/m4/aclocal_fc.m4 @@ -131,6 +131,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 new file mode 100644 index 0000000..0fcbcf7 --- /dev/null +++ b/release_docs/INSTALL @@ -0,0 +1,79 @@ +************************************************************************* +* Installation Instructions for HDF5 * +************************************************************************* + +Instructions for the Installation of HDF5 Software +================================================== + +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://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 + + + +***************************************************************************** + +1. Obtaining HDF5 + The latest supported public releases of HDF5 are available on + https://github.com/HDFGroup/hdf5. + +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. + +2.2. Szip (optional) + The HDF5 library includes a predefined compression filter that + uses the extended-Rice lossless compression algorithm for chunked + datasets. + + Building instructions are available with the Szip source code. + + The HDF Group does not distribute separate Szip precompiled libraries, + but the HDF5 pre-built binaries provided on The HDF Group download page + include the Szip library with the encoder enabled. These can be found + here: + + https://www.hdfgroup.org/downloads/hdf5/ + + 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. + + To check if Szip compression was successfully configured in, + check the "I/O filters (external):" line in the configure output, + summary section, printed to the standard output. + +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: + + https://github.com/HDFGroup/hdf5/releases + +4. Build and Install HDF5 on Unix and Mac OSX Platforms with autotools + see the release_docs/INSTALL_Autotools.txt file. + +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 index 969fbac..f022154 100644 --- a/release_docs/INSTALL_Auto.txt +++ b/release_docs/INSTALL_Auto.txt @@ -1,60 +1,56 @@ +************************************************************************* +* Installation Instructions for HDF5 using Autotools * +************************************************************************* -Instructions for the Installation of HDF5 Software -================================================== + Table of Contents -This file provides instructions for installing the HDF5 software. +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 -CONTENTS --------- - 1. Obtaining HDF5 - - 2. Quick installation - 2.1. Windows - - 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 releases of HDF5 are available on - https://github.com/HDFGroup/hdf5. - - -2. Quick installation + +======================================================================== +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 @@ -67,8 +63,7 @@ CONTENTS $ make install $ make check-install # verify installation. - - above refers to the configure flags appropriate + 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: @@ -79,84 +74,38 @@ CONTENTS 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. - - -3. HDF5 dependencies -3.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) - 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: +======================================================================== +III. Full installation instructions for source distributions +======================================================================== - https://portal.hdfgroup.org/display/HDF5/Szip+Compression+in+HDF+Products - - Building instructions are available with the Szip source code. - - The HDF Group does not distribute separate Szip precompiled libraries, - but the HDF5 pre-built binaries provided on The HDF Group download page - include the Szip library with the encoder enabled. These can be found - here: - - 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. - - To check if Szip compression was successfully configured in, - check the "I/O filters (external):" line in the configure output, - summary section, printed to the standard output. - -3.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. - - -4. Full installation instructions for source distributions - -4.1. Unpacking the distribution + 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) + 1.1. Non-compressed tar archive (*.tar) $ tar xf hdf5-X.Y.Z.tar -4.1.2. Compressed tar archive (*.tar.Z) + 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) + 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) + 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 + 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 @@ -168,7 +117,7 @@ CONTENTS $ ../hdf5-X.Y.Z/configure --enable-fortran ... -4.3. Configuring + 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: @@ -189,7 +138,7 @@ CONTENTS `configure' output. The host config file influences the behavior of configure by setting or augmenting shell variables. -4.3.1. Specifying the installation directories + 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, @@ -206,7 +155,7 @@ CONTENTS specified at configure time; see section 4.6, "Installing HDF5," for more details. -4.3.2. Using an alternate C compiler + 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 @@ -225,7 +174,7 @@ CONTENTS $ CC=/usr/local/mpi/bin/mpicc ./configure -4.3.3. Additional compilation flags + 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 @@ -233,7 +182,7 @@ CONTENTS $ CFLAGS=-g ./configure --enable-build-mode=production -4.3.4. Compiling HDF5 wrapper libraries + 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', @@ -251,7 +200,7 @@ CONTENTS $ FC=/usr/local/bin/g95 ./configure --enable-fortran -4.3.5. Specifying other programs + 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 @@ -285,7 +234,7 @@ CONTENTS 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 + 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 @@ -315,7 +264,7 @@ CONTENTS $ ./configure --with-szlib=/Szip_Install_Directory -4.3.7. Static versus shared linking + 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 @@ -331,7 +280,7 @@ CONTENTS $ ./configure --enable-static-exec -4.3.8. Optimization versus symbolic debugging + 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 @@ -372,7 +321,7 @@ CONTENTS 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 + 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. @@ -384,7 +333,7 @@ CONTENTS --enable-threadsafe, --enable-cxx, --enable-java -4.3.10. Threadsafe capability + 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' @@ -401,7 +350,7 @@ CONTENTS --enable-hl, --enable-cxx, --enable-fortran, --enable-java -4.3.11. Backward compatibility + 3.11. Backward compatibility The 1.14 version of the HDF5 library can be configured to operate identically to the v1.12 library with the --with-default-api-version=v112 @@ -418,7 +367,7 @@ CONTENTS https://portal.hdfgroup.org/display/HDF5/API+Compatibility+Macros -4.4. Building + 4. Building The library, confidence tests, and programs can be built by specifying: @@ -435,7 +384,7 @@ CONTENTS $ make -j -l6 -4.4. Building doxygen + 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'. @@ -448,7 +397,7 @@ CONTENTS $ make doxygen -4.5. Testing + 5. Testing HDF5 comes with various test suites, all of which can be run by specifying: @@ -478,7 +427,7 @@ CONTENTS 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 + 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' @@ -541,8 +490,9 @@ CONTENTS ./tools/gifconv/gif2h5 (GIF to HDF5 converter) -5. Using the Library - +======================================================================== +IV. Using the Library +======================================================================== For information on using HDF5 see the documentation, tutorials and examples found here: @@ -553,4 +503,21 @@ CONTENTS 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 f794d3c..c041bae 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -213,7 +213,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.14."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.14."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.14."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.14."X" @@ -657,7 +657,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 +692,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 @@ -779,7 +779,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,17 +787,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_BUILD_PARALLEL_TOOLS "Build Parallel HDF5 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" @@ -904,28 +905,28 @@ if (BUILD_TESTING) HDF5_DISABLE_TESTS_REGEX "Regex pattern to set execution of specific tests to DISABLED" "" ---------------- 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" OFF -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-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 -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: diff --git a/release_docs/INSTALL_parallel b/release_docs/INSTALL_parallel index d3d7830..8dabf89 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 7e42b01..364a3b1 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -47,6 +47,14 @@ New Features Configuration: ------------- + - 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. @@ -171,6 +179,33 @@ Bug Fixes since HDF5-1.14.3 release =================================== Library ------- + - 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) @@ -284,7 +319,16 @@ Bug Fixes since HDF5-1.14.3 release 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 diff --git a/release_docs/USING_CMake_Examples.txt b/release_docs/USING_CMake_Examples.txt index 4439296..5e7c66b 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_VS.txt b/release_docs/USING_HDF5_VS.txt index 79d9c3c..03db0db 100644 --- a/release_docs/USING_HDF5_VS.txt +++ b/release_docs/USING_HDF5_VS.txt @@ -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 ========================================================================== diff --git a/src/H5AC.c b/src/H5AC.c index 802ccdd..b752803 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 5e23036..51f1b35 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/H5C.c b/src/H5C.c index eb6e49e..1713e83 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 @@ done: * * 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 2bbf9ac..fec1f4a 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 31a947a..2e79a0d 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 5417684..4408774 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 3477e75..9f12312 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 a1a9f42..8da6c13 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 @@ done: 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 /*------------------------------------------------------------------------- @@ -685,6 +588,36 @@ done: #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 * * Purpose: Flushes all entries with the specified tag to disk. @@ -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/H5Fint.c b/src/H5Fint.c index 1feada6..7b5aeb4 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 @@ done: *------------------------------------------------------------------------- */ 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/H5Fpkg.h b/src/H5Fpkg.h index bc5c90b..60de31e 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/H5Ftest.c b/src/H5Ftest.c index 081fbda..7e34e0a 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/H5Oainfo.c b/src/H5Oainfo.c index 1050212..8b82e39 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 @@ done: *------------------------------------------------------------------------- */ 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 e86ec39..6852ebc 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 c9c2196..4948d61 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 @@ done: *------------------------------------------------------------------------- */ 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 7f56b43..42e1ce0 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 @@ done: *------------------------------------------------------------------------- */ 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 7c71178..d91b463 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 @@ done: *------------------------------------------------------------------------- */ 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 ff08218..6894eca 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 @@ done: *------------------------------------------------------------------------- */ 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/H5Odrvinfo.c b/src/H5Odrvinfo.c index 4ff9873..baec777 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 @@ done: *------------------------------------------------------------------------- */ 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 c06ecf6..ebd92a7 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 @@ done: *------------------------------------------------------------------------- */ 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 ca3a3de..5b69235 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); @@ -221,7 +222,8 @@ done: *------------------------------------------------------------------------- */ 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 72d15af..645c5ff 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 @@ done: *------------------------------------------------------------------------- */ 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 1f2b686..75456d6 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 @@ done: *------------------------------------------------------------------------- */ 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 9d26483..830e4e3 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 @@ done: *------------------------------------------------------------------------- */ 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 9d4d685..6657a50 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 @@ done: *------------------------------------------------------------------------- */ 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 f6cafdc..bc4381b 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 9cf9400..864af93 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 @@ done: *------------------------------------------------------------------------- */ 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 d600137..fc85c0b 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 @@ done: *------------------------------------------------------------------------- */ 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 feca86f..4c719bf 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/H5Orefcount.c b/src/H5Orefcount.c index 426d2be..a93f429 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 @@ done: *------------------------------------------------------------------------- */ 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 97539ba..2813bad 100644 --- a/src/H5Oshared.h +++ b/src/H5Oshared.h @@ -91,7 +91,7 @@ done: *------------------------------------------------------------------------- */ 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 50d6652..98f1829 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 @@ done: *------------------------------------------------------------------------- */ 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 a9c3dd1..5000ca8 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 @@ done: *------------------------------------------------------------------------- */ 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/H5Pfapl.c b/src/H5Pfapl.c index e7c1fb3..6c2ef47 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -3159,9 +3159,10 @@ done: 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() */ @@ -4978,7 +4986,9 @@ H5Pget_file_locking(hid_t fapl_id, hbool_t *use_file_locking /*out*/, hbool_t *i H5TRACE3("e", "ixx", 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 */ diff --git a/test/API/H5_api_dataset_test.c b/test/API/H5_api_dataset_test.c index e9ad15c..2989b70 100644 --- a/test/API/H5_api_dataset_test.c +++ b/test/API/H5_api_dataset_test.c @@ -67,6 +67,7 @@ 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); @@ -148,6 +149,7 @@ static int (*dataset_tests[])(void) = { 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, @@ -9829,6 +9831,484 @@ error: 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(file_id, 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(file_id, 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(file_id, 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; + } + + 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(rw_all_int) + { + 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); + + for (size_t j = 0; j < i + 1; j++) { + ((int *)wbuf[i].p)[j] = (int)(i * j + 1); + } + + wbuf[i].len = i + 1; + } + + /* Perform write */ + if ((H5Dwrite(dset_int, vlen_int, space_id, H5S_ALL, H5P_DEFAULT, (const void *)wbuf)) < 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); + } + + PASSED(); + + /* 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); + } + PART_END(rw_all_int) + { + 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; + } + + /* Perform write */ + if ((H5Dwrite(dset_float, vlen_float, space_id, H5S_ALL, H5P_DEFAULT, (const void *)wbuf)) < 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 (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); + } + } + + PASSED(); + + /* 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); + PART_BEGIN(rw_all_float) + } + PART_END(rw_all_float); + + PART_BEGIN(rw_all_string) + { + 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); + + 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); + } + + wbuf[i].len = i + 1; + } + + /* Perform write */ + if ((H5Dwrite(dset_string, vlen_string, space_id, H5S_ALL, H5P_DEFAULT, (const void *)wbuf)) < 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 (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); + } + } + + PASSED(); + + /* 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); + } + PART_END(rw_all_string); + + PART_BEGIN(rw_point_selection) + { + /* Select even-indexed points */ + for (size_t i = 0; i < DATASET_VLEN_IO_DSET_DIMS / 2; i++) + point_coords[i] = i * 2; + + /* 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); + + /* 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); + + for (size_t j = 0; j < i + 1; j++) { + ((int *)wbuf[i].p)[j] = (int)(i * j + 1); + } + + wbuf[i].len = i + 1; + } + + /* Perform write */ + if ((H5Dwrite(dset_int, vlen_int, space_id, space_id, H5P_DEFAULT, (const void *)wbuf)) < 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); + } + } + + PASSED(); + + /* 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); + } + 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; + } + + /* Perform write */ + if ((H5Dwrite(dset_int, vlen_int, space_id, space_id, H5P_DEFAULT, (const void *)wbuf)) < 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 (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); + } + } + + PASSED(); + + /* 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); + } + PART_END(rw_hyperslab_selection); + } + END_MULTIPART; + + TESTING_2("test cleanup"); + + if (H5Fclose(file_id) < 0) + TEST_ERROR; + if (H5Gclose(container_group) < 0) + TEST_ERROR; + if (H5Dclose(dset_int) < 0) + TEST_ERROR; + if (H5Dclose(dset_float) < 0) + TEST_ERROR; + if (H5Dclose(dset_string) < 0) + TEST_ERROR; + if (H5Sclose(space_id) < 0) + TEST_ERROR; + /* 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(vlen_float) < 0) + TEST_ERROR; + if (H5Tclose(vlen_string) < 0) + TEST_ERROR; + + PASSED(); + return 0; +error: + + H5E_BEGIN_TRY + { + H5Fclose(file_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 + + return 1; +} + /* * A test to check that a chunked dataset's extent can be * changed by using H5Dset_extent. This test uses unlimited diff --git a/test/API/H5_api_dataset_test.h b/test/API/H5_api_dataset_test.h index 086dc1c..12a111a 100644 --- a/test/API/H5_api_dataset_test.h +++ b/test/API/H5_api_dataset_test.h @@ -256,6 +256,11 @@ int H5_api_dataset_test(void); #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_link_test.c b/test/API/H5_api_link_test.c index b6ae512..e681084 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 @@ error: 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 @@ error: 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 c068f4f..02514cd 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/cache.c b/test/cache.c index 4e62886..09d6a1f 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) { @@ -2841,24 +2839,6 @@ check_insert_entry(unsigned paged) 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 */ if ((entry_ptr->header).is_pinned) { @@ -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 a9a8dbb..2e8a463 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 61b1dbe..9a86b8a 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -264,10 +264,7 @@ error: * * 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/dt_arith.c b/test/dt_arith.c index d3147cb..4a99811 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -3307,6 +3307,7 @@ error: 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/h5test.c b/test/h5test.c index 1f1430b..c9c5c10 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -2067,6 +2067,49 @@ error: } /* 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 * * Purpose: Checks if the VOL connector being used is (or the VOL diff --git a/test/h5test.h b/test/h5test.h index 8115207..8f78567 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 e068d71..299a7c2 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 @@ -9821,6 +9823,225 @@ error: } /* 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 * * Purpose: Verify functionality of H5P_set/get_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/vol.c b/test/vol.c index 43336c6..e29c6bb 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/tools/libtest/h5tools_test_utils.c b/tools/libtest/h5tools_test_utils.c index 6f3c0a6..32f109b 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 5b79a85..6263fe6 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 8de7c61..e6802b1 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/h5dump/CMakeLists.txt b/tools/src/h5dump/CMakeLists.txt index 3284949..3cdffa2 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 8f2c406..63c2102 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -1169,7 +1169,8 @@ end_collect: 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 +1189,7 @@ end_collect: 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 diff --git a/tools/src/h5format_convert/CMakeLists.txt b/tools/src/h5format_convert/CMakeLists.txt index 2a7e3cb..4e48ad5 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 f8268a1..4d231ad 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 7efd0d8..bcd7eca 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 67122a1..f8f7fff 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 04c5ff3..b3488d5 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 6ff5200..2237f74 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 ea1ee80..f215b05 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 c3aef5f..a7b8e5c 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 15232e4..a90ef5e 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 62bd443..1b45246 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 15d66d1..27e7e1a 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") @@ -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") @@ -261,7 +261,7 @@ ) # 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}) + 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,7 +270,7 @@ 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" @@ -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" @@ -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" @@ -445,7 +445,7 @@ 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}) + add_test (NAME H5COPY-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) if (${resultcode}) set_tests_properties (H5COPY-${resultfile} PROPERTIES WILL_FAIL "true") endif () @@ -454,7 +454,7 @@ 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" diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index f993f4b..30dffb6 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -415,7 +415,7 @@ 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}) + 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" @@ -445,7 +445,7 @@ 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}) + 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}" @@ -484,7 +484,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" @@ -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 e997aa8..323e5dc 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -442,13 +442,13 @@ 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}) + 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" @@ -482,7 +482,7 @@ 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}) + 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" @@ -522,7 +522,7 @@ ) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-N-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) + 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" @@ -571,7 +571,7 @@ ) # 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}) + 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" @@ -640,7 +640,7 @@ ) # 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}) + 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" @@ -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 @@ -757,7 +757,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" @@ -781,7 +781,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" @@ -804,7 +804,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" @@ -828,7 +828,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" @@ -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" @@ -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" @@ -954,7 +954,7 @@ 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" diff --git a/tools/test/h5dump/CMakeTestsPBITS.cmake b/tools/test/h5dump/CMakeTestsPBITS.cmake index 3104846..8f479f3 100644 --- a/tools/test/h5dump/CMakeTestsPBITS.cmake +++ b/tools/test/h5dump/CMakeTestsPBITS.cmake @@ -118,7 +118,7 @@ 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}) + 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 1589e70..e3cb9e3 100644 --- a/tools/test/h5dump/CMakeTestsVDS.cmake +++ b/tools/test/h5dump/CMakeTestsVDS.cmake @@ -109,7 +109,7 @@ 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}) + 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" @@ -138,7 +138,7 @@ 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}) + 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" @@ -173,7 +173,7 @@ 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}) + 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 ae7cd8f..43e77ee 100644 --- a/tools/test/h5dump/CMakeTestsXML.cmake +++ b/tools/test/h5dump/CMakeTestsXML.cmake @@ -181,7 +181,7 @@ macro (ADD_XML_H5_TEST resultfile resultcode) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP_XML-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --xml ${ARGN}) + 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 433eced..6f89d4c 100644 --- a/tools/test/h5dump/CMakeVFDTests.cmake +++ b/tools/test/h5dump/CMakeVFDTests.cmake @@ -82,7 +82,7 @@ macro (ADD_VFD_H5DUMP_TEST vfdname resultfile resultcode) 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}" diff --git a/tools/test/h5format_convert/CMakeTests.cmake b/tools/test/h5format_convert/CMakeTests.cmake index ecf16bf..bf4257e 100644 --- a/tools/test/h5format_convert/CMakeTests.cmake +++ b/tools/test/h5format_convert/CMakeTests.cmake @@ -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" @@ -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" @@ -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" @@ -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" @@ -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" @@ -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 71c0421..c5753c1 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 @@ -127,7 +127,7 @@ 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" @@ -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" @@ -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" diff --git a/tools/test/h5jam/CMakeTests.cmake b/tools/test/h5jam/CMakeTests.cmake index d87899a..2067e79 100644 --- a/tools/test/h5jam/CMakeTests.cmake +++ b/tools/test/h5jam/CMakeTests.cmake @@ -54,7 +54,7 @@ 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}) + 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" @@ -86,7 +86,7 @@ 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}) + 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" @@ -116,7 +116,7 @@ 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" @@ -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 () @@ -262,7 +262,7 @@ 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 () @@ -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 2d932b2..9b63021 100644 --- a/tools/test/h5ls/CMakeTests.cmake +++ b/tools/test/h5ls/CMakeTests.cmake @@ -144,7 +144,7 @@ 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}) + 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" @@ -177,7 +177,7 @@ 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}) + 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,7 +187,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" @@ -212,7 +212,7 @@ 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" diff --git a/tools/test/h5ls/CMakeTestsVDS.cmake b/tools/test/h5ls/CMakeTestsVDS.cmake index 9bf4042..9251718 100644 --- a/tools/test/h5ls/CMakeTestsVDS.cmake +++ b/tools/test/h5ls/CMakeTestsVDS.cmake @@ -84,7 +84,7 @@ 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}) + 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" @@ -111,7 +111,7 @@ 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}) + 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 3fb5d56..83c1e73 100644 --- a/tools/test/h5repack/CMakeTests.cmake +++ b/tools/test/h5repack/CMakeTests.cmake @@ -249,13 +249,13 @@ 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}) + 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" @@ -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} @@ -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} @@ -378,7 +378,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) 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" @@ -432,14 +432,14 @@ if (HDF5_ENABLE_USING_MEMCHECKER) 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) 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" @@ -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 @@ -495,7 +495,7 @@ 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" @@ -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 @@ -560,7 +560,7 @@ 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" @@ -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" @@ -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 @@ -659,7 +659,7 @@ 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" @@ -709,7 +709,7 @@ ) 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" @@ -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" @@ -851,7 +851,7 @@ ) 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" @@ -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" @@ -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/h5stat/CMakeTests.cmake b/tools/test/h5stat/CMakeTests.cmake index 2b47cd0..5e1833f 100644 --- a/tools/test/h5stat/CMakeTests.cmake +++ b/tools/test/h5stat/CMakeTests.cmake @@ -96,7 +96,7 @@ 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}) + add_test (NAME H5STAT-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) if (${resultcode}) set_tests_properties (H5STAT-${resultfile} PROPERTIES WILL_FAIL "true") endif () @@ -105,7 +105,7 @@ 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" @@ -125,7 +125,7 @@ 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}) + add_test (NAME H5STAT-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) if (${resultcode}) set_tests_properties (H5STAT-${resultfile} PROPERTIES WILL_FAIL "true") endif () @@ -134,7 +134,7 @@ 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 aead4c5..f62be78 100644 --- a/tools/test/misc/CMakeTestsClear.cmake +++ b/tools/test/misc/CMakeTestsClear.cmake @@ -94,7 +94,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}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}.out" @@ -118,7 +118,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}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}.out" @@ -156,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" @@ -191,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" @@ -213,7 +213,7 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) 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" @@ -243,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" @@ -260,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 @@ -280,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" @@ -318,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" @@ -335,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 @@ -354,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" @@ -397,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} diff --git a/tools/test/misc/CMakeTestsMkgrp.cmake b/tools/test/misc/CMakeTestsMkgrp.cmake index e583b7f..a66d4ee 100644 --- a/tools/test/misc/CMakeTestsMkgrp.cmake +++ b/tools/test/misc/CMakeTestsMkgrp.cmake @@ -58,7 +58,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) 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" @@ -104,7 +104,7 @@ macro (ADD_H5_CMP resultfile resultcode) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5MKGRP_CMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) + 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" diff --git a/tools/test/misc/CMakeTestsRepart.cmake b/tools/test/misc/CMakeTestsRepart.cmake index 81e8cc6..9b3e44e 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/utils/tools/h5dwalk/CMakeLists.txt b/utils/tools/h5dwalk/CMakeLists.txt index f0611e0..c520eca 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/test/h5dwalk/CMakeTests.cmake b/utils/tools/test/h5dwalk/CMakeTests.cmake index 6cf2dbe..b65499d 100644 --- a/utils/tools/test/h5dwalk/CMakeTests.cmake +++ b/utils/tools/test/h5dwalk/CMakeTests.cmake @@ -29,7 +29,7 @@ # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) 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" -- cgit v0.12