From c36a41770ed0d3d2682f3de3208b09b67e7876db Mon Sep 17 00:00:00 2001 From: Paul Beusterien Date: Mon, 1 Dec 2025 17:53:46 -0800 Subject: [PATCH 1/6] [Crashlyics] Address some Crashlytics flakes and disable others in nightlies --- .github/workflows/common.yml | 9 ++ .github/workflows/crashlytics.yml | 1 + .../UnitTests/FIRCLSContextManagerTests.m | 4 + .../FIRCLSExistingReportManagerTests.m | 3 +- .../UnitTests/FIRCLSReportUploaderTests.m | 3 + .../UnitTests/FIRCLSUserDefaultsTests.m | 3 + .../UnitTests/Mocks/FIRCLSMockFileManager.h | 9 +- .../UnitTests/Mocks/FIRCLSMockFileManager.m | 93 +++++++++++-------- Package.swift | 72 +++++++++----- 9 files changed, 134 insertions(+), 63 deletions(-) diff --git a/.github/workflows/common.yml b/.github/workflows/common.yml index 4af29b0f68b..1de6102e1b6 100644 --- a/.github/workflows/common.yml +++ b/.github/workflows/common.yml @@ -52,6 +52,12 @@ on: required: false default: "" + # An environment variable to be set for the test run. + env_var: + type: string + required: false + default: "" + outputs: cache_key: description: "The cache key for the Swift package resolution." @@ -105,6 +111,9 @@ jobs: with: path: .build key: ${{needs.spm-package-resolved.outputs.cache_key}} + - name: Set nightly env var + if: inputs.env_var != '' + run: echo "${{ inputs.env_var }}=1" >> $GITHUB_ENV - name: Xcode run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer - name: Run setup command, if needed. diff --git a/.github/workflows/crashlytics.yml b/.github/workflows/crashlytics.yml index 3969c1eb223..60599d17c3a 100644 --- a/.github/workflows/crashlytics.yml +++ b/.github/workflows/crashlytics.yml @@ -30,6 +30,7 @@ jobs: uses: ./.github/workflows/common.yml with: target: FirebaseCrashlyticsUnit + env_var: ${{ github.event_name == 'schedule' && 'CRASHLYTICS_NIGHTLY' || '' }} catalyst: uses: ./.github/workflows/common_catalyst.yml diff --git a/Crashlytics/UnitTests/FIRCLSContextManagerTests.m b/Crashlytics/UnitTests/FIRCLSContextManagerTests.m index f4c863b05a5..a0cfc1af74d 100644 --- a/Crashlytics/UnitTests/FIRCLSContextManagerTests.m +++ b/Crashlytics/UnitTests/FIRCLSContextManagerTests.m @@ -42,6 +42,10 @@ @implementation FIRCLSContextManagerTests - (void)setUp { self.fileManager = [[FIRCLSMockFileManager alloc] init]; + [[NSFileManager defaultManager] createDirectoryAtPath:self.fileManager.rootPath + withIntermediateDirectories:YES + attributes:nil + error:nil]; [self.fileManager createReportDirectories]; [self.fileManager setupNewPathForExecutionIdentifier:TestContextReportID]; diff --git a/Crashlytics/UnitTests/FIRCLSExistingReportManagerTests.m b/Crashlytics/UnitTests/FIRCLSExistingReportManagerTests.m index ce073a8914b..265290f3307 100644 --- a/Crashlytics/UnitTests/FIRCLSExistingReportManagerTests.m +++ b/Crashlytics/UnitTests/FIRCLSExistingReportManagerTests.m @@ -54,10 +54,11 @@ - (void)setUp { self.fileManager = [[FIRCLSTempMockFileManager alloc] init]; - // Cleanup potential artifacts from other test files. + // Clean up the directory and then re-create it to ensure a fresh state if ([[NSFileManager defaultManager] fileExistsAtPath:[self.fileManager rootPath]]) { assert([self.fileManager removeItemAtPath:[self.fileManager rootPath]]); } + [self.fileManager createReportDirectories]; // Allow nil values only in tests #pragma clang diagnostic push diff --git a/Crashlytics/UnitTests/FIRCLSReportUploaderTests.m b/Crashlytics/UnitTests/FIRCLSReportUploaderTests.m index 4dbca18e44c..7e9862d2832 100644 --- a/Crashlytics/UnitTests/FIRCLSReportUploaderTests.m +++ b/Crashlytics/UnitTests/FIRCLSReportUploaderTests.m @@ -284,6 +284,9 @@ - (void)runUploadPackagedReportWithUrgency:(BOOL)urgent { asUrgent:urgent]; XCTAssertNotNil(self.mockDataTransport.sendDataEvent_event); + + // Wait a little bit for the file to be removed. + [NSRunLoop.currentRunLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; XCTAssertEqualObjects(self.fileManager.removedItemAtPath_path, [self packagePath]); } diff --git a/Crashlytics/UnitTests/FIRCLSUserDefaultsTests.m b/Crashlytics/UnitTests/FIRCLSUserDefaultsTests.m index e310d85121c..2fcf0b6aed9 100644 --- a/Crashlytics/UnitTests/FIRCLSUserDefaultsTests.m +++ b/Crashlytics/UnitTests/FIRCLSUserDefaultsTests.m @@ -53,6 +53,9 @@ - (void)setUp { - (void)tearDown { [_userDefaults removeAllObjects]; + [[NSUserDefaults standardUserDefaults] removeObjectForKey:_testKey1]; + [[NSUserDefaults standardUserDefaults] removeObjectForKey:_testKey2]; + [[NSUserDefaults standardUserDefaults] removeObjectForKey:_testKey3]; [super tearDown]; } diff --git a/Crashlytics/UnitTests/Mocks/FIRCLSMockFileManager.h b/Crashlytics/UnitTests/Mocks/FIRCLSMockFileManager.h index 3bff289bf03..86382211da1 100644 --- a/Crashlytics/UnitTests/Mocks/FIRCLSMockFileManager.h +++ b/Crashlytics/UnitTests/Mocks/FIRCLSMockFileManager.h @@ -16,14 +16,17 @@ #import -@interface FIRCLSMockFileManager : FIRCLSFileManager +// Notification posted when an item is removed via `removeItemAtPath`. +extern NSNotificationName const FIRCLSMockFileManagerDidRemoveItemNotification; -// Number of calls to removeItemAtPath are expected for the unit test -@property(nonatomic) NSInteger expectedRemoveCount; +@interface FIRCLSMockFileManager : FIRCLSFileManager // Incremented when a remove happens with removeItemAtPath @property(nonatomic) NSInteger removeCount; +// Number of calls to removeItemAtPath are expected for the unit test +@property(nonatomic) NSInteger expectedRemoveCount; + // Will be fulfilled when the expected number of removes have happened // using removeItemAtPath // diff --git a/Crashlytics/UnitTests/Mocks/FIRCLSMockFileManager.m b/Crashlytics/UnitTests/Mocks/FIRCLSMockFileManager.m index b89d05bbff8..2c37549503f 100644 --- a/Crashlytics/UnitTests/Mocks/FIRCLSMockFileManager.m +++ b/Crashlytics/UnitTests/Mocks/FIRCLSMockFileManager.m @@ -14,6 +14,9 @@ #import "Crashlytics/UnitTests/Mocks/FIRCLSMockFileManager.h" +NSNotificationName const FIRCLSMockFileManagerDidRemoveItemNotification = + @"FIRCLSMockFileManagerDidRemoveItemNotification"; + @interface FIRCLSMockFileManager () @property(nonatomic) NSMutableDictionary *fileSystemDict; @@ -34,68 +37,82 @@ - (instancetype)init { } - (BOOL)removeItemAtPath:(NSString *)path { - [self.fileSystemDict removeObjectForKey:path]; - - self.removeCount += 1; - - // If we set up the expectation, and we went over the expected count or removes, fulfill the - // expectation - if (self.removeExpectation && self.removeCount >= self.expectedRemoveCount) { - [self.removeExpectation fulfill]; + @synchronized(self) { + [self.fileSystemDict removeObjectForKey:path]; + self.removeCount += 1; + + // If we set up the expectation, and we went over the expected count or removes, fulfill the + // expectation + if (self.removeExpectation && self.removeCount >= self.expectedRemoveCount) { + [self.removeExpectation fulfill]; + } } + [[NSNotificationCenter defaultCenter] + postNotificationName:FIRCLSMockFileManagerDidRemoveItemNotification + object:self]; + return YES; } - (BOOL)fileExistsAtPath:(NSString *)path { - return self.fileSystemDict[path] != nil; + @synchronized(self) { + return self.fileSystemDict[path] != nil; + } } - (BOOL)createFileAtPath:(NSString *)path contents:(NSData *)data attributes:(NSDictionary *)attr { - self.fileSystemDict[path] = data; + @synchronized(self) { + self.fileSystemDict[path] = data; + } return YES; } - (NSArray *)activePathContents { - NSMutableArray *pathsWithActive = [[NSMutableArray alloc] init]; - for (NSString *path in [_fileSystemDict allKeys]) { - if ([path containsString:@"v5/reports/active"]) { - [pathsWithActive addObject:path]; + @synchronized(self) { + NSMutableArray *pathsWithActive = [[NSMutableArray alloc] init]; + for (NSString *path in [_fileSystemDict allKeys]) { + if ([path containsString:@"v5/reports/active"]) { + [pathsWithActive addObject:path]; + } } + return pathsWithActive; } - - return pathsWithActive; } - (NSData *)dataWithContentsOfFile:(NSString *)path { - return self.fileSystemDict[path]; + @synchronized(self) { + return self.fileSystemDict[path]; + } } - (void)enumerateFilesInDirectory:(NSString *)directory usingBlock:(void (^)(NSString *filePath, NSString *extension))block { - NSArray *filteredPaths = [self.fileSystemDict.allKeys - filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(NSString *path, - NSDictionary *bindings) { - return [path hasPrefix:directory]; - }]]; - - for (NSString *path in filteredPaths) { - NSString *extension; - NSString *fullPath; - - // Skip files that start with a dot. This is important, because if you try to move a .DS_Store - // file, it will fail if the target directory also has a .DS_Store file in it. Plus, its - // wasteful, because we don't care about dot files. - if ([path hasPrefix:@"."]) { - continue; - } - - extension = [path pathExtension]; - fullPath = [directory stringByAppendingPathComponent:path]; - if (block) { - block(fullPath, extension); + @synchronized(self) { + NSArray *filteredPaths = [self.fileSystemDict.allKeys + filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(NSString *path, + NSDictionary *bindings) { + return [path hasPrefix:directory]; + }]]; + + for (NSString *path in filteredPaths) { + NSString *extension; + NSString *fullPath; + + // Skip files that start with a dot. This is important, because if you try to move a + // .DS_Store file, it will fail if the target directory also has a .DS_Store file in + // it. Plus, it's wasteful, because we don't care about dot files. + if ([path hasPrefix:@"."]) { + continue; + } + + extension = [path pathExtension]; + fullPath = [directory stringByAppendingPathComponent:path]; + if (block) { + block(fullPath, extension); + } } } } diff --git a/Package.swift b/Package.swift index 41afc02d1b4..79f6beb2627 100644 --- a/Package.swift +++ b/Package.swift @@ -626,27 +626,7 @@ let package = Package( .swiftLanguageMode(SwiftLanguageMode.v5), ] ), - .testTarget( - name: "FirebaseCrashlyticsUnit", - dependencies: ["FirebaseCrashlytics", .product(name: "OCMock", package: "ocmock")], - path: "Crashlytics/UnitTests", - resources: [ - .copy("FIRCLSMachO/machO_data"), - .copy("Data"), - ], - cSettings: [ - .headerSearchPath("../.."), - .define("DISPLAY_VERSION", to: firebaseVersion), - .define("CLS_SDK_NAME", to: "Crashlytics iOS SDK", .when(platforms: [.iOS])), - .define( - "CLS_SDK_NAME", - to: "Crashlytics macOS SDK", - .when(platforms: [.macOS, .macCatalyst]) - ), - .define("CLS_SDK_NAME", to: "Crashlytics tvOS SDK", .when(platforms: [.tvOS])), - .define("CLS_SDK_NAME", to: "Crashlytics watchOS SDK", .when(platforms: [.watchOS])), - ] - ), + crashlyticsUnitTestChooser(), .target( name: "FirebaseDatabaseInternal", dependencies: [ @@ -1467,6 +1447,56 @@ func firestoreWrapperTarget() -> Target { ) } +func crashlyticsUnitTestChooser() -> Target { + // Don't run flaky tests in nightly runs. + if Context.environment["CRASHLYTICS_NIGHTLY"] != nil { + return .testTarget( + name: "FirebaseCrashlyticsUnit", + dependencies: ["FirebaseCrashlytics", .product(name: "OCMock", package: "ocmock")], + path: "Crashlytics/UnitTests", + exclude: ["FIRCrashlyticsReportTests.m"], // Flaky + resources: [ + .copy("FIRCLSMachO/machO_data"), + .copy("Data"), + ], + cSettings: [ + .headerSearchPath("../.."), + .define("DISPLAY_VERSION", to: firebaseVersion), + .define("CLS_SDK_NAME", to: "Crashlytics iOS SDK", .when(platforms: [.iOS])), + .define( + "CLS_SDK_NAME", + to: "Crashlytics macOS SDK", + .when(platforms: [.macOS, .macCatalyst]) + ), + .define("CLS_SDK_NAME", to: "Crashlytics tvOS SDK", .when(platforms: [.tvOS])), + .define("CLS_SDK_NAME", to: "Crashlytics watchOS SDK", .when(platforms: [.watchOS])), + ] + ) + } else { + return .testTarget( + name: "FirebaseCrashlyticsUnit", + dependencies: ["FirebaseCrashlytics", .product(name: "OCMock", package: "ocmock")], + path: "Crashlytics/UnitTests", + resources: [ + .copy("FIRCLSMachO/machO_data"), + .copy("Data"), + ], + cSettings: [ + .headerSearchPath("../.."), + .define("DISPLAY_VERSION", to: firebaseVersion), + .define("CLS_SDK_NAME", to: "Crashlytics iOS SDK", .when(platforms: [.iOS])), + .define( + "CLS_SDK_NAME", + to: "Crashlytics macOS SDK", + .when(platforms: [.macOS, .macCatalyst]) + ), + .define("CLS_SDK_NAME", to: "Crashlytics tvOS SDK", .when(platforms: [.tvOS])), + .define("CLS_SDK_NAME", to: "Crashlytics watchOS SDK", .when(platforms: [.watchOS])), + ] + ) + } +} + func firestoreTargets() -> [Target] { if Context.environment["FIREBASE_SOURCE_FIRESTORE"] != nil { return [ From 1dc5262e0afa642c96020bc3d7f43a50292ff3fd Mon Sep 17 00:00:00 2001 From: Paul Beusterien Date: Mon, 1 Dec 2025 18:41:42 -0800 Subject: [PATCH 2/6] Run CI tests only on SPM --- .github/workflows/crashlytics.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/crashlytics.yml b/.github/workflows/crashlytics.yml index 60599d17c3a..9ab4ef86920 100644 --- a/.github/workflows/crashlytics.yml +++ b/.github/workflows/crashlytics.yml @@ -42,7 +42,8 @@ jobs: uses: ./.github/workflows/common_cocoapods.yml with: product: FirebaseCrashlytics - buildonly_platforms: tvOS, macOS, watchOS + # Run CI tests only on SPM. + buildonly_platforms: iOS, tvOS, macOS, watchOS quickstart: uses: ./.github/workflows/common_quickstart.yml From 0484b9165968d08a60cef73a0ed3cc51e0dcc8f7 Mon Sep 17 00:00:00 2001 From: Paul Beusterien Date: Mon, 1 Dec 2025 19:23:10 -0800 Subject: [PATCH 3/6] review --- .../UnitTests/FIRCLSReportUploaderTests.m | 8 ++- .../Sources/FIRMessagingRmqManager.m | 4 +- Package.swift | 71 +++++++------------ 3 files changed, 32 insertions(+), 51 deletions(-) diff --git a/Crashlytics/UnitTests/FIRCLSReportUploaderTests.m b/Crashlytics/UnitTests/FIRCLSReportUploaderTests.m index 7e9862d2832..dd39982ddba 100644 --- a/Crashlytics/UnitTests/FIRCLSReportUploaderTests.m +++ b/Crashlytics/UnitTests/FIRCLSReportUploaderTests.m @@ -282,11 +282,13 @@ - (void)runUploadPackagedReportWithUrgency:(BOOL)urgent { [self.uploader uploadPackagedReportAtPath:[self packagePath] dataCollectionToken:FIRCLSDataCollectionToken.validToken asUrgent:urgent]; - XCTAssertNotNil(self.mockDataTransport.sendDataEvent_event); - // Wait a little bit for the file to be removed. - [NSRunLoop.currentRunLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; + // Poll until the file is removed, with a timeout to prevent an infinite loop. + NSDate *timeoutDate = [NSDate dateWithTimeIntervalSinceNow:1.0]; + while (self.fileManager.removedItemAtPath_path == nil && [timeoutDate timeIntervalSinceNow] > 0) { + [NSRunLoop.currentRunLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.01]]; + } XCTAssertEqualObjects(self.fileManager.removedItemAtPath_path, [self packagePath]); } diff --git a/FirebaseMessaging/Sources/FIRMessagingRmqManager.m b/FirebaseMessaging/Sources/FIRMessagingRmqManager.m index 6a28d1d926d..ae28e2c6a6e 100644 --- a/FirebaseMessaging/Sources/FIRMessagingRmqManager.m +++ b/FirebaseMessaging/Sources/FIRMessagingRmqManager.m @@ -501,7 +501,7 @@ - (void)openDatabase { #ifdef SQLITE_OPEN_FILEPROTECTION_NONE flags |= SQLITE_OPEN_FILEPROTECTION_NONE; #endif - int result = sqlite3_open_v2([path UTF8String], &self -> _database, flags, NULL); + int result = sqlite3_open_v2([path UTF8String], &self->_database, flags, NULL); if (result != SQLITE_OK) { NSString *errorString = FIRMessagingStringFromSQLiteResult(result); NSString *errorMessage = [NSString @@ -522,7 +522,7 @@ - (void)openDatabase { #ifdef SQLITE_OPEN_FILEPROTECTION_NONE flags |= SQLITE_OPEN_FILEPROTECTION_NONE; #endif - int result = sqlite3_open_v2([path UTF8String], &self -> _database, flags, NULL); + int result = sqlite3_open_v2([path UTF8String], &self->_database, flags, NULL); if (result != SQLITE_OK) { NSString *errorString = FIRMessagingStringFromSQLiteResult(result); NSString *errorMessage = diff --git a/Package.swift b/Package.swift index 79f6beb2627..fbcf0c5be8e 100644 --- a/Package.swift +++ b/Package.swift @@ -1449,52 +1449,31 @@ func firestoreWrapperTarget() -> Target { func crashlyticsUnitTestChooser() -> Target { // Don't run flaky tests in nightly runs. - if Context.environment["CRASHLYTICS_NIGHTLY"] != nil { - return .testTarget( - name: "FirebaseCrashlyticsUnit", - dependencies: ["FirebaseCrashlytics", .product(name: "OCMock", package: "ocmock")], - path: "Crashlytics/UnitTests", - exclude: ["FIRCrashlyticsReportTests.m"], // Flaky - resources: [ - .copy("FIRCLSMachO/machO_data"), - .copy("Data"), - ], - cSettings: [ - .headerSearchPath("../.."), - .define("DISPLAY_VERSION", to: firebaseVersion), - .define("CLS_SDK_NAME", to: "Crashlytics iOS SDK", .when(platforms: [.iOS])), - .define( - "CLS_SDK_NAME", - to: "Crashlytics macOS SDK", - .when(platforms: [.macOS, .macCatalyst]) - ), - .define("CLS_SDK_NAME", to: "Crashlytics tvOS SDK", .when(platforms: [.tvOS])), - .define("CLS_SDK_NAME", to: "Crashlytics watchOS SDK", .when(platforms: [.watchOS])), - ] - ) - } else { - return .testTarget( - name: "FirebaseCrashlyticsUnit", - dependencies: ["FirebaseCrashlytics", .product(name: "OCMock", package: "ocmock")], - path: "Crashlytics/UnitTests", - resources: [ - .copy("FIRCLSMachO/machO_data"), - .copy("Data"), - ], - cSettings: [ - .headerSearchPath("../.."), - .define("DISPLAY_VERSION", to: firebaseVersion), - .define("CLS_SDK_NAME", to: "Crashlytics iOS SDK", .when(platforms: [.iOS])), - .define( - "CLS_SDK_NAME", - to: "Crashlytics macOS SDK", - .when(platforms: [.macOS, .macCatalyst]) - ), - .define("CLS_SDK_NAME", to: "Crashlytics tvOS SDK", .when(platforms: [.tvOS])), - .define("CLS_SDK_NAME", to: "Crashlytics watchOS SDK", .when(platforms: [.watchOS])), - ] - ) - } + let exclusions: [String] = Context.environment["CRASHLYTICS_NIGHTLY"] != nil ? + ["FIRCrashlyticsReportTests.m"] : [] + + return .testTarget( + name: "FirebaseCrashlyticsUnit", + dependencies: ["FirebaseCrashlytics", .product(name: "OCMock", package: "ocmock")], + path: "Crashlytics/UnitTests", + exclude: exclusions, + resources: [ + .copy("FIRCLSMachO/machO_data"), + .copy("Data"), + ], + cSettings: [ + .headerSearchPath("../.."), + .define("DISPLAY_VERSION", to: firebaseVersion), + .define("CLS_SDK_NAME", to: "Crashlytics iOS SDK", .when(platforms: [.iOS])), + .define( + "CLS_SDK_NAME", + to: "Crashlytics macOS SDK", + .when(platforms: [.macOS, .macCatalyst]) + ), + .define("CLS_SDK_NAME", to: "Crashlytics tvOS SDK", .when(platforms: [.tvOS])), + .define("CLS_SDK_NAME", to: "Crashlytics watchOS SDK", .when(platforms: [.watchOS])), + ] + ) } func firestoreTargets() -> [Target] { From 18c42cc10cdf8ba37660a5fa6e096880eff3f027 Mon Sep 17 00:00:00 2001 From: Paul Beusterien Date: Mon, 1 Dec 2025 19:27:06 -0800 Subject: [PATCH 4/6] Build only for Catalyst --- .github/workflows/crashlytics.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/crashlytics.yml b/.github/workflows/crashlytics.yml index 9ab4ef86920..3974afa996f 100644 --- a/.github/workflows/crashlytics.yml +++ b/.github/workflows/crashlytics.yml @@ -37,6 +37,7 @@ jobs: with: product: FirebaseCrashlytics target: FirebaseCrashlytics-Unit-unit + buildonly: true pod_lib_lint: uses: ./.github/workflows/common_cocoapods.yml From 8984dc38d6346cd2c258d5f9bf038d2e2039c37e Mon Sep 17 00:00:00 2001 From: Paul Beusterien Date: Mon, 1 Dec 2025 19:51:16 -0800 Subject: [PATCH 5/6] Accidental file add --- FirebaseMessaging/Sources/FIRMessagingRmqManager.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FirebaseMessaging/Sources/FIRMessagingRmqManager.m b/FirebaseMessaging/Sources/FIRMessagingRmqManager.m index ae28e2c6a6e..6a28d1d926d 100644 --- a/FirebaseMessaging/Sources/FIRMessagingRmqManager.m +++ b/FirebaseMessaging/Sources/FIRMessagingRmqManager.m @@ -501,7 +501,7 @@ - (void)openDatabase { #ifdef SQLITE_OPEN_FILEPROTECTION_NONE flags |= SQLITE_OPEN_FILEPROTECTION_NONE; #endif - int result = sqlite3_open_v2([path UTF8String], &self->_database, flags, NULL); + int result = sqlite3_open_v2([path UTF8String], &self -> _database, flags, NULL); if (result != SQLITE_OK) { NSString *errorString = FIRMessagingStringFromSQLiteResult(result); NSString *errorMessage = [NSString @@ -522,7 +522,7 @@ - (void)openDatabase { #ifdef SQLITE_OPEN_FILEPROTECTION_NONE flags |= SQLITE_OPEN_FILEPROTECTION_NONE; #endif - int result = sqlite3_open_v2([path UTF8String], &self->_database, flags, NULL); + int result = sqlite3_open_v2([path UTF8String], &self -> _database, flags, NULL); if (result != SQLITE_OK) { NSString *errorString = FIRMessagingStringFromSQLiteResult(result); NSString *errorMessage = From 624c30f1215efa5769037bc024c6d7124ea06497 Mon Sep 17 00:00:00 2001 From: Paul Beusterien Date: Tue, 2 Dec 2025 07:07:51 -0800 Subject: [PATCH 6/6] cleanup --- Crashlytics/UnitTests/Mocks/FIRCLSMockFileManager.h | 9 +++------ Crashlytics/UnitTests/Mocks/FIRCLSMockFileManager.m | 8 -------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/Crashlytics/UnitTests/Mocks/FIRCLSMockFileManager.h b/Crashlytics/UnitTests/Mocks/FIRCLSMockFileManager.h index 86382211da1..3bff289bf03 100644 --- a/Crashlytics/UnitTests/Mocks/FIRCLSMockFileManager.h +++ b/Crashlytics/UnitTests/Mocks/FIRCLSMockFileManager.h @@ -16,17 +16,14 @@ #import -// Notification posted when an item is removed via `removeItemAtPath`. -extern NSNotificationName const FIRCLSMockFileManagerDidRemoveItemNotification; - @interface FIRCLSMockFileManager : FIRCLSFileManager -// Incremented when a remove happens with removeItemAtPath -@property(nonatomic) NSInteger removeCount; - // Number of calls to removeItemAtPath are expected for the unit test @property(nonatomic) NSInteger expectedRemoveCount; +// Incremented when a remove happens with removeItemAtPath +@property(nonatomic) NSInteger removeCount; + // Will be fulfilled when the expected number of removes have happened // using removeItemAtPath // diff --git a/Crashlytics/UnitTests/Mocks/FIRCLSMockFileManager.m b/Crashlytics/UnitTests/Mocks/FIRCLSMockFileManager.m index 2c37549503f..8bf1b47456b 100644 --- a/Crashlytics/UnitTests/Mocks/FIRCLSMockFileManager.m +++ b/Crashlytics/UnitTests/Mocks/FIRCLSMockFileManager.m @@ -14,9 +14,6 @@ #import "Crashlytics/UnitTests/Mocks/FIRCLSMockFileManager.h" -NSNotificationName const FIRCLSMockFileManagerDidRemoveItemNotification = - @"FIRCLSMockFileManagerDidRemoveItemNotification"; - @interface FIRCLSMockFileManager () @property(nonatomic) NSMutableDictionary *fileSystemDict; @@ -47,11 +44,6 @@ - (BOOL)removeItemAtPath:(NSString *)path { [self.removeExpectation fulfill]; } } - - [[NSNotificationCenter defaultCenter] - postNotificationName:FIRCLSMockFileManagerDidRemoveItemNotification - object:self]; - return YES; }