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

Side by Side Diff: tools/bisect-perf-regression_test.py

Issue 288843002: Fix bisect script to match a results with {mean, stddev} format. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « tools/bisect-perf-regression.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 # 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 math 5 import math
6 import unittest 6 import unittest
7 7
8 # Special import necessary because filename contains dash characters. 8 # Special import necessary because filename contains dash characters.
9 bisect_perf_module = __import__('bisect-perf-regression') 9 bisect_perf_module = __import__('bisect-perf-regression')
10 10
11 11
12 RESULTS_OUTPUT = """RESULT write_operations: write_operations= 23089 count
13 RESULT read_bytes_gpu: read_bytes_gpu= 35201 kb
14 RESULT write_bytes_gpu: write_bytes_gpu= 542 kb
15 RESULT telemetry_page_measurement_results: num_failed= 0 count
16 RESULT telemetry_page_measurement_results: num_errored= 0 count
17 *RESULT Total: Total_ref= %(value)s
18 """
19
20
12 class BisectPerfRegressionTest(unittest.TestCase): 21 class BisectPerfRegressionTest(unittest.TestCase):
13 """Test case for top-level functions in the bisect-perf-regrssion module.""" 22 """Test case for top-level functions in the bisect-perf-regrssion module."""
14 23
15 def setUp(self): 24 def setUp(self):
16 """Sets up the test environment before each test method.""" 25 """Sets up the test environment before each test method."""
17 pass 26 pass
18 27
19 def tearDown(self): 28 def tearDown(self):
20 """Cleans up the test environment after each test method.""" 29 """Cleans up the test environment after each test method."""
21 pass 30 pass
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 math.isnan(bisect_perf_module.CalculateRelativeChange(0, 1))) 130 math.isnan(bisect_perf_module.CalculateRelativeChange(0, 1)))
122 self.assertTrue( 131 self.assertTrue(
123 math.isnan(bisect_perf_module.CalculateRelativeChange(0, -1))) 132 math.isnan(bisect_perf_module.CalculateRelativeChange(0, -1)))
124 133
125 def testCalculateRelativeChangeWithNegatives(self): 134 def testCalculateRelativeChangeWithNegatives(self):
126 """Tests that relative change given is always positive.""" 135 """Tests that relative change given is always positive."""
127 self.assertEqual(3.0, bisect_perf_module.CalculateRelativeChange(-1, 2)) 136 self.assertEqual(3.0, bisect_perf_module.CalculateRelativeChange(-1, 2))
128 self.assertEqual(3.0, bisect_perf_module.CalculateRelativeChange(1, -2)) 137 self.assertEqual(3.0, bisect_perf_module.CalculateRelativeChange(1, -2))
129 self.assertEqual(1.0, bisect_perf_module.CalculateRelativeChange(-1, -2)) 138 self.assertEqual(1.0, bisect_perf_module.CalculateRelativeChange(-1, -2))
130 139
140 def testTryParseResultValuesFromOutputWithSingleValue(self):
141 """Tests result pattern <*>RESULT <graph>: <trace>= <value>"""
142 bisect_options = bisect_perf_module.BisectOptions()
143 bisect_instance = bisect_perf_module.BisectPerformanceMetrics(
144 None, bisect_options)
145 metrics = ['Total', 'Total_ref']
146 self.assertEqual(
147 [66.88], bisect_instance.TryParseResultValuesFromOutput(
148 metrics, RESULTS_OUTPUT % {'value': '66.88 kb'}))
149 self.assertEqual(
150 [66.88], bisect_instance.TryParseResultValuesFromOutput(
151 metrics, RESULTS_OUTPUT % {'value': '66.88kb'}))
152 self.assertEqual(
153 [66.88], bisect_instance.TryParseResultValuesFromOutput(
154 metrics, RESULTS_OUTPUT % {'value': ' 66.88 '}))
155 self.assertEqual(
156 [-66.88], bisect_instance.TryParseResultValuesFromOutput(
157 metrics, RESULTS_OUTPUT % {'value': ' -66.88 kb'}))
158 self.assertEqual(
159 [66], bisect_instance.TryParseResultValuesFromOutput(
160 metrics, RESULTS_OUTPUT % {'value': '66 kb'}))
161 self.assertEqual(
162 [.66], bisect_instance.TryParseResultValuesFromOutput(
163 metrics, RESULTS_OUTPUT % {'value': '.66 kb'}))
164 self.assertEqual(
165 [], bisect_instance.TryParseResultValuesFromOutput(
166 metrics, RESULTS_OUTPUT % {'value': '. kb'}))
167 self.assertEqual(
168 [], bisect_instance.TryParseResultValuesFromOutput(
169 metrics, RESULTS_OUTPUT % {'value': 'aaa kb'}))
170
171 def testTryParseResultValuesFromOutputWithMulitValue(self):
172 """Tests result pattern <*>RESULT <graph>: <trace>= [<value>,<value>, ..]"""
173 bisect_options = bisect_perf_module.BisectOptions()
174 bisect_instance = bisect_perf_module.BisectPerformanceMetrics(
175 None, bisect_options)
176 metrics = ['Total', 'Total_ref']
177 self.assertEqual(
178 [66.88], bisect_instance.TryParseResultValuesFromOutput(
179 metrics, RESULTS_OUTPUT % {'value': '[66.88] kb'}))
180 self.assertEqual(
181 [66.88, 99.44], bisect_instance.TryParseResultValuesFromOutput(
182 metrics, RESULTS_OUTPUT % {'value': '[66.88, 99.44]kb'}))
183 self.assertEqual(
184 [66.88, 99.44], bisect_instance.TryParseResultValuesFromOutput(
185 metrics, RESULTS_OUTPUT % {'value': '[ 66.88, 99.44 ]'}))
186 self.assertEqual(
187 [-66.88, 99.44], bisect_instance.TryParseResultValuesFromOutput(
188 metrics, RESULTS_OUTPUT % {'value': '[-66.88,99.44] kb'}))
189 self.assertEqual(
190 [-66, 99], bisect_instance.TryParseResultValuesFromOutput(
191 metrics, RESULTS_OUTPUT % {'value': '[-66,99] kb'}))
192 self.assertEqual(
193 [-66, 99], bisect_instance.TryParseResultValuesFromOutput(
194 metrics, RESULTS_OUTPUT % {'value': '[-66,99,] kb'}))
195 self.assertEqual(
196 [.66, .99], bisect_instance.TryParseResultValuesFromOutput(
197 metrics, RESULTS_OUTPUT % {'value': '[.66,.99] kb'}))
198 self.assertEqual(
199 [], bisect_instance.TryParseResultValuesFromOutput(
200 metrics, RESULTS_OUTPUT % {'value': '[] kb'}))
201 self.assertEqual(
202 [], bisect_instance.TryParseResultValuesFromOutput(
203 metrics, RESULTS_OUTPUT % {'value': '[-66,abc] kb'}))
204
205 def testTryParseResultValuesFromOutputWithMeanStd(self):
206 """Tests result pattern <*>RESULT <graph>: <trace>= {<mean, std}"""
207 bisect_options = bisect_perf_module.BisectOptions()
208 bisect_instance = bisect_perf_module.BisectPerformanceMetrics(
209 None, bisect_options)
210 metrics = ['Total', 'Total_ref']
211 self.assertEqual(
212 [33.22], bisect_instance.TryParseResultValuesFromOutput(
213 metrics, RESULTS_OUTPUT % {'value': '{33.22, 3.6} kb'}))
214 self.assertEqual(
215 [33.22], bisect_instance.TryParseResultValuesFromOutput(
216 metrics, RESULTS_OUTPUT % {'value': '{33.22,3.6}kb'}))
217 self.assertEqual(
218 [33.22], bisect_instance.TryParseResultValuesFromOutput(
219 metrics, RESULTS_OUTPUT % {'value': '{33.22,3.6} kb'}))
220 self.assertEqual(
221 [33.22], bisect_instance.TryParseResultValuesFromOutput(
222 metrics, RESULTS_OUTPUT % {'value': '{ 33.22,3.6 }kb'}))
223 self.assertEqual(
224 [-33.22], bisect_instance.TryParseResultValuesFromOutput(
225 metrics, RESULTS_OUTPUT % {'value': '{-33.22,3.6}kb'}))
226 self.assertEqual(
227 [22], bisect_instance.TryParseResultValuesFromOutput(
228 metrics, RESULTS_OUTPUT % {'value': '{22,6}kb'}))
229 self.assertEqual(
230 [.22], bisect_instance.TryParseResultValuesFromOutput(
231 metrics, RESULTS_OUTPUT % {'value': '{.22,6}kb'}))
232 self.assertEqual(
233 [], bisect_instance.TryParseResultValuesFromOutput(
234 metrics, RESULTS_OUTPUT % {'value': '{.22,6, 44}kb'}))
235 self.assertEqual(
236 [], bisect_instance.TryParseResultValuesFromOutput(
237 metrics, RESULTS_OUTPUT % {'value': '{}kb'}))
238 self.assertEqual(
239 [], bisect_instance.TryParseResultValuesFromOutput(
240 metrics, RESULTS_OUTPUT % {'value': '{XYZ}kb'}))
241
131 242
132 if __name__ == '__main__': 243 if __name__ == '__main__':
133 unittest.main() 244 unittest.main()
OLDNEW
« no previous file with comments | « tools/bisect-perf-regression.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698