Skip to content

Commit 3d063d0

Browse files
authored
Link test command test failures on Linux to issue (#8459)
The TestCommandTests fail on Linux due to a common linker problem with swift build build system, which is the missing 'main' symbol problem. This is described further detail in #8439. Provide the link in the skip messages and remove the TODO tags since the investigation is complete and the reason for the failures is now known. Update the common test case logic so that it dumps the command execution stdout and stderr in the case of failure to help diagnose these result.xml failures immediately in the logs.
1 parent 57a67b4 commit 3d063d0

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

Tests/CommandsTests/TestCommandTests.swift

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ class TestCommandTestCase: CommandsBuildProviderTestCase {
225225
let xUnitUnderTest = fixturePath.appending("result\(testRunner.fileSuffix).xml")
226226

227227
// WHEN we execute swift-test in parallel while specifying xUnit generation
228-
let extraCommandArgs = enableExperimentalFlag ? ["--experimental-xunit-message-failure"]: [],
229-
_ = try await execute(
228+
let extraCommandArgs = enableExperimentalFlag ? ["--experimental-xunit-message-failure"]: []
229+
let (stdout, stderr) = try await execute(
230230
[
231231
"--parallel",
232232
"--verbose",
@@ -239,6 +239,12 @@ class TestCommandTestCase: CommandsBuildProviderTestCase {
239239
throwIfCommandFails: false
240240
)
241241

242+
if !FileManager.default.fileExists(atPath: xUnitUnderTest.pathString) {
243+
// If the build failed then produce a output dump of what happened during the execution
244+
print("\(stdout)")
245+
print("\(stderr)")
246+
}
247+
242248
// THEN we expect \(xUnitUnderTest) to exists
243249
XCTAssertFileExists(xUnitUnderTest)
244250
let contents: String = try localFileSystem.readFileContents(xUnitUnderTest)
@@ -694,35 +700,35 @@ class TestCommandSwiftBuildTests: TestCommandTestCase {
694700

695701
#if !os(macOS)
696702
override func testSwiftTestXMLOutputVerifySingleTestFailureMessageWithFlagDisabledXCTest() async throws {
697-
throw XCTSkip("SWBINTTODO: Result XML could not be found. This looks to be a build layout issue. Further investigation is needed.")
703+
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")
698704
}
699705

700706
override func testSwiftTestXMLOutputVerifyMultipleTestFailureMessageWithFlagEnabledXCTest() async throws {
701-
throw XCTSkip("SWBINTTODO: Result XML could not be found. This looks to be a build layout issue. Further investigation is needed.")
707+
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")
702708
}
703709

704710
override func testSwiftTestXMLOutputVerifySingleTestFailureMessageWithFlagEnabledXCTest() async throws {
705-
throw XCTSkip("SWBINTTODO: Result XML could not be found. This looks to be a build layout issue. Further investigation is needed.")
711+
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")
706712
}
707713

708714
override func testSwiftTestXMLOutputVerifyMultipleTestFailureMessageWithFlagDisabledXCTest() async throws {
709-
throw XCTSkip("SWBINTTODO: Result XML could not be found. This looks to be a build layout issue. Further investigation is needed.")
715+
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")
710716
}
711717

712718
override func testSwiftTestSkip() async throws {
713-
throw XCTSkip("SWBINTTODO: This fails due to a linker error on Linux. Further investigation is needed.")
719+
throw XCTSkip("This fails due to a linker error on Linux. https://github.com/swiftlang/swift-package-manager/issues/8439")
714720
}
715721

716722
override func testSwiftTestXMLOutputWhenEmpty() async throws {
717-
throw XCTSkip("SWBINTTODO: This fails due to a linker error on Linux 'undefined reference to main'. Further investigation is needed.")
723+
throw XCTSkip("This fails due to a linker error on Linux. https://github.com/swiftlang/swift-package-manager/issues/8439")
718724
}
719725

720726
override func testSwiftTestFilter() async throws {
721-
throw XCTSkip("SWBINTTODO: This fails due to an unknown linker error on Linux. Further investigation is needed.")
727+
throw XCTSkip("This fails due to an unknown linker error on Linux. https://github.com/swiftlang/swift-package-manager/issues/8439")
722728
}
723729

724730
override func testSwiftTestParallel() async throws {
725-
throw XCTSkip("SWBINTTODO: This fails due to the test expecting specific test output that appears to be empty on Linux. Further investigation is needed.")
731+
throw XCTSkip("This fails due to an unknown linker error on Linux. https://github.com/swiftlang/swift-package-manager/issues/8439")
726732
}
727733
#endif
728734
}

0 commit comments

Comments
 (0)