diff --git a/bp/src/BPConstants.h b/bp/src/BPConstants.h index 2c7e0116..f80cc63f 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 "15.1" -#define BP_DEFAULT_RUNTIME "iOS 17.2" -#define BP_DEFAULT_BASE_SDK "17.2" +#define BP_DEFAULT_XCODE_VERSION "16.0" +#define BP_DEFAULT_RUNTIME "iOS 18.0" +#define BP_DEFAULT_BASE_SDK "18.0" #define BP_DEFAULT_DEVICE_TYPE "iPhone SE (3rd generation)" diff --git a/bp/src/BPSimulator.m b/bp/src/BPSimulator.m index 7b55451f..1a441abe 100644 --- a/bp/src/BPSimulator.m +++ b/bp/src/BPSimulator.m @@ -506,11 +506,8 @@ - (void)launchApplicationAndExecuteTestsWithParser:(BPTreeParser *)parser andCom self.appOutput = [NSFileHandle fileHandleForReadingAtPath:simStdoutPath]; - NSDictionary *appLaunchEnvironment = [SimulatorHelper appLaunchEnvironmentWithBundleID:hostBundleId device:self.device config:self.config]; + NSDictionary *appLaunchEnvironment = [SimulatorHelper appLaunchEnvironmentWithBundleID:hostBundleId injectDylib:(self.config.testRunnerAppPath == nil) device:self.device config:self.config]; NSMutableDictionary *mutableAppLaunchEnv = [appLaunchEnvironment mutableCopy]; - NSString *insertLibraryPath = [NSString stringWithFormat:@"%@/Platforms/iPhoneSimulator.platform/Developer/usr/lib/libXCTestBundleInject.dylib", self.config.xcodePath]; - [mutableAppLaunchEnv setObject:insertLibraryPath forKey:@"DYLD_INSERT_LIBRARIES"]; - [mutableAppLaunchEnv setObject:insertLibraryPath forKey:@"XCInjectBundleInto"]; [mutableAppLaunchEnv setObject:simStdoutRelativePath forKey:kOptionsStdoutKey]; [mutableAppLaunchEnv setObject:simStdoutRelativePath forKey:kOptionsStderrKey]; [mutableAppLaunchEnv addEntriesFromDictionary:argsAndEnv[@"env"]]; diff --git a/bp/src/BPTMDRunnerConnection.m b/bp/src/BPTMDRunnerConnection.m index cc6d9afe..ddc1043c 100644 --- a/bp/src/BPTMDRunnerConnection.m +++ b/bp/src/BPTMDRunnerConnection.m @@ -397,7 +397,7 @@ - (id)_XCT_terminateProcess:(id)token { - (id)_XCT_launchProcessWithPath:(NSString *)path bundleID:(NSString *)bundleID arguments:(NSArray *)arguments environmentVariables:(NSDictionary *)environment { NSMutableDictionary *env = [[NSMutableDictionary alloc] init]; - [env addEntriesFromDictionary:[SimulatorHelper appLaunchEnvironmentWithBundleID:bundleID device:nil config:_context.config]]; + [env addEntriesFromDictionary:[SimulatorHelper appLaunchEnvironmentWithBundleID:bundleID injectDylib:true device:nil config:_context.config]]; [env addEntriesFromDictionary:environment]; NSDictionary *options = @{ @"arguments": arguments, diff --git a/bp/src/SimulatorHelper.h b/bp/src/SimulatorHelper.h index a17227f6..7442b46f 100644 --- a/bp/src/SimulatorHelper.h +++ b/bp/src/SimulatorHelper.h @@ -28,6 +28,7 @@ * @return returns the app launch environment as a dictionary */ + (NSDictionary *)appLaunchEnvironmentWithBundleID:(NSString *)hostBundleID + injectDylib:(Boolean)injectDylib device:(SimDevice *)device config:(BPConfiguration *)config; diff --git a/bp/src/SimulatorHelper.m b/bp/src/SimulatorHelper.m index d4d5cf25..65f5eae7 100644 --- a/bp/src/SimulatorHelper.m +++ b/bp/src/SimulatorHelper.m @@ -62,21 +62,24 @@ + (BOOL)loadFrameworksWithXcodePath:(NSString *)xcodePath { } + (NSDictionary *)appLaunchEnvironmentWithBundleID:(NSString *)hostBundleID + injectDylib:(Boolean)injectDylib device:(SimDevice *)device config:(BPConfiguration *)config { NSString *hostAppExecPath = [SimulatorHelper executablePathforPath:config.appBundlePath]; NSString *hostAppPath = [hostAppExecPath stringByDeletingLastPathComponent]; NSString *testSimulatorFrameworkPath = [hostAppPath stringByDeletingLastPathComponent]; - NSString *libXCTestBundleInjectPath = [[hostAppPath stringByAppendingPathComponent:@"Frameworks"] stringByAppendingPathComponent:@"libXCTestBundleInject.dylib"]; - NSString *libXCTestBundleInjectValue = libXCTestBundleInjectPath; - if (![NSFileManager.defaultManager fileExistsAtPath:libXCTestBundleInjectPath]) { - [BPUtils printInfo:DEBUGINFO withString:@"Not injecting libXCTestBundleInject dylib because it was not found in the app host bundle at path: %@", libXCTestBundleInjectValue]; - libXCTestBundleInjectValue = @""; - } NSMutableDictionary *environment = [[NSMutableDictionary alloc] init]; environment[@"DYLD_FALLBACK_FRAMEWORK_PATH"] = [NSString stringWithFormat:@"%@/Library/Frameworks:%@/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks", config.xcodePath, config.xcodePath]; environment[@"DYLD_FALLBACK_LIBRARY_PATH"] = [NSString stringWithFormat:@"%@/Platforms/iPhoneSimulator.platform/Developer/usr/lib", config.xcodePath]; - environment[@"DYLD_INSERT_LIBRARIES"] = libXCTestBundleInjectValue; + if (injectDylib) { + NSString *libXCTestBundleInjectPath = [NSString stringWithFormat:@"%@/Platforms/iPhoneSimulator.platform/Developer/usr/lib/libXCTestBundleInject.dylib", config.xcodePath]; + // NSString *libXCTestBundleInjectPath = [[hostAppPath stringByAppendingPathComponent:@"Frameworks"] stringByAppendingPathComponent:@"libXCTestBundleInject.dylib"]; + if (![NSFileManager.defaultManager fileExistsAtPath:libXCTestBundleInjectPath]) { + [BPUtils printInfo:ERROR withString:@"Not injecting libXCTestBundleInject dylib because it was not found in the app host bundle at path: %@", libXCTestBundleInjectPath]; + } else { + environment[@"DYLD_INSERT_LIBRARIES"] = libXCTestBundleInjectPath; + } + } environment[@"DYLD_LIBRARY_PATH"] = [NSString stringWithFormat:@"%@/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks", config.xcodePath]; environment[@"DYLD_ROOT_PATH"] = [NSString stringWithFormat:@"%@/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot", config.xcodePath]; environment[@"NSUnbufferedIO"] = @"1"; diff --git a/bp/tests/BPIntTestCase.m b/bp/tests/BPIntTestCase.m index a800a44f..90a0d384 100644 --- a/bp/tests/BPIntTestCase.m +++ b/bp/tests/BPIntTestCase.m @@ -49,6 +49,7 @@ - (void)setUp { if (!sc) { NSLog(@"Failed to initialize SimServiceContext: %@", err); } for (SimDeviceType *type in [sc supportedDeviceTypes]) { + [BPUtils printInfo:DEBUGINFO withString:@"Runtime Found: %@", [type name]]; if ([[type name] isEqualToString:self.config.deviceType]) { self.config.simDeviceType = type; break; diff --git a/bp/tests/BluepillTests.m b/bp/tests/BluepillTests.m index cd7f148f..a8f37629 100644 --- a/bp/tests/BluepillTests.m +++ b/bp/tests/BluepillTests.m @@ -277,7 +277,7 @@ - (void)testRunUITest { [BPUtils enableDebugOutput:YES]; // The delay of ui test bootstrapping is larger than 5s. self.config.testCaseTimeout = @300; - self.config.errorRetriesCount = @1; + self.config.errorRetriesCount = @0; NSString *testBundlePath = [BPTestHelper sampleAppUITestBundlePath]; NSString *testRunnerPath = [BPTestHelper sampleAppUITestRunnerPath]; NSString *tempDir = NSTemporaryDirectory(); diff --git a/bp/tests/SimulatorHelperTests.m b/bp/tests/SimulatorHelperTests.m index 880d6cbc..cd022f27 100644 --- a/bp/tests/SimulatorHelperTests.m +++ b/bp/tests/SimulatorHelperTests.m @@ -41,7 +41,7 @@ - (void)testAppLaunchEnvironment { NSString *hostBundleId = [SimulatorHelper bundleIdForPath:config.appBundlePath]; config.xcodePath = @"/Applications/Xcode.app/Contents/Developer"; config.outputDirectory = @"/Users/test/output"; - NSDictionary *appLaunchEnvironment = [SimulatorHelper appLaunchEnvironmentWithBundleID:hostBundleId device:nil config:config]; + NSDictionary *appLaunchEnvironment = [SimulatorHelper appLaunchEnvironmentWithBundleID:hostBundleId injectDylib:true device:nil config:config]; XCTAssert([appLaunchEnvironment[@"DYLD_FALLBACK_FRAMEWORK_PATH"] containsString:@"Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks"]); XCTAssert([appLaunchEnvironment[@"DYLD_FALLBACK_LIBRARY_PATH"] containsString:@"Platforms/iPhoneSimulator.platform/Developer/usr/lib"]); XCTAssert([appLaunchEnvironment[@"DYLD_INSERT_LIBRARIES"] containsString:@"libXCTestBundleInject.dylib"]);