зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset a209d4d37f8f (bug 1147031) for Luciddream bustage.
This commit is contained in:
Родитель
a569d7335f
Коммит
720e898086
|
@ -52,7 +52,6 @@ SEARCH_PATHS = [
|
|||
'testing/marionette/client',
|
||||
'testing/marionette/transport',
|
||||
'testing/marionette/driver',
|
||||
'testing/luciddream',
|
||||
'testing/mozbase/mozcrash',
|
||||
'testing/mozbase/mozdebug',
|
||||
'testing/mozbase/mozdevice',
|
||||
|
@ -85,7 +84,6 @@ MACH_MODULES = [
|
|||
'python/mozbuild/mozbuild/backend/mach_commands.py',
|
||||
'python/mozbuild/mozbuild/frontend/mach_commands.py',
|
||||
'services/common/tests/mach_commands.py',
|
||||
'testing/luciddream/mach_commands.py',
|
||||
'testing/mach_commands.py',
|
||||
'testing/taskcluster/mach_commands.py',
|
||||
'testing/marionette/mach_commands.py',
|
||||
|
|
|
@ -10,9 +10,8 @@ from marionette.marionette_test import MarionetteTestCase, MarionetteJSTestCase
|
|||
from marionette_driver.errors import ScriptTimeoutException
|
||||
|
||||
class LucidDreamTestCase(MarionetteTestCase):
|
||||
def __init__(self, marionette_weakref, browser=None, logger=None, **kwargs):
|
||||
def __init__(self, marionette_weakref, browser=None, **kwargs):
|
||||
self.browser = browser
|
||||
self.logger = logger
|
||||
MarionetteTestCase.__init__(self, marionette_weakref, **kwargs)
|
||||
|
||||
def run_js_test(self, filename, marionette):
|
||||
|
|
|
@ -76,7 +76,7 @@ class LucidDreamTestRunner(BaseMarionetteTestRunner):
|
|||
self.test_handlers = [LucidDreamTestCase]
|
||||
|
||||
|
||||
def start_browser(browserPath, app_args):
|
||||
def start_browser(browserPath):
|
||||
'''
|
||||
Start a Firefox browser and return a Marionette instance that
|
||||
can talk to it.
|
||||
|
@ -86,8 +86,6 @@ def start_browser(browserPath, app_args):
|
|||
# Need to avoid the browser and emulator's ports stepping
|
||||
# on each others' toes.
|
||||
port=2929,
|
||||
app_args=app_args,
|
||||
gecko_log="firefox.log"
|
||||
)
|
||||
runner = marionette.runner
|
||||
if runner:
|
||||
|
@ -100,7 +98,14 @@ def start_browser(browserPath, app_args):
|
|||
|
||||
#TODO: make marionette/client/marionette/runtests.py importable so we can
|
||||
# just use cli from there. A lot of this is copy/paste from that function.
|
||||
def main(firefox=None, b2g_desktop=None, emulator=None, emulator_arch=None, gaia_profile=None, manifest=None, browser_args=None, **kwargs):
|
||||
def main():
|
||||
try:
|
||||
args = parse_args(sys.argv[1:])
|
||||
except CommandLineError as e:
|
||||
return 1
|
||||
|
||||
logger = structured.commandline.setup_logging(
|
||||
'luciddream', args, {"tbpl": sys.stdout})
|
||||
|
||||
# It's sort of debatable here whether the marionette instance managed
|
||||
# by the test runner should be the browser or the emulator. Right now
|
||||
|
@ -108,43 +113,39 @@ def main(firefox=None, b2g_desktop=None, emulator=None, emulator_arch=None, gaia
|
|||
# that, but longer-term if we want to run tests against different
|
||||
# (non-B2G) targets this won't match up very well, so maybe it ought to
|
||||
# be the browser?
|
||||
browser = start_browser(firefox, browser_args)
|
||||
|
||||
kwargs["browser"] = browser
|
||||
if not "logger" in kwargs:
|
||||
logger = structured.commandline.setup_logging(
|
||||
"luciddream", kwargs, {"tbpl": sys.stdout})
|
||||
kwargs["logger"] = logger
|
||||
|
||||
if emulator:
|
||||
kwargs['homedir'] = emulator
|
||||
kwargs['emulator'] = emulator_arch
|
||||
elif b2g_desktop:
|
||||
browser = start_browser(args.browserPath)
|
||||
kwargs = {
|
||||
'browser': browser,
|
||||
'logger': logger,
|
||||
}
|
||||
if args.b2gPath:
|
||||
kwargs['homedir'] = args.b2gPath
|
||||
kwargs['emulator'] = args.emulator
|
||||
elif args.b2gDesktopPath:
|
||||
# Work around bug 859952
|
||||
if '-bin' not in b2g_desktop:
|
||||
if b2g_desktop.endswith('.exe'):
|
||||
newpath = b2g_desktop[:-4] + '-bin.exe'
|
||||
if '-bin' not in args.b2gDesktopPath:
|
||||
if args.b2gDesktopPath.endswith('.exe'):
|
||||
newpath = args.b2gDesktopPath[:-4] + '-bin.exe'
|
||||
else:
|
||||
newpath = b2g_desktop + '-bin'
|
||||
newpath = args.b2gDesktopPath + '-bin'
|
||||
if os.path.exists(newpath):
|
||||
b2g_desktop = newpath
|
||||
kwargs['binary'] = b2g_desktop
|
||||
args.b2gDesktopPath = newpath
|
||||
kwargs['binary'] = args.b2gDesktopPath
|
||||
kwargs['app'] = 'b2gdesktop'
|
||||
if gaia_profile:
|
||||
kwargs['profile'] = gaia_profile
|
||||
if args.gaiaProfile:
|
||||
kwargs['profile'] = args.gaiaProfile
|
||||
else:
|
||||
kwargs['profile'] = os.path.join(
|
||||
os.path.dirname(b2g_desktop),
|
||||
os.path.dirname(args.b2gDesktopPath),
|
||||
'gaia',
|
||||
'profile'
|
||||
)
|
||||
runner = LucidDreamTestRunner(**kwargs)
|
||||
runner.run_tests([manifest])
|
||||
runner.run_tests([args.manifest])
|
||||
if runner.failed > 0:
|
||||
sys.exit(10)
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
args = parse_args(sys.argv[1:])
|
||||
main(args)
|
||||
main()
|
||||
|
|
|
@ -1,99 +0,0 @@
|
|||
# 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/.
|
||||
|
||||
# Integrates luciddream test runner with mach.
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
import mozpack.path as mozpath
|
||||
|
||||
from mozbuild.base import (
|
||||
MachCommandBase,
|
||||
MachCommandConditions as conditions,
|
||||
MozbuildObject,
|
||||
)
|
||||
|
||||
from mach.decorators import (
|
||||
CommandArgument,
|
||||
CommandProvider,
|
||||
Command,
|
||||
)
|
||||
|
||||
class LucidDreamRunner(MozbuildObject):
|
||||
"""Run luciddream tests."""
|
||||
def run_tests(self, **kwargs):
|
||||
self._run_make(target='jetpack-tests')
|
||||
|
||||
@CommandProvider
|
||||
class MachCommands(MachCommandBase):
|
||||
@Command('luciddream', category='testing',
|
||||
description='Runs the luciddream test suite.')
|
||||
@CommandArgument("--consoles", dest="consoles", action="store_true",
|
||||
help="Open jsconsole in both runtimes.")
|
||||
@CommandArgument('--b2g-desktop', type=str, default=None,
|
||||
help='Path to b2g desktop binary.')
|
||||
@CommandArgument('--firefox', type=str, default=None,
|
||||
help='Path to firefox binary.')
|
||||
@CommandArgument('--gaia-profile', type=str, default=None,
|
||||
help='Path to gaia profile, optional, if not bundled with b2g desktop.')
|
||||
@CommandArgument('--emulator', type=str, default=None,
|
||||
help='Path to android emulator.')
|
||||
@CommandArgument('--emulator-arch', type=str, default="x86",
|
||||
help='Emulator arch: x86 or arm.')
|
||||
@CommandArgument('test_paths', default=None, nargs='*', metavar='TEST',
|
||||
help='Test to run. Can be specified as a single file, a '
|
||||
'directory, or omitted. If omitted, the entire test suite is '
|
||||
'executed.')
|
||||
def run_luciddream_test(self, firefox, b2g_desktop, test_paths, consoles, **params):
|
||||
# import luciddream lazily as its marionette dependency make ./mach clobber fails
|
||||
# early on TBPL
|
||||
import luciddream.runluciddream
|
||||
|
||||
# get_binary_path is going to throw if we haven't built any product
|
||||
# but luciddream can still be run if we provide both binaries...
|
||||
binary_path=False
|
||||
try:
|
||||
binary_path = self.get_binary_path()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# otherwise, if we have a build, automatically fetch the binary
|
||||
if conditions.is_b2g(self):
|
||||
if not b2g_desktop and binary_path:
|
||||
b2g_desktop = binary_path
|
||||
else:
|
||||
if not firefox and binary_path:
|
||||
firefox = binary_path
|
||||
|
||||
if not firefox:
|
||||
print "Need firefox binary path via --firefox argument"
|
||||
return 1
|
||||
elif not os.path.exists(firefox):
|
||||
print "Firefox binary doesn't exists: " + firefox
|
||||
return 1
|
||||
|
||||
if not b2g_desktop:
|
||||
print "Need b2g desktop binary path via --b2g-desktop argument"
|
||||
return 1
|
||||
elif not os.path.exists(b2g_desktop):
|
||||
print "B2G desktop binary doesn't exists: " + b2g_desktop
|
||||
return 1
|
||||
|
||||
if not test_paths or len(test_paths) == 0:
|
||||
print "Please specify a test manifest to run"
|
||||
return 1
|
||||
|
||||
browser_args = None
|
||||
if consoles:
|
||||
browser_args = ["-jsconsole"]
|
||||
if "app_args" in params and isinstance(params["app_args"], list):
|
||||
params["app_args"].append("-jsconsole")
|
||||
else:
|
||||
params["app_args"] = ["-jsconsole"]
|
||||
|
||||
for test in test_paths:
|
||||
luciddream.runluciddream.main(firefox=firefox, b2g_desktop=b2g_desktop,
|
||||
manifest=test, browser_args=browser_args, **params)
|
|
@ -87,10 +87,6 @@ TEST_SUITES = {
|
|||
'mach_command': 'mochitest',
|
||||
'kwargs': {'flavor': 'mochitest', 'test_paths': None},
|
||||
},
|
||||
'luciddream': {
|
||||
'mach_command': 'luciddream',
|
||||
'kwargs': {'test_paths': None},
|
||||
},
|
||||
'reftest': {
|
||||
'aliases': ('RR', 'rr', 'Rr'),
|
||||
'mach_command': 'reftest',
|
||||
|
|
Загрузка…
Ссылка в новой задаче