Backed out 3 changesets (bug 1231784) for breaking 10.10 opt jetpack tests

Backed out changeset 653df21ca861 (bug 1231784)
Backed out changeset 0aac20bc3619 (bug 1231784)
Backed out changeset edcbd7c0aa36 (bug 1231784)
This commit is contained in:
Wes Kocher 2016-02-03 17:38:12 -08:00
parent d3c2e68d83
commit 3b6e1cd6a4
19 changed files with 162 additions and 292 deletions

View File

@ -7,7 +7,6 @@ import glob
import time
import re
import os
import posixpath
import tempfile
import shutil
import subprocess
@ -215,7 +214,7 @@ class RemoteAutomation(Automation):
try:
dumpDir = tempfile.mkdtemp()
remoteCrashDir = posixpath.join(self._remoteProfile, 'minidumps')
remoteCrashDir = self._remoteProfile + '/minidumps/'
if not self._devicemanager.dirExists(remoteCrashDir):
# If crash reporting is enabled (MOZ_CRASHREPORTER=1), the
# minidumps directory is automatically created when Fennec

View File

@ -1149,11 +1149,8 @@ class Marionette(object):
self.host,
self.port,
self.socket_timeout)
# Call wait_for_port() before attempting to connect in
# the event gecko hasn't started yet.
self.wait_for_port(timeout=timeout)
self.protocol, _ = self.client.connect()
self.wait_for_port(timeout=timeout)
body = {"capabilities": desired_capabilities, "sessionId": session_id}
resp = self._send_message("newSession", body)

View File

@ -1,84 +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/. */
const { utils: Cu, interfaces: Ci, classes: Cc } = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
var WindowListener = {
// browser-test.js is only loaded into the first window. Setup that
// needs to happen in all navigator:browser windows should go here.
setupWindow: function(win) {
win.nativeConsole = win.console;
XPCOMUtils.defineLazyModuleGetter(win, "console",
"resource://gre/modules/Console.jsm");
},
tearDownWindow: function(win) {
if (win.nativeConsole) {
win.console = win.nativeConsole;
win.nativeConsole = undefined;
}
},
onOpenWindow: function (win) {
win = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow);
win.addEventListener("load", function listener() {
win.removeEventListener("load", listener, false);
if (win.document.documentElement.getAttribute("windowtype") == "navigator:browser") {
WindowListener.setupWindow(win);
}
}, false);
}
}
function loadMochitest(e) {
let flavor = e.detail[0];
let url = e.detail[1];
let win = Services.wm.getMostRecentWindow("navigator:browser");
win.removeEventListener('mochitest-load', loadMochitest);
// for mochitest-plain, navigating to the url is all we need
win.loadURI(url);
if (flavor == "mochitest") {
return;
}
WindowListener.setupWindow(win);
Services.wm.addListener(WindowListener);
let overlay;
if (flavor == "jetpack-addon") {
overlay = "chrome://mochikit/content/jetpack-addon-overlay.xul";
} else if (flavor == "jetpack-package") {
overlay = "chrome://mochikit/content/jetpack-package-overlay.xul";
} else {
overlay = "chrome://mochikit/content/browser-test-overlay.xul";
}
win.document.loadOverlay(overlay, null);
}
function startup(data, reason) {
let win = Services.wm.getMostRecentWindow("navigator:browser");
// wait for event fired from start_desktop.js containing the
// suite and url to load
win.addEventListener('mochitest-load', loadMochitest);
}
function shutdown(data, reason) {
let windows = Services.wm.getEnumerator("navigator:browser");
while (windows.hasMoreElements()) {
let win = windows.getNext().QueryInterface(Ci.nsIDOMWindow);
WindowListener.tearDownWindow(win);
}
Services.wm.removeListener(WindowListener);
}
function install(data, reason) {}
function uninstall(data, reason) {}

View File

@ -251,7 +251,7 @@
waitForFocus(() => {
// Focus the test window and start tests.
waitForFocus(() => {
var Tester = new testWin.Tester(links, gDumper.structuredLogger, testsFinished);
var Tester = new testWin.Tester(links, gDumper, testsFinished);
Tester.start();
}, testWin);
}, window);

View File

@ -7,7 +7,7 @@
<overlay id="browserTestOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript" src="chrome://mochikit/content/chrome-harness.js"/>
<script type="application/javascript" src="chrome://mochikit/content/mochitest-e10s-utils.js"/>
<script type="application/javascript" src="chrome://mochikit/content/browser-test.js"/>
<script type="application/javascript" src="chrome://mochikit/content/cc-analyzer.js"/>
<script type="application/javascript" src="chrome://mochikit/content/mochitest-e10s-utils.js"/>
</overlay>

View File

@ -3,10 +3,22 @@
var gTimeoutSeconds = 45;
var gConfig;
if (Cc === undefined) {
var Cc = Components.classes;
}
if (Ci === undefined) {
var Ci = Components.interfaces;
}
if (Cu === undefined) {
var Cu = Components.utils;
}
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://gre/modules/AppConstants.jsm");
Cu.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Services",
"resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "CustomizationTabPreloader",
"resource:///modules/CustomizationTabPreloader.jsm");
@ -17,21 +29,20 @@ XPCOMUtils.defineLazyModuleGetter(this, "ContentSearch",
XPCOMUtils.defineLazyModuleGetter(this, "SelfSupportBackend",
"resource:///modules/SelfSupportBackend.jsm");
var nativeConsole = console;
XPCOMUtils.defineLazyModuleGetter(this, "console",
"resource://gre/modules/Console.jsm");
const SIMPLETEST_OVERRIDES =
["ok", "is", "isnot", "todo", "todo_is", "todo_isnot", "info", "expectAssertions", "requestCompleteLog"];
// non-android is bootstrapped by marionette
if (Services.appinfo.OS == 'Android') {
window.addEventListener("load", function testOnLoad() {
window.removeEventListener("load", testOnLoad);
window.addEventListener("MozAfterPaint", function testOnMozAfterPaint() {
window.removeEventListener("MozAfterPaint", testOnMozAfterPaint);
setTimeout(testInit, 0);
});
window.addEventListener("load", function testOnLoad() {
window.removeEventListener("load", testOnLoad);
window.addEventListener("MozAfterPaint", function testOnMozAfterPaint() {
window.removeEventListener("MozAfterPaint", testOnMozAfterPaint);
setTimeout(testInit, 0);
});
} else {
setTimeout(testInit, 0);
}
});
function b2gStart() {
let homescreen = document.getElementById('systemapp');
@ -129,8 +140,8 @@ function testInit() {
gmm.loadFrameScript("chrome://mochikit/content/tests/SimpleTest/AsyncUtilsContent.js", true);
}
function Tester(aTests, structuredLogger, aCallback) {
this.structuredLogger = structuredLogger;
function Tester(aTests, aDumper, aCallback) {
this.dumper = aDumper;
this.tests = aTests;
this.callback = aCallback;
this.openedWindows = {};
@ -246,7 +257,7 @@ Tester.prototype = {
this._coverageCollector = new CoverageCollector(coveragePath);
}
this.structuredLogger.info("*** Start BrowserChrome Test Results ***");
this.dumper.structuredLogger.info("*** Start BrowserChrome Test Results ***");
Services.console.registerListener(this);
Services.obs.addObserver(this, "chrome-document-global-created", false);
Services.obs.addObserver(this, "content-document-global-created", false);
@ -307,7 +318,7 @@ Tester.prototype = {
}
// Remove stale windows
this.structuredLogger.info("checking window state");
this.dumper.structuredLogger.info("checking window state");
let windowsEnum = Services.wm.getEnumerator(null);
let createdFakeTestForLogging = false;
while (windowsEnum.hasMoreElements()) {
@ -330,11 +341,11 @@ Tester.prototype = {
} else {
if (!createdFakeTestForLogging) {
createdFakeTestForLogging = true;
this.structuredLogger.testStart("browser-test.js");
this.dumper.structuredLogger.testStart("browser-test.js");
}
this.failuresFromInitialWindowState++;
this.structuredLogger.testStatus("browser-test.js",
msg, "FAIL", false, "");
this.dumper.structuredLogger.testStatus("browser-test.js",
msg, "FAIL", false, "");
}
win.close();
@ -342,10 +353,10 @@ Tester.prototype = {
}
if (createdFakeTestForLogging) {
let time = Date.now() - startTime;
this.structuredLogger.testEnd("browser-test.js",
"OK",
undefined,
"finished window state check in " + time + "ms");
this.dumper.structuredLogger.testEnd("browser-test.js",
"OK",
undefined,
"finished window state check in " + time + "ms");
}
// Make sure the window is raised before each test.
@ -379,20 +390,22 @@ Tester.prototype = {
let pid = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).processID;
dump("Completed ShutdownLeaks collections in process " + pid + "\n");
this.structuredLogger.info("TEST-START | Shutdown");
this.dumper.structuredLogger.info("TEST-START | Shutdown");
if (this.tests.length) {
this.structuredLogger.info("Browser Chrome Test Summary");
this.structuredLogger.info("Passed: " + passCount);
this.structuredLogger.info("Failed: " + failCount);
this.structuredLogger.info("Todo: " + todoCount);
this.dumper.structuredLogger.info("Browser Chrome Test Summary");
this.dumper.structuredLogger.info("Passed: " + passCount);
this.dumper.structuredLogger.info("Failed: " + failCount);
this.dumper.structuredLogger.info("Todo: " + todoCount);
} else {
this.structuredLogger.testEnd("browser-test.js",
"FAIL",
"PASS",
"No tests to run. Did you pass invalid test_paths?");
this.dumper.structuredLogger.testEnd("browser-test.js",
"FAIL",
"PASS",
"No tests to run. Did you pass invalid test_paths?");
}
this.structuredLogger.info("*** End BrowserChrome Test Results ***");
this.dumper.structuredLogger.info("*** End BrowserChrome Test Results ***");
this.dumper.done();
// Tests complete, notify the callback and return
this.callback(this.tests);
@ -441,7 +454,7 @@ Tester.prototype = {
if (this.currentTest)
this.currentTest.addResult(new testMessage(msg));
else
this.structuredLogger.info("TEST-INFO | (browser-test.js) | " + msg.replace(/\n$/, "") + "\n");
this.dumper.dump("TEST-INFO | (browser-test.js) | " + msg.replace(/\n$/, "") + "\n");
} catch (ex) {
// Swallow exception so we don't lead to another error being reported,
// throwing us into an infinite loop
@ -568,7 +581,7 @@ Tester.prototype = {
// Note the test run time
let time = Date.now() - this.lastStartTime;
this.structuredLogger.testEnd(this.currentTest.path,
this.dumper.structuredLogger.testEnd(this.currentTest.path,
"OK",
undefined,
"finished in " + time + "ms");
@ -712,7 +725,7 @@ Tester.prototype = {
}),
execTest: function Tester_execTest() {
this.structuredLogger.testStart(this.currentTest.path);
this.dumper.structuredLogger.testStart(this.currentTest.path);
this.SimpleTest.reset();
@ -1065,9 +1078,9 @@ function testScope(aTester, aTest, expected) {
};
this.requestCompleteLog = function test_requestCompleteLog() {
self.__tester.structuredLogger.deactivateBuffering();
self.__tester.dumper.structuredLogger.deactivateBuffering();
self.registerCleanupFunction(function() {
self.__tester.structuredLogger.activateBuffering();
self.__tester.dumper.structuredLogger.activateBuffering();
})
};
}

View File

@ -5,15 +5,11 @@
<Description about="urn:mozilla:install-manifest">
<em:id>mochikit@mozilla.org</em:id>
<em:version>1.0</em:version>
#ifdef MOCHITEST_BOOTSTRAP
<em:bootstrap>true</em:bootstrap>
#endif
<em:targetApplication>
<Description>
<em:id>toolkit@mozilla.org</em:id>
#expand <em:minVersion>__MOZILLA_VERSION_U__</em:minVersion>
<!-- Set to * so toolkit/mozapps/update/chrome tests pass. -->
<em:maxVersion>*</em:maxVersion>
#expand <em:maxVersion>__MOZILLA_VERSION_U__</em:maxVersion>
</Description>
</em:targetApplication>
<!-- Front End MetaData -->

View File

@ -16,7 +16,14 @@ XPCOMUtils.defineLazyModuleGetter(this, "Services",
XPCOMUtils.defineLazyModuleGetter(this, "AddonManager",
"resource://gre/modules/AddonManager.jsm");
setTimeout(testInit, 0);
// Start the tests after the window has been displayed
window.addEventListener("load", function testOnLoad() {
window.removeEventListener("load", testOnLoad);
window.addEventListener("MozAfterPaint", function testOnMozAfterPaint() {
window.removeEventListener("MozAfterPaint", testOnMozAfterPaint);
setTimeout(testInit, 0);
});
});
var sdkpath = null;

View File

@ -18,7 +18,14 @@ Cu.import("resource://gre/modules/Task.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Services",
"resource://gre/modules/Services.jsm");
setTimeout(testInit, 0);
// Start the tests after the window has been displayed
window.addEventListener("load", function testOnLoad() {
window.removeEventListener("load", testOnLoad);
window.addEventListener("MozAfterPaint", function testOnMozAfterPaint() {
window.removeEventListener("MozAfterPaint", testOnMozAfterPaint);
setTimeout(testInit, 0);
});
});
// Tests a single module
function testModule(require, { url, expected }) {

View File

@ -558,17 +558,13 @@ class MochitestArguments(ArgumentContainer):
"help": "Enable logging of unsafe CPOW usage, which is disabled by default for tests",
"suppress": True,
}],
[["--marionette"],
{"default": None,
"help": "host:port to use when connecting to Marionette",
}],
]
defaults = {
# Bug 1065098 - The geckomediaplugin process fails to produce a leak
# log for some reason.
'ignoreMissingLeaks': ["geckomediaplugin"],
'extensionsToExclude': ['specialpowers'],
# Set server information on the args object
'webServer': '127.0.0.1',
'httpPort': DEFAULT_PORTS['http'],
@ -826,6 +822,10 @@ class B2GArguments(ArgumentContainer):
"help": "Path to B2G repo or QEMU directory.",
"suppress": True,
}],
[["--marionette"],
{"default": None,
"help": "host:port to use when connecting to Marionette",
}],
[["--emulator"],
{"default": None,
"help": "Architecture of emulator to use, x86 or arm",
@ -919,8 +919,6 @@ class B2GArguments(ArgumentContainer):
# Specialpowers is integrated with marionette for b2g,
# see marionette's jar.mn.
'extensionsToExclude': ['specialpowers'],
# mochijar doesn't get installed via marionette on android
'extensionsToInstall': [os.path.join(here, 'mochijar')],
# See dependencies of bug 1038943.
'defaultLeakThreshold': 5536,
}
@ -1073,10 +1071,6 @@ class AndroidArguments(ArgumentContainer):
defaults = {
'dm': None,
# we don't want to exclude specialpowers on android just yet
'extensionsToExclude': [],
# mochijar doesn't get installed via marionette on android
'extensionsToInstall': [os.path.join(here, 'mochijar')],
'logFile': 'mochitest.log',
'utilityPath': None,
}

View File

@ -19,10 +19,6 @@ USE_EXTENSION_MANIFEST = True
FINAL_TARGET_PP_FILES += ['install.rdf']
if CONFIG['MOZ_BUILD_APP'] != 'mobile/android' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
DEFINES['MOCHITEST_BOOTSTRAP'] = True
FINAL_TARGET_FILES += ['bootstrap.js']
MOCHITEST_MANIFESTS += [
'tests/MochiKit-1.4.2/tests/mochitest.ini',
]
@ -44,6 +40,7 @@ TEST_HARNESS_FILES.testing.mochitest += [
'/testing/mozbase/mozdevice/mozdevice/version_codes.py',
'/testing/mozbase/mozdevice/mozdevice/Zeroconf.py',
'/testing/mozbase/moznetwork/moznetwork/moznetwork.py',
'b2g_start_script.js',
'bisection.py',
'browser-harness.xul',
'browser-test-overlay.xul',
@ -70,8 +67,6 @@ TEST_HARNESS_FILES.testing.mochitest += [
'runtestsb2g.py',
'runtestsremote.py',
'server.js',
'start_b2g.js',
'start_desktop.js',
]
TEST_HARNESS_FILES.testing.mochitest.pywebsocket += [

View File

@ -44,15 +44,6 @@ from manifestparser.filters import (
subsuite,
tags,
)
try:
from marionette import Marionette
from marionette_driver.addons import Addons
except ImportError:
# Marionette not needed nor supported on android
Marionette = None
from leaks import ShutdownLeaks, LSANLeaks
from mochitest_options import (
MochitestArgumentParser, build_obj, get_default_valgrind_suppression_files
@ -514,7 +505,7 @@ class MochitestBase(object):
"""
oldcwd = os.getcwd()
mochijar = os.path.join(SCRIPT_DIR, 'mochijar')
jarDir = 'mochijar'
# Path to the test script on the server
TEST_PATH = "tests"
@ -531,10 +522,6 @@ class MochitestBase(object):
self._active_tests = None
self._locations = None
self.marionette = None
self.start_script = None
self.start_script_args = []
if self.log is None:
commandline.log_formatters["tbpl"] = (
MochitestFormatter,
@ -548,7 +535,6 @@ class MochitestBase(object):
self.message_logger = MessageLogger(logger=self.log)
def update_mozinfo(self):
"""walk up directories to find mozinfo.json update the info"""
# TODO: This should go in a more generic place, e.g. mozinfo
@ -892,6 +878,14 @@ class MochitestBase(object):
"runtests.py | Failed to copy %s to profile" %
abspath)
def installChromeJar(self, chrome, options):
"""
copy mochijar directory to profile as an extension so we have chrome://mochikit for all harness code
"""
# Write chrome.manifest.
with open(os.path.join(options.profilePath, "extensions", "staged", "mochikit@mozilla.org", "chrome.manifest"), "a") as mfile:
mfile.write(chrome)
def getChromeTestDir(self, options):
dir = os.path.join(os.path.abspath("."), SCRIPT_DIR) + "/"
if mozinfo.isWin:
@ -943,16 +937,39 @@ toolbar#nav-bar {
manifest = self.writeChromeManifest(options)
if not os.path.isdir(self.mochijar):
# Call installChromeJar().
if not os.path.isdir(os.path.join(SCRIPT_DIR, self.jarDir)):
self.log.info(
"TEST-UNEXPECTED-FAIL | invalid setup: missing mochikit extension")
return None
# Support Firefox (browser), B2G (shell), SeaMonkey (navigator), and Webapp
# Runtime (webapp).
chrome = ""
if options.browserChrome or options.chrome or options.a11y or options.webapprtChrome:
chrome += """
overlay chrome://browser/content/browser.xul chrome://mochikit/content/browser-test-overlay.xul
overlay chrome://browser/content/shell.xhtml chrome://mochikit/content/browser-test-overlay.xul
overlay chrome://navigator/content/navigator.xul chrome://mochikit/content/browser-test-overlay.xul
overlay chrome://webapprt/content/webapp.xul chrome://mochikit/content/browser-test-overlay.xul
"""
if options.jetpackPackage:
chrome += """
overlay chrome://browser/content/browser.xul chrome://mochikit/content/jetpack-package-overlay.xul
"""
if options.jetpackAddon:
chrome += """
overlay chrome://browser/content/browser.xul chrome://mochikit/content/jetpack-addon-overlay.xul
"""
self.installChromeJar(chrome, options)
return manifest
def getExtensionsToInstall(self, options):
"Return a list of extensions to install in the profile"
extensions = []
extensions = options.extensionsToInstall or []
appDir = options.app[
:options.app.rfind(
os.sep)] if options.app else options.utilityPath
@ -977,7 +994,9 @@ toolbar#nav-bar {
if os.path.isdir(path) or (
os.path.isfile(path) and path.endswith(".xpi")):
extensions.append(path)
extensions.extend(options.extensionsToInstall)
# append mochikit
extensions.append(os.path.join(SCRIPT_DIR, self.jarDir))
return extensions
def logPreamble(self, tests):
@ -1249,20 +1268,6 @@ toolbar#nav-bar {
process.run()
process.wait()
def execute_start_script(self):
if not self.start_script or not self.marionette:
return
if os.path.isfile(self.start_script):
with open(self.start_script, 'r') as fh:
script = fh.read()
else:
script = self.start_script
with self.marionette.using_context('chrome'):
return self.marionette.execute_script(script,
script_args=self.start_script_args)
class SSLTunnel:
@ -1507,8 +1512,8 @@ class MochitestDesktop(MochitestBase):
# TODO: replace this with 'runtests.py' or 'mochitest' or the like
test_name = 'automation.py'
def __init__(self, *args, **kwargs):
MochitestBase.__init__(self, *args, **kwargs)
def __init__(self, logger_options):
MochitestBase.__init__(self, logger_options)
# Max time in seconds to wait for server startup before tests will fail -- if
# this seems big, it's mostly for debug machines where cold startup
@ -1527,8 +1532,6 @@ class MochitestDesktop(MochitestBase):
self.expectedError = {}
self.result = {}
self.start_script = os.path.join(here, 'start_desktop.js')
def extraPrefs(self, extraPrefs):
"""interpolate extra preferences from option strings"""
@ -1856,11 +1859,11 @@ class MochitestDesktop(MochitestBase):
valgrindSuppFiles=None,
symbolsPath=None,
timeout=-1,
onLaunch=None,
detectShutdownLeaks=False,
screenshotOnFail=False,
bisectChunk=None,
quiet=False,
marionette_args=None):
quiet=False):
"""
Run the app, log the duration it took to execute, return the status code.
Kills the app if it runs for longer than |maxTime| seconds, or outputs nothing for |timeout| seconds.
@ -1924,16 +1927,13 @@ class MochitestDesktop(MochitestBase):
# build command line
cmd = os.path.abspath(app)
args = list(extraArgs)
args.append('-marionette')
# TODO: mozrunner should use -foreground at least for mac
# https://bugzilla.mozilla.org/show_bug.cgi?id=916512
args.append('-foreground')
if testUrl:
if debuggerInfo and debuggerInfo.requiresEscapedArgs:
testUrl = testUrl.replace("&", "\\&")
self.start_script_args.append(testUrl)
else:
self.start_script_args.append('about:blank')
args.append(testUrl)
if detectShutdownLeaks:
shutdownLeaks = ShutdownLeaks(self.log)
@ -1984,7 +1984,6 @@ class MochitestDesktop(MochitestBase):
'appname',
'firefox'),
mozrunner.Runner)
runner = runner_cls(profile=self.profile,
binary=cmd,
cmdargs=args,
@ -2000,24 +1999,12 @@ class MochitestDesktop(MochitestBase):
self.log.info("runtests.py | Application pid: %d" % proc.pid)
self.log.process_start("Main app process")
# start marionette and kick off the tests
marionette_args = marionette_args or {}
self.marionette = Marionette(**marionette_args)
self.marionette.start_session()
# install specialpowers and mochikit as temporary addons
addons = Addons(self.marionette)
if mozinfo.info.get('toolkit') != 'gonk':
addons.install(os.path.join(here, 'extensions', 'specialpowers'), temp=True)
addons.install(self.mochijar, temp=True)
self.execute_start_script()
# an open marionette session interacts badly with mochitest,
# delete it until we figure out why.
self.marionette.delete_session()
del self.marionette
if onLaunch is not None:
# Allow callers to specify an onLaunch callback to be fired after the
# app is launched.
# We call onLaunch for b2g desktop mochitests so that we can
# run a Marionette script after gecko has completed startup.
onLaunch()
# wait until app is finished
# XXX copy functionality from
@ -2120,7 +2107,7 @@ class MochitestDesktop(MochitestBase):
return testsToRun
def runMochitests(self, options, testsToRun):
def runMochitests(self, options, testsToRun, onLaunch=None):
"This is a base method for calling other methods in this class for --bisect-chunk."
# Making an instance of bisect class for --bisect-chunk option.
bisect = bisection.Bisect(self)
@ -2137,7 +2124,7 @@ class MochitestDesktop(MochitestBase):
"TEST-UNEXPECTED-FAIL | Bisection | Please ignore repeats and look for 'Bleedthrough' (if any) at the end of the failure list")
bisection_log = 1
result = self.doTests(options, testsToRun)
result = self.doTests(options, onLaunch, testsToRun)
if options.bisectChunk:
status = bisect.post_test(
options,
@ -2157,7 +2144,7 @@ class MochitestDesktop(MochitestBase):
return result
def runTests(self, options):
def runTests(self, options, onLaunch=None):
""" Prepare, configure, run tests and cleanup """
self.setTestRoot(options)
@ -2175,7 +2162,7 @@ class MochitestDesktop(MochitestBase):
testsToRun = self.getTestsToRun(options)
if not options.runByDir:
return self.runMochitests(options, testsToRun)
return self.runMochitests(options, testsToRun, onLaunch)
# code for --run-by-dir
dirs = self.getDirectories(options)
@ -2188,7 +2175,7 @@ class MochitestDesktop(MochitestBase):
# If we are using --run-by-dir, we should not use the profile path (if) provided
# by the user, since we need to create a new directory for each run. We would face problems
# if we use the directory provided by the user.
result = self.runMochitests(options, tests_in_dir)
result = self.runMochitests(options, tests_in_dir, onLaunch)
# Dump the logging buffer
self.message_logger.dump_buffered()
@ -2213,7 +2200,7 @@ class MochitestDesktop(MochitestBase):
return result
def doTests(self, options, testsToFilter=None):
def doTests(self, options, onLaunch=None, testsToFilter=None):
# A call to initializeLooping method is required in case of --run-by-dir or --bisect-chunk
# since we need to initialize variables for each loop.
if options.bisectChunk or options.runByDir:
@ -2351,16 +2338,6 @@ class MochitestDesktop(MochitestBase):
detectShutdownLeaks = mozinfo.info[
"debug"] and options.browserChrome and not options.webapprtChrome
self.start_script_args.append(self.getTestFlavor(options))
marionette_args = {
'symbols_path': options.symbolsPath,
}
if options.marionette:
host, port = options.marionette.split(':')
marionette_args['host'] = host
marionette_args['port'] = int(port)
self.log.info("runtests.py | Running tests: start.\n")
try:
status = self.runApp(testURL,
@ -2375,11 +2352,11 @@ class MochitestDesktop(MochitestBase):
valgrindSuppFiles=valgrindSuppFiles,
symbolsPath=options.symbolsPath,
timeout=timeout,
onLaunch=onLaunch,
detectShutdownLeaks=detectShutdownLeaks,
screenshotOnFail=options.screenshotOnFail,
bisectChunk=options.bisectChunk,
quiet=options.quiet,
marionette_args=marionette_args,
quiet=options.quiet
)
except KeyboardInterrupt:
self.log.info("runtests.py | Received keyboard interrupt.\n")
@ -2637,7 +2614,6 @@ def run_test_harness(options):
logger_options = {
key: value for key, value in vars(options).iteritems()
if key.startswith('log') or key == 'valgrind'}
runner = MochitestDesktop(logger_options)
options.runByDir = False

View File

@ -42,8 +42,8 @@ class MochitestB2G(MochitestBase):
self.locations_file = locations
self.preferences = []
self.webapps = None
self.start_script = os.path.join(here, 'start_b2g.js')
self.start_script_args = [self.out_of_process]
self.test_script = os.path.join(here, 'b2g_start_script.js')
self.test_script_args = [self.out_of_process]
self.product = 'b2g'
self.remote_chrome_test_dir = None
self.local_log = None
@ -198,9 +198,9 @@ class MochitestB2G(MochitestBase):
self.buildURLOptions(options, {'MOZ_HIDE_RESULTS_TABLE': '1'})
options.manifestFile = manifestFile
self.start_script_args.append(not options.emulator)
self.start_script_args.append(options.wifi)
self.start_script_args.append(options.chrome)
self.test_script_args.append(not options.emulator)
self.test_script_args.append(options.wifi)
self.test_script_args.append(options.chrome)
self.runner.start(outputTimeout=timeout)
@ -243,7 +243,15 @@ class MochitestB2G(MochitestBase):
(local, remote))
self.app_ctx.dm.pushDir(local, remote)
self.execute_start_script()
if os.path.isfile(self.test_script):
with open(self.test_script, 'r') as script:
self.marionette.execute_script(
script.read(),
script_args=self.test_script_args)
else:
self.marionette.execute_script(
self.test_script,
script_args=self.test_script_args)
status = self.runner.wait()
if status is None:
@ -354,7 +362,7 @@ class MochitestB2G(MochitestBase):
if len(self.urlOpts) > 0:
test_url += "?" + "&".join(self.urlOpts)
self.start_script_args.append(test_url)
self.test_script_args.append(test_url)
options.profilePath = self.app_ctx.remote_profile
options.logFile = self.local_log

View File

@ -196,20 +196,6 @@ class MochiRemote(MochitestDesktop):
options.profilePath = self.remoteProfile
return manifest
def addChromeToProfile(self, options):
manifest = MochitestDesktop.addChromeToProfile(self, options)
# Support Firefox (browser), B2G (shell), SeaMonkey (navigator), and Webapp
# Runtime (webapp).
if options.chrome:
# append overlay to chrome.manifest
chrome = "overlay chrome://browser/content/browser.xul chrome://mochikit/content/browser-test-overlay.xul"
path = os.path.join(options.profilePath, 'extensions', 'staged',
'mochikit@mozilla.org', 'chrome.manifest')
with open(path, "a") as f:
f.write(chrome)
return manifest
def buildURLOptions(self, options, env):
self.localLog = options.logFile
options.logFile = self.remoteLog
@ -295,9 +281,8 @@ class MochiRemote(MochitestDesktop):
if 'profileDir' not in kwargs and 'profile' in kwargs:
kwargs['profileDir'] = kwargs.pop('profile').profile
# remove args not supported by automation.py
kwargs.pop('marionette_args', None)
kwargs.pop('quiet', None)
if 'quiet' in kwargs:
kwargs.pop('quiet')
return self._automation.runApp(*args, **kwargs)

View File

@ -1,15 +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/. */
const flavor = __marionetteParams[0]
const url = __marionetteParams[1]
let wm = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator);
let win = wm.getMostRecentWindow("navigator:browser");
// mochikit's bootstrap.js has set up a listener for this event. It's
// used so bootstrap.js knows which flavor and url to load.
let ev = new CustomEvent('mochitest-load', {'detail': [flavor, url]});
win.dispatchEvent(ev);

View File

@ -93,8 +93,6 @@ user_pref("privacy.trackingprotection.introURL", "http://%(server)s/trackingprot
// Point update checks to the local testing server for fast failures
user_pref("extensions.update.url", "http://%(server)s/extensions-dummy/updateURL");
user_pref("extensions.update.background.url", "http://%(server)s/extensions-dummy/updateBackgroundURL");
user_pref("extensions.blocklist.detailsURL", "http://%(server)s/extensions-dummy/blocklistDetailsURL");
user_pref("extensions.blocklist.itemURL", "http://%(server)s/extensions-dummy/blocklistItemURL");
user_pref("extensions.blocklist.url", "http://%(server)s/extensions-dummy/blocklistURL");
user_pref("extensions.hotfix.url", "http://%(server)s/extensions-dummy/hotfixURL");
user_pref("extensions.systemAddon.update.url", "http://%(server)s/dummy-system-addons.xml");
@ -345,4 +343,3 @@ user_pref("browser.urlbar.userMadeSearchSuggestionsChoice", true);
user_pref("dom.audiochannel.mutedByDefault", false);
user_pref("webextensions.tests", true);
user_pref("startup.homepage_welcome_url", "about:blank");

View File

@ -111,15 +111,13 @@ add_test(function disabling_test() {
var list = gWin.document.getElementById("disable-list");
ok(!list.hidden, "Disable list should be visible");
// As of bug 1231784, mochikit and special-powers are temporary addons
// and therefore also getting disabled.
is(list.childNodes.length, 4, "Should be three add-ons getting disabled (plus the header)");
is(list.childNodes[3].id, "test2@tests.mozilla.org", "Should be the right add-on ID");
is(list.childNodes[3].getAttribute("name"), "Test Add-on 2", "Should be the right add-on name");
is(list.childNodes.length, 2, "Should be one add-on getting disabled (plus the header)");
is(list.childNodes[1].id, "test2@tests.mozilla.org", "Should be the right add-on ID");
is(list.childNodes[1].getAttribute("name"), "Test Add-on 2", "Should be the right add-on name");
var list = gWin.document.getElementById("enable-list");
ok(!list.hidden, "Enable list should be visible");
is(list.childNodes.length, 2, "Should be one add-on getting enabled (plus the header)");
is(list.childNodes.length, 2, "Should be one add-on getting disabled (plus the header)");
is(list.childNodes[1].id, "test3@tests.mozilla.org", "Should be the right add-on ID");
is(list.childNodes[1].getAttribute("name"), "Test Add-on 3", "Should be the right add-on name");
@ -135,7 +133,7 @@ add_test(function disabling_test() {
add_test(function incompatible_test() {
setupUI(true, false, function() {
ok(gWin.document.getElementById("update-list").hidden, "Update list should be hidden");
ok(!gWin.document.getElementById("disable-list").hidden, "Disable list should be visible");
ok(gWin.document.getElementById("disable-list").hidden, "Disable list should be hidden");
ok(gWin.document.getElementById("enable-list").hidden, "Enable list should be hidden");
var list = gWin.document.getElementById("incompatible-list");
@ -170,11 +168,9 @@ add_test(function update_test() {
list = gWin.document.getElementById("disable-list");
ok(!list.hidden, "Disable list should be visible");
// As of bug 1231784, mochikit and special-powers are temporary addons
// and therefore also getting disabled.
is(list.childNodes.length, 4, "Should be three add-ons getting disabled (plus the header)");
is(list.childNodes[3].id, "test2@tests.mozilla.org", "Should be the right add-on ID");
is(list.childNodes[3].getAttribute("name"), "Test Add-on 2", "Should be the right add-on name");
is(list.childNodes.length, 2, "Should be one add-on getting disabled (plus the header)");
is(list.childNodes[1].id, "test2@tests.mozilla.org", "Should be the right add-on ID");
is(list.childNodes[1].getAttribute("name"), "Test Add-on 2", "Should be the right add-on name");
ok(!gWin.document.getElementById("next").hidden, "Next button should be visible");
ok(gWin.document.getElementById("done").hidden, "Done button should be hidden");

View File

@ -1295,18 +1295,17 @@ function setupAddons(aCallback) {
// tests.
AddonManager.getAllAddons(function(aAddons) {
let disabledAddons = [];
let harnessAddons = ["special-powers@mozilla.org", "mochikit@mozilla.org"];
aAddons.forEach(function(aAddon) {
// If an addon's type equals plugin it is skipped since
// checking plugins compatibility information isn't supported at this
// time (also see bug 566787). Also, SCOPE_APPLICATION add-ons are
// excluded by app update so there is no reason to disable them.
// Specialpowers and mochikit are excluded as the test harness requires
// them to run the tests.
// Specialpowers is excluded as the test harness requires it to run
// the tests.
if (aAddon.type != "plugin" && !aAddon.appDisabled &&
!aAddon.userDisabled &&
aAddon.scope != AddonManager.SCOPE_APPLICATION &&
harnessAddons.indexOf(aAddon.id) == -1) {
aAddon.id != "special-powers@mozilla.org") {
disabledAddons.push(aAddon);
aAddon.userDisabled = true;
}