summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScot Breitenfeld <brtnfld@hdfgroup.org>2008-09-30 21:05:39 (GMT)
committerScot Breitenfeld <brtnfld@hdfgroup.org>2008-09-30 21:05:39 (GMT)
commit393100b2b64ff6180119649599926ca7f22682f8 (patch)
tree7c806161df2df5497bca4985bfedb87b626a5f00
parent915ed3269683d30045d4c06b85ec76c792bcf4ac (diff)
downloadhdf5-393100b2b64ff6180119649599926ca7f22682f8.zip
hdf5-393100b2b64ff6180119649599926ca7f22682f8.tar.gz
hdf5-393100b2b64ff6180119649599926ca7f22682f8.tar.bz2
[svn-r15737] Description:
Changed the tests so that the *.h5 test files are removed depending on the HDF5_NOCLEANUP environment variable. bug 696
-rw-r--r--fortran/test/fortranlib_test.f9011
-rw-r--r--fortran/test/fortranlib_test_1_8.f908
-rw-r--r--fortran/test/t.c19
-rw-r--r--fortran/test/t.h4
-rw-r--r--fortran/test/tH5P.f9023
-rw-r--r--fortran/test/tH5Sselect.f9016
-rw-r--r--fortran/test/tH5T.f9018
-rw-r--r--fortran/test/tf.f9043
8 files changed, 123 insertions, 19 deletions
diff --git a/fortran/test/fortranlib_test.f90 b/fortran/test/fortranlib_test.f90
index a96b269..60a026b 100644
--- a/fortran/test/fortranlib_test.f90
+++ b/fortran/test/fortranlib_test.f90
@@ -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)
diff --git a/fortran/test/fortranlib_test_1_8.f90 b/fortran/test/fortranlib_test_1_8.f90
index 4ff3e0f..49835b0 100644
--- a/fortran/test/fortranlib_test_1_8.f90
+++ b/fortran/test/fortranlib_test_1_8.f90
@@ -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(*,*) ' ========================== '
diff --git a/fortran/test/t.c b/fortran/test/t.c
index de450f9..861a3e7 100644
--- a/fortran/test/t.c
+++ b/fortran/test/t.c
@@ -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 */
+
diff --git a/fortran/test/t.h b/fortran/test/t.h
index 005eb17..d315bda 100644
--- a/fortran/test/t.h
+++ b/fortran/test/t.h
@@ -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);
+
diff --git a/fortran/test/tH5P.f90 b/fortran/test/tH5P.f90
index e8e3a1d..7e6c8de 100644
--- a/fortran/test/tH5P.f90
+++ b/fortran/test/tH5P.f90
@@ -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
diff --git a/fortran/test/tH5Sselect.f90 b/fortran/test/tH5Sselect.f90
index 25fcca2..7e11b61 100644
--- a/fortran/test/tH5Sselect.f90
+++ b/fortran/test/tH5Sselect.f90
@@ -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
diff --git a/fortran/test/tH5T.f90 b/fortran/test/tH5T.f90
index 0c86b6c..7c81d6d 100644
--- a/fortran/test/tH5T.f90
+++ b/fortran/test/tH5T.f90
@@ -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
diff --git a/fortran/test/tf.f90 b/fortran/test/tf.f90
index d48ede1..b4956ea 100644
--- a/fortran/test/tf.f90
+++ b/fortran/test/tf.f90
@@ -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
+