| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 '\n'.join(' %s=%s' % | 166 '\n'.join(' %s=%s' % |
| 167 (k, v) for k, v in sorted(extra_env.iteritems())), | 167 (k, v) for k, v in sorted(extra_env.iteritems())), |
| 168 ' '.join(cmd))) | 168 ' '.join(cmd))) |
| 169 env.update(extra_env or {}) | 169 env.update(extra_env or {}) |
| 170 try: | 170 try: |
| 171 # See above comment regarding offline symbolization. | 171 # See above comment regarding offline symbolization. |
| 172 if asan and not lsan: | 172 if asan and not lsan: |
| 173 # Need to pipe to the symbolizer script. | 173 # Need to pipe to the symbolizer script. |
| 174 p1 = subprocess.Popen(cmd, env=env, stdout=subprocess.PIPE, | 174 p1 = subprocess.Popen(cmd, env=env, stdout=subprocess.PIPE, |
| 175 stderr=sys.stdout) | 175 stderr=sys.stdout) |
| 176 p2 = subprocess.Popen(["../tools/valgrind/asan/asan_symbolize.py"], | 176 p2 = subprocess.Popen([sys.executable, |
| 177 "../tools/valgrind/asan/asan_symbolize.py"], |
| 177 env=env, stdin=p1.stdout) | 178 env=env, stdin=p1.stdout) |
| 178 p1.stdout.close() # Allow p1 to receive a SIGPIPE if p2 exits. | 179 p1.stdout.close() # Allow p1 to receive a SIGPIPE if p2 exits. |
| 179 p1.wait() | 180 p1.wait() |
| 180 p2.wait() | 181 p2.wait() |
| 181 return p1.returncode | 182 return p1.returncode |
| 182 else: | 183 else: |
| 183 return subprocess.call(cmd, env=env) | 184 return subprocess.call(cmd, env=env) |
| 184 except OSError: | 185 except OSError: |
| 185 print >> sys.stderr, 'Failed to start %s' % cmd | 186 print >> sys.stderr, 'Failed to start %s' % cmd |
| 186 raise | 187 raise |
| 187 | 188 |
| 188 | 189 |
| 189 def main(): | 190 def main(): |
| 190 return run_executable(sys.argv[1:], os.environ.copy()) | 191 return run_executable(sys.argv[1:], os.environ.copy()) |
| 191 | 192 |
| 192 | 193 |
| 193 if __name__ == '__main__': | 194 if __name__ == '__main__': |
| 194 sys.exit(main()) | 195 sys.exit(main()) |
| OLD | NEW |