Skip to content

Commit 3a2ab4d

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. (cherry picked from commit ae31314)
1 parent 2107e81 commit 3a2ab4d

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

Sources/_InternalTestSupport/XCTAssertHelpers.swift

Lines changed: 10 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
@@ -318,6 +319,15 @@ public struct CommandExecutionError: Error {
318319
public let stderr: String
319320
}
320321

322+
323+
public func XCTExhibitsGitHubIssue(_ number: Int) throws {
324+
let envVar = "SWIFTCI_EXHIBITS_GH_\(number)"
325+
326+
try XCTSkipIf(
327+
ProcessInfo.processInfo.environment[envVar] != nil,
328+
"https://github.com/swiftlang/swift-package-manager/issues/\(number): \(envVar)environment variable is set"
329+
)
330+
}
321331
/// Skips the test if running on a platform which lacks the ability for build tasks to set a working directory due to lack of requisite system API.
322332
///
323333
/// Presently, relevant platforms include Amazon Linux 2 and OpenBSD.

Tests/CommandsTests/PackageCommandTests.swift

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

0 commit comments

Comments
 (0)