summaryrefslogtreecommitdiffstats
path: root/test/vfd.c
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2021-02-08 16:56:16 (GMT)
committerGitHub <noreply@github.com>2021-02-08 16:56:16 (GMT)
commit22c67ff6570f16050f0a5654cf1c84df917bb598 (patch)
tree38fb63aa498b250c2543fe7e22a511706de96a42 /test/vfd.c
parent551f15f8ae02ca9c995619b216121081eb07633e (diff)
downloadhdf5-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/vfd.c')
-rw-r--r--test/vfd.c1662
1 files changed, 1025 insertions, 637 deletions
diff --git a/test/vfd.c b/test/vfd.c
index 305afe5..d6832b8 100644
--- a/test/vfd.c
+++ b/test/vfd.c
@@ -6,13 +6,13 @@
* 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: Raymond Lu<slu@ncsa.uiuc.edu>
+ * Programmer: Raymond Lu
* Tuesday, Sept 24, 2002
*
* Purpose: Tests the basic features of Virtual File Drivers
@@ -20,48 +20,59 @@
#include "h5test.h"
-#define KB 1024U
-#define FAMILY_NUMBER 4
-#define FAMILY_SIZE (1*KB)
-#define FAMILY_SIZE2 (5*KB)
-#define MULTI_SIZE 128
-#define CORE_INCREMENT (4*KB)
-#define CORE_PAGE_SIZE (1024 * 1024)
-#define DSET1_NAME "dset1"
-#define DSET1_DIM1 1024
-#define DSET1_DIM2 32
-#define DSET3_NAME "dset3"
+#ifdef H5_HAVE_ROS3_VFD
+#include "H5FDros3.h"
+#endif
+
+#ifdef H5_HAVE_LIBHDFS
+#include "H5FDhdfs.h"
+#endif
+
+#define KB 1024U
+#define FAMILY_NUMBER 4
+#define FAMILY_SIZE (1 * KB)
+#define FAMILY_SIZE2 (5 * KB)
+#define MULTI_SIZE 128
+
+#define CORE_INCREMENT (4 * KB)
+#define CORE_PAGE_SIZE (1024 * KB)
+#define CORE_DSET_NAME "core dset"
+#define CORE_DSET_DIM1 1024
+#define CORE_DSET_DIM2 32
+
+#define DSET1_NAME "dset1"
+#define DSET1_DIM1 1024
+#define DSET1_DIM2 32
+#define DSET3_NAME "dset3"
/* Macros for Direct VFD */
#ifdef H5_HAVE_DIRECT
-#define MBOUNDARY 512
-#define FBSIZE (4*KB)
-#define CBSIZE (8*KB)
-#define THRESHOLD 1
-#define DSET2_NAME "dset2"
-#define DSET2_DIM 4
+#define MBOUNDARY 512
+#define FBSIZE (4 * KB)
+#define CBSIZE (8 * KB)
+#define THRESHOLD 1
+#define DSET2_NAME "dset2"
+#define DSET2_DIM 4
#endif /* H5_HAVE_DIRECT */
-const char *FILENAME[] = {
- "sec2_file", /*0*/
- "core_file", /*1*/
- "family_file", /*2*/
- "new_family_v16_", /*3*/
- "multi_file", /*4*/
- "direct_file", /*5*/
- "log_file", /*6*/
- "stdio_file", /*7*/
- "windows_file", /*8*/
- "new_multi_file_v16",/*9*/
- NULL
-};
+const char *FILENAME[] = {"sec2_file", /*0*/
+ "core_file", /*1*/
+ "family_file", /*2*/
+ "new_family_v16_", /*3*/
+ "multi_file", /*4*/
+ "direct_file", /*5*/
+ "log_file", /*6*/
+ "stdio_file", /*7*/
+ "windows_file", /*8*/
+ "new_multi_file_v16", /*9*/
+ "ro_s3_file", /*10*/
+ NULL};
#define LOG_FILENAME "log_vfd_out.log"
-#define COMPAT_BASENAME "family_v16_"
+#define COMPAT_BASENAME "family_v16_"
#define MULTI_COMPAT_BASENAME "multi_file_v16"
-
/*-------------------------------------------------------------------------
* Function: test_sec2
*
@@ -78,525 +89,682 @@ const char *FILENAME[] = {
static herr_t
test_sec2(void)
{
- hid_t file = -1; /* file ID */
- hid_t fapl = -1; /* file access property list ID */
- hid_t access_fapl = -1;
- char filename[1024];
- int *fhandle = NULL;
- hsize_t file_size = 0;
+ hid_t fid = -1; /* file ID */
+ hid_t fapl_id = -1; /* file access property list ID */
+ hid_t fapl_id_out = -1; /* from H5Fget_access_plist */
+ hid_t driver_id = -1; /* ID for this VFD */
+ unsigned long driver_flags = 0; /* VFD feature flags */
+ char filename[1024]; /* filename */
+ void * os_file_handle = NULL; /* OS file handle */
+ hsize_t file_size; /* file size */
TESTING("SEC2 file driver");
/* Set property list and file name for SEC2 driver. */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
- if(H5Pset_fapl_sec2(fapl) < 0)
+ if (H5Pset_fapl_sec2(fapl_id) < 0)
TEST_ERROR;
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+ h5_fixname(FILENAME[0], fapl_id, filename, sizeof(filename));
+
+ /* Check that the VFD feature flags are correct */
+ if ((driver_id = H5Pget_driver(fapl_id)) < 0)
+ TEST_ERROR
+ if (H5FDdriver_query(driver_id, &driver_flags) < 0)
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_AGGREGATE_METADATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_ACCUMULATE_METADATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_DATA_SIEVE))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_POSIX_COMPAT_HANDLE))
+ TEST_ERROR
+ /* Check for extra flags not accounted for above */
+ if (driver_flags != (H5FD_FEAT_AGGREGATE_METADATA | H5FD_FEAT_ACCUMULATE_METADATA | H5FD_FEAT_DATA_SIEVE |
+ H5FD_FEAT_AGGREGATE_SMALLDATA | H5FD_FEAT_POSIX_COMPAT_HANDLE))
+ TEST_ERROR
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
TEST_ERROR;
/* Retrieve the access property list... */
- if((access_fapl = H5Fget_access_plist(file)) < 0)
+ if ((fapl_id_out = H5Fget_access_plist(fid)) < 0)
TEST_ERROR;
/* Check that the driver is correct */
- if(H5FD_SEC2 != H5Pget_driver(access_fapl))
+ if (H5FD_SEC2 != H5Pget_driver(fapl_id_out))
TEST_ERROR;
/* ...and close the property list */
- if(H5Pclose(access_fapl) < 0)
+ if (H5Pclose(fapl_id_out) < 0)
TEST_ERROR;
- /* Check file handle API */
- if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0)
- TEST_ERROR;
- if(*fhandle < 0)
+ /* Check that we can get an operating-system-specific handle from
+ * the library.
+ */
+ if (H5Fget_vfd_handle(fid, H5P_DEFAULT, &os_file_handle) < 0)
TEST_ERROR;
+ if (os_file_handle == NULL)
+ FAIL_PUTS_ERROR("NULL os-specific vfd/file handle was returned from H5Fget_vfd_handle");
- /* Check file size API */
- if(H5Fget_filesize(file, &file_size) < 0)
+ /* There is no garantee the size of metadata in file is constant.
+ * Just try to check if it's reasonable.
+ *
+ * Currently it should be around 2 KB.
+ */
+ if (H5Fget_filesize(fid, &file_size) < 0)
TEST_ERROR;
+ if (file_size < 1 * KB || file_size > 4 * KB)
+ FAIL_PUTS_ERROR("suspicious file size obtained from H5Fget_filesize");
- /* There is no guarantee the size of metadata in file is constant.
- * Just try to check if it's reasonable. It's 2KB right now.
- */
- if(file_size < 1 * KB || file_size > 4 * KB)
+ /* Close and delete the file */
+ if (H5Fclose(fid) < 0)
TEST_ERROR;
- h5_delete_test_file(FILENAME[0], fapl);
+ h5_delete_test_file(FILENAME[0], fapl_id);
/* Close the fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl_id) < 0)
TEST_ERROR;
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- H5Pclose(fapl);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(fapl_id);
+ H5Pclose(fapl_id_out);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return -1;
-}
-
+} /* end test_sec2() */
-
/*-------------------------------------------------------------------------
- * Function: test_direct
+ * Function: test_core
*
- * Purpose: Tests the file handle interface for DIRECT I/O driver
+ * Purpose: Tests the file handle interface for CORE driver
*
* Return: Success: 0
* Failure: -1
*
* Programmer: Raymond Lu
- * Wednesday, 20 September 2006
+ * Tuesday, Sept 24, 2002
*
*-------------------------------------------------------------------------
*/
static herr_t
-test_direct(void)
+test_core(void)
{
-#ifdef H5_HAVE_DIRECT
- hid_t file=(-1), fapl, access_fapl = -1;
- hid_t dset1=-1, dset2=-1, space1=-1, space2=-1;
- char filename[1024];
- int *fhandle=NULL;
- hsize_t file_size;
- hsize_t dims1[2], dims2[1];
- size_t mbound;
- size_t fbsize;
- size_t cbsize;
- int *points = NULL, *check = NULL, *p1, *p2;
- int wdata2[DSET2_DIM] = {11,12,13,14};
- int rdata2[DSET2_DIM];
- int i, j, n;
-#endif /*H5_HAVE_DIRECT*/
+ hid_t fid = -1; /* file ID */
+ hid_t fapl_id = -1; /* file access property list ID */
+ hid_t fapl_id_out = -1; /* from H5Fget_access_plist */
+ hid_t driver_id = -1; /* ID for this VFD */
+ unsigned long driver_flags = 0; /* VFD feature flags */
+ hid_t did = -1; /* dataset ID */
+ hid_t sid = -1; /* dataspace ID */
+ char filename[1024]; /* filename */
+ void * os_file_handle = NULL; /* OS file handle */
+ hsize_t file_size; /* file size */
+ size_t increment; /* core VFD increment */
+ hbool_t backing_store; /* use backing store? */
+ hbool_t use_write_tracking; /* write tracking flag */
+ size_t write_tracking_page_size; /* write tracking page size */
+ int * data_w = NULL; /* data written to the dataset */
+ int * data_r = NULL; /* data read from the dataset */
+ int val; /* data value */
+ int * pw = NULL, *pr = NULL; /* pointers for iterating over
+ data arrays (write & read) */
+ hsize_t dims[2]; /* dataspace dimensions */
+ int i, j; /* iterators */
+ htri_t status; /* return value from H5Lexists */
- TESTING("DIRECT I/O file driver");
+ TESTING("CORE file driver");
-#ifndef H5_HAVE_DIRECT
- SKIPPED();
- return 0;
-#else /*H5_HAVE_DIRECT*/
+ /* Get a file access property list and fix up the file name */
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
+ h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename));
- /* Set property list and file name for Direct driver. Set memory alignment boundary
- * and file block size to 512 which is the minimum for Linux 2.6. */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ /************************************************************************
+ * Check that the backing store flag works by creating a file, close
+ * it, and ensure that the file does not exist.
+ ************************************************************************/
+
+ /* Make sure it's not present at the start of the test */
+ if (HDaccess(filename, F_OK) != -1)
+ if (HDremove(filename) < 0)
+ FAIL_PUTS_ERROR("unable to remove backing store file");
+
+ /* Create and close file w/ backing store off */
+ if (H5Pset_fapl_core(fapl_id, (size_t)CORE_INCREMENT, FALSE) < 0)
+ TEST_ERROR;
+
+ /* Check that the VFD feature flags are correct.
+ * Note that the H5FDdriver_query() API call does not require a file
+ * so backing-store related flags will not be returned here.
+ */
+ if ((driver_id = H5Pget_driver(fapl_id)) < 0)
+ TEST_ERROR
+ if (H5FDdriver_query(driver_id, &driver_flags) < 0)
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_AGGREGATE_METADATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_ACCUMULATE_METADATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_DATA_SIEVE))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_ALLOW_FILE_IMAGE))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_CAN_USE_FILE_IMAGE_CALLBACKS))
+ TEST_ERROR
+ /* Check for extra flags not accounted for above */
+ if (driver_flags !=
+ (H5FD_FEAT_AGGREGATE_METADATA | H5FD_FEAT_ACCUMULATE_METADATA | H5FD_FEAT_DATA_SIEVE |
+ H5FD_FEAT_AGGREGATE_SMALLDATA | H5FD_FEAT_ALLOW_FILE_IMAGE | H5FD_FEAT_CAN_USE_FILE_IMAGE_CALLBACKS))
+ TEST_ERROR
+
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
TEST_ERROR;
- if(H5Pset_fapl_direct(fapl, MBOUNDARY, FBSIZE, CBSIZE) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR;
- h5_fixname(FILENAME[5], fapl, filename, sizeof filename);
+ /* Check for the backing store file */
+ if (HDaccess(filename, F_OK) != -1)
+ FAIL_PUTS_ERROR("file created when backing store set to FALSE");
- /* Verify the file access properties */
- if(H5Pget_fapl_direct(fapl, &mbound, &fbsize, &cbsize) < 0)
+ /************************************************************************
+ * Check basic core VFD operation and properties. This is done with the
+ * backing store on so a file will be created for later use.
+ ************************************************************************/
+
+ /* Turn the backing store on */
+ if (H5Pset_fapl_core(fapl_id, (size_t)CORE_INCREMENT, TRUE) < 0)
TEST_ERROR;
- if(mbound != MBOUNDARY || fbsize != FBSIZE || cbsize != CBSIZE)
+
+ /* Check that write tracking is off by default and that the default
+ * page size is non-zero.
+ */
+ if (H5Pget_core_write_tracking(fapl_id, &use_write_tracking, &write_tracking_page_size) < 0)
TEST_ERROR;
+ if (FALSE != use_write_tracking)
+ FAIL_PUTS_ERROR("write tracking should be off by default");
+ if (0 == write_tracking_page_size)
+ FAIL_PUTS_ERROR("write tracking page size should never be zero");
- if(H5Pset_alignment(fapl, (hsize_t)THRESHOLD, (hsize_t)FBSIZE) < 0)
+ /* Set core VFD properties */
+ if (H5Pset_core_write_tracking(fapl_id, TRUE, CORE_PAGE_SIZE) < 0)
TEST_ERROR;
- H5E_BEGIN_TRY {
- file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- } H5E_END_TRY;
- if(file<0) {
- H5Pclose (fapl);
- SKIPPED();
- printf(" Probably the file system doesn't support Direct I/O\n");
- return 0;
- }
+ /* Create the file */
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
+ TEST_ERROR;
/* Retrieve the access property list... */
- if ((access_fapl = H5Fget_access_plist(file)) < 0)
+ if ((fapl_id_out = H5Fget_access_plist(fid)) < 0)
TEST_ERROR;
/* Check that the driver is correct */
- if(H5FD_DIRECT != H5Pget_driver(access_fapl))
+ if (H5FD_CORE != H5Pget_driver(fapl_id_out))
TEST_ERROR;
- /* ...and close the property list */
- if (H5Pclose(access_fapl) < 0)
- TEST_ERROR;
+ /* Get the basic VFD properties from the fapl and ensure that
+ * they are correct.
+ */
+ if (H5Pget_fapl_core(fapl_id_out, &increment, &backing_store) < 0)
+ TEST_ERROR
+ if (increment != (size_t)CORE_INCREMENT)
+ FAIL_PUTS_ERROR("incorrect increment from file fapl");
+ if (backing_store != TRUE)
+ FAIL_PUTS_ERROR("incorrect backing store flag from file fapl");
- /* Check file handle API */
- if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0)
- TEST_ERROR;
- if(*fhandle<0)
+ /* Check that the backing store write tracking info was saved */
+ /* TODO: There is a bug where H5Fget_access_plist() does not return
+ * the write tracking properties. Until this bug is fixed, just
+ * test the main fapl_id.
+ */
+ if (H5Pget_core_write_tracking(fapl_id, &use_write_tracking, &write_tracking_page_size) < 0)
TEST_ERROR;
+ if (TRUE != use_write_tracking)
+ FAIL_PUTS_ERROR("write tracking flag incorrect in fapl obtained from H5Fget_access_plist");
+ if (CORE_PAGE_SIZE != write_tracking_page_size)
+ FAIL_PUTS_ERROR("write tracking page size incorrect in fapl obtained from H5Fget_access_plist");
- /* Check file size API */
- if(H5Fget_filesize(file, &file_size) < 0)
+ /* Close the property list */
+ if (H5Pclose(fapl_id_out) < 0)
TEST_ERROR;
- /* There is no guarantee of the number of metadata allocations, but it's
- * 4 currently and the size of the file should be between 3 & 4 file buffer
- * sizes..
+ /* Check that we can get an operating-system-specific handle from
+ * the library.
*/
- if(file_size < (FBSIZE * 3) || file_size >= (FBSIZE * 4))
+ if (H5Fget_vfd_handle(fid, H5P_DEFAULT, &os_file_handle) < 0)
TEST_ERROR;
+ if (os_file_handle == NULL)
+ FAIL_PUTS_ERROR("NULL os-specific vfd/file handle was returned from H5Fget_vfd_handle");
- /* Allocate aligned memory for data set 1. For data set 1, everything is aligned including
- * memory address, size of data, and file address. */
- if(0 != HDposix_memalign(&points, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
+ /* There is no garantee the size of metadata in file is constant.
+ * Just try to check if it's reasonable.
+ *
+ * TODO: Needs justification of why is this is a reasonable size.
+ */
+ if (H5Fget_filesize(fid, &file_size) < 0)
TEST_ERROR;
- if(0 != HDposix_memalign(&check, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
+ if (file_size < 2 * KB || file_size > 6 * KB)
+ FAIL_PUTS_ERROR("suspicious file size obtained from H5Fget_filesize");
+
+ /* Close the file */
+ if (H5Fclose(fid) < 0)
TEST_ERROR;
- /* Initialize the dset1 */
- p1 = points;
- for(i = n = 0; i < DSET1_DIM1; i++)
- for(j = 0; j < DSET1_DIM2; j++)
- *p1++ = n++;
+ /************************************************************************
+ * Make changes to the file with the backing store flag OFF to ensure
+ * that they ARE NOT propagated.
+ ************************************************************************/
- /* Create the data space1 */
- dims1[0] = DSET1_DIM1;
- dims1[1] = DSET1_DIM2;
- if((space1 = H5Screate_simple(2, dims1, NULL)) < 0)
+ /* Open the file with backing store off for read and write.
+ * Changes won't be saved in file.
+ */
+ if (H5Pset_fapl_core(fapl_id, (size_t)CORE_INCREMENT, FALSE) < 0)
+ TEST_ERROR;
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
TEST_ERROR;
- /* Create the dset1 */
- if((dset1 = H5Dcreate2(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ /* Allocate memory for data set. */
+ if (NULL == (data_w = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
+ FAIL_PUTS_ERROR("unable to allocate memory for input array");
+ if (NULL == (data_r = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
+ FAIL_PUTS_ERROR("unable to allocate memory for output array");
+
+ /* Initialize the buffers */
+ val = 0;
+ pw = data_w;
+ for (i = 0; i < CORE_DSET_DIM1; i++)
+ for (j = 0; j < CORE_DSET_DIM2; j++)
+ *pw++ = val++;
+ HDmemset(data_r, 0, DSET1_DIM1 * DSET1_DIM2 * sizeof(int));
+
+ /* Create the dataspace */
+ dims[0] = CORE_DSET_DIM1;
+ dims[1] = CORE_DSET_DIM2;
+ if ((sid = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR;
- /* Write the data to the dset1 */
- if(H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
+ /* Create the dataset */
+ if ((did = H5Dcreate2(fid, CORE_DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
TEST_ERROR;
- if(H5Dclose(dset1) < 0)
+ /* Write the data to the dataset */
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_w) < 0)
TEST_ERROR;
- if((dset1 = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0)
+ /* Close and reopen the dataset */
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
+ if ((did = H5Dopen2(fid, CORE_DSET_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Read the data back from dset1 */
- if(H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0)
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_r) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
- p1 = points;
- p2 = check;
- for(i = 0; i < DSET1_DIM1; i++)
- for(j = 0; j < DSET1_DIM2; j++)
- if(*p1++ != *p2++) {
+ pw = data_w;
+ pr = data_r;
+ for (i = 0; i < CORE_DSET_DIM1; i++)
+ for (j = 0; j < CORE_DSET_DIM2; j++)
+ if (*pr++ != *pw++) {
H5_FAILED();
- printf(" Read different values than written in data set 1.\n");
- printf(" At index %d,%d\n", i, j);
+ HDprintf(" Read different values than written in data set.\n");
+ HDprintf(" At index %d,%d\n", i, j);
TEST_ERROR;
- } /* end if */
+ } /* end if */
- /* Create the data space2. For data set 2, memory address and data size are not aligned. */
- dims2[0] = DSET2_DIM;
- if((space2 = H5Screate_simple(1, dims2, NULL)) < 0)
+ /* Close everything except the dataspace ID (needed below)*/
+ if (H5Dclose(did) < 0)
TEST_ERROR;
-
- /* Create the dset2 */
- if((dset2 = H5Dcreate2(file, DSET2_NAME, H5T_NATIVE_INT, space2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR;
- /* Write the data to the dset1 */
- if(H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2) < 0)
+ /* Reopen the file and ensure that the dataset does not exist */
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
+ TEST_ERROR;
+ status = H5Lexists(fid, CORE_DSET_NAME, H5P_DEFAULT);
+ if (status < 0)
TEST_ERROR;
+ if (status > 0)
+ FAIL_PUTS_ERROR("core VFD dataset created in file when backing store disabled");
- if(H5Dclose(dset2) < 0)
+ /* Close the file */
+ if (H5Fclose(fid) < 0)
TEST_ERROR;
- if((dset2 = H5Dopen2(file, DSET2_NAME, H5P_DEFAULT)) < 0)
+ /************************************************************************
+ * Make changes to the file with the backing store flag ON to ensure
+ * that they ARE propagated.
+ ************************************************************************/
+
+ /* Open the file with backing store on for read and write.
+ * Changes will be saved in file.
+ */
+ if (H5Pset_fapl_core(fapl_id, (size_t)CORE_INCREMENT, TRUE) < 0)
+ TEST_ERROR;
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
TEST_ERROR;
- /* Read the data back from dset1 */
- if(H5Dread(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata2) < 0)
+ /* Create the dataset */
+ if ((did = H5Dcreate2(fid, CORE_DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
TEST_ERROR;
- /* Check that the values read are the same as the values written */
- for(i = 0; i < DSET2_DIM; i++)
- if(wdata2[i] != rdata2[i]) {
- H5_FAILED();
- printf(" Read different values than written in data set 2.\n");
- printf(" At index %d\n", i);
- TEST_ERROR;
- } /* end if */
+ /* Write the data to the dataset */
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_w) < 0)
+ TEST_ERROR;
- if(H5Sclose(space1) < 0)
+ /* Close everything and reopen */
+ if (H5Dclose(did) < 0)
TEST_ERROR;
- if(H5Dclose(dset1) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR;
- if(H5Sclose(space2) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
TEST_ERROR;
- if(H5Dclose(dset2) < 0)
+ if ((did = H5Dopen2(fid, CORE_DSET_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR;
- if(H5Fclose(file) < 0)
+
+ /* Read the data back from the dataset */
+ HDmemset(data_r, 0, DSET1_DIM1 * DSET1_DIM2 * sizeof(int));
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_r) < 0)
+ TEST_ERROR;
+
+ /* Check that the values read are the same as the values written */
+ pw = data_w;
+ pr = data_r;
+ for (i = 0; i < CORE_DSET_DIM1; i++)
+ for (j = 0; j < CORE_DSET_DIM2; j++)
+ if (*pw++ != *pr++) {
+ H5_FAILED();
+ HDprintf(" Read different values than written in data set.\n");
+ HDprintf(" At index %d,%d\n", i, j);
+ TEST_ERROR;
+ } /* end if */
+
+ /* Check file size API.
+ * There is no garantee the size of metadata in file is constant.
+ * Just try to check if it's reasonable.
+ *
+ * TODO: Needs justification of why is this is a reasonable size.
+ */
+ if (H5Fget_filesize(fid, &file_size) < 0)
+ TEST_ERROR;
+ if (file_size < 64 * KB || file_size > 256 * KB)
+ FAIL_PUTS_ERROR("suspicious file size obtained from H5Fget_filesize");
+
+ /* Close everything */
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR;
+ if (H5Dclose(did) < 0)
TEST_ERROR;
- HDassert(points);
- HDfree(points);
- HDassert(check);
- HDfree(check);
- h5_delete_test_file(FILENAME[1], fapl);
+ HDfree(data_w);
+ HDfree(data_r);
+
+ /* Close and delete the file */
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
+ h5_delete_test_file(FILENAME[1], fapl_id);
/* Close the fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl_id) < 0)
TEST_ERROR;
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- H5Pclose(fapl);
- H5Sclose(space1);
- H5Dclose(dset1);
- H5Sclose(space2);
- H5Dclose(dset2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Pclose(fapl_id_out);
+ H5Pclose(fapl_id);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
- if(points)
- HDfree(points);
- if(check)
- HDfree(check);
+ if (data_w)
+ HDfree(data_w);
+ if (data_r)
+ HDfree(data_r);
return -1;
-#endif /*H5_HAVE_DIRECT*/
-}
+} /* end test_core() */
-
/*-------------------------------------------------------------------------
- * Function: test_core
+ * Function: test_direct
*
- * Purpose: Tests the file handle interface for CORE driver
+ * Purpose: Tests the file handle interface for DIRECT I/O driver
*
* Return: Success: 0
* Failure: -1
*
* Programmer: Raymond Lu
- * Tuesday, Sept 24, 2002
+ * Wednesday, 20 September 2006
*
*-------------------------------------------------------------------------
*/
static herr_t
-test_core(void)
+test_direct(void)
{
- hid_t file=(-1), fapl, access_fapl = -1;
- char filename[1024];
- void *fhandle=NULL;
- hsize_t file_size;
- hbool_t use_write_tracking;
- size_t write_tracking_page_size;
- int *points = NULL, *check = NULL, *p1, *p2;
- hid_t dset1=-1, space1=-1;
- hsize_t dims1[2];
- int i, j, n;
+#ifdef H5_HAVE_DIRECT
+ hid_t file = -1, fapl = -1, access_fapl = -1;
+ hid_t dset1 = -1, dset2 = -1, space1 = -1, space2 = -1;
+ char filename[1024];
+ int * fhandle = NULL;
+ hsize_t file_size;
+ hsize_t dims1[2], dims2[1];
+ size_t mbound;
+ size_t fbsize;
+ size_t cbsize;
+ int * points = NULL, *check = NULL, *p1 = NULL, *p2 = NULL;
+ int wdata2[DSET2_DIM] = {11, 12, 13, 14};
+ int rdata2[DSET2_DIM];
+ int i, j, n;
+#endif /*H5_HAVE_DIRECT*/
- TESTING("CORE file driver");
+ TESTING("DIRECT I/O file driver");
- /* Set property list and file name for CORE driver */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+#ifndef H5_HAVE_DIRECT
+ SKIPPED();
+ return 0;
+#else /*H5_HAVE_DIRECT*/
+
+ /* Set property list and file name for Direct driver. Set memory alignment boundary
+ * and file block size to 512 which is the minimum for Linux 2.6. */
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
- if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE) < 0)
+ if (H5Pset_fapl_direct(fapl, MBOUNDARY, FBSIZE, CBSIZE) < 0)
TEST_ERROR;
- if(H5Pset_core_write_tracking(fapl, TRUE, CORE_PAGE_SIZE) < 0)
+ h5_fixname(FILENAME[5], fapl, filename, sizeof filename);
+
+ /* Verify the file access properties */
+ if (H5Pget_fapl_direct(fapl, &mbound, &fbsize, &cbsize) < 0)
+ TEST_ERROR;
+ if (mbound != MBOUNDARY || fbsize != FBSIZE || cbsize != CBSIZE)
TEST_ERROR;
- h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if (H5Pset_alignment(fapl, (hsize_t)THRESHOLD, (hsize_t)FBSIZE) < 0)
TEST_ERROR;
+ H5E_BEGIN_TRY { file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); }
+ H5E_END_TRY;
+ if (file < 0) {
+ H5Pclose(fapl);
+ SKIPPED();
+ HDprintf(" Probably the file system doesn't support Direct I/O\n");
+ return 0;
+ }
+
/* Retrieve the access property list... */
if ((access_fapl = H5Fget_access_plist(file)) < 0)
TEST_ERROR;
/* Check that the driver is correct */
- if(H5FD_CORE != H5Pget_driver(access_fapl))
- TEST_ERROR;
-
- /* Check that the backing store write tracking info was saved */
- if(H5Pget_core_write_tracking(fapl, &use_write_tracking, &write_tracking_page_size) < 0)
- TEST_ERROR;
- if(TRUE != use_write_tracking)
- TEST_ERROR;
- if(CORE_PAGE_SIZE != write_tracking_page_size)
+ if (H5FD_DIRECT != H5Pget_driver(access_fapl))
TEST_ERROR;
/* ...and close the property list */
if (H5Pclose(access_fapl) < 0)
TEST_ERROR;
- if(H5Fget_vfd_handle(file, H5P_DEFAULT, &fhandle) < 0)
+ /* Check file handle API */
+ if (H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0)
+ TEST_ERROR;
+ if (*fhandle < 0)
TEST_ERROR;
- if(fhandle==NULL)
- {
- printf("fhandle==NULL\n");
- TEST_ERROR;
- }
/* Check file size API */
- if(H5Fget_filesize(file, &file_size) < 0)
+ if (H5Fget_filesize(file, &file_size) < 0)
TEST_ERROR;
- /* There is no garantee the size of metadata in file is constant.
- * Just try to check if it's reasonable. Why is this 4KB?
+ /* There is no guarantee of the number of metadata allocations, but it's
+ * 4 currently and the size of the file should be between 3 & 4 file buffer
+ * sizes..
*/
- if(file_size<2*KB || file_size>6*KB)
- TEST_ERROR;
-
- if(H5Fclose(file) < 0)
- TEST_ERROR;
-
-
- /* Open the file with backing store off for read and write.
- * Changes won't be saved in file. */
- if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, FALSE) < 0)
- TEST_ERROR;
-
- if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if (file_size < (FBSIZE * 3) || file_size >= (FBSIZE * 4))
TEST_ERROR;
- /* Allocate memory for data set. */
- if(NULL == (points = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
+ /* Allocate aligned memory for data set 1. For data set 1, everything is aligned including
+ * memory address, size of data, and file address. */
+ if (0 != HDposix_memalign(&points, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
TEST_ERROR;
- if(NULL == (check = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
+ if (0 != HDposix_memalign(&check, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
TEST_ERROR;
/* Initialize the dset1 */
p1 = points;
- for(i = n = 0; i < DSET1_DIM1; i++)
- for(j = 0; j < DSET1_DIM2; j++)
+ for (i = n = 0; i < DSET1_DIM1; i++)
+ for (j = 0; j < DSET1_DIM2; j++)
*p1++ = n++;
/* Create the data space1 */
dims1[0] = DSET1_DIM1;
dims1[1] = DSET1_DIM2;
- if((space1 = H5Screate_simple(2, dims1, NULL)) < 0)
+ if ((space1 = H5Screate_simple(2, dims1, NULL)) < 0)
TEST_ERROR;
/* Create the dset1 */
- if((dset1 = H5Dcreate2(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dset1 =
+ H5Dcreate2(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Write the data to the dset1 */
- if(H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
+ if (H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
TEST_ERROR;
- if(H5Dclose(dset1) < 0)
+ if (H5Dclose(dset1) < 0)
TEST_ERROR;
- if((dset1 = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0)
+ if ((dset1 = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Read the data back from dset1 */
- if(H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0)
+ if (H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
p1 = points;
p2 = check;
- for(i = 0; i < DSET1_DIM1; i++)
- for(j = 0; j < DSET1_DIM2; j++)
- if(*p1++ != *p2++) {
+ for (i = 0; i < DSET1_DIM1; i++)
+ for (j = 0; j < DSET1_DIM2; j++)
+ if (*p1++ != *p2++) {
H5_FAILED();
- printf(" Read different values than written in data set 1.\n");
- printf(" At index %d,%d\n", i, j);
+ HDprintf(" Read different values than written in data set 1.\n");
+ HDprintf(" At index %d,%d\n", i, j);
TEST_ERROR;
} /* end if */
- if(H5Dclose(dset1) < 0)
- TEST_ERROR;
-
- if(H5Fclose(file) < 0)
- TEST_ERROR;
-
- /* Open the file with backing store on for read and write.
- * Changes will be saved in file. */
- if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE) < 0)
- TEST_ERROR;
-
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ /* Create the data space2. For data set 2, memory address and data size are not aligned. */
+ dims2[0] = DSET2_DIM;
+ if ((space2 = H5Screate_simple(1, dims2, NULL)) < 0)
TEST_ERROR;
- /* Create the dset1 */
- if((dset1 = H5Dcreate2(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ /* Create the dset2 */
+ if ((dset2 =
+ H5Dcreate2(file, DSET2_NAME, H5T_NATIVE_INT, space2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Write the data to the dset1 */
- if(H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
+ if (H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2) < 0)
TEST_ERROR;
- if(H5Dclose(dset1) < 0)
+ if (H5Dclose(dset2) < 0)
TEST_ERROR;
- if((dset1 = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0)
- TEST_ERROR;
-
- /* Reallocate memory for reading buffer. */
- HDassert(check);
- HDfree(check);
- if(NULL == (check = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
+ if ((dset2 = H5Dopen2(file, DSET2_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Read the data back from dset1 */
- if(H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0)
+ if (H5Dread(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata2) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
- p1 = points;
- p2 = check;
- for(i = 0; i < DSET1_DIM1; i++)
- for(j = 0; j < DSET1_DIM2; j++)
- if(*p1++ != *p2++) {
- H5_FAILED();
- printf(" Read different values than written in data set 1.\n");
- printf(" At index %d,%d\n", i, j);
- TEST_ERROR;
- } /* end if */
+ for (i = 0; i < DSET2_DIM; i++)
+ if (wdata2[i] != rdata2[i]) {
+ H5_FAILED();
+ HDprintf(" Read different values than written in data set 2.\n");
+ HDprintf(" At index %d\n", i);
+ TEST_ERROR;
+ } /* end if */
- /* Check file size API */
- if(H5Fget_filesize(file, &file_size) < 0)
+ if (H5Sclose(space1) < 0)
TEST_ERROR;
-
- /* There is no garantee the size of metadata in file is constant.
- * Just try to check if it's reasonable. */
- if(file_size<64*KB || file_size>256*KB)
+ if (H5Dclose(dset1) < 0)
TEST_ERROR;
-
- if(H5Sclose(space1) < 0)
+ if (H5Sclose(space2) < 0)
TEST_ERROR;
- if(H5Dclose(dset1) < 0)
+ if (H5Dclose(dset2) < 0)
TEST_ERROR;
- HDassert(points);
+
HDfree(points);
- HDassert(check);
HDfree(check);
/* Close and delete the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR;
h5_delete_test_file(FILENAME[5], fapl);
/* Close the fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR;
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
+ H5Sclose(space1);
+ H5Dclose(dset1);
+ H5Sclose(space2);
+ H5Dclose(dset2);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- if(points)
+ if (points)
HDfree(points);
- if(check)
+ if (check)
HDfree(check);
return -1;
+#endif /*H5_HAVE_DIRECT*/
}
-
/*-------------------------------------------------------------------------
* Function: test_family_opens
*
@@ -611,55 +779,58 @@ error:
*
*-------------------------------------------------------------------------
*/
+/* Disable warning for "format not a string literal" here -QAK */
+/*
+ * This pragma only needs to surround the snprintf() calls with
+ * 'first_name' 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")
static herr_t
test_family_opens(char *fname, hid_t fa_pl)
{
- hid_t file=-1;
- char first_name[1024];
- char wrong_name[1024];
- int i;
+ hid_t file = -1;
+ char first_name[1024];
+ char wrong_name[1024];
+ int i;
/* Case 1: reopen file with 1st member file name and default property list */
HDsnprintf(first_name, sizeof(first_name), fname, 0);
- H5E_BEGIN_TRY {
- file = H5Fopen(first_name, H5F_ACC_RDWR, H5P_DEFAULT);
- } H5E_END_TRY;
- if(file >= 0)
+ H5E_BEGIN_TRY { file = H5Fopen(first_name, H5F_ACC_RDWR, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (file >= 0)
TEST_ERROR
/* Case 2: reopen file with correct name template but default property list */
- H5E_BEGIN_TRY {
- file = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT);
- } H5E_END_TRY;
- if(file >= 0)
+ H5E_BEGIN_TRY { file = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (file >= 0)
TEST_ERROR
/* Case 3: reopen file with wrong member size */
- if(H5Pset_fapl_family(fa_pl, (hsize_t)128, H5P_DEFAULT) < 0)
+ if (H5Pset_fapl_family(fa_pl, (hsize_t)128, H5P_DEFAULT) < 0)
TEST_ERROR;
- H5E_BEGIN_TRY {
- file = H5Fopen(fname, H5F_ACC_RDWR, fa_pl);
- } H5E_END_TRY;
- if(file >= 0)
+ H5E_BEGIN_TRY { file = H5Fopen(fname, H5F_ACC_RDWR, fa_pl); }
+ H5E_END_TRY;
+ if (file >= 0)
TEST_ERROR
/* Case 4: reopen file with wrong name template */
HDstrcpy(wrong_name, fname);
- for(i = 0; i < 1024; i++)
- if(wrong_name[i] == '5') {
+ for (i = 0; i < 1024; i++)
+ if (wrong_name[i] == '5') {
wrong_name[i] = '4';
break;
}
- if(H5Pset_fapl_family(fa_pl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0)
+ if (H5Pset_fapl_family(fa_pl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0)
TEST_ERROR;
- H5E_BEGIN_TRY {
- file = H5Fopen(wrong_name, H5F_ACC_RDWR, fa_pl);
- } H5E_END_TRY;
- if(file >= 0)
+ H5E_BEGIN_TRY { file = H5Fopen(wrong_name, H5F_ACC_RDWR, fa_pl); }
+ H5E_END_TRY;
+ if (file >= 0)
TEST_ERROR
return 0;
@@ -667,8 +838,8 @@ test_family_opens(char *fname, hid_t fa_pl)
error:
return -1;
} /* end test_family_opens() */
+H5_GCC_DIAG_ON("format-nonliteral")
-
/*-------------------------------------------------------------------------
* Function: test_family
*
@@ -685,53 +856,73 @@ error:
static herr_t
test_family(void)
{
- hid_t file=-1, fapl=-1, fapl2=-1, space=-1, dset=-1;
- hid_t access_fapl = -1;
- char filename[1024];
- char dname[]="dataset";
- unsigned int i, j;
- int *fhandle=NULL, *fhandle2=NULL;
- int buf[FAMILY_NUMBER][FAMILY_SIZE];
- hsize_t dims[2]={FAMILY_NUMBER, FAMILY_SIZE};
- hsize_t file_size;
+ hid_t file = -1, fapl = -1, fapl2 = -1, space = -1, dset = -1;
+ hid_t access_fapl = -1;
+ hid_t driver_id = -1; /* ID for this VFD */
+ unsigned long driver_flags = 0; /* VFD feature flags */
+ char filename[1024];
+ char dname[] = "dataset";
+ unsigned int i, j;
+ int * fhandle = NULL, *fhandle2 = NULL;
+ int buf[FAMILY_NUMBER][FAMILY_SIZE];
+ hsize_t dims[2] = {FAMILY_NUMBER, FAMILY_SIZE};
+ hsize_t file_size;
TESTING("FAMILY file driver");
/* Set property list and file name for FAMILY driver */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
- if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0)
+ if (H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0)
TEST_ERROR;
h5_fixname(FILENAME[2], fapl, filename, sizeof(filename));
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ /* Check that the VFD feature flags are correct */
+ if ((driver_id = H5Pget_driver(fapl)) < 0)
+ TEST_ERROR
+ if (H5FDdriver_query(driver_id, &driver_flags) < 0)
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_AGGREGATE_METADATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_ACCUMULATE_METADATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_DATA_SIEVE))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA))
+ TEST_ERROR
+ /* Check for extra flags not accounted for above */
+ if (driver_flags != (H5FD_FEAT_AGGREGATE_METADATA | H5FD_FEAT_ACCUMULATE_METADATA | H5FD_FEAT_DATA_SIEVE |
+ H5FD_FEAT_AGGREGATE_SMALLDATA))
+ TEST_ERROR
+
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR;
/* Test different wrong ways to reopen family files where there's only
* one member file existing. */
- if(test_family_opens(filename, fapl) < 0)
+ if (test_family_opens(filename, fapl) < 0)
TEST_ERROR;
/* Reopen the file with default member file size */
- if(H5Pset_fapl_family(fapl, (hsize_t)H5F_FAMILY_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Pset_fapl_family(fapl, (hsize_t)H5F_FAMILY_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR;
- if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
/* Check file size API */
- if(H5Fget_filesize(file, &file_size) < 0)
+ if (H5Fget_filesize(file, &file_size) < 0)
TEST_ERROR;
/* The file size is supposed to be about 800 bytes right now. */
- if(file_size < (KB / 2) || file_size > KB)
+ if (file_size < (KB / 2) || file_size > KB)
TEST_ERROR;
/* Create and write dataset */
- if((space=H5Screate_simple(2, dims, NULL)) < 0)
+ if ((space = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR;
/* Retrieve the access property list... */
@@ -739,100 +930,101 @@ test_family(void)
TEST_ERROR;
/* Check that the driver is correct */
- if(H5FD_FAMILY != H5Pget_driver(access_fapl))
+ if (H5FD_FAMILY != H5Pget_driver(access_fapl))
TEST_ERROR;
/* ...and close the property list */
if (H5Pclose(access_fapl) < 0)
TEST_ERROR;
- if((dset=H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
- for(i = 0; i < FAMILY_NUMBER; i++)
- for(j = 0; j < FAMILY_SIZE; j++)
+ for (i = 0; i < FAMILY_NUMBER; i++)
+ for (j = 0; j < FAMILY_SIZE; j++)
buf[i][j] = (int)((i * 10000) + j);
- if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
TEST_ERROR;
/* check file handle API */
- if((fapl2 = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl2 = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
- if(H5Pset_family_offset(fapl2, (hsize_t)0) < 0)
+ if (H5Pset_family_offset(fapl2, (hsize_t)0) < 0)
TEST_ERROR;
- if(H5Fget_vfd_handle(file, fapl2, (void **)&fhandle) < 0)
+ if (H5Fget_vfd_handle(file, fapl2, (void **)&fhandle) < 0)
TEST_ERROR;
- if(*fhandle < 0)
+ if (*fhandle < 0)
TEST_ERROR;
- if(H5Pset_family_offset(fapl2, (hsize_t)(FAMILY_SIZE*2)) < 0)
+ if (H5Pset_family_offset(fapl2, (hsize_t)(FAMILY_SIZE * 2)) < 0)
TEST_ERROR;
- if(H5Fget_vfd_handle(file, fapl2, (void **)&fhandle2) < 0)
+ if (H5Fget_vfd_handle(file, fapl2, (void **)&fhandle2) < 0)
TEST_ERROR;
- if(*fhandle2 < 0)
+ if (*fhandle2 < 0)
TEST_ERROR;
/* Check file size API */
- if(H5Fget_filesize(file, &file_size) < 0)
+ if (H5Fget_filesize(file, &file_size) < 0)
TEST_ERROR;
- /* Some data has been written. The file size should be bigger (18KB+976)
- * bytes if int size is 4 bytes) now. */
+ /* Some data has been written. The file size should be bigger (18KB+976)
+ * bytes if int size is 4 bytes) now. */
#if H5_SIZEOF_INT <= 4
- if(file_size < (18 * KB) || file_size > (20 * KB))
+ if (file_size < (18 * KB) || file_size > (20 * KB))
TEST_ERROR;
#elif H5_SIZEOF_INT >= 8
- if(file_size < (32 * KB) || file_size > (40 * KB))
+ if (file_size < (32 * KB) || file_size > (40 * KB))
TEST_ERROR;
#endif
- if(H5Sclose(space) < 0)
+ if (H5Sclose(space) < 0)
TEST_ERROR;
- if(H5Dclose(dset) < 0)
+ if (H5Dclose(dset) < 0)
TEST_ERROR;
- if(H5Pclose(fapl2) < 0)
+ if (H5Pclose(fapl2) < 0)
TEST_ERROR;
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR;
/* Test different wrong ways to reopen family files when there're multiple
* member files existing. */
- if(test_family_opens(filename, fapl) < 0)
+ if (test_family_opens(filename, fapl) < 0)
TEST_ERROR;
/* Reopen the file with correct member file size. */
- if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0)
+ if (H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0)
TEST_ERROR;
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
/* Close and delete the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR;
h5_delete_test_file(FILENAME[2], fapl);
/* Close the fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR;
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(space);
H5Dclose(dset);
H5Pclose(fapl);
H5Pclose(fapl2);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: test_family_compat
*
@@ -851,23 +1043,30 @@ error:
*
*-------------------------------------------------------------------------
*/
+/* Disable warning for "format not a string literal" here -QAK */
+/*
+ * This pragma only needs to surround the snprintf() calls with
+ * 'newname_individual', etc. 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")
static herr_t
test_family_compat(void)
{
- hid_t file = -1, fapl = -1;
- hid_t dset = -1;
- char dname[]="dataset";
- char filename[1024];
- char pathname[1024], pathname_individual[1024];
- char newname[1024], newname_individual[1024];
- int counter = 0;
+ hid_t file = -1, fapl = -1;
+ hid_t dset = -1;
+ char dname[] = "dataset";
+ char filename[1024];
+ char pathname[1024], pathname_individual[1024];
+ char newname[1024], newname_individual[1024];
+ int counter = 0;
TESTING("FAMILY file driver backward compatibility");
/* Set property list and file name for FAMILY driver */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
- if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE2, H5P_DEFAULT) < 0)
+ if (H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE2, H5P_DEFAULT) < 0)
TEST_ERROR;
h5_fixname(COMPAT_BASENAME, fapl, filename, sizeof(filename));
@@ -883,7 +1082,7 @@ test_family_compat(void)
HDsnprintf(newname_individual, sizeof(newname_individual), newname, counter);
HDsnprintf(pathname_individual, sizeof(pathname_individual), pathname, counter);
- while(h5_make_local_copy(pathname_individual, newname_individual) >= 0) {
+ while (h5_make_local_copy(pathname_individual, newname_individual) >= 0) {
counter++;
HDsnprintf(newname_individual, sizeof(newname_individual), newname, counter);
HDsnprintf(pathname_individual, sizeof(pathname_individual), pathname, counter);
@@ -891,35 +1090,35 @@ test_family_compat(void)
/* Make sure we can open the file. Use the read and write mode to flush the
* superblock. */
- if((file = H5Fopen(newname, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(newname, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
- if((dset = H5Dopen2(file, dname, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dopen2(file, dname, H5P_DEFAULT)) < 0)
TEST_ERROR;
- if(H5Dclose(dset) < 0)
+ if (H5Dclose(dset) < 0)
TEST_ERROR;
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR;
/* Open the file again to make sure it isn't corrupted. */
- if((file = H5Fopen(newname, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(newname, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
- if((dset = H5Dopen2(file, dname, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dopen2(file, dname, H5P_DEFAULT)) < 0)
TEST_ERROR;
- if(H5Dclose(dset) < 0)
+ if (H5Dclose(dset) < 0)
TEST_ERROR;
/* Close and delete the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR;
h5_delete_test_file(FILENAME[3], fapl);
/* Close the fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR;
PASSED();
@@ -927,55 +1126,61 @@ test_family_compat(void)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(file);
H5Pclose(fapl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* end test_family_compat() */
+H5_GCC_DIAG_ON("format-nonliteral")
-
/*-------------------------------------------------------------------------
* Function: test_multi_opens
*
* Purpose: Private function for test_multi() to tests wrong ways of
* reopening multi file.
*
- * Return: Success: 0
- * Failure: -1
+ * Return: SUCCEED/FAIL
*
* Programmer: Raymond Lu
* Thursday, May 19, 2005
*
*-------------------------------------------------------------------------
*/
+/* Disable warning for "format not a string literal" here -QAK */
+/*
+ * This pragma only needs to surround the snprintf() calls with
+ * 'sf_name' 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")
static herr_t
test_multi_opens(char *fname)
{
- hid_t file=-1;
- char super_name[1024]; /*name string "%%s-s.h5"*/
- char sf_name[1024]; /*name string "multi_file-s.h5"*/
+ hid_t fid = H5I_INVALID_HID;
+ char super_name[1024]; /*name string "%%s-s.h5"*/
+ char sf_name[1024]; /*name string "multi_file-s.h5"*/
/* Case: reopen with the name of super file and default property list */
HDsnprintf(super_name, sizeof(super_name), "%%s-%c.h5", 's');
HDsnprintf(sf_name, sizeof(sf_name), super_name, fname);
- H5E_BEGIN_TRY {
- file = H5Fopen(sf_name, H5F_ACC_RDWR, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { fid = H5Fopen(sf_name, H5F_ACC_RDWR, H5P_DEFAULT); }
+ H5E_END_TRY;
- return(file >= 0 ? -1 : 0);
-}
+ return (fid >= 0 ? FAIL : SUCCEED);
+} /* end test_multi_opens() */
+H5_GCC_DIAG_ON("format-nonliteral")
-
/*-------------------------------------------------------------------------
* Function: test_multi
*
* Purpose: Tests the file handle interface for MUTLI driver
*
- * Return: Success: 0
- * Failure: -1
+ * Return: SUCCEED/FAIL
*
* Programmer: Raymond Lu
* Tuesday, Sept 24, 2002
@@ -985,82 +1190,95 @@ test_multi_opens(char *fname)
static herr_t
test_multi(void)
{
- hid_t file=-1, fapl=-1, fapl2=-1, dset=-1, space=-1;
- hid_t root=-1, attr=-1, aspace=-1, atype=-1;
- hid_t access_fapl = -1;
- char filename[1024];
- int *fhandle2=NULL, *fhandle=NULL;
- hsize_t file_size;
- H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES];
- hid_t memb_fapl[H5FD_MEM_NTYPES];
- haddr_t memb_addr[H5FD_MEM_NTYPES];
- const char *memb_name[H5FD_MEM_NTYPES];
- char sv[H5FD_MEM_NTYPES][32];
- hsize_t dims[2]={MULTI_SIZE, MULTI_SIZE};
- hsize_t adims[1]={1};
- char dname[]="dataset";
- char meta[] = "this is some metadata on this file";
- int i, j;
- int buf[MULTI_SIZE][MULTI_SIZE];
+ hid_t file = -1, fapl = -1, fapl2 = -1, dset = -1, space = -1;
+ hid_t root = -1, attr = -1, aspace = -1, atype = -1;
+ hid_t access_fapl = -1;
+ hid_t driver_id = -1; /* ID for this VFD */
+ unsigned long driver_flags = 0; /* VFD feature flags */
+ char filename[1024];
+ int * fhandle2 = NULL, *fhandle = NULL;
+ hsize_t file_size;
+ H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES];
+ hid_t memb_fapl[H5FD_MEM_NTYPES];
+ haddr_t memb_addr[H5FD_MEM_NTYPES];
+ const char * memb_name[H5FD_MEM_NTYPES];
+ char sv[H5FD_MEM_NTYPES][32];
+ hsize_t dims[2] = {MULTI_SIZE, MULTI_SIZE};
+ hsize_t adims[1] = {1};
+ char dname[] = "dataset";
+ char meta[] = "this is some metadata on this file";
+ int i, j;
+ int buf[MULTI_SIZE][MULTI_SIZE];
TESTING("MULTI file driver");
/* Set file access property list for MULTI driver */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
- HDmemset(memb_map, 0, sizeof(memb_map));
+ 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(sv, 0, sizeof(sv));
- 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)) {
memb_fapl[mt] = H5P_DEFAULT;
- memb_map[mt] = H5FD_MEM_SUPER;
+ memb_map[mt] = H5FD_MEM_SUPER;
}
- memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW;
+ memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW;
memb_map[H5FD_MEM_BTREE] = H5FD_MEM_BTREE;
memb_map[H5FD_MEM_GHEAP] = H5FD_MEM_GHEAP;
- sprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's');
+ HDsprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's');
memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER];
memb_addr[H5FD_MEM_SUPER] = 0;
- sprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b');
+ HDsprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b');
memb_name[H5FD_MEM_BTREE] = sv[H5FD_MEM_BTREE];
- memb_addr[H5FD_MEM_BTREE] = HADDR_MAX/4;
+ memb_addr[H5FD_MEM_BTREE] = HADDR_MAX / 4;
- sprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r');
+ HDsprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r');
memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW];
- memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/2;
+ memb_addr[H5FD_MEM_DRAW] = HADDR_MAX / 2;
- sprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g');
+ HDsprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g');
memb_name[H5FD_MEM_GHEAP] = sv[H5FD_MEM_GHEAP];
- memb_addr[H5FD_MEM_GHEAP] = (HADDR_MAX/4)*3;
+ memb_addr[H5FD_MEM_GHEAP] = (HADDR_MAX / 4) * 3;
-
- if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE) < 0)
+ if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE) < 0)
TEST_ERROR;
h5_fixname(FILENAME[4], fapl, filename, sizeof filename);
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- TEST_ERROR;
+ /* Check that the VFD feature flags are correct */
+ if ((driver_id = H5Pget_driver(fapl)) < 0)
+ TEST_ERROR
+ if (H5FDdriver_query(driver_id, &driver_flags) < 0)
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_DATA_SIEVE))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA))
+ TEST_ERROR
+ /* Check for extra flags not accounted for above */
+ if (driver_flags != (H5FD_FEAT_DATA_SIEVE | H5FD_FEAT_AGGREGATE_SMALLDATA))
+ TEST_ERROR
- if(H5Fclose(file) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
+ if (H5Fclose(file) < 0)
+ TEST_ERROR;
/* Test wrong ways to reopen multi files */
- if(test_multi_opens(filename) < 0)
+ if (test_multi_opens(filename) < 0)
TEST_ERROR;
/* Reopen the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
/* Create and write data set */
- if((space = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((space = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR;
/* Retrieve the access property list... */
@@ -1068,7 +1286,7 @@ test_multi(void)
TEST_ERROR;
/* Check that the driver is correct */
- if(H5FD_MULTI != H5Pget_driver(access_fapl))
+ if (H5FD_MULTI != H5Pget_driver(access_fapl))
TEST_ERROR;
/* ...and close the property list */
@@ -1076,122 +1294,124 @@ test_multi(void)
TEST_ERROR;
/* Check file size API */
- if(H5Fget_filesize(file, &file_size) < 0)
+ if (H5Fget_filesize(file, &file_size) < 0)
TEST_ERROR;
/* Before any data is written, the raw data file is empty. So
* the file size is only the size of b-tree + HADDR_MAX/4.
*/
- if(file_size < HADDR_MAX/4 || file_size > HADDR_MAX/2)
+ if (file_size < HADDR_MAX / 4 || file_size > HADDR_MAX / 2)
TEST_ERROR;
- if((dset=H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
- for(i=0; i<MULTI_SIZE; i++)
- for(j=0; j<MULTI_SIZE; j++)
- buf[i][j] = i*10000+j;
- if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ for (i = 0; i < MULTI_SIZE; i++)
+ for (j = 0; j < MULTI_SIZE; j++)
+ buf[i][j] = i * 10000 + j;
+ if (H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
TEST_ERROR;
- if((fapl2=H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl2 = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
- if(H5Pset_multi_type(fapl2, H5FD_MEM_SUPER) < 0)
+ if (H5Pset_multi_type(fapl2, H5FD_MEM_SUPER) < 0)
TEST_ERROR;
- if(H5Fget_vfd_handle(file, fapl2, (void **)&fhandle) < 0)
+ if (H5Fget_vfd_handle(file, fapl2, (void **)&fhandle) < 0)
TEST_ERROR;
- if(*fhandle<0)
+ if (*fhandle < 0)
TEST_ERROR;
- if(H5Pset_multi_type(fapl2, H5FD_MEM_DRAW) < 0)
+ if (H5Pset_multi_type(fapl2, H5FD_MEM_DRAW) < 0)
TEST_ERROR;
- if(H5Fget_vfd_handle(file, fapl2, (void **)&fhandle2) < 0)
+ if (H5Fget_vfd_handle(file, fapl2, (void **)&fhandle2) < 0)
TEST_ERROR;
- if(*fhandle2<0)
+ if (*fhandle2 < 0)
TEST_ERROR;
/* Check file size API */
- if(H5Fget_filesize(file, &file_size) < 0)
+ if (H5Fget_filesize(file, &file_size) < 0)
TEST_ERROR;
/* After the data is written, the file size is huge because the
* beginning of raw data file is set at HADDR_MAX/2. It's supposed
* to be (HADDR_MAX/2 + 128*128*4)
*/
- if(file_size < HADDR_MAX/2 || file_size > HADDR_MAX)
+ if (file_size < HADDR_MAX / 2 || file_size > HADDR_MAX)
TEST_ERROR;
- if(H5Sclose(space) < 0)
+ if (H5Sclose(space) < 0)
TEST_ERROR;
- if(H5Dclose(dset) < 0)
+ if (H5Dclose(dset) < 0)
TEST_ERROR;
- if(H5Pclose(fapl2) < 0)
+ if (H5Pclose(fapl2) < 0)
TEST_ERROR;
/* Create and write attribute for the root group. */
- if((root = H5Gopen2(file, "/", H5P_DEFAULT)) < 0)
+ if ((root = H5Gopen2(file, "/", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Attribute string. */
- if((atype = H5Tcopy(H5T_C_S1)) < 0)
+ if ((atype = H5Tcopy(H5T_C_S1)) < 0)
TEST_ERROR;
- if(H5Tset_size(atype, strlen(meta) + 1) < 0)
+ if (H5Tset_size(atype, HDstrlen(meta) + 1) < 0)
TEST_ERROR;
- if(H5Tset_strpad(atype, H5T_STR_NULLTERM) < 0)
+ if (H5Tset_strpad(atype, H5T_STR_NULLTERM) < 0)
TEST_ERROR;
/* Create and write attribute */
- if((aspace = H5Screate_simple(1, adims, NULL)) < 0)
+ if ((aspace = H5Screate_simple(1, adims, NULL)) < 0)
TEST_ERROR;
- if((attr = H5Acreate2(root, "Metadata", atype, aspace, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((attr = H5Acreate2(root, "Metadata", atype, aspace, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
- if(H5Awrite(attr, atype, meta) < 0)
+ if (H5Awrite(attr, atype, meta) < 0)
TEST_ERROR;
/* Close IDs */
- if(H5Tclose(atype) < 0)
+ if (H5Tclose(atype) < 0)
TEST_ERROR;
- if(H5Sclose(aspace) < 0)
+ if (H5Sclose(aspace) < 0)
TEST_ERROR;
- if(H5Aclose(attr) < 0)
+ if (H5Aclose(attr) < 0)
TEST_ERROR;
/* Close and delete the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR;
h5_delete_test_file(FILENAME[4], fapl);
/* Close the fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR;
PASSED();
- return 0;
+ return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(space);
H5Dclose(dset);
H5Pclose(fapl);
H5Pclose(fapl2);
H5Fclose(file);
- } H5E_END_TRY;
- return -1;
-}
+ H5Aclose(attr);
+ }
+ H5E_END_TRY;
+ return FAIL;
+} /* end test_multi() */
-
/*-------------------------------------------------------------------------
* Function: test_multi_compat
*
* Purpose: Tests the backward compatibility for MULTI driver.
* See if we can open files created with v1.6 library.
* The source file was created by the test/file_handle.c
- * of the v1.6 library. This test verifies the fix for
+ * of the v1.6 library. This test verifies the fix for
* Issue 2598. In v1.6 library, there was EOA for the whole
* MULTI file saved in the super block. We took it out in
* v1.8 library because it's meaningless for the MULTI file.
@@ -1208,138 +1428,141 @@ error:
static herr_t
test_multi_compat(void)
{
- hid_t file=-1, fapl=-1, dset=-1, space=-1;
+ hid_t file = -1, fapl = -1, dset = -1, space = -1;
char newname[1024];
char filename_s[1024], newname_s[1024];
char filename_r[1024], newname_r[1024];
H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES];
hid_t memb_fapl[H5FD_MEM_NTYPES];
haddr_t memb_addr[H5FD_MEM_NTYPES];
- const char *memb_name[H5FD_MEM_NTYPES];
+ const char *memb_name[H5FD_MEM_NTYPES];
char sv[H5FD_MEM_NTYPES][32];
- hsize_t dims[2]={MULTI_SIZE, MULTI_SIZE};
+ hsize_t dims[2] = {MULTI_SIZE, MULTI_SIZE};
int i, j;
int buf[MULTI_SIZE][MULTI_SIZE];
TESTING("MULTI file driver backward compatibility");
/* Set file access property list for MULTI driver */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
- HDmemset(memb_map, 0, sizeof memb_map);
+ 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(sv, 0, sizeof sv);
- 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))
memb_map[mt] = H5FD_MEM_SUPER;
memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW;
memb_fapl[H5FD_MEM_SUPER] = H5P_DEFAULT;
- sprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's');
+ HDsprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's');
memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER];
memb_addr[H5FD_MEM_SUPER] = 0;
memb_fapl[H5FD_MEM_DRAW] = H5P_DEFAULT;
- sprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r');
+ HDsprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r');
memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW];
- memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/2;
+ memb_addr[H5FD_MEM_DRAW] = HADDR_MAX / 2;
- if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE)<0)
+ if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE) < 0)
TEST_ERROR;
h5_fixname(FILENAME[9], fapl, newname, sizeof newname);
- /* Make copy for the data file in the build directory, to protect the
- * original file in the source directory */
- sprintf(filename_s, "%s-%c.h5", MULTI_COMPAT_BASENAME, 's');
- sprintf(newname_s, "%s-%c.h5", FILENAME[9], 's');
+ /* Make copy for the data file in the build directory, to protect the
+ * original file in the source directory
+ */
+ HDsprintf(filename_s, "%s-%c.h5", MULTI_COMPAT_BASENAME, 's');
+ HDsprintf(newname_s, "%s-%c.h5", FILENAME[9], 's');
h5_make_local_copy(filename_s, newname_s);
- sprintf(filename_r, "%s-%c.h5", MULTI_COMPAT_BASENAME, 'r');
- sprintf(newname_r, "%s-%c.h5", FILENAME[9], 'r');
+ HDsprintf(filename_r, "%s-%c.h5", MULTI_COMPAT_BASENAME, 'r');
+ HDsprintf(newname_r, "%s-%c.h5", FILENAME[9], 'r');
h5_make_local_copy(filename_r, newname_r);
/* Reopen the file for read only. Verify 1.8 library can open file
- * created with 1.6 library. */
- if((file=H5Fopen(newname, H5F_ACC_RDONLY, fapl)) < 0)
+ * created with 1.6 library.
+ */
+ if ((file = H5Fopen(newname, H5F_ACC_RDONLY, fapl)) < 0)
TEST_ERROR;
- if((dset = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR;
- if(H5Dclose(dset) < 0)
+ if (H5Dclose(dset) < 0)
TEST_ERROR;
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR;
/* Make sure we can reopen the file for read and write */
- if((file=H5Fopen(newname, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(newname, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
- if((dset = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR;
- if(H5Dclose(dset) < 0)
+ if (H5Dclose(dset) < 0)
TEST_ERROR;
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR;
- /* Reopen the file for adding another dataset. The new EOA for metadata file
+ /* Reopen the file for adding another dataset. The new EOA for metadata file
* should be written to the file */
- if((file=H5Fopen(newname, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(newname, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
/* Create and write data set */
- if((space=H5Screate_simple(2, dims, NULL)) < 0)
+ if ((space = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR;
- if((dset=H5Dcreate2(file, DSET3_NAME, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dcreate2(file, DSET3_NAME, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
TEST_ERROR;
- for(i=0; i<MULTI_SIZE; i++)
- for(j=0; j<MULTI_SIZE; j++)
- buf[i][j] = i*10000+j;
- if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ for (i = 0; i < MULTI_SIZE; i++)
+ for (j = 0; j < MULTI_SIZE; j++)
+ buf[i][j] = i * 10000 + j;
+ if (H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
TEST_ERROR;
- if(H5Dclose(dset) < 0)
+ if (H5Dclose(dset) < 0)
TEST_ERROR;
- if(H5Sclose(space) < 0)
+ if (H5Sclose(space) < 0)
TEST_ERROR;
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR;
- /* Reopen the file for read only again. Verify the library can handle
+ /* Reopen the file for read only again. Verify the library can handle
* the EOA correctly */
- if((file=H5Fopen(newname, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((file = H5Fopen(newname, H5F_ACC_RDONLY, fapl)) < 0)
TEST_ERROR;
- if((dset = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR;
- if(H5Dclose(dset) < 0)
+ if (H5Dclose(dset) < 0)
TEST_ERROR;
- if((dset = H5Dopen2(file, DSET3_NAME, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dopen2(file, DSET3_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR;
- if(H5Dclose(dset) < 0)
+ if (H5Dclose(dset) < 0)
TEST_ERROR;
/* Close and delete the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR;
h5_delete_test_file(FILENAME[9], fapl);
/* Close the fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR;
PASSED();
@@ -1347,16 +1570,17 @@ test_multi_compat(void)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(space);
H5Dclose(dset);
H5Pclose(fapl);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: test_log
*
@@ -1373,77 +1597,100 @@ error:
static herr_t
test_log(void)
{
- hid_t file = -1;
- hid_t fapl = -1;
- hid_t access_fapl = -1;
- char filename[1024];
- int *fhandle = NULL;
- hsize_t file_size = 0;
- unsigned int flags = H5FD_LOG_ALL;
- size_t buf_size = 4 * KB;
+ hid_t file = -1;
+ hid_t fapl = -1;
+ hid_t access_fapl = -1;
+ hid_t driver_id = -1; /* ID for this VFD */
+ unsigned long driver_flags = 0; /* VFD feature flags */
+ char filename[1024];
+ int * fhandle = NULL;
+ hsize_t file_size = 0;
+ unsigned int flags = H5FD_LOG_ALL;
+ size_t buf_size = 4 * KB;
TESTING("LOG file driver");
/* Set property list and file name for log driver. */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
- if(H5Pset_fapl_log(fapl, LOG_FILENAME, flags, buf_size) < 0)
+ if (H5Pset_fapl_log(fapl, LOG_FILENAME, flags, buf_size) < 0)
TEST_ERROR;
h5_fixname(FILENAME[6], fapl, filename, sizeof filename);
+ /* Check that the VFD feature flags are correct */
+ if ((driver_id = H5Pget_driver(fapl)) < 0)
+ TEST_ERROR
+ if (H5FDdriver_query(driver_id, &driver_flags) < 0)
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_AGGREGATE_METADATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_ACCUMULATE_METADATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_DATA_SIEVE))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_POSIX_COMPAT_HANDLE))
+ TEST_ERROR
+ /* Check for extra flags not accounted for above */
+ if (driver_flags != (H5FD_FEAT_AGGREGATE_METADATA | H5FD_FEAT_ACCUMULATE_METADATA | H5FD_FEAT_DATA_SIEVE |
+ H5FD_FEAT_AGGREGATE_SMALLDATA | H5FD_FEAT_POSIX_COMPAT_HANDLE))
+ TEST_ERROR
+
/* Create the test file */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
/* Retrieve the access property list... */
- if((access_fapl = H5Fget_access_plist(file)) < 0)
+ if ((access_fapl = H5Fget_access_plist(file)) < 0)
TEST_ERROR;
/* Check that the driver is correct */
- if(H5FD_LOG != H5Pget_driver(access_fapl))
+ if (H5FD_LOG != H5Pget_driver(access_fapl))
TEST_ERROR;
/* ...and close the property list */
- if(H5Pclose(access_fapl) < 0)
+ if (H5Pclose(access_fapl) < 0)
TEST_ERROR;
/* Check file handle API */
- if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0)
+ if (H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0)
TEST_ERROR;
- if(*fhandle < 0)
+ if (*fhandle < 0)
TEST_ERROR;
/* Check file size API */
- if(H5Fget_filesize(file, &file_size) < 0)
+ if (H5Fget_filesize(file, &file_size) < 0)
TEST_ERROR;
/* There is no guarantee the size of metadata in file is constant.
* Just try to check if it's reasonable. It's 2KB right now.
*/
- if(file_size < 1 * KB || file_size > 4 * KB)
+ if (file_size < 1 * KB || file_size > 4 * KB)
TEST_ERROR;
/* Close and delete the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR;
h5_delete_test_file(FILENAME[6], fapl);
/* Close the fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR;
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: test_stdio
*
@@ -1460,75 +1707,95 @@ error:
static herr_t
test_stdio(void)
{
- hid_t file = -1;
- hid_t fapl = -1;
- hid_t access_fapl = -1;
- char filename[1024];
- FILE *fhandle = NULL;
- hsize_t file_size = 0;
+ hid_t file = -1;
+ hid_t fapl = -1;
+ hid_t access_fapl = -1;
+ hid_t driver_id = -1; /* ID for this VFD */
+ unsigned long driver_flags = 0; /* VFD feature flags */
+ char filename[1024];
+ FILE * fhandle = NULL;
+ hsize_t file_size = 0;
TESTING("STDIO file driver");
/* Set property list and file name for STDIO driver. */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
- if(H5Pset_fapl_stdio(fapl) < 0)
+ if (H5Pset_fapl_stdio(fapl) < 0)
TEST_ERROR;
h5_fixname(FILENAME[7], fapl, filename, sizeof filename);
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ /* Check that the VFD feature flags are correct */
+ if ((driver_id = H5Pget_driver(fapl)) < 0)
+ TEST_ERROR
+ if (H5FDdriver_query(driver_id, &driver_flags) < 0)
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_AGGREGATE_METADATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_ACCUMULATE_METADATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_DATA_SIEVE))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA))
+ TEST_ERROR
+ /* Check for extra flags not accounted for above */
+ if (driver_flags != (H5FD_FEAT_AGGREGATE_METADATA | H5FD_FEAT_ACCUMULATE_METADATA | H5FD_FEAT_DATA_SIEVE |
+ H5FD_FEAT_AGGREGATE_SMALLDATA))
+ TEST_ERROR
+
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
/* Retrieve the access property list... */
- if((access_fapl = H5Fget_access_plist(file)) < 0)
+ if ((access_fapl = H5Fget_access_plist(file)) < 0)
TEST_ERROR;
/* Check that the driver is correct */
- if(H5FD_STDIO != H5Pget_driver(access_fapl))
+ if (H5FD_STDIO != H5Pget_driver(access_fapl))
TEST_ERROR;
/* ...and close the property list */
- if(H5Pclose(access_fapl) < 0)
+ if (H5Pclose(access_fapl) < 0)
TEST_ERROR;
/* Check file handle API */
- if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0)
+ if (H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0)
TEST_ERROR;
- if(NULL == fhandle)
+ if (NULL == fhandle)
TEST_ERROR;
/* Check file size API */
- if(H5Fget_filesize(file, &file_size) < 0)
+ if (H5Fget_filesize(file, &file_size) < 0)
TEST_ERROR;
/* There is no guarantee the size of metadata in file is constant.
* Just try to check if it's reasonable. It's 2KB right now.
*/
- if(file_size < 1 * KB || file_size > 4 * KB)
+ if (file_size < 1 * KB || file_size > 4 * KB)
TEST_ERROR;
/* Close and delete the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR;
h5_delete_test_file(FILENAME[7], fapl);
/* Close the fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR;
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
-
/*-------------------------------------------------------------------------
* Function: test_windows
*
@@ -1547,12 +1814,14 @@ test_windows(void)
{
#ifdef H5_HAVE_WINDOWS
- hid_t file = -1;
- hid_t fapl = -1;
- hid_t access_fapl = -1;
- char filename[1024];
- int *fhandle = NULL;
- hsize_t file_size = 0;
+ hid_t file = -1;
+ hid_t fapl = -1;
+ hid_t access_fapl = -1;
+ hid_t driver_id = -1; /* ID for this VFD */
+ unsigned long driver_flags = 0; /* VFD feature flags */
+ char filename[1024];
+ int * fhandle = NULL;
+ hsize_t file_size = 0;
#endif /*H5_HAVE_WINDOWS*/
@@ -1566,67 +1835,186 @@ test_windows(void)
#else /* H5_HAVE_WINDOWS */
/* Set property list and file name for WINDOWS driver. */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
- if(H5Pset_fapl_windows(fapl) < 0)
+ if (H5Pset_fapl_windows(fapl) < 0)
TEST_ERROR;
h5_fixname(FILENAME[8], fapl, filename, sizeof filename);
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ /* Check that the VFD feature flags are correct */
+ if ((driver_id = H5Pget_driver(fapl)) < 0)
+ TEST_ERROR
+ if (H5FDdriver_query(driver_id, &driver_flags) < 0)
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_AGGREGATE_METADATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_ACCUMULATE_METADATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_DATA_SIEVE))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_POSIX_COMPAT_HANDLE))
+ TEST_ERROR
+ /* Check for extra flags not accounted for above */
+ if (driver_flags != (H5FD_FEAT_AGGREGATE_METADATA | H5FD_FEAT_ACCUMULATE_METADATA | H5FD_FEAT_DATA_SIEVE |
+ H5FD_FEAT_AGGREGATE_SMALLDATA | H5FD_FEAT_POSIX_COMPAT_HANDLE))
+ TEST_ERROR
+
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
/* Retrieve the access property list... */
- if((access_fapl = H5Fget_access_plist(file)) < 0)
+ if ((access_fapl = H5Fget_access_plist(file)) < 0)
TEST_ERROR;
/* Check that the driver is correct */
- if(H5FD_WINDOWS!= H5Pget_driver(access_fapl))
+ if (H5FD_WINDOWS != H5Pget_driver(access_fapl))
TEST_ERROR;
/* ...and close the property list */
- if(H5Pclose(access_fapl) < 0)
+ if (H5Pclose(access_fapl) < 0)
TEST_ERROR;
/* Check file handle API */
- if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0)
+ if (H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0)
TEST_ERROR;
- if(*fhandle < 0)
+ if (*fhandle < 0)
TEST_ERROR;
/* Check file size API */
- if(H5Fget_filesize(file, &file_size) < 0)
+ if (H5Fget_filesize(file, &file_size) < 0)
TEST_ERROR;
/* There is no guarantee the size of metadata in file is constant.
* Just try to check if it's reasonable. It's 2KB right now.
*/
- if(file_size < 1 * KB || file_size > 4 * KB)
+ if (file_size < 1 * KB || file_size > 4 * KB)
TEST_ERROR;
- /* Close and delete the file */
- if(H5Fclose(file) < 0)
+ /* Close and delete the file */
+ if (H5Fclose(file) < 0)
TEST_ERROR;
h5_delete_test_file(FILENAME[8], fapl);
/* Close the fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR;
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
#endif /* H5_HAVE_WINDOWS */
-}
+} /* end test_windows() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_ros3
+ *
+ * Purpose: Tests the file handle interface for the ROS3 driver
+ *
+ * As the ROS3 driver is 1) read only, 2) requires access
+ * to an S3 server (minio for now), this test is quite
+ * different from the other tests.
+ *
+ * For now, test only fapl & flags. Extend as the
+ * work on the VFD continues.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: John Mainzer
+ * 7/12/17
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_ros3(void)
+{
+#ifdef H5_HAVE_ROS3_VFD
+ hid_t fid = -1; /* file ID */
+ hid_t fapl_id = -1; /* file access property list ID */
+ hid_t fapl_id_out = -1; /* from H5Fget_access_plist */
+ hid_t driver_id = -1; /* ID for this VFD */
+ unsigned long driver_flags = 0; /* VFD feature flags */
+ char filename[1024]; /* filename */
+ void * os_file_handle = NULL; /* OS file handle */
+ hsize_t file_size; /* file size */
+ H5FD_ros3_fapl_t test_ros3_fa;
+ H5FD_ros3_fapl_t ros3_fa_0 = {
+ /* version = */ H5FD_CURR_ROS3_FAPL_T_VERSION,
+ /* authenticate = */ FALSE,
+ /* aws_region = */ "",
+ /* secret_id = */ "",
+ /* secret_key = */ "plugh",
+ };
+#endif /*H5_HAVE_ROS3_VFD */
+
+ TESTING("Read-only S3 file driver");
+
+#ifndef H5_HAVE_ROS3_VFD
+ SKIPPED();
+ return 0;
+#else /* H5_HAVE_ROS3_VFD */
+
+ /* Set property list and file name for ROS3 driver. */
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
+
+ if (H5Pset_fapl_ros3(fapl_id, &ros3_fa_0) < 0)
+ TEST_ERROR;
+ /* verify that the ROS3 FAPL entry is set as expected */
+ if (H5Pget_fapl_ros3(fapl_id, &test_ros3_fa) < 0)
+ TEST_ERROR;
+
+ /* need a macro to compare instances of H5FD_ros3_fapl_t */
+ if ((test_ros3_fa.version != ros3_fa_0.version) ||
+ (test_ros3_fa.authenticate != ros3_fa_0.authenticate) ||
+ (strcmp(test_ros3_fa.aws_region, ros3_fa_0.aws_region) != 0) ||
+ (strcmp(test_ros3_fa.secret_id, ros3_fa_0.secret_id) != 0) ||
+ (strcmp(test_ros3_fa.secret_key, ros3_fa_0.secret_key) != 0))
+ TEST_ERROR;
+
+ h5_fixname(FILENAME[10], fapl_id, filename, sizeof(filename));
+
+ /* Check that the VFD feature flags are correct */
+ if ((driver_id = H5Pget_driver(fapl_id)) < 0)
+ TEST_ERROR;
+
+ if (H5FDdriver_query(driver_id, &driver_flags) < 0)
+ TEST_ERROR;
+
+ if (!(driver_flags & H5FD_FEAT_DATA_SIEVE))
+ TEST_ERROR
+
+ /* Check for extra flags not accounted for above */
+ if (driver_flags != (H5FD_FEAT_DATA_SIEVE))
+ TEST_ERROR
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(fapl_id);
+ H5Pclose(fapl_id_out);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
+ return -1;
+#endif /* H5_HAVE_ROS3_VFD */
+} /* end test_ros3() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -1647,26 +2035,26 @@ main(void)
h5_reset();
- printf("Testing basic Virtual File Driver functionality.\n");
-
- nerrors += test_sec2() < 0 ? 1 : 0;
- nerrors += test_core() < 0 ? 1 : 0;
- nerrors += test_family() < 0 ? 1 : 0;
- nerrors += test_family_compat() < 0 ? 1 : 0;
- nerrors += test_multi() < 0 ? 1 : 0;
- nerrors += test_multi_compat() < 0 ? 1 : 0;
- nerrors += test_direct() < 0 ? 1 : 0;
- nerrors += test_log() < 0 ? 1 : 0;
- nerrors += test_stdio() < 0 ? 1 : 0;
- nerrors += test_windows() < 0 ? 1 : 0;
-
- if(nerrors) {
- printf("***** %d Virtual File Driver TEST%s FAILED! *****\n",
- nerrors, nerrors > 1 ? "S" : "");
- return 1;
- }
+ HDprintf("Testing basic Virtual File Driver functionality.\n");
- printf("All Virtual File Driver tests passed.\n");
- return 0;
-}
+ nerrors += test_sec2() < 0 ? 1 : 0;
+ nerrors += test_core() < 0 ? 1 : 0;
+ nerrors += test_direct() < 0 ? 1 : 0;
+ nerrors += test_family() < 0 ? 1 : 0;
+ nerrors += test_family_compat() < 0 ? 1 : 0;
+ nerrors += test_multi() < 0 ? 1 : 0;
+ nerrors += test_multi_compat() < 0 ? 1 : 0;
+ nerrors += test_log() < 0 ? 1 : 0;
+ nerrors += test_stdio() < 0 ? 1 : 0;
+ nerrors += test_windows() < 0 ? 1 : 0;
+ nerrors += test_ros3() < 0 ? 1 : 0;
+
+ if (nerrors) {
+ HDprintf("***** %d Virtual File Driver TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : "");
+ return 1;
+ } /* end if */
+ HDprintf("All Virtual File Driver tests passed.\n");
+
+ return 0;
+} /* end main() */