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

Unified Diff: tools/telemetry/telemetry/test.py

Issue 18576004: [telemetry] Add @RunOnBuildMastersNamed support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/test.py
diff --git a/tools/telemetry/telemetry/test.py b/tools/telemetry/telemetry/test.py
index f48a8823193c9c1cb83a2e4949fad32af8443575..27a0f6ae6da3d3071f0e43fb8d56ce7f3079af1d 100644
--- a/tools/telemetry/telemetry/test.py
+++ b/tools/telemetry/telemetry/test.py
@@ -6,13 +6,40 @@ from telemetry.page import page_set
from telemetry.page import page_test
+__all__ = ["Test", "RunOnMastersNamed"]
dtu 2013/07/03 01:25:43 single quotes
+
+
+def RunOnBuildMastersNamed(*build_master_names):
+ """
+ Indicates that the test should only run on a given set of buildbot masters.
+ """
+ assert build_master_names
+ def wrap(cls):
+ assert not cls._run_on_build_masters_named # pylint: disable=W0212
+ cls._run_on_build_masters_named = build_master_names # pylint: disable=W0212
+ return cls
+ return wrap
+
+
+def AddOptionsForRunDecoratorToParser(parser):
+ parser.add_option(
+ '--build-master-name',
+ help='Only runs tests with @RunOnMastersNamed(build_master_name)')
+
+
class Test(object):
"""Base class for a Telemetry test or benchmark.
A test packages a PageTest/PageMeasurement and a PageSet together.
"""
options = {}
- enabled = True
+ _run_on_build_masters_named = []
+
+ @classmethod
+ def CanRun(cls, options):
+ if not options.build_master_name:
+ return True
+ return options.build_master_name in cls._run_on_build_masters_named
def Run(self, options):
"""Run this test with the given options."""

Powered by Google App Engine
This is Rietveld 408576698