Bug 1303590 - Remove Luciddream test suite r=aobreja

This commit is contained in:
Kim Moir 2016-09-23 09:20:54 -04:00
parent 29ea45e195
commit 9334cbf678
16 changed files with 0 additions and 885 deletions

View File

@ -67,7 +67,6 @@ SEARCH_PATHS = [
'testing', 'testing',
'testing/firefox-ui/harness', 'testing/firefox-ui/harness',
'testing/firefox-ui/tests', 'testing/firefox-ui/tests',
'testing/luciddream',
'testing/marionette/harness', 'testing/marionette/harness',
'testing/marionette/harness/marionette/runner/mixins/browsermob-proxy-py', 'testing/marionette/harness/marionette/runner/mixins/browsermob-proxy-py',
'testing/marionette/client', 'testing/marionette/client',
@ -119,7 +118,6 @@ MACH_MODULES = [
'services/common/tests/mach_commands.py', 'services/common/tests/mach_commands.py',
'taskcluster/mach_commands.py', 'taskcluster/mach_commands.py',
'testing/firefox-ui/mach_commands.py', 'testing/firefox-ui/mach_commands.py',
'testing/luciddream/mach_commands.py',
'testing/mach_commands.py', 'testing/mach_commands.py',
'testing/marionette/mach_commands.py', 'testing/marionette/mach_commands.py',
'testing/mochitest/mach_commands.py', 'testing/mochitest/mach_commands.py',

View File

@ -80,7 +80,6 @@ UNITTEST_ALIASES = {
'jittests': alias_prefix('jittest'), 'jittests': alias_prefix('jittest'),
'jsreftest': alias_prefix('jsreftest'), 'jsreftest': alias_prefix('jsreftest'),
'jsreftest-e10s': alias_prefix('jsreftest-e10s'), 'jsreftest-e10s': alias_prefix('jsreftest-e10s'),
'luciddream': alias_prefix('luciddream'),
'marionette': alias_prefix('marionette'), 'marionette': alias_prefix('marionette'),
'marionette-e10s': alias_prefix('marionette-e10s'), 'marionette-e10s': alias_prefix('marionette-e10s'),
'mochitest': alias_prefix('mochitest'), 'mochitest': alias_prefix('mochitest'),

View File

@ -1,59 +0,0 @@
Luciddream is a test harness for running tests between a Firefox browser and another device, such as a Firefox OS emulator.
The primary goal of the project is to be able to test the Firefox Developer Tools' [remote debugging feature](https://developer.mozilla.org/en-US/docs/Tools/Remote_Debugging), where the developer tools can be used to debug web content running in another browser or device. Mozilla currently doesn't have any automated testing of this feature, so getting some automated tests running is a high priority.
The first planned milestone (for Q4 2014) is to stand up a prototype of a harness, in the process figuring out what the harness will look like and what tests will look like. This work is tracked in [bug 1064253](https://bugzilla.mozilla.org/show_bug.cgi?id=1064253) and is nearing completion. The current harness is based on the [Marionette Test Runner](https://developer.mozilla.org/en-US/docs/Marionette_Test_Runner), and tests right now are a subclass of [Marionette Python tests](https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/Marionette_Python_Tests).
The second planned milestone (for Q1 2015) is to get the harness running in Mozilla's continuous integration environment. Whether this will be in the legacy Buildbot environment or the new TaskCluster environment is yet to be determined. The bare minimum for this milestone will be having the tests run per-checkin against a Firefox Linux desktop build and a Firefox OS emulator both built from the same changeset. A stretch goal for this milestone will be to get tests running against a Firefox Linux desktop build per-checkin paired with stable release builds of the Firefox OS emulator, to be able to test backwards-compatibility of remote debugging. It's likely that as part of this work the repository of record will move from GitHub to mozilla-central, and the harness may be renamed from the current codename to a more descriptive (but less fun) name.
Future directions will likely include testing Firefox desktop remote debugging against other platforms, such as Firefox for Android, desktop Chrome, Chrome for Android, and Safari on iOS.
Points of Contact
=================
The primary developer of this project is Ted Mielczarek (@luser), ted on irc.mozilla.org, :ted in bugzilla.mozilla.org.
The primary DevTools point of contact is Alexandre Poirot (@ochameau), ochameau on irc.mozilla.org, :ochameau in bugzilla.mozilla.org.
Installation and Configuration
==============================
Currently running Luciddream is only supported on Linux, as the Firefox OS emulator is only well-supported there.
Install this module and its Python prerequisites in a virtualenv:
```
virtualenv ./ve
. ./ve/bin/activate
python setup.py develop
```
[Download a Firefox build](http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-mozilla-central/) (if you don't already have one).
Download one of:
* [A Firefox OS emulator build](http://pvtbuilds.pvt.build.mozilla.org/pub/mozilla.org/b2g/tinderbox-builds/mozilla-central-emulator/) (if you don't already have one, this link requires Mozilla VPN access).
* [A B2G desktop build](http://ftp.mozilla.org/pub/mozilla.org/b2g/nightly/latest-mozilla-central/)
Unzip both your Firefox and your Firefox OS emulator/B2G desktop somewhere.
If you're on a 64-bit Ubuntu, you may need to do some fiddling to ensure you have the 32-bit OpenGL libraries available. See the "Solution : have both 32bit and 64bit OpenGL libs installed, with the right symlinks" section [in this blog post](http://rishav006.wordpress.com/2014/05/19/how-to-build-b2g-emulator-in-linux-environment/).
Running Tests
=============
To run with a Firefox OS emulator:
```
runluciddream --b2gpath /path/to/b2g-distro/ --browser-path /path/to/firefox/firefox example-tests/luciddream.ini
```
To run with B2G desktop:
```
runluciddream --b2g-desktop-path /path/to/b2g/b2g --browser-path /path/to/firefox/firefox example-tests/luciddream.ini
```
If you're using a locally-built B2G desktop build which doesn't have a Gaia profile included you should get Gaia and build a profile, and then pass that in with the `--gaia-profile` option:
```
runluciddream --b2g-desktop-path /path/to/obj-b2g/dist/bin/b2g --gaia-profile /path/to/gaia/profile --browser-path /path/to/firefox/firefox example-tests/luciddream.ini
```

View File

@ -1 +0,0 @@
[test_sample.py]

View File

@ -1,6 +0,0 @@
ok(true, "Assertion from a JS script!");
//ok(false, "test failure");
setTimeout(function() {
ok(true, "Assertion from setTimeout!");
finish();
}, 15);

View File

@ -1,15 +0,0 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
from luciddream import LucidDreamTestCase
class TestSample(LucidDreamTestCase):
def test_sample(self):
#TODO: make this better
self.assertIsNotNone(self.marionette.session)
self.assertIsNotNone(self.browser.session)
def test_js(self):
'Test that we can run a JavaScript test in both Marionette instances'
self.run_js_test('test.js', self.marionette)
self.run_js_test('test.js', self.browser)

View File

@ -1,111 +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/.
#
import os
import sys
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):
self.browser = browser
self.logger = logger
MarionetteTestCase.__init__(self, marionette_weakref, **kwargs)
def run_js_test(self, filename, marionette):
'''
Run a JavaScript test file and collect its set of assertions
into the current test's results.
:param filename: The path to the JavaScript test file to execute.
May be relative to the current script.
:param marionette: The Marionette object in which to execute the test.
'''
caller_file = sys._getframe(1).f_globals.get('__file__', '')
caller_file = os.path.abspath(caller_file)
script = os.path.join(os.path.dirname(caller_file), filename)
self.assert_(os.path.exists(script), 'Script "%s" must exist' % script)
if hasattr(MarionetteTestCase, 'run_js_test'):
return MarionetteTestCase.run_js_test(self, script, marionette)
#XXX: copy/pasted from marionette_test.py, refactor this!
f = open(script, 'r')
js = f.read()
args = []
head_js = MarionetteJSTestCase.head_js_re.search(js);
if head_js:
head_js = head_js.group(3)
head = open(os.path.join(os.path.dirname(script), head_js), 'r')
js = head.read() + js;
context = MarionetteJSTestCase.context_re.search(js)
if context:
context = context.group(3)
else:
context = 'content'
marionette.set_context(context)
if context != "chrome":
marionette.navigate('data:text/html,<html>test page</html>')
timeout = MarionetteJSTestCase.timeout_re.search(js)
if timeout:
timeout = timeout.group(3)
marionette.set_script_timeout(timeout)
inactivity_timeout = MarionetteJSTestCase.inactivity_timeout_re.search(js)
if inactivity_timeout:
inactivity_timeout = inactivity_timeout.group(3)
try:
results = marionette.execute_js_script(js,
args,
special_powers=True,
inactivity_timeout=inactivity_timeout,
filename=os.path.basename(script))
self.assertTrue(not 'timeout' in script,
'expected timeout not triggered')
if 'fail' in script:
self.assertTrue(len(results['failures']) > 0,
"expected test failures didn't occur")
else:
for failure in results['failures']:
diag = "" if failure.get('diag') is None else failure['diag']
name = "got false, expected true" if failure.get('name') is None else failure['name']
self.logger.test_status(self.test_name, name, 'FAIL',
message=diag)
for failure in results['expectedFailures']:
diag = "" if failure.get('diag') is None else failure['diag']
name = "got false, expected false" if failure.get('name') is None else failure['name']
self.logger.test_status(self.test_name, name, 'FAIL',
expected='FAIL', message=diag)
for failure in results['unexpectedSuccesses']:
diag = "" if failure.get('diag') is None else failure['diag']
name = "got true, expected false" if failure.get('name') is None else failure['name']
self.logger.test_status(self.test_name, name, 'PASS',
expected='FAIL', message=diag)
self.assertEqual(0, len(results['failures']),
'%d tests failed' % len(results['failures']))
if len(results['unexpectedSuccesses']) > 0:
raise _UnexpectedSuccess('')
if len(results['expectedFailures']) > 0:
raise _ExpectedFailure((AssertionError, AssertionError(''), None))
self.assertTrue(results['passed']
+ len(results['failures'])
+ len(results['expectedFailures'])
+ len(results['unexpectedSuccesses']) > 0,
'no tests run')
except ScriptTimeoutException:
if 'timeout' in script:
# expected exception
pass
else:
self.loglines = marionette.get_logs()
raise

View File

@ -1,157 +0,0 @@
#!/usr/bin/env python
#
# 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 print_function
import argparse
import os
import sys
from luciddream import LucidDreamTestCase
from marionette import Marionette
from marionette.runner import BaseMarionetteTestRunner
import marionette
import mozlog
class CommandLineError(Exception):
pass
def validate_options(options):
if not (options.emulator_path or options.b2g_desktop_path):
raise CommandLineError('You must specify --emulator-path or ' +
'--b2g-desktop-path')
if options.emulator_path and options.b2g_desktop_path:
raise CommandLineError('You may only use one of --emulator-path or ' +
'--b2g-desktop-path')
if options.gaia_profile and options.emulator_path:
raise CommandLineError('You may not use --gaia-profile with ' +
'--emulator-path')
if not options.browser_path:
raise CommandLineError('You must specify --browser-path')
if not os.path.isfile(options.manifest):
raise CommandLineError('The manifest at "%s" does not exist!'
% options.manifest)
# BaseMarionetteOptions has a lot of stuff we don't care about, and
# it seems hard to apply directly to this problem. We can revisit this
# decision later if necessary.
def parse_args(in_args):
parser = argparse.ArgumentParser(description='Run Luciddream tests.')
parser.add_argument('--emulator-arch', dest='emulator_arch', action='store',
default='arm',
help='Architecture of emulator to use: x86 or arm')
parser.add_argument('--emulator-path', dest='emulator_path', action='store',
help='path to B2G repo or qemu dir')
parser.add_argument('--b2g-desktop-path', dest='b2g_desktop_path',
action='store',
help='path to B2G desktop binary')
parser.add_argument('--browser-path', dest='browser_path', action='store',
help='path to Firefox binary')
parser.add_argument('--gaia-profile', dest='gaia_profile', action='store',
help='path to Gaia profile')
parser.add_argument('--startup-timeout', dest='startup_timeout', action='store',
default=60, type=int,
help='max time to wait for Marionette to be available after launching binary')
parser.add_argument('manifest', metavar='MANIFEST', action='store',
help='path to manifest of tests to run')
mozlog.commandline.add_logging_group(parser)
args = parser.parse_args(in_args)
try:
validate_options(args)
return args
except CommandLineError as e:
print('Error: ', e.args[0], file=sys.stderr)
parser.print_help()
raise
class LucidDreamTestRunner(BaseMarionetteTestRunner):
def __init__(self, **kwargs):
BaseMarionetteTestRunner.__init__(self, **kwargs)
#TODO: handle something like MarionetteJSTestCase
self.test_handlers = [LucidDreamTestCase]
def start_browser(browser_path, app_args, startup_timeout):
'''
Start a Firefox browser and return a Marionette instance that
can talk to it.
'''
marionette = Marionette(
bin=browser_path,
# Need to avoid the browser and emulator's ports stepping
# on each others' toes.
port=2929,
app_args=app_args,
gecko_log="firefox.log",
startup_timeout=startup_timeout
)
runner = marionette.runner
if runner:
runner.start()
marionette.wait_for_port()
marionette.start_session()
marionette.set_context(marionette.CONTEXT_CHROME)
return marionette
# TODO: make ../../marionette/harness/marionette/runtests.py importable
# so we can just use cli from there. A lot of this is copy/paste from that function.
def run(browser_path=None, b2g_desktop_path=None, emulator_path=None,
emulator_arch=None, gaia_profile=None, manifest=None, browser_args=None,
**kwargs):
# It's sort of debatable here whether the marionette instance managed
# by the test runner should be the browser or the emulator. Right now
# it's the emulator because it feels like there's more fiddly setup around
# 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(browser_path, browser_args, kwargs['startup_timeout'])
kwargs["browser"] = browser
if not "logger" in kwargs:
logger = mozlog.commandline.setup_logging(
"luciddream", kwargs, {"tbpl": sys.stdout})
kwargs["logger"] = logger
if emulator_path:
kwargs['homedir'] = emulator_path
kwargs['emulator'] = emulator_arch
elif b2g_desktop_path:
# Work around bug 859952
if '-bin' not in b2g_desktop_path:
if b2g_desktop_path.endswith('.exe'):
newpath = b2g_desktop_path[:-4] + '-bin.exe'
else:
newpath = b2g_desktop_path + '-bin'
if os.path.exists(newpath):
b2g_desktop_path = newpath
kwargs['binary'] = b2g_desktop_path
kwargs['app'] = 'b2gdesktop'
if gaia_profile:
kwargs['profile'] = gaia_profile
else:
kwargs['profile'] = os.path.join(
os.path.dirname(b2g_desktop_path),
'gaia',
'profile'
)
runner = LucidDreamTestRunner(**kwargs)
runner.run_tests([manifest])
if runner.failed > 0:
sys.exit(10)
sys.exit(0)
def main():
args = parse_args(sys.argv[1:])
run(**vars(args))
if __name__ == '__main__':
main()

View File

@ -1,97 +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.
from __future__ import absolute_import
import os
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='Run the luciddream test suite (remote debugging).')
@CommandArgument("--consoles", action="store_true",
help="Open jsconsole in both runtimes.")
@CommandArgument('--b2g-desktop', dest="b2g_desktop_path", type=str, default=None,
help='Path to b2g desktop binary.')
@CommandArgument('--browser', dest="browser_path", 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', dest="emulator_path", type=str, default=None,
help='Path to android emulator.')
@CommandArgument('--emulator-arch', type=str, default="arm",
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, browser_path, b2g_desktop_path, 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_path and binary_path:
b2g_desktop_path = binary_path
else:
if not browser_path and binary_path:
browser_path = binary_path
if not browser_path:
print "Need firefox binary path via --browser_path argument"
return 1
elif not os.path.exists(browser_path):
print "Firefox binary doesn't exists: " + browser_path
return 1
if not b2g_desktop_path:
print "Need b2g desktop binary path via --b2g-desktop argument"
return 1
elif not os.path.exists(b2g_desktop_path):
print "B2G desktop binary doesn't exists: " + b2g_desktop_path
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.run(browser_path=browser_path, b2g_desktop_path=b2g_desktop_path,
manifest=test, browser_args=browser_args, **params)

View File

@ -1,2 +0,0 @@
marionette-client >= 1.1.0
mozlog >= 3.0

View File

@ -1,43 +0,0 @@
#!/usr/bin/env python
#
# 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/.
#
import os
from setuptools import setup, find_packages
try:
here = os.path.dirname(os.path.abspath(__file__))
description = file(os.path.join(here, 'README.md')).read()
except IOError:
description = ''
version = '0.1'
dependencies = open('requirements.txt', 'r').read().splitlines()
setup(
name='luciddream',
version=version,
description='''
Luciddream is a test harness for running tests between
a Firefox browser and another device, such as a Firefox OS
emulator.
''',
long_description=description,
classifiers=[], # Get strings from http://www.python.org/pypi?%3Aaction=list_classifiers
author='Ted Mielczarek',
author_email='ted@mielczarek.org',
url='',
license='MPL 2.0',
packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
include_package_data=True,
package_data={'': ['*.js', '*.css', '*.html', '*.txt', '*.xpi', '*.rdf', '*.xul', '*.jsm', '*.xml'],},
zip_safe=False,
install_requires=dependencies,
entry_points = {
'console_scripts': ['runluciddream=luciddream.runluciddream:main'],
}
)

View File

@ -103,10 +103,6 @@ TEST_SUITES = {
'mach_command': 'mochitest', 'mach_command': 'mochitest',
'kwargs': {'flavor': 'plain', 'test_paths': None}, 'kwargs': {'flavor': 'plain', 'test_paths': None},
}, },
'luciddream': {
'mach_command': 'luciddream',
'kwargs': {'test_paths': None},
},
'python': { 'python': {
'mach_command': 'python-test', 'mach_command': 'python-test',
'kwargs': {'tests': None}, 'kwargs': {'tests': None},

View File

@ -1,65 +0,0 @@
# This is a template config file for luciddream production.
import os
import platform
HG_SHARE_BASE_DIR = "/builds/hg-shared"
if platform.system().lower() == 'darwin':
xre_url = "https://api.pub.build.mozilla.org/tooltool/sha512/4d8d7a37d90c34a2a2fda3066a8fe85c189b183d05389cb957fc6fed31f10a6924e50c1b84488ff61c015293803f58a3aed5d4819374d04c8e0ee2b9e3997278"
else:
xre_url = "https://api.pub.build.mozilla.org/tooltool/sha512/dc9503b21c87b5a469118746f99e4f41d73888972ce735fa10a80f6d218086da0e3da525d9a4cd8e4ea497ec199fef720e4a525873d77a1af304ac505e076462"
config = {
# mozharness script options
"xre_url": xre_url,
"b2gdesktop_url": "http://ftp.mozilla.org/pub/mozilla.org/b2g/nightly/2015/03/2015-03-09-00-25-06-mozilla-b2g37_v2_2/b2g-37.0.multi.linux-i686.tar.bz2",
# mozharness configuration
"vcs_share_base": HG_SHARE_BASE_DIR,
"exes": {
'python': '/tools/buildbot/bin/python',
'virtualenv': ['/tools/buildbot/bin/python', '/tools/misc-python/virtualenv.py'],
'tooltool.py': "/tools/tooltool.py",
'gittool.py': '%(abs_tools_dir)s/buildfarm/utils/gittool.py',
},
"find_links": [
"http://pypi.pvt.build.mozilla.org/pub",
"http://pypi.pub.build.mozilla.org/pub",
],
"pip_index": False,
"suite_definitions": {
"luciddream-emulator": {
"options": [
"--startup-timeout=300",
"--log-raw=%(raw_log_file)s",
"--log-errorsummary=%(error_summary_file)s",
"--browser-path=%(browser_path)s",
"--b2gpath=%(emulator_path)s",
"%(test_manifest)s"
],
},
"luciddream-b2gdt": {
"options": [
"--startup-timeout=300",
"--log-raw=%(raw_log_file)s",
"--log-errorsummary=%(error_summary_file)s",
"--browser-path=%(browser_path)s",
"--b2g-desktop-path=%(fxos_desktop_path)s",
"--gaia-profile=%(gaia_profile)s",
"%(test_manifest)s"
],
},
},
"buildbot_json_path": "buildprops.json",
"default_blob_upload_servers": [
"https://blobupload.elasticbeanstalk.com",
],
"blob_uploader_auth_file": os.path.join(os.getcwd(), "oauth.txt"),
"download_symbols": "ondemand",
"download_minidump_stackwalk": True,
"tooltool_cache": "/builds/tooltool_cache",
}

View File

@ -98,27 +98,6 @@ config = {
"testsdir": "jit-test/jit-test", "testsdir": "jit-test/jit-test",
"run_timeout": 1000 # Keep in sync with --timeout above. "run_timeout": 1000 # Keep in sync with --timeout above.
}, },
"luciddream-emulator": {
"options": [
"--startup-timeout=300",
"--log-raw=%(raw_log_file)s",
"--log-errorsummary=%(error_summary_file)s",
"--browser-path=%(browser_path)s",
"--b2gpath=%(emulator_path)s",
"%(test_manifest)s"
],
},
"luciddream-b2gdt": {
"options": [
"--startup-timeout=300",
"--log-raw=%(raw_log_file)s",
"--log-errorsummary=%(error_summary_file)s",
"--browser-path=%(browser_path)s",
"--b2g-desktop-path=%(fxos_desktop_path)s",
"--gaia-profile=%(gaia_profile)s",
"%(test_manifest)s"
],
},
"mochitest": { "mochitest": {
"options": [ "options": [
"--appname=%(binary_path)s", "--appname=%(binary_path)s",

View File

@ -1,294 +0,0 @@
#!/usr/bin/env python
# ***** BEGIN LICENSE BLOCK *****
# 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/.
# ***** END LICENSE BLOCK *****
import copy
import os
import sys
# load modules from parent dir
sys.path.insert(1, os.path.dirname(sys.path[0]))
from mozharness.base.errors import BaseErrorList, TarErrorList
from mozharness.base.log import ERROR, FATAL, INFO
from mozharness.base.script import (
BaseScript,
PreScriptAction,
)
from mozharness.base.transfer import TransferMixin
from mozharness.base.vcs.vcsbase import MercurialScript
from mozharness.mozilla.blob_upload import BlobUploadMixin, blobupload_config_options
from mozharness.mozilla.testing.testbase import TestingMixin, testing_config_options
from mozharness.mozilla.mozbase import MozbaseMixin
from mozharness.mozilla.buildbot import TBPL_SUCCESS, TBPL_WARNING, TBPL_FAILURE
from mozharness.mozilla.structuredlog import StructuredOutputParser
from mozharness.mozilla.testing.unittest import TestSummaryOutputParserHelper
from mozharness.mozilla.gaia import GaiaMixin
class LuciddreamTest(TestingMixin, MercurialScript, MozbaseMixin, BaseScript,
BlobUploadMixin, TransferMixin, GaiaMixin):
config_options = [[
["--emulator-url"],
{"action": "store",
"dest": "emulator_url",
"default": None,
"help": "URL to the emulator zip",
}
], [
["--gaia-profile"],
{"action": "store",
"dest": "gaia_profile",
"help": "path to gaia profile",
}
], [
["--gaia-repo"],
{"action": "store",
"dest": "gaia_repo",
"default": "https://hg.mozilla.org/integration/gaia-central",
"help": "url of gaia repo to clone"
}
], [
["--gaia-branch"],
{"action": "store",
"dest": "gaia_branch",
"default": "default",
"help": "branch of gaia repo to clone"
}
], [
["--b2g-desktop-path"],
{"action": "store",
"dest": "b2gdesktop_path",
"help": "path to b2gdesktop binary",
}
], [
["--b2g-desktop-url"],
{"action": "store",
"dest": "b2gdesktop_url",
"help": "URL to b2gdesktop archive",
}
], [
["--xre-path"],
{"action": "store",
"dest": "xre_path",
"default": "xulrunner-sdk",
"help": "directory (relative to gaia repo) of xulrunner-sdk"
}
], [
["--xre-url"],
{"action": "store",
"dest": "xre_url",
"default": None,
"help": "url of desktop xre archive"
}
]] + copy.deepcopy(testing_config_options) \
+ copy.deepcopy(blobupload_config_options)
def __init__(self, require_config_file=False):
super(LuciddreamTest, self).__init__(
config_options=self.config_options,
all_actions=['clobber',
'read-buildbot-config',
'download-and-extract',
'pull',
'create-virtualenv',
'install',
'run-tests'],
default_actions=['clobber',
'read-buildbot-config',
'download-and-extract',
'pull',
'create-virtualenv',
'install',
'run-tests'],
require_config_file=require_config_file,
config={
'require_test_zip': True,
'emulator': 'arm',
'virtualenv_modules': [
'mozinstall',
],
}
)
# these are necessary since self.config is read only
c = self.config
self.installer_url = c.get('installer_url')
self.installer_path = c.get('installer_path')
self.emulator_url = c.get('emulator_url')
self.binary_path = c.get('binary_path')
self.test_url = c.get('test_url')
self.test_packages_url = c.get('test_packages_url')
if c.get('structured_output'):
self.parser_class = StructuredOutputParser
else:
self.parser_class = TestSummaryOutputParserHelper
def query_abs_dirs(self):
if self.abs_dirs:
return self.abs_dirs
abs_dirs = super(LuciddreamTest, self).query_abs_dirs()
dirs = {}
dirs['abs_blob_upload_dir'] = os.path.join(
abs_dirs['abs_work_dir'], 'logs')
dirs['abs_test_install_dir'] = os.path.join(
abs_dirs['abs_work_dir'], 'tests')
dirs['abs_emulator_dir'] = os.path.join(
abs_dirs['abs_work_dir'], 'emulator')
dirs['abs_b2g-distro_dir'] = os.path.join(
dirs['abs_emulator_dir'], 'b2g-distro')
dirs['abs_b2g_desktop'] = os.path.join(
abs_dirs['abs_work_dir'], 'b2gdesktop')
gaia_root_dir = self.config.get('gaia_dir')
if not gaia_root_dir:
gaia_root_dir = self.config['base_work_dir']
dirs['abs_gaia_dir'] = os.path.join(gaia_root_dir, 'gaia')
abs_dirs.update(dirs)
self.abs_dirs = abs_dirs
return self.abs_dirs
def install_emulator(self):
dirs = self.query_abs_dirs()
self.mkdir_p(dirs['abs_emulator_dir'])
tarfile = self.download_file(self.emulator_url,
parent_dir=dirs['abs_work_dir'],
error_level=FATAL)
self.emulator_path = tarfile
tar = self.query_exe('tar', return_type='list')
self.run_command(tar + ['zxf', self.emulator_path],
cwd=dirs['abs_emulator_dir'],
error_list=TarErrorList,
halt_on_failure=True, fatal_exit_code=3)
def install(self, **kwargs):
super(LuciddreamTest, self).install(**kwargs)
dirs = self.query_abs_dirs()
self.install_app(app='b2g',
target_dir=dirs['abs_b2g_desktop'],
installer_path=self.b2gdesktop_archive)
def setup_gaia(self):
dirs = self.query_abs_dirs()
self.make_gaia(dirs['abs_gaia_dir'],
self.config.get('xre_path'),
xre_url=self.config.get('xre_url'),
debug=False,
noftu=False,
build_config_path=None)
def pull(self, **kwargs):
if self.config.get('b2gdesktop_url') or self.config.get('b2gdesktop_path'):
GaiaMixin.pull(self, **kwargs)
super(LuciddreamTest, self).pull(**kwargs)
def download_and_extract(self):
super(LuciddreamTest, self).download_and_extract()
if self.config.get('emulator_url'):
self.install_emulator()
if self.config.get('b2gdesktop_url'):
dirs = self.query_abs_dirs()
self.mkdir_p(dirs['abs_b2g_desktop'])
self.b2gdesktop_archive = self.download_file(self.config.get('b2gdesktop_url'),
parent_dir=dirs['abs_work_dir'])
@PreScriptAction('create-virtualenv')
def _pre_create_virtualenv(self, action):
dirs = self.query_abs_dirs()
requirements = os.path.join(dirs['abs_test_install_dir'],
'config',
'marionette_requirements.txt')
self.register_virtualenv_module(requirements=[requirements],
two_pass=True)
luciddream_dir = os.path.join(dirs['abs_test_install_dir'],
'luciddream')
self.register_virtualenv_module(
'luciddream',
url=luciddream_dir,
requirements=[os.path.join(luciddream_dir, 'requirements.txt')],
)
def run_tests(self):
"""
Run the tests
"""
dirs = self.query_abs_dirs()
env = {}
env = self.query_env(partial_env=env)
ld_dir = os.path.join(dirs['abs_test_install_dir'], 'luciddream')
if self.config.get('b2gdesktop_path') or self.config.get('b2gdesktop_url'):
self.setup_gaia()
ld_parser = self.parser_class(config=self.config,
log_obj=self.log_obj,
error_list=BaseErrorList)
cmd = [self.query_python_path('python'),
os.path.join(ld_dir, 'luciddream', 'runluciddream.py')
]
str_format_values = {
'browser_path': self.binary_path,
'raw_log_file': os.path.join(dirs['abs_work_dir'], 'luciddream_raw.log'),
'error_summary_file': os.path.join(dirs['abs_work_dir'], 'luciddream_errorsummary.log'),
'test_manifest': os.path.join(ld_dir, 'example-tests', 'luciddream.ini')
}
if self.config.get('emulator_url'):
str_format_values['emulator_path'] = dirs['abs_b2g-distro_dir']
else:
if self.config.get('b2gdesktop_url'):
str_format_values['fxos_desktop_path'] = os.path.join(dirs['abs_b2g_desktop'], 'b2g', 'b2g')
else:
str_format_values['fxos_desktop_path'] = self.config.get('b2gdesktop_path')
str_format_values['gaia_profile'] = os.path.join(dirs['abs_gaia_dir'], 'profile')
suite = 'luciddream-emulator' if self.config.get('emulator_url') else 'luciddream-b2gdt'
options = self.config['suite_definitions'][suite]['options']
for option in options:
option = option % str_format_values
if not option.endswith('None'):
cmd.append(option)
code = self.run_command(cmd, env=env,
output_timeout=1000,
output_parser=ld_parser,
success_codes=[0],
cwd=dirs['abs_work_dir'])
level = INFO
if code == 0 and ld_parser.passed > 0 and ld_parser.failed == 0:
status = "success"
tbpl_status = TBPL_SUCCESS
elif ld_parser.failed > 0:
status = "test failures"
tbpl_status = TBPL_WARNING
else:
status = "harness failures"
level = ERROR
tbpl_status = TBPL_FAILURE
ld_parser.print_summary('luciddream')
self.log("Luciddream exited with return code %s: %s" % (code, status),
level=level)
self.buildbot_status(tbpl_status)
if not os.path.exists(dirs['abs_blob_upload_dir']):
self.mkdir_p(dirs['abs_blob_upload_dir'])
for filename in os.listdir(dirs['abs_work_dir']):
if filename.endswith('.log'):
self.copyfile(os.path.join(dirs['abs_work_dir'], filename),
os.path.join(dirs['abs_blob_upload_dir'], filename))
if __name__ == '__main__':
luciddreamTest = LuciddreamTest()
luciddreamTest.run_and_exit()

View File

@ -182,7 +182,6 @@ stage-all: \
stage-mochitest \ stage-mochitest \
stage-jstests \ stage-jstests \
stage-jetpack \ stage-jetpack \
stage-luciddream \
test-packages-manifest \ test-packages-manifest \
$(NULL) $(NULL)
ifdef MOZ_WEBRTC ifdef MOZ_WEBRTC
@ -325,11 +324,6 @@ stage-steeplechase: make-stage-dir
cp -RL $(DIST)/xpi-stage/specialpowers $(PKG_STAGE)/steeplechase cp -RL $(DIST)/xpi-stage/specialpowers $(PKG_STAGE)/steeplechase
cp -RL $(topsrcdir)/testing/profiles/prefs_general.js $(PKG_STAGE)/steeplechase cp -RL $(topsrcdir)/testing/profiles/prefs_general.js $(PKG_STAGE)/steeplechase
LUCIDDREAM_DIR=$(PKG_STAGE)/luciddream
stage-luciddream: make-stage-dir
$(NSINSTALL) -D $(LUCIDDREAM_DIR)
@(cd $(topsrcdir)/testing/luciddream && tar $(TAR_CREATE_FLAGS) - *) | (cd $(LUCIDDREAM_DIR)/ && tar -xf -)
stage-instrumentation-tests: make-stage-dir stage-instrumentation-tests: make-stage-dir
$(MAKE) -C $(DEPTH)/testing/instrumentation stage-package $(MAKE) -C $(DEPTH)/testing/instrumentation stage-package
@ -359,6 +353,5 @@ stage-extensions: make-stage-dir
stage-jetpack \ stage-jetpack \
stage-steeplechase \ stage-steeplechase \
stage-instrumentation-tests \ stage-instrumentation-tests \
stage-luciddream \
test-packages-manifest \ test-packages-manifest \
$(NULL) $(NULL)