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..4e5a479bd6c8d8c0937925e550720dda807ed4bf 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,7 @@ 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_file = args.logdog_file |
#override |
def SetUp(self): |
@@ -76,7 +78,7 @@ class LocalDeviceEnvironment(environment.Environment): |
d.LoadCacheData(f.read()) |
# Delete cached file so that any exceptions cause it to be cleared. |
os.unlink(cache_path) |
- if self._logcat_output_file: |
+ if self._logcat_output_file or self._logdog_file: |
self._logcat_output_dir = tempfile.mkdtemp() |
if self._logcat_output_dir: |
for d in self._devices: |
@@ -133,6 +135,15 @@ class LocalDeviceEnvironment(environment.Environment): |
self._logcat_output_file, |
[m.output_file for m in self._logcat_monitors]) |
shutil.rmtree(self._logcat_output_dir) |
+ if self._logdog_file: |
+ for m in self._logcat_monitors: |
+ add_device_args = ['sed', '-i', '-e', |
+ 's/^/device({0}) /'.format(m.get_device_serial), |
+ m.output_file] |
+ cmd_helper.RunCmd(add_device_args) |
+ file_utils.MergeFiles( |
+ self._logdog_file, |
+ [m.output_file for m in self._logcat_monitors]) |
def BlacklistDevice(self, device, reason='local_device_failure'): |
device_serial = device.adb.GetDeviceSerial() |