Merge m-c to inbound.

This commit is contained in:
Ryan VanderMeulen 2012-10-31 20:19:27 -04:00
commit f4efaa936a
7 changed files with 118 additions and 49 deletions

View File

@ -127,28 +127,28 @@ public:
void SetValueAtTime(float aValue, float aStartTime, ErrorResult& aRv)
{
InsertEvent(Event(Event::Type::SetValue, aStartTime, aValue), aRv);
InsertEvent(Event(Event::SetValue, aStartTime, aValue), aRv);
}
void LinearRampToValueAtTime(float aValue, float aEndTime, ErrorResult& aRv)
{
InsertEvent(Event(Event::Type::LinearRamp, aEndTime, aValue), aRv);
InsertEvent(Event(Event::LinearRamp, aEndTime, aValue), aRv);
}
void ExponentialRampToValueAtTime(float aValue, float aEndTime, ErrorResult& aRv)
{
InsertEvent(Event(Event::Type::ExponentialRamp, aEndTime, aValue), aRv);
InsertEvent(Event(Event::ExponentialRamp, aEndTime, aValue), aRv);
}
void SetTargetAtTime(float aTarget, float aStartTime, float aTimeConstant, ErrorResult& aRv)
{
InsertEvent(Event(Event::Type::SetTarget, aStartTime, aTarget, aTimeConstant), aRv);
InsertEvent(Event(Event::SetTarget, aStartTime, aTarget, aTimeConstant), aRv);
}
void SetValueCurveAtTime(const FloatArrayWrapper& aValues, float aStartTime, float aDuration, ErrorResult& aRv)
{
// TODO: implement
// InsertEvent(Event(Event::Type::SetValueCurve, aStartTime, 0.0f, 0.0f, aDuration, aValues), aRv);
// InsertEvent(Event(Event::SetValueCurve, aStartTime, 0.0f, 0.0f, aDuration, aValues), aRv);
}
void CancelScheduledValues(float aStartTime)
@ -165,10 +165,10 @@ public:
bool bailOut = false;
for (unsigned i = 0; !bailOut && i < mEvents.Length(); ++i) {
switch (mEvents[i].mType) {
case Event::Type::SetValue:
case Event::Type::SetTarget:
case Event::Type::LinearRamp:
case Event::Type::ExponentialRamp:
case Event::SetValue:
case Event::SetTarget:
case Event::LinearRamp:
case Event::ExponentialRamp:
if (aTime == mEvents[i].mTime) {
// Find the last event with the same time
do {
@ -183,7 +183,7 @@ public:
bailOut = true;
}
break;
case Event::Type::SetValueCurve:
case Event::SetValueCurve:
// TODO: implement
break;
default:
@ -204,17 +204,17 @@ public:
// If the requested time is before all of the existing events
if (!previous) {
switch (next->mType) {
case Event::Type::SetValue:
case Event::Type::SetTarget:
case Event::SetValue:
case Event::SetTarget:
// The requested time is before the first event
return mValue;
case Event::Type::LinearRamp:
case Event::LinearRamp:
// Use t=0 as T0 and v=defaultValue as V0
return LinearInterpolate(0.0f, mValue, next->mTime, next->mValue, aTime);
case Event::Type::ExponentialRamp:
case Event::ExponentialRamp:
// Use t=0 as T0 and v=defaultValue as V0
return ExponentialInterpolate(0.0f, mValue, next->mTime, next->mValue, aTime);
case Event::Type::SetValueCurve:
case Event::SetValueCurve:
// TODO: implement
return 0.0f;
}
@ -222,7 +222,7 @@ public:
}
// SetTarget nodes can be handled no matter what their next node is (if they have one)
if (previous->mType == Event::Type::SetTarget) {
if (previous->mType == Event::SetTarget) {
// Follow the curve, without regard to the next node
return ExponentialApproach(previous->mTime, mValue, previous->mValue,
previous->mTimeConstant, aTime);
@ -231,15 +231,15 @@ public:
// If the requested time is after all of the existing events
if (!next) {
switch (previous->mType) {
case Event::Type::SetValue:
case Event::Type::LinearRamp:
case Event::Type::ExponentialRamp:
case Event::SetValue:
case Event::LinearRamp:
case Event::ExponentialRamp:
// The value will be constant after the last event
return previous->mValue;
case Event::Type::SetValueCurve:
case Event::SetValueCurve:
// TODO: implement
return 0.0f;
case Event::Type::SetTarget:
case Event::SetTarget:
MOZ_ASSERT(false, "unreached");
}
MOZ_ASSERT(false, "unreached");
@ -249,28 +249,28 @@ public:
// First, handle the case where our range ends up in a ramp event
switch (next->mType) {
case Event::Type::LinearRamp:
case Event::LinearRamp:
return LinearInterpolate(previous->mTime, previous->mValue, next->mTime, next->mValue, aTime);
case Event::Type::ExponentialRamp:
case Event::ExponentialRamp:
return ExponentialInterpolate(previous->mTime, previous->mValue, next->mTime, next->mValue, aTime);
case Event::Type::SetValue:
case Event::Type::SetTarget:
case Event::Type::SetValueCurve:
case Event::SetValue:
case Event::SetTarget:
case Event::SetValueCurve:
break;
}
// Now handle all other cases
switch (previous->mType) {
case Event::Type::SetValue:
case Event::Type::LinearRamp:
case Event::Type::ExponentialRamp:
case Event::SetValue:
case Event::LinearRamp:
case Event::ExponentialRamp:
// If the next event type is neither linear or exponential ramp, the
// value is constant.
return previous->mValue;
case Event::Type::SetValueCurve:
case Event::SetValueCurve:
// TODO: implement
return 0.0f;
case Event::Type::SetTarget:
case Event::SetTarget:
MOZ_ASSERT(false, "unreached");
}
@ -310,7 +310,7 @@ private:
// Make sure that non-curve events don't fall within the duration of a
// curve event.
for (unsigned i = 0; i < mEvents.Length(); ++i) {
if (mEvents[i].mType == Event::Type::SetValueCurve &&
if (mEvents[i].mType == Event::SetValueCurve &&
mEvents[i].mTime <= aEvent.mTime &&
(mEvents[i].mTime + mEvents[i].mDuration) >= aEvent.mTime) {
aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
@ -320,7 +320,7 @@ private:
// Make sure that curve events don't fall in a range which includes other
// events.
if (aEvent.mType == Event::Type::SetValueCurve) {
if (aEvent.mType == Event::SetValueCurve) {
for (unsigned i = 0; i < mEvents.Length(); ++i) {
if (mEvents[i].mTime >= aEvent.mTime &&
mEvents[i].mTime <= (aEvent.mTime + aEvent.mDuration)) {

2
mach
View File

@ -20,6 +20,7 @@ if sys.version_info[0] == 2 and sys.version_info[1] < 7:
# TODO Bug 794506 Integrate with the in-tree virtualenv configuration.
SEARCH_PATHS = [
'python/mach',
'python/mozboot',
'python/mozbuild',
'build',
'build/pymake',
@ -37,6 +38,7 @@ SEARCH_PATHS = [
# Individual files providing mach commands.
MACH_MODULES = [
'layout/tools/reftest/mach_commands.py',
'python/mozboot/mozboot/mach_commands.py',
'testing/mochitest/mach_commands.py',
'testing/xpcshell/mach_commands.py',
]

View File

@ -0,0 +1,23 @@
# 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 unicode_literals
from mozbuild.base import MozbuildObject
from mach.base import CommandArgument
from mach.base import CommandProvider
from mach.base import Command
@CommandProvider
class Bootstrap(MozbuildObject):
"""Bootstrap system and mach for optimal development experience."""
@Command('bootstrap',
help='Install required system packages for building.')
def bootstrap(self):
from mozboot.bootstrap import Bootstrapper
bootstrapper = Bootstrapper()
bootstrapper.bootstrap()

View File

@ -4,6 +4,7 @@
import datetime
from errors import *
from mozdevice import devicemanagerADB
from mozprocess import ProcessHandlerMixin
import multiprocessing
import os
@ -19,6 +20,7 @@ import time
from emulator_battery import EmulatorBattery
from emulator_geo import EmulatorGeo
class LogcatProc(ProcessHandlerMixin):
"""Process handler for logcat which saves all output to a logfile.
"""
@ -42,6 +44,7 @@ class Emulator(object):
arch="x86", emulatorBinary=None, res='480x800', sdcard=None,
userdata=None):
self.port = None
self.dm = None
self._emulator_launched = False
self.proc = None
self.marionette_port = None
@ -319,6 +322,9 @@ waitFor(
online, offline = self._get_adb_devices()
self.port = int(list(online)[0])
self.dm = devicemanagerADB.DeviceManagerADB(adbPath=self.adb,
deviceSerial='emulator-%d' % self.port)
def start(self):
self._check_for_b2g()
self.start_adb()
@ -347,6 +353,9 @@ waitFor(
self.port = int(list(online - original_online)[0])
self._emulator_launched = True
self.dm = devicemanagerADB.DeviceManagerADB(adbPath=self.adb,
deviceSerial='emulator-%d' % self.port)
# bug 802877
time.sleep(10)
self.geo.set_default_location()
@ -369,14 +378,29 @@ waitFor(
Install gecko into the emulator using adb push. Restart b2g after the
installation.
"""
print 'installing gecko binaries...'
# need to remount so we can write to /system/b2g
self._run_adb(['remount'])
self._run_adb(['shell', 'stop', 'b2g'])
self._run_adb(['shell', 'rm', '-rf', '/system/b2g/*.so'])
print 'installing gecko binaries'
self._run_adb(['push', gecko_path, '/system/b2g'])
# See bug 800102. We use this particular method of installing
# gecko in order to avoid an adb bug in which adb will sometimes
# hang indefinitely while copying large files to the system
# partition.
for root, dirs, files in os.walk(gecko_path):
for filename in files:
data_local_file = os.path.join('/data/local', filename)
print 'pushing', data_local_file
self.dm.pushFile(os.path.join(root, filename), data_local_file)
self.dm.shellCheckOutput(['stop', 'b2g'])
for root, dirs, files in os.walk(gecko_path):
for filename in files:
data_local_file = os.path.join('/data/local', filename)
rel_file = os.path.relpath(os.path.join(root, filename), gecko_path)
system_file = os.path.join('/system/b2g', rel_file)
print 'copying', data_local_file, 'to', system_file
self.dm.shellCheckOutput(['dd', 'if=%s' % data_local_file,
'of=%s' % system_file])
print 'restarting B2G'
self._run_adb(['shell', 'start', 'b2g'])
self.dm.shellCheckOutput(['start', 'b2g'])
self.wait_for_port()
self.wait_for_system_message(marionette)

View File

@ -1,7 +1,7 @@
import os
from setuptools import setup, find_packages
version = '0.5.2'
version = '0.5.3'
# get documentation from the README
try:
@ -12,7 +12,8 @@ except (OSError, IOError):
# dependencies
deps = ['manifestdestiny', 'mozhttpd >= 0.3',
'mozprocess >= 0.5', 'mozrunner >= 5.10']
'mozprocess >= 0.5', 'mozrunner >= 5.10',
'mozdevice >= 0.12']
setup(name='marionette_client',
version=version,

View File

@ -21,15 +21,19 @@ from mach.base import (
class XPCShellRunner(MozbuildObject):
"""Run xpcshell tests."""
def run_suite(self):
# TODO hook up to harness runner and support things like shuffle,
# proper progress updates, etc.
self._run_make(directory='.', target='xpcshell-tests')
def run_suite(self, **kwargs):
manifest = os.path.join(self.topobjdir, '_tests', 'xpcshell',
'xpcshell.ini')
def run_test(self, test_file, debug=False):
self._run_xpcshell_harness(manifest=manifest, **kwargs)
def run_test(self, test_file, debug=False, interactive=False,
keep_going=False, shuffle=False):
"""Runs an individual xpcshell test."""
if test_file == 'all':
self.run_suite()
self.run_suite(debug=debug, interactive=interactive,
keep_going=keep_going, shuffle=shuffle)
return
# dirname() gets confused if there isn't a trailing slash.
@ -46,6 +50,9 @@ class XPCShellRunner(MozbuildObject):
args = {
'debug': debug,
'interactive': interactive,
'keep_going': keep_going,
'shuffle': shuffle,
'test_dirs': [test_dir],
}
@ -55,7 +62,8 @@ class XPCShellRunner(MozbuildObject):
self._run_xpcshell_harness(**args)
def _run_xpcshell_harness(self, test_dirs=None, manifest=None,
test_path=None, debug=False):
test_path=None, debug=False, shuffle=False, interactive=False,
keep_going=False):
# Obtain a reference to the xpcshell test runner.
import runxpcshelltests
@ -71,11 +79,16 @@ class XPCShellRunner(MozbuildObject):
'xpcshell': os.path.join(self.bindir, 'xpcshell'),
'mozInfo': os.path.join(self.topobjdir, 'mozinfo.json'),
'symbolsPath': os.path.join(self.distdir, 'crashreporter-symbols'),
'interactive': interactive,
'keepGoing': keep_going,
'logfiles': False,
'shuffle': shuffle,
'testsRootDir': tests_dir,
'testingModulesDir': modules_dir,
'profileName': 'firefox',
'verbose': test_path is not None,
'xunitFilename': os.path.join(self.statedir, 'xpchsell.xunit.xml'),
'xunitName': 'xpcshell',
}
if manifest is not None:
@ -105,6 +118,12 @@ class MachCommands(MozbuildObject):
'or omitted. If omitted, the entire test suite is executed.')
@CommandArgument('--debug', '-d', action='store_true',
help='Run test in a debugger.')
@CommandArgument('--interactive', '-i', action='store_true',
help='Open an xpcshell prompt before running tests.')
@CommandArgument('--keep-going', '-k', action='store_true',
help='Continue running tests after a SIGINT is received.')
@CommandArgument('--shuffle', '-s', action='store_true',
help='Randomize the execution order of tests.')
def run_xpcshell_test(self, **params):
xpcshell = self._spawn(XPCShellRunner)
xpcshell.run_test(**params)

View File

@ -482,7 +482,7 @@ class XPCShellTests(object):
if name is None:
name = "xpcshell"
else:
assert isinstance(name, str)
assert isinstance(name, basestring)
if filename is not None:
fh = open(filename, 'wb')
@ -637,7 +637,7 @@ class XPCShellTests(object):
testdirs = []
if xunitFilename is not None or xunitName is not None:
if not isinstance(testsRootDir, str):
if not isinstance(testsRootDir, basestring):
raise Exception("testsRootDir must be a str when outputting xUnit.")
if not os.path.isabs(testsRootDir):