Merge lp:~bladernr/checkbox/1103647-lsmod_info-chokes-on-nvidia into lp:checkbox

Proposed by Jeff Lane 
Status: Merged
Approved by: Zygmunt Krynicki
Approved revision: 2099
Merged at revision: 2099
Proposed branch: lp:~bladernr/checkbox/1103647-lsmod_info-chokes-on-nvidia
Merge into: lp:checkbox
Diff against target: 38 lines (+8/-3)
2 files modified
debian/changelog (+2/-0)
scripts/lsmod_info (+6/-3)
To merge this branch: bzr merge lp:~bladernr/checkbox/1103647-lsmod_info-chokes-on-nvidia
Reviewer Review Type Date Requested Status
Zygmunt Krynicki (community) Approve
Review via email: mp+162266@code.launchpad.net

Description of the change

For some reason, we were trapping OSError instead of CalledProcessError when calling check_output(). This results in a traceback when running lsmod_info on a system with the nVidia proprietary driver installed.

So, to remedy this, we now trap CalledProcessError instead. If this is hit, if the retcode is 1, it's most likely due to a module not returning info:

$ modinfo nvidia
ERROR: Module nvidia not found.

If it's anything else, we raise the error because it's something more insidious that needs to be looked at.

To post a comment you must log in.
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

34 + raise e

Inside a exception capture block you can just use 'raise' to re-raise whatever is being currently captured

review: Approve
Revision history for this message
Daniel Manrique (roadmr) wrote :

The attempt to merge lp:~bladernr/checkbox/1103647-lsmod_info-chokes-on-nvidia into lp:checkbox failed. Below is the output from the failed tests.

[precise] Bringing VM 'up'
[precise] Unable to 'up' VM!
[precise] stdout: http://paste.ubuntu.com/5628458/
[precise] stderr: http://paste.ubuntu.com/5628459/
[precise] NOTE: unable to execute tests, marked as failed
[quantal] Bringing VM 'up'
[quantal] Unable to 'up' VM!
[quantal] stdout: http://paste.ubuntu.com/5628460/
[quantal] stderr: http://paste.ubuntu.com/5628461/
[quantal] NOTE: unable to execute tests, marked as failed
[raring] Bringing VM 'up'
[raring] Unable to 'up' VM!
[raring] stdout: http://paste.ubuntu.com/5628462/
[raring] stderr: http://paste.ubuntu.com/5628463/
[raring] NOTE: unable to execute tests, marked as failed

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

Tarmac ran out of space, we should check why that could have happened later.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2013-05-01 18:21:01 +0000
3+++ debian/changelog 2013-05-02 22:39:29 +0000
4@@ -8,6 +8,8 @@
5 (LP: #970857)
6 * scripts/cpu_topology: define the cpuinfo nested dicts on creation rather
7 than define elements during parsing of /proc/cpuinfo (LP: #1111878)
8+ * scripts/lsmod_info: Corrected error handling for the check_output() call to
9+ trap the correct error. (LP: #1103647)
10
11 [ Sylvain Pineau ]
12 * jobs/suspend.txt.in, scripts/gpu_test: Remove the need of running the script
13
14=== modified file 'scripts/lsmod_info'
15--- scripts/lsmod_info 2012-10-26 19:57:00 +0000
16+++ scripts/lsmod_info 2013-05-02 22:39:29 +0000
17@@ -1,7 +1,7 @@
18 #!/usr/bin/env python3
19 import sys
20 from checkbox.parsers.modinfo import ModinfoParser
21-from subprocess import Popen, PIPE, check_output
22+from subprocess import Popen, PIPE, check_output, CalledProcessError
23
24
25 def main():
26@@ -19,8 +19,11 @@
27 stream = check_output([cmd, module],
28 stderr=PIPE,
29 universal_newlines=False)
30- except OSError:
31- version = 'Unavailable'
32+ except CalledProcessError as e:
33+ if e.returncode != 1:
34+ raise e
35+ else:
36+ version = 'Unavailable'
37
38 stream = stream.decode('utf-8')
39

Subscribers

People subscribed via source and target branches