Rename option to --enable-continuous-coverage-collection
Summary: Renamed the option to --enable-continuous-coverage-collection to avoid leaking too many implementation details of idb_companion to the idb client API. Reviewed By: jbardini Differential Revision: D48606534 fbshipit-source-id: b586b52f04985a820cc2ce58fb0a8da31b45c169
This commit is contained in:
Родитель
b930660ca4
Коммит
4ab2ca1cba
|
@ -21,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
/**
|
||||
The Designated Initializer
|
||||
*/
|
||||
- (instancetype)initWithTestBundle:(FBBundleDescriptor *)testBundle applicationLaunchConfiguration:(FBApplicationLaunchConfiguration *)applicationLaunchConfiguration testHostBundle:(nullable FBBundleDescriptor *)testHostBundle timeout:(NSTimeInterval)timeout initializeUITesting:(BOOL)initializeUITesting useXcodebuild:(BOOL)useXcodebuild testsToRun:(nullable NSSet<NSString *> *)testsToRun testsToSkip:(nullable NSSet<NSString *> *)testsToSkip targetApplicationBundle:(nullable FBBundleDescriptor *)targetApplicationBundle xcTestRunProperties:(nullable NSDictionary *)xcTestRunProperties resultBundlePath:(nullable NSString *)resultBundlePath reportActivities:(BOOL)reportActivities coverageDirectoryPath:(nullable NSString *)coverageDirectoryPath coverageFileSuffix:(nullable NSString *)coverageFileSuffix logDirectoryPath:(nullable NSString *)logDirectoryPath reportResultBundle:(BOOL)reportResultBundle;
|
||||
- (instancetype)initWithTestBundle:(FBBundleDescriptor *)testBundle applicationLaunchConfiguration:(FBApplicationLaunchConfiguration *)applicationLaunchConfiguration testHostBundle:(nullable FBBundleDescriptor *)testHostBundle timeout:(NSTimeInterval)timeout initializeUITesting:(BOOL)initializeUITesting useXcodebuild:(BOOL)useXcodebuild testsToRun:(nullable NSSet<NSString *> *)testsToRun testsToSkip:(nullable NSSet<NSString *> *)testsToSkip targetApplicationBundle:(nullable FBBundleDescriptor *)targetApplicationBundle xcTestRunProperties:(nullable NSDictionary *)xcTestRunProperties resultBundlePath:(nullable NSString *)resultBundlePath reportActivities:(BOOL)reportActivities coverageDirectoryPath:(nullable NSString *)coverageDirectoryPath enableContinuousCoverageCollection:(BOOL)enableContinuousCoverageCollection logDirectoryPath:(nullable NSString *)logDirectoryPath reportResultBundle:(BOOL)reportResultBundle;
|
||||
|
||||
/**
|
||||
XCTest bundle used for testing
|
||||
|
@ -89,9 +89,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
@property (nonatomic, copy, readonly, nullable) NSString *coverageDirectoryPath;
|
||||
|
||||
/**
|
||||
Suffix of the coverage file
|
||||
Determines whether should enable continuous coverage collection
|
||||
*/
|
||||
@property (nonatomic, copy, readonly) NSString *coverageFileSuffix;
|
||||
@property (nonatomic, assign, readonly) BOOL shouldEnableContinuousCoverageCollection;
|
||||
|
||||
/**
|
||||
The Directory to use for storing logs generated during the execution of the test run.
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
@implementation FBTestLaunchConfiguration
|
||||
|
||||
- (instancetype)initWithTestBundle:(FBBundleDescriptor *)testBundle applicationLaunchConfiguration:(FBApplicationLaunchConfiguration *)applicationLaunchConfiguration testHostBundle:(nullable FBBundleDescriptor *)testHostBundle timeout:(NSTimeInterval)timeout initializeUITesting:(BOOL)initializeUITesting useXcodebuild:(BOOL)useXcodebuild testsToRun:(NSSet<NSString *> *)testsToRun testsToSkip:(NSSet<NSString *> *)testsToSkip targetApplicationBundle:(nullable FBBundleDescriptor *)targetApplicationBundle xcTestRunProperties:(NSDictionary *)xcTestRunProperties resultBundlePath:(NSString *)resultBundlePath reportActivities:(BOOL)reportActivities coverageDirectoryPath:(NSString *)coverageDirectoryPath coverageFileSuffix:(NSString *)coverageFileSuffix logDirectoryPath:(nullable NSString *)logDirectoryPath reportResultBundle:(BOOL)reportResultBundle
|
||||
- (instancetype)initWithTestBundle:(FBBundleDescriptor *)testBundle applicationLaunchConfiguration:(FBApplicationLaunchConfiguration *)applicationLaunchConfiguration testHostBundle:(nullable FBBundleDescriptor *)testHostBundle timeout:(NSTimeInterval)timeout initializeUITesting:(BOOL)initializeUITesting useXcodebuild:(BOOL)useXcodebuild testsToRun:(NSSet<NSString *> *)testsToRun testsToSkip:(NSSet<NSString *> *)testsToSkip targetApplicationBundle:(nullable FBBundleDescriptor *)targetApplicationBundle xcTestRunProperties:(NSDictionary *)xcTestRunProperties resultBundlePath:(NSString *)resultBundlePath reportActivities:(BOOL)reportActivities coverageDirectoryPath:(NSString *)coverageDirectoryPath enableContinuousCoverageCollection:(BOOL)enableContinuousCoverageCollection logDirectoryPath:(nullable NSString *)logDirectoryPath reportResultBundle:(BOOL)reportResultBundle
|
||||
{
|
||||
self = [super init];
|
||||
if (!self) {
|
||||
|
@ -37,7 +37,7 @@
|
|||
_resultBundlePath = resultBundlePath;
|
||||
_reportActivities = reportActivities;
|
||||
_coverageDirectoryPath = coverageDirectoryPath;
|
||||
_coverageFileSuffix = coverageFileSuffix ?: @"";
|
||||
_shouldEnableContinuousCoverageCollection = enableContinuousCoverageCollection;
|
||||
_logDirectoryPath = logDirectoryPath;
|
||||
_reportResultBundle = reportResultBundle;
|
||||
|
||||
|
@ -72,20 +72,20 @@
|
|||
(self.xcTestRunProperties == configuration.xcTestRunProperties || [self.xcTestRunProperties isEqual:configuration.xcTestRunProperties]) &&
|
||||
(self.resultBundlePath == configuration.resultBundlePath || [self.resultBundlePath isEqual:configuration.resultBundlePath]) &&
|
||||
(self.coverageDirectoryPath == configuration.coverageDirectoryPath || [self.coverageDirectoryPath isEqualToString:configuration.coverageDirectoryPath]) &&
|
||||
(self.coverageFileSuffix == configuration.coverageFileSuffix || [self.coverageFileSuffix isEqualToString:configuration.coverageFileSuffix]) &&
|
||||
(self.shouldEnableContinuousCoverageCollection == configuration.shouldEnableContinuousCoverageCollection) &&
|
||||
(self.logDirectoryPath == configuration.logDirectoryPath || [self.logDirectoryPath isEqualToString:configuration.logDirectoryPath]) &&
|
||||
self.reportResultBundle == configuration.reportResultBundle;
|
||||
}
|
||||
|
||||
- (NSUInteger)hash
|
||||
{
|
||||
return self.testBundle.hash ^ self.applicationLaunchConfiguration.hash ^ self.testHostBundle.hash ^ (unsigned long) self.timeout ^ (unsigned long) self.shouldInitializeUITesting ^ (unsigned long) self.shouldUseXcodebuild ^ self.testsToRun.hash ^ self.testsToSkip.hash ^ self.targetApplicationBundle.hash ^ self.xcTestRunProperties.hash ^ self.resultBundlePath.hash ^ self.coverageDirectoryPath.hash ^ self.coverageFileSuffix.hash ^ self.logDirectoryPath.hash;
|
||||
return self.testBundle.hash ^ self.applicationLaunchConfiguration.hash ^ self.testHostBundle.hash ^ (unsigned long) self.timeout ^ (unsigned long) self.shouldInitializeUITesting ^ (unsigned long) self.shouldUseXcodebuild ^ self.testsToRun.hash ^ self.testsToSkip.hash ^ self.targetApplicationBundle.hash ^ self.xcTestRunProperties.hash ^ self.resultBundlePath.hash ^ self.coverageDirectoryPath.hash ^ (unsigned long) self.shouldEnableContinuousCoverageCollection ^ self.logDirectoryPath.hash;
|
||||
}
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
return [NSString stringWithFormat:
|
||||
@"FBTestLaunchConfiguration TestBundle %@ | AppConfig %@ | HostBundle %@ | UITesting %d | UseXcodebuild %d | TestsToRun %@ | TestsToSkip %@ | Target application bundle %@ xcTestRunProperties %@ | ResultBundlePath %@ | CoverageDirPath %@ | CoverageFileSuffix %@ | LogDirectoryPath %@ | ReportResultBundle %d" ,
|
||||
@"FBTestLaunchConfiguration TestBundle %@ | AppConfig %@ | HostBundle %@ | UITesting %d | UseXcodebuild %d | TestsToRun %@ | TestsToSkip %@ | Target application bundle %@ xcTestRunProperties %@ | ResultBundlePath %@ | CoverageDirPath %@ | EnableContinuousCoverageCollection %d | LogDirectoryPath %@ | ReportResultBundle %d" ,
|
||||
self.testBundle,
|
||||
self.applicationLaunchConfiguration,
|
||||
self.testHostBundle,
|
||||
|
@ -97,7 +97,7 @@
|
|||
self.xcTestRunProperties,
|
||||
self.resultBundlePath,
|
||||
self.coverageDirectoryPath,
|
||||
self.coverageFileSuffix,
|
||||
self.shouldEnableContinuousCoverageCollection,
|
||||
self.logDirectoryPath,
|
||||
self.reportResultBundle
|
||||
];
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
resultBundlePath:nil
|
||||
reportActivities:NO
|
||||
coverageDirectoryPath:nil
|
||||
coverageFileSuffix:nil
|
||||
enableContinuousCoverageCollection:NO
|
||||
logDirectoryPath:nil
|
||||
reportResultBundle:NO];
|
||||
}
|
||||
|
@ -92,7 +92,7 @@
|
|||
resultBundlePath:nil
|
||||
reportActivities:NO
|
||||
coverageDirectoryPath:nil
|
||||
coverageFileSuffix:nil
|
||||
enableContinuousCoverageCollection:NO
|
||||
logDirectoryPath:nil
|
||||
reportResultBundle:NO];
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@
|
|||
resultBundlePath:nil
|
||||
reportActivities:NO
|
||||
coverageDirectoryPath:nil
|
||||
coverageFileSuffix:nil
|
||||
enableContinuousCoverageCollection:NO
|
||||
logDirectoryPath:nil
|
||||
reportResultBundle:NO];
|
||||
|
||||
|
@ -144,7 +144,7 @@
|
|||
resultBundlePath:nil
|
||||
reportActivities:NO
|
||||
coverageDirectoryPath:nil
|
||||
coverageFileSuffix:nil
|
||||
enableContinuousCoverageCollection:NO
|
||||
logDirectoryPath:nil
|
||||
reportResultBundle:NO];
|
||||
|
||||
|
@ -170,7 +170,7 @@
|
|||
resultBundlePath:nil
|
||||
reportActivities:NO
|
||||
coverageDirectoryPath:nil
|
||||
coverageFileSuffix:nil
|
||||
enableContinuousCoverageCollection:NO
|
||||
logDirectoryPath:nil
|
||||
reportResultBundle:NO];
|
||||
|
||||
|
|
|
@ -30,11 +30,11 @@ typedef NS_ENUM(NSUInteger, FBCodeCoverageFormat) {
|
|||
@property (nonatomic, assign, readonly) FBCodeCoverageFormat format;
|
||||
|
||||
/**
|
||||
Suffix of the coverage file
|
||||
Determines whether should enable continuous coverage collection
|
||||
*/
|
||||
@property (nonatomic, strong, readonly) NSString *coverageFileSuffix;
|
||||
@property (nonatomic, assign, readonly) BOOL shouldEnableContinuousCoverageCollection;
|
||||
|
||||
- (instancetype)initWithDirectory:(NSString *)coverageDirectory format:(FBCodeCoverageFormat)format coverageFileSuffix:(NSString *)coverageFileSuffix;
|
||||
- (instancetype)initWithDirectory:(NSString *)coverageDirectory format:(FBCodeCoverageFormat)format enableContinuousCoverageCollection:(BOOL)enableContinuousCoverageCollection;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
@implementation FBCodeCoverageConfiguration
|
||||
|
||||
-(instancetype) initWithDirectory:(NSString *)coverageDirectory format:(FBCodeCoverageFormat)format coverageFileSuffix:(NSString *)coverageFileSuffix
|
||||
-(instancetype) initWithDirectory:(NSString *)coverageDirectory format:(FBCodeCoverageFormat)format enableContinuousCoverageCollection:(BOOL)enableContinuousCoverageCollection
|
||||
{
|
||||
self = [super init];
|
||||
if (!self) {
|
||||
|
@ -19,14 +19,14 @@
|
|||
|
||||
_coverageDirectory = coverageDirectory;
|
||||
_format = format;
|
||||
_coverageFileSuffix = coverageFileSuffix;
|
||||
_shouldEnableContinuousCoverageCollection = enableContinuousCoverageCollection;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"Coverage Directory %@ | Format %lu | File Suffix '%@'", self.coverageDirectory, (unsigned long)self.format, self.coverageFileSuffix];
|
||||
return [NSString stringWithFormat:@"Coverage Directory %@ | Format %lu | Enable Continuous Coverage Collection %d", self.coverageDirectory, (unsigned long)self.format, self.shouldEnableContinuousCoverageCollection];
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -179,13 +179,13 @@
|
|||
hostApplicationAdditionalEnvironment[@"DYLD_INSERT_LIBRARIES"] = shimPath;
|
||||
hostApplicationAdditionalEnvironment[kEnv_WaitForDebugger] = testLaunchConfiguration.applicationLaunchConfiguration.waitForDebugger ? @"YES" : @"NO";
|
||||
if (testLaunchConfiguration.coverageDirectoryPath) {
|
||||
NSString *coverageFileSuffix = testLaunchConfiguration.coverageFileSuffix;
|
||||
NSString *hostCoverageFile = [NSString stringWithFormat:@"coverage_%@%@.profraw", hostApplication.bundle.identifier, coverageFileSuffix];
|
||||
NSString *continuousCoverageCollectionMode = testLaunchConfiguration.shouldEnableContinuousCoverageCollection ? @"%c" : @"";
|
||||
NSString *hostCoverageFile = [NSString stringWithFormat:@"coverage_%@%@.profraw", hostApplication.bundle.identifier, continuousCoverageCollectionMode];
|
||||
NSString *hostCoveragePath = [testLaunchConfiguration.coverageDirectoryPath stringByAppendingPathComponent:hostCoverageFile];
|
||||
hostApplicationAdditionalEnvironment[kEnv_LLVMProfileFile] = hostCoveragePath;
|
||||
|
||||
if (testLaunchConfiguration.targetApplicationBundle != nil) {
|
||||
NSString *targetCoverageFile = [NSString stringWithFormat:@"coverage_%@%@.profraw", testLaunchConfiguration.targetApplicationBundle.identifier, coverageFileSuffix];
|
||||
NSString *targetCoverageFile = [NSString stringWithFormat:@"coverage_%@%@.profraw", testLaunchConfiguration.targetApplicationBundle.identifier, continuousCoverageCollectionMode];
|
||||
NSString *targetAppCoveragePath = [testLaunchConfiguration.coverageDirectoryPath stringByAppendingPathComponent:targetCoverageFile];
|
||||
testedApplicationAdditionalEnvironment[kEnv_LLVMProfileFile] = targetAppCoveragePath;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
resultBundlePath:nil
|
||||
reportActivities:NO
|
||||
coverageDirectoryPath:nil
|
||||
coverageFileSuffix:nil
|
||||
enableContinuousCoverageCollection:NO
|
||||
logDirectoryPath:nil
|
||||
reportResultBundle:NO];
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@
|
|||
resultBundlePath:nil
|
||||
reportActivities:NO
|
||||
coverageDirectoryPath:nil
|
||||
coverageFileSuffix:nil
|
||||
enableContinuousCoverageCollection:NO
|
||||
logDirectoryPath:nil
|
||||
reportResultBundle:NO];
|
||||
|
||||
|
|
|
@ -28,11 +28,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
@property (nonatomic, assign, readonly) FBCodeCoverageFormat format;
|
||||
|
||||
/**
|
||||
Suffix of the coverage file
|
||||
Determines whether should enable continuous coverage collection
|
||||
*/
|
||||
@property (nonatomic, strong, readonly) NSString *coverageFileSuffix;
|
||||
@property (nonatomic, assign, readonly) BOOL shouldEnableContinuousCoverageCollection;
|
||||
|
||||
- (instancetype)initWithCollect:(BOOL)collect format:(FBCodeCoverageFormat)format coverageFileSuffix:(NSString *)coverageFileSuffix;
|
||||
- (instancetype)initWithCollect:(BOOL)collect format:(FBCodeCoverageFormat)format enableContinuousCoverageCollection:(BOOL)enableContinuousCoverageCollection;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
@implementation FBCodeCoverageRequest
|
||||
|
||||
- (instancetype)initWithCollect:(BOOL)collect format:(FBCodeCoverageFormat)format coverageFileSuffix:(nonnull NSString *)coverageFileSuffix
|
||||
- (instancetype)initWithCollect:(BOOL)collect format:(FBCodeCoverageFormat)format enableContinuousCoverageCollection:(BOOL)enableContinuousCoverageCollection
|
||||
{
|
||||
self = [super init];
|
||||
if (!self) {
|
||||
|
@ -18,7 +18,7 @@
|
|||
|
||||
_collect = collect;
|
||||
_format = format;
|
||||
_coverageFileSuffix = coverageFileSuffix;
|
||||
_shouldEnableContinuousCoverageCollection = enableContinuousCoverageCollection;
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ static const NSTimeInterval FBLogicTestTimeout = 60 * 60; //Aprox. an hour.
|
|||
NSURL *dir = [temporaryDirectory ephemeralTemporaryDirectory];
|
||||
NSString *coverageDirName =[NSString stringWithFormat:@"coverage_%@", NSUUID.UUID.UUIDString];
|
||||
NSString *coverageDirPath = [dir.path stringByAppendingPathComponent:coverageDirName];
|
||||
coverageConfig = [[FBCodeCoverageConfiguration alloc] initWithDirectory:coverageDirPath format:self.coverageRequest.format coverageFileSuffix:self.coverageRequest.coverageFileSuffix];
|
||||
coverageConfig = [[FBCodeCoverageConfiguration alloc] initWithDirectory:coverageDirPath format:self.coverageRequest.format enableContinuousCoverageCollection:self.coverageRequest.shouldEnableContinuousCoverageCollection];
|
||||
}
|
||||
|
||||
NSString *testFilter = nil;
|
||||
|
|
|
@ -96,12 +96,12 @@ struct XCTestRunMethodHandler {
|
|||
if request.hasCodeCoverage {
|
||||
switch request.codeCoverage.format {
|
||||
case .raw:
|
||||
return FBCodeCoverageRequest(collect: request.codeCoverage.collect, format: .raw, coverageFileSuffix: request.codeCoverage.coverageFileSuffix)
|
||||
return FBCodeCoverageRequest(collect: request.codeCoverage.collect, format: .raw, enableContinuousCoverageCollection: request.codeCoverage.enableContinuousCoverageCollection)
|
||||
case .exported, .UNRECOGNIZED:
|
||||
return FBCodeCoverageRequest(collect: request.codeCoverage.collect, format: .exported, coverageFileSuffix: request.codeCoverage.coverageFileSuffix)
|
||||
return FBCodeCoverageRequest(collect: request.codeCoverage.collect, format: .exported, enableContinuousCoverageCollection: request.codeCoverage.enableContinuousCoverageCollection)
|
||||
}
|
||||
}
|
||||
// fallback to deprecated request field for backwards compatibility
|
||||
return FBCodeCoverageRequest(collect: request.collectCoverage, format: .exported, coverageFileSuffix: request.codeCoverage.coverageFileSuffix)
|
||||
return FBCodeCoverageRequest(collect: request.collectCoverage, format: .exported, enableContinuousCoverageCollection: request.codeCoverage.enableContinuousCoverageCollection)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -177,7 +177,7 @@ static FBFuture<FBApplicationLaunchConfiguration *> *BuildAppLaunchConfig(NSStri
|
|||
if (request.coverageRequest.collect) {
|
||||
NSString *coverageDirName =[NSString stringWithFormat:@"coverage_%@", NSUUID.UUID.UUIDString];
|
||||
NSString *coverageDirPath = [self.targetAuxillaryDirectory stringByAppendingPathComponent:coverageDirName];
|
||||
coverageConfig = [[FBCodeCoverageConfiguration alloc] initWithDirectory:coverageDirPath format:request.coverageRequest.format coverageFileSuffix:request.coverageRequest.coverageFileSuffix];
|
||||
coverageConfig = [[FBCodeCoverageConfiguration alloc] initWithDirectory:coverageDirPath format:request.coverageRequest.format enableContinuousCoverageCollection:request.coverageRequest.shouldEnableContinuousCoverageCollection];
|
||||
}
|
||||
|
||||
return [appLaunchConfigFuture onQueue:queue map:^ FBIDBAppHostedTestConfiguration * (FBApplicationLaunchConfiguration *applicationLaunchConfiguration) {
|
||||
|
@ -195,7 +195,7 @@ static FBFuture<FBApplicationLaunchConfiguration *> *BuildAppLaunchConfig(NSStri
|
|||
resultBundlePath:nil
|
||||
reportActivities:request.reportActivities
|
||||
coverageDirectoryPath:coverageConfig.coverageDirectory
|
||||
coverageFileSuffix:coverageConfig.coverageFileSuffix
|
||||
enableContinuousCoverageCollection:coverageConfig.shouldEnableContinuousCoverageCollection
|
||||
logDirectoryPath:logDirectoryPath
|
||||
reportResultBundle:request.collectResultBundle];
|
||||
return [[FBIDBAppHostedTestConfiguration alloc] initWithTestLaunchConfiguration:testLaunchConfig coverageConfiguration:coverageConfig];
|
||||
|
@ -298,7 +298,7 @@ static FBFuture<FBApplicationLaunchConfiguration *> *BuildAppLaunchConfig(NSStri
|
|||
resultBundlePath:resultBundlePath
|
||||
reportActivities:request.reportActivities
|
||||
coverageDirectoryPath:nil
|
||||
coverageFileSuffix:nil
|
||||
enableContinuousCoverageCollection:NO
|
||||
logDirectoryPath:logDirectoryPath
|
||||
reportResultBundle:request.collectResultBundle];
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче