Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into DYLD_FALLBACK_LIBRARY_PATH
Browse files Browse the repository at this point in the history
* master:
  Reference libXCTestBundleInject.dylib only if it exists (MobileNativeFoundation#460)
  Record video using simctl (MobileNativeFoundation#441)
  Xcode 12.0 support (MobileNativeFoundation#458)
  Retry app crash tests and consider then non-fatal if they pass (MobileNativeFoundation#456)
  Do not retry crashed tests (MobileNativeFoundation#443)
  Fixing minor issues and doing some minor refactoring/clean-up (MobileNativeFoundation#444)
  Xcode 11.5 support (MobileNativeFoundation#447)
  Xcode 11.4 support (MobileNativeFoundation#446)
  Add a flag to disable Xcode version check failure (MobileNativeFoundation#436)
  Support sidecar applications (MobileNativeFoundation#438)
  Added a few more tests to mock test failure scenarios and fixed a few final Exit Status issues  (MobileNativeFoundation#430)
  make retry checks more resilient to prevent infinite retries (MobileNativeFoundation#432)
  Xcode 11.3 support (MobileNativeFoundation#426)
  Supporting tests and app hosts in subfolders (MobileNativeFoundation#419)

# Conflicts:
#	bp/src/SimulatorHelper.m
#	bp/tests/SimulatorHelperTests.m
  • Loading branch information
AhmedEid committed Nov 18, 2020
2 parents e4cbc96 + db09487 commit 65fec64
Show file tree
Hide file tree
Showing 35 changed files with 1,018 additions and 305 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
steps:
# actions/checkout@v2 but we use the SHA1 because tags can be re-written in git
- uses: actions/checkout@722adc63f1aa60a57ec37892e133b1d319cae598
- name: Select Xcode 11.2
run: sudo xcode-select -s /Applications/Xcode_11.2.app
- name: Select Xcode 12
run: sudo xcode-select -s /Applications/Xcode_12.app
- name: Run Bluepill tests
run: ./scripts/bluepill.sh instance_tests

Expand All @@ -22,8 +22,8 @@ jobs:
steps:
# actions/checkout@v2 but we use the SHA1 because tags can be re-written in git
- uses: actions/checkout@722adc63f1aa60a57ec37892e133b1d319cae598
- name: Select Xcode 11.2
run: sudo xcode-select -s /Applications/Xcode_11.2.app
- name: Select Xcode 12
run: sudo xcode-select -s /Applications/Xcode_12.app
- name: Run BP tests
run: ./scripts/bluepill.sh runner_tests
- name: Build and Package
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@ jobs:
# First machine, runs Bluepill tests
integration_tests:
name: Bluepill Test
runs-on: macOS-latest
runs-on: macos-latest
steps:
# actions/checkout@v2 but we use the sha because tags can be rewritten in git
- uses: actions/checkout@722adc63f1aa60a57ec37892e133b1d319cae598
- name: Select Xcode 11.2
run: sudo xcode-select -s /Applications/Xcode_11.2.app
- name: Select Xcode 12
run: sudo xcode-select -s /Applications/Xcode_12.app
- name: Run Bluepill tests
run: ./scripts/bluepill.sh instance_tests

# Second machine, runs BP tests and makes build
build:
name: BP Test and build
runs-on: macOS-latest
runs-on: macos-latest
steps:
# actions/checkout@v2 but we use the sha because tags can be rewritten in git
- uses: actions/checkout@722adc63f1aa60a57ec37892e133b1d319cae598
- name: Select Xcode 11.2
run: sudo xcode-select -s /Applications/Xcode_11.2.app
- name: Select Xcode 12
run: sudo xcode-select -s /Applications/Xcode_12.app
- name: Run BP tests
run: ./scripts/bluepill.sh runner_tests
- name: Build and Package
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,27 @@ jobs:
# First machine, runs Bluepill tests
integration_tests:
name: Bluepill Test
runs-on: macOS-latest
runs-on: macos-latest
steps:
# actions/checkout@v2 but we use the sha because tags can be rewritten in git
- uses: actions/checkout@722adc63f1aa60a57ec37892e133b1d319cae598
- name: Select Xcode 11.2
run: sudo xcode-select -s /Applications/Xcode_11.2.app
- name: Select Xcode 12
run: sudo xcode-select -s /Applications/Xcode_12.app
- name: Run Bluepill tests
run: ./scripts/bluepill.sh instance_tests

# Second machine, runs BP tests and makes build
build:
name: BP Test and build
runs-on: macOS-latest
runs-on: macos-latest
steps:
# actions/checkout@v2 but we use the sha because tags can be rewritten in git
- uses: actions/checkout@722adc63f1aa60a57ec37892e133b1d319cae598
- name: Report event trigger data
run: |
echo "Event ${{ github.event_name }}, ref: ${{ github.ref }}"
- name: Select Xcode 11.2
run: sudo xcode-select -s /Applications/Xcode_11.2.app
- name: Select Xcode 12
run: sudo xcode-select -s /Applications/Xcode_12.app
- name: Run Bluepill tests
run: ./scripts/bluepill.sh runner_tests
- name: Build Bluepill
Expand Down
87 changes: 84 additions & 3 deletions BPSampleApp/BPSampleAppHangingTests/BPSampleAppHangingTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,100 @@ @interface BPSampleAppHangingTests : XCTestCase

@implementation BPSampleAppHangingTests

-(long)attemptFromSimulatorVersionInfo:(NSString *)simulatorVersionInfo {
// simulatorVersionInfo is something like
// CoreSimulator 587.35 - Device: BP93497-2-2 (7AB3D528-5473-401A-B23E-2E2E86C73861) - Runtime: iOS 12.2 (16E226) - DeviceType: iPhone 7
NSLog(@"Dissecting version info %@ to extra attempt number.", simulatorVersionInfo);
NSArray<NSString *> *parts = [simulatorVersionInfo componentsSeparatedByString:@" - "];
NSString *deviceString = parts[1];
// Device: BP93497-2-2 (7AB3D528-5473-401A-B23E-2E2E86C73861)
parts = [deviceString componentsSeparatedByString:@" "];
NSString *device = parts[1];
// BP93497-2-2
parts = [device componentsSeparatedByString:@"-"];
NSString *attempt = parts[1];
return [attempt longLongValue];
}

-(void)extractPlanAndExecuteActions:(int)index {
NSDictionary *env = [[NSProcessInfo processInfo] environment];
NSString *simulatorVersionInfo = [env objectForKey:@"SIMULATOR_VERSION_INFO"];
long attempt = [self attemptFromSimulatorVersionInfo:simulatorVersionInfo];
NSString *executionPlan = [env objectForKey:@"_BP_TEST_EXECUTION_PLAN"];
if (!executionPlan) {
NSLog(@"No execution plan found in attempt#%ld. Failing the test.", attempt);
XCTAssert(NO);
return;
}
NSLog(@"Received execution plan %@ on attempt#%ld for this test.", executionPlan, attempt);
NSArray *setsOfPlans = [executionPlan componentsSeparatedByString:@";"];
if (index >= [setsOfPlans count]) {
NSLog(@"Not enough plans for test#%d in execution plan: '%@'.", index, executionPlan);
XCTAssert(YES);
return;
}
NSString *currentPlan = setsOfPlans[index];
currentPlan = [currentPlan stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
NSArray *array = [currentPlan componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
if (attempt > [array count]) {
NSLog(@"Passing on attempt#%ld, by default, as there is no action defined in the execution plan", (long)attempt);
XCTAssert(YES);
return;
}
NSString *action = array[attempt - 1];
if ([action isEqualToString:@"TIMEOUT"]) {
NSLog(@"Entering into an infinite loop on attempt#%ld to timeout as per the execution plan", (long)attempt);
while(1) {
}
return;
} else if ([action isEqualToString:@"PASS"]) {
NSLog(@"Passing on attempt#%ld based on execution plan", (long)attempt);
XCTAssert(YES);
return;
} else if ([action isEqualToString:@"FAIL"]) {
NSLog(@"Failing on attempt#%ld based on execution plan", (long)attempt);
XCTAssert(NO);
return;
} else if ([action isEqualToString:@"CRASH"]) {
NSLog(@"Crashing on attempt#%ld based on execution plan", (long)attempt);
// ok, let's crash and burn
int *pointer = nil;
*pointer = 1;
return;
}
NSLog(@"Failing on attempt#%ld as an unidentified action is encountered in the execution plan", (long)attempt);
XCTAssert(NO);
return;
}

- (void)setUp {
[super setUp];
// Put setup code here. This method is called before the invocation of each test method in the class.

}

- (void)tearDown {
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
}

- (void)testAppHanging {
while(TRUE){};
- (void)testASimpleTest {
XCTAssert(YES);
}

- (void)testBasedOnExecutionPlan {
[self extractPlanAndExecuteActions:0];
}

- (void)testCaseFinal {
XCTAssert(YES);
}

- (void)testDoubleBasedOnExecutionPlan {
[self extractPlanAndExecuteActions:1];
}

- (void)testEndFinal {
XCTAssert(YES);
}

@end
Loading

0 comments on commit 65fec64

Please sign in to comment.