Skip to content

Complete init/shutdown API test coverage. - #107

Merged
hidmic merged 4 commits into
masterfrom
hidmic/rmw-init-shutdown-tests
Jul 1, 2020
Merged

hidmic merged 4 commits into
masterfrom
hidmic/rmw-init-shutdown-tests

Conversation

@hidmic

@hidmic hidmic commented Jun 22, 2020

Copy link
Copy Markdown

Precisely what the title says. Follow-up after #106.

@hidmic
hidmic requested review from Blast545 and brawner June 22, 2020 15:18
@hidmic

hidmic commented Jun 22, 2020

Copy link
Copy Markdown
Author

These tests need ros2/rmw#242 and connected PRs to pass.

rmw_context_t context = rmw_get_zero_initialized_context();
rmw_init_options_t options = rmw_get_zero_initialized_init_options();
rmw_ret_t ret = rmw_init_options_init(&options, rcutils_get_default_allocator());
EXPECT_NE(RMW_RET_OK, rmw_shutdown(&context));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a specific error you are expecting? RMW_RET_ERROR?

@hidmic hidmic Jun 22, 2020 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Based on rmw_shutdown() API contract, an RMW implementation could equally return RMW_RET_INVALID_ARGUMENT or RMW_RET_INCORRECT_IMPLEMENTATION. That's why I don't check for a specific return code.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since you already test the incorrect_implementation error below, wouldn't it make more sense to test the invalid_argument error here? Set context.implementation_identifier to a known valid identifier, then check that it returns invalid argument?

@hidmic hidmic Jun 22, 2020 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Hmm, problem is that we get into bad initialization territory. Here I deal with the four (4) known context states: zero-initialized, initialized and not shutdown, initialized and shutdown, finalized. Anything outside that is UB. So if we want to be specific about the assertion we have to further clarify API contracts i.e. what it means for a context to be invalid for all rmw implementations.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If you don't want to monkey around with the identifier field to force the invalid argument, then I recommend to at least narrow down the expect statement to only two errors you expect. Something like:

EXPECT_TRUE((ret == RMW_RET_INVALID_ARGUMENT || 
             ret == RMW_RET_INCORRECT_IMPLEMENTATION))

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Sure, we can do that. See 9bff7f2

@hidmic

hidmic commented Jun 22, 2020 •

Copy link
Copy Markdown
Author

CI up to test_rmw_implementation against all RMW implementations:

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

hidmic added 2 commits June 22, 2020 19:39
Signed-off-by: Michel Hidalgo <[email protected]>
Signed-off-by: Michel Hidalgo <[email protected]>

@fujitatomoya fujitatomoya left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm

@hidmic

hidmic commented Jun 23, 2020

Copy link
Copy Markdown
Author

Hold on, as tests may change with ros2/rmw#243.

Signed-off-by: Michel Hidalgo <[email protected]>
@hidmic
hidmic requested a review from brawner June 24, 2020 22:55
@hidmic

hidmic commented Jun 24, 2020 •

Copy link
Copy Markdown
Author

Ready for re-review !

@Blast545 Blast545 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@brawner

brawner commented Jun 25, 2020

Copy link
Copy Markdown
Contributor

Does this need to be retested on CI?

@hidmic

hidmic commented Jun 25, 2020 •

Copy link
Copy Markdown
Author

Does this need to be retested on CI?

More than that. RMW implementations have to be released into rolling after connected PRs are merged to get that PR job passing.

@hidmic

hidmic commented Jun 29, 2020 •

Copy link
Copy Markdown
Author

CI up to test_rmw_implementation against all RMW implementations:

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

@hidmic

hidmic commented Jun 29, 2020

Copy link
Copy Markdown
Author

Same as in #108, I'll hold off merging this until I've re-released RMWs so that rolling PR jobs pass.

@hidmic

hidmic commented Jul 1, 2020

Copy link
Copy Markdown
Author

@ros-pull-request-builder retest this please

@hidmic

hidmic commented Jul 1, 2020

Copy link
Copy Markdown
Author

Alright, all's green! Going in.

@hidmic
hidmic merged commit 96ca972 into master Jul 1, 2020
@delete-merged-branch
delete-merged-branch Bot deleted the hidmic/rmw-init-shutdown-tests branch July 1, 2020 17:05
ahcorde pushed a commit that referenced this pull request Oct 9, 2020
ahcorde pushed a commit that referenced this pull request Oct 21, 2020
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.

4 participants