Skip to content
Open
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
31 changes: 29 additions & 2 deletions bluepill/src/BPPacker.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,35 @@ @implementation BPPacker
[BPUtils printInfo:INFO withString:@"Packing test bundles based on test counts."];
NSArray *testCasesToRun = config.testCasesToRun;
NSArray *noSplit = config.noSplit;
NSUInteger numBundles = [[config numSims] integerValue];
NSArray *sortedXCTestFiles = [xcTestFiles sortedArrayUsingComparator:^NSComparisonResult(id _Nonnull obj1, id _Nonnull obj2) {
NSUInteger numBundles = [config.numSims integerValue];
NSMutableArray *filteredXcTestFiles = [NSMutableArray new];

for (BPXCTestFile *xcFile in xcTestFiles) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it Github or the indentation is off?

if (config.xcTestFileToRun) {
for(NSString *includedTestFile in config.xcTestFileToRun) {
if ([[xcFile name] isEqualToString:includedTestFile]) {
[filteredXcTestFiles addObject:xcFile];
break;
}
}
} else {
[filteredXcTestFiles addObject:xcFile];
}
}

if (config.xcTestFileToSkip) {
for (BPXCTestFile *xcFile in [NSArray arrayWithArray:filteredXcTestFiles]) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you merge these 2 for loops?

for(NSString *excludedXcTestFile in config.xcTestFileToSkip) {
if ([[xcFile name] isEqualToString:excludedXcTestFile]) {
[filteredXcTestFiles removeObject:xcFile];
break;
}
}
}
}


NSArray *sortedXCTestFiles = [filteredXcTestFiles sortedArrayUsingComparator:^NSComparisonResult(id _Nonnull obj1, id _Nonnull obj2) {
NSUInteger numTests1 = [(BPXCTestFile *)obj1 numTests];
NSUInteger numTests2 = [(BPXCTestFile *)obj2 numTests];
return numTests2 - numTests1;
Expand Down
2 changes: 2 additions & 0 deletions bp/src/BPConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ typedef NS_ENUM(NSInteger, BPProgram) {
@property (nonatomic, strong) NSNumber *failureTolerance;
@property (nonatomic) BOOL onlyRetryFailed;
@property (nonatomic, strong) NSArray *testCasesToSkip;
@property (nonatomic, strong) NSArray *xcTestFileToSkip;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xcTestFile -> testSuites please, closer to Xcode terminology

@property (nonatomic, strong) NSArray *testCasesToRun;
@property (nonatomic, strong) NSArray *xcTestFileToRun;
@property (nonatomic, strong) NSArray *allTestCases;
@property (nonatomic, strong) NSString *configOutputFile;
@property (nonatomic, strong) NSString *outputDirectory;
Expand Down
4 changes: 4 additions & 0 deletions bp/src/BPConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ typedef NS_OPTIONS(NSUInteger, BPOptionType) {
{364, "test-plan-path", BP_MASTER | BP_SLAVE, NO, NO, required_argument, NULL, BP_VALUE | BP_PATH, "testPlanPath",
"The path of a json file which describes the test plan. It is equivalent to the .xctestrun file generated by Xcode, but it can be generated by a different build system, e.g. Bazel"},

{365, "exclude-xctest-file", BP_MASTER | BP_SLAVE, NO, NO, required_argument, NULL, BP_LIST, "xcTestFileToSkip",
"Exclude a xctestfile in the set of tests to run (takes priority over `include`)."},
{366, "include-xctest-file", BP_MASTER | BP_SLAVE, NO, NO, required_argument, NULL, BP_LIST, "xcTestFileToRun", "Include a xctestfile in the set of tests to run (unless specified in `exclude`)."},

{0, 0, 0, 0, 0, 0, 0}
};

Expand Down