Improve post-migration testing tools.

This commit is contained in:
Matthew Chen 2018-01-29 10:58:38 -05:00
parent bb44def8b7
commit 6eddfae214
4 changed files with 15 additions and 2 deletions

View File

@ -220,6 +220,16 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
return;
}
DDLogInfo(@"%@ Database file size: %@",
self.logTag,
[OWSFileSystem fileSizeOfPath:TSStorageManager.legacyDatabaseFilePath]);
DDLogInfo(@"%@ \t SHM file size: %@",
self.logTag,
[OWSFileSystem fileSizeOfPath:TSStorageManager.legacyDatabaseFilePath_SHM]);
DDLogInfo(@"%@ \t WAL file size: %@",
self.logTag,
[OWSFileSystem fileSizeOfPath:TSStorageManager.legacyDatabaseFilePath_WAL]);
NSError *_Nullable error = [self convertDatabaseIfNecessary];
// TODO: Handle this error.
OWSAssert(!error);

View File

@ -456,12 +456,10 @@ typedef NSData *_Nullable (^CreateDatabaseMetadataBlock)(void);
return self.database.newConnection;
}
#ifdef DEBUG
- (BOOL)registerExtension:(YapDatabaseExtension *)extension withName:(NSString *)extensionName
{
return [self.database registerExtension:extension withName:extensionName];
}
#endif
- (void)asyncRegisterExtension:(YapDatabaseExtension *)extension
withName:(NSString *)extensionName

View File

@ -26,6 +26,8 @@ void runAsyncRegistrationsForStorage(OWSStorage *storage);
+ (NSString *)databaseFilePath;
+ (NSString *)legacyDatabaseFilePath;
+ (NSString *)legacyDatabaseFilePath_SHM;
+ (NSString *)legacyDatabaseFilePath_WAL;
@end

View File

@ -126,6 +126,7 @@ void AssertIsOnMainThread(void);
#define OWSRaiseException(name, formatParam, ...) \
{ \
DDLogError(@"Exception: %@ %@", name, [NSString stringWithFormat:formatParam, ##__VA_ARGS__]); \
[DDLog flushLog]; \
@throw [NSException exceptionWithName:name \
reason:[NSString stringWithFormat:formatParam, ##__VA_ARGS__] \
@ -134,6 +135,8 @@ void AssertIsOnMainThread(void);
#define OWSRaiseExceptionWithUserInfo(name, userInfoParam, formatParam, ...) \
{ \
DDLogError( \
@"Exception: %@ %@ %@", name, userInfoParam, [NSString stringWithFormat:formatParam, ##__VA_ARGS__]); \
[DDLog flushLog]; \
@throw [NSException exceptionWithName:name \
reason:[NSString stringWithFormat:formatParam, ##__VA_ARGS__] \