[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251015151002.GH3938986@ziepe.ca>
Date: Wed, 15 Oct 2025 12:10:02 -0300
From: Jason Gunthorpe <jgg@...pe.ca>
To: Robin Murphy <robin.murphy@....com>
Cc: Mostafa Saleh <smostafa@...gle.com>, iommu@...ts.linux.dev,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
will@...nel.org, joro@...tes.org, praan@...gle.com
Subject: Re: [PATCH v5 4/4] iommu/io-pgtable-arm-selftests: Use KUnit
On Wed, Oct 15, 2025 at 02:51:15PM +0100, Robin Murphy wrote:
> On 2025-10-15 10:53 am, Mostafa Saleh wrote:
> > > Conversely, this is infrastructure, not an actual test of expected
> > > io-pgtable behaviour, so I think just:
> > >
> > > cfg.iommu_dev = kunit_device_register(test, "io-pgtable-test");
> > > if (IS_ERR(cfg.iommu_dev))
> > > return;
> > >
> > > (it doesn't return NULLs either)
> > >
> >
> > Yes, I was not sure about this one, when checking the code base, every test
> > handles kunit_device_register() failure differently, this seemed the
> > most strict one so I used it, I will update that in the next version.
>
> Yeah, my impression is that those have likely been copied from the
> lib/kunit/ code where it is actually testing its own API. I've now sent a
> patch for the example in the docs...
I think any failure to run the test should be reported, either with an
err or a skip. Tests that didn't do anything and silently report
success are not a good design.
Looking at the existing users I see alot are in init functions, so
they propogate an error code and fail the init.
And the rest inside tests do something like this:
dev = kunit_device_register(test, dev_name);
KUNIT_ASSERT_FALSE_MSG(test, IS_ERR(dev);
"Cannot register test device\n");
Jason
Powered by blists - more mailing lists