Skip to content

Commit

Permalink
Add a couple more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
lthrockmorton committed Jun 16, 2023
1 parent 8ee43b4 commit 3da0fe4
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
45 changes: 45 additions & 0 deletions bluepill/tests/BPIntegrationTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,32 @@ - (void)testLogicTestBundles {
XCTAssert([runner busySwimlaneCount] == 0);
}

- (void)testTwoBPInstancesWithLogicTestPlanJson {
[self writeLogicTestPlan];
BPConfiguration *config = [BPTestUtils makeUnhostedTestConfiguration];
config.numSims = @2;
config.testBundlePath = nil;
config.testRunnerAppPath = nil;
config.appBundlePath = nil;
config.testPlanPath = [BPTestHelper testPlanPath];

NSError *err;
[config validateConfigWithError:&err];
BPApp *app = [BPApp appWithConfig:config withError:&err];
NSString *bpPath = [BPTestHelper bpExecutablePath];
BPRunner *runner = [BPRunner BPRunnerWithConfig:config withBpPath:bpPath];
XCTAssert(runner != nil);
int rc = [runner runWithBPXCTestFiles:app.testBundles];
XCTAssert(rc != 0); // this runs tests that fail
XCTAssertEqual(app.testBundles.count, 2);
XCTAssertTrue([app.testBundles[0].name isEqualToString:@"BPLogicTests"]);
XCTAssertEqual(app.testBundles[0].numTests, 10);
XCTAssertEqual(app.testBundles[0].skipTestIdentifiers.count, 0);
XCTAssertTrue([app.testBundles[1].name isEqualToString:@"BPPassingLogicTests"]);
XCTAssertEqual(app.testBundles[1].numTests, 207);
XCTAssertEqual(app.testBundles[1].skipTestIdentifiers.count, 0);
}

- (void)testOneBPInstance {
BPConfiguration *config = [self generateConfig];
config.numSims = @1;
Expand Down Expand Up @@ -250,6 +276,25 @@ - (void)writeTestPlan {
[jsonData writeToFile:[BPTestHelper testPlanPath] atomically:YES];
}

- (void)writeLogicTestPlan {
NSDictionary *testPlan = @{
@"tests": @{
@"BPLogicTests": @{
@"test_bundle_path": [BPTestHelper logicTestBundlePath],
@"environment": @{},
@"arguments": @{}
},
@"BPPassingLogicTests": @{
@"test_bundle_path": [BPTestHelper passingLogicTestBundlePath],
@"environment": @{},
@"arguments": @{}
}
}
};
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:testPlan options:0 error:nil];
[jsonData writeToFile:[BPTestHelper testPlanPath] atomically:YES];
}

// TODO: Enable this when we figure out issue #469
- (void)DISABLE_testTwoBPInstancesWithVideo {
NSFileManager *fileManager = [NSFileManager defaultManager];
Expand Down
2 changes: 2 additions & 0 deletions bp/tests/BPCLITests.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ - (void)testListArguments {
[config saveOpt:[NSNumber numberWithInt:'N'] withArg:[NSString stringWithUTF8String:"foo"]];
[config saveOpt:[NSNumber numberWithInt:'N'] withArg:[NSString stringWithUTF8String:"bar"]];
[config saveOpt:[NSNumber numberWithInt:'N'] withArg:[NSString stringWithUTF8String:"baz"]];
[config saveOpt:[NSNumber numberWithInt:369] withArg:@"YES"];

NSError *err;
BOOL result;
Expand All @@ -54,6 +55,7 @@ - (void)testListArguments {
XCTAssertEqualObjects(config.errorRetriesCount, @2);
XCTAssertEqualObjects(config.failureTolerance, @1);
XCTAssertEqualObjects(config.numSims, @5);
XCTAssert(config.isLogicTestTarget);
}

- (void)testIgnoringAdditionalTestBundles {
Expand Down

0 comments on commit 3da0fe4

Please sign in to comment.