Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: testing/test_env.py

Issue 1645183003: Make path to asan_symbolize.py absolute in test_env.py (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 extra_env = {} 58 extra_env = {}
59 59
60 # Instruct GTK to use malloc while running sanitizer-instrumented tests. 60 # Instruct GTK to use malloc while running sanitizer-instrumented tests.
61 extra_env['G_SLICE'] = 'always-malloc' 61 extra_env['G_SLICE'] = 'always-malloc'
62 62
63 extra_env['NSS_DISABLE_ARENA_FREE_LIST'] = '1' 63 extra_env['NSS_DISABLE_ARENA_FREE_LIST'] = '1'
64 extra_env['NSS_DISABLE_UNLOAD'] = '1' 64 extra_env['NSS_DISABLE_UNLOAD'] = '1'
65 65
66 # TODO(glider): remove the symbolizer path once 66 # TODO(glider): remove the symbolizer path once
67 # https://code.google.com/p/address-sanitizer/issues/detail?id=134 is fixed. 67 # https://code.google.com/p/address-sanitizer/issues/detail?id=134 is fixed.
68 symbolizer_path = os.path.abspath(os.path.join(ROOT_DIR, 'third_party', 68 symbolizer_path = os.path.join(ROOT_DIR,
69 'llvm-build', 'Release+Asserts', 'bin', 'llvm-symbolizer')) 69 'third_party', 'llvm-build', 'Release+Asserts', 'bin', 'llvm-symbolizer')
70 70
71 if lsan or tsan: 71 if lsan or tsan:
72 # LSan is not sandbox-compatible, so we can use online symbolization. In 72 # LSan is not sandbox-compatible, so we can use online symbolization. In
73 # fact, it needs symbolization to be able to apply suppressions. 73 # fact, it needs symbolization to be able to apply suppressions.
74 symbolization_options = ['symbolize=1', 74 symbolization_options = ['symbolize=1',
75 'external_symbolizer_path=%s' % symbolizer_path] 75 'external_symbolizer_path=%s' % symbolizer_path]
76 elif (asan or msan) and sys.platform not in ['win32', 'cygwin']: 76 elif (asan or msan) and sys.platform not in ['win32', 'cygwin']:
77 # ASan uses a script for offline symbolization, except on Windows. 77 # ASan uses a script for offline symbolization, except on Windows.
78 # Important note: when running ASan with leak detection enabled, we must use 78 # Important note: when running ASan with leak detection enabled, we must use
79 # the LSan symbolization options above. 79 # the LSan symbolization options above.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 118
119 if tsan: 119 if tsan:
120 tsan_options = symbolization_options[:] 120 tsan_options = symbolization_options[:]
121 extra_env['TSAN_OPTIONS'] = ' '.join(tsan_options) 121 extra_env['TSAN_OPTIONS'] = ' '.join(tsan_options)
122 122
123 return extra_env 123 return extra_env
124 124
125 125
126 def get_sanitizer_symbolize_command(json_path=None, executable_path=None): 126 def get_sanitizer_symbolize_command(json_path=None, executable_path=None):
127 """Construct the command to invoke offline symbolization script.""" 127 """Construct the command to invoke offline symbolization script."""
128 script_path = '../tools/valgrind/asan/asan_symbolize.py' 128 script_path = os.path.join(
129 ROOT_DIR, 'tools', 'valgrind', 'asan', 'asan_symbolize.py')
129 cmd = [sys.executable, script_path] 130 cmd = [sys.executable, script_path]
130 if json_path is not None: 131 if json_path is not None:
131 cmd.append('--test-summary-json-file=%s' % json_path) 132 cmd.append('--test-summary-json-file=%s' % json_path)
132 if executable_path is not None: 133 if executable_path is not None:
133 cmd.append('--executable-path=%s' % executable_path) 134 cmd.append('--executable-path=%s' % executable_path)
134 return cmd 135 return cmd
135 136
136 137
137 def get_json_path(cmd): 138 def get_json_path(cmd):
138 """Extract the JSON test summary path from a command line.""" 139 """Extract the JSON test summary path from a command line."""
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 print >> sys.stderr, 'Failed to start %s' % cmd 231 print >> sys.stderr, 'Failed to start %s' % cmd
231 raise 232 raise
232 233
233 234
234 def main(): 235 def main():
235 return run_executable(sys.argv[1:], os.environ.copy()) 236 return run_executable(sys.argv[1:], os.environ.copy())
236 237
237 238
238 if __name__ == '__main__': 239 if __name__ == '__main__':
239 sys.exit(main()) 240 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698