Commit 600fbf32 authored by zhaoyangli's avatar zhaoyangli Committed by Commit Bot

[iOS][test runner] Add verification and re-attempt at creating simulator.

Sometimes the first attempt to create a simulator might fail. Add
second attempt when first one fails.

Bug: 1119591
Change-Id: Ie516a664c919160233b81dad995b04a3d23ceae5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2367778Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
Commit-Queue: Zhaoyang Li <zhaoyangli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821514}
parent a487fad7
......@@ -129,7 +129,16 @@ def create_device_by_platform_and_version(platform, version):
udid = subprocess.check_output(
['xcrun', 'simctl', 'create', name, device_type, runtime],
stderr=subprocess.STDOUT).rstrip()
LOGGER.info('Created simulator with UDID: %s', udid)
LOGGER.info('Created simulator in first attempt with UDID: %s', udid)
# Sometimes above command fails to create a simulator. Verify it and retry
# once if first attempt failed.
if not is_device_with_udid_simulator(udid):
# Try to delete once to avoid duplicate in case of race condition.
delete_simulator_by_udid(udid)
udid = subprocess.check_output(
['xcrun', 'simctl', 'create', name, device_type, runtime],
stderr=subprocess.STDOUT).rstrip()
LOGGER.info('Created simulator in second attempt with UDID: %s', udid)
return udid
except subprocess.CalledProcessError as e:
LOGGER.error('Error when creating simulator "%s": %s' % (name, e.output))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment