diff options
author | PMR <pmr@pmr-lander> | 2019-02-22 11:01:22 +0000 |
---|---|---|
committer | PMR <pmr@pmr-lander> | 2019-02-22 11:01:22 +0000 |
commit | 46bab3e479f3a8b453222714401ad9d29ec5fe5e (patch) | |
tree | 2d22d789e1ceebaa39cfddac11c77c5a90a50251 | |
parent | 28a813939a9d47930f3fc0f295da8b9c2634e6f4 (diff) | |
parent | df9b2ba046abc04c6c993ca05ff3b8e62822d9ce (diff) |
Merge #363500 from ~jocave/plainbox-provider-checkbox:filter-out-loop-devices
-rwxr-xr-x | bin/removable_storage_test | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/bin/removable_storage_test b/bin/removable_storage_test index 6de3f979..a7abdfed 100755 --- a/bin/removable_storage_test +++ b/bin/removable_storage_test @@ -21,6 +21,7 @@ from checkbox_support.dbus import connect_to_system_bus from checkbox_support.dbus.udisks2 import UDISKS2_BLOCK_INTERFACE from checkbox_support.dbus.udisks2 import UDISKS2_DRIVE_INTERFACE from checkbox_support.dbus.udisks2 import UDISKS2_FILESYSTEM_INTERFACE +from checkbox_support.dbus.udisks2 import UDISKS2_LOOP_INTERFACE from checkbox_support.dbus.udisks2 import UDisks2Model, UDisks2Observer from checkbox_support.dbus.udisks2 import is_udisks2_supported from checkbox_support.dbus.udisks2 import lookup_udev_device @@ -38,6 +39,7 @@ from checkbox_support.udev import get_udev_xhci_devices class ActionTimer(): '''Class to implement a simple timer''' + def __enter__(self): self.start = time.time() return self @@ -49,6 +51,7 @@ class ActionTimer(): class RandomData(): '''Class to create data files''' + def __init__(self, size): self.tfile = tempfile.NamedTemporaryFile(delete=False) self.path = '' @@ -299,7 +302,8 @@ class DiskTest(): udev_devices = get_udev_block_devices(GUdev.Client()) for udev_device in udev_devices: if udev_device.get_device_file() == dev_file: - interconnect_speed = get_interconnect_speed(udev_device) + interconnect_speed = get_interconnect_speed( + udev_device) if interconnect_speed: self.rem_disks_speed[dev_file] = ( interconnect_speed * 10 ** 6) @@ -329,7 +333,8 @@ class DiskTest(): """ for udisks2_object_path, interfaces in udisks2_objects.items(): if (UDISKS2_FILESYSTEM_INTERFACE in interfaces and - UDISKS2_BLOCK_INTERFACE in interfaces): + UDISKS2_BLOCK_INTERFACE in interfaces and + UDISKS2_LOOP_INTERFACE not in interfaces): yield udisks2_object_path # We need to know about all IO candidates, # let's iterate over all the block devices reported by udisks2 @@ -605,7 +610,7 @@ def main(): help=("Detect the driver of the host controller." "Only xhci_hcd for usb3 is supported so far.")) parser.add_argument("--lsblkcommand", action='store', type=str, - default="lsblk -i -n -P -o KNAME,TYPE,MOUNTPOINT", + default="lsblk -i -n -P -e 7 -o KNAME,TYPE,MOUNTPOINT", help=("Command to execute to get lsblk information. " "Only change it if you know what you're doing.")) @@ -870,5 +875,6 @@ def main(): logging.error("No removable drives were detected, aborting") return 1 + if __name__ == '__main__': sys.exit(main()) |