# Copyright 2021 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import argparse import logging import os import shutil import subprocess import sys import tempfile from gpu_tests import path_util sys.path.insert( 0, os.path.join(path_util.GetChromiumSrcDir(), 'build', 'fuchsia')) from common_args import (AddCommonArgs, ConfigureLogging, GetDeploymentTargetForArgs) from symbolizer import RunSymbolizer def RunTestOnFuchsiaDevice(script_cmd): """Preps Fuchsia device with pave and package update, then runs script.""" parser = argparse.ArgumentParser() AddCommonArgs(parser) runner_script_args, test_args = parser.parse_known_args() ConfigureLogging(runner_script_args) # If out_dir is not set, assume the script is being launched # from the output directory.
# Copyright 2020 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """GPU implementation of //testing/skia_gold_common/skia_gold_session.py.""" import os import subprocess import tempfile from gpu_tests import path_util path_util.AddDirToPathIfNeeded(path_util.GetChromiumSrcDir(), 'testing') from skia_gold_common import skia_gold_session class GpuSkiaGoldSession(skia_gold_session.SkiaGoldSession): def RunComparison(self, name, png_file, output_manager=True, use_luci=True): # Passing True for the output manager is a bit of a hack, as we don't # actually need an output manager and just need to get past the truthy # check. return super(GpuSkiaGoldSession, self).RunComparison(name=name, png_file=png_file, output_manager=output_manager, use_luci=use_luci) def _CreateDiffOutputDir(self): # We intentionally don't clean this up and don't put it in self._working_dir
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os from gpu_tests import gpu_test_base from gpu_tests import path_util from gpu_tests import webgl_conformance_expectations from gpu_tests import webgl2_conformance_expectations from telemetry.internal.browser import browser_finder from telemetry.page import page_test from telemetry.story.story_set import StorySet extensions_path = os.path.join( path_util.GetChromiumSrcDir(), 'content', 'test', 'data', 'gpu') conformance_path = os.path.join( path_util.GetChromiumSrcDir(), 'third_party', 'webgl', 'src', 'sdk', 'tests') conformance_harness_script = r""" var testHarness = {}; testHarness._allTestSucceeded = true; testHarness._messages = ''; testHarness._failures = 0; testHarness._finished = false; testHarness._originalLog = window.console.log; testHarness.log = function(msg) { testHarness._messages += msg + "\n";
# Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os import random import sys from gpu_tests import color_profile_manager from gpu_tests import gpu_integration_test from gpu_tests import path_util from gpu_tests import screenshot_sync_expectations from telemetry.util import image_util from telemetry.util import rgba_color data_path = os.path.join(path_util.GetChromiumSrcDir(), 'content', 'test', 'data', 'gpu') class ScreenshotSyncIntegrationTest(gpu_integration_test.GpuIntegrationTest): """Tests that screenshots are properly synchronized with the frame on which they were requested. """ @classmethod def Name(cls): """The name by which this test is invoked on the command line.""" return 'screenshot_sync' @classmethod def SetUpProcess(cls): color_profile_manager.ForceUntilExitSRGB()
def GetMediaStreamTestBrowserArgs(media_stream_source_relpath): return [ '--use-fake-device-for-media-stream', '--use-fake-ui-for-media-stream', '--use-file-for-fake-video-capture=' + os.path.join( path_util.GetChromiumSrcDir(), media_stream_source_relpath) ]
# Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import json import os import sys from gpu_tests import gpu_integration_test from gpu_tests import cloud_storage_integration_test_base from gpu_tests import maps_expectations from gpu_tests import path_util from gpu_tests import color_profile_manager from py_utils import cloud_storage maps_perf_test_path = os.path.join(path_util.GetChromiumSrcDir(), 'tools', 'perf', 'page_sets', 'maps_perf_test') data_path = os.path.join(path_util.GetChromiumSrcDir(), 'content', 'test', 'gpu', 'gpu_tests') class MapsIntegrationTest( cloud_storage_integration_test_base.CloudStorageIntegrationTestBase): """Google Maps pixel tests. Note: this test uses the same WPR as the smoothness.maps benchmark in tools/perf/benchmarks. See src/tools/perf/page_sets/maps.py for documentation on updating the WPR archive. """ @classmethod
import tempfile from gpu_tests import gpu_integration_test from gpu_tests import path_util from gpu_tests import color_profile_manager from gpu_tests.skia_gold import gpu_skia_gold_properties from gpu_tests.skia_gold import gpu_skia_gold_session from gpu_tests.skia_gold import gpu_skia_gold_session_manager from py_utils import cloud_storage from telemetry.util import image_util from telemetry.util import rgba_color GPU_RELATIVE_PATH = "content/test/data/gpu/" GPU_DATA_DIR = os.path.join(path_util.GetChromiumSrcDir(), GPU_RELATIVE_PATH) TEST_DATA_DIRS = [ GPU_DATA_DIR, os.path.join(path_util.GetChromiumSrcDir(), 'media/test/data'), ] SKIA_GOLD_INSTANCE = 'chrome-gpu' SKIA_GOLD_CORPUS = SKIA_GOLD_INSTANCE class _ImageParameters(object): def __init__(self): # Parameters for cloud storage reference images. self.vendor_id = None self.device_id = None self.vendor_string = None
# found in the LICENSE file. import json import os import sys from gpu_tests import color_profile_manager from gpu_tests import gpu_integration_test from gpu_tests import path_util from gpu_tests import pixel_test_pages from gpu_tests import skia_gold_integration_test_base from py_utils import cloud_storage _MAPS_PERF_TEST_PATH = os.path.join( path_util.GetChromiumSrcDir(), 'tools', 'perf', 'page_sets', 'maps_perf_test') _DATA_PATH = os.path.join(path_util.GetChromiumSrcDir(), 'content', 'test', 'gpu', 'gpu_tests') _TOLERANCE = 3 class MapsIntegrationTest( skia_gold_integration_test_base.SkiaGoldIntegrationTestBase): """Google Maps pixel tests. Note: this test uses the same WPR as the smoothness.maps benchmark in tools/perf/benchmarks. See src/tools/perf/page_sets/maps.py for documentation on updating the WPR archive. """
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os from gpu_tests import gpu_test_base from gpu_tests import path_util from gpu_tests import webgl_conformance_expectations from gpu_tests import webgl2_conformance_expectations from telemetry.internal.browser import browser_finder from telemetry.page import page_test from telemetry.story.story_set import StorySet extensions_path = os.path.join(path_util.GetChromiumSrcDir(), 'content', 'test', 'data', 'gpu') conformance_path = os.path.join(path_util.GetChromiumSrcDir(), 'third_party', 'webgl', 'src', 'sdk', 'tests') conformance_harness_script = r""" var testHarness = {}; testHarness._allTestSucceeded = true; testHarness._messages = ''; testHarness._failures = 0; testHarness._finished = false; testHarness._originalLog = window.console.log; testHarness.log = function(msg) { testHarness._messages += msg + "\n"; testHarness._originalLog.apply(window.console, [msg]); }
import subprocess from subprocess import CalledProcessError import shutil import sys import tempfile from gpu_tests import gpu_integration_test from gpu_tests import cloud_storage_integration_test_base from gpu_tests import path_util from gpu_tests import pixel_test_pages from gpu_tests import color_profile_manager from telemetry.util import image_util gpu_relative_path = "content/test/data/gpu/" gpu_data_dir = os.path.join(path_util.GetChromiumSrcDir(), gpu_relative_path) default_reference_image_dir = os.path.join(gpu_data_dir, 'gpu_reference') test_data_dirs = [gpu_data_dir, os.path.join( path_util.GetChromiumSrcDir(), 'media/test/data')] test_harness_script = r""" var domAutomationController = {}; domAutomationController._proceed = false; domAutomationController._readyForActions = false; domAutomationController._succeeded = false; domAutomationController._finished = false;
def main(): parser = argparse.ArgumentParser() AddCommonArgs(parser) args, gpu_test_args = parser.parse_known_args() ConfigureLogging(args) additional_target_args = {} # If output_dir is not set, assume the script is being launched # from the output directory. if not args.out_dir: args.out_dir = os.getcwd() additional_target_args['out_dir'] = args.out_dir # Create a temporary log file that Telemetry will look to use to build # an artifact when tests fail. temp_log_file = False if not args.system_log_file: args.system_log_file = os.path.join(tempfile.mkdtemp(), 'system-log') temp_log_file = True additional_target_args['system_log_file'] = args.system_log_file package_names = ['web_engine', 'web_engine_shell'] web_engine_dir = os.path.join(args.out_dir, 'gen', 'fuchsia', 'engine') gpu_script = [ os.path.join(path_util.GetChromiumSrcDir(), 'content', 'test', 'gpu', 'run_gpu_integration_test.py') ] # Pass all other arguments to the gpu integration tests. gpu_script.extend(gpu_test_args) try: with GetDeploymentTargetForArgs(additional_target_args) as target: target.Start() fuchsia_device_address, fuchsia_ssh_port = target._GetEndpoint() gpu_script.extend(['--chromium-output-directory', args.out_dir]) gpu_script.extend( ['--fuchsia-device-address', fuchsia_device_address]) gpu_script.extend( ['--fuchsia-ssh-config', target._GetSshConfigPath()]) if fuchsia_ssh_port: gpu_script.extend( ['--fuchsia-ssh-port', str(fuchsia_ssh_port)]) gpu_script.extend( ['--fuchsia-system-log-file', args.system_log_file]) if args.verbose: gpu_script.append('-v') # Set up logging of WebEngine listener = target.RunCommandPiped(['log_listener'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) build_ids_paths = map( lambda package_name: os.path.join(web_engine_dir, package_name, 'ids.txt'), package_names) symbolizer = RunSymbolizer(listener.stdout, open(args.system_log_file, 'w'), build_ids_paths) # Keep the Amber repository live while the test runs. with target.GetAmberRepo(): # Install necessary packages on the device. far_files = map( lambda package_name: os.path.join( web_engine_dir, package_name, package_name + '.far'), package_names) target.InstallPackage(far_files) return subprocess.call(gpu_script) finally: if temp_log_file: shutil.rmtree(os.path.dirname(args.system_log_file))
# Copyright 2020 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """GPU implementation of //testing/skia_gold_common/skia_gold_session.py.""" import os import subprocess import tempfile from gpu_tests import path_util path_util.AddDirToPathIfNeeded(path_util.GetChromiumSrcDir(), 'build') from skia_gold_common import skia_gold_session class GpuSkiaGoldSession(skia_gold_session.SkiaGoldSession): def RunComparison(self, name, png_file, output_manager=True, use_luci=True): # Passing True for the output manager is a bit of a hack, as we don't # actually need an output manager and just need to get past the truthy # check. return super(GpuSkiaGoldSession, self).RunComparison(name=name, png_file=png_file, output_manager=output_manager, use_luci=use_luci) def _CreateDiffOutputDir(self): # We intentionally don't clean this up and don't put it in self._working_dir
from subprocess import CalledProcessError import shutil import sys import tempfile from gpu_tests import gpu_integration_test from gpu_tests import path_util from gpu_tests import color_profile_manager from py_utils import cloud_storage from telemetry.util import image_util from telemetry.util import rgba_color GPU_RELATIVE_PATH = "content/test/data/gpu/" GPU_DATA_DIR = os.path.join(path_util.GetChromiumSrcDir(), GPU_RELATIVE_PATH) TEST_DATA_DIRS = [GPU_DATA_DIR, os.path.join( path_util.GetChromiumSrcDir(), 'media/test/data')] goldctl_bin = os.path.join( path_util.GetChromiumSrcDir(), 'tools', 'skia_goldctl') if sys.platform == 'win32': goldctl_bin = os.path.join(goldctl_bin, 'win', 'goldctl') + '.exe' elif sys.platform == 'darwin': goldctl_bin = os.path.join(goldctl_bin, 'mac', 'goldctl') else: goldctl_bin = os.path.join(goldctl_bin, 'linux', 'goldctl') SKIA_GOLD_INSTANCE = 'chrome-gpu'
# Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import json import os import sys from gpu_tests import gpu_integration_test from gpu_tests import cloud_storage_integration_test_base from gpu_tests import maps_expectations from gpu_tests import path_util import py_utils from py_utils import cloud_storage data_path = os.path.join(path_util.GetChromiumSrcDir(), 'content', 'test', 'gpu', 'page_sets', 'data') class MapsIntegrationTest( cloud_storage_integration_test_base.CloudStorageIntegrationTestBase): """Google Maps pixel tests. Note: the WPR for this test was recorded from the smoothness.maps benchmark's similar page. The Maps team gave us a build of their test. The only modification to the test was to config.js, where the width and height query args were set to 800 by 600. The WPR was recorded with: tools/perf/record_wpr smoothness_maps --browser=system This produced maps_???.wpr and maps.json, which were copied from tools/perf/page_sets/data into content/test/gpu/page_sets/data.
def main(): gpu_script = [ os.path.join(path_util.GetChromiumSrcDir(), 'content', 'test', 'gpu', 'run_gpu_integration_test.py') ] return fuchsia_util.RunTestOnFuchsiaDevice(gpu_script)
import os import re import sys from gpu_tests import gpu_integration_test from gpu_tests import cloud_storage_integration_test_base from gpu_tests import path_util from gpu_tests import pixel_expectations from gpu_tests import pixel_test_pages from gpu_tests import color_profile_manager from py_utils import cloud_storage from telemetry.util import image_util gpu_relative_path = "content/test/data/gpu/" gpu_data_dir = os.path.join(path_util.GetChromiumSrcDir(), gpu_relative_path) default_reference_image_dir = os.path.join(gpu_data_dir, 'gpu_reference') test_data_dirs = [ gpu_data_dir, os.path.join(path_util.GetChromiumSrcDir(), 'media/test/data') ] test_harness_script = r""" var domAutomationController = {}; domAutomationController._proceed = false; domAutomationController._readyForActions = false; domAutomationController._succeeded = false;
#!/usr/bin/env vpython # Copyright 2020 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Wrapper for running gpu integration tests on Fuchsia devices.""" import argparse import logging import os import subprocess import sys import time from gpu_tests import path_util sys.path.insert(0, os.path.join(path_util.GetChromiumSrcDir(), 'build', 'fuchsia')) from common_args import AddCommonArgs, ConfigureLogging, GetDeploymentTargetForArgs def main(): parser = argparse.ArgumentParser() AddCommonArgs(parser) args, gpu_test_args = parser.parse_known_args() ConfigureLogging(args) # If output directory is not set, assume the script is being launched # from the output directory. if not args.output_directory: args.output_directory = os.getcwd() gpu_script = [os.path.join(path_util.GetChromiumSrcDir(), 'content',
# Copyright 2021 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from __future__ import print_function import os import sys from gpu_tests import common_browser_args as cba from gpu_tests import gpu_integration_test from gpu_tests import path_util # Tests will be stored individually in subdirectories underneath this base # directory. _DATA_PATH = os.path.join(path_util.GetChromiumSrcDir(), 'content', 'test', 'data', 'gpu', 'mediapipe') class MediaPipeIntegrationTest(gpu_integration_test.GpuIntegrationTest): """Google MediaPipe Tests The tests are generated by MediaPipe's test_harness and placed into a zip file that is stored on the cloud. See mediapipe_update.py. Iterate through the subdirectories under _DATA_PATH and runs each test individually. """ @classmethod def Name(cls): return 'mediapipe'
# Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import json import os import sys from gpu_tests import color_profile_manager from gpu_tests import gpu_integration_test from gpu_tests import path_util from gpu_tests import pixel_test_pages from gpu_tests import skia_gold_integration_test_base from py_utils import cloud_storage _MAPS_PERF_TEST_PATH = os.path.join(path_util.GetChromiumSrcDir(), 'tools', 'perf', 'page_sets', 'maps_perf_test') _DATA_PATH = os.path.join(path_util.GetChromiumSrcDir(), 'content', 'test', 'gpu', 'gpu_tests') _TOLERANCE = 3 class MapsIntegrationTest( skia_gold_integration_test_base.SkiaGoldIntegrationTestBase): """Google Maps pixel tests. Note: this test uses the same WPR as the smoothness.maps benchmark in tools/perf/benchmarks. See src/tools/perf/page_sets/maps.py for documentation on updating the WPR archive.
# Copyright 2016 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import unittest import os from gpu_tests import path_util path_util.AddDirToPathIfNeeded(path_util.GetChromiumSrcDir(), 'third_party', 'logilab') path_util.AddDirToPathIfNeeded(path_util.GetChromiumSrcDir(), 'third_party', 'logilab', 'logilab') path_util.AddDirToPathIfNeeded(path_util.GetChromiumSrcDir(), 'third_party', 'pylint') try: from pylint import lint except ImportError: lint = None _RC_FILE = os.path.join(path_util.GetGpuTestDir(), 'pylintrc') def LintCheckPassed(directory): args = [directory, '--rcfile=%s' % _RC_FILE] try: assert lint, 'pylint module cannot be found' lint.Run(args)
# found in the LICENSE file. import os import sys from gpu_tests import gpu_integration_test from gpu_tests import path_util from gpu_tests import pixel_test_pages from telemetry.timeline import model as model_module from telemetry.timeline import tracing_config gpu_relative_path = "content/test/data/gpu/" data_paths = [ os.path.join(path_util.GetChromiumSrcDir(), gpu_relative_path), os.path.join(path_util.GetChromiumSrcDir(), 'media', 'test', 'data') ] webgl_test_harness_script = r""" var domAutomationController = {}; domAutomationController._finished = false; domAutomationController.send = function(msg) { // Issue a read pixel to synchronize the gpu process to ensure // the asynchronous category enabling is finished. var temp_canvas = document.createElement("canvas") temp_canvas.width = 1; temp_canvas.height = 1; var temp_gl = temp_canvas.getContext("experimental-webgl") ||
import time # Waits for [x] seconds after browser launch before measuring power to # avoid startup tasks affecting results. _POWER_MEASUREMENT_DELAY = 20 # Measures power for [x] seconds and calculates the average as results. _POWER_MEASUREMENT_DURATION = 15 # Measures power in resolution of [x] milli-seconds. _POWER_MEASUREMENT_RESOLUTION = 100 _GPU_RELATIVE_PATH = "content/test/data/gpu/" _DATA_PATHS = [ os.path.join(path_util.GetChromiumSrcDir(), _GPU_RELATIVE_PATH), os.path.join(path_util.GetChromiumSrcDir(), 'media', 'test', 'data') ] _VIDEO_TEST_SCRIPT = r""" var _video_in_fullscreen = false; var _colored_box = null; var _video_element = null; function _locateVideoElement() { // return the video element with largest width. var elements = document.getElementsByTagName("video"); if (elements.length == 0) return null; var rt = elements[0]; var max = elements[0].width;
# found in the LICENSE file. import os import random import sys from gpu_tests import color_profile_manager from gpu_tests import gpu_integration_test from gpu_tests import path_util from gpu_tests import screenshot_sync_expectations from telemetry.util import image_util from telemetry.util import rgba_color data_path = os.path.join( path_util.GetChromiumSrcDir(), 'content', 'test', 'data', 'gpu') class ScreenshotSyncIntegrationTest(gpu_integration_test.GpuIntegrationTest): """Tests that screenshots are properly synchronized with the frame on which they were requested. """ @classmethod def Name(cls): """The name by which this test is invoked on the command line.""" return 'screenshot_sync' # The command line options (which are passed to subclasses' # GenerateGpuTests) *must* be configured here, via a call to # SetParsedCommandLineOptions. If they are not, an error will be # raised when running the tests.
# Copyright 2021 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from __future__ import print_function import os import sys import time from gpu_tests import gpu_integration_test from gpu_tests import path_util html_path = os.path.join(path_util.GetChromiumSrcDir(), 'content', 'test', 'data', 'gpu', 'webcodecs') data_path = os.path.join(path_util.GetChromiumSrcDir(), 'media', 'test', 'data') frame_sources = ["camera", "capture", "offscreen", "hw_decoder", "sw_decoder"] codecs = ["avc1.42001E", "vp8", "vp09.00.10.08"] accelerations = ["require", "deny"] class WebCodecsIntegrationTest(gpu_integration_test.GpuIntegrationTest): @classmethod def Name(cls): return 'webcodecs' @classmethod def GenerateGpuTests(cls, options): for source_type in frame_sources: yield ('WebCodecs_DrawImage_' + source_type, 'draw-image.html',
# Copyright 2016 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import json import os import shutil import tempfile import unittest from telemetry.testing import browser_test_runner from gpu_tests import path_util path_util.AddDirToPathIfNeeded(path_util.GetChromiumSrcDir(), 'tools', 'perf') from chrome_telemetry_build import chromium_config class GpuIntegrationTestUnittest(unittest.TestCase): def setUp(self): self._test_state = {} def testSimpleIntegrationTest(self): self._RunIntegrationTest( 'simple_integration_unittest', ['unittest_data.integration_tests.SimpleTest.unexpected_error', 'unittest_data.integration_tests.SimpleTest.unexpected_failure'], ['unittest_data.integration_tests.SimpleTest.expected_flaky', 'unittest_data.integration_tests.SimpleTest.expected_failure'], ['unittest_data.integration_tests.SimpleTest.expected_skip'], [])
def main(): telemetry_script = [ os.path.join(path_util.GetChromiumSrcDir(), 'tools', 'perf', 'run_benchmark') ] return fuchsia_util.RunTestOnFuchsiaDevice(telemetry_script)
import sys from gpu_tests import gpu_integration_test from gpu_tests import path_util from gpu_tests import webgl_conformance_expectations from gpu_tests import webgl2_conformance_expectations from telemetry.internal.browser import browser_finder conformance_relcomps = ('third_party', 'webgl', 'src', 'sdk', 'tests') extensions_relcomps = ('content', 'test', 'data', 'gpu') conformance_relpath = os.path.join(*conformance_relcomps) extensions_relpath = os.path.join(*extensions_relcomps) conformance_path = os.path.join(path_util.GetChromiumSrcDir(), conformance_relpath) # These URL prefixes are needed because having more than one static # server dir is causing the base server directory to be moved up the # directory hierarchy. url_prefixes_to_trim = [ '/'.join(conformance_relcomps) + '/', '/'.join(extensions_relcomps) + '/' ] conformance_harness_script = r""" var testHarness = {}; testHarness._allTestSucceeded = true; testHarness._messages = ''; testHarness._failures = 0; testHarness._finished = false;
"""Class for interacting with the Skia Gold image diffing service. This is based heavily off Android's Skia Gold implementation in //build/android/pylib/utils/gold_utils.py. If you need to make a change to this file, check to see if the same change needs to be made there. """ import logging import os import subprocess import sys import tempfile from gpu_tests import path_util GOLDCTL_BINARY = os.path.join(path_util.GetChromiumSrcDir(), 'tools', 'skia_goldctl') if sys.platform == 'win32': GOLDCTL_BINARY = os.path.join(GOLDCTL_BINARY, 'win', 'goldctl') + '.exe' elif sys.platform == 'darwin': GOLDCTL_BINARY = os.path.join(GOLDCTL_BINARY, 'mac', 'goldctl') else: GOLDCTL_BINARY = os.path.join(GOLDCTL_BINARY, 'linux', 'goldctl') class SkiaGoldSession(object): class StatusCodes(object): """Status codes for RunComparison.""" SUCCESS = 0 AUTH_FAILURE = 1 INIT_FAILURE = 2