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

More swiftbuild testing #8333

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

cmcgee1024
Copy link
Member

@cmcgee1024 cmcgee1024 commented Mar 6, 2025

Add more verifications of the swiftbuild build system to ensure correctness moving forward. Tag various discovered swift-build integration issues with the tag SWBINTTODO with a general description of the problem encountered to enable categorization for further exploration activities.

Motivation:

The swiftbuild integration has only the most basic smoke testing of its functionality. Add more automated tests, and explicit skips where there are functionality gaps that need to be addressed.

@cmcgee1024
Copy link
Member Author

@swift-ci test Windows

@cmcgee1024
Copy link
Member Author

@swift-ci please test

@cmcgee1024
Copy link
Member Author

@swift-ci test macOS

@cmcgee1024
Copy link
Member Author

@swift-ci test Windows

try localFileSystem.createDirectory(packagePath)
try sh(swiftPackage, "--package-path", packagePath, "init", "--type", "executable")
try sh(swiftBuild, "--package-path", packagePath, "--build-system", "swiftbuild")
do {
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these do blocks intended to swallow all errors? Seems like this test should be skipped instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

These do blocks seem to throw errors, and that's why I had to comment out the assert at the bottom. The original intent is unclear. You can see them in #8276 too.

The goal is to increase test coverage, even if the assert/test at the end don't currently work. I think that these do exercise the build function.

final class APIDiffTests: CommandsTestCase {
class APIDiffTestCase: CommandsBuildProviderTestCase {
override func setUpWithError() throws {
try XCTSkipIf(type(of: self) == APIDiffTestCase.self, "Pay no attention to the class behind the curtain.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this to make sure this class is "abstract" and ensure its always extended? I don't want to be a wet paper bag, but a more clear message would help clarify the intent.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's correct. I've updated this message to help clarify that.

@@ -173,7 +173,7 @@ extension BuildSystemProvider.Kind {
public var usesXcodeBuildEngine: Bool {
switch self {
case .native: return false
case .swiftbuild: return false
case .swiftbuild: return true
Copy link
Member

Choose a reason for hiding this comment

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

Don't change this. I am removing this calculated boolean in my swift run/test PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, is that change going in imminently? If not, this change really improves the test success rates until that other PR lands.

@@ -191,3 +191,16 @@ public enum BuildSystemUtilities {
return try AbsolutePath(validating: env, relativeTo: workingDir)
}
}

Copy link
Member

Choose a reason for hiding this comment

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

Same with this. I am revamping how this path is calculated.

Copy link
Member Author

Choose a reason for hiding this comment

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

Same comment as above. Which PR will be merged first?

bkhouri and others added 12 commits March 10, 2025 18:23
Augment Commands Tests to run against the Native and Swift Build build
systems.

- BuildCommandTests
- TestCommandTests
- RunCommandTests
- APIDiffTests
- PackageCommandTests

Also,
  - Add a new BuildCommandTest and RunCommandTest test case that ensures
    a package with target conditionals builds and runs successfully
  - update BuildSystemProvider.Kind to define a "useXcodeBuildSystemPath"
    variable instead of sprinkling the `buildSystem == .xcode` all over
    the place
  - Augment the Swift Build integration test to run `swift test`

TODO:
  - Instead of marking test failures as  "Skipped", See if we can mark
    them as "expected fail" so we are forced to update the test once the
    production code has been update to support the "feature".

more update'
This reverts commit 3e06c8f497b33b24aefc18290d9226dea01525e6.
Remove the duplicate symbol checks for use in a future enhancement

Refactor xcode specific tests into the new build system matrix
Skip Xcode build system variant of tests that are failing
Fix double-override in BuildCommandTests
@cmcgee1024 cmcgee1024 force-pushed the more_swiftbuild_testing branch from 02771e2 to 153eb90 Compare March 10, 2025 22:23
@cmcgee1024
Copy link
Member Author

@swift-ci test Windows

@cmcgee1024
Copy link
Member Author

@swift-ci please test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants