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

Unified Diff: build/android/tombstones.py

Issue 1013463003: Update from https://crrev.com/320931 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 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/device/device_utils_test.py ('k') | build/common.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/tombstones.py
diff --git a/build/android/tombstones.py b/build/android/tombstones.py
index 7449a73b9aab7baf216dc22dfb98a0aa4fa21a74..9b8a8b2b1c4d942a67bfc93d7fd2725f418db8b0 100755
--- a/build/android/tombstones.py
+++ b/build/android/tombstones.py
@@ -18,9 +18,12 @@ import sys
import optparse
from pylib import android_commands
+from pylib.device import device_errors
from pylib.device import device_utils
+_TZ_UTC = {'TZ': 'UTC'}
+
def _ListTombstones(device):
"""List the tombstone files on the device.
@@ -30,7 +33,9 @@ def _ListTombstones(device):
Yields:
Tuples of (tombstone filename, date time of file on device).
"""
- lines = device.RunShellCommand('TZ=UTC su -c ls -a -l /data/tombstones')
+ lines = device.RunShellCommand(
+ ['ls', '-a', '-l', '/data/tombstones'],
+ as_root=True, check_return=True, env=_TZ_UTC, timeout=60)
for line in lines:
if 'tombstone' in line and not 'No such file or directory' in line:
details = line.split()
@@ -48,7 +53,8 @@ def _GetDeviceDateTime(device):
Returns:
A datetime instance.
"""
- device_now_string = device.RunShellCommand('TZ=UTC date')
+ device_now_string = device.RunShellCommand(
+ ['date'], check_return=True, env=_TZ_UTC)
return datetime.datetime.strptime(
device_now_string[0], '%a %b %d %H:%M:%S %Z %Y')
@@ -75,7 +81,8 @@ def _EraseTombstone(device, tombstone_file):
tombstone_file: the tombstone to delete.
"""
return device.RunShellCommand(
- 'rm /data/tombstones/' + tombstone_file, as_root=True)
+ ['rm', '/data/tombstones/' + tombstone_file],
+ as_root=True, check_return=True)
def _DeviceAbiToArch(device_abi):
@@ -172,14 +179,21 @@ def _GetTombstonesForDevice(device, options):
tombstones = all_tombstones if options.all_tombstones else [all_tombstones[0]]
device_now = _GetDeviceDateTime(device)
- for tombstone_file, tombstone_time in tombstones:
- ret += [{'serial': str(device),
- 'device_abi': device.product_cpu_abi,
- 'device_now': device_now,
- 'time': tombstone_time,
- 'file': tombstone_file,
- 'stack': options.stack,
- 'data': _GetTombstoneData(device, tombstone_file)}]
+ try:
+ for tombstone_file, tombstone_time in tombstones:
+ ret += [{'serial': str(device),
+ 'device_abi': device.product_cpu_abi,
+ 'device_now': device_now,
+ 'time': tombstone_time,
+ 'file': tombstone_file,
+ 'stack': options.stack,
+ 'data': _GetTombstoneData(device, tombstone_file)}]
+ except device_errors.CommandFailedError:
+ for line in device.RunShellCommand(
+ ['ls', '-a', '-l', '/data/tombstones'],
+ as_root=True, check_return=True, env=_TZ_UTC, timeout=60):
+ print '%s: %s' % (str(device), line)
+ raise
# Erase all the tombstones if desired.
if options.wipe_tombstones:
« no previous file with comments | « build/android/pylib/device/device_utils_test.py ('k') | build/common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698