diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2003-10-07 13:32:32 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2003-10-07 13:32:32 (GMT) |
commit | f766b32d07fae4562e95b9166255c35c8f3e467a (patch) | |
tree | 59aa2706ca5c91e1ac4c314a9de9b48f8979dc40 /fortran/test/tH5F.f90 | |
parent | 259247fc328fa17b705fc16ab8e004d8c5814ea8 (diff) | |
download | hdf5-f766b32d07fae4562e95b9166255c35c8f3e467a.zip hdf5-f766b32d07fae4562e95b9166255c35c8f3e467a.tar.gz hdf5-f766b32d07fae4562e95b9166255c35c8f3e467a.tar.bz2 |
[svn-r7559] Purpose:
Add feature
Description:
Add H5Fget_freespace() routine, to check the amount of free space in a
file. This information is only valid until the file is closed currently,
however (until we start recording the free space information in the file
itself).
Platforms tested:
FreeBSD 4.9 (sleipnir)
h5committest
Diffstat (limited to 'fortran/test/tH5F.f90')
-rw-r--r-- | fortran/test/tH5F.f90 | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/fortran/test/tH5F.f90 b/fortran/test/tH5F.f90 index ffd0df9..8dba136 100644 --- a/fortran/test/tH5F.f90 +++ b/fortran/test/tH5F.f90 @@ -669,5 +669,79 @@ END SUBROUTINE file_close +! +! The following subroutine tests h5fget_freespace_f +! + + SUBROUTINE file_space(cleanup, total_error) + USE HDF5 ! This module contains all necessary modules + IMPLICIT NONE + LOGICAL, INTENT(IN) :: cleanup + INTEGER, INTENT(OUT) :: total_error + INTEGER :: error + + ! + CHARACTER(LEN=10), PARAMETER :: filename = "file_space" + CHARACTER(LEN=3), PARAMETER :: grpname = "grp" + CHARACTER(LEN=80) :: fix_filename + + INTEGER(HID_T) :: fid ! File identifiers + INTEGER(HSSIZE_T) :: free_space + INTEGER(HID_T) :: group_id ! Group identifier + + CALL h5eset_auto_f(0, error) + + CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error) + if (error .ne. 0) then + write(*,*) "Cannot modify filename" + stop + endif + CALL h5fcreate_f(fix_filename, H5F_ACC_TRUNC_F, fid, error) + CALL check("h5fcreate_f",error,total_error) + + CALL h5fget_freespace_f(fid, free_space, error) + CALL check("h5fget_freespace_f",error,total_error) + if(error .eq.0 .and. free_space .ne. 0) then + total_error = total_error + 1 + write(*,*) "Wrong amount of free space reported, ", free_space + endif + + ! Create group in the file. + CALL h5gcreate_f(fid, grpname, group_id, error) + CALL check("h5gcreate_f",error,total_error) + + ! Close group + CALL h5gclose_f(group_id, error) + CALL check("h5gclose_f", error, total_error) + + ! Check the free space now + CALL h5fget_freespace_f(fid, free_space, error) + CALL check("h5fget_freespace_f",error,total_error) + if(error .eq.0 .and. free_space .ne. 0) then + total_error = total_error + 1 + write(*,*) "Wrong amount of free space reported, ", free_space + endif + + !Unlink the group + CALL h5gunlink_f(fid, grpname, error) + CALL check("h5gunlink_f", error, total_error) + + ! Check the free space now + CALL h5fget_freespace_f(fid, free_space, error) + CALL check("h5fget_freespace_f",error,total_error) + if(error .eq.0 .and. free_space .ne. 976) then + total_error = total_error + 1 + write(*,*) "Wrong amount of free space reported, ", free_space + endif + + CALL h5fclose_f(fid, error) + CALL check("h5fclose_f",error,total_error) + + if(cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) + RETURN + + END SUBROUTINE file_space + |