| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 out.insert(0, sys.executable) | 74 out.insert(0, sys.executable) |
| 75 return out | 75 return out |
| 76 | 76 |
| 77 | 77 |
| 78 def get_asan_env(cmd, lsan): | 78 def get_asan_env(cmd, lsan): |
| 79 """Returns the envirnoment flags needed for ASan and LSan.""" | 79 """Returns the envirnoment flags needed for ASan and LSan.""" |
| 80 | 80 |
| 81 extra_env = {} | 81 extra_env = {} |
| 82 | 82 |
| 83 # Instruct GTK to use malloc while running ASan or LSan tests. | 83 # Instruct GTK to use malloc while running ASan or LSan tests. |
| 84 # TODO(earthdok): enabling G_SLICE gives these leaks, locally and on swarming | 84 extra_env['G_SLICE'] = 'always-malloc' |
| 85 #0 0x62c01b in __interceptor_malloc (/tmp/run_tha_testXukBDT/out/Release/brows
er_tests+0x62c01b) | |
| 86 #1 0x7fb64ab64a38 in g_malloc /build/buildd/glib2.0-2.32.4/./glib/gmem.c:159 | |
| 87 #extra_env['G_SLICE'] = 'always-malloc' | |
| 88 | 85 |
| 89 extra_env['NSS_DISABLE_ARENA_FREE_LIST'] = '1' | 86 extra_env['NSS_DISABLE_ARENA_FREE_LIST'] = '1' |
| 90 extra_env['NSS_DISABLE_UNLOAD'] = '1' | 87 extra_env['NSS_DISABLE_UNLOAD'] = '1' |
| 91 | 88 |
| 92 # TODO(glider): remove the symbolizer path once | 89 # TODO(glider): remove the symbolizer path once |
| 93 # https://code.google.com/p/address-sanitizer/issues/detail?id=134 is fixed. | 90 # https://code.google.com/p/address-sanitizer/issues/detail?id=134 is fixed. |
| 94 symbolizer_path = os.path.abspath(os.path.join(ROOT_DIR, 'third_party', | 91 symbolizer_path = os.path.abspath(os.path.join(ROOT_DIR, 'third_party', |
| 95 'llvm-build', 'Release+Asserts', 'bin', 'llvm-symbolizer')) | 92 'llvm-build', 'Release+Asserts', 'bin', 'llvm-symbolizer')) |
| 96 | 93 |
| 97 asan_options = [] | 94 asan_options = [] |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 print >> sys.stderr, 'Failed to start %s' % cmd | 182 print >> sys.stderr, 'Failed to start %s' % cmd |
| 186 raise | 183 raise |
| 187 | 184 |
| 188 | 185 |
| 189 def main(): | 186 def main(): |
| 190 return run_executable(sys.argv[1:], os.environ.copy()) | 187 return run_executable(sys.argv[1:], os.environ.copy()) |
| 191 | 188 |
| 192 | 189 |
| 193 if __name__ == '__main__': | 190 if __name__ == '__main__': |
| 194 sys.exit(main()) | 191 sys.exit(main()) |
| OLD | NEW |