Skip to content

Commit efb106f

Browse files
authored
Merge pull request #12 from andread3vita/main
FIX tests
2 parents 2287583 + 723c3d2 commit efb106f

File tree

4 files changed

+42
-48
lines changed

4 files changed

+42
-48
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ limitations under the License.
1919
CMAKE_MINIMUM_REQUIRED(VERSION 3.12)
2020

2121

22-
project(GaudiTutorial LANGUAGES CXX)
22+
project(SoftwareTutorials LANGUAGES CXX)
2323

2424
# please keep this layout for version setting, used by the automatic tagging script
2525
set(PACKAGE_VERSION_MAJOR 1)

GaudiTutorial/CMakeLists.txt

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,9 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1616
See the License for the specific language governing permissions and
1717
limitations under the License.
1818
]]
19-
add_subdirectory(EventStats)
20-
add_subdirectory(MoliereRadiusFunctional)
21-
add_subdirectory(RandomNoiseDigitizer)
22-
23-
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory
24-
${PROJECT_SOURCE_DIR}/GaudiTutorial/data)
2519

26-
set(SIM_FILE ${PROJECT_SOURCE_DIR}/GaudiTutorial/data/simpleCalo_simulation.root)
20+
project(GaudiTutorial LANGUAGES CXX)
2721

28-
if(NOT EXISTS ${SIM_FILE})
29-
message(STATUS "Downloading simpleCalo_simulation.root ...")
30-
execute_process(
31-
COMMAND wget -O ${SIM_FILE} https://fccsw.web.cern.ch/fccsw/tutorials/DRD6_2025_Ancona/simpleCalo_simulation.root
32-
)
33-
else()
34-
message(STATUS "File already exists: ${SIM_FILE}, skipping download.")
35-
endif()
22+
add_subdirectory(EventStats)
23+
add_subdirectory(MoliereRadiusFunctional)
24+
add_subdirectory(RandomNoiseDigitizer)

GaudiTutorial/EventStats/CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,17 @@ See the License for the specific language governing permissions and
1717
limitations under the License.
1818
]]
1919
file(GLOB _plugin_sources src/components/*.cpp)
20-
gaudi_add_module(EventStatsPlugins
20+
21+
set(PackageName EventStats)
22+
23+
gaudi_add_module(${PackageName}
2124
SOURCES ${_plugin_sources}
2225
LINK Gaudi::GaudiKernel
2326
k4FWCore::k4FWCore
2427
EDM4HEP::edm4hep
2528
)
2629

27-
install(TARGETS EventStatsPlugins
30+
install(TARGETS ${PackageName}
2831
EXPORT ${CMAKE_PROJECT_NAME}Targets
2932
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin
3033
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib

test/CMakeLists.txt

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,39 +17,17 @@ See the License for the specific language governing permissions and
1717
limitations under the License.
1818
]]
1919

20-
function(set_test_env _testname)
21-
set_property(TEST ${_testname} APPEND PROPERTY ENVIRONMENT
22-
"ROOT_INCLUDE_PATH=$<$<TARGET_EXISTS:podio::podio>:$<TARGET_FILE_DIR:podio::podio>/../include>:$<$<TARGET_EXISTS:EDM4HEP::edm4hep>:$<TARGET_FILE_DIR:EDM4HEP::edm4hep>/../include>:$ENV{ROOT_INCLUDE_PATH}"
23-
)
24-
25-
set_property(TEST ${_testname} APPEND PROPERTY ENVIRONMENT
26-
"LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib64:${PROJECT_BINARY_DIR}:${PROJECT_BINARY_DIR}/${CMAKE_PROJECT_NAME}:${PROJECT_BINARY_DIR}/genConfDir/${PackageName}:<$<TARGET_EXISTS:ROOT::Core>:$<TARGET_FILE_DIR:ROOT::Core>>:$<$<TARGET_EXISTS:EDM4HEP::edm4hep>:$<TARGET_FILE_DIR:EDM4HEP::edm4hep>>:$<$<TARGET_EXISTS:podio::podio>:$<TARGET_FILE_DIR:podio::podio>>:$ENV{LD_LIBRARY_PATH}"
27-
)
28-
29-
set_property(TEST ${_testname} APPEND PROPERTY ENVIRONMENT
30-
"PYTHONPATH=${CMAKE_BINARY_DIR}:${PROJECT_BINARY_DIR}/genConfDir:$ENV{PYTHONPATH}"
31-
)
32-
33-
set_property(TEST ${_testname} APPEND PROPERTY ENVIRONMENT
34-
"GAUDI_PLUGIN_PATH=${CMAKE_BINARY_DIR}/.plugins:${CMAKE_INSTALL_PREFIX}/lib64:$ENV{GAUDI_PLUGIN_PATH}"
35-
)
36-
37-
endfunction()
38-
3920
add_test(NAME test_EventStats
40-
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
41-
COMMAND k4run GaudiTutorial/EventStats/options/runEventStatsSolution.py --IOSvc.Input ${PROJECT_SOURCE_DIR}/GaudiTutorial/data/simpleCalo_simulation.root --IOSvc.Output ${PROJECT_SOURCE_DIR}/GaudiTutorial/data/simpleCalo_eventStats.root)
42-
set_test_env(test_EventStats)
21+
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
22+
COMMAND k4run GaudiTutorial/EventStats/options/runEventStatsSolution.py --IOSvc.Input ${PROJECT_SOURCE_DIR}/GaudiTutorial/data/simpleCalo_simulation.root --IOSvc.Output ${PROJECT_SOURCE_DIR}/GaudiTutorial/data/simpleCalo_eventStats.root)
4323

4424
add_test(NAME test_MoliereRadius
45-
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
46-
COMMAND k4run GaudiTutorial/MoliereRadiusFunctional/options/runMoliereRadiusSolution.py --IOSvc.Input ${PROJECT_SOURCE_DIR}/GaudiTutorial/data/simpleCalo_simulation.root --IOSvc.Output ${PROJECT_SOURCE_DIR}/GaudiTutorial/data/simpleCalo_moliereRadius.root)
47-
set_test_env(test_MoliereRadius)
25+
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
26+
COMMAND k4run GaudiTutorial/MoliereRadiusFunctional/options/runMoliereRadiusSolution.py --IOSvc.Input ${PROJECT_SOURCE_DIR}/GaudiTutorial/data/simpleCalo_simulation.root --IOSvc.Output ${PROJECT_SOURCE_DIR}/GaudiTutorial/data/simpleCalo_moliereRadius.root)
4827

4928
add_test(NAME test_RandomNoiseDigitizer
50-
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
51-
COMMAND k4run GaudiTutorial/RandomNoiseDigitizer/options/runRandomNoiseDigitizerSolution.py --IOSvc.Input ${PROJECT_SOURCE_DIR}/GaudiTutorial/data/simpleCalo_simulation.root --IOSvc.Output ${PROJECT_SOURCE_DIR}/GaudiTutorial/data/simpleCalo_noiseDigitizer.root)
52-
set_test_env(test_MoliereRadius)
29+
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
30+
COMMAND k4run GaudiTutorial/RandomNoiseDigitizer/options/runRandomNoiseDigitizerSolution.py --IOSvc.Input ${PROJECT_SOURCE_DIR}/GaudiTutorial/data/simpleCalo_simulation.root --IOSvc.Output ${PROJECT_SOURCE_DIR}/GaudiTutorial/data/simpleCalo_noiseDigitizer.root)
5331

5432
# For LD_LIBRARY_PATH
5533
# ${PROJECT_BINARY_DIR} # The files <plugins>.components and <plugins>.confdb are here
@@ -67,22 +45,46 @@ set_test_env(test_MoliereRadius)
6745
# See, for example:
6846
# https://github.com/key4hep/k4FWCore/blob/42497b71c23425a3a26648f30a1285a499dcda28/test/k4FWCoreTest/CMakeLists.txt#L71
6947

48+
49+
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory
50+
${PROJECT_SOURCE_DIR}/GaudiTutorial/data)
51+
52+
set(SIM_FILE ${PROJECT_SOURCE_DIR}/GaudiTutorial/data/simpleCalo_simulation.root)
53+
54+
if(NOT EXISTS ${SIM_FILE})
55+
message(STATUS "Downloading simpleCalo_simulation.root ...")
56+
execute_process(
57+
COMMAND wget -O ${SIM_FILE} https://fccsw.web.cern.ch/fccsw/tutorials/DRD6_2025_Ancona/simpleCalo_simulation.root
58+
)
59+
else()
60+
message(STATUS "File already exists: ${SIM_FILE}, skipping download.")
61+
endif()
62+
63+
7064
get_filename_component(CURRENT_DIR_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
7165

7266
set(test_environment "\
7367
LD_LIBRARY_PATH=\
7468
${PROJECT_BINARY_DIR}:\
69+
${PROJECT_BINARY_DIR}/GaudiTutorial/EventStats:\
70+
${PROJECT_BINARY_DIR}/GaudiTutorial/MoliereRadiusFunctional:\
71+
${PROJECT_BINARY_DIR}/GaudiTutorial/RandomNoiseDigitizer:\
7572
${PROJECT_BINARY_DIR}/${PROJECT_NAME}:\
7673
${CMAKE_CURRENT_BINARY_DIR}:\
7774
${CMAKE_CURRENT_BINARY_DIR}/genConfDir/${CURRENT_DIR_NAME}:\
7875
$ENV{LD_LIBRARY_PATH};\
7976
\
8077
PYTHONPATH=\
78+
${PROJECT_BINARY_DIR}/GaudiTutorial/EventStats/genConfDir:\
79+
${PROJECT_BINARY_DIR}/GaudiTutorial/MoliereRadiusFunctional/genConfDir:\
80+
${PROJECT_BINARY_DIR}/GaudiTutorial/RandomNoiseDigitizer/genConfDir:\
8181
${PROJECT_BINARY_DIR}/${PROJECT_NAME}/genConfDir:\
8282
${CMAKE_CURRENT_BINARY_DIR}/genConfDir:\
8383
$ENV{PYTHONPATH};\
84-
"
85-
)
84+
")
8685
get_property(test_names DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY TESTS)
8786
set_tests_properties(${test_names} PROPERTIES ENVIRONMENT "${test_environment}")
8887

88+
message(STATUS "================ Test Environment ================")
89+
message(STATUS "${test_environment}")
90+
message(STATUS "=================================================")

0 commit comments

Comments
 (0)