@@ -65,6 +65,7 @@ extension XCTestCase {
6565 Thread . sleep ( forTimeInterval: 2.0 )
6666 }
6767
68+ #if canImport(Darwin)
6869 func induceThermalRange( _ range: ClosedRange < Int > ) {
6970 var temperature : Int
7071 repeat {
@@ -99,6 +100,7 @@ extension XCTestCase {
99100 return nil
100101 }
101102 } ( )
103+ #endif
102104
103105 private static let measurementsLogFile : String ? = {
104106 UserDefaults . standard. string ( forKey: " TestMeasurementLogPath " )
@@ -149,10 +151,14 @@ extension XCTestCase {
149151 let logFD = tryOrFailTest ( try Self . openPerformanceLog ( ) , message: " Failed to open performance log " )
150152 var timings = Timings ( )
151153 for iteration in 0 ..< iterations {
154+ #if canImport(Darwin)
152155 if let targetThermalRange = Self . targetThermalRange {
153156 induceThermalRange ( targetThermalRange)
154157 }
155158 let thermalLevel = ProcessInfo . processInfo. thermalLevel ( )
159+ #else
160+ let thermalLevel = " unknown "
161+ #endif
156162 let duration = duration ( of: body)
157163 let stats = timings. append ( duration)
158164 let confidence = timings. confidenceOfMean_95Percent
@@ -174,6 +180,7 @@ extension XCTestCase {
174180 }
175181}
176182
183+ #if canImport(Darwin)
177184extension ProcessInfo {
178185 func thermalLevel( ) -> Int {
179186 var thermalLevel : UInt64 = 0
@@ -182,6 +189,7 @@ extension ProcessInfo {
182189 return Int ( thermalLevel)
183190 }
184191}
192+ #endif
185193
186194extension String {
187195 fileprivate func dropSuffix( _ suffix: String ) -> String {
0 commit comments