Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xcode 16 beta 5 bugfixes #571

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bp/src/BPConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
#import <Foundation/Foundation.h>

#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)"

Expand Down
5 changes: 1 addition & 4 deletions bp/src/BPSimulator.m
Original file line number Diff line number Diff line change
Expand Up @@ -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"]];
Expand Down
2 changes: 1 addition & 1 deletion bp/src/BPTMDRunnerConnection.m
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ - (id)_XCT_terminateProcess:(id)token {
- (id)_XCT_launchProcessWithPath:(NSString *)path bundleID:(NSString *)bundleID arguments:(NSArray *)arguments environmentVariables:(NSDictionary *)environment
{
NSMutableDictionary<NSString *, NSString *> *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,
Expand Down
1 change: 1 addition & 0 deletions bp/src/SimulatorHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
17 changes: 10 additions & 7 deletions bp/src/SimulatorHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -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<NSString *, NSString *> *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";
Expand Down
1 change: 1 addition & 0 deletions bp/tests/BPIntTestCase.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion bp/tests/BluepillTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion bp/tests/SimulatorHelperTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
Expand Down
Loading