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 contextlib | 5 import contextlib |
6 import logging | 6 import logging |
7 import os | 7 import os |
8 import posixpath | 8 import posixpath |
9 import re | 9 import re |
10 import sys | 10 import sys |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 device.RunShellCommand( | 81 device.RunShellCommand( |
82 ['log', '-p', 'i', '-t', _TAG, 'START %s' % test_name], | 82 ['log', '-p', 'i', '-t', _TAG, 'START %s' % test_name], |
83 check_return=True) | 83 check_return=True) |
84 try: | 84 try: |
85 yield | 85 yield |
86 finally: | 86 finally: |
87 device.RunShellCommand( | 87 device.RunShellCommand( |
88 ['log', '-p', 'i', '-t', _TAG, 'END %s' % test_name], | 88 ['log', '-p', 'i', '-t', _TAG, 'END %s' % test_name], |
89 check_return=True) | 89 check_return=True) |
90 | 90 |
91 # TODO(jbudorick): Make this private once the instrumentation test_runner is | 91 # TODO(jbudorick): Make this private once the instrumentation test_runner |
92 # deprecated. | 92 # is deprecated. |
93 def DidPackageCrashOnDevice(package_name, device): | 93 def DidPackageCrashOnDevice(package_name, device): |
94 # Dismiss any error dialogs. Limit the number in case we have an error | 94 # Dismiss any error dialogs. Limit the number in case we have an error |
95 # loop or we are failing to dismiss. | 95 # loop or we are failing to dismiss. |
96 try: | 96 try: |
97 for _ in xrange(10): | 97 for _ in xrange(10): |
98 package = device.DismissCrashDialogIfNeeded() | 98 package = device.DismissCrashDialogIfNeeded() |
99 if not package: | 99 if not package: |
100 return False | 100 return False |
101 # Assume test package convention of ".test" suffix | 101 # Assume test package convention of ".test" suffix |
102 if package in package_name: | 102 if package in package_name: |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 if not str(device) in self._flag_changers: | 299 if not str(device) in self._flag_changers: |
300 self._flag_changers[str(device)] = flag_changer.FlagChanger( | 300 self._flag_changers[str(device)] = flag_changer.FlagChanger( |
301 device, self._test_instance.package_info.cmdline_file) | 301 device, self._test_instance.package_info.cmdline_file) |
302 | 302 |
303 #override | 303 #override |
304 def _CreateShards(self, tests): | 304 def _CreateShards(self, tests): |
305 return tests | 305 return tests |
306 | 306 |
307 #override | 307 #override |
308 def _GetTests(self): | 308 def _GetTests(self): |
309 tests = self._test_instance.GetTests() | 309 device = self._env.devices[0] |
| 310 tests = self._test_instance.GetTests(device) |
310 tests = self._ApplyExternalSharding( | 311 tests = self._ApplyExternalSharding( |
311 tests, self._test_instance.external_shard_index, | 312 tests, self._test_instance.external_shard_index, |
312 self._test_instance.total_external_shards) | 313 self._test_instance.total_external_shards) |
313 return tests | 314 return tests |
314 | 315 |
315 #override | 316 #override |
316 def _GetUniqueTestName(self, test): | 317 def _GetUniqueTestName(self, test): |
317 return instrumentation_test_instance.GetUniqueTestName(test) | 318 return instrumentation_test_instance.GetUniqueTestName(test) |
318 | 319 |
319 #override | 320 #override |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 extras.update( | 365 extras.update( |
365 self._test_instance.GetDriverEnvironmentVars( | 366 self._test_instance.GetDriverEnvironmentVars( |
366 test_list=test_names)) | 367 test_list=test_names)) |
367 timeout = sum(timeouts) | 368 timeout = sum(timeouts) |
368 else: | 369 else: |
369 test_name = instrumentation_test_instance.GetTestName(test) | 370 test_name = instrumentation_test_instance.GetTestName(test) |
370 test_display_name = self._GetUniqueTestName(test) | 371 test_display_name = self._GetUniqueTestName(test) |
371 if test['is_junit4']: | 372 if test['is_junit4']: |
372 target = '%s/%s' % ( | 373 target = '%s/%s' % ( |
373 self._test_instance.test_package, | 374 self._test_instance.test_package, |
374 self._test_instance.test_runner_junit4) | 375 self._test_instance.junit4_runner_class) |
375 else: | 376 else: |
376 target = '%s/%s' % ( | 377 target = '%s/%s' % ( |
377 self._test_instance.test_package, self._test_instance.test_runner) | 378 self._test_instance.test_package, |
| 379 self._test_instance.junit3_runner_class) |
378 extras['class'] = test_name | 380 extras['class'] = test_name |
379 if 'flags' in test and test['flags']: | 381 if 'flags' in test and test['flags']: |
380 flags_to_add.extend(test['flags']) | 382 flags_to_add.extend(test['flags']) |
381 timeout = self._GetTimeoutFromAnnotations( | 383 timeout = self._GetTimeoutFromAnnotations( |
382 test['annotations'], test_display_name) | 384 test['annotations'], test_display_name) |
383 | 385 |
384 test_timeout_scale = self._GetTimeoutScaleFromAnnotations( | 386 test_timeout_scale = self._GetTimeoutScaleFromAnnotations( |
385 test['annotations']) | 387 test['annotations']) |
386 if test_timeout_scale and test_timeout_scale != 1: | 388 if test_timeout_scale and test_timeout_scale != 1: |
387 valgrind_tools.SetChromeTimeoutScale( | 389 valgrind_tools.SetChromeTimeoutScale( |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) | 715 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) |
714 | 716 |
715 return timeout | 717 return timeout |
716 | 718 |
717 def _IsRenderTest(test): | 719 def _IsRenderTest(test): |
718 """Determines if a test or list of tests has a RenderTest amongst them.""" | 720 """Determines if a test or list of tests has a RenderTest amongst them.""" |
719 if not isinstance(test, list): | 721 if not isinstance(test, list): |
720 test = [test] | 722 test = [test] |
721 return any([RENDER_TEST_FEATURE_ANNOTATION in t['annotations'].get( | 723 return any([RENDER_TEST_FEATURE_ANNOTATION in t['annotations'].get( |
722 FEATURE_ANNOTATION, {}).get('value', ()) for t in test]) | 724 FEATURE_ANNOTATION, {}).get('value', ()) for t in test]) |
OLD | NEW |