From 685ce4103329c418624271d59092270aaf07a068 Mon Sep 17 00:00:00 2001 From: Rob Wood Date: Wed, 13 Jun 2018 14:04:46 -0700 Subject: [PATCH] Bug 1467827 - Port raptor firefox tp6 to linux; r=jmaher MozReview-Commit-ID: AQuWSuw7cFw --HG-- extra : rebase_source : 7c74a2a31c0fdac89b9fd0950e5a53cd64e2d7f5 --- taskcluster/ci/test/raptor.yml | 1 + taskcluster/taskgraph/transforms/tests.py | 2 +- .../mozharness/configs/raptor/linux_config.py | 6 ++--- .../mozharness/mozilla/testing/raptor.py | 12 ++++++++++ .../mitmproxy-rel-bin-linux64.manifest | 9 +++++++ testing/raptor/raptor/playback/mitmproxy.py | 13 +++++++--- testing/raptor/raptor/raptor.py | 2 ++ testing/raptor/raptor/tests/raptor-tp6.ini | 4 ++-- testing/raptor/raptor/utils.py | 24 +++++++++++++++++++ testing/raptor/test/test_playback.py | 10 +++++++- 10 files changed, 73 insertions(+), 10 deletions(-) create mode 100644 testing/raptor/raptor/playback/mitmproxy-rel-bin-linux64.manifest create mode 100644 testing/raptor/raptor/utils.py diff --git a/taskcluster/ci/test/raptor.yml b/taskcluster/ci/test/raptor.yml index cf11729939e2..0a4bd603caf1 100644 --- a/taskcluster/ci/test/raptor.yml +++ b/taskcluster/ci/test/raptor.yml @@ -32,6 +32,7 @@ raptor-firefox-tp6: run-on-projects: by-test-platform: macosx.*: ['try', 'mozilla-central'] + linux64.*: ['try', 'mozilla-central'] default: ['try'] max-run-time: 1200 mozharness: diff --git a/taskcluster/taskgraph/transforms/tests.py b/taskcluster/taskgraph/transforms/tests.py index f0842aac2782..0aa6ca52d49b 100644 --- a/taskcluster/taskgraph/transforms/tests.py +++ b/taskcluster/taskgraph/transforms/tests.py @@ -408,7 +408,7 @@ def set_defaults(config, tests): test.setdefault('e10s', True) # software-gl-layers is only meaningful on linux unittests, where it defaults to True - if test['test-platform'].startswith('linux') and test['suite'] != 'talos': + if test['test-platform'].startswith('linux') and test['suite'] not in ['talos', 'raptor']: test.setdefault('allow-software-gl-layers', True) else: test['allow-software-gl-layers'] = False diff --git a/testing/mozharness/configs/raptor/linux_config.py b/testing/mozharness/configs/raptor/linux_config.py index 4b699c7d7c8c..360dfdc8adba 100644 --- a/testing/mozharness/configs/raptor/linux_config.py +++ b/testing/mozharness/configs/raptor/linux_config.py @@ -14,8 +14,8 @@ config = { "installer_path": "installer.exe", "virtualenv_path": VENV_PATH, "find_links": [ - "http://pypi.pvt.build.mozilla.org/pub", - "http://pypi.pub.build.mozilla.org/pub", + "https://pypi.pvt.build.mozilla.org/pub", + "https://pypi.pub.build.mozilla.org/pub", ], "pip_index": False, "title": os.uname()[1].lower().split('.')[0], @@ -23,9 +23,9 @@ config = { "clobber", "download-and-extract", "populate-webroot", + "install-chrome", "create-virtualenv", "install", - "setup-mitmproxy", "run-tests", ], "download_minidump_stackwalk": True, diff --git a/testing/mozharness/mozharness/mozilla/testing/raptor.py b/testing/mozharness/mozharness/mozilla/testing/raptor.py index 5cce982a86eb..cb6e8155151a 100644 --- a/testing/mozharness/mozharness/mozilla/testing/raptor.py +++ b/testing/mozharness/mozharness/mozilla/testing/raptor.py @@ -71,6 +71,12 @@ class Raptor(TestingMixin, MercurialScript, Python3Virtualenv, CodeCoverageMixin "default": None, "help": "extra options to raptor" }], + [["--enable-webrender"], { + "action": "store_true", + "dest": "enable_webrender", + "default": False, + "help": "Tries to enable the WebRender compositor.", + }], ] + testing_config_options + copy.deepcopy(code_coverage_config_options) def __init__(self, **kwargs): @@ -376,6 +382,12 @@ class Raptor(TestingMixin, MercurialScript, Python3Virtualenv, CodeCoverageMixin else: env['PYTHONPATH'] = self.raptor_path + # if running in production on a quantum_render build + if self.config['enable_webrender']: + self.info("webrender is enabled so setting MOZ_WEBRENDER=1 and MOZ_ACCELERATED=1") + env['MOZ_WEBRENDER'] = '1' + env['MOZ_ACCELERATED'] = '1' + # mitmproxy needs path to mozharness when installing the cert, and tooltool env['SCRIPTSPATH'] = scripts_path env['EXTERNALTOOLSPATH'] = external_tools_path diff --git a/testing/raptor/raptor/playback/mitmproxy-rel-bin-linux64.manifest b/testing/raptor/raptor/playback/mitmproxy-rel-bin-linux64.manifest new file mode 100644 index 000000000000..eda3d80680a5 --- /dev/null +++ b/testing/raptor/raptor/playback/mitmproxy-rel-bin-linux64.manifest @@ -0,0 +1,9 @@ +[ + { + "filename": "mitmproxy-2.0.2-linux.tar.gz", + "size": 48997542, + "digest": "b032e04b8763206a19f80b78062efa59dc901ad32fd8d6cf2d20e22744711352da61e75d93a0d93d645179153534f72a154f73432837db415c9b0cd9d981f012", + "algorithm": "sha512", + "unpack": true + } +] diff --git a/testing/raptor/raptor/playback/mitmproxy.py b/testing/raptor/raptor/playback/mitmproxy.py index 89645702ab28..78f1333cd042 100644 --- a/testing/raptor/raptor/playback/mitmproxy.py +++ b/testing/raptor/raptor/playback/mitmproxy.py @@ -1,4 +1,4 @@ -'''This helps loading mitmproxy's cert and change proxy settings for Firefox.''' +'''Functions to download, install, setup, and use the mitmproxy playback tool''' # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. @@ -21,8 +21,13 @@ from .base import Playback here = os.path.dirname(os.path.realpath(__file__)) LOG = get_proxy_logger(component='raptor-mitmproxy') +# needed so unit tests can find their imports mozharness_dir = os.path.join(here, '../../../mozharness') sys.path.insert(0, mozharness_dir) +raptor_dir = os.path.join(here, '..') +sys.path.insert(0, raptor_dir) + +from utils import transform_platform external_tools_path = os.environ.get('EXTERNALTOOLSPATH', None) @@ -117,10 +122,12 @@ class Mitmproxy(Playback): os.makedirs(self.raptor_dir) LOG.info("downloading mitmproxy binary") _manifest = os.path.join(here, self.config['playback_binary_manifest']) - self._tooltool_fetch(_manifest) + transformed_manifest = transform_platform(_manifest, self.config['platform']) + self._tooltool_fetch(transformed_manifest) LOG.info("downloading mitmproxy pageset") _manifest = os.path.join(here, self.config['playback_pageset_manifest']) - self._tooltool_fetch(_manifest) + transformed_manifest = transform_platform(_manifest, self.config['platform']) + self._tooltool_fetch(transformed_manifest) return def setup(self): diff --git a/testing/raptor/raptor/raptor.py b/testing/raptor/raptor/raptor.py index 89b8a5801d8a..8be7cf4e57e3 100644 --- a/testing/raptor/raptor/raptor.py +++ b/testing/raptor/raptor/raptor.py @@ -76,6 +76,8 @@ class Raptor(object): self.runner = runner_cls( binary, profile=self.profile, process_args=process_args) + self.log.info("raptor config: %s" % str(self.config)) + @property def profile_data_dir(self): if 'MOZ_DEVELOPER_REPO_DIR' in os.environ: diff --git a/testing/raptor/raptor/tests/raptor-tp6.ini b/testing/raptor/raptor/tests/raptor-tp6.ini index 4f1f96d1184a..b33562e8ca25 100644 --- a/testing/raptor/raptor/tests/raptor-tp6.ini +++ b/testing/raptor/raptor/tests/raptor-tp6.ini @@ -7,8 +7,8 @@ [DEFAULT] type = pageload playback = mitmproxy -playback_binary_manifest = mitmproxy-rel-bin-osx.manifest -playback_binary_zip_mac = mitmproxy-2.0.2-osx.tar.gz +playback_binary_manifest = mitmproxy-rel-bin-{platform}.manifest +playback_binary_zip_mac = mitmproxy-2.0.2-{platform}.tar.gz playback_pageset_manifest = mitmproxy-playback-set.manifest playback_pageset_zip_mac = mitmproxy-recording-set-win10.zip page_cycles = 25 diff --git a/testing/raptor/raptor/utils.py b/testing/raptor/raptor/utils.py new file mode 100644 index 000000000000..8766157ea49b --- /dev/null +++ b/testing/raptor/raptor/utils.py @@ -0,0 +1,24 @@ +'''Utility functions for Raptor''' +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +from __future__ import absolute_import + +from mozlog import get_proxy_logger + +LOG = get_proxy_logger(component="raptor-utils") + + +def transform_platform(str_to_transform, config_platform): + # transform platform name i.e. 'mitmproxy-rel-bin-{platform}.manifest' + # transforms to 'mitmproxy-rel-bin-osx.manifest' + if '{platform}' not in str_to_transform: + return str_to_transform + if 'win' in config_platform: + platform_id = 'win' + elif config_platform == 'mac': + platform_id = 'osx' + else: + platform_id = 'linux64' + return str_to_transform.replace('{platform}', platform_id) diff --git a/testing/raptor/test/test_playback.py b/testing/raptor/test/test_playback.py index 1b14c50396e1..86f2b4c8ec76 100644 --- a/testing/raptor/test/test_playback.py +++ b/testing/raptor/test/test_playback.py @@ -1,5 +1,8 @@ from __future__ import absolute_import, unicode_literals +import os + +import mozinfo import mozunit from mozlog.structuredlog import set_default_logger, StructuredLogger @@ -8,11 +11,16 @@ set_default_logger(StructuredLogger('test_playback')) from raptor.playback import get_playback, Mitmproxy - config = {} def test_get_playback(get_binary): + config['platform'] = mozinfo.os + if 'win' in config['platform']: + # this test is not yet supported on windows + assert True + return + config['obj_path'] = os.path.dirname(get_binary('firefox')) config['playback_tool'] = 'mitmproxy' config['playback_binary_manifest'] = 'mitmproxy-rel-bin-osx.manifest' config['playback_binary_zip_mac'] = 'mitmproxy-2.0.2-osx.tar.gz'