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

Side by Side Diff: appengine/findit/crash/test/findit_for_chromecrash_test.py

Issue 2378133004: [Findit] Rerun if the regression range is different. (Closed)
Patch Set: Fix nits. Created 4 years, 2 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
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 from common import chromium_deps 5 from common import chromium_deps
6 from common.dependency import DependencyRoll 6 from common.dependency import DependencyRoll
7 from crash import detect_regression_range 7 from crash import detect_regression_range
8 from crash import findit_for_chromecrash 8 from crash import findit_for_chromecrash
9 from crash import chromecrash_parser 9 from crash import chromecrash_parser
10 from crash import findit_for_crash 10 from crash import findit_for_crash
(...skipping 30 matching lines...) Expand all
41 41
42 def testFindCulpritForChromeCrash(self): 42 def testFindCulpritForChromeCrash(self):
43 def _MockGetChromeDependency(*_): 43 def _MockGetChromeDependency(*_):
44 return {} 44 return {}
45 45
46 def _MockParse(*_): 46 def _MockParse(*_):
47 stack = Stacktrace() 47 stack = Stacktrace()
48 stack.append(CallStack(0)) 48 stack.append(CallStack(0))
49 return stack 49 return stack
50 50
51 def _MockDetectRegressionRange(historic):
52 if historic:
53 return '50.0.1233.0', '50.0.1234.0'
54
55 return None
56
57 def _MockGetDEPSRollsDict(*_): 51 def _MockGetDEPSRollsDict(*_):
58 return {'src/': DependencyRoll('src/', 'https://repo', '1', '2'), 52 return {'src/': DependencyRoll('src/', 'https://repo', '1', '2'),
59 'src/add': DependencyRoll('src/add', 'https://repo1', None, '2'), 53 'src/add': DependencyRoll('src/add', 'https://repo1', None, '2'),
60 'src/delete': DependencyRoll('src/delete', 'https://repo2', 54 'src/delete': DependencyRoll('src/delete', 'https://repo2',
61 '2', None)} 55 '2', None)}
62 56
63 dummy_match_result = MatchResult(self.GetDummyChangeLog(), 'src/') 57 dummy_match_result = MatchResult(self.GetDummyChangeLog(), 'src/')
64 def _MockFindItForCrash(*args): 58 def _MockFindItForCrash(*args):
65 regression_deps_rolls = args[1] 59 regression_deps_rolls = args[1]
66 if regression_deps_rolls: 60 if regression_deps_rolls:
67 return [dummy_match_result] 61 return [dummy_match_result]
68 62
69 return [] 63 return []
70 64
71 def _MockComponentClassify(*_): 65 def _MockComponentClassify(*_):
72 return [] 66 return []
73 67
74 def _MockProjectClassify(*_): 68 def _MockProjectClassify(*_):
75 return '' 69 return ''
76 70
77 self.mock(chromium_deps, 'GetChromeDependency', _MockGetChromeDependency) 71 self.mock(chromium_deps, 'GetChromeDependency', _MockGetChromeDependency)
78 self.mock(chromecrash_parser.ChromeCrashParser, 'Parse', _MockParse) 72 self.mock(chromecrash_parser.ChromeCrashParser, 'Parse', _MockParse)
79 self.mock(detect_regression_range, 'DetectRegressionRange',
80 _MockDetectRegressionRange)
81 self.mock(chromium_deps, 'GetDEPSRollsDict', _MockGetDEPSRollsDict) 73 self.mock(chromium_deps, 'GetDEPSRollsDict', _MockGetDEPSRollsDict)
82 self.mock(findit_for_crash, 'FindItForCrash', _MockFindItForCrash) 74 self.mock(findit_for_crash, 'FindItForCrash', _MockFindItForCrash)
83 75
84 self.mock(ComponentClassifier, 'Classify', _MockComponentClassify) 76 self.mock(ComponentClassifier, 'Classify', _MockComponentClassify)
85 self.mock(ProjectClassifier, 'Classify', _MockProjectClassify) 77 self.mock(ProjectClassifier, 'Classify', _MockProjectClassify)
86 78
87 expected_results = {'found': False} 79 expected_results = {'found': False}
88 expected_tag = {'found_suspects': False} 80 expected_tag = {'found_suspects': False}
89 81
90 results, tag = findit_for_chromecrash.FinditForChromeCrash().FindCulprit( 82 results, tag = findit_for_chromecrash.FinditForChromeCrash().FindCulprit(
91 'signature', 'win', 'frame1\nframe2', '50.0.1234.0', 83 'signature', 'win', 'frame1\nframe2', '50.0.1234.0',
92 [{'chrome_version': '50.0.1234.0', 'cpm': 0.6}]).ToDicts() 84 ['50.0.1233.0', '50.0.1234.0']).ToDicts()
93 85
94 # TODO(wrengr): compare the Culprit object directly to these values, 86 # TODO(wrengr): compare the Culprit object directly to these values,
95 # rather than converting to dicts first. We can make a different 87 # rather than converting to dicts first. We can make a different
96 # unit test for comparing the dicts, if we actually need/want to. 88 # unit test for comparing the dicts, if we actually need/want to.
97 expected_results = { 89 expected_results = {
98 'found': True, 90 'found': True,
99 'suspected_project': '', 91 'suspected_project': '',
100 'suspected_components': [], 92 'suspected_components': [],
101 'suspected_cls': [dummy_match_result.ToDict()], 93 'suspected_cls': [dummy_match_result.ToDict()],
102 'regression_range': ('50.0.1233.0', '50.0.1234.0'), 94 'regression_range': ['50.0.1233.0', '50.0.1234.0']
103 } 95 }
104 expected_tag = { 96 expected_tag = {
105 'found_suspects': True, 97 'found_suspects': True,
106 'found_project': False, 98 'found_project': False,
107 'found_components': False, 99 'found_components': False,
108 'has_regression_range': True, 100 'has_regression_range': True,
109 'solution': 'core_algorithm', 101 'solution': 'core_algorithm',
110 } 102 }
111 103
112 self.assertEqual(expected_results, results) 104 self.assertEqual(expected_results, results)
113 self.assertEqual(expected_tag, tag) 105 self.assertEqual(expected_tag, tag)
114 106
115 results, tag = findit_for_chromecrash.FinditForChromeCrash().FindCulprit( 107 results, tag = findit_for_chromecrash.FinditForChromeCrash().FindCulprit(
116 'signature', 'win', 'frame1\nframe2', '50.0.1234.0', 108 'signature', 'win', 'frame1\nframe2', '50.0.1234.0', None).ToDicts()
117 []).ToDicts()
118 109
119 expected_results = { 110 expected_results = {
120 'found': False, 111 'found': False,
121 'suspected_project': '', 112 'suspected_project': '',
122 'suspected_components': [], 113 'suspected_components': [],
123 'suspected_cls': [], 114 'suspected_cls': [],
124 'regression_range': None 115 'regression_range': None
125 } 116 }
126 expected_tag = { 117 expected_tag = {
127 'found_suspects': False, 118 'found_suspects': False,
128 'found_project': False, 119 'found_project': False,
129 'found_components': False, 120 'found_components': False,
130 'has_regression_range': False, 121 'has_regression_range': False,
131 'solution': 'core_algorithm', 122 'solution': 'core_algorithm',
132 } 123 }
133 124
134 self.assertEqual(expected_results, results) 125 self.assertEqual(expected_results, results)
135 self.assertEqual(expected_tag, tag) 126 self.assertEqual(expected_tag, tag)
OLDNEW
« no previous file with comments | « appengine/findit/crash/test/crash_pipeline_test.py ('k') | appengine/findit/crash/test/findit_for_client_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698