@@ -201,7 +201,12 @@ describe("DocumentLinter", () => {
201
201
202
202
let coinFlips ;
203
203
let rng = new ExhaustiveRNG ( ) ;
204
- qljs . maybeInjectFault = ( functionName ) => {
204
+ let crashedProcesses = new Set ( ) ;
205
+ qljs . maybeInjectFault = ( process , functionName ) => {
206
+ assert . ok (
207
+ ! crashedProcesses . has ( process ) ,
208
+ "Should not use previously-crashed process"
209
+ ) ;
205
210
// TODO(strager): Figure out why qljs_vscode_create_document failures
206
211
// cause this test to fail.
207
212
// TODO(strager): Fix problems when qljs_vscode_destroy_document fails.
@@ -212,6 +217,7 @@ describe("DocumentLinter", () => {
212
217
let shouldCrash = rng . nextCoinFlip ( ) ;
213
218
coinFlips . push ( shouldCrash ) ;
214
219
if ( shouldCrash ) {
220
+ crashedProcesses . add ( process ) ;
215
221
throw new ProcessCrashed ( "(injected fault)" ) ;
216
222
}
217
223
}
@@ -268,6 +274,8 @@ describe("DocumentLinter", () => {
268
274
269
275
console . log ( `coinFlips: ${ coinFlips } ` ) ;
270
276
rng . lap ( ) ;
277
+
278
+ crashedProcesses . clear ( ) ; // Avoid out-of-memory errors.
271
279
}
272
280
273
281
async function didLintingCrashAsync ( callback ) {
@@ -287,12 +295,18 @@ describe("DocumentLinter", () => {
287
295
it ( "concurrent edits are applied in order of calls, with exhaustive fault injection" , async ( ) => {
288
296
let coinFlips ;
289
297
let rng = new ExhaustiveRNG ( ) ;
290
- function maybeInjectFaultWithExhaustiveRNG ( functionName ) {
298
+ let crashedProcesses = new Set ( ) ;
299
+ function maybeInjectFaultWithExhaustiveRNG ( process , functionName ) {
300
+ assert . ok (
301
+ ! crashedProcesses . has ( process ) ,
302
+ "Should not use previously-crashed process"
303
+ ) ;
291
304
// TODO(strager): Fix problems when qljs_vscode_destroy_document fails.
292
305
if ( functionName != "qljs_vscode_destroy_document" ) {
293
306
let shouldCrash = rng . nextCoinFlip ( ) ;
294
307
coinFlips . push ( shouldCrash ) ;
295
308
if ( shouldCrash ) {
309
+ crashedProcesses . add ( process ) ;
296
310
throw new qljs . ProcessCrashed ( "(injected fault)" ) ;
297
311
}
298
312
}
@@ -362,6 +376,8 @@ describe("DocumentLinter", () => {
362
376
console . log ( `coinFlips: ${ coinFlips } ` ) ;
363
377
rng . lap ( ) ;
364
378
qljs . maybeInjectFault = originalMaybeInjectFault ;
379
+
380
+ crashedProcesses . clear ( ) ; // Avoid out-of-memory errors.
365
381
}
366
382
} ) ;
367
383
} ) ;
0 commit comments