Skip to content

Unit-tests for static executor #3

@alsora

Description

@alsora

Hi,

I created a bunch of "unit-tests" for the static executor.
They test the following scenarios:

  1. add 1 pub node and 1 sub node to the executor and spin
  2. add 1 pub node to the executor and spin, then add 1 sub node while spinning
  3. add 1 pub node and 1 node with no entities to the executor and spin, then add 1 sub to the second node while spinning
  4. add 1 pub node and 1 sub node to the executor and spin, then while spinning remove the sub node from the executor

You can find them here
https://github.com/alsora/ros2-code-examples/blob/master/simple_static_executor/static_executor_test.cpp

These tests are meant to be used with your rclcpp version (nobleo/feature/static_executor), I opened the ticket here since it was not possible in that repo.

To build colcon build --packages-select simple_static_executor
To run ./install/simple_static_executor/lib/simple_static_executor/static_executor_test 2
Where the number at the end denotes the id of the test you want to run (1, 2, 3, 4)

The results are unfortunately not good.

Test 2 throws an exception

[ERROR] [1584978899.809709877] [rclcpp]: Couldn't add guard_condition to wait set: guard_conditions set is full, at /root/ros2_ws/src/ros2/rcl/rcl/src/rcl/wait.c:456
terminate called after throwing an instance of 'std::runtime_error'
  what():  Couldn't fill wait set
Aborted (core dumped)

In test 4 the subscription keeps receiving messages after having been removed from the executor

Could you have a look at the test?
Maybe I'm not using the executor as it is supposed to be used.

FYI the standard SingleThreadExecutor allows to pass all the tests successfully.

@MartinCornelis2 @mauropasse

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions