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

Side by Side Diff: telemetry/telemetry/story/expectations.py

Issue 3008203003: [Telemetry] Expose disable_stories in StoryExpectations api. (Closed)
Patch Set: diabled_stories -> AsDict() Created 3 years, 3 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 | « no previous file | 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 2017 The Chromium Authors. All rights reserved. 1 # Copyright 2017 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 logging 5 import logging
6 6
7 7
8 class StoryExpectations(object): 8 class StoryExpectations(object):
9 """An object that contains disabling expectations for benchmarks and stories. 9 """An object that contains disabling expectations for benchmarks and stories.
10 10
11 Example Usage: 11 Example Usage:
12 class FooBenchmarkExpectations(expectations.StoryExpectations): 12 class FooBenchmarkExpectations(expectations.StoryExpectations):
13 def SetExpectations(self): 13 def SetExpectations(self):
14 self.DisableBenchmark( 14 self.DisableBenchmark(
15 [expectations.ALL_MOBILE], 'Desktop Benchmark') 15 [expectations.ALL_MOBILE], 'Desktop Benchmark')
16 self.DisableStory('story_name1', [expectations.ALL_MAC], 'crbug.com/456') 16 self.DisableStory('story_name1', [expectations.ALL_MAC], 'crbug.com/456')
17 self.DisableStory('story_name2', [expectations.ALL], 'crbug.com/789') 17 self.DisableStory('story_name2', [expectations.ALL], 'crbug.com/789')
18 ... 18 ...
19 """ 19 """
20 def __init__(self): 20 def __init__(self):
21 self._disabled_platforms = [] 21 self._disabled_platforms = []
22 self._expectations = {} 22 self._expectations = {}
23 self._frozen = False 23 self._frozen = False
24 self.SetExpectations() 24 self.SetExpectations()
25 self._Freeze() 25 self._Freeze()
26 26
27 def AsDict(self):
28 """Returns information on disabled stories/benchmarks as a dictionary"""
29 return {
30 'platforms': self._disabled_platforms,
31 'stories': self._expectations
32 }
33
27 def GetBrokenExpectations(self, story_set): 34 def GetBrokenExpectations(self, story_set):
28 story_set_story_names = [s.name for s in story_set.stories] 35 story_set_story_names = [s.name for s in story_set.stories]
29 invalid_story_names = [] 36 invalid_story_names = []
30 for story_name in self._expectations: 37 for story_name in self._expectations:
31 if story_name not in story_set_story_names: 38 if story_name not in story_set_story_names:
32 invalid_story_names.append(story_name) 39 invalid_story_names.append(story_name)
33 logging.error('Story %s is not in the story set.' % story_name) 40 logging.error('Story %s is not in the story set.' % story_name)
34 return invalid_story_names 41 return invalid_story_names
35 42
36 def SetExpectations(self): 43 def SetExpectations(self):
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 # Mac 10.11 Perf, Mac Retina Perf, Mac Pro 10.11 Perf, Mac Air 10.11 Perf 263 # Mac 10.11 Perf, Mac Retina Perf, Mac Pro 10.11 Perf, Mac Air 10.11 Perf
257 MAC_10_11 = _TestConditionByMacVersion('10.11', 'Mac 10.11') 264 MAC_10_11 = _TestConditionByMacVersion('10.11', 'Mac 10.11')
258 # Mac 10_12 Includes: 265 # Mac 10_12 Includes:
259 # Mac 10.12 Perf, Mac Mini 8GB 10.12 Perf 266 # Mac 10.12 Perf, Mac Mini 8GB 10.12 Perf
260 MAC_10_12 = _TestConditionByMacVersion('10.12', 'Mac 10.12') 267 MAC_10_12 = _TestConditionByMacVersion('10.12', 'Mac 10.12')
261 268
262 ANDROID_NEXUS6_WEBVIEW = _TestConditionLogicalAndConditions( 269 ANDROID_NEXUS6_WEBVIEW = _TestConditionLogicalAndConditions(
263 [ANDROID_NEXUS6, ANDROID_WEBVIEW], 'Nexus6 Webview') 270 [ANDROID_NEXUS6, ANDROID_WEBVIEW], 'Nexus6 Webview')
264 ANDROID_NEXUS5X_WEBVIEW = _TestConditionLogicalAndConditions( 271 ANDROID_NEXUS5X_WEBVIEW = _TestConditionLogicalAndConditions(
265 [ANDROID_NEXUS5X, ANDROID_WEBVIEW], 'Nexus5X Webview') 272 [ANDROID_NEXUS5X, ANDROID_WEBVIEW], 'Nexus5X Webview')
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698