mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 13:25:37 +00:00
Back out 3354e7e52613 (bug 899171) on suspicion of causing Fennec and b2g reftest/jsreftest/crashtest bustage
CLOSED TREE
This commit is contained in:
parent
9b8bb85a9c
commit
db6b4c09ab
@ -332,50 +332,55 @@ class RemoteReftest(RefTest):
|
||||
def stopWebServer(self, options):
|
||||
self.server.stop()
|
||||
|
||||
def createReftestProfile(self, options, reftestlist):
|
||||
profile = RefTest.createReftestProfile(self, options, reftestlist, server=options.remoteWebServer)
|
||||
profileDir = profile.profile
|
||||
def createReftestProfile(self, options, profileDir, reftestlist):
|
||||
RefTest.createReftestProfile(self, options, profileDir, reftestlist, server=options.remoteWebServer)
|
||||
|
||||
prefs = {}
|
||||
prefs["browser.firstrun.show.localepicker"] = False
|
||||
prefs["font.size.inflation.emPerLine"] = 0
|
||||
prefs["font.size.inflation.minTwips"] = 0
|
||||
prefs["reftest.remote"] = True
|
||||
# Set a future policy version to avoid the telemetry prompt.
|
||||
prefs["toolkit.telemetry.prompted"] = 999
|
||||
prefs["toolkit.telemetry.notifiedOptOut"] = 999
|
||||
prefs["reftest.uri"] = reftestlist
|
||||
prefs["datareporting.policy.dataSubmissionPolicyBypassAcceptance"] = True
|
||||
# Turn off the locale picker screen
|
||||
fhandle = open(os.path.join(profileDir, "user.js"), 'a')
|
||||
fhandle.write("""
|
||||
user_pref("browser.firstrun.show.localepicker", false);
|
||||
user_pref("font.size.inflation.emPerLine", 0);
|
||||
user_pref("font.size.inflation.minTwips", 0);
|
||||
user_pref("reftest.remote", true);
|
||||
// Set a future policy version to avoid the telemetry prompt.
|
||||
user_pref("toolkit.telemetry.prompted", 999);
|
||||
user_pref("toolkit.telemetry.notifiedOptOut", 999);
|
||||
user_pref("reftest.uri", "%s");
|
||||
user_pref("datareporting.policy.dataSubmissionPolicyBypassAcceptance", true);
|
||||
|
||||
# Point the url-classifier to the local testing server for fast failures
|
||||
prefs["browser.safebrowsing.gethashURL"] = "http://127.0.0.1:8888/safebrowsing-dummy/gethash"
|
||||
prefs["browser.safebrowsing.keyURL"] = "http://127.0.0.1:8888/safebrowsing-dummy/newkey"
|
||||
prefs["browser.safebrowsing.updateURL"] = "http://127.0.0.1:8888/safebrowsing-dummy/update"
|
||||
# Point update checks to the local testing server for fast failures
|
||||
prefs["extensions.update.url"] = "http://127.0.0.1:8888/extensions-dummy/updateURL"
|
||||
prefs["extensions.update.background.url"] = "http://127.0.0.1:8888/extensions-dummy/updateBackgroundURL"
|
||||
prefs["extensions.blocklist.url"] = "http://127.0.0.1:8888/extensions-dummy/blocklistURL"
|
||||
prefs["extensions.hotfix.url"] = "http://127.0.0.1:8888/extensions-dummy/hotfixURL"
|
||||
# Turn off extension updates so they don't bother tests
|
||||
prefs["extensions.update.enabled"] = False
|
||||
# Make sure opening about:addons won't hit the network
|
||||
prefs["extensions.webservice.discoverURL"] = "http://127.0.0.1:8888/extensions-dummy/discoveryURL"
|
||||
# Make sure AddonRepository won't hit the network
|
||||
prefs["extensions.getAddons.maxResults"] = 0
|
||||
prefs["extensions.getAddons.get.url"] = "http://127.0.0.1:8888/extensions-dummy/repositoryGetURL"
|
||||
prefs["extensions.getAddons.getWithPerformance.url"] = "http://127.0.0.1:8888/extensions-dummy/repositoryGetWithPerformanceURL"
|
||||
prefs["extensions.getAddons.search.browseURL"] = "http://127.0.0.1:8888/extensions-dummy/repositoryBrowseURL"
|
||||
prefs["extensions.getAddons.search.url"] = "http://127.0.0.1:8888/extensions-dummy/repositorySearchURL"
|
||||
# Make sure that opening the plugins check page won't hit the network
|
||||
prefs["plugins.update.url"] = "http://127.0.0.1:8888/plugins-dummy/updateCheckURL"
|
||||
// Point the url-classifier to the local testing server for fast failures
|
||||
user_pref("browser.safebrowsing.gethashURL", "http://127.0.0.1:8888/safebrowsing-dummy/gethash");
|
||||
user_pref("browser.safebrowsing.keyURL", "http://127.0.0.1:8888/safebrowsing-dummy/newkey");
|
||||
user_pref("browser.safebrowsing.updateURL", "http://127.0.0.1:8888/safebrowsing-dummy/update");
|
||||
// Point update checks to the local testing server for fast failures
|
||||
user_pref("extensions.update.url", "http://127.0.0.1:8888/extensions-dummy/updateURL");
|
||||
user_pref("extensions.update.background.url", "http://127.0.0.1:8888/extensions-dummy/updateBackgroundURL");
|
||||
user_pref("extensions.blocklist.url", "http://127.0.0.1:8888/extensions-dummy/blocklistURL");
|
||||
user_pref("extensions.hotfix.url", "http://127.0.0.1:8888/extensions-dummy/hotfixURL");
|
||||
// Turn off extension updates so they don't bother tests
|
||||
user_pref("extensions.update.enabled", false);
|
||||
// Make sure opening about:addons won't hit the network
|
||||
user_pref("extensions.webservice.discoverURL", "http://127.0.0.1:8888/extensions-dummy/discoveryURL");
|
||||
// Make sure AddonRepository won't hit the network
|
||||
user_pref("extensions.getAddons.maxResults", 0);
|
||||
user_pref("extensions.getAddons.get.url", "http://127.0.0.1:8888/extensions-dummy/repositoryGetURL");
|
||||
user_pref("extensions.getAddons.getWithPerformance.url", "http://127.0.0.1:8888/extensions-dummy/repositoryGetWithPerformanceURL");
|
||||
user_pref("extensions.getAddons.search.browseURL", "http://127.0.0.1:8888/extensions-dummy/repositoryBrowseURL");
|
||||
user_pref("extensions.getAddons.search.url", "http://127.0.0.1:8888/extensions-dummy/repositorySearchURL");
|
||||
// Make sure that opening the plugins check page won't hit the network
|
||||
user_pref("plugins.update.url", "http://127.0.0.1:8888/plugins-dummy/updateCheckURL");
|
||||
|
||||
# Workaround for jsreftests.
|
||||
""" % reftestlist)
|
||||
|
||||
#workaround for jsreftests.
|
||||
if options.enablePrivilege:
|
||||
prefs["capability.principal.codebase.p2.granted"] = "UniversalXPConnect"
|
||||
prefs["capability.principal.codebase.p2.id"] = "http://%s:%s" % (options.remoteWebServer, options.httpPort)
|
||||
fhandle.write("""
|
||||
user_pref("capability.principal.codebase.p2.granted", "UniversalXPConnect");
|
||||
user_pref("capability.principal.codebase.p2.id", "http://%s:%s");
|
||||
""" % (options.remoteWebServer, options.httpPort))
|
||||
|
||||
# Set the extra prefs.
|
||||
profile.set_preferences(prefs)
|
||||
# Close the file
|
||||
fhandle.close()
|
||||
|
||||
try:
|
||||
self._devicemanager.pushDir(profileDir, options.remoteProfile)
|
||||
@ -383,8 +388,6 @@ class RemoteReftest(RefTest):
|
||||
print "Automation Error: Failed to copy profiledir to device"
|
||||
raise
|
||||
|
||||
return profile
|
||||
|
||||
def copyExtraFilesToProfile(self, options, profileDir):
|
||||
RefTest.copyExtraFilesToProfile(self, options, profileDir)
|
||||
try:
|
||||
|
@ -15,8 +15,6 @@ from automationutils import *
|
||||
from optparse import OptionParser
|
||||
from tempfile import mkdtemp
|
||||
|
||||
import mozprofile
|
||||
|
||||
class RefTest(object):
|
||||
|
||||
oldcwd = os.getcwd()
|
||||
@ -44,7 +42,7 @@ class RefTest(object):
|
||||
def makeJSString(self, s):
|
||||
return '"%s"' % re.sub(r'([\\"])', r'\\\1', s)
|
||||
|
||||
def createReftestProfile(self, options, manifest, server='localhost'):
|
||||
def createReftestProfile(self, options, profileDir, manifest, server='localhost'):
|
||||
"""
|
||||
Sets up a profile for reftest.
|
||||
'manifest' is the path to the reftest.list file we want to test with. This is used in
|
||||
@ -52,58 +50,47 @@ class RefTest(object):
|
||||
bootstrap extension.
|
||||
"""
|
||||
|
||||
locations = mozprofile.permissions.ServerLocations()
|
||||
locations.add_host(server, port=0)
|
||||
locations.add_host('<file>', port=0)
|
||||
self.automation.setupPermissionsDatabase(profileDir,
|
||||
{'allowXULXBL': [(server, True), ('<file>', True)]})
|
||||
|
||||
# Set preferences for communication between our command line arguments
|
||||
# and the reftest harness. Preferences that are required for reftest
|
||||
# to work should instead be set in reftest-cmdline.js .
|
||||
prefs = {}
|
||||
prefs['reftest.timeout'] = options.timeout * 1000
|
||||
if options.totalChunks:
|
||||
prefs['reftest.totalChunks'] = options.totalChunks
|
||||
if options.thisChunk:
|
||||
prefs['reftest.thisChunk'] = options.thisChunk
|
||||
if options.logFile:
|
||||
prefs['reftest.logFile'] = options.logFile
|
||||
if options.ignoreWindowSize:
|
||||
prefs['reftest.ignoreWindowSize'] = 'true'
|
||||
if options.filter:
|
||||
prefs['reftest.filter'] = self.makeJSString(options.filter)
|
||||
prefs['reftest.focusFilterMode'] = self.makeJSString(options.focusFilterMode)
|
||||
prefsFile = open(os.path.join(profileDir, "user.js"), "a")
|
||||
prefsFile.write('user_pref("reftest.timeout", %d);\n' % (options.timeout * 1000))
|
||||
|
||||
if options.totalChunks != None:
|
||||
prefsFile.write('user_pref("reftest.totalChunks", %d);\n' % options.totalChunks)
|
||||
if options.thisChunk != None:
|
||||
prefsFile.write('user_pref("reftest.thisChunk", %d);\n' % options.thisChunk)
|
||||
if options.logFile != None:
|
||||
prefsFile.write('user_pref("reftest.logFile", "%s");\n' % options.logFile)
|
||||
if options.ignoreWindowSize != False:
|
||||
prefsFile.write('user_pref("reftest.ignoreWindowSize", true);\n')
|
||||
if options.filter != None:
|
||||
prefsFile.write('user_pref("reftest.filter", %s);\n' % self.makeJSString(options.filter))
|
||||
prefsFile.write('user_pref("reftest.focusFilterMode", %s);\n' % self.makeJSString(options.focusFilterMode))
|
||||
|
||||
for v in options.extraPrefs:
|
||||
thispref = v.split('=')
|
||||
thispref = v.split("=")
|
||||
if len(thispref) < 2:
|
||||
print "Error: syntax error in --setpref=" + v
|
||||
sys.exit(1)
|
||||
prefs[thispref[0]] = thispref[1]
|
||||
part = 'user_pref("%s", %s);\n' % (thispref[0], thispref[1])
|
||||
prefsFile.write(part)
|
||||
prefsFile.close()
|
||||
|
||||
# install the reftest extension bits into the profile
|
||||
addons = []
|
||||
addons.append(os.path.join(SCRIPT_DIRECTORY, "reftest"))
|
||||
self.automation.installExtension(os.path.join(SCRIPT_DIRECTORY, "reftest"),
|
||||
profileDir,
|
||||
"reftest@mozilla.org")
|
||||
|
||||
# I would prefer to use "--install-extension reftest/specialpowers", but that requires tight coordination with
|
||||
# release engineering and landing on multiple branches at once.
|
||||
if manifest.endswith('crashtests.list'):
|
||||
addons.append(os.path.join(SCRIPT_DIRECTORY, 'specialpowers'))
|
||||
|
||||
# Install distributed extensions, if application has any.
|
||||
distExtDir = os.path.join(options.app[ : options.app.rfind(os.sep)], "distribution", "extensions")
|
||||
if os.path.isdir(distExtDir):
|
||||
for f in os.listdir(distExtDir):
|
||||
addons.append(os.path.join(distExtDir, f))
|
||||
|
||||
# Install custom extensions.
|
||||
for f in options.extensionsToInstall:
|
||||
addons.append(self.getFullPath(f))
|
||||
|
||||
return mozprofile.profile.Profile(
|
||||
addons=addons,
|
||||
preferences=prefs,
|
||||
locations=locations,
|
||||
)
|
||||
self.automation.installExtension(os.path.join(SCRIPT_DIRECTORY, "specialpowers"),
|
||||
profileDir,
|
||||
"special-powers@mozilla.org")
|
||||
|
||||
def buildBrowserEnv(self, options, profileDir):
|
||||
browserEnv = self.automation.environment(xrePath = options.xrePath)
|
||||
@ -134,9 +121,10 @@ class RefTest(object):
|
||||
reftestlist = self.getManifestPath(testPath)
|
||||
if cmdlineArgs == None:
|
||||
cmdlineArgs = ['-reftest', reftestlist]
|
||||
profile = self.createReftestProfile(options, reftestlist)
|
||||
profileDir = profile.profile # name makes more sense
|
||||
profileDir = mkdtemp()
|
||||
self.copyExtraFilesToProfile(options, profileDir)
|
||||
self.createReftestProfile(options, profileDir, reftestlist)
|
||||
self.installExtensionsToProfile(options, profileDir)
|
||||
|
||||
# browser environment
|
||||
browserEnv = self.buildBrowserEnv(options, profileDir)
|
||||
@ -170,6 +158,18 @@ class RefTest(object):
|
||||
self.automation.log.warning("WARNING | runreftest.py | Failed to copy %s to profile", abspath)
|
||||
continue
|
||||
|
||||
def installExtensionsToProfile(self, options, profileDir):
|
||||
"Install application distributed extensions and specified on the command line ones to testing profile."
|
||||
# Install distributed extensions, if application has any.
|
||||
distExtDir = os.path.join(options.app[ : options.app.rfind(os.sep)], "distribution", "extensions")
|
||||
if os.path.isdir(distExtDir):
|
||||
for f in os.listdir(distExtDir):
|
||||
self.automation.installExtension(os.path.join(distExtDir, f), profileDir)
|
||||
|
||||
# Install custom extensions.
|
||||
for f in options.extensionsToInstall:
|
||||
self.automation.installExtension(self.getFullPath(f), profileDir)
|
||||
|
||||
|
||||
class ReftestOptions(OptionParser):
|
||||
|
||||
|
@ -218,6 +218,7 @@ class B2GReftest(RefTest):
|
||||
self.runSSLTunnel = False
|
||||
self.remoteTestRoot = options.remoteTestRoot
|
||||
self.remoteProfile = options.remoteProfile
|
||||
self._automation.setRemoteProfile(self.remoteProfile)
|
||||
self.localLogName = options.localLogName
|
||||
self.remoteLogFile = options.remoteLogFile
|
||||
self.bundlesDir = '/system/b2g/distribution/bundles'
|
||||
@ -391,37 +392,41 @@ class B2GReftest(RefTest):
|
||||
pass
|
||||
|
||||
|
||||
def createReftestProfile(self, options, reftestlist):
|
||||
profile = RefTest.createReftestProfile(self, options, reftestlist, server=options.remoteWebServer)
|
||||
profileDir = profile.profile
|
||||
def createReftestProfile(self, options, profileDir, reftestlist):
|
||||
print "profileDir: " + str(profileDir)
|
||||
retVal = RefTest.createReftestProfile(self, options, profileDir, reftestlist, server=options.remoteWebServer)
|
||||
|
||||
prefs = {}
|
||||
# Turn off the locale picker screen
|
||||
prefs["browser.firstrun.show.localepicker"] = False
|
||||
prefs["browser.homescreenURL"] = "app://system.gaiamobile.org"
|
||||
prefs["browser.manifestURL"] = "app://system.gaiamobile.org/manifest.webapp"
|
||||
prefs["browser.tabs.remote"] = False
|
||||
prefs["dom.ipc.browser_frames.oop_by_default"] = True
|
||||
prefs["dom.ipc.tabs.disabled"] = False
|
||||
prefs["dom.mozBrowserFramesEnabled"] = True
|
||||
prefs["dom.mozBrowserFramesWhitelist"] = "app://system.gaiamobile.org"
|
||||
prefs["network.dns.localDomains"] = "app://system.gaiamobile.org"
|
||||
prefs["font.size.inflation.emPerLine"] = 0
|
||||
prefs["font.size.inflation.minTwips"] = 0
|
||||
prefs["reftest.browser.iframe.enabled"] = False
|
||||
prefs["reftest.remote"] = True
|
||||
prefs["reftest.uri"] = "%s" % reftestlist
|
||||
# Set a future policy version to avoid the telemetry prompt.
|
||||
prefs["toolkit.telemetry.prompted"] = 999
|
||||
prefs["toolkit.telemetry.notifiedOptOut"] = 999
|
||||
fhandle = open(os.path.join(profileDir, "user.js"), 'a')
|
||||
fhandle.write("""
|
||||
user_pref("browser.firstrun.show.localepicker", false);
|
||||
user_pref("browser.homescreenURL","app://system.gaiamobile.org");\n
|
||||
user_pref("browser.manifestURL","app://system.gaiamobile.org/manifest.webapp");\n
|
||||
user_pref("browser.tabs.remote", false);\n
|
||||
user_pref("dom.ipc.browser_frames.oop_by_default", true);\n
|
||||
user_pref("dom.ipc.tabs.disabled", false);\n
|
||||
user_pref("dom.mozBrowserFramesEnabled", true);\n
|
||||
user_pref("dom.mozBrowserFramesWhitelist","app://system.gaiamobile.org");\n
|
||||
user_pref("network.dns.localDomains","app://system.gaiamobile.org");\n
|
||||
user_pref("font.size.inflation.emPerLine", 0);
|
||||
user_pref("font.size.inflation.minTwips", 0);
|
||||
user_pref("reftest.browser.iframe.enabled", false);
|
||||
user_pref("reftest.remote", true);
|
||||
user_pref("reftest.uri", "%s");
|
||||
// Set a future policy version to avoid the telemetry prompt.
|
||||
user_pref("toolkit.telemetry.prompted", 999);
|
||||
user_pref("toolkit.telemetry.notifiedOptOut", 999);
|
||||
""" % reftestlist)
|
||||
|
||||
# Workaround for jsreftests.
|
||||
#workaround for jsreftests.
|
||||
if getattr(options, 'enablePrivilege', False):
|
||||
prefs["capability.principal.codebase.p2.granted"] = "UniversalXPConnect"
|
||||
prefs["capability.principal.codebase.p2.id"] = "http://%s:%s" % (options.remoteWebServer, options.httpPort)
|
||||
fhandle.write("""
|
||||
user_pref("capability.principal.codebase.p2.granted", "UniversalXPConnect");
|
||||
user_pref("capability.principal.codebase.p2.id", "http://%s:%s");
|
||||
""" % (options.remoteWebServer, options.httpPort))
|
||||
|
||||
# Set the extra prefs.
|
||||
profile.set_preferences(prefs)
|
||||
# Close the file
|
||||
fhandle.close()
|
||||
|
||||
# Copy the profile to the device.
|
||||
self._devicemanager.removeDir(self.remoteProfile)
|
||||
@ -453,7 +458,7 @@ class B2GReftest(RefTest):
|
||||
self.updateProfilesIni(self.remoteProfile)
|
||||
|
||||
options.profilePath = self.remoteProfile
|
||||
return profile
|
||||
return retVal
|
||||
|
||||
def copyExtraFilesToProfile(self, options, profileDir):
|
||||
RefTest.copyExtraFilesToProfile(self, options, profileDir)
|
||||
|
Loading…
Reference in New Issue
Block a user