diff --git a/.bazel-version b/.bazel-version index 1b58cc10..83b47304 100644 --- a/.bazel-version +++ b/.bazel-version @@ -1 +1 @@ -0.27.0 +0.27.1 diff --git a/bp/src/BPConfiguration.m b/bp/src/BPConfiguration.m index 15af54fa..da65f28b 100644 --- a/bp/src/BPConfiguration.m +++ b/bp/src/BPConfiguration.m @@ -318,7 +318,7 @@ -(id)copyWithZone:(NSZone *)zone { } - (id)mutableCopyWithZone:(NSZone *)zone { - BPConfiguration *newConfig = [[BPConfiguration alloc] initWithProgram:self.program]; + BPConfiguration *newConfig = [[BPConfiguration alloc] initWithProgram:(int)self.program]; assert(newConfig); for(int i = 0; BPOptions[i].name; i++) { const char *name = BPOptions[i].property; diff --git a/bp/src/Bluepill.m b/bp/src/Bluepill.m index b6640c84..5fbaa223 100644 --- a/bp/src/Bluepill.m +++ b/bp/src/Bluepill.m @@ -121,6 +121,7 @@ - (void)retry { if (self.failureTolerance == 0) { // If there is no more retries, set the final exitCode to current context's exitCode self.finalExitStatus = self.context.exitStatus | self.context.finalExitStatus; + [BPUtils printInfo:INFO withString:@"%s:%d finalExitStatus = %@", __FILE__, __LINE__, [BPExitStatusHelper stringFromExitStatus:self.finalExitStatus]]; self.exitLoop = YES; return; } @@ -155,6 +156,7 @@ - (void)recover { // If error retry reach to the max, then return if (self.retries == [self.config.errorRetriesCount integerValue]) { self.finalExitStatus = self.context.exitStatus | self.context.finalExitStatus; + [BPUtils printInfo:INFO withString:@"%s:%d finalExitStatus = %@", __FILE__, __LINE__, [BPExitStatusHelper stringFromExitStatus:self.finalExitStatus]]; self.exitLoop = YES; [BPUtils printInfo:ERROR withString:@"Too many retries have occurred. Giving up."]; return; @@ -182,6 +184,7 @@ - (void)recover { - (void)proceed { if (self.retries == [self.config.errorRetriesCount integerValue]) { self.finalExitStatus = self.context.exitStatus | self.context.finalExitStatus; + [BPUtils printInfo:INFO withString:@"%s:%d finalExitStatus = %@", __FILE__, __LINE__, [BPExitStatusHelper stringFromExitStatus:self.finalExitStatus]]; self.exitLoop = YES; [BPUtils printInfo:ERROR withString:@"Too many retries have occurred. Giving up."]; return; @@ -600,7 +603,10 @@ - (void)finishWithContext:(BPExecutionContext *)context { if (![self hasRemainingTestsInContext:context] && (context.attemptNumber <= [context.config.errorRetriesCount integerValue])) { [BPUtils printInfo:INFO withString:@"No more tests to run."]; - self.finalExitStatus = context.exitStatus; + [BPUtils printInfo:INFO withString:@"%s:%d finalExitStatus = %@", __FILE__, __LINE__, [BPExitStatusHelper stringFromExitStatus:self.finalExitStatus]]; + // TODO: Temporarily disabling the fix from PR#338 while the issue is being investigated + // self.finalExitStatus = context.exitStatus; + self.finalExitStatus = context.finalExitStatus | context.exitStatus; self.exitLoop = YES; return; } @@ -651,6 +657,7 @@ - (void)finishWithContext:(BPExecutionContext *)context { case BPExitStatusSimulatorDeleted: case BPExitStatusSimulatorReuseFailed: self.finalExitStatus = context.exitStatus; + [BPUtils printInfo:INFO withString:@"%s:%d finalExitStatus = %@", __FILE__, __LINE__, [BPExitStatusHelper stringFromExitStatus:self.finalExitStatus]]; self.exitLoop = YES; return; } diff --git a/bp/src/main.m b/bp/src/main.m index df0a09b5..dee1e568 100644 --- a/bp/src/main.m +++ b/bp/src/main.m @@ -66,10 +66,10 @@ int main(int argc, char * argv[]) { NSString *fileName = [NSString stringWithFormat:@"%@-stats.json", [[config.testBundlePath lastPathComponent] stringByDeletingPathExtension]]; NSString *outputFile = [config.outputDirectory stringByAppendingPathComponent:fileName]; BPWriter *statsWriter = [[BPWriter alloc] initWithDestination:BPWriterDestinationFile andPath:outputFile]; - [[BPStats sharedStats] exitWithWriter:statsWriter exitCode:exitCode]; + [[BPStats sharedStats] exitWithWriter:statsWriter exitCode:(int)exitCode]; } [BPUtils printInfo:INFO withString:@"BP exiting %ld", (long)exitCode]; - return exitCode; + return (int)exitCode; } } diff --git a/bp/tests/BluepillTests.m b/bp/tests/BluepillTests.m index d53841f8..f91cc2ca 100644 --- a/bp/tests/BluepillTests.m +++ b/bp/tests/BluepillTests.m @@ -232,7 +232,8 @@ - (void)testReportWithAppCrashingAndRetryOnlyFailedTestsSet { [self assertGotReport:junitReportPath isEqualToWantReport:expectedFilePath]; } -- (void)testAppCrashingAndRetryReportsCorrectExitCode { +// TODO: Enable this while re-enabling the fix from PR#338 +- (void)DISABLE_testAppCrashingAndRetryReportsCorrectExitCode { NSString *testBundlePath = [BPTestHelper sampleAppCrashingTestsBundlePath]; self.config.testBundlePath = testBundlePath; NSString *tempDir = NSTemporaryDirectory(); @@ -416,7 +417,7 @@ - (void)testKeepSimulatorWithAppCrashingTestsSet { } //simulator shouldn't be kept in this case -- (void)testKeepSimulatorWithAppHaningTestsSet { +- (void)testKeepSimulatorWithAppHangingTestsSet { NSString *testBundlePath = [BPTestHelper sampleAppHangingTestsBundlePath]; self.config.testBundlePath = testBundlePath; self.config.keepSimulator = YES; diff --git a/scripts/bluepill.sh b/scripts/bluepill.sh index b749d2b3..3aa282ba 100755 --- a/scripts/bluepill.sh +++ b/scripts/bluepill.sh @@ -88,10 +88,11 @@ bluepill_build_sample_app() bluepill_instance_tests() { + mkdir -p build/reports/ xcodebuild test \ -workspace Bluepill.xcworkspace \ -scheme bp-tests \ - -derivedDataPath "build/" 2>&1 | tee result.txt | $XCPRETTY --output build/reports/instance.xml + -derivedDataPath "build/" 2>&1 | tee result.txt | $XCPRETTY | tee build/reports/instance.xml if ! grep '\*\* TEST SUCCEEDED \*\*' result.txt; then echo 'Test failed' @@ -101,10 +102,11 @@ bluepill_instance_tests() bluepill_runner_tests() { + mkdir -p build/reports/ xcodebuild test \ -workspace Bluepill.xcworkspace \ -scheme bluepill-tests \ - -derivedDataPath "build/" 2>&1 | tee result.txt | $XCPRETTY --output build/reports/runner.xml + -derivedDataPath "build/" 2>&1 | tee result.txt | $XCPRETTY | tee build/reports/runner.xml if ! grep '\*\* TEST SUCCEEDED \*\*' result.txt; then echo 'Test failed'