OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 """Runs a perf test on a single device. | 5 """Runs a perf test on a single device. |
6 | 6 |
7 Our buildbot infrastructure requires each slave to run steps serially. | 7 Our buildbot infrastructure requires each slave to run steps serially. |
8 This is sub-optimal for android, where these steps can run independently on | 8 This is sub-optimal for android, where these steps can run independently on |
9 multiple connected devices. | 9 multiple connected devices. |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 reset test server port allocation. | 50 reset test server port allocation. |
51 """ | 51 """ |
52 | 52 |
53 import datetime | 53 import datetime |
54 import logging | 54 import logging |
55 import pexpect | 55 import pexpect |
56 import pickle | 56 import pickle |
57 import os | 57 import os |
58 import sys | 58 import sys |
59 | 59 |
| 60 from pylib import android_commands |
60 from pylib import constants | 61 from pylib import constants |
61 from pylib.base import base_test_result | 62 from pylib.base import base_test_result |
62 from pylib.base import base_test_runner | 63 from pylib.base import base_test_runner |
63 | 64 |
64 | 65 |
65 def PrintTestOutput(test_name): | 66 def PrintTestOutput(test_name): |
66 """Helper method to print the output of previously executed test_name. | 67 """Helper method to print the output of previously executed test_name. |
67 | 68 |
68 Args: | 69 Args: |
69 test_name: name of the test that has been previously executed. | 70 test_name: name of the test that has been previously executed. |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 'name': test_name, | 151 'name': test_name, |
151 'output': output, | 152 'output': output, |
152 'exit_code': exit_code, | 153 'exit_code': exit_code, |
153 'result_type': result_type, | 154 'result_type': result_type, |
154 'total_time': (end_time - start_time).seconds, | 155 'total_time': (end_time - start_time).seconds, |
155 'device': self.device, | 156 'device': self.device, |
156 'cmd': cmd, | 157 'cmd': cmd, |
157 } | 158 } |
158 self._SaveResult(persisted_result) | 159 self._SaveResult(persisted_result) |
159 | 160 |
| 161 self.adb.KillAdbdDevice() |
| 162 |
160 return (output, result_type) | 163 return (output, result_type) |
161 | 164 |
162 def RunTest(self, test_name): | 165 def RunTest(self, test_name): |
163 """Run a perf test on the device. | 166 """Run a perf test on the device. |
164 | 167 |
165 Args: | 168 Args: |
166 test_name: String to use for logging the test result. | 169 test_name: String to use for logging the test result. |
167 | 170 |
168 Returns: | 171 Returns: |
169 A tuple of (TestRunResults, retry). | 172 A tuple of (TestRunResults, retry). |
170 """ | 173 """ |
171 output, result_type = self._LaunchPerfTest(test_name) | 174 output, result_type = self._LaunchPerfTest(test_name) |
172 results = base_test_result.TestRunResults() | 175 results = base_test_result.TestRunResults() |
173 results.AddResult(base_test_result.BaseTestResult(test_name, result_type)) | 176 results.AddResult(base_test_result.BaseTestResult(test_name, result_type)) |
174 retry = None | 177 retry = None |
175 if not results.DidRunPass(): | 178 if not results.DidRunPass(): |
176 retry = test_name | 179 retry = test_name |
177 return results, retry | 180 return results, retry |
OLD | NEW |