diff --git a/compiler-rt/test/sanitizer_common/ios_commands/iossim_run.py b/compiler-rt/test/sanitizer_common/ios_commands/iossim_run.py --- a/compiler-rt/test/sanitizer_common/ios_commands/iossim_run.py +++ b/compiler-rt/test/sanitizer_common/ios_commands/iossim_run.py @@ -4,6 +4,9 @@ device_id = os.environ.get('SANITIZER_IOSSIM_TEST_DEVICE_IDENTIFIER') +iossim_run_verbose = os.environ.get('SANITIZER_IOSSIM_RUN_VERBOSE') +wait_for_debug = os.environ.get('SANITIZER_IOSSIM_RUN_WAIT_FOR_DEBUGGER') + if not device_id: raise EnvironmentError("Specify SANITIZER_IOSSIM_TEST_DEVICE_IDENTIFIER to select which simulator to use.") @@ -34,9 +37,25 @@ rm_cmd_line = ["/bin/rm"] + rm_args rm_cmd_line_str = ' '.join(rm_cmd_line) # We use `shell=True` so that any wildcard globs get expanded by the shell. + + if iossim_run_verbose: + print("RUNNING: \t{}".format(rm_cmd_line_str)) + exitcode = subprocess.call(rm_cmd_line_str, shell=True) + else: - exitcode = subprocess.call(["xcrun", "simctl", "spawn", "--standalone", device_id] + sys.argv[1:]) + cmd = ["xcrun", "simctl", "spawn", "--standalone"] + + if wait_for_debug: + cmd.append("--wait-for-debugger") + + cmd.append(device_id) + cmd += sys.argv[1:] + + if iossim_run_verbose: + print("RUNNING: \t{}".format(" ".join(cmd))) + + exitcode = subprocess.call(cmd) if exitcode > 125: exitcode = 126 sys.exit(exitcode)