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

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

Issue 2414523002: [Findit] Reorganizing findit_for_*.py (Closed)
Patch Set: trying to fix some tests 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 collections import defaultdict 5 from collections import defaultdict
6 6
7 from common import chromium_deps
8 from common.blame import Blame
7 from common.blame import Region 9 from common.blame import Region
8 from common.blame import Blame
9 from common.change_log import ChangeLog 10 from common.change_log import ChangeLog
10 from common.dependency import Dependency 11 from common.dependency import Dependency
11 from common.dependency import DependencyRoll 12 from common.dependency import DependencyRoll
12 from common.git_repository import GitRepository 13 from common.git_repository import GitRepository
13 from crash import findit_for_crash 14 from crash import changelist_classifier
15 from crash.crash_report import CrashReport
16 from crash.results import MatchResult
14 from crash.stacktrace import StackFrame 17 from crash.stacktrace import StackFrame
15 from crash.stacktrace import CallStack 18 from crash.stacktrace import CallStack
16 from crash.stacktrace import Stacktrace 19 from crash.stacktrace import Stacktrace
17 from crash.results import MatchResult
18 from crash.test.crash_test_suite import CrashTestSuite 20 from crash.test.crash_test_suite import CrashTestSuite
19 21
20
21 DUMMY_CHANGELOG1 = ChangeLog.FromDict({ 22 DUMMY_CHANGELOG1 = ChangeLog.FromDict({
22 'author_name': 'r@chromium.org', 23 'author_name': 'r@chromium.org',
23 'message': 'dummy', 24 'message': 'dummy',
24 'committer_email': 'r@chromium.org', 25 'committer_email': 'r@chromium.org',
25 'commit_position': 175900, 26 'commit_position': 175900,
26 'author_email': 'r@chromium.org', 27 'author_email': 'r@chromium.org',
27 'touched_files': [ 28 'touched_files': [
28 { 29 {
29 'change_type': 'add', 30 'change_type': 'add',
30 'new_path': 'a.cc', 31 'new_path': 'a.cc',
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 'committer_time': 'Thu Apr 1 21:28:39 2016', 87 'committer_time': 'Thu Apr 1 21:28:39 2016',
87 'commit_url': 88 'commit_url':
88 'https://repo.test/+/3', 89 'https://repo.test/+/3',
89 'code_review_url': 'https://codereview.chromium.org/3281', 90 'code_review_url': 'https://codereview.chromium.org/3281',
90 'committer_name': 'example@chromium.org', 91 'committer_name': 'example@chromium.org',
91 'revision': '3', 92 'revision': '3',
92 'reverted_revision': None 93 'reverted_revision': None
93 }) 94 })
94 95
95 96
96 class FinditForCrashTest(CrashTestSuite): 97 class ChangelistClassifierTest(CrashTestSuite):
97 98
98 def testGetDepsInCrashStack(self): 99 def testGetDepsInCrashStack(self):
99 crash_stack = CallStack(0) 100 crash_stack = CallStack(0)
100 crash_stack.extend([ 101 crash_stack.extend([
101 StackFrame(0, 'src/', 'func0', 'f0.cc', 'src/f0.cc', [1]), 102 StackFrame(0, 'src/', 'func0', 'f0.cc', 'src/f0.cc', [1]),
102 StackFrame(1, 'src/', 'func1', 'f1.cc', 'src/f1.cc', [2, 3]), 103 StackFrame(1, 'src/', 'func1', 'f1.cc', 'src/f1.cc', [2, 3]),
103 StackFrame(1, '', 'func2', 'f2.cc', 'src/f2.cc', [2, 3]), 104 StackFrame(1, '', 'func2', 'f2.cc', 'src/f2.cc', [2, 3]),
104 ]) 105 ])
105 crash_deps = {'src/': Dependency('src/', 'https://chromium_repo', '1'), 106 crash_deps = {'src/': Dependency('src/', 'https://chromium_repo', '1'),
106 'src/v8/': Dependency('src/v8/', 'https://v8_repo', '2')} 107 'src/v8/': Dependency('src/v8/', 'https://v8_repo', '2')}
107 108
108 expected_stack_deps = {'src/': crash_deps['src/']} 109 expected_stack_deps = {'src/': crash_deps['src/']}
109 110
110 self.assertEqual( 111 self.assertEqual(
111 findit_for_crash.GetDepsInCrashStack(crash_stack, crash_deps), 112 changelist_classifier.GetDepsInCrashStack(crash_stack, crash_deps),
112 expected_stack_deps) 113 expected_stack_deps)
113 114
114 def testGetChangeLogsForFilesGroupedByDeps(self): 115 def testGetChangeLogsForFilesGroupedByDeps(self):
115 regression_deps_rolls = { 116 regression_deps_rolls = {
116 'src/dep1': DependencyRoll('src/dep1', 'https://url_dep1', '7', '9'), 117 'src/dep1': DependencyRoll('src/dep1', 'https://url_dep1', '7', '9'),
117 'src/dep2': DependencyRoll('src/dep2', 'repo_url', '3', None), 118 'src/dep2': DependencyRoll('src/dep2', 'repo_url', '3', None),
118 'src/': DependencyRoll('src/', ('https://chromium.googlesource.com/' 119 'src/': DependencyRoll('src/', ('https://chromium.googlesource.com/'
119 'chromium/src.git'), '4', '5') 120 'chromium/src.git'), '4', '5')
120 } 121 }
121 122
122 stack_deps = { 123 stack_deps = {
123 'src/': Dependency('src/', 'https://url_src', 'rev1', 'DEPS'), 124 'src/': Dependency('src/', 'https://url_src', 'rev1', 'DEPS'),
124 'src/new': Dependency('src/new', 'https://new', 'rev2', 'DEPS'), 125 'src/new': Dependency('src/new', 'https://new', 'rev2', 'DEPS'),
125 } 126 }
126 127
127 def _MockGetChangeLogs(*_): 128 def _MockGetChangeLogs(*_):
128 return [DUMMY_CHANGELOG1, DUMMY_CHANGELOG2, DUMMY_CHANGELOG3] 129 return [DUMMY_CHANGELOG1, DUMMY_CHANGELOG2, DUMMY_CHANGELOG3]
129 130
130 self.mock(GitRepository, 'GetChangeLogs', _MockGetChangeLogs) 131 self.mock(GitRepository, 'GetChangeLogs', _MockGetChangeLogs)
131 132
132 dep_file_to_changelogs, ignore_cls = ( 133 dep_file_to_changelogs, ignore_cls = (
133 findit_for_crash.GetChangeLogsForFilesGroupedByDeps( 134 changelist_classifier.GetChangeLogsForFilesGroupedByDeps(
134 regression_deps_rolls, stack_deps)) 135 regression_deps_rolls, stack_deps))
135 dep_file_to_changelogs_json = defaultdict(lambda: defaultdict(list)) 136 dep_file_to_changelogs_json = defaultdict(lambda: defaultdict(list))
136 for dep, file_to_changelogs in dep_file_to_changelogs.iteritems(): 137 for dep, file_to_changelogs in dep_file_to_changelogs.iteritems():
137 for file_path, changelogs in file_to_changelogs.iteritems(): 138 for file_path, changelogs in file_to_changelogs.iteritems():
138 for changelog in changelogs: 139 for changelog in changelogs:
139 dep_file_to_changelogs_json[dep][file_path].append(changelog.ToDict()) 140 dep_file_to_changelogs_json[dep][file_path].append(changelog.ToDict())
140 141
141 expected_dep_file_to_changelogs_json = { 142 expected_dep_file_to_changelogs_json = {
142 'src/': { 143 'src/': {
143 'a.cc': [DUMMY_CHANGELOG1.ToDict()], 144 'a.cc': [DUMMY_CHANGELOG1.ToDict()],
144 'f.cc': [DUMMY_CHANGELOG3.ToDict()] 145 'f.cc': [DUMMY_CHANGELOG3.ToDict()]
145 } 146 }
146 } 147 }
147 self.assertEqual(dep_file_to_changelogs_json, 148 self.assertEqual(dep_file_to_changelogs_json,
148 expected_dep_file_to_changelogs_json) 149 expected_dep_file_to_changelogs_json)
149 self.assertEqual(ignore_cls, set(['1'])) 150 self.assertEqual(ignore_cls, set(['1']))
150 151
151 def testGetStackInfosForFilesGroupedByDeps(self): 152 def testGetStackInfosForFilesGroupedByDeps(self):
152
153 main_stack = CallStack(0) 153 main_stack = CallStack(0)
154 main_stack.extend( 154 main_stack.extend(
155 [StackFrame(0, 'src/', 'c(p* &d)', 'a.cc', 'src/a.cc', [177]), 155 [StackFrame(0, 'src/', 'c(p* &d)', 'a.cc', 'src/a.cc', [177]),
156 StackFrame(1, 'src/', 'd(a* c)', 'a.cc', 'src/a.cc', [227, 228, 229]), 156 StackFrame(1, 'src/', 'd(a* c)', 'a.cc', 'src/a.cc', [227, 228, 229]),
157 StackFrame(2, 'src/v8/', 'e(int)', 'b.cc', 'src/v8/b.cc', [89, 90])]) 157 StackFrame(2, 'src/v8/', 'e(int)', 'b.cc', 'src/v8/b.cc', [89, 90])])
158 158
159 low_priority_stack = CallStack(1) 159 low_priority_stack = CallStack(1)
160 low_priority_stack.append( 160 low_priority_stack.append(
161 StackFrame(0, 'src/dummy/', 'c(p* &d)', 'd.cc', 'src/dummy/d.cc', [17])) 161 StackFrame(0, 'src/dummy/', 'c(p* &d)', 'd.cc', 'src/dummy/d.cc', [17]))
162 162
(...skipping 11 matching lines...) Expand all
174 ], 174 ],
175 }, 175 },
176 'src/v8/': { 176 'src/v8/': {
177 'b.cc': [ 177 'b.cc': [
178 (main_stack[2], 0), 178 (main_stack[2], 0),
179 ] 179 ]
180 } 180 }
181 } 181 }
182 182
183 dep_file_to_stack_infos = ( 183 dep_file_to_stack_infos = (
184 findit_for_crash.GetStackInfosForFilesGroupedByDeps( 184 changelist_classifier.GetStackInfosForFilesGroupedByDeps(
185 stacktrace, crashed_deps)) 185 stacktrace, crashed_deps))
186 186
187 self.assertEqual(len(dep_file_to_stack_infos), 187 self.assertEqual(len(dep_file_to_stack_infos),
188 len(expected_dep_file_to_stack_infos)) 188 len(expected_dep_file_to_stack_infos))
189 189
190 for dep, file_to_stack_infos in dep_file_to_stack_infos.iteritems(): 190 for dep, file_to_stack_infos in dep_file_to_stack_infos.iteritems():
191 self.assertTrue(dep in expected_dep_file_to_stack_infos) 191 self.assertTrue(dep in expected_dep_file_to_stack_infos)
192 expected_file_to_stack_infos = expected_dep_file_to_stack_infos[dep] 192 expected_file_to_stack_infos = expected_dep_file_to_stack_infos[dep]
193 193
194 for file_path, stack_infos in file_to_stack_infos.iteritems(): 194 for file_path, stack_infos in file_to_stack_infos.iteritems():
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 'review_url': 'https://codereview.chromium.org/3281', 238 'review_url': 'https://codereview.chromium.org/3281',
239 'revision': '1', 239 'revision': '1',
240 'project_path': 'src/', 240 'project_path': 'src/',
241 'author': 'r@chromium.org', 241 'author': 'r@chromium.org',
242 'time': 'Thu Mar 31 21:24:43 2016', 242 'time': 'Thu Mar 31 21:24:43 2016',
243 'reasons': None, 243 'reasons': None,
244 'confidence': None, 244 'confidence': None,
245 'changed_files': None 245 'changed_files': None
246 }] 246 }]
247 247
248 match_results = findit_for_crash.FindMatchResults( 248 match_results = changelist_classifier.FindMatchResults(
249 dep_file_to_changelogs, dep_file_to_stack_infos, stack_deps) 249 dep_file_to_changelogs, dep_file_to_stack_infos, stack_deps)
250 self.assertEqual([result.ToDict() for result in match_results], 250 self.assertEqual([result.ToDict() for result in match_results],
251 expected_match_results) 251 expected_match_results)
252 252
253 def testFindItForCrashNoRegressionRange(self): 253 def testFindItForCrashNoRegressionRange(self):
254 self.mock(chromium_deps, 'GetDEPSRollsDict', lambda *_: {})
255 self.mock(chromium_deps, 'GetChromeDependency', lambda *_: {})
256 report = CrashReport(None, None, None, Stacktrace(), None)
254 self.assertEqual( 257 self.assertEqual(
255 findit_for_crash.FindItForCrash(Stacktrace(), {}, {}, 7), 258 changelist_classifier.ChangelistClassifier(7)(report), [])
256 [])
257 259
258 def testFindItForCrashNoMatchFound(self): 260 def testFindItForCrashNoMatchFound(self):
261 regression_deps_rolls = {
262 'src/': DependencyRoll('src/', 'https://repo', '1', '2')}
259 263
260 def _MockFindMatchResults(*_): 264 self.mock(changelist_classifier, 'FindMatchResults', lambda *_: [])
261 return [] 265 self.mock(chromium_deps, 'GetDEPSRollsDict', lambda *_: regression_deps_roll s)
266 self.mock(chromium_deps, 'GetChromeDependency', lambda *_: {})
262 267
263 self.mock(findit_for_crash, 'FindMatchResults', _MockFindMatchResults) 268 report = CrashReport(None, None, None, Stacktrace(), None)
264 269 self.assertEqual(changelist_classifier.ChangelistClassifier(7)(report), [])
265 regression_deps_rolls = {'src/': DependencyRoll('src/', 'https://repo',
266 '1', '2')}
267 self.assertEqual(findit_for_crash.FindItForCrash(
268 Stacktrace(), regression_deps_rolls, {}, 7), [])
269 270
270 def testFindItForCrash(self): 271 def testFindItForCrash(self):
271 272
272 def _MockFindMatchResults(*_): 273 def _MockFindMatchResults(*_):
273 match_result1 = MatchResult(DUMMY_CHANGELOG1, 'src/', '') 274 match_result1 = MatchResult(DUMMY_CHANGELOG1, 'src/', '')
274 frame1 = StackFrame(0, 'src/', 'func', 'a.cc', 'src/a.cc', [1]) 275 frame1 = StackFrame(0, 'src/', 'func', 'a.cc', 'src/a.cc', [1])
275 frame2 = StackFrame(1, 'src/', 'func', 'a.cc', 'src/a.cc', [7]) 276 frame2 = StackFrame(1, 'src/', 'func', 'a.cc', 'src/a.cc', [7])
276 match_result1.file_to_stack_infos = { 277 match_result1.file_to_stack_infos = {
277 'a.cc': [(frame1, 0), (frame2, 0)] 278 'a.cc': [(frame1, 0), (frame2, 0)]
278 } 279 }
279 match_result1.file_to_analysis_info = { 280 match_result1.file_to_analysis_info = {
280 'a.cc': {'min_distance': 0, 'min_distance_frame': frame1} 281 'a.cc': {'min_distance': 0, 'min_distance_frame': frame1}
281 } 282 }
282 283
283 match_result2 = MatchResult(DUMMY_CHANGELOG3, 'src/', '') 284 match_result2 = MatchResult(DUMMY_CHANGELOG3, 'src/', '')
284 frame3 = StackFrame(5, 'src/', 'func', 'f.cc', 'src/f.cc', [1]) 285 frame3 = StackFrame(5, 'src/', 'func', 'f.cc', 'src/f.cc', [1])
285 match_result2.file_to_stack_infos = { 286 match_result2.file_to_stack_infos = {
286 'f.cc': [(frame3, 0)] 287 'f.cc': [(frame3, 0)]
287 } 288 }
288 match_result2.file_to_analysis_info = { 289 match_result2.file_to_analysis_info = {
289 'a.cc': {'min_distance': 20, 'min_distance_frame': frame3} 290 'a.cc': {'min_distance': 20, 'min_distance_frame': frame3}
290 } 291 }
291 292
292 return [match_result1, match_result2] 293 return [match_result1, match_result2]
293 294
294 self.mock(findit_for_crash, 'FindMatchResults', _MockFindMatchResults) 295 self.mock(changelist_classifier, 'FindMatchResults', _MockFindMatchResults)
295 296
296 expected_match_results = [ 297 expected_match_results = [
297 { 298 {
298 'reasons': [('TopFrameIndex', 1.0, 'Top frame is #0'), 299 'reasons': [('TopFrameIndex', 1.0, 'Top frame is #0'),
299 ('MinDistance', 1, 'Minimum distance is 0')], 300 ('MinDistance', 1, 'Minimum distance is 0')],
300 'changed_files': [{'info': 'Minimum distance (LOC) 0, frame #0', 301 'changed_files': [{'info': 'Minimum distance (LOC) 0, frame #0',
301 'blame_url': None, 'file': 'a.cc'}], 302 'blame_url': None, 'file': 'a.cc'}],
302 'time': 'Thu Mar 31 21:24:43 2016', 303 'time': 'Thu Mar 31 21:24:43 2016',
303 'author': 'r@chromium.org', 304 'author': 'r@chromium.org',
304 'url': 'https://repo.test/+/1', 305 'url': 'https://repo.test/+/1',
305 'project_path': 'src/', 306 'project_path': 'src/',
306 'review_url': 'https://codereview.chromium.org/3281', 307 'review_url': 'https://codereview.chromium.org/3281',
307 'confidence': 1.0, 'revision': '1' 308 'confidence': 1.0, 'revision': '1'
308 }, 309 },
309 ] 310 ]
310 311
311 regression_deps_rolls = {'src/': DependencyRoll('src/', 'https://repo', 312 regression_deps_rolls = {'src/': DependencyRoll('src/', 'https://repo',
312 '1', '2')} 313 '1', '2')}
313 314
314 results = findit_for_crash.FindItForCrash(Stacktrace(), 315 self.mock(chromium_deps, 'GetDEPSRollsDict', lambda *_: regression_deps_roll s)
315 regression_deps_rolls, {}, 7) 316 self.mock(chromium_deps, 'GetChromeDependency', lambda *_: {})
317 report = CrashReport(None, None, None, Stacktrace(), None)
318 results = changelist_classifier.ChangelistClassifier(7)(report)
316 self.assertEqual([result.ToDict() for result in results], 319 self.assertEqual([result.ToDict() for result in results],
317 expected_match_results) 320 expected_match_results)
318 321
319 def testFinditForCrashFilterZeroConfidentResults(self): 322 def testFinditForCrashFilterZeroConfidentResults(self):
320 def _MockFindMatchResults(*_): 323 def _MockFindMatchResults(*_):
321 match_result1 = MatchResult(DUMMY_CHANGELOG1, 'src/', '') 324 match_result1 = MatchResult(DUMMY_CHANGELOG1, 'src/', '')
322 frame1 = StackFrame(0, 'src/', 'func', 'a.cc', 'src/a.cc', [1]) 325 frame1 = StackFrame(0, 'src/', 'func', 'a.cc', 'src/a.cc', [1])
323 frame2 = StackFrame(1, 'src/', 'func', 'a.cc', 'src/a.cc', [7]) 326 frame2 = StackFrame(1, 'src/', 'func', 'a.cc', 'src/a.cc', [7])
324 match_result1.file_to_stack_infos = { 327 match_result1.file_to_stack_infos = {
325 'a.cc': [(frame1, 0), (frame2, 0)] 328 'a.cc': [(frame1, 0), (frame2, 0)]
(...skipping 15 matching lines...) Expand all
341 frame4 = StackFrame(3, 'src/', 'func', 'ff.cc', 'src/ff.cc', [1]) 344 frame4 = StackFrame(3, 'src/', 'func', 'ff.cc', 'src/ff.cc', [1])
342 match_result3.file_to_stack_infos = { 345 match_result3.file_to_stack_infos = {
343 'f.cc': [(frame4, 0)] 346 'f.cc': [(frame4, 0)]
344 } 347 }
345 match_result3.file_to_analysis_info = { 348 match_result3.file_to_analysis_info = {
346 'f.cc': {'min_distance': 60, 'min_distance_frame': frame4} 349 'f.cc': {'min_distance': 60, 'min_distance_frame': frame4}
347 } 350 }
348 351
349 return [match_result1, match_result2, match_result3] 352 return [match_result1, match_result2, match_result3]
350 353
351 self.mock(findit_for_crash, 'FindMatchResults', _MockFindMatchResults) 354 self.mock(changelist_classifier, 'FindMatchResults', _MockFindMatchResults)
352 355
353 expected_match_results = [ 356 expected_match_results = [
354 { 357 {
355 'author': 'r@chromium.org', 358 'author': 'r@chromium.org',
356 'changed_files': [ 359 'changed_files': [
357 { 360 {
358 'blame_url': None, 361 'blame_url': None,
359 'file': 'a.cc', 362 'file': 'a.cc',
360 'info': 'Minimum distance (LOC) 1, frame #0' 363 'info': 'Minimum distance (LOC) 1, frame #0'
361 } 364 }
362 ], 365 ],
363 'confidence': 0.8, 366 'confidence': 0.8,
364 'project_path': 'src/', 367 'project_path': 'src/',
365 'reasons': [ 368 'reasons': [
366 ('TopFrameIndex', 1.0, 'Top frame is #0'), 369 ('TopFrameIndex', 1.0, 'Top frame is #0'),
367 ('MinDistance', 0.8, 'Minimum distance is 1') 370 ('MinDistance', 0.8, 'Minimum distance is 1')
368 ], 371 ],
369 'review_url': 'https://codereview.chromium.org/3281', 372 'review_url': 'https://codereview.chromium.org/3281',
370 'revision': '1', 373 'revision': '1',
371 'time': 'Thu Mar 31 21:24:43 2016', 374 'time': 'Thu Mar 31 21:24:43 2016',
372 'url': 'https://repo.test/+/1' 375 'url': 'https://repo.test/+/1'
373 } 376 }
374 ] 377 ]
375 378
376 regression_deps_rolls = {'src/': DependencyRoll('src/', 'https://repo', 379 regression_deps_rolls = {'src/': DependencyRoll('src/', 'https://repo',
377 '1', '2')} 380 '1', '2')}
378 381
379 results = findit_for_crash.FindItForCrash(Stacktrace(), 382 self.mock(chromium_deps, 'GetDEPSRollsDict', lambda *_: regression_deps_roll s)
380 regression_deps_rolls, {}, 7) 383 self.mock(chromium_deps, 'GetChromeDependency', lambda *_: {})
384 report = CrashReport(None, None, None, Stacktrace(), None)
385 results = changelist_classifier.ChangelistClassifier(7)(report)
381 386
382 self.assertEqual([result.ToDict() for result in results], 387 self.assertEqual([result.ToDict() for result in results],
383 expected_match_results) 388 expected_match_results)
384 389
385 def testFinditForCrashAllMatchResultsWithZeroConfidences(self): 390 def testFinditForCrashAllMatchResultsWithZeroConfidences(self):
386 def _MockFindMatchResults(*_): 391 def _MockFindMatchResults(*_):
387 match_result1 = MatchResult(DUMMY_CHANGELOG1, 'src/', '') 392 match_result1 = MatchResult(DUMMY_CHANGELOG1, 'src/', '')
388 frame1 = StackFrame(20, 'src/', '', 'func', 'a.cc', [1]) 393 frame1 = StackFrame(20, 'src/', '', 'func', 'a.cc', [1])
389 frame2 = StackFrame(21, 'src/', '', 'func', 'a.cc', [7]) 394 frame2 = StackFrame(21, 'src/', '', 'func', 'a.cc', [7])
390 match_result1.file_to_stack_infos = { 395 match_result1.file_to_stack_infos = {
391 'a.cc': [(frame1, 0), (frame2, 0)] 396 'a.cc': [(frame1, 0), (frame2, 0)]
392 } 397 }
393 match_result1.file_to_analysis_info = { 398 match_result1.file_to_analysis_info = {
394 'a.cc': {'min_distance': 1, 'min_distance_frame': frame1} 399 'a.cc': {'min_distance': 1, 'min_distance_frame': frame1}
395 } 400 }
396 401
397 match_result2 = MatchResult(DUMMY_CHANGELOG3, 'src/', '') 402 match_result2 = MatchResult(DUMMY_CHANGELOG3, 'src/', '')
398 frame3 = StackFrame(15, 'src/', '', 'func', 'f.cc', [1]) 403 frame3 = StackFrame(15, 'src/', '', 'func', 'f.cc', [1])
399 match_result2.file_to_stack_infos = { 404 match_result2.file_to_stack_infos = {
400 'f.cc': [(frame3, 0)] 405 'f.cc': [(frame3, 0)]
401 } 406 }
402 match_result2.min_distance = 20 407 match_result2.min_distance = 20
403 match_result2.file_to_analysis_info = { 408 match_result2.file_to_analysis_info = {
404 'f.cc': {'min_distance': 20, 'min_distance_frame': frame3} 409 'f.cc': {'min_distance': 20, 'min_distance_frame': frame3}
405 } 410 }
406 411
407 return [match_result1, match_result2] 412 return [match_result1, match_result2]
408 413
409 self.mock(findit_for_crash, 'FindMatchResults', _MockFindMatchResults) 414 self.mock(changelist_classifier, 'FindMatchResults', _MockFindMatchResults)
410 415
411 regression_deps_rolls = {'src/': DependencyRoll('src/', 'https://repo', 416 regression_deps_rolls = {'src/': DependencyRoll('src/', 'https://repo',
412 '1', '2')} 417 '1', '2')}
413 418
414 self.assertEqual(findit_for_crash.FindItForCrash( 419 self.mock(chromium_deps, 'GetDEPSRollsDict', lambda *_: regression_deps_roll s)
415 Stacktrace(), regression_deps_rolls, {}, 7), []) 420 self.mock(chromium_deps, 'GetChromeDependency', lambda *_: {})
421 report = CrashReport(None, None, None, Stacktrace(), None)
422 self.assertEqual(changelist_classifier.ChangelistClassifier(7)(report), [])
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698