Bug 1543725 Add marionette support to thunderbird r=ato,whimboo

Differential Revision: https://phabricator.services.mozilla.com/D27102

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Samuel Thibault 2019-06-05 07:59:19 +00:00
Родитель 7b16930b86
Коммит d708762a60
3 изменённых файлов: 57 добавлений и 7 удалений

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

@ -631,6 +631,20 @@ if buildconfig.substs.get('commtopsrcdir'):
'dest': 'mozharness/configs'
}
ARCHIVE_FILES['mozharness'].append(mozharness_comm)
marionette_comm = {
'source': commtopsrcdir,
'base': '',
'manifest': 'testing/marionette/unit-tests.ini',
'dest': 'marionette/tests/comm',
}
ARCHIVE_FILES['common'].append(marionette_comm)
thunderbirdinstance = {
'source': commtopsrcdir,
'base': 'testing/marionette',
'pattern': 'thunderbirdinstance.py',
'dest': 'marionette/client/marionette_driver',
}
ARCHIVE_FILES['common'].append(thunderbirdinstance)
# "common" is our catch all archive and it ignores things from other archives.
@ -707,7 +721,7 @@ def find_files(archive):
if manifest:
manifests.append(manifest)
if manifests:
dirs = find_manifest_dirs(buildconfig.topsrcdir, manifests)
dirs = find_manifest_dirs(os.path.join(source, base), manifests)
patterns.extend({'{}/**'.format(d) for d in dirs})
ignore = list(entry.get('ignore', []))

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

@ -591,6 +591,21 @@ class DesktopInstance(GeckoInstance):
self.required_prefs.update(required_prefs)
class ThunderbirdInstance(GeckoInstance):
def __init__(self, *args, **kwargs):
super(ThunderbirdInstance, self).__init__(*args, **kwargs)
try:
# Copied alongside in the test archive
from .thunderbirdinstance import thunderbird_prefs
except ImportError:
try:
# Coming from source tree through virtualenv
from thunderbirdinstance import thunderbird_prefs
except ImportError:
thunderbird_prefs = {}
self.required_prefs.update(thunderbird_prefs)
class NullOutput(object):
def __call__(self, line):
pass
@ -599,9 +614,11 @@ class NullOutput(object):
apps = {
'fennec': FennecInstance,
'fxdesktop': DesktopInstance,
'thunderbird': ThunderbirdInstance,
}
app_ids = {
'{aa3c5121-dab2-40e2-81ca-7ea25febc110}': 'fennec',
'{ec8030f7-c20a-464f-9b0e-13a3a9e97384}': 'fxdesktop',
'{3550f703-e582-4d05-9a08-453d09bdfdc6}': 'thunderbird',
}

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

@ -18,6 +18,7 @@ from mozbuild.base import (
MachCommandConditions as conditions,
)
SUPPORTED_APPS = ['firefox', 'android', 'thunderbird']
def create_parser_tests():
from marionette_harness.runtests import MarionetteArguments
@ -38,10 +39,6 @@ def run_marionette(tests, binary=None, topsrcdir=None, **kwargs):
parser = create_parser_tests()
if not tests:
tests = [os.path.join(topsrcdir,
"testing/marionette/harness/marionette_harness/tests/unit-tests.ini")]
args = argparse.Namespace(tests=tests)
args.binary = binary
@ -63,12 +60,25 @@ def run_marionette(tests, binary=None, topsrcdir=None, **kwargs):
return 0
def is_buildapp_in(*apps):
def is_buildapp_supported(cls):
for a in apps:
c = getattr(conditions, 'is_{}'.format(a), None)
if c and c(cls):
return True
return False
is_buildapp_supported.__doc__ = 'Must have a {} build.'.format(
' or '.join(apps))
return is_buildapp_supported
@CommandProvider
class MarionetteTest(MachCommandBase):
@Command("marionette-test",
category="testing",
description="Remote control protocol to Gecko, used for browser automation.",
conditions=[conditions.is_firefox_or_android],
conditions=[is_buildapp_in(*SUPPORTED_APPS)],
parser=create_parser_tests,
)
def marionette_test(self, tests, **kwargs):
@ -78,11 +88,20 @@ class MarionetteTest(MachCommandBase):
tests.append(obj["file_relpath"])
del kwargs["test_objects"]
if not tests:
if conditions.is_thunderbird(self):
tests = [os.path.join(self.topsrcdir,
"comm/testing/marionette/unit-tests.ini")]
else:
tests = [os.path.join(self.topsrcdir,
"testing/marionette/harness/marionette_harness/tests/unit-tests.ini")]
# Force disable e10s because it is not supported in Fennec
if kwargs.get("app") == "fennec":
kwargs["e10s"] = False
if not kwargs.get("binary") and conditions.is_firefox(self):
if not kwargs.get("binary") and \
(conditions.is_firefox(self) or conditions.is_thunderbird(self)):
kwargs["binary"] = self.get_binary_path("app")
return run_marionette(tests, topsrcdir=self.topsrcdir, **kwargs)