From 7385ce7696fc5e3b9c60825da68bc02df1be28f5 Mon Sep 17 00:00:00 2001 From: Abrar Ahmed Date: Fri, 18 Oct 2024 04:06:18 -0700 Subject: [PATCH] Add logging to debug failed listing due to invalid format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Many tests are failing due to the error "Failed to list tests". Logs include the error "The data couldn’t be read because it isn’t in the correct format." This diff adds logs to see when a test should be added to the listing, and if the listing fails, what the description of the data that should contain the test listing entails. Reviewed By: lawrencelomax Differential Revision: D64563764 fbshipit-source-id: e2d75d9935730b205a8d73371ac04c692d832ed9 --- .../TestReporterShim/XCTestReporterShim.m | 1 + XCTestBootstrap/Strategies/FBListTestStrategy.m | 15 ++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Shims/Shimulator/TestReporterShim/XCTestReporterShim.m b/Shims/Shimulator/TestReporterShim/XCTestReporterShim.m index ca9d5eb49..9c549927f 100644 --- a/Shims/Shimulator/TestReporterShim/XCTestReporterShim.m +++ b/Shims/Shimulator/TestReporterShim/XCTestReporterShim.m @@ -614,6 +614,7 @@ static void listBundle(NSString *testBundlePath, NSString *outputFile) NSString *testKey = nil; parseXCTestCase(testCase, &className, &methodName, &testKey); NSString *legacyTestName = [NSString stringWithFormat:@"%@/%@", className, methodName]; + NSLog(@"Found test: %@", legacyTestName); [testsToReport addObject:@{ kReporter_ListTest_LegacyTestNameKey: legacyTestName, kReporter_ListTest_ClassNameKey: className, diff --git a/XCTestBootstrap/Strategies/FBListTestStrategy.m b/XCTestBootstrap/Strategies/FBListTestStrategy.m index cb0fe55a2..88fa34c72 100644 --- a/XCTestBootstrap/Strategies/FBListTestStrategy.m +++ b/XCTestBootstrap/Strategies/FBListTestStrategy.m @@ -38,10 +38,10 @@ - (instancetype)initWithStrategy:(FBListTestStrategy *)strategy reporter:(id * (NSArray *libraries){ NSDictionary *environment = [FBListTestStrategy setupEnvironmentWithDylibs:libraries shimPath:shimPath shimOutputFilePath:shimOutput.filePath bundlePath:self.configuration.testBundlePath]; - + return [[FBListTestStrategy listTestProcessWithTarget:self.target configuration:self.configuration @@ -171,6 +171,7 @@ - (instancetype)initWithTarget:(id *> *tests = [NSJSONSerialization JSONObjectWithData:shimBuffer.data options:0 error:&error]; if (!tests) { + NSLog(@"Shimulator buffer data (should contain test information): %@", shimBuffer.data); return [FBFuture futureWithError:error]; } NSMutableArray *testNames = [NSMutableArray array]; @@ -211,7 +212,7 @@ - (instancetype)initWithTarget:(id