summaryrefslogtreecommitdiff
path: root/bin
diff options
authorJonathan Cave <jonathan.cave@canonical.com>2019-02-21 16:26:08 +0000
committerJonathan Cave <jonathan.cave@canonical.com>2019-02-21 16:26:08 +0000
commitdf9b2ba046abc04c6c993ca05ff3b8e62822d9ce (patch)
tree2d22d789e1ceebaa39cfddac11c77c5a90a50251 /bin
parent28a813939a9d47930f3fc0f295da8b9c2634e6f4 (diff)
removable_storage_test: ignore loop devices
Diffstat (limited to 'bin')
-rwxr-xr-xbin/removable_storage_test12
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())