Skip to content

Commit 8c28054

Browse files
committed
Tests: Add "XCTSkipExhibits" call
A test fails in certain CI environmnents. Introduce an `XCTExhibit...` call that would skip a test if an environment variable is set.
1 parent d8cec15 commit 8c28054

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Sources/_InternalTestSupport/XCTAssertHelpers.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13+
import class Foundation.ProcessInfo
1314
import Basics
1415
#if os(macOS)
1516
import class Foundation.Bundle
@@ -322,3 +323,13 @@ public struct CommandExecutionError: Error {
322323
public let stdout: String
323324
public let stderr: String
324325
}
326+
327+
328+
public func XCTExhibitsGitHubIssue(_ number: Int) throws {
329+
let envVar = "SWIFTCI_EXHIBITS_GH_\(number)"
330+
331+
try XCTSkipIf(
332+
ProcessInfo.processInfo.environment[envVar] != nil,
333+
"https://github.com/swiftlang/swift-package-manager/issues/\(number): \(envVar)environment variable is set"
334+
)
335+
}

Tests/CommandsTests/PackageCommandTests.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4091,4 +4091,9 @@ class PackageCommandSwiftBuildTests: PackageCommandTestCase {
40914091
try XCTSkipOnWindows(because: "TSCBasic/Path.swift:969: Assertion failed, https://github.com/swiftlang/swift-package-manager/issues/8602")
40924092
try await super.testCommandPluginTargetBuilds()
40934093
}
4094+
4095+
override func testCommandPluginPermissions() async throws {
4096+
try XCTExhibitsGitHubIssue(8782)
4097+
try await super.testCommandPluginPermissions()
4098+
}
40944099
}

0 commit comments

Comments
 (0)