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

Test load and lookup functionality. #135

Merged
merged 3 commits into from
Sep 22, 2020
Merged

Conversation

hidmic
Copy link
Contributor

@hidmic hidmic commented Sep 22, 2020

Precisely what the title says. It exposes a few symbols to enable some testing. It also refactors the implementation a bit to make it allow testing.

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

hidmic commented Sep 22, 2020

CI up to rmw_implementation, test_rmw_implementation, and rcl:

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

Copy link
Contributor

@Lobotuerk Lobotuerk left a comment

Choose a reason for hiding this comment

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

LGTM

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

hidmic commented Sep 22, 2020

CI again on Windows to make sure warnings are gone:

  • Windows Build Status

Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

I have one major concern here (I'll do another pass once we get past the major concern).

Comment on lines 55 to 57
target_include_directories(${PROJECT_NAME} PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include>")
Copy link
Contributor

Choose a reason for hiding this comment

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

I have to say that I'm a bit concerned about making this header file "public". If we put this in, then it seems like load_library and lookup_symbol are APIs that downstream consumers should be able to call. And as far as I can tell, that is not the case.

One alternative here is to do something similar to what rviz_default_plugins does. That is, put the header file in the src directory, and don't install it. Then have the tests include the header file via relative paths. I don't love that scheme, but it has the property that it keeps this implementation private (as it looks like it should be), but also makes the symbols available to tests. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't have a strong opinion in favor or against exposing rmw implementation lookup.

One alternative here is to do something similar to what rviz_default_plugins does.

I'm OK with that scheme too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Though that doesn't change the fact that the symbols will be public.

Copy link
Contributor

Choose a reason for hiding this comment

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

Though that doesn't change the fact that the symbols will be public.

Just to recap a private conversation: while that is true, it is more around the messaging to external consumers. If a function is in a publicly-accessible, installed header, then that seems like something a user might want to call. If it is hidden away in a src directory, and the user has to go looking through symbols to find it, then it is pretty clear they are doing something unsupported.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. See b885711. Went the extra mile to only make symbols public if building for testing.

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

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

Looks good to me with green CI!

// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef FUNCTIONS_HPP_
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this will run afoul of the linters, but maybe they don't care about private headers? (I don't care either way)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was actually cpplint that forced me to use this guard.

Copy link
Contributor

Choose a reason for hiding this comment

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

It was actually cpplint that forced me to use this guard.

Haha, OK.

@clalancette
Copy link
Contributor

@ros-pull-request-builder retest this please

@hidmic
Copy link
Contributor Author

hidmic commented Sep 22, 2020

CI up to rmw_implementation:

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

@hidmic
Copy link
Contributor Author

hidmic commented Sep 22, 2020

Even though http://build.ros2.org/job/Rpr__rmw_implementation__ubuntu_focal_amd64/135/ failed on a rosdep timeout, http://build.ros2.org/job/Rpr__rmw_implementation__ubuntu_focal_amd64/136/ did pass. Not sure why it wasn't reflected here.

@hidmic
Copy link
Contributor Author

hidmic commented Sep 22, 2020

Oh, there we go. It was my browser cache 😅

@hidmic hidmic merged commit 8a20aa5 into master Sep 22, 2020
@delete-merged-branch delete-merged-branch bot deleted the hidmic/test-load-n-lookup branch September 22, 2020 21:19
ahcorde pushed a commit that referenced this pull request Oct 21, 2020
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
ahcorde pushed a commit that referenced this pull request Oct 23, 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