Chromium Code Reviews| 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.""" |