| 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 perf tests. | 5 """Runs perf tests. | 
| 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 30 matching lines...) Expand all  Loading... | 
| 41   --device: the serial number to be passed to all adb commands. | 41   --device: the serial number to be passed to all adb commands. | 
| 42 """ | 42 """ | 
| 43 | 43 | 
| 44 import datetime | 44 import datetime | 
| 45 import logging | 45 import logging | 
| 46 import os | 46 import os | 
| 47 import pickle | 47 import pickle | 
| 48 import sys | 48 import sys | 
| 49 | 49 | 
| 50 from pylib import constants | 50 from pylib import constants | 
|  | 51 from pylib import forwarder | 
| 51 from pylib import pexpect | 52 from pylib import pexpect | 
| 52 from pylib.base import base_test_result | 53 from pylib.base import base_test_result | 
| 53 from pylib.base import base_test_runner | 54 from pylib.base import base_test_runner | 
| 54 | 55 | 
| 55 | 56 | 
| 56 def PrintTestOutput(test_name): | 57 def PrintTestOutput(test_name): | 
| 57   """Helper method to print the output of previously executed test_name. | 58   """Helper method to print the output of previously executed test_name. | 
| 58 | 59 | 
| 59   Args: | 60   Args: | 
| 60     test_name: name of the test that has been previously executed. | 61     test_name: name of the test that has been previously executed. | 
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 114 | 115 | 
| 115   def _LaunchPerfTest(self, test_name): | 116   def _LaunchPerfTest(self, test_name): | 
| 116     """Runs a perf test. | 117     """Runs a perf test. | 
| 117 | 118 | 
| 118     Args: | 119     Args: | 
| 119       test_name: the name of the test to be executed. | 120       test_name: the name of the test to be executed. | 
| 120 | 121 | 
| 121     Returns: | 122     Returns: | 
| 122       A tuple containing (Output, base_test_result.ResultType) | 123       A tuple containing (Output, base_test_result.ResultType) | 
| 123     """ | 124     """ | 
|  | 125     try: | 
|  | 126       logging.warning('Unmapping device ports') | 
|  | 127       forwarder.Forwarder.UnmapAllDevicePorts(self.adb) | 
|  | 128       self.adb.RestartAdbdOnDevice() | 
|  | 129     except Exception as e: | 
|  | 130       logging.error('Exception when tearing down device %s', e) | 
|  | 131 | 
| 124     cmd = ('%s --device %s' % | 132     cmd = ('%s --device %s' % | 
| 125            (self._tests[test_name], self.device)) | 133            (self._tests[test_name], self.device)) | 
| 126     logging.info('%s : %s', test_name, cmd) | 134     logging.info('%s : %s', test_name, cmd) | 
| 127     start_time = datetime.datetime.now() | 135     start_time = datetime.datetime.now() | 
| 128 | 136 | 
| 129     timeout = 1800 | 137     timeout = 1800 | 
| 130     if self._options.no_timeout: | 138     if self._options.no_timeout: | 
| 131       timeout = None | 139       timeout = None | 
| 132     full_cmd = cmd | 140     full_cmd = cmd | 
| 133     if self._options.dry_run: | 141     if self._options.dry_run: | 
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 177     Returns: | 185     Returns: | 
| 178       A tuple of (TestRunResults, retry). | 186       A tuple of (TestRunResults, retry). | 
| 179     """ | 187     """ | 
| 180     output, result_type = self._LaunchPerfTest(test_name) | 188     output, result_type = self._LaunchPerfTest(test_name) | 
| 181     results = base_test_result.TestRunResults() | 189     results = base_test_result.TestRunResults() | 
| 182     results.AddResult(base_test_result.BaseTestResult(test_name, result_type)) | 190     results.AddResult(base_test_result.BaseTestResult(test_name, result_type)) | 
| 183     retry = None | 191     retry = None | 
| 184     if not results.DidRunPass(): | 192     if not results.DidRunPass(): | 
| 185       retry = test_name | 193       retry = test_name | 
| 186     return results, retry | 194     return results, retry | 
| OLD | NEW | 
|---|