ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
12

How do I only run tests for only one package?

asked 2013-05-12 10:31:12 -0500

David Lu gravatar image

catkin_make run_tests --pkg costmap_2d seems a likely candidate but doesn't work.

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
13

answered 2013-05-12 12:41:28 -0500

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.

edit flag offensive delete link more

Comments

3

That's entirely intuitive. </sarcasm> Thanks!

David Lu gravatar image David Lu  ( 2013-05-13 09:34:53 -0500 )edit
2

This is not built into catkin_make because it has to work without catkin_make, i.e. it should work with just cmake and make. Btw, the make targets should be tab completable, so catkin_make run_tests_<tab><tab> should list all of your options.

William gravatar image William  ( 2013-05-13 14:53:18 -0500 )edit
6

answered 2016-12-02 08:34:32 -0500

afakih gravatar image

To run a catkin test for a specific catkin package, from a directory within that package:

   catkin run_tests --no-deps --this
edit flag offensive delete link more
1

answered 2014-10-03 10:22:05 -0500

dustingooding gravatar image

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
edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-05-12 10:31:12 -0500

Seen: 8,252 times

Last updated: Dec 02 '16