From 01259e03a9b9c150fa5b56cf482dc5b783fe4e21 Mon Sep 17 00:00:00 2001 From: Pavel Dusatko Date: Wed, 29 Sep 2021 09:54:17 -0700 Subject: [PATCH] Add Xcode 13 support (#500) * Add Xcode 13 support Signed-off-by: Pavel Dusatko * Fix Xcode paths Signed-off-by: Pavel Dusatko * Fix Xcode 13 path Signed-off-by: Oscar Bonilla <6f6231@gmail.com> * Updating the README with Xcode 12.5 branch Signed-off-by: Ravi Mandala * Fixing a test and splitting a reporting diagnostics test Signed-off-by: Ravi Mandala * Skipping data-container flag to significantly reduce the diagnostics archive size Signed-off-by: Ravi Mandala Co-authored-by: Oscar Bonilla <6f6231@gmail.com> Co-authored-by: Ravi Mandala --- .github/workflows/PR.yml | 12 ++++---- .github/workflows/master.yml | 12 ++++---- .github/workflows/release.yml | 12 ++++---- Configurations/common.xcconfig | 2 +- README.md | 4 +-- bp/bp.xcodeproj/project.pbxproj | 4 --- bp/src/BPConstants.h | 6 ++-- bp/src/BPUtils.m | 2 +- bp/tests/BPReportTests.m | 28 ++++++++++++++++--- .../Resource Files/fatal_tests_attempt_3.xml | 3 +- 10 files changed, 50 insertions(+), 35 deletions(-) diff --git a/.github/workflows/PR.yml b/.github/workflows/PR.yml index fec22c94..5f4ae9ba 100644 --- a/.github/workflows/PR.yml +++ b/.github/workflows/PR.yml @@ -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 12.5 - run: sudo xcode-select -s /Applications/Xcode_12.5.app + - name: Select Xcode 13.0 + run: sudo xcode-select -s /Applications/Xcode_13.0.app - name: Run Bluepill tests run: ./scripts/bluepill.sh instance_tests1 - name: Capture xcresult files @@ -29,8 +29,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 12.5 - run: sudo xcode-select -s /Applications/Xcode_12.5.app + - name: Select Xcode 13.0 + run: sudo xcode-select -s /Applications/Xcode_13.0.app - name: Run Bluepill tests run: ./scripts/bluepill.sh instance_tests2 - name: Capture xcresult files @@ -48,8 +48,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 12.5 - run: sudo xcode-select -s /Applications/Xcode_12.5.app + - name: Select Xcode 13.0 + run: sudo xcode-select -s /Applications/Xcode_13.0.app - name: Run Bluepill tests run: ./scripts/bluepill.sh runner_tests - name: Capture xcresult files diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 44d9cc81..609f9a49 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -15,8 +15,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 12.5 - run: sudo xcode-select -s /Applications/Xcode_12.5.app + - name: Select Xcode 13.0 + run: sudo xcode-select -s /Applications/Xcode_13.0.app - name: Run Bluepill tests run: ./scripts/bluepill.sh instance_tests1 - name: Capture xcresult files @@ -34,8 +34,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 12.5 - run: sudo xcode-select -s /Applications/Xcode_12.5.app + - name: Select Xcode 13.0 + run: sudo xcode-select -s /Applications/Xcode_13.0.app - name: Run Bluepill tests run: ./scripts/bluepill.sh instance_tests2 - name: Capture xcresult files @@ -53,8 +53,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 12.5 - run: sudo xcode-select -s /Applications/Xcode_12.5.app + - name: Select Xcode 13.0 + run: sudo xcode-select -s /Applications/Xcode_13.0.app - name: Run Bluepill tests run: ./scripts/bluepill.sh runner_tests - name: Capture xcresult files diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 61a057cc..e3369c4f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,8 +13,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 12.5 - run: sudo xcode-select -s /Applications/Xcode_12.5.app + - name: Select Xcode 13.0 + run: sudo xcode-select -s /Applications/Xcode_13.0.app - name: Run Bluepill tests run: ./scripts/bluepill.sh instance_tests1 - name: Capture xcresult files @@ -32,8 +32,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 12.5 - run: sudo xcode-select -s /Applications/Xcode_12.5.app + - name: Select Xcode 13.0 + run: sudo xcode-select -s /Applications/Xcode_13.0.app - name: Run Bluepill tests run: ./scripts/bluepill.sh instance_tests2 - name: Capture xcresult files @@ -54,8 +54,8 @@ jobs: - name: Report event trigger data run: | echo "Event ${{ github.event_name }}, ref: ${{ github.ref }}" - - name: Select Xcode 12.5 - run: sudo xcode-select -s /Applications/Xcode_12.5.app + - name: Select Xcode 13.0 + run: sudo xcode-select -s /Applications/Xcode_13.0.app - name: Run Bluepill tests run: ./scripts/bluepill.sh runner_tests - name: Capture xcresult files diff --git a/Configurations/common.xcconfig b/Configurations/common.xcconfig index 7b531a7e..c953ba1c 100644 --- a/Configurations/common.xcconfig +++ b/Configurations/common.xcconfig @@ -15,4 +15,4 @@ DEPLOYMENT_LOCATION = YES // Used by bluepill and bp to search for frameworks. FRAMEWORK_SEARCH_PATHS = "/Library/Developer/PrivateFrameworks" "$(PRIVATE_FRAMEWORKS_DIR)" "$(DEVELOPER_PRIVATE_FRAMEWORKS_DIR)" "$(DEVELOPER_DIR)/Platforms/MacOSX.platform/Developer/Library/Frameworks" "$(DEVELOPER_DIR)/Library/PrivateFrameworks" "$(DEVELOPER_DIR)/../SharedFrameworks" "$(DEVELOPER_DIR)/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks" -OTHER_LDFLAGS = -weak_framework DVTFoundation -weak_framework DVTiPhoneSimulatorRemoteClient -weak_framework CoreSimulator -weak_framework XCTest -weak_framework DTXConnectionServices -weak_framework SimulatorKit +OTHER_LDFLAGS = -weak_framework DVTFoundation -weak_framework CoreSimulator -weak_framework XCTest -weak_framework DTXConnectionServices -weak_framework SimulatorKit diff --git a/README.md b/README.md index e663f6e9..a71be46d 100644 --- a/README.md +++ b/README.md @@ -104,11 +104,11 @@ The exit code of Bluepill uses bit indicators which could represent multiple exi ## Requirements -Bluepill officially supports **Xcode 12.5**. If you're looking for old Xcode support, please checkout the following branches: +Bluepill officially supports **Xcode 13.0**. If you're looking for old Xcode support, please checkout the following branches: * [Xcode-10.0](https://github.com/linkedin/bluepill/tree/xcode-10.0) | [Xcode-10.1](https://github.com/linkedin/bluepill/tree/xcode-10.1) | [Xcode-10.2](https://github.com/linkedin/bluepill/tree/xcode-10.2) | [Xcode-10.3](https://github.com/linkedin/bluepill/tree/xcode-10.3) * [Xcode-11.0](https://github.com/linkedin/bluepill/tree/xcode-11.0) | [Xcode-11.1](https://github.com/linkedin/bluepill/tree/xcode-11.1) | [Xcode-11.2](https://github.com/linkedin/bluepill/tree/xcode-11.2) | [Xcode-11.3](https://github.com/linkedin/bluepill/tree/xcode-11.3) | [Xcode-11.4](https://github.com/linkedin/bluepill/tree/xcode-11.4) | [Xcode-11.5](https://github.com/linkedin/bluepill/tree/xcode-11.5) -* [Xcode-12.0](https://github.com/linkedin/bluepill/tree/xcode-12.0) | [Xcode-12.2](https://github.com/linkedin/bluepill/tree/xcode-12.2) | [Xcode-12.3](https://github.com/linkedin/bluepill/tree/xcode-12.3) | [Xcode-12.4](https://github.com/linkedin/bluepill/tree/xcode-12.4) +* [Xcode-12.0](https://github.com/linkedin/bluepill/tree/xcode-12.0) | [Xcode-12.2](https://github.com/linkedin/bluepill/tree/xcode-12.2) | [Xcode-12.3](https://github.com/linkedin/bluepill/tree/xcode-12.3) | [Xcode-12.4](https://github.com/linkedin/bluepill/tree/xcode-12.4) | [Xcode-12.5](https://github.com/linkedin/bluepill/tree/xcode-12.5) If you're looking for newer Xcode version support, try using Bluepill with `unsafe-skip-xcode-version-check` flag but make sure your app is tested with it and the underlying risks are understand. diff --git a/bp/bp.xcodeproj/project.pbxproj b/bp/bp.xcodeproj/project.pbxproj index 2600ed6e..ab6c29ab 100644 --- a/bp/bp.xcodeproj/project.pbxproj +++ b/bp/bp.xcodeproj/project.pbxproj @@ -1184,8 +1184,6 @@ "-weak_framework", DVTFoundation, "-weak_framework", - DVTiPhoneSimulatorRemoteClient, - "-weak_framework", CoreSimulator, "-weak_framework", XCTest, @@ -1219,8 +1217,6 @@ "-weak_framework", DVTFoundation, "-weak_framework", - DVTiPhoneSimulatorRemoteClient, - "-weak_framework", CoreSimulator, "-weak_framework", XCTest, diff --git a/bp/src/BPConstants.h b/bp/src/BPConstants.h index 3ee1a3d0..648f6230 100644 --- a/bp/src/BPConstants.h +++ b/bp/src/BPConstants.h @@ -10,9 +10,9 @@ #import #pragma mark - Version Constants -#define BP_DEFAULT_XCODE_VERSION "12.5" -#define BP_DEFAULT_RUNTIME "iOS 14.5" -#define BP_DEFAULT_BASE_SDK "14.5" +#define BP_DEFAULT_XCODE_VERSION "13.0" +#define BP_DEFAULT_RUNTIME "iOS 15.0" +#define BP_DEFAULT_BASE_SDK "15.0" #define BP_DEFAULT_DEVICE_TYPE "iPhone 8" diff --git a/bp/src/BPUtils.m b/bp/src/BPUtils.m index 814bf3e6..3b8bf87b 100644 --- a/bp/src/BPUtils.m +++ b/bp/src/BPUtils.m @@ -288,7 +288,7 @@ + (void)saveDebuggingDiagnostics:(NSString *)outputDirectory { if (outputDirectory == nil || !([fm fileExistsAtPath:outputDirectory isDirectory:&isDir] && isDir)) { return; } - NSString *cmd = [NSString stringWithFormat:@"xcrun simctl diagnose -l -b --output='%@/diagnostics' --data-container", outputDirectory]; + NSString *cmd = [NSString stringWithFormat:@"xcrun simctl diagnose -l -b --output='%@/diagnostics'", outputDirectory]; [BPUtils runShell:cmd]; cmd = [NSString stringWithFormat:@"ps axuw > '%@'/ps-axuw.log", outputDirectory]; [BPUtils runShell:cmd]; diff --git a/bp/tests/BPReportTests.m b/bp/tests/BPReportTests.m index 8650e54e..496eb3fd 100644 --- a/bp/tests/BPReportTests.m +++ b/bp/tests/BPReportTests.m @@ -408,13 +408,12 @@ - (void)testReportSuccessOnTestFailedAndPassOnRetry { XCTAssertTrue(exitCode == BPExitStatusAllTestsPassed); } -- (void)testReportWithFailingTestsSetAndDiagnostics { +- (void)testReportWithFailingTestsSet { NSString *tempDir = NSTemporaryDirectory(); NSError *error; NSString *outputDir = [BPUtils mkdtemp:[NSString stringWithFormat:@"%@/FailingTestsSetTempDir", tempDir] withError:&error]; - // NSLog(@"output directory is %@", outputDir); + NSLog(@"output directory is %@", outputDir); self.config.outputDirectory = outputDir; - self.config.saveDiagnosticsOnError = YES; self.config.testCasesToSkip = @[@"BPAppNegativeTests/testBPDoesNotHangWithBigOutput"]; BPExitStatus exitCode = [[[Bluepill alloc ] initWithConfiguration:self.config] run]; // Make sure all tests started on the first run @@ -433,6 +432,27 @@ - (void)testReportWithFailingTestsSetAndDiagnostics { NSLog(@"Junit report: %@", junitReportPath); NSString *expectedFilePath = [[[NSBundle bundleForClass:[self class]] resourcePath] stringByAppendingPathComponent:@"BPAppNegativeTests-results.xml"]; [self assertGotReport:junitReportPath isEqualToWantReport:expectedFilePath]; + XCTAssert(exitCode == BPExitStatusTestsFailed); +} + +/** + Execution plan: TIMEOUT, CRASH (not retried) + */ +- (void)testReportFailureOnTimeoutCrashAndPassWithDiagnostics { + self.config.stuckTimeout = @6; + self.config.testing_ExecutionPlan = @"TIMEOUT CRASH"; + self.config.errorRetriesCount = @4; + self.config.onlyRetryFailed = TRUE; + NSString *tempDir = NSTemporaryDirectory(); + NSError *error; + NSString *outputDir = [BPUtils mkdtemp:[NSString stringWithFormat:@"%@/FailingTestsSetTempDir", tempDir] withError:&error]; + NSLog(@"output directory is %@", outputDir); + self.config.outputDirectory = outputDir; + self.config.saveDiagnosticsOnError = YES; + NSString *testBundlePath = [BPTestHelper sampleAppHangingTestsBundlePath]; + self.config.testBundlePath = testBundlePath; + + BPExitStatus exitCode = [[[Bluepill alloc ] initWithConfiguration:self.config] run]; NSFileManager *fm = [NSFileManager defaultManager]; [BPUtils runShell:[NSString stringWithFormat:@"find %@", outputDir]]; BOOL diagFileFound = [fm fileExistsAtPath:[NSString stringWithFormat:@"%@/diagnostics.tar.gz", outputDir]]; @@ -441,7 +461,7 @@ - (void)testReportWithFailingTestsSetAndDiagnostics { XCTAssert(psFileFound); BOOL dfFileFound = [fm fileExistsAtPath:[NSString stringWithFormat:@"%@/df-h.log", outputDir]]; XCTAssert(dfFileFound); - XCTAssert(exitCode == BPExitStatusTestsFailed); + XCTAssertTrue(exitCode == BPExitStatusAppCrashed); } #pragma mark - Test helpers diff --git a/bp/tests/Resource Files/fatal_tests_attempt_3.xml b/bp/tests/Resource Files/fatal_tests_attempt_3.xml index b8dd6832..757965d1 100644 --- a/bp/tests/Resource Files/fatal_tests_attempt_3.xml +++ b/bp/tests/Resource Files/fatal_tests_attempt_3.xml @@ -1,11 +1,10 @@ + - -