| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Sets environment variables needed to run a chromium unit test.""" | 6 """Sets environment variables needed to run a chromium unit test.""" |
| 7 | 7 |
| 8 import os | 8 import os |
| 9 import stat | 9 import stat |
| 10 import subprocess | 10 import subprocess |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 suppressions_file = os.path.join(ROOT_DIR, 'tools', 'lsan', | 107 suppressions_file = os.path.join(ROOT_DIR, 'tools', 'lsan', |
| 108 'suppressions.txt') | 108 'suppressions.txt') |
| 109 lsan_options = ['suppressions=%s' % suppressions_file, | 109 lsan_options = ['suppressions=%s' % suppressions_file, |
| 110 'print_suppressions=1'] | 110 'print_suppressions=1'] |
| 111 extra_env['LSAN_OPTIONS'] = ' '.join(lsan_options) | 111 extra_env['LSAN_OPTIONS'] = ' '.join(lsan_options) |
| 112 else: | 112 else: |
| 113 # ASan uses a script for offline symbolization. | 113 # ASan uses a script for offline symbolization. |
| 114 # Important note: when running ASan with leak detection enabled, we must use | 114 # Important note: when running ASan with leak detection enabled, we must use |
| 115 # the LSan symbolization options above. | 115 # the LSan symbolization options above. |
| 116 symbolization_options = ['symbolize=0'] | 116 symbolization_options = ['symbolize=0'] |
| 117 # Set the path to llvm-symbolizer to be used by asan_symbolize.py |
| 118 extra_env['LLVM_SYMBOLIZER_PATH'] = symbolizer_path |
| 117 | 119 |
| 118 asan_options.extend(symbolization_options) | 120 asan_options.extend(symbolization_options) |
| 119 | 121 |
| 120 extra_env['ASAN_OPTIONS'] = ' '.join(asan_options) | 122 extra_env['ASAN_OPTIONS'] = ' '.join(asan_options) |
| 121 | 123 |
| 122 if sys.platform == 'darwin': | 124 if sys.platform == 'darwin': |
| 123 isolate_output_dir = os.path.abspath(os.path.dirname(cmd[0])) | 125 isolate_output_dir = os.path.abspath(os.path.dirname(cmd[0])) |
| 124 # This is needed because the test binary has @executable_path embedded in it | 126 # This is needed because the test binary has @executable_path embedded in it |
| 125 # it that the OS tries to resolve to the cache directory and not the mapped | 127 # it that the OS tries to resolve to the cache directory and not the mapped |
| 126 # directory. | 128 # directory. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 print >> sys.stderr, 'Failed to start %s' % cmd | 184 print >> sys.stderr, 'Failed to start %s' % cmd |
| 183 raise | 185 raise |
| 184 | 186 |
| 185 | 187 |
| 186 def main(): | 188 def main(): |
| 187 return run_executable(sys.argv[1:], os.environ.copy()) | 189 return run_executable(sys.argv[1:], os.environ.copy()) |
| 188 | 190 |
| 189 | 191 |
| 190 if __name__ == '__main__': | 192 if __name__ == '__main__': |
| 191 sys.exit(main()) | 193 sys.exit(main()) |
| OLD | NEW |