Skip to content

Commit a16474a

Browse files
authored
Re-enable more plugin related tests for non-macOS platforms (#8558)
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 * Skip test that's failing on Amazon Linux 2
1 parent d026b3f commit a16474a

File tree

5 files changed

+26
-24
lines changed

5 files changed

+26
-24
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

+5-3
Original file line numberDiff line numberDiff line change
@@ -959,10 +959,12 @@ class BuildCommandSwiftBuildTests: BuildCommandTestCases {
959959

960960
override func testBuildCompleteMessage() async throws {
961961
#if os(Linux)
962-
throw XCTSkip("SWBINTTODO: Need to properly set LD_LIBRARY_PATH on linux")
963-
#else
964-
try await super.testBuildCompleteMessage()
962+
if FileManager.default.contents(atPath: "/etc/system-release").map { String(decoding: $0, as: UTF8.self) == "Amazon Linux release 2 (Karoo)\n" } ?? false {
963+
throw XCTSkip("Skipping Swift Build testing on Amazon Linux because of platform issues.")
964+
}
965965
#endif
966+
967+
try await super.testBuildCompleteMessage()
966968
}
967969

968970
}

Tests/CommandsTests/PackageCommandTests.swift

+8-2
Original file line numberDiff line numberDiff line change
@@ -3898,15 +3898,21 @@ 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
}
39063906

39073907
#if !os(macOS)
39083908
override func testCommandPluginTestingCallbacks() async throws {
3909-
throw XCTSkip("SWBINTTODO: Test fails on inability to find libclang on Linux. Also, plugins are not currently supported")
3909+
#if os(Linux)
3910+
if FileManager.default.contents(atPath: "/etc/system-release").map { String(decoding: $0, as: UTF8.self) == "Amazon Linux release 2 (Karoo)\n" } ?? false {
3911+
throw XCTSkip("Skipping Swift Build testing on Amazon Linux because of platform issues.")
3912+
}
3913+
#endif
3914+
try await super.testCommandPluginTestingCallbacks()
39103915
}
39113916
#endif
3917+
39123918
}

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)