Bug 1266198 - support --setenv options for robocop tests; r=gbrown
authorNathan Froyd <froydnj.com>
Thu, 21 Apr 2016 11:13:14 -0400
changeset 318105 263e3cf287dda5bc5b4bbcb9198a871793d6a319
parent 318104 869c852dff028771930a58c7c35e153999581fb5
child 318106 991c721d2e551357d8f7213a4c484b3bcba53736
push id9480
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 17:12:58 +0000
treeherdermozilla-aurora@0d6a91c76a9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgbrown
bugs1266198
milestone48.0a1
Bug 1266198 - support --setenv options for robocop tests; r=gbrown
testing/mochitest/runrobocop.py
--- a/testing/mochitest/runrobocop.py
+++ b/testing/mochitest/runrobocop.py
@@ -11,17 +11,17 @@ import traceback
 
 sys.path.insert(
     0, os.path.abspath(
         os.path.realpath(
             os.path.dirname(__file__))))
 
 from automation import Automation
 from remoteautomation import RemoteAutomation, fennecLogcatFilters
-from runtests import MochitestDesktop, MessageLogger
+from runtests import KeyValueParseError, MochitestDesktop, MessageLogger, parseKeyValue
 from mochitest_options import MochitestArgumentParser
 
 from manifestparser import TestManifest
 from manifestparser.filters import chunk_by_slice
 import mozdevice
 import mozinfo
 
 SCRIPT_DIR = os.path.abspath(os.path.realpath(os.path.dirname(__file__)))
@@ -398,16 +398,27 @@ class RobocopTestRunner(MochitestDesktop
         # remove desktop environment not used on device
         if "MOZ_WIN_INHERIT_STD_HANDLES_PRE_VISTA" in browserEnv:
             del browserEnv["MOZ_WIN_INHERIT_STD_HANDLES_PRE_VISTA"]
         if "XPCOM_MEM_BLOAT_LOG" in browserEnv:
             del browserEnv["XPCOM_MEM_BLOAT_LOG"]
         browserEnv["MOZ_LOG_FILE"] = os.path.join(
             self.remoteMozLog,
             self.mozLogName)
+
+        try:
+            browserEnv.update(
+                dict(
+                    parseKeyValue(
+                        self.options.environment,
+                        context='--setenv')))
+        except KeyValueParseError as e:
+            self.log.error(str(e))
+            return None
+
         return browserEnv
 
     def runSingleTest(self, test):
         """
            Run the specified test.
         """
         self.log.debug("Running test %s" % test['name'])
         self.mozLogName = "moz-%s.log" % test['name']