Skip to content

Commit

Permalink
Update test runner
Browse files Browse the repository at this point in the history
- Fix typo
- Fix the compatibility issue in Xcode 8.
  • Loading branch information
Weiming Dai committed Nov 12, 2018
1 parent f895ca3 commit 0bb08cc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
6 changes: 3 additions & 3 deletions xctestrunner/test_runner/xcodebuild_test_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,9 @@ def Execute(self, return_output=True):
if _PROCESS_EXISTED_OR_CRASHED_ERROR in output_str:
raise ios_errors.SimError('')
if ios_constants.CORESIMULATOR_INTERRUPTED_ERROR in output_str:
# Sleep random[0,2] seconds to avoid race condition. It is known
# issue that CoreSimulatorService connection will interrupte if
# two simulators booting at the same time.
# Sleep random[0,2] seconds to avoid race condition. It is a known
# issue that CoreSimulatorService connection will be interrupted
# if two simulators are booting at the same time.
time.sleep(random.uniform(0, 2))
raise ios_errors.SimError('')
if (self._app_bundle_id and
Expand Down
29 changes: 15 additions & 14 deletions xctestrunner/test_runner/xctestrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,12 +396,13 @@ def _GenerateTestRootForXcuitest(self):
shutil.copytree(
os.path.join(platform_library_path, 'Frameworks/XCTest.framework'),
xctest_framework)
xct_automation_framework = os.path.join(runner_app_frameworks_dir,
'XCTAutomationSupport.framework')
shutil.copytree(
os.path.join(platform_library_path,
'PrivateFrameworks/XCTAutomationSupport.framework'),
xct_automation_framework)
if xcode_info_util.GetXcodeVersionNumber() >= 900:
xct_automation_framework = os.path.join(runner_app_frameworks_dir,
'XCTAutomationSupport.framework')
shutil.copytree(
os.path.join(platform_library_path,
'PrivateFrameworks/XCTAutomationSupport.framework'),
xct_automation_framework)

self._PrepareUitestInRunerApp(uitest_runner_app)

Expand Down Expand Up @@ -451,8 +452,9 @@ def _GenerateTestRootForXcuitest(self):
self._app_under_test_dir)
bundle_util.CodesignBundle(
xctest_framework, identity=app_under_test_signing_identity)
bundle_util.CodesignBundle(
xct_automation_framework, identity=app_under_test_signing_identity)
if xcode_info_util.GetXcodeVersionNumber() >= 900:
bundle_util.CodesignBundle(
xct_automation_framework, identity=app_under_test_signing_identity)
bundle_util.CodesignBundle(
uitest_runner_app,
entitlements_plist_path=entitlements_plist_path,
Expand Down Expand Up @@ -504,12 +506,11 @@ def _GetUitestRunnerAppFromXcode(self, platform_library_path):
os.path.join(uitest_runner_app, uitest_runner_app_name))

runner_app_info_plist_path = os.path.join(uitest_runner_app, 'Info.plist')
with open(runner_app_info_plist_path, 'r') as info_plist_file:
file_content = info_plist_file.read()
file_content = file_content.replace('WRAPPEDPRODUCTNAME',
uitest_runner_app_name)
with open(runner_app_info_plist_path, 'w') as info_plist_file:
info_plist_file.write(file_content)
info_plist = plist_util.Plist(runner_app_info_plist_path)
info_plist.SetPlistField('CFBundleName', uitest_runner_app_name)
info_plist.SetPlistField('CFBundleExecutable', uitest_runner_app_name)
info_plist.SetPlistField('CFBundleIdentifier',
'com.apple.test.' + uitest_runner_app_name)

return uitest_runner_app

Expand Down

0 comments on commit 0bb08cc

Please sign in to comment.