Backed out changeset 5f2252c9e774 (bug 1668458) for wpt failures CLOSED TREE

This commit is contained in:
Bogdan Tara 2020-10-06 16:32:01 +03:00
Родитель b5c3417177
Коммит 50effb1629
12 изменённых файлов: 50 добавлений и 122 удалений

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

@ -174,8 +174,6 @@ class WebPlatformTest(TestingMixin, MercurialScript, CodeCoverageMixin, AndroidM
dirs['abs_test_bin_dir'] = os.path.join(dirs['abs_test_install_dir'], 'bin')
dirs["abs_wpttest_dir"] = os.path.join(dirs['abs_test_install_dir'], "web-platform")
dirs['abs_blob_upload_dir'] = os.path.join(abs_dirs['abs_work_dir'], 'blobber_upload_dir')
dirs['abs_test_extensions_dir'] = os.path.join(dirs['abs_test_install_dir'],
'extensions')
if self.is_android:
dirs['abs_xre_dir'] = os.path.join(abs_dirs['abs_work_dir'], 'hostutils')
if self.is_emulator:
@ -251,10 +249,7 @@ class WebPlatformTest(TestingMixin, MercurialScript, CodeCoverageMixin, AndroidM
"--stackfix-dir=%s" % os.path.join(dirs["abs_test_install_dir"], "bin"),
"--no-pause-after-test",
"--instrument-to-file=%s" % os.path.join(dirs["abs_blob_upload_dir"],
"wpt_instruments.txt"),
"--specialpowers-path=%s" % os.path.join(dirs['abs_test_extensions_dir'],
"specialpowers@mozilla.org.xpi"),
]
"wpt_instruments.txt")]
is_windows_7 = mozinfo.info["os"] == "win" and mozinfo.info["os_version"] == "6.1"
@ -367,7 +362,6 @@ class WebPlatformTest(TestingMixin, MercurialScript, CodeCoverageMixin, AndroidM
extract_dirs=["mach",
"bin/*",
"config/*",
"extensions/*",
"mozbase/*",
"marionette/*",
"tools/*",

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

@ -82,13 +82,6 @@ FAQ
[testdriver](https://web-platform-tests.org/writing-tests/testdriver.html)
API.
For Gecko-specific testharness tests, the specialPowers extension is
available. Note that this should only be used when no other approach
works; such tests can't be shared with other browsers. If you're
using specialPowers for something that could be tested in other
browsers if we extended testdriver or added test-only APIs, please
file a bug.
Writing tests
-------------

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

@ -41,13 +41,6 @@ class WebPlatformTestsRunnerSetup(MozbuildObject):
"""Setup kwargs relevant for all browser products"""
tests_src_path = os.path.join(self._here, "tests")
if (kwargs["product"] in {"firefox", "firefox_android"} and
kwargs["specialpowers_path"] is None):
kwargs["specialpowers_path"] = os.path.join(self.distdir,
"xpi-stage",
"specialpowers@mozilla.org.xpi")
if kwargs["product"] == "firefox_android":
# package_name may be different in the future
package_name = kwargs["package_name"]
@ -94,9 +87,9 @@ class WebPlatformTestsRunnerSetup(MozbuildObject):
def kwargs_firefox(self, kwargs):
"""Setup kwargs specific to running Firefox and other gecko browsers"""
import mozinfo
from wptrunner import wptcommandline
kwargs = self.kwargs_common(kwargs)
if kwargs["binary"] is None:
@ -132,6 +125,7 @@ class WebPlatformTestsRunnerSetup(MozbuildObject):
def kwargs_wptrun(self, kwargs):
"""Setup kwargs for wpt-run which is only used for non-gecko browser products"""
from tools.wpt import run
kwargs = self.kwargs_common(kwargs)
@ -351,11 +345,9 @@ class MachCommands(MachCommandBase):
parser=create_parser_wpt)
def run_web_platform_tests(self, **params):
self.setup()
if params["product"] is None:
if conditions.is_android(self):
if conditions.is_android(self) and params["product"] != "firefox_android":
if params["product"] is None:
params["product"] = "firefox_android"
else:
params["product"] = "firefox"
if "test_objects" in params:
include = []
test_types = set()

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

@ -33,7 +33,7 @@ class WebPlatformTestsRunner(object):
self.update_manifest(logger)
kwargs["manifest_update"] = False
if kwargs["product"] == "firefox":
if kwargs["product"] in ["firefox", None]:
try:
kwargs = self.setup.kwargs_firefox(kwargs)
except BinaryNotFoundException as e:

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

@ -1,7 +0,0 @@
<title>Check specialPowers is available in gecko-only tests</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(() => assert_equals(SpecialPowers.sanityCheck(), "foo"))
</script>

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

@ -126,12 +126,6 @@ class Browser(object):
pass
def settings(self, test):
"""Dictionary of metadata that is constant for a specific launch of a browser.
This is used to determine when the browser instance configuration changes, requiring
a relaunch of the browser. The test runner calls this method for each test, and if the
returned value differs from that for the previous test, the browser is relaunched.
"""
return {}
@abstractmethod

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

@ -101,8 +101,7 @@ def browser_kwargs(test_type, run_info_data, config, **kwargs):
"config": config,
"browser_channel": kwargs["browser_channel"],
"headless": kwargs["headless"],
"preload_browser": kwargs["preload_browser"],
"specialpowers_path": kwargs["specialpowers_path"]}
"preload_browser": kwargs["preload_browser"]}
def executor_kwargs(test_type, server_config, cache_manager, run_info_data,
@ -541,16 +540,12 @@ class ProfileCreator(object):
self.certutil_binary = certutil_binary
self.ca_certificate_path = ca_certificate_path
def create(self, **kwargs):
def create(self):
"""Create a Firefox profile and return the mozprofile Profile object pointing at that
profile
:param kwargs: Additional arguments to pass into the profile constructor
"""
profile"""
preferences = self._load_prefs()
profile = FirefoxProfile(preferences=preferences,
**kwargs)
profile = FirefoxProfile(preferences=preferences)
self._set_required_prefs(profile)
if self.ca_certificate_path is not None:
self._setup_ssl(profile)
@ -675,6 +670,7 @@ class ProfileCreator(object):
certutil("-L", "-d", cert_db_path)
class FirefoxBrowser(Browser):
init_timeout = 70
@ -683,8 +679,7 @@ class FirefoxBrowser(Browser):
ca_certificate_path=None, e10s=False, enable_webrender=False, enable_fission=False,
stackfix_dir=None, binary_args=None, timeout_multiplier=None, leak_check=False,
asan=False, stylo_threads=1, chaos_mode_flags=None, config=None,
browser_channel="nightly", headless=None, preload_browser=False,
specialpowers_path=None, **kwargs):
browser_channel="nightly", headless=None, preload_browser=False, **kwargs):
Browser.__init__(self, logger)
self.logger = logger
@ -693,7 +688,6 @@ class FirefoxBrowser(Browser):
self.init_timeout = self.init_timeout * timeout_multiplier
self.instance = None
self._settings = None
self.stackfix_dir = stackfix_dir
self.symbols_path = symbols_path
@ -702,8 +696,6 @@ class FirefoxBrowser(Browser):
self.asan = asan
self.leak_check = leak_check
self.specialpowers_path = specialpowers_path
profile_creator = ProfileCreator(logger,
prefs_root,
config,
@ -734,15 +726,14 @@ class FirefoxBrowser(Browser):
symbols_path,
asan)
def settings(self, test):
self._settings = {"check_leaks": self.leak_check and not test.leaks,
"lsan_disabled": test.lsan_disabled,
"lsan_allowed": test.lsan_allowed,
"lsan_max_stack_depth": test.lsan_max_stack_depth,
"mozleak_allowed": self.leak_check and test.mozleak_allowed,
"mozleak_thresholds": self.leak_check and test.mozleak_threshold,
"special_powers": self.specialpowers_path and test.url_base == "/_mozilla/"}
return self._settings
return {"check_leaks": self.leak_check and not test.leaks,
"lsan_disabled": test.lsan_disabled,
"lsan_allowed": test.lsan_allowed,
"lsan_max_stack_depth": test.lsan_max_stack_depth,
"mozleak_allowed": self.leak_check and test.mozleak_allowed,
"mozleak_thresholds": self.leak_check and test.mozleak_threshold}
def start(self, group_metadata=None, **kwargs):
self.instance = self.instance_manager.get()
@ -765,11 +756,7 @@ class FirefoxBrowser(Browser):
def executor_browser(self):
assert self.instance is not None
extensions = []
if self._settings.get("special_powers", False):
extensions.append(self.specialpowers_path)
return ExecutorBrowser, {"marionette_port": self.instance.marionette_port,
"extensions": extensions}
return ExecutorBrowser, {"marionette_port": self.instance.marionette_port}
def check_crash(self, process, test):
dump_dir = os.path.join(self.instance.runner.profile.profile, "minidumps")

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

@ -62,8 +62,7 @@ def browser_kwargs(test_type, run_info_data, config, **kwargs):
"chaos_mode_flags": kwargs["chaos_mode_flags"],
"config": config,
"install_fonts": kwargs["install_fonts"],
"tests_root": config.doc_root,
"specialpowers_path": kwargs["specialpowers_path"]}
"tests_root": config.doc_root}
def env_extras(**kwargs):
@ -120,6 +119,7 @@ class ProfileCreator(FirefoxProfileCreator):
})
class FirefoxAndroidBrowser(Browser):
init_timeout = 300
shutdown_timeout = 60
@ -130,7 +130,7 @@ class FirefoxAndroidBrowser(Browser):
ca_certificate_path=None, e10s=False, enable_webrender=False, stackfix_dir=None,
binary_args=None, timeout_multiplier=None, leak_check=False, asan=False,
stylo_threads=1, chaos_mode_flags=None, config=None, browser_channel="nightly",
install_fonts=False, tests_root=None, specialpowers_path=None, **kwargs):
install_fonts=False, tests_root=None, **kwargs):
super(FirefoxAndroidBrowser, self).__init__(logger)
self.prefs_root = prefs_root
@ -155,7 +155,6 @@ class FirefoxAndroidBrowser(Browser):
self.browser_channel = browser_channel
self.install_fonts = install_fonts
self.tests_root = tests_root
self.specialpowers_path = specialpowers_path
self.profile_creator = ProfileCreator(logger,
prefs_root,
@ -171,23 +170,19 @@ class FirefoxAndroidBrowser(Browser):
self.marionette_port = None
self.profile = None
self.runner = None
self._settings = {}
def settings(self, test):
self._settings = {"check_leaks": self.leak_check and not test.leaks,
"lsan_allowed": test.lsan_allowed,
"lsan_max_stack_depth": test.lsan_max_stack_depth,
"mozleak_allowed": self.leak_check and test.mozleak_allowed,
"mozleak_thresholds": self.leak_check and test.mozleak_threshold,
"special_powers": self.specialpowers_path and test.url_base == "/_mozilla/"}
return self._settings
return {"check_leaks": self.leak_check and not test.leaks,
"lsan_allowed": test.lsan_allowed,
"lsan_max_stack_depth": test.lsan_max_stack_depth,
"mozleak_allowed": self.leak_check and test.mozleak_allowed,
"mozleak_thresholds": self.leak_check and test.mozleak_threshold}
def start(self, **kwargs):
if self.marionette_port is None:
self.marionette_port = get_free_port()
addons = [self.specialpowers_path] if self._settings.get("special_powers") else None
self.profile = self.profile_creator.create(addons=addons)
self.profile = self.profile_creator.create()
self.profile.set_preferences({"marionette.port": self.marionette_port})
if self.install_fonts:
@ -278,10 +273,7 @@ class FirefoxAndroidBrowser(Browser):
self.stop(force)
def executor_browser(self):
return ExecutorBrowser, {"marionette_port": self.marionette_port,
# We never want marionette to install extensions because
# that doesn't work on Android; instead they are in the profile
"extensions": []}
return ExecutorBrowser, {"marionette_port": self.marionette_port}
def check_crash(self, process, test):
if not os.environ.get("MINIDUMP_STACKWALK", "") and self.stackwalk_binary:

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

@ -1,7 +1,5 @@
import json
import os
import shutil
import tempfile
import threading
import time
import traceback
@ -47,10 +45,15 @@ from ..webdriver_server import GeckoDriverServer
def do_delayed_imports():
global errors, marionette, Addons
global errors, marionette
from marionette_driver import marionette, errors
from marionette_driver.addons import Addons
# Marionette client used to be called marionette, recently it changed
# to marionette_driver for unfathomable reasons
try:
import marionette
from marionette import errors
except ImportError:
from marionette_driver import marionette, errors
def _switch_to_window(marionette, handle):
@ -714,6 +717,7 @@ class MarionetteProtocol(Protocol):
class ExecuteAsyncScriptRun(TimedRunner):
def set_timeout(self):
timeout = self.timeout
@ -786,8 +790,6 @@ class MarionetteTestharnessExecutor(TestharnessExecutor):
self.window_id = str(uuid.uuid4())
self.debug = debug
self.install_extensions = browser.extensions
self.original_pref_values = {}
if marionette is None:
@ -795,11 +797,6 @@ class MarionetteTestharnessExecutor(TestharnessExecutor):
def setup(self, runner):
super(MarionetteTestharnessExecutor, self).setup(runner)
for extension_path in self.install_extensions:
self.logger.info("Installing extension from %s" % extension_path)
addons = Addons(self.protocol.marionette)
addons.install(extension_path)
self.protocol.testharness.load_runner(self.last_environment["protocol"])
def is_alive(self):

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

@ -98,12 +98,7 @@ class TestRunner(object):
def run(self):
"""Main loop accepting commands over the pipe and triggering
the associated methods"""
try:
self.setup()
except Exception:
self.logger.warning("An error occured during executor setup:\n%s" %
traceback.format_exc())
raise
self.setup()
commands = {"run_test": self.run_test,
"reset": self.reset,
"stop": self.stop,

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

@ -284,8 +284,6 @@ scheme host and port.""")
help="Disable fission in Gecko.")
gecko_group.add_argument("--stackfix-dir", dest="stackfix_dir", action="store",
help="Path to directory containing assertion stack fixing scripts")
gecko_group.add_argument("--specialpowers-path", action="store",
help="Path to specialPowers extension xpi file")
gecko_group.add_argument("--setpref", dest="extra_prefs", action='append',
default=[], metavar="PREF=VALUE",
help="Defines an extra user preference (overrides those in prefs_root)")

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

@ -157,19 +157,15 @@ class Test(object):
default_timeout = 10 # seconds
long_timeout = 60 # seconds
def __init__(self, url_base, tests_root, url, inherit_metadata, test_metadata,
def __init__(self, tests_root, url, inherit_metadata, test_metadata,
timeout=None, path=None, protocol="http", quic=False):
self.url_base = url_base
self.tests_root = tests_root
self.url = url
self._inherit_metadata = inherit_metadata
self._test_metadata = test_metadata
self.timeout = timeout if timeout is not None else self.default_timeout
self.path = path
self.environment = {"url_base": url_base,
"protocol": protocol,
"prefs": self.prefs,
"quic": quic}
self.environment = {"protocol": protocol, "prefs": self.prefs, "quic": quic}
def __eq__(self, other):
if not isinstance(other, Test):
@ -188,8 +184,7 @@ class Test(object):
@classmethod
def from_manifest(cls, manifest_file, manifest_item, inherit_metadata, test_metadata):
timeout = cls.long_timeout if manifest_item.timeout == "long" else cls.default_timeout
return cls(manifest_file.url_base,
manifest_file.tests_root,
return cls(manifest_file.tests_root,
manifest_item.url,
inherit_metadata,
test_metadata,
@ -398,10 +393,10 @@ class TestharnessTest(Test):
subtest_result_cls = TestharnessSubtestResult
test_type = "testharness"
def __init__(self, url_base, tests_root, url, inherit_metadata, test_metadata,
def __init__(self, tests_root, url, inherit_metadata, test_metadata,
timeout=None, path=None, protocol="http", testdriver=False,
jsshell=False, scripts=None, quic=False):
Test.__init__(self, url_base, tests_root, url, inherit_metadata, test_metadata, timeout,
Test.__init__(self, tests_root, url, inherit_metadata, test_metadata, timeout,
path, protocol, quic)
self.testdriver = testdriver
@ -417,8 +412,7 @@ class TestharnessTest(Test):
script_metadata = manifest_item.script_metadata or []
scripts = [v for (k, v) in script_metadata
if k == "script"]
return cls(manifest_file.url_base,
manifest_file.tests_root,
return cls(manifest_file.tests_root,
manifest_item.url,
inherit_metadata,
test_metadata,
@ -458,10 +452,10 @@ class ReftestTest(Test):
result_cls = ReftestResult
test_type = "reftest"
def __init__(self, url_base, tests_root, url, inherit_metadata, test_metadata, references,
def __init__(self, tests_root, url, inherit_metadata, test_metadata, references,
timeout=None, path=None, viewport_size=None, dpi=None, fuzzy=None, protocol="http",
quic=False):
Test.__init__(self, url_base, tests_root, url, inherit_metadata, test_metadata, timeout,
Test.__init__(self, tests_root, url, inherit_metadata, test_metadata, timeout,
path, protocol, quic)
for _, ref_type in references:
@ -492,8 +486,7 @@ class ReftestTest(Test):
url = manifest_test.url
node = cls(manifest_file.url_base,
manifest_file.tests_root,
node = cls(manifest_file.tests_root,
manifest_test.url,
inherit_metadata,
test_metadata,
@ -612,7 +605,7 @@ class ReftestTest(Test):
class PrintReftestTest(ReftestTest):
test_type = "print-reftest"
def __init__(self, url_base, tests_root, url, inherit_metadata, test_metadata, references,
def __init__(self, tests_root, url, inherit_metadata, test_metadata, references,
timeout=None, path=None, viewport_size=None, dpi=None, fuzzy=None,
page_ranges=None, protocol="http", quic=False):
super(PrintReftestTest, self).__init__(tests_root, url, inherit_metadata, test_metadata,