From fb3cdf4aa2c7820561b4abdfcb5ee4ce799ca59c Mon Sep 17 00:00:00 2001 From: Frank Gaede <frank.gaede@desy.de> Date: Tue, 28 Jan 2014 12:07:15 +0000 Subject: [PATCH] - added script run_tests.sh to run the tests after initializing w/ thisdd4hep.sh --- CMakeLists.txt | 6 +++++- DDTest/CMakeLists.txt | 9 ++++++--- cmake/run_test.sh | 26 ++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 4 deletions(-) create mode 100755 cmake/run_test.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 0453d7920..58419ecd4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,11 +84,15 @@ add_subdirectory(UtilityApps) #---Configuration------------------------------------------------------------------- configure_file(cmake/thisdd4hep.csh thisdd4hep.csh @ONLY) configure_file(cmake/thisdd4hep.sh thisdd4hep.sh @ONLY) +configure_file(cmake/run_test.sh run_test.sh @ONLY) install(FILES ${CMAKE_BINARY_DIR}/thisdd4hep.csh ${CMAKE_BINARY_DIR}/thisdd4hep.sh DESTINATION bin ) - +install(PROGRAMS ${CMAKE_BINARY_DIR}/run_test.sh + DESTINATION bin + ) +# PERMISSIONS OWNER_READ, OWNER_WRITE, OWNER_EXECUTE, GROUP_READ, GROUP_EXECUTE, WORLD_READ, WORLD_EXECUTE, #----------------------------------------------------------------------------------- display_std_variables() diff --git a/DDTest/CMakeLists.txt b/DDTest/CMakeLists.txt index 533677d21..b0e08f5c4 100644 --- a/DDTest/CMakeLists.txt +++ b/DDTest/CMakeLists.txt @@ -4,6 +4,7 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/DDCore/include + ${CMAKE_SOURCE_DIR}/DDG4/include ${CMAKE_SOURCE_DIR}/DDSegmentation/include ${CMAKE_SOURCE_DIR}/include ${ROOT_INCLUDE_DIR} @@ -11,16 +12,18 @@ include_directories( link_libraries(DD4hepG4 DD4hepCore DDSegmentation ${ROOT_LIBRARIES} Reflex ${Geant4_LIBRARIES}) #-------------------------------------------------- +#ADD_TEST( t_init source "${CMAKE_CURRENT_WORK_DIR}/thisdd4hep.sh" ) SET( test_name "test_example" ) -ADD_EXECUTABLE( ${test_name} ./src/${test_name}.cc ) -ADD_TEST( t_${test_name} "${EXECUTABLE_OUTPUT_PATH}/${test_name}" ) +ADD_EXECUTABLE(${test_name} ./src/${test_name}.cc ) +ADD_TEST( t_${test_name} "${CMAKE_INSTALL_PREFIX}/bin/run_test.sh" ${EXECUTABLE_OUTPUT_PATH}/${test_name} ) SET_TESTS_PROPERTIES( t_${test_name} PROPERTIES PASS_REGULAR_EXPRESSION "TEST_PASSED" ) SET_TESTS_PROPERTIES( t_${test_name} PROPERTIES FAIL_REGULAR_EXPRESSION "TEST_FAILED" ) SET( test_name "test_units" ) ADD_EXECUTABLE( ${test_name} ./src/${test_name}.cc ) -ADD_TEST( t_${test_name} "${EXECUTABLE_OUTPUT_PATH}/${test_name}" ${CMAKE_CURRENT_SOURCE_DIR}/units.xml ) +ADD_TEST( t_${test_name} "${CMAKE_INSTALL_PREFIX}/bin/run_test.sh" + ${EXECUTABLE_OUTPUT_PATH}/${test_name} ${CMAKE_CURRENT_SOURCE_DIR}/units.xml ) SET_TESTS_PROPERTIES( t_${test_name} PROPERTIES PASS_REGULAR_EXPRESSION "TEST_PASSED" ) SET_TESTS_PROPERTIES( t_${test_name} PROPERTIES FAIL_REGULAR_EXPRESSION "TEST_FAILED" ) diff --git a/cmake/run_test.sh b/cmake/run_test.sh new file mode 100755 index 000000000..69bd739d1 --- /dev/null +++ b/cmake/run_test.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# +# Simple script to run DD4hep tests +# - sources thisdd4hep.sh first and then +# calls the command (given as first argument) +# with all following arguments +# + +# ---- initialize DD4hep for this shell +. @CMAKE_INSTALL_PREFIX@/bin/thisdd4hep.sh + + +#----- parse command line - first argument is the +# test to run +command=$1 +theargs="" +shift +for i in "$@" ; do + if [ $i != ${command} ] ; then + theargs="${theargs} $i" + fi +done + +echo "---running test : '" ${command} ${theargs} "'" +${command} ${theargs} -- GitLab