| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 # logic is used. | 119 # logic is used. |
| 120 env.pop('CR_SOURCE_ROOT', None) | 120 env.pop('CR_SOURCE_ROOT', None) |
| 121 extra_env.update(get_sandbox_env(env)) | 121 extra_env.update(get_sandbox_env(env)) |
| 122 | 122 |
| 123 # Copy logic from tools/build/scripts/slave/runtest.py. | 123 # Copy logic from tools/build/scripts/slave/runtest.py. |
| 124 asan = '--asan=1' in cmd | 124 asan = '--asan=1' in cmd |
| 125 lsan = '--lsan=1' in cmd | 125 lsan = '--lsan=1' in cmd |
| 126 | 126 |
| 127 if asan: | 127 if asan: |
| 128 extra_env.update(get_asan_env(cmd, lsan)) | 128 extra_env.update(get_asan_env(cmd, lsan)) |
| 129 # ASan is not yet sandbox-friendly on Windows (http://crbug.com/382867). |
| 130 if sys.platform == 'win32': |
| 131 cmd.append('--no-sandbox') |
| 129 if lsan: | 132 if lsan: |
| 130 cmd.append('--no-sandbox') | 133 cmd.append('--no-sandbox') |
| 131 | 134 |
| 132 cmd = trim_cmd(cmd) | 135 cmd = trim_cmd(cmd) |
| 133 | 136 |
| 134 # Ensure paths are correctly separated on windows. | 137 # Ensure paths are correctly separated on windows. |
| 135 cmd[0] = cmd[0].replace('/', os.path.sep) | 138 cmd[0] = cmd[0].replace('/', os.path.sep) |
| 136 cmd = fix_python_path(cmd) | 139 cmd = fix_python_path(cmd) |
| 137 | 140 |
| 138 print('Additional test environment:\n%s\n' | 141 print('Additional test environment:\n%s\n' |
| (...skipping 21 matching lines...) Expand all Loading... |
| 160 print >> sys.stderr, 'Failed to start %s' % cmd | 163 print >> sys.stderr, 'Failed to start %s' % cmd |
| 161 raise | 164 raise |
| 162 | 165 |
| 163 | 166 |
| 164 def main(): | 167 def main(): |
| 165 return run_executable(sys.argv[1:], os.environ.copy()) | 168 return run_executable(sys.argv[1:], os.environ.copy()) |
| 166 | 169 |
| 167 | 170 |
| 168 if __name__ == '__main__': | 171 if __name__ == '__main__': |
| 169 sys.exit(main()) | 172 sys.exit(main()) |
| OLD | NEW |