mbox series

[v3,0/3] KUnit tests for drm_format_helper

Message ID 20220613171738.111013-1-jose.exposito89@gmail.com (mailing list archive)
Headers show
Series KUnit tests for drm_format_helper | expand

Message

José Expósito June 13, 2022, 5:17 p.m. UTC
Hello everyone,

Here is the v3 of the series, including the documentation, previously
sent as a standalone patch [1], and changes suggested during review.

Thanks a lot,
José Expósito

RFC -> v1: https://lore.kernel.org/dri-devel/20220530102017.471865-1-jose.exposito89@gmail.com/T/

 - Add .kunitconfig (Maxime Ripard)
 - Fix memory leak (Daniel Latypov)
 - Make config option generic (Javier Martinez Canillas):
   DRM_FORMAR_HELPER_TEST -> DRM_KUNIT_TEST
 - Remove DISABLE_STRUCTLEAK_PLUGIN (Daniel Latypov)

v1 -> v2: https://lore.kernel.org/dri-devel/20220606095516.938934-1-jose.exposito89@gmail.com/T/

 Thomas Zimmermann:
 - Add DRM_RECT_INIT() macro
 - Move tests to drivers/gpu/drm/kunit
 - Improve test documentation

v2 -> v3: https://lore.kernel.org/dri-devel/20220612161248.271590-1-jose.exposito89@gmail.com/T/

 - Use designated initializer in DRM_RECT_INIT (Jani Nikula)
 - Simplify the "conversion_buf_size" helper

[1] https://lore.kernel.org/dri-devel/20220606180940.43371-1-jose.exposito89@gmail.com/T/

José Expósito (3):
  drm/rect: Add DRM_RECT_INIT() macro
  drm/format-helper: Add KUnit tests for drm_fb_xrgb8888_to_rgb332()
  drm/doc: Add KUnit documentation

 Documentation/gpu/drm-internals.rst           |  32 ++++
 drivers/gpu/drm/Kconfig                       |  16 ++
 drivers/gpu/drm/Makefile                      |   1 +
 drivers/gpu/drm/kunit/.kunitconfig            |   3 +
 drivers/gpu/drm/kunit/Makefile                |   3 +
 .../gpu/drm/kunit/drm_format_helper_test.c    | 160 ++++++++++++++++++
 include/drm/drm_rect.h                        |  16 ++
 7 files changed, 231 insertions(+)
 create mode 100644 drivers/gpu/drm/kunit/.kunitconfig
 create mode 100644 drivers/gpu/drm/kunit/Makefile
 create mode 100644 drivers/gpu/drm/kunit/drm_format_helper_test.c

Comments

Thomas Zimmermann June 14, 2022, 7:08 a.m. UTC | #1
Hi Jose,

for the whole patchset:

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>

One small detail on licensing: drm_format_helper.c is licensed under 
GPL2 or MIT. Maybe consider adding 'or MIT' to drm_format_helper_test.c 
as well.

Best regards
Thomas

Am 13.06.22 um 19:17 schrieb José Expósito:
> Hello everyone,
> 
> Here is the v3 of the series, including the documentation, previously
> sent as a standalone patch [1], and changes suggested during review.
> 
> Thanks a lot,
> José Expósito
> 
> RFC -> v1: https://lore.kernel.org/dri-devel/20220530102017.471865-1-jose.exposito89@gmail.com/T/
> 
>   - Add .kunitconfig (Maxime Ripard)
>   - Fix memory leak (Daniel Latypov)
>   - Make config option generic (Javier Martinez Canillas):
>     DRM_FORMAR_HELPER_TEST -> DRM_KUNIT_TEST
>   - Remove DISABLE_STRUCTLEAK_PLUGIN (Daniel Latypov)
> 
> v1 -> v2: https://lore.kernel.org/dri-devel/20220606095516.938934-1-jose.exposito89@gmail.com/T/
> 
>   Thomas Zimmermann:
>   - Add DRM_RECT_INIT() macro
>   - Move tests to drivers/gpu/drm/kunit
>   - Improve test documentation
> 
> v2 -> v3: https://lore.kernel.org/dri-devel/20220612161248.271590-1-jose.exposito89@gmail.com/T/
> 
>   - Use designated initializer in DRM_RECT_INIT (Jani Nikula)
>   - Simplify the "conversion_buf_size" helper
> 
> [1] https://lore.kernel.org/dri-devel/20220606180940.43371-1-jose.exposito89@gmail.com/T/
> 
> José Expósito (3):
>    drm/rect: Add DRM_RECT_INIT() macro
>    drm/format-helper: Add KUnit tests for drm_fb_xrgb8888_to_rgb332()
>    drm/doc: Add KUnit documentation
> 
>   Documentation/gpu/drm-internals.rst           |  32 ++++
>   drivers/gpu/drm/Kconfig                       |  16 ++
>   drivers/gpu/drm/Makefile                      |   1 +
>   drivers/gpu/drm/kunit/.kunitconfig            |   3 +
>   drivers/gpu/drm/kunit/Makefile                |   3 +
>   .../gpu/drm/kunit/drm_format_helper_test.c    | 160 ++++++++++++++++++
>   include/drm/drm_rect.h                        |  16 ++
>   7 files changed, 231 insertions(+)
>   create mode 100644 drivers/gpu/drm/kunit/.kunitconfig
>   create mode 100644 drivers/gpu/drm/kunit/Makefile
>   create mode 100644 drivers/gpu/drm/kunit/drm_format_helper_test.c
>
Javier Martinez Canillas June 14, 2022, 1:03 p.m. UTC | #2
On 6/13/22 19:17, José Expósito wrote:
> Hello everyone,
> 
> Here is the v3 of the series, including the documentation, previously
> sent as a standalone patch [1], and changes suggested during review.
> 
> Thanks a lot,
> José Expósito
> 

Before merging this, could you please reach the folks working on [0] ?

I think that would be good to have some consistency with regard to KUnit
tests from the start to avoid future refactorings. For instance, you are
adding the tests under a `kunit` sub-directory while they are doing it
in a `tests` sub-dir.

Also there may be other things that could be made more consistent, like
the naming conventions for the tests, suites, etc.

[0]: https://lore.kernel.org/all/20220608010709.272962-4-maira.canal@usp.br/T/
David Gow June 16, 2022, 2:44 p.m. UTC | #3
On Tue, Jun 14, 2022 at 1:17 AM José Expósito <jose.exposito89@gmail.com> wrote:
>
> Hello everyone,
>
> Here is the v3 of the series, including the documentation, previously
> sent as a standalone patch [1], and changes suggested during review.
>
> Thanks a lot,
> José Expósito
>

[+Maíra, Isabella, Tales, Magali for other drm,amdgpu,KUnit work.]

These seem pretty good to me, but I'd echo Javier's comments about
consistency with other DRM tests.

In particular, we now have three concurrently developed DRM-related
test suites, each doing things slightly differently:
- This series is putting tests in drm/kunit, and providing a
.kunitconfig in that directory,
- The selftest ports here[1] are putting tests in drm/tests, and
provide a separate Kconfig file, as well as a .kunitconfig
- And the AMDGPU tests[2] are doing something totally different, with
their own tests in drm/amd/display/amdgpu_dm/tests, which get compiled
directly into the amdgpu module (and, at present, can't be run at all
via kunit_tool)

Certainly the general DRM tests should be in the same place, and use
the same Kconfig entries, etc. A mix of the separate Kconfig file from
[1] (if there's enough benefit to having the ability to turn on and
off suites individually, which seems plausible) and the documentation
from this series seems good to me.

There's some basic guidelines around test nomenclature in
Documentation/dev-tools/kunit/style.rst[3], though all of these
patches seem pretty consistent with that. Either 'kunit' or 'tests'
would work as a directory name: given the AMDGPU patches are using
'tests', maybe that's easier to stick with.

Cheers,
-- David

[1]: https://lore.kernel.org/linux-kselftest/20220615135824.15522-1-maira.canal@usp.br/
[2]: https://lore.kernel.org/dri-devel/20220608010709.272962-1-maira.canal@usp.br/
[3]: https://www.kernel.org/doc/html/latest/dev-tools/kunit/style.html
José Expósito June 16, 2022, 6:38 p.m. UTC | #4
Hi!

Javier Martinez Canillas wrote:
> Before merging this, could you please reach the folks working on [0] ?
> I think that would be good to have some consistency with regard to KUnit
> tests from the start to avoid future refactorings. For instance, you are
> adding the tests under a `kunit` sub-directory while they are doing it
> in a `tests` sub-dir.
>
> Also there may be other things that could be made more consistent, like
> the naming conventions for the tests, suites, etc.
>
> [0]: https://lore.kernel.org/all/20220608010709.272962-4-maira.canal@usp.br/T/

David Gow wrote:
> [+Maíra, Isabella, Tales, Magali for other drm,amdgpu,KUnit work.]
> 
> These seem pretty good to me, but I'd echo Javier's comments about
> consistency with other DRM tests.

I agree, I'd need to look with more detail into the selftest conversion
and the AMD series, but it'd be nice to avoid unnecessary refactors.
 
> In particular, we now have three concurrently developed DRM-related
> test suites, each doing things slightly differently:
> - This series is putting tests in drm/kunit, and providing a
> .kunitconfig in that directory,
>
> - The selftest ports here[1] are putting tests in drm/tests, and
> provide a separate Kconfig file, as well as a .kunitconfig

Now that "selftests/" is going to be removed, "tests/" is a good name
for the folder, I'll rename it in v4.

> - And the AMDGPU tests[2] are doing something totally different, with
> their own tests in drm/amd/display/amdgpu_dm/tests, which get compiled
> directly into the amdgpu module (and, at present, can't be run at all
> via kunit_tool)
> 
> Certainly the general DRM tests should be in the same place, and use
> the same Kconfig entries, etc. A mix of the separate Kconfig file from
> [1] (if there's enough benefit to having the ability to turn on and
> off suites individually, which seems plausible) and the documentation
> from this series seems good to me.

I agree about having the DRM-core tests in drm/tests/ and driver tests
in drm/driver/tests/.

About allowing turning on or off test suites, it was agreed to use a
generic symbol to group them (DRM_KUNIT_TEST) [1].
I won't have time merge all patches toghether and run them until next
week, but if it takes too long to run them or you find it beneficial to
split the symbols, I'll change my patch.

[1] https://lore.kernel.org/dri-devel/e26de140-afb7-7b1b-4826-6ac4f3a4fe02@redhat.com/
 
> There's some basic guidelines around test nomenclature in
> Documentation/dev-tools/kunit/style.rst[3], though all of these
> patches seem pretty consistent with that. Either 'kunit' or 'tests'
> would work as a directory name: given the AMDGPU patches are using
> 'tests', maybe that's easier to stick with.

I'll have to rename my kunit_suite to use underscores, as well as the
test cases, that at the moment are using English sentences.

Maíra: We'd also need to agree on the file names used, the
documentation [2] suggest to use *_test.c, it'd need to be changed in
the selftest to KUnit series.

Best wishes,
Jose

[2] https://www.kernel.org/doc/html/latest/dev-tools/kunit/style.html#test-file-and-module-names 
> Cheers,
> -- David
> 
> [1]: https://lore.kernel.org/linux-kselftest/20220615135824.15522-1-maira.canal@usp.br/
> [2]: https://lore.kernel.org/dri-devel/20220608010709.272962-1-maira.canal@usp.br/
> [3]: https://www.kernel.org/doc/html/latest/dev-tools/kunit/style.html