File tree 1 file changed +13
-5
lines changed
Tests/SwiftFormatPerformanceTests
1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -5,11 +5,19 @@ import XCTest
5
5
@_spi ( Testing) import _SwiftFormatTestSupport
6
6
7
7
final 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
+
8
20
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
13
21
let input = String (
14
22
repeating: """
15
23
import SomeModule
@@ -50,7 +58,7 @@ final class WhitespaceLinterPerformanceTests: DiagnosingTestCase {
50
58
count: 20
51
59
)
52
60
53
- measure { performWhitespaceLint ( input: input, expected: expected) }
61
+ measureIfNotInCI { performWhitespaceLint ( input: input, expected: expected) }
54
62
}
55
63
56
64
/// 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