From 8d7d6659fee4b344dbd847d6159edfac7027a699 Mon Sep 17 00:00:00 2001 From: Bryan Gurney Date: Fri, 17 Nov 2023 16:09:42 -0500 Subject: [PATCH] Fail only on non-zero alignment_offset Signed-off-by: Bryan Gurney --- testlib/infra.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/testlib/infra.py b/testlib/infra.py index 0682c66..21a30c2 100644 --- a/testlib/infra.py +++ b/testlib/infra.py @@ -180,7 +180,14 @@ def tearDown(self): misaligned_devices = [] for dev in os.listdir("/sys/class/block"): if fnmatch.fnmatch(dev, "dm-*"): - misaligned_devices.append(dev) + dev_sysfspath = os.path.join( + "/sys/class/block", dev, "alignment_offset" + ) + 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) + self.assertEqual(misaligned_devices, []) except FileNotFoundError: pass