Merge lp:~zyga/checkbox/fix-1313581 into lp:checkbox
- fix-1313581
- Merge into trunk
Proposed by
Zygmunt Krynicki
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Zygmunt Krynicki | ||||
Approved revision: | 2972 | ||||
Merged at revision: | 2971 | ||||
Proposed branch: | lp:~zyga/checkbox/fix-1313581 | ||||
Merge into: | lp:checkbox | ||||
Diff against target: |
232 lines (+77/-28) 4 files modified
checkbox-support/checkbox_support/udev.py (+17/-0) providers/plainbox-provider-checkbox/bin/removable_storage_test (+54/-20) providers/plainbox-provider-checkbox/jobs/suspend.txt.in (+3/-4) providers/plainbox-provider-checkbox/jobs/usb.txt.in (+3/-4) |
||||
To merge this branch: | bzr merge lp:~zyga/checkbox/fix-1313581 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Zygmunt Krynicki (community) | Approve | ||
Review via email: mp+218028@code.launchpad.net |
Commit message
Description of the change
Squashed version of https:/
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'checkbox-support/checkbox_support/udev.py' | |||
2 | --- checkbox-support/checkbox_support/udev.py 2014-01-07 13:39:44 +0000 | |||
3 | +++ checkbox-support/checkbox_support/udev.py 2014-05-02 09:27:37 +0000 | |||
4 | @@ -91,3 +91,20 @@ | |||
5 | 91 | # look better. | 91 | # look better. |
6 | 92 | devices.sort(key=lambda device: device.get_device_file()) | 92 | devices.sort(key=lambda device: device.get_device_file()) |
7 | 93 | return devices | 93 | return devices |
8 | 94 | |||
9 | 95 | |||
10 | 96 | def get_udev_xhci_devices(udev_client): | ||
11 | 97 | """ | ||
12 | 98 | Get a list of all devices on pci slots using xhci drivers | ||
13 | 99 | """ | ||
14 | 100 | # setup an enumerator so that we can list devices | ||
15 | 101 | enumerator = GUdev.Enumerator(client=udev_client) | ||
16 | 102 | # Iterate over pci devices only | ||
17 | 103 | enumerator.add_match_subsystem('pci') | ||
18 | 104 | devices = [ | ||
19 | 105 | device for device in enumerator.execute() | ||
20 | 106 | if (device.get_driver() == 'xhci_hcd')] | ||
21 | 107 | # Sort the list, this is not needed but makes various debugging dumps | ||
22 | 108 | # look better. | ||
23 | 109 | devices.sort(key=lambda device: device.get_property('PCI_SLOT_NAME')) | ||
24 | 110 | return devices | ||
25 | 94 | 111 | ||
26 | === modified file 'providers/plainbox-provider-checkbox/bin/removable_storage_test' | |||
27 | --- providers/plainbox-provider-checkbox/bin/removable_storage_test 2014-01-07 13:43:22 +0000 | |||
28 | +++ providers/plainbox-provider-checkbox/bin/removable_storage_test 2014-05-02 09:27:37 +0000 | |||
29 | @@ -22,9 +22,12 @@ | |||
30 | 22 | from checkbox_support.dbus.udisks2 import lookup_udev_device | 22 | from checkbox_support.dbus.udisks2 import lookup_udev_device |
31 | 23 | from checkbox_support.dbus.udisks2 import map_udisks1_connection_bus | 23 | from checkbox_support.dbus.udisks2 import map_udisks1_connection_bus |
32 | 24 | from checkbox_support.heuristics.udisks2 import is_memory_card | 24 | from checkbox_support.heuristics.udisks2 import is_memory_card |
34 | 25 | from checkbox_support.parsers.udevadm import CARD_READER_RE, GENERIC_RE, FLASH_RE | 25 | from checkbox_support.parsers.udevadm import CARD_READER_RE |
35 | 26 | from checkbox_support.parsers.udevadm import GENERIC_RE | ||
36 | 27 | from checkbox_support.parsers.udevadm import FLASH_RE | ||
37 | 26 | from checkbox_support.udev import get_interconnect_speed | 28 | from checkbox_support.udev import get_interconnect_speed |
38 | 27 | from checkbox_support.udev import get_udev_block_devices | 29 | from checkbox_support.udev import get_udev_block_devices |
39 | 30 | from checkbox_support.udev import get_udev_xhci_devices | ||
40 | 28 | 31 | ||
41 | 29 | 32 | ||
42 | 30 | class ActionTimer(): | 33 | class ActionTimer(): |
43 | @@ -99,6 +102,8 @@ | |||
44 | 99 | self.rem_disks_memory_cards = {} | 102 | self.rem_disks_memory_cards = {} |
45 | 100 | self.rem_disks_memory_cards_nm = {} | 103 | self.rem_disks_memory_cards_nm = {} |
46 | 101 | self.rem_disks_speed = {} | 104 | self.rem_disks_speed = {} |
47 | 105 | # LP: #1313581, TODO: extend to be rem_disks_driver | ||
48 | 106 | self.rem_disks_xhci = {} | ||
49 | 102 | self.data = '' | 107 | self.data = '' |
50 | 103 | self.device = device | 108 | self.device = device |
51 | 104 | self.memorycard = memorycard | 109 | self.memorycard = memorycard |
52 | @@ -174,8 +179,8 @@ | |||
53 | 174 | have both the filesystem and block device interfaces | 179 | have both the filesystem and block device interfaces |
54 | 175 | """ | 180 | """ |
55 | 176 | for udisks2_object_path, interfaces in udisks2_objects.items(): | 181 | for udisks2_object_path, interfaces in udisks2_objects.items(): |
58 | 177 | if (UDISKS2_FILESYSTEM_INTERFACE in interfaces | 182 | if (UDISKS2_FILESYSTEM_INTERFACE in interfaces and |
59 | 178 | and UDISKS2_BLOCK_INTERFACE in interfaces): | 183 | UDISKS2_BLOCK_INTERFACE in interfaces): |
60 | 179 | yield udisks2_object_path | 184 | yield udisks2_object_path |
61 | 180 | # We need to know about all IO candidates, | 185 | # We need to know about all IO candidates, |
62 | 181 | # let's iterate over all the block devices reported by udisks2 | 186 | # let's iterate over all the block devices reported by udisks2 |
63 | @@ -247,6 +252,23 @@ | |||
64 | 247 | else: | 252 | else: |
65 | 248 | self.rem_disks_memory_cards_nm[dev_file] = None | 253 | self.rem_disks_memory_cards_nm[dev_file] = None |
66 | 249 | self.rem_disks_nm[dev_file] = None | 254 | self.rem_disks_nm[dev_file] = None |
67 | 255 | # LP: #1313581 | ||
68 | 256 | # Compare the pci slot name of the devices using xhci and | ||
69 | 257 | # the pci slot name of the disks, | ||
70 | 258 | # which is usb3 disks in this case so far, | ||
71 | 259 | # to make sure the usb3 disk does be on the bus using xhci | ||
72 | 260 | # TODO: it will be better to extend to be all kinds of drivers. | ||
73 | 261 | try: | ||
74 | 262 | udev_devices_xhci = get_udev_xhci_devices(udev_client) | ||
75 | 263 | for udev_device_xhci in udev_devices_xhci: | ||
76 | 264 | pci_slot_name = udev_device_xhci.get_property('PCI_SLOT_NAME') | ||
77 | 265 | for udev_device in udev_devices: | ||
78 | 266 | if (pci_slot_name == | ||
79 | 267 | udev_device.get_property('DEVPATH').split('/')[3]): | ||
80 | 268 | self.rem_disks_xhci[ | ||
81 | 269 | udev_device.get_property('DEVNAME')] = 'xhci' | ||
82 | 270 | except: | ||
83 | 271 | logging.error("Failed to get driver information.") | ||
84 | 250 | 272 | ||
85 | 251 | def _probe_disks_udisks1(self, bus): | 273 | def _probe_disks_udisks1(self, bus): |
86 | 252 | """ | 274 | """ |
87 | @@ -275,14 +297,14 @@ | |||
88 | 275 | parent_media = parent_props.Get(udisks, "DriveMedia") | 297 | parent_media = parent_props.Get(udisks, "DriveMedia") |
89 | 276 | if self.memorycard: | 298 | if self.memorycard: |
90 | 277 | if (dev_bus != 'sdio' | 299 | if (dev_bus != 'sdio' |
94 | 278 | and not FLASH_RE.search(parent_media) | 300 | and not FLASH_RE.search(parent_media) |
95 | 279 | and not CARD_READER_RE.search(parent_model) | 301 | and not CARD_READER_RE.search(parent_model) |
96 | 280 | and not GENERIC_RE.search(parent_vendor)): | 302 | and not GENERIC_RE.search(parent_vendor)): |
97 | 281 | continue | 303 | continue |
98 | 282 | else: | 304 | else: |
99 | 283 | if (FLASH_RE.search(parent_media) | 305 | if (FLASH_RE.search(parent_media) |
102 | 284 | or CARD_READER_RE.search(parent_model) | 306 | or CARD_READER_RE.search(parent_model) |
103 | 285 | or GENERIC_RE.search(parent_vendor)): | 307 | or GENERIC_RE.search(parent_vendor)): |
104 | 286 | continue | 308 | continue |
105 | 287 | dev_file = str(device_props.Get(udisks, "DeviceFile")) | 309 | dev_file = str(device_props.Get(udisks, "DeviceFile")) |
106 | 288 | dev_speed = str(device_props.Get(udisks, | 310 | dev_speed = str(device_props.Get(udisks, |
107 | @@ -393,6 +415,10 @@ | |||
108 | 393 | help=("Memory cards devices on bus other than sdio " | 415 | help=("Memory cards devices on bus other than sdio " |
109 | 394 | "require this parameter to identify " | 416 | "require this parameter to identify " |
110 | 395 | "them as such")) | 417 | "them as such")) |
111 | 418 | parser.add_argument('--driver', | ||
112 | 419 | choices=['xhci_hcd'], | ||
113 | 420 | help=("Detect the driver of the host controller." | ||
114 | 421 | "Only xhci_hcd for usb3 is supported so far.")) | ||
115 | 396 | 422 | ||
116 | 397 | args = parser.parse_args() | 423 | args = parser.parse_args() |
117 | 398 | 424 | ||
118 | @@ -444,7 +470,7 @@ | |||
119 | 444 | 470 | ||
120 | 445 | if errors_mount > 0: | 471 | if errors_mount > 0: |
121 | 446 | print("There're total %d device(s) failed at mounting." | 472 | print("There're total %d device(s) failed at mounting." |
123 | 447 | % errors_mount) | 473 | % errors_mount) |
124 | 448 | errors += errors_mount | 474 | errors += errors_mount |
125 | 449 | 475 | ||
126 | 450 | disks_all = dict(list(test.rem_disks.items()) | 476 | disks_all = dict(list(test.rem_disks.items()) |
127 | @@ -452,17 +478,17 @@ | |||
128 | 452 | 478 | ||
129 | 453 | if len(disks_all) > 0: | 479 | if len(disks_all) > 0: |
130 | 454 | print("Found the following mounted %s partitions:" | 480 | print("Found the following mounted %s partitions:" |
132 | 455 | % ', '.join(args.device)) | 481 | % ', '.join(args.device)) |
133 | 456 | 482 | ||
134 | 457 | for disk, mount_point in disks_all.items(): | 483 | for disk, mount_point in disks_all.items(): |
135 | 458 | supported_speed = test.rem_disks_speed[disk] | 484 | supported_speed = test.rem_disks_speed[disk] |
136 | 459 | print(" %s : %s : %s bits/s" % | 485 | print(" %s : %s : %s bits/s" % |
141 | 460 | (disk, mount_point, supported_speed), | 486 | (disk, mount_point, supported_speed), |
142 | 461 | end="") | 487 | end="") |
143 | 462 | if (args.min_speed | 488 | if (args.min_speed and |
144 | 463 | and int(args.min_speed) > int(supported_speed)): | 489 | int(args.min_speed) > int(supported_speed)): |
145 | 464 | print(" (Will not test it, speed is below %s bits/s)" % | 490 | print(" (Will not test it, speed is below %s bits/s)" % |
147 | 465 | args.min_speed, end="") | 491 | args.min_speed, end="") |
148 | 466 | 492 | ||
149 | 467 | print("") | 493 | print("") |
150 | 468 | 494 | ||
151 | @@ -478,7 +504,7 @@ | |||
152 | 478 | for count in range(args.count): | 504 | for count in range(args.count): |
153 | 479 | test_files[count] = RandomData(args.size) | 505 | test_files[count] = RandomData(args.size) |
154 | 480 | write_sizes.append(os.path.getsize( | 506 | write_sizes.append(os.path.getsize( |
156 | 481 | test_files[count].tfile.name)) | 507 | test_files[count].tfile.name)) |
157 | 482 | total_write_size = sum(write_sizes) | 508 | total_write_size = sum(write_sizes) |
158 | 483 | 509 | ||
159 | 484 | try: | 510 | try: |
160 | @@ -525,7 +551,7 @@ | |||
161 | 525 | for file in target_file_list: | 551 | for file in target_file_list: |
162 | 526 | test.clean_up(file) | 552 | test.clean_up(file) |
163 | 527 | total_write_time = sum(write_times) | 553 | total_write_time = sum(write_times) |
165 | 528 | avg_write_time = total_write_time / args.count | 554 | # avg_write_time = total_write_time / args.count |
166 | 529 | try: | 555 | try: |
167 | 530 | avg_write_speed = (( | 556 | avg_write_speed = (( |
168 | 531 | total_write_size / total_write_time) | 557 | total_write_size / total_write_time) |
169 | @@ -547,7 +573,7 @@ | |||
170 | 547 | (iteration_write_time / args.iterations)) | 573 | (iteration_write_time / args.iterations)) |
171 | 548 | try: | 574 | try: |
172 | 549 | avg_write_speed = (iteration_write_size / | 575 | avg_write_speed = (iteration_write_size / |
174 | 550 | iteration_write_time) | 576 | iteration_write_time) |
175 | 551 | except ZeroDivisionError: | 577 | except ZeroDivisionError: |
176 | 552 | avg_write_speed = 0.00 | 578 | avg_write_speed = 0.00 |
177 | 553 | finally: | 579 | finally: |
178 | @@ -573,9 +599,17 @@ | |||
179 | 573 | return 1 | 599 | return 1 |
180 | 574 | 600 | ||
181 | 575 | else: | 601 | else: |
183 | 576 | #Pass is not assured! | 602 | # LP: 1313581 |
184 | 603 | if (args.driver == 'xhci_hcd'): | ||
185 | 604 | if(5000000000 == test.rem_disks_speed[disk] and | ||
186 | 605 | 'xhci' == test.rem_disks_xhci[disk]): | ||
187 | 606 | print("\t\tDevice Detected: SuperSpeed USB") | ||
188 | 607 | print("\t\tDriver Detected: xhci_hcd") | ||
189 | 608 | else: | ||
190 | 609 | return 1 | ||
191 | 610 | # Pass is not assured | ||
192 | 577 | if (not args.pass_speed or | 611 | if (not args.pass_speed or |
194 | 578 | avg_write_speed >= args.pass_speed): | 612 | avg_write_speed >= args.pass_speed): |
195 | 579 | return 0 | 613 | return 0 |
196 | 580 | else: | 614 | else: |
197 | 581 | print("FAIL: Average speed was lower than desired " | 615 | print("FAIL: Average speed was lower than desired " |
198 | 582 | 616 | ||
199 | === modified file 'providers/plainbox-provider-checkbox/jobs/suspend.txt.in' | |||
200 | --- providers/plainbox-provider-checkbox/jobs/suspend.txt.in 2014-04-29 21:10:14 +0000 | |||
201 | +++ providers/plainbox-provider-checkbox/jobs/suspend.txt.in 2014-05-02 09:27:37 +0000 | |||
202 | @@ -1667,11 +1667,10 @@ | |||
203 | 1667 | depends: suspend/usb3_insert_after_suspend | 1667 | depends: suspend/usb3_insert_after_suspend |
204 | 1668 | user: root | 1668 | user: root |
205 | 1669 | estimated_duration: 45.00 | 1669 | estimated_duration: 45.00 |
207 | 1670 | command: removable_storage_test -s 268400000 -m 500000000 -p 60 usb | 1670 | command: removable_storage_test -s 268400000 -m 500000000 usb --driver xhci_hcd |
208 | 1671 | _description: | 1671 | _description: |
212 | 1672 | This test will check that your USB 3.0 port transfers data at a | 1672 | This test will check that your USB 3.0 port could be recognized |
213 | 1673 | minimum expected speed in accordance with the specification of | 1673 | as SuperSpeed USB device using xhci_hcd driver and transfers data correctly. |
211 | 1674 | USB 3.0 SuperSpeed mode. | ||
214 | 1675 | 1674 | ||
215 | 1676 | plugin: user-interact | 1675 | plugin: user-interact |
216 | 1677 | id: suspend/mmc-insert-after-suspend | 1676 | id: suspend/mmc-insert-after-suspend |
217 | 1678 | 1677 | ||
218 | === modified file 'providers/plainbox-provider-checkbox/jobs/usb.txt.in' | |||
219 | --- providers/plainbox-provider-checkbox/jobs/usb.txt.in 2014-04-10 21:51:48 +0000 | |||
220 | +++ providers/plainbox-provider-checkbox/jobs/usb.txt.in 2014-05-02 09:27:37 +0000 | |||
221 | @@ -217,8 +217,7 @@ | |||
222 | 217 | depends: usb3/insert | 217 | depends: usb3/insert |
223 | 218 | user: root | 218 | user: root |
224 | 219 | estimated_duration: 45.00 | 219 | estimated_duration: 45.00 |
226 | 220 | command: removable_storage_test -s 268400000 -m 500000000 -p 60 usb | 220 | command: removable_storage_test -s 268400000 -m 500000000 usb --driver xhci_hcd |
227 | 221 | _description: | 221 | _description: |
231 | 222 | This test will check that your USB 3.0 port transfers data at a | 222 | This test will check that your USB 3.0 port could be recognized |
232 | 223 | minimum expected speed in accordance with the specification of | 223 | as SuperSpeed USB device using xhci_hcd driver and transfers data correctly. |
230 | 224 | USB 3.0 SuperSpeed mode. |
+1