Skip to content

Conversation

@iche033
Copy link
Contributor

@iche033 iche033 commented Apr 29, 2025

🦟 Bug fix

Fixes #2889

Summary

The test was also failing locally on my mac but with a slightly different error msg from the output in #2889:

dyld[22115]: Library not loaded: libgz-sim.10.dylib

Setting DISCOVERY_MODE to PRE_TEST in gtest_discover_tests makes gtest delay test discovery until before test execution. By default it's done at build time with POST_BUILD.

From cmake doc on PRE_TEST:

This way test discovery occurs in the target environment where the test has a better chance at finding appropriate runtime dependencies.

I was able to build and run the test locally with these changes.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

Signed-off-by: Ian Chen <ichen@openrobotics.org>
@iche033 iche033 requested a review from mjcarroll as a code owner April 29, 2025 01:06
@github-actions github-actions bot added the 🪵 jetty Gazebo Jetty label Apr 29, 2025

include(GoogleTest)
gtest_discover_tests(${TEST_TARGET})
if (APPLE)
Copy link
Member

Choose a reason for hiding this comment

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

Do you think this issue will occur on other platforms with cmake 4? If so, I would check the cmake version instead of APPLE

I'm not sure though

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 did some tests:

  • Ubuntu + cmake 4.0.1: built fine
  • Mac + cmake 3.31.7: same error
  • Mac + cmake 3.31.6: same error

hmm maybe something else has changed

Copy link
Member

Choose a reason for hiding this comment

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

weird

I've tried disabling ccache and that seems to fix it for me?

testing without ccache using gazebo-tooling/release-tools@b7cd4e3:

Copy link
Member

Choose a reason for hiding this comment

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

that didn't help

Copy link
Member

Choose a reason for hiding this comment

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

now I can't reproduce the failure on my personal machine at all, though it still fails in CI

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm I can still reproduce it. I don't have ccache setup.

@scpeters scpeters changed the title Fix standalone_gtest_setup example test on mac Disable standalone_gtest_setup example test on mac May 12, 2025
Copy link
Member

@scpeters scpeters left a comment

Choose a reason for hiding this comment

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

I'm not sure why the test is failing, but let's go ahead and merge this to fix CI

let's leave the issue open though

@github-project-automation github-project-automation bot moved this from Inbox to In review in Core development May 12, 2025
@scpeters scpeters merged commit 480cf85 into main May 12, 2025
8 of 9 checks passed
@scpeters scpeters deleted the iche033/fix_gtest_example branch May 12, 2025 22:53
@github-project-automation github-project-automation bot moved this from In review to Done in Core development May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🪵 jetty Gazebo Jetty

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants