improved invocation of rosunit binary and scripts
This commit is contained in:
parent
41c5e1f48c
commit
8023d54f81
|
@ -105,7 +105,7 @@ endmacro(_rosbuild_check_package_location)
|
||||||
# helper function to register check that results were generated (#580)
|
# helper function to register check that results were generated (#580)
|
||||||
macro(_rosbuild_check_rostest_xml_result test_name test_file)
|
macro(_rosbuild_check_rostest_xml_result test_name test_file)
|
||||||
add_custom_target(${test_name}_result
|
add_custom_target(${test_name}_result
|
||||||
COMMAND ${rosunit_path}/scripts/check_test_ran.py ${test_file}
|
COMMAND ${ROSUNIT_SCRIPTS_DIR}/check_test_ran.py ${test_file}
|
||||||
VERBATIM)
|
VERBATIM)
|
||||||
# Redeclaration of target is to workaround bug in 2.4.6
|
# Redeclaration of target is to workaround bug in 2.4.6
|
||||||
if(CMAKE_MINOR_VERSION LESS 6)
|
if(CMAKE_MINOR_VERSION LESS 6)
|
||||||
|
@ -134,13 +134,13 @@ macro(_rosbuild_add_gtest exe)
|
||||||
# But don't depend on the gtest executable if rosbuild_test_nobuild is set, #3008
|
# But don't depend on the gtest executable if rosbuild_test_nobuild is set, #3008
|
||||||
if(NOT rosbuild_test_nobuild)
|
if(NOT rosbuild_test_nobuild)
|
||||||
add_custom_target(test_${_testname}
|
add_custom_target(test_${_testname}
|
||||||
COMMAND ${rosunit_path}/../..//bin/rosunit --name=${_testname} --time-limit=${_gtest_TIMEOUT} ${EXECUTABLE_OUTPUT_PATH}/${exe}
|
COMMAND ${ROSUNIT_EXE} --name=${_testname} --time-limit=${_gtest_TIMEOUT} ${EXECUTABLE_OUTPUT_PATH}/${exe}
|
||||||
DEPENDS ${EXECUTABLE_OUTPUT_PATH}/${exe}
|
DEPENDS ${EXECUTABLE_OUTPUT_PATH}/${exe}
|
||||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||||
VERBATIM)
|
VERBATIM)
|
||||||
else(NOT rosbuild_test_nobuild)
|
else(NOT rosbuild_test_nobuild)
|
||||||
add_custom_target(test_${_testname}
|
add_custom_target(test_${_testname}
|
||||||
COMMAND ${rosunit_path}/../..//bin/rosunit --name=${_testname} --time-limit=${_gtest_TIMEOUT} ${EXECUTABLE_OUTPUT_PATH}/${exe}
|
COMMAND ${ROSUNIT_EXE} --name=${_testname} --time-limit=${_gtest_TIMEOUT} ${EXECUTABLE_OUTPUT_PATH}/${exe}
|
||||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||||
VERBATIM)
|
VERBATIM)
|
||||||
endif(NOT rosbuild_test_nobuild)
|
endif(NOT rosbuild_test_nobuild)
|
||||||
|
@ -167,7 +167,7 @@ endmacro(_rosbuild_add_gtest)
|
||||||
# arguments as cmake doesn't know the name of the output file
|
# arguments as cmake doesn't know the name of the output file
|
||||||
macro(_rosbuild_check_rostest_result test_name test_pkg test_file)
|
macro(_rosbuild_check_rostest_result test_name test_pkg test_file)
|
||||||
add_custom_target(${test_name}_result
|
add_custom_target(${test_name}_result
|
||||||
COMMAND ${rosunit_path}/scripts/check_test_ran.py --rostest ${test_pkg} ${test_file}
|
COMMAND ${ROSUNIT_SCRIPTS_DIR}/check_test_ran.py --rostest ${test_pkg} ${test_file}
|
||||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||||
VERBATIM)
|
VERBATIM)
|
||||||
# Redeclaration of target is to workaround bug in 2.4.6
|
# Redeclaration of target is to workaround bug in 2.4.6
|
||||||
|
@ -240,7 +240,7 @@ macro(_rosbuild_add_pyunit file)
|
||||||
# Create target for this test
|
# Create target for this test
|
||||||
# We use rostest to call the executable to get process control, #1629
|
# We use rostest to call the executable to get process control, #1629
|
||||||
add_custom_target(pyunit_${_testname}
|
add_custom_target(pyunit_${_testname}
|
||||||
COMMAND ${rosunit_path}/../..//bin/rosunit --name=${_testname} --time-limit=${_pyunit_TIMEOUT} -- ${file} ${_covarg}
|
COMMAND ${ROSUNIT_EXE} --name=${_testname} --time-limit=${_pyunit_TIMEOUT} -- ${file} ${_covarg}
|
||||||
DEPENDS ${file}
|
DEPENDS ${file}
|
||||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||||
VERBATIM)
|
VERBATIM)
|
||||||
|
|
|
@ -291,11 +291,11 @@ macro(rosbuild_init)
|
||||||
# friends add targets and dependencies from these targets.
|
# friends add targets and dependencies from these targets.
|
||||||
#
|
#
|
||||||
|
|
||||||
# Find rosunit; rosunit_path will be used later
|
# find rosunit since ROSUNIT_SCRIPTS_DIR and ROSUNIT_EXE will be used later
|
||||||
rosbuild_invoke_rospack("" rosunit path find rosunit)
|
find_package(rosunit REQUIRED)
|
||||||
|
|
||||||
# Record where we're going to put test results (#2003)
|
# Record where we're going to put test results (#2003)
|
||||||
execute_process(COMMAND ${rosunit_path}/scripts/test_results_dir.py
|
execute_process(COMMAND ${ROSUNIT_SCRIPTS_DIR}/test_results_dir.py
|
||||||
OUTPUT_VARIABLE rosbuild_test_results_dir
|
OUTPUT_VARIABLE rosbuild_test_results_dir
|
||||||
RESULT_VARIABLE _test_results_dir_failed
|
RESULT_VARIABLE _test_results_dir_failed
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
@ -331,13 +331,13 @@ macro(rosbuild_init)
|
||||||
|
|
||||||
add_custom_target(test-results-run)
|
add_custom_target(test-results-run)
|
||||||
add_custom_target(test-results
|
add_custom_target(test-results
|
||||||
COMMAND ${rosunit_path}/scripts/summarize_results.py --nodeps ${_project})
|
COMMAND ${ROSUNIT_SCRIPTS_DIR}/summarize_results.py --nodeps ${_project})
|
||||||
add_dependencies(test-results test-results-run)
|
add_dependencies(test-results test-results-run)
|
||||||
# Do we want coverage reporting (only matters for Python, because
|
# Do we want coverage reporting (only matters for Python, because
|
||||||
# Bullseye already collects everything into a single file).
|
# Bullseye already collects everything into a single file).
|
||||||
if("$ENV{ROS_TEST_COVERAGE}" STREQUAL "1")
|
if("$ENV{ROS_TEST_COVERAGE}" STREQUAL "1")
|
||||||
add_custom_target(test-results-coverage
|
add_custom_target(test-results-coverage
|
||||||
COMMAND ${rosunit_path}/scripts/pycoverage_to_html.py
|
COMMAND ${ROSUNIT_SCRIPTS_DIR}/pycoverage_to_html.py
|
||||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
|
||||||
# Make tests run before collecting coverage results
|
# Make tests run before collecting coverage results
|
||||||
add_dependencies(test-results-coverage test-results-run)
|
add_dependencies(test-results-coverage test-results-run)
|
||||||
|
|
|
@ -2,15 +2,23 @@ include(CMakeParseArguments)
|
||||||
|
|
||||||
macro(rosunit_initialize_tests)
|
macro(rosunit_initialize_tests)
|
||||||
@[if DEVELSPACE]@
|
@[if DEVELSPACE]@
|
||||||
# find program in develspace
|
# find binary and scripts in develspace
|
||||||
find_program_required(ROSUNIT_EXE rosunit
|
find_program(ROSUNIT_EXE rosunit
|
||||||
PATHS @(PROJECT_SOURCE_DIR)/scripts
|
PATHS @(PROJECT_SOURCE_DIR)/scripts
|
||||||
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
|
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
|
||||||
|
if(NOT ROSUNIT_EXE)
|
||||||
|
message(FATAL_ERROR "'rosunit' not found")
|
||||||
|
endif()
|
||||||
|
set(ROSUNIT_SCRIPTS_DIR @(PROJECT_SOURCE_DIR)/scripts)
|
||||||
@[else]@
|
@[else]@
|
||||||
# find program in installspace
|
# find binary and scripts in installspace
|
||||||
find_program_required(ROSUNIT_EXE rosunit
|
find_program(ROSUNIT_EXE rosunit
|
||||||
PATHS @(CMAKE_INSTALL_PREFIX)/bin
|
PATHS @(CMAKE_INSTALL_PREFIX)/bin
|
||||||
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
|
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
|
||||||
|
if(NOT ROSUNIT_EXE)
|
||||||
|
message(FATAL_ERROR "'rosunit' not found")
|
||||||
|
endif()
|
||||||
|
set(ROSUNIT_SCRIPTS_DIR @(CMAKE_INSTALL_PREFIX)/scripts)
|
||||||
@[end if]@
|
@[end if]@
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue