-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
More swiftbuild testing #8333
Conversation
try localFileSystem.createDirectory(packagePath) | ||
try sh(swiftPackage, "--package-path", packagePath, "init", "--type", "executable") | ||
try sh(swiftBuild, "--package-path", packagePath, "--build-system", "swiftbuild") | ||
do { |
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.
Are these do
blocks intended to swallow all errors? Seems like this test should be skipped instead.
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.
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.") |
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.
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.
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.
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 |
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.
Don't change this. I am removing this calculated boolean in my swift run/test PR.
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.
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) | |||
} | |||
} | |||
|
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.
Same with this. I am revamping how this path is calculated.
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.
Same comment as above. Which PR will be merged first?
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
…d integration issues
02771e2
to
153eb90
Compare
…to more_swiftbuild_testing
…ager into more_swiftbuild_testing
@swift-ci please test |
@swift-ci test Windows |
Please test with following pull request: @swift-ci test Windows |
…ager into more_swiftbuild_testing
@swift-ci please test |
@swift-ci test Windows |
@@ -89,12 +108,6 @@ final class BuildCommandTests: CommandsTestCase { | |||
XCTAssertMatch(stdout, .contains("SEE ALSO: swift run, swift package, swift test")) | |||
} | |||
|
|||
func testCommandDoesNotEmitDuplicateSymbols() async throws { |
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.
question: why was this test removed?
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.
This test was removed because it doesn't work with the new framework. The --help
option isn't accepted by the executable it tries to run.
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.
we may need to replace try await execute(["--help"])
with try await SwiftPM.Build.execute(....)
// Print correct path when building with XCBuild. | ||
#if os(macOS) | ||
let xcodeDebugOutput = try await execute(["--build-system", "xcode", "--show-bin-path"], packagePath: fullPath) | ||
guard buildSystemProvider == .xcode || buildSystemProvider == .swiftbuild else { |
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.
suggestion: in order to make the intent more clear, can we move this considitional to a property/attribute in BuildSystemProvider.Kind
so that we could do guard buildSystemProvider.supportsBinarySymLinks else { return }
(or similar)
#if os(macOS) | ||
let xcodeDebugOutput = try await execute(["--build-system", "xcode", "--show-bin-path"], packagePath: fullPath) | ||
guard buildSystemProvider == .xcode || buildSystemProvider == .swiftbuild else { | ||
return |
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.
thought (blocking): Can we call this guard
as the very first step in the test implementation, and "Skip" the test in the else block so we don't get a "false positive".
e.g.
func testBinSymlink() async throws {
guard buildSystemProvider.supportsBinarySymlink {
XCTSkip("Build Provider \(buildSystemProvider) does not support binary symbolic links")
return
}
try await fixture (.....) {
...
}
}
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.
According to conventionalcomments.org "[thoughts] are non-blocking by nature..."
If this is non-blocking then a follow-up PR could address this.
@@ -204,8 +220,16 @@ final class BuildCommandTests: CommandsTestCase { | |||
xcodeReleaseOutput, | |||
"\(xcbuildTargetPath.appending(components: "Products", "Release").pathString)\n" | |||
) | |||
#endif | |||
} |
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.
issue (blocking): can we add an assertion on the debug bin path?
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.
Can this be done in a follow-up PR?
|
||
// In the case of the native build system check for the cross-compile target, only for macOS | ||
#if os(macOS) | ||
if buildSystem == "native" { | ||
if buildSystemProvider == .native { |
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.
issue (blocking): This test only has assertions for the native build system.
Can we document the intent of this test for the other build systems? If we want to ensure the package builds successfully, can we use the XCTAssertBuilds
helper function in XCTAssertHelpers.swift .
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.
While this doesn't have an assertion for the non-native build system case, there is an implicit assertion that the build succeeds, which increases test coverage for the other build systems. There does not appear to be an analog to the text that this is looking for with the other build systems. So, the question is do we want more test coverage, or not because of one less assert in this test case?
@@ -40,7 +45,13 @@ final class PackageCommandTests: CommandsTestCase { | |||
var environment = env ?? [:] | |||
// don't ignore local packages when caching | |||
environment["SWIFTPM_TESTS_PACKAGECACHE"] = "1" | |||
return try await SwiftPM.Package.execute(args, packagePath: packagePath, env: environment) | |||
// return try await self.execute(args, packagePath: packagePath, env: environment) |
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.
nit: remove commented line
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.
Removing the commented line requires another 4 hour turnaround waiting on CI, and that assumes that CI doesn't break for external reasons, and there are no conflicts introduced in the interim.
@@ -40,7 +45,13 @@ final class PackageCommandTests: CommandsTestCase { | |||
var environment = env ?? [:] | |||
// don't ignore local packages when caching | |||
environment["SWIFTPM_TESTS_PACKAGECACHE"] = "1" |
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.
question: out of curiosity, what behavioural changes does setting this environment variable have?
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.
This seems out of scope of this PR. I don't know the answer.
@swift-ci test Windows |
This is a followup to #8333 based on feedback from there.
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.