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

Side by Side Diff: scripts/slave/recipe_modules/auto_bisect/bisector_test.py

Issue 1782263002: Don't check improvement direction for return_code bisects. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « scripts/slave/recipe_modules/auto_bisect/bisector.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2015 The Chromium Authors. All rights reserved. 2 # Copyright 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import copy 6 import copy
7 import os 7 import os
8 import sys 8 import sys
9 import unittest 9 import unittest
10 10
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 # Improvement down, bad > good: should not fail 105 # Improvement down, bad > good: should not fail
106 self.bisect_config['improvement_direction'] = -1 106 self.bisect_config['improvement_direction'] = -1
107 bisector = auto_bisect.bisector.Bisector(self.dummy_api, self.bisect_config, 107 bisector = auto_bisect.bisector.Bisector(self.dummy_api, self.bisect_config,
108 MockRevisionClass) 108 MockRevisionClass)
109 bisector.good_rev.mean_value = 10 109 bisector.good_rev.mean_value = 10
110 bisector.bad_rev.mean_value = 100 110 bisector.bad_rev.mean_value = 100
111 self.assertTrue(bisector.check_improvement_direction()) 111 self.assertTrue(bisector.check_improvement_direction())
112 self.assertNotIn('direction of improvement', ''.join(bisector.warnings)) 112 self.assertNotIn('direction of improvement', ''.join(bisector.warnings))
113 113
114 def test_improvement_direction_return_code(self): 114 def test_improvement_direction_return_code(self):
115 # Good revision is bad or bad revision is good, should fail. 115 # The improvement direction check doesn't apply for return code bisects.
116 bisect_config = copy.deepcopy(self.bisect_config) 116 bisect_config = copy.deepcopy(self.bisect_config)
117 bisect_config['test_type'] = 'return_code' 117 bisect_config['test_type'] = 'return_code'
118 bisector = auto_bisect.bisector.Bisector(self.dummy_api, bisect_config, 118 bisector = auto_bisect.bisector.Bisector(self.dummy_api, bisect_config,
119 MockRevisionClass) 119 MockRevisionClass)
120 bisector.good_rev.mean_value = 1 120 bisector.good_rev.mean_value = 1
121 bisector.bad_rev.mean_value = 0 121 bisector.bad_rev.mean_value = 0
122 self.assertTrue(bisector.is_return_code_mode()) 122 self.assertTrue(bisector.is_return_code_mode())
123 self.assertFalse(bisector.check_improvement_direction()) 123 self.assertTrue(bisector.check_improvement_direction())
124 self.assertIn('return code', ''.join(bisector.warnings))
125 124
126 @mock.patch.object(auto_bisect.bisector.Bisector, 'significantly_different', 125 @mock.patch.object(auto_bisect.bisector.Bisector, 'significantly_different',
127 mock.MagicMock(return_value=True)) 126 mock.MagicMock(return_value=True))
128 def test_check_initial_confidence_pass(self): 127 def test_check_initial_confidence_pass(self):
129 # patch bisector.significantly_different with true 128 # patch bisector.significantly_different with true
130 # assert both revisions have > 5 samples 129 # assert both revisions have > 5 samples
131 bisector = auto_bisect.bisector.Bisector(self.dummy_api, self.bisect_config, 130 bisector = auto_bisect.bisector.Bisector(self.dummy_api, self.bisect_config,
132 MockRevisionClass) 131 MockRevisionClass)
133 bisector.good_rev.values = [3, 3, 3, 3, 3, 3] 132 bisector.good_rev.values = [3, 3, 3, 3, 3, 3]
134 bisector.bad_rev.values = [3, 3, 3, 3] 133 bisector.bad_rev.values = [3, 3, 3, 3]
(...skipping 20 matching lines...) Expand all
155 return_code_config['test_type'] = 'return_code' 154 return_code_config['test_type'] = 'return_code'
156 # When confidence is not required, confidence_score should not be called. 155 # When confidence is not required, confidence_score should not be called.
157 bisector = auto_bisect.bisector.Bisector(self.dummy_api, return_code_config, 156 bisector = auto_bisect.bisector.Bisector(self.dummy_api, return_code_config,
158 MockRevisionClass) 157 MockRevisionClass)
159 self.assertTrue(bisector.check_initial_confidence()) 158 self.assertTrue(bisector.check_initial_confidence())
160 self.assertFalse(bisector.significantly_different.called) 159 self.assertFalse(bisector.significantly_different.called)
161 160
162 161
163 if __name__ == '__main__': 162 if __name__ == '__main__':
164 unittest.main() # pragma: no cover 163 unittest.main() # pragma: no cover
OLDNEW
« no previous file with comments | « scripts/slave/recipe_modules/auto_bisect/bisector.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698