Skip to content
Snippets Groups Projects
Commit 534d8417 authored by Felix Weiglhofer's avatar Felix Weiglhofer
Browse files

algo: Refactor test cmake.

parent f3b02e92
No related branches found
No related tags found
1 merge request!1456algo: Refactor test cmake.
Pipeline #25106 passed
......@@ -51,12 +51,15 @@ if (CBM_ONLINE_STANDALONE)
add_subdirectory(../external external)
endif()
add_subdirectory(log)
add_subdirectory(data)
add_subdirectory(test)
add_subdirectory(ca)
# exclude unittests from being build inside the container
if (NOT CBM_ONLINE_STANDALONE)
add_subdirectory(test)
endif()
set(DEVICE_SRCS
base/gpu/DeviceImage.cxx
base/gpu/Params.cxx
......
Macro(CreateGTestExeAndAddTest _testname _includeDirs _linkDirs _sources _pub_dep _pvt_dep _int_dep _testdepend)
add_executable(${_testname} ${_sources})
target_link_libraries(${_testname} PUBLIC ${_pub_dep} PRIVATE ${_pvt_dep} INTERFACE ${_int_dep} )
target_include_directories(${_testname} PUBLIC ${_includeDirs})
Gen_Exe_Script(${_testname})
string(REPLACE ${PROJECT_SOURCE_DIR}
${PROJECT_BINARY_DIR} new_path ${CMAKE_CURRENT_SOURCE_DIR}
)
Add_Test(${_testname} ${new_path}/${_testname}.sh)
If(NOT ${_testdepend} STREQUAL "")
Set_Tests_Properties(${_testname} PROPERTIES DEPENDS ${_testdepend})
EndIf()
EndMacro(CreateGTestExeAndAddTest)
# get_target_property(_inDir Gtest INTERFACE_INCLUDE_DIRECTORIES)
# set_property(TARGET Gtest APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${_inDir}/..")
set(PVT_DEPS
Algo
Gtest
GtestMain
Function(AddBasicTest name)
set(PVT_DEPS
Algo
Gtest
GtestMain
)
Set(TimeClusterTriggerSources
_GTestTimeClusterTrigger.cxx
)
CreateGTestExeAndAddTest(_GTestTimeClusterTrigger "${INCLUDE_DIRECTORIES}" "${LINK_DIRECTORIES}"
"${TimeClusterTriggerSources}" "${PUB_DEPS}" "${PVT_DEPS}" "${INT_DEPS}" "")
Set(EventBuilderSources
_GTestEventBuilder.cxx
)
CreateGTestExeAndAddTest(_GTestEventBuilder "${INCLUDE_DIRECTORIES}" "${LINK_DIRECTORIES}"
"${EventBuilderSources}" "${PUB_DEPS}" "${PVT_DEPS}" "${INT_DEPS}" "")
Set(DigiEventSelectorSources
_GTestDigiEventSelector.cxx
)
CreateGTestExeAndAddTest(_GTestDigiEventSelector "${INCLUDE_DIRECTORIES}" "${LINK_DIRECTORIES}"
"${DigiEventSelectorSources}" "${PUB_DEPS}" "${PVT_DEPS}" "${INT_DEPS}" "")
Set(YamlConfigSources
_GTestYamlConfig.cxx
)
CreateGTestExeAndAddTest(_GTestYamlConfig "${INCLUDE_DIRECTORIES}" "${LINK_DIRECTORIES}"
"${YamlConfigSources}" "${PUB_DEPS}" "${PVT_DEPS}" "${INT_DEPS}" "")
Set(PartitionedVectorSources
_GTestPartitionedVector.cxx
)
CreateGTestExeAndAddTest(_GTestPartitionedVector "${INCLUDE_DIRECTORIES}" "${LINK_DIRECTORIES}"
"${PartitionedVectorSources}" "${PUB_DEPS}" "${PVT_DEPS}" "${INT_DEPS}" "")
Set(PartitionedSpanSources _GTestPartitionedSpan.cxx)
CreateGTestExeAndAddTest(_GTestPartitionedSpan "${INCLUDE_DIRECTORIES}" "${LINK_DIRECTORIES}"
"${PartitionedSpanSources}" "${PUB_DEPS}" "${PVT_DEPS}" "${INT_DEPS}" "")
add_executable(${name} ${name}.cxx)
target_link_libraries(${name} PRIVATE ${PVT_DEPS})
Add_Test(
NAME ${name}
COMMAND ${name}
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
)
EndFunction()
AddBasicTest(_GTestTimeClusterTrigger)
AddBasicTest(_GTestEventBuilder)
AddBasicTest(_GTestDigiEventSelector)
AddBasicTest(_GTestYamlConfig)
AddBasicTest(_GTestPartitionedVector)
AddBasicTest(_GTestPartitionedSpan)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment