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

Side by Side Diff: tools/perf/core/stacktrace_unittest.py

Issue 1880333002: Use is_valid_dump to check for valid dumps in telemetry exceptions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disable windows for testValidDump Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « components/crash/content/tools/generate_breakpad_symbols.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import tempfile 5 import tempfile
6 import os 6 import os
7 7
8 from telemetry.core import exceptions 8 from telemetry.core import exceptions
9 from telemetry import decorators 9 from telemetry import decorators
10 from telemetry.testing import tab_test_case 10 from telemetry.testing import tab_test_case
11 11
12 12
13 class TabStackTraceTest(tab_test_case.TabTestCase): 13 class TabStackTraceTest(tab_test_case.TabTestCase):
14 14
15 # TODO(dyen): For now this doesn't work on Android but continue to
16 # expand this.
17 # TODO(kbr): currently failing on Windows because the symbolized
18 # stack trace format is unexpected. http://crbug.com/561763
19 @decorators.Enabled('mac', 'linux')
20 # Stack traces do not currently work on 10.6, but they are also being 15 # Stack traces do not currently work on 10.6, but they are also being
21 # disabled shortly so just disable it for now. 16 # disabled shortly so just disable it for now.
22 @decorators.Disabled('snowleopard') 17 # All platforms except chromeos should at least have a valid minidump.
23 def testStackTrace(self): 18 # TODO(dyen): Investigate why crashpad_database_util is not being included.
19 @decorators.Disabled('snowleopard', 'chromeos', 'win')
20 def testValidDump(self):
24 with self.assertRaises(exceptions.DevtoolsTargetCrashException) as c: 21 with self.assertRaises(exceptions.DevtoolsTargetCrashException) as c:
25 self._tab.Navigate('chrome://crash', timeout=5) 22 self._tab.Navigate('chrome://crash', timeout=5)
26 self.assertIn('Thread 0 (crashed)', '\n'.join(c.exception.stack_trace)) 23 self.assertTrue(c.exception.is_valid_dump)
27 24
28 # Stack traces aren't working on Android yet. 25 # Stack traces aren't working on Android yet.
29 @decorators.Enabled('mac', 'linux', 'win') 26 # TODO(dyen): Investigate why windows is crashing in mojo.
27 @decorators.Enabled('mac', 'linux')
30 @decorators.Disabled('snowleopard') 28 @decorators.Disabled('snowleopard')
31 def testCrashSymbols(self): 29 def testCrashSymbols(self):
32 with self.assertRaises(exceptions.DevtoolsTargetCrashException) as c: 30 with self.assertRaises(exceptions.DevtoolsTargetCrashException) as c:
33 self._tab.Navigate('chrome://crash', timeout=5) 31 self._tab.Navigate('chrome://crash', timeout=5)
34 self.assertIn('CrashIntentionally', '\n'.join(c.exception.stack_trace)) 32 self.assertIn('CrashIntentionally', '\n'.join(c.exception.stack_trace))
35 33
36 # The breakpad file specific test only apply to platforms which use the 34 # The breakpad file specific test only apply to platforms which use the
37 # breakpad symbol format. This also must be tested in isolation because it can 35 # breakpad symbol format. This also must be tested in isolation because it can
38 # potentially interfere with other tests symbol parsing. 36 # potentially interfere with other tests symbol parsing.
39 @decorators.Enabled('mac', 'linux') 37 @decorators.Enabled('mac', 'linux')
40 @decorators.Isolated 38 @decorators.Isolated
41 def testBadBreakpadFileIgnored(self): 39 def testBadBreakpadFileIgnored(self):
42 # pylint: disable=protected-access 40 # pylint: disable=protected-access
43 executable_path = self._browser._browser_backend._executable 41 executable_path = self._browser._browser_backend._executable
44 executable = os.path.basename(executable_path) 42 executable = os.path.basename(executable_path)
45 with tempfile.NamedTemporaryFile(mode='wt', 43 with tempfile.NamedTemporaryFile(mode='wt',
46 dir=os.path.dirname(executable_path), 44 dir=os.path.dirname(executable_path),
47 prefix=executable + '.breakpad', 45 prefix=executable + '.breakpad',
48 delete=True) as f: 46 delete=True) as f:
49 f.write('Garbage Data 012345') 47 garbage_hash = 'ABCDEF1234567'
48 f.write('MODULE PLATFORM ARCH %s %s' % (garbage_hash, executable))
50 f.flush() 49 f.flush()
51 with self.assertRaises(exceptions.DevtoolsTargetCrashException) as c: 50 with self.assertRaises(exceptions.DevtoolsTargetCrashException) as c:
52 self._tab.Navigate('chrome://crash', timeout=5) 51 self._tab.Navigate('chrome://crash', timeout=5)
53 # The symbol directory should now contain our breakpad file. 52 # The symbol directory should now symbols for out executable.
54 tmp_dir = os.path.join(self._browser._browser_backend._tmp_minidump_dir) 53 tmp_dir = os.path.join(self._browser._browser_backend._tmp_minidump_dir)
54 symbol_dir = os.path.join(tmp_dir, 'symbols')
55 self.assertTrue(os.path.isdir(symbol_dir))
55 56
56 # Symbol directory should have been created. 57 # Bad breakpad file should not be in the symbol directory
57 symbol_dir = os.path.join(tmp_dir, 'symbols', executable) 58 garbage_symbol_dir = os.path.join(symbol_dir, executable, garbage_hash)
58 self.assertTrue(os.path.isdir(symbol_dir)) 59 self.assertFalse(os.path.isdir(garbage_symbol_dir))
59 60
60 # A single symbol file should still exist here. 61 # Stack trace should still work.
61 self.assertEqual(1, len(os.listdir(symbol_dir))) 62 self.assertIn('CrashIntentionally', '\n'.join(c.exception.stack_trace))
62
63 # Stack trace should still work.
64 self.assertIn('CrashIntentionally', '\n'.join(c.exception.stack_trace))
OLDNEW
« no previous file with comments | « components/crash/content/tools/generate_breakpad_symbols.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698