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

Unified Diff: build/android/test_runner.py

Issue 1281923003: [Android] Add --blacklist-file as a command-line option. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix telemetry_unittests Created 5 years, 4 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
« no previous file with comments | « build/android/screenshot.py ('k') | build/android/tombstones.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/test_runner.py
diff --git a/build/android/test_runner.py b/build/android/test_runner.py
index 7b49c9e69a1f2c181d268393487c3e0aeebdecb4..8bae397f261112ebac8721402035fd58a475d08f 100755
--- a/build/android/test_runner.py
+++ b/build/android/test_runner.py
@@ -24,6 +24,7 @@ from pylib.base import environment_factory
from pylib.base import test_dispatcher
from pylib.base import test_instance_factory
from pylib.base import test_run_factory
+from pylib.device import device_blacklist
from pylib.device import device_errors
from pylib.device import device_utils
from pylib.gtest import gtest_config
@@ -188,6 +189,7 @@ def AddDeviceOptions(parser):
group.add_argument('-d', '--device', dest='test_device',
help=('Target device for the test suite '
'to run on.'))
+ group.add_argument('--blacklist-file', help='Device blacklist file.')
def AddGTestOptions(parser):
@@ -767,7 +769,7 @@ def _RunUIAutomatorTests(args, devices):
"""Subcommand of RunTestsCommands which runs uiautomator tests."""
uiautomator_options = ProcessUIAutomatorOptions(args)
- runner_factory, tests = uiautomator_setup.Setup(uiautomator_options)
+ runner_factory, tests = uiautomator_setup.Setup(uiautomator_options, devices)
results, exit_code = test_dispatcher.RunTests(
tests, runner_factory, devices, shard=True, test_timeout=None,
@@ -823,7 +825,7 @@ def _RunMonkeyTests(args, devices):
return exit_code
-def _RunPerfTests(args):
+def _RunPerfTests(args, active_devices):
"""Subcommand of RunTestsCommands which runs perf tests."""
perf_options = ProcessPerfTestOptions(args)
@@ -837,7 +839,8 @@ def _RunPerfTests(args):
return perf_test_runner.PrintTestOutput(
perf_options.print_step, perf_options.output_chartjson_data)
- runner_factory, tests, devices = perf_setup.Setup(perf_options)
+ runner_factory, tests, devices = perf_setup.Setup(
+ perf_options, active_devices)
# shard=False means that each device will get the full list of tests
# and then each one will decide their own affinity.
@@ -882,7 +885,7 @@ def _RunPythonTests(args):
sys.path = sys.path[1:]
-def _GetAttachedDevices(test_device=None):
+def _GetAttachedDevices(blacklist_file, test_device):
"""Get all attached devices.
Args:
@@ -891,7 +894,14 @@ def _GetAttachedDevices(test_device=None):
Returns:
A list of attached devices.
"""
- attached_devices = device_utils.DeviceUtils.HealthyDevices()
+ if not blacklist_file:
+ # TODO(jbudorick): Remove this once bots pass the blacklist file.
+ blacklist_file = device_blacklist.BLACKLIST_JSON
+ logging.warning('Using default device blacklist %s',
+ device_blacklist.BLACKLIST_JSON)
+
+ blacklist = device_blacklist.Blacklist(blacklist_file)
+ attached_devices = device_utils.DeviceUtils.HealthyDevices(blacklist)
if test_device:
test_device = [d for d in attached_devices if d == test_device]
if not test_device:
@@ -930,7 +940,7 @@ def RunTestsCommand(args, parser):
if command in constants.LOCAL_MACHINE_TESTS:
devices = []
else:
- devices = _GetAttachedDevices(args.test_device)
+ devices = _GetAttachedDevices(args.blacklist_file, args.test_device)
forwarder.Forwarder.RemoveHostLog()
if not ports.ResetTestServerPortAllocation():
@@ -951,7 +961,7 @@ def RunTestsCommand(args, parser):
elif command == 'monkey':
return _RunMonkeyTests(args, devices)
elif command == 'perf':
- return _RunPerfTests(args)
+ return _RunPerfTests(args, devices)
elif command == 'python':
return _RunPythonTests(args)
else:
« no previous file with comments | « build/android/screenshot.py ('k') | build/android/tombstones.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698