Merge lp:~brendan-donegan/checkbox/bug887049_usb_test into lp:checkbox

Proposed by Brendan Donegan
Status: Merged
Merged at revision: 1119
Proposed branch: lp:~brendan-donegan/checkbox/bug887049_usb_test
Merge into: lp:checkbox
Diff against target: 30 lines (+7/-3)
2 files modified
debian/changelog (+2/-0)
scripts/usb_test (+5/-3)
To merge this branch: bzr merge lp:~brendan-donegan/checkbox/bug887049_usb_test
Reviewer Review Type Date Requested Status
Daniel Manrique (community) Approve
Review via email: mp+81855@code.launchpad.net

Description of the change

Previously the usb_test script wasn't checking that the device in question actually had a path in the filesystem. This was causing an exception when the script was trying to read the non-existent path. This merge adds a guard around the statements which depend on the path existing.

To post a comment you must log in.
Revision history for this message
Daniel Manrique (roadmr) wrote :

I tested on a USB drive containing multiple partitions (3 primary and one extended containing 2 logical partitions) and it handles them correctly. A problem remains when there are no write permissions but that's outside the scope of the linked bug, so I'm merging this as it works as intended. Thanks!

review: Approve

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 2011-11-10 09:21:34 +0000
3+++ debian/changelog 2011-11-10 14:02:06 +0000
4@@ -35,6 +35,8 @@
5 * Have the bluetooth/detect tests require a device with the category
6 BLUETOOTH to run, thus preventing the test from failing on systems with
7 no Bluetooth device (LP: #862322)
8+ * Guard against trying to write files to logical partitions on USB sticks
9+ (which will obviously fail) in usb_test (LP: #887049)
10
11 [ Javier Collado ]
12 * Broken job dependencies fixed (LP: #888447)
13
14=== modified file 'scripts/usb_test'
15--- scripts/usb_test 2011-09-20 10:43:56 +0000
16+++ scripts/usb_test 2011-11-10 14:02:06 +0000
17@@ -68,9 +68,11 @@
18 if not device_props.Get('org.freedesktop.UDisks.Device',"DeviceIsDrive"):
19 if device_props.Get('org.freedesktop.UDisks.Device', "DriveConnectionInterface") == 'usb':
20 devFile = str(device_props.Get('org.freedesktop.UDisks.Device',"DeviceFile"))
21- print str(device_props.Get('org.freedesktop.UDisks.Device',"DeviceMountPaths"))
22- devPath = str(device_props.Get('org.freedesktop.UDisks.Device',"DeviceMountPaths")[0])
23- disks[devFile] = devPath
24+
25+ if len(device_props.Get('org.freedesktop.UDisks.Device',"DeviceMountPaths")) > 0:
26+ print str(device_props.Get('org.freedesktop.UDisks.Device',"DeviceMountPaths"))
27+ devPath = str(device_props.Get('org.freedesktop.UDisks.Device',"DeviceMountPaths")[0])
28+ disks[devFile] = devPath
29
30 return disks
31

Subscribers

People subscribed via source and target branches