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

Side by Side Diff: testing/test_env.py

Issue 1647653008: Don't silently swallow error about symbolize script not existing. (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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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())
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