Index: build/android/pylib/instrumentation/dispatch.py |
diff --git a/build/android/pylib/instrumentation/dispatch.py b/build/android/pylib/instrumentation/dispatch.py |
index dd3723517623b2b1c878cd5ded78d3e0578111a8..2bac9274db688347647a33a159c6c4aea2460a5d 100644 |
--- a/build/android/pylib/instrumentation/dispatch.py |
+++ b/build/android/pylib/instrumentation/dispatch.py |
@@ -10,12 +10,13 @@ import os |
from pylib import android_commands |
from pylib.base import base_test_result |
from pylib.base import shard |
+from pylib.utils import report_results |
import test_package |
import test_runner |
-def Dispatch(options): |
+def DispatchCore(options): |
"""Dispatches instrumentation tests onto connected device(s). |
If possible, this method will attempt to shard the tests to |
@@ -42,9 +43,9 @@ def Dispatch(options): |
if not attached_devices: |
raise Exception('There are no devices online.') |
- if options.device: |
- assert options.device in attached_devices |
- attached_devices = [options.device] |
+ if options.test_device: |
+ assert options.test_device in attached_devices |
+ attached_devices = [options.test_device] |
if len(attached_devices) > 1 and options.wait_for_debugger: |
logging.warning('Debugger can not be sharded, using first available device') |
@@ -57,3 +58,15 @@ def Dispatch(options): |
return shard.ShardAndRunTests(TestRunnerFactory, attached_devices, tests, |
options.build_type, |
num_retries=options.num_retries) |
+ |
+def Dispatch(options): |
+ """Wraps DispatchCore to return number of failures, and log appropriately.""" |
+ results = DispatchCore(options) |
+ report_results.LogFull( |
+ results=results, |
+ test_type='Instrumentation', |
+ test_package=os.path.basename(options.test_apk), |
+ annotation=options.annotations, |
+ build_type=options.build_type, |
+ flakiness_server=options.flakiness_dashboard_server) |
+ return len(results.GetNotPass()) |