[compiler-rt] d1783db - [iOS sim] Ensure simulator device is booted in iossim_prepare.py

Julian Lettner via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 20 13:44:14 PST 2019


Author: Julian Lettner
Date: 2019-12-20T13:44:01-08:00
New Revision: d1783db9dbda78d04cd131a93978edf8f497e58b

URL: https://github.com/llvm/llvm-project/commit/d1783db9dbda78d04cd131a93978edf8f497e58b
DIFF: https://github.com/llvm/llvm-project/commit/d1783db9dbda78d04cd131a93978edf8f497e58b.diff

LOG: [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

Added: 
    

Modified: 
    compiler-rt/test/sanitizer_common/ios_commands/iossim_prepare.py

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/sanitizer_common/ios_commands/iossim_prepare.py b/compiler-rt/test/sanitizer_common/ios_commands/iossim_prepare.py
index 4b618fe9de8a..1a350006c33f 100755
--- a/compiler-rt/test/sanitizer_common/ios_commands/iossim_prepare.py
+++ b/compiler-rt/test/sanitizer_common/ios_commands/iossim_prepare.py
@@ -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": {}}))


        


More information about the llvm-commits mailing list