Chromium Code Reviews| Index: build/android/pylib/local/device/local_device_environment.py |
| diff --git a/build/android/pylib/local/device/local_device_environment.py b/build/android/pylib/local/device/local_device_environment.py |
| index 178e2f18a3e0337fd35eebfda4f8af02ed009c28..53e9566fed3dd6fd8cb051fc6f96785b3e327564 100644 |
| --- a/build/android/pylib/local/device/local_device_environment.py |
| +++ b/build/android/pylib/local/device/local_device_environment.py |
| @@ -14,6 +14,7 @@ from devil.android import device_errors |
| from devil.android import device_list |
| from devil.android import device_utils |
| from devil.android import logcat_monitor |
| +from devil.utils import cmd_helper |
| from devil.utils import file_utils |
| from devil.utils import parallelizer |
| from pylib import constants |
| @@ -44,6 +45,8 @@ class LocalDeviceEnvironment(environment.Environment): |
| self._skip_clear_data = args.skip_clear_data |
| self._target_devices_file = args.target_devices_file |
| self._tool_name = args.tool |
| + self._logdog_command = args.logdog_command.split() |
| + self._logdog_stream = args.logdog_stream.split() |
| #override |
| def SetUp(self): |
| @@ -125,14 +128,31 @@ class LocalDeviceEnvironment(environment.Environment): |
| with open(cache_path, 'w') as f: |
| f.write(d.DumpCacheData()) |
| logging.info('Wrote device cache: %s', cache_path) |
| + logging.info('Adding device serials to logcats') |
| for m in self._logcat_monitors: |
| m.Stop() |
| m.Close() |
| + add_device_args = ['sed', '-i', '-e', |
| + 's/^/device({0}) /'. |
| + format(m._adb.GetDeviceSerial()), |
|
nicholaslin
2016/07/20 03:04:13
I'll change this to m.get_device_serial or somethi
|
| + m.output_file] |
| + cmd_helper.RunCmd(add_device_args) |
| if self._logcat_output_file: |
| file_utils.MergeFiles( |
| self._logcat_output_file, |
| [m.output_file for m in self._logcat_monitors]) |
| shutil.rmtree(self._logcat_output_dir) |
| + if self._logdog_command and self._logdog_stream: |
|
nicholaslin
2016/07/20 03:04:13
As of right now I don't have a good way to make lo
|
| + logging.info('NOTE: outputs below are specific to logdog.') |
| + task = str(os.environ['SWARMING_TASK_ID']) |
| + prefix = ['-prefix', 'swarming/{0}/logcats'.format(task)] |
| + cmd = self._logdog_command + prefix + self._logdog_stream |
| + cmd_helper.RunCmd(cmd) |
| + url_prefix = prefix[1].replace('/', '%2F') |
| + suffix = self._logdog_stream[-1] |
| + url_suffix = 'file:{0}'.format(suffix.replace('/', '_')) |
| + url = 'https://luci-logdog.appspot.com/v/?s=chromium%2F{0}%2F%2B%2F{1}'.format(url_prefix, url_suffix) |
| + logging.info('Logcats are at %s', url) |
| def BlacklistDevice(self, device, reason='local_device_failure'): |
| device_serial = device.adb.GetDeviceSerial() |