mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 519574. Add --setpref to runtests.py, to add custom prefs to mochitest runs. r=mielczarek
--HG-- extra : rebase_source : db4f83d61b30b70fe5e3f49b25367f223a1ea5e3
This commit is contained in:
parent
a2d0aed7de
commit
997ce091cb
@ -223,7 +223,7 @@ def readLocations(locationsPath = "server-locations.txt"):
|
||||
return locations
|
||||
|
||||
|
||||
def initializeProfile(profileDir):
|
||||
def initializeProfile(profileDir, extraPrefs = []):
|
||||
"Sets up the standard testing profile."
|
||||
|
||||
# Start with a clean slate.
|
||||
@ -333,6 +333,14 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
|
||||
""" % {"pacURL": pacURL}
|
||||
prefs.append(part)
|
||||
|
||||
for v in extraPrefs:
|
||||
thispref = v.split("=")
|
||||
if len(thispref) < 2:
|
||||
print "Error: syntax error in --extra-pref=" + v
|
||||
sys.exit(1)
|
||||
part = 'user_pref("%s", %s);\n' % (thispref[0], thispref[1])
|
||||
prefs.append(part)
|
||||
|
||||
# write the preferences
|
||||
prefsFile = open(profileDir + "/" + "user.js", "a")
|
||||
prefsFile.write("".join(prefs))
|
||||
|
@ -214,6 +214,12 @@ class MochitestOptions(optparse.OptionParser):
|
||||
"environment")
|
||||
defaults["environment"] = []
|
||||
|
||||
self.add_option("--setpref",
|
||||
action = "append", type = "string",
|
||||
dest = "extraPrefs", metavar = "PREF=VALUE",
|
||||
help = "defines an extra user preference")
|
||||
defaults["extraPrefs"] = []
|
||||
|
||||
self.add_option("--browser-arg",
|
||||
action = "append", type = "string",
|
||||
dest = "browserArgs", metavar = "ARG",
|
||||
@ -426,7 +432,7 @@ Are you executing $objdir/_tests/testing/mochitest/runtests.py?"""
|
||||
sys.exit(1)
|
||||
browserEnv[v[:ix]] = v[ix + 1:]
|
||||
|
||||
automation.initializeProfile(PROFILE_DIRECTORY)
|
||||
automation.initializeProfile(PROFILE_DIRECTORY, options.extraPrefs)
|
||||
manifest = addChromeToProfile(options)
|
||||
copyExtraFilesToProfile(options)
|
||||
server = MochitestServer(options)
|
||||
|
Loading…
Reference in New Issue
Block a user