Bug 799107 - minidumps not being generated from robocop test crashes (breakpad environment variables not being set properly). r=kats
authorJoel Maher <jmaher@mozilla.com>
Tue, 16 Oct 2012 13:25:23 -0400
changeset 110420 b05c80fb621f7a0831def11d06c413990336034a
parent 110419 0d27abf6448275d4ebada86d12934bffcc9013c9
child 110421 8cbc15e874a2a487b723699e0b2e552badc6e8e8
push id23688
push userryanvm@gmail.com
push dateWed, 17 Oct 2012 01:52:19 +0000
treeherdermozilla-central@dac5700acf8b [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
@@ -381,16 +381,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 "Found: Error 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):
@@ -429,31 +464,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')