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

Unified Diff: build/android/pylib/instrumentation/dispatch.py

Issue 13989007: [Android] Split uiautomator test runner from instrumentation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months 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
Index: build/android/pylib/instrumentation/dispatch.py
diff --git a/build/android/pylib/instrumentation/dispatch.py b/build/android/pylib/instrumentation/dispatch.py
index 53c9d82c1ee9b1272d9e8e6a89382fec44e693b3..ff4e367ab8ca3cb0931bc326919ec90ad13f9bd1 100644
--- a/build/android/pylib/instrumentation/dispatch.py
+++ b/build/android/pylib/instrumentation/dispatch.py
@@ -10,7 +10,6 @@ import os
from pylib import android_commands
from pylib.base import base_test_result
from pylib.base import shard
-from pylib.uiautomator import test_package as uiautomator_package
import test_package
import test_runner
@@ -31,74 +30,29 @@ def Dispatch(options):
Raises:
Exception: when there are no attached devices.
"""
- is_uiautomator_test = False
- if hasattr(options, 'uiautomator_jar'):
- test_pkg = uiautomator_package.TestPackage(
- options.uiautomator_jar, options.uiautomator_info_jar)
- is_uiautomator_test = True
- else:
- test_pkg = test_package.TestPackage(options.test_apk_path,
- options.test_apk_jar_path)
- # The default annotation for tests which do not have any sizes annotation.
- default_size_annotation = 'SmallTest'
-
- def _GetTestsMissingAnnotation(test_pkg):
- test_size_annotations = frozenset(['Smoke', 'SmallTest', 'MediumTest',
- 'LargeTest', 'EnormousTest', 'FlakyTest',
- 'DisabledTest', 'Manual', 'PerfTest'])
- tests_missing_annotations = []
- for test_method in test_pkg.GetTestMethods():
- annotations = frozenset(test_pkg.GetTestAnnotations(test_method))
- if (annotations.isdisjoint(test_size_annotations) and
- not test_pkg.IsPythonDrivenTest(test_method)):
- tests_missing_annotations.append(test_method)
- return sorted(tests_missing_annotations)
-
- if options.annotation:
- available_tests = test_pkg.GetAnnotatedTests(options.annotation)
- if options.annotation.count(default_size_annotation) > 0:
- tests_missing_annotations = _GetTestsMissingAnnotation(test_pkg)
- if tests_missing_annotations:
- logging.warning('The following tests do not contain any 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_pkg.GetTestMethods()
- if not test_pkg.IsPythonDrivenTest(m)]
-
- tests = []
- if options.test_filter:
- # |available_tests| are in adb instrument format: package.path.class#test.
- filter_without_hash = options.test_filter.replace('#', '.')
- tests = [t for t in available_tests
- if filter_without_hash in t.replace('#', '.')]
- else:
- tests = available_tests
-
+ test_pkg = test_package.TestPackage(options.test_apk_path,
+ options.test_apk_jar_path)
+ tests = test_pkg._GetAllMatchingTests(
+ options.annotations, options.test_filter)
if not tests:
logging.warning('No instrumentation tests to run with current args.')
return base_test_result.TestRunResults()
- tests *= options.number_of_runs
-
attached_devices = android_commands.GetAttachedDevices()
-
if not attached_devices:
raise Exception('There are no devices online.')
+
if options.device:
+ assert options.device in attached_devices
attached_devices = [options.device]
- logging.info('Will run: %s', str(tests))
-
if len(attached_devices) > 1 and options.wait_for_debugger:
logging.warning('Debugger can not be sharded, using first available device')
attached_devices = attached_devices[:1]
def TestRunnerFactory(device, shard_index):
return test_runner.TestRunner(
- options, device, shard_index, test_pkg, [], is_uiautomator_test)
+ options, device, shard_index, test_pkg, [])
return shard.ShardAndRunTests(TestRunnerFactory, attached_devices, tests,
options.build_type)
« no previous file with comments | « build/android/pylib/host_driven/run_python_tests.py ('k') | build/android/pylib/instrumentation/test_jar.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698