Skip to content

Commit

Permalink
Revert "Attempt solution at a custom XFail for XCTest.."
Browse files Browse the repository at this point in the history
This reverts commit 3e06c8f497b33b24aefc18290d9226dea01525e6.
  • Loading branch information
bkhouri committed Mar 3, 2025
1 parent f3625a8 commit b14a7e1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 100 deletions.
30 changes: 0 additions & 30 deletions Sources/_InternalTestSupport/Commands.swift
Original file line number Diff line number Diff line change
@@ -1,38 +1,8 @@
import SPMBuildCore
import XCTest

public struct XFailCaseName {
let testName: String
let reason: String

public init(_ testName: String, because reason: String) {
self.testName = testName
self.reason = reason
}
}
open class BuildSystemProviderTestCase: XCTestCase {
open var buildSystemProvider: BuildSystemProvider.Kind {
fatalError("\(self) does not implement \(#function)")
}

open var xFailTestCaseNames: [XFailCaseName] {
return []
}

override open func recordFailure(withDescription description: String, inFile filePath: String, atLine lineNumber: Int, expected: Bool) {
// Get current test name:
print("--->> In recordFailure: Test name is >>>\(self.name)<<<")

if self.xFailTestCaseNames.map({ item in item.testName }).contains(self.name) {
// do nothing
print("--->> In recordFailure: Test name is >>>\(self.name)<<< is expected to fail, so mark as passed!!")
} else {
super.recordFailure(
withDescription: description,
inFile: filePath,
atLine: lineNumber,
expected: expected
)
}
}
}
29 changes: 6 additions & 23 deletions Tests/BuildTests/BuildPlanTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6880,34 +6880,17 @@ class BuildPlanSwiftBuildTests: BuildPlanTestCase {
return .swiftbuild
}

override open var xFailTestCaseNames: [XFailCaseName] {
return [
XFailCaseName(
String(describing: testDuplicateProductNamesWithNonDefaultLibsThrowError.self),
because: "This test is not expected to fail.. it should pass.",
),
XFailCaseName(
String(describing: testTargetsWithPackageAccess.self),
because: "Skip until swift build system can support this case",
),
// XFailCaseName(
// String(describing: testTestModule.self),
// because: "Skip until swift build system can support this case."
// )
]
}

override func testDuplicateProductNamesWithNonDefaultLibsThrowError() async throws {
try await super.testDuplicateProductNamesWithNonDefaultLibsThrowError()
}

// override func testTargetsWithPackageAccess() async throws {
// throw XCTSkip("Skip until swift build system can support this case.")
// }
override func testTargetsWithPackageAccess() async throws {
throw XCTSkip("Skip until swift build system can support this case.")
}

// override func testTestModule() async throws {
// throw XCTSkip("Skip until swift build system can support this case.")
// }
override func testTestModule() async throws {
throw XCTSkip("Skip until swift build system can support this case.")
}

override func testPackageNameFlag() async throws {
#if os(Windows)
Expand Down
65 changes: 18 additions & 47 deletions Tests/CommandsTests/RunCommandTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import XCTest

import class Basics.AsyncProcess

class RunCommandTestCase: CommandsBuildProviderTestCase {
class RunCommandTestCase: BuildSystemProviderTestCase {
override func setUpWithError() throws {
try XCTSkipIf(type(of: self) == RunCommandTestCase.self, "Pay no attention to the class behind the curtain.")
}
Expand Down Expand Up @@ -291,57 +291,28 @@ class RunCommandSwiftBuildTests: RunCommandTestCase {
try await super.testUsage()
}

override open var xFailTestCaseNames: [XFailCaseName] {
return [
XFailCaseName(
String(describing: testMultipleExecutableAndExplicitExecutable.self),
because: "https://github.com/swiftlang/swift-package-manager/issues/8279: Swift run using Swift Build does not output executable content to the terminal",
),
XFailCaseName(
String(describing: testUnknownProductAndArgumentPassing.self),
because: "https://github.com/swiftlang/swift-package-manager/issues/8279: Swift run using Swift Build does not output executable content to the terminal",
),
XFailCaseName(
String(describing: testPackageWithExcutableTargetsContainsPlatformConditionalsBuildsSuccessfullyInDebugConfig.self),
because: "Test fixture fails to build",
),
XFailCaseName(
String(describing: testPackageWithExcutableTargetsContainsPlatformConditionalsBuildsSuccessfullyInReleaseConfig.self),
because: "Test fixture fails to build",
),
XFailCaseName(
String(describing: testToolsetDebugger.self),
because: "Test fixture fails to build",
),
XFailCaseName(
String(describing: testUnreachableExecutable.self),
because: "Need to investigate test failure",
),
]
override func testMultipleExecutableAndExplicitExecutable() async throws {
try XCTSkip("https://github.com/swiftlang/swift-package-manager/issues/8279: Swift run using Swift Build does not output executable content to the terminal")
}

// override func testMultipleExecutableAndExplicitExecutable() async throws {
// try XCTSkip("https://github.com/swiftlang/swift-package-manager/issues/8279: Swift run using Swift Build does not output executable content to the terminal")
// }

// override func testUnknownProductAndArgumentPassing() async throws {
// try XCTSkip("https://github.com/swiftlang/swift-package-manager/issues/8279: Swift run using Swift Build does not output executable content to the terminal")
// }
override func testUnknownProductAndArgumentPassing() async throws {
try XCTSkip("https://github.com/swiftlang/swift-package-manager/issues/8279: Swift run using Swift Build does not output executable content to the terminal")
}

// override func testPackageWithExcutableTargetsContainsPlatformConditionalsBuildsSuccessfullyInDebugConfig() async throws {
// try XCTSkip("Test fixture fails to build")
// }
override func testPackageWithExcutableTargetsContainsPlatformConditionalsBuildsSuccessfullyInDebugConfig() async throws {
try XCTSkip("Test fixture fails to build")
}

// override func testPackageWithExcutableTargetsContainsPlatformConditionalsBuildsSuccessfullyInReleaseConfig() async throws {
// try XCTSkip("Test fixture fails to build")
// }
override func testPackageWithExcutableTargetsContainsPlatformConditionalsBuildsSuccessfullyInReleaseConfig() async throws {
try XCTSkip("Test fixture fails to build")
}

// override func testToolsetDebugger() async throws {
// try XCTSkip("Test fixture fails to build")
// }
override func testToolsetDebugger() async throws {
try XCTSkip("Test fixture fails to build")
}

// override func testUnreachableExecutable() async throws {
// try XCTSkip("Need to investigate test failure")
// }
override func testUnreachableExecutable() async throws {
try XCTSkip("Need to investigate test failure")
}

}

0 comments on commit b14a7e1

Please sign in to comment.