How do I only run tests for only one package?
catkin_make run_tests --pkg costmap_2d
seems a likely candidate but doesn't work.
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
catkin_make run_tests --pkg costmap_2d
seems a likely candidate but doesn't work.
Good question!
I didn't know either, but I did some digging, and here's what I found:
catkin_make run_tests_packageName
catkin_make run_tests_packageName_gtest_testTarget
Read on for more details...
As documented here,
Catkin packages use macros that define make targets prefixed with run-tests. They can be run by invoking catkin_make run_tests[_...] or just using make run_tests[_...].
Given this clue, I googled for a command to list all defined make targets, and found this:
make -qp | awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ {split($1,A,/ /);for(i in A)print A[i]}'
When I run that in my catkin workspace, I get the following targets (among others):
run_tests_my_package
run_tests_my_package_gtest
run_tests_my_package_gtest_my_tests
These targets correspond to the following lines in my CMakeLists.txt
file:
project(my_package)
catkin_add_gtest(my_tests test/my_tests.cpp)
I would assume there are similar targets defined for rostest tests, but I have not looked for these yet.
To run a catkin test for a specific catkin package, from a directory within that package:
catkin run_tests --no-deps --this
For those of you using catkin_make_isolated (and with plain cmake packages in the mix), the following seems to work well:
catkin_make_isolated --catkin-make-args run_tests
Asked: 2013-05-12 10:31:12 -0500
Seen: 8,403 times
Last updated: Dec 02 '16
How does rostest work with catkin?
install destination error with my catkin package
How to build just one package using catkin_make?
How to exclude one package from the catkin_make build?
Should catkin_make work for package targets?
Help with catkin_make on an ARM
catkin_make failing with custom source directory
Boost error building catkin on OS X