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

Add optional argument to catch_discover_tests to set DYLD_FRAMEWORK_PATH #2880

Merged
merged 2 commits into from
Jul 22, 2024

Conversation

andy-phillips
Copy link
Contributor

If a 3rd party library used in tests depends on the DYLD_FRAMEWORK_PATH environment variable to be set on OSX (in order to find its dependent libraries packaged as Apple frameworks during test discovery and run them), then catch_discover_tests will fail. It's similar to the need and usage of the DL_PATHS argument.

Two solutions I initially thought of. One, set the DYLD_FRAMEWORK_PATH implicitly to the same value as DL_PATHS. Second, adding an explicit optional argument to set the paths specifically used for Apple frameworks.

In this PR I have opted for the second solution to allow the two variables to hold different values, even though DYLD_FRAMEWORK_PATH only needs to be set on OSX. There is some repetition in the code to process the paths and set the variables which could be improved in a separate commit or PR.

…WORK_PATH environment variable on Apple platforms.
Copy link

codecov bot commented Jun 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.14%. Comparing base (4e8d92b) to head (9109c06).
Report is 6 commits behind head on devel.

Additional details and impacted files
@@            Coverage Diff             @@
##            devel    #2880      +/-   ##
==========================================
+ Coverage   91.10%   91.14%   +0.04%     
==========================================
  Files         198      198              
  Lines        8493     8487       -6     
==========================================
- Hits         7737     7735       -2     
+ Misses        756      752       -4     

@horenmar horenmar added the Extras Touches utility scripts outside of Catch2 proper, e.g. CMake integration. label Jul 22, 2024
@horenmar
Copy link
Member

It's fine to keep the paths duplicated.

packaged as frameworks on Apple platforms when running the test executable
(DYLD_FRAMEWORK_PATH). These paths will both be set when retrieving the list
of test cases from the test executable and when the tests are executed themselves.
This requires cmake/ctest >= 3.22.
Copy link
Member

Choose a reason for hiding this comment

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

On line 166, the script explicitly errors out if _DL_PATHS are used with CMake version before 3.22. _DL_FRAMEWORK_PATHS should be checked there as well.

Copy link
Contributor Author

@andy-phillips andy-phillips Jul 22, 2024

Choose a reason for hiding this comment

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

Thanks for pointing that out, check added.

@horenmar horenmar merged commit 85b7f3d into catchorg:devel Jul 22, 2024
81 checks passed
@horenmar
Copy link
Member

Thanks

@andy-phillips andy-phillips deleted the feature/dyld-framework-path branch July 22, 2024 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Extras Touches utility scripts outside of Catch2 proper, e.g. CMake integration.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants