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

Dan Liew via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 16 10:25:37 PST 2019


delcypher added inline comments.


================
Comment at: compiler-rt/test/sanitizer_common/ios_commands/iossim_prepare.py:11
+boot_cmd = ['xcrun', 'simctl', 'bootstatus', device_id, '-b']
+subprocess.check_call(boot_cmd)
+
----------------
yln wrote:
> delcypher wrote:
> > Suggested (but optional improvement). If the command fails print an error message that explains the command to run to boot the iOS simulator.
> The command will boot the simulator (the `-b` flag ).
> 
> This is the error for an invalid device:
> ```
> ➤ env SANITIZER_IOSSIM_TEST_DEVICE_IDENTIFIER="iPhone Y" ../llvm-project/llvm/utils/lit/lit.py  projects/compiler-rt/test/tsan/IOSSimX86_64Config/ -sv
> Invalid device: iPhone Y
> Traceback (most recent call last):
>   File "/Users/yln/work/llvm-upstream/llvm-project/compiler-rt/test/sanitizer_common/ios_commands/iossim_prepare.py", line 11, in <module>
>     subprocess.check_call(boot_cmd)
>   File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 190, in check_call
>     raise CalledProcessError(retcode, cmd)
> subprocess.CalledProcessError: Command '['xcrun', 'simctl', 'bootstatus', 'iPhone Y', '-b']' returned non-zero exit status 164
> Command failed:
> 
> lit.py: /Users/yln/work/llvm-upstream/llvm-project/llvm/utils/lit/lit/TestingConfig.py:102: fatal: unable to parse config file '/Users/yln/work/llvm-upstream/llvm-project/compiler-rt/test/lit.common.cfg.py', traceback: Traceback (most recent call last):
>   File "/Users/yln/work/llvm-upstream/llvm-project/llvm/utils/lit/lit/TestingConfig.py", line 89, in load_from_path
>     exec(compile(data, path, 'exec'), cfg_globals, None)
>   File "/Users/yln/work/llvm-upstream/llvm-project/compiler-rt/test/lit.common.cfg.py", line 175, in <module>
>     raise e
> CalledProcessError: Command '['/Users/yln/work/llvm-upstream/llvm-project/compiler-rt/test/sanitizer_common/ios_commands/iossim_prepare.py', 'iossim', '/Users/yln/work/llvm-upstream/build/./bin/clang']' returned non-zero exit status 1
> ```
Ah I missed the `-b` flag. One issue with this is that we don't teardown the iOS simulator when testing finishes. I guess this mean we'll have a bunch of simulator daemons running in the background on the bot. I don't think there's any great way of fixing this today because I don't think we have a way of adding "clean up" hooks to lit to tell it to execute some custom code when testing finishes.

Maybe leave a TODO and file a radar about this?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71449/new/

https://reviews.llvm.org/D71449





More information about the llvm-commits mailing list