[Intel-xe] [PATCH 1/7] drm/xe: Add basic unit tests for rtp

Michał Winiarski michal at hardline.pl
Sat Apr 1 18:26:24 UTC 2023


On Sat, Apr 01, 2023 at 01:54:59AM -0700, Lucas De Marchi wrote:
> On Fri, Mar 31, 2023 at 08:34:21AM -0600, Lucas De Marchi wrote:
> > On Mon, Mar 27, 2023 at 07:56:01PM +0200, Michał Winiarski wrote:
> > > On Tue, Mar 21, 2023 at 03:05:21PM -0700, Lucas De Marchi wrote:
> > > > +EXPORT_SYMBOL(xe_rtp_process_incompat_types);
> > > > diff --git a/drivers/gpu/drm/xe/tests/xe_rtp_test.c b/drivers/gpu/drm/xe/tests/xe_rtp_test.c
> > > > new file mode 100644
> > > > index 000000000000..4a12aad3f759
> > > > --- /dev/null
> > > > +++ b/drivers/gpu/drm/xe/tests/xe_rtp_test.c
> > > 
> > > There's no need to have this as a separate file.
> > > We can move the contents of tests/xe_rtp.c into tests/xe_rtp_test.c and
> > > include tests/xe_rtp_test.c directly in xe_rtp.c
> > 
> > this is not how the tests are currently structured.
> > 
> > xe_rtp.c includes tests/xe_rtp.c. The latter can be seen as "an
> > extension of the that file, exporting whatever entrypoint is needed
> > for the real test". They are then part of the xe.ko module.
> > 
> > tests/xe_rtp_test.c is the one in the separate test module, and contains
> > the integration with kunit.
> 
> but it's possible to keep everythin in the separate module and not need
> the include of tests/xe_rtp.c. I did that on v2.
> 
> Lucas De Marchi

>From my perspective - the way that the test is implemented carries an
additional information.
1) Test is a separate module:
Means that we're testing the API exported by the module (that's used by
other modules).
2) Test is a file that's a part of a module:
Means that we're testing non-static API used internally by the module.
3) Test is a file that's included at the end of a file:
Means that we're testing static functions.

Forcing everything to be a module doesn't really serve any purpose.
It just makes things harder to follow, as it removes this useful
additional bit of information.

-Michał

> 
> > 
> > For some of the tests, when they don't export the required interface,
> > this unfortunately means writing most of the test inside tests/xe_rtp.c,
> > which ends up bloating xe.ko.  This is not true for all, however. See
> > the xe_wa tests where we don't even have tests/xe_wa.c.
> > 
> > Lucas De Marchi


More information about the Intel-xe mailing list