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