File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
Tests/SwiftFormatPerformanceTests Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -5,11 +5,19 @@ import XCTest
55@_spi ( Testing) import _SwiftFormatTestSupport
66
77final class WhitespaceLinterPerformanceTests : DiagnosingTestCase {
8+ /// When executing in Swift CI, run the block to make sure it doesn't hit any assertions because we don't look at
9+ /// performance numbers in CI and CI nodes can have variable performance characteristics if they are not bare-metal.
10+ ///
11+ /// Anywhere else, run XCTest's `measure` function to measure the performance of the block.
12+ private func measureIfNotInCI( _ block: ( ) -> Void ) {
13+ if ProcessInfo . processInfo. environment [ " SWIFTCI_USE_LOCAL_DEPS " ] != nil {
14+ block ( )
15+ } else {
16+ measure { block ( ) }
17+ }
18+ }
19+
820 func testWhitespaceLinterPerformance( ) throws {
9- #if os(Windows)
10- // https://github.com/swiftlang/swift-format/issues/939
11- throw XCTSkip ( " This test is flaky on Windows " )
12- #endif
1321 let input = String (
1422 repeating: """
1523 import SomeModule
@@ -50,7 +58,7 @@ final class WhitespaceLinterPerformanceTests: DiagnosingTestCase {
5058 count: 20
5159 )
5260
53- measure { performWhitespaceLint ( input: input, expected: expected) }
61+ measureIfNotInCI { performWhitespaceLint ( input: input, expected: expected) }
5462 }
5563
5664 /// Perform whitespace linting by comparing the input text from the user with the expected
You can’t perform that action at this time.
0 commit comments