From fd18c6a804f9a10d6054cc5f00f7d564e36e67de Mon Sep 17 00:00:00 2001 From: Bryan Gurney Date: Fri, 17 Nov 2023 17:05:00 -0500 Subject: [PATCH] SysfsMonitor: create dictionary of dm devices Signed-off-by: Bryan Gurney --- testlib/infra.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/testlib/infra.py b/testlib/infra.py index 21a30c2..583b464 100644 --- a/testlib/infra.py +++ b/testlib/infra.py @@ -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"): @@ -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: