@@ -221,21 +221,34 @@ final class CrashRecoveryTests: XCTestCase {
221
221
222
222
let clangdCrashed = self . expectation ( description: " clangd crashed " )
223
223
clangdCrashed. assertForOverFulfill = false
224
+ // assertForOverFulfill is not working on Linux (SR-12575). Manually keep track if we have already called fulfill on the expectation
225
+ var clangdCrashedFulfilled = false
226
+
224
227
let clangdRestartedFirstTime = self . expectation ( description: " clangd restarted for the first time " )
228
+
225
229
let clangdRestartedSecondTime = self . expectation ( description: " clangd restarted for the second time " )
226
230
clangdRestartedSecondTime. assertForOverFulfill = false
231
+ // assertForOverFulfill is not working on Linux (SR-12575). Manually keep track if we have already called fulfill on the expectation
232
+ var clangdRestartedSecondTimeFulfilled = false
233
+
227
234
var clangdHasRestartedFirstTime = false
228
235
229
236
clangdServer. addStateChangeHandler { ( oldState, newState) in
230
237
switch newState {
231
238
case . connectionInterrupted:
232
- clangdCrashed. fulfill ( )
239
+ if !clangdCrashedFulfilled {
240
+ clangdCrashed. fulfill ( )
241
+ clangdCrashedFulfilled = true
242
+ }
233
243
case . connected:
234
244
if !clangdHasRestartedFirstTime {
235
245
clangdRestartedFirstTime. fulfill ( )
236
246
clangdHasRestartedFirstTime = true
237
247
} else {
238
- clangdRestartedSecondTime. fulfill ( )
248
+ if !clangdRestartedSecondTimeFulfilled {
249
+ clangdRestartedSecondTime. fulfill ( )
250
+ clangdRestartedSecondTimeFulfilled = true
251
+ }
239
252
}
240
253
default :
241
254
break
0 commit comments