summaryrefslogtreecommitdiffstats
path: root/fortran/test/tf.f90
diff options
context:
space:
mode:
authorElena Pourmal <epourmal@hdfgroup.org>2002-09-23 22:06:01 (GMT)
committerElena Pourmal <epourmal@hdfgroup.org>2002-09-23 22:06:01 (GMT)
commitf5096c200093eaf5b7dae72a3f672b2d7f457ca6 (patch)
tree457ebff96156da5e20133905167b7ac714428c30 /fortran/test/tf.f90
parent47fc4908325071261476bbdabb1be696323f9298 (diff)
downloadhdf5-f5096c200093eaf5b7dae72a3f672b2d7f457ca6.zip
hdf5-f5096c200093eaf5b7dae72a3f672b2d7f457ca6.tar.gz
hdf5-f5096c200093eaf5b7dae72a3f672b2d7f457ca6.tar.bz2
[svn-r5940]
Purpose: Bug fix, code improvement Description: Fortran tests didn't cleanup created files. Also HDF5_PREFIX and HDF5_PARAPREFIX were not used to specify location of the files. There was a redundant file in the testpar directory that contained an error reporting function used by both serial and parallel tests. Solution: Created library h5test_fortran.a that contains functions used by the serial and parallel tests. It includes Fortran and C functions that may be called from Fortran programs to report errors, to modify file names and to cleanup files after run. Modified test code to use new functions. Platforms tested: Linux 2.2 (eirene) serial IRIX64 (modi4) parallel with HDF5_PREFIX and HDF5_PARAPREFIX set to $SCR Solris 2.7 with mpich 1.2.4 with HDF5_PARAPREFIX set to /tmp/epourmal
Diffstat (limited to 'fortran/test/tf.f90')
-rw-r--r--fortran/test/tf.f90134
1 files changed, 134 insertions, 0 deletions
diff --git a/fortran/test/tf.f90 b/fortran/test/tf.f90
new file mode 100644
index 0000000..ef4c784
--- /dev/null
+++ b/fortran/test/tf.f90
@@ -0,0 +1,134 @@
+
+! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+! Copyright by the Board of Trustees of the University of Illinois. *
+! All rights reserved. *
+! *
+! This file is part of HDF5. The full HDF5 copyright notice, including *
+! terms governing use, modification, and redistribution, is contained in *
+! the files COPYING and Copyright.html. COPYING can be found at the root *
+! of the source code distribution tree; Copyright.html can be found at the *
+! root level of an installed copy of the electronic HDF5 document set and *
+! is linked from the top-level documents page. It can also be found at *
+! http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
+! access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
+! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+!
+!
+!
+! This file contains subroutines which are used in
+! all the hdf5 fortran tests
+!
+
+ SUBROUTINE check(string,error,total_error)
+ CHARACTER(LEN=*) :: string
+ INTEGER :: error, total_error
+ if (error .lt. 0) then
+ total_error=total_error+1
+ write(*,*) string, " failed"
+ endif
+ RETURN
+ END SUBROUTINE check
+
+!----------------------------------------------------------------------
+! Name: h5_fixname_f
+!
+! Purpose: Create a file name from the a file base name.
+! It is a fortran counterpart for the h5_fixname in ../../test/h5test.c
+!
+! Inputs:
+! base_name - base name of the file
+! fapl - file access property list
+! Outputs:
+! full_name - full file name
+! hdferr: - error code
+! Success: 0
+! Failure: -1
+!
+! Programmer: Elena Pourmal
+! September 13, 2002
+!
+!
+!----------------------------------------------------------------------
+ SUBROUTINE h5_fixname_f(base_name, full_name, fapl, hdferr)
+!
+ USE H5GLOBAL
+ IMPLICIT NONE
+ CHARACTER(LEN=*), INTENT(IN) :: base_name ! base name
+ CHARACTER(LEN=*), INTENT(IN) :: full_name ! full name
+ INTEGER, INTENT(OUT) :: hdferr ! Error code
+ INTEGER(HID_T), INTENT(IN) :: fapl ! file access property list
+
+ INTEGER :: base_namelen ! Length of the base name character string
+ INTEGER :: full_namelen ! Length of the full name character string
+! INTEGER(HID_T) :: fapl_default
+
+ INTERFACE
+ INTEGER FUNCTION h5_fixname_c(base_name, base_namelen, fapl, &
+ full_name, full_namelen)
+ USE H5GLOBAL
+ !DEC$ IF DEFINED(HDF5F90_WINDOWS)
+ !MS$ATTRIBUTES C,reference,alias:'_H5_FIXNAME_C':: h5_fixname_c
+ !DEC$ ENDIF
+ !DEC$ATTRIBUTES reference :: base_name
+ !DEC$ATTRIBUTES reference :: full_name
+ CHARACTER(LEN=*), INTENT(IN) :: base_name
+ INTEGER :: base_namelen
+ INTEGER(HID_T), INTENT(IN) :: fapl
+ CHARACTER(LEN=*), INTENT(IN) :: full_name
+ INTEGER :: full_namelen
+ END FUNCTION h5_fixname_c
+ END INTERFACE
+
+ base_namelen = LEN(base_name)
+ full_namelen = LEN(full_name)
+ hdferr = h5_fixname_c(base_name, base_namelen, fapl, &
+ full_name, full_namelen)
+
+ END SUBROUTINE h5_fixname_f
+
+!----------------------------------------------------------------------
+! Name: h5_cleanup_f
+!
+! Purpose: Cleanups tests files
+! It is a fortran counterpart for the h5_cleanup in ../../test/h5test.c
+!
+! Inputs:
+! base_name - base name of the file
+! fapl - file access property list
+! Outputs:
+! hdferr: - error code
+! Success: 0
+! Failure: -1
+!
+! Programmer: Elena Pourmal
+! September 19, 2002
+!
+!
+!----------------------------------------------------------------------
+ SUBROUTINE h5_cleanup_f(base_name, fapl, hdferr)
+!
+ USE H5GLOBAL
+ IMPLICIT NONE
+ CHARACTER(LEN=*), INTENT(IN) :: base_name ! base name
+ INTEGER, INTENT(OUT) :: hdferr ! Error code
+ INTEGER(HID_T), INTENT(IN) :: fapl ! file access property list
+
+ INTEGER :: base_namelen ! Length of the base name character string
+
+ INTERFACE
+ INTEGER FUNCTION h5_cleanup_c(base_name, base_namelen, fapl)
+ USE H5GLOBAL
+ !DEC$ IF DEFINED(HDF5F90_WINDOWS)
+ !MS$ATTRIBUTES C,reference,alias:'_H5_CLEANUP_C':: h5_cleanup_c
+ !DEC$ ENDIF
+ !DEC$ATTRIBUTES reference :: base_name
+ CHARACTER(LEN=*), INTENT(IN) :: base_name
+ INTEGER :: base_namelen
+ INTEGER(HID_T), INTENT(IN) :: fapl
+ END FUNCTION h5_cleanup_c
+ END INTERFACE
+
+ base_namelen = LEN(base_name)
+ hdferr = h5_cleanup_c(base_name, base_namelen, fapl)
+
+ END SUBROUTINE h5_cleanup_f