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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
148 json_path = get_json_path(cmd) | 148 json_path = get_json_path(cmd) |
149 if json_path is None: | 149 if json_path is None: |
150 return | 150 return |
151 | 151 |
152 try: | 152 try: |
153 symbolize_command = get_sanitizer_symbolize_command( | 153 symbolize_command = get_sanitizer_symbolize_command( |
154 json_path=json_path, executable_path=cmd[0]) | 154 json_path=json_path, executable_path=cmd[0]) |
155 p = subprocess.Popen(symbolize_command, stderr=subprocess.PIPE, env=env) | 155 p = subprocess.Popen(symbolize_command, stderr=subprocess.PIPE, env=env) |
156 (_, stderr) = p.communicate() | 156 (_, stderr) = p.communicate() |
157 except OSError as e: | 157 except OSError as e: |
158 print 'Exception while symbolizing snippets: %s' % e | 158 print 'Exception while symbolizing snippets: %s' % e |
M-A Ruel
2016/01/29 16:34:23
print >> sys.stderr, 'Exception ...
| |
159 raise | |
159 | 160 |
160 if p.returncode != 0: | 161 if p.returncode != 0: |
161 print "Error: failed to symbolize snippets in JSON:\n" | 162 print "Error: failed to symbolize snippets in JSON:\n" |
162 print stderr | 163 print stderr |
M-A Ruel
2016/01/29 16:34:23
print >> sys.stderr, stderr
?
| |
164 raise subprocess.CalledProcessError(p.returncode, symbolize_command) | |
163 | 165 |
164 | 166 |
165 def run_executable(cmd, env): | 167 def run_executable(cmd, env): |
166 """Runs an executable with: | 168 """Runs an executable with: |
167 - environment variable CR_SOURCE_ROOT set to the root directory. | 169 - environment variable CR_SOURCE_ROOT set to the root directory. |
168 - environment variable LANGUAGE to en_US.UTF-8. | 170 - environment variable LANGUAGE to en_US.UTF-8. |
169 - environment variable CHROME_DEVEL_SANDBOX set | 171 - environment variable CHROME_DEVEL_SANDBOX set |
170 - Reuses sys.executable automatically. | 172 - Reuses sys.executable automatically. |
171 """ | 173 """ |
172 extra_env = {} | 174 extra_env = {} |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
230 print >> sys.stderr, 'Failed to start %s' % cmd | 232 print >> sys.stderr, 'Failed to start %s' % cmd |
231 raise | 233 raise |
232 | 234 |
233 | 235 |
234 def main(): | 236 def main(): |
235 return run_executable(sys.argv[1:], os.environ.copy()) | 237 return run_executable(sys.argv[1:], os.environ.copy()) |
236 | 238 |
237 | 239 |
238 if __name__ == '__main__': | 240 if __name__ == '__main__': |
239 sys.exit(main()) | 241 sys.exit(main()) |
OLD | NEW |