[svn-r15737] Description:

Changed the tests so that the *.h5 test files are removed depending on the HDF5_NOCLEANUP environment variable.
bug 696
This commit is contained in:
Scot Breitenfeld 2008-09-30 16:05:39 -05:00
parent 915ed32696
commit 393100b2b6
8 changed files with 123 additions and 19 deletions

View File

@ -25,12 +25,16 @@ PROGRAM fortranlibtest
INTEGER :: total_error = 0
INTEGER :: error
INTEGER :: majnum, minnum, relnum
LOGICAL :: cleanup = .TRUE.
! LOGICAL :: cleanup = .FALSE.
LOGICAL :: szip_flag
INTEGER :: ret_total_error
LOGICAL :: cleanup, status
CALL h5open_f(error)
cleanup = .TRUE.
CALL h5_env_nocleanup_f(status)
IF(status) cleanup=.FALSE.
CALL h5open_f(error)
WRITE(*,*) ' ========================== '
WRITE(*,*) ' FORTRAN tests '
WRITE(*,*) ' ========================== '
@ -169,7 +173,6 @@ PROGRAM fortranlibtest
CALL write_test_status(ret_total_error, ' External dataset test', total_error)
ret_total_error = 0
cleanup = .FALSE.
CALL multi_file_test(cleanup, ret_total_error)
CALL write_test_status(ret_total_error, ' Multi file driver test', total_error)

View File

@ -26,10 +26,14 @@ PROGRAM fortranlibtest
INTEGER :: error
INTEGER :: ret_total_error
INTEGER :: majnum, minnum, relnum
LOGICAL :: cleanup = .TRUE.
! LOGICAL :: cleanup = .FALSE.
LOGICAL :: cleanup, status
CALL h5open_f(error)
cleanup = .TRUE.
CALL h5_env_nocleanup_f(status)
IF(status) cleanup=.FALSE.
WRITE(*,*) ' ========================== '
WRITE(*,*) ' FORTRAN 1.8 tests '
WRITE(*,*) ' ========================== '

View File

@ -129,3 +129,22 @@ nh5_exit_c(int_f *status)
HDexit((int)*status);
} /* h5_exit_c */
/*----------------------------------------------------------------------------
* Name: h5_env_nocleanup_c
* Purpose: Determines the state of the environment variable HDF5_NOCLEANUP
* Input: none
* Output: status: 1 - HDF5_NOCLEANUP is set
* 0 - HDF5_NOCLEANUP is not set
* Returns: none
* Programmer: M.S. Breitenfeld
* September 30, 3008
* Modifications:
*---------------------------------------------------------------------------*/
void
nh5_env_nocleanup_c(int_f *status)
{
*status = (int_f)0;
if (HDgetenv("HDF5_NOCLEANUP"))
*status = (int_f)1;
} /* h5_env_nocleanup_c */

View File

@ -26,6 +26,7 @@ char *h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
# define nh5_fixname_c H5_FC_FUNC_(h5_fixname_c, H5_FIXNAME_C)
# define nh5_cleanup_c H5_FC_FUNC_(h5_cleanup_c, H5_CLEANUP_C)
# define nh5_exit_c H5_FC_FUNC_(h5_exit_c, H5_EXIT_C)
# define nh5_env_nocleanup_c H5_FC_FUNC_(h5_env_nocleanup_c, H5_ENV_NOCLEANUP_C)
H5_FCTESTDLL int_f nh5_fixname_c
(_fcd base_name, size_t_f *base_namelen, hid_t_f *fapl, _fcd full_name, size_t_f *full_namelen);
@ -36,3 +37,6 @@ H5_FCTESTDLL int_f nh5_cleanup_c
H5_FCTESTDLL void nh5_exit_c
(int_f *status);
H5_FCTESTDLL void nh5_env_nocleanup_c
(int_f *status);

View File

@ -372,13 +372,26 @@
! Close the file.
!
CALL h5fclose_f(file_id, error)
CALL check("h5fclose_f", error, total_error)
CALL check("h5fclose_f", error, total_error)
CALL h5pclose_f(fapl, error)
CALL check("h5pclose_f", error, total_error)
CALL check("h5pclose_f", error, total_error)
CALL h5pclose_f(fapl_1, error)
CALL check("h5pclose_f", error, total_error)
if(cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error)
CALL check("h5_cleanup_f", error, total_error)
CALL check("h5pclose_f", error, total_error)
IF(cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error)
CALL check("h5_cleanup_f", error, total_error)
IF(cleanup) CALL h5_cleanup_f(filename//'.h5-b', H5P_DEFAULT_F, error)
CALL check("h5_cleanup_f", error, total_error)
IF(cleanup) CALL h5_cleanup_f(filename//'.h5-g', H5P_DEFAULT_F, error)
CALL check("h5_cleanup_f", error, total_error)
IF(cleanup) CALL h5_cleanup_f(filename//'.h5-l', H5P_DEFAULT_F, error)
CALL check("h5_cleanup_f", error, total_error)
IF(cleanup) CALL h5_cleanup_f(filename//'.h5-o', H5P_DEFAULT_F, error)
CALL check("h5_cleanup_f", error, total_error)
IF(cleanup) CALL h5_cleanup_f(filename//'.h5-r', H5P_DEFAULT_F, error)
CALL check("h5_cleanup_f", error, total_error)
IF(cleanup) CALL h5_cleanup_f(filename//'.h5-s', H5P_DEFAULT_F, error)
CALL check("h5_cleanup_f", error, total_error)
RETURN
END SUBROUTINE multi_file_test

View File

@ -1063,9 +1063,15 @@ SUBROUTINE test_select_point(cleanup, total_error)
INTEGER :: i,j; !/* Counters */
! struct pnt_iter pi; /* Custom Pointer iterator struct */
INTEGER :: error !/* Generic return value */
CHARACTER(LEN=12) :: filename = 'h5s_hyper.h5'
CHARACTER(LEN=9) :: filename = 'h5s_hyper'
CHARACTER(LEN=80) :: fix_filename
CHARACTER(LEN=1), DIMENSION(1:SPACE2_DIM1,1:SPACE2_DIM2) :: wbuf, rbuf
CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error)
IF (error .NE. 0) THEN
WRITE(*,*) "Cannot modify filename"
STOP
ENDIF
xfer_plist = H5P_DEFAULT_F
! MESSAGE(5, ("Testing Element Selection Functions\n"));
@ -1086,7 +1092,7 @@ SUBROUTINE test_select_point(cleanup, total_error)
!!$ *tbuf++=(uint8_t)((i*SPACE2_DIM2)+j);
!/* Create file */
CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, fid1, error)
CALL h5fcreate_f(fix_filename, H5F_ACC_TRUNC_F, fid1, error)
CALL check("h5fcreate_f", error, total_error)
!/* Create dataspace for dataset */
@ -1327,6 +1333,10 @@ SUBROUTINE test_select_point(cleanup, total_error)
CALL h5fclose_f(fid1, 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)
END SUBROUTINE test_select_point

View File

@ -800,7 +800,7 @@
SUBROUTINE enumtest(cleanup, total_error)
USE HDF5
IMPLICIT none
IMPLICIT NONE
LOGICAL, INTENT(IN) :: cleanup
INTEGER, INTENT(OUT) :: total_error
@ -871,7 +871,7 @@
CALL check("H5Tget_order_f",error, total_error)
CALL VERIFY("H5Tget_native_type_f",order1, order2, total_error)
! this test depends on whether -i8 was specified needs to account for that FIX -scot-
! this test depends on whether -i8 was specified
!!$ CALL H5Tget_size_f(native_type, type_size1, error)
!!$ CALL check("H5Tget_size_f",error, total_error)
@ -909,11 +909,15 @@
ENDIF
CALL h5tclose_f(dtype_id,error)
CALL check("h5tclose_f", error, total_error)
CALL check("h5tclose_f", error, total_error)
CALL h5fclose_f(file_id,error)
CALL check("h5fclose_f", error, total_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 enumtest
END SUBROUTINE enumtest
!/*-------------------------------------------------------------------------
! * Function: test_derived_flt
@ -1114,4 +1118,8 @@ SUBROUTINE test_derived_flt(cleanup, total_error)
CALL h5fclose_f(file,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)
END SUBROUTINE test_derived_flt

View File

@ -272,3 +272,46 @@ SUBROUTINE h5_exit_f(status)
END SUBROUTINE h5_exit_f
!----------------------------------------------------------------------
! Name: h5_env_nocleanup_f
!
! Purpose: Uses the HDF5_NOCLEANUP environment variable in Fortran
! tests to determine if the output files should be removed
!
! Inputs:
!
! Outputs: HDF5_NOCLEANUP: .true. - don't remove test files
! .false. - remove test files
!
! Programmer: M.S. Breitenfeld
! September 30, 2008
!
!----------------------------------------------------------------------
SUBROUTINE h5_env_nocleanup_f(HDF5_NOCLEANUP)
!
!This definition is needed for Windows DLLs
!DEC$if defined(BUILD_HDF5_DLL)
!DEC$attributes dllexport :: h5_env_nocleanup_f
!DEC$endif
IMPLICIT NONE
LOGICAL, INTENT(OUT) :: HDF5_NOCLEANUP ! Return code
INTEGER :: status
INTERFACE
SUBROUTINE h5_env_nocleanup_c(status)
!DEC$ IF DEFINED(HDF5F90_WINDOWS)
!DEC$ ATTRIBUTES C,reference,decorate,alias:'H5_ENV_NOCLEANUP_C':: h5_env_nocleanup_c
!DEC$ ENDIF
INTEGER :: status
END SUBROUTINE h5_env_nocleanup_c
END INTERFACE
CALL h5_env_nocleanup_c(status)
HDF5_NOCLEANUP = .FALSE.
IF(status.EQ.1)THEN
HDF5_NOCLEANUP = .TRUE.
ENDIF
END SUBROUTINE h5_env_nocleanup_f