Skip to content

Commit 538ea33

Browse files
committed
Tests: adjust test for Windows release build
Running the test in release mode on Windows, the block would completely get optimized out and the resulting time slice was 0 per measurement. This would result in the relative standard deviation being undefined, which would render as `nan(ind)%` failing the expectation. Add a sleep to ensure that the block has something to execute.
1 parent 10140f4 commit 538ea33

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Tests/Functional/Performance/main.swift

+3-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ class PerformanceTestCase: XCTestCase {
6565
// CHECK: .*[/\\]Performance[/\\]main.swift:[[@LINE+3]]: Test Case 'PerformanceTestCase.test_printsValuesAfterMeasuring' measured \[Time, seconds\] average: \d+.\d{3}, relative standard deviation: \d+.\d{3}%, values: \[\d+.\d{6}, \d+.\d{6}, \d+.\d{6}, \d+.\d{6}, \d+.\d{6}, \d+.\d{6}, \d+.\d{6}, \d+.\d{6}, \d+.\d{6}, \d+.\d{6}\], performanceMetricID:org.swift.XCTPerformanceMetric_WallClockTime, maxPercentRelativeStandardDeviation: \d+.\d{3}%, maxStandardDeviation: \d.\d{3}
6666
// CHECK: Test Case 'PerformanceTestCase.test_printsValuesAfterMeasuring' passed \(\d+\.\d+ seconds\)
6767
func test_printsValuesAfterMeasuring() {
68-
measure {}
68+
measure {
69+
Thread.sleep(forTimeInterval: 1)
70+
}
6971
}
7072

7173
// CHECK: Test Case 'PerformanceTestCase.test_abortsMeasurementsAfterTestFailure' started at \d+-\d+-\d+ \d+:\d+:\d+\.\d+

0 commit comments

Comments
 (0)