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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/run_java_tests.py
diff --git a/build/android/pylib/run_java_tests.py b/build/android/pylib/run_java_tests.py
index 7b5ea6e9ec796f506604f789273b6357db298e10..07b45e0ea9dfa857bafeb563699dcabfd4c14806 100644
--- a/build/android/pylib/run_java_tests.py
+++ b/build/android/pylib/run_java_tests.py
@@ -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)]
« 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