From 5db8ac6b5e22579c76ccfb9220003b7c592e6a4b Mon Sep 17 00:00:00 2001 From: Luigi Pertoldi Date: Sat, 28 Dec 2024 20:28:35 +0100 Subject: [PATCH] use the python wrapper in tests --- tests/CMakeLists.txt | 5 +++++ tests/basics/CMakeLists.txt | 8 ++++---- tests/confinement/CMakeLists.txt | 6 +++--- tests/python/CMakeLists.txt | 7 +------ tests/vertex/CMakeLists.txt | 5 +++-- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 19da9398..be851279 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,6 +1,11 @@ cmake_minimum_required(VERSION 3.8) project(remage-tests) +# this can be used as the path to the remage executable in the tests +# in case the remage-cpp executable is needed, one can just use the +# "remage-cli-cpp" target name (see add_test() docs) +get_target_property(REMAGE_PYEXE remage-cli PYEXE_PATH) + add_subdirectory(basics) add_subdirectory(confinement) add_subdirectory(internals) diff --git a/tests/basics/CMakeLists.txt b/tests/basics/CMakeLists.txt index aed279a2..f30b7f8d 100644 --- a/tests/basics/CMakeLists.txt +++ b/tests/basics/CMakeLists.txt @@ -14,11 +14,11 @@ set(_macros_extra run-2nbb.mac) set(_macros_vis vis-co60.mac vis-2nbb.mac) foreach(_mac ${_macros} ${_macros_extra} ${_macros_vis}) - add_test(NAME basics/${_mac} COMMAND remage-cli-cpp -g gdml/main.gdml -- macros/${_mac}) + add_test(NAME basics/${_mac} COMMAND ${REMAGE_PYEXE} -g gdml/main.gdml -- macros/${_mac}) endforeach() foreach(_mac ${_macros}) - add_test(NAME basics-mt/${_mac} COMMAND remage-cli-cpp -g gdml/main.gdml -t 2 macros/${_mac}) + add_test(NAME basics-mt/${_mac} COMMAND ${REMAGE_PYEXE} -g gdml/main.gdml -t 2 macros/${_mac}) set_tests_properties(basics-mt/${_mac} PROPERTIES LABELS mt) endforeach() @@ -29,7 +29,7 @@ endif() if(BxDecay0_THREADSAFE) foreach(_mac ${_macros_extra}) - add_test(NAME basics-mt/${_mac} COMMAND remage-cli-cpp -g gdml/main.gdml -t 2 macros/${_mac}) + add_test(NAME basics-mt/${_mac} COMMAND ${REMAGE_PYEXE} -g gdml/main.gdml -t 2 macros/${_mac}) set_tests_properties(basics-mt/${_mac} PROPERTIES LABELS "mt extra") endforeach() @@ -49,6 +49,6 @@ set_tests_properties(${_macros_vis} PROPERTIES SKIP_REGULAR_EXPRESSION "couldn't # further specific tests. # expect two overlaps from this prepared geometry. -add_test(NAME basics/overlaps.mac COMMAND remage-cli-cpp -- macros/overlaps.mac) +add_test(NAME basics/overlaps.mac COMMAND ${REMAGE_PYEXE} -- macros/overlaps.mac) set_tests_properties(basics/overlaps.mac PROPERTIES PASS_REGULAR_EXPRESSION "GeomVol1002.*GeomVol1002") diff --git a/tests/confinement/CMakeLists.txt b/tests/confinement/CMakeLists.txt index 681f86c4..2107bbe2 100644 --- a/tests/confinement/CMakeLists.txt +++ b/tests/confinement/CMakeLists.txt @@ -13,15 +13,15 @@ set(_macros complex-volume.mac geometrical.mac native-surface.mac geometrical-an geometrical-or-physical.mac native-volume.mac) foreach(_mac ${_macros}) - add_test(NAME confinement/${_mac} COMMAND remage-cli-cpp -g gdml/geometry.gdml -o test-out.root + add_test(NAME confinement/${_mac} COMMAND ${REMAGE_PYEXE} -g gdml/geometry.gdml -o test-out.root -- macros/${_mac}) - add_test(NAME confinement-mt/${_mac} COMMAND remage-cli-cpp -g gdml/geometry.gdml -t 2 -o + add_test(NAME confinement-mt/${_mac} COMMAND ${REMAGE_PYEXE} -g gdml/geometry.gdml -t 2 -o test-out.root -- macros/${_mac}) set_tests_properties(confinement-mt/${_mac} PROPERTIES LABELS mt) add_test(NAME confinement-vis/${_mac} - COMMAND remage-cli-cpp -g gdml/geometry.gdml -o test-out.root -- macros/_vis.mac + COMMAND ${REMAGE_PYEXE} -g gdml/geometry.gdml -o test-out.root -- macros/_vis.mac macros/${_mac} macros/_vis-export.mac) set_tests_properties(confinement-vis/${_mac} PROPERTIES LABELS vis) set_tests_properties(confinement-vis/${_mac} PROPERTIES SKIP_REGULAR_EXPRESSION diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt index 41ced6ea..a6a18ad4 100644 --- a/tests/python/CMakeLists.txt +++ b/tests/python/CMakeLists.txt @@ -1,6 +1 @@ -get_target_property(REMAGE_PYEXE remage-cli PYEXE_PATH) - -add_test( - NAME python/cli - COMMAND "${REMAGE_PYEXE}" -q - COMMAND "${REMAGE_PYEXE}" --help) +add_test(NAME python/cli COMMAND "${REMAGE_PYEXE}" -q --help) diff --git a/tests/vertex/CMakeLists.txt b/tests/vertex/CMakeLists.txt index 2b2ddcce..4b16e003 100644 --- a/tests/vertex/CMakeLists.txt +++ b/tests/vertex/CMakeLists.txt @@ -12,8 +12,9 @@ endforeach() set(_macros vert-hdf5.mac vert-lh5.mac) foreach(_mac ${_macros}) - add_test(NAME vertex/${_mac} COMMAND remage-cli-cpp -g gdml/geometry.gdml -- macros/${_mac}) + add_test(NAME vertex/${_mac} COMMAND ${REMAGE_PYEXE} -g gdml/geometry.gdml -- macros/${_mac}) set_tests_properties(vertex/${_mac} PROPERTIES LABELS extra) - add_test(NAME vertex-mt/${_mac} COMMAND remage-cli-cpp -g gdml/geometry.gdml -t 2 macros/${_mac}) + add_test(NAME vertex-mt/${_mac} COMMAND ${REMAGE_PYEXE} -g gdml/geometry.gdml -t 2 + macros/${_mac}) set_tests_properties(vertex-mt/${_mac} PROPERTIES LABELS "mt extra") endforeach()