Commit f14b5b44 authored by dyen's avatar dyen Committed by Commit bot

Separate GPU Trace Test into 2 tests.

Not all devices support GPU Tracing, but it is still useful to
be able run a trace test which tests whether or not traces are
properly plumbed all the way through the stack.

This CL separates out trace tests into 2 different tests, the
original "trace_test" only tests the CPU side and does not test
anything on the GPU. The "device_trace_test" will be used to test
whether or not GPU traces are working properly on devices which
support it.

Currently the device trace test is set to skip unconditionally.
Once we have the recipes set up to run the "device_trace_test" we
can enable this for devices that support it.

BUG=455324
TEST=trybots

Review URL: https://codereview.chromium.org/874023003

Cr-Commit-Position: refs/heads/master@{#314614}
parent 950b89fb
...@@ -8,11 +8,12 @@ from telemetry import benchmark ...@@ -8,11 +8,12 @@ from telemetry import benchmark
from telemetry.page import page_test from telemetry.page import page_test
from telemetry.core.platform import tracing_category_filter from telemetry.core.platform import tracing_category_filter
from telemetry.core.platform import tracing_options from telemetry.core.platform import tracing_options
from telemetry.timeline import model from telemetry.timeline import model as model_module
TOPLEVEL_GL_CATEGORY = 'gpu_toplevel' TOPLEVEL_GL_CATEGORY = 'gpu_toplevel'
TOPLEVEL_CATEGORIES = ['disabled-by-default-gpu.device', TOPLEVEL_SERVICE_CATEGORY = 'disabled-by-default-gpu.service'
'disabled-by-default-gpu.service'] TOPLEVEL_DEVICE_CATEGORY = 'disabled-by-default-gpu.device'
TOPLEVEL_CATEGORIES = [TOPLEVEL_SERVICE_CATEGORY, TOPLEVEL_DEVICE_CATEGORY]
test_harness_script = r""" test_harness_script = r"""
var domAutomationController = {}; var domAutomationController = {};
...@@ -28,19 +29,24 @@ test_harness_script = r""" ...@@ -28,19 +29,24 @@ test_harness_script = r"""
window.domAutomationController = domAutomationController; window.domAutomationController = domAutomationController;
""" """
class _TraceValidator(page_test.PageTest):
class _TraceValidatorBase(page_test.PageTest):
def GetCategoryName(self):
raise NotImplementedError("GetCategoryName() Not implemented!")
def ValidateAndMeasurePage(self, page, tab, results): def ValidateAndMeasurePage(self, page, tab, results):
timeline_data = tab.browser.platform.tracing_controller.Stop() timeline_data = tab.browser.platform.tracing_controller.Stop()
timeline_model = model.TimelineModel(timeline_data) timeline_model = model_module.TimelineModel(timeline_data)
categories_set = set(TOPLEVEL_CATEGORIES) category_name = self.GetCategoryName()
for event in timeline_model.IterAllEvents(): event_iter = timeline_model.IterAllEvents(
if event.args.get('gl_category', None) == TOPLEVEL_GL_CATEGORY: event_type_predicate=model_module.IsSliceOrAsyncSlice)
categories_set.discard(event.category) for event in event_iter:
if not categories_set: if (event.args.get('gl_category', None) == TOPLEVEL_GL_CATEGORY and
event.category == category_name):
break break
else: else:
raise page_test.Failure(self._FormatException(sorted(categories_set))) raise page_test.Failure(self._FormatException(category_name))
def CustomizeBrowserOptions(self, options): def CustomizeBrowserOptions(self, options):
options.AppendExtraBrowserArgs('--enable-logging') options.AppendExtraBrowserArgs('--enable-logging')
...@@ -52,23 +58,49 @@ class _TraceValidator(page_test.PageTest): ...@@ -52,23 +58,49 @@ class _TraceValidator(page_test.PageTest):
options.enable_chrome_trace = True options.enable_chrome_trace = True
tab.browser.platform.tracing_controller.Start(options, cat_filter, 60) tab.browser.platform.tracing_controller.Start(options, cat_filter, 60)
def _FormatException(self, categories): def _FormatException(self, category):
return 'Trace markers for GPU categories were not found: %s' % categories return 'Trace markers for GPU category was not found: %s' % category
class TraceTest(benchmark.Benchmark):
"""Tests GPU traces"""
test = _TraceValidator
@classmethod class _TraceValidator(_TraceValidatorBase):
def Name(cls): def GetCategoryName(self):
return 'trace_test' return TOPLEVEL_SERVICE_CATEGORY
class _DeviceTraceValidator(_TraceValidatorBase):
def GetCategoryName(self):
return TOPLEVEL_DEVICE_CATEGORY
def CreateExpectations(self):
return trace_test_expectations.TraceTestExpectations()
class _TraceTestBase(benchmark.Benchmark):
"""Base class for the trace tests."""
def CreatePageSet(self, options): def CreatePageSet(self, options):
# Utilize pixel tests page set as a set of simple pages to load. # Utilize pixel tests page set as a set of simple pages to load.
page_set = page_sets.PixelTestsPageSet() page_set = page_sets.PixelTestsPageSet()
for page in page_set.pages: for page in page_set.pages:
page.script_to_evaluate_on_commit = test_harness_script page.script_to_evaluate_on_commit = test_harness_script
return page_set return page_set
class TraceTest(_TraceTestBase):
"""Tests GPU traces are plumbed through properly."""
test = _TraceValidator
@classmethod
def Name(cls):
return 'trace_test'
def CreateExpectations(self):
return trace_test_expectations.TraceTestExpectations()
class DeviceTraceTest(_TraceTestBase):
"""Tests GPU Device traces show up on devices that support it."""
test = _DeviceTraceValidator
@classmethod
def Name(cls):
return 'device_trace_test'
def CreateExpectations(self):
return trace_test_expectations.DeviceTraceTestExpectations()
...@@ -12,6 +12,9 @@ class TraceTestExpectations(GpuTestExpectations): ...@@ -12,6 +12,9 @@ class TraceTestExpectations(GpuTestExpectations):
# self.Fail('Pixel.Canvas2DRedBox', # self.Fail('Pixel.Canvas2DRedBox',
# ['mac', 'amd', ('nvidia', 0x1234)], bug=123) # ['mac', 'amd', ('nvidia', 0x1234)], bug=123)
# Temporarily skip everything while bot recipes are being put in place.
self.Skip('*')
pass pass
class DeviceTraceTestExpectations(GpuTestExpectations):
def SetExpectations(self):
# Device traces are not supported on all machines.
self.Skip('*')
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment