summaryrefslogtreecommitdiffstats
path: root/fortran/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-10-07 13:32:32 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-10-07 13:32:32 (GMT)
commitf766b32d07fae4562e95b9166255c35c8f3e467a (patch)
tree59aa2706ca5c91e1ac4c314a9de9b48f8979dc40 /fortran/test
parent259247fc328fa17b705fc16ab8e004d8c5814ea8 (diff)
downloadhdf5-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')
-rw-r--r--fortran/test/fortranlib_test.f909
-rw-r--r--fortran/test/tH5F.f9074
2 files changed, 83 insertions, 0 deletions
diff --git a/fortran/test/fortranlib_test.f90 b/fortran/test/fortranlib_test.f90
index f32924e..a244f53 100644
--- a/fortran/test/fortranlib_test.f90
+++ b/fortran/test/fortranlib_test.f90
@@ -26,6 +26,7 @@
INTEGER :: mounting_total_error = 0
INTEGER :: reopen_total_error = 0
INTEGER :: fclose_total_error = 0
+ INTEGER :: fspace_total_error = 0
INTEGER :: dataset_total_error = 0
INTEGER :: extend_dataset_total_error = 0
INTEGER :: refobj_total_error = 0
@@ -104,6 +105,14 @@
write(*, fmt = e_format) error_string
total_error = total_error + fclose_total_error
+ error_string = failure
+ CALL file_space(cleanup, fspace_total_error)
+ IF (fspace_total_error == 0) error_string = success
+ write(*, fmt = '(21a)', advance = 'no') ' File free space test'
+ write(*, fmt = '(49x,a)', advance = 'no') ' '
+ write(*, fmt = e_format) error_string
+ total_error = total_error + fspace_total_error
+
! write(*,*)
! write(*,*) '========================================='
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
+