@@ -65,6 +65,7 @@ extension XCTestCase {
65
65
Thread . sleep ( forTimeInterval: 2.0 )
66
66
}
67
67
68
+ #if canImport(Darwin)
68
69
func induceThermalRange( _ range: ClosedRange < Int > ) {
69
70
var temperature : Int
70
71
repeat {
@@ -99,6 +100,7 @@ extension XCTestCase {
99
100
return nil
100
101
}
101
102
} ( )
103
+ #endif
102
104
103
105
private static let measurementsLogFile : String ? = {
104
106
UserDefaults . standard. string ( forKey: " TestMeasurementLogPath " )
@@ -149,10 +151,14 @@ extension XCTestCase {
149
151
let logFD = tryOrFailTest ( try Self . openPerformanceLog ( ) , message: " Failed to open performance log " )
150
152
var timings = Timings ( )
151
153
for iteration in 0 ..< iterations {
154
+ #if canImport(Darwin)
152
155
if let targetThermalRange = Self . targetThermalRange {
153
156
induceThermalRange ( targetThermalRange)
154
157
}
155
158
let thermalLevel = ProcessInfo . processInfo. thermalLevel ( )
159
+ #else
160
+ let thermalLevel = " unknown "
161
+ #endif
156
162
let duration = duration ( of: body)
157
163
let stats = timings. append ( duration)
158
164
let confidence = timings. confidenceOfMean_95Percent
@@ -174,6 +180,7 @@ extension XCTestCase {
174
180
}
175
181
}
176
182
183
+ #if canImport(Darwin)
177
184
extension ProcessInfo {
178
185
func thermalLevel( ) -> Int {
179
186
var thermalLevel : UInt64 = 0
@@ -182,6 +189,7 @@ extension ProcessInfo {
182
189
return Int ( thermalLevel)
183
190
}
184
191
}
192
+ #endif
185
193
186
194
extension String {
187
195
fileprivate func dropSuffix( _ suffix: String ) -> String {
0 commit comments