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..f0e46ecdba3e3f0275076d92c7ed06f40058b65e 100644 |
--- a/build/android/pylib/run_java_tests.py |
+++ b/build/android/pylib/run_java_tests.py |
@@ -529,20 +529,33 @@ 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 testsMissingAnnotation(test_apk): |
frankf
2012/12/05 23:54:17
Unfortunately, we don't follow the google3 style g
shashi
2012/12/06 00:27:26
Done.
|
+ 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 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 (len(options.annotation) == 1 and |
+ options.annotation[0] == default_size_annotation): |
frankf
2012/12/05 23:54:17
Why do we include un-annotated tests in SmallTest
shashi
2012/12/06 00:27:26
Currently build bots always specify size when runn
frankf
2012/12/06 01:01:55
What I meant:
1. Unannotated tests are run:
./run
shashi
2012/12/06 01:18:40
Makes sense, we need not check if SmallTest is the
|
+ tests_missing_annotations = testsMissingAnnotation(test_apk) |
+ if tests_missing_annotations: |
+ tests_missing_annotations.sort() |
frankf
2012/12/05 23:54:17
just have the method sort it for you.
shashi
2012/12/06 00:27:26
Done.
|
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)] |