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

swift-test doesn't find xctest bundle with swiftbuild #8272

Open
1 task done
dschaefer2 opened this issue Feb 1, 2025 · 5 comments · May be fixed by #8276
Open
1 task done

swift-test doesn't find xctest bundle with swiftbuild #8272

dschaefer2 opened this issue Feb 1, 2025 · 5 comments · May be fixed by #8276
Assignees
Labels
bug swift build Changes impacting `swift build` swift test Changes impacting `swift test` tool

Comments

@dschaefer2
Copy link
Member

dschaefer2 commented Feb 1, 2025

Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?

  • Confirmed reproduction steps with SwiftPM CLI. The description text must include reproduction steps with either of command-line SwiftPM commands, swift build, swift test, swift package etc.

Description

swift-test is using the old native build path layout to find the xctest bundle when used with --build-system swiftbuild

Expected behavior

swift-test should run the tests.

Actual behavior

I'm getting an error:

swiftpm_testing_helper/Entrypoint.swift:29: Fatal error: Failed to open test bundle at path /Users/dschaefer/swift/douglib/.build/arm64-apple-macosx/debug/douglibPackageTests.xctest/Contents/MacOS/douglibPackageTests: dlopen(/Users/dschaefer/swift/douglib/.build/arm64-apple-macosx/debug/douglibPackageTests.xctest/Contents/MacOS/douglibPackageTests, 0x0101)

it's actually at the following with swiftbuild.

.build/arm64-apple-macosx/Products/Debug/douglibPackageTests.xctest/Contents/MacOS/douglibPackageTests

Steps to reproduce

Run swift test --build-system swiftbuild, or swift-test until the initial PR lands.

Swift Package Manager version/commit hash

No response

Swift & OS version (output of swift --version ; uname -a)

No response

@dschaefer2 dschaefer2 added bug swift build Changes impacting `swift build` swift test Changes impacting `swift test` tool labels Feb 1, 2025
@dschaefer2
Copy link
Member Author

Interesting. swift-run does find the executable to run. We need to find out why swift-test doesn't use the same technique.

@dschaefer2
Copy link
Member Author

BTW, this is with a simple project created with swift package init.

@bkhouri bkhouri self-assigned this Feb 3, 2025
@bkhouri bkhouri linked a pull request Feb 4, 2025 that will close this issue
1 task
@bkhouri
Copy link
Contributor

bkhouri commented Feb 4, 2025

I potential fix is included in #8276

@dschaefer2
Copy link
Member Author

@bkhouri can you break that out into a separate change? I'd like to review that separate from the rest of 8276. In theory we can fix that now.

bkhouri added a commit to bkhouri/swift-package-manager that referenced this issue Feb 19, 2025
There are a few places that check the BuildSystemProvider.Kind is Xcode
to determine the build directory structure.  With the upcoming Swift
Build integration, which uses the "Xcode path" structure, we would need
to update all instances to check the two build system provider kinds.

Add an extension on the BuildSystemProvider.Kind that create a boolean
variable `useXcodeBuildSystemPath`, which determines whether the build
system should use the xcode path structure or not.  In addition, update
the code that requires a  "isXcodeBuildSystemEnabled" to return this
build system provider variable.

This will hopefully help address swiftlang#8272.
bkhouri added a commit to bkhouri/swift-package-manager that referenced this issue Feb 19, 2025
There are a few places that check the BuildSystemProvider.Kind is Xcode
to determine the build directory structure.  With the upcoming Swift
Build integration, which uses the "Xcode path" structure, we would need
to update all instances to check the two build system provider kinds.

Add an extension on the BuildSystemProvider.Kind that create a boolean
variable `useXcodeBuildSystemPath`, which determines whether the build
system should use the xcode path structure or not.  In addition, update
the code that requires a  "isXcodeBuildSystemEnabled" to return this
build system provider variable.

This will hopefully help address swiftlang#8272 when swiftlang#8271, where it adds
`case .swiftbuild: return true` to the `useXcodeBuildSystemPath`
@bkhouri
Copy link
Contributor

bkhouri commented Feb 19, 2025

@dschaefer2 : here's the PR #8298.

bkhouri added a commit to bkhouri/swift-package-manager that referenced this issue Feb 20, 2025
There are a few places that check the BuildSystemProvider.Kind is Xcode
to determine the build directory structure.  With the upcoming Swift
Build integration, which uses the "Xcode path" structure, we would need
to update all instances to check the two build system provider kinds.

Add an extension on the BuildSystemProvider.Kind that create a boolean
variable `useXcodeBuildEngine`, which determines whether the build
system should use the xcode path structure or not.  In addition, update
the code that requires a  "isXcodeBuildSystemEnabled" to return this
build system provider variable.

This will hopefully help address swiftlang#8272 when swiftlang#8271, where it adds
`case .swiftbuild: return true` to the `useXcodeBuildEngine`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug swift build Changes impacting `swift build` swift test Changes impacting `swift test` tool
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants