Bug 799107 - minidumps not being generated from robocop test crashes (breakpad environment variables not being set properly). r=kats

This commit is contained in:
Joel Maher 2012-10-16 13:25:23 -04:00
parent c316c36e49
commit 7217f498ae
3 changed files with 45 additions and 15 deletions

View File

@ -393,7 +393,7 @@ public class FennecNativeDriver implements Driver {
String[] lines = data.split("\n"); String[] lines = data.split("\n");
for (int i = 0; i < lines.length; i++) { 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()); retVal.put(parts[0].trim(), parts[1].trim());
} }
return retVal; return retVal;

View File

@ -66,6 +66,14 @@ abstract class BaseTest extends ActivityInstrumentationTestCase2<Activity> {
mProfile = (String)config.get("profile"); mProfile = (String)config.get("profile");
i.putExtra("args", "-no-remote -profile " + mProfile); 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 // Start the activity
setActivityIntent(i); setActivityIntent(i);
mActivity = getActivity(); mActivity = getActivity();

View File

@ -386,6 +386,41 @@ class MochiRemote(Mochitest):
if failed > 0: if failed > 0:
return 1 return 1
return 0 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(): def main():
scriptdir = os.path.abspath(os.path.realpath(os.path.dirname(__file__))) scriptdir = os.path.abspath(os.path.realpath(os.path.dirname(__file__)))
@ -434,21 +469,8 @@ def main():
mp.read(options.robocop) mp.read(options.robocop)
robocop_tests = mp.active_tests(exists=False) robocop_tests = mp.active_tests(exists=False)
fHandle = tempfile.NamedTemporaryFile(suffix='.config', deviceRoot = dm.getDeviceRoot()
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()
dm.removeFile(os.path.join(deviceRoot, "fennec_ids.txt")) 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") fennec_ids = os.path.abspath("fennec_ids.txt")
if not os.path.exists(fennec_ids) and options.robocopIds: if not os.path.exists(fennec_ids) and options.robocopIds:
fennec_ids = options.robocopIds fennec_ids = options.robocopIds