Load test bundle earlier and run _XCTestMain later in FBXCTestMain
Summary: Following similar things done in IDEBundleInjection (Xcode 9) and libXCTestBundleInject.dylib (Xcode 10). We need to load test bundle earlier as it gives us flexibility in testing code to override target app's behavior before its `main` started running. Reviewed By: superb Differential Revision: D8526237 fbshipit-source-id: c4970f10daef190414e9befbfd8d31395a386485
This commit is contained in:
Родитель
1595982572
Коммит
ecb57d0f7a
Двоичные данные
Shims/Binaries/libMaculator.dylib
Двоичные данные
Shims/Binaries/libMaculator.dylib
Двоичный файл не отображается.
Двоичные данные
Shims/Binaries/libShimulator.dylib
Двоичные данные
Shims/Binaries/libShimulator.dylib
Двоичный файл не отображается.
|
@ -81,6 +81,24 @@ BOOL FBXCTestMain()
|
|||
return NO;
|
||||
}
|
||||
[configuration setAbsolutePath:configurationPath];
|
||||
|
||||
NSURL *testBundleURL = configuration.testBundleURL;
|
||||
if (!testBundleURL) {
|
||||
NSLog(@"XCTestConfiguration has no test bundle URL value");
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSBundle *testBundle = [NSBundle bundleWithURL:testBundleURL];
|
||||
if (!testBundle) {
|
||||
NSLog(@"Failed to open test bundle from %@", testBundleURL);
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (![testBundle loadAndReturnError:&error]) {
|
||||
NSLog(@"Failed load test bundle with error: %@", error);
|
||||
return NO;
|
||||
}
|
||||
|
||||
void (*XCTestMain)(XCTestConfiguration *) = (void (*)(XCTestConfiguration *))FBRetrieveXCTestSymbol("_XCTestMain");
|
||||
CFRunLoopPerformBlock([NSRunLoop mainRunLoop].getCFRunLoop, kCFRunLoopCommonModes, ^{
|
||||
XCTestMain(configuration);
|
||||
|
|
Загрузка…
Ссылка в новой задаче