4 ${CoreFlows_INCLUDES} #
10 if(CMAKE_COMPILER_IS_GNUCXX)
11 if (CMAKE_BUILD_TYPE STREQUAL Debug)
13 setup_target_for_coverage(cov ctest coverage)
18 ##################################### test generation with ctest
20 # this function creates a target and a ctest test
21 function(CreateTestExec SourceTestFile libList)
22 get_filename_component( FILE_BASENAME ${SourceTestFile} NAME_WE) # <path>/testxxx.c --> testxxx
23 set( EXECNAME "${FILE_BASENAME}.exe" ) # testxxx --> testxxx.exe
24 add_executable(${EXECNAME} ${SourceTestFile}) # compilation of the testxxx.exe
25 set_target_properties(${EXECNAME} PROPERTIES COMPILE_FLAGS "")
26 target_link_libraries(${EXECNAME} ${libList}) # provide required lib for testxxx.exe
27 add_test(${FILE_BASENAME} ${EXECNAME} "./${EXECNAME}") # adding a ctest Test
28 endfunction(CreateTestExec)
30 # this function creates a target and a ctest test
31 # and also create install rules for copying the example
33 function(CreateTestExecAndInstall SourceTestFile libList)
34 get_filename_component( FILE_BASENAME ${SourceTestFile} NAME_WE) # <path>/testxxx.c --> testxxx
35 set( EXECNAME "${FILE_BASENAME}.exe" ) # testxxx --> testxxx.exe
36 add_executable(${EXECNAME} ${SourceTestFile}) # compilation of the testxxx.exe
37 set_target_properties(${EXECNAME} PROPERTIES COMPILE_FLAGS "")
38 target_link_libraries(${EXECNAME} ${libList}) # provide required lib for testxxx.exe
39 add_test(NAME ${EXECNAME} COMMAND "./${EXECNAME}") # adding a ctest Test
40 install(TARGETS ${EXECNAME} DESTINATION share/examples)
41 endfunction(CreateTestExecAndInstall)
44 set( libs_for_tests CoreFlowsLibs )
46 # copy tests resources (med files etc.) into the build directory
47 file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../resources DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
49 CreateTestExecAndInstall(CoupledTransportDiffusionEquations_1DHeatedChannel.cxx "${libs_for_tests}" )
51 CreateTestExecAndInstall(TransportEquation_1DHeatedChannel.cxx "${libs_for_tests}" )
53 CreateTestExecAndInstall(DiffusionEquation_1DHeatedRod.cxx "${libs_for_tests}" )
54 CreateTestExecAndInstall(DiffusionEquation_1DHeatedRod_FE.cxx "${libs_for_tests}" )
56 CreateTestExecAndInstall(StationaryDiffusionEquation_2DEF_StructuredTriangles.cxx "${libs_for_tests}" )
57 CreateTestExecAndInstall(StationaryDiffusionEquation_2DEF_StructuredTriangles_Neumann.cxx "${libs_for_tests}" )
58 CreateTestExecAndInstall(StationaryDiffusionEquation_2DEF_UnstructuredTriangles.cxx "${libs_for_tests}" )
59 CreateTestExecAndInstall(StationaryDiffusionEquation_2DFV_StructuredTriangles.cxx "${libs_for_tests}" )
60 CreateTestExecAndInstall(StationaryDiffusionEquation_2DFV_StructuredTriangles_Neumann.cxx "${libs_for_tests}" )
61 CreateTestExecAndInstall(StationaryDiffusionEquation_2DFV_StructuredSquares.cxx "${libs_for_tests}" )
62 CreateTestExecAndInstall(StationaryDiffusionEquation_3DEF_StructuredTetrahedra.cxx "${libs_for_tests}" )
63 CreateTestExecAndInstall(StationaryDiffusionEquation_3DFV_StructuredTetrahedra.cxx "${libs_for_tests}" )
65 CreateTestExecAndInstall(testEOS.cxx "${libs_for_tests}" )
67 CreateTestExecAndInstall(SinglePhase_1DDepressurisation.cxx "${libs_for_tests}" )
68 CreateTestExecAndInstall(SinglePhase_1DHeatedChannel.cxx "${libs_for_tests}" )
69 CreateTestExecAndInstall(SinglePhase_1DPorosityJump.cxx "${libs_for_tests}" )
70 CreateTestExecAndInstall(SinglePhase_1DRiemannProblem.cxx "${libs_for_tests}" )
71 CreateTestExecAndInstall(SinglePhase_1DRiemannProblem_Implicit.cxx "${libs_for_tests}" )
72 CreateTestExecAndInstall(SinglePhase_1DRiemannProblem_Implicit_LineSearch.cxx "${libs_for_tests}" )
73 CreateTestExecAndInstall(SinglePhase_2DHeatDrivenCavity.cxx "${libs_for_tests}" )
74 CreateTestExecAndInstall(SinglePhase_2DHeatDrivenCavity_unstructured.cxx "${libs_for_tests}" )
75 CreateTestExecAndInstall(SinglePhase_2DHeatedChannelInclined.cxx "${libs_for_tests}" )
76 CreateTestExecAndInstall(SinglePhase_2DLidDrivenCavity.cxx "${libs_for_tests}" )
77 CreateTestExecAndInstall(SinglePhase_2DLidDrivenCavity_unstructured.cxx "${libs_for_tests}" )
78 CreateTestExecAndInstall(SinglePhase_2DSphericalExplosion_unstructured.cxx "${libs_for_tests}" )
79 CreateTestExecAndInstall(SinglePhase_3DSphericalExplosion_unstructured.cxx "${libs_for_tests}" )
80 CreateTestExecAndInstall(SinglePhase_2DWallHeatedChannel_ChangeSect.cxx "${libs_for_tests}" )
81 CreateTestExecAndInstall(SinglePhase_2DWallHeatedChannel.cxx "${libs_for_tests}" )
82 CreateTestExecAndInstall(SinglePhase_3DHeatDrivenCavity.cxx "${libs_for_tests}" )
83 CreateTestExecAndInstall(SinglePhase_HeatedWire_2Branches.cxx "${libs_for_tests}" )
85 CreateTestExecAndInstall(DriftModel_1DBoilingAssembly.cxx "${libs_for_tests}" )
86 CreateTestExecAndInstall(DriftModel_1DBoilingChannel.cxx "${libs_for_tests}" )
87 CreateTestExecAndInstall(DriftModel_1DChannelGravity.cxx "${libs_for_tests}" )
88 CreateTestExecAndInstall(DriftModel_1DDepressurisation.cxx "${libs_for_tests}" )
89 CreateTestExecAndInstall(DriftModel_1DPorosityJump.cxx "${libs_for_tests}" )
90 CreateTestExecAndInstall(DriftModel_1DPressureLoss.cxx "${libs_for_tests}" )
91 CreateTestExecAndInstall(DriftModel_1DRiemannProblem.cxx "${libs_for_tests}" )
92 CreateTestExecAndInstall(DriftModel_1DVidangeReservoir.cxx "${libs_for_tests}" )
93 CreateTestExecAndInstall(DriftModel_2DInclinedBoilingChannel.cxx "${libs_for_tests}" )
94 CreateTestExecAndInstall(DriftModel_2DInclinedChannelGravity.cxx "${libs_for_tests}" )
95 CreateTestExecAndInstall(DriftModel_2DInclinedChannelGravityBarriers.cxx "${libs_for_tests}" )
96 CreateTestExecAndInstall(DriftModel_3DCanalCloison.cxx "${libs_for_tests}" )
98 CreateTestExecAndInstall(FiveEqsTwoFluid_1DBoilingChannel.cxx "${libs_for_tests}" )
99 CreateTestExecAndInstall(FiveEqsTwoFluid_1DDepressurisation.cxx "${libs_for_tests}" )
100 CreateTestExecAndInstall(FiveEqsTwoFluid_1DRiemannProblem.cxx "${libs_for_tests}" )
101 CreateTestExecAndInstall(FiveEqsTwoFluid_2DInclinedBoilingChannel.cxx "${libs_for_tests}" )
102 CreateTestExecAndInstall(FiveEqsTwoFluid_2DInclinedSedimentation.cxx "${libs_for_tests}" )
104 CreateTestExecAndInstall(IsothermalTwoFluid_1DDepressurisation.cxx "${libs_for_tests}" )
105 CreateTestExecAndInstall(IsothermalTwoFluid_1DRiemannProblem.cxx "${libs_for_tests}" )
106 #CreateTestExecAndInstall(IsothermalTwoFluid_1DSedimentation.cxx "${libs_for_tests}" )
107 CreateTestExecAndInstall(IsothermalTwoFluid_2DInclinedSedimentation.cxx "${libs_for_tests}" )
108 CreateTestExecAndInstall(IsothermalTwoFluid_2DVidangeReservoir.cxx "${libs_for_tests}" )
111 add_executable(WaveSystem_FV_SphericalExplosion_CDMATH.exe WaveSystem_FV_SphericalExplosion_CDMATH.cxx)
112 target_link_libraries(WaveSystem_FV_SphericalExplosion_CDMATH.exe CoreFlowsLibs )
113 install(TARGETS WaveSystem_FV_SphericalExplosion_CDMATH.exe DESTINATION share/examples)
114 add_test(NAME WaveSystem_2DFV_SphericalExplosion_CDMATH_SQUARE COMMAND "./WaveSystem_FV_SphericalExplosion_CDMATH.exe")
115 add_test(NAME WaveSystem_2DFV_SphericalExplosion_CDMATH_HEXAGON COMMAND "./WaveSystem_FV_SphericalExplosion_CDMATH.exe" resources/meshHexagonWithTriangles10.med)
116 add_test(NAME WaveSystem_3DFV_SphericalExplosion_CDMATH_CUBE COMMAND "./WaveSystem_FV_SphericalExplosion_CDMATH.exe" resources/meshCube.med)
117 add_test(NAME WaveSystem_3DFV_SphericalExplosion_CDMATH_TETRAHEDRON COMMAND "./WaveSystem_FV_SphericalExplosion_CDMATH.exe" resources/meshTetrahedron10.med)
119 if( SOLVERLAB_WITH_MPI )
120 add_executable(WaveSystem_FV_SphericalExplosion_MPI.exe WaveSystem_FV_SphericalExplosion_MPI.cxx) # compilation of the testxxx.exe
121 target_link_libraries(WaveSystem_FV_SphericalExplosion_MPI.exe CoreFlowsLibs ${MPI_LIBRARY}) # provide required lib for testxxx.exe
122 install(TARGETS WaveSystem_FV_SphericalExplosion_MPI.exe DESTINATION share/examples)
123 add_test(NAME WaveSystem_2DFV_SphericalExplosion_MPI_SEQ_SQUARE COMMAND "${MPIEXEC}" "-n" "1" "./WaveSystem_FV_SphericalExplosion_MPI.exe")
124 add_test(NAME WaveSystem_2DFV_SphericalExplosion_MPI_SEQ_HEXAGON COMMAND "${MPIEXEC}" "-n" "1" "./WaveSystem_FV_SphericalExplosion_MPI.exe" resources/meshHexagonWithTriangles10.med)
125 add_test(NAME WaveSystem_3DFV_SphericalExplosion_MPI_SEQ_CUBE COMMAND "${MPIEXEC}" "-n" "1" "./WaveSystem_FV_SphericalExplosion_MPI.exe" resources/meshCube.med)
126 add_test(NAME WaveSystem_3DFV_SphericalExplosion_MPI_SEQ_TETRAHEDRON COMMAND "${MPIEXEC}" "-n" "1" "./WaveSystem_FV_SphericalExplosion_MPI.exe" resources/meshTetrahedron10.med)
127 add_test(NAME WaveSystem_2DFV_SphericalExplosion_MPI_PAR_SQUARE COMMAND "${MPIEXEC}" "-n" "2" "./WaveSystem_FV_SphericalExplosion_MPI.exe")
128 add_test(NAME WaveSystem_2DFV_SphericalExplosion_MPI_PAR_HEXAGON COMMAND "${MPIEXEC}" "-n" "2" "./WaveSystem_FV_SphericalExplosion_MPI.exe" resources/meshHexagonWithTriangles10.med)
129 add_test(NAME WaveSystem_3DFV_SphericalExplosion_MPI_PAR_CUBE COMMAND "${MPIEXEC}" "-n" "2" "./WaveSystem_FV_SphericalExplosion_MPI.exe" resources/meshCube.med)
130 add_test(NAME WaveSystem_3DFV_SphericalExplosion_MPI_PAR_TETRAHEDRON COMMAND "${MPIEXEC}" "-n" "2" "./WaveSystem_FV_SphericalExplosion_MPI.exe" resources/meshTetrahedron10.med)
131 endif( SOLVERLAB_WITH_MPI )