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

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

Issue 2903023002: [Telemetry] Do not have benchmarks validate story name in expectations during runs. (Closed)
Patch Set: [Telemetry] Do not have benchmarks validate story name in expectations during runs. Created 3 years, 6 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
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.PermanentlyDisableBenchmark( 14 self.PermanentlyDisableBenchmark(
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 ValidateAgainstStorySet(self, story_set): 27 def GetBrokenExpectations(self, story_set):
28 stories = [s.display_name for s in story_set.stories] 28 story_set_story_names = [s.display_name for s in story_set.stories]
29 for expectation in self._expectations: 29 invalid_story_names = []
30 if expectation not in stories: 30 for story_name in self._expectations:
31 raise TypeError('Story %s is not in the story set.' % expectation) 31 if story_name not in story_set_story_names:
32 invalid_story_names.append(story_name)
33 logging.error('Story %s is not in the story set.' % story_name)
34 return invalid_story_names
32 35
33 def SetExpectations(self): 36 def SetExpectations(self):
34 """Sets the Expectations for test disabling 37 """Sets the Expectations for test disabling
35 38
36 Override in subclasses to disable tests.""" 39 Override in subclasses to disable tests."""
37 pass 40 pass
38 41
39 def _Freeze(self): 42 def _Freeze(self):
40 self._frozen = True 43 self._frozen = True
41 44
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 ['mac', 'linux', 'win'], 'Desktop Platforms') 185 ['mac', 'linux', 'win'], 'Desktop Platforms')
183 ALL_MOBILE = _TestConditionByPlatformList(['android'], 'Mobile Platforms') 186 ALL_MOBILE = _TestConditionByPlatformList(['android'], 'Mobile Platforms')
184 ANDROID_NEXUS5 = _TestConditionByAndroidModel('Nexus 5') 187 ANDROID_NEXUS5 = _TestConditionByAndroidModel('Nexus 5')
185 ANDROID_NEXUS5X = _TestConditionByAndroidModel('Nexus 5X') 188 ANDROID_NEXUS5X = _TestConditionByAndroidModel('Nexus 5X')
186 ANDROID_NEXUS6 = _TestConditionByAndroidModel('Nexus 6') 189 ANDROID_NEXUS6 = _TestConditionByAndroidModel('Nexus 6')
187 ANDROID_NEXUS6P = _TestConditionByAndroidModel('Nexus 6P') 190 ANDROID_NEXUS6P = _TestConditionByAndroidModel('Nexus 6P')
188 ANDROID_NEXUS7 = _TestConditionByAndroidModel('Nexus 7') 191 ANDROID_NEXUS7 = _TestConditionByAndroidModel('Nexus 7')
189 ANDROID_ONE = _TestConditionByAndroidModel( 192 ANDROID_ONE = _TestConditionByAndroidModel(
190 'W6210', 'Cherry Mobile Android One') 193 'W6210', 'Cherry Mobile Android One')
191 ANDROID_SVELTE = _TestConditionAndroidSvelte() 194 ANDROID_SVELTE = _TestConditionAndroidSvelte()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698