Bug 843296 - Check for crashes and minidump_stackwalk for b2g emulator unittests, r=jgriffin
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Mon, 18 Mar 2013 10:01:06 -0400
changeset 125230 dadc8416f4df3468f54dfd763dcd315ee1a500f3
parent 125229 ecce21507ea0ebdf25cee4187fb22cae51b468ba
child 125231 74795c6fd7d6be56da55d19ba68ca0fe66ca85af
push id1435
push userryanvm@gmail.com
push dateTue, 19 Mar 2013 13:44:42 +0000
treeherderfx-team@55860fd20f67 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgriffin
bugs843296
milestone22.0a1
Bug 843296 - Check for crashes and minidump_stackwalk for b2g emulator unittests, r=jgriffin
b2g/test/b2g-unittest-requirements.txt
build/mobile/b2gautomation.py
--- a/b2g/test/b2g-unittest-requirements.txt
+++ b/b2g/test/b2g-unittest-requirements.txt
@@ -1,2 +1,6 @@
-mozprocess==0.8
-mozdevice==0.18
+mozprocess==0.9
+mozrunner==5.15
+mozdevice==0.21
+mozcrash==0.2.1
+mozfile==0.3
+mozlog==1.1
--- a/build/mobile/b2gautomation.py
+++ b/build/mobile/b2gautomation.py
@@ -1,13 +1,13 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
 # You can obtain one at http://mozilla.org/MPL/2.0/.
 
-import automationutils
+import mozcrash
 import threading
 import os
 import Queue
 import re
 import shutil
 import tempfile
 import time
 
@@ -76,16 +76,20 @@ class B2GRemoteAutomation(Automation):
 
     # Set up what we need for the remote environment
     def environment(self, env=None, xrePath=None, crashreporter=True):
         # Because we are running remote, we don't want to mimic the local env
         # so no copying of os.environ
         if env is None:
             env = {}
 
+        if crashreporter:
+            env['MOZ_CRASHREPORTER'] = '1'
+            env['MOZ_CRASHREPORTER_NO_REPORT'] = '1'
+
         # We always hide the results table in B2G; it's much slower if we don't.
         env['MOZ_HIDE_RESULTS_TABLE'] = '1'
         return env
 
     def waitForNet(self):
         active = False
         time_out = 0
         while not active and time_out < 40:
@@ -95,27 +99,26 @@ class B2GRemoteAutomation(Automation):
                 if (re.search(r'UP\s+(?:[0-9]{1,3}\.){3}[0-9]{1,3}', line)):
                     active = True
                     break
             time_out += 1
             time.sleep(1)
         return active
 
     def checkForCrashes(self, directory, symbolsPath):
-        # XXX: This will have to be updated after crash reporting on b2g
-        # is in place.
-        try:
-            dumpDir = tempfile.mkdtemp()
-            self._devicemanager.getDirectory(self._remoteProfile + '/minidumps/', dumpDir)
-            crashed = automationutils.checkForCrashes(dumpDir, symbolsPath, self.lastTestSeen)
-        finally:
+        crashed = False
+        remote_dump_dir = self._remoteProfile + '/minidumps'
+        if self._devicemanager.dirExists(remote_dump_dir):
+            local_dump_dir = tempfile.mkdtemp()
+            self._devicemanager.getDirectory(remote_dump_dir, local_dump_dir)
             try:
-                shutil.rmtree(dumpDir)
-            except:
-                print "WARNING: unable to remove directory: %s" % (dumpDir)
+                crashed = mozcrash.check_for_crashes(local_dump_dir, symbolsPath, test_name=self.lastTestSeen)
+            finally:
+                shutil.rmtree(local_dump_dir)
+                self._devicemanager.removeDir(remote_dump_dir)
         return crashed
 
     def initializeProfile(self,  profileDir, extraPrefs=[],
                           useServerLocations=False,
                           initialProfile=None):
         # add b2g specific prefs
         extraPrefs.extend(["browser.manifestURL='dummy (bug 772307)'"])
         return Automation.initializeProfile(self, profileDir,