Skip to content

Stop using the SWIFT_PM_SUPPORTS_SWIFT_TESTING flag. #376

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

Merged
merged 1 commit into from
Apr 26, 2024

Conversation

grynspan
Copy link
Contributor

@grynspan grynspan commented Apr 26, 2024

When we were first bringing up experimental support for swift-testing in Swift Package Manager, I added the flag SWIFT_PM_SUPPORTS_SWIFT_TESTING to the build process for test targets so that we could detect if there was built-in support or not. Now that we've announced we're aligning our release with Swift 6, we can instead just check if the compiler is Swift 6 or later. Very early Swift 5.11 toolchain builds did not have support, but they have long since been superseded.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

When we were first bringing up experimental support for swift-testing in Swift Package Manager, I added the flag `SWIFT_PM_SUPPORTS_SWIFT_TESTING` to the build process for test targets so that we could detect if there was built-in support or not. Now that we've announced we're aligning our release with Swift 6, we can instead just check if the compiler is Swift 6 or later. Very early Swift 5.11 toolchain builds did not have support, but they have long since been superseded.
@grynspan
Copy link
Contributor Author

@swift-ci please test

@grynspan
Copy link
Contributor Author

@swift-ci please clean test

2 similar comments
@grynspan
Copy link
Contributor Author

@swift-ci please clean test

@grynspan
Copy link
Contributor Author

@swift-ci please clean test

@grynspan
Copy link
Contributor Author

@swift-ci please clean test macOS

@grynspan
Copy link
Contributor Author

@swift-ci please test

grynspan added a commit to swiftlang/swift-package-manager that referenced this pull request Apr 26, 2024
After #7353 landed, I noticed that the build products for test targets were not
being emitted correctly. swift-testing and XCTest produce separate build
products (with distinct names) but this wasn't happening as intended. It turns
out that the changes to split `buildParameters` into `productsBuildParameters`
and `toolsBuildParameters` weren't fully propagated to our testing
infrastructure.

I also noticed `SWIFT_PM_SUPPORTS_SWIFT_TESTING` wasn't being set correctly
anymore (same root cause) although we've decided to ignore that flag over in
swift-testing anyway (see swiftlang/swift-testing#376.)

This regression caused build failures in swift-testing (e.g. [here](https://ci.swift.org/job/pr-swift-testing-macos/663/console))
with the telltale failure signature:

> /Users/ec2-user/jenkins/workspace/pr-swift-testing-macos/branch-main/swift-testing/.build/x86_64-apple-macosx/debug/swift-testingPackageTests.xctest/Contents/MacOS/swift-testingPackageTests: /Users/ec2-user/jenkins/workspace/pr-swift-testing-macos/branch-main/swift-testing/.build/x86_64-apple-macosx/debug/swift-testingPackageTests.xctest/Contents/MacOS/swift-testingPackageTests: cannot execute binary file

Which indicates that it thinks the filename for the swift-testing build product
is the XCTest bundle's executable.

This PR plumbs through the two build parameters arguments to everywhere in
`swift test` and `swift build` that needs them and resolves the issue.
MaxDesiatov added a commit to swiftlang/swift-package-manager that referenced this pull request Apr 26, 2024
After #7353 landed, I noticed that the build products for test targets
were not being emitted correctly. swift-testing and XCTest produce
separate build products (with distinct names) but this wasn't happening
as intended. It turns out that the changes to split `buildParameters`
into `productsBuildParameters` and `toolsBuildParameters` weren't fully
propagated to our testing infrastructure.

I also noticed `SWIFT_PM_SUPPORTS_SWIFT_TESTING` wasn't being set
correctly anymore (same root cause) although we've decided to ignore
that flag over in swift-testing anyway (see
swiftlang/swift-testing#376.)

This regression caused build failures in swift-testing (e.g.
[here](https://ci.swift.org/job/pr-swift-testing-macos/663/console))
with the telltale failure signature:

>
/Users/ec2-user/jenkins/workspace/pr-swift-testing-macos/branch-main/swift-testing/.build/x86_64-apple-macosx/debug/swift-testingPackageTests.xctest/Contents/MacOS/swift-testingPackageTests:
/Users/ec2-user/jenkins/workspace/pr-swift-testing-macos/branch-main/swift-testing/.build/x86_64-apple-macosx/debug/swift-testingPackageTests.xctest/Contents/MacOS/swift-testingPackageTests:
cannot execute binary file

Which indicates that it thinks the filename for the swift-testing build
product is the XCTest bundle's executable.

This PR plumbs through the two build parameters arguments to everywhere
in `swift test` and `swift build` that needs them and resolves the
issue.

---------

Co-authored-by: Max Desiatov <[email protected]>
@grynspan
Copy link
Contributor Author

macOS failure is due to an infrastructure regression fixed with swiftlang/swift-package-manager#7508. Tested and passed at desk.

@grynspan grynspan merged commit f40b57a into main Apr 26, 2024
2 of 3 checks passed
@grynspan grynspan deleted the jgrynspan/remove-SWIFT_PM_SUPPORTS_SWIFT_TESTING branch April 26, 2024 22:40
grynspan added a commit that referenced this pull request Apr 28, 2024
grynspan added a commit that referenced this pull request Apr 28, 2024
#378)

This reverts commit f40b57a.

`SWIFT_PM_SUPPORTS_SWIFT_TESTING` is still needed in some
configurations.

### Checklist:

- [x] Code and documentation should follow the style of the [Style
Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
- [x] If public symbols are renamed or modified, DocC references should
be updated.
furby-tm pushed a commit to wabiverse/swift-package-manager that referenced this pull request May 15, 2024
…#7508)

After swiftlang#7353 landed, I noticed that the build products for test targets
were not being emitted correctly. swift-testing and XCTest produce
separate build products (with distinct names) but this wasn't happening
as intended. It turns out that the changes to split `buildParameters`
into `productsBuildParameters` and `toolsBuildParameters` weren't fully
propagated to our testing infrastructure.

I also noticed `SWIFT_PM_SUPPORTS_SWIFT_TESTING` wasn't being set
correctly anymore (same root cause) although we've decided to ignore
that flag over in swift-testing anyway (see
swiftlang/swift-testing#376.)

This regression caused build failures in swift-testing (e.g.
[here](https://ci.swift.org/job/pr-swift-testing-macos/663/console))
with the telltale failure signature:

>
/Users/ec2-user/jenkins/workspace/pr-swift-testing-macos/branch-main/swift-testing/.build/x86_64-apple-macosx/debug/swift-testingPackageTests.xctest/Contents/MacOS/swift-testingPackageTests:
/Users/ec2-user/jenkins/workspace/pr-swift-testing-macos/branch-main/swift-testing/.build/x86_64-apple-macosx/debug/swift-testingPackageTests.xctest/Contents/MacOS/swift-testingPackageTests:
cannot execute binary file

Which indicates that it thinks the filename for the swift-testing build
product is the XCTest bundle's executable.

This PR plumbs through the two build parameters arguments to everywhere
in `swift test` and `swift build` that needs them and resolves the
issue.

---------

Co-authored-by: Max Desiatov <[email protected]>
grynspan added a commit to swiftlang/swift-package-manager that referenced this pull request May 15, 2024
After #7353 landed, I noticed that the build products for test targets
were not being emitted correctly. swift-testing and XCTest produce
separate build products (with distinct names) but this wasn't happening
as intended. It turns out that the changes to split `buildParameters`
into `productsBuildParameters` and `toolsBuildParameters` weren't fully
propagated to our testing infrastructure.

I also noticed `SWIFT_PM_SUPPORTS_SWIFT_TESTING` wasn't being set
correctly anymore (same root cause) although we've decided to ignore
that flag over in swift-testing anyway (see
swiftlang/swift-testing#376.)

This regression caused build failures in swift-testing (e.g.
[here](https://ci.swift.org/job/pr-swift-testing-macos/663/console))
with the telltale failure signature:

>
/Users/ec2-user/jenkins/workspace/pr-swift-testing-macos/branch-main/swift-testing/.build/x86_64-apple-macosx/debug/swift-testingPackageTests.xctest/Contents/MacOS/swift-testingPackageTests:
/Users/ec2-user/jenkins/workspace/pr-swift-testing-macos/branch-main/swift-testing/.build/x86_64-apple-macosx/debug/swift-testingPackageTests.xctest/Contents/MacOS/swift-testingPackageTests:
cannot execute binary file

Which indicates that it thinks the filename for the swift-testing build
product is the XCTest bundle's executable.

This PR plumbs through the two build parameters arguments to everywhere
in `swift test` and `swift build` that needs them and resolves the
issue.

---------

Co-authored-by: Max Desiatov <[email protected]>
furby-tm pushed a commit to wabiverse/swift-package-manager that referenced this pull request May 15, 2024
…#7508)

After swiftlang#7353 landed, I noticed that the build products for test targets
were not being emitted correctly. swift-testing and XCTest produce
separate build products (with distinct names) but this wasn't happening
as intended. It turns out that the changes to split `buildParameters`
into `productsBuildParameters` and `toolsBuildParameters` weren't fully
propagated to our testing infrastructure.

I also noticed `SWIFT_PM_SUPPORTS_SWIFT_TESTING` wasn't being set
correctly anymore (same root cause) although we've decided to ignore
that flag over in swift-testing anyway (see
swiftlang/swift-testing#376.)

This regression caused build failures in swift-testing (e.g.
[here](https://ci.swift.org/job/pr-swift-testing-macos/663/console))
with the telltale failure signature:

>
/Users/ec2-user/jenkins/workspace/pr-swift-testing-macos/branch-main/swift-testing/.build/x86_64-apple-macosx/debug/swift-testingPackageTests.xctest/Contents/MacOS/swift-testingPackageTests:
/Users/ec2-user/jenkins/workspace/pr-swift-testing-macos/branch-main/swift-testing/.build/x86_64-apple-macosx/debug/swift-testingPackageTests.xctest/Contents/MacOS/swift-testingPackageTests:
cannot execute binary file

Which indicates that it thinks the filename for the swift-testing build
product is the XCTest bundle's executable.

This PR plumbs through the two build parameters arguments to everywhere
in `swift test` and `swift build` that needs them and resolves the
issue.

---------

Co-authored-by: Max Desiatov <[email protected]>
MaxDesiatov pushed a commit to swiftlang/swift-package-manager that referenced this pull request Jun 6, 2024
After #7353 landed, I noticed that the build products for test targets
were not being emitted correctly. swift-testing and XCTest produce
separate build products (with distinct names) but this wasn't happening
as intended. It turns out that the changes to split `buildParameters`
into `productsBuildParameters` and `toolsBuildParameters` weren't fully
propagated to our testing infrastructure.

I also noticed `SWIFT_PM_SUPPORTS_SWIFT_TESTING` wasn't being set
correctly anymore (same root cause) although we've decided to ignore
that flag over in swift-testing anyway (see
swiftlang/swift-testing#376.)

This regression caused build failures in swift-testing (e.g.
[here](https://ci.swift.org/job/pr-swift-testing-macos/663/console))
with the telltale failure signature:

>
/Users/ec2-user/jenkins/workspace/pr-swift-testing-macos/branch-main/swift-testing/.build/x86_64-apple-macosx/debug/swift-testingPackageTests.xctest/Contents/MacOS/swift-testingPackageTests:
/Users/ec2-user/jenkins/workspace/pr-swift-testing-macos/branch-main/swift-testing/.build/x86_64-apple-macosx/debug/swift-testingPackageTests.xctest/Contents/MacOS/swift-testingPackageTests:
cannot execute binary file

Which indicates that it thinks the filename for the swift-testing build
product is the XCTest bundle's executable.

This PR plumbs through the two build parameters arguments to everywhere
in `swift test` and `swift build` that needs them and resolves the
issue.

---------

Co-authored-by: Max Desiatov <[email protected]>
(cherry picked from commit 5a4c024)

# Conflicts:
#	Sources/Commands/SwiftBuildCommand.swift
#	Sources/Commands/SwiftTestCommand.swift
#	Sources/Commands/Utilities/TestingSupport.swift
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
swiftpm-integration 📦 Swift Package Manager integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants