~andres.mujica/+junk/testing

« back to all changes in this revision

Viewing changes to hibernate-v3.py

  • Committer: andres.mujica at com
  • Date: 2009-09-01 12:57:24 UTC
  • Revision ID: andres.mujica@seaq.com.co-20090901125724-8981qcqsbkdty0kx
version 3.0 of PoC

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
'''Triaging Hibernate issues.
 
2
 
 
3
(c) 2009
 
4
Author:
 
5
Andres Mujica <andres.mujica@seaq.com.co>
 
6
 
 
7
This program is free software; you can redistribute it and/or modify itunder the terms of the GNU General Public License as published by the
 
8
Free Software Foundation; either version 2 of the License, or (at your
 
9
option) any later version.  See http://www.gnu.org/copyleft/gpl.html for
 
10
the full text of the license.
 
11
 
 
12
This apport-hook was made according to:
 
13
https://wiki.ubuntu.com/DebuggingKernelSuspendHibernateResume
 
14
'''
 
15
 
 
16
import apport.ui
 
17
 
 
18
def add_info(report, ui):
 
19
        # validating which type of problem is if problem at all.
 
20
    problem = ui.choice('Which type of hibernate/suspend/resume problem do you have?',
 
21
       ['Suspend (your computer saves everything in RAM consuming less power)',
 
22
        'Hibernate (your computer saves everything in Disk)',
 
23
        'Battery died while suspended',
 
24
        'A repetition of a previous reported hibernate/suspend/resume failure',
 
25
        'Other problem',
 
26
       ])
 
27
 
 
28
    if problem is None:
 
29
       raise StopIteration
 
30
    problem = problem[0]
 
31
    
 
32
    if problem == 0:
 
33
           # tagging as suspend bug
 
34
       ProblemTag = 'suspend'
 
35
           # invoking further questions
 
36
       return problem_debug(report, ui, ProblemTag)
 
37
    if problem == 1:
 
38
           # tagging as hibernate bug
 
39
       ProblemTag = 'hibernate'
 
40
           # invoking further questions
 
41
       return problem_debug(report, ui, ProblemTag)
 
42
    if problem == 2:
 
43
           # if the battery died while suspending, is not a Suspend/Resume bug... so test again fully charged
 
44
       ui.information('Please reproduce your issue with the battery fully charged and report back if still happens')
 
45
       return None
 
46
    if problem == 3:
 
47
           # maybe this is redundant, anyway tagging as likely-dup and asking further questions to the reporter
 
48
       ui.information('If you have reported this issue before, please mark this bug as a duplicate from the first one')
 
49
       ProblemTag = 'likely-dup'
 
50
       return problem_debug(report, ui, ProblemTag)
 
51
    if problem == 4:
 
52
           # a different problem... probably we can add further questions and expand this hook to g-p-m issues
 
53
       ui.information('Please use "ubuntu-bug <packagename>" to report a bug against the particular package')
 
54
       return None
 
55
 
 
56
 
 
57
def problem_debug(report, ui, tag):
 
58
 
 
59
    # we need to now if it was resuming or not.  Normally all bugs are tagged resume also, but this is not necessary true.
 
60
    when = ui.choice('Did the machine break while going to sleep or waking up?',
 
61
         ['While sleeping',
 
62
          'While waking up',
 
63
         ])
 
64
     
 
65
    if when is None:
 
66
       raise StopIteration 
 
67
    when = when[0]
 
68
 
 
69
    if when == 1:
 
70
           # it will be ideal if we can get some input box here and then attach that as a comment.. 
 
71
       ui.information('Please explain in your report how did you verify this')
 
72
       WhenTag = 'resume'
 
73
       
 
74
           # we want to now if it was a one time thing or if it's common behaviour.
 
75
    reproducible = ui.choice('From 10 sleep cycles, how often this ocurr?',
 
76
       ['first time ever',
 
77
        '1 in 5',
 
78
        'almost always',
 
79
       ])
 
80
    
 
81
    if reproducible is None:
 
82
       raise StopIteration
 
83
    reproducible = reproducible[0]
 
84
 
 
85
    if reproducible == 1:
 
86
           # it will be ideal if we can get some input box here and then attach that as a comment.. 
 
87
       ui.information('Please be sure to explain in the report how did you reproduce this behaviour')
 
88
    report['HowReproducible'] = str(reproducible)
 
89
       
 
90
           # we want to now if this is a regression, i'm using tags from update manager, but maybe this give an idea when the regression occurred. 
 
91
    regression = ui.choice('Did it work before?',
 
92
           ['Yes, in Jaunty',
 
93
            'Yes, in Intrepid',
 
94
            'Yes, in Hardy',
 
95
            'No, never',
 
96
           ])
 
97
    
 
98
    if regression is None:
 
99
       raise StopIteration
 
100
    regression = regression[0]
 
101
 
 
102
    if regression == 0:
 
103
       RegressionTag = 'regression-potential jaunty2karmic'
 
104
    if regression == 1:
 
105
       RegressionTag = 'regression-potential intrepid2jaunty'
 
106
    if regression == 2:
 
107
       RegressionTag = 'regression-potential hardy2intrepid'
 
108
 
 
109
        # is this a kernel panic error?
 
110
    panic = ui.yesno('Do you end up with flashing caps-lock or similar?')
 
111
    
 
112
    if panic is None:
 
113
       raise StopIteration
 
114
    report['KernelPanic'] = str(panic)
 
115
    FinalTags = 'apport-symptom' + " " + tag + " " + WhenTag + " " + RegressionTag
 
116
    report['Tags'] = FinalTags
 
117
    
 
118
    return 'linux-image-generic'