Skip to content

Commit 0484b91

Browse files
committed
review
1 parent 1dc5262 commit 0484b91

File tree

3 files changed

+32
-51
lines changed

3 files changed

+32
-51
lines changed

Crashlytics/UnitTests/FIRCLSReportUploaderTests.m

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,13 @@ - (void)runUploadPackagedReportWithUrgency:(BOOL)urgent {
282282
[self.uploader uploadPackagedReportAtPath:[self packagePath]
283283
dataCollectionToken:FIRCLSDataCollectionToken.validToken
284284
asUrgent:urgent];
285-
286285
XCTAssertNotNil(self.mockDataTransport.sendDataEvent_event);
287286

288-
// Wait a little bit for the file to be removed.
289-
[NSRunLoop.currentRunLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
287+
// Poll until the file is removed, with a timeout to prevent an infinite loop.
288+
NSDate *timeoutDate = [NSDate dateWithTimeIntervalSinceNow:1.0];
289+
while (self.fileManager.removedItemAtPath_path == nil && [timeoutDate timeIntervalSinceNow] > 0) {
290+
[NSRunLoop.currentRunLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.01]];
291+
}
290292
XCTAssertEqualObjects(self.fileManager.removedItemAtPath_path, [self packagePath]);
291293
}
292294

FirebaseMessaging/Sources/FIRMessagingRmqManager.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ - (void)openDatabase {
501501
#ifdef SQLITE_OPEN_FILEPROTECTION_NONE
502502
flags |= SQLITE_OPEN_FILEPROTECTION_NONE;
503503
#endif
504-
int result = sqlite3_open_v2([path UTF8String], &self -> _database, flags, NULL);
504+
int result = sqlite3_open_v2([path UTF8String], &self->_database, flags, NULL);
505505
if (result != SQLITE_OK) {
506506
NSString *errorString = FIRMessagingStringFromSQLiteResult(result);
507507
NSString *errorMessage = [NSString
@@ -522,7 +522,7 @@ - (void)openDatabase {
522522
#ifdef SQLITE_OPEN_FILEPROTECTION_NONE
523523
flags |= SQLITE_OPEN_FILEPROTECTION_NONE;
524524
#endif
525-
int result = sqlite3_open_v2([path UTF8String], &self -> _database, flags, NULL);
525+
int result = sqlite3_open_v2([path UTF8String], &self->_database, flags, NULL);
526526
if (result != SQLITE_OK) {
527527
NSString *errorString = FIRMessagingStringFromSQLiteResult(result);
528528
NSString *errorMessage =

Package.swift

Lines changed: 25 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,52 +1449,31 @@ func firestoreWrapperTarget() -> Target {
14491449

14501450
func crashlyticsUnitTestChooser() -> Target {
14511451
// Don't run flaky tests in nightly runs.
1452-
if Context.environment["CRASHLYTICS_NIGHTLY"] != nil {
1453-
return .testTarget(
1454-
name: "FirebaseCrashlyticsUnit",
1455-
dependencies: ["FirebaseCrashlytics", .product(name: "OCMock", package: "ocmock")],
1456-
path: "Crashlytics/UnitTests",
1457-
exclude: ["FIRCrashlyticsReportTests.m"], // Flaky
1458-
resources: [
1459-
.copy("FIRCLSMachO/machO_data"),
1460-
.copy("Data"),
1461-
],
1462-
cSettings: [
1463-
.headerSearchPath("../.."),
1464-
.define("DISPLAY_VERSION", to: firebaseVersion),
1465-
.define("CLS_SDK_NAME", to: "Crashlytics iOS SDK", .when(platforms: [.iOS])),
1466-
.define(
1467-
"CLS_SDK_NAME",
1468-
to: "Crashlytics macOS SDK",
1469-
.when(platforms: [.macOS, .macCatalyst])
1470-
),
1471-
.define("CLS_SDK_NAME", to: "Crashlytics tvOS SDK", .when(platforms: [.tvOS])),
1472-
.define("CLS_SDK_NAME", to: "Crashlytics watchOS SDK", .when(platforms: [.watchOS])),
1473-
]
1474-
)
1475-
} else {
1476-
return .testTarget(
1477-
name: "FirebaseCrashlyticsUnit",
1478-
dependencies: ["FirebaseCrashlytics", .product(name: "OCMock", package: "ocmock")],
1479-
path: "Crashlytics/UnitTests",
1480-
resources: [
1481-
.copy("FIRCLSMachO/machO_data"),
1482-
.copy("Data"),
1483-
],
1484-
cSettings: [
1485-
.headerSearchPath("../.."),
1486-
.define("DISPLAY_VERSION", to: firebaseVersion),
1487-
.define("CLS_SDK_NAME", to: "Crashlytics iOS SDK", .when(platforms: [.iOS])),
1488-
.define(
1489-
"CLS_SDK_NAME",
1490-
to: "Crashlytics macOS SDK",
1491-
.when(platforms: [.macOS, .macCatalyst])
1492-
),
1493-
.define("CLS_SDK_NAME", to: "Crashlytics tvOS SDK", .when(platforms: [.tvOS])),
1494-
.define("CLS_SDK_NAME", to: "Crashlytics watchOS SDK", .when(platforms: [.watchOS])),
1495-
]
1496-
)
1497-
}
1452+
let exclusions: [String] = Context.environment["CRASHLYTICS_NIGHTLY"] != nil ?
1453+
["FIRCrashlyticsReportTests.m"] : []
1454+
1455+
return .testTarget(
1456+
name: "FirebaseCrashlyticsUnit",
1457+
dependencies: ["FirebaseCrashlytics", .product(name: "OCMock", package: "ocmock")],
1458+
path: "Crashlytics/UnitTests",
1459+
exclude: exclusions,
1460+
resources: [
1461+
.copy("FIRCLSMachO/machO_data"),
1462+
.copy("Data"),
1463+
],
1464+
cSettings: [
1465+
.headerSearchPath("../.."),
1466+
.define("DISPLAY_VERSION", to: firebaseVersion),
1467+
.define("CLS_SDK_NAME", to: "Crashlytics iOS SDK", .when(platforms: [.iOS])),
1468+
.define(
1469+
"CLS_SDK_NAME",
1470+
to: "Crashlytics macOS SDK",
1471+
.when(platforms: [.macOS, .macCatalyst])
1472+
),
1473+
.define("CLS_SDK_NAME", to: "Crashlytics tvOS SDK", .when(platforms: [.tvOS])),
1474+
.define("CLS_SDK_NAME", to: "Crashlytics watchOS SDK", .when(platforms: [.watchOS])),
1475+
]
1476+
)
14981477
}
14991478

15001479
func firestoreTargets() -> [Target] {

0 commit comments

Comments
 (0)