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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 reset test server port allocation. | 43 reset test server port allocation. |
44 """ | 44 """ |
45 | 45 |
46 import datetime | 46 import datetime |
47 import logging | 47 import logging |
48 import pexpect | 48 import pexpect |
49 import pickle | 49 import pickle |
50 import os | 50 import os |
51 import sys | 51 import sys |
52 | 52 |
| 53 from pylib import android_commands |
53 from pylib import constants | 54 from pylib import constants |
54 from pylib.base import base_test_result | 55 from pylib.base import base_test_result |
55 from pylib.base import base_test_runner | 56 from pylib.base import base_test_runner |
56 | 57 |
57 | 58 |
58 def PrintTestOutput(test_name): | 59 def PrintTestOutput(test_name): |
59 """Helper method to print the output of previously executed test_name. | 60 """Helper method to print the output of previously executed test_name. |
60 | 61 |
61 Args: | 62 Args: |
62 test_name: name of the test that has been previously executed. | 63 test_name: name of the test that has been previously executed. |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 'name': test_name, | 147 'name': test_name, |
147 'output': output, | 148 'output': output, |
148 'exit_code': exit_code, | 149 'exit_code': exit_code, |
149 'result_type': result_type, | 150 'result_type': result_type, |
150 'total_time': (end_time - start_time).seconds, | 151 'total_time': (end_time - start_time).seconds, |
151 'device': self.device, | 152 'device': self.device, |
152 'cmd': cmd, | 153 'cmd': cmd, |
153 } | 154 } |
154 self._SaveResult(persisted_result) | 155 self._SaveResult(persisted_result) |
155 | 156 |
| 157 try: |
| 158 self.adb.KillAdbdDevice() |
| 159 except Exception as e: |
| 160 logging.error('Exception when killing adbd %s', e) |
| 161 |
156 return (output, result_type) | 162 return (output, result_type) |
157 | 163 |
158 def RunTest(self, test_name): | 164 def RunTest(self, test_name): |
159 """Run a perf test on the device. | 165 """Run a perf test on the device. |
160 | 166 |
161 Args: | 167 Args: |
162 test_name: String to use for logging the test result. | 168 test_name: String to use for logging the test result. |
163 | 169 |
164 Returns: | 170 Returns: |
165 A tuple of (TestRunResults, retry). | 171 A tuple of (TestRunResults, retry). |
166 """ | 172 """ |
167 output, result_type = self._LaunchPerfTest(test_name) | 173 output, result_type = self._LaunchPerfTest(test_name) |
168 results = base_test_result.TestRunResults() | 174 results = base_test_result.TestRunResults() |
169 results.AddResult(base_test_result.BaseTestResult(test_name, result_type)) | 175 results.AddResult(base_test_result.BaseTestResult(test_name, result_type)) |
170 retry = None | 176 retry = None |
171 if not results.DidRunPass(): | 177 if not results.DidRunPass(): |
172 retry = test_name | 178 retry = test_name |
173 return results, retry | 179 return results, retry |
OLD | NEW |