-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Ensure Xcode SDK paths are set when running test targets. #7040
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
Conversation
Currently, some of our code paths that run test targets don't correctly set the `DYLD_FRAMEWORK_PATH` and `DYLD_LIBRARY_PATH` arguments on macOS. This hasn't been a problem in practice because the XCTest helper tool is able to sort it out for us, but my plan with swift-testing is to run an executable directly (like we do for corelibs-xctest.) That means we'll have a code path that could potentially rely on XCTest or other Apple SDK bits, but which is not calling through the XCTest helper tool. This change hoists our setting of those arguments to a position where they are always set (on macOS only!) before we run a test target, regardless of build style.
@swift-ci please test |
seems fine to me, but @neonichu to review |
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.
Would it be possible to add a test that exercises constructTestEnvironment
and checks that it returns correct env vars when executed on macOS?
@MaxDesiatov We can write a test that does that, but it would be a bit tautological. I was planning to write some tests of broader test target behaviour in subsequent PRs that would cover these variables. |
)" This reverts commit bcad083.
Currently, some of our code paths that run test targets don't correctly set the `DYLD_FRAMEWORK_PATH` and `DYLD_LIBRARY_PATH` arguments on macOS. This hasn't been a problem in practice because the XCTest helper tool is able to sort it out for us, but my plan with swift-testing is to run an executable directly (like we do for corelibs-xctest.) That means we'll have a code path that could potentially rely on XCTest or other Apple SDK bits, but which is not calling through the XCTest helper tool. This change hoists our setting of those arguments to a position where they are always set (on macOS only!) before we run a test target, regardless of build style. This change was previously landed as #7040 but was reverted while we investigated a toolchain regression. We do not believe #7040 is the root cause of that issue, so this PR reapplies it.
Currently, some of our code paths that run test targets don't correctly set the `DYLD_FRAMEWORK_PATH` and `DYLD_LIBRARY_PATH` arguments on macOS. This hasn't been a problem in practice because the XCTest helper tool is able to sort it out for us, but my plan with swift-testing is to run an executable directly (like we do for corelibs-xctest.) That means we'll have a code path that could potentially rely on XCTest or other Apple SDK bits, but which is not calling through the XCTest helper tool. This change hoists our setting of those arguments to a position where they are always set (on macOS only!) before we run a test target, regardless of build style. This change was previously landed as #7040 but was reverted (#7054) while we investigated a toolchain regression. We do not believe #7040 is the root cause of that issue, so this PR reapplies it.
Currently, some of our code paths that run test targets don't correctly set the
DYLD_FRAMEWORK_PATH
andDYLD_LIBRARY_PATH
arguments on macOS. This hasn't been a problem in practice because the XCTest helper tool is able to sort it out for us, but my plan with swift-testing is to run an executable directly (like we do for corelibs-xctest.) That means we'll have a code path that could potentially rely on XCTest or other Apple SDK bits, but which is not calling through the XCTest helper tool.This change hoists our setting of those arguments to a position where they are always set (on macOS only!) before we run a test target, regardless of build style.