bug 540627 - provide an environment variable to save minidumps from test runs. r=bsmedberg
authorTed Mielczarek <ted.mielczarek@gmail.com>
Wed, 03 Feb 2010 14:15:17 -0500
changeset 37862 577a861efe56a3c0a67317d671322db8687da771
parent 37861 350784945074b592e8b794948be32d98c7a1fb99
child 37863 2258a632387e1af5a493902657a665c7f56b2ff0
push id11471
push usertmielczarek@mozilla.com
push dateWed, 03 Feb 2010 19:27:38 +0000
treeherdermozilla-central@577a861efe56 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs540627
milestone1.9.3a1pre
bug 540627 - provide an environment variable to save minidumps from test runs. r=bsmedberg
build/automationutils.py
--- a/build/automationutils.py
+++ b/build/automationutils.py
@@ -31,17 +31,17 @@
 # use your version of this file under the terms of the MPL, indicate your
 # decision by deleting the provisions above and replace them with the notice
 # and other provisions required by the GPL or the LGPL. If you do not delete
 # the provisions above, a recipient may use your version of this file under
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK ***** */
 
-import glob, logging, os, subprocess, sys
+import glob, logging, os, shutil, subprocess, sys
 import re
 
 __all__ = [
   "addCommonOptions",
   "checkForCrashes",
   "dumpLeakLog",
   "processLeakLog",
   "getDebuggerInfo",
@@ -113,17 +113,23 @@ def checkForCrashes(dumpDir, symbolsPath
     else:
       if not symbolsPath:
         print "No symbols path given, can't process dump."
       if not stackwalkPath:
         print "MINIDUMP_STACKWALK not set, can't process dump."
       else:
         if not os.path.exists(stackwalkPath):
           print "MINIDUMP_STACKWALK binary not found: %s" % stackwalkPath
-    os.remove(d)
+    dumpSavePath = os.environ.get('MINIDUMP_SAVE_PATH', None)
+    if dumpSavePath:
+      shutil.move(d, dumpSavePath)
+      print "Saved dump as %s" % os.path.join(dumpSavePath,
+                                              os.path.basename(d))
+    else:
+      os.remove(d)
     extra = os.path.splitext(d)[0] + ".extra"
     if os.path.exists(extra):
       os.remove(extra)
     foundCrash = True
 
   return foundCrash
   
 def getFullPath(directory, path):