diff --git a/compiler-rt/test/lit.common.cfg.py b/compiler-rt/test/lit.common.cfg.py --- a/compiler-rt/test/lit.common.cfg.py +++ b/compiler-rt/test/lit.common.cfg.py @@ -697,16 +697,16 @@ if config.host_os == 'Darwin': config.substitutions.append(( - "%get_pid_from_output", + "%get_pid_from_output", "{} {}/get_pid_from_output.py".format( - sh_quote(config.python_executable), + sh_quote(config.python_executable), sh_quote(get_ios_commands_dir()) )) ) config.substitutions.append( - ("%print_crashreport_for_pid", + ("%print_crashreport_for_pid", "{} {}/print_crashreport_for_pid.py".format( - sh_quote(config.python_executable), + sh_quote(config.python_executable), sh_quote(get_ios_commands_dir()) )) ) 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.") @@ -36,7 +39,18 @@ # We use `shell=True` so that any wildcard globs get expanded by the shell. 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)