Bug 1482874 - Detect anr traces directory, r=gbrown.
authorBob Clary <bclary@bclary.com>
Sat, 18 Aug 2018 10:47:12 -0700
changeset 487379 974c72e27e7e0f5158fdb3b4862ff4dab4d61802
parent 487378 2fe3aa8aeb317ba4bd59dd8f4cbea016741c47d5
child 487380 4956d2326228f24cbaf6dfebb2362aab983ae7e3
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1482874 - Detect anr traces directory, r=gbrown.
--- a/testing/mozbase/mozdevice/mozdevice/adb_android.py
+++ b/testing/mozbase/mozdevice/mozdevice/adb_android.py
@@ -1,15 +1,16 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
 # You can obtain one at http://mozilla.org/MPL/2.0/.
 from __future__ import absolute_import, print_function
 import os
+import posixpath
 import re
 import time
 from abc import ABCMeta
 from . import version_codes
 from .adb import ADBDevice, ADBError, ADBRootError
@@ -93,16 +94,31 @@ class ADBAndroid(ADBDevice):
                 self._logger.info('Setting SELinux Permissive Mode')
                 self.shell_output("setenforce Permissive", timeout=timeout, root=True)
         except (ADBError, ADBRootError) as e:
             self._logger.warning('Unable to set SELinux Permissive due to %s.' % e)
             self.selinux = False
         self.version = int(self.shell_output("getprop ro.build.version.sdk",
+        # Beginning in Android 8.1 /data/anr/traces.txt no longer contains
+        # a single file traces.txt but instead will contain individual files
+        # for each stack.
+        # See https://github.com/aosp-mirror/platform_build/commit/
+        # fbba7fe06312241c7eb8c592ec2ac630e4316d55
+        stack_trace_dir = self.shell_output("getprop dalvik.vm.stack-trace-dir",
+                                            timeout=timeout)
+        if not stack_trace_dir:
+            stack_trace_file = self.shell_output("getprop dalvik.vm.stack-trace-file",
+                                                 timeout=timeout)
+            if stack_trace_file:
+                stack_trace_dir = posixpath.dirname(stack_trace_file)
+            else:
+                stack_trace_dir = '/data/anr'
+        self.stack_trace_dir = stack_trace_dir
     def reboot(self, timeout=None):
         """Reboots the device.
         :param timeout: optional integer specifying the maximum time in
             seconds for any spawned adb process to complete before
             throwing an ADBTimeoutError.
             This timeout is per adb call. The total time spent