Merge lp:~zyga/checkbox/fix-1313581 into lp:checkbox

Proposed by Zygmunt Krynicki on 2014-05-02
Status: Merged
Approved by: Zygmunt Krynicki on 2014-05-02
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
Reviewer Review Type Date Requested Status
Zygmunt Krynicki (community) Approve on 2014-05-02
Review via email: mp+218028@code.launchpad.net

Description of the change

To post a comment you must log in.
Zygmunt Krynicki (zyga) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'checkbox-support/checkbox_support/udev.py'
--- checkbox-support/checkbox_support/udev.py 2014-01-07 13:39:44 +0000
+++ checkbox-support/checkbox_support/udev.py 2014-05-02 09:27:37 +0000
@@ -91,3 +91,20 @@
91 # look better.91 # look better.
92 devices.sort(key=lambda device: device.get_device_file())92 devices.sort(key=lambda device: device.get_device_file())
93 return devices93 return devices
94
95
96def get_udev_xhci_devices(udev_client):
97 """
98 Get a list of all devices on pci slots using xhci drivers
99 """
100 # setup an enumerator so that we can list devices
101 enumerator = GUdev.Enumerator(client=udev_client)
102 # Iterate over pci devices only
103 enumerator.add_match_subsystem('pci')
104 devices = [
105 device for device in enumerator.execute()
106 if (device.get_driver() == 'xhci_hcd')]
107 # Sort the list, this is not needed but makes various debugging dumps
108 # look better.
109 devices.sort(key=lambda device: device.get_property('PCI_SLOT_NAME'))
110 return devices
94111
=== modified file 'providers/plainbox-provider-checkbox/bin/removable_storage_test'
--- providers/plainbox-provider-checkbox/bin/removable_storage_test 2014-01-07 13:43:22 +0000
+++ providers/plainbox-provider-checkbox/bin/removable_storage_test 2014-05-02 09:27:37 +0000
@@ -22,9 +22,12 @@
22from checkbox_support.dbus.udisks2 import lookup_udev_device22from checkbox_support.dbus.udisks2 import lookup_udev_device
23from checkbox_support.dbus.udisks2 import map_udisks1_connection_bus23from checkbox_support.dbus.udisks2 import map_udisks1_connection_bus
24from checkbox_support.heuristics.udisks2 import is_memory_card24from checkbox_support.heuristics.udisks2 import is_memory_card
25from checkbox_support.parsers.udevadm import CARD_READER_RE, GENERIC_RE, FLASH_RE25from checkbox_support.parsers.udevadm import CARD_READER_RE
26from checkbox_support.parsers.udevadm import GENERIC_RE
27from checkbox_support.parsers.udevadm import FLASH_RE
26from checkbox_support.udev import get_interconnect_speed28from checkbox_support.udev import get_interconnect_speed
27from checkbox_support.udev import get_udev_block_devices29from checkbox_support.udev import get_udev_block_devices
30from checkbox_support.udev import get_udev_xhci_devices
2831
2932
30class ActionTimer():33class ActionTimer():
@@ -99,6 +102,8 @@
99 self.rem_disks_memory_cards = {}102 self.rem_disks_memory_cards = {}
100 self.rem_disks_memory_cards_nm = {}103 self.rem_disks_memory_cards_nm = {}
101 self.rem_disks_speed = {}104 self.rem_disks_speed = {}
105 # LP: #1313581, TODO: extend to be rem_disks_driver
106 self.rem_disks_xhci = {}
102 self.data = ''107 self.data = ''
103 self.device = device108 self.device = device
104 self.memorycard = memorycard109 self.memorycard = memorycard
@@ -174,8 +179,8 @@
174 have both the filesystem and block device interfaces179 have both the filesystem and block device interfaces
175 """180 """
176 for udisks2_object_path, interfaces in udisks2_objects.items():181 for udisks2_object_path, interfaces in udisks2_objects.items():
177 if (UDISKS2_FILESYSTEM_INTERFACE in interfaces182 if (UDISKS2_FILESYSTEM_INTERFACE in interfaces and
178 and UDISKS2_BLOCK_INTERFACE in interfaces):183 UDISKS2_BLOCK_INTERFACE in interfaces):
179 yield udisks2_object_path184 yield udisks2_object_path
180 # We need to know about all IO candidates,185 # We need to know about all IO candidates,
181 # let's iterate over all the block devices reported by udisks2186 # let's iterate over all the block devices reported by udisks2
@@ -247,6 +252,23 @@
247 else:252 else:
248 self.rem_disks_memory_cards_nm[dev_file] = None253 self.rem_disks_memory_cards_nm[dev_file] = None
249 self.rem_disks_nm[dev_file] = None254 self.rem_disks_nm[dev_file] = None
255 # LP: #1313581
256 # Compare the pci slot name of the devices using xhci and
257 # the pci slot name of the disks,
258 # which is usb3 disks in this case so far,
259 # to make sure the usb3 disk does be on the bus using xhci
260 # TODO: it will be better to extend to be all kinds of drivers.
261 try:
262 udev_devices_xhci = get_udev_xhci_devices(udev_client)
263 for udev_device_xhci in udev_devices_xhci:
264 pci_slot_name = udev_device_xhci.get_property('PCI_SLOT_NAME')
265 for udev_device in udev_devices:
266 if (pci_slot_name ==
267 udev_device.get_property('DEVPATH').split('/')[3]):
268 self.rem_disks_xhci[
269 udev_device.get_property('DEVNAME')] = 'xhci'
270 except:
271 logging.error("Failed to get driver information.")
250272
251 def _probe_disks_udisks1(self, bus):273 def _probe_disks_udisks1(self, bus):
252 """274 """
@@ -275,14 +297,14 @@
275 parent_media = parent_props.Get(udisks, "DriveMedia")297 parent_media = parent_props.Get(udisks, "DriveMedia")
276 if self.memorycard:298 if self.memorycard:
277 if (dev_bus != 'sdio'299 if (dev_bus != 'sdio'
278 and not FLASH_RE.search(parent_media)300 and not FLASH_RE.search(parent_media)
279 and not CARD_READER_RE.search(parent_model)301 and not CARD_READER_RE.search(parent_model)
280 and not GENERIC_RE.search(parent_vendor)):302 and not GENERIC_RE.search(parent_vendor)):
281 continue303 continue
282 else:304 else:
283 if (FLASH_RE.search(parent_media)305 if (FLASH_RE.search(parent_media)
284 or CARD_READER_RE.search(parent_model)306 or CARD_READER_RE.search(parent_model)
285 or GENERIC_RE.search(parent_vendor)):307 or GENERIC_RE.search(parent_vendor)):
286 continue308 continue
287 dev_file = str(device_props.Get(udisks, "DeviceFile"))309 dev_file = str(device_props.Get(udisks, "DeviceFile"))
288 dev_speed = str(device_props.Get(udisks,310 dev_speed = str(device_props.Get(udisks,
@@ -393,6 +415,10 @@
393 help=("Memory cards devices on bus other than sdio "415 help=("Memory cards devices on bus other than sdio "
394 "require this parameter to identify "416 "require this parameter to identify "
395 "them as such"))417 "them as such"))
418 parser.add_argument('--driver',
419 choices=['xhci_hcd'],
420 help=("Detect the driver of the host controller."
421 "Only xhci_hcd for usb3 is supported so far."))
396422
397 args = parser.parse_args()423 args = parser.parse_args()
398424
@@ -444,7 +470,7 @@
444470
445 if errors_mount > 0:471 if errors_mount > 0:
446 print("There're total %d device(s) failed at mounting."472 print("There're total %d device(s) failed at mounting."
447 % errors_mount)473 % errors_mount)
448 errors += errors_mount474 errors += errors_mount
449475
450 disks_all = dict(list(test.rem_disks.items())476 disks_all = dict(list(test.rem_disks.items())
@@ -452,17 +478,17 @@
452478
453 if len(disks_all) > 0:479 if len(disks_all) > 0:
454 print("Found the following mounted %s partitions:"480 print("Found the following mounted %s partitions:"
455 % ', '.join(args.device))481 % ', '.join(args.device))
456482
457 for disk, mount_point in disks_all.items():483 for disk, mount_point in disks_all.items():
458 supported_speed = test.rem_disks_speed[disk]484 supported_speed = test.rem_disks_speed[disk]
459 print(" %s : %s : %s bits/s" %485 print(" %s : %s : %s bits/s" %
460 (disk, mount_point, supported_speed),486 (disk, mount_point, supported_speed),
461 end="")487 end="")
462 if (args.min_speed488 if (args.min_speed and
463 and int(args.min_speed) > int(supported_speed)):489 int(args.min_speed) > int(supported_speed)):
464 print(" (Will not test it, speed is below %s bits/s)" %490 print(" (Will not test it, speed is below %s bits/s)" %
465 args.min_speed, end="")491 args.min_speed, end="")
466492
467 print("")493 print("")
468494
@@ -478,7 +504,7 @@
478 for count in range(args.count):504 for count in range(args.count):
479 test_files[count] = RandomData(args.size)505 test_files[count] = RandomData(args.size)
480 write_sizes.append(os.path.getsize(506 write_sizes.append(os.path.getsize(
481 test_files[count].tfile.name))507 test_files[count].tfile.name))
482 total_write_size = sum(write_sizes)508 total_write_size = sum(write_sizes)
483509
484 try:510 try:
@@ -525,7 +551,7 @@
525 for file in target_file_list:551 for file in target_file_list:
526 test.clean_up(file)552 test.clean_up(file)
527 total_write_time = sum(write_times)553 total_write_time = sum(write_times)
528 avg_write_time = total_write_time / args.count554 # avg_write_time = total_write_time / args.count
529 try:555 try:
530 avg_write_speed = ((556 avg_write_speed = ((
531 total_write_size / total_write_time)557 total_write_size / total_write_time)
@@ -547,7 +573,7 @@
547 (iteration_write_time / args.iterations))573 (iteration_write_time / args.iterations))
548 try:574 try:
549 avg_write_speed = (iteration_write_size /575 avg_write_speed = (iteration_write_size /
550 iteration_write_time)576 iteration_write_time)
551 except ZeroDivisionError:577 except ZeroDivisionError:
552 avg_write_speed = 0.00578 avg_write_speed = 0.00
553 finally:579 finally:
@@ -573,9 +599,17 @@
573 return 1599 return 1
574600
575 else:601 else:
576 #Pass is not assured!602 # LP: 1313581
603 if (args.driver == 'xhci_hcd'):
604 if(5000000000 == test.rem_disks_speed[disk] and
605 'xhci' == test.rem_disks_xhci[disk]):
606 print("\t\tDevice Detected: SuperSpeed USB")
607 print("\t\tDriver Detected: xhci_hcd")
608 else:
609 return 1
610 # Pass is not assured
577 if (not args.pass_speed or611 if (not args.pass_speed or
578 avg_write_speed >= args.pass_speed):612 avg_write_speed >= args.pass_speed):
579 return 0613 return 0
580 else:614 else:
581 print("FAIL: Average speed was lower than desired "615 print("FAIL: Average speed was lower than desired "
582616
=== modified file 'providers/plainbox-provider-checkbox/jobs/suspend.txt.in'
--- providers/plainbox-provider-checkbox/jobs/suspend.txt.in 2014-04-29 21:10:14 +0000
+++ providers/plainbox-provider-checkbox/jobs/suspend.txt.in 2014-05-02 09:27:37 +0000
@@ -1667,11 +1667,10 @@
1667depends: suspend/usb3_insert_after_suspend1667depends: suspend/usb3_insert_after_suspend
1668user: root1668user: root
1669estimated_duration: 45.001669estimated_duration: 45.00
1670command: removable_storage_test -s 268400000 -m 500000000 -p 60 usb1670command: removable_storage_test -s 268400000 -m 500000000 usb --driver xhci_hcd
1671_description:1671_description:
1672 This test will check that your USB 3.0 port transfers data at a1672 This test will check that your USB 3.0 port could be recognized
1673 minimum expected speed in accordance with the specification of1673 as SuperSpeed USB device using xhci_hcd driver and transfers data correctly.
1674 USB 3.0 SuperSpeed mode.
16751674
1676plugin: user-interact1675plugin: user-interact
1677id: suspend/mmc-insert-after-suspend1676id: suspend/mmc-insert-after-suspend
16781677
=== modified file 'providers/plainbox-provider-checkbox/jobs/usb.txt.in'
--- providers/plainbox-provider-checkbox/jobs/usb.txt.in 2014-04-10 21:51:48 +0000
+++ providers/plainbox-provider-checkbox/jobs/usb.txt.in 2014-05-02 09:27:37 +0000
@@ -217,8 +217,7 @@
217depends: usb3/insert217depends: usb3/insert
218user: root218user: root
219estimated_duration: 45.00219estimated_duration: 45.00
220command: removable_storage_test -s 268400000 -m 500000000 -p 60 usb220command: removable_storage_test -s 268400000 -m 500000000 usb --driver xhci_hcd
221_description:221_description:
222 This test will check that your USB 3.0 port transfers data at a222 This test will check that your USB 3.0 port could be recognized
223 minimum expected speed in accordance with the specification of223 as SuperSpeed USB device using xhci_hcd driver and transfers data correctly.
224 USB 3.0 SuperSpeed mode.

Subscribers

People subscribed via source and target branches