Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validating the numSims configuration and adjusting it when needed #335

Merged
merged 1 commit into from
Jun 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions bluepill/src/BPRunner.m
Original file line number Diff line number Diff line change
Expand Up @@ -214,17 +214,18 @@ - (int)runWithBPXCTestFiles:(NSArray<BPXCTestFile *> *)xcTestFiles {
}
if (bundles.count < numSims) {
[BPUtils printInfo:WARNING
withString:@"Lowering number of parallel simulators from %lu to %lu because there aren't enough tests.",
withString:@"Lowering number of parallel simulators from %lu to %lu because there aren't enough test bundles.",
numSims, bundles.count];
numSims = bundles.count;
}
if (self.config.cloneSimulator) {
self.testHostForSimUDID = [bpSimulator createSimulatorAndInstallAppWithBundles:xcTestFiles];
if ([self.testHostForSimUDID count] == 0) {
return 1;
}
}
[BPUtils printInfo:INFO withString:@"Running with %lu parallel simulator%s.",
(unsigned long)numSims, (numSims > 1) ? "s" : ""];
[BPUtils printInfo:INFO withString:@"Running with %lu %s.",
(unsigned long)numSims, (numSims > 1) ? "parallel simulators" : "simulator"];
NSArray *copyBundles = [NSMutableArray arrayWithArray:bundles];
for (int i = 1; i < [self.config.repeatTestsCount integerValue]; i++) {
[bundles addObjectsFromArray:copyBundles];
Expand Down
4 changes: 4 additions & 0 deletions bp/src/BPConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,10 @@ - (BOOL)loadConfigFile:(NSString *)file withError:(NSError **)errPtr{
}
}
}
if (self.numSims.integerValue < 1) {
BP_SET_ERROR(errPtr, @"Number of simulators set to %lu but there cannot be fewer than one simulator.", self.numSims.integerValue);
return NO;
}
// Pull out two keys that are undocumented but needed for supporting xctest
self.commandLineArguments = [configDict objectForKey:@"commandLineArguments"];
self.environmentVariables = [configDict objectForKey:@"environmentVariables"];
Expand Down