From ebd8eee62a431a6744c3f187fcda58e5dea08499 Mon Sep 17 00:00:00 2001 From: Julian Lettner Date: Fri, 7 Jan 2022 16:47:37 -0800 Subject: [PATCH] [Darwin] Apply workaround to make symbolication in iOS simulators work Specify `ASAN_SYMBOLIZER_PATH` when running simulator tests. This will unblock simulator testing in GreenDragon (Apple's open source testing). --- .../test/sanitizer_common/ios_commands/iossim_run.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/compiler-rt/test/sanitizer_common/ios_commands/iossim_run.py b/compiler-rt/test/sanitizer_common/ios_commands/iossim_run.py index c8ff980c8b61..49df74e862b6 100755 --- a/compiler-rt/test/sanitizer_common/ios_commands/iossim_run.py +++ b/compiler-rt/test/sanitizer_common/ios_commands/iossim_run.py @@ -14,6 +14,7 @@ for e in [ "ASAN_OPTIONS", "TSAN_OPTIONS", "UBSAN_OPTIONS", + "LSAN_OPTIONS", "APPLE_ASAN_INIT_FOR_DLOPEN", "ASAN_ACTIVATION_OPTIONS", "MallocNanoZone", @@ -21,6 +22,11 @@ for e in [ if e in os.environ: os.environ["SIMCTL_CHILD_" + e] = os.environ[e] +find_atos_cmd = 'xcrun -sdk iphonesimulator -f atos' +atos_path = subprocess.run(find_atos_cmd.split(), capture_output=True, check=True).stdout.decode().strip() +for san in ['ASAN', 'TSAN', 'UBSAN', 'LSAN']: + os.environ[f'SIMCTL_CHILD_{san}_SYMBOLIZER_PATH'] = atos_path + prog = sys.argv[1] exit_code = None if prog == 'rm': @@ -39,7 +45,7 @@ if prog == 'rm': # 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)) + print("RUNNING: \t{}".format(rm_cmd_line_str), flush=True) exitcode = subprocess.call(rm_cmd_line_str, shell=True) @@ -53,7 +59,7 @@ else: cmd += sys.argv[1:] if iossim_run_verbose: - print("RUNNING: \t{}".format(" ".join(cmd))) + print("RUNNING: \t{}".format(" ".join(cmd)), flush=True) exitcode = subprocess.call(cmd) if exitcode > 125: