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

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

Issue 2241553002: Adding in checks for all logging statements and none. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 | « no previous file | 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 logging 5 import logging
6 import time 6 import time
7 7
8 from telemetry.testing import tab_test_case 8 from telemetry.testing import tab_test_case
9 from telemetry import decorators 9 from telemetry import decorators
10 from telemetry.core import util 10 from telemetry.core import util
11 11
12 class BrowserMinidumpTest(tab_test_case.TabTestCase): 12 class BrowserMinidumpTest(tab_test_case.TabTestCase):
13 @decorators.Isolated 13 @decorators.Isolated
14 @decorators.Enabled('mac') 14 @decorators.Enabled('mac')
15 def testSymbolizeMinidump(self): 15 def testSymbolizeMinidump(self):
16 # Wait for the browser to restart fully before crashing 16 # Wait for the browser to restart fully before crashing
17 self._LoadPageThenWait('var sam = "car";', 'sam') 17 self._LoadPageThenWait('var sam = "car";', 'sam')
18 self._browser.tabs.New().Navigate('chrome://gpucrash', timeout=5) 18 self._browser.tabs.New().Navigate('chrome://gpucrash', timeout=5)
19 crash_minidump_path = self._browser.GetMostRecentMinidumpPath() 19 crash_minidump_path = self._browser.GetMostRecentMinidumpPath()
20 #self.assertIsNotNone(crash_minidump_path) 20 #self.assertIsNotNone(crash_minidump_path)
21 21
22 if crash_minidump_path is not None: 22 if crash_minidump_path is not None:
23 logging.info('testSymbolizeMinidump: most recent path = ' 23 logging.info('testSymbolizeMinidump: most recent path = '
24 + crash_minidump_path) 24 + crash_minidump_path)
25 all_paths = self._browser.GetAllMinidumpPaths() 25 all_paths = self._browser.GetAllMinidumpPaths()
26 logging.info('testSymbolizeMinidump: all paths ' + ''.join(all_paths)) 26 if all_paths is not None:
27 logging.info('testSymbolizeMinidump: all paths ' + ''.join(all_paths))
27 all_unsymbolized_paths = self._browser.GetAllUnsymbolizedMinidumpPaths() 28 all_unsymbolized_paths = self._browser.GetAllUnsymbolizedMinidumpPaths()
28 logging.info('testSymbolizeMinidump: all unsymbolized paths ' 29 if all_unsymbolized_paths is not None:
29 + ''.join(all_unsymbolized_paths)) 30 logging.info('testSymbolizeMinidump: all unsymbolized paths '
31 + ''.join(all_unsymbolized_paths))
30 #self.assertTrue(len(all_unsymbolized_paths) == 1) 32 #self.assertTrue(len(all_unsymbolized_paths) == 1)
31 33
32 # Now symbolize that minidump and make sure there are no longer any present 34 # Now symbolize that minidump and make sure there are no longer any present
33 self._browser.SymbolizeMinidump(crash_minidump_path) 35 self._browser.SymbolizeMinidump(crash_minidump_path)
34 36
35 all_unsymbolized_after_symbolize_paths = \ 37 all_unsymbolized_after_symbolize_paths = \
36 self._browser.GetAllUnsymbolizedMinidumpPaths() 38 self._browser.GetAllUnsymbolizedMinidumpPaths()
37 logging.info('testSymbolizeMinidump: after symbolize all ' 39 if all_unsymbolized_after_symbolize_paths is not None:
38 + 'unsymbolized paths: ' 40 logging.info('testSymbolizeMinidump: after symbolize all '
39 + ''.join(all_unsymbolized_after_symbolize_paths)) 41 + 'unsymbolized paths: '
42 + ''.join(all_unsymbolized_after_symbolize_paths))
40 #self.assertTrue(len(all_unsymbolized_after_symbolize_paths) == 0) 43 #self.assertTrue(len(all_unsymbolized_after_symbolize_paths) == 0)
41 44
42 45
43 @decorators.Isolated 46 @decorators.Isolated
44 @decorators.Enabled('mac') 47 @decorators.Enabled('mac')
45 def testMultipleCrashMinidumps(self): 48 def testMultipleCrashMinidumps(self):
46 # Wait for the browser to restart fully before crashing 49 # Wait for the browser to restart fully before crashing
47 self._LoadPageThenWait('var cat = "dog";', 'cat') 50 self._LoadPageThenWait('var cat = "dog";', 'cat')
48 self._browser.tabs.New().Navigate('chrome://gpucrash', timeout=5) 51 self._browser.tabs.New().Navigate('chrome://gpucrash', timeout=5)
49 first_crash_path = self._browser.GetMostRecentMinidumpPath() 52 first_crash_path = self._browser.GetMostRecentMinidumpPath()
50 53
51 #self.assertIsNotNone(first_crash_path) 54 #self.assertIsNotNone(first_crash_path)
52 if first_crash_path is not None: 55 if first_crash_path is not None:
53 logging.info('testMultipleCrashMinidumps: first crash most recent path' 56 logging.info('testMultipleCrashMinidumps: first crash most recent path'
54 + first_crash_path) 57 + first_crash_path)
55 all_paths = self._browser.GetAllMinidumpPaths() 58 all_paths = self._browser.GetAllMinidumpPaths()
56 logging.info('testMultipleCrashMinidumps: first crash all paths: ' 59 if all_paths is not None:
57 + ''.join(all_paths)) 60 logging.info('testMultipleCrashMinidumps: first crash all paths: '
61 + ''.join(all_paths))
58 #self.assertEquals(len(all_paths), 1) 62 #self.assertEquals(len(all_paths), 1)
59 #self.assertEqual(all_paths[0], first_crash_path) 63 #self.assertEqual(all_paths[0], first_crash_path)
60 all_unsymbolized_paths = self._browser.GetAllUnsymbolizedMinidumpPaths() 64 all_unsymbolized_paths = self._browser.GetAllUnsymbolizedMinidumpPaths()
61 #self.assertTrue(len(all_unsymbolized_paths) == 1) 65 #self.assertTrue(len(all_unsymbolized_paths) == 1)
62 logging.info('testMultipleCrashMinidumps: first crash all unsymbolized ' 66 if all_unsymbolized_paths is not None:
63 'paths: ' + ''.join(all_unsymbolized_paths)) 67 logging.info('testMultipleCrashMinidumps: first crash all unsymbolized '
68 'paths: ' + ''.join(all_unsymbolized_paths))
64 69
65 # Restart the browser and then crash a second time 70 # Restart the browser and then crash a second time
66 self._RestartBrowser() 71 self._RestartBrowser()
67 72
68 # Start a new tab in the restarted browser 73 # Start a new tab in the restarted browser
69 self._LoadPageThenWait('var foo = "bar";', 'foo') 74 self._LoadPageThenWait('var foo = "bar";', 'foo')
70 75
71 self._browser.tabs.New().Navigate('chrome://gpucrash', timeout=5) 76 self._browser.tabs.New().Navigate('chrome://gpucrash', timeout=5)
72 second_crash_path = self._browser.GetMostRecentMinidumpPath() 77 second_crash_path = self._browser.GetMostRecentMinidumpPath()
73 #self.assertIsNotNone(second_crash_path) 78 #self.assertIsNotNone(second_crash_path)
74 if second_crash_path is not None: 79 if second_crash_path is not None:
75 logging.info('testMultipleCrashMinidumps: second crash most recent path' 80 logging.info('testMultipleCrashMinidumps: second crash most recent path'
76 + second_crash_path) 81 + second_crash_path)
77 second_crash_all_paths = self._browser.GetAllMinidumpPaths() 82 second_crash_all_paths = self._browser.GetAllMinidumpPaths()
78 logging.info('testMultipleCrashMinidumps: second crash all paths: ' 83 if second_crash_all_paths is not None:
79 + ''.join(second_crash_all_paths)) 84 logging.info('testMultipleCrashMinidumps: second crash all paths: '
85 + ''.join(second_crash_all_paths))
80 second_crash_all_unsymbolized_paths = \ 86 second_crash_all_unsymbolized_paths = \
81 self._browser.GetAllUnsymbolizedMinidumpPaths() 87 self._browser.GetAllUnsymbolizedMinidumpPaths()
82 #self.assertTrue(len(all_unsymbolized_paths) == 1) 88 #self.assertTrue(len(all_unsymbolized_paths) == 1)
83 logging.info('testMultipleCrashMinidumps: second crash all unsymbolized ' 89 if second_crash_all_unsymbolized_paths is not None:
84 'paths: ' + ''.join(second_crash_all_unsymbolized_paths)) 90 logging.info('testMultipleCrashMinidumps: second crash all unsymbolized '
91 'paths: ' + ''.join(second_crash_all_unsymbolized_paths))
85 #self.assertEquals(len(second_crash_all_paths), 2) 92 #self.assertEquals(len(second_crash_all_paths), 2)
86 # Check that both paths are now present and unsymbolized 93 # Check that both paths are now present and unsymbolized
87 #self.assertTrue(first_crash_path in second_crash_all_paths) 94 #self.assertTrue(first_crash_path in second_crash_all_paths)
88 #self.assertTrue(second_crash_path in second_crash_all_paths) 95 #self.assertTrue(second_crash_path in second_crash_all_paths)
89 #self.assertTrue(len(second_crash_all_unsymbolized_paths) == 2) 96 #self.assertTrue(len(second_crash_all_unsymbolized_paths) == 2)
90 97
91 98
92 # Now symbolize one of those paths and assert that there is still one 99 # Now symbolize one of those paths and assert that there is still one
93 # unsymbolized 100 # unsymbolized
94 self._browser.SymbolizeMinidump(second_crash_path) 101 self._browser.SymbolizeMinidump(second_crash_path)
95 after_symbolize_all_paths = self._browser.GetAllMinidumpPaths() 102 after_symbolize_all_paths = self._browser.GetAllMinidumpPaths()
96 logging.info('testMultipleCrashMinidumps: after symbolize all paths: ' 103 if after_symbolize_all_paths is not None:
97 + ''.join(after_symbolize_all_paths)) 104 logging.info('testMultipleCrashMinidumps: after symbolize all paths: '
105 + ''.join(after_symbolize_all_paths))
98 #self.assertEquals(len(after_symbolize_all_paths), 2) 106 #self.assertEquals(len(after_symbolize_all_paths), 2)
99 after_symbolize_all_unsymbolized_paths = \ 107 after_symbolize_all_unsymbolized_paths = \
100 self._browser.GetAllUnsymbolizedMinidumpPaths() 108 self._browser.GetAllUnsymbolizedMinidumpPaths()
101 logging.info('testMultipleCrashMinidumps: after symbolize all ' 109 if after_symbolize_all_unsymbolized_paths is not None:
102 + 'unsymbolized paths: ' 110 logging.info('testMultipleCrashMinidumps: after symbolize all '
103 + ''.join(after_symbolize_all_unsymbolized_paths)) 111 + 'unsymbolized paths: '
112 + ''.join(after_symbolize_all_unsymbolized_paths))
104 #self.assertEquals(after_symbolize_all_unsymbolized_paths, 113 #self.assertEquals(after_symbolize_all_unsymbolized_paths,
105 # [first_crash_path]) 114 # [first_crash_path])
106 115
107 def _LoadPageThenWait(self, script, value): 116 def _LoadPageThenWait(self, script, value):
108 # We are occasionally seeing these tests fail on the first load and 117 # We are occasionally seeing these tests fail on the first load and
109 # call to GetMostRecentMinidumpPath, where the directory is coming up empty. 118 # call to GetMostRecentMinidumpPath, where the directory is coming up empty.
110 # We are hypothesizing, that although the browser is technically loaded, 119 # We are hypothesizing, that although the browser is technically loaded,
111 # some of chromes optimizations could still be running in the background 120 # some of chromes optimizations could still be running in the background
112 # that potentially initializing the crash directory that we set with the 121 # that potentially initializing the crash directory that we set with the
113 # environment vairable BREAKPAD_DUMP_LOCATION in desktop_browser_backend. 122 # environment vairable BREAKPAD_DUMP_LOCATION in desktop_browser_backend.
114 # Therefore, we are adding a 5 second wait for now to see if this can help 123 # Therefore, we are adding a 5 second wait for now to see if this can help
115 # the problem until we determine if there is another chrome process we can 124 # the problem until we determine if there is another chrome process we can
116 # wait on to ensure that all browser load processes have finished 125 # wait on to ensure that all browser load processes have finished
117 time.sleep(5) 126 time.sleep(5)
118 new_tab = self._browser.tabs.New() 127 new_tab = self._browser.tabs.New()
119 new_tab.Navigate(self.UrlOfUnittestFile('blank.html'), 128 new_tab.Navigate(self.UrlOfUnittestFile('blank.html'),
120 script_to_evaluate_on_commit=script) 129 script_to_evaluate_on_commit=script)
121 # Wait until the javascript has run ensuring that 130 # Wait until the javascript has run ensuring that
122 # the new browser has restarted before we crash it again 131 # the new browser has restarted before we crash it again
123 util.WaitFor(lambda: new_tab.EvaluateJavaScript(value), 60) 132 util.WaitFor(lambda: new_tab.EvaluateJavaScript(value), 60)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698