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 HTMLParser | 5 import HTMLParser |
6 import logging | 6 import logging |
7 import os | 7 import os |
8 import re | 8 import re |
9 import tempfile | 9 import tempfile |
10 import threading | 10 import threading |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
281 | 281 |
282 self._data_deps = [] | 282 self._data_deps = [] |
283 if args.test_filter: | 283 if args.test_filter: |
284 self._gtest_filter = args.test_filter | 284 self._gtest_filter = args.test_filter |
285 elif args.test_filter_file: | 285 elif args.test_filter_file: |
286 with open(args.test_filter_file, 'r') as f: | 286 with open(args.test_filter_file, 'r') as f: |
287 self._gtest_filter = ConvertTestFilterFileIntoGTestFilterArgument(f) | 287 self._gtest_filter = ConvertTestFilterFileIntoGTestFilterArgument(f) |
288 else: | 288 else: |
289 self._gtest_filter = None | 289 self._gtest_filter = None |
290 | 290 |
291 self._run_disabled = args.run_disabled | |
292 | |
291 self._data_deps_delegate = data_deps_delegate | 293 self._data_deps_delegate = data_deps_delegate |
292 self._runtime_deps_path = args.runtime_deps_path | 294 self._runtime_deps_path = args.runtime_deps_path |
293 if not self._runtime_deps_path: | 295 if not self._runtime_deps_path: |
294 logging.warning('No data dependencies will be pushed.') | 296 logging.warning('No data dependencies will be pushed.') |
295 | 297 |
296 if args.app_data_files: | 298 if args.app_data_files: |
297 self._app_data_files = args.app_data_files | 299 self._app_data_files = args.app_data_files |
298 if args.app_data_file_dir: | 300 if args.app_data_file_dir: |
299 self._app_data_file_dir = args.app_data_file_dir | 301 self._app_data_file_dir = args.app_data_file_dir |
300 else: | 302 else: |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
335 | 337 |
336 @property | 338 @property |
337 def exe_dist_dir(self): | 339 def exe_dist_dir(self): |
338 return self._exe_dist_dir | 340 return self._exe_dist_dir |
339 | 341 |
340 @property | 342 @property |
341 def extras(self): | 343 def extras(self): |
342 return self._extras | 344 return self._extras |
343 | 345 |
344 @property | 346 @property |
347 def gtest_also_run_disabled_tests(self): | |
348 return self._run_disabled | |
349 | |
350 @property | |
345 def gtest_filter(self): | 351 def gtest_filter(self): |
346 return self._gtest_filter | 352 return self._gtest_filter |
347 | 353 |
348 @property | 354 @property |
349 def package(self): | 355 def package(self): |
350 return self._apk_helper and self._apk_helper.GetPackageName() | 356 return self._apk_helper and self._apk_helper.GetPackageName() |
351 | 357 |
352 @property | 358 @property |
353 def permissions(self): | 359 def permissions(self): |
354 return self._apk_helper and self._apk_helper.GetPermissions() | 360 return self._apk_helper and self._apk_helper.GetPermissions() |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
403 def FilterTests(self, test_list, disabled_prefixes=None): | 409 def FilterTests(self, test_list, disabled_prefixes=None): |
404 """Filters |test_list| based on prefixes and, if present, a filter string. | 410 """Filters |test_list| based on prefixes and, if present, a filter string. |
405 | 411 |
406 Args: | 412 Args: |
407 test_list: The list of tests to filter. | 413 test_list: The list of tests to filter. |
408 disabled_prefixes: A list of test prefixes to filter. Defaults to | 414 disabled_prefixes: A list of test prefixes to filter. Defaults to |
409 DISABLED_, FLAKY_, FAILS_, PRE_, and MANUAL_ | 415 DISABLED_, FLAKY_, FAILS_, PRE_, and MANUAL_ |
410 Returns: | 416 Returns: |
411 A filtered list of tests to run. | 417 A filtered list of tests to run. |
412 """ | 418 """ |
413 gtest_filter_strings = [ | 419 gtest_filter_strings = [self._GenerateDisabledFilterString( |
414 self._GenerateDisabledFilterString(disabled_prefixes)] | 420 disabled_prefixes, self.gtest_also_run_disabled_tests)] |
415 if self._gtest_filter: | 421 if self._gtest_filter: |
416 gtest_filter_strings.append(self._gtest_filter) | 422 gtest_filter_strings.append(self._gtest_filter) |
417 | 423 |
418 filtered_test_list = test_list | 424 filtered_test_list = test_list |
419 # This lock is required because on older versions of Python | 425 # This lock is required because on older versions of Python |
420 # |unittest_util.FilterTestNames| use of |fnmatch| is not threadsafe. | 426 # |unittest_util.FilterTestNames| use of |fnmatch| is not threadsafe. |
421 with self._filter_tests_lock: | 427 with self._filter_tests_lock: |
422 for gtest_filter_string in gtest_filter_strings: | 428 for gtest_filter_string in gtest_filter_strings: |
423 logging.debug('Filtering tests using: %s', gtest_filter_string) | 429 logging.debug('Filtering tests using: %s', gtest_filter_string) |
424 filtered_test_list = unittest_util.FilterTestNames( | 430 filtered_test_list = unittest_util.FilterTestNames( |
425 filtered_test_list, gtest_filter_string) | 431 filtered_test_list, gtest_filter_string) |
426 return filtered_test_list | 432 return filtered_test_list |
427 | 433 |
428 def _GenerateDisabledFilterString(self, disabled_prefixes): | 434 def _GenerateDisabledFilterString(self, disabled_prefixes, |
435 run_disabled=False): | |
jbudorick
2016/11/30 23:17:11
Sorry, I should've made my comment about passing i
shenghuazhang
2016/11/30 23:52:44
Oh no we don't need to pass this... Will use the a
| |
429 disabled_filter_items = [] | 436 disabled_filter_items = [] |
430 | 437 |
431 if disabled_prefixes is None: | 438 if disabled_prefixes is None: |
432 disabled_prefixes = ['DISABLED_', 'FLAKY_', 'FAILS_', 'PRE_', 'MANUAL_'] | 439 disabled_prefixes = ['DISABLED_', 'FLAKY_', 'FAILS_', 'PRE_', 'MANUAL_'] |
440 if run_disabled: | |
shenghuazhang
2016/11/30 21:58:01
When 'disabled_prefixes' is an non-empty input, co
jbudorick
2016/11/30 23:17:11
This is a bit more complex than just appending the
shenghuazhang
2016/11/30 23:52:44
But it didn't consider to remove the inputted disa
jbudorick
2016/11/30 23:54:14
That's a fair point, and I hadn't considered it. T
shenghuazhang
2016/12/01 00:39:56
OK that make sense. Will refactor it with appendin
| |
441 if 'DISABLED_' in disabled_prefixes: | |
442 disabled_prefixes.remove('DISABLED_') | |
443 if 'FLAKY_' in disabled_prefixes: | |
444 disabled_prefixes.remove('FLAKY_') | |
445 | |
433 disabled_filter_items += ['%s*' % dp for dp in disabled_prefixes] | 446 disabled_filter_items += ['%s*' % dp for dp in disabled_prefixes] |
434 disabled_filter_items += ['*.%s*' % dp for dp in disabled_prefixes] | 447 disabled_filter_items += ['*.%s*' % dp for dp in disabled_prefixes] |
435 | 448 |
436 disabled_tests_file_path = os.path.join( | 449 disabled_tests_file_path = os.path.join( |
437 host_paths.DIR_SOURCE_ROOT, 'build', 'android', 'pylib', 'gtest', | 450 host_paths.DIR_SOURCE_ROOT, 'build', 'android', 'pylib', 'gtest', |
438 'filter', '%s_disabled' % self._suite) | 451 'filter', '%s_disabled' % self._suite) |
439 if disabled_tests_file_path and os.path.exists(disabled_tests_file_path): | 452 if disabled_tests_file_path and os.path.exists(disabled_tests_file_path): |
440 with open(disabled_tests_file_path) as disabled_tests_file: | 453 with open(disabled_tests_file_path) as disabled_tests_file: |
441 disabled_filter_items += [ | 454 disabled_filter_items += [ |
442 '%s' % l for l in (line.strip() for line in disabled_tests_file) | 455 '%s' % l for l in (line.strip() for line in disabled_tests_file) |
443 if l and not l.startswith('#')] | 456 if l and not l.startswith('#')] |
444 | 457 |
445 return '*-%s' % ':'.join(disabled_filter_items) | 458 return '*-%s' % ':'.join(disabled_filter_items) |
446 | 459 |
447 #override | 460 #override |
448 def TearDown(self): | 461 def TearDown(self): |
449 """Do nothing.""" | 462 """Do nothing.""" |
450 pass | 463 pass |
451 | 464 |
OLD | NEW |