| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 import logging | 5 import logging |
| 6 import os | 6 import os |
| 7 import posixpath | 7 import posixpath |
| 8 import re | 8 import re |
| 9 import time | 9 import time |
| 10 | 10 |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 coverage_directory = os.path.join( | 197 coverage_directory = os.path.join( |
| 198 device.GetExternalStoragePath(), 'chrome', 'test', 'coverage') | 198 device.GetExternalStoragePath(), 'chrome', 'test', 'coverage') |
| 199 coverage_device_file = os.path.join( | 199 coverage_device_file = os.path.join( |
| 200 coverage_directory, coverage_basename) | 200 coverage_directory, coverage_basename) |
| 201 extras['coverageFile'] = coverage_device_file | 201 extras['coverageFile'] = coverage_device_file |
| 202 | 202 |
| 203 if isinstance(test, list): | 203 if isinstance(test, list): |
| 204 if not self._test_instance.driver_apk: | 204 if not self._test_instance.driver_apk: |
| 205 raise Exception('driver_apk does not exist. ' | 205 raise Exception('driver_apk does not exist. ' |
| 206 'Please build it and try again.') | 206 'Please build it and try again.') |
| 207 if any(t.get('is_junit4') for t in test): |
| 208 raise Exception('driver apk does not support JUnit4 tests') |
| 207 | 209 |
| 208 def name_and_timeout(t): | 210 def name_and_timeout(t): |
| 209 n = instrumentation_test_instance.GetTestName(t) | 211 n = instrumentation_test_instance.GetTestName(t) |
| 210 i = self._GetTimeoutFromAnnotations(t['annotations'], n) | 212 i = self._GetTimeoutFromAnnotations(t['annotations'], n) |
| 211 return (n, i) | 213 return (n, i) |
| 212 | 214 |
| 213 test_names, timeouts = zip(*(name_and_timeout(t) for t in test)) | 215 test_names, timeouts = zip(*(name_and_timeout(t) for t in test)) |
| 214 | 216 |
| 215 test_name = ','.join(test_names) | 217 test_name = ','.join(test_names) |
| 216 test_display_name = test_name | 218 test_display_name = test_name |
| 217 target = '%s/%s' % ( | 219 target = '%s/%s' % ( |
| 218 self._test_instance.driver_package, | 220 self._test_instance.driver_package, |
| 219 self._test_instance.driver_name) | 221 self._test_instance.driver_name) |
| 220 extras.update( | 222 extras.update( |
| 221 self._test_instance.GetDriverEnvironmentVars( | 223 self._test_instance.GetDriverEnvironmentVars( |
| 222 test_list=test_names)) | 224 test_list=test_names)) |
| 223 timeout = sum(timeouts) | 225 timeout = sum(timeouts) |
| 224 else: | 226 else: |
| 225 test_name = instrumentation_test_instance.GetTestName(test) | 227 test_name = instrumentation_test_instance.GetTestName(test) |
| 226 test_display_name = self._GetUniqueTestName(test) | 228 test_display_name = self._GetUniqueTestName(test) |
| 227 target = '%s/%s' % ( | 229 if test['is_junit4']: |
| 228 self._test_instance.test_package, self._test_instance.test_runner) | 230 target = '%s/%s' % ( |
| 231 self._test_instance.test_package, |
| 232 self._test_instance.test_runner_junit4) |
| 233 else: |
| 234 target = '%s/%s' % ( |
| 235 self._test_instance.test_package, self._test_instance.test_runner) |
| 229 extras['class'] = test_name | 236 extras['class'] = test_name |
| 230 if 'flags' in test: | 237 if 'flags' in test: |
| 231 flags = test['flags'] | 238 flags = test['flags'] |
| 232 timeout = self._GetTimeoutFromAnnotations( | 239 timeout = self._GetTimeoutFromAnnotations( |
| 233 test['annotations'], test_display_name) | 240 test['annotations'], test_display_name) |
| 234 | 241 |
| 235 test_timeout_scale = self._GetTimeoutScaleFromAnnotations( | 242 test_timeout_scale = self._GetTimeoutScaleFromAnnotations( |
| 236 test['annotations']) | 243 test['annotations']) |
| 237 if test_timeout_scale and test_timeout_scale != 1: | 244 if test_timeout_scale and test_timeout_scale != 1: |
| 238 valgrind_tools.SetChromeTimeoutScale( | 245 valgrind_tools.SetChromeTimeoutScale( |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 timeout = v | 398 timeout = v |
| 392 break | 399 break |
| 393 else: | 400 else: |
| 394 logging.warning('Using default 1 minute timeout for %s', test_name) | 401 logging.warning('Using default 1 minute timeout for %s', test_name) |
| 395 timeout = 60 | 402 timeout = 60 |
| 396 | 403 |
| 397 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) | 404 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) |
| 398 | 405 |
| 399 return timeout | 406 return timeout |
| 400 | 407 |
| OLD | NEW |