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

Unified Diff: build/android/pylib/base/test_dispatcher.py

Issue 221823011: [Android] Change object types from AndroidCommands to DeviceUtils in build/android/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « build/android/pylib/base/base_test_runner.py ('k') | build/android/pylib/chrome_test_server_spawner.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/base/test_dispatcher.py
diff --git a/build/android/pylib/base/test_dispatcher.py b/build/android/pylib/base/test_dispatcher.py
index 5f68a7ff46a648ea0685eb9ce53e5801dfa72fed..b3642e23077542052c8d6ebb038d127f1e9fd932 100644
--- a/build/android/pylib/base/test_dispatcher.py
+++ b/build/android/pylib/base/test_dispatcher.py
@@ -21,6 +21,7 @@ import threading
from pylib import android_commands
from pylib import constants
from pylib.base import base_test_result
+from pylib.device import adb_wrapper
from pylib.utils import reraiser_thread
from pylib.utils import watchdog_timer
@@ -160,18 +161,19 @@ def _RunTestsFromQueue(runner, test_collection, out_results, watcher,
"""
new_test_run_results = base_test_result.TestRunResults()
for test_result in test_run_results.GetAll():
- test_result.SetName('%s_%s' % (runner.device[-4:], test_result.GetName()))
+ test_result.SetName('%s_%s' % (runner.device_serial[-4:],
+ test_result.GetName()))
new_test_run_results.AddResult(test_result)
return new_test_run_results
for test in test_collection:
watcher.Reset()
try:
- if not android_commands.IsDeviceAttached(runner.device):
+ if runner.device_serial not in android_commands.GetAttachedDevices():
# Device is unresponsive, stop handling tests on this device.
- msg = 'Device %s is unresponsive.' % runner.device
+ msg = 'Device %s is unresponsive.' % runner.device_serial
logging.warning(msg)
- raise android_commands.errors.DeviceUnresponsiveError(msg)
+ raise adb_wrapper.DeviceUnreachableError(msg)
result, retry = runner.RunTest(test.test)
if tag_results_with_device:
result = TagTestRunResults(result)
@@ -215,7 +217,7 @@ def _SetUp(runner_factory, device, out_runners, threadsafe_counter):
runner = runner_factory(device, index)
runner.SetUp()
out_runners.append(runner)
- except android_commands.errors.DeviceUnresponsiveError as e:
+ except adb_wrapper.DeviceUnreachableError as e:
logging.warning('Failed to create shard for %s: [%s]', device, e)
@@ -248,16 +250,16 @@ def _RunAllTests(runners, test_collection_factory, num_retries, timeout=None,
reraiser_thread.ReraiserThread(
_RunTestsFromQueue,
[r, tc, results, watcher, num_retries, tag_results_with_device],
- name=r.device[-4:])
+ name=r.device_serial[-4:])
for r, tc in zip(runners, test_collections)]
workers = reraiser_thread.ReraiserThreadGroup(threads)
workers.StartAll()
- # Catch DeviceUnresponsiveErrors and set a warning exit code
+ # Catch DeviceUnreachableErrors and set a warning exit code
try:
workers.JoinAll(watcher)
- except android_commands.errors.DeviceUnresponsiveError as e:
+ except adb_wrapper.DeviceUnreachableError as e:
logging.error(e)
exit_code = constants.WARNING_EXIT_CODE
@@ -308,7 +310,7 @@ def _TearDownRunners(runners, timeout=None):
timeout: Watchdog timeout in seconds, defaults to the default timeout.
"""
threads = reraiser_thread.ReraiserThreadGroup(
- [reraiser_thread.ReraiserThread(r.TearDown, name=r.device[-4:])
+ [reraiser_thread.ReraiserThread(r.TearDown, name=r.device_serial[-4:])
for r in runners])
threads.StartAll()
threads.JoinAll(watchdog_timer.WatchdogTimer(timeout))
@@ -363,5 +365,5 @@ def RunTests(tests, runner_factory, devices, shard=True,
finally:
try:
_TearDownRunners(runners, setup_timeout)
- except android_commands.errors.DeviceUnresponsiveError as e:
+ except adb_wrapper.DeviceUnreachableError as e:
logging.warning('Device unresponsive during TearDown: [%s]', e)
« no previous file with comments | « build/android/pylib/base/base_test_runner.py ('k') | build/android/pylib/chrome_test_server_spawner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698