Bug 1299216 - [mozcrash] Count crash reports in check_for_crashes and bump version to 1.0. r=ahal
authorHenrik Skupin <mail@hskupin.info>
Wed, 28 Sep 2016 23:26:19 +0200
changeset 351597 d58be05673a2f2ef4e1db32193611d37f1da470c
parent 351596 9af814b282fa915ee95329443ee42cc46943a863
child 351598 6ec047c4e48e94fefb428779427591b22a01bb36
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersahal
bugs1299216
milestone52.0a1
Bug 1299216 - [mozcrash] Count crash reports in check_for_crashes and bump version to 1.0. r=ahal 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 "