Bug 799107 - minidumps not being generated from robocop test crashes (breakpad environment variables not being set properly). r=kats
☠☠ backed out by a53a74e310ae ☠ ☠
authorJoel Maher <jmaher@mozilla.com>
Mon, 15 Oct 2012 07:10:49 -0400
changeset 110269 f271acb304c2b8eae1975f84ee0d8756d3e69292
parent 110268 d16548ef9acccf64c85c32195f76a3a3aa11ecf2
child 110270 22d51507ec021c0362e80e339370769578194642
push id23680
push useremorley@mozilla.com
push dateTue, 16 Oct 2012 08:09:24 +0000
treeherdermozilla-central@8f145599e4bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs799107
milestone19.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 799107 - minidumps not being generated from robocop test crashes (breakpad environment variables not being set properly). r=kats
build/mobile/robocop/FennecNativeDriver.java.in
mobile/android/base/tests/BaseTest.java.in
testing/mochitest/runtestsremote.py
--- a/build/mobile/robocop/FennecNativeDriver.java.in
+++ b/build/mobile/robocop/FennecNativeDriver.java.in
@@ -388,17 +388,17 @@ public class FennecNativeDriver implemen
      *  Takes a string of "key=value" pairs split by \n and creates a hash table.
      */
     public static HashMap convertTextToTable(String data)
     {
         HashMap retVal = new HashMap();
 
         String[] lines = data.split("\n");
         for (int i = 0; i < lines.length; i++) {
-            String[] parts = lines[i].split("=");
+            String[] parts = lines[i].split("=", 2);
             retVal.put(parts[0].trim(), parts[1].trim());
         }
         return retVal;
     }
 
     public static void logAllStackTraces(LogLevel level) {
         StringBuffer sb = new StringBuffer();
         sb.append("Dumping ALL the threads!\n");
--- a/mobile/android/base/tests/BaseTest.java.in
+++ b/mobile/android/base/tests/BaseTest.java.in
@@ -61,16 +61,24 @@ abstract class BaseTest extends Activity
         String configFile = FennecNativeDriver.getFile(rootPath + "/robotium.config");
         HashMap config = FennecNativeDriver.convertTextToTable(configFile);
 
         // Create the intent to be used with all the important arguments.
         Intent i = new Intent(Intent.ACTION_MAIN);
         mProfile = (String)config.get("profile");
         i.putExtra("args", "-no-remote -profile " + mProfile);
 
+        String envString = (String)config.get("envvars");
+        if (envString != "") {
+            String[] envStrings = envString.split(",");
+            for (int iter = 0; iter < envStrings.length; iter++) {
+                i.putExtra("env" + iter, envStrings[iter]);
+            }
+        }
+
         // Start the activity
         setActivityIntent(i);
         mActivity = getActivity();
 
         mLogFile = (String)config.get("logfile");
         mBaseUrl = ((String)config.get("host")).replaceAll("(/$)", "");
         mRawBaseUrl = ((String)config.get("rawhost")).replaceAll("(/$)", "");
 
--- a/testing/mochitest/runtestsremote.py
+++ b/testing/mochitest/runtestsremote.py
@@ -377,16 +377,51 @@ class MochiRemote(Mochitest):
         # TODO: Consider not printing to stdout because we might be duplicating output
         print '\n'.join(logFile)
         with open(self.localLog, 'w') as localLog:
             localLog.write('\n'.join(logFile))
 
         if failed > 0:
             return 1
         return 0
+
+    def buildRobotiumConfig(self, options, browserEnv):
+        deviceRoot = self._dm.getDeviceRoot()
+        fHandle = tempfile.NamedTemporaryFile(suffix='.config',
+                                              prefix='robotium-',
+                                              dir=os.getcwd(),
+                                              delete=False)
+        fHandle.write("profile=%s\n" % (self.remoteProfile))
+        fHandle.write("logfile=%s\n" % (options.remoteLogFile))
+        fHandle.write("host=http://mochi.test:8888/tests\n")
+        fHandle.write("rawhost=http://%s:%s/tests\n" % (options.remoteWebServer, options.httpPort))
+
+        if browserEnv:
+            envstr = ""
+            delim = ""
+            for key, value in browserEnv.items():
+                try:
+                    value.index(',')
+                    print "Error: Found an ',' in our value, unable to process value."
+                except ValueError, e:
+                    envstr += "%s%s=%s" % (delim, key, value)
+                    delim = ","
+
+            fHandle.write("envvars=%s\n" % envstr)
+        fHandle.close()
+
+        self._dm.removeFile(os.path.join(deviceRoot, "robotium.config"))
+        self._dm.pushFile(fHandle.name, os.path.join(deviceRoot, "robotium.config"))
+        os.unlink(fHandle.name)
+
+    def buildBrowserEnv(self, options):
+        browserEnv = Mochitest.buildBrowserEnv(self, options)
+        self.buildRobotiumConfig(options, browserEnv)
+        return browserEnv
+
         
 def main():
     scriptdir = os.path.abspath(os.path.realpath(os.path.dirname(__file__)))
     auto = RemoteAutomation(None, "fennec")
     parser = RemoteOptions(auto, scriptdir)
     options, args = parser.parse_args()
     if (options.dm_trans == "adb"):
         if (options.deviceIP):
@@ -425,31 +460,18 @@ def main():
         dm.killProcess(procName)
     
     if options.robocop != "":
         mp = manifestparser.TestManifest(strict=False)
         # TODO: pull this in dynamically
         mp.read(options.robocop)
         robocop_tests = mp.active_tests(exists=False)
 
-        fHandle = tempfile.NamedTemporaryFile(suffix='.config',
-                                              prefix='robotium-',
-                                              dir=os.getcwd(),
-                                              delete=False)
-        fHandle.write("profile=%s\n" % (mochitest.remoteProfile))
-        fHandle.write("logfile=%s\n" % (options.remoteLogFile))
-        fHandle.write("host=http://mochi.test:8888/tests\n")
-        fHandle.write("rawhost=http://%s:%s/tests\n" % (options.remoteWebServer, options.httpPort))
-        fHandle.close()
-        deviceRoot = dm.getDeviceRoot()
-      
+        deviceRoot = dm.getDeviceRoot()      
         dm.removeFile(os.path.join(deviceRoot, "fennec_ids.txt"))
-        dm.removeFile(os.path.join(deviceRoot, "robotium.config"))
-        dm.pushFile(fHandle.name, os.path.join(deviceRoot, "robotium.config"))
-        os.unlink(fHandle.name)
         fennec_ids = os.path.abspath("fennec_ids.txt")
         if not os.path.exists(fennec_ids) and options.robocopIds:
             fennec_ids = options.robocopIds
         dm.pushFile(fennec_ids, os.path.join(deviceRoot, "fennec_ids.txt"))
         options.extraPrefs.append('robocop.logfile="%s/robocop.log"' % deviceRoot)
         options.extraPrefs.append('browser.search.suggest.enabled=true')
         options.extraPrefs.append('browser.search.suggest.prompted=true')