diff options
author | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2015-07-13 19:37:28 (GMT) |
---|---|---|
committer | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2015-07-13 19:37:28 (GMT) |
commit | 838755cf71e270e2123b540bae3a89f6bbffbc2b (patch) | |
tree | 38debfdcb9b1481a4a692c56055067db58611783 /fortran | |
parent | c90d6ad2869a9787e5068ca2a9f72f51d5b30438 (diff) | |
download | hdf5-838755cf71e270e2123b540bae3a89f6bbffbc2b.zip hdf5-838755cf71e270e2123b540bae3a89f6bbffbc2b.tar.gz hdf5-838755cf71e270e2123b540bae3a89f6bbffbc2b.tar.bz2 |
[svn-r27375] Moved generating Fortran 'test' code from the fortran src directory to the fortran 'test' directory. Updated autotools and cmake.
Diffstat (limited to 'fortran')
-rw-r--r-- | fortran/src/H5_buildiface.F90 | 174 | ||||
-rw-r--r-- | fortran/test/CMakeLists.txt | 38 | ||||
-rw-r--r-- | fortran/test/Makefile.am | 21 | ||||
-rw-r--r-- | fortran/test/Makefile.in | 71 |
4 files changed, 109 insertions, 195 deletions
diff --git a/fortran/src/H5_buildiface.F90 b/fortran/src/H5_buildiface.F90 index 7de9760..e058849 100644 --- a/fortran/src/H5_buildiface.F90 +++ b/fortran/src/H5_buildiface.F90 @@ -549,180 +549,6 @@ PROGRAM test_kind CLOSE(11) -! (b) Generate Fortran Check routines for the tests KIND interfaces. - - OPEN(11,FILE='../test/tf_gen.F90') - WRITE(11,'(40(A,/))') & -'!****h* ROBODoc/TH5_MISC_gen.F90',& -'!',& -'! NAME',& -'! TH5_MISC_gen',& -'! ',& -'! PURPOSE',& -'! This module is generated at build by H5_buildiface.F90 to handle checking ',& -'! in the tests all the detected KINDs.',& -'!',& -'! COPYRIGHT',& -'! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *',& -'! Copyright by The HDF Group. *',& -'! 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://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *',& -'! access to either file, you may request a copy from help@hdfgroup.org. *',& -'! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *',& -'!',& -'! AUTHOR',& -'! H5_buildiface.F90',& -'!',& -'!*****' - - WRITE(11,'(a)') "MODULE TH5_MISC_gen" - - WRITE(11,'(A)') ' USE, INTRINSIC :: ISO_C_BINDING' - WRITE(11,'(A)') ' USE H5GLOBAL' - -! Interfaces for validating REALs, INTEGERs, CHARACTERs, LOGICALs - - WRITE(11,'(A)') ' INTERFACE verify' - DO i = 1, num_rkinds - j = rkind(i) - WRITE(chr2,'(I2)') j - WRITE(11,'(A)') " MODULE PROCEDURE verify_real_kind_"//TRIM(ADJUSTL(chr2)) - END DO - DO i = 1, num_ikinds - j = ikind(i) - WRITE(chr2,'(I2)') j - WRITE(11,'(A)') " MODULE PROCEDURE verify_integer_kind_"//TRIM(ADJUSTL(chr2)) - END DO - WRITE(11,'(A)') " MODULE PROCEDURE verify_character" - WRITE(11,'(A)') " MODULE PROCEDURE verify_logical" - WRITE(11,'(A)') " END INTERFACE" - - WRITE(11,'(A)') ' INTERFACE check_real_eq' - DO i = 1, num_rkinds - j = rkind(i) - WRITE(chr2,'(I2)') j - WRITE(11,'(A)') " MODULE PROCEDURE real_eq_kind_"//TRIM(ADJUSTL(chr2)) - END DO - WRITE(11,'(A)') " END INTERFACE" - - WRITE(11,'(A)') 'CONTAINS' - -! *************************** -! VALIDATE INTEGERS -! *************************** - DO i = 1, num_ikinds - k = ikind(i) - WRITE(chr2,'(I2)') k -! DLL definitions for windows - WRITE(11,'(A)') '!DEC$if defined(BUILD_HDF5_TEST_DLL)' - WRITE(11,'(A)') '!DEC$attributes dllexport :: verify_integer_kind_'//TRIM(ADJUSTL(chr2)) - WRITE(11,'(A)') '!DEC$endif' - -! Subroutine API - WRITE(11,'(A)') ' SUBROUTINE verify_integer_kind_'//TRIM(ADJUSTL(chr2))//'(string,value,correct_value,total_error)' - WRITE(11,'(A)') ' IMPLICIT NONE' - WRITE(11,'(A)') ' CHARACTER(LEN=*) :: string' - WRITE(11,'(A)') ' INTEGER(KIND='//TRIM(ADJUSTL(chr2))//') :: value, correct_value' - WRITE(11,'(A)') ' INTEGER :: total_error' - WRITE(11,'(A)') ' IF (value .NE. correct_value) THEN' - WRITE(11,'(A)') ' total_error=total_error+1' - WRITE(11,'(A)') ' WRITE(*,*) "ERROR: INCORRECT INTEGER VALIDATION ", string' - WRITE(11,'(A)') ' ENDIF' - WRITE(11,'(A)') ' END SUBROUTINE verify_integer_kind_'//TRIM(ADJUSTL(chr2)) - ENDDO - -! *************************** -! VALIDATE REALS -! *************************** - DO i = 1, num_rkinds - k = rkind(i) - WRITE(chr2,'(I2)') k -! DLL definitions for windows - WRITE(11,'(A)') '!DEC$if defined(BUILD_HDF5_TEST_DLL)' - WRITE(11,'(A)') '!DEC$attributes dllexport :: verify_real_kind_'//TRIM(ADJUSTL(chr2)) - WRITE(11,'(A)') '!DEC$endif' - -! Subroutine API - WRITE(11,'(A)') ' SUBROUTINE verify_real_kind_'//TRIM(ADJUSTL(chr2))//'(string,value,correct_value,total_error)' - WRITE(11,'(A)') ' IMPLICIT NONE' - WRITE(11,'(A)') ' CHARACTER(LEN=*) :: string' - WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//') :: value, correct_value' - WRITE(11,'(A)') ' INTEGER :: total_error' - WRITE(11,'(A)') ' IF (.NOT.real_eq_kind_'//TRIM(ADJUSTL(chr2))//'( value, correct_value) ) THEN' - WRITE(11,'(A)') ' total_error=total_error+1' - WRITE(11,'(A)') ' WRITE(*,*) "ERROR: INCORRECT REAL VALIDATION ", string' - WRITE(11,'(A)') ' ENDIF' - WRITE(11,'(A)') ' END SUBROUTINE verify_real_kind_'//TRIM(ADJUSTL(chr2)) - - -! *********************************** -! TEST IF TWO REAL NUMBERS ARE EQUAL -! *********************************** - - WRITE(11,'(A)') '!DEC$if defined(BUILD_HDF5_TEST_DLL)' - WRITE(11,'(A)') '!DEC$attributes dllexport :: real_eq_kind_'//TRIM(ADJUSTL(chr2)) - WRITE(11,'(A)') '!DEC$endif' - WRITE(11,'(A)') ' LOGICAL FUNCTION real_eq_kind_'//TRIM(ADJUSTL(chr2))//'(a,b)' - WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'), INTENT (in):: a,b' - WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'), PARAMETER :: eps = 1.e-8' - WRITE(11,'(A)') ' real_eq_kind_'//TRIM(ADJUSTL(chr2))//' = ABS(a-b) .LT. eps' - WRITE(11,'(A)') ' END FUNCTION real_eq_kind_'//TRIM(ADJUSTL(chr2)) - ENDDO - -! *************************** -! VALIDATE CHARACTER STRINGS -! *************************** - -! DLL definitions for windows - WRITE(11,'(A)') '!DEC$if defined(BUILD_HDF5_TEST_DLL)' - WRITE(11,'(A)') '!DEC$attributes dllexport :: verify_character' - WRITE(11,'(A)') '!DEC$endif' - -! Subroutine API - WRITE(11,'(A)') ' SUBROUTINE verify_character(string,value,correct_value,total_error)' - WRITE(11,'(A)') ' IMPLICIT NONE' - WRITE(11,'(A)') ' CHARACTER*(*) :: string' - WRITE(11,'(A)') ' CHARACTER*(*) :: value, correct_value' - WRITE(11,'(A)') ' INTEGER :: total_error' - WRITE(11,'(A)') ' IF (TRIM(value) .NE. TRIM(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)') ' END SUBROUTINE verify_character' - -! *************************** -! VALIDATE LOGICAL -! *************************** - -! DLL definitions for windows - WRITE(11,'(A)') '!DEC$if defined(BUILD_HDF5_TEST_DLL)' - WRITE(11,'(A)') '!DEC$attributes dllexport :: verify_logical' - WRITE(11,'(A)') '!DEC$endif' -! Subroutine API - WRITE(11,'(A)') ' SUBROUTINE verify_logical(string,value,correct_value,total_error)' - WRITE(11,'(A)') ' CHARACTER(LEN=*) :: string' - WRITE(11,'(A)') ' LOGICAL :: value, correct_value' - WRITE(11,'(A)') ' INTEGER :: total_error' - 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)') ' END SUBROUTINE verify_logical' - - - - WRITE(11,'(A)') "END MODULE TH5_MISC_gen" - - CLOSE(11) - END PROGRAM test_kind diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 9b82765..32b3a09 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -23,8 +23,8 @@ set_target_properties (${HDF5_F90_C_TEST_LIB_TARGET} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) -set_source_files_properties (tf.F90 tf_gen.F90 PROPERTIES LANGUAGE Fortran) -add_library (${HDF5_F90_TEST_LIB_TARGET} ${LIB_TYPE} tf.F90 tf_gen.F90) +set_source_files_properties (tf.F90 ${HDF5_F90_BINARY_DIR}/tf_gen.F90 PROPERTIES LANGUAGE Fortran) +add_library (${HDF5_F90_TEST_LIB_TARGET} ${LIB_TYPE} tf.F90 ${HDF5_F90_BINARY_DIR}/tf_gen.F90) set (SHARED_LINK_FLAGS " ") if (WIN32) @@ -51,6 +51,40 @@ set_target_properties (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES ) #----------------------------------------------------------------------------- +# Setup the Fortran auto-detection utilities +# H5_test_buildiface.F90 used to generate various KIND test interfaces +#----------------------------------------------------------------------------- + +add_executable (H5_test_buildiface + ${HDF5_F90_SRC_DIR}/test/H5_test_buildiface.F90 + ) + +if (WIN32 AND MSVC) + if (BUILD_SHARED_LIBS) + set_target_properties (H5_test_buildiface + PROPERTIES + COMPILE_FLAGS "/MT" + ) + endif (BUILD_SHARED_LIBS) + set_target_properties (H5_test_buildiface + PROPERTIES + LINK_FLAGS "/SUBSYSTEM:CONSOLE" + ) +endif (WIN32 AND MSVC) +set_target_properties (H5_test_buildiface PROPERTIES + LINKER_LANGUAGE Fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} +) + +set (CMD $<TARGET_FILE:H5_test_buildiface>) +add_custom_command ( + OUTPUT ${HDF5_F90_BINARY_DIR}/tf_gen.F90 + COMMAND ${CMD} + WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR} + DEPENDS H5_test_buildiface +) + +#----------------------------------------------------------------------------- # Add Tests #----------------------------------------------------------------------------- diff --git a/fortran/test/Makefile.am b/fortran/test/Makefile.am index 9c5b4f0..608b1e9 100644 --- a/fortran/test/Makefile.am +++ b/fortran/test/Makefile.am @@ -76,13 +76,32 @@ maintainer-clean-local: clean-local distclean-local: clean-local clean-local: @if test -n "$(F9XMODEXT)" && test "X$(F9XMODEXT)" != "Xo"; then \ - $(RM) *.$(F9XMODEXT); \ + $(RM) *.$(F9XMODEXT) tf_gen.F90; \ fi # Mark this directory as part of the Fortran API (this affects output # from tests in conclude.am) FORTRAN_API=yes +# helper program we need to build. +noinst_PROGRAMS = H5_test_buildiface + +# H5_test_buildiface.F90 generates all the test APIs that have a KIND type associated +# with them. + +tf_gen.F90: H5_test_buildiface$(EXEEXT) + $(RUNSERIAL) ./H5_test_buildiface$(EXEEXT) + +# H5_test_buildiface.F90 is included in the distribution, and Automake knows +# how to compile a fortran program given its sources. + +H5_test_buildiface_SOURCES = H5_test_buildiface.F90 + +# The build of the H5_test_buildiface does depend on any libraries, so set it +# to nothing. + +H5_test_buildiface_LDADD = + # fflush2 depends on files created by fflush1 fflush2.chkexe_: fflush1.chkexe_ diff --git a/fortran/test/Makefile.in b/fortran/test/Makefile.in index cadba68..4e9bbd6 100644 --- a/fortran/test/Makefile.in +++ b/fortran/test/Makefile.in @@ -14,6 +14,7 @@ @SET_MAKE@ + VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ @@ -88,6 +89,7 @@ DIST_COMMON = $(top_srcdir)/config/commence.am \ # pass the -static flag to the library linker. @FORTRAN_SHARED_CONDITIONAL_FALSE@am__append_1 = -static check_PROGRAMS = $(am__EXEEXT_1) +noinst_PROGRAMS = H5_test_buildiface$(EXEEXT) TESTS = $(am__EXEEXT_1) subdir = fortran/test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -111,6 +113,10 @@ am__v_lt_1 = am__EXEEXT_1 = fortranlib_test$(EXEEXT) fflush1$(EXEEXT) \ fflush2$(EXEEXT) fortranlib_test_1_8$(EXEEXT) \ fortranlib_test_F03$(EXEEXT) +PROGRAMS = $(noinst_PROGRAMS) +am_H5_test_buildiface_OBJECTS = H5_test_buildiface.$(OBJEXT) +H5_test_buildiface_OBJECTS = $(am_H5_test_buildiface_OBJECTS) +H5_test_buildiface_DEPENDENCIES = am_fflush1_OBJECTS = fflush1.$(OBJEXT) fflush1_OBJECTS = $(am_fflush1_OBJECTS) fflush1_LDADD = $(LDADD) @@ -212,10 +218,12 @@ AM_V_FC = $(am__v_FC_@AM_V@) am__v_FC_ = $(am__v_FC_@AM_DEFAULT_V@) am__v_FC_0 = @echo " FC " $@; am__v_FC_1 = -SOURCES = $(libh5test_fortran_la_SOURCES) $(fflush1_SOURCES) \ +SOURCES = $(libh5test_fortran_la_SOURCES) \ + $(H5_test_buildiface_SOURCES) $(fflush1_SOURCES) \ $(fflush2_SOURCES) $(fortranlib_test_SOURCES) \ $(fortranlib_test_1_8_SOURCES) $(fortranlib_test_F03_SOURCES) -DIST_SOURCES = $(libh5test_fortran_la_SOURCES) $(fflush1_SOURCES) \ +DIST_SOURCES = $(libh5test_fortran_la_SOURCES) \ + $(H5_test_buildiface_SOURCES) $(fflush1_SOURCES) \ $(fflush2_SOURCES) $(fortranlib_test_SOURCES) \ $(fortranlib_test_1_8_SOURCES) $(fortranlib_test_F03_SOURCES) am__can_run_installinfo = \ @@ -766,6 +774,14 @@ MOSTLYCLEANFILES = *.tmp # from tests in conclude.am) FORTRAN_API = yes +# H5_test_buildiface.F90 is included in the distribution, and Automake knows +# how to compile a fortran program given its sources. +H5_test_buildiface_SOURCES = H5_test_buildiface.F90 + +# The build of the H5_test_buildiface does depend on any libraries, so set it +# to nothing. +H5_test_buildiface_LDADD = + # Automake needs to be taught how to build lib, progs, and tests targets. # These will be filled in automatically for the most part (e.g., # lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG, and @@ -844,6 +860,19 @@ clean-checkPROGRAMS: echo " rm -f" $$list; \ rm -f $$list +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +H5_test_buildiface$(EXEEXT): $(H5_test_buildiface_OBJECTS) $(H5_test_buildiface_DEPENDENCIES) $(EXTRA_H5_test_buildiface_DEPENDENCIES) + @rm -f H5_test_buildiface$(EXEEXT) + $(AM_V_FCLD)$(FCLINK) $(H5_test_buildiface_OBJECTS) $(H5_test_buildiface_LDADD) $(LIBS) + fflush1$(EXEEXT): $(fflush1_OBJECTS) $(fflush1_DEPENDENCIES) $(EXTRA_fflush1_DEPENDENCIES) @rm -f fflush1$(EXEEXT) $(AM_V_FCLD)$(FCLINK) $(fflush1_OBJECTS) $(fflush1_LDADD) $(LIBS) @@ -1273,7 +1302,7 @@ check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am -all-am: Makefile $(LTLIBRARIES) all-local +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) all-local installdirs: install: install-am install-exec: install-exec-am @@ -1312,7 +1341,7 @@ maintainer-clean-generic: clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool clean-local \ - clean-noinstLTLIBRARIES mostlyclean-am + clean-noinstLTLIBRARIES clean-noinstPROGRAMS mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) @@ -1385,19 +1414,19 @@ uninstall-am: .PHONY: CTAGS GTAGS TAGS all all-am all-local check check-TESTS \ check-am clean clean-checkPROGRAMS clean-generic clean-libtool \ - clean-local clean-noinstLTLIBRARIES cscopelist-am ctags \ - ctags-am distclean distclean-compile distclean-generic \ - distclean-libtool distclean-local distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic maintainer-clean-local mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - mostlyclean-local pdf pdf-am ps ps-am recheck tags tags-am \ - uninstall uninstall-am + clean-local clean-noinstLTLIBRARIES clean-noinstPROGRAMS \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-local \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic \ + maintainer-clean-local mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \ + pdf-am ps ps-am recheck tags tags-am uninstall uninstall-am # @@ -1438,9 +1467,15 @@ maintainer-clean-local: clean-local distclean-local: clean-local clean-local: @if test -n "$(F9XMODEXT)" && test "X$(F9XMODEXT)" != "Xo"; then \ - $(RM) *.$(F9XMODEXT); \ + $(RM) *.$(F9XMODEXT) tf_gen.F90; \ fi +# H5_test_buildiface.F90 generates all the test APIs that have a KIND type associated +# with them. + +tf_gen.F90: H5_test_buildiface$(EXEEXT) + $(RUNSERIAL) ./H5_test_buildiface$(EXEEXT) + # fflush2 depends on files created by fflush1 fflush2.chkexe_: fflush1.chkexe_ |