Bug 821425 - Flexible env variable support for remote cpp unit tests; r=jmaher

--HG--
extra : rebase_source : 8fd1519077f7e20538af805d91d6373c0c9abcd1
This commit is contained in:
Geoff Brown 2013-01-03 13:02:04 -07:00
parent 74b9df4351
commit a5a0925a67

View File

@ -68,6 +68,16 @@ class RemoteCPPUnitTests(cppunittests.CPPUnitTests):
env["HOME"]=self.remote_home_dir
env["MOZILLA_FIVE_HOME"] = self.remote_home_dir
env["MOZ_XRE_DIR"] = self.remote_bin_dir
if self.options.add_env:
for envdef in self.options.add_env:
envdef_parts = envdef.split("=", 1)
if len(envdef_parts) == 2:
env[envdef_parts[0]] = envdef_parts[1]
elif len(envdef_parts) == 1:
env[envdef_parts[0]] = ""
else:
print >> sys.stderr, "warning: invalid --addEnv option skipped: "+envdef
return env
def run_one_test(self, prog, env, symbols_path=None):
@ -138,6 +148,11 @@ class RemoteCPPUnittestOptions(cppunittests.CPPUnittestOptions):
# on binaries on /mnt/sdcard
defaults["remote_test_root"] = "/data/local/tests"
self.add_option("--addEnv", action = "append",
type = "string", dest = "add_env",
help = "additional remote environment variable definitions (eg. --addEnv \"somevar=something\")")
defaults["add_env"] = None
self.set_defaults(**defaults)
def main():