Bug 1467827 - Port raptor firefox tp6 to linux; r=jmaher

MozReview-Commit-ID: AQuWSuw7cFw

--HG--
extra : rebase_source : 7c74a2a31c0fdac89b9fd0950e5a53cd64e2d7f5
This commit is contained in:
Rob Wood 2018-06-13 14:04:46 -07:00
Родитель e536804584
Коммит 685ce41033
10 изменённых файлов: 73 добавлений и 10 удалений

Просмотреть файл

@ -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:

Просмотреть файл

@ -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

Просмотреть файл

@ -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,

Просмотреть файл

@ -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

Просмотреть файл

@ -0,0 +1,9 @@
[
{
"filename": "mitmproxy-2.0.2-linux.tar.gz",
"size": 48997542,
"digest": "b032e04b8763206a19f80b78062efa59dc901ad32fd8d6cf2d20e22744711352da61e75d93a0d93d645179153534f72a154f73432837db415c9b0cd9d981f012",
"algorithm": "sha512",
"unpack": true
}
]

Просмотреть файл

@ -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):

Просмотреть файл

@ -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:

Просмотреть файл

@ -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

Просмотреть файл

@ -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)

Просмотреть файл

@ -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'