| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import os | 5 import os |
| 6 import re | 6 import re |
| 7 import time | 7 import time |
| 8 | 8 |
| 9 from . import parse_metric | 9 from . import parse_metric |
| 10 | 10 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 command_parts = command.split() | 192 command_parts = command.split() |
| 193 stdout = api.m.raw_io.output() | 193 stdout = api.m.raw_io.output() |
| 194 stderr = api.m.raw_io.output() | 194 stderr = api.m.raw_io.output() |
| 195 | 195 |
| 196 # TODO(prasadv): Remove this once bisect runs are no longer running | 196 # TODO(prasadv): Remove this once bisect runs are no longer running |
| 197 # against revisions from February 2016 or earlier. | 197 # against revisions from February 2016 or earlier. |
| 198 kwargs = {} | 198 kwargs = {} |
| 199 if 'android-chrome' in command: # pragma: no cover | 199 if 'android-chrome' in command: # pragma: no cover |
| 200 kwargs['env'] = {'CHROMIUM_OUTPUT_DIR': api.m.chromium.output_dir} | 200 kwargs['env'] = {'CHROMIUM_OUTPUT_DIR': api.m.chromium.output_dir} |
| 201 | 201 |
| 202 # By default, we assume that the test to run is an executable binary. In the |
| 203 # case of python scripts, runtest.py will guess based on the extension. |
| 204 python_mode = False |
| 205 if command_parts[0] == 'python': # pragma: no cover |
| 206 # Dashboard prepends the command with 'python' when on windows, however, it |
| 207 # is not necessary to pass this along to the runtest.py invocation. |
| 208 # TODO(robertocn): Remove this clause when dashboard stops sending python as |
| 209 # part of the command. |
| 210 # https://github.com/catapult-project/catapult/issues/2283 |
| 211 command_parts = command_parts[1:] |
| 212 python_mode = True |
| 213 elif _is_telemetry_command(command): |
| 214 # run_benchmark is a python script without an extension, hence we force |
| 215 # python mode. |
| 216 python_mode = True |
| 202 try: | 217 try: |
| 203 step_result = api.m.chromium.runtest( | 218 step_result = api.m.chromium.runtest( |
| 204 test=_rebase_path(command_parts[0]), | 219 test=_rebase_path(command_parts[0]), |
| 205 args=command_parts[1:], | 220 args=command_parts[1:], |
| 206 xvfb=True, | 221 xvfb=True, |
| 207 name=step_name, | 222 name=step_name, |
| 223 python_mode=python_mode, |
| 208 stdout=stdout, | 224 stdout=stdout, |
| 209 stderr=stderr, | 225 stderr=stderr, |
| 210 **kwargs) | 226 **kwargs) |
| 211 step_result.presentation.logs['Captured Output'] = ( | 227 step_result.presentation.logs['Captured Output'] = ( |
| 212 step_result.stdout or '').splitlines() | 228 step_result.stdout or '').splitlines() |
| 213 except api.m.step.StepFailure as sf: | 229 except api.m.step.StepFailure as sf: |
| 214 sf.result.presentation.logs['Failure Output'] = ( | 230 sf.result.presentation.logs['Failure Output'] = ( |
| 215 sf.result.stdout or '').splitlines() | 231 sf.result.stdout or '').splitlines() |
| 216 if sf.result.stderr: # pragma: no cover | 232 if sf.result.stderr: # pragma: no cover |
| 217 sf.result.presentation.logs['stderr'] = ( | 233 sf.result.presentation.logs['stderr'] = ( |
| 218 sf.result.stderr).splitlines() | 234 sf.result.stderr).splitlines() |
| 219 return sf.result.stdout, sf.result.stderr, sf.result.retcode | 235 return sf.result.stdout, sf.result.stderr, sf.result.retcode |
| 220 return step_result.stdout, step_result.stderr, step_result.retcode | 236 return step_result.stdout, step_result.stderr, step_result.retcode |
| OLD | NEW |