Commit d1783db9 authored by Julian Lettner's avatar Julian Lettner
Browse files

[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
parent 0378f3a9
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
#!/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": {}}))