Re: [RFC v1 09/10] regulator: tps62864: add roadtest
From: Vincent Whitchurch
Date: Tue Apr 05 2022 - 18:04:00 EST
On Thu, Mar 17, 2022 at 05:53:22PM +0000, Mark Brown wrote:
> On Thu, Mar 17, 2022 at 04:13:26PM +0100, Vincent Whitchurch wrote:
> > On Fri, Mar 11, 2022 at 06:06:54PM +0000, Mark Brown wrote:
> > > > + @classmethod
> > > > + def setUpClass(cls) -> None:
> > > > + insmod("tps6286x-regulator")
> > > Shouldn't this get figured out when the device gets created in DT (if it
> > > doesn't I guess the tests found a bug...)?
> > The system isn't set up to load modules automatically. The reason for
> > this is to give the test cases full control of when the module is loaded
> > and unload, since the tests could want to load the module with specific
> > options.
> That seems like the uncommon case which could remove the module if it
> explicitly needed it.
Another reason was to get the tests to test module unloading since I've
seen a lot of especially new driver writers forget to test that, but I
realise that for most normal drivers that should be mostly covered by
the fact that we test device unbinding.
So I went ahead and implemented this and it seems to work. As you
hinted earlier, this also means that the modalias stuff gets tested, and
as we know that's been broken in the recent past for a bunch of drivers,
so that's another advantage to automatic module loading, besides the
boilerplate reduction in the tests.