Merge lp:~ev/apport/group-suspend-resume-failures into lp:~apport-hackers/apport/trunk

Proposed by Evan
Status: Merged
Merged at revision: 2627
Proposed branch: lp:~ev/apport/group-suspend-resume-failures
Merge into: lp:~apport-hackers/apport/trunk
Diff against target: 55 lines (+28/-0)
2 files modified
apport/report.py (+14/-0)
test/test_report.py (+14/-0)
To merge this branch: bzr merge lp:~ev/apport/group-suspend-resume-failures
Reviewer Review Type Date Requested Status
Martin Pitt (community) Approve
Andy Whitcroft signature format Pending
Review via email: mp+160854@code.launchpad.net

Description of the change

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.

To post a comment you must log in.
Revision history for this message
Martin Pitt (pitti) wrote :

The code does not actually check whether this is a suspend/resume failure, it computes that signature for any kind of KernelOops. Presumably this is how it is supposed to work, so could you please adjust the doc string and test case name, as well as the comment (line 20) accordingly? Otherwise, if this really should just happen for suspend/resume, then report.py needs to check the value of 'Failure'.

Thank you!

review: Needs Fixing
2626. By Evan

Add a test for a signature without a BIOS version

2627. By Evan

Check that this in indeed a suspend/resume failure.

Revision history for this message
Evan (ev) wrote :

I believe r2627 fixes this.

Revision history for this message
Martin Pitt (pitti) wrote :

Thanks, LGTM now! Please commit with an appropriate NEWS entry.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'apport/report.py'
2--- apport/report.py 2013-04-03 09:05:41 +0000
3+++ apport/report.py 2013-04-25 10:55:40 +0000
4@@ -1209,6 +1209,10 @@
5
6 For Python crashes, this concatenates the ExecutablePath, exception
7 name, and Traceback function names, again separated by a colon.
8+
9+ For suspend/resume failures, this concatenates whether it was a suspend
10+ or resume failure with the hardware identifier and the BIOS version, if
11+ it exists.
12 '''
13 if 'ExecutablePath' not in self:
14 if not self['ProblemType'] in ('KernelCrash', 'KernelOops'):
15@@ -1277,6 +1281,16 @@
16
17 return self['ExecutablePath'] + ':' + trace[-1].split(':')[0] + sig
18
19+ if self['ProblemType'] == 'KernelOops' and 'Failure' in self:
20+ if 'suspend' in self['Failure'] or 'resume' in self['Failure']:
21+ # Suspend / resume failure
22+ sig = self['Failure']
23+ if self.get('MachineType'):
24+ sig += ':%s' % self['MachineType']
25+ if self.get('dmi.bios.version'):
26+ sig += ':%s' % self['dmi.bios.version']
27+ return sig
28+
29 # KernelOops crashes
30 if 'OopsText' in self:
31 in_trace_body = False
32
33=== modified file 'test/test_report.py'
34--- test/test_report.py 2013-04-25 10:38:30 +0000
35+++ test/test_report.py 2013-04-25 10:55:40 +0000
36@@ -2128,5 +2128,19 @@
37 finally:
38 os.getuid = orig_getuid
39
40+ def test_suspend_resume(self):
41+ pr = apport.report.Report()
42+ pr['ProblemType'] = 'KernelOops'
43+ pr['Failure'] = 'suspend/resume'
44+ pr['MachineType'] = 'Cray XT5'
45+ pr['dmi.bios.version'] = 'ABC123 (1.0)'
46+ expected = 'suspend/resume:Cray XT5:ABC123 (1.0)'
47+ self.assertEqual(expected, pr.crash_signature())
48+
49+ # There will not always be a BIOS version
50+ del pr['dmi.bios.version']
51+ expected = 'suspend/resume:Cray XT5'
52+ self.assertEqual(expected, pr.crash_signature())
53+
54 if __name__ == '__main__':
55 unittest.main()

Subscribers

People subscribed via source and target branches