Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Side by Side Diff: build/android/pylib/run_java_tests.py

Issue 11437018: Change test running logic to run tests without any size annotation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 """Runs the Java tests. See more information on run_instrumentation_tests.py.""" 5 """Runs the Java tests. See more information on run_instrumentation_tests.py."""
6 6
7 import fnmatch 7 import fnmatch
8 import logging 8 import logging
9 import os 9 import os
10 import re 10 import re
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 options: Command line options. 522 options: Command line options.
523 apks: list of APKs to use. 523 apks: list of APKs to use.
524 524
525 Returns: 525 Returns:
526 A TestResults object holding the results of the Java tests. 526 A TestResults object holding the results of the Java tests.
527 527
528 Raises: 528 Raises:
529 FatalTestException: when there's no attached the devices. 529 FatalTestException: when there's no attached the devices.
530 """ 530 """
531 test_apk = apks[0] 531 test_apk = apks[0]
532 test_size_annotations = frozenset(['Smoke', 'SmallTest', 'MediumTest',
533 'LargeTest', 'EnormousTest', 'FlakyTest',
534 'DisabledTest', 'Manual', 'PerfTest'])
535 # The default annotation for tests which do not have any sizes annotation.
536 default_size_annotation = 'FlakyTest'
Yaron 2012/12/05 21:52:50 I think I prefer unspecified to not be Flaky. In g
frankf 2012/12/05 22:12:25 Agree with Yaron. If someone adds a test and forge
shashi 2012/12/05 23:30:06 I have it as FlakyTest so that the bots do not bre
532 if options.annotation: 537 if options.annotation:
533 available_tests = test_apk.GetAnnotatedTests(options.annotation) 538 available_tests = test_apk.GetAnnotatedTests(options.annotation)
534 if len(options.annotation) == 1 and options.annotation[0] == 'SmallTest': 539 if (len(options.annotation) == 1 and
535 tests_without_annotation = [ 540 options.annotation[0] == default_size_annotation):
541 tests_without_size_annotation = [
536 m for m in 542 m for m in
537 test_apk.GetTestMethods() 543 test_apk.GetTestMethods()
538 if not test_apk.GetTestAnnotations(m) and 544 if frozenset(test_apk.GetTestAnnotations(m)).
Yaron 2012/12/05 21:52:50 this is now too complicated for a list comprehensi
shashi 2012/12/05 23:30:06 Done.
545 isdisjoint(test_size_annotations) and
539 not apk_info.ApkInfo.IsPythonDrivenTest(m)] 546 not apk_info.ApkInfo.IsPythonDrivenTest(m)]
540 if tests_without_annotation: 547 if tests_without_size_annotation:
541 tests_without_annotation.sort() 548 tests_without_size_annotation.sort()
542 logging.warning('The following tests do not contain any annotation. ' 549 logging.warning('The following tests do not contain any annotation. '
543 'Assuming "SmallTest":\n%s', 550 'Assuming "%s":\n%s',
544 '\n'.join(tests_without_annotation)) 551 default_size_annotation,
545 available_tests += tests_without_annotation 552 '\n'.join(tests_without_size_annotation))
553 available_tests += tests_without_size_annotation
546 else: 554 else:
547 available_tests = [m for m in test_apk.GetTestMethods() 555 available_tests = [m for m in test_apk.GetTestMethods()
548 if not apk_info.ApkInfo.IsPythonDrivenTest(m)] 556 if not apk_info.ApkInfo.IsPythonDrivenTest(m)]
549 coverage = os.environ.get('EMMA_INSTRUMENT') == 'true' 557 coverage = os.environ.get('EMMA_INSTRUMENT') == 'true'
550 558
551 tests = [] 559 tests = []
552 if options.test_filter: 560 if options.test_filter:
553 # |available_tests| are in adb instrument format: package.path.class#test. 561 # |available_tests| are in adb instrument format: package.path.class#test.
554 filter_without_hash = options.test_filter.replace('#', '.') 562 filter_without_hash = options.test_filter.replace('#', '.')
555 tests = [t for t in available_tests 563 tests = [t for t in available_tests
(...skipping 17 matching lines...) Expand all
573 581
574 logging.info('Will run: %s', str(tests)) 582 logging.info('Will run: %s', str(tests))
575 583
576 if len(attached_devices) > 1 and (coverage or options.wait_for_debugger): 584 if len(attached_devices) > 1 and (coverage or options.wait_for_debugger):
577 logging.warning('Coverage / debugger can not be sharded, ' 585 logging.warning('Coverage / debugger can not be sharded, '
578 'using first available device') 586 'using first available device')
579 attached_devices = attached_devices[:1] 587 attached_devices = attached_devices[:1]
580 sharder = TestSharder(attached_devices, options, tests, apks) 588 sharder = TestSharder(attached_devices, options, tests, apks)
581 test_results = sharder.RunShardedTests() 589 test_results = sharder.RunShardedTests()
582 return test_results 590 return test_results
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698