-
Notifications
You must be signed in to change notification settings - Fork 269
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
Improve ign tool support on macOS #477
Conversation
This enables and fixes UNIT_ign_TEST for macOS. * Set environment variables in cmake * Find ign binary location * Try to find brew ruby location to workaround SIP Signed-off-by: Steve Peters <[email protected]>
Recommend using brew ruby and ensuring that colcon setup scripts have been sourced. Signed-off-by: Steve Peters <[email protected]>
Signed-off-by: Steve Peters <[email protected]>
ign tests passing on macOS: https://build.osrfoundation.org/job/ignition_gazebo-ci-pr_any-homebrew-amd64/4218/testReport/(root)/CmdLine/ |
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.
Great to give more direction to macOS users!
list(APPEND _env_vars "IGN_GAZEBO_SYSTEM_PLUGIN_PATH=$<TARGET_FILE_DIR:TestModelSystem>") | ||
|
||
set_tests_properties(UNIT_ign_TEST PROPERTIES | ||
ENVIRONMENT "${_env_vars}") |
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.
Interesting, I don't think we've been setting environment variables for tests from CMake.
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 learned it from Dirk; it's not universal, but we have done it in a few places:
- https://github.com/ignitionrobotics/ign-cmake/blob/ignition-cmake2_2.6.0/examples/CMakeLists.txt#L180-L186
- https://github.com/osrf/sdformat/blob/sdformat10_10.0.0/cmake/SDFUtils.cmake#L192-L197
- https://github.com/osrf/gazebo/blob/gazebo11_11.3.0/cmake/GazeboTestUtils.cmake#L69-L77
I think it's a bit cleaner to set them from cmake. One drawback is that executing the binaries directly (like ./UNIT_ign_TEST
) may not work, but it's easy enough to use ctest -R UNIT_ign_TEST -VV
once you know to do so
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.
One drawback is that executing the binaries directly (like ./UNIT_ign_TEST) may not work
Oh no, that sounds like a regression. We have that workflow documented in a few places, it would be unfortunate not to support it anymore.
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.
As I mentioned during the meeting, I don't see the advantage of moving the environment variables to CMake.
It prevents a common workflow, and it hides the environment configuration from anyone who's debugging the tests or looking into them to understand how the code works. Especially for variables like IGN_GAZEBO_SYSTEM_PLUGIN_PATH
, which are set by the user at runtime, I think it's valuable to explicitly set them during the tests.
But I'm not going to block this PR on this, I'll leave it up to you.
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 pointed to 3 examples in our code where it's already being used, so this isn't a completely new thing, but you're right that the docs need to be updated to handle this case. I'll merge this then open a pull request to update the docs
Signed-off-by: Steve Peters <[email protected]>
list(APPEND _env_vars "IGN_GAZEBO_SYSTEM_PLUGIN_PATH=$<TARGET_FILE_DIR:TestModelSystem>") | ||
|
||
set_tests_properties(UNIT_ign_TEST PROPERTIES | ||
ENVIRONMENT "${_env_vars}") |
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.
As I mentioned during the meeting, I don't see the advantage of moving the environment variables to CMake.
It prevents a common workflow, and it hides the environment configuration from anyone who's debugging the tests or looking into them to understand how the code works. Especially for variables like IGN_GAZEBO_SYSTEM_PLUGIN_PATH
, which are set by the user at runtime, I think it's valuable to explicitly set them during the tests.
But I'm not going to block this PR on this, I'll leave it up to you.
@scpeters , I think you moved this back to "In Progress" because a resolution to gazebosim/gz-tools#7 may help here, right? I think we could get this in as is, and make those improvements later if we can. Let me know if I misunderstood something. I think this is a good intermediate state and better than the current state without it. |
Signed-off-by: Louise Poubel <[email protected]>
Signed-off-by: Louise Poubel <[email protected]>
Signed-off-by: Louise Poubel <[email protected]>
The
ign gazebo
command does not have full support on macOS (see #25 and #44). If System Integrity Protection is not disabled, the system version of ruby at/usr/bin/ruby
cannot be used, though the brew version of ruby can be used as a workaround. Additionally, the GUI interface window does not work on macOS. This pull request enablesUNIT_ign_TEST
on macOS and fixes it to use the brew version of ruby (which was added as a dependency to the homebrew formulae in osrf/homebrew-simulation#1221). It also moves the configuration of environment variables from the test to the cmake code.I've also added some extra console error messages when macOS is detected (from the
.dylib
suffix on library files):