[iOS sim] Ensure simulator device is booted in iossim_prepare.py

Recent versions of the iOS simulator require that a "simulator device"
is booted before we can use `simctl spawn` (see iossim_run.py) to start
processes.

We can use `simctl bootstatus` to ensure that the simulator device
is booted before we run any tests via lit.  The `-b` option starts the
device if necessary.

Reviewed By: delcypher

Differential Revision: https://reviews.llvm.org/D71449
This commit is contained in:
Julian Lettner 2019-12-16 09:33:11 -08:00
parent 0378f3a903
commit d1783db9db
1 changed files with 13 additions and 1 deletions

View File

@ -1,5 +1,17 @@
#!/usr/bin/python
import os, sys, subprocess, json
import json
import os
import subprocess
device_id = os.environ.get('SANITIZER_IOSSIM_TEST_DEVICE_IDENTIFIER')
if not device_id:
raise EnvironmentError('Specify SANITIZER_IOSSIM_TEST_DEVICE_IDENTIFIER to select which simulator to use.')
boot_cmd = ['xcrun', 'simctl', 'bootstatus', device_id, '-b']
subprocess.check_call(boot_cmd)
# TODO(rdar58118442): we start the simulator here, but we never tear it down
print(json.dumps({"env": {}}))