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

Revision history [back]

click to hide/show revision 1
initial version

I'm not familiar with a way to do that specifically from catkin_make level as it would not make much sense to pass the same argument to all gtests.

But if you just run the specific test directly and then use the --gtest_filter option: https://github.com/google/googletest/blob/master/googletest/docs/AdvancedGuide.md#running-a-subset-of-the-tests

For example in tf2 there's a gtest callted test_cache_unittest that can be run with the filter and without like this.

. devel/setup.bash
tfoote@snowman:~/work/workspaces/geometry Last: [127] (0s Seconds)
$ ./devel/lib/tf2/test_cache_unittest --gtest_filter=Bullet*
Note: Google Test filter = Bullet*
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from Bullet
[ RUN      ] Bullet.Slerp
[       OK ] Bullet.Slerp (0 ms)
[----------] 1 test from Bullet (0 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (1 ms total)
[  PASSED  ] 1 test.

And without the filter you can see it running more tests.

tfoote@snowman:~/work/workspaces/geometry Last: [0] (0s Seconds)
$ ./devel/lib/tf2/test_cache_unittest
[==========] Running 8 tests from 2 test cases.
[----------] Global test environment set-up.
[----------] 7 tests from TimeCache
[ RUN      ] TimeCache.Repeatability
[       OK ] TimeCache.Repeatability (1 ms)
[ RUN      ] TimeCache.RepeatabilityReverseInsertOrder
[       OK ] TimeCache.RepeatabilityReverseInsertOrder (0 ms)
[ RUN      ] TimeCache.ZeroAtFront
[       OK ] TimeCache.ZeroAtFront (0 ms)
[ RUN      ] TimeCache.CartesianInterpolation
[       OK ] TimeCache.CartesianInterpolation (4 ms)
[ RUN      ] TimeCache.ReparentingInterpolationProtection
[       OK ] TimeCache.ReparentingInterpolationProtection (0 ms)
[ RUN      ] TimeCache.AngularInterpolation
[       OK ] TimeCache.AngularInterpolation (11 ms)
[ RUN      ] TimeCache.DuplicateEntries
[       OK ] TimeCache.DuplicateEntries (0 ms)
[----------] 7 tests from TimeCache (16 ms total)

[----------] 1 test from Bullet
[ RUN      ] Bullet.Slerp
[       OK ] Bullet.Slerp (0 ms)
[----------] 1 test from Bullet (0 ms total)

[----------] Global test environment tear-down
[==========] 8 tests from 2 test cases ran. (16 ms total)
[  PASSED  ] 8 tests.