| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 re | 7 import re |
| 8 import shutil | |
| 9 import sys | 8 import sys |
| 10 import tempfile | 9 import tempfile |
| 11 | 10 |
| 12 from devil.android import apk_helper | 11 from devil.android import apk_helper |
| 13 from pylib import constants | 12 from pylib import constants |
| 14 from pylib.base import base_test_result | 13 from pylib.base import base_test_result |
| 15 from pylib.base import test_instance | 14 from pylib.base import test_instance |
| 16 | 15 |
| 17 sys.path.append(os.path.join( | 16 sys.path.append(os.path.join( |
| 18 constants.DIR_SOURCE_ROOT, 'build', 'util', 'lib', 'common')) | 17 constants.DIR_SOURCE_ROOT, 'build', 'util', 'lib', 'common')) |
| 19 import unittest_util | 18 import unittest_util # pylint: disable=import-error |
| 20 | 19 |
| 21 | 20 |
| 22 BROWSER_TEST_SUITES = [ | 21 BROWSER_TEST_SUITES = [ |
| 23 'components_browsertests', | 22 'components_browsertests', |
| 24 'content_browsertests', | 23 'content_browsertests', |
| 25 ] | 24 ] |
| 26 | 25 |
| 27 | 26 |
| 28 _DEFAULT_ISOLATE_FILE_PATHS = { | 27 _DEFAULT_ISOLATE_FILE_PATHS = { |
| 29 'base_unittests': 'base/base_unittests.isolate', | 28 'base_unittests': 'base/base_unittests.isolate', |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 'third_party/hunspell_dictionaries/*.dic', | 66 'third_party/hunspell_dictionaries/*.dic', |
| 68 # crbug.com/258690 | 67 # crbug.com/258690 |
| 69 'webkit/data/bmp_decoder', | 68 'webkit/data/bmp_decoder', |
| 70 'webkit/data/ico_decoder', | 69 'webkit/data/ico_decoder', |
| 71 ] | 70 ] |
| 72 | 71 |
| 73 | 72 |
| 74 _EXTRA_NATIVE_TEST_ACTIVITY = ( | 73 _EXTRA_NATIVE_TEST_ACTIVITY = ( |
| 75 'org.chromium.native_test.NativeTestInstrumentationTestRunner.' | 74 'org.chromium.native_test.NativeTestInstrumentationTestRunner.' |
| 76 'NativeTestActivity') | 75 'NativeTestActivity') |
| 77 _EXTRA_SHARD_SIZE_LIMIT =( | 76 _EXTRA_SHARD_SIZE_LIMIT = ( |
| 78 'org.chromium.native_test.NativeTestInstrumentationTestRunner.' | 77 'org.chromium.native_test.NativeTestInstrumentationTestRunner.' |
| 79 'ShardSizeLimit') | 78 'ShardSizeLimit') |
| 80 | 79 |
| 81 # TODO(jbudorick): Remove these once we're no longer parsing stdout to generate | 80 # TODO(jbudorick): Remove these once we're no longer parsing stdout to generate |
| 82 # results. | 81 # results. |
| 83 _RE_TEST_STATUS = re.compile( | 82 _RE_TEST_STATUS = re.compile( |
| 84 r'\[ +((?:RUN)|(?:FAILED)|(?:OK)) +\] ?([^ ]+)(?: \((\d+) ms\))?$') | 83 r'\[ +((?:RUN)|(?:FAILED)|(?:OK)) +\] ?([^ ]+)(?: \((\d+) ms\))?$') |
| 85 _RE_TEST_RUN_STATUS = re.compile( | 84 _RE_TEST_RUN_STATUS = re.compile( |
| 86 r'\[ +(PASSED|RUNNER_FAILED|CRASHED) \] ?[^ ]+') | 85 r'\[ +(PASSED|RUNNER_FAILED|CRASHED) \] ?[^ ]+') |
| 87 | 86 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 if default_isolate_file_path: | 169 if default_isolate_file_path: |
| 171 args.isolate_file_path = os.path.join( | 170 args.isolate_file_path = os.path.join( |
| 172 constants.DIR_SOURCE_ROOT, default_isolate_file_path) | 171 constants.DIR_SOURCE_ROOT, default_isolate_file_path) |
| 173 | 172 |
| 174 if args.isolate_file_path: | 173 if args.isolate_file_path: |
| 175 self._isolate_abs_path = os.path.abspath(args.isolate_file_path) | 174 self._isolate_abs_path = os.path.abspath(args.isolate_file_path) |
| 176 self._isolate_delegate = isolate_delegate | 175 self._isolate_delegate = isolate_delegate |
| 177 self._isolated_abs_path = os.path.join( | 176 self._isolated_abs_path = os.path.join( |
| 178 constants.GetOutDirectory(), '%s.isolated' % self._suite) | 177 constants.GetOutDirectory(), '%s.isolated' % self._suite) |
| 179 else: | 178 else: |
| 180 logging.warning('No isolate file provided. No data deps will be pushed.'); | 179 logging.warning('No isolate file provided. No data deps will be pushed.') |
| 181 self._isolate_delegate = None | 180 self._isolate_delegate = None |
| 182 | 181 |
| 183 if args.app_data_files: | 182 if args.app_data_files: |
| 184 self._app_data_files = args.app_data_files | 183 self._app_data_files = args.app_data_files |
| 185 if args.app_data_file_dir: | 184 if args.app_data_file_dir: |
| 186 self._app_data_file_dir = args.app_data_file_dir | 185 self._app_data_file_dir = args.app_data_file_dir |
| 187 else: | 186 else: |
| 188 self._app_data_file_dir = tempfile.mkdtemp() | 187 self._app_data_file_dir = tempfile.mkdtemp() |
| 189 logging.critical('Saving app files to %s', self._app_data_file_dir) | 188 logging.critical('Saving app files to %s', self._app_data_file_dir) |
| 190 else: | 189 else: |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 constants.DIR_SOURCE_ROOT, 'build', 'android', 'pylib', 'gtest', | 251 constants.DIR_SOURCE_ROOT, 'build', 'android', 'pylib', 'gtest', |
| 253 'filter', '%s_disabled' % self._suite) | 252 'filter', '%s_disabled' % self._suite) |
| 254 if disabled_tests_file_path and os.path.exists(disabled_tests_file_path): | 253 if disabled_tests_file_path and os.path.exists(disabled_tests_file_path): |
| 255 with open(disabled_tests_file_path) as disabled_tests_file: | 254 with open(disabled_tests_file_path) as disabled_tests_file: |
| 256 disabled_filter_items += [ | 255 disabled_filter_items += [ |
| 257 '%s' % l for l in (line.strip() for line in disabled_tests_file) | 256 '%s' % l for l in (line.strip() for line in disabled_tests_file) |
| 258 if l and not l.startswith('#')] | 257 if l and not l.startswith('#')] |
| 259 | 258 |
| 260 return '*-%s' % ':'.join(disabled_filter_items) | 259 return '*-%s' % ':'.join(disabled_filter_items) |
| 261 | 260 |
| 261 # pylint: disable=no-self-use |
| 262 def ParseGTestOutput(self, output): | 262 def ParseGTestOutput(self, output): |
| 263 """Parses raw gtest output and returns a list of results. | 263 """Parses raw gtest output and returns a list of results. |
| 264 | 264 |
| 265 Args: | 265 Args: |
| 266 output: A list of output lines. | 266 output: A list of output lines. |
| 267 Returns: | 267 Returns: |
| 268 A list of base_test_result.BaseTestResults. | 268 A list of base_test_result.BaseTestResults. |
| 269 """ | 269 """ |
| 270 results = [] | 270 results = [] |
| 271 for l in output: | 271 for l in output: |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 return self._package | 320 return self._package |
| 321 | 321 |
| 322 @property | 322 @property |
| 323 def runner(self): | 323 def runner(self): |
| 324 return self._runner | 324 return self._runner |
| 325 | 325 |
| 326 @property | 326 @property |
| 327 def suite(self): | 327 def suite(self): |
| 328 return self._suite | 328 return self._suite |
| 329 | 329 |
| OLD | NEW |