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 if args.run_disabled: | |
jbudorick
2016/11/30 21:05:56
This can just be
self._run_disabled = args.run_
shenghuazhang
2016/11/30 21:58:01
Done.
| |
292 self._run_disabled = args.run_disabled | |
293 else: | |
294 self._run_disabled = False | |
295 | |
291 self._data_deps_delegate = data_deps_delegate | 296 self._data_deps_delegate = data_deps_delegate |
292 self._runtime_deps_path = args.runtime_deps_path | 297 self._runtime_deps_path = args.runtime_deps_path |
293 if not self._runtime_deps_path: | 298 if not self._runtime_deps_path: |
294 logging.warning('No data dependencies will be pushed.') | 299 logging.warning('No data dependencies will be pushed.') |
295 | 300 |
296 if args.app_data_files: | 301 if args.app_data_files: |
297 self._app_data_files = args.app_data_files | 302 self._app_data_files = args.app_data_files |
298 if args.app_data_file_dir: | 303 if args.app_data_file_dir: |
299 self._app_data_file_dir = args.app_data_file_dir | 304 self._app_data_file_dir = args.app_data_file_dir |
300 else: | 305 else: |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
335 | 340 |
336 @property | 341 @property |
337 def exe_dist_dir(self): | 342 def exe_dist_dir(self): |
338 return self._exe_dist_dir | 343 return self._exe_dist_dir |
339 | 344 |
340 @property | 345 @property |
341 def extras(self): | 346 def extras(self): |
342 return self._extras | 347 return self._extras |
343 | 348 |
344 @property | 349 @property |
350 def gtest_also_run_disabled_tests(self): | |
351 return self._run_disabled | |
352 | |
353 @property | |
345 def gtest_filter(self): | 354 def gtest_filter(self): |
346 return self._gtest_filter | 355 return self._gtest_filter |
347 | 356 |
348 @property | 357 @property |
349 def package(self): | 358 def package(self): |
350 return self._apk_helper and self._apk_helper.GetPackageName() | 359 return self._apk_helper and self._apk_helper.GetPackageName() |
351 | 360 |
352 @property | 361 @property |
353 def permissions(self): | 362 def permissions(self): |
354 return self._apk_helper and self._apk_helper.GetPermissions() | 363 return self._apk_helper and self._apk_helper.GetPermissions() |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
393 | 402 |
394 def GetDataDependencies(self): | 403 def GetDataDependencies(self): |
395 """Returns the test suite's data dependencies. | 404 """Returns the test suite's data dependencies. |
396 | 405 |
397 Returns: | 406 Returns: |
398 A list of (host_path, device_path) tuples to push. If device_path is | 407 A list of (host_path, device_path) tuples to push. If device_path is |
399 None, the client is responsible for determining where to push the file. | 408 None, the client is responsible for determining where to push the file. |
400 """ | 409 """ |
401 return self._data_deps | 410 return self._data_deps |
402 | 411 |
403 def FilterTests(self, test_list, disabled_prefixes=None): | 412 def FilterTests(self, test_list, disabled_prefixes=None, run_disabled=False): |
jbudorick
2016/11/30 21:05:56
Does this need to be exposed? Can this function ju
shenghuazhang
2016/11/30 21:58:01
Done.
| |
404 """Filters |test_list| based on prefixes and, if present, a filter string. | 413 """Filters |test_list| based on prefixes and, if present, a filter string. |
405 | 414 |
406 Args: | 415 Args: |
407 test_list: The list of tests to filter. | 416 test_list: The list of tests to filter. |
408 disabled_prefixes: A list of test prefixes to filter. Defaults to | 417 disabled_prefixes: A list of test prefixes to filter. Defaults to |
409 DISABLED_, FLAKY_, FAILS_, PRE_, and MANUAL_ | 418 DISABLED_, FLAKY_, FAILS_, PRE_, and MANUAL_ |
410 Returns: | 419 Returns: |
411 A filtered list of tests to run. | 420 A filtered list of tests to run. |
412 """ | 421 """ |
413 gtest_filter_strings = [ | 422 gtest_filter_strings = [ |
414 self._GenerateDisabledFilterString(disabled_prefixes)] | 423 self._GenerateDisabledFilterString(disabled_prefixes, run_disabled)] |
415 if self._gtest_filter: | 424 if self._gtest_filter: |
416 gtest_filter_strings.append(self._gtest_filter) | 425 gtest_filter_strings.append(self._gtest_filter) |
417 | 426 |
418 filtered_test_list = test_list | 427 filtered_test_list = test_list |
419 # This lock is required because on older versions of Python | 428 # This lock is required because on older versions of Python |
420 # |unittest_util.FilterTestNames| use of |fnmatch| is not threadsafe. | 429 # |unittest_util.FilterTestNames| use of |fnmatch| is not threadsafe. |
421 with self._filter_tests_lock: | 430 with self._filter_tests_lock: |
422 for gtest_filter_string in gtest_filter_strings: | 431 for gtest_filter_string in gtest_filter_strings: |
423 logging.debug('Filtering tests using: %s', gtest_filter_string) | 432 logging.debug('Filtering tests using: %s', gtest_filter_string) |
424 filtered_test_list = unittest_util.FilterTestNames( | 433 filtered_test_list = unittest_util.FilterTestNames( |
425 filtered_test_list, gtest_filter_string) | 434 filtered_test_list, gtest_filter_string) |
426 return filtered_test_list | 435 return filtered_test_list |
427 | 436 |
428 def _GenerateDisabledFilterString(self, disabled_prefixes): | 437 def _GenerateDisabledFilterString(self, disabled_prefixes, |
438 run_disabled=False): | |
429 disabled_filter_items = [] | 439 disabled_filter_items = [] |
430 | 440 |
431 if disabled_prefixes is None: | 441 if disabled_prefixes is None: |
432 disabled_prefixes = ['DISABLED_', 'FLAKY_', 'FAILS_', 'PRE_', 'MANUAL_'] | 442 if run_disabled: |
jbudorick
2016/11/30 21:05:56
nit:
disabled_prefixes = ['FAILS_', 'PRE_', 'MA
shenghuazhang
2016/11/30 21:58:01
Done.
| |
443 disabled_prefixes = ['FAILS_', 'PRE_', 'MANUAL_'] | |
444 else: | |
445 disabled_prefixes = ['DISABLED_', 'FLAKY_', 'FAILS_', 'PRE_', 'MANUAL_'] | |
446 | |
433 disabled_filter_items += ['%s*' % dp for dp in disabled_prefixes] | 447 disabled_filter_items += ['%s*' % dp for dp in disabled_prefixes] |
434 disabled_filter_items += ['*.%s*' % dp for dp in disabled_prefixes] | 448 disabled_filter_items += ['*.%s*' % dp for dp in disabled_prefixes] |
435 | 449 |
436 disabled_tests_file_path = os.path.join( | 450 disabled_tests_file_path = os.path.join( |
437 host_paths.DIR_SOURCE_ROOT, 'build', 'android', 'pylib', 'gtest', | 451 host_paths.DIR_SOURCE_ROOT, 'build', 'android', 'pylib', 'gtest', |
438 'filter', '%s_disabled' % self._suite) | 452 'filter', '%s_disabled' % self._suite) |
439 if disabled_tests_file_path and os.path.exists(disabled_tests_file_path): | 453 if disabled_tests_file_path and os.path.exists(disabled_tests_file_path): |
440 with open(disabled_tests_file_path) as disabled_tests_file: | 454 with open(disabled_tests_file_path) as disabled_tests_file: |
441 disabled_filter_items += [ | 455 disabled_filter_items += [ |
442 '%s' % l for l in (line.strip() for line in disabled_tests_file) | 456 '%s' % l for l in (line.strip() for line in disabled_tests_file) |
443 if l and not l.startswith('#')] | 457 if l and not l.startswith('#')] |
444 | 458 |
445 return '*-%s' % ':'.join(disabled_filter_items) | 459 return '*-%s' % ':'.join(disabled_filter_items) |
446 | 460 |
447 #override | 461 #override |
448 def TearDown(self): | 462 def TearDown(self): |
449 """Do nothing.""" | 463 """Do nothing.""" |
450 pass | 464 pass |
451 | 465 |
OLD | NEW |