зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1642615 - Renamed the browser layer to test r=sparky
This patch renames the browser layer to test, since it could be something else than a browser Differential Revision: https://phabricator.services.mozilla.com/D78016
This commit is contained in:
Родитель
346a4b69db
Коммит
18f9ccd8f2
|
@ -16,7 +16,7 @@ except ImportError:
|
|||
conditions = None
|
||||
|
||||
from mozperftest.system import get_layers as system_layers # noqa
|
||||
from mozperftest.browser import get_layers as browser_layers # noqa
|
||||
from mozperftest.test import get_layers as test_layers # noqa
|
||||
from mozperftest.metrics import get_layers as metrics_layers # noqa
|
||||
|
||||
FLAVORS = ["script", "doc"]
|
||||
|
@ -71,7 +71,7 @@ class Options:
|
|||
args = copy.deepcopy(general_args)
|
||||
|
||||
|
||||
for layer in system_layers() + browser_layers() + metrics_layers():
|
||||
for layer in system_layers() + test_layers() + metrics_layers():
|
||||
if layer.activated:
|
||||
# add an option to deactivate it
|
||||
option_name = "--no-%s" % layer.name
|
||||
|
|
|
@ -8,7 +8,7 @@ from pathlib import Path
|
|||
import tempfile
|
||||
import shutil
|
||||
|
||||
from mozperftest.browser import pick_browser
|
||||
from mozperftest.test import pick_test
|
||||
from mozperftest.system import pick_system
|
||||
from mozperftest.metrics import pick_metrics
|
||||
from mozperftest.layers import Layers
|
||||
|
@ -28,7 +28,7 @@ class MachEnvironment:
|
|||
# XXX do something with flavors, etc
|
||||
if flavor != "script":
|
||||
raise NotImplementedError(flavor)
|
||||
for layer in (pick_system, pick_browser, pick_metrics):
|
||||
for layer in (pick_system, pick_test, pick_metrics):
|
||||
self.add_layer(layer(self, flavor, mach_cmd))
|
||||
self.tmp_dir = tempfile.mkdtemp()
|
||||
self._load_hooks()
|
||||
|
@ -89,7 +89,7 @@ class MachEnvironment:
|
|||
def run(self, metadata):
|
||||
has_exc_handler = self.has_hook("on_exception")
|
||||
|
||||
# run the system and browser layers
|
||||
# run the system and test layers
|
||||
for layer in self.layers[:-1]:
|
||||
with layer:
|
||||
try:
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# 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 collections import defaultdict
|
||||
from mozperftest.utils import MachLogger
|
||||
|
||||
|
||||
|
@ -9,7 +10,7 @@ class Metadata(MachLogger):
|
|||
MachLogger.__init__(self, mach_cmd)
|
||||
self._mach_cmd = mach_cmd
|
||||
self.flavor = flavor
|
||||
self.browser = {"prefs": {}}
|
||||
self.options = defaultdict(dict)
|
||||
self._results = []
|
||||
self._output = None
|
||||
self._env = env
|
||||
|
@ -34,8 +35,8 @@ class Metadata(MachLogger):
|
|||
def clear_results(self):
|
||||
self._results = []
|
||||
|
||||
def update_browser_prefs(self, prefs):
|
||||
self.browser["prefs"].update(prefs)
|
||||
def update_options(self, name, options):
|
||||
self.options[name].update(options)
|
||||
|
||||
def get_browser_prefs(self):
|
||||
return self.browser["prefs"]
|
||||
def get_options(self, name):
|
||||
return self.options[name]
|
||||
|
|
|
@ -54,7 +54,13 @@ class ProxyRunner(Layer):
|
|||
prefs["network.proxy.ssl"] = "localhost"
|
||||
prefs["network.proxy.ssl_port"] = port
|
||||
prefs["network.proxy.no_proxies_on"] = "localhost"
|
||||
metadata.update_browser_prefs(prefs)
|
||||
browser_prefs = metadata.get_options("browser_prefs")
|
||||
if "prefs" in browser_prefs:
|
||||
browser_prefs["prefs"].update(prefs)
|
||||
else:
|
||||
browser_prefs["prefs"] = prefs
|
||||
metadata.update_options("browser_prefs", browser_prefs)
|
||||
|
||||
return metadata
|
||||
|
||||
def teardown(self):
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# 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 mozperftest.browser.browsertime import BrowsertimeRunner
|
||||
from mozperftest.browser.profile import Profile
|
||||
from mozperftest.test.browsertime import BrowsertimeRunner
|
||||
from mozperftest.test.profile import Profile
|
||||
from mozperftest.layers import Layers
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@ def get_layers():
|
|||
return (Profile, BrowsertimeRunner)
|
||||
|
||||
|
||||
def pick_browser(env, flavor, mach_cmd):
|
||||
def pick_test(env, flavor, mach_cmd):
|
||||
if flavor == "script":
|
||||
return Layers(env, mach_cmd, get_layers())
|
||||
raise NotImplementedError(flavor)
|
|
@ -2,7 +2,7 @@
|
|||
# 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 mozperftest.browser.browsertime.runner import BrowsertimeRunner # noqa
|
||||
from mozperftest.test.browsertime.runner import BrowsertimeRunner # noqa
|
||||
|
||||
|
||||
def add_option(env, name, value):
|
|
@ -12,8 +12,8 @@ from pathlib import Path
|
|||
|
||||
from mozperftest.scriptinfo import ScriptInfo
|
||||
from mozperftest.utils import install_package
|
||||
from mozperftest.browser.noderunner import NodeRunner
|
||||
from mozperftest.browser.browsertime.setup import (
|
||||
from mozperftest.test.noderunner import NodeRunner
|
||||
from mozperftest.test.browsertime.setup import (
|
||||
system_prerequisites,
|
||||
append_system_env,
|
||||
)
|
|
@ -43,7 +43,7 @@ class Profile(Layer):
|
|||
# calling cleanup. We override this silly behavior here.
|
||||
profile.cleanup = self._cleanup
|
||||
|
||||
prefs = metadata.get_browser_prefs()
|
||||
prefs = metadata.get_options("browser_prefs")
|
||||
|
||||
if prefs == {}:
|
||||
prefs["mozperftest"] = "true"
|
|
@ -10,8 +10,8 @@ import pytest
|
|||
|
||||
from mozperftest.tests.support import get_running_env, EXAMPLE_TEST
|
||||
from mozperftest.environment import BROWSER
|
||||
from mozperftest.browser.browsertime import add_options
|
||||
from mozperftest.browser.browsertime.runner import (
|
||||
from mozperftest.test.browsertime import add_options
|
||||
from mozperftest.test.browsertime.runner import (
|
||||
NodeException,
|
||||
matches,
|
||||
extract_browser_name,
|
||||
|
@ -26,13 +26,13 @@ def fetch(self, url):
|
|||
return os.path.join(HERE, "fetched_artifact.zip")
|
||||
|
||||
|
||||
@mock.patch("mozperftest.browser.browsertime.runner.install_package")
|
||||
@mock.patch("mozperftest.test.browsertime.runner.install_package")
|
||||
@mock.patch(
|
||||
"mozperftest.browser.noderunner.NodeRunner.verify_node_install", new=lambda x: True
|
||||
"mozperftest.test.noderunner.NodeRunner.verify_node_install", new=lambda x: True
|
||||
)
|
||||
@mock.patch("mozbuild.artifact_cache.ArtifactCache.fetch", new=fetch)
|
||||
@mock.patch(
|
||||
"mozperftest.browser.browsertime.runner.BrowsertimeRunner._setup_node_packages",
|
||||
"mozperftest.test.browsertime.runner.BrowsertimeRunner._setup_node_packages",
|
||||
new=lambda x, y: None,
|
||||
)
|
||||
def test_browser(*mocked):
|
||||
|
@ -70,13 +70,13 @@ def test_browser(*mocked):
|
|||
assert results[0]["name"] == "Example"
|
||||
|
||||
|
||||
@mock.patch("mozperftest.browser.browsertime.runner.install_package")
|
||||
@mock.patch("mozperftest.test.browsertime.runner.install_package")
|
||||
@mock.patch(
|
||||
"mozperftest.browser.noderunner.NodeRunner.verify_node_install", new=lambda x: True
|
||||
"mozperftest.test.noderunner.NodeRunner.verify_node_install", new=lambda x: True
|
||||
)
|
||||
@mock.patch("mozbuild.artifact_cache.ArtifactCache.fetch", new=fetch)
|
||||
@mock.patch(
|
||||
"mozperftest.browser.browsertime.runner.BrowsertimeRunner._setup_node_packages",
|
||||
"mozperftest.test.browsertime.runner.BrowsertimeRunner._setup_node_packages",
|
||||
new=lambda x, y: None,
|
||||
)
|
||||
def test_browser_failed(*mocked):
|
||||
|
@ -96,13 +96,13 @@ def test_browser_failed(*mocked):
|
|||
b(metadata)
|
||||
|
||||
|
||||
@mock.patch("mozperftest.browser.browsertime.runner.install_package")
|
||||
@mock.patch("mozperftest.test.browsertime.runner.install_package")
|
||||
@mock.patch(
|
||||
"mozperftest.browser.noderunner.NodeRunner.verify_node_install", new=lambda x: True
|
||||
"mozperftest.test.noderunner.NodeRunner.verify_node_install", new=lambda x: True
|
||||
)
|
||||
@mock.patch("mozbuild.artifact_cache.ArtifactCache.fetch", new=fetch)
|
||||
@mock.patch(
|
||||
"mozperftest.browser.browsertime.runner.BrowsertimeRunner._setup_node_packages",
|
||||
"mozperftest.test.browsertime.runner.BrowsertimeRunner._setup_node_packages",
|
||||
new=lambda x, y: None,
|
||||
)
|
||||
def test_browser_desktop(*mocked):
|
||||
|
@ -140,12 +140,12 @@ def test_add_options():
|
|||
assert "two=2" in extra
|
||||
|
||||
|
||||
@mock.patch("mozperftest.browser.browsertime.runner.install_package")
|
||||
@mock.patch("mozperftest.test.browsertime.runner.install_package")
|
||||
@mock.patch(
|
||||
"mozperftest.browser.noderunner.NodeRunner.verify_node_install", new=lambda x: True
|
||||
"mozperftest.test.noderunner.NodeRunner.verify_node_install", new=lambda x: True
|
||||
)
|
||||
@mock.patch("mozbuild.artifact_cache.ArtifactCache.fetch", new=fetch)
|
||||
@mock.patch("mozperftest.browser.browsertime.runner.BrowsertimeRunner.setup_helper")
|
||||
@mock.patch("mozperftest.test.browsertime.runner.BrowsertimeRunner.setup_helper")
|
||||
def test_install_url(*mocked):
|
||||
url = "https://here/tarball/" + "".join(
|
||||
[random.choice(string.hexdigits[:-6]) for c in range(40)]
|
||||
|
@ -163,13 +163,13 @@ def test_install_url(*mocked):
|
|||
assert mach.run_process.call_count == 1
|
||||
|
||||
|
||||
@mock.patch("mozperftest.browser.browsertime.runner.install_package")
|
||||
@mock.patch("mozperftest.test.browsertime.runner.install_package")
|
||||
@mock.patch(
|
||||
"mozperftest.browser.noderunner.NodeRunner.verify_node_install", new=lambda x: True
|
||||
"mozperftest.test.noderunner.NodeRunner.verify_node_install", new=lambda x: True
|
||||
)
|
||||
@mock.patch("mozbuild.artifact_cache.ArtifactCache.fetch", new=fetch)
|
||||
@mock.patch(
|
||||
"mozperftest.browser.browsertime.runner.BrowsertimeRunner._setup_node_packages",
|
||||
"mozperftest.test.browsertime.runner.BrowsertimeRunner._setup_node_packages",
|
||||
new=lambda x, y: None,
|
||||
)
|
||||
def test_install_url_bad(*mocked):
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
import os
|
||||
import mozunit
|
||||
from mozperftest.tests.support import get_running_env
|
||||
from mozperftest.browser.profile import Profile
|
||||
from mozperftest.test.profile import Profile
|
||||
|
||||
|
||||
def test_profile():
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# 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/.
|
||||
import os
|
||||
from mozperftest.browser.browsertime import add_options, add_option
|
||||
from mozperftest.test.browsertime import add_options, add_option
|
||||
|
||||
|
||||
sites = os.path.join(os.path.dirname(__file__), "sites.txt")
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# 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 mozperftest.browser.browsertime import add_options
|
||||
from mozperftest.test.browsertime import add_options
|
||||
|
||||
url = "'https://www.example.com'"
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче