From 81bf46834b11232b14e3db75e672c72c00701230 Mon Sep 17 00:00:00 2001 From: Weiming Dai Date: Tue, 4 Aug 2020 16:38:03 -0700 Subject: [PATCH] Xcode 12.0 compatible change on device testing. Xcode 12.0 compatible change on device testing. --- xctestrunner/test_runner/xctestrun.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/xctestrunner/test_runner/xctestrun.py b/xctestrunner/test_runner/xctestrun.py index 6750144..1aecad5 100644 --- a/xctestrunner/test_runner/xctestrun.py +++ b/xctestrunner/test_runner/xctestrun.py @@ -634,13 +634,21 @@ def _GenerateTestRootForXctest(self): os.path.basename(self._app_under_test_dir))[0] platform_name = 'iPhoneOS' if self._on_device else 'iPhoneSimulator' developer_path = '__PLATFORMS__/%s.platform/Developer' % platform_name - if xcode_info_util.GetXcodeVersionNumber() < 1000: - dyld_insert_libs = ('%s/Library/PrivateFrameworks/' - 'IDEBundleInjection.framework/IDEBundleInjection' % - developer_path) + + if self._on_device: + if xcode_info_util.GetXcodeVersionNumber() < 1000: + dyld_insert_libs = ('__TESTHOST__/Frameworks/' + 'IDEBundleInjection.framework/IDEBundleInjection') + else: + dyld_insert_libs = '__TESTHOST__/Frameworks/libXCTestBundleInject.dylib' else: - dyld_insert_libs = ('%s/usr/lib/libXCTestBundleInject.dylib' % - developer_path) + if xcode_info_util.GetXcodeVersionNumber() < 1000: + dyld_insert_libs = ('%s/Library/PrivateFrameworks/' + 'IDEBundleInjection.framework/IDEBundleInjection' % + developer_path) + else: + dyld_insert_libs = ('%s/usr/lib/libXCTestBundleInject.dylib' % + developer_path) test_envs = { 'XCInjectBundleInto': os.path.join('__TESTHOST__', app_under_test_name), 'DYLD_FRAMEWORK_PATH': '__TESTROOT__:{developer}/Library/Frameworks:'