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

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

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