Skip to content

Commit

Permalink
Fix Race in ListTestRunner
Browse files Browse the repository at this point in the history
Summary:
This serializes all calls on the same queue otherwise this crash happens:

```
  0   CoreFoundation                      0x00007fffbd8946fb __exceptionPreprocess + 171
  1   libobjc.A.dylib                     0x00007fffd2238a2a objc_exception_throw + 48
  2   CoreFoundation                      0x00007fffbd911656 __NSFastEnumerationMutationHandler + 294
  3   CoreFoundation                      0x00007fffbd80219f -[NSArray componentsJoinedByString:] + 399
  4   fbxctest                            0x00000001092d5792 -[FBJSONTestReporter handleExternalEvent:] + 242
  5   fbxctest                            0x00000001092d9c2f __39-[FBLogicTestRunner runTestsWithError:]_block_invoke + 463
  6   fbxctest                            0x00000001093ab3a4 __38-[FBLineFileDataConsumer consumeData:]_block_invoke + 36
```

Reviewed By: nqmtuan

Differential Revision: D4231420

fbshipit-source-id: 9cff2b5c8f288e944657d33d21ebab59456ece3a
  • Loading branch information
lawrencelomax authored and Facebook Github Bot committed Nov 24, 2016
1 parent 4758272 commit f0cc887
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fbxctest/FBXCTestKit/Runners/FBLogicTestRunner.m
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ - (BOOL)runTestsWithError:(NSError **)error

FBMultiFileReader *multiReader = [FBMultiFileReader new];

FBLineFileDataConsumer *otestLineReader = [FBLineFileDataConsumer lineReaderWithConsumer:^(NSString *line){
dispatch_queue_t consumerQueue = dispatch_get_main_queue();
FBLineFileDataConsumer *otestLineReader = [FBLineFileDataConsumer lineReaderWithQueue:consumerQueue consumer:^(NSString *line){
if ([line length] == 0) {
return;
}
Expand All @@ -117,7 +118,7 @@ - (BOOL)runTestsWithError:(NSError **)error
return NO;
}

FBLineFileDataConsumer *testOutputLineReader = [FBLineFileDataConsumer lineReaderWithConsumer:^(NSString *line){
FBLineFileDataConsumer *testOutputLineReader = [FBLineFileDataConsumer lineReaderWithQueue:consumerQueue consumer:^(NSString *line){
[self.configuration.reporter testHadOutput:[line stringByAppendingString:@"\n"]];
}];
if (![multiReader addFileHandle:testOutputPipe.fileHandleForReading withConsumer:testOutputLineReader error:error]) {
Expand Down

0 comments on commit f0cc887

Please sign in to comment.