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

Unified Diff: telemetry/telemetry/story/expectations.py

Issue 2913383005: [Telemetry] Add temporary disabling of benchmark to story expectations. (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
Index: telemetry/telemetry/story/expectations.py
diff --git a/telemetry/telemetry/story/expectations.py b/telemetry/telemetry/story/expectations.py
index 3626f143397a52805c110585ac06744fe292d6e0..1bf43c2cd3d1ca3086091675a1455c923e06d332 100644
--- a/telemetry/telemetry/story/expectations.py
+++ b/telemetry/telemetry/story/expectations.py
@@ -18,7 +18,8 @@ class StoryExpectations(object):
...
"""
def __init__(self):
- self._disabled_platforms = []
+ self._permanently_disabled_platforms = []
+ self._temporarily_disabled_platforms = []
self._expectations = {}
self._frozen = False
self.SetExpectations()
@@ -42,6 +43,28 @@ class StoryExpectations(object):
def _Freeze(self):
self._frozen = True
+ def TemporarilyDisableBenchmark(self, conditions, reason):
+ """Temporarily Disable benchmark under the given conditions.
+
+ This means that if --also-run-disabled-tests is passed, the benchmark will
+ run.
+
+ Example:
+ TemporarilyDisableBenchmark(
+ [expectations.ALL_MOBILE], 'crbug.com/123')
+
+ Args:
+ conditions: List of _TestCondition subclasses.
+ reason: Reason for disabling the benchmark.
+ """
+ assert reason, 'A reason for disabling must be given.'
+ assert not self._frozen, ('Cannot disable benchmark on a frozen '
+ 'StoryExpectation object.')
+ for condition in conditions:
+ assert isinstance(condition, _TestCondition)
+
+ self._temporarily_disabled_platforms.append((conditions, reason))
+
def PermanentlyDisableBenchmark(self, conditions, reason):
"""Permanently Disable benchmark under the given conditions.
@@ -64,15 +87,29 @@ class StoryExpectations(object):
for condition in conditions:
assert isinstance(condition, _TestCondition)
- self._disabled_platforms.append((conditions, reason))
+ self._permanently_disabled_platforms.append((conditions, reason))
+
+ def IsBenchmarkTemporarilyDisabled(self, platform, finder_options):
+ """Returns reason benchmark is disabled, or None if not disabled.
+
+ Args:
+ platform: A platform object.
+ """
+ for conditions, reason in self._temporarily_disabled_platforms:
+ for condition in conditions:
+ if condition.ShouldDisable(platform, finder_options):
+ logging.info('Benchmark permanently disabled on %s due to %s.',
+ condition, reason)
+ return reason
+ return None
- def IsBenchmarkDisabled(self, platform, finder_options):
- """Returns the reason the benchmark was disabled, or None if not disabled.
+ def IsBenchmarkPermanentlyDisabled(self, platform, finder_options):
+ """Returns reason benchmark is permanently disabled, or None if not disabled
Args:
platform: A platform object.
"""
- for conditions, reason in self._disabled_platforms:
+ for conditions, reason in self._permanently_disabled_platforms:
for condition in conditions:
if condition.ShouldDisable(platform, finder_options):
logging.info('Benchmark permanently disabled on %s due to %s.',
« no previous file with comments | « telemetry/telemetry/internal/story_runner_unittest.py ('k') | telemetry/telemetry/story/expectations_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698