Skip to content

Commit 5da13be

Browse files
authored
Enable more plugin related tests for non-macOS platforms (#8477)
There are tests that were formerly failing due to missing support for plugins in the old PIF builder. Enable these test for better coverage with the new builder. * Fix spelling in one of the APIs * Remove macOS-specific linker flag in the PIF builder and use a setting that is target platform neutral * Update skip comments for tests based on new analysis of the failures
1 parent b842488 commit 5da13be

File tree

5 files changed

+14
-35
lines changed

5 files changed

+14
-35
lines changed

Sources/SwiftBuildSupport/PackagePIFBuilder.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -651,9 +651,9 @@ extension PackagePIFBuilder.LinkedPackageBinary {
651651

652652
init?(dependency: ResolvedModule.Dependency, package: ResolvedPackage) {
653653
switch dependency {
654-
case .product(let producutDependency, _):
655-
guard producutDependency.hasSourceTargets else { return nil }
656-
self.init(name: producutDependency.name, packageName: package.name, type: .product)
654+
case .product(let productDependency, _):
655+
guard productDependency.hasSourceTargets else { return nil }
656+
self.init(name: productDependency.name, packageName: package.name, type: .product)
657657

658658
case .module(let moduleDependency, _):
659659
self.init(module: moduleDependency, package: package)

Sources/SwiftBuildSupport/PackagePIFProjectBuilder+Modules.swift

+2-8
Original file line numberDiff line numberDiff line change
@@ -504,20 +504,14 @@ extension PackagePIFProjectBuilder {
504504
}
505505

506506
// Additional settings for the linker.
507-
let baselineOTHER_LDFLAGS: [String]
508507
let enableDuplicateLinkageCulling = UserDefaults.standard.bool(
509508
forKey: "IDESwiftPackagesEnableDuplicateLinkageCulling",
510509
defaultValue: true
511510
)
512511
if enableDuplicateLinkageCulling {
513-
baselineOTHER_LDFLAGS = [
514-
"-Wl,-no_warn_duplicate_libraries",
515-
"$(inherited)"
516-
]
517-
} else {
518-
baselineOTHER_LDFLAGS = ["$(inherited)"]
512+
impartedSettings[.LD_WARN_DUPLICATE_LIBRARIES] = "NO"
519513
}
520-
impartedSettings[.OTHER_LDFLAGS] = (sourceModule.isCxx ? ["-lc++"] : []) + baselineOTHER_LDFLAGS
514+
impartedSettings[.OTHER_LDFLAGS] = (sourceModule.isCxx ? ["-lc++"] : []) + ["$(inherited)"]
521515
impartedSettings[.OTHER_LDRFLAGS] = []
522516
log(
523517
.debug,

Tests/CommandsTests/BuildCommandTests.swift

-9
Original file line numberDiff line numberDiff line change
@@ -956,13 +956,4 @@ class BuildCommandSwiftBuildTests: BuildCommandTestCases {
956956

957957
try await super.testBuildSystemDefaultSettings()
958958
}
959-
960-
override func testBuildCompleteMessage() async throws {
961-
#if os(Linux)
962-
throw XCTSkip("SWBINTTODO: Need to properly set LD_LIBRARY_PATH on linux")
963-
#else
964-
try await super.testBuildCompleteMessage()
965-
#endif
966-
}
967-
968959
}

Tests/CommandsTests/PackageCommandTests.swift

+1-7
Original file line numberDiff line numberDiff line change
@@ -3898,15 +3898,9 @@ class PackageCommandSwiftBuildTests: PackageCommandTestCase {
38983898
}
38993899

39003900
override func testCommandPluginBuildingCallbacks() async throws {
3901-
throw XCTSkip("SWBINTTODO: Test fails as plugins are not currenty supported")
3901+
throw XCTSkip("SWBINTTODO: Test fails because plugin is not producing expected output to stdout.")
39023902
}
39033903
override func testCommandPluginBuildTestability() async throws {
39043904
throw XCTSkip("SWBINTTODO: Test fails as plugins are not currenty supported")
39053905
}
3906-
3907-
#if !os(macOS)
3908-
override func testCommandPluginTestingCallbacks() async throws {
3909-
throw XCTSkip("SWBINTTODO: Test fails on inability to find libclang on Linux. Also, plugins are not currently supported")
3910-
}
3911-
#endif
39123906
}

Tests/CommandsTests/TestCommandTests.swift

+8-8
Original file line numberDiff line numberDiff line change
@@ -701,35 +701,35 @@ class TestCommandSwiftBuildTests: TestCommandTestCase {
701701

702702
#if !os(macOS)
703703
override func testSwiftTestXMLOutputVerifySingleTestFailureMessageWithFlagDisabledXCTest() async throws {
704-
throw XCTSkip("Result XML could not be found. The build fails due to an LD_LIBRARY_PATH issue finding swift core libraries. https://github.com/swiftlang/swift-package-manager/issues/8416")
704+
throw XCTSkip("Result XML could not be found. The build fails because of missing test helper generation logic for non-macOS platforms: https://github.com/swiftlang/swift-package-manager/issues/8479")
705705
}
706706

707707
override func testSwiftTestXMLOutputVerifyMultipleTestFailureMessageWithFlagEnabledXCTest() async throws {
708-
throw XCTSkip("Result XML could not be found. The build fails due to an LD_LIBRARY_PATH issue finding swift core libraries. https://github.com/swiftlang/swift-package-manager/issues/8416")
708+
throw XCTSkip("Result XML could not be found. The build fails because of missing test helper generation logic for non-macOS platforms: https://github.com/swiftlang/swift-package-manager/issues/8479")
709709
}
710710

711711
override func testSwiftTestXMLOutputVerifySingleTestFailureMessageWithFlagEnabledXCTest() async throws {
712-
throw XCTSkip("Result XML could not be found. The build fails due to an LD_LIBRARY_PATH issue finding swift core libraries. https://github.com/swiftlang/swift-package-manager/issues/8416")
712+
throw XCTSkip("Result XML could not be found. The build fails because of missing test helper generation logic for non-macOS platforms: https://github.com/swiftlang/swift-package-manager/issues/8479")
713713
}
714714

715715
override func testSwiftTestXMLOutputVerifyMultipleTestFailureMessageWithFlagDisabledXCTest() async throws {
716-
throw XCTSkip("Result XML could not be found. The build fails due to an LD_LIBRARY_PATH issue finding swift core libraries. https://github.com/swiftlang/swift-package-manager/issues/8416")
716+
throw XCTSkip("Result XML could not be found. The build fails because of missing test helper generation logic for non-macOS platforms: https://github.com/swiftlang/swift-package-manager/issues/8479")
717717
}
718718

719719
override func testSwiftTestSkip() async throws {
720-
throw XCTSkip("This fails due to a linker error on Linux. https://github.com/swiftlang/swift-package-manager/issues/8439")
720+
throw XCTSkip("Result XML could not be found. The build fails because of missing test helper generation logic for non-macOS platforms: https://github.com/swiftlang/swift-package-manager/issues/8479")
721721
}
722722

723723
override func testSwiftTestXMLOutputWhenEmpty() async throws {
724-
throw XCTSkip("This fails due to a linker error on Linux. https://github.com/swiftlang/swift-package-manager/issues/8439")
724+
throw XCTSkip("Result XML could not be found. The build fails because of missing test helper generation logic for non-macOS platforms: https://github.com/swiftlang/swift-package-manager/issues/8479")
725725
}
726726

727727
override func testSwiftTestFilter() async throws {
728-
throw XCTSkip("This fails due to an unknown linker error on Linux. https://github.com/swiftlang/swift-package-manager/issues/8439")
728+
throw XCTSkip("Result XML could not be found. The build fails because of missing test helper generation logic for non-macOS platforms: https://github.com/swiftlang/swift-package-manager/issues/8479")
729729
}
730730

731731
override func testSwiftTestParallel() async throws {
732-
throw XCTSkip("This fails due to an unknown linker error on Linux. https://github.com/swiftlang/swift-package-manager/issues/8439")
732+
throw XCTSkip("Result XML could not be found. The build fails because of missing test helper generation logic for non-macOS platforms: https://github.com/swiftlang/swift-package-manager/issues/8479")
733733
}
734734
#endif
735735
}

0 commit comments

Comments
 (0)