| 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 sys | |
| 9 import tempfile | 8 import tempfile |
| 10 | 9 |
| 11 from devil.android import apk_helper | 10 from devil.android import apk_helper |
| 12 from pylib import constants | 11 from pylib import constants |
| 12 from pylib.constants import host_paths |
| 13 from pylib.base import base_test_result | 13 from pylib.base import base_test_result |
| 14 from pylib.base import test_instance | 14 from pylib.base import test_instance |
| 15 | 15 |
| 16 sys.path.append(os.path.join( | 16 with host_paths.SysPath(host_paths.BUILD_COMMON_PATH): |
| 17 constants.DIR_SOURCE_ROOT, 'build', 'util', 'lib', 'common')) | 17 import unittest_util # pylint: disable=import-error |
| 18 import unittest_util # pylint: disable=import-error | |
| 19 | 18 |
| 20 | 19 |
| 21 BROWSER_TEST_SUITES = [ | 20 BROWSER_TEST_SUITES = [ |
| 22 'components_browsertests', | 21 'components_browsertests', |
| 23 'content_browsertests', | 22 'content_browsertests', |
| 24 ] | 23 ] |
| 25 | 24 |
| 26 RUN_IN_SUB_THREAD_TEST_SUITES = ['net_unittests'] | 25 RUN_IN_SUB_THREAD_TEST_SUITES = ['net_unittests'] |
| 27 | 26 |
| 28 | 27 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 elif args.test_filter_file: | 168 elif args.test_filter_file: |
| 170 with open(args.test_filter_file, 'r') as f: | 169 with open(args.test_filter_file, 'r') as f: |
| 171 self._gtest_filter = ':'.join(l.strip() for l in f) | 170 self._gtest_filter = ':'.join(l.strip() for l in f) |
| 172 else: | 171 else: |
| 173 self._gtest_filter = None | 172 self._gtest_filter = None |
| 174 | 173 |
| 175 if not args.isolate_file_path: | 174 if not args.isolate_file_path: |
| 176 default_isolate_file_path = _DEFAULT_ISOLATE_FILE_PATHS.get(self._suite) | 175 default_isolate_file_path = _DEFAULT_ISOLATE_FILE_PATHS.get(self._suite) |
| 177 if default_isolate_file_path: | 176 if default_isolate_file_path: |
| 178 args.isolate_file_path = os.path.join( | 177 args.isolate_file_path = os.path.join( |
| 179 constants.DIR_SOURCE_ROOT, default_isolate_file_path) | 178 host_paths.DIR_SOURCE_ROOT, default_isolate_file_path) |
| 180 | 179 |
| 181 if args.isolate_file_path: | 180 if args.isolate_file_path: |
| 182 self._isolate_abs_path = os.path.abspath(args.isolate_file_path) | 181 self._isolate_abs_path = os.path.abspath(args.isolate_file_path) |
| 183 self._isolate_delegate = isolate_delegate | 182 self._isolate_delegate = isolate_delegate |
| 184 self._isolated_abs_path = os.path.join( | 183 self._isolated_abs_path = os.path.join( |
| 185 constants.GetOutDirectory(), '%s.isolated' % self._suite) | 184 constants.GetOutDirectory(), '%s.isolated' % self._suite) |
| 186 else: | 185 else: |
| 187 logging.warning('No isolate file provided. No data deps will be pushed.') | 186 logging.warning('No isolate file provided. No data deps will be pushed.') |
| 188 self._isolate_delegate = None | 187 self._isolate_delegate = None |
| 189 | 188 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 | 307 |
| 309 def _GenerateDisabledFilterString(self, disabled_prefixes): | 308 def _GenerateDisabledFilterString(self, disabled_prefixes): |
| 310 disabled_filter_items = [] | 309 disabled_filter_items = [] |
| 311 | 310 |
| 312 if disabled_prefixes is None: | 311 if disabled_prefixes is None: |
| 313 disabled_prefixes = ['DISABLED_', 'FLAKY_', 'FAILS_', 'PRE_', 'MANUAL_'] | 312 disabled_prefixes = ['DISABLED_', 'FLAKY_', 'FAILS_', 'PRE_', 'MANUAL_'] |
| 314 disabled_filter_items += ['%s*' % dp for dp in disabled_prefixes] | 313 disabled_filter_items += ['%s*' % dp for dp in disabled_prefixes] |
| 315 disabled_filter_items += ['*.%s*' % dp for dp in disabled_prefixes] | 314 disabled_filter_items += ['*.%s*' % dp for dp in disabled_prefixes] |
| 316 | 315 |
| 317 disabled_tests_file_path = os.path.join( | 316 disabled_tests_file_path = os.path.join( |
| 318 constants.DIR_SOURCE_ROOT, 'build', 'android', 'pylib', 'gtest', | 317 host_paths.DIR_SOURCE_ROOT, 'build', 'android', 'pylib', 'gtest', |
| 319 'filter', '%s_disabled' % self._suite) | 318 'filter', '%s_disabled' % self._suite) |
| 320 if disabled_tests_file_path and os.path.exists(disabled_tests_file_path): | 319 if disabled_tests_file_path and os.path.exists(disabled_tests_file_path): |
| 321 with open(disabled_tests_file_path) as disabled_tests_file: | 320 with open(disabled_tests_file_path) as disabled_tests_file: |
| 322 disabled_filter_items += [ | 321 disabled_filter_items += [ |
| 323 '%s' % l for l in (line.strip() for line in disabled_tests_file) | 322 '%s' % l for l in (line.strip() for line in disabled_tests_file) |
| 324 if l and not l.startswith('#')] | 323 if l and not l.startswith('#')] |
| 325 | 324 |
| 326 return '*-%s' % ':'.join(disabled_filter_items) | 325 return '*-%s' % ':'.join(disabled_filter_items) |
| 327 | 326 |
| 328 # pylint: disable=no-self-use | 327 # pylint: disable=no-self-use |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 result_type = None | 360 result_type = None |
| 362 | 361 |
| 363 return results | 362 return results |
| 364 | 363 |
| 365 #override | 364 #override |
| 366 def TearDown(self): | 365 def TearDown(self): |
| 367 """Clear the mappings created by SetUp.""" | 366 """Clear the mappings created by SetUp.""" |
| 368 if self._isolate_delegate: | 367 if self._isolate_delegate: |
| 369 self._isolate_delegate.Clear() | 368 self._isolate_delegate.Clear() |
| 370 | 369 |
| OLD | NEW |