Skip to content

Commit

Permalink
SysfsMonitor: create dictionary of dm devices
Browse files Browse the repository at this point in the history
Signed-off-by: Bryan Gurney <[email protected]>
  • Loading branch information
bgurney-rh committed Nov 17, 2023
1 parent 8d7d665 commit fd18c6a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion testlib/infra.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,12 @@ class SysfsMonitor(unittest.TestCase):

def tearDown(self):
if SysfsMonitor.verify_sysfs: # pylint: disable=no-member
dm_devices = {}
for dmdev in os.listdir("/dev/mapper"):
dmdev_path = os.path.join("/dev/mapper", dmdev)
dmdev_num = os.path.basename(os.path.realpath(dmdev_path))
dm_devices[dmdev_num] = dmdev

try:
misaligned_devices = []
for dev in os.listdir("/sys/class/block"):
Expand All @@ -186,7 +192,7 @@ def tearDown(self):
with open(dev_sysfspath, "r", encoding="utf-8") as dev_sysfs:
dev_align = dev_sysfs.read().rstrip()
if int(dev_align) != 0:
misaligned_devices.append(dev)
misaligned_devices.append(dm_devices[dev])

self.assertEqual(misaligned_devices, [])
except FileNotFoundError:
Expand Down

0 comments on commit fd18c6a

Please sign in to comment.