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

There's no way to do this currently, and I don't think it'll be worthwhile to implement it. In your situation, I would do one of two things:

  • comment out the executables from CMakeLists.txt during test development; or
  • put tests in a separate package (e.g., for package foo, put tests in test_foo).

Btw, it's awesome that you're putting such effort into writing tests!

Rationale:

The test target can run two kinds of tests: unit tests (C++ or Python) and rostests. Unit tests, which it sounds like you're using, are generally self-contained (but not always; see below). On the other hand, it's common to use a rostest to verify the functionality of executables that are built by the package (e.g., see test for topic_tools/relay).

To support your use case, we'd need to define two categories of tests: one that wants all the executables built, and one that doesn't, with API hooks to allow the developer to say which kind of test is being declared. We'd further have to segregate libraries from executables, to allow them to be built separately (they're currently both attached to the ALL target). And then we'd likely have to retrofit existing packages that use unit tests to verify executables via fork/exec (e.g., see the pyunit-based rospack test suite).