-
Notifications
You must be signed in to change notification settings - Fork 315
Improve ign tool support on macOS #477
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
Changes from 4 commits
c1bc06b
20331b8
182bee1
0dfa9aa
b7774c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,6 +131,36 @@ ign_build_tests(TYPE UNIT | |
ignition-gazebo${PROJECT_VERSION_MAJOR} | ||
) | ||
|
||
if(TARGET UNIT_ign_TEST) | ||
|
||
# Running `ign gazebo` on macOS has problems when run with /usr/bin/ruby | ||
# due to System Integrity Protection (SIP). Try to find ruby from | ||
# homebrew as a workaround. | ||
if (APPLE) | ||
find_program(BREW_RUBY ruby HINTS /usr/local/opt/ruby/bin) | ||
endif() | ||
|
||
add_dependencies(UNIT_ign_TEST | ||
${ign_lib_target} | ||
TestModelSystem | ||
TestSensorSystem | ||
TestWorldSystem | ||
) | ||
|
||
target_compile_definitions(UNIT_ign_TEST PRIVATE | ||
"BREW_RUBY=\"${BREW_RUBY} \"") | ||
|
||
target_compile_definitions(UNIT_ign_TEST PRIVATE | ||
"IGN_PATH=\"${IGNITION-TOOLS_BINARY_DIRS}\"") | ||
|
||
set(_env_vars) | ||
list(APPEND _env_vars "IGN_CONFIG_PATH=${CMAKE_BINARY_DIR}/test/conf") | ||
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 commentThe 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 commentThe 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:
I think it's a bit cleaner to set them from cmake. One drawback is that executing the binaries directly (like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
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 commentThe 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 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 commentThe 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 |
||
endif() | ||
|
||
if(NOT WIN32) | ||
add_subdirectory(cmd) | ||
endif() | ||
|
Uh oh!
There was an error while loading. Please reload this page.