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

Side by Side Diff: appengine/findit/crash/scorers/test/aggregator_test.py

Issue 1861373003: [Findit] Initial code of findit for crash. Add scorers to apply heuristic rules. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Address comments Created 4 years, 8 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
(Empty)
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
3 # found in the LICENSE file.
4
5 from common.change_log import ChangeLog
6 from crash.callstack import StackFrame
7 from crash.results import MatchResult
8 from crash.scorers.aggregator import Aggregator
9 from crash.scorers.min_distance import MinDistance
10 from crash.scorers.test.scorer_test_suite import ScorerTestSuite
11 from crash.scorers.top_frame_index import TopFrameIndex
12
13
14 class AggregatorTest(ScorerTestSuite):
15
16 def testScoreAndReason(self):
17 result = MatchResult(self._GetDummyChangeLog(), 'src/', '')
18 result.file_to_stack_infos = {
19 'a.cc': [(StackFrame(0, 'src/', '', 'func', 'a.cc', [7]), 0)]
20 }
21 result.min_distance = 0
22
23 aggregator = Aggregator([TopFrameIndex(), MinDistance()])
24 aggregator.ScoreAndReason(result)
25
26 self.assertEqual(result.confidence, 1)
27 self.assertEqual(result.reason,
28 ('1. Top frame changed is frame #0 (score: 1)\n'
29 '2. Minimum distance to crashed line is 0 (score: 1)\n'
30 '\nChanged file a.cc which crashed in func (#0)'))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698