diff options
author | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2024-02-23 13:57:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-23 13:57:30 (GMT) |
commit | e7f41a2fbf9cc123b14edbb73501c19976c514c4 (patch) | |
tree | 95e286eb43a0936cb8688b502987b9f46fcabd9e /fortran | |
parent | f02ecb21dd96a2445d988e8684a015fac9c30afd (diff) | |
download | hdf5-e7f41a2fbf9cc123b14edbb73501c19976c514c4.zip hdf5-e7f41a2fbf9cc123b14edbb73501c19976c514c4.tar.gz hdf5-e7f41a2fbf9cc123b14edbb73501c19976c514c4.tar.bz2 |
Fix the datatype passed to H5*exists_async APIs in tests. (#4033)
Add a new testing function to verify C_BOOL values.
Diffstat (limited to 'fortran')
-rw-r--r-- | fortran/src/H5config_f.inc.cmake | 3 | ||||
-rw-r--r-- | fortran/src/H5config_f.inc.in | 3 | ||||
-rw-r--r-- | fortran/test/H5_test_buildiface.F90 | 32 | ||||
-rw-r--r-- | fortran/testpar/async.F90 | 9 |
4 files changed, 42 insertions, 5 deletions
diff --git a/fortran/src/H5config_f.inc.cmake b/fortran/src/H5config_f.inc.cmake index e6fa7b9..4330ca2 100644 --- a/fortran/src/H5config_f.inc.cmake +++ b/fortran/src/H5config_f.inc.cmake @@ -73,6 +73,9 @@ ! Define if Fortran C_LONG_DOUBLE is different from C_DOUBLE #define H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE @H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE@ +! Define if Fortran C_BOOL is different from default LOGICAL +#define H5_FORTRAN_C_BOOL_IS_UNIQUE @H5_FORTRAN_C_BOOL_IS_UNIQUE@ + ! Define if the intrinsic module ISO_FORTRAN_ENV exists #define H5_HAVE_ISO_FORTRAN_ENV @H5_HAVE_ISO_FORTRAN_ENV@ diff --git a/fortran/src/H5config_f.inc.in b/fortran/src/H5config_f.inc.in index 7f52255..65fd68a 100644 --- a/fortran/src/H5config_f.inc.in +++ b/fortran/src/H5config_f.inc.in @@ -41,6 +41,9 @@ ! Define if Fortran C_LONG_DOUBLE is different from C_DOUBLE #undef FORTRAN_C_LONG_DOUBLE_IS_UNIQUE +! Define if Fortran C_BOOL is different from default LOGICAL +#undef FORTRAN_C_BOOL_IS_UNIQUE + ! Define if the intrinsic module ISO_FORTRAN_ENV exists #undef HAVE_ISO_FORTRAN_ENV diff --git a/fortran/test/H5_test_buildiface.F90 b/fortran/test/H5_test_buildiface.F90 index 60f2e4c..0b5efeb 100644 --- a/fortran/test/H5_test_buildiface.F90 +++ b/fortran/test/H5_test_buildiface.F90 @@ -106,6 +106,9 @@ PROGRAM H5_test_buildiface END DO WRITE(11,'(A)') " MODULE PROCEDURE verify_character" WRITE(11,'(A)') " MODULE PROCEDURE verify_logical" +#ifdef H5_FORTRAN_C_BOOL_IS_UNIQUE + WRITE(11,'(A)') " MODULE PROCEDURE verify_c_bool" +#endif WRITE(11,'(A)') " END INTERFACE" WRITE(11,'(A)') ' INTERFACE check_real_eq' @@ -300,6 +303,35 @@ PROGRAM H5_test_buildiface WRITE(11,'(A)') ' ENDIF' WRITE(11,'(A)') ' END SUBROUTINE verify_logical' +#ifdef H5_FORTRAN_C_BOOL_IS_UNIQUE +! DLL definitions for windows + WRITE(11,'(A)') '!DEC$if defined(BUILD_HDF5_TEST_DLL)' + WRITE(11,'(A)') '!DEC$attributes dllexport :: verify_c_bool' + WRITE(11,'(A)') '!DEC$endif' +! Subroutine API + WRITE(11,'(A)') ' SUBROUTINE verify_c_bool(string,value,correct_value,total_error,chck_eq)' + WRITE(11,'(A)') ' IMPLICIT NONE' + WRITE(11,'(A)') ' CHARACTER(LEN=*) :: string' + WRITE(11,'(A)') ' LOGICAL(C_BOOL) :: value, correct_value' + WRITE(11,'(A)') ' INTEGER :: total_error' + WRITE(11,'(A)') ' LOGICAL, OPTIONAL :: chck_eq' + WRITE(11,'(A)') ' LOGICAL :: chck_eq_opt' + WRITE(11,'(A)') ' chck_eq_opt = .TRUE.' + WRITE(11,'(A)') ' IF(PRESENT(chck_eq)) chck_eq_opt = chck_eq' + WRITE(11,'(A)') ' IF(chck_eq_opt .EQV. .TRUE.)THEN' + WRITE(11,'(A)') ' IF (value .NEQV. correct_value) THEN' + WRITE(11,'(A)') ' total_error = total_error + 1' + WRITE(11,'(A)') ' WRITE(*,*) "ERROR: INCORRECT VALIDATION ", string' + WRITE(11,'(A)') ' ENDIF' + WRITE(11,'(A)') ' ELSE' + WRITE(11,'(A)') ' IF (value .EQV. correct_value) THEN' + WRITE(11,'(A)') ' total_error = total_error + 1' + WRITE(11,'(A)') ' WRITE(*,*) "ERROR: INCORRECT VALIDATION ", string' + WRITE(11,'(A)') ' ENDIF' + WRITE(11,'(A)') ' ENDIF' + WRITE(11,'(A)') ' END SUBROUTINE verify_c_bool' +#endif + WRITE(11,'(A)') "END MODULE TH5_MISC_gen" CLOSE(11) diff --git a/fortran/testpar/async.F90 b/fortran/testpar/async.F90 index 02045cb..5c7411f 100644 --- a/fortran/testpar/async.F90 +++ b/fortran/testpar/async.F90 @@ -26,9 +26,8 @@ MODULE test_async_APIs LOGICAL :: async_enabled = .TRUE. LOGICAL :: mpi_thread_mult = .TRUE. - INTEGER(C_INT), PARAMETER :: logical_true = 1 - INTEGER(C_INT), PARAMETER :: logical_false = 0 - + LOGICAL(C_BOOL), PARAMETER :: logical_true = .TRUE. + LOGICAL(C_BOOL), PARAMETER :: logical_false = .FALSE. ! Custom group iteration callback data TYPE, bind(c) :: iter_info @@ -178,7 +177,7 @@ CONTAINS INTEGER(HID_T) :: space_id INTEGER(HID_T) :: attr_id0, attr_id1, attr_id2 LOGICAL :: exists - INTEGER(C_INT), TARGET :: exists0=logical_false, exists1=logical_false, exists2=logical_false, exists3=logical_false + LOGICAL(C_BOOL), TARGET :: exists0=logical_false, exists1=logical_false, exists2=logical_false, exists3=logical_false TYPE(C_PTR) :: f_ptr, f_ptr1, f_ptr2 CALL H5EScreate_f(es_id, hdferror) @@ -788,7 +787,7 @@ CONTAINS INTEGER(hid_t) :: sid = -1 ! Dataspace ID CHARACTER(LEN=12), PARAMETER :: CORDER_GROUP_NAME = "corder_group" CHARACTER(LEN=12), PARAMETER :: CORDER_GROUP_NAME2 = "corder_grp00" - INTEGER(C_INT), TARGET :: exists1, exists2 + LOGICAL(C_BOOL), TARGET :: exists1, exists2 LOGICAL :: exists TYPE(C_PTR) :: f_ptr |