Commit 5f0df051 authored by dyen's avatar dyen Committed by Commit bot

Reland of Added unit test for stack traces in telemetry crashes. (patchset #1...

Reland of Added unit test for stack traces in telemetry crashes. (patchset #1 id:1 of https://codereview.chromium.org/1580313002/ )

Reason for revert:
Try again disabling 10.6

Original issue's description:
> Revert of Added unit test for stack traces in telemetry crashes. (patchset #17 id:320001 of https://codereview.chromium.org/1498633003/ )
>
> Reason for revert:
> Test fails on some bots.
>
> Original issue's description:
> > Added unit test for stack traces in telemetry crashes.
> >
> > This CL also fixes an issue on Mac where telemetry does not
> > know how to locate chromium_framework for the symbols.
> >
> > R=nednguyen@google.com
> > BUG=563716
> > TEST=ran unit test locally
> >
> > Committed: https://crrev.com/a20e03ee6906c50bdfaf8fb34fe684b4a89db852
> > Cr-Commit-Position: refs/heads/master@{#368997}
>
> TBR=nednguyen@google.com
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=563716
>
> Committed: https://crrev.com/f0cb0bf2dd7f677423318d2318902311e635538d
> Cr-Commit-Position: refs/heads/master@{#369056}

R=nednguyen@google.com
BUG=563716

Review URL: https://codereview.chromium.org/1581143002

Cr-Commit-Position: refs/heads/master@{#369404}
parent c38cb957
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.core import exceptions
from telemetry import decorators
from telemetry.testing import tab_test_case
class TabStackTraceTest(tab_test_case.TabTestCase):
# For now just work on a single platform (mac).
@decorators.Enabled('mac')
# Stack traces do not currently work on 10.6, but they are also being
# disabled shortly so just disable it for now.
@decorators.Disabled('snowleopard')
def testStackTrace(self):
try:
self._tab.Navigate('chrome://crash', timeout=5)
except exceptions.DevtoolsTargetCrashException as e:
self.assertIn('Thread 0 (crashed)', '\n'.join(e.stack_trace))
# Currently stack traces do not work on windows: http://crbug.com/476110
# Currently symbols do not work on swarming: http://crbug.com/563716
# Linux stack traces depends on fission support: http://crbug.com/405623
@decorators.Disabled('all')
def testCrashSymbols(self):
try:
self._tab.Navigate('chrome://crash', timeout=5)
except exceptions.DevtoolsTargetCrashException as e:
self.assertIn('CrashIntentionally', '\n'.join(e.stack_trace))
......@@ -68,6 +68,10 @@ class AppCrashException(Error):
except Exception as err:
logging.error('Problem when trying to gather standard output: %s' % err)
@property
def stack_trace(self):
return self._stack_trace
def __str__(self):
divider = '*' * 80
debug_messages = []
......
......@@ -34,6 +34,23 @@ def ParseCrashpadDateTime(date_time_str):
return datetime.datetime.strptime(date_time_str, '%Y-%m-%d %H:%M:%S')
def GetSymbolBinary(executable, os_name):
# Returns binary file where symbols are located.
if os_name == 'mac':
version_dir = os.path.join(os.path.dirname(executable),
'..',
'Versions')
for version_num in os.listdir(version_dir):
framework_file = os.path.join(version_dir,
version_num,
'Chromium Framework.framework',
'Chromium Framework')
if os.path.isfile(framework_file):
return framework_file
return executable
class DesktopBrowserBackend(chrome_browser_backend.ChromeBrowserBackend):
"""The backend for controlling a locally-executed browser instance, on Linux,
Mac or Windows.
......@@ -453,7 +470,8 @@ class DesktopBrowserBackend(chrome_browser_backend.ChromeBrowserBackend):
cmd = [
sys.executable,
generate_breakpad_symbols_command,
'--binary=%s' % self._executable,
'--binary=%s' % GetSymbolBinary(self._executable,
self.browser.platform.GetOSName()),
'--symbols-dir=%s' % symbols_path,
'--build-dir=%s' % self._browser_directory,
]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment