diff options
author | Larry Knox <lrknox@hdfgroup.org> | 2021-02-08 16:56:16 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-08 16:56:16 (GMT) |
commit | 22c67ff6570f16050f0a5654cf1c84df917bb598 (patch) | |
tree | 38fb63aa498b250c2543fe7e22a511706de96a42 /test/h5test.c | |
parent | 551f15f8ae02ca9c995619b216121081eb07633e (diff) | |
download | hdf5-hdf5-1_8_22.zip hdf5-hdf5-1_8_22.tar.gz hdf5-hdf5-1_8_22.tar.bz2 |
1.8/master (#317)hdf5-1_8_22
* Revert incorrect bool type
* Correct grep text for filter test
* Check sizeof type to use correct ref_type
* h5dump reg ref chnages has no error file
* Fix comment
* Remove unneeded files
* Verify the decoded version for "all" and "none" selection.
* Remove double entry
* Add missing include
* Snapshot version 1.8 release 22 (snap4)
Update version to 1.8-snap5
* Fixes for test failures with --disable-tests --disable-tools options.
Don't test ph5diff if tests are disabled.
* Correct conditions for parallel builds with and without tests.
* Snapshot version 1.8 release 22 (snap5)
Update version to 1.8.22-snap6
* TRILAB-192 merging warnings changes from develop
* Autotools reconfigure update
* Restore page ejects.
* Restore page eject chars
* Fix orphaned token
* Update LT files
* Correct extra flags and merge TRILAB-24
* Update release note for CMake warnings
* H5repack bug fixes from develop
* TRILAB-192 - merge changes from develop
Single source, config files, for warnings for both autotools and CMake.
Update CMake libraries, tools, tests to use correct flags.
* Add missing m4 file
* Remove 128bit config check fo 1.8
* TRILAB-192 update LTparse files
* A fix in the cleaning up code for datatype when datatype initialization via H5D__init_type() fails.
The code to fix the problem is the same as what is done in H5D__open_oid().
* Add missing " and update function calls incorrectly
named load_gcc_arguments.
Commit changes to gnu-cxxflags to remove unmatched " and to gnu-fflags
to not add C warnings flags to H5_FCFLAGS.
* TRILAB-192 - cleanup edits and match CMake CXX to autotools
* Fix shadowed type
* TRILAB-192 correct fortran commands
* TRILAB-192 version of std=f2008 special check
* Fix shadow variable
* Add prefix_relto_examplesdir function to set relative path to h5c++.
* TRILAB-192 - parser files cannot handle this warning
* Parallel Fortran tests now use the MPI module instead of including
mpif.h.
* Don't add general warnings flags for unsupported old versions of gcc and
g++ (older than gcc/g++ 4.2).
Correct gnu-cxxflags to determine warnings flags to be added based on
C++ compiler version instead of C compiler version.
* Snapshot version 1.8 release 22 (snap6)
Update version to 1.8.22-snap7
* TRILAB-244 separate CXX warnings and errors from C
* Fix NoFilter build
* Move ADD_H5_FLAGS macro from *CompilerFlags.cmake files to
config/cmake_ext_mod/HDFMacros.cmake for common use.
* Restrict errors to gcc 4.8 and above.
* OESS-65 replace szip with aec szip
* Correct CMake version
* Correct -Werror=unused-variable
* Add -Werror= flags to lists displayed in libhdf5.settings.
* Fix -Werror=unused-variable
* More fixes for unused variable
* Resolve warning errors from -Werror= flags:
-Werror=bad-function-cast
-Werror=bad-function-cast
-Werror=implicit-function-declaration
-Werror=nested-externs
* Remove verbose assignments in smoke_check 3 and 5 functions.
* Update to use optimization flags, C++ error flags, and correct
libhdf5.settings.in to remove unworkable changes.
* Update config/gnu-cxxflags.
* Add missing headers
* Fix ifort warning flag.
Restore AC_DEFUN([PAC_PROG_FC_DEFAULT_REALisDBLE] in m4/aclocal_fc.m4.
Add --enable-symbols, --enable-profiling, and --enable-optimization
options to autotools configure; all configure flags for
--enable-production and --disable-production should match HDF5 1.10 and
1.12 production and debug default flags.
* Add github actions file
* Correct path
* OESS-65 Fix packaging
* Update reference name
* Correct filename
* disable pr action and enable fail fast
* Snapshot 1.8.22-snap7
Update version to 1.8.22-snap8.
* Correct mingw path
* Correct mingw paths
* Revise gnu-*flags and cmake/HDF*CompilerFlags.cmake files to add warning
flags for GCC compilers version 4.8 and above.
Removed files from gnu-warnings that only apply to versions < 4.8.
Consolidated warnings from versions < 4.8 that apply to versions >= 4.8
into the 4.8 warnings files.
* Update MANIFEST for removal of older warnings files.
* Yanked all MPI-1 calls
Added batch scripts in bin/batch.
* Snapshot 1.8.22-snap8.
Update version to 1.8.22-snap9.
* Squashed commit of the following:
commit 45b0cbc71929930a874e1c09e0770aa64d0ae697
Author: Larry Knox <lrknox@hdfgroup.org>
Date: Thu Apr 23 13:14:56 2020 -0500
Add C++ warnings treated as error for autotools builds.
commit 6debcddcc766601799d5bd661bd60946f951a07e
Author: Larry Knox <lrknox@hdfgroup.org>
Date: Fri Jun 19 16:50:03 2020 -0500
Remove tests for develop branch from testh5cc.sh.in.
Add @H5_ECXXFLAGS@ to AM_CXXFLAGS.
commit fed497e7f207313b2a133d3b68c942b7d7104b90
Author: Larry Knox <lrknox@hdfgroup.org>
Date: Fri Jun 12 15:06:39 2020 -0500
Merge pull request #2646 in HDFFV/hdf5 from ~LRKNOX/hdf5_lrk:develop to develop
* commit '998c6470d78e14228695419c3b514c35ecf3d69e':
Remove unnecessary version conditions for Clang compilers.
commit 92e52ce5c211bd1d3991a3b8bb67287ac7b652aa
Author: Larry Knox <lrknox@hdfgroup.org>
Date: Wed Jun 10 18:53:45 2020 -0500
Merge pull request #2639 in HDFFV/hdf5 from ~LRKNOX/hdf5_lrk:develop to develop
* commit 'a33667faf226f5d8c9633bf537893e8fce1bf1f6':
Add c++ to --enable-sanitize-checks option.
commit 2e802534fb997b81fa98fdd1c7d97d4310898e0d
Author: Larry Knox <lrknox@hdfgroup.org>
Date: Wed Jun 10 15:18:36 2020 -0500
Merge pull request #2633 in HDFFV/hdf5 from ~LRKNOX/hdf5_lrk:develop to develop
* commit '20eab963899841c9a003baebead8e3bc07d9e127':
Remove duplicate entries in MANIFEST.
Make changes to CMake CompilerFlags.cmake files so extra flags are loaded for non-GNU compilers.
Update new clang files to not pick up clang as vendor for pgCC. Add new files to MANIFEST Temporary demotion of 2 -Werror warning flags that fail on macos 10.12 Remove Production flag unknown to Apple clang.
commit 96ef60a58a23847a7da89a891f2415055ec2ab60
Author: Larry Knox <lrknox@hdfgroup.org>
Date: Mon Jun 8 16:24:49 2020 -0500
Merge pull request #2631 in HDFFV/hdf5 from ~LRKNOX/hdf5_lrk:develop to develop
* commit 'b942a4d8a3e27317cac50ce37ff5302d477664d8':
Clean up code to get clang version in config/linux-gnulibc1
commit 8a7c687da568e8b50b38fa53da1ca63759be6ec4
Author: Larry Knox <lrknox@hdfgroup.org>
Date: Mon Jun 8 11:42:37 2020 -0500
Merge pull request #2623 in HDFFV/hdf5 from ~LRKNOX/hdf5_lrk:develop to develop
* commit 'c7626f79fdee4eee13925e240ef41e61f3367eab':
Add flags from config/clang-warnings/*general files to H5 C and CXX flags for all versions of Clang and Clang++ compilers. Switched from cut to awk in testcheck_version.sh.in to avoid dependence on tab vs. " " in version definitions in H5public.h.
Add files for adding warning flags for clang compilers in autotools configure.
commit db3ef7ff3c1ed79167cecef831501411cff8291f
Merge: 5a0f8d7 f9f1310
Author: Larry Knox <lrknox@hdfgroup.org>
Date: Fri Jun 19 14:46:22 2020 -0500
Merge branch 'hdf5_1_12' of https://bitbucket.hdfgroup.org/scm/~lrknox/hdf5_lrk into hdf5_1_12
commit 5a0f8d7940ae57b445f545a0abd7e303ce6924ee
Author: Larry Knox <lrknox@hdfgroup.org>
Date: Wed Jun 10 20:15:41 2020 -0500
Merge pull request #2636 in HDFFV/hdf5 from ~LRKNOX/hdf5_lrk:HDFFV-11000-update-testh5cc.sh.in-for-version to develop
* commit '5c0bd670d6e9919c463fbc05de99e2ba55b0761e':
Add tests for all version to H5_NO_DEPRECATED_SYMBOLS section and to section for current version, with and without default API version flags.
HDFFV-11000: update-testh5cc.sh.in to test sample versioned functions in HDF5 1.10, 1.12 and develop.
* Update configure and Makefile.ins after bin/reconfigure.
* Fix MANIFEST
* Fix HDFFV-10591
Description:
h52gif produced a segfault when a buffer overflow occurred because
the data size was corrupted and became very large. This commit added
a check on the data size against the buffer size to prevent the segfault.
It also added error reporting to h52gif to display an error message
instead of silently exiting when the failure occurred.
Platforms tested:
Linux/64 (jelly)
* Snapshot 1.8.22-snap9. Update version to 1.8.22-snap10.
* Merge pull request #2686 in HDFFV/hdf5 from ~LRKNOX/hdf5_lrk:develop to develop
* commit '800f93f7c994f88dfa716746153ded4b1e690e3a':
Remove path to szip header file from AM_CPPFLAGS when configure check of libsz fails. Fix for HDFFV-10830.
* Regenerate configure.
* Merge from 1.10-1.12-dev - LT parse needs update
* Incorporate pull request #2693 from develop for the fix to HDFFV-11080:
(1) Patch up the file pointer when reading attribute of variable length datatype
(2) Test to verify the fix when doing multiple threads
(3) Update MANIFEST
(4) Add new test to Cmake
* Switch bison and flex update of LT files from bin/genltanalyse to
bin/genparser, and from automatically updating the LT files whenever
reconfigure is run to running only on man<F12>ual command.
* Update hl/sr/H5LT files.
Add bin/genparser to MANIFEST; remove bin/genltanalyze.
* Fix to the merge of PR #2708 for HDFFV-11080 to the 1.8 branch.
Need to checkin test/Makefile.in for the new file added.
* Fix HDFFV-11120 and HDFFV-11121 (CVE-2018-13870 and CVE-2018-13869)
Description:
When a buffer overflow occurred because a name length was corrupted
and became very large, h5dump produced a segfault on one file and a
memcpy parameter overlap on another file. This commit added checks
that detect a read pass the end of the buffer to prevent these error
conditions.
Platforms tested:
Linux/64 (jelly)
* Fixed typo
* Check for header szlib.h only when libsz passes AC_CHECK_LIB, so that
H5_HAVE_SALIB_H is not defined when szip is not enabled, to prevent
compile failures for incompatible szlib.
* HDFFV-11127 - force RTLD_LOCAL in dlopen
* spelling
* Remove extra parens
* Remove unnecessary assignment freom configure.ac.
* Add hypen to subrelease regex
* Add special case when H5_VERS_SUBRELEASE is 0
* Revert H5_VERS_SUBRELEASE check
* The version string has a second use for packaging
* MinGW uses "MinGW Makefiles"
* Snapshot 1.8.22-snap10. Update version to 1.8.22-snap11.
* Merge clang-format changes from develop
* remove stray file
* Source formatted
* Add options to github actions.
* Add back file, remove py file
* HDFFV-11096 Correct h5dump usage text
* Update formating
* remove autogen for 1.8 branch
* Fix comment whitespace
* Change '==' to 'eq' in test script
* Merge from develop
github updates
bin scripts
parser updates
* Snapshot 1.8.22-snap11. Update version to 1.8.22-snap12.
* Merge from 1.10
Comments, whitespace
Simple init and if block brackets.
Minimal code changes limited to return value and spelling
* Update autotools files
* Update FD source
* More merges from 1.10 comments and inits
* Comment fixes
* Fix macro argument
* Remove autogen file and cache dir
* Revert autotools files to previous version
* Correct boolean value and missing define
* URL and options corrections
* revert autoconf files
* Fix compile issues with vfd drivers.
* Fix HDFS test
* Remove extra #endif
* Move init above execution
* Multiple changes to bring branch up-to-date (#87)
Correct TARGET variable and CMake config file location.
Add option to allow filter plugins to be built inline.
Update CMake tools macros.
* hdf5 1 8 release text (#113)
* Multiple changes to bring branch up-to-date
Correct TARGET variable and CMake config file location.
Add option to allow filter plugins to be built inline.
Update CMake tools macros.
* release text updates - mostly whitespace
* Fixed HDFFV-10480 and HDFFV-11159 (#145)
* Fixed HDFFV-10480 and HDFFV-11159
Description
Checked against buffer size to prevent segfault, in case of data corruption.
+ HDFFV-11159 CVE-2018-14033 Buffer over-read in H5O_layout_decode
+ HDFFV-10480 CVE-2018-11206 Buffer over-read in H5O_fill_new[/old]_decode and
A user's patch was applied to this previously, but it is redone
for a more correct fix, that is the check now accounted for the
previous advance of the buffer pointer.
Platforms tested:
Linux/64 (jelly)
* Fixed typo
* Update HDF5 1.8 copyright headers with updated copyright URL (#148)
* Update URL for COPYING file in copyright headers.
* Make fortran copyright headers uniformly spaced.
* Update url for Copyright file in c++/src/footer.html.
* OESS-98 Update plugin build option (#171)
* 1.8 has extra fortran CMake option (#176)
* 1.8 has extra fortran CMake option
* Update license URL
* OESS-98 fix tools test for plugins (#180)
* Hdf5 1 8 (#169)
* Fixed HDFFV-10480 and HDFFV-11159
Description
Checked against buffer size to prevent segfault, in case of data corruption.
+ HDFFV-11159 CVE-2018-14033 Buffer over-read in H5O_layout_decode
+ HDFFV-10480 CVE-2018-11206 Buffer over-read in H5O_fill_new[/old]_decode and
A user's patch was applied to this previously, but it is redone
for a more correct fix, that is the check now accounted for the
previous advance of the buffer pointer.
Platforms tested:
Linux/64 (jelly)
* Fixed typo
* Fixed HDFFV-11150
Description
Replaced an HDassert with a check for null pointer in H5O_dec_rc() to
catch null pointer in corrupted data situation.
Reversed the fix in svn-r24463 in which a check for null pointer prior
to calling H5O_dec_rc()
Platforms tested:
Linux/64 (jelly)
* HDF5 1 8 fix fortran build on macs (#186)
* Correct fortran and shared libs option
* Fix for no shared fortran build
* OESS-98 fix hdf5 link target (#191)
* Partial changes to RELEASE.txt for release. (#185)
* Partial changes to RELEASE.txt for release.
* Update supported and tested platforms.
* Update version to 1.8.22-12.
* close #195. (#196)
* Update HDF5PluginMacros.cmake
* Update HDF5PluginMacros.cmake
* Update directory for SZ filter in HDF5PluginMacros.cmake.
Updates for release:
Switch configure default to production mode.
Set HDF5_GENERATE_HEADERS to OFF.
* Restores maintainer mode in the autotools (#200)
Maintainer mode should be enabled in development branches.
Also adds helpful commenting.
Add bin/switch_maint_mode
Disable maintainer mode for release.
Fix incomplete merge for stub functions in H5Fdhdfs.c
* Update configure for Restores maintainer mode in the autotools (#200).
* Update MANIFEST for switch_maint_mode script.
* Restores maintainer mode in the autotools (#200) (#203)
* Restores maintainer mode in the autotools (#200)
Maintainer mode should be enabled in development branches.
Also adds helpful commenting.
Add bin/switch_maint_mode
Disable maintainer mode for release.
Fix incomplete merge for stub functions in H5Fdhdfs.c
* Update configure for Restores maintainer mode in the autotools (#200).
* Update MANIFEST for switch_maint_mode script.
Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com>
* Hdf5 1 8 22 (#212)
* Restores maintainer mode in the autotools (#200)
Maintainer mode should be enabled in development branches.
Also adds helpful commenting.
Add bin/switch_maint_mode
Disable maintainer mode for release.
Fix incomplete merge for stub functions in H5Fdhdfs.c
* Update configure for Restores maintainer mode in the autotools (#200).
* Update MANIFEST for switch_maint_mode script.
Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com>
* Update so numbers for 1.8.22 release.
* Add so numbers changes in Makefile.ins for 1.8.22 release.
* Brings ttsafe_attr_vlen.c changes from develop (#214)
Fixes exposed pthread problem on Windows.
* Update SO numbers for Hdf5 1 8 22 (#215)
* Restores maintainer mode in the autotools (#200)
Maintainer mode should be enabled in development branches.
Also adds helpful commenting.
Add bin/switch_maint_mode
Disable maintainer mode for release.
Fix incomplete merge for stub functions in H5Fdhdfs.c
* Update configure for Restores maintainer mode in the autotools (#200).
* Update MANIFEST for switch_maint_mode script.
* Update so numbers for 1.8.22 release.
* Add so numbers changes in Makefile.ins for 1.8.22 release.
Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com>
* Update pkgconfig settings with version - #218 (#223)
* Add notice of final HDFF5 1.8 release.
Add solaris 64bit alignment issue to "Known Problems".
* Update 1.8 final release notice.
* Hdf5 1 8 22 (#224)
* Restores maintainer mode in the autotools (#200)
Maintainer mode should be enabled in development branches.
Also adds helpful commenting.
Add bin/switch_maint_mode
Disable maintainer mode for release.
Fix incomplete merge for stub functions in H5Fdhdfs.c
* Update configure for Restores maintainer mode in the autotools (#200).
* Update MANIFEST for switch_maint_mode script.
* Update so numbers for 1.8.22 release.
* Add so numbers changes in Makefile.ins for 1.8.22 release.
* Update pkgconfig settings with version - #218 (#223)
* Add notice of final HDFF5 1.8 release.
Add solaris 64bit alignment issue to "Known Problems".
* Update 1.8 final release notice.
Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com>
Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com>
* Update CMake/HDF5Examples version in bin/release
* Update CMake/HDF5Examples version number in bin/release (#225)
* Restores maintainer mode in the autotools (#200)
Maintainer mode should be enabled in development branches.
Also adds helpful commenting.
Add bin/switch_maint_mode
Disable maintainer mode for release.
Fix incomplete merge for stub functions in H5Fdhdfs.c
* Update configure for Restores maintainer mode in the autotools (#200).
* Update MANIFEST for switch_maint_mode script.
* Update so numbers for 1.8.22 release.
* Add so numbers changes in Makefile.ins for 1.8.22 release.
* Update pkgconfig settings with version - #218 (#223)
* Add notice of final HDFF5 1.8 release.
Add solaris 64bit alignment issue to "Known Problems".
* Update 1.8 final release notice.
* Update CMake/HDF5Examples version in bin/release
Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com>
Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com>
* Fixed typo in an error message. (#228)
* Fixed typo in an error message. (#227)
* Remove duplicate setting (#239)
* Bring 3 small changes from Hdf5 1.8 to 1.8.22 (#241)
* Restores maintainer mode in the autotools (#200)
Maintainer mode should be enabled in development branches.
Also adds helpful commenting.
Add bin/switch_maint_mode
Disable maintainer mode for release.
Fix incomplete merge for stub functions in H5Fdhdfs.c
* Update configure for Restores maintainer mode in the autotools (#200).
* Update MANIFEST for switch_maint_mode script.
* Update so numbers for 1.8.22 release.
* Add so numbers changes in Makefile.ins for 1.8.22 release.
* Update pkgconfig settings with version - #218 (#223)
* Add notice of final HDFF5 1.8 release.
Add solaris 64bit alignment issue to "Known Problems".
* Update 1.8 final release notice.
* Update CMake/HDF5Examples version in bin/release
* Fixed typo in an error message. (#227)
* Remove duplicate setting (#239)
Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com>
Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com>
Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com>
* Stat st blocks fix 1822 (#251)
* Restores maintainer mode in the autotools (#200)
Maintainer mode should be enabled in development branches.
Also adds helpful commenting.
Add bin/switch_maint_mode
Disable maintainer mode for release.
Fix incomplete merge for stub functions in H5Fdhdfs.c
* Update configure for Restores maintainer mode in the autotools (#200).
* Update MANIFEST for switch_maint_mode script.
* Update so numbers for 1.8.22 release.
* Add so numbers changes in Makefile.ins for 1.8.22 release.
* Update pkgconfig settings with version - #218 (#223)
* Add notice of final HDFF5 1.8 release.
Add solaris 64bit alignment issue to "Known Problems".
* Update 1.8 final release notice.
* Update CMake/HDF5Examples version in bin/release
* Fixed typo in an error message. (#227)
* Remove duplicate setting (#239)
* Fixes Autotools detection of the st_blocks field in stat (#246)
* Fixes Autotools detection of the st_blocks field in stat
The Autotools and CMake will now both correctly determine if the
stat struct has the st_blocks field and set H5_HAVE_STAT_ST_BLOCKS
appropriately.
* Fixes a typo in configure.ac
* Restore lines in RELEASE.txt.
Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com>
Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com>
Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com>
* Stat st blocks fix 1822 (#256)
* Restores maintainer mode in the autotools (#200)
Maintainer mode should be enabled in development branches.
Also adds helpful commenting.
Add bin/switch_maint_mode
Disable maintainer mode for release.
Fix incomplete merge for stub functions in H5Fdhdfs.c
* Update configure for Restores maintainer mode in the autotools (#200).
* Update MANIFEST for switch_maint_mode script.
* Update so numbers for 1.8.22 release.
* Add so numbers changes in Makefile.ins for 1.8.22 release.
* Update pkgconfig settings with version - #218 (#223)
* Add notice of final HDFF5 1.8 release.
Add solaris 64bit alignment issue to "Known Problems".
* Update 1.8 final release notice.
* Update CMake/HDF5Examples version in bin/release
* Fixed typo in an error message. (#227)
* Remove duplicate setting (#239)
* Fixes Autotools detection of the st_blocks field in stat (#246)
* Fixes Autotools detection of the st_blocks field in stat
The Autotools and CMake will now both correctly determine if the
stat struct has the st_blocks field and set H5_HAVE_STAT_ST_BLOCKS
appropriately.
* Fixes a typo in configure.ac
* Restore lines in RELEASE.txt.
* Updated configure with reconfigure.
Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com>
Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com>
Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com>
* RELEASE.txt cleanup.
* Hdf5 1 8 22 (#261)
* Restores maintainer mode in the autotools (#200)
Maintainer mode should be enabled in development branches.
Also adds helpful commenting.
Add bin/switch_maint_mode
Disable maintainer mode for release.
Fix incomplete merge for stub functions in H5Fdhdfs.c
* Update configure for Restores maintainer mode in the autotools (#200).
* Update MANIFEST for switch_maint_mode script.
* Update so numbers for 1.8.22 release.
* Add so numbers changes in Makefile.ins for 1.8.22 release.
* Update pkgconfig settings with version - #218 (#223)
* Add notice of final HDFF5 1.8 release.
Add solaris 64bit alignment issue to "Known Problems".
* Update 1.8 final release notice.
* Update CMake/HDF5Examples version in bin/release
* Fixed typo in an error message. (#227)
* Remove duplicate setting (#239)
* RELEASE.txt cleanup.
Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com>
Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com>
Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com>
* Add macOS Big Sur to tested machines, also missing entries for macOS 10.13 and 10.14.
* )Update version.
* Hdf5 1 8 22 (#266)
* Restores maintainer mode in the autotools (#200)
Maintainer mode should be enabled in development branches.
Also adds helpful commenting.
Add bin/switch_maint_mode
Disable maintainer mode for release.
Fix incomplete merge for stub functions in H5Fdhdfs.c
* Update configure for Restores maintainer mode in the autotools (#200).
* Update MANIFEST for switch_maint_mode script.
* Update so numbers for 1.8.22 release.
* Add so numbers changes in Makefile.ins for 1.8.22 release.
* Update pkgconfig settings with version - #218 (#223)
* Add notice of final HDFF5 1.8 release.
Add solaris 64bit alignment issue to "Known Problems".
* Update 1.8 final release notice.
* Update CMake/HDF5Examples version in bin/release
* Fixed typo in an error message. (#227)
* Remove duplicate setting (#239)
* RELEASE.txt cleanup.
* Add macOS Big Sur to tested machines, also missing entries for macOS 10.13 and 10.14.
* )Update version.
Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com>
Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com>
Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com>
* Reverts lock/unlock callback signature to 1.8.21 version (#254)
* Reverts lock/unlock callback signature to 1.8.21 version
This callback is unused in 1.8. The ros3 and hdfs VFDs are the only VFDs
that have the lock callback implemented and that is just as no-op stubs.
These stubs were removed so the callbacks are now NULL pointers, like
the other VFDs in 1.8.
* Trivial whitespace fix
* Update version to 1.8.22-14.
* Hdf5 1 8 22 - Reverts lock/unlock callback signature to 1.8.21 version (#267)
* Restores maintainer mode in the autotools (#200)
Maintainer mode should be enabled in development branches.
Also adds helpful commenting.
Add bin/switch_maint_mode
Disable maintainer mode for release.
Fix incomplete merge for stub functions in H5Fdhdfs.c
* Update configure for Restores maintainer mode in the autotools (#200).
* Update MANIFEST for switch_maint_mode script.
* Update so numbers for 1.8.22 release.
* Add so numbers changes in Makefile.ins for 1.8.22 release.
* Update pkgconfig settings with version - #218 (#223)
* Add notice of final HDFF5 1.8 release.
Add solaris 64bit alignment issue to "Known Problems".
* Update 1.8 final release notice.
* Update CMake/HDF5Examples version in bin/release
* Fixed typo in an error message. (#227)
* Remove duplicate setting (#239)
* RELEASE.txt cleanup.
* Add macOS Big Sur to tested machines, also missing entries for macOS 10.13 and 10.14.
* )Update version.
* Reverts lock/unlock callback signature to 1.8.21 version (#254)
* Reverts lock/unlock callback signature to 1.8.21 version
This callback is unused in 1.8. The ros3 and hdfs VFDs are the only VFDs
that have the lock callback implemented and that is just as no-op stubs.
These stubs were removed so the callbacks are now NULL pointers, like
the other VFDs in 1.8.
* Trivial whitespace fix
* Update version to 1.8.22-14.
Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com>
Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com>
Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com>
* Update version in H5public.h
* Hdf5 1 8 22 (#269)
* Restores maintainer mode in the autotools (#200)
Maintainer mode should be enabled in development branches.
Also adds helpful commenting.
Add bin/switch_maint_mode
Disable maintainer mode for release.
Fix incomplete merge for stub functions in H5Fdhdfs.c
* Update configure for Restores maintainer mode in the autotools (#200).
* Update MANIFEST for switch_maint_mode script.
* Update so numbers for 1.8.22 release.
* Add so numbers changes in Makefile.ins for 1.8.22 release.
* Update pkgconfig settings with version - #218 (#223)
* Add notice of final HDFF5 1.8 release.
Add solaris 64bit alignment issue to "Known Problems".
* Update 1.8 final release notice.
* Update CMake/HDF5Examples version in bin/release
* Fixed typo in an error message. (#227)
* Remove duplicate setting (#239)
* RELEASE.txt cleanup.
* Add macOS Big Sur to tested machines, also missing entries for macOS 10.13 and 10.14.
* )Update version.
* Reverts lock/unlock callback signature to 1.8.21 version (#254)
* Reverts lock/unlock callback signature to 1.8.21 version
This callback is unused in 1.8. The ros3 and hdfs VFDs are the only VFDs
that have the lock callback implemented and that is just as no-op stubs.
These stubs were removed so the callbacks are now NULL pointers, like
the other VFDs in 1.8.
* Trivial whitespace fix
* Update version to 1.8.22-14.
* Update version in H5public.h
Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com>
Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com>
Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com>
* Set version 1.8.22 for release.
* dd RELEASE.txt entry for HDFFV-10741.
* Hdf5 1 8 22 (#279)
* Restores maintainer mode in the autotools (#200)
Maintainer mode should be enabled in development branches.
Also adds helpful commenting.
Add bin/switch_maint_mode
Disable maintainer mode for release.
Fix incomplete merge for stub functions in H5Fdhdfs.c
* Update configure for Restores maintainer mode in the autotools (#200).
* Update MANIFEST for switch_maint_mode script.
* Update so numbers for 1.8.22 release.
* Add so numbers changes in Makefile.ins for 1.8.22 release.
* Update pkgconfig settings with version - #218 (#223)
* Add notice of final HDFF5 1.8 release.
Add solaris 64bit alignment issue to "Known Problems".
* Update 1.8 final release notice.
* Update CMake/HDF5Examples version in bin/release
* Fixed typo in an error message. (#227)
* Remove duplicate setting (#239)
* RELEASE.txt cleanup.
* Add macOS Big Sur to tested machines, also missing entries for macOS 10.13 and 10.14.
* )Update version.
* Reverts lock/unlock callback signature to 1.8.21 version (#254)
* Reverts lock/unlock callback signature to 1.8.21 version
This callback is unused in 1.8. The ros3 and hdfs VFDs are the only VFDs
that have the lock callback implemented and that is just as no-op stubs.
These stubs were removed so the callbacks are now NULL pointers, like
the other VFDs in 1.8.
* Trivial whitespace fix
* Update version to 1.8.22-14.
* Update version in H5public.h
* Set version 1.8.22 for release.
* dd RELEASE.txt entry for HDFFV-10741.
Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com>
Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com>
Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com>
* Improve performance of multiple calls to H5Sget_select_elem_pointlist (#270) (#277)
* Cache the pointer to the next point to process after the last call to
H5S__get_select_elem_pointlist. This allows the normal process of
iterating over the points in batches to be much more efficient, as the
library does not need to traverse the entirety of the preceding points
every time the funciton is re-entered.
* Update RELEASE.txt for point selection iteration performance fix.
* Hdf5 1 8 22 (#281)
* Restores maintainer mode in the autotools (#200)
Maintainer mode should be enabled in development branches.
Also adds helpful commenting.
Add bin/switch_maint_mode
Disable maintainer mode for release.
Fix incomplete merge for stub functions in H5Fdhdfs.c
* Update configure for Restores maintainer mode in the autotools (#200).
* Update MANIFEST for switch_maint_mode script.
* Update so numbers for 1.8.22 release.
* Add so numbers changes in Makefile.ins for 1.8.22 release.
* Update pkgconfig settings with version - #218 (#223)
* Add notice of final HDFF5 1.8 release.
Add solaris 64bit alignment issue to "Known Problems".
* Update 1.8 final release notice.
* Update CMake/HDF5Examples version in bin/release
* Fixed typo in an error message. (#227)
* Remove duplicate setting (#239)
* RELEASE.txt cleanup.
* Add macOS Big Sur to tested machines, also missing entries for macOS 10.13 and 10.14.
* )Update version.
* Reverts lock/unlock callback signature to 1.8.21 version (#254)
* Reverts lock/unlock callback signature to 1.8.21 version
This callback is unused in 1.8. The ros3 and hdfs VFDs are the only VFDs
that have the lock callback implemented and that is just as no-op stubs.
These stubs were removed so the callbacks are now NULL pointers, like
the other VFDs in 1.8.
* Trivial whitespace fix
* Update version to 1.8.22-14.
* Update version in H5public.h
* Set version 1.8.22 for release.
* dd RELEASE.txt entry for HDFFV-10741.
* Improve performance of multiple calls to H5Sget_select_elem_pointlist (#270) (#277)
* Cache the pointer to the next point to process after the last call to
H5S__get_select_elem_pointlist. This allows the normal process of
iterating over the points in batches to be much more efficient, as the
library does not need to traverse the entirety of the preceding points
every time the funciton is re-entered.
* Update RELEASE.txt for point selection iteration performance fix.
Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com>
Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com>
Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com>
Co-authored-by: Neil Fortner <nfortne2@hdfgroup.org>
* Hdf5 1 8 22 (#284)
* Fixed typo in an error message.
* Updated for HDFFV-11150, HDFFV-10480, and HDFFV-11159
* Update "Support for New Platforms and Compilers" section in RELEASE.txt;
add check_version workaround for binary compatibility to "Known
Problems".
* Add SUSE Linux to tested platforms.
* Update numbers in config/lt_vers.am and run bin/reconfigure for so
numbers.
* Update version in 3 files missed by merge.
Co-authored-by: Allen Byrne <byrn@hdfgroup.org>
Co-authored-by: Vailin Choi <vchoi@hdfgroup.org>
Co-authored-by: vchoi <vchoi@jelly.ad.hdfgroup.org>
Co-authored-by: hdftest <hdftest@hdfgroup.org>
Co-authored-by: Jordan Henderson <jhenderson@hdfgroup.org>
Co-authored-by: Dana Robinson <derobins@hdfgroup.org>
Co-authored-by: Binh-Minh Ribler <bmribler@hdfgroup.org>
Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com>
Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com>
Co-authored-by: H. Joe Lee <hyoklee@hdfgroup.org>
Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com>
Co-authored-by: Neil Fortner <nfortne2@hdfgroup.org>
Diffstat (limited to 'test/h5test.c')
-rw-r--r-- | test/h5test.c | 1196 |
1 files changed, 808 insertions, 388 deletions
diff --git a/test/h5test.c b/test/h5test.c index faeca34..3e7d276 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -6,20 +6,20 @@ * 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://support.hdfgroup.org/ftp/HDF5/releases. * + * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke <matzke@llnl.gov> + * Programmer: Robb Matzke * Thursday, November 19, 1998 * * Purpose: Provides support functions for most of the hdf5 tests cases. * */ -#undef NDEBUG /*override -DNDEBUG */ +#undef NDEBUG /*override -DNDEBUG */ #include "h5test.h" #include "H5srcdir.h" @@ -31,7 +31,7 @@ #ifdef H5_HAVE_WIN32_API #include <process.h> -#endif /* H5_HAVE_WIN32_API */ +#endif /* H5_HAVE_WIN32_API */ /* * Define these environment variables or constants to influence functions in @@ -42,7 +42,10 @@ * use for HDF5 file access. The first word in the * value is the name of the driver and subsequent data * is interpreted according to the driver. See - * h5_fileaccess() for details. + * h5_get_vfd_fapl() for details. + * + * HDF5_LIBVER_BOUNDS: This string describes what library version bounds to + * use for HDF5 file access. See h5_get_libver_fapl() for details. * * HDF5_PREFIX: A string to add to the beginning of all serial test * file names. This can be used to run tests in a @@ -67,12 +70,12 @@ #ifndef HDF5_PARAPREFIX #define HDF5_PARAPREFIX "" #endif -char *paraprefix = NULL; /* for command line option para-prefix */ +char *paraprefix = NULL; /* for command line option para-prefix */ #ifdef H5_HAVE_PARALLEL -MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */ +MPI_Info h5_io_info_g = MPI_INFO_NULL; /* MPI INFO object for IO */ #endif -#define READ_BUF_SIZE 65536 +#define READ_BUF_SIZE 65536 /* * These are the letters that are appended to the file name when generating @@ -89,16 +92,27 @@ MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */ static const char *multi_letters = "msbrglo"; /* Length of multi-file VFD filename buffers */ -#define H5TEST_MULTI_FILENAME_LEN 1024 +#define H5TEST_MULTI_FILENAME_LEN 1024 + +/* Temporary file for sending signal messages */ +#define TMP_SIGNAL_FILE "tmp_signal_file" + +/* The # of seconds to wait for the message file--used by h5_wait_message() */ +#define MESSAGE_TIMEOUT 300 /* Timeout in seconds */ + +/* The strings that correspond to library version bounds H5F_libver_t in H5Fpublic.h */ +/* This is used by h5_get_version_string() */ +const char *LIBVER_NAMES[] = {"earliest", /* H5F_LIBVER_EARLIEST = 0 */ + "latest", /* H5F_LIBVER_V18 = 1 */ + NULL}; /* Previous error reporting function */ static H5E_auto2_t err_func = NULL; static herr_t h5_errors(hid_t estack, void *client_data); -static char * h5_fixname_real(const char *base_name, hid_t fapl, const char *suffix, - char *fullname, size_t size); +static char * h5_fixname_real(const char *base_name, hid_t fapl, const char *suffix, char *fullname, + size_t size, hbool_t nest_printf); - /*------------------------------------------------------------------------- * Function: h5_errors * @@ -123,7 +137,6 @@ h5_errors(hid_t estack, void H5_ATTR_UNUSED *client_data) return 0; } - /*------------------------------------------------------------------------- * Function: h5_clean_files * @@ -142,48 +155,9 @@ h5_clean_files(const char *base_name[], hid_t fapl) { int i; - for(i = 0; base_name[i]; i++) { - char filename[1024]; - char temp[2048]; - hid_t driver; - - if(NULL == h5_fixname(base_name[i], fapl, filename, sizeof(filename))) - continue; - - driver = H5Pget_driver(fapl); - - if(driver == H5FD_FAMILY) { - int j; - - for(j = 0; /*void*/; j++) { - HDsnprintf(temp, sizeof temp, filename, j); - - if(HDaccess(temp, F_OK) < 0) - break; - - HDremove(temp); - } /* end for */ - } else if(driver == H5FD_CORE) { - hbool_t backing; /* Whether the core file has backing store */ - - H5Pget_fapl_core(fapl, NULL, &backing); - - /* If the file was stored to disk with bacing store, remove it */ - if(backing) - HDremove(filename); - } else if (driver == H5FD_MULTI) { - H5FD_mem_t mt; - - HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES); - - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) { - HDsnprintf(temp, sizeof temp, "%s-%c.h5", filename, multi_letters[mt]); - HDremove(temp); /*don't care if it fails*/ - } /* end for */ - } else { - HDremove(filename); - } - } /* end for */ + for (i = 0; base_name[i]; i++) { + h5_delete_test_file(base_name[i], fapl); + } /* Close the FAPL used to access the file */ H5Pclose(fapl); @@ -191,7 +165,6 @@ h5_clean_files(const char *base_name[], hid_t fapl) return; } /* end h5_clean_files() */ - /*------------------------------------------------------------------------- * Function: h5_delete_test_file * @@ -209,57 +182,67 @@ h5_clean_files(const char *base_name[], hid_t fapl) * *------------------------------------------------------------------------- */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the snprintf() calls with + * sub_filename in the code below, but early (4.4.7, at least) gcc only + * allows diagnostic pragmas to be toggled outside of functions. + */ +H5_GCC_DIAG_OFF("format-nonliteral") void h5_delete_test_file(const char *base_name, hid_t fapl) { - char filename[1024]; /* VFD-dependent filename to delete */ - char sub_filename[2048]; /* sub-files in multi & family VFDs */ - hid_t driver = -1; /* VFD ID */ + char filename[1024]; /* VFD-dependent filename to delete */ + char sub_filename[2048]; /* sub-files in multi & family VFDs */ + hid_t driver = -1; /* VFD ID */ /* Get the VFD-dependent filename */ - if(NULL == h5_fixname(base_name, fapl, filename, sizeof(filename))) + if (NULL == h5_fixname(base_name, fapl, filename, sizeof(filename))) return; driver = H5Pget_driver(fapl); - if(driver == H5FD_FAMILY) { + if (driver == H5FD_FAMILY) { int j; - for(j = 0; /*void*/; j++) { + for (j = 0; /*void*/; j++) { HDsnprintf(sub_filename, sizeof(sub_filename), filename, j); /* If we can't access the file, it probably doesn't exist * and we are done deleting the sub-files. */ - if(HDaccess(sub_filename, F_OK) < 0) + if (HDaccess(sub_filename, F_OK) < 0) break; HDremove(sub_filename); } /* end for */ - } else if(driver == H5FD_CORE) { - hbool_t backing; /* Whether the core file has backing store */ + } + else if (driver == H5FD_CORE) { + hbool_t backing; /* Whether the core file has backing store */ H5Pget_fapl_core(fapl, NULL, &backing); /* If the file was stored to disk with bacing store, remove it */ - if(backing) + if (backing) HDremove(filename); - } else if (driver == H5FD_MULTI) { + } + else if (driver == H5FD_MULTI) { H5FD_mem_t mt; HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) { + for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { HDsnprintf(sub_filename, sizeof(sub_filename), "%s-%c.h5", filename, multi_letters[mt]); HDremove(sub_filename); - } /* end for */ - } else { + } + } + else { HDremove(filename); - } /* end if */ + } /* end driver selection tree */ return; } /* end h5_delete_test_file() */ +H5_GCC_DIAG_ON("format-nonliteral") - /*------------------------------------------------------------------------- * Function: h5_delete_all_test_files * @@ -283,16 +266,15 @@ h5_delete_test_file(const char *base_name, hid_t fapl) void h5_delete_all_test_files(const char *base_name[], hid_t fapl) { - int i; /* iterator */ + int i; /* iterator */ - for(i = 0; base_name[i]; i++) { + for (i = 0; base_name[i]; i++) { h5_delete_test_file(base_name[i], fapl); } /* end for */ return; } /* end h5_delete_all_test_files() */ - /*------------------------------------------------------------------------- * Function: h5_cleanup * @@ -310,9 +292,9 @@ h5_delete_all_test_files(const char *base_name[], hid_t fapl) int h5_cleanup(const char *base_name[], hid_t fapl) { - int retval = 0; + int retval = 0; - if(GetTestCleanup()) { + if (GetTestCleanup()) { /* Clean up files in base_name, and the FAPL */ h5_clean_files(base_name, fapl); @@ -325,7 +307,34 @@ h5_cleanup(const char *base_name[], hid_t fapl) return retval; } /* end h5_cleanup() */ - +/*------------------------------------------------------------------------- + * Function: h5_test_shutdown + * + * Purpose: Performs any special test cleanup required before the test + * ends. + * + * NOTE: This function should normally only be called once + * in a given test, usually just before leaving main(). It + * is intended for use in the single-file unit tests, not + * testhdf5. + * + * Return: void + * + * Programmer: Dana Robinson + * February 2016 + * + *------------------------------------------------------------------------- + */ +void +h5_test_shutdown(void) +{ + + /* Restore the original error reporting routine */ + h5_restore_err(); + + return; +} /* end h5_test_shutdown() */ + /*------------------------------------------------------------------------- * Function: h5_restore_err * @@ -347,7 +356,6 @@ h5_restore_err(void) err_func = NULL; } - /*------------------------------------------------------------------------- * Function: h5_reset * @@ -382,27 +390,59 @@ h5_reset(void) * appropriate configure flags/macros. QAK - 2007/12/20 */ #ifdef OLD_WAY -{ - char filename[1024]; + { + char filename[1024]; - /* - * Cause the library to emit some diagnostics early so they don't - * interfere with other formatted output. - */ - sprintf(filename, "/tmp/h5emit-%05d.h5", HDgetpid()); - H5E_BEGIN_TRY { - hid_t file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, - H5P_DEFAULT); - hid_t grp = H5Gcreate2(file, "emit", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Gclose(grp); - H5Fclose(file); - HDunlink(filename); - } H5E_END_TRY; -} + /* + * Cause the library to emit some diagnostics early so they don't + * interfere with other formatted output. + */ + HDsprintf(filename, "/tmp/h5emit-%05d.h5", HDgetpid()); + H5E_BEGIN_TRY + { + hid_t file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + hid_t grp = H5Gcreate2(file, "emit", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Gclose(grp); + H5Fclose(file); + HDunlink(filename); + } + H5E_END_TRY; + } #endif /* OLD_WAY */ } - +/*------------------------------------------------------------------------- + * Function: h5_test_init + * + * Purpose: Performs any special actions before the test begins. + * + * NOTE: This function should normally only be called once + * in a given test, usually at the beginning of main(). It + * is intended for use in the single-file unit tests, not + * testhdf5. + * + * Return: void + * + * Programmer: Dana Robinson + * February 2016 + * + *------------------------------------------------------------------------- + */ +void +h5_test_init(void) +{ + HDfflush(stdout); + HDfflush(stderr); + H5close(); + + /* Save current error stack reporting routine and redirect to our local one */ + HDassert(err_func == NULL); + H5Eget_auto2(H5E_DEFAULT, &err_func, NULL); + H5Eset_auto2(H5E_DEFAULT, h5_errors, NULL); + + return; +} /* end h5_test_init() */ + /*------------------------------------------------------------------------- * Function: h5_fixname * @@ -428,10 +468,9 @@ h5_reset(void) char * h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size) { - return (h5_fixname_real(base_name, fapl, ".h5", fullname, size)); + return (h5_fixname_real(base_name, fapl, ".h5", fullname, size, FALSE)); } - /*------------------------------------------------------------------------- * Function: h5_fixname_no_suffix * @@ -448,10 +487,34 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size) char * h5_fixname_no_suffix(const char *base_name, hid_t fapl, char *fullname, size_t size) { - return (h5_fixname_real(base_name, fapl, NULL, fullname, size)); + return (h5_fixname_real(base_name, fapl, NULL, fullname, size, FALSE)); +} + +/*------------------------------------------------------------------------- + * Function: h5_fixname_printf + * + * Purpose: Same as h5_fixname but returns a filename that can be passed + * through a printf-style function once before being passed to the file + * driver. Basically, replaces all % characters used by the file + * driver with %%. + * + * Return: Success: The FULLNAME pointer. + * + * Failure: NULL if BASENAME or FULLNAME is the null + * pointer or if FULLNAME isn't large enough for + * the result. + * + * Programmer: Neil Fortner + * Wednesday, July 15, 2015 + * + *------------------------------------------------------------------------- + */ +char * +h5_fixname_printf(const char *base_name, hid_t fapl, char *fullname, size_t size) +{ + return (h5_fixname_real(base_name, fapl, ".h5", fullname, size, TRUE)); } - /*------------------------------------------------------------------------- * Function: h5_fixname_real * @@ -475,15 +538,16 @@ h5_fixname_no_suffix(const char *base_name, hid_t fapl, char *fullname, size_t s *------------------------------------------------------------------------- */ static char * -h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, - char *fullname, size_t size) +h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fullname, size_t size, + hbool_t nest_printf) { - const char *prefix = NULL; - char *ptr, last = '\0'; - const char *suffix = _suffix; - size_t i, j; - hid_t driver = -1; - int isppdriver = 0; /* if the driver is MPI parallel */ + const char *prefix = NULL; + const char *env = NULL; /* HDF5_DRIVER environment variable */ + char * ptr, last = '\0'; + const char *suffix = _suffix; + size_t i, j; + hid_t driver = -1; + int isppdriver = 0; /* if the driver is MPI parallel */ if (!base_name || !fullname || size < 1) return NULL; @@ -491,34 +555,55 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, HDmemset(fullname, 0, size); /* figure out the suffix */ - if(H5P_DEFAULT != fapl) { - if((driver = H5Pget_driver(fapl)) < 0) + if (H5P_DEFAULT != fapl) { + if ((driver = H5Pget_driver(fapl)) < 0) return NULL; - if(suffix) { - if(H5FD_FAMILY == driver) - suffix = "%05d.h5"; - else if (H5FD_MULTI == driver) - suffix = NULL; + if (suffix) { + if (H5FD_FAMILY == driver) { + suffix = nest_printf ? "%%05d.h5" : "%05d.h5"; + } + else if (H5FD_MULTI == driver) { + + /* Get the environment variable, if it exists, in case + * we are using the split driver since both of those + * use the multi VFD under the hood. + */ + env = HDgetenv("HDF5_DRIVER"); +#ifdef HDF5_DRIVER + /* Use the environment variable, then the compile-time constant */ + if (!env) + env = HDF5_DRIVER; +#endif + if (env && !HDstrcmp(env, "split")) { + /* split VFD */ + suffix = NULL; + } + else { + /* multi VFD */ + suffix = NULL; + } + } } } /* Must first check fapl is not H5P_DEFAULT (-1) because H5FD_XXX * could be of value -1 if it is not defined. */ - isppdriver = H5P_DEFAULT != fapl && (H5FD_MPIO==driver); + isppdriver = H5P_DEFAULT != fapl && (H5FD_MPIO == driver); /* Check HDF5_NOCLEANUP environment setting. * (The #ifdef is needed to prevent compile failure in case MPI is not * configured.) */ - if(isppdriver) { + if (isppdriver) { #ifdef H5_HAVE_PARALLEL - if(getenv_all(MPI_COMM_WORLD, 0, "HDF5_NOCLEANUP")) + if (getenv_all(MPI_COMM_WORLD, 0, "HDF5_NOCLEANUP")) SetTestNoCleanup(); -#endif /* H5_HAVE_PARALLEL */ - } else { - if(HDgetenv("HDF5_NOCLEANUP")) +#endif /* H5_HAVE_PARALLEL */ + } + else { + if (HDgetenv("HDF5_NOCLEANUP")) SetTestNoCleanup(); } @@ -528,7 +613,7 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, * (The #ifdef is needed to prevent compile failure in case MPI is not * configured.) */ - if(isppdriver) { + if (isppdriver) { #ifdef H5_HAVE_PARALLEL /* * For parallel: @@ -546,21 +631,22 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); if (mpi_rank == 0) - printf("*** Hint ***\n" - "You can use environment variable HDF5_PARAPREFIX to " - "run parallel test files in a\n" - "different directory or to add file type prefix. E.g.,\n" - " HDF5_PARAPREFIX=pfs:/PFS/user/me\n" - " export HDF5_PARAPREFIX\n" - "*** End of Hint ***\n"); + HDprintf("*** Hint ***\n" + "You can use environment variable HDF5_PARAPREFIX to " + "run parallel test files in a\n" + "different directory or to add file type prefix. e.g.,\n" + " HDF5_PARAPREFIX=pfs:/PFS/user/me\n" + " export HDF5_PARAPREFIX\n" + "*** End of Hint ***\n"); explained = TRUE; #ifdef HDF5_PARAPREFIX prefix = HDF5_PARAPREFIX; -#endif /* HDF5_PARAPREFIX */ +#endif /* HDF5_PARAPREFIX */ } -#endif /* H5_HAVE_PARALLEL */ - } else { +#endif /* H5_HAVE_PARALLEL */ + } + else { /* * For serial: * First use the environment variable, then try the constant @@ -570,7 +656,7 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, #ifdef HDF5_PREFIX if (!prefix) prefix = HDF5_PREFIX; -#endif /* HDF5_PREFIX */ +#endif /* HDF5_PREFIX */ } /* Prepend the prefix value to the base name */ @@ -587,8 +673,8 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, */ char *user, *login; - user = HDgetenv("USER"); - login = HDgetenv("LOGIN"); + user = HDgetenv("USER"); + login = HDgetenv("LOGIN"); subdir = (user ? user : login); if (subdir) { @@ -605,7 +691,7 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, if (!fullname[0]) { /* We didn't append the prefix yet */ HDstrncpy(fullname, prefix, size); - fullname[size -1] = '\0'; + fullname[size - 1] = '\0'; } if (HDstrlen(fullname) + HDstrlen(base_name) + 1 < size) { @@ -627,19 +713,23 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, HDstrcat(fullname, "/"); HDstrcat(fullname, base_name); - } else { + } + else { /* Buffer is too small */ return NULL; } - } else { + } + else { if (HDsnprintf(fullname, size, "%s/%s", prefix, base_name) == (int)size) /* Buffer is too small */ return NULL; } - } else if (HDstrlen(base_name) >= size) { + } + else if (HDstrlen(base_name) >= size) { /* Buffer is too small */ return NULL; - } else { + } + else { HDstrcpy(fullname, base_name); } @@ -662,7 +752,6 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, return fullname; } - /*------------------------------------------------------------------------- * Function: h5_rmprefix * @@ -690,19 +779,18 @@ h5_rmprefix(const char *filename) else ret_ptr++; - return(ret_ptr); + return (ret_ptr); } - /*------------------------------------------------------------------------- * Function: h5_fileaccess * * Purpose: Returns a file access template which is the default template - * but with a file driver set according to the constant or - * environment variable HDF5_DRIVER + * but with a file driver set + * according to a constant or environment variable HDF5_DRIVER * - * Return: Success: A file access property list - * Failure: -1 + * Return: Success: A file access property list + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Thursday, November 19, 1998 @@ -712,127 +800,202 @@ h5_rmprefix(const char *filename) hid_t h5_fileaccess(void) { - const char *val = NULL; - const char *name; - char s[1024]; - hid_t fapl = -1; + hid_t fapl_id = H5I_INVALID_HID; + + if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) + goto error; + + /* Attempt to set up a file driver first */ + if (h5_get_vfd_fapl(fapl_id) < 0) + goto error; + + return fapl_id; + +error: + if (fapl_id != H5I_INVALID_HID) + H5Pclose(fapl_id); + return H5I_INVALID_HID; +} /* end h5_fileaccess() */ + +/*------------------------------------------------------------------------- + * Function: h5_fileaccess_flags + * + * Purpose: Returns a file access template which is the default template + * but with a file driver, VOL connector, or libver bound set + * according to a constant or environment variable + * + * Return: Success: A file access property list + * Failure: H5I_INVALID_HID + * + * Programmer: Robb Matzke + * Thursday, November 19, 1998 + * + *------------------------------------------------------------------------- + */ +hid_t +h5_fileaccess_flags(unsigned flags) +{ + hid_t fapl_id = H5I_INVALID_HID; + + if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) + goto error; + + /* Attempt to set up a file driver first */ + if ((flags & H5_FILEACCESS_VFD) && h5_get_vfd_fapl(fapl_id) < 0) + goto error; + + return fapl_id; + +error: + if (fapl_id != H5I_INVALID_HID) + H5Pclose(fapl_id); + return H5I_INVALID_HID; +} /* end h5_fileaccess_flags() */ + +/*------------------------------------------------------------------------- + * Function: h5_get_vfd_fapl + * + * Purpose: Sets the file driver for a FAPL according to the value specified + * in the constant or environment variable "HDF5_DRIVER". + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Dana Robinson + * February 2016 + * + *------------------------------------------------------------------------- + */ +herr_t +h5_get_vfd_fapl(hid_t fapl) +{ + const char *env = NULL; /* HDF5_DRIVER environment variable */ + const char *tok = NULL; /* strtok pointer */ + char * lasts = NULL; /* Context pointer for strtok_r() call */ + char buf[1024]; /* buffer for tokenizing HDF5_DRIVER */ - /* First use the environment variable, then the constant */ - val = HDgetenv("HDF5_DRIVER"); + /* Get the environment variable, if it exists */ + env = HDgetenv("HDF5_DRIVER"); #ifdef HDF5_DRIVER - if(!val) - val = HDF5_DRIVER; + /* Use the environment variable, then the compile-time constant */ + if (!env) + env = HDF5_DRIVER; #endif - if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - return -1; - if(!val || !*val) - return fapl; /* use default */ + /* If the environment variable was not set, just return + * without modifying the FAPL. + */ + if (!env || !*env) + goto done; - HDstrncpy(s, val, sizeof s); - s[sizeof(s)-1] = '\0'; - if(NULL == (name = HDstrtok(s, " \t\n\r"))) - return fapl; + /* Get the first 'word' of the environment variable. + * If it's nothing (environment variable was whitespace) + * just return the default fapl. + */ + HDstrncpy(buf, env, sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; + if (NULL == (tok = HDstrtok_r(buf, " \t\n\r", &lasts))) + goto done; - if(!HDstrcmp(name, "sec2")) { - /* Unix read() and write() system calls */ + if (!HDstrcmp(tok, "sec2")) { + /* POSIX (section 2) read() and write() system calls */ if (H5Pset_fapl_sec2(fapl) < 0) - return -1; + goto error; } - else if(!HDstrcmp(name, "stdio")) { + else if (!HDstrcmp(tok, "stdio")) { /* Standard C fread() and fwrite() system calls */ if (H5Pset_fapl_stdio(fapl) < 0) - return -1; + goto error; } - else if(!HDstrcmp(name, "core")) { + else if (!HDstrcmp(tok, "core")) { /* In-memory driver settings (backing store on, 1 MB increment) */ - if(H5Pset_fapl_core(fapl, (size_t)1, TRUE) < 0) - return -1; + if (H5Pset_fapl_core(fapl, (size_t)H5_MB, TRUE) < 0) + goto error; } - else if(!HDstrcmp(name, "core_paged")) { + else if (!HDstrcmp(tok, "core_paged")) { /* In-memory driver with write tracking and paging on */ - if(H5Pset_fapl_core(fapl, (size_t)1, TRUE) < 0) - return -1; - if(H5Pset_core_write_tracking(fapl, TRUE, (size_t)4096) < 0) - return -1; + if (H5Pset_fapl_core(fapl, (size_t)H5_MB, TRUE) < 0) + goto error; + if (H5Pset_core_write_tracking(fapl, TRUE, (size_t)4096) < 0) + goto error; } - else if(!HDstrcmp(name, "split")) { + else if (!HDstrcmp(tok, "split")) { /* Split meta data and raw data each using default driver */ - if(H5Pset_fapl_split(fapl, - "-m.h5", H5P_DEFAULT, - "-r.h5", H5P_DEFAULT) < 0) - return -1; + if (H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT) < 0) + goto error; } - else if(!HDstrcmp(name, "multi")) { + else if (!HDstrcmp(tok, "multi")) { /* Multi-file driver, general case of the split driver */ - H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; - hid_t memb_fapl[H5FD_MEM_NTYPES]; + H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; + hid_t memb_fapl[H5FD_MEM_NTYPES]; const char *memb_name[H5FD_MEM_NTYPES]; - char *sv[H5FD_MEM_NTYPES]; - haddr_t memb_addr[H5FD_MEM_NTYPES]; + char * sv[H5FD_MEM_NTYPES]; + haddr_t memb_addr[H5FD_MEM_NTYPES]; H5FD_mem_t mt; - HDmemset(memb_map, 0, sizeof memb_map); - HDmemset(memb_fapl, 0, sizeof memb_fapl); - HDmemset(memb_name, 0, sizeof memb_name); - HDmemset(memb_addr, 0, sizeof memb_addr); + HDmemset(memb_map, 0, sizeof(memb_map)); + HDmemset(memb_fapl, 0, sizeof(memb_fapl)); + HDmemset(memb_name, 0, sizeof(memb_name)); + HDmemset(memb_addr, 0, sizeof(memb_addr)); - HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES); - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { + HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); + for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { memb_fapl[mt] = H5P_DEFAULT; - if(NULL == (sv[mt] = (char *)HDmalloc(H5TEST_MULTI_FILENAME_LEN))) - return -1; + sv[mt] = (char *)HDmalloc(H5TEST_MULTI_FILENAME_LEN); + HDassert(sv[mt]); HDsprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); memb_name[mt] = sv[mt]; memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10); } /* end for */ - if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0) - return -1; + if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0) + goto error; - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) + for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) HDfree(sv[mt]); } - else if(!HDstrcmp(name, "family")) { - hsize_t fam_size = 100*1024*1024; /*100 MB*/ - + else if (!HDstrcmp(tok, "family")) { /* Family of files, each 1MB and using the default driver */ - if((val = HDstrtok(NULL, " \t\n\r"))) - fam_size = (hsize_t)(HDstrtod(val, NULL) * 1024*1024); - if(H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0) - return -1; + hsize_t fam_size = 100 * 1024 * 1024; /* 100 MB */ + + /* Was a family size specified in the environment variable? */ + if ((tok = HDstrtok_r(NULL, " \t\n\r", &lasts))) + fam_size = (hsize_t)(HDstrtod(tok, NULL) * 1024 * 1024); + if (H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT) < 0) + goto error; } - else if(!HDstrcmp(name, "log")) { + else if (!HDstrcmp(tok, "log")) { + /* Log file access */ unsigned log_flags = H5FD_LOG_LOC_IO | H5FD_LOG_ALLOC; - /* Log file access */ - if((val = HDstrtok(NULL, " \t\n\r"))) - log_flags = (unsigned)HDstrtol(val, NULL, 0); - if(H5Pset_fapl_log(fapl, NULL, log_flags, (size_t)0) < 0) - return -1; - } - else if(!HDstrcmp(name, "direct")) { + /* Were special log file flags specified in the environment variable? */ + if ((tok = HDstrtok_r(NULL, " \t\n\r", &lasts))) + log_flags = (unsigned)HDstrtol(tok, NULL, 0); + + if (H5Pset_fapl_log(fapl, NULL, log_flags, (size_t)0) < 0) + goto error; #ifdef H5_HAVE_DIRECT - /* Linux direct read() and write() system calls. Set memory boundary, file block size, - * and copy buffer size to the default values. */ - if(H5Pset_fapl_direct(fapl, 1024, 4096, 8 * 4096) < 0) - return -1; -#endif } - else if(!HDstrcmp(name, "latest")) { - /* use the latest format */ - if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - return -1; + else if (!HDstrcmp(tok, "direct")) { + /* Linux direct read() and write() system calls. Set memory boundary, + * file block size, and copy buffer size to the default values. + */ + if (H5Pset_fapl_direct(fapl, 1024, 4096, 8 * 4096) < 0) + goto error; +#endif } else { /* Unknown driver */ - return -1; - } + goto error; + } /* end if */ - return fapl; -} +done: + return 0; + +error: + return -1; +} /* end h5_get_vfd_fapl() */ - /*------------------------------------------------------------------------- * Function: h5_no_hwconv * @@ -853,7 +1016,6 @@ h5_no_hwconv(void) H5Tunregister(H5T_PERS_HARD, NULL, (hid_t)-1, (hid_t)-1, NULL); } - /*------------------------------------------------------------------------- * Function: h5_show_hostname * @@ -871,10 +1033,10 @@ h5_no_hwconv(void) void h5_show_hostname(void) { - char hostname[80]; + char hostname[80]; #ifdef H5_HAVE_WIN32_API WSADATA wsaData; - int err; + int err; #endif /* try show the process or thread id in multiple processes cases*/ @@ -885,22 +1047,22 @@ h5_show_hostname(void) MPI_Initialized(&mpi_initialized); MPI_Finalized(&mpi_finalized); - if(mpi_initialized && !mpi_finalized) { - MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); - printf("MPI-process %d.", mpi_rank); + if (mpi_initialized && !mpi_finalized) { + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + HDprintf("MPI-process %d.", mpi_rank); } else - printf("thread 0."); + HDprintf("thread 0."); } #elif defined(H5_HAVE_THREADSAFE) - printf("thread %lu.", HDpthread_self_ulong()); + HDprintf("thread %lu.", HDpthread_self_ulong()); #else - printf("thread 0."); + HDprintf("thread 0."); #endif #ifdef H5_HAVE_WIN32_API - err = WSAStartup( MAKEWORD(2,2), &wsaData ); - if ( err != 0 ) { + err = WSAStartup(MAKEWORD(2, 2), &wsaData); + if (err != 0) { /* could not find a usable WinSock DLL */ return; } @@ -911,28 +1073,26 @@ h5_show_hostname(void) /* 2.2 in wVersion since that is the version we */ /* requested. */ - if ( LOBYTE( wsaData.wVersion ) != 2 || - HIBYTE( wsaData.wVersion ) != 2 ) { + if (LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 2) { /* could not find a usable WinSock DLL */ - WSACleanup( ); + WSACleanup(); return; } #endif #ifdef H5_HAVE_GETHOSTNAME - if (gethostname(hostname, (size_t)80) < 0) - printf(" gethostname failed\n"); + if (HDgethostname(hostname, (size_t)80) < 0) + HDprintf(" gethostname failed\n"); else - printf(" hostname=%s\n", hostname); + HDprintf(" hostname=%s\n", hostname); #else - printf(" gethostname not supported\n"); + HDprintf(" gethostname not supported\n"); #endif #ifdef H5_HAVE_WIN32_API WSACleanup(); #endif } - #ifdef H5_HAVE_PARALLEL /* * Function: h5_set_info_object @@ -950,16 +1110,17 @@ h5_show_hostname(void) int h5_set_info_object(void) { - char *envp; /* environment pointer */ - int ret_value=0; + char *envp; /* environment pointer */ + int ret_value = 0; /* handle any MPI INFO hints via $HDF5_MPI_INFO */ - if ((envp = getenv("HDF5_MPI_INFO")) != NULL){ + if ((envp = HDgetenv("HDF5_MPI_INFO")) != NULL) { char *next, *valp; valp = envp = next = HDstrdup(envp); - if (!valp) return 0; + if (!valp) + return 0; /* create an INFO object if not created yet */ if (h5_io_info_g == MPI_INFO_NULL) @@ -967,14 +1128,14 @@ h5_set_info_object(void) do { size_t len; - char *key_val, *endp, *namep; + char * key_val, *endp, *namep; if (*valp == ';') valp++; /* copy key/value pair into temporary buffer */ - len = strcspn(valp, ";"); - next = &valp[len]; + len = strcspn(valp, ";"); + next = &valp[len]; key_val = (char *)HDcalloc(1, len + 1); /* increment the next pointer past the terminating semicolon */ @@ -987,7 +1148,8 @@ h5_set_info_object(void) while (*namep && (*namep == ' ' || *namep == '\t')) namep++; - if (!*namep) continue; /* was all white space, so move to next k/v pair */ + if (!*namep) + continue; /* was all white space, so move to next k/v pair */ /* eat up any ending white spaces */ endp = &namep[HDstrlen(namep) - 1]; @@ -998,7 +1160,7 @@ h5_set_info_object(void) /* find the '=' */ valp = HDstrchr(namep, '='); - if (valp != NULL) { /* it's a valid key/value pairing */ + if (valp != NULL) { /* it's a valid key/value pairing */ char *tmp_val = valp + 1; /* change '=' to \0, move valp down one */ @@ -1016,7 +1178,7 @@ h5_set_info_object(void) /* actually set the darned thing */ if (MPI_SUCCESS != MPI_Info_set(h5_io_info_g, namep, valp)) { - printf("MPI_Info_set failed\n"); + HDprintf("MPI_Info_set failed\n"); ret_value = -1; } } @@ -1031,7 +1193,6 @@ h5_set_info_object(void) return ret_value; } - /* * Function: h5_dump_info_object * Purpose: Display content of an MPI Info object @@ -1042,30 +1203,27 @@ h5_set_info_object(void) void h5_dump_info_object(MPI_Info info) { - char key[MPI_MAX_INFO_KEY+1]; - char value[MPI_MAX_INFO_VAL+1]; - int flag; - int i, nkeys; - - printf("Dumping MPI Info Object(%d) (up to %d bytes per item):\n", (int)info, - MPI_MAX_INFO_VAL); - if (info==MPI_INFO_NULL){ - printf("object is MPI_INFO_NULL\n"); + char key[MPI_MAX_INFO_KEY + 1]; + char value[MPI_MAX_INFO_VAL + 1]; + int flag; + int i, nkeys; + + HDprintf("Dumping MPI Info Object (up to %d bytes per item):\n", MPI_MAX_INFO_VAL); + if (info == MPI_INFO_NULL) { + HDprintf("object is MPI_INFO_NULL\n"); } else { - MPI_Info_get_nkeys(info, &nkeys); - printf("object has %d items\n", nkeys); - for (i=0; i<nkeys; i++){ - MPI_Info_get_nthkey(info, i, key); - MPI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag); - printf("%s=%s\n", key, value); - } - + MPI_Info_get_nkeys(info, &nkeys); + HDprintf("object has %d items\n", nkeys); + for (i = 0; i < nkeys; i++) { + MPI_Info_get_nthkey(info, i, key); + MPI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag); + HDprintf("%s=%s\n", key, value); + } } } -#endif /* H5_HAVE_PARALLEL */ +#endif /* H5_HAVE_PARALLEL */ - /*------------------------------------------------------------------------- * Function: h5_get_file_size * @@ -1079,107 +1237,118 @@ h5_dump_info_object(MPI_Info info) * *------------------------------------------------------------------------- */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the snprintf() calls with + * temp in the code below, but early (4.4.7, at least) gcc only + * allows diagnostic pragmas to be toggled outside of functions. + */ +H5_GCC_DIAG_OFF("format-nonliteral") h5_stat_size_t h5_get_file_size(const char *filename, hid_t fapl) { - char temp[2048]; /* Temporary buffer for file names */ - h5_stat_t sb; /* Structure for querying file info */ - int j = 0; + char temp[2048]; /* Temporary buffer for file names */ + h5_stat_t sb; /* Structure for querying file info */ + int j = 0; - if(fapl == H5P_DEFAULT) { + if (fapl == H5P_DEFAULT) { /* Get the file's statistics */ - if(0 == HDstat(filename, &sb)) - return((h5_stat_size_t)sb.st_size); + if (0 == HDstat(filename, &sb)) + return ((h5_stat_size_t)sb.st_size); } /* end if */ else { - hid_t driver; /* VFD used for file */ + hid_t driver; /* VFD used for file */ /* Get the driver used when creating the file */ - if((driver = H5Pget_driver(fapl)) < 0) - return(-1); + if ((driver = H5Pget_driver(fapl)) < 0) + return (-1); /* Check for simple cases */ - if(driver == H5FD_SEC2 || driver == H5FD_STDIO || driver == H5FD_CORE || + if (driver == H5FD_SEC2 || driver == H5FD_STDIO || driver == H5FD_CORE || #ifdef H5_HAVE_WINDOWS - driver == H5FD_WINDOWS || + driver == H5FD_WINDOWS || #endif /* H5_HAVE_WINDOWS */ #ifdef H5_HAVE_DIRECT - driver == H5FD_DIRECT || + driver == H5FD_DIRECT || #endif /* H5_HAVE_DIRECT */ - driver == H5FD_LOG) { + driver == H5FD_LOG) { /* Get the file's statistics */ - if(0 == HDstat(filename, &sb)) - return((h5_stat_size_t)sb.st_size); + if (0 == HDstat(filename, &sb)) + return ((h5_stat_size_t)sb.st_size); } /* end if */ - else if(driver == H5FD_MULTI) { - H5FD_mem_t mt; + else if (driver == H5FD_MULTI) { + H5FD_mem_t mt; h5_stat_size_t tot_size = 0; HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { + for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { /* Create the filename to query */ HDsnprintf(temp, sizeof temp, "%s-%c.h5", filename, multi_letters[mt]); /* Check for existence of file */ - if(0 == HDaccess(temp, F_OK)) { + if (0 == HDaccess(temp, F_OK)) { /* Get the file's statistics */ - if(0 != HDstat(temp, &sb)) - return(-1); + if (0 != HDstat(temp, &sb)) + return (-1); /* Add to total size */ tot_size += (h5_stat_size_t)sb.st_size; } /* end if */ - } /* end for */ + } /* end for */ /* Return total size */ - return(tot_size); + return (tot_size); } /* end if */ #ifdef H5_HAVE_PARALLEL - else if(driver == H5FD_MPIO) { - MPI_File fh; /* MPI file handle used to open the file and verify its size */ - int mpi_ret; + else if (driver == H5FD_MPIO) { + MPI_File fh; /* MPI file handle used to open the file and verify its size */ + int mpi_ret; MPI_Offset file_size; mpi_ret = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, MPI_INFO_NULL, &fh); - if (mpi_ret != MPI_SUCCESS) return -1; + if (mpi_ret != MPI_SUCCESS) + return -1; mpi_ret = MPI_File_get_size(fh, &file_size); - if (mpi_ret != MPI_SUCCESS) return -1; + if (mpi_ret != MPI_SUCCESS) + return -1; mpi_ret = MPI_File_close(&fh); - if (mpi_ret != MPI_SUCCESS) return -1; + if (mpi_ret != MPI_SUCCESS) + return -1; return file_size; } #endif /* H5_HAVE_PARALLEL */ - else if(driver == H5FD_FAMILY) { + else if (driver == H5FD_FAMILY) { h5_stat_size_t tot_size = 0; /* Try all filenames possible, until we find one that's missing */ - for(j = 0; /*void*/; j++) { + for (j = 0; /*void*/; j++) { /* Create the filename to query */ HDsnprintf(temp, sizeof temp, filename, j); /* Check for existence of file */ - if(HDaccess(temp, F_OK) < 0) + if (HDaccess(temp, F_OK) < 0) break; /* Get the file's statistics */ - if(0 != HDstat(temp, &sb)) - return(-1); + if (0 != HDstat(temp, &sb)) + return (-1); /* Add to total size */ tot_size += (h5_stat_size_t)sb.st_size; } /* end for */ /* Return total size */ - return(tot_size); + return (tot_size); } /* end if */ else { HDassert(0 && "Unknown VFD!"); } /* end else */ - } /* end else */ + } /* end else */ - return(-1); + return (-1); } /* end get_file_size() */ +H5_GCC_DIAG_ON("format-nonliteral") /* * This routine is designed to provide equivalent functionality to 'printf' @@ -1189,18 +1358,17 @@ h5_get_file_size(const char *filename, hid_t fapl) int print_func(const char *format, ...) { - va_list arglist; - int ret_value; + va_list arglist; + int ret_value; - va_start(arglist, format); - ret_value = vprintf(format, arglist); - va_end(arglist); - return ret_value; + HDva_start(arglist, format); + ret_value = HDvprintf(format, arglist); + HDva_end(arglist); + return ret_value; } #ifdef H5_HAVE_FILTER_SZIP - /*------------------------------------------------------------------------- * Function: h5_szip_can_encode * @@ -1217,31 +1385,31 @@ print_func(const char *format, ...) * *------------------------------------------------------------------------- */ -int h5_szip_can_encode(void ) +int +h5_szip_can_encode(void) { unsigned int filter_config_flags; H5Zget_filter_info(H5Z_FILTER_SZIP, &filter_config_flags); - if ((filter_config_flags & - (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) == 0) { + if ((filter_config_flags & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == 0) { /* filter present but neither encode nor decode is supported (???) */ return -1; - } else if ((filter_config_flags & - (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) == - H5Z_FILTER_CONFIG_DECODE_ENABLED) { + } + else if ((filter_config_flags & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == + H5Z_FILTER_CONFIG_DECODE_ENABLED) { /* decoder only: read but not write */ return 0; - } else if ((filter_config_flags & - (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) == - H5Z_FILTER_CONFIG_ENCODE_ENABLED) { + } + else if ((filter_config_flags & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == + H5Z_FILTER_CONFIG_ENCODE_ENABLED) { /* encoder only: write but not read (???) */ return -1; - } else if ((filter_config_flags & - (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) == - (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) { + } + else if ((filter_config_flags & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == + (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) { return 1; } - return(-1); + return (-1); } #endif /* H5_HAVE_FILTER_SZIP */ @@ -1273,27 +1441,27 @@ int h5_szip_can_encode(void ) *------------------------------------------------------------------------- */ char * -getenv_all(MPI_Comm comm, int root, const char* name) +getenv_all(MPI_Comm comm, int root, const char *name) { - int mpi_size, mpi_rank, mpi_initialized, mpi_finalized; - int len; - static char* env = NULL; + int mpi_size, mpi_rank, mpi_initialized, mpi_finalized; + int len; + static char *env = NULL; - assert(name); + HDassert(name); MPI_Initialized(&mpi_initialized); MPI_Finalized(&mpi_finalized); - if(mpi_initialized && !mpi_finalized) { + if (mpi_initialized && !mpi_finalized) { MPI_Comm_rank(comm, &mpi_rank); MPI_Comm_size(comm, &mpi_size); - assert(root < mpi_size); + HDassert(root < mpi_size); /* The root task does the getenv call * and sends the result to the other tasks */ - if(mpi_rank == root) { + if (mpi_rank == root) { env = HDgetenv(name); - if(env) { + if (env) { len = (int)HDstrlen(env); MPI_Bcast(&len, 1, MPI_INT, root, comm); MPI_Bcast(env, len, MPI_CHAR, root, comm); @@ -1306,17 +1474,17 @@ getenv_all(MPI_Comm comm, int root, const char* name) } else { MPI_Bcast(&len, 1, MPI_INT, root, comm); - if(len >= 0) { - if(env == NULL) - env = (char*) HDmalloc((size_t)len+1); - else if(HDstrlen(env) < (size_t)len) - env = (char*) HDrealloc(env, (size_t)len+1); + if (len >= 0) { + if (env == NULL) + env = (char *)HDmalloc((size_t)len + 1); + else if (HDstrlen(env) < (size_t)len) + env = (char *)HDrealloc(env, (size_t)len + 1); MPI_Bcast(env, len, MPI_CHAR, root, comm); env[len] = '\0'; } else { - if(env) + if (env) HDfree(env); env = NULL; } @@ -1327,7 +1495,7 @@ getenv_all(MPI_Comm comm, int root, const char* name) } else { /* use original getenv */ - if(env) + if (env) HDfree(env); env = HDgetenv(name); } /* end if */ @@ -1358,30 +1526,30 @@ getenv_all(MPI_Comm comm, int root, const char* name) int h5_make_local_copy(const char *origfilename, const char *local_copy_name) { - int fd_old = (-1), fd_new = (-1); /* File descriptors for copying data */ - ssize_t nread; /* Number of bytes read in */ - void *buf = NULL; /* Buffer for copying data */ - const char *filename = H5_get_srcdir_filename(origfilename); /* Get the test file name to copy */ + int fd_old = (-1), fd_new = (-1); /* File descriptors for copying data */ + ssize_t nread; /* Number of bytes read in */ + void * buf = NULL; /* Buffer for copying data */ + const char *filename = H5_get_srcdir_filename(origfilename); /* Get the test file name to copy */ /* Allocate copy buffer */ - if(NULL == (buf = HDcalloc((size_t)1, (size_t)READ_BUF_SIZE))) + if (NULL == (buf = HDcalloc((size_t)1, (size_t)READ_BUF_SIZE))) goto error; /* Copy old file into temporary file */ - if((fd_old = HDopen(filename, O_RDONLY, 0666)) < 0) + if ((fd_old = HDopen(filename, O_RDONLY, 0666)) < 0) goto error; - if((fd_new = HDopen(local_copy_name, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0) + if ((fd_new = HDopen(local_copy_name, O_RDWR | O_CREAT | O_TRUNC, 0666)) < 0) goto error; /* Copy data */ - while((nread = HDread(fd_old, buf, (size_t)READ_BUF_SIZE)) > 0) - if(HDwrite(fd_new, buf, (size_t)nread) < 0) + while ((nread = HDread(fd_old, buf, (size_t)READ_BUF_SIZE)) > 0) + if (HDwrite(fd_new, buf, (size_t)nread) < 0) goto error; - + /* Close files */ - if(HDclose(fd_old) < 0) + if (HDclose(fd_old) < 0) goto error; - if(HDclose(fd_new) < 0) + if (HDclose(fd_new) < 0) goto error; /* Release memory */ @@ -1391,42 +1559,36 @@ h5_make_local_copy(const char *origfilename, const char *local_copy_name) error: /* ignore return values since we're already noted the problem */ - if(fd_old > 0) + if (fd_old > 0) HDclose(fd_old); - if(fd_new > 0) + if (fd_new > 0) HDclose(fd_new); HDfree(buf); return -1; } /* end h5_make_local_copy() */ - /*------------------------------------------------------------------------- * Function: h5_verify_cached_stabs_cb * * Purpose: Callback function for h5_verify_cached_stabs. * - * Return: Success: 0 - * - * Failure: -1 + * Return: SUCCEED/FAIL * * Programmer: Neil Fortner * Tuesday, April 12, 2011 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -h5_verify_cached_stabs_cb(hid_t oid, const char H5_ATTR_UNUSED *name, - const H5O_info_t *oinfo, void H5_ATTR_UNUSED *udata) +h5_verify_cached_stabs_cb(hid_t oid, const char H5_ATTR_UNUSED *name, const H5O_info_t *oinfo, + void H5_ATTR_UNUSED *udata) { - if(oinfo->type == H5O_TYPE_GROUP) - return(H5G__verify_cached_stabs_test(oid)); + if (oinfo->type == H5O_TYPE_GROUP) + return H5G__verify_cached_stabs_test(oid); else - return(0); + return SUCCEED; } /* end h5_verify_cached_stabs_cb() */ - /*------------------------------------------------------------------------- * Function: h5_verify_cached_stabs * @@ -1450,27 +1612,25 @@ h5_verify_cached_stabs_cb(hid_t oid, const char H5_ATTR_UNUSED *name, herr_t h5_verify_cached_stabs(const char *base_name[], hid_t fapl) { - hid_t file = -1; - char filename[1024]; - int i = 0; + hid_t file = -1; + char filename[1024]; + int i = 0; - while(base_name[i]) { + while (base_name[i]) { if (h5_fixname(base_name[i], fapl, filename, sizeof(filename)) == NULL) continue; - H5E_BEGIN_TRY { - file = H5Fopen(filename, H5F_ACC_RDONLY, fapl); - } H5E_END_TRY - if(file < 0) { + H5E_BEGIN_TRY { file = H5Fopen(filename, H5F_ACC_RDONLY, fapl); } + H5E_END_TRY + if (file < 0) { i++; continue; } /* end if */ - if(H5Ovisit(file, H5_INDEX_NAME, H5_ITER_NATIVE, - h5_verify_cached_stabs_cb, NULL) < 0) + if (H5Ovisit(file, H5_INDEX_NAME, H5_ITER_NATIVE, h5_verify_cached_stabs_cb, NULL) < 0) goto error; - if(H5Fclose(file) < 0) + if (H5Fclose(file) < 0) goto error; file = -1; @@ -1480,10 +1640,270 @@ h5_verify_cached_stabs(const char *base_name[], hid_t fapl) return 0; error: - H5E_BEGIN_TRY { - H5Fclose(file); - } H5E_END_TRY; + H5E_BEGIN_TRY { H5Fclose(file); } + H5E_END_TRY; return -1; } +/*------------------------------------------------------------------------- + * Function: h5_send_message + * + * Purpose: Sends the specified signal. + * + * In terms of this test framework, a signal consists of a file + * on disk. Since there are multiple processes that need to + * communicate with each other, they do so by writing and + * reading signal files on disk, the names and contents of + * which are used to inform a process about when it can + * proceed and what it should do next. + * + * This function writes a signal file. The first argument is + * the name of the signal file, and the second and third + * arguments are the contents of the first two lines of the + * signal file. The last two arguments may be NULL. + * + * Return: void + * + * Programmer: Mike McGreevy + * August 18, 2010 + * + *------------------------------------------------------------------------- + */ +void +h5_send_message(const char *send, const char *arg1, const char *arg2) +{ + FILE *signalfile = NULL; + + /* Create signal file (which will send signal to some other process) */ + signalfile = HDfopen(TMP_SIGNAL_FILE, "w+"); + + /* Write messages to signal file, if provided */ + if (arg2 != NULL) { + HDassert(arg1); + HDfprintf(signalfile, "%s\n%s\n", arg1, arg2); + } /* end if */ + else if (arg1 != NULL) { + HDassert(arg2 == NULL); + HDfprintf(signalfile, "%s\n", arg1); + } /* end if */ + else { + HDassert(arg1 == NULL); + HDassert(arg2 == NULL); + } /* end else */ + + HDfclose(signalfile); + + HDrename(TMP_SIGNAL_FILE, send); +} /* h5_send_message() */ + +/*------------------------------------------------------------------------- + * Function: h5_wait_message + * + * Purpose: Waits for the specified signal. + * + * In terms of this test framework, a signal consists of a file + * on disk. Since there are multiple processes that need to + * communicate with each other, they do so by writing and + * reading signal files on disk, the names and contents of + * which are used to inform a process about when it can + * proceed and what it should do next. + * + * This function continuously attempts to read the specified + * signal file from disk, and only continues once it has + * successfully done so (i.e., only after another process has + * called the "h5_send_message" function to write the signal file). + * This functon will then immediately remove the file (i.e., + * to indicate that it has been received and can be reused), + * and then exits, allowing the calling function to continue. + * + * Return: void + * + * Programmer: Mike McGreevy + * August 18, 2010 + * + *------------------------------------------------------------------------- + */ +herr_t +h5_wait_message(const char *waitfor) +{ + FILE * returnfile; + time_t t0, t1; + + /* Start timer. If this function runs for too long (i.e., + expected signal is never received), it will + return failure */ + HDtime(&t0); + + /* Wait for return signal from some other process */ + while ((returnfile = HDfopen(waitfor, "r")) == NULL) { + + /* make note of current time. */ + HDtime(&t1); + + /* If we've been waiting for a signal for too long, then + it was likely never sent and we should fail rather + than loop infinitely */ + if (HDdifftime(t1, t0) > MESSAGE_TIMEOUT) { + HDfprintf(stdout, "Error communicating between processes. Make sure test script is running.\n"); + TEST_ERROR; + } /* end if */ + } /* end while */ + + HDfclose(returnfile); + HDunlink(waitfor); + + return SUCCEED; + +error: + return FAIL; +} /* h5_wait_message() */ + +/* Functions for the dummy VFD class (see below). + * + * Useful for testing things like ID handling where we shouldn't mess with the + * real VFDs. + */ +static H5FD_t *dummy_vfd_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); +static H5FD_t * +dummy_vfd_open(const char H5_ATTR_UNUSED *name, unsigned H5_ATTR_UNUSED flags, hid_t H5_ATTR_UNUSED fapl_id, + haddr_t H5_ATTR_UNUSED maxaddr) +{ + return NULL; +} + +static herr_t dummy_vfd_close(H5FD_t *_file); +static herr_t +dummy_vfd_close(H5FD_t H5_ATTR_UNUSED *_file) +{ + return FAIL; +} + +static haddr_t dummy_vfd_get_eoa(const H5FD_t *file, H5FD_mem_t type); +static haddr_t +dummy_vfd_get_eoa(const H5FD_t H5_ATTR_UNUSED *file, H5FD_mem_t H5_ATTR_UNUSED type) +{ + return HADDR_UNDEF; +} + +static herr_t dummy_vfd_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); +static herr_t +dummy_vfd_set_eoa(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t H5_ATTR_UNUSED addr) +{ + return FAIL; +} + +static haddr_t dummy_vfd_get_eof(const H5FD_t *file); +static haddr_t +dummy_vfd_get_eof(const H5FD_t H5_ATTR_UNUSED *file) +{ + return HADDR_UNDEF; +} + +static herr_t dummy_vfd_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, + void *buf); +static herr_t +dummy_vfd_read(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED fapl_id, + haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED size, void H5_ATTR_UNUSED *buf) +{ + return FAIL; +} + +static herr_t dummy_vfd_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, + const void *buf); +static herr_t +dummy_vfd_write(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED fapl_id, + haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED size, const void H5_ATTR_UNUSED *buf) +{ + return FAIL; +} + +/* Dummy VFD with the minimum parameters to make a VFD that can be registered */ +static const H5FD_class_t H5FD_dummy_g = { + "dummy", /* name */ + 1, /* maxaddr */ + H5F_CLOSE_WEAK, /* fc_degree */ + NULL, /* sb_size */ + NULL, /* sb_encode */ + NULL, /* sb_decode */ + 0, /* fapl_size */ + NULL, /* fapl_get */ + NULL, /* fapl_copy */ + NULL, /* fapl_free */ + 0, /* dxpl_size */ + NULL, /* dxpl_copy */ + NULL, /* dxpl_free */ + dummy_vfd_open, /* open */ + dummy_vfd_close, /* close */ + NULL, /* cmp */ + NULL, /* query */ + NULL, /* get_type_map */ + NULL, /* alloc */ + NULL, /* free */ + dummy_vfd_get_eoa, /* get_eoa */ + dummy_vfd_set_eoa, /* set_eoa */ + dummy_vfd_get_eof, /* get_eof */ + NULL, /* get_handle */ + dummy_vfd_read, /* read */ + dummy_vfd_write, /* write */ + NULL, /* flush */ + NULL, /* truncate */ + NULL, /* lock */ + NULL, /* unlock */ + H5FD_FLMAP_DICHOTOMY /* fl_map */ +}; + +/*------------------------------------------------------------------------- + * Function: h5_get_dummy_vfd_class() + * + * Purpose: Returns a disposable, generally non-functional, + * VFD class struct. + * + * In some of the test code, we need a disposable VFD but + * we don't want to mess with the real VFDs and we also + * don't have access to the internals of the real VFDs (which + * use static globals and functions) to easily duplicate + * them (e.g.: for testing VFD ID handling). + * + * This API call will return a pointer to a VFD class that + * can be used to construct a test VFD using H5FDregister(). + * + * Return: Success: A pointer to a VFD class struct + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +H5FD_class_t * +h5_get_dummy_vfd_class(void) +{ + H5FD_class_t *vfd_class = NULL; /* Dummy VFD that will be returned */ + + /* Create the class and initialize everything to zero/NULL */ + if (NULL == (vfd_class = (H5FD_class_t *)HDmalloc(sizeof(H5FD_class_t)))) + TEST_ERROR; + + /* Copy the dummy VFD */ + HDmemcpy(vfd_class, &H5FD_dummy_g, sizeof(H5FD_class_t)); + + return vfd_class; + +error: + if (vfd_class) + HDfree(vfd_class); + return NULL; +} /* h5_get_dummy_vfd_class */ + +/*------------------------------------------------------------------------- + * Function: h5_get_version_string + * + * Purpose: Get the string that corresponds to the libvery version bound. + * + * Return: The string + * + *------------------------------------------------------------------------- + */ +char * +h5_get_version_string(H5F_libver_t libver) +{ + return (LIBVER_NAMES[libver]); +} /* end of h5_get_version_string */ |