diff options
author | Brad King <brad.king@kitware.com> | 2016-09-22 18:23:39 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-09-22 18:52:01 (GMT) |
commit | eb8cd35684f2dc2f53d205d7738e1c01a12a493f (patch) | |
tree | 77732180392bf2da1fe0aa6facd25c9fe95e6614 /Tests/Fortran | |
parent | a41c8724d155f1cd74ce36cdfbd10da0eac5b389 (diff) | |
download | CMake-eb8cd35684f2dc2f53d205d7738e1c01a12a493f.zip CMake-eb8cd35684f2dc2f53d205d7738e1c01a12a493f.tar.gz CMake-eb8cd35684f2dc2f53d205d7738e1c01a12a493f.tar.bz2 |
Tests: Split Fortran module testing into separate FortranModules test
The main Fortran test is not granular enough. Split some into another
test.
Diffstat (limited to 'Tests/Fortran')
-rw-r--r-- | Tests/Fortran/CMakeLists.txt | 85 | ||||
-rw-r--r-- | Tests/Fortran/Executable/CMakeLists.txt | 8 | ||||
-rw-r--r-- | Tests/Fortran/Executable/main.f90 | 7 | ||||
-rw-r--r-- | Tests/Fortran/External/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/Fortran/External/a.f90 | 7 | ||||
-rw-r--r-- | Tests/Fortran/Library/CMakeLists.txt | 11 | ||||
-rw-r--r-- | Tests/Fortran/Library/a.f90 | 3 | ||||
-rw-r--r-- | Tests/Fortran/Library/b.f90 | 2 | ||||
-rw-r--r-- | Tests/Fortran/Library/main.f90 | 3 | ||||
-rw-r--r-- | Tests/Fortran/Subdir/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/Fortran/Subdir/subdir.f90 | 2 | ||||
-rw-r--r-- | Tests/Fortran/in_interface/main.f90 | 3 | ||||
-rw-r--r-- | Tests/Fortran/in_interface/module.f90 | 12 | ||||
-rw-r--r-- | Tests/Fortran/include/test_preprocess.h | 5 | ||||
-rw-r--r-- | Tests/Fortran/test_module_implementation.f90 | 6 | ||||
-rw-r--r-- | Tests/Fortran/test_module_interface.f90 | 9 | ||||
-rw-r--r-- | Tests/Fortran/test_module_main.f90 | 4 | ||||
-rw-r--r-- | Tests/Fortran/test_preprocess.F90 | 53 | ||||
-rw-r--r-- | Tests/Fortran/test_preprocess_module.F90 | 5 | ||||
-rw-r--r-- | Tests/Fortran/test_use_in_comment_fixedform.f | 7 | ||||
-rw-r--r-- | Tests/Fortran/test_use_in_comment_freeform.f90 | 7 |
21 files changed, 0 insertions, 244 deletions
diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt index 3105d13..740e6f5 100644 --- a/Tests/Fortran/CMakeLists.txt +++ b/Tests/Fortran/CMakeLists.txt @@ -1,8 +1,5 @@ cmake_minimum_required (VERSION 3.1) project(testf C CXX Fortran) -if(NOT DEFINED CMake_TEST_NESTED_MAKE_PROGRAM AND NOT CMAKE_GENERATOR MATCHES "Visual Studio") - set(CMake_TEST_NESTED_MAKE_PROGRAM "${CMAKE_MAKE_PROGRAM}") -endif() message("CTEST_FULL_OUTPUT ") set(CMAKE_VERBOSE_MAKEFILE 1) @@ -144,85 +141,3 @@ else() endif() endif() - - - - -set(TEST_MODULE_DEPENDS 0) -if(CMAKE_Fortran_COMPILER_SUPPORTS_F90) - add_executable(test_module - test_module_main.f90 - test_module_implementation.f90 - test_module_interface.f90) - - add_executable(test_use_in_comment_fixedform - test_use_in_comment_fixedform.f) - set_property(SOURCE test_use_in_comment_fixedform.f PROPERTY Fortran_FORMAT FIXED) - add_executable(test_use_in_comment_freeform - test_use_in_comment_freeform.f90) - set_property(SOURCE test_use_in_comment_freeform.f90 PROPERTY Fortran_FORMAT FREE) - - add_executable(test_in_interface - in_interface/main.f90 - in_interface/module.f90) - - add_definitions(-DFOO -DBAR=1) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) - add_executable(test_preprocess test_preprocess.F90 test_preprocess_module.F90) - - set(TEST_MODULE_DEPENDS 1) -endif() - -if(TEST_MODULE_DEPENDS) - # Build the external project separately using a custom target. - # Make sure it uses the same build configuration as this test. - if(CMAKE_CONFIGURATION_TYPES) - set(External_CONFIG_TYPE -C "${CMAKE_CFG_INTDIR}") - set(External_BUILD_TYPE) - else() - set(External_CONFIG_TYPE) - set(External_BUILD_TYPE -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}) - endif() - set(External_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/External") - set(External_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/External") - if("${CMAKE_CURRENT_BINARY_DIR}" MATCHES " ") - # Our build tree has a space, so the build tool supports spaces. - # Test using modules from a path with spaces. - string(APPEND External_BINARY_DIR " Build") - endif() - add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ExternalProject - COMMAND ${CMAKE_CTEST_COMMAND} - ARGS ${External_CONFIG_TYPE} - --build-and-test - ${External_SOURCE_DIR} - ${External_BINARY_DIR} - --build-noclean - --build-two-config - --build-project ExtFort - --build-generator ${CMAKE_GENERATOR} - --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}" - --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" - --build-options -DCMAKE_Fortran_COMPILER:STRING=${CMAKE_Fortran_COMPILER} - -DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS} - -DCMAKE_Fortran_FLAGS_DEBUG:STRING=${CMAKE_Fortran_FLAGS_DEBUG} - -DCMAKE_Fortran_FLAGS_RELEASE:STRING=${CMAKE_Fortran_FLAGS_RELEASE} - -DCMAKE_Fortran_FLAGS_MINSIZEREL:STRING=${CMAKE_Fortran_FLAGS_MINSIZEREL} - -DCMAKE_Fortran_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_Fortran_FLAGS_RELWITHDEBINFO} - -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMake_TEST_NESTED_MAKE_PROGRAM} - ${External_BUILD_TYPE} - VERBATIM - ) - add_custom_target(ExternalTarget ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ExternalProject) - - # Test module output directory if available. - if(CMAKE_Fortran_MODDIR_FLAG) - set(Library_MODDIR "${CMAKE_CURRENT_BINARY_DIR}/Library/modules") - else() - set(Library_MODDIR "${CMAKE_CURRENT_BINARY_DIR}/Library") - endif() - - add_subdirectory(Library) - add_subdirectory(Subdir) - add_subdirectory(Executable) -endif() diff --git a/Tests/Fortran/Executable/CMakeLists.txt b/Tests/Fortran/Executable/CMakeLists.txt deleted file mode 100644 index de08d86..0000000 --- a/Tests/Fortran/Executable/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -include_directories(${Library_MODDIR}) -include_directories(${External_BINARY_DIR}) -link_directories(${External_BINARY_DIR}) - -add_executable(subdir_exe2 main.f90) -target_link_libraries(subdir_exe2 subdir_mods subdir_mods2) -add_dependencies(subdir_exe2 ExternalTarget) -target_link_libraries(subdir_exe2 myext) diff --git a/Tests/Fortran/Executable/main.f90 b/Tests/Fortran/Executable/main.f90 deleted file mode 100644 index 640259c..0000000 --- a/Tests/Fortran/Executable/main.f90 +++ /dev/null @@ -1,7 +0,0 @@ -PROGRAM MAINF90 - USE libraryModuleA - USE libraryModuleB - USE subdirModuleA - USE externalMod - CALL printExtModGreeting -END PROGRAM MAINF90 diff --git a/Tests/Fortran/External/CMakeLists.txt b/Tests/Fortran/External/CMakeLists.txt deleted file mode 100644 index c90a0ffb..0000000 --- a/Tests/Fortran/External/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -project(ExtFort Fortran) - -add_library(myext a.f90) diff --git a/Tests/Fortran/External/a.f90 b/Tests/Fortran/External/a.f90 deleted file mode 100644 index 2be73c5..0000000 --- a/Tests/Fortran/External/a.f90 +++ /dev/null @@ -1,7 +0,0 @@ -MODULE externalMod -! -CONTAINS - SUBROUTINE printExtModGreeting - WRITE(*,*) "Greetings from Module externalMod" - END SUBROUTINE -END MODULE diff --git a/Tests/Fortran/Library/CMakeLists.txt b/Tests/Fortran/Library/CMakeLists.txt deleted file mode 100644 index 17438ca..0000000 --- a/Tests/Fortran/Library/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -include_directories(${Library_MODDIR}) -add_library(subdir_mods a.f90 b.f90) -add_executable(subdir_exe main.f90) -target_link_libraries(subdir_exe subdir_mods) - -# Test module output directory if available. -if(CMAKE_Fortran_MODDIR_FLAG) - set_target_properties(subdir_mods PROPERTIES - Fortran_MODULE_DIRECTORY modules - ) -endif() diff --git a/Tests/Fortran/Library/a.f90 b/Tests/Fortran/Library/a.f90 deleted file mode 100644 index 3031c07..0000000 --- a/Tests/Fortran/Library/a.f90 +++ /dev/null @@ -1,3 +0,0 @@ -MODULE libraryModuleA - USE libraryModuleB -END MODULE diff --git a/Tests/Fortran/Library/b.f90 b/Tests/Fortran/Library/b.f90 deleted file mode 100644 index ae1edcb..0000000 --- a/Tests/Fortran/Library/b.f90 +++ /dev/null @@ -1,2 +0,0 @@ -MODULE libraryModuleB -END MODULE diff --git a/Tests/Fortran/Library/main.f90 b/Tests/Fortran/Library/main.f90 deleted file mode 100644 index 2385408..0000000 --- a/Tests/Fortran/Library/main.f90 +++ /dev/null @@ -1,3 +0,0 @@ -PROGRAM MAINF90 - USE libraryModuleA -END PROGRAM MAINF90 diff --git a/Tests/Fortran/Subdir/CMakeLists.txt b/Tests/Fortran/Subdir/CMakeLists.txt deleted file mode 100644 index 52683e5..0000000 --- a/Tests/Fortran/Subdir/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_library(subdir_mods2 subdir.f90) -target_include_directories(subdir_mods2 INTERFACE ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/Tests/Fortran/Subdir/subdir.f90 b/Tests/Fortran/Subdir/subdir.f90 deleted file mode 100644 index 68955f6..0000000 --- a/Tests/Fortran/Subdir/subdir.f90 +++ /dev/null @@ -1,2 +0,0 @@ -MODULE subdirModuleA -END MODULE diff --git a/Tests/Fortran/in_interface/main.f90 b/Tests/Fortran/in_interface/main.f90 deleted file mode 100644 index 28bcf36..0000000 --- a/Tests/Fortran/in_interface/main.f90 +++ /dev/null @@ -1,3 +0,0 @@ -program hello - use test_interface -end program hello diff --git a/Tests/Fortran/in_interface/module.f90 b/Tests/Fortran/in_interface/module.f90 deleted file mode 100644 index 1064d74..0000000 --- a/Tests/Fortran/in_interface/module.f90 +++ /dev/null @@ -1,12 +0,0 @@ -module test_interface - - interface dummy - module procedure module_function - end interface - -contains - - subroutine module_function - end subroutine - -end module test_interface
\ No newline at end of file diff --git a/Tests/Fortran/include/test_preprocess.h b/Tests/Fortran/include/test_preprocess.h deleted file mode 100644 index f4a00a9..0000000 --- a/Tests/Fortran/include/test_preprocess.h +++ /dev/null @@ -1,5 +0,0 @@ -#ifdef BAR -PRINT*, 'BAR was defined via ADD_DEFINITIONS' -#else -PRINT*, 'If you can read this something went wrong' -#endif diff --git a/Tests/Fortran/test_module_implementation.f90 b/Tests/Fortran/test_module_implementation.f90 deleted file mode 100644 index de3cb57..0000000 --- a/Tests/Fortran/test_module_implementation.f90 +++ /dev/null @@ -1,6 +0,0 @@ -FUNCTION TEST_MODULE_FUNCTION(A,B) - REAL :: TEST_MODULE_FUNCTION - REAL, INTENT(IN) :: A - REAL, INTENT(IN) :: B - TEST_MODULE_FUNCTION = A + B -END FUNCTION TEST_MODULE_FUNCTION diff --git a/Tests/Fortran/test_module_interface.f90 b/Tests/Fortran/test_module_interface.f90 deleted file mode 100644 index dd0f35c..0000000 --- a/Tests/Fortran/test_module_interface.f90 +++ /dev/null @@ -1,9 +0,0 @@ -MODULE TEST_MODULE - INTERFACE - FUNCTION TEST_MODULE_FUNCTION(A,B) - REAL :: TEST_MODULE_FUNCTION - REAL, INTENT(IN) :: A - REAL, INTENT(IN) :: B - END FUNCTION TEST_MODULE_FUNCTION - END INTERFACE -END MODULE TEST_MODULE diff --git a/Tests/Fortran/test_module_main.f90 b/Tests/Fortran/test_module_main.f90 deleted file mode 100644 index 6ac97fa..0000000 --- a/Tests/Fortran/test_module_main.f90 +++ /dev/null @@ -1,4 +0,0 @@ -PROGRAM MAINF90 - USE TEST_MODULE - PRINT *,'Sum is',TEST_MODULE_FUNCTION(1., 2.) -END PROGRAM MAINF90 diff --git a/Tests/Fortran/test_preprocess.F90 b/Tests/Fortran/test_preprocess.F90 deleted file mode 100644 index 3a09976..0000000 --- a/Tests/Fortran/test_preprocess.F90 +++ /dev/null @@ -1,53 +0,0 @@ -MODULE Available -! no conent -END MODULE - -PROGRAM PPTEST -! value of InPPFalseBranch ; values of SkipToEnd -! 0 <empty> -#ifndef FOO - ! 1 ; <0> - USE NotAvailable -# ifndef FOO - ! 2 ; <0,0> - USE NotAvailable -# else - ! 2 ; <0,0> - USE NotAvailable -# endif - ! 1 ; <0> -# ifdef FOO - ! 2 ; <0,1> - USE NotAvailable -# else - ! 2 ; <0,1> - USE NotAvailable -# endif - ! 1 ; <0> -#else - ! 0 ; <0> - USE Available -# ifndef FOO - ! 1 ; <0,0> - USE NotAvailable -# else - ! 0 ; <0,0> - USE Available -# endif - ! 0 ; <0> -# ifdef FOO - ! 0 ; <0,1> - USE Available -# else - ! 1 ; <0,1> - USE NotAvailable -# endif - ! 0 ; <0> -#endif -! 0 ; <empty> - -USE PPAvailable - -#include "test_preprocess.h" - -END PROGRAM diff --git a/Tests/Fortran/test_preprocess_module.F90 b/Tests/Fortran/test_preprocess_module.F90 deleted file mode 100644 index 5849b62..0000000 --- a/Tests/Fortran/test_preprocess_module.F90 +++ /dev/null @@ -1,5 +0,0 @@ -#ifdef FOO -MODULE PPAvailable -! no conent -END MODULE -#endif diff --git a/Tests/Fortran/test_use_in_comment_fixedform.f b/Tests/Fortran/test_use_in_comment_fixedform.f deleted file mode 100644 index 39f486b..0000000 --- a/Tests/Fortran/test_use_in_comment_fixedform.f +++ /dev/null @@ -1,7 +0,0 @@ - PROGRAM foo -! USE bar -! use bar -! Use bar - - WRITE(*,*) 'Hello, Fortran world.' - END PROGRAM diff --git a/Tests/Fortran/test_use_in_comment_freeform.f90 b/Tests/Fortran/test_use_in_comment_freeform.f90 deleted file mode 100644 index 48bcd5a..0000000 --- a/Tests/Fortran/test_use_in_comment_freeform.f90 +++ /dev/null @@ -1,7 +0,0 @@ -PROGRAM foo -! USE bar -! use bar -! Use bar - - WRITE(*,*) 'Hello, Fortran world.' -END PROGRAM |