Newer
Older
#=================================================================================
#---------------------------------------------------------------------------------
# Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
# All rights reserved.
#
# For the licensing terms see $DD4hepINSTALL/LICENSE.
# For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
#
#=================================================================================
Andre Sailer
committed
add_library(DD4hep::DDTest ALIAS DDTest)
Markus Frank
committed
dd4hep_use_python_executable()
target_include_directories(DDTest INTERFACE include)
Andre Sailer
committed
foreach(TEST_NAME
Andre Sailer
committed
test_bitfield64
test_bitfieldcoder
test_DetType
test_PolarGridRPhi2
test_cellDimensions
test_cellDimensionsRPhi2
test_segmentationHandles
Andre Sailer
committed
)
add_executable(${TEST_NAME} src/${TEST_NAME}.cc)
Andre Sailer
committed
target_link_libraries(${TEST_NAME} DD4hep::DDCore DD4hep::DDRec DD4hep::DDTest)
install(TARGETS ${TEST_NAME} RUNTIME DESTINATION bin)
Andre Sailer
committed
set(cmd ${CMAKE_INSTALL_PREFIX}/bin/run_test.sh ${TEST_NAME})
add_test(NAME t_${TEST_NAME} COMMAND ${cmd} ${TEST_NAME})
set_tests_properties(t_${TEST_NAME} PROPERTIES FAIL_REGULAR_EXPRESSION "TEST_FAILED")
endforeach()
foreach(TEST_NAME
test_units
test_surface
)
add_executable(${TEST_NAME} src/${TEST_NAME}.cc)
Andre Sailer
committed
target_link_libraries(${TEST_NAME} DD4hep::DDCore DD4hep::DDRec DD4hep::DDTest)
install(TARGETS ${TEST_NAME} RUNTIME DESTINATION bin)
Andre Sailer
committed
add_test(NAME t_${TEST_NAME}
COMMAND ${CMAKE_INSTALL_PREFIX}/bin/run_test.sh ${TEST_NAME} file:${CMAKE_CURRENT_SOURCE_DIR}/units.xml)
set_tests_properties(t_${TEST_NAME} PROPERTIES FAIL_REGULAR_EXPRESSION "TEST_FAILED")
endforeach()
ADD_TEST( t_test_python_import "${CMAKE_INSTALL_PREFIX}/bin/run_test.sh"
pytest ${PROJECT_SOURCE_DIR}/DDTest/python/test_import.py)
SET_TESTS_PROPERTIES( t_test_python_import PROPERTIES FAIL_REGULAR_EXPRESSION "Exception;EXCEPTION;ERROR;Error" )
ADD_TEST( t_test_python_import_ddg4 "${CMAKE_INSTALL_PREFIX}/bin/run_test.sh"
pytest ${PROJECT_SOURCE_DIR}/DDTest/python/test_import_ddg4.py)
SET_TESTS_PROPERTIES( t_test_python_import_ddg4 PROPERTIES FAIL_REGULAR_EXPRESSION "Exception;EXCEPTION;ERROR;Error" )
Andre Sailer
committed
foreach(TEST_NAME
test_EventReaders
)
add_executable(${TEST_NAME} src/${TEST_NAME}.cc)
if(DD4HEP_USE_HEPMC3)
target_compile_definitions(${TEST_NAME} PRIVATE DD4HEP_USE_HEPMC3)
endif()
if(DD4HEP_USE_LCIO)
target_compile_definitions(${TEST_NAME} PRIVATE DD4HEP_USE_LCIO)
endif()
Andre Sailer
committed
target_link_libraries(${TEST_NAME} DD4hep::DDCore DD4hep::DDRec DD4hep::DDG4)
Andre Sailer
committed
target_include_directories(${TEST_NAME} PRIVATE ./include)
install(TARGETS ${TEST_NAME} DESTINATION bin)
add_test(NAME t_${TEST_NAME} COMMAND ${CMAKE_INSTALL_PREFIX}/bin/run_test.sh ${TEST_NAME} ${CMAKE_CURRENT_SOURCE_DIR})
set_tests_properties(t_${TEST_NAME} PROPERTIES FAIL_REGULAR_EXPRESSION "TEST_FAILED")
endforeach(TEST_NAME)
set(DDSIM_OUTPUT_FILES .root)
if(DD4HEP_USE_LCIO)
LIST(APPEND DDSIM_OUTPUT_FILES .slcio)
endif()
if(DD4HEP_USE_EDM4HEP)
LIST(APPEND DDSIM_OUTPUT_FILES edm4hep.root)
endif()
foreach(OUTPUT_FILE IN LISTS DDSIM_OUTPUT_FILES)
ADD_TEST( t_test_ddsim_${OUTPUT_FILE} "${CMAKE_INSTALL_PREFIX}/bin/run_test.sh"
ddsim --compactFile=${CMAKE_INSTALL_PREFIX}/DDDetectors/compact/SiD.xml --runType=batch -G -N=2
--outputFile=testSid${OUTPUT_FILE}
--gun.position \"0.0 0.0 1.0*cm\" --gun.direction \"1.0 0.0 1.0\" --gun.energy 100*GeV --part.userParticleHandler=)
SET_TESTS_PROPERTIES( t_test_ddsim_${OUTPUT_FILE} PROPERTIES FAIL_REGULAR_EXPRESSION "Exception;EXCEPTION;ERROR;Error" )
endforeach()
install(DIRECTORY include/DD4hep DESTINATION include)