OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 import unittest | 5 import unittest |
6 | 6 |
7 from auto_bisect import source_control as source_control_module | 7 from auto_bisect import source_control as source_control_module |
8 | 8 |
9 # Special import necessary because filename contains dash characters. | 9 # Special import necessary because filename contains dash characters. |
10 bisect_perf_module = __import__('bisect-perf-regression') | 10 bisect_perf_module = __import__('bisect-perf-regression') |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 def testConfidenceScore_EmptySample(self): | 55 def testConfidenceScore_EmptySample(self): |
56 # Confidence is zero if either or both samples are empty. | 56 # Confidence is zero if either or both samples are empty. |
57 self._AssertConfidence(0.0, [], []) | 57 self._AssertConfidence(0.0, [], []) |
58 self._AssertConfidence(0.0, [], [1.1, 1.2, 1.1, 1.2, 1.0, 1.3, 1.2, 1.3]) | 58 self._AssertConfidence(0.0, [], [1.1, 1.2, 1.1, 1.2, 1.0, 1.3, 1.2, 1.3]) |
59 self._AssertConfidence(0.0, [1.1, 1.2, 1.1, 1.2, 1.0, 1.3, 1.2, 1.3], []) | 59 self._AssertConfidence(0.0, [1.1, 1.2, 1.1, 1.2, 1.0, 1.3, 1.2, 1.3], []) |
60 | 60 |
61 def testConfidenceScore_FunctionalTestResults(self): | 61 def testConfidenceScore_FunctionalTestResults(self): |
62 self._AssertConfidence(80.0, [1, 1, 0, 1, 1, 1, 0, 1], [0, 0, 1, 0, 1, 0]) | 62 self._AssertConfidence(80.0, [1, 1, 0, 1, 1, 1, 0, 1], [0, 0, 1, 0, 1, 0]) |
63 self._AssertConfidence(99.9, [1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]) | 63 self._AssertConfidence(99.9, [1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]) |
64 | 64 |
| 65 def testConfidenceScore_RealWorldCases(self): |
| 66 """This method contains a set of data from actual bisect results. |
| 67 |
| 68 The confidence scores asserted below were all copied from the actual |
| 69 results, so the purpose of this test method is mainly to show what the |
| 70 results for real cases are, and compare when we change the confidence |
| 71 score function in the future. |
| 72 """ |
| 73 self._AssertConfidence(80, [133, 130, 132, 132, 130, 129], [129, 129, 125]) |
| 74 self._AssertConfidence(99.5, [668, 667], [498, 498, 499]) |
| 75 self._AssertConfidence(80, [67, 68], [65, 65, 67]) |
| 76 self._AssertConfidence(0, [514], [514]) |
| 77 self._AssertConfidence(90, [616, 613, 607, 615], [617, 619, 619, 617]) |
| 78 self._AssertConfidence(0, [3.5, 5.8, 4.7, 3.5, 3.6], [2.8]) |
| 79 self._AssertConfidence(90, [3, 3, 3], [2, 2, 2, 3]) |
| 80 self._AssertConfidence(0, [1999004, 1999627], [223355]) |
| 81 self._AssertConfidence(90, [1040, 934, 961], [876, 875, 789]) |
| 82 self._AssertConfidence(90, [309, 305, 304], [302, 302, 299, 303, 298]) |
| 83 |
65 def testParseDEPSStringManually(self): | 84 def testParseDEPSStringManually(self): |
66 """Tests DEPS parsing.""" | 85 """Tests DEPS parsing.""" |
67 deps_file_contents = """ | 86 deps_file_contents = """ |
68 vars = { | 87 vars = { |
69 'ffmpeg_hash': | 88 'ffmpeg_hash': |
70 '@ac4a9f31fe2610bd146857bbd55d7a260003a888', | 89 '@ac4a9f31fe2610bd146857bbd55d7a260003a888', |
71 'webkit_url': | 90 'webkit_url': |
72 'https://chromium.googlesource.com/chromium/blink.git', | 91 'https://chromium.googlesource.com/chromium/blink.git', |
73 'git_url': | 92 'git_url': |
74 'https://chromium.googlesource.com', | 93 'https://chromium.googlesource.com', |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 source_control, bisect_options) | 242 source_control, bisect_options) |
224 results = bisect_instance.Run(bisect_options.command, | 243 results = bisect_instance.Run(bisect_options.command, |
225 bisect_options.bad_revision, | 244 bisect_options.bad_revision, |
226 bisect_options.good_revision, | 245 bisect_options.good_revision, |
227 bisect_options.metric) | 246 bisect_options.metric) |
228 bisect_instance.FormatAndPrintResults(results) | 247 bisect_instance.FormatAndPrintResults(results) |
229 | 248 |
230 | 249 |
231 if __name__ == '__main__': | 250 if __name__ == '__main__': |
232 unittest.main() | 251 unittest.main() |
OLD | NEW |