Chromium Code Reviews| Index: testing/test_env.py |
| diff --git a/testing/test_env.py b/testing/test_env.py |
| index 2c39508c438d2e9074c10aad29f4c845c380464b..1c12284ee87060b2b445c547999f37ab35972255 100755 |
| --- a/testing/test_env.py |
| +++ b/testing/test_env.py |
| @@ -83,23 +83,56 @@ def run_executable(cmd, env): |
| # Copy logic from tools/build/scripts/slave/runtest.py. |
| asan = '--asan=1' in cmd |
| lsan = '--lsan=1' in cmd |
| - if lsan and sys.platform == 'linux2': |
| - # Use the debug version of libstdc++ under LSan. If we don't, there will |
| - # be a lot of incomplete stack traces in the reports. |
| - env['LD_LIBRARY_PATH'] = '/usr/lib/x86_64-linux-gnu/debug:' |
| - |
| - if asan and sys.platform == 'darwin': |
| - isolate_output_dir = os.path.abspath(os.path.dirname(cmd[0])) |
| - # This is needed because the test binary has @executable_path embedded in it |
| - # that the OS tries to resolve to the cache directory and not the mapped |
| - # directory. |
| - env['DYLD_LIBRARY_PATH'] = str(isolate_output_dir) |
| + |
| + if asan: |
|
M-A Ruel
2014/10/14 23:38:51
I think it's large enough I'd make it a function a
jam
2014/10/15 03:20:48
Done.
|
| + # Instruct GTK to use malloc while running ASan, TSan, MSan or LSan tests. |
| + env['G_SLICE'] = 'always-malloc' |
| + env['NSS_DISABLE_ARENA_FREE_LIST'] = '1' |
| + env['NSS_DISABLE_UNLOAD'] = '1' |
| + |
| + # TODO(glider): remove the symbolizer path once |
| + # https://code.google.com/p/address-sanitizer/issues/detail?id=134 is fixed. |
| + symbolizer_path = os.path.abspath(os.path.join('..', 'third_party', |
| + 'llvm-build', 'Release+Asserts', 'bin', 'llvm-symbolizer')) |
| + |
| + asan_options = [] |
| + if lsan: |
| + asan_options += ['detect_leaks=1'] |
|
M-A Ruel
2014/10/14 23:38:51
I really prefer:
asan_options.append('detect_leaks
jam
2014/10/15 03:20:48
Done.
|
| + if sys.platform == 'linux2': |
| + # Use the debug version of libstdc++ under LSan. If we don't, there will |
| + # be a lot of incomplete stack traces in the reports. |
| + env['LD_LIBRARY_PATH'] = '/usr/lib/x86_64-linux-gnu/debug:' |
|
M-A Ruel
2014/10/14 23:38:51
[General comment] It'd be nice to have these addit
jam
2014/10/15 03:20:48
Done.
|
| + |
| + # LSan is not sandbox-compatible, so we can use online symbolization. In |
| + # fact, it needs symbolization to be able to apply suppressions. |
| + symbolization_options = ['symbolize=1', |
| + 'external_symbolizer_path=%s' % symbolizer_path] |
| + |
| + lsan_options = ['suppressions=../tools/lsan/suppressions.txt', |
|
M-A Ruel
2014/10/14 23:38:51
The relative path could be wrong; it's relative to
jam
2014/10/15 03:20:48
Done.
|
| + 'print_suppressions=1'] |
| + env['LSAN_OPTIONS'] = ' '.join(lsan_options) |
| + else: |
| + # ASan uses a script for offline symbolization. |
| + # Important note: when running ASan with leak detection enabled, we must |
| + # use the LSan symbolization options above. |
| + symbolization_options = ['symbolize=0'] |
| + asan_options = symbolization_options |
| + |
| + env['ASAN_OPTIONS'] = ' '.join(asan_options) |
| + |
| + if sys.platform == 'darwin': |
| + isolate_output_dir = os.path.abspath(os.path.dirname(cmd[0])) |
| + # This is needed because the test binary has @executable_path embedded in |
| + # it that the OS tries to resolve to the cache directory and not the |
| + # mapped directory. |
| + env['DYLD_LIBRARY_PATH'] = str(isolate_output_dir) |
| # Ensure paths are correctly separated on windows. |
| cmd[0] = cmd[0].replace('/', os.path.sep) |
| cmd = fix_python_path(cmd) |
| try: |
| - if asan: |
| + # See above comment regarding offline symbolization. |
| + if asan and not lsan: |
| # Need to pipe to the symbolizer script. |
| p1 = subprocess.Popen(cmd, env=env, stdout=subprocess.PIPE, |
| stderr=sys.stdout) |