[PATCH v5 4/4] iommu/io-pgtable-arm-selftests: Use KUnit
Mostafa Saleh
smostafa at google.com
Fri Oct 17 06:04:49 PDT 2025
On Thu, Oct 16, 2025 at 02:25:24PM -0300, Jason Gunthorpe wrote:
> On Thu, Oct 16, 2025 at 06:17:35PM +0100, Robin Murphy wrote:
>
> > In this case AFAICS kunit_device_register() can only fail due to OOM or
> > something unexpectedly messed up in the kobject/sysfs hierarchy, all of
> > which should already scream (and represent the system being sufficiently
> > hosed that any actual test results probably no longer matter anyway) -
> > otherwise I would have suggested a kunit_err() message too.
>
> Yes, I think so too. Which is why I think the simple
> KUNIT_ASSERT_FALSE is fine - we don't need to over think something
> that should never happen.
>
> Basically it is a simple logic for the test writer, any thing in the
> test body that doesn't work as expected triggers a
> KUNIT_ASSERT. Infrastructure included.
>
> At least that is how I've written all my tests so far, including the
> userspace ones..
Maybe as Robin suggested, something as:
if (IS_ERR(dev)) {
kunit_skip(test, "Failed to allocated device!\n");
return;
}
Is simple enough and verbose and can distinguished from test failures,
it will look like:
[ 2.095812] ok 1 arm_lpae_do_selftests # SKIP Failed to allocated device!
Thanks,
Mostafa
>
> Jason
More information about the linux-arm-kernel
mailing list