diff --git a/FBControlCore/Configuration/FBXCTraceConfiguration.m b/FBControlCore/Configuration/FBXCTraceConfiguration.m index 211714941..531938465 100644 --- a/FBControlCore/Configuration/FBXCTraceConfiguration.m +++ b/FBControlCore/Configuration/FBXCTraceConfiguration.m @@ -80,7 +80,7 @@ - (instancetype)withShim:(FBXCTestShimConfiguration *)shim - (NSString *)description { return [NSString stringWithFormat: - @"xctrace record: template %@ | duration %f | process to launch %@ | process to attach %@ | package %@ | target stdin %@ | target stdout %@ | target arguments %@ | target environment %@ | record all processes %@ | shim %@", + @"xctrace record: template %@ | duration %f | process to launch %@ | process to attach %@ | package %@ | target stdin %@ | target stdout %@ | target arguments %@ | target environment %@ | record all processes %@", self.templateName, self.timeLimit, self.processToLaunch, @@ -90,8 +90,7 @@ - (NSString *)description self.targetStdout, [FBCollectionInformation oneLineDescriptionFromArray:self.launchArgs], [FBCollectionInformation oneLineDescriptionFromDictionary:self.processEnv], - self.allProcesses ? @"Yes" : @"No", - self.shim + self.allProcesses ? @"Yes" : @"No" ]; } diff --git a/idb_companion/Utility/FBXCTestDescriptor.h b/idb_companion/Utility/FBXCTestDescriptor.h index 6012a11ab..f9bfc1d78 100644 --- a/idb_companion/Utility/FBXCTestDescriptor.h +++ b/idb_companion/Utility/FBXCTestDescriptor.h @@ -232,12 +232,11 @@ The Initializer for UI Tests. @param request the xctest run request @param testApps the materialized Applications that are used as a part of testing. - @param shims the shims to use for relevant test runs @param logger the logger to log to @param queue the queue to be used for async operations @return a Future wrapping the test launch configuration if constructed successfully or an error. */ -- (FBFuture *)testConfigWithRunRequest:(FBXCTestRunRequest *)request testApps:(FBTestApplicationsPair *)testApps shims:(nullable FBXCTestShimConfiguration *)shims logger:(id)logger queue:(dispatch_queue_t)queue; +- (FBFuture *)testConfigWithRunRequest:(FBXCTestRunRequest *)request testApps:(FBTestApplicationsPair *)testApps logger:(id)logger queue:(dispatch_queue_t)queue; /** Obtains the Test Application Components for the provided target and request diff --git a/idb_companion/Utility/FBXCTestDescriptor.m b/idb_companion/Utility/FBXCTestDescriptor.m index dd06a7f23..833499fbd 100644 --- a/idb_companion/Utility/FBXCTestDescriptor.m +++ b/idb_companion/Utility/FBXCTestDescriptor.m @@ -125,62 +125,58 @@ - (BOOL)isUITest - (FBFuture *)startWithTestDescriptor:(id)testDescriptor target:(id)target reporter:(id)reporter logger:(id)logger temporaryDirectory:(FBTemporaryDirectory *)temporaryDirectory { - return [[FBXCTestShimConfiguration - defaultShimConfigurationWithLogger:logger] - onQueue:target.workQueue fmap:^ FBFuture * (FBXCTestShimConfiguration *shims) { - NSError *error = nil; - NSURL *workingDirectory = [temporaryDirectory ephemeralTemporaryDirectory]; - if (![NSFileManager.defaultManager createDirectoryAtURL:workingDirectory withIntermediateDirectories:YES attributes:nil error:&error]) { - return [FBFuture futureWithError:error]; - } + NSError *error = nil; + NSURL *workingDirectory = [temporaryDirectory ephemeralTemporaryDirectory]; + if (![NSFileManager.defaultManager createDirectoryAtURL:workingDirectory withIntermediateDirectories:YES attributes:nil error:&error]) { + return [FBFuture futureWithError:error]; + } - NSString *logDirectoryPath = nil; - if (self.collectLogs) { - NSURL *dir = [temporaryDirectory ephemeralTemporaryDirectory]; - if (![NSFileManager.defaultManager createDirectoryAtURL:dir withIntermediateDirectories:YES attributes:nil error:&error]) { - return [FBFuture futureWithError:error]; - } - logDirectoryPath = dir.path; - [reporter setLogDirectoryPath:logDirectoryPath]; - } + NSString *logDirectoryPath = nil; + if (self.collectLogs) { + NSURL *dir = [temporaryDirectory ephemeralTemporaryDirectory]; + if (![NSFileManager.defaultManager createDirectoryAtURL:dir withIntermediateDirectories:YES attributes:nil error:&error]) { + return [FBFuture futureWithError:error]; + } + logDirectoryPath = dir.path; + [reporter setLogDirectoryPath:logDirectoryPath]; + } - NSString *coveragePath = nil; - if (self.collectCoverage) { - NSURL *dir = [temporaryDirectory ephemeralTemporaryDirectory]; - NSString *coverageFileName = [NSString stringWithFormat:@"coverage_%@.profraw", NSUUID.UUID.UUIDString]; - coveragePath = [dir.path stringByAppendingPathComponent:coverageFileName]; - } + NSString *coveragePath = nil; + if (self.collectCoverage) { + NSURL *dir = [temporaryDirectory ephemeralTemporaryDirectory]; + NSString *coverageFileName = [NSString stringWithFormat:@"coverage_%@.profraw", NSUUID.UUID.UUIDString]; + coveragePath = [dir.path stringByAppendingPathComponent:coverageFileName]; + } - NSString *testFilter = nil; - NSArray *testsToSkip = self.testsToSkip.allObjects ?: @[]; - if (testsToSkip.count > 0) { - return [[FBXCTestError - describeFormat:@"'Tests to Skip' %@ provided, but Logic Tests to not support this.", [FBCollectionInformation oneLineDescriptionFromArray:testsToSkip]] - failFuture]; - } - NSArray *testsToRun = self.testsToRun.allObjects ?: @[]; - if (testsToRun.count > 1){ - return [[FBXCTestError - describeFormat:@"More than one 'Tests to Run' %@ provided, but only one 'Tests to Run' is supported.", [FBCollectionInformation oneLineDescriptionFromArray:testsToRun]] - failFuture]; - } - testFilter = testsToRun.firstObject; - - NSTimeInterval timeout = self.testTimeout.boolValue ? self.testTimeout.doubleValue : FBLogicTestTimeout; - FBLogicTestConfiguration *configuration = [FBLogicTestConfiguration - configurationWithEnvironment:self.environment - workingDirectory:workingDirectory.path - testBundlePath:testDescriptor.testBundle.path - waitForDebugger:self.waitForDebugger - timeout:timeout - testFilter:testFilter - mirroring:FBLogicTestMirrorFileLogs - coveragePath:coveragePath - binaryPath:testDescriptor.testBundle.binary.path - logDirectoryPath:logDirectoryPath]; - - return [self startTestExecution:configuration target:target reporter:reporter logger:logger]; - }]; + NSString *testFilter = nil; + NSArray *testsToSkip = self.testsToSkip.allObjects ?: @[]; + if (testsToSkip.count > 0) { + return [[FBXCTestError + describeFormat:@"'Tests to Skip' %@ provided, but Logic Tests to not support this.", [FBCollectionInformation oneLineDescriptionFromArray:testsToSkip]] + failFuture]; + } + NSArray *testsToRun = self.testsToRun.allObjects ?: @[]; + if (testsToRun.count > 1){ + return [[FBXCTestError + describeFormat:@"More than one 'Tests to Run' %@ provided, but only one 'Tests to Run' is supported.", [FBCollectionInformation oneLineDescriptionFromArray:testsToRun]] + failFuture]; + } + testFilter = testsToRun.firstObject; + + NSTimeInterval timeout = self.testTimeout.boolValue ? self.testTimeout.doubleValue : FBLogicTestTimeout; + FBLogicTestConfiguration *configuration = [FBLogicTestConfiguration + configurationWithEnvironment:self.environment + workingDirectory:workingDirectory.path + testBundlePath:testDescriptor.testBundle.path + waitForDebugger:self.waitForDebugger + timeout:timeout + testFilter:testFilter + mirroring:FBLogicTestMirrorFileLogs + coveragePath:coveragePath + binaryPath:testDescriptor.testBundle.binary.path + logDirectoryPath:logDirectoryPath]; + + return [self startTestExecution:configuration target:target reporter:reporter logger:logger]; } - (FBFuture *)startTestExecution:(FBLogicTestConfiguration *)configuration target:(id)target reporter:(id)reporter logger:(id)logger @@ -215,21 +211,16 @@ - (BOOL)isUITest - (FBFuture *)startWithTestDescriptor:(id)testDescriptor target:(id)target reporter:(id)reporter logger:(id)logger temporaryDirectory:(FBTemporaryDirectory *)temporaryDirectory { - return [[FBXCTestShimConfiguration - defaultShimConfigurationWithLogger:logger] - onQueue:target.workQueue fmap:^ FBFuture * (FBXCTestShimConfiguration *shims) { - return [[testDescriptor - testAppPairForRequest:self target:target] - onQueue:target.workQueue fmap:^ FBFuture * (FBTestApplicationsPair *pair) { - [logger logFormat:@"Obtaining launch configuration for App Pair %@ on descriptor %@", pair, testDescriptor]; - FBFuture *launchConfigFuture = [testDescriptor testConfigWithRunRequest:self testApps:pair shims:shims logger:logger queue:target.workQueue]; - return [launchConfigFuture onQueue:target.workQueue fmap:^ FBFuture * (FBTestLaunchConfiguration *testConfig) { - [logger logFormat:@"Obtained launch configuration %@", testConfig]; - [reporter setLogDirectoryPath:testConfig.logDirectoryPath]; - return [FBXCTestRunRequest_AppTest startTestExecution:testConfig target:target reporter:reporter logger:logger]; - }]; - - }]; + return [[testDescriptor + testAppPairForRequest:self target:target] + onQueue:target.workQueue fmap:^ FBFuture * (FBTestApplicationsPair *pair) { + [logger logFormat:@"Obtaining launch configuration for App Pair %@ on descriptor %@", pair, testDescriptor]; + FBFuture *launchConfigFuture = [testDescriptor testConfigWithRunRequest:self testApps:pair logger:logger queue:target.workQueue]; + return [launchConfigFuture onQueue:target.workQueue fmap:^ FBFuture * (FBTestLaunchConfiguration *testConfig) { + [logger logFormat:@"Obtained launch configuration %@", testConfig]; + [reporter setLogDirectoryPath:testConfig.logDirectoryPath]; + return [FBXCTestRunRequest_AppTest startTestExecution:testConfig target:target reporter:reporter logger:logger]; + }]; }]; } @@ -482,7 +473,7 @@ - (NSSet *)architectures }]; } -- (FBFuture *)testConfigWithRunRequest:(FBXCTestRunRequest *)request testApps:(FBTestApplicationsPair *)testApps shims:(FBXCTestShimConfiguration *)shims logger:(id)logger queue:(dispatch_queue_t)queue +- (FBFuture *)testConfigWithRunRequest:(FBXCTestRunRequest *)request testApps:(FBTestApplicationsPair *)testApps logger:(id)logger queue:(dispatch_queue_t)queue { BOOL uiTesting = NO; @@ -596,7 +587,7 @@ - (NSSet *)architectures return [FBFuture futureWithResult:[[FBTestApplicationsPair alloc] initWithApplicationUnderTest:nil testHostApp:nil]]; } -- (FBFuture *)testConfigWithRunRequest:(FBXCTestRunRequest *)request testApps:(FBTestApplicationsPair *)testApps shims:(FBXCTestShimConfiguration *)shims logger:(id)logger queue:(dispatch_queue_t)queue +- (FBFuture *)testConfigWithRunRequest:(FBXCTestRunRequest *)request testApps:(FBTestApplicationsPair *)testApps logger:(id)logger queue:(dispatch_queue_t)queue { NSString *resultBundleName = [NSString stringWithFormat:@"resultbundle_%@", NSUUID.UUID.UUIDString]; NSString *resultBundlePath = [self.targetAuxillaryDirectory stringByAppendingPathComponent:resultBundleName];