summaryrefslogtreecommitdiffstats
path: root/test/mf.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/mf.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/mf.c')
-rw-r--r--test/mf.c3131
1 files changed, 1631 insertions, 1500 deletions
diff --git a/test/mf.c b/test/mf.c
index 7608c09..e218904 100644
--- a/test/mf.c
+++ b/test/mf.c
@@ -6,7 +6,7 @@
* 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -35,49 +35,45 @@
#include "H5Iprivate.h"
#include "H5VMprivate.h"
-#define FILENAME_LEN 1024
-
-#define TEST_BLOCK_SIZE5 5
-#define TEST_BLOCK_SIZE20 20
-#define TEST_BLOCK_SIZE30 30
-#define TEST_BLOCK_SIZE40 40
-#define TEST_BLOCK_SIZE50 50
-#define TEST_BLOCK_SIZE80 80
-#define TEST_BLOCK_SIZE200 200
-#define TEST_BLOCK_SIZE600 600
-#define TEST_BLOCK_SIZE700 700
-#define TEST_BLOCK_SIZE1034 1034
-#define TEST_BLOCK_SIZE1970 1970
-#define TEST_BLOCK_SIZE2058 2058
-#define TEST_BLOCK_SIZE8000 8000
-#define TEST_BLOCK_SIZE2048 2048
-
-#define TEST_BLOCK_ADDR70 70
-#define TEST_BLOCK_ADDR100 100
-
-#define TEST_ALIGN1024 1024
-#define TEST_ALIGN4096 4096
-
-const char *FILENAME[] = {
- "mf",
- NULL
-};
+#define FILENAME_LEN 1024
+
+#define TEST_BLOCK_SIZE5 5
+#define TEST_BLOCK_SIZE20 20
+#define TEST_BLOCK_SIZE30 30
+#define TEST_BLOCK_SIZE40 40
+#define TEST_BLOCK_SIZE50 50
+#define TEST_BLOCK_SIZE80 80
+#define TEST_BLOCK_SIZE200 200
+#define TEST_BLOCK_SIZE600 600
+#define TEST_BLOCK_SIZE700 700
+#define TEST_BLOCK_SIZE1034 1034
+#define TEST_BLOCK_SIZE1970 1970
+#define TEST_BLOCK_SIZE2058 2058
+#define TEST_BLOCK_SIZE8000 8000
+#define TEST_BLOCK_SIZE2048 2048
+
+#define TEST_BLOCK_ADDR70 70
+#define TEST_BLOCK_ADDR100 100
+
+#define TEST_ALIGN1024 1024
+#define TEST_ALIGN4096 4096
+
+const char *FILENAME[] = {"mf", NULL};
typedef enum {
- TEST_NORMAL, /* size of aggregator is >= alignment size */
- TEST_AGGR_SMALL, /* size of aggregator is smaller than alignment size */
- TEST_NTESTS /* The number of test types, must be last */
+ TEST_NORMAL, /* size of aggregator is >= alignment size */
+ TEST_AGGR_SMALL, /* size of aggregator is smaller than alignment size */
+ TEST_NTESTS /* The number of test types, must be last */
} test_type_t;
typedef struct frspace_state_t {
- hsize_t tot_space; /* Total amount of space tracked */
- hsize_t tot_sect_count; /* Total # of sections tracked */
- hsize_t serial_sect_count; /* # of serializable sections tracked */
- hsize_t ghost_sect_count; /* # of un-serializable sections tracked */
+ hsize_t tot_space; /* Total amount of space tracked */
+ hsize_t tot_sect_count; /* Total # of sections tracked */
+ hsize_t serial_sect_count; /* # of serializable sections tracked */
+ hsize_t ghost_sect_count; /* # of un-serializable sections tracked */
} frspace_state_t;
-
-static int check_stats(const H5F_t *, const H5FS_t *, frspace_state_t *);
+static int check_stats(const H5F_t *, const H5FS_t *, frspace_state_t *);
static unsigned test_mf_eoa(const char *env_h5_drvr, hid_t fapl);
static unsigned test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl);
static unsigned test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl);
@@ -107,72 +103,71 @@ static unsigned test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t
/*
* Verify statistics for the free-space manager
*
- * Modifications:
- * Vailin Choi; July 2012
- * To ensure "f" and "frsp" are valid pointers
*/
static int
check_stats(const H5F_t *f, const H5FS_t *frsp, frspace_state_t *state)
{
- H5FS_stat_t frspace_stats; /* Statistics about the heap */
+ H5FS_stat_t frspace_stats; /* Statistics about the heap */
HDassert(f);
HDassert(frsp);
/* Get statistics for free-space and verify they are correct */
- if(H5FS_stat_info(f, frsp, &frspace_stats) < 0)
+ if (H5FS_stat_info(f, frsp, &frspace_stats) < 0)
FAIL_STACK_ERROR
- if(frspace_stats.tot_space != state->tot_space) {
- HDfprintf(stdout, "frspace_stats.tot_space = %Hu, state->tot_space = %Zu\n",
- frspace_stats.tot_space, state->tot_space);
+ if (frspace_stats.tot_space != state->tot_space) {
+ HDfprintf(stdout, "frspace_stats.tot_space = %Hu, state->tot_space = %Zu\n", frspace_stats.tot_space,
+ state->tot_space);
TEST_ERROR
} /* end if */
- if(frspace_stats.tot_sect_count != state->tot_sect_count) {
+ if (frspace_stats.tot_sect_count != state->tot_sect_count) {
HDfprintf(stdout, "frspace_stats.tot_sect_count = %Hu, state->tot_sect_count = %Hu\n",
- frspace_stats.tot_sect_count, state->tot_sect_count);
+ frspace_stats.tot_sect_count, state->tot_sect_count);
TEST_ERROR
} /* end if */
- if(frspace_stats.serial_sect_count != state->serial_sect_count) {
+ if (frspace_stats.serial_sect_count != state->serial_sect_count) {
HDfprintf(stdout, "frspace_stats.serial_sect_count = %Hu, state->serial_sect_count = %Hu\n",
- frspace_stats.serial_sect_count, state->serial_sect_count);
+ frspace_stats.serial_sect_count, state->serial_sect_count);
TEST_ERROR
} /* end if */
- if(frspace_stats.ghost_sect_count != state->ghost_sect_count) {
+ if (frspace_stats.ghost_sect_count != state->ghost_sect_count) {
HDfprintf(stdout, "frspace_stats.ghost_sect_count = %Hu, state->ghost_sect_count = %Hu\n",
- frspace_stats.ghost_sect_count, state->ghost_sect_count);
+ frspace_stats.ghost_sect_count, state->ghost_sect_count);
TEST_ERROR
} /* end if */
/* All tests passed */
- return(0);
+ return (0);
error:
- return(1);
+ return (1);
} /* check_stats() */
/*
+ *-------------------------------------------------------------------------
* To verify that blocks are allocated from file allocation
*
* Set up:
- * Turn off using meta/small data aggregator
- * There is nothing in free-space manager
+ * Turn off using meta/small data aggregator
+ * There is nothing in free-space manager
*
* Allocate two blocks which should be from file allocation
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_eoa(const char *env_h5_drvr, hid_t fapl)
{
- hid_t file = -1; /* File ID */
- hid_t fapl_new = -1; /* copy of fapl */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size, new_file_size; /* file size */
- H5FD_mem_t type;
- haddr_t addr1, addr2;
- haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF;
- hsize_t ma_size=0;
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ hid_t file = -1; /* File ID */
+ hid_t fapl_new = -1; /* copy of fapl */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size, new_file_size; /* file size */
+ H5FD_mem_t type;
+ haddr_t addr1, addr2;
+ haddr_t ma_addr = HADDR_UNDEF, new_ma_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0;
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
TESTING("H5MM_alloc() of file allocation");
@@ -180,22 +175,23 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl)
* type of metadata allocation.
*/
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Set the filename to use for this test */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- if((fapl_new = H5Pcopy(fapl)) < 0) TEST_ERROR
+ if ((fapl_new = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Turn off using meta/small data aggregator */
@@ -203,16 +199,16 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl)
H5Pset_small_data_block_size(fapl_new, (hsize_t)0);
/* Re-open the file with meta/small data setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
/* nothing should be changed in meta_aggr */
@@ -233,60 +229,63 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl)
if (addr2 < (haddr_t)file_size)
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if (new_file_size != (file_size+TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50))
+ if (new_file_size != (file_size + TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50))
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30);
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr2, (hsize_t)TEST_BLOCK_SIZE50);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != file_size)
+ if (new_file_size != file_size)
TEST_ERROR
- if(H5Pclose(fapl_new) < 0)
+ if (H5Pclose(fapl_new) < 0)
FAIL_STACK_ERROR
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support continuous address space");
+ SKIPPED();
+ puts(" Current VFD doesn't support continuous address space");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl_new);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_eoa() */
/*
+ *-------------------------------------------------------------------------
* To verify that an allocated block from file allocation is shrunk.
*
* Set up:
@@ -302,20 +301,21 @@ error:
* Test 4: Allocate a block of 30 from file allocation
* H5MF_try_shrink() the block by 20 from the end: succeed
*
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
{
- hid_t file = -1; /* File ID */
- hid_t fapl_new = -1; /* copy of fapl */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size, new_file_size; /* file size */
- H5FD_mem_t type;
- haddr_t addr;
- haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF;
- hsize_t ma_size=0, new_ma_size=0;
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ hid_t file = -1; /* File ID */
+ hid_t fapl_new = -1; /* copy of fapl */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size = 0, new_file_size; /* file size */
+ H5FD_mem_t type;
+ haddr_t addr = 0;
+ haddr_t ma_addr = HADDR_UNDEF, new_ma_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0, new_ma_size = 0;
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
TESTING("H5MF_try_shrink() of file allocation: test 1");
@@ -323,22 +323,23 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
* type of metadata allocation.
*/
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- if((fapl_new = H5Pcopy(fapl)) < 0) TEST_ERROR
+ if ((fapl_new = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Turn off using meta/small data aggregator */
@@ -346,11 +347,11 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
H5Pset_small_data_block_size(fapl_new, (hsize_t)0);
/* Re-open the file with meta/small data setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
@@ -363,57 +364,59 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
/* nothing should be changed in meta_aggr */
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if (new_ma_addr != ma_addr) TEST_ERROR
- if (new_ma_size != ma_size) TEST_ERROR
+ if (new_ma_addr != ma_addr)
+ TEST_ERROR
+ if (new_ma_size != ma_size)
+ TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if (new_file_size != (file_size+TEST_BLOCK_SIZE30))
+ if (new_file_size != (file_size + TEST_BLOCK_SIZE30))
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
/* should succeed */
- if(H5MF_try_shrink(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)TEST_BLOCK_SIZE30) <= 0)
+ if (H5MF_try_shrink(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)TEST_BLOCK_SIZE30) <= 0)
TEST_ERROR
/* nothing should be changed in meta_aggr */
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &ma_size);
- if(new_ma_addr != ma_addr)
+ if (new_ma_addr != ma_addr)
TEST_ERROR
- if(new_ma_size != ma_size)
+ if (new_ma_size != ma_size)
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != file_size)
+ if (new_file_size != file_size)
TEST_ERROR
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support metadata aggregator");
+ SKIPPED();
+ puts(" Current VFD doesn't support metadata aggregator");
} /* end else */
TESTING("H5MF_try_shrink() of file allocation: test 2");
@@ -421,13 +424,13 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
/* Skip test when using VFDs that has different address spaces for each
* type of metadata allocation.
*/
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Re-open the file with meta/small data setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
@@ -438,74 +441,77 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
TEST_ERROR
/* should not succeed in shrinking */
- if(H5MF_try_shrink(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)TEST_BLOCK_SIZE30 - 10) > 0)
+ if (H5MF_try_shrink(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)TEST_BLOCK_SIZE30 - 10) > 0)
TEST_ERROR
/* nothing should be changed in meta_aggr */
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &ma_size);
- if (new_ma_addr != ma_addr) TEST_ERROR
- if (new_ma_size != ma_size) TEST_ERROR
+ if (new_ma_addr != ma_addr)
+ TEST_ERROR
+ if (new_ma_size != ma_size)
+ TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != (file_size + TEST_BLOCK_SIZE30))
+ if (new_file_size != (file_size + TEST_BLOCK_SIZE30))
TEST_ERROR
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support metadata aggregator");
+ SKIPPED();
+ puts(" Current VFD doesn't support metadata aggregator");
} /* end else */
-
TESTING("H5MF_try_shrink() of file allocation: test 3");
/* Skip test when using VFDs that has different address spaces for each
* type of metadata allocation.
*/
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Re-open the file with meta/small data setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
/* should not succeed in shrinking */
- if(H5MF_try_shrink(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)TEST_BLOCK_SIZE30 + 10) > 0)
+ if (H5MF_try_shrink(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)TEST_BLOCK_SIZE30 + 10) > 0)
TEST_ERROR
/* nothing should be changed in meta_aggr */
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &ma_size);
- if (new_ma_addr != ma_addr) TEST_ERROR
- if (new_ma_size != ma_size) TEST_ERROR
+ if (new_ma_addr != ma_addr)
+ TEST_ERROR
+ if (new_ma_size != ma_size)
+ TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != (file_size + TEST_BLOCK_SIZE30))
+ if (new_file_size != (file_size + TEST_BLOCK_SIZE30))
TEST_ERROR
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support metadata aggregator");
+ SKIPPED();
+ puts(" Current VFD doesn't support metadata aggregator");
} /* end else */
TESTING("H5MF_try_shrink() of file allocation: test 4");
@@ -513,60 +519,64 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
/* Skip test when using VFDs that has different address spaces for each
* type of metadata allocation.
*/
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Re-open the file with meta/small data setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
/* should succeed in shrinking */
- if(H5MF_try_shrink(f, type, H5P_DATASET_XFER_DEFAULT, addr+10, (hsize_t)(TEST_BLOCK_SIZE30 - 10)) <= 0)
+ if (H5MF_try_shrink(f, type, H5P_DATASET_XFER_DEFAULT, addr + 10,
+ (hsize_t)(TEST_BLOCK_SIZE30 - 10)) <= 0)
TEST_ERROR
/* nothing should be changed in meta_aggr */
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &ma_size);
- if(new_ma_addr != ma_addr)
+ if (new_ma_addr != ma_addr)
TEST_ERROR
- if(new_ma_size != ma_size)
+ if (new_ma_size != ma_size)
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != (file_size + 10))
+ if (new_file_size != (file_size + 10))
TEST_ERROR
- if(H5Pclose(fapl_new) < 0)
+ if (H5Pclose(fapl_new) < 0)
FAIL_STACK_ERROR
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support metadata aggregator");
+ SKIPPED();
+ puts(" Current VFD doesn't support metadata aggregator");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl_new);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_eoa_shrink() */
/*
+ *-------------------------------------------------------------------------
* To verify that an allocated block from file allocation is extended.
*
* Set up:
@@ -578,21 +588,22 @@ error:
*
* Test 2: Allocate a block of 30
* H5MF_try_extend() the block of size 20 by 50: fail
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
{
- hid_t file = -1; /* File ID */
- hid_t fapl_new = -1; /* copy of fapl */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size, new_file_size; /* File size */
- H5FD_mem_t type;
- haddr_t addr;
- htri_t was_extended;
- haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF;
- hsize_t ma_size=0, new_ma_size=0;
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ hid_t file = -1; /* File ID */
+ hid_t fapl_new = -1; /* copy of fapl */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size, new_file_size; /* File size */
+ H5FD_mem_t type;
+ haddr_t addr;
+ htri_t was_extended;
+ haddr_t ma_addr = HADDR_UNDEF, new_ma_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0, new_ma_size = 0;
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
TESTING("H5MF_try_extend() of file allocation: test 1");
@@ -600,36 +611,37 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
* type of metadata allocation.
*/
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- if((fapl_new = H5Pcopy(fapl)) < 0) TEST_ERROR
+ if ((fapl_new = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of a file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Turn off using meta/small data aggregator */
- if(H5Pset_meta_block_size(fapl_new, (hsize_t)0) < 0)
+ if (H5Pset_meta_block_size(fapl_new, (hsize_t)0) < 0)
FAIL_STACK_ERROR
- if(H5Pset_small_data_block_size(fapl_new, (hsize_t)0) < 0)
+ if (H5Pset_small_data_block_size(fapl_new, (hsize_t)0) < 0)
FAIL_STACK_ERROR
/* Re-open the file with meta/small data setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
@@ -644,29 +656,30 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
if (new_ma_addr != ma_addr)
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != (file_size + TEST_BLOCK_SIZE30))
+ if (new_file_size != (file_size + TEST_BLOCK_SIZE30))
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
/* should succeed */
- was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)addr, (hsize_t)TEST_BLOCK_SIZE30, (hsize_t)TEST_BLOCK_SIZE50);
+ was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)addr,
+ (hsize_t)TEST_BLOCK_SIZE30, (hsize_t)TEST_BLOCK_SIZE50);
- if(was_extended <= 0)
+ if (was_extended <= 0)
TEST_ERROR
/* nothing should be changed in meta_aggr */
@@ -674,22 +687,22 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
if (new_ma_addr != ma_addr)
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != (file_size + TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50))
+ if (new_file_size != (file_size + TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50))
TEST_ERROR
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support metadata aggregator");
+ SKIPPED();
+ puts(" Current VFD doesn't support metadata aggregator");
} /* end else */
TESTING("H5MF_try_extend() of file allocation: test 2");
@@ -697,17 +710,17 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
/* Skip test when using VFDs that has different address spaces for each
* type of metadata allocation.
*/
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Re-open the file with meta/small data setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
@@ -715,18 +728,19 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
type = H5FD_MEM_SUPER;
addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
- if(addr < (haddr_t)file_size)
+ if (addr < (haddr_t)file_size)
TEST_ERROR
/* nothing should be changed in meta_aggr */
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if(new_ma_addr != ma_addr)
+ if (new_ma_addr != ma_addr)
TEST_ERROR
- was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)addr, (hsize_t)(TEST_BLOCK_SIZE30-10), (hsize_t)(TEST_BLOCK_SIZE50));
+ was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)addr,
+ (hsize_t)(TEST_BLOCK_SIZE30 - 10), (hsize_t)(TEST_BLOCK_SIZE50));
/* should not succeed */
- if(was_extended > 0)
+ if (was_extended > 0)
TEST_ERROR
/* nothing should be changed in meta_aggr */
@@ -734,38 +748,41 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
if (new_ma_addr != ma_addr)
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != file_size + TEST_BLOCK_SIZE30)
+ if (new_file_size != file_size + TEST_BLOCK_SIZE30)
TEST_ERROR
- if(H5Pclose(fapl_new) < 0)
+ if (H5Pclose(fapl_new) < 0)
FAIL_STACK_ERROR
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support metadata aggregator");
+ SKIPPED();
+ puts(" Current VFD doesn't support metadata aggregator");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl_new);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_eoa_extend() */
/*
+ *-------------------------------------------------------------------------
* To verify that temporary blocks are allocated correctly
*
* Set up:
@@ -785,197 +802,207 @@ error:
* space fails
* - Check that allocating another 1/2 of the file as normal address
* space fails
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_tmp(const char *env_h5_drvr, hid_t fapl)
{
- hid_t file = -1; /* File ID */
+ hid_t file = -1; /* File ID */
TESTING("'temporary' file space allocation");
/* Can't run this test with multi-file VFDs */
- if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")) {
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size, new_file_size; /* file size */
- haddr_t maxaddr; /* File's max. address */
- haddr_t tmp_addr; /* Temporary space file address */
- haddr_t norm_addr; /* Normal space file address */
- haddr_t check_addr; /* File address for checking for errors */
- unsigned char buf = 0; /* Buffer to read/write with */
- herr_t status; /* Generic status value */
+ if (HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")) {
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size, new_file_size; /* file size */
+ haddr_t maxaddr; /* File's max. address */
+ haddr_t tmp_addr; /* Temporary space file address */
+ haddr_t norm_addr; /* Normal space file address */
+ haddr_t check_addr; /* File address for checking for errors */
+ unsigned char buf = 0; /* Buffer to read/write with */
+ herr_t status; /* Generic status value */
/* Set the filename to use for this test */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
-
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
/* Retrieve the file's maxaddr */
- if(H5F_get_maxaddr_test(file, &maxaddr) < 0)
+ if (H5F_get_maxaddr_test(file, &maxaddr) < 0)
FAIL_STACK_ERROR
/* Allocate some temporary address space */
- if(HADDR_UNDEF == (tmp_addr = H5MF_alloc_tmp(f, (hsize_t)TEST_BLOCK_SIZE30)))
+ if (HADDR_UNDEF == (tmp_addr = H5MF_alloc_tmp(f, (hsize_t)TEST_BLOCK_SIZE30)))
FAIL_STACK_ERROR
/* Check if temporary file address is valid */
- if(!H5F_IS_TMP_ADDR(f, tmp_addr))
+ if (!H5F_IS_TMP_ADDR(f, tmp_addr))
TEST_ERROR
- if(tmp_addr < (haddr_t)(maxaddr - TEST_BLOCK_SIZE30))
+ if (tmp_addr < (haddr_t)(maxaddr - TEST_BLOCK_SIZE30))
TEST_ERROR
/* Reading & writing with a temporary address value should fail */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
status = H5F_block_read(f, H5FD_MEM_SUPER, tmp_addr, sizeof(buf), H5P_DATASET_XFER_DEFAULT, &buf);
- } H5E_END_TRY;
- if(status >= 0)
+ }
+ H5E_END_TRY;
+ if (status >= 0)
TEST_ERROR
- H5E_BEGIN_TRY {
- status = H5F_block_write(f, H5FD_MEM_SUPER, tmp_addr, sizeof(buf), H5P_DATASET_XFER_DEFAULT, &buf);
- } H5E_END_TRY;
- if(status >= 0)
+ H5E_BEGIN_TRY
+ {
+ status =
+ H5F_block_write(f, H5FD_MEM_SUPER, tmp_addr, sizeof(buf), H5P_DATASET_XFER_DEFAULT, &buf);
+ }
+ H5E_END_TRY;
+ if (status >= 0)
TEST_ERROR
/* Freeing a temporary address value should fail */
- H5E_BEGIN_TRY {
- status = H5MF_xfree(f, H5FD_MEM_SUPER, H5P_DATASET_XFER_DEFAULT, tmp_addr, (hsize_t)TEST_BLOCK_SIZE30);
- } H5E_END_TRY;
- if(status >= 0)
+ H5E_BEGIN_TRY
+ {
+ status =
+ H5MF_xfree(f, H5FD_MEM_SUPER, H5P_DATASET_XFER_DEFAULT, tmp_addr, (hsize_t)TEST_BLOCK_SIZE30);
+ }
+ H5E_END_TRY;
+ if (status >= 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != file_size)
+ if (new_file_size != file_size)
TEST_ERROR
-
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
/* Allocate 1/3 of the file as temporary address space */
- if(HADDR_UNDEF == (tmp_addr = H5MF_alloc_tmp(f, (hsize_t)(maxaddr / 3))))
+ if (HADDR_UNDEF == (tmp_addr = H5MF_alloc_tmp(f, (hsize_t)(maxaddr / 3))))
FAIL_STACK_ERROR
- if(!H5F_IS_TMP_ADDR(f, tmp_addr))
+ if (!H5F_IS_TMP_ADDR(f, tmp_addr))
TEST_ERROR
/* Allocate 1/3 of the file as normal address space */
- if(HADDR_UNDEF == (norm_addr = H5MF_alloc(f, H5FD_MEM_DRAW, H5P_DATASET_XFER_DEFAULT, (hsize_t)(maxaddr / 3))))
+ if (HADDR_UNDEF ==
+ (norm_addr = H5MF_alloc(f, H5FD_MEM_DRAW, H5P_DATASET_XFER_DEFAULT, (hsize_t)(maxaddr / 3))))
FAIL_STACK_ERROR
- if(H5F_IS_TMP_ADDR(f, norm_addr))
+ if (H5F_IS_TMP_ADDR(f, norm_addr))
TEST_ERROR
/* Test that pushing temporary space allocation into normal space fails */
- H5E_BEGIN_TRY {
- check_addr = H5MF_alloc_tmp(f, (hsize_t)(maxaddr / 3));
- } H5E_END_TRY;
- if(H5F_addr_defined(check_addr))
+ H5E_BEGIN_TRY { check_addr = H5MF_alloc_tmp(f, (hsize_t)(maxaddr / 3)); }
+ H5E_END_TRY;
+ if (H5F_addr_defined(check_addr))
TEST_ERROR
/* Test that pushing normal space allocation into temporary space fails */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
check_addr = H5MF_alloc(f, H5FD_MEM_DRAW, H5P_DATASET_XFER_DEFAULT, (hsize_t)(maxaddr / 3));
- } H5E_END_TRY;
- if(H5F_addr_defined(check_addr))
+ }
+ H5E_END_TRY;
+ if (H5F_addr_defined(check_addr))
TEST_ERROR
/* Free the normal block (so the file doesn't blow up to a huge size) */
- if(H5MF_xfree(f, H5FD_MEM_DRAW, H5P_DATASET_XFER_DEFAULT, norm_addr, (hsize_t)(maxaddr / 3)) < 0)
+ if (H5MF_xfree(f, H5FD_MEM_DRAW, H5P_DATASET_XFER_DEFAULT, norm_addr, (hsize_t)(maxaddr / 3)) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != file_size)
+ if (new_file_size != file_size)
TEST_ERROR
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support continuous address space");
+ SKIPPED();
+ puts(" Current VFD doesn't support continuous address space");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_tmp() */
/*
+ *-------------------------------------------------------------------------
* To verify that the free-space manager is created or opened
*
* Set up:
* Turn off using meta/small data aggregator
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_fs_start(hid_t fapl)
{
- hid_t file = -1; /* File ID */
- hid_t fapl_new = -1; /* copy of fapl */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size, new_file_size; /* file size */
- H5FD_mem_t type;
- frspace_state_t state;
-
+ hid_t file = -1; /* File ID */
+ hid_t fapl_new = -1; /* copy of fapl */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size, new_file_size; /* file size */
+ H5FD_mem_t type;
+ frspace_state_t state;
TESTING("H5MF_alloc_create()/H5MF_alloc_open() of free-space manager");
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- if((fapl_new = H5Pcopy(fapl)) < 0) TEST_ERROR
+ if ((fapl_new = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Turn off using meta/small data aggregator */
@@ -983,57 +1010,59 @@ test_mf_fs_start(hid_t fapl)
H5Pset_small_data_block_size(fapl_new, (hsize_t)0);
/* Re-open the file with meta/small data setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
/* Start up free-space manager */
type = H5FD_MEM_SUPER;
- if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
+ if (H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
TEST_ERROR
if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN)
- TEST_ERROR
+ TEST_ERROR
if (f->shared->fs_man[type]->client != H5FS_CLIENT_FILE_ID)
- TEST_ERROR
+ TEST_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != file_size)
- TEST_ERROR
+ if (new_file_size != file_size)
+ TEST_ERROR
- if(H5Pclose(fapl_new) < 0)
+ if (H5Pclose(fapl_new) < 0)
FAIL_STACK_ERROR
PASSED()
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl_new);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_fs_start() */
-
/*
+ *-------------------------------------------------------------------------
* To verify that a block is allocated/freed from/to the free-space manager
*
* Set up:
@@ -1057,24 +1086,21 @@ error:
* The block is allocated from file allocation
* Deallocate the block which will be returned to free-space manager
* (the space is shrunk and freed since it is at end of file)
- *
- * Modifications:
- * Vailin Choi; July 2012
- * Initialize the new field "allow_eoa_shrink_only" for user data.
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_fs_alloc_free(hid_t fapl)
{
- hid_t file = -1; /* File ID */
- hid_t fapl_new = -1; /* copy of fapl */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size, new_file_size; /* file size */
- H5FD_mem_t type;
+ hid_t file = -1; /* File ID */
+ hid_t fapl_new = -1; /* copy of fapl */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size, new_file_size; /* file size */
+ H5FD_mem_t type;
H5MF_free_section_t *sect_node = NULL;
- haddr_t addr;
- frspace_state_t state;
- H5MF_sect_ud_t udata;
+ haddr_t addr;
+ frspace_state_t state;
+ H5MF_sect_ud_t udata;
H5FS_section_info_t *node;
TESTING("H5MF_alloc()/H5MF_xfree() of free-space manager:test 1");
@@ -1082,18 +1108,19 @@ test_mf_fs_alloc_free(hid_t fapl)
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- if((fapl_new = H5Pcopy(fapl)) < 0) TEST_ERROR
+ if ((fapl_new = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of a file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Turn off using meta/small data aggregator */
@@ -1101,43 +1128,44 @@ test_mf_fs_alloc_free(hid_t fapl)
H5Pset_small_data_block_size(fapl_new, (hsize_t)0);
/* Re-open the file with meta/small data setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
type = H5FD_MEM_SUPER;
- if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
+ if (H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
TEST_ERROR
if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN)
- TEST_ERROR
+ TEST_ERROR
if (f->shared->fs_man[type]->client != H5FS_CLIENT_FILE_ID)
- TEST_ERROR
+ TEST_ERROR
/* Create section A */
sect_node = H5MF_sect_simple_new((haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE30);
/* Construct user data for callbacks */
- udata.f = f;
- udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
- udata.alloc_type = type;
- udata.allow_sect_absorb = TRUE;
+ udata.f = f;
+ udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
+ udata.alloc_type = type;
+ udata.allow_sect_absorb = TRUE;
udata.allow_eoa_shrink_only = FALSE;
/* Add section A to free-space manager */
- if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node,
+ H5FS_ADD_RETURNED_SPACE, &udata))
+ FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
state.tot_space += TEST_BLOCK_SIZE30;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Allocate a block of 30 */
@@ -1145,13 +1173,13 @@ test_mf_fs_alloc_free(hid_t fapl)
/* Verify that the allocated block is section A in free-space */
if (addr != TEST_BLOCK_ADDR70)
- TEST_ERROR
+ TEST_ERROR
state.tot_space -= TEST_BLOCK_SIZE30;
state.tot_sect_count -= 1;
state.serial_sect_count -= 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Free the block to free-space */
@@ -1160,71 +1188,72 @@ test_mf_fs_alloc_free(hid_t fapl)
state.tot_space += TEST_BLOCK_SIZE30;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Remove section A from free-space */
- if(H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type],
- (hsize_t)TEST_BLOCK_SIZE30, (H5FS_section_info_t **)&node) < 0)
- TEST_ERROR
+ if (H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (hsize_t)TEST_BLOCK_SIZE30,
+ (H5FS_section_info_t **)&node) < 0)
+ TEST_ERROR
/* Free the free-space section node */
- if(H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
- TEST_ERROR
+ if (H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
+ TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
if (new_file_size != file_size)
- TEST_ERROR
+ TEST_ERROR
PASSED()
TESTING("H5MF_alloc()/H5MF_xfree() of free-space manager:test 2");
/* Re-open the file with meta/small data setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
type = H5FD_MEM_SUPER;
- if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
+ if (H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
TEST_ERROR
if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN)
- TEST_ERROR
+ TEST_ERROR
if (f->shared->fs_man[type]->client != H5FS_CLIENT_FILE_ID)
- TEST_ERROR
+ TEST_ERROR
/* Create section A */
sect_node = H5MF_sect_simple_new((haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE30);
/* Construct user data for callbacks */
- udata.f = f;
- udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
- udata.alloc_type = type;
- udata.allow_sect_absorb = TRUE;
+ udata.f = f;
+ udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
+ udata.alloc_type = type;
+ udata.allow_sect_absorb = TRUE;
udata.allow_eoa_shrink_only = FALSE;
/* Add section A to free-space manager */
- if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node,
+ H5FS_ADD_RETURNED_SPACE, &udata))
+ FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
state.tot_space += TEST_BLOCK_SIZE30;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Allocate a block of 20 */
@@ -1232,12 +1261,12 @@ test_mf_fs_alloc_free(hid_t fapl)
/* Verify that the allocated block is section A in free-space manager */
if (addr != TEST_BLOCK_ADDR70)
- TEST_ERROR
+ TEST_ERROR
/* should still have 1 section of size 10 left in free-space manager */
state.tot_space -= (TEST_BLOCK_SIZE20);
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Free the block to free-space manager */
@@ -1245,71 +1274,72 @@ test_mf_fs_alloc_free(hid_t fapl)
/* Still 1 section in free-space because of merging */
state.tot_space += TEST_BLOCK_SIZE20;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Remove section A from free-space manager */
- if(H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type],
- (hsize_t)TEST_BLOCK_SIZE30, (H5FS_section_info_t **)&node) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (hsize_t)TEST_BLOCK_SIZE30,
+ (H5FS_section_info_t **)&node) < 0)
+ FAIL_STACK_ERROR
/* Free the free-space section node */
- if(H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
- TEST_ERROR
+ if (H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
+ TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
if (new_file_size != file_size)
- TEST_ERROR
+ TEST_ERROR
PASSED()
TESTING("H5MF_alloc()/H5MF_xfree() of free-space manager:test 3");
/* Re-open the file with meta/small data setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
type = H5FD_MEM_SUPER;
- if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
+ if (H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
TEST_ERROR
if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN)
- TEST_ERROR
+ TEST_ERROR
if (f->shared->fs_man[type]->client != H5FS_CLIENT_FILE_ID)
- TEST_ERROR
+ TEST_ERROR
/* Create section A */
sect_node = H5MF_sect_simple_new((haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE30);
/* Construct user data for callbacks */
- udata.f = f;
- udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
- udata.alloc_type = type;
- udata.allow_sect_absorb = TRUE;
+ udata.f = f;
+ udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
+ udata.alloc_type = type;
+ udata.allow_sect_absorb = TRUE;
udata.allow_eoa_shrink_only = FALSE;
/* Add section A to free-space manager */
- if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node,
+ H5FS_ADD_RETURNED_SPACE, &udata))
+ FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
state.tot_space += TEST_BLOCK_SIZE30;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/*
@@ -1321,23 +1351,23 @@ test_mf_fs_alloc_free(hid_t fapl)
/* Verify that the allocated block is not section A in free-space */
if (addr == TEST_BLOCK_ADDR70)
- TEST_ERROR
+ TEST_ERROR
/* free-space info should be the same */
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Remove section A from free-space */
- if(H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type],
- (hsize_t)TEST_BLOCK_SIZE30, (H5FS_section_info_t **)&node) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (hsize_t)TEST_BLOCK_SIZE30,
+ (H5FS_section_info_t **)&node) < 0)
+ FAIL_STACK_ERROR
/* Free the free-space section node */
- if(H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
- TEST_ERROR
+ if (H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
+ TEST_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Free the block of size 40 to free-space */
@@ -1348,37 +1378,39 @@ test_mf_fs_alloc_free(hid_t fapl)
* The block is returned to free-space.
* It is shrunk and freed because it is at end of file.
*/
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != file_size)
- TEST_ERROR
+ if (new_file_size != file_size)
+ TEST_ERROR
- if(H5Pclose(fapl_new) < 0)
+ if (H5Pclose(fapl_new) < 0)
FAIL_STACK_ERROR
PASSED()
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl_new);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_fs_alloc_free() */
-
/*
+ *-------------------------------------------------------------------------
* To verify that a block allocated from the free-space manager can be extended
*
* Set up:
@@ -1414,44 +1446,42 @@ error:
* Try to extend the allocated block by 50 from the free-space_manager:
* Fail: section A does not adjoin section B (70+20 != address of section B) even though
* the requested-size (50) equal to size of section B (50)
- *
- * Modifications:
- * Vailin Choi; July 2012
- * Initialize the new field "allow_eoa_shrink_only" for user data.
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_fs_extend(hid_t fapl)
{
- hid_t file = -1; /* File ID */
- hid_t fapl_new = -1; /* copy of fapl */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size, new_file_size; /* file size */
- H5FD_mem_t type;
- H5MF_free_section_t *sect_node1 = NULL, *sect_node2=NULL;
- haddr_t addr;
- frspace_state_t state; /* State of free space*/
- H5MF_sect_ud_t udata;
+ hid_t file = -1; /* File ID */
+ hid_t fapl_new = -1; /* copy of fapl */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size, new_file_size; /* file size */
+ H5FD_mem_t type;
+ H5MF_free_section_t *sect_node1 = NULL, *sect_node2 = NULL;
+ haddr_t addr;
+ frspace_state_t state; /* State of free space*/
+ H5MF_sect_ud_t udata;
H5FS_section_info_t *node;
- htri_t was_extended;
+ htri_t was_extended;
TESTING("H5MF_try_extend() of free-space manager:test 1");
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- if((fapl_new = H5Pcopy(fapl)) < 0) TEST_ERROR
+ if ((fapl_new = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of a file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Turn off using meta/small data aggregator */
@@ -1459,43 +1489,44 @@ test_mf_fs_extend(hid_t fapl)
H5Pset_small_data_block_size(fapl_new, (hsize_t)0);
/* Re-open the file with meta/small data setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
type = H5FD_MEM_SUPER;
- if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
+ if (H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
TEST_ERROR
if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN)
- TEST_ERROR
+ TEST_ERROR
if (f->shared->fs_man[type]->client != H5FS_CLIENT_FILE_ID)
- TEST_ERROR
+ TEST_ERROR
/* Create section A */
sect_node1 = H5MF_sect_simple_new((haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE30);
/* Construct user data for callbacks */
- udata.f = f;
- udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
- udata.alloc_type = type;
- udata.allow_sect_absorb = TRUE;
+ udata.f = f;
+ udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
+ udata.alloc_type = type;
+ udata.allow_sect_absorb = TRUE;
udata.allow_eoa_shrink_only = FALSE;
/* Add section A to free-space manager */
- if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node1,
+ H5FS_ADD_RETURNED_SPACE, &udata))
+ FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
state.tot_space += TEST_BLOCK_SIZE30;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Allocate a block of 30 */
@@ -1503,117 +1534,120 @@ test_mf_fs_extend(hid_t fapl)
/* Verify that the allocated block is section A in free-space manager */
if (addr != TEST_BLOCK_ADDR70)
- TEST_ERROR
+ TEST_ERROR
state.tot_space -= TEST_BLOCK_SIZE30;
state.tot_sect_count -= 1;
state.serial_sect_count -= 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Create section B */
sect_node2 = H5MF_sect_simple_new((haddr_t)TEST_BLOCK_ADDR100, (hsize_t)TEST_BLOCK_SIZE50);
/* Add section B to free-space manager */
- if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node2,
+ H5FS_ADD_RETURNED_SPACE, &udata))
+ FAIL_STACK_ERROR
state.tot_space += TEST_BLOCK_SIZE50;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Try to extend the allocated block */
- was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE30, (hsize_t)TEST_BLOCK_SIZE50);
+ was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)TEST_BLOCK_ADDR70,
+ (hsize_t)TEST_BLOCK_SIZE30, (hsize_t)TEST_BLOCK_SIZE50);
/* should succeed */
- if(was_extended <= 0)
- TEST_ERROR
+ if (was_extended <= 0)
+ TEST_ERROR
/* Section B is removed from free-space manager */
state.tot_space -= TEST_BLOCK_SIZE50;
state.tot_sect_count -= 1;
state.serial_sect_count -= 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Free the extended block to free-space manager */
- H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)(TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50));
+ H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)(TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50));
/* Verify that the extended block is back into free-space */
- state.tot_space += TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50;
- state.tot_sect_count = 1;
+ state.tot_space += TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50;
+ state.tot_sect_count = 1;
state.serial_sect_count = 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Remove the extended block */
- if(H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type],
- (hsize_t)(TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50), (H5FS_section_info_t **)&node) < 0)
- TEST_ERROR
+ if (H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type],
+ (hsize_t)(TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50), (H5FS_section_info_t **)&node) < 0)
+ TEST_ERROR
/* Remove the free-space section node */
- if(H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
- TEST_ERROR
+ if (H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
+ TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
if (new_file_size != file_size)
- TEST_ERROR
+ TEST_ERROR
PASSED()
TESTING("H5MF_try_extend() of free-space manager:test 2");
/* Re-open the file with meta/small data setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
type = H5FD_MEM_SUPER;
- if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
+ if (H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
TEST_ERROR
if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN)
- TEST_ERROR
+ TEST_ERROR
if (f->shared->fs_man[type]->client != H5FS_CLIENT_FILE_ID)
- TEST_ERROR
+ TEST_ERROR
/* Create section A */
sect_node1 = H5MF_sect_simple_new((haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE30);
/* Construct user data for callbacks */
- udata.f = f;
- udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
- udata.alloc_type = type;
- udata.allow_sect_absorb = TRUE;
+ udata.f = f;
+ udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
+ udata.alloc_type = type;
+ udata.allow_sect_absorb = TRUE;
udata.allow_eoa_shrink_only = FALSE;
/* Add section A to free-space */
- if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node1,
+ H5FS_ADD_RETURNED_SPACE, &udata))
+ FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
state.tot_space += TEST_BLOCK_SIZE30;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Allocate a block of 30 */
@@ -1621,38 +1655,40 @@ test_mf_fs_extend(hid_t fapl)
/* Verify that the allocated block is section A in free-space manager */
if (addr != TEST_BLOCK_ADDR70)
- TEST_ERROR
+ TEST_ERROR
state.tot_space -= TEST_BLOCK_SIZE30;
state.tot_sect_count -= 1;
state.serial_sect_count -= 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Create section B */
sect_node2 = H5MF_sect_simple_new((haddr_t)TEST_BLOCK_ADDR100, (hsize_t)TEST_BLOCK_SIZE50);
/* Add section B to free-space manager */
- if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node2,
+ H5FS_ADD_RETURNED_SPACE, &udata))
+ FAIL_STACK_ERROR
state.tot_space += TEST_BLOCK_SIZE50;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Try to extend the allocated block */
- was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE30, (hsize_t)(TEST_BLOCK_SIZE50+10));
+ was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)TEST_BLOCK_ADDR70,
+ (hsize_t)TEST_BLOCK_SIZE30, (hsize_t)(TEST_BLOCK_SIZE50 + 10));
/* Should not be able to extend the allocated block */
- if(was_extended)
- TEST_ERROR
+ if (was_extended)
+ TEST_ERROR
/* free-space info should remain the same */
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Free the allocated block A to free-space */
@@ -1662,71 +1698,72 @@ test_mf_fs_extend(hid_t fapl)
/* rest of the info remains the same */
state.tot_space += TEST_BLOCK_SIZE30;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Remove the merged sections A & B from free-space */
- if(H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type],
- (hsize_t)(TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50), (H5FS_section_info_t **)&node) < 0)
- TEST_ERROR
+ if (H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type],
+ (hsize_t)(TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50), (H5FS_section_info_t **)&node) < 0)
+ TEST_ERROR
/* Remove the free-space section node */
- if(H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
- TEST_ERROR
+ if (H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
+ TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
if (new_file_size != file_size)
- TEST_ERROR
+ TEST_ERROR
PASSED()
TESTING("H5MF_try_extend() of free-space manager:test 3");
/* Re-open the file with meta/small data setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
type = H5FD_MEM_SUPER;
- if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
+ if (H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
TEST_ERROR
if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN)
- TEST_ERROR
+ TEST_ERROR
if (f->shared->fs_man[type]->client != H5FS_CLIENT_FILE_ID)
- TEST_ERROR
+ TEST_ERROR
/* Create section A */
sect_node1 = H5MF_sect_simple_new((haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE30);
/* Construct user data for callbacks */
- udata.f = f;
- udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
- udata.alloc_type = type;
- udata.allow_sect_absorb = TRUE;
+ udata.f = f;
+ udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
+ udata.alloc_type = type;
+ udata.allow_sect_absorb = TRUE;
udata.allow_eoa_shrink_only = FALSE;
/* Add section A to free-space */
- if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node1,
+ H5FS_ADD_RETURNED_SPACE, &udata))
+ FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
state.tot_space += TEST_BLOCK_SIZE30;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Allocate a block of 30 */
@@ -1734,208 +1771,216 @@ test_mf_fs_extend(hid_t fapl)
/* Verify that the allocated block is section A in free-space manager */
if (addr != TEST_BLOCK_ADDR70)
- TEST_ERROR
+ TEST_ERROR
state.tot_space -= TEST_BLOCK_SIZE30;
state.tot_sect_count -= 1;
state.serial_sect_count -= 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Create section B */
sect_node2 = H5MF_sect_simple_new((haddr_t)TEST_BLOCK_ADDR100, (hsize_t)TEST_BLOCK_SIZE50);
/* Add section B to free-space manager */
- if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node2,
+ H5FS_ADD_RETURNED_SPACE, &udata))
+ FAIL_STACK_ERROR
state.tot_space += TEST_BLOCK_SIZE50;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Try to extend the allocated block */
- was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE30, (hsize_t)(TEST_BLOCK_SIZE40));
+ was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)TEST_BLOCK_ADDR70,
+ (hsize_t)TEST_BLOCK_SIZE30, (hsize_t)(TEST_BLOCK_SIZE40));
/* Should succeed in extending the allocated block */
- if(was_extended <=0)
- TEST_ERROR
+ if (was_extended <= 0)
+ TEST_ERROR
/* Should have 1 section of size=10 left in free-space manager */
state.tot_space -= (TEST_BLOCK_SIZE40);
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Free the extended block */
- H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)(TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE40));
+ H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)(TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE40));
/* rest info is same, the extended section returned is merged with the section in free-space */
- state.tot_space += (TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE40);
+ state.tot_space += (TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE40);
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Remove the merged sections A & B from free-space */
- if(H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type],
- (hsize_t)(TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50), (H5FS_section_info_t **)&node) < 0)
- TEST_ERROR
+ if (H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type],
+ (hsize_t)(TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50), (H5FS_section_info_t **)&node) < 0)
+ TEST_ERROR
/* Remove the free-space section node */
- if(H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
- TEST_ERROR
+ if (H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
+ TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
if (new_file_size != file_size)
- TEST_ERROR
+ TEST_ERROR
PASSED()
TESTING("H5MF_try_extend() of free-space manager:test 4");
/* Re-open the file with meta/small data setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
type = H5FD_MEM_SUPER;
- if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
+ if (H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
TEST_ERROR
if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN)
- TEST_ERROR
+ TEST_ERROR
if (f->shared->fs_man[type]->client != H5FS_CLIENT_FILE_ID)
- TEST_ERROR
+ TEST_ERROR
/* Create section A */
- sect_node1 = H5MF_sect_simple_new((haddr_t)TEST_BLOCK_ADDR70, (hsize_t)(TEST_BLOCK_SIZE30-10));
+ sect_node1 = H5MF_sect_simple_new((haddr_t)TEST_BLOCK_ADDR70, (hsize_t)(TEST_BLOCK_SIZE30 - 10));
/* Construct user data for callbacks */
- udata.f = f;
- udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
- udata.alloc_type = type;
- udata.allow_sect_absorb = TRUE;
+ udata.f = f;
+ udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
+ udata.alloc_type = type;
+ udata.allow_sect_absorb = TRUE;
udata.allow_eoa_shrink_only = FALSE;
/* Add section A of size=20 to free-space */
- if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node1,
+ H5FS_ADD_RETURNED_SPACE, &udata))
+ FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
- state.tot_space += (TEST_BLOCK_SIZE30-10);
+ state.tot_space += (TEST_BLOCK_SIZE30 - 10);
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Allocate a block of size=20 */
- addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)(TEST_BLOCK_SIZE30-10));
+ addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)(TEST_BLOCK_SIZE30 - 10));
/* Verify that the allocated block is section A in free-space manager */
if (addr != TEST_BLOCK_ADDR70)
- TEST_ERROR
+ TEST_ERROR
- state.tot_space -= (TEST_BLOCK_SIZE30-10);
+ state.tot_space -= (TEST_BLOCK_SIZE30 - 10);
state.tot_sect_count -= 1;
state.serial_sect_count -= 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Create section B */
sect_node2 = H5MF_sect_simple_new((haddr_t)TEST_BLOCK_ADDR100, (hsize_t)TEST_BLOCK_SIZE50);
/* Add section B to free-space manager */
- if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node2,
+ H5FS_ADD_RETURNED_SPACE, &udata))
+ FAIL_STACK_ERROR
state.tot_space += TEST_BLOCK_SIZE50;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Try to extend the allocated block */
- was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)TEST_BLOCK_ADDR70, (hsize_t)(TEST_BLOCK_SIZE30-10), (hsize_t)TEST_BLOCK_SIZE50);
+ was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)TEST_BLOCK_ADDR70,
+ (hsize_t)(TEST_BLOCK_SIZE30 - 10), (hsize_t)TEST_BLOCK_SIZE50);
/* Should not succeed in extending the allocated block */
- if(was_extended)
- TEST_ERROR
+ if (was_extended)
+ TEST_ERROR
/* Free-space info should be the same */
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Free the allocated block */
- H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)(TEST_BLOCK_SIZE30-10));
+ H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)(TEST_BLOCK_SIZE30 - 10));
- state.tot_space += (TEST_BLOCK_SIZE30-10);
+ state.tot_space += (TEST_BLOCK_SIZE30 - 10);
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Remove section A from free-space manger */
- if(H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type],
- (hsize_t)(TEST_BLOCK_SIZE30-10), (H5FS_section_info_t **)&node) < 0)
- TEST_ERROR
+ if (H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type],
+ (hsize_t)(TEST_BLOCK_SIZE30 - 10), (H5FS_section_info_t **)&node) < 0)
+ TEST_ERROR
/* Remove the free-space section node */
- if(H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
- TEST_ERROR
+ if (H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
+ TEST_ERROR
/* Remove section B from free-space manager */
- if(H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type],
- (hsize_t)TEST_BLOCK_SIZE50, (H5FS_section_info_t **)&node) < 0)
- TEST_ERROR
+ if (H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (hsize_t)TEST_BLOCK_SIZE50,
+ (H5FS_section_info_t **)&node) < 0)
+ TEST_ERROR
/* Remove the free-space section node */
- if(H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
- TEST_ERROR
+ if (H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
+ TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != file_size)
- TEST_ERROR
+ if (new_file_size != file_size)
+ TEST_ERROR
- if(H5Pclose(fapl_new) < 0)
+ if (H5Pclose(fapl_new) < 0)
FAIL_STACK_ERROR
PASSED()
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl_new);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_fs_extend() */
/*
+ *-------------------------------------------------------------------------
* To verify that an aggregator is absorbed into a section.
*
* Test 1: To aborb the aggregator onto the beginning of the section
@@ -1958,53 +2003,50 @@ error:
* which will absorb meta_aggr to the section:
* section size + remaining size of aggregator is > aggr->alloc_size,
* section is allowed to absorb an aggregator (allow_sect_absorb is true)
- *
- * Modifications:
- * Vailin Choi; July 2012
- * Initialize the new field "allow_eoa_shrink_only" for user data.
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FD_mem_t type, stype;
- haddr_t addr, saddr;
- haddr_t ma_addr=HADDR_UNDEF;
- hsize_t ma_size=0;
- H5MF_free_section_t *sect_node=NULL;
- H5MF_sect_ud_t udata;
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5FD_mem_t type, stype;
+ haddr_t addr, saddr;
+ haddr_t ma_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0;
+ H5MF_free_section_t *sect_node = NULL;
+ H5MF_sect_ud_t udata;
H5FS_section_info_t *node;
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
TESTING("A free-space section absorbs an aggregator: test 1");
/* Skip test when using VFDs that don't use the metadata aggregator */
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
type = H5FD_MEM_SUPER;
- if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
+ if (H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
TEST_ERROR
if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN)
@@ -2018,29 +2060,32 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl)
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
/* Add a section to free-space that adjoins end of the aggregator */
- sect_node = H5MF_sect_simple_new((haddr_t)(ma_addr+ma_size), (hsize_t)TEST_BLOCK_SIZE2048);
+ sect_node = H5MF_sect_simple_new((haddr_t)(ma_addr + ma_size), (hsize_t)TEST_BLOCK_SIZE2048);
/* Construct user data for callbacks */
- udata.f = f;
- udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
- udata.alloc_type = type;
- udata.allow_sect_absorb = TRUE;
- udata.allow_eoa_shrink_only = FALSE;
+ udata.f = f;
+ udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
+ udata.alloc_type = type;
+ udata.allow_sect_absorb = TRUE;
+ udata.allow_eoa_shrink_only = FALSE;
/* When adding, meta_aggr is absorbed onto the beginning of the section */
- if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type],
+ (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata))
+ FAIL_STACK_ERROR
/* Verify that the section did absorb the aggregator */
- if(H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type],
- (hsize_t)TEST_BLOCK_SIZE2048, (H5FS_section_info_t **)&node) < 0)
+ if (H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (hsize_t)TEST_BLOCK_SIZE2048,
+ (H5FS_section_info_t **)&node) < 0)
TEST_ERROR
- if (node->addr != ma_addr) TEST_ERROR
- if (node->size != (ma_size + TEST_BLOCK_SIZE2048)) TEST_ERROR
+ if (node->addr != ma_addr)
+ TEST_ERROR
+ if (node->size != (ma_size + TEST_BLOCK_SIZE2048))
+ TEST_ERROR
/* Remove the free-space section node */
- if(H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
+ if (H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
TEST_ERROR
/* Restore info for aggregator */
@@ -2050,31 +2095,31 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl)
/* Remove section from meta_aggr */
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)TEST_BLOCK_SIZE30);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support metadata aggregator");
+ SKIPPED();
+ puts(" Current VFD doesn't support metadata aggregator");
} /* end else */
TESTING("A free-space section absorbs an aggregator: test 2");
/* Skip test when using VFDs that don't use the metadata aggregator */
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
type = H5FD_MEM_SUPER;
- if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
+ if (H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
TEST_ERROR
if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN)
@@ -2094,26 +2139,29 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl)
sect_node = H5MF_sect_simple_new((haddr_t)addr, (hsize_t)TEST_BLOCK_SIZE30);
/* Construct user data for callbacks */
- udata.f = f;
- udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
- udata.alloc_type = type;
- udata.allow_sect_absorb = TRUE;
+ udata.f = f;
+ udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
+ udata.alloc_type = type;
+ udata.allow_sect_absorb = TRUE;
udata.allow_eoa_shrink_only = FALSE;
/* When adding, meta_aggr is absorbed onto the end of the section */
- if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type],
+ (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata))
+ FAIL_STACK_ERROR
/* Verify that the section did absorb the aggregator */
- if(H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type],
- (hsize_t)(ma_size+TEST_BLOCK_SIZE30), (H5FS_section_info_t **)&node) < 0)
+ if (H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type],
+ (hsize_t)(ma_size + TEST_BLOCK_SIZE30), (H5FS_section_info_t **)&node) < 0)
TEST_ERROR
- if ((node->addr + TEST_BLOCK_SIZE30) != ma_addr) TEST_ERROR
- if (node->size != (ma_size + TEST_BLOCK_SIZE30)) TEST_ERROR
+ if ((node->addr + TEST_BLOCK_SIZE30) != ma_addr)
+ TEST_ERROR
+ if (node->size != (ma_size + TEST_BLOCK_SIZE30))
+ TEST_ERROR
/* free the free-space section node */
- if(H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
+ if (H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
TEST_ERROR
/* restore info to meta_aggr */
@@ -2125,26 +2173,26 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl)
/* Remove section from sdata_aggr */
H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr, (hsize_t)TEST_BLOCK_SIZE50);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support metadata aggregator");
+ SKIPPED();
+ puts(" Current VFD doesn't support metadata aggregator");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_fs_absorb() */
/*
+ *-------------------------------------------------------------------------
* To verify that blocks are allocated from the aggregator
*
* Allocate first block (30) from meta_aggr: (nothing in the aggregator)
@@ -2159,93 +2207,94 @@ error:
* Result:
* The second block of 50 is allocated from meta_aggr
* There is space of 1968 left in meta_aggr
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size, new_file_size; /* file size */
- H5FD_mem_t type;
- haddr_t addr1, addr2;
- haddr_t ma_addr=HADDR_UNDEF;
- hsize_t ma_size=0;
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size, new_file_size; /* file size */
+ H5FD_mem_t type;
+ haddr_t addr1, addr2;
+ haddr_t ma_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0;
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
TESTING("H5MF_alloc() of meta/sdata aggregator:test 1");
/* Skip test when using VFDs that don't use the metadata aggregator */
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of a file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
/* Allocate first block from meta_aggr */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr1+TEST_BLOCK_SIZE30) != ma_addr)
+ if ((addr1 + TEST_BLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* Allocate second block from meta_aggr */
addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr2+TEST_BLOCK_SIZE50) != ma_addr)
+ if ((addr2 + TEST_BLOCK_SIZE50) != ma_addr)
TEST_ERROR
if (ma_size != (TEST_BLOCK_SIZE2048 - (TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50)))
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if (new_file_size != (file_size+TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50))
+ if (new_file_size != (file_size + TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50))
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
/* Free the two blocks */
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30);
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr2, (hsize_t)TEST_BLOCK_SIZE50);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
@@ -2255,20 +2304,20 @@ test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl)
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support metadata aggregator");
+ SKIPPED();
+ puts(" Current VFD doesn't support metadata aggregator");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_aggr_alloc1() */
/*
+ *-------------------------------------------------------------------------
* To verify that blocks are allocated from the aggregator
*
* Allocate first block (30) from meta_aggr: (nothing in the aggregator)
@@ -2290,59 +2339,60 @@ error:
* A block of request-size is extended via file allocation and is merged with meta_aggr
* The block of 2058 is allocated out of meta_aggr
* There is space of 1968 left in meta_aggr
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size, new_file_size; /* file size */
- H5FD_mem_t type;
- haddr_t addr1, addr2, addr3;
- haddr_t ma_addr=HADDR_UNDEF;
- hsize_t ma_size=0;
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size, new_file_size; /* file size */
+ H5FD_mem_t type;
+ haddr_t addr1, addr2, addr3;
+ haddr_t ma_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0;
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
TESTING("H5MF_alloc() of meta/sdata aggregator:test 2");
/* Skip test when using VFDs that don't use the metadata aggregator */
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of a file */
- if((file_size= h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr1+TEST_BLOCK_SIZE30) != ma_addr)
+ if ((addr1 + TEST_BLOCK_SIZE30) != ma_addr)
TEST_ERROR
addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr2+TEST_BLOCK_SIZE50) != ma_addr)
+ if ((addr2 + TEST_BLOCK_SIZE50) != ma_addr)
TEST_ERROR
if (ma_size != (TEST_BLOCK_SIZE2048 - (TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50)))
@@ -2352,39 +2402,40 @@ test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl)
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr3+TEST_BLOCK_SIZE2058) != ma_addr)
+ if ((addr3 + TEST_BLOCK_SIZE2058) != ma_addr)
TEST_ERROR
if (ma_size != (TEST_BLOCK_SIZE2048 - (TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50)))
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
/* Unused space is freed from the end of the file */
- if (new_file_size != (file_size+TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50+TEST_BLOCK_SIZE2058))
+ if (new_file_size != (file_size + TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50 + TEST_BLOCK_SIZE2058))
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
- H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50+TEST_BLOCK_SIZE2058);
+ H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1,
+ (hsize_t)TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50 + TEST_BLOCK_SIZE2058);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
@@ -2394,17 +2445,16 @@ test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl)
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support metadata aggregator");
+ SKIPPED();
+ puts(" Current VFD doesn't support metadata aggregator");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_aggr_alloc2() */
/*
@@ -2446,52 +2496,52 @@ error:
static unsigned
test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size, new_file_size; /* file size */
- H5FD_mem_t type, stype;
- haddr_t addr1, addr2, addr3, addr4, saddr1;
- haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF;
- hsize_t ma_size=0, new_ma_size=0;
- haddr_t sdata_addr=HADDR_UNDEF;
- hsize_t sdata_size=0;
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size, new_file_size; /* file size */
+ H5FD_mem_t type, stype;
+ haddr_t addr1, addr2, addr3, addr4, saddr1;
+ haddr_t ma_addr = HADDR_UNDEF, new_ma_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0, new_ma_size = 0;
+ haddr_t sdata_addr = HADDR_UNDEF;
+ hsize_t sdata_size = 0;
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
TESTING("H5MF_alloc() of meta/sdata aggregator: test 3");
/* Skip test when using VFDs that don't use the metadata aggregator */
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
/* Allocate first block from meta_aggr */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr1+TEST_BLOCK_SIZE30) != ma_addr)
+ if ((addr1 + TEST_BLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* Allocate second block from meta_aggr */
@@ -2499,18 +2549,19 @@ test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl)
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr2+TEST_BLOCK_SIZE50) != ma_addr)
+ if ((addr2 + TEST_BLOCK_SIZE50) != ma_addr)
TEST_ERROR
if (ma_size != (TEST_BLOCK_SIZE2048 - (TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50)))
TEST_ERROR
/* Allocate first block from sdata_aggr */
- stype = H5FD_MEM_DRAW;
+ stype = H5FD_MEM_DRAW;
saddr1 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if ((saddr1+TEST_BLOCK_SIZE30) != sdata_addr)
+ if ((saddr1 + TEST_BLOCK_SIZE30) != sdata_addr)
+ TEST_ERROR
+ if (sdata_size != (TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30))
TEST_ERROR
- if (sdata_size != (TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30)) TEST_ERROR
/* Allocate third block, which is from file allocation not from meta_aggr */
addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)(TEST_BLOCK_SIZE2058));
@@ -2518,15 +2569,18 @@ test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl)
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
/* info for meta_aggr shouldn't be changed */
- if (addr3 != (sdata_addr+sdata_size)) TEST_ERROR
- if ((addr3+TEST_BLOCK_SIZE2058) == new_ma_addr) TEST_ERROR
- if ((new_ma_addr != ma_addr) || (new_ma_size != ma_size)) TEST_ERROR
+ if (addr3 != (sdata_addr + sdata_size))
+ TEST_ERROR
+ if ((addr3 + TEST_BLOCK_SIZE2058) == new_ma_addr)
+ TEST_ERROR
+ if ((new_ma_addr != ma_addr) || (new_ma_size != ma_size))
+ TEST_ERROR
/* Allocate fourth block, which should be from meta_aggr */
addr4 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr4+TEST_BLOCK_SIZE50) != ma_addr)
+ if ((addr4 + TEST_BLOCK_SIZE50) != ma_addr)
TEST_ERROR
if (ma_size != (TEST_BLOCK_SIZE2048 - (TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50 + TEST_BLOCK_SIZE50)))
TEST_ERROR
@@ -2538,11 +2592,11 @@ test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl)
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr4, (hsize_t)TEST_BLOCK_SIZE50);
H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr1, (hsize_t)TEST_BLOCK_SIZE30);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
@@ -2552,20 +2606,18 @@ test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl)
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support metadata aggregator");
+ SKIPPED();
+ puts(" Current VFD doesn't support metadata aggregator");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_aggr_alloc3() */
-
/*
* To verify that blocks are allocated from the aggregator
*
@@ -2609,75 +2661,76 @@ error:
static unsigned
test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size, new_file_size; /* File size */
- H5FD_mem_t type, stype;
- haddr_t addr1, addr2, saddr1, saddr2, saddr3;
- haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF;
- hsize_t ma_size=0, new_ma_size=0, sdata_size=0;
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size, new_file_size; /* File size */
+ H5FD_mem_t type, stype;
+ haddr_t addr1, addr2, saddr1, saddr2, saddr3;
+ haddr_t ma_addr = HADDR_UNDEF, new_ma_addr = HADDR_UNDEF, sdata_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0, new_ma_size = 0, sdata_size = 0;
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
TESTING("H5MF_alloc() of meta/sdata aggregator:test 4");
/* Skip test when using VFDs that don't use the metadata aggregator */
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
/* Allocate first block from meta_aggr */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr1+TEST_BLOCK_SIZE30) != ma_addr)
+ if ((addr1 + TEST_BLOCK_SIZE30) != ma_addr)
TEST_ERROR
if (ma_size != (TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30))
TEST_ERROR
/* Allocate first block from sdata_aggr */
- stype = H5FD_MEM_DRAW;
+ stype = H5FD_MEM_DRAW;
saddr1 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if ((saddr1+TEST_BLOCK_SIZE30) != sdata_addr)
+ if ((saddr1 + TEST_BLOCK_SIZE30) != sdata_addr)
TEST_ERROR
/* Allocate second block from sdata_aggr */
- saddr2 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)(TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30));
+ saddr2 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT,
+ (hsize_t)(TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30));
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if (saddr2+(TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30) != sdata_addr)
+ if (saddr2 + (TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30) != sdata_addr)
TEST_ERROR
/* Allocate third block from sdata_aggr */
saddr3 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50);
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if ((saddr3+TEST_BLOCK_SIZE50) != sdata_addr)
+ if ((saddr3 + TEST_BLOCK_SIZE50) != sdata_addr)
TEST_ERROR
- if(sdata_size != (TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE50))
+ if (sdata_size != (TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE50))
TEST_ERROR
/* Allocate second block of 2058, which is from file allocation, not from meta_aggr */
@@ -2700,14 +2753,15 @@ test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl)
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30);
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr2, (hsize_t)TEST_BLOCK_SIZE2058);
H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr1, (hsize_t)TEST_BLOCK_SIZE30);
- H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr2, (hsize_t)TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30);
+ H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr2,
+ (hsize_t)TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30);
H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr3, (hsize_t)TEST_BLOCK_SIZE50);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
@@ -2717,17 +2771,16 @@ test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl)
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support metadata aggregator");
+ SKIPPED();
+ puts(" Current VFD doesn't support metadata aggregator");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_aggr_alloc4() */
/*
@@ -2747,75 +2800,76 @@ error:
*
* Allocate third block (1970) from meta_aggr:
* request-size is > what is left in meta_aggr and is < meta_aggr->alloc_size
- * Result: A block of meta_aggr->alloc_size is extended via file allocation and is absorbed into the meta_aggr
- * The block of 1970 is allocated from there
- * There is space of 2046 left in meta_aggr
+ * Result: A block of meta_aggr->alloc_size is extended via file allocation and is absorbed into the
+ *meta_aggr The block of 1970 is allocated from there There is space of 2046 left in meta_aggr
*
*/
static unsigned
test_mf_aggr_alloc5(const char *env_h5_drvr, hid_t fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size, new_file_size; /* File size */
- H5FD_mem_t type;
- haddr_t addr1, addr2, addr3;
- haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF;
- hsize_t ma_size=0, new_ma_size=0;
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size, new_file_size; /* File size */
+ H5FD_mem_t type;
+ haddr_t addr1, addr2, addr3;
+ haddr_t ma_addr = HADDR_UNDEF, new_ma_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0, new_ma_size = 0;
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
TESTING("H5MF_alloc() of meta/sdata aggregator:test 5");
/* Skip test when using VFDs that don't use the metadata aggregator */
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
/* Allocate first block from meta_aggr */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr1+TEST_BLOCK_SIZE30) != ma_addr)
+ if ((addr1 + TEST_BLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* Allocate second block from meta_aggr */
addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if (addr2+TEST_BLOCK_SIZE50 != ma_addr)
+ if (addr2 + TEST_BLOCK_SIZE50 != ma_addr)
TEST_ERROR
- if (ma_size != (TEST_BLOCK_SIZE2048 - (TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50)))
+ if (ma_size != (TEST_BLOCK_SIZE2048 - (TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50)))
TEST_ERROR
/* Allocate third block from meta_aggr */
addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1970);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if (addr3 != ma_addr) TEST_ERROR
- if ((addr3+TEST_BLOCK_SIZE1970) != new_ma_addr) TEST_ERROR
+ if (addr3 != ma_addr)
+ TEST_ERROR
+ if ((addr3 + TEST_BLOCK_SIZE1970) != new_ma_addr)
+ TEST_ERROR
if (new_ma_size != (TEST_BLOCK_SIZE2048 - (TEST_BLOCK_SIZE1970 - ma_size)))
TEST_ERROR
@@ -2824,11 +2878,11 @@ test_mf_aggr_alloc5(const char *env_h5_drvr, hid_t fapl)
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr2, (hsize_t)TEST_BLOCK_SIZE50);
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr3, (hsize_t)TEST_BLOCK_SIZE1970);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
@@ -2838,17 +2892,16 @@ test_mf_aggr_alloc5(const char *env_h5_drvr, hid_t fapl)
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support metadata aggregator");
+ SKIPPED();
+ puts(" Current VFD doesn't support metadata aggregator");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_aggr_alloc5() */
/*
@@ -2886,43 +2939,43 @@ error:
static unsigned
test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size, new_file_size; /* file size */
- H5FD_mem_t type, stype;
- haddr_t addr1, addr2, addr3, saddr1;
- haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF;
- hsize_t ma_size=0, new_ma_size=0, sdata_size=0;
- frspace_state_t state;
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size, new_file_size; /* file size */
+ H5FD_mem_t type, stype;
+ haddr_t addr1, addr2, addr3, saddr1;
+ haddr_t ma_addr = HADDR_UNDEF, new_ma_addr = HADDR_UNDEF, sdata_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0, new_ma_size = 0, sdata_size = 0;
+ frspace_state_t state;
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
TESTING("H5MF_alloc() of meta/sdata aggregator:test 6");
/* Skip test when using VFDs that don't use the metadata aggregator */
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
type = H5FD_MEM_SUPER;
@@ -2931,45 +2984,50 @@ test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl)
addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr1+TEST_BLOCK_SIZE30) != ma_addr)
+ if ((addr1 + TEST_BLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* Allocate second block from meta_aggr */
addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if (addr2+TEST_BLOCK_SIZE50 != ma_addr)
+ if (addr2 + TEST_BLOCK_SIZE50 != ma_addr)
TEST_ERROR
if (ma_size != (TEST_BLOCK_SIZE2048 - (TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50)))
TEST_ERROR
/* Allocate first block from sdata_aggr */
- stype = H5FD_MEM_DRAW;
+ stype = H5FD_MEM_DRAW;
saddr1 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if ((saddr1+TEST_BLOCK_SIZE30) != sdata_addr) TEST_ERROR
- if (sdata_size != (TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30)) TEST_ERROR
+ if ((saddr1 + TEST_BLOCK_SIZE30) != sdata_addr)
+ TEST_ERROR
+ if (sdata_size != (TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30))
+ TEST_ERROR
/* Allocate third block from meta_aggr */
addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1970);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if ((addr3+TEST_BLOCK_SIZE1970) != new_ma_addr) TEST_ERROR
- if (addr3 != (sdata_addr+sdata_size)) TEST_ERROR
+ if ((addr3 + TEST_BLOCK_SIZE1970) != new_ma_addr)
+ TEST_ERROR
+ if (addr3 != (sdata_addr + sdata_size))
+ TEST_ERROR
- if ((ma_addr+TEST_BLOCK_SIZE1970) == new_ma_addr) TEST_ERROR
+ if ((ma_addr + TEST_BLOCK_SIZE1970) == new_ma_addr)
+ TEST_ERROR
if (new_ma_size != (TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE1970))
TEST_ERROR
/* Verify that meta_aggr's unused space of 1968 is freed to free-space */
HDmemset(&state, 0, sizeof(frspace_state_t));
- state.tot_space += (TEST_BLOCK_SIZE2048 - (TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50));
+ state.tot_space += (TEST_BLOCK_SIZE2048 - (TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50));
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Free all the allocated blocks */
@@ -2978,11 +3036,11 @@ test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl)
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr3, (hsize_t)TEST_BLOCK_SIZE1970);
H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr1, (hsize_t)TEST_BLOCK_SIZE30);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
@@ -2992,17 +3050,16 @@ test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl)
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support metadata aggregator");
+ SKIPPED();
+ puts(" Current VFD doesn't support metadata aggregator");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_aggr_alloc6() */
/*
@@ -3051,81 +3108,83 @@ error:
static unsigned
test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t empty_size, file_size;
- H5FD_mem_t type, stype;
- haddr_t addr1, addr2, addr3, saddr1, saddr2, saddr3;
- haddr_t ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF;
- hsize_t ma_size=0, sdata_size=0;
- frspace_state_t state;
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t empty_size, file_size;
+ H5FD_mem_t type, stype;
+ haddr_t addr1, addr2, addr3, saddr1, saddr2, saddr3;
+ haddr_t ma_addr = HADDR_UNDEF, sdata_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0, sdata_size = 0;
+ frspace_state_t state;
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
TESTING("H5MF_alloc() of meta/sdata aggregator:test 7");
/* Skip test when using VFDs that don't use the metadata aggregator */
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((empty_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((empty_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
/* Allocate the first block from meta_aggr */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr1+TEST_BLOCK_SIZE30) != ma_addr)
+ if ((addr1 + TEST_BLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* Allocate the second block from meta_aggr */
addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if (addr2+TEST_BLOCK_SIZE50 != ma_addr)
+ if (addr2 + TEST_BLOCK_SIZE50 != ma_addr)
TEST_ERROR
if (ma_size != (TEST_BLOCK_SIZE2048 - (TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50)))
TEST_ERROR
/* Allocate the first block from sdata_aggr */
- stype = H5FD_MEM_DRAW;
+ stype = H5FD_MEM_DRAW;
saddr1 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if ((saddr1+TEST_BLOCK_SIZE30) != sdata_addr)
+ if ((saddr1 + TEST_BLOCK_SIZE30) != sdata_addr)
TEST_ERROR
/* Allocate the second block from sdata_aggr */
- saddr2 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30);
+ saddr2 =
+ H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if ((saddr2+(TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30)) != sdata_addr)
+ if ((saddr2 + (TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30)) != sdata_addr)
+ TEST_ERROR
+ if (sdata_size != 0)
TEST_ERROR
- if (sdata_size != 0) TEST_ERROR
/* Allocate the third block from sdata_aggr */
saddr3 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50);
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if ((saddr3+TEST_BLOCK_SIZE50) != sdata_addr)
+ if ((saddr3 + TEST_BLOCK_SIZE50) != sdata_addr)
TEST_ERROR
if (sdata_size != (TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE50))
TEST_ERROR
@@ -3134,14 +3193,19 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl)
addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1970);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if (addr3 != sdata_addr) TEST_ERROR
- if ((addr3 + TEST_BLOCK_SIZE1970) != ma_addr) TEST_ERROR
- if (ma_size != (TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE1970)) TEST_ERROR
+ if (addr3 != sdata_addr)
+ TEST_ERROR
+ if ((addr3 + TEST_BLOCK_SIZE1970) != ma_addr)
+ TEST_ERROR
+ if (ma_size != (TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE1970))
+ TEST_ERROR
/* sdata_aggr info is reset to 0 */
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if (sdata_addr != HADDR_UNDEF) TEST_ERROR
- if (sdata_size != 0) TEST_ERROR
+ if (sdata_addr != HADDR_UNDEF)
+ TEST_ERROR
+ if (sdata_size != 0)
+ TEST_ERROR
/* Verify that meta_aggr's unused space of 1968 is freed to free-space */
HDmemset(&state, 0, sizeof(frspace_state_t));
@@ -3149,7 +3213,7 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl)
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Free all the allocated blocks */
@@ -3157,14 +3221,15 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl)
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr2, (hsize_t)TEST_BLOCK_SIZE50);
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr3, (hsize_t)TEST_BLOCK_SIZE1970);
H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr1, (hsize_t)TEST_BLOCK_SIZE30);
- H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr2, (hsize_t)(TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30));
+ H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr2,
+ (hsize_t)(TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30));
H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr3, (hsize_t)TEST_BLOCK_SIZE50);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
@@ -3174,17 +3239,16 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl)
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support metadata aggregator");
+ SKIPPED();
+ puts(" Current VFD doesn't support metadata aggregator");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_aggr_alloc7() */
/*
@@ -3206,56 +3270,56 @@ error:
*
* Test 3: Allocate block A from meta_aggr
* Allocate block B from sdata_aggr so that meta_aggr is not at end of file
- * Try to extend a block which adjoins meta_aggr but meta_aggr cannot fulfill the extended-request
- * H5MF_try_extend() fails
+ * Try to extend a block which adjoins meta_aggr but meta_aggr cannot fulfill the
+ *extended-request H5MF_try_extend() fails
*/
static unsigned
test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t empty_size, file_size;
- H5FD_mem_t type, stype;
- haddr_t new_addr, addr, saddr;
- haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF;
- hsize_t ma_size=0, new_ma_size=0, sdata_size=0;
- htri_t was_extended;
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t empty_size, file_size;
+ H5FD_mem_t type, stype;
+ haddr_t new_addr, addr, saddr;
+ haddr_t ma_addr = HADDR_UNDEF, new_ma_addr = HADDR_UNDEF, sdata_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0, new_ma_size = 0, sdata_size = 0;
+ htri_t was_extended;
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
TESTING("H5MF_try_extend() of meta/sdata aggregator: test 1");
/* Skip test when using VFDs that don't use the metadata aggregator */
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((empty_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((empty_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
/* Allocate the first block from meta_aggr */
type = H5FD_MEM_SUPER;
addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr+TEST_BLOCK_SIZE30) != ma_addr)
+ if ((addr + TEST_BLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* Adjust meta_aggr's info info for testing */
@@ -3265,58 +3329,64 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
new_addr = addr - 10;
/* Try to extend the block by an amount < (% * aggr->alloc_size) */
- was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE50));
+ was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)new_addr, (hsize_t)10,
+ (hsize_t)(TEST_BLOCK_SIZE50));
/* should succeed */
- if(!was_extended)
+ if (!was_extended)
TEST_ERROR
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if (new_ma_addr != (addr+TEST_BLOCK_SIZE50))
+ if (new_ma_addr != (addr + TEST_BLOCK_SIZE50))
+ TEST_ERROR
+ if (new_ma_size != (f->shared->meta_aggr.alloc_size - TEST_BLOCK_SIZE50))
TEST_ERROR
- if (new_ma_size != (f->shared->meta_aggr.alloc_size - TEST_BLOCK_SIZE50)) TEST_ERROR
/* Free the allocated blocks */
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)TEST_BLOCK_SIZE50);
/* Try to extend the block by an amount > (% * aggr->alloc_size) but amount < aggr->alloc_size */
- was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE700));
+ was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)new_addr, (hsize_t)10,
+ (hsize_t)(TEST_BLOCK_SIZE700));
/* should succeed */
- if(!was_extended)
+ if (!was_extended)
TEST_ERROR
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
if (new_ma_addr != (addr + TEST_BLOCK_SIZE700))
TEST_ERROR
- if (new_ma_size != (f->shared->meta_aggr.alloc_size * 2 - TEST_BLOCK_SIZE700)) TEST_ERROR
+ if (new_ma_size != (f->shared->meta_aggr.alloc_size * 2 - TEST_BLOCK_SIZE700))
+ TEST_ERROR
/* Free the allocated blocks */
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)TEST_BLOCK_SIZE700);
/* Try to extend the block by an amount > (% * aggr->alloc_size) but amount > aggr->alloc_size */
- was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE2058));
+ was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)new_addr, (hsize_t)10,
+ (hsize_t)(TEST_BLOCK_SIZE2058));
/* should succeed */
- if(!was_extended)
+ if (!was_extended)
TEST_ERROR
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
if (new_ma_addr != (addr + TEST_BLOCK_SIZE2058))
TEST_ERROR
- if (new_ma_size != f->shared->meta_aggr.size) TEST_ERROR
+ if (new_ma_size != f->shared->meta_aggr.size)
+ TEST_ERROR
/* Free the allocated blocks */
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)TEST_BLOCK_SIZE2058);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
@@ -3326,34 +3396,34 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support metadata aggregator");
+ SKIPPED();
+ puts(" Current VFD doesn't support metadata aggregator");
} /* end else */
TESTING("H5MF_try_extend() of meta/sdata aggregator: test 2");
/* Skip test when using VFDs that don't use the metadata aggregator */
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
/* Allocate the first block from meta_aggr */
type = H5FD_MEM_SUPER;
addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr+TEST_BLOCK_SIZE30) != ma_addr)
+ if ((addr + TEST_BLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* Allocate the first block from sdata_aggr */
stype = H5FD_MEM_DRAW;
saddr = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50);
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if ((saddr+TEST_BLOCK_SIZE50) != sdata_addr)
+ if ((saddr + TEST_BLOCK_SIZE50) != sdata_addr)
TEST_ERROR
/* Adjust meta_aggr's info info for testing */
@@ -3363,16 +3433,17 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
new_addr = addr - 10;
/* should be able to fulfill request from the aggreqator itself */
- was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE50));
+ was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)new_addr, (hsize_t)10,
+ (hsize_t)(TEST_BLOCK_SIZE50));
- if(!was_extended)
+ if (!was_extended)
TEST_ERROR
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if (new_ma_addr != (addr+TEST_BLOCK_SIZE50))
+ if (new_ma_addr != (addr + TEST_BLOCK_SIZE50))
TEST_ERROR
- if (new_ma_size != (f->shared->meta_aggr.alloc_size-TEST_BLOCK_SIZE50))
+ if (new_ma_size != (f->shared->meta_aggr.alloc_size - TEST_BLOCK_SIZE50))
TEST_ERROR
/* Restore info for meta_aggr */
@@ -3382,11 +3453,11 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)TEST_BLOCK_SIZE30);
H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr, (hsize_t)TEST_BLOCK_SIZE50);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
@@ -3396,34 +3467,34 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support metadata aggregator");
+ SKIPPED();
+ puts(" Current VFD doesn't support metadata aggregator");
} /* end else */
TESTING("H5MF_try_extend() of meta/sdata aggregator: test 3");
/* Skip test when using VFDs that don't use the metadata aggregator */
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
/* Allocate first block from meta_aggr */
type = H5FD_MEM_SUPER;
addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr+TEST_BLOCK_SIZE30) != ma_addr)
+ if ((addr + TEST_BLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* Allocate first block from sdata_aggr */
stype = H5FD_MEM_DRAW;
saddr = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50);
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if ((saddr+TEST_BLOCK_SIZE50) != sdata_addr)
+ if ((saddr + TEST_BLOCK_SIZE50) != sdata_addr)
TEST_ERROR
/* Adjust meta_aggr's info info for testing */
@@ -3433,15 +3504,18 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
new_addr = addr - 10;
/* unable to fulfill request from the aggreqator itself */
- was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE50));
+ was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)new_addr, (hsize_t)10,
+ (hsize_t)(TEST_BLOCK_SIZE50));
- if(was_extended)
+ if (was_extended)
TEST_ERROR
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if (new_ma_addr != addr) TEST_ERROR
- if (new_ma_size != 0) TEST_ERROR
+ if (new_ma_addr != addr)
+ TEST_ERROR
+ if (new_ma_size != 0)
+ TEST_ERROR
/* restore info for meta_aggr */
f->shared->meta_aggr.addr = ma_addr;
@@ -3450,11 +3524,11 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)TEST_BLOCK_SIZE30);
H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr, (hsize_t)TEST_BLOCK_SIZE50);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
@@ -3464,17 +3538,16 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support metadata aggregator");
+ SKIPPED();
+ puts(" Current VFD doesn't support metadata aggregator");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_aggr_extend() */
/*
@@ -3504,68 +3577,69 @@ error:
static unsigned
test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t empty_size, file_size;
- H5FD_mem_t type, stype;
- haddr_t addr1, addr2, addr3, saddr1;
- haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF;
- haddr_t new_sdata_addr=HADDR_UNDEF;
- hsize_t ma_size=0, new_ma_size=0;
- hsize_t sdata_size=0, new_sdata_size=0;
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t empty_size, file_size;
+ H5FD_mem_t type, stype;
+ haddr_t addr1, addr2, addr3, saddr1;
+ haddr_t ma_addr = HADDR_UNDEF, new_ma_addr = HADDR_UNDEF;
+ haddr_t new_sdata_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0, new_ma_size = 0;
+ hsize_t sdata_size = 0, new_sdata_size = 0;
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
TESTING("H5MF_try_shrink() of meta/sdata aggregator: test 1");
/* Skip test when using VFDs that don't use the metadata aggregator */
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((empty_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((empty_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
/* Allocate block A from meta_aggr */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
ma_addr = new_ma_addr - TEST_BLOCK_SIZE30;
- if((addr1 + TEST_BLOCK_SIZE30) != new_ma_addr)
+ if ((addr1 + TEST_BLOCK_SIZE30) != new_ma_addr)
TEST_ERROR
/* should succeed */
- if(H5MF_try_shrink(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30) <= 0)
+ if (H5MF_try_shrink(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30) <= 0)
TEST_ERROR
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if (new_ma_addr != ma_addr) TEST_ERROR
+ if (new_ma_addr != ma_addr)
+ TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
@@ -3575,56 +3649,62 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl)
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support metadata aggregator");
+ SKIPPED();
+ puts(" Current VFD doesn't support metadata aggregator");
} /* end else */
TESTING("H5MF_try_shrink() of meta/sdata aggregator: test 2");
/* Skip test when using VFDs that don't use the metadata aggregator */
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
/* Allocate block A from meta_aggr */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr1+TEST_BLOCK_SIZE30) != ma_addr) TEST_ERROR
- if (ma_size != (TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30)) TEST_ERROR
+ if ((addr1 + TEST_BLOCK_SIZE30) != ma_addr)
+ TEST_ERROR
+ if (ma_size != (TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30))
+ TEST_ERROR
/* Allocate block B from sdata_aggr */
- stype = H5FD_MEM_DRAW;
+ stype = H5FD_MEM_DRAW;
saddr1 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50);
H5MF_aggr_query(f, &(f->shared->sdata_aggr), NULL, &sdata_size);
/* should succeed */
- if(H5MF_try_shrink(f, stype, H5P_DATASET_XFER_DEFAULT, saddr1, (hsize_t)TEST_BLOCK_SIZE50) <= 0)
+ if (H5MF_try_shrink(f, stype, H5P_DATASET_XFER_DEFAULT, saddr1, (hsize_t)TEST_BLOCK_SIZE50) <= 0)
TEST_ERROR
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &new_sdata_addr, &new_sdata_size);
- if (new_sdata_addr != saddr1) TEST_ERROR
- if (new_sdata_size != sdata_size + TEST_BLOCK_SIZE50) TEST_ERROR
+ if (new_sdata_addr != saddr1)
+ TEST_ERROR
+ if (new_sdata_size != sdata_size + TEST_BLOCK_SIZE50)
+ TEST_ERROR
/* meta_aggr info should be updated because the block is absorbed into the meta_aggr */
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if (new_ma_addr != ma_addr) TEST_ERROR
- if (new_ma_size != (ma_size)) TEST_ERROR
+ if (new_ma_addr != ma_addr)
+ TEST_ERROR
+ if (new_ma_size != (ma_size))
+ TEST_ERROR
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
@@ -3634,59 +3714,62 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl)
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support metadata aggregator");
+ SKIPPED();
+ puts(" Current VFD doesn't support metadata aggregator");
} /* end else */
TESTING("H5MF_try_shrink() of meta/sdata aggregator: test 3");
/* Skip test when using VFDs that don't use the metadata aggregator */
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
/* Allocate block A from meta_aggr */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr1+TEST_BLOCK_SIZE30) != ma_addr)
+ if ((addr1 + TEST_BLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* Allocate block B from meta_aggr */
addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr2+TEST_BLOCK_SIZE50) != ma_addr)
+ if ((addr2 + TEST_BLOCK_SIZE50) != ma_addr)
TEST_ERROR
/* Allocate block C from meta_aggr */
- addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)(TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50));
+ addr3 =
+ H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)(TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50));
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr3+TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50) != ma_addr)
+ if ((addr3 + TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50) != ma_addr)
TEST_ERROR
/* should not succeed */
- if(H5MF_try_shrink(f, type, H5P_DATASET_XFER_DEFAULT, addr2, (hsize_t)TEST_BLOCK_SIZE50) > 0)
+ if (H5MF_try_shrink(f, type, H5P_DATASET_XFER_DEFAULT, addr2, (hsize_t)TEST_BLOCK_SIZE50) > 0)
TEST_ERROR
/* aggregator info should be the same as before */
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if (new_ma_addr != ma_addr) TEST_ERROR
+ if (new_ma_addr != ma_addr)
+ TEST_ERROR
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30);
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr2, (hsize_t)TEST_BLOCK_SIZE50);
- H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr3, (hsize_t)(TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50));
+ H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr3,
+ (hsize_t)(TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50));
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
@@ -3696,17 +3779,16 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl)
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support metadata aggregator");
+ SKIPPED();
+ puts(" Current VFD doesn't support metadata aggregator");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_aggr_absorb() */
/*
@@ -3742,117 +3824,122 @@ error:
static unsigned
test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
{
- hid_t file = -1; /* File ID */
- hid_t fapl1;
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size, new_file_size;
- H5FD_mem_t type;
- haddr_t addr1, addr2;
- haddr_t ma_addr=HADDR_UNDEF;
- hsize_t ma_size=0;
- htri_t was_extended;
- frspace_state_t state;
- hsize_t alignment=0, mis_align=0, tmp=0, accum=0;
- hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
+ hid_t file = -1; /* File ID */
+ hid_t fapl1;
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size, new_file_size;
+ H5FD_mem_t type;
+ haddr_t addr1, addr2;
+ haddr_t ma_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0;
+ htri_t was_extended;
+ frspace_state_t state;
+ hsize_t alignment = 0, mis_align = 0, tmp = 0, accum = 0;
+ hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
TESTING("H5MM_alloc() of file allocation with alignment: test 1");
/* Skip test when using VFDs that have their own 'alloc' callback, which
* don't push mis-aligned space fragments on the file free space list
*/
- have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
- && HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(have_alloc_vfd) {
+ have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") &&
+ HDstrcmp(env_h5_drvr, "multi"));
+ if (have_alloc_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Turn off using meta/small data aggregator */
- if((fapl1 = H5Pcopy(new_fapl)) < 0) TEST_ERROR
+ if ((fapl1 = H5Pcopy(new_fapl)) < 0)
+ TEST_ERROR
H5Pset_meta_block_size(fapl1, (hsize_t)0);
H5Pset_small_data_block_size(fapl1, (hsize_t)0);
/* Create the file to work on (without alignment) */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* get alignment setting */
- if(H5Pget_alignment(fapl1, NULL, &alignment) < 0)
+ if (H5Pget_alignment(fapl1, NULL, &alignment) < 0)
TEST_ERROR
/* Re-open the file with alignment and meta/sdata setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl1)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl1)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
/* calculate fragment for alignment of block 30 */
if ((tmp = (hsize_t)file_size % alignment))
- mis_align = alignment - tmp;
+ mis_align = alignment - tmp;
accum = mis_align + TEST_BLOCK_SIZE30;
/* Allocate a block of 30 from file allocation */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
/* Verify that the allocated block is aligned */
- if (addr1 % alignment) TEST_ERROR
+ if (addr1 % alignment)
+ TEST_ERROR
/* there should be nothing in the aggregator */
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if (ma_addr || ma_size) TEST_ERROR
+ if (ma_addr || ma_size)
+ TEST_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
if (mis_align) {
state.tot_space += mis_align;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
}
/* calculate fragment for alignment of block 50 */
mis_align = 0;
if ((tmp = ((hsize_t)file_size + accum) % alignment))
- mis_align = alignment - tmp;
+ mis_align = alignment - tmp;
accum += (mis_align + TEST_BLOCK_SIZE50);
addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50);
/* Verify that the allocated block is aligned */
- if (addr2 % alignment) TEST_ERROR
+ if (addr2 % alignment)
+ TEST_ERROR
/* there should be nothing in the aggregator */
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if (ma_addr || ma_size) TEST_ERROR
+ if (ma_addr || ma_size)
+ TEST_ERROR
if (mis_align) {
state.tot_space += mis_align;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
}
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30);
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr2, (hsize_t)TEST_BLOCK_SIZE50);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
- if((new_file_size = h5_get_file_size(filename, fapl1)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl1)) < 0)
TEST_ERROR
if (new_file_size != file_size)
@@ -3861,8 +3948,8 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support mis-aligned fragments");
+ SKIPPED();
+ puts(" Current VFD doesn't support mis-aligned fragments");
} /* end else */
TESTING("H5MF_try_shrink() of file allocation with alignment: test 2");
@@ -3870,54 +3957,56 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* Skip test when using VFDs that have their own 'alloc' callback, which
* don't push mis-aligned space fragments on the file free space list
*/
- if(have_alloc_vfd) {
+ if (have_alloc_vfd) {
/* Re-open the file with alignment and meta/sdata setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl1)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl1)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
/* allocate a block of 50 from meta_aggr */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50);
/* address should be aligned */
- if (addr1 % alignment) TEST_ERROR
+ if (addr1 % alignment)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
- if((file_size = h5_get_file_size(filename, fapl1)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl1)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl1)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl1)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
/* shrink the block */
- if(H5MF_try_shrink(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE50) <= 0)
+ if (H5MF_try_shrink(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE50) <= 0)
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
- if((new_file_size = h5_get_file_size(filename, fapl1)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl1)) < 0)
TEST_ERROR
- if (new_file_size != (file_size-TEST_BLOCK_SIZE50)) TEST_ERROR
+ if (new_file_size != (file_size - TEST_BLOCK_SIZE50))
+ TEST_ERROR
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support mis-aligned fragments");
+ SKIPPED();
+ puts(" Current VFD doesn't support mis-aligned fragments");
} /* end else */
TESTING("H5MF_try_extend() of file allocation with alignment: test 3");
@@ -3925,64 +4014,67 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* Skip test when using VFDs that have their own 'alloc' callback, which
* don't push mis-aligned space fragments on the file free space list
*/
- if(have_alloc_vfd) {
+ if (have_alloc_vfd) {
/* Re-open the file with alignment and meta/sdata setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl1)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl1)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
/* allocate a block of 50 */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50);
/* address should be aligned */
- if (addr1 % alignment) TEST_ERROR
+ if (addr1 % alignment)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
- if((file_size = h5_get_file_size(filename, fapl1)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl1)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl1)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl1)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
/* try to extend the block */
- was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)addr1, (hsize_t)TEST_BLOCK_SIZE50, (hsize_t)TEST_BLOCK_SIZE30);
+ was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)addr1,
+ (hsize_t)TEST_BLOCK_SIZE50, (hsize_t)TEST_BLOCK_SIZE30);
- if (was_extended <=0) TEST_ERROR
+ if (was_extended <= 0)
+ TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
- if((new_file_size = h5_get_file_size(filename, fapl1)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl1)) < 0)
TEST_ERROR
- if (new_file_size != (file_size+TEST_BLOCK_SIZE30)) TEST_ERROR
+ if (new_file_size != (file_size + TEST_BLOCK_SIZE30))
+ TEST_ERROR
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support mis-aligned fragments");
+ SKIPPED();
+ puts(" Current VFD doesn't support mis-aligned fragments");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_align_eoa() */
/*
@@ -4022,18 +4114,18 @@ error:
static unsigned
test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- h5_stat_size_t file_size;
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FD_mem_t type;
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ h5_stat_size_t file_size;
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5FD_mem_t type;
H5MF_free_section_t *sect_node = NULL;
- haddr_t addr;
- frspace_state_t state;
- H5MF_sect_ud_t udata;
- htri_t was_extended;
- hsize_t alignment=0, tmp=0, mis_align=0;
- hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
+ haddr_t addr;
+ frspace_state_t state;
+ H5MF_sect_ud_t udata;
+ htri_t was_extended;
+ hsize_t alignment = 0, tmp = 0, mis_align = 0;
+ hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
TESTING("H5MF_alloc() of free-space manager with alignment: test 1");
@@ -4041,68 +4133,71 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* get alignment setting */
- if(H5Pget_alignment(new_fapl, NULL, &alignment) < 0)
+ if (H5Pget_alignment(new_fapl, NULL, &alignment) < 0)
TEST_ERROR
/* Re-open the file with alignment setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
type = H5FD_MEM_SUPER;
- if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
+ if (H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
TEST_ERROR
if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN)
- TEST_ERROR
+ TEST_ERROR
if (f->shared->fs_man[type]->client != H5FS_CLIENT_FILE_ID)
- TEST_ERROR
+ TEST_ERROR
sect_node = H5MF_sect_simple_new((haddr_t)alignment, (hsize_t)TEST_BLOCK_SIZE50);
/* Construct user data for callbacks */
- udata.f = f;
- udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
- udata.alloc_type = type;
- udata.allow_sect_absorb = TRUE;
+ udata.f = f;
+ udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
+ udata.alloc_type = type;
+ udata.allow_sect_absorb = TRUE;
udata.allow_eoa_shrink_only = FALSE;
/* Add section A to free-space manager */
- if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node,
+ H5FS_ADD_RETURNED_SPACE, &udata))
+ FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
state.tot_space += TEST_BLOCK_SIZE50;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Allocate a block of 50 */
addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50);
/* Verify that the allocated block is section A in free-space */
- if (addr != (haddr_t)alignment) TEST_ERROR
- if (addr % alignment) TEST_ERROR
+ if (addr != (haddr_t)alignment)
+ TEST_ERROR
+ if (addr % alignment)
+ TEST_ERROR
state.tot_space -= TEST_BLOCK_SIZE50;
state.tot_sect_count -= 1;
state.serial_sect_count -= 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Free the block to free-space */
@@ -4111,92 +4206,95 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
state.tot_space += TEST_BLOCK_SIZE50;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED()
TESTING("H5MF_alloc() of free-space manager with alignment: test 2");
-
/* Re-open the file with alignment setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
type = H5FD_MEM_SUPER;
- if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
+ if (H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
TEST_ERROR
if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN)
- TEST_ERROR
+ TEST_ERROR
if (f->shared->fs_man[type]->client != H5FS_CLIENT_FILE_ID)
- TEST_ERROR
+ TEST_ERROR
sect_node = H5MF_sect_simple_new((haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE8000);
/* Construct user data for callbacks */
- udata.f = f;
- udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
- udata.alloc_type = type;
- udata.allow_sect_absorb = TRUE;
+ udata.f = f;
+ udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
+ udata.alloc_type = type;
+ udata.allow_sect_absorb = TRUE;
udata.allow_eoa_shrink_only = FALSE;
/* Add section A to free-space manager */
- if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node,
+ H5FS_ADD_RETURNED_SPACE, &udata))
+ FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
state.tot_space += TEST_BLOCK_SIZE8000;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Allocate a block of 600 */
addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE600);
/* Verify that the allocated block is aligned */
- if (addr % alignment) TEST_ERROR
+ if (addr % alignment)
+ TEST_ERROR
/* should have 1 more section in free-space */
state.tot_space -= TEST_BLOCK_SIZE600;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* try to extend the block */
- was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)addr, (hsize_t)TEST_BLOCK_SIZE600, (hsize_t)TEST_BLOCK_SIZE200);
+ was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)addr,
+ (hsize_t)TEST_BLOCK_SIZE600, (hsize_t)TEST_BLOCK_SIZE200);
- if (was_extended <=0) TEST_ERROR
+ if (was_extended <= 0)
+ TEST_ERROR
/* space should be decreased by 200, # of sections remain the same */
state.tot_space -= TEST_BLOCK_SIZE200;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Free the block to free-space manager */
- H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)(TEST_BLOCK_SIZE600+TEST_BLOCK_SIZE200));
+ H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)(TEST_BLOCK_SIZE600 + TEST_BLOCK_SIZE200));
/* only 1 section in free-space because of merging */
- state.tot_space += (TEST_BLOCK_SIZE600+TEST_BLOCK_SIZE200);
- state.tot_sect_count = 1;
+ state.tot_space += (TEST_BLOCK_SIZE600 + TEST_BLOCK_SIZE200);
+ state.tot_sect_count = 1;
state.serial_sect_count = 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED()
@@ -4206,23 +4304,23 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* Skip test when using VFDs that have their own 'alloc' callback, which
* don't push mis-aligned space fragments on the file free space list
*/
- have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
- && HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(have_alloc_vfd) {
- if((file_size = h5_get_file_size(filename, new_fapl)) < 0)
+ have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") &&
+ HDstrcmp(env_h5_drvr, "multi"));
+ if (have_alloc_vfd) {
+ if ((file_size = h5_get_file_size(filename, new_fapl)) < 0)
TEST_ERROR
/* Re-open the file with alignment setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
type = H5FD_MEM_SUPER;
- if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
+ if (H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
TEST_ERROR
if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN)
@@ -4233,22 +4331,23 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
sect_node = H5MF_sect_simple_new((haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE700);
/* Construct user data for callbacks */
- udata.f = f;
- udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
- udata.alloc_type = type;
- udata.allow_sect_absorb = TRUE;
- udata.allow_eoa_shrink_only = FALSE;
+ udata.f = f;
+ udata.dxpl_id = H5P_DATASET_XFER_DEFAULT;
+ udata.alloc_type = type;
+ udata.allow_sect_absorb = TRUE;
+ udata.allow_eoa_shrink_only = FALSE;
/* Add section A to free-space manager */
- if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata))
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type],
+ (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata))
+ FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
state.tot_space += TEST_BLOCK_SIZE700;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/*
* Allocate a block of 40
@@ -4262,7 +4361,8 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
TEST_ERROR
/* verify that the allocated block is from file allocation, not section A in free-space */
- if (!(addr >= (haddr_t)file_size)) TEST_ERROR
+ if (!(addr >= (haddr_t)file_size))
+ TEST_ERROR
/* calculate fragment for alignment of block 40 from file allocation */
if ((tmp = (hsize_t)file_size % alignment))
@@ -4275,26 +4375,25 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
}
/* free-space info should be the same */
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support mis-aligned fragments");
+ SKIPPED();
+ puts(" Current VFD doesn't support mis-aligned fragments");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_align_fs() */
/*
@@ -4396,53 +4495,52 @@ error:
static unsigned
test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size; /* File size */
-
- H5FD_mem_t type;
- haddr_t addr1, addr2, addr3, addr4;
- frspace_state_t state;
- haddr_t ma_addr=HADDR_UNDEF;
- hsize_t ma_size=0, mis_align=0;
- hsize_t alignment=0, tmp=0;
- hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
-
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size; /* File size */
+
+ H5FD_mem_t type;
+ haddr_t addr1, addr2, addr3, addr4;
+ frspace_state_t state;
+ haddr_t ma_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0, mis_align = 0;
+ hsize_t alignment = 0, tmp = 0;
+ hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 1");
/* Skip test when using VFDs that have their own 'alloc' callback, which
* don't push mis-aligned space fragments on the file free space list
*/
- have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
- && HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(have_alloc_vfd) {
+ have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") &&
+ HDstrcmp(env_h5_drvr, "multi"));
+ if (have_alloc_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on (without alignment) */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* get alignment setting */
- if(H5Pget_alignment(new_fapl, NULL, &alignment) < 0)
+ if (H5Pget_alignment(new_fapl, NULL, &alignment) < 0)
TEST_ERROR
/* Re-open the file with alignment setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
/* calculate fragment for alignment of block 30 */
@@ -4450,11 +4548,12 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
mis_align = alignment - tmp;
/* Allocate a block of 30 from meta_aggr */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
/* Verify that the allocated block is aligned */
- if (addr1 % alignment) TEST_ERROR
+ if (addr1 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 30 is freed to free-space */
HDmemset(&state, 0, sizeof(frspace_state_t));
@@ -4478,7 +4577,8 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50);
/* Verify that the allocated block is aligned */
- if (addr2 % alignment) TEST_ERROR
+ if (addr2 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 50 is freed to free-space */
if (mis_align) {
@@ -4500,7 +4600,8 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE80);
/* Verify that the allocated block is aligned */
- if (addr3 % alignment) TEST_ERROR
+ if (addr3 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 80 is freed to free-space */
if (mis_align) {
@@ -4523,7 +4624,8 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
addr4 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1970);
/* Verify that the allocated block is aligned */
- if (addr4 % alignment) TEST_ERROR
+ if (addr4 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 1970 is freed to free-space */
if (mis_align) {
@@ -4538,7 +4640,7 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
TEST_ERROR
/* Verify total size of free space after all the allocations */
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30);
@@ -4546,23 +4648,22 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr3, (hsize_t)TEST_BLOCK_SIZE80);
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr3, (hsize_t)TEST_BLOCK_SIZE1970);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support mis-aligned fragments");
+ SKIPPED();
+ puts(" Current VFD doesn't support mis-aligned fragments");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_align_alloc1() */
/*
@@ -4656,51 +4757,51 @@ error:
static unsigned
test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size; /* File size */
- H5FD_mem_t type, stype;
- haddr_t addr1, addr2, addr3, saddr1;
- frspace_state_t state[H5FD_MEM_NTYPES];
- haddr_t ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF;
- hsize_t ma_size=0, sdata_size=0, mis_align=0;
- hsize_t alignment=0, tmp=0;
- hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size; /* File size */
+ H5FD_mem_t type, stype;
+ haddr_t addr1, addr2, addr3, saddr1;
+ frspace_state_t state[H5FD_MEM_NTYPES];
+ haddr_t ma_addr = HADDR_UNDEF, sdata_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0, sdata_size = 0, mis_align = 0;
+ hsize_t alignment = 0, tmp = 0;
+ hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 2");
/* Skip test when using VFDs that have their own 'alloc' callback, which
* don't push mis-aligned space fragments on the file free space list
*/
- have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
- && HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(have_alloc_vfd) {
+ have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") &&
+ HDstrcmp(env_h5_drvr, "multi"));
+ if (have_alloc_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on (without alignment) */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* get alignment setting */
- if(H5Pget_alignment(new_fapl, NULL, &alignment) < 0)
+ if (H5Pget_alignment(new_fapl, NULL, &alignment) < 0)
TEST_ERROR
/* Re-open the file with alignment setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
/* calculate fragment for alignment of block 30 */
@@ -4708,11 +4809,12 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
mis_align = alignment - tmp;
/* Allocate a block of 30 from meta_aggr */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
/* Verify that the allocated block is aligned */
- if (addr1 % alignment) TEST_ERROR
+ if (addr1 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 30 is freed to free-space */
HDmemset(&state, 0, sizeof(frspace_state_t) * H5FD_MEM_NTYPES);
@@ -4735,7 +4837,8 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50);
/* Verify that the allocated block is aligned */
- if (addr2 % alignment) TEST_ERROR
+ if (addr2 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 50 is freed to free-space */
if (mis_align) {
@@ -4767,7 +4870,7 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
mis_align = alignment - tmp;
/* Allocate a block of 30 from sdata_aggr */
- stype = H5FD_MEM_DRAW;
+ stype = H5FD_MEM_DRAW;
saddr1 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
/* fragment for alignment of block 30 for sdata_aggr is freed to free-space */
@@ -4778,12 +4881,14 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
}
/* Verify that the allocated block is aligned */
- if (saddr1 % alignment) TEST_ERROR
+ if (saddr1 % alignment)
+ TEST_ERROR
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if (sdata_addr != (saddr1 + TEST_BLOCK_SIZE30)) TEST_ERROR
+ if (sdata_addr != (saddr1 + TEST_BLOCK_SIZE30))
+ TEST_ERROR
/*
* Calculate fragment for the allocation of block 80 from meta_aggr:
@@ -4804,7 +4909,8 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE80);
/* Verify that the allocated block is aligned */
- if (addr3 % alignment) TEST_ERROR
+ if (addr3 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 80 is freed to free-space */
if (mis_align) {
@@ -4819,38 +4925,37 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
TEST_ERROR
/* Verify total size of free space after all the allocations */
- if(f->shared->fs_man[type]) {
- if(check_stats(f, f->shared->fs_man[type], &(state[type])))
- TEST_ERROR
- }
+ if (f->shared->fs_man[type]) {
+ if (check_stats(f, f->shared->fs_man[type], &(state[type])))
+ TEST_ERROR
+ }
- if(f->shared->fs_man[stype]) {
- if(check_stats(f, f->shared->fs_man[stype], &(state[stype])))
- TEST_ERROR
- }
+ if (f->shared->fs_man[stype]) {
+ if (check_stats(f, f->shared->fs_man[stype], &(state[stype])))
+ TEST_ERROR
+ }
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30);
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr2, (hsize_t)TEST_BLOCK_SIZE50);
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr3, (hsize_t)TEST_BLOCK_SIZE80);
H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr1, (hsize_t)TEST_BLOCK_SIZE30);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support mis-aligned fragments");
+ SKIPPED();
+ puts(" Current VFD doesn't support mis-aligned fragments");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_align_alloc2() */
/*
@@ -4996,53 +5101,52 @@ error:
static unsigned
test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size;
- H5FD_mem_t type, stype;
- haddr_t addr1, addr2, addr3;
- haddr_t saddr1, saddr2, saddr3;
- frspace_state_t state[H5FD_MEM_NTYPES];
- haddr_t ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF;
- hsize_t ma_size=0, sdata_size=0, mis_align=0;
- hsize_t alignment=0, tmp=0;
- hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
-
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size;
+ H5FD_mem_t type, stype;
+ haddr_t addr1, addr2, addr3;
+ haddr_t saddr1, saddr2, saddr3;
+ frspace_state_t state[H5FD_MEM_NTYPES];
+ haddr_t ma_addr = HADDR_UNDEF, sdata_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0, sdata_size = 0, mis_align = 0;
+ hsize_t alignment = 0, tmp = 0;
+ hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 3");
/* Skip test when using VFDs that have their own 'alloc' callback, which
* don't push mis-aligned space fragments on the file free space list
*/
- have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
- && HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(have_alloc_vfd) {
+ have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") &&
+ HDstrcmp(env_h5_drvr, "multi"));
+ if (have_alloc_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on (without alignment) */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* get alignment setting */
- if(H5Pget_alignment(new_fapl, NULL, &alignment) < 0)
+ if (H5Pget_alignment(new_fapl, NULL, &alignment) < 0)
TEST_ERROR
/* Re-open the file with alignment setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
/* calculate fragment for alignment of block 30 */
@@ -5050,11 +5154,12 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
mis_align = alignment - tmp;
/* Allocate a block of 30 from meta_aggr */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
/* Verify that the allocated block is aligned */
- if (addr1 % alignment) TEST_ERROR
+ if (addr1 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 30 is freed to free-space */
HDmemset(&state, 0, sizeof(frspace_state_t) * H5FD_MEM_NTYPES);
@@ -5077,7 +5182,8 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50);
/* Verify that the allocated block is aligned */
- if (addr2 % alignment) TEST_ERROR
+ if (addr2 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 50 is freed to free-space */
if (mis_align) {
@@ -5108,11 +5214,12 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
mis_align = alignment - tmp;
/* Allocate a block of 30 from sdata_aggr */
- stype = H5FD_MEM_DRAW;
+ stype = H5FD_MEM_DRAW;
saddr1 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
/* Verify that the allocated block is aligned */
- if (saddr1 % alignment) TEST_ERROR
+ if (saddr1 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 30 for sdata_aggr is freed to free-space */
if (mis_align) {
@@ -5122,7 +5229,8 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
}
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if (sdata_addr != (saddr1+TEST_BLOCK_SIZE30)) TEST_ERROR
+ if (sdata_addr != (saddr1 + TEST_BLOCK_SIZE30))
+ TEST_ERROR
/* calculate fragment for alignment of block 50 in sdata_aggr */
mis_align = 0;
@@ -5133,7 +5241,8 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
saddr2 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50);
/* Verify that the allocated block is aligned */
- if (saddr2 % alignment) TEST_ERROR
+ if (saddr2 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 50 for sdata_aggr is freed to free-space */
if (mis_align) {
@@ -5143,7 +5252,8 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
}
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if (sdata_addr != (saddr2 + TEST_BLOCK_SIZE50)) TEST_ERROR
+ if (sdata_addr != (saddr2 + TEST_BLOCK_SIZE50))
+ TEST_ERROR
/* calculate fragment for alignment of block 80 in sdata_aggr */
mis_align = 0;
@@ -5154,7 +5264,8 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
saddr3 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE80);
/* Verify that the allocated block is aligned */
- if (saddr3 % alignment) TEST_ERROR
+ if (saddr3 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 80 for sdata_aggr is freed to free-space */
if (mis_align) {
@@ -5176,7 +5287,8 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1034);
/* Verify that the allocated block is aligned */
- if (addr3 % alignment) TEST_ERROR
+ if (addr3 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 1034 for meta_aggr is freed to free-space */
if (mis_align) {
@@ -5203,36 +5315,34 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
TEST_ERROR
/* Verify total size of free space after all allocations */
- if(f->shared->fs_man[type]) {
- if(check_stats(f, f->shared->fs_man[type], &(state[type])))
- TEST_ERROR
- }
+ if (f->shared->fs_man[type]) {
+ if (check_stats(f, f->shared->fs_man[type], &(state[type])))
+ TEST_ERROR
+ }
- if(f->shared->fs_man[stype]) {
- if(check_stats(f, f->shared->fs_man[stype], &(state[stype])))
- TEST_ERROR
- }
+ if (f->shared->fs_man[stype]) {
+ if (check_stats(f, f->shared->fs_man[stype], &(state[stype])))
+ TEST_ERROR
+ }
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support mis-aligned fragments");
+ SKIPPED();
+ puts(" Current VFD doesn't support mis-aligned fragments");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_align_alloc3() */
-
/*
* To verify that blocks allocated from the aggregator are aligned
*
@@ -5300,52 +5410,51 @@ error:
static unsigned
test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size;
- H5FD_mem_t type;
- haddr_t addr1, addr2, addr3;
- frspace_state_t state;
- haddr_t ma_addr=HADDR_UNDEF;
- hsize_t ma_size=0, saved_ma_size=0;
- hsize_t alignment=0, mis_align=0, tmp=0;
- hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
-
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size;
+ H5FD_mem_t type;
+ haddr_t addr1, addr2, addr3;
+ frspace_state_t state;
+ haddr_t ma_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0, saved_ma_size = 0;
+ hsize_t alignment = 0, mis_align = 0, tmp = 0;
+ hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 4");
/* Skip test when using VFDs that have their own 'alloc' callback, which
* don't push mis-aligned space fragments on the file free space list
*/
- have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
- && HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(have_alloc_vfd) {
+ have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") &&
+ HDstrcmp(env_h5_drvr, "multi"));
+ if (have_alloc_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on (without alignment) */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file with alignment setting and meta/sdata setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
/* get alignment setting */
- if(H5Pget_alignment(new_fapl, NULL, &alignment) < 0)
+ if (H5Pget_alignment(new_fapl, NULL, &alignment) < 0)
TEST_ERROR
/* calculate fragment for alignment of block 30 */
@@ -5353,11 +5462,12 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
mis_align = alignment - tmp;
/* Allocate a block of 30 from meta_aggr */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
/* Verify that the allocated block is aligned */
- if (addr1 % alignment) TEST_ERROR
+ if (addr1 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 30 is freed to free-space */
HDmemset(&state, 0, sizeof(frspace_state_t));
@@ -5369,7 +5479,8 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
saved_ma_size = ma_size;
- if ((addr1+TEST_BLOCK_SIZE30) != ma_addr) TEST_ERROR
+ if ((addr1 + TEST_BLOCK_SIZE30) != ma_addr)
+ TEST_ERROR
/* calculate fragment for alignment of block 2058 */
mis_align = 0;
@@ -5380,7 +5491,8 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE2058);
/* Verify that the allocated block is aligned */
- if (addr2 % alignment) TEST_ERROR
+ if (addr2 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 2058 is freed to free-space */
if (mis_align) {
@@ -5391,10 +5503,12 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr2 + TEST_BLOCK_SIZE2058) != ma_addr) TEST_ERROR
+ if ((addr2 + TEST_BLOCK_SIZE2058) != ma_addr)
+ TEST_ERROR
/* meta_aggr->size remains the same */
- if (ma_size != saved_ma_size) TEST_ERROR
+ if (ma_size != saved_ma_size)
+ TEST_ERROR
/* calculate fragment for alignment of block 5 from meta_aggr */
mis_align = 0;
@@ -5412,31 +5526,31 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
}
/* Verify that the allocated block is aligned */
- if (addr3 % alignment) TEST_ERROR
+ if (addr3 % alignment)
+ TEST_ERROR
/* Verify total size of free space after all allocations */
- if(f->shared->fs_man[type]) {
- if(check_stats(f, f->shared->fs_man[type], &state))
- TEST_ERROR
- }
+ if (f->shared->fs_man[type]) {
+ if (check_stats(f, f->shared->fs_man[type], &state))
+ TEST_ERROR
+ }
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support mis-aligned fragments");
+ SKIPPED();
+ puts(" Current VFD doesn't support mis-aligned fragments");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_align_alloc4() */
/*
@@ -5512,53 +5626,52 @@ error:
static unsigned
test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size;
- H5FD_mem_t type, stype;
- haddr_t addr1, addr2, saddr1;
- frspace_state_t state[H5FD_MEM_NTYPES];
- haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF;
- haddr_t sdata_addr=HADDR_UNDEF, new_sdata_addr=HADDR_UNDEF;
- hsize_t ma_size=0, new_ma_size=0, sdata_size=0, new_sdata_size=0;
- hsize_t alignment=0, mis_align=0, tmp=0;
- hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
-
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size;
+ H5FD_mem_t type, stype;
+ haddr_t addr1, addr2, saddr1;
+ frspace_state_t state[H5FD_MEM_NTYPES];
+ haddr_t ma_addr = HADDR_UNDEF, new_ma_addr = HADDR_UNDEF;
+ haddr_t sdata_addr = HADDR_UNDEF, new_sdata_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0, new_ma_size = 0, sdata_size = 0, new_sdata_size = 0;
+ hsize_t alignment = 0, mis_align = 0, tmp = 0;
+ hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 5");
/* Skip test when using VFDs that have their own 'alloc' callback, which
* don't push mis-aligned space fragments on the file free space list
*/
- have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
- && HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(have_alloc_vfd) {
+ have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") &&
+ HDstrcmp(env_h5_drvr, "multi"));
+ if (have_alloc_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on (without alignment) */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file with alignment setting and meta/sdata setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
/* get alignment setting */
- if(H5Pget_alignment(new_fapl, NULL, &alignment) < 0)
+ if (H5Pget_alignment(new_fapl, NULL, &alignment) < 0)
TEST_ERROR
/* calculate fragment for alignment of block 30 */
@@ -5566,15 +5679,17 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
mis_align = alignment - tmp;
/* Allocate a block of 30 from meta_aggr */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
/* Verify that the allocated block is aligned */
- if (addr1 % alignment) TEST_ERROR
+ if (addr1 % alignment)
+ TEST_ERROR
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr1 + TEST_BLOCK_SIZE30) != ma_addr) TEST_ERROR
+ if ((addr1 + TEST_BLOCK_SIZE30) != ma_addr)
+ TEST_ERROR
/* fragment for alignment of block 30 is freed to free-space */
HDmemset(&state, 0, sizeof(frspace_state_t) * H5FD_MEM_NTYPES);
@@ -5590,11 +5705,12 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
mis_align = alignment - tmp;
/* Allocate a block of 30 from sdata_aggr */
- stype = H5FD_MEM_DRAW;
+ stype = H5FD_MEM_DRAW;
saddr1 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
/* Verify that the allocated block is aligned */
- if (saddr1 % alignment) TEST_ERROR
+ if (saddr1 % alignment)
+ TEST_ERROR
/* fragment of alignment for block 30 in sdata_aggr is freed to free-space */
if (mis_align) {
@@ -5604,7 +5720,8 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
}
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if ((saddr1+TEST_BLOCK_SIZE30) != sdata_addr) TEST_ERROR
+ if ((saddr1 + TEST_BLOCK_SIZE30) != sdata_addr)
+ TEST_ERROR
/* calculate fragment for alignment of block 2058 from meta_aggr */
mis_align = 0;
@@ -5615,7 +5732,8 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE2058);
/* Verify that the allocated block is aligned */
- if (addr2 % alignment) TEST_ERROR
+ if (addr2 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 2058 is freed to free-space */
if (mis_align) {
@@ -5625,15 +5743,15 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
}
/* Verify total size of free space after all allocations */
- if(f->shared->fs_man[type]) {
- if(check_stats(f, f->shared->fs_man[type], &(state[type])))
- TEST_ERROR
- }
+ if (f->shared->fs_man[type]) {
+ if (check_stats(f, f->shared->fs_man[type], &(state[type])))
+ TEST_ERROR
+ }
- if(f->shared->fs_man[stype]) {
- if(check_stats(f, f->shared->fs_man[stype], &(state[stype])))
- TEST_ERROR
- }
+ if (f->shared->fs_man[stype]) {
+ if (check_stats(f, f->shared->fs_man[stype], &(state[stype])))
+ TEST_ERROR
+ }
/* nothing is changed in meta_aggr */
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
@@ -5645,26 +5763,24 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
if (new_sdata_addr != sdata_addr || new_sdata_size != sdata_size)
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support mis-aligned fragments");
+ SKIPPED();
+ puts(" Current VFD doesn't support mis-aligned fragments");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_align_alloc5() */
-
/*
* To verify that blocks allocated from the aggregator are aligned
*
@@ -5779,52 +5895,52 @@ error:
static unsigned
test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size;
- H5FD_mem_t type, stype;
- haddr_t addr1, addr2;
- haddr_t saddr1, saddr2, saddr3;
- frspace_state_t state[H5FD_MEM_NTYPES];
- haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF;
- hsize_t ma_size=0, new_ma_size=0, sdata_size=0;
- hsize_t alignment=0, mis_align=0, tmp=0;
- hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size;
+ H5FD_mem_t type, stype;
+ haddr_t addr1, addr2;
+ haddr_t saddr1, saddr2, saddr3;
+ frspace_state_t state[H5FD_MEM_NTYPES];
+ haddr_t ma_addr = HADDR_UNDEF, new_ma_addr = HADDR_UNDEF, sdata_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0, new_ma_size = 0, sdata_size = 0;
+ hsize_t alignment = 0, mis_align = 0, tmp = 0;
+ hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 6");
/* Skip test when using VFDs that have their own 'alloc' callback, which
* don't push mis-aligned space fragments on the file free space list
*/
- have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
- && HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(have_alloc_vfd) {
+ have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") &&
+ HDstrcmp(env_h5_drvr, "multi"));
+ if (have_alloc_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on (without alignment) */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file with alignment setting and meta/sdata setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
/* get alignment setting */
- if(H5Pget_alignment(new_fapl, NULL, &alignment) < 0)
+ if (H5Pget_alignment(new_fapl, NULL, &alignment) < 0)
TEST_ERROR
/* calculate fragment for alignment of block 30 */
@@ -5832,11 +5948,12 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
mis_align = alignment - tmp;
/* Allocate a block of 30 from meta_aggr */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
/* Verify that the allocated block is aligned */
- if (addr1 % alignment) TEST_ERROR
+ if (addr1 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 30 in meta_aggr is freed to free-space */
HDmemset(&state, 0, sizeof(frspace_state_t) * H5FD_MEM_NTYPES);
@@ -5847,7 +5964,7 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
}
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr1+TEST_BLOCK_SIZE30) != ma_addr)
+ if ((addr1 + TEST_BLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* calculate fragment for alignment of block 30 in sdata_aggr */
@@ -5856,11 +5973,12 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
mis_align = alignment - tmp;
/* Allocate a block of 30 from sdata_aggr */
- stype = H5FD_MEM_DRAW;
+ stype = H5FD_MEM_DRAW;
saddr1 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
/* Verify that the allocated block is aligned */
- if (saddr1 % alignment) TEST_ERROR
+ if (saddr1 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 30 in sdata_aggr is freed to free-space */
if (mis_align) {
@@ -5870,7 +5988,8 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
}
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if (sdata_addr != (saddr1+TEST_BLOCK_SIZE30)) TEST_ERROR
+ if (sdata_addr != (saddr1 + TEST_BLOCK_SIZE30))
+ TEST_ERROR
/* calculate fragment for alignment of block 50 in sdata_aggr */
mis_align = 0;
@@ -5881,7 +6000,8 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
saddr2 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50);
/* Verify that the allocated block is aligned */
- if (saddr2 % alignment) TEST_ERROR
+ if (saddr2 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 50 in sdata_aggr is freed to free-space */
if (mis_align) {
@@ -5891,7 +6011,8 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
}
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if (sdata_addr != (saddr2+TEST_BLOCK_SIZE50)) TEST_ERROR
+ if (sdata_addr != (saddr2 + TEST_BLOCK_SIZE50))
+ TEST_ERROR
/* calculate fragment for alignment of block 80 in sdata_aggr */
mis_align = 0;
@@ -5902,7 +6023,8 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
saddr3 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE80);
/* Verify that the allocated block is aligned */
- if (saddr3 % alignment) TEST_ERROR
+ if (saddr3 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 80 in sdata_aggr is freed to free-space */
if (mis_align) {
@@ -5912,7 +6034,8 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
}
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if (sdata_addr != (saddr3+TEST_BLOCK_SIZE80)) TEST_ERROR
+ if (sdata_addr != (saddr3 + TEST_BLOCK_SIZE80))
+ TEST_ERROR
/* calculate fragment for alignment of block 2058 */
/* remaining space in sdata_aggr is freed and shrunk */
@@ -5924,7 +6047,8 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE2058);
/* Verify that the allocated block is aligned */
- if (addr2 % alignment) TEST_ERROR
+ if (addr2 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 2058 is freed to free-space */
if (mis_align) {
@@ -5942,37 +6066,34 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
if (sdata_addr != HADDR_UNDEF || sdata_size != 0)
TEST_ERROR
- if(f->shared->fs_man[type]) {
- if(check_stats(f, f->shared->fs_man[type], &(state[type])))
- TEST_ERROR
- }
-
+ if (f->shared->fs_man[type]) {
+ if (check_stats(f, f->shared->fs_man[type], &(state[type])))
+ TEST_ERROR
+ }
- if(f->shared->fs_man[stype]) {
- if(check_stats(f, f->shared->fs_man[stype], &(state[stype])))
- TEST_ERROR
- }
+ if (f->shared->fs_man[stype]) {
+ if (check_stats(f, f->shared->fs_man[stype], &(state[stype])))
+ TEST_ERROR
+ }
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support mis-aligned fragments");
+ SKIPPED();
+ puts(" Current VFD doesn't support mis-aligned fragments");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_align_alloc6() */
-
/*
* Test a bug that occurs when an allocator with zero size left and an unaligned
* endpoint is extended to allocate an aligned object
@@ -5980,15 +6101,15 @@ error:
static unsigned
test_mf_bug1(const char *env_h5_drvr, hid_t fapl)
{
- hid_t file = -1; /* File ID */
- hid_t copied_fapl = -1; /* FAPL to use for this test */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FD_mem_t type;
- haddr_t addr1, addr2;
- hsize_t block_size;
- hsize_t align;
- hbool_t split = FALSE, multi = FALSE;
+ hid_t file = -1; /* File ID */
+ hid_t copied_fapl = -1; /* FAPL to use for this test */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5FD_mem_t type;
+ haddr_t addr1, addr2;
+ hsize_t block_size;
+ hsize_t align;
+ hbool_t split = FALSE, multi = FALSE;
TESTING("H5MF_alloc() bug 1");
@@ -5996,146 +6117,152 @@ test_mf_bug1(const char *env_h5_drvr, hid_t fapl)
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Copy fapl */
- if((copied_fapl = H5Pcopy(fapl)) < 0)
+ if ((copied_fapl = H5Pcopy(fapl)) < 0)
TEST_ERROR
/* Get metadata block size */
- if(H5Pget_meta_block_size(copied_fapl, &block_size) < 0)
+ if (H5Pget_meta_block_size(copied_fapl, &block_size) < 0)
TEST_ERROR
/* Set alignment to equal block size / 2 */
align = block_size / 2;
- if(H5Pset_alignment(copied_fapl, 0, align) < 0)
+ if (H5Pset_alignment(copied_fapl, 0, align) < 0)
TEST_ERROR
/* Check for split or multi driver */
- if(!HDstrcmp(env_h5_drvr, "split"))
+ if (!HDstrcmp(env_h5_drvr, "split"))
split = TRUE;
- else if(!HDstrcmp(env_h5_drvr, "multi"))
+ else if (!HDstrcmp(env_h5_drvr, "multi"))
multi = TRUE;
/* Add alignment to member files for split/multi driver */
- if(split || multi) {
+ if (split || multi) {
hid_t memb_fapl;
/* Creat fapl */
- if((memb_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((memb_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR
/* Set alignment. Note that it is the block size of the parent FAPL that
* is important here. */
- if(H5Pset_alignment(memb_fapl, 0, align) < 0)
+ if (H5Pset_alignment(memb_fapl, 0, align) < 0)
TEST_ERROR
- if(split) {
+ if (split) {
/* Set split driver with new FAPLs */
- if(H5Pset_fapl_split(copied_fapl, "-m.h5", memb_fapl, "-r.h5", memb_fapl) < 0)
+ if (H5Pset_fapl_split(copied_fapl, "-m.h5", memb_fapl, "-r.h5", memb_fapl) < 0)
TEST_ERROR
} /* end if */
else {
H5FD_mem_t memb_map[H5FD_MEM_NTYPES];
- hid_t memb_fapl_arr[H5FD_MEM_NTYPES];
- char *memb_name[H5FD_MEM_NTYPES];
- haddr_t memb_addr[H5FD_MEM_NTYPES];
- hbool_t relax;
- H5FD_mem_t mt;
+ hid_t memb_fapl_arr[H5FD_MEM_NTYPES];
+ char * memb_name[H5FD_MEM_NTYPES];
+ haddr_t memb_addr[H5FD_MEM_NTYPES];
+ hbool_t relax;
+ H5FD_mem_t mt;
/* Get current multi settings */
HDmemset(memb_name, 0, sizeof memb_name);
- if(H5Pget_fapl_multi(copied_fapl, memb_map, NULL, memb_name, memb_addr, &relax) < 0)
+ if (H5Pget_fapl_multi(copied_fapl, memb_map, NULL, memb_name, memb_addr, &relax) < 0)
TEST_ERROR
/* Populate memb_fapl_arr, patch memb_addr so member file addresses
* are aligned */
- 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_arr[mt] = memb_fapl;
- memb_addr[mt] = ((memb_addr[mt] + align - 1) / align) * align;
+ memb_addr[mt] = ((memb_addr[mt] + align - 1) / align) * align;
} /* end for */
/* Set multi driver with new FAPLs */
- if(H5Pset_fapl_multi(copied_fapl, memb_map, memb_fapl_arr, (const char * const *)memb_name, memb_addr, relax) < 0)
+ if (H5Pset_fapl_multi(copied_fapl, memb_map, memb_fapl_arr, (const char *const *)memb_name,
+ memb_addr, relax) < 0)
TEST_ERROR
/* Free memb_name */
- 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))
free(memb_name[mt]);
} /* end else */
/* Close memb_fapl */
- if(H5Pclose(memb_fapl) < 0)
+ if (H5Pclose(memb_fapl) < 0)
TEST_ERROR
} /* end if */
/* Reopen the file with alignment */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, copied_fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, copied_fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
TEST_ERROR
/* Allocate a block of size align from meta_aggr. This should create an
* aggregator that extends to the end of the file, with
* block_size / 2 bytes remaining, and the end of the file aligned */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, align);
/* Verify that the allocated block is aligned */
- if(addr1 % align) TEST_ERROR
+ if (addr1 % align)
+ TEST_ERROR
/* Allocate a block of size align from meta_aggr. This should force the
* aggregator to extend to the end of the file, with 0 bytes remaining, and
* the end of the file aligned */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, align);
/* Verify that the allocated block is aligned */
- if(addr2 % align) TEST_ERROR
+ if (addr2 % align)
+ TEST_ERROR
/* Verify that the allocated block is placed align after the previous */
- if((addr2 - addr1) != align) TEST_ERROR
+ if ((addr2 - addr1) != align)
+ TEST_ERROR
/* Allocate a block of size block_size + 1 from meta_aggr. This should
* force the aggregator to extend to the end of the file, with 0 bytes
* remaining, and the end of the file unaligned */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, block_size + (hsize_t)1);
/* Verify that the allocated block is aligned */
- if(addr1 % align) TEST_ERROR
+ if (addr1 % align)
+ TEST_ERROR
/* Verify that the allocated block is placed block_size / 2 after the
* previous */
- if((addr1 - addr2) != align) TEST_ERROR
+ if ((addr1 - addr2) != align)
+ TEST_ERROR
/* Allocate a block of size 1. This should extend the aggregator from
* the previous allocation, and align the new block */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)1);
/* Verify that the allocated block is aligned */
- if(addr2 % align) TEST_ERROR
+ if (addr2 % align)
+ TEST_ERROR
/* Verify that the allocated block is placed 3 * (block_size / 2) after
* the previous */
- if((addr2 - addr1) != (3 * align)) TEST_ERROR
+ if ((addr2 - addr1) != (3 * align))
+ TEST_ERROR
PASSED()
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_bug1() */
-
/*
* To verify that file space is allocated from the corresponding free-space manager
* because H5FD_FLMAP_DICHOTOMY is used as the default free-list mapping.
@@ -6159,89 +6286,90 @@ error:
static unsigned
test_dichotomy(const char *env_h5_drvr, hid_t fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FD_mem_t type, stype;
- haddr_t addr1, addr3, saddr1, saddr2;
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5FD_mem_t type, stype;
+ haddr_t addr1, addr3, saddr1, saddr2;
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
TESTING("Allocation from raw or metadata free-space manager");
/* Skip test when using VFDs that don't use the metadata aggregator */
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
+ if (NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
/* Allocate the first block of type H5FD_MEM_SUPER */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
/* Allocate the second block of type H5FD_MEM_SUPER */
H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50);
/* Allocate the first block of type H5FD_MEM_DRAW */
- stype = H5FD_MEM_DRAW;
+ stype = H5FD_MEM_DRAW;
saddr1 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
- /* Free the first block of type H5FD_MEM_SUPER */
+ /* Free the first block of type H5FD_MEM_SUPER */
H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30);
/* Allocate the second block of type H5FD_MEM_DRAW */
saddr2 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
- /* Verify that saddr1 is not addr1 */
- if(saddr2 == addr1) TEST_ERROR
+ /* Verify that saddr1 is not addr1 */
+ if (saddr2 == addr1)
+ TEST_ERROR
- /* Free the first block of type H5FD_MEM_DRAW */
+ /* Free the first block of type H5FD_MEM_DRAW */
H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr1, (hsize_t)TEST_BLOCK_SIZE30);
/* Allocate the third block of type H5FD_MEM_SUPER */
addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
- /* Verify that addr3 is not saddr1 */
- if(addr3 == saddr1) TEST_ERROR
+ /* Verify that addr3 is not saddr1 */
+ if (addr3 == saddr1)
+ TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED()
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support metadata aggregator");
+ SKIPPED();
+ puts(" Current VFD doesn't support metadata aggregator");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_dichotomy() */
int
main(void)
{
- hid_t fapl = -1; /* File access property list for data files */
- hid_t new_fapl = -1; /* File access property list for alignment & aggr setting */
- unsigned nerrors = 0; /* Cumulative error count */
- test_type_t curr_test; /* Current test being worked on */
- const char *env_h5_drvr; /* File Driver value from environment */
+ hid_t fapl = -1; /* File access property list for data files */
+ hid_t new_fapl = -1; /* File access property list for alignment & aggr setting */
+ unsigned nerrors = 0; /* Cumulative error count */
+ test_type_t curr_test; /* Current test being worked on */
+ const char *env_h5_drvr; /* File Driver value from environment */
/* Get the VFD to use */
env_h5_drvr = HDgetenv("HDF5_DRIVER");
- if(env_h5_drvr == NULL)
+ if (env_h5_drvr == NULL)
env_h5_drvr = "nomatch";
h5_reset();
@@ -6249,17 +6377,18 @@ main(void)
fapl = h5_fileaccess();
/* Make a copy of the FAPL before adjusting the alignment */
- if((new_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR
+ if ((new_fapl = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
/* alignment is not set for the following tests */
- if(H5Pset_alignment(fapl, (hsize_t)1, (hsize_t)1) < 0)
- TEST_ERROR
+ if (H5Pset_alignment(fapl, (hsize_t)1, (hsize_t)1) < 0)
+ TEST_ERROR
/* meta/small data is set to 2048 for the following tests */
- if(H5Pset_meta_block_size(fapl, (hsize_t)TEST_BLOCK_SIZE2048) < 0)
- TEST_ERROR
- if(H5Pset_small_data_block_size(fapl, (hsize_t)TEST_BLOCK_SIZE2048) < 0)
- TEST_ERROR
+ if (H5Pset_meta_block_size(fapl, (hsize_t)TEST_BLOCK_SIZE2048) < 0)
+ TEST_ERROR
+ if (H5Pset_small_data_block_size(fapl, (hsize_t)TEST_BLOCK_SIZE2048) < 0)
+ TEST_ERROR
/* interaction with file allocation */
nerrors += test_mf_eoa(env_h5_drvr, fapl);
@@ -6288,16 +6417,16 @@ main(void)
nerrors += test_mf_aggr_absorb(env_h5_drvr, fapl);
/* Tests for alignment */
- for(curr_test = TEST_NORMAL; curr_test < TEST_NTESTS; H5_INC_ENUM(test_type_t, curr_test)) {
+ for (curr_test = TEST_NORMAL; curr_test < TEST_NTESTS; H5_INC_ENUM(test_type_t, curr_test)) {
- switch(curr_test) {
+ switch (curr_test) {
case TEST_NORMAL: /* set alignment = 1024 */
- if(H5Pset_alignment(new_fapl, (hsize_t)0, (hsize_t)TEST_ALIGN1024) < 0)
+ if (H5Pset_alignment(new_fapl, (hsize_t)0, (hsize_t)TEST_ALIGN1024) < 0)
TEST_ERROR
break;
case TEST_AGGR_SMALL: /* set alignment = 4096 */
- if(H5Pset_alignment(new_fapl, (hsize_t)0, (hsize_t)TEST_ALIGN4096) < 0)
+ if (H5Pset_alignment(new_fapl, (hsize_t)0, (hsize_t)TEST_ALIGN4096) < 0)
TEST_ERROR
break;
@@ -6320,21 +6449,23 @@ main(void)
/* tests for specific bugs */
nerrors += test_mf_bug1(env_h5_drvr, fapl);
- if(H5Pclose(new_fapl) < 0)
+ if (H5Pclose(new_fapl) < 0)
FAIL_STACK_ERROR
h5_cleanup(FILENAME, fapl);
- if(nerrors)
+ if (nerrors)
goto error;
puts("All free-space manager tests for file memory passed.");
- return(0);
+ return (0);
error:
puts("*** TESTS FAILED ***");
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Pclose(new_fapl);
- } H5E_END_TRY;
- return(1);
+ }
+ H5E_END_TRY;
+ return (1);
} /* main() */