Skip to content
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

Merged
merged 4 commits into from
Sep 2, 2020

Conversation

hidmic
Copy link
Contributor

@hidmic hidmic commented Aug 20, 2020

Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
@hidmic
Copy link
Contributor Author

hidmic commented Aug 20, 2020

Matching pub/sub tests are not passing for rmw_connext_cpp. Arguably, these tests lack (1) a wait on the graph guard condition, and (2) an upper bound for repeated waits.

Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
@hidmic hidmic changed the title [WIP] Add publisher/subscription matched count API test coverage. Add publisher/subscription matched count API test coverage. Aug 24, 2020
}

TEST_F(
CLASSNAME(TestPublisherUse, RMW_IMPLEMENTATION),
Copy link
Contributor

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.

Copy link
Contributor Author

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; \
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

@hidmic hidmic Aug 24, 2020

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}")

Copy link
Contributor

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

Copy link
Contributor Author

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>
Copy link
Contributor

@Blast545 Blast545 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hidmic
Copy link
Contributor Author

hidmic commented Aug 26, 2020

CI up to test_rmw_implementation, against all Tier 1 RMW implementations:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@hidmic
Copy link
Contributor Author

hidmic commented Sep 1, 2020

@ros-pull-request-builder retest this please

1 similar comment
@hidmic
Copy link
Contributor Author

hidmic commented Sep 2, 2020

@ros-pull-request-builder retest this please

@hidmic
Copy link
Contributor Author

hidmic commented Sep 2, 2020

Finally! PR job's green. Merging.

@hidmic hidmic merged commit a41e97a into master Sep 2, 2020
@delete-merged-branch delete-merged-branch bot deleted the hidmic/rmw-pub-sub-count-tests branch September 2, 2020 17:22
ahcorde pushed a commit that referenced this pull request Oct 9, 2020
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
ahcorde pushed a commit that referenced this pull request Oct 21, 2020
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants