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

colcon test to run tests not defined in the package.xml or cmake?

asked 2021-01-04 18:04:58 -0500

Is there a way to have colcon test run a test that was not defined in the package.xml through the test_depend feature or through the cmake file?

An example of what I'd like to do is run ament_clang_tidy on specific packages using colcon. Something like: colcon test --tests ament_clang_tidy --packages-select <packages>?

I've read through the documentation on colcon and don't see any functionality like this. It seems that all tests are configured at configuration time.

This is a follow-on to this question: https://answers.ros.org/question/3686... and this PR: https://github.com/ament/ament_lint/p...

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-01-08 00:40:03 -0500

Dirk Thomas gravatar image

For a CMake package colcon test will simply invoke all tests defined - same as calling ctest on that package. You can only use options to select / exclude certain tests - for CTest e.g. based on the test names or labels.

ament_clang_tidy iis an independent package / executable and afaik it doesn't have any logic to select files based on package names.

edit flag offensive delete link more

Comments

ament_clang_tidy as executed by ament_cmake_clang_tidy seems to be broken the way it exists now. It is written like all the other ament_lint cmake functions in that it tries to execute from the CMAKE_CURRENT_SOURCE_DIR as the working directory. This won't work because it needs to be executed from some path where it can find the compile_commands.json file for the package.

tyler-picknik gravatar image tyler-picknik  ( 2021-01-08 09:31:18 -0500 )edit

I would suggest to create an issue for this (or even better provide a pull request to address it). Please reference it here for future readers to find.

Dirk Thomas gravatar image Dirk Thomas  ( 2021-01-08 10:21:21 -0500 )edit

Someone else is already having a problem caused by the same issue here: https://github.com/ament/ament_lint/i...

tyler-picknik gravatar image tyler-picknik  ( 2021-01-08 14:34:56 -0500 )edit

I am starting to doubt anyone is actually using ament_cmake_clang_tidy. There is no way to configure the timeout. When run over a relatively simple package (9 compilation units) it takes 2min to execute on my fast cpu locally. Here is another issue I created about that: https://github.com/ament/ament_lint/i...

tyler-picknik gravatar image tyler-picknik  ( 2021-01-08 15:14:03 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2021-01-04 18:04:58 -0500

Seen: 906 times

Last updated: Jan 08 '21