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

Unified Diff: appengine/findit/crash/test/findit_for_crash_test.py

Issue 2157433002: [Findit] Pass changed files info to Fracas, 2 face design. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Fix nits. Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/findit/crash/test/crash_test_suite.py ('k') | appengine/findit/crash/test/parse_util_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/findit/crash/test/findit_for_crash_test.py
diff --git a/appengine/findit/crash/test/findit_for_crash_test.py b/appengine/findit/crash/test/findit_for_crash_test.py
index acaa18288ebaed91c46df29dd4f3d8a1e3c43b6b..348f0084f920f0e154b39f7071cf229ff948faa3 100644
--- a/appengine/findit/crash/test/findit_for_crash_test.py
+++ b/appengine/findit/crash/test/findit_for_crash_test.py
@@ -237,8 +237,9 @@ class FinditForCrashTest(CrashTestSuite):
'project_path': 'src/',
'author': 'r@chromium.org',
'time': 'Thu Mar 31 21:24:43 2016',
- 'reason': None,
+ 'reasons': None,
'confidence': None,
+ 'changed_files': None
}]
match_results = findit_for_crash.FindMatchResults(
@@ -267,21 +268,23 @@ class FinditForCrashTest(CrashTestSuite):
def _MockFindMatchResults(*_):
match_result1 = MatchResult(DUMMY_CHANGELOG1, 'src/', '')
+ frame1 = StackFrame(0, 'src/', 'func', 'a.cc', 'src/a.cc', [1])
+ frame2 = StackFrame(1, 'src/', 'func', 'a.cc', 'src/a.cc', [7])
match_result1.file_to_stack_infos = {
- 'a.cc': [
- (StackFrame(0, 'src/', 'func', 'a.cc', 'src/a.cc', [1]), 0),
- (StackFrame(1, 'src/', 'func', 'a.cc', 'src/a.cc', [7]), 0),
- ]
+ 'a.cc': [(frame1, 0), (frame2, 0)]
+ }
+ match_result1.file_to_analysis_info = {
+ 'a.cc': {'min_distance': 0, 'min_distance_frame': frame1}
}
- match_result1.min_distance = 0
match_result2 = MatchResult(DUMMY_CHANGELOG3, 'src/', '')
+ frame3 = StackFrame(5, 'src/', 'func', 'f.cc', 'src/f.cc', [1])
match_result2.file_to_stack_infos = {
- 'f.cc': [
- (StackFrame(5, 'src/', 'func', 'f.cc', 'src/f.cc', [1]), 0),
- ]
+ 'f.cc': [(frame3, 0)]
+ }
+ match_result2.file_to_analysis_info = {
+ 'a.cc': {'min_distance': 20, 'min_distance_frame': frame3}
}
- match_result2.min_distance = 20
return [match_result1, match_result2]
@@ -289,16 +292,17 @@ class FinditForCrashTest(CrashTestSuite):
expected_match_results = [
{
- 'reason': ('(1) Modified top crashing frame is #0\n'
- '(2) Modification distance (LOC) is 0\n\n'
- 'Changed file a.cc crashed in frame #0, frame #1'),
- 'time': 'Thu Mar 31 21:24:43 2016',
- 'author': 'r@chromium.org',
- 'url': 'https://repo.test/+/1',
- 'project_path': 'src/',
- 'review_url': 'https://codereview.chromium.org/3281',
- 'confidence': 1.0, 'revision': '1'
- },
+ 'reasons': [('TopFrameIndex', 1.0, 'Top frame is #0'),
+ ('MinDistance', 1, 'Minimum distance is 0')],
+ 'changed_files': [{'info': 'Minimum distance (LOC) 0, frame #0',
+ 'blame_url': None, 'file': 'a.cc'}],
+ 'time': 'Thu Mar 31 21:24:43 2016',
+ 'author': 'r@chromium.org',
+ 'url': 'https://repo.test/+/1',
+ 'project_path': 'src/',
+ 'review_url': 'https://codereview.chromium.org/3281',
+ 'confidence': 1.0, 'revision': '1'
+ },
]
regression_deps_rolls = {'src/': DependencyRoll('src/', 'https://repo',
@@ -312,29 +316,32 @@ class FinditForCrashTest(CrashTestSuite):
def testFinditForCrashFilterZeroConfidentResults(self):
def _MockFindMatchResults(*_):
match_result1 = MatchResult(DUMMY_CHANGELOG1, 'src/', '')
+ frame1 = StackFrame(0, 'src/', 'func', 'a.cc', 'src/a.cc', [1])
+ frame2 = StackFrame(1, 'src/', 'func', 'a.cc', 'src/a.cc', [7])
match_result1.file_to_stack_infos = {
- 'a.cc': [
- (StackFrame(0, 'src/', 'func', 'a.cc', 'src/a.cc', [1]), 0),
- (StackFrame(1, 'src/', 'func', 'a.cc', 'src/a.cc', [7]), 0),
- ]
+ 'a.cc': [(frame1, 0), (frame2, 0)]
+ }
+ match_result1.file_to_analysis_info = {
+ 'a.cc': {'min_distance': 1, 'min_distance_frame': frame1}
}
- match_result1.min_distance = 1
match_result2 = MatchResult(DUMMY_CHANGELOG3, 'src/', '')
+ frame3 = StackFrame(15, 'src/', 'func', 'f.cc', 'src/f.cc', [1])
match_result2.file_to_stack_infos = {
- 'f.cc': [
- (StackFrame(15, 'src/', 'func', 'f.cc', 'src/f.cc', [1]), 0),
- ]
+ 'f.cc': [(frame3, 0)]
+ }
+ match_result2.file_to_analysis_info = {
+ 'f.cc': {'min_distance': 20, 'min_distance_frame': frame3}
}
- match_result2.min_distance = 20
match_result3 = MatchResult(DUMMY_CHANGELOG3, 'src/', '')
+ frame4 = StackFrame(3, 'src/', 'func', 'ff.cc', 'src/ff.cc', [1])
match_result3.file_to_stack_infos = {
- 'f.cc': [
- (StackFrame(3, 'src/', 'func', 'ff.cc', 'src/ff.cc', [1]), 0),
- ]
+ 'f.cc': [(frame4, 0)]
+ }
+ match_result3.file_to_analysis_info = {
+ 'f.cc': {'min_distance': 60, 'min_distance_frame': frame4}
}
- match_result3.min_distance = 60
return [match_result1, match_result2, match_result3]
@@ -342,16 +349,25 @@ class FinditForCrashTest(CrashTestSuite):
expected_match_results = [
{
- 'reason': ('(1) Modified top crashing frame is #0\n'
- '(2) Modification distance (LOC) is 1\n\n'
- 'Changed file a.cc crashed in frame #0, frame #1'),
- 'time': 'Thu Mar 31 21:24:43 2016',
'author': 'r@chromium.org',
- 'url': 'https://repo.test/+/1',
+ 'changed_files': [
+ {
+ 'blame_url': None,
+ 'file': 'a.cc',
+ 'info': 'Minimum distance (LOC) 1, frame #0'
+ }
+ ],
+ 'confidence': 0.8,
'project_path': 'src/',
+ 'reasons': [
+ ('TopFrameIndex', 1.0, 'Top frame is #0'),
+ ('MinDistance', 0.8, 'Minimum distance is 1')
+ ],
'review_url': 'https://codereview.chromium.org/3281',
- 'confidence': 0.8, 'revision': '1'
- },
+ 'revision': '1',
+ 'time': 'Thu Mar 31 21:24:43 2016',
+ 'url': 'https://repo.test/+/1'
+ }
]
regression_deps_rolls = {'src/': DependencyRoll('src/', 'https://repo',
@@ -359,27 +375,31 @@ class FinditForCrashTest(CrashTestSuite):
results = findit_for_crash.FindItForCrash(Stacktrace(),
regression_deps_rolls, {})
+
self.assertEqual([result.ToDict() for result in results],
expected_match_results)
def testFinditForCrashAllMatchResultsWithZeroConfidences(self):
def _MockFindMatchResults(*_):
match_result1 = MatchResult(DUMMY_CHANGELOG1, 'src/', '')
+ frame1 = StackFrame(20, 'src/', '', 'func', 'a.cc', [1])
+ frame2 = StackFrame(21, 'src/', '', 'func', 'a.cc', [7])
match_result1.file_to_stack_infos = {
- 'a.cc': [
- (StackFrame(20, 'src/', '', 'func', 'a.cc', [1]), 0),
- (StackFrame(21, 'src/', '', 'func', 'a.cc', [7]), 0),
- ]
+ 'a.cc': [(frame1, 0), (frame2, 0)]
+ }
+ match_result1.file_to_analysis_info = {
+ 'a.cc': {'min_distance': 1, 'min_distance_frame': frame1}
}
- match_result1.min_distance = 1
match_result2 = MatchResult(DUMMY_CHANGELOG3, 'src/', '')
+ frame3 = StackFrame(15, 'src/', '', 'func', 'f.cc', [1])
match_result2.file_to_stack_infos = {
- 'f.cc': [
- (StackFrame(15, 'src/', '', 'func', 'f.cc', [1]), 0),
- ]
+ 'f.cc': [(frame3, 0)]
}
match_result2.min_distance = 20
+ match_result2.file_to_analysis_info = {
+ 'f.cc': {'min_distance': 20, 'min_distance_frame': frame3}
+ }
return [match_result1, match_result2]
« no previous file with comments | « appengine/findit/crash/test/crash_test_suite.py ('k') | appengine/findit/crash/test/parse_util_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698