зеркало из https://github.com/mozilla/gecko-dev.git
Bug 519574. Add --setpref to runtests.py, to add custom prefs to mochitest runs. r-mielczarek
--HG-- extra : rebase_source : ce30cb69fa925be5c639ed4e740a85b831cf9b0a
This commit is contained in:
Родитель
8635fae956
Коммит
07aa873623
|
@ -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)
|
||||
|
|
Загрузка…
Ссылка в новой задаче