| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 output_for_all_runs = [] | 86 output_for_all_runs = [] |
| 87 temp_dir = None | 87 temp_dir = None |
| 88 repeat_cnt = test_config['repeat_count'] | 88 repeat_cnt = test_config['repeat_count'] |
| 89 | 89 |
| 90 command = test_config['command'] | 90 command = test_config['command'] |
| 91 use_chartjson = bool('chartjson' in command) | 91 use_chartjson = bool('chartjson' in command) |
| 92 is_telemetry = _is_telemetry_command(command) | 92 is_telemetry = _is_telemetry_command(command) |
| 93 start_time = time.time() | 93 start_time = time.time() |
| 94 for i in range(repeat_cnt): | 94 for i in range(repeat_cnt): |
| 95 elapsed_minutes = (time.time() - start_time) / 60.0 | 95 elapsed_minutes = (time.time() - start_time) / 60.0 |
| 96 if elapsed_minutes >= limit: # pragma: no cover | 96 # A limit of 0 means 'no timeout set'. |
| 97 if limit and elapsed_minutes >= limit: # pragma: no cover |
| 97 break | 98 break |
| 98 if is_telemetry: | 99 if is_telemetry: |
| 99 if i == 0 and kwargs.get('reset_on_first_run'): | 100 if i == 0 and kwargs.get('reset_on_first_run'): |
| 100 command += ' --reset-results' | 101 command += ' --reset-results' |
| 101 if i == repeat_cnt - 1 and kwargs.get('upload_on_last_run'): | 102 if i == repeat_cnt - 1 and kwargs.get('upload_on_last_run'): |
| 102 command += ' --upload-results' | 103 command += ' --upload-results' |
| 103 if kwargs.get('results_label'): | 104 if kwargs.get('results_label'): |
| 104 command += ' --results-label=%s' % kwargs.get('results_label') | 105 command += ' --results-label=%s' % kwargs.get('results_label') |
| 105 if use_chartjson: # pragma: no cover | 106 if use_chartjson: # pragma: no cover |
| 106 temp_dir = api.m.path.mkdtemp('perf-test-output') | 107 temp_dir = api.m.path.mkdtemp('perf-test-output') |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 command_parts, | 197 command_parts, |
| 197 stdout=stdout, | 198 stdout=stdout, |
| 198 stderr=stderr) | 199 stderr=stderr) |
| 199 step_result.presentation.logs['Captured Output'] = ( | 200 step_result.presentation.logs['Captured Output'] = ( |
| 200 step_result.stdout or '').splitlines() | 201 step_result.stdout or '').splitlines() |
| 201 except api.m.step.StepFailure as sf: | 202 except api.m.step.StepFailure as sf: |
| 202 sf.result.presentation.logs['Failure Output'] = ( | 203 sf.result.presentation.logs['Failure Output'] = ( |
| 203 sf.result.stdout or '').splitlines() | 204 sf.result.stdout or '').splitlines() |
| 204 return sf.result.stdout, sf.result.stderr, sf.result.retcode | 205 return sf.result.stdout, sf.result.stderr, sf.result.retcode |
| 205 return step_result.stdout, step_result.stderr, step_result.retcode | 206 return step_result.stdout, step_result.stderr, step_result.retcode |
| OLD | NEW |