Change test running logic to run tests without any size annotation.

Currently some tests without any test size annotation but with any other
annotation (like PhoneOnly) are not run. These tests are not disabled and
should be run, all disabled tests should now have a DisabledTest annotation.


Review URL: https://chromiumcodereview.appspot.com/11437018

git-svn-id: http://src.chromium.org/svn/trunk/src/build@171434 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
shashishekhar@chromium.org 2012-12-06 06:47:29 +00:00
Родитель 12431c9e64
Коммит 51bf7244a8
1 изменённых файлов: 22 добавлений и 11 удалений

Просмотреть файл

@ -529,20 +529,31 @@ def DispatchJavaTests(options, apks):
FatalTestException: when there's no attached the devices.
"""
test_apk = apks[0]
# The default annotation for tests which do not have any sizes annotation.
default_size_annotation = 'SmallTest'
def _GetTestsMissingAnnotation(test_apk):
test_size_annotations = frozenset(['Smoke', 'SmallTest', 'MediumTest',
'LargeTest', 'EnormousTest', 'FlakyTest',
'DisabledTest', 'Manual', 'PerfTest'])
tests_missing_annotations = []
for test_method in test_apk.GetTestMethods():
annotations = frozenset(test_apk.GetTestAnnotations(test_method))
if (annotations.isdisjoint(test_size_annotations) and
not apk_info.ApkInfo.IsPythonDrivenTest(test_method)):
tests_missing_annotations.append(test_method)
return sorted(tests_missing_annotations)
if options.annotation:
available_tests = test_apk.GetAnnotatedTests(options.annotation)
if len(options.annotation) == 1 and options.annotation[0] == 'SmallTest':
tests_without_annotation = [
m for m in
test_apk.GetTestMethods()
if not test_apk.GetTestAnnotations(m) and
not apk_info.ApkInfo.IsPythonDrivenTest(m)]
if tests_without_annotation:
tests_without_annotation.sort()
if options.annotation.count(default_size_annotation) > 0:
tests_missing_annotations = _GetTestsMissingAnnotation(test_apk)
if tests_missing_annotations:
logging.warning('The following tests do not contain any annotation. '
'Assuming "SmallTest":\n%s',
'\n'.join(tests_without_annotation))
available_tests += tests_without_annotation
'Assuming "%s":\n%s',
default_size_annotation,
'\n'.join(tests_missing_annotations))
available_tests += tests_missing_annotations
else:
available_tests = [m for m in test_apk.GetTestMethods()
if not apk_info.ApkInfo.IsPythonDrivenTest(m)]