Android: capture logcat for all devices on bb_run_sharded_steps.py

This will help track issues when running sharded steps, specially the perf ones.

BUG=165692
TEST=

Review URL: https://chromiumcodereview.appspot.com/11860012

git-svn-id: http://src.chromium.org/svn/trunk/src/build@176754 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
bulach@chromium.org 2013-01-14 23:23:35 +00:00
Родитель 2c869a1876
Коммит f723f72bab
1 изменённых файлов: 28 добавлений и 3 удалений

Просмотреть файл

@ -45,6 +45,7 @@ import pickle
import os
import signal
import shutil
import subprocess
import sys
from pylib import android_commands
@ -84,6 +85,27 @@ def _RunStepsPerDevice(steps):
return results
class _LogCatMonitor(object):
def __init__(self):
self._monitor = None
self._logcat_dir = os.path.join(constants.CHROME_DIR, 'out',
'sharded_steps_logcat_monitor')
def __enter__(self):
cmd = [os.path.join(constants.CHROME_DIR, 'build', 'android',
'adb_logcat_monitor.py'), self._logcat_dir]
self._monitor = subprocess.Popen(cmd, cwd=constants.CHROME_DIR)
def __exit__(self, *args):
if self._monitor:
# adb_logcat_printer will kill the monitor.
self._monitor = None
cmd = [os.path.join(constants.CHROME_DIR, 'build', 'android',
'adb_logcat_printer.py'), self._logcat_dir]
cmd = subprocess.Popen(cmd, cwd=constants.CHROME_DIR)
cmd.wait()
def _RunShardedSteps(steps, devices):
assert steps
assert devices, 'No devices connected?'
@ -107,9 +129,12 @@ def _RunShardedSteps(steps, devices):
print 'Start sharding (note: output is not synchronized...)'
print '*' * 80
start_time = datetime.datetime.now()
pool = multiprocessing.Pool(processes=num_devices)
async_results = pool.map_async(_RunStepsPerDevice, all_params)
results_per_device = async_results.get(999999)
with _LogCatMonitor() as logcat_monitor:
pool = multiprocessing.Pool(processes=num_devices)
async_results = pool.map_async(_RunStepsPerDevice, all_params)
results_per_device = async_results.get(999999)
end_time = datetime.datetime.now()
print '*' * 80
print 'Finished sharding.'