diff options
author | M. Scot Breitenfeld <brtnfld@hdfgroup.org> | 2018-06-08 19:19:11 (GMT) |
---|---|---|
committer | M. Scot Breitenfeld <brtnfld@hdfgroup.org> | 2018-06-08 19:19:11 (GMT) |
commit | c52d04320b452e9132fa656c3bf52d6b5a89d353 (patch) | |
tree | ef38215155d2a302a8fe80360e476ab3b1543e8a /fortran/test | |
parent | e87be2e9e770fbe6f54f11551cabff60273f1461 (diff) | |
download | hdf5-c52d04320b452e9132fa656c3bf52d6b5a89d353.zip hdf5-c52d04320b452e9132fa656c3bf52d6b5a89d353.tar.gz hdf5-c52d04320b452e9132fa656c3bf52d6b5a89d353.tar.bz2 |
HDFFV-10405: Using h5fget_obj_count_f with a file id of H5F_OBJ_ALL_F does not work properly
h5fget_obj_count_f with H5F_OBJ_ALL_F counted objects created in h5open_f, which should not be included in the count. The function now returns the correct number of objects (i.e., objects created in h5open are not included in the total).
Diffstat (limited to 'fortran/test')
-rw-r--r-- | fortran/test/tH5F.F90 | 76 |
1 files changed, 75 insertions, 1 deletions
diff --git a/fortran/test/tH5F.F90 b/fortran/test/tH5F.F90 index d91ee9c..72920f2 100644 --- a/fortran/test/tH5F.F90 +++ b/fortran/test/tH5F.F90 @@ -103,6 +103,10 @@ CONTAINS ! INTEGER :: i, j + !number of objects + INTEGER(SIZE_T) :: obj_count + INTEGER(HID_T) :: t1, t2, t3, t4 + ! !data buffers ! @@ -133,11 +137,51 @@ CONTAINS CALL h5_fixname_f(filename2, fix_filename2, H5P_DEFAULT_F, error) if(error .ne. 0) stop + ! Test object counts + CALL h5tcopy_f(H5T_NATIVE_CHARACTER, t1, error) + CALL check(" h5tcopy_f",error,total_error) + CALL h5tcopy_f(H5T_NATIVE_CHARACTER, t2, error) + CALL check(" h5tcopy_f",error,total_error) + CALL h5tcopy_f(H5T_NATIVE_CHARACTER, t3, error) + CALL check(" h5tcopy_f",error,total_error) + CALL h5tcopy_f(H5T_NATIVE_CHARACTER, t4, error) + CALL check(" h5tcopy_f",error,total_error) + + CALL h5fget_obj_count_f(INT(H5F_OBJ_ALL_F,HID_T), H5F_OBJ_ALL_F, obj_count, error) + CALL check(" h5fget_obj_count_f",error,total_error) + + IF(obj_count.NE.4)THEN + total_error = total_error + 1 + ENDIF + ! !Create first file "mount1.h5" using default properties. ! CALL h5fcreate_f(fix_filename1, H5F_ACC_TRUNC_F, file1_id, error) - CALL check("h5fcreate_f",error,total_error) + CALL check("h5fcreate_f",error,total_error) + + CALL h5fget_obj_count_f(INT(H5F_OBJ_ALL_F,HID_T), H5F_OBJ_ALL_F, obj_count, error) + CALL check(" h5fget_obj_count_f",error,total_error) + + IF(obj_count.NE.5)THEN + total_error = total_error + 1 + ENDIF + + CALL h5tclose_f(t1, error) + CALL check("h5tclose_f",error,total_error) + CALL h5tclose_f(t2, error) + CALL check("h5tclose_f",error,total_error) + CALL h5tclose_f(t3, error) + CALL check("h5tclose_f",error,total_error) + CALL h5tclose_f(t4, error) + CALL check("h5tclose_f",error,total_error) + + CALL h5fget_obj_count_f(INT(H5F_OBJ_ALL_F,HID_T), H5F_OBJ_ALL_F, obj_count, error) + CALL check(" h5fget_obj_count_f",error,total_error) + + IF(obj_count.NE.1)THEN + total_error = total_error + 1 + ENDIF ! !Create group "/G" inside file "mount1.h5". @@ -211,9 +255,23 @@ CONTAINS ! CALL h5fopen_f (fix_filename1, H5F_ACC_RDWR_F, file1_id, error) CALL check("hfopen_f",error,total_error) + + CALL h5fget_obj_count_f(INT(H5F_OBJ_ALL_F,HID_T), H5F_OBJ_ALL_F, obj_count, error) + CALL check(" h5fget_obj_count_f",error,total_error) + + IF(obj_count.NE.1)THEN + total_error = total_error + 1 + ENDIF + CALL h5fopen_f (fix_filename2, H5F_ACC_RDWR_F, file2_id, error) CALL check("h5fopen_f",error,total_error) + CALL h5fget_obj_count_f(INT(H5F_OBJ_ALL_F,HID_T), H5F_OBJ_ALL_F, obj_count, error) + CALL check(" h5fget_obj_count_f",error,total_error) + + IF(obj_count.NE.2)THEN + total_error = total_error + 1 + ENDIF ! !mount the second file under the first file's "/G" group. ! @@ -245,6 +303,7 @@ CONTAINS do i = 1, NX do j = 1, NY IF (data_out(i,j) .NE. data_in(i, j)) THEN + total_error = total_error + 1 END IF end do end do @@ -267,11 +326,26 @@ CONTAINS ! !Close both files. ! + + CALL h5fget_obj_count_f(INT(H5F_OBJ_ALL_F,HID_T), H5F_OBJ_ALL_F, obj_count, error) + CALL check(" h5fget_obj_count_f",error,total_error) + + IF(obj_count.NE.2)THEN + total_error = total_error + 1 + ENDIF + CALL h5fclose_f(file1_id, error) CALL check("h5fclose_f",error,total_error) CALL h5fclose_f(file2_id, error) CALL check("h5fclose_f",error,total_error) + CALL h5fget_obj_count_f(INT(H5F_OBJ_ALL_F,HID_T), H5F_OBJ_ALL_F, obj_count, error) + CALL check(" h5fget_obj_count_f",error,total_error) + + IF(obj_count.NE.0)THEN + total_error = total_error + 1 + ENDIF + if(cleanup) CALL h5_cleanup_f(filename1, H5P_DEFAULT_F, error) CALL check("h5_cleanup_f", error, total_error) if(cleanup) CALL h5_cleanup_f(filename2, H5P_DEFAULT_F, error) |