Skip to content

Commit

Permalink
Update methods used when listing tests
Browse files Browse the repository at this point in the history
Summary: The methods "writeData:" and "closeFile" have been deprecated, replaced with "writeData:error:" and "closeAndReturnError:" respectively. This may be impacting the listing issues people have been having, which is really due to reading an empty JSON file that should contain the list of tests for a target.

Differential Revision: D64705885

fbshipit-source-id: d898f64df61f3797a30410f302aaa7af5d86f266
  • Loading branch information
Abrar Ahmed authored and facebook-github-bot committed Oct 22, 2024
1 parent 7385ce7 commit be053d3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Shims/Shimulator/TestReporterShim/XCTestReporterShim.m
Original file line number Diff line number Diff line change
Expand Up @@ -629,11 +629,13 @@ static void listBundle(NSString *testBundlePath, NSString *outputFile)
}];
NSError *error = nil;
NSData *output = [NSJSONSerialization dataWithJSONObject:testsToReport options:0 error:&error];
NSCAssert(output, @"Failed to generate list test JSON", error);
[fileHandle writeData:output];
NSCAssert(output, @"Failed to generate test list JSON", error);
bool fileWrittenSuccessfully = [fileHandle writeData:output error:&error];
NSCAssert(fileWrittenSuccessfully, @"Failed to write test list to file", error);

// Close the file so the other end knows this is the end of the input.
[fileHandle closeFile];
bool fileClosedSuccessfully = [fileHandle closeAndReturnError:&error];
NSCAssert(fileClosedSuccessfully, @"Failed to close file with test list", error);
exit(TestShimExitCodeSuccess);
}

Expand Down

0 comments on commit be053d3

Please sign in to comment.