moved test macros into catkin, enabled pyunit tests for test_roscreate and test_roslib
This commit is contained in:
parent
a00b78679c
commit
a0d795ef94
|
@ -9,6 +9,7 @@ foreach(subdir
|
||||||
tools/rosunit
|
tools/rosunit
|
||||||
tools/rosclean
|
tools/rosclean
|
||||||
test/test_roscreate
|
test/test_roscreate
|
||||||
|
test/test_roslib
|
||||||
)
|
)
|
||||||
add_subdirectory(${subdir})
|
add_subdirectory(${subdir})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
|
@ -1,52 +1,3 @@
|
||||||
project(test_roscreate)
|
project(test_roscreate)
|
||||||
find_package(catkin)
|
find_package(catkin)
|
||||||
|
|
||||||
macro(append_project_cache CACHENAME)
|
|
||||||
set(cachefile ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}.${CACHENAME})
|
|
||||||
if(NOT ${PROJECT_NAME}_CACHE)
|
|
||||||
file(WRITE ${cachefile} "#\n# This is ${cachefile}\n#\n")
|
|
||||||
set(${PROJECT_NAME}_CACHE TRUE)
|
|
||||||
# TODO: find catkin somehow
|
|
||||||
set(runtests_path ${CMAKE_SOURCE_DIR}/catkin/scripts/runtests.py)
|
|
||||||
add_custom_target(${PROJECT_NAME}_run_tests
|
|
||||||
COMMAND ${runtests_path} ${cachefile})
|
|
||||||
add_custom_target(test)
|
|
||||||
add_dependencies(test ${PROJECT_NAME}_run_tests)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# gotcha: you need a newline or the message doesn't appear
|
|
||||||
# in the cache. pfft.
|
|
||||||
file(APPEND ${cachefile} "${ARGN}\n")
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
function(add_pyunit file)
|
|
||||||
# Look for optional TIMEOUT argument, #2645
|
|
||||||
parse_arguments(_pyunit "TIMEOUT" "" ${ARGN})
|
|
||||||
if(NOT _pyunit_TIMEOUT)
|
|
||||||
set(_pyunit_TIMEOUT 60.0)
|
|
||||||
endif(NOT _pyunit_TIMEOUT)
|
|
||||||
|
|
||||||
# Check that the file exists, #1621
|
|
||||||
set(_file_name _file_name-NOTFOUND)
|
|
||||||
find_file(_file_name ${file} ${PROJECT_SOURCE_DIR})
|
|
||||||
if(NOT _file_name)
|
|
||||||
message(FATAL_ERROR "Can't find pyunit file \"${file}\"")
|
|
||||||
endif(NOT _file_name)
|
|
||||||
|
|
||||||
# We look for ROS_TEST_COVERAGE=1
|
|
||||||
# to indicate that coverage reports are being requested.
|
|
||||||
if("$ENV{ROS_TEST_COVERAGE}" STREQUAL "1")
|
|
||||||
set(_covarg "--cov")
|
|
||||||
else("$ENV{ROS_TEST_COVERAGE}" STREQUAL "1")
|
|
||||||
set(_covarg)
|
|
||||||
endif("$ENV{ROS_TEST_COVERAGE}" STREQUAL "1")
|
|
||||||
|
|
||||||
# TODO: find rosunit somehow
|
|
||||||
set(rosunit_path ${CMAKE_SOURCE_DIR}/ros/tools/rosunit)
|
|
||||||
# Create a legal test name, in case the target name has slashes in it
|
|
||||||
string(REPLACE "/" "_" _testname ${file})
|
|
||||||
# We use rostest to call the executable to get process control, #1629
|
|
||||||
append_project_cache(catkin-tests "${rosunit_path}/bin/rosunit --name=${_testname} --time-limit=${_pyunit_TIMEOUT} -- ${_file_name} ${_covarg}")
|
|
||||||
endfunction(add_pyunit)
|
|
||||||
|
|
||||||
add_pyunit(test/test_roscreate_stack.py)
|
add_pyunit(test/test_roscreate_stack.py)
|
||||||
|
|
|
@ -1,31 +1,24 @@
|
||||||
if(ROSBUILD)
|
project(test_roslib)
|
||||||
# this is for rosbuild2 integration, you can ignore this
|
find_package(catkin)
|
||||||
include(rosbuild.cmake OPTIONAL)
|
add_pyunit(test/test_roslib.py)
|
||||||
return()
|
add_pyunit(test/test_roslib_exceptions.py)
|
||||||
endif()
|
add_pyunit(test/test_roslib_manifest.py)
|
||||||
cmake_minimum_required(VERSION 2.4.6)
|
add_pyunit(test/test_roslib_manifestlib.py)
|
||||||
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
|
add_pyunit(test/test_roslib_names.py)
|
||||||
rosbuild_init()
|
add_pyunit(test/test_roslib_packages.py)
|
||||||
# unit tests
|
add_pyunit(test/test_roslib_params.py)
|
||||||
rosbuild_add_pyunit(test/test_roslib.py)
|
add_pyunit(test/test_roslib_rosenv.py)
|
||||||
rosbuild_add_pyunit(test/test_roslib_exceptions.py)
|
add_pyunit(test/test_roslib_rospack.py)
|
||||||
rosbuild_add_pyunit(test/test_roslib_manifest.py)
|
#add_pyunit(test/test_roslib_scriptutil.py)
|
||||||
rosbuild_add_pyunit(test/test_roslib_manifestlib.py)
|
add_pyunit(test/test_roslib_stacks.py)
|
||||||
rosbuild_add_pyunit(test/test_roslib_names.py)
|
add_pyunit(test/test_roslib_stack_manifest.py)
|
||||||
rosbuild_add_pyunit(test/test_roslib_packages.py)
|
|
||||||
rosbuild_add_pyunit(test/test_roslib_params.py)
|
|
||||||
rosbuild_add_pyunit(test/test_roslib_rosenv.py)
|
|
||||||
rosbuild_add_pyunit(test/test_roslib_rospack.py)
|
|
||||||
rosbuild_add_pyunit(test/test_roslib_scriptutil.py)
|
|
||||||
rosbuild_add_pyunit(test/test_roslib_stacks.py)
|
|
||||||
rosbuild_add_pyunit(test/test_roslib_stack_manifest.py)
|
|
||||||
|
|
||||||
#integration tests
|
#integration tests
|
||||||
|
|
||||||
rosbuild_add_boost_directories()
|
#rosbuild_add_boost_directories()
|
||||||
rosbuild_add_gtest(test/utest test/utest.cpp)
|
#rosbuild_add_gtest(test/utest test/utest.cpp)
|
||||||
rosbuild_link_boost(test/utest thread)
|
#rosbuild_link_boost(test/utest thread)
|
||||||
|
#
|
||||||
|
#
|
||||||
rosbuild_add_gtest(test_package test/package.cpp)
|
#rosbuild_add_gtest(test_package test/package.cpp)
|
||||||
target_link_libraries(test_package roslib)
|
#target_link_libraries(test_package roslib)
|
||||||
|
|
Loading…
Reference in New Issue