Chromium Code Reviews| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 --keep_test_server_ports: indicates it's being run as a shard, and shouldn't | 49 --keep_test_server_ports: indicates it's being run as a shard, and shouldn't |
| 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 import time | |
| 59 | 60 |
| 61 from pylib import android_commands | |
| 60 from pylib import constants | 62 from pylib import constants |
| 61 from pylib.base import base_test_result | 63 from pylib.base import base_test_result |
| 62 from pylib.base import base_test_runner | 64 from pylib.base import base_test_runner |
| 63 | 65 |
| 64 | 66 |
| 65 def PrintTestOutput(test_name): | 67 def PrintTestOutput(test_name): |
| 66 """Helper method to print the output of previously executed test_name. | 68 """Helper method to print the output of previously executed test_name. |
| 67 | 69 |
| 68 Args: | 70 Args: |
| 69 test_name: name of the test that has been previously executed. | 71 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, | 152 'name': test_name, |
| 151 'output': output, | 153 'output': output, |
| 152 'exit_code': exit_code, | 154 'exit_code': exit_code, |
| 153 'result_type': result_type, | 155 'result_type': result_type, |
| 154 'total_time': (end_time - start_time).seconds, | 156 'total_time': (end_time - start_time).seconds, |
| 155 'device': self.device, | 157 'device': self.device, |
| 156 'cmd': cmd, | 158 'cmd': cmd, |
| 157 } | 159 } |
| 158 self._SaveResult(persisted_result) | 160 self._SaveResult(persisted_result) |
| 159 | 161 |
| 162 | |
| 163 try: | |
| 164 logging.info('Killing adbd on the device...') | |
| 165 adb = android_commands.AndroidCommands(self.device) | |
|
craigdh
2013/10/01 18:56:44
An adb object should already exists for this devic
navabi
2013/10/01 22:55:10
I don't understand. Where is the reference to that
bulach
2013/10/02 08:53:43
I think base_test_runner.BaseTestRunner has alread
| |
| 166 adb_pids = adb.ExtractPid('adbd') | |
| 167 if adb_pids: | |
| 168 adb.RunShellCommandWithSU('kill %s' % ' '.join(adb_pids)) | |
|
craigdh
2013/10/01 18:56:44
Instead of putting all this here, let's add androi
navabi
2013/10/01 22:55:10
+1
bulach
2013/10/02 08:53:43
Done.
| |
| 169 logging.info('Waiting for device to settle...') | |
| 170 time.sleep(5) | |
| 171 except Exception as e: | |
| 172 logging.error('Exception when killing adbd %s', e) | |
| 173 | |
| 160 return (output, result_type) | 174 return (output, result_type) |
| 161 | 175 |
| 162 def RunTest(self, test_name): | 176 def RunTest(self, test_name): |
| 163 """Run a perf test on the device. | 177 """Run a perf test on the device. |
| 164 | 178 |
| 165 Args: | 179 Args: |
| 166 test_name: String to use for logging the test result. | 180 test_name: String to use for logging the test result. |
| 167 | 181 |
| 168 Returns: | 182 Returns: |
| 169 A tuple of (TestRunResults, retry). | 183 A tuple of (TestRunResults, retry). |
| 170 """ | 184 """ |
| 171 output, result_type = self._LaunchPerfTest(test_name) | 185 output, result_type = self._LaunchPerfTest(test_name) |
| 172 results = base_test_result.TestRunResults() | 186 results = base_test_result.TestRunResults() |
| 173 results.AddResult(base_test_result.BaseTestResult(test_name, result_type)) | 187 results.AddResult(base_test_result.BaseTestResult(test_name, result_type)) |
| 174 retry = None | 188 retry = None |
| 175 if not results.DidRunPass(): | 189 if not results.DidRunPass(): |
| 176 retry = test_name | 190 retry = test_name |
| 177 return results, retry | 191 return results, retry |
| OLD | NEW |