iommufd/selftest: Fix _test_mock_dirty_bitmaps()
authorRobin Murphy <robin.murphy@arm.com>
Thu, 16 Nov 2023 16:52:15 +0000 (16:52 +0000)
committerJason Gunthorpe <jgg@nvidia.com>
Tue, 21 Nov 2023 01:29:31 +0000 (21:29 -0400)
commit98594181944daa201481ad63242806beb7c89ff4
tree45f01db480a10d66b1f3b8963d2f692c12ba11c5
parent98b1cc82c4affc16f5598d4fa14b1858671b2263
iommufd/selftest: Fix _test_mock_dirty_bitmaps()

The ASSERT_EQ() macro sneakily expands to two statements, so the loop here
needs braces to ensure it captures both and actually terminates the test
upon failure. Where these tests are currently failing on my arm64 machine,
this reduces the number of logged lines from a rather unreasonable
~197,000 down to 10. While we're at it, we can also clean up the
tautologous "count" calculations whose assertions can never fail unless
mathematics and/or the C language become fundamentally broken.

Fixes: a9af47e382a4 ("iommufd/selftest: Test IOMMU_HWPT_GET_DIRTY_BITMAP")
Link: https://lore.kernel.org/r/90e083045243ef407dd592bb1deec89cd1f4ddf2.1700153535.git.robin.murphy@arm.com
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Joao Martins <joao.m.martins@oracle.com>
Tested-by: Joao Martins <joao.m.martins@oracle.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
tools/testing/selftests/iommu/iommufd_utils.h