← Back to team overview

apport-hackers team mailing list archive

[Merge] lp:~ev/apport/group-suspend-resume-failures into lp:apport

 

Evan Dandrea has proposed merging lp:~ev/apport/group-suspend-resume-failures into lp:apport.

Requested reviews:
  Andy Whitcroft (apw): signature format
  Apport upstream developers (apport-hackers)

For more details, see:
https://code.launchpad.net/~ev/apport/group-suspend-resume-failures/+merge/160854

This branch adds report.crash_signature() support for suspend/resume KernelOops reports. The signature is of the form:

suspend/resume:MachineType:BiosVersion

This was suggested by Andy Whitcroft and Colin King.
-- 
https://code.launchpad.net/~ev/apport/group-suspend-resume-failures/+merge/160854
Your team Apport upstream developers is requested to review the proposed merge of lp:~ev/apport/group-suspend-resume-failures into lp:apport.
=== modified file 'apport/report.py'
--- apport/report.py	2013-04-03 09:05:41 +0000
+++ apport/report.py	2013-04-25 10:41:26 +0000
@@ -1209,6 +1209,10 @@
 
         For Python crashes, this concatenates the ExecutablePath, exception
         name, and Traceback function names, again separated by a colon.
+
+        For suspend/resume failures, this concatenates whether it was a suspend
+        or resume failure with the hardware identifier and the BIOS version, if
+        it exists.
         '''
         if 'ExecutablePath' not in self:
             if not self['ProblemType'] in ('KernelCrash', 'KernelOops'):
@@ -1277,6 +1281,15 @@
 
             return self['ExecutablePath'] + ':' + trace[-1].split(':')[0] + sig
 
+        if self['ProblemType'] == 'KernelOops' and 'Failure' in self:
+            # Suspend / resume failure
+            sig = self['Failure']
+            if self.get('MachineType'):
+                sig += ':%s' % self['MachineType']
+            if self.get('dmi.bios.version'):
+                sig += ':%s' % self['dmi.bios.version']
+            return sig
+
         # KernelOops crashes
         if 'OopsText' in self:
             in_trace_body = False

=== modified file 'test/test_report.py'
--- test/test_report.py	2013-04-25 10:38:30 +0000
+++ test/test_report.py	2013-04-25 10:41:26 +0000
@@ -2128,5 +2128,14 @@
         finally:
             os.getuid = orig_getuid
 
+    def test_suspend_resume(self):
+        pr = apport.report.Report()
+        pr['ProblemType'] = 'KernelOops'
+        pr['Failure'] = 'suspend/resume'
+        pr['MachineType'] = 'Cray XT5'
+        pr['dmi.bios.version'] = 'ABC123 (1.0)'
+        expected = 'suspend/resume:Cray XT5:ABC123 (1.0)'
+        self.assertEqual(expected, pr.crash_signature())
+
 if __name__ == '__main__':
     unittest.main()