Bug 777412 - Support the --setenv option in reftests

This commit is contained in:
Christian Holler 2012-07-30 13:47:27 +02:00
parent 2bca813a6f
commit a42c8cb1e9

View File

@ -83,6 +83,13 @@ class RefTest(object):
browserEnv = self.automation.environment(xrePath = options.xrePath) browserEnv = self.automation.environment(xrePath = options.xrePath)
browserEnv["XPCOM_DEBUG_BREAK"] = "stack" browserEnv["XPCOM_DEBUG_BREAK"] = "stack"
for v in options.environment:
ix = v.find("=")
if ix <= 0:
print "Error: syntax error in --setenv=" + v
return None
browserEnv[v[:ix]] = v[ix + 1:]
# Enable leaks detection to its own log file. # Enable leaks detection to its own log file.
self.leakLogFile = os.path.join(profileDir, "runreftest_leaks.log") self.leakLogFile = os.path.join(profileDir, "runreftest_leaks.log")
browserEnv["XPCOM_MEM_BLOAT_LOG"] = self.leakLogFile browserEnv["XPCOM_MEM_BLOAT_LOG"] = self.leakLogFile
@ -223,6 +230,13 @@ class ReftestOptions(OptionParser):
"An optional path can be specified too.") "An optional path can be specified too.")
defaults["extensionsToInstall"] = [] defaults["extensionsToInstall"] = []
self.add_option("--setenv",
action = "append", type = "string",
dest = "environment", metavar = "NAME=VALUE",
help = "sets the given variable in the application's "
"environment")
defaults["environment"] = []
self.set_defaults(**defaults) self.set_defaults(**defaults)
def main(): def main():