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

Side by Side Diff: tracing/tracing/metrics/compare_samples_unittest.py

Issue 2527263004: [bisect] - Have compare_samples check for missing "summary" tracename. (Closed)
Patch Set: Created 4 years 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 | « tracing/tracing/metrics/compare_samples_cmdline.html ('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 2016 The Chromium Authors. All rights reserved. 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 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 json 5 import json
6 import math 6 import math
7 import os 7 import os
8 import random 8 import random
9 import tempfile 9 import tempfile
10 import unittest 10 import unittest
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 metric=metric, seed='lower%d' % i, mu=10, sigma=1, n=5) 188 metric=metric, seed='lower%d' % i, mu=10, sigma=1, n=5)
189 for i in range(4)]) 189 for i in range(4)])
190 higher_values = ','.join([ 190 higher_values = ','.join([
191 self.MakeChart( 191 self.MakeChart(
192 metric=metric, seed='higher%d' % i, mu=10.01, sigma=0.95, n=5) 192 metric=metric, seed='higher%d' % i, mu=10.01, sigma=0.95, n=5)
193 for i in range(4)]) 193 for i in range(4)])
194 result = json.loads(compare_samples.CompareSamples( 194 result = json.loads(compare_samples.CompareSamples(
195 lower_values, higher_values, '/'.join(metric)).stdout) 195 lower_values, higher_values, '/'.join(metric)).stdout)
196 self.assertEqual(result['result']['significance'], FAIL_TO_REJECT) 196 self.assertEqual(result['result']['significance'], FAIL_TO_REJECT)
197 197
198 def testCompareTIRLabel(self):
199 tir_metric = ('some_chart', 'some_label', 'some_trace')
200 tir_metric_name = ('%s@@%s' % (tir_metric[1], tir_metric[0]), tir_metric[2])
201 lower_values = ','.join([self.MakeChart(
202 metric=tir_metric_name, seed='lower', mu=10, sigma=1, n=10)])
203 higher_values = ','.join([self.MakeChart(
204 metric=tir_metric_name, seed='higher', mu=20, sigma=2, n=10)])
205 result = json.loads(compare_samples.CompareSamples(
206 lower_values, higher_values, '/'.join(tir_metric)).stdout)
207 self.assertEqual(result['result']['significance'], REJECT)
208
209 def testCompareTIRLabelMissingSummary(self):
210 tir_metric = ('some_chart', 'some_label')
211 tir_metric_name = ('%s@@%s' % (tir_metric[1], tir_metric[0]), 'summary')
212 lower_values = ','.join([self.MakeChart(
213 metric=tir_metric_name, seed='lower', mu=10, sigma=1, n=10)])
214 higher_values = ','.join([self.MakeChart(
215 metric=tir_metric_name, seed='higher', mu=20, sigma=2, n=10)])
216 result = json.loads(compare_samples.CompareSamples(
217 lower_values, higher_values, '/'.join(tir_metric)).stdout)
218 self.assertEqual(result['result']['significance'], REJECT)
219
198 def testCompareInsufficientData(self): 220 def testCompareInsufficientData(self):
199 metric = ('some_chart', 'some_trace') 221 metric = ('some_chart', 'some_trace')
200 lower_values = ','.join([self.MakeChart(metric=metric, seed='lower', 222 lower_values = ','.join([self.MakeChart(metric=metric, seed='lower',
201 mu=10, sigma=1, n=5)]) 223 mu=10, sigma=1, n=5)])
202 higher_values = ','.join([self.MakeChart(metric=metric, seed='higher', 224 higher_values = ','.join([self.MakeChart(metric=metric, seed='higher',
203 mu=10.40, sigma=0.95, n=5)]) 225 mu=10.40, sigma=0.95, n=5)])
204 result = json.loads(compare_samples.CompareSamples( 226 result = json.loads(compare_samples.CompareSamples(
205 lower_values, higher_values, '/'.join(metric)).stdout) 227 lower_values, higher_values, '/'.join(metric)).stdout)
206 self.assertEqual(result['result']['significance'], NEED_MORE_DATA) 228 self.assertEqual(result['result']['significance'], NEED_MORE_DATA)
207 229
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 keys = 'blank', 'about' 300 keys = 'blank', 'about'
279 lower_values = ','.join([self.MakeChart(metric=metric, seed='lower', 301 lower_values = ','.join([self.MakeChart(metric=metric, seed='lower',
280 mu=10, sigma=1, n=10, keys=keys)]) 302 mu=10, sigma=1, n=10, keys=keys)])
281 higher_values = ','.join([self.MakeChart(metric=metric, seed='higher', 303 higher_values = ','.join([self.MakeChart(metric=metric, seed='higher',
282 mu=20, sigma=2, n=10, keys=keys)]) 304 mu=20, sigma=2, n=10, keys=keys)])
283 result = compare_samples.CompareSamples( 305 result = compare_samples.CompareSamples(
284 lower_values, higher_values, full_metric_name).stdout 306 lower_values, higher_values, full_metric_name).stdout
285 print result 307 print result
286 result = json.loads(result) 308 result = json.loads(result)
287 self.assertEqual(result['result']['significance'], REJECT) 309 self.assertEqual(result['result']['significance'], REJECT)
OLDNEW
« no previous file with comments | « tracing/tracing/metrics/compare_samples_cmdline.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698