Bug 606389 - when minidump_stack fails, show its error messages and/or exit code. r=ted, a=npotb
authorJesse Ruderman <jruderman@gmail.com>
Sat, 06 Nov 2010 13:30:32 -0700
changeset 57034 415bf458e0df196ce11c9865fd0afde9b7d6d303
parent 57033 d29ac45571d929471abb100f028dab3a04c61bd7
child 57035 9500a7491002d2819cbfb20e394815c756c8081c
push idunknown
push userunknown
push dateunknown
reviewersted, npotb
bugs606389
milestone2.0b8pre
Bug 606389 - when minidump_stack fails, show its error messages and/or exit code. r=ted, a=npotb
build/automationutils.py
--- a/build/automationutils.py
+++ b/build/automationutils.py
@@ -110,33 +110,45 @@ def checkForCrashes(dumpDir, symbolsPath
     except:
       testName = "unknown"
 
   foundCrash = False
   dumps = glob.glob(os.path.join(dumpDir, '*.dmp'))
   for d in dumps:
     log.info("PROCESS-CRASH | %s | application crashed (minidump found)", testName)
     if symbolsPath and stackwalkPath and os.path.exists(stackwalkPath):
-      nullfd = open(os.devnull, 'w')
-      # eat minidump_stackwalk errors
-      subprocess.call([stackwalkPath, d, symbolsPath], stderr=nullfd)
-      nullfd.close()
+      p = subprocess.Popen([stackwalkPath, d, symbolsPath],
+                           stdout=subprocess.PIPE,
+                           stderr=subprocess.PIPE)
+      (out, err) = p.communicate()
+      if len(out) > 3:
+        # minidump_stackwalk is chatty, so ignore stderr when it succeeds.
+        print out
+      else:
+        print "stderr from minidump_stackwalk:"
+        print err
+      if p.returncode != 0:
+        print "minidump_stackwalk exited with return code %d" % p.returncode
     elif stackwalkCGI and symbolsPath and isURL(symbolsPath):
       f = None
       try:
         f = open(d, "rb")
         sys.path.append(os.path.join(os.path.dirname(__file__), "poster.zip"))
         from poster.encode import multipart_encode
         from poster.streaminghttp import register_openers
         import urllib2
         register_openers()
         datagen, headers = multipart_encode({"minidump": f,
                                              "symbols": symbolsPath})
         request = urllib2.Request(stackwalkCGI, datagen, headers)
-        print urllib2.urlopen(request).read()
+        result = urllib2.urlopen(request).read()
+        if len(result) > 3:
+          print result
+        else:
+          print "stackwalkCGI returned nothing."
       finally:
         if f:
           f.close()
     else:
       if not symbolsPath:
         print "No symbols path given, can't process dump."
       if not stackwalkPath and not stackwalkCGI:
         print "Neither MINIDUMP_STACKWALK nor MINIDUMP_STACKWALK_CGI is set, can't process dump."