-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add publisher/subscription matched count API test coverage. #119
Conversation
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Matching pub/sub tests are not passing for |
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
} | ||
|
||
TEST_F( | ||
CLASSNAME(TestPublisherUse, RMW_IMPLEMENTATION), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This alignment is strange since it aligns with the code. Is there not a way to adjust the indentation, or move the curly brace to a new line?
This happens elsewhere as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's uncrustify
... I ended up shortening the test case name in da38188.
*/ | ||
#define SLEEP_AND_RETRY_UNTIL(delay, timeout) for ( \ | ||
auto loop_start_time = std::chrono::steady_clock::now(), \ | ||
iteration_start_time = loop_start_time; \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is iteration_start_time
needed? Why can't you just use std::this_thread::sleep_for(delay)
instead of sleep_until
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid the time it takes to actually execute the loop code from adding up. Also, std::this_thread::sleep_for
makes no guarantees as to which clock is used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I mean something like:
#define SLEEP_AND_RETRY_UNTIL(delay, timeout) \
for (auto start = std::chrono::steady_clock::now(); \
std::chrono::steady_clock::now() - start < timeout; \
std::this_thread::sleep_for(delay))
If you'd rather leave it as is, then I'm fine with it. It just seems like your use case doesn't require such precision.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't want to lose retries due to non-negligible execution times, but it is true that these timeouts are pretty arbitrary anyways.
Sure, why not. See 4d85be9.
@@ -34,6 +34,7 @@ if(BUILD_TESTING) | |||
) | |||
target_compile_definitions(test_init_shutdown${target_suffix} | |||
PUBLIC "RMW_IMPLEMENTATION=${rmw_implementation}") | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This added line can be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in da38188.
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@ros-pull-request-builder retest this please |
1 similar comment
@ros-pull-request-builder retest this please |
Finally! PR job's green. Merging. |
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Connected to ros2/rmw#262. Depends on ros2/rmw_fastrtps#424, ros2/rmw_connext#451, and ros2/rmw_cyclonedds#223.