ros2 / demos

Apache License 2.0
493 stars 329 forks source link

Dramatically speed up the demo_nodes_cpp tests #641

Closed clalancette closed 1 year ago

clalancette commented 1 year ago

The purpose of this PR is to speed up the demo_nodes_cpp tests. On my local machine, prior to this PR, the tests took ~5 minutes to run. After this PR, they take ~1 minute.

To achieve this, this PR does a number of different things:

  1. Instead of waiting an unconditional 5 seconds for each process to quit, it runs a loop checking every 100 milliseconds for the process to quit, and doing this for up to 5 seconds.
  2. Change it so that we can pass parameters into the individual tests as we are running them. This required work both in CMakeList.txt and in the test launcher, but facilitates the rest of the changes.
  3. Add parameters to talker, listener, content_filtering_publisher, and add_two_ints_server to control their behavior. The major goal here is to keep their default behavior the same, but add in alternate modes to dramatically speed up tests.

The individual commits have more information about each change and why I made it.

This is still a draft because I want to run extensive CI on it, particularly on Windows.

clalancette commented 1 year ago

CI (with retest-until-fail 30):

clalancette commented 1 year ago

To try and get this out of draft, here is normal CI for this PR:

And here is Windows run with --retest-until-fail 30, both with and without this PR:

clalancette commented 1 year ago

After comparing the test failures before and after on Windows, I think it is fair to say that these failures aren't caused by this PR. That is, this PR seems to make no difference there (we should debug those failures separately).

So I'm actually going to take this out of draft status so we can review and get this in.