Skip to content

Commit

Permalink
[Telemetry] Get rid of last references to benchmark.Enabled/Disabled
Browse files Browse the repository at this point in the history
For benchmarks, this means moving to expectations. For unit tests this
means moving to decorators.Enabled()/Disabled()

TBR=bustamante@chromium.org

Bug: 713222
Cq-Include-Trybots: master.tryserver.chromium.android:android_cronet_tester
Change-Id: Ia67b2ce6734740770d33d012f7b557879c47321d
Reviewed-on: https://chromium-review.googlesource.com/663664
Commit-Queue: rnephew <rnephew@chromium.org>
Reviewed-by: Ned Nguyen <nednguyen@google.com>
Reviewed-by: Paul Jensen <pauljensen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#503550}
  • Loading branch information
randalnephew authored and Commit Bot committed Sep 21, 2017
1 parent dac9751 commit 1eaf2fb
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 42 deletions.
8 changes: 7 additions & 1 deletion components/cronet/android/test/javaperftests/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,10 @@ def Measure(self, platform, results):
'ms', jsonResults[test]))


@benchmark.Enabled('android')
class CronetPerfTestBenchmark(benchmark.Benchmark):
# Benchmark implementation spawning off Cronet perf test measurement and
# StorySet.
SUPPORTED_PLATFORMS = [story.expectations.ALL_ANDROID]

def __init__(self, max_failures=None):
super(CronetPerfTestBenchmark, self).__init__(max_failures)
Expand All @@ -221,6 +221,12 @@ def CreatePageTest(self, options):
def CreateStorySet(self, options):
return CronetPerfTestStorySet(self._device)

def GetExpectations(self):
class StoryExpectations(story.expectations.StoryExpectations):
def SetExpectations(self):
pass # Nothing disabled.
return StoryExpectations()


class QuicServer(object):

Expand Down
25 changes: 13 additions & 12 deletions tools/chrome_proxy/integration_tests/chrome_proxy_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from integration_tests import chrome_proxy_measurements as measurements
from integration_tests import chrome_proxy_pagesets as pagesets
from telemetry import benchmark
from telemetry import decorators

DESKTOP_PLATFORMS = ['mac', 'linux', 'win', 'chromeos']
WEBVIEW_PLATFORMS = ['android-webview', 'android-webview-instrumentation']
Expand Down Expand Up @@ -49,7 +50,7 @@ def Name(cls):
return 'chrome_proxy_benchmark.client_type.client_type'


@benchmark.Disabled(*WEBVIEW_PLATFORMS)
@decorators.Disabled(*WEBVIEW_PLATFORMS)
class ChromeProxyLoFi(ChromeProxyBenchmark):
tag = 'lo_fi'
test = measurements.ChromeProxyLoFi
Expand All @@ -60,7 +61,7 @@ def Name(cls):
return 'chrome_proxy_benchmark.lo_fi.lo_fi'


@benchmark.Disabled(*WEBVIEW_PLATFORMS)
@decorators.Disabled(*WEBVIEW_PLATFORMS)
class ChromeProxyCacheLoFiDisabled(ChromeProxyBenchmark):
tag = 'cache_lo_fi_disabled'
test = measurements.ChromeProxyCacheLoFiDisabled
Expand All @@ -71,7 +72,7 @@ def Name(cls):
return 'chrome_proxy_benchmark.lo_fi.cache_lo_fi_disabled'


@benchmark.Disabled(*WEBVIEW_PLATFORMS)
@decorators.Disabled(*WEBVIEW_PLATFORMS)
class ChromeProxyCacheProxyDisabled(ChromeProxyBenchmark):
tag = 'cache_proxy_disabled'
test = measurements.ChromeProxyCacheProxyDisabled
Expand All @@ -82,7 +83,7 @@ def Name(cls):
return 'chrome_proxy_benchmark.lo_fi.cache_proxy_disabled'


@benchmark.Disabled(*WEBVIEW_PLATFORMS)
@decorators.Disabled(*WEBVIEW_PLATFORMS)
class ChromeProxyLitePage(ChromeProxyBenchmark):
tag = 'lite_page'
test = measurements.ChromeProxyLitePage
Expand Down Expand Up @@ -143,7 +144,7 @@ def Name(cls):
return 'chrome_proxy_benchmark.html5test.html5test'


@benchmark.Enabled(*DESKTOP_PLATFORMS)
@decorators.Enabled(*DESKTOP_PLATFORMS)
class ChromeProxyYouTube(ChromeProxyBenchmark):
tag = 'youtube'
test = measurements.ChromeProxyYouTube
Expand Down Expand Up @@ -174,7 +175,7 @@ def Name(cls):
return 'chrome_proxy_benchmark.block_once.block_once'


@benchmark.Disabled(*(DESKTOP_PLATFORMS + WEBVIEW_PLATFORMS))
@decorators.Disabled(*(DESKTOP_PLATFORMS + WEBVIEW_PLATFORMS))
# Safebrowsing is enabled for Android and iOS.
class ChromeProxySafeBrowsingOn(ChromeProxyBenchmark):
tag = 'safebrowsing_on'
Expand All @@ -191,7 +192,7 @@ def Name(cls):
return 'chrome_proxy_benchmark.safebrowsing_on.safebrowsing'


@benchmark.Enabled(*(DESKTOP_PLATFORMS + WEBVIEW_PLATFORMS))
@decorators.Enabled(*(DESKTOP_PLATFORMS + WEBVIEW_PLATFORMS))
# Safebrowsing is switched off for Android Webview and all desktop platforms.
class ChromeProxySafeBrowsingOff(ChromeProxyBenchmark):
tag = 'safebrowsing_off'
Expand Down Expand Up @@ -283,7 +284,7 @@ def Name(cls):
return 'chrome_proxy_benchmark.client_config.synthetic'


@benchmark.Enabled(*DESKTOP_PLATFORMS)
@decorators.Enabled(*DESKTOP_PLATFORMS)
class ChromeProxyVideoDirect(benchmark.Benchmark):
tag = 'video'
test = measurements.ChromeProxyVideoValidation
Expand All @@ -294,7 +295,7 @@ def Name(cls):
return 'chrome_proxy_benchmark.video.direct'


@benchmark.Enabled(*DESKTOP_PLATFORMS)
@decorators.Enabled(*DESKTOP_PLATFORMS)
class ChromeProxyVideoProxied(benchmark.Benchmark):
tag = 'video'
test = measurements.ChromeProxyVideoValidation
Expand All @@ -305,7 +306,7 @@ def Name(cls):
return 'chrome_proxy_benchmark.video.proxied'


@benchmark.Enabled(*DESKTOP_PLATFORMS)
@decorators.Enabled(*DESKTOP_PLATFORMS)
class ChromeProxyVideoCompare(benchmark.Benchmark):
"""Comparison of direct and proxied video fetches.
Expand All @@ -321,7 +322,7 @@ class ChromeProxyVideoCompare(benchmark.Benchmark):
def Name(cls):
return 'chrome_proxy_benchmark.video.compare'

@benchmark.Enabled(*DESKTOP_PLATFORMS)
@decorators.Enabled(*DESKTOP_PLATFORMS)
class ChromeProxyVideoFrames(benchmark.Benchmark):
"""Check for video frames similar to original video."""

Expand All @@ -333,7 +334,7 @@ class ChromeProxyVideoFrames(benchmark.Benchmark):
def Name(cls):
return 'chrome_proxy_benchmark.video.frames'

@benchmark.Enabled(*DESKTOP_PLATFORMS)
@decorators.Enabled(*DESKTOP_PLATFORMS)
class ChromeProxyVideoAudio(benchmark.Benchmark):
"""Check that audio is similar to original video."""

Expand Down
5 changes: 1 addition & 4 deletions tools/perf/benchmarks/dromaeo.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from core import perf_benchmark

from telemetry import benchmark
from telemetry import decorators
from telemetry import page as page_module
from telemetry.page import legacy_page_test
from telemetry import story
Expand Down Expand Up @@ -191,8 +190,6 @@ def SetExpectations(self):
return StoryExpectations()


# Flaky on Windows: https://crbug.com/763263
@decorators.Disabled('win')
@benchmark.Owner(emails=['jbroman@chromium.org',
'yukishiino@chromium.org',
'haraken@chromium.org'])
Expand All @@ -211,5 +208,5 @@ def Name(cls):
def GetExpectations(self):
class StoryExpectations(story.expectations.StoryExpectations):
def SetExpectations(self):
pass # http://dromaeo.com?dom-traverse not disabled.
self.DisableBenchmark([story.expectations.ALL_WIN], 'crbug.com/763263')
return StoryExpectations()
15 changes: 6 additions & 9 deletions tools/perf/contrib/cros_benchmarks/page_cycler_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ def ShouldDisable(cls, possible_browser):
return False


@benchmark.Disabled('win10')
@benchmark.Disabled('android') # crbug.com/654217
@benchmark.Owner(emails=['kouhei@chromium.org', 'ksakamoto@chromium.org'])
class PageCyclerV2Typical25(_PageCyclerV2):
"""Page load time benchmark for a 25 typical web pages.
Expand All @@ -62,7 +60,7 @@ def CreateStorySet(self, options):
def GetExpectations(self):
class StoryExpectations(story.expectations.StoryExpectations):
def SetExpectations(self):
pass # Nothing disabled.
pass # Nothing disabled.
return StoryExpectations()


Expand All @@ -85,7 +83,7 @@ def CreateStorySet(self, options):
def GetExpectations(self):
class StoryExpectations(story.expectations.StoryExpectations):
def SetExpectations(self):
pass # Nothing disabled.
pass # Nothing disabled.
return StoryExpectations()


Expand All @@ -108,7 +106,7 @@ def CreateStorySet(self, options):
def GetExpectations(self):
class StoryExpectations(story.expectations.StoryExpectations):
def SetExpectations(self):
pass # Nothing disabled.
pass # Nothing disabled.
return StoryExpectations()


Expand All @@ -131,11 +129,10 @@ def CreateStorySet(self, options):
def GetExpectations(self):
class StoryExpectations(story.expectations.StoryExpectations):
def SetExpectations(self):
pass # Nothing disabled.
pass # Nothing disabled.
return StoryExpectations()


@benchmark.Disabled('android') # crbug.com/666898
@benchmark.Owner(emails=['kouhei@chromium.org', 'ksakamoto@chromium.org'])
class PageCyclerV2IntlJaZh(_PageCyclerV2):
"""Page load time benchmark for a variety of pages in Japanese and Chinese.
Expand All @@ -154,7 +151,7 @@ def CreateStorySet(self, options):
def GetExpectations(self):
class StoryExpectations(story.expectations.StoryExpectations):
def SetExpectations(self):
pass # Nothing disabled.
pass # Nothing disabled.
return StoryExpectations()


Expand All @@ -177,5 +174,5 @@ def CreateStorySet(self, options):
def GetExpectations(self):
class StoryExpectations(story.expectations.StoryExpectations):
def SetExpectations(self):
pass # Nothing disabled.
pass # Nothing disabled.
return StoryExpectations()
5 changes: 3 additions & 2 deletions tools/perf/contrib/cros_benchmarks/tab_switching_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

@benchmark.Owner(emails=['vovoy@chromium.org'],
component='OS>Performance')
@benchmark.Enabled('chromeos')
class CrosTabSwitchingTypical24(perf_benchmark.PerfBenchmark):
"""Measures tab switching performance with 24 tabs.
Expand All @@ -31,6 +30,8 @@ class CrosTabSwitchingTypical24(perf_benchmark.PerfBenchmark):
cros_tab_switching.typical_24 --tabset-repeat=5
"""
test = tab_switching_measure.CrosTabSwitchingMeasurement
SUPPORTED_PLATFORMS = [story.expectations.ALL_CHROMEOS]


@classmethod
def AddBenchmarkCommandLineArgs(cls, parser):
Expand All @@ -56,5 +57,5 @@ def Name(cls):
def GetExpectations(self):
class StoryExpectations(story.expectations.StoryExpectations):
def SetExpectations(self):
pass # No tests disabled.
pass # Nothing disabled.
return StoryExpectations()
6 changes: 3 additions & 3 deletions tools/perf/contrib/oilpan/oilpan_benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from contrib.oilpan import oilpan_gc_times

@benchmark.Enabled('content-shell')

class OilpanGCTimesBlinkPerfStress(perf_benchmark.PerfBenchmark):
tag = 'blink_perf_stress'
test = oilpan_gc_times.OilpanGCTimesForInternals
Expand Down Expand Up @@ -52,10 +52,10 @@ def SetExpectations(self):
return StoryExpectations()


@benchmark.Enabled('android')
class OilpanGCTimesKeySilkCases(perf_benchmark.PerfBenchmark):
test = oilpan_gc_times.OilpanGCTimesForSmoothness
page_set = page_sets.KeySilkCasesPageSet
SUPPORTED_PLATFORMS = [story.expectations.ALL_ANDROID]

@classmethod
def Name(cls):
Expand All @@ -73,11 +73,11 @@ def SetExpectations(self):
return StoryExpectations()


@benchmark.Enabled('android')
class OilpanGCTimesSyncScrollKeyMobileSites(perf_benchmark.PerfBenchmark):
tag = 'sync_scroll'
test = oilpan_gc_times.OilpanGCTimesForSmoothness
page_set = page_sets.KeyMobileSitesSmoothPageSet
SUPPORTED_PLATFORMS = [story.expectations.ALL_ANDROID]

def SetExtraBrowserOptions(self, options):
silk_flags.CustomizeBrowserOptionsForSyncScrolling(options)
Expand Down
11 changes: 6 additions & 5 deletions tools/perf/core/trybot_command_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from core import trybot_command
import mock
from telemetry import benchmark

from telemetry import decorators

class FakeProcess(object):

Expand Down Expand Up @@ -911,14 +911,15 @@ def testAttemptTryjobWithDepsRevisionArg(self):
self.assertEquals(output, sys.stdout.getvalue().strip())


# TODO(rnephew): Modernize these tests to use StoryExpectations.
class IsBenchmarkDisabledOnTrybotPlatformTest(unittest.TestCase):

def IsBenchmarkDisabled(self, benchmark_class, trybot_name):
return trybot_command.Trybot.IsBenchmarkDisabledOnTrybotPlatform(
benchmark_class, trybot_name)[0]

def testBenchmarkIsDisabledAll(self):
@benchmark.Disabled('all')
@decorators.Disabled('all')
class FooBenchmark(benchmark.Benchmark):
pass
self.assertTrue(self.IsBenchmarkDisabled(FooBenchmark, 'all'))
Expand All @@ -928,7 +929,7 @@ class FooBenchmark(benchmark.Benchmark):
self.assertTrue(self.IsBenchmarkDisabled(FooBenchmark, 'winx64ati'))

def testBenchmarkIsEnabledAll(self):
@benchmark.Enabled('all')
@decorators.Enabled('all')
class FooBenchmark(benchmark.Benchmark):
pass
self.assertFalse(self.IsBenchmarkDisabled(FooBenchmark, 'all'))
Expand All @@ -938,7 +939,7 @@ class FooBenchmark(benchmark.Benchmark):
self.assertFalse(self.IsBenchmarkDisabled(FooBenchmark, 'winx64ati'))

def testBenchmarkIsDisabledOnMultiplePlatforms(self):
@benchmark.Disabled('win', 'mac')
@decorators.Disabled('win', 'mac')
class FooBenchmark(benchmark.Benchmark):
pass
self.assertFalse(self.IsBenchmarkDisabled(FooBenchmark, 'all'))
Expand All @@ -949,7 +950,7 @@ class FooBenchmark(benchmark.Benchmark):
self.assertTrue(self.IsBenchmarkDisabled(FooBenchmark, 'winx64ati'))

def testBenchmarkIsEnabledOnMultiplePlatforms(self):
@benchmark.Enabled('win', 'mac')
@decorators.Enabled('win', 'mac')
class FooBenchmark(benchmark.Benchmark):
pass
self.assertFalse(self.IsBenchmarkDisabled(FooBenchmark, 'all'))
Expand Down
3 changes: 1 addition & 2 deletions tools/perf/measurements/clock_domain_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

from telemetry import benchmark
from telemetry import decorators
from telemetry.testing import tab_test_case
from telemetry.timeline import tracing_config
Expand All @@ -17,7 +16,7 @@ class ClockDomainTest(tab_test_case.TabTestCase):
# Don't run this test on Android; it's not supposed to work on Android
# (since when doing Android tracing there are two different devices,
# so the clock domains will be different)
@benchmark.Disabled('android')
@decorators.Disabled('android')
@decorators.Isolated
def testTelemetryUsesChromeClockDomain(self):

Expand Down
8 changes: 4 additions & 4 deletions tools/perf/measurements/tab_switching_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from measurements import tab_switching
import mock
from page_sets.system_health import multi_tab_stories
from telemetry import benchmark
from telemetry import decorators
from telemetry import story as story_module
from telemetry.internal.results import page_test_results
from telemetry.testing import page_test_test_case
Expand Down Expand Up @@ -95,9 +95,9 @@ def testIsDone(self):
[browser.tabs[-1]] * 2]
self.assertEqual(expected_calls, mock_get_histogram.mock_calls)

@benchmark.Enabled('has tabs')
@benchmark.Disabled('mac')
@benchmark.Disabled('android')
@decorators.Enabled('has tabs')
@decorators.Disabled('mac')
@decorators.Disabled('android')
def testTabSwitching(self):
"""IT of TabSwitching measurement and multi-tab story"""
ps = story_module.StorySet()
Expand Down

0 comments on commit 1eaf2fb

Please sign in to comment.