mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bug 1482874 - Handle Android 8.1 change for anr stack directory to contain individual files for traces, r=gbrown.
This commit is contained in:
parent
ac89381d02
commit
be2ccf78f3
@ -106,31 +106,34 @@ class RemoteAutomation(Automation):
|
||||
return status
|
||||
|
||||
def deleteANRs(self):
|
||||
# empty ANR traces.txt file; usually need root permissions
|
||||
# we make it empty and writable so we can test the ANR reporter later
|
||||
traces = "/data/anr/traces.txt"
|
||||
# Remove files from the dalvik stack-trace directory.
|
||||
if not self._device.is_dir(self._device.stack_trace_dir, root=True):
|
||||
return
|
||||
try:
|
||||
self._device.shell_output('echo > %s' % traces, root=True)
|
||||
self._device.shell_output('chmod 666 %s' % traces, root=True)
|
||||
for trace_file in self._device.ls(self._device.stack_trace_dir, root=True):
|
||||
trace_path = posixpath.join(self._device.stack_trace_dir, trace_file)
|
||||
self._device.chmod(trace_path, root=True)
|
||||
self._device.rm(trace_path, root=True)
|
||||
except Exception as e:
|
||||
print("Error deleting %s: %s" % (traces, str(e)))
|
||||
print("Error deleting %s: %s" % (self._device.stack_trace_dir, str(e)))
|
||||
|
||||
def checkForANRs(self):
|
||||
traces = "/data/anr/traces.txt"
|
||||
if self._device.is_file(traces):
|
||||
try:
|
||||
t = self._device.get_file(traces)
|
||||
if not self._device.is_dir(self._device.stack_trace_dir):
|
||||
print("%s not found" % self._device.stack_trace_dir)
|
||||
return
|
||||
try:
|
||||
for trace_file in self._device.ls(self._device.stack_trace_dir, root=True):
|
||||
trace_path = posixpath.join(self._device.stack_trace_dir, trace_file)
|
||||
t = self._device.get_file(trace_path)
|
||||
if t:
|
||||
stripped = t.strip()
|
||||
if len(stripped) > 0:
|
||||
print("Contents of %s:" % traces)
|
||||
print("Contents of %s:" % trace_path)
|
||||
print(t)
|
||||
# Once reported, delete traces
|
||||
self.deleteANRs()
|
||||
except Exception as e:
|
||||
print("Error pulling %s: %s" % (traces, str(e)))
|
||||
else:
|
||||
print("%s not found" % traces)
|
||||
# Once reported, delete traces
|
||||
self.deleteANRs()
|
||||
except Exception as e:
|
||||
print("Error pulling %s: %s" % (self._device.stack_trace_dir, str(e)))
|
||||
|
||||
def deleteTombstones(self):
|
||||
# delete any tombstone files from device
|
||||
|
Loading…
Reference in New Issue
Block a user