Bug 1299216 - [mozcrash] Count crash reports in check_for_crashes and bump version to 1.0. draft
authorHenrik Skupin <mail@hskupin.info>
Wed, 28 Sep 2016 23:26:19 +0200
changeset 435298 ed40141d081a6fe0bc5a11d33003d0f96d1a590d
parent 435182 f13e90d496cf1bc6dfc4fd398da33e4afe785bde
child 435299 af8f3672941d49baf57b60e44aa9de2883cb2ee7
push id34992
push userbmo:hskupin@gmail.com
push dateTue, 08 Nov 2016 11:06:47 +0000
bugs1299216
milestone52.0a1
Bug 1299216 - [mozcrash] Count crash reports in check_for_crashes and bump version to 1.0. Currently check_for_crashes() behaves differently compared to log_crashes(), whereby it only returns a boolean if a crash has been detected but not the amount of crash reports found. We should make sure that both methods behave the same. Given that this change might affect consumers, we should have a major version bump for the new release. MozReview-Commit-ID: LiPaozJL5NF
testing/mozbase/mozcrash/mozcrash/mozcrash.py
testing/mozbase/mozcrash/setup.py
--- a/testing/mozbase/mozcrash/mozcrash/mozcrash.py
+++ b/testing/mozbase/mozcrash/mozcrash/mozcrash.py
@@ -70,50 +70,52 @@ def check_for_crashes(dump_directory,
     variable MINIDUMP_SAVE_PATH will be checked and its value used if it is not empty.
 
     If `test_name` is set it will be used as the test name in log output. If not set the
     filename of the calling function will be used.
 
     If `quiet` is set, no PROCESS-CRASH message will be printed to stdout if a
     crash is detected.
 
-    Returns True if any minidumps were found, False otherwise.
+    Returns number of minidump files found.
     """
 
     # try to get the caller's filename if no test name is given
     if test_name is None:
         try:
             test_name = os.path.basename(sys._getframe(1).f_code.co_filename)
         except:
             test_name = "unknown"
 
     crash_info = CrashInfo(dump_directory, symbols_path, dump_save_path=dump_save_path,
                            stackwalk_binary=stackwalk_binary)
 
     if not crash_info.has_dumps:
         return False
 
+    crash_count = 0
     for info in crash_info:
+        crash_count += 1
         if not quiet:
             stackwalk_output = ["Crash dump filename: %s" % info.minidump_path]
             if info.stackwalk_stderr:
                 stackwalk_output.append("stderr from minidump_stackwalk:")
                 stackwalk_output.append(info.stackwalk_stderr)
             elif info.stackwalk_stdout is not None:
                 stackwalk_output.append(info.stackwalk_stdout)
             if info.stackwalk_retcode is not None and info.stackwalk_retcode != 0:
                 stackwalk_output.append("minidump_stackwalk exited with return code %d" %
                                         info.stackwalk_retcode)
             signature = info.signature if info.signature else "unknown top frame"
             print "PROCESS-CRASH | %s | application crashed [%s]" % (test_name,
                                                                      signature)
             print '\n'.join(stackwalk_output)
             print '\n'.join(info.stackwalk_errors)
 
-    return True
+    return crash_count
 
 
 def log_crashes(logger,
                 dump_directory,
                 symbols_path,
                 process=None,
                 test=None,
                 stackwalk_binary=None,
--- a/testing/mozbase/mozcrash/setup.py
+++ b/testing/mozbase/mozcrash/setup.py
@@ -1,16 +1,16 @@
 # 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/.
 
 from setuptools import setup
 
 PACKAGE_NAME = 'mozcrash'
-PACKAGE_VERSION = '0.17'
+PACKAGE_VERSION = '1.0'
 
 # dependencies
 deps = ['mozfile >= 1.0',
         'mozlog >= 3.0']
 
 setup(name=PACKAGE_NAME,
       version=PACKAGE_VERSION,
       description="Library for printing stack traces from minidumps "