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

Unified 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: Fix nits and rebase 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 side-by-side diff with in-line comments
Download patch
Index: appengine/findit/crash/scorers/test/aggregator_test.py
diff --git a/appengine/findit/crash/scorers/test/aggregator_test.py b/appengine/findit/crash/scorers/test/aggregator_test.py
new file mode 100644
index 0000000000000000000000000000000000000000..1d80bc1b3238944ada7cd325f6a41357df2caf77
--- /dev/null
+++ b/appengine/findit/crash/scorers/test/aggregator_test.py
@@ -0,0 +1,29 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from crash.callstack import StackFrame
+from crash.results import MatchResult
+from crash.scorers.aggregator import Aggregator
+from crash.scorers.min_distance import MinDistance
+from crash.scorers.test.scorer_test_suite import ScorerTestSuite
+from crash.scorers.top_frame_index import TopFrameIndex
+
+
+class AggregatorTest(ScorerTestSuite):
+
+ def testScoreAndReason(self):
+ result = MatchResult(self._GetDummyChangeLog(), 'src/', '')
+ result.file_to_stack_infos = {
+ 'a.cc': [(StackFrame(0, 'src/', '', 'func', 'a.cc', [7]), 0)]
+ }
+ result.min_distance = 0
+
+ aggregator = Aggregator([TopFrameIndex(), MinDistance()])
+ aggregator.ScoreAndReason(result)
+
+ self.assertEqual(result.confidence, 1)
+ self.assertEqual(result.reason,
+ ('1. Top frame changed is frame #0 (score: 1)\n'
+ '2. Minimum distance to crashed line is 0 (score: 1)\n'
+ '\nChanged file a.cc which crashed in func (#0)'))
« no previous file with comments | « appengine/findit/crash/scorers/test/__init__.py ('k') | appengine/findit/crash/scorers/test/min_distance_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698