KUnit tests for drm_format_helper
Subsystems (3)
v3 cover KUnit tests for drm_format_helper
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/[email protected]/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/[email protected]/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/[email protected]/T/
- Use designated initializer in DRM_RECT_INIT (Jani Nikula)
- Simplify the "conversion_buf_size" helper
[1] https://lore.kernel.org/dri-devel/[email protected]/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
Signature · 1 line
2.25.1
PATCH v3 1/3 drm/rect: Add DRM_RECT_INIT() macro
Add a helper macro to initialize a rectangle from x, y, width and height information.
--- include/drm/drm_rect.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
include/drm/drm_rect.h +16 -0
@@ -47,6 +47,22 @@ struct drm_rect {int x1, y1, x2, y2; }; +/** +* DRM_RECT_INIT - initialize a rectangle from x/y/w/h +* @x: x coordinate +* @y: y coordinate +* @w: width +* @h: height +* +* RETURNS: +* A new rectangle of the specified size. +*/ +#define DRM_RECT_INIT (x, y, w, h) ((struct drm_rect){ \ + .x1 = (x), \ + .y1 = (y), \ + .x2 = (x) + (w), \ + .y2 = (y) + (h) }) +/** * DRM_RECT_FMT - printf string for &struct drm_rect */
Signature · 1 line
2.25.1
Re: [PATCH v3 1/3] drm/rect: Add DRM_RECT_INIT() macro
Quoted 4 lines · José Expósito
Add a helper macro to initialize a rectangle from x, y, width and height information.
Signed-off-by José Expósito <[email protected]>
Quoted 31 lines
--- include/drm/drm_rect.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)include/drm/drm_rect.h +16
-0@@ -47,6 +47,22 @@ struct drm_rect {int x1, y1, x2, y2; }; +/** +* DRM_RECT_INIT - initialize a rectangle from x/y/w/h +* @x: x coordinate +* @y: y coordinate +* @w: width +* @h: height +* +* RETURNS: +* A new rectangle of the specified size. +*/ +#define DRM_RECT_INIT (x, y, w, h) ((struct drm_rect){ \ + .x1 = (x), \ + .y1 = (y), \ + .x2 = (x) + (w), \ + .y2 = (y) + (h) }) +/** * DRM_RECT_FMT - printf string for &struct drm_rect */
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
PATCH v3 2/3 drm/format-helper: Add KUnit tests for drm_fb_xrgb8888_to_rgb332()
In reply to José ExpósitoTest the conversion from XRGB8888 to RGB332.
What is tested?
- Different values for the X in XRGB8888 to make sure it is ignored
- Different clip values: Single pixel and full and partial buffer
- Well known colors: White, black, red, green, blue, magenta, yellow and cyan
- Other colors: Randomly picked
- Destination pitch
How to run the tests?
$ ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/gpu/drm/kunit \
--kconfig_add CONFIG_VIRTIO_UML=y \
--kconfig_add CONFIG_UML_PCI_OVER_VIRTIO=y--- 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 ++++++++++++++++++ 5 files changed, 183 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
drivers/gpu/drm/Kconfig +16 -0
@@ -70,6 +70,22 @@ config DRM_DEBUG_SELFTEST If in doubt, say "N". +config DRM_KUNIT_TEST + tristate "KUnit tests for DRM" if !KUNIT_ALL_TESTS + depends on DRM && KUNIT=y + select DRM_KMS_HELPER + default KUNIT_ALL_TESTS + help + This builds unit tests for DRM. This option is not useful for + distributions or general kernels, but only for kernel + developers working on DRM and associated drivers. + + For more information on KUnit and unit tests in general, + please refer to the KUnit documentation in + Documentation/dev-tools/kunit/. + + If in doubt, say "N". + config DRM_KMS_HELPER tristate depends on DRM
drivers/gpu/drm/Makefile +1 -0
@@ -76,6 +76,7 @@ obj-$(CONFIG_DRM_KMS_HELPER) += drm_kms_helper.o # obj-$(CONFIG_DRM_DEBUG_SELFTEST) += selftests/ +obj-$(CONFIG_DRM_KUNIT_TEST) += kunit/ obj-$(CONFIG_DRM_MIPI_DBI) += drm_mipi_dbi.o obj-$(CONFIG_DRM_MIPI_DSI) += drm_mipi_dsi.o
drivers/gpu/drm/kunit/.kunitconfig new file +3 -0
@@ -0,0 +1,3 @@ +CONFIG_KUNIT=y +CONFIG_DRM=y +CONFIG_DRM_KUNIT_TEST=y
drivers/gpu/drm/kunit/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-$(CONFIG_DRM_KUNIT_TEST) += drm_format_helper_test.o
drivers/gpu/drm/kunit/drm_format_helper_test.c new file +160 -0
160 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v3 3/3 drm/doc: Add KUnit documentation
In reply to José ExpósitoExplain how to run the KUnit tests present in the DRM subsystem and clarify why the UML-only options were not added to the configuration file present in drivers/gpu/drm/.kunitconfig [1] [2].
[1] https://lore.kernel.org/dri-devel/CABVgOSn8i=LO5p7830h2XU1Jgg0KrN0qTnxkOMhf1oTgxjaKKw@mail.gmail.com/
[2] https://lore.kernel.org/dri-devel/CAGS_qxqpiCim_sy1LDK7PLwVgWf-LKW+uNFTGM=T7ydk-dYcEw@mail.gmail.com/
--- Documentation/gpu/drm-internals.rst | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
Documentation/gpu/drm-internals.rst +32 -0
@@ -207,6 +207,38 @@ Utilities :internal: +Unit testing +============ + +KUnit +----- + +KUnit (Kernel unit testing framework) provides a common framework for unit tests +within the Linux kernel. + +This section covers the specifics for the DRM subsystem. For general information +about KUnit, please refer to Documentation/dev-tools/kunit/start.rst. + +How to run the tests? +~~~~~~~~~~~~~~~~~~~~~ + +In order to facilitate running the test suite, a configuration file is present +in ``drivers/gpu/drm/kunit/.kunitconfig``. It can be used by ``kunit.py`` as +follows: + +.. code-block:: bash + + $ ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/gpu/drm/kunit \ + --kconfig_add CONFIG_VIRTIO_UML=y \ + --kconfig_add CONFIG_UML_PCI_OVER_VIRTIO=y + +.. note:: + The configuration included in ``.kunitconfig`` should be as generic as + possible. + ``CONFIG_VIRTIO_UML`` and ``CONFIG_UML_PCI_OVER_VIRTIO`` are not + included in it because they are only required for User Mode Linux. + + Legacy Support Code ===================
Signature · 1 line
2.25.1
Re: [PATCH v3 3/3] drm/doc: Add KUnit documentation
Hello José,
On 6/13/22 19:17, José Expósito wrote:
[snip]
Documentation/gpu/drm-internals.rst Utilities · line 218
Quoted 3 lines
Documentation/gpu/drm-internals.rst +3
-0+KUnit (Kernel unit testing framework) provides a common framework for unit tests +within the Linux kernel. +
I think that it will be useful to have a reference to the KUnit kernel doc here, something like the following:
KUnit <https://docs.kernel.org/dev-tools/kunit/index.html>_ (Kernel Unit...
Quoted 13 lines
Documentation/gpu/drm-internals.rst +13
-0+This section covers the specifics for the DRM subsystem. For general information +about KUnit, please refer to Documentation/dev-tools/kunit/start.rst. + +How to run the tests? +~~~~~~~~~~~~~~~~~~~~~ + +In order to facilitate running the test suite, a configuration file is present +in ``drivers/gpu/drm/kunit/.kunitconfig``. It can be used by ``kunit.py`` as +follows: + +.. code-block:: bash + + $ ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/gpu/drm/kunit \
Documentation/gpu/drm-internals.rst Utilities · line 241
Quoted 10 lines
Documentation/gpu/drm-internals.rst +10
-0+ --kconfig_add CONFIG_VIRTIO_UML=y \ + --kconfig_add CONFIG_UML_PCI_OVER_VIRTIO=y + +.. note:: + The configuration included in ``.kunitconfig`` should be as generic as + possible. + ``CONFIG_VIRTIO_UML`` and ``CONFIG_UML_PCI_OVER_VIRTIO`` are not + included in it because they are only required for User Mode Linux. + +
Maybe also add something like this ?
For example, the following command can be used to run the test for x86_64:
$ ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/gpu/drm/kunit \ --arch=x86_64
Regardless, the patch looks good to me:
Signature · 5 lines
Best regards, Javier Martinez Canillas Linux Engineering Red Hat
Re: [PATCH v3 3/3] drm/doc: Add KUnit documentation
Hi Javier,
Quoted 6 lines · Javier Martinez Canillas
Hello José,
On 6/13/22 19:17, José Expósito wrote:
[snip]
Quoted 8 lines
Documentation/gpu/drm-internals.rst Utilities · line 218
Quoted 3 lines
Documentation/gpu/drm-internals.rst +3
-0+KUnit (Kernel unit testing framework) provides a common framework for unit tests +within the Linux kernel. +I think that it will be useful to have a reference to the KUnit kernel doc here, something like the following:
KUnit <https://docs.kernel.org/dev-tools/kunit/index.html>_ (Kernel Unit...
There is a link in the next paragraph. Once the documentation is generated the path "Documentation/dev-tools/kunit/start.rst" is transformed into a link.
Quoted 26 lines
Quoted 13 lines
Documentation/gpu/drm-internals.rst +13
-0+This section covers the specifics for the DRM subsystem. For general information +about KUnit, please refer to Documentation/dev-tools/kunit/start.rst. + +How to run the tests? +~~~~~~~~~~~~~~~~~~~~~ + +In order to facilitate running the test suite, a configuration file is present +in ``drivers/gpu/drm/kunit/.kunitconfig``. It can be used by ``kunit.py`` as +follows: + +.. code-block:: bash + + $ ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/gpu/drm/kunit \Documentation/gpu/drm-internals.rst Utilities · line 241
Quoted 10 lines
Documentation/gpu/drm-internals.rst +10
-0+ --kconfig_add CONFIG_VIRTIO_UML=y \ + --kconfig_add CONFIG_UML_PCI_OVER_VIRTIO=y + +.. note:: + The configuration included in ``.kunitconfig`` should be as generic as + possible. + ``CONFIG_VIRTIO_UML`` and ``CONFIG_UML_PCI_OVER_VIRTIO`` are not + included in it because they are only required for User Mode Linux. + +Maybe also add something like this ?
Quoted 4 lines
For example, the following command can be used to run the test for
x86_64:$ ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/gpu/drm/kunit \ --arch=x86_64
I didn't want to go into much detail because the KUnit docs are a very good resource and already explain how to run the tests in your favorite architecture.
Since running the test on x86_64 should not change the results, I'd prefer to keep it simple and trust the KUnit docs for the "advanced" options.
Quoted 3 lines
Regardless, the patch looks good to me:
Reviewed-by Javier Martinez Canillas <[email protected]>
Thanks a lot for taking the time to review it. I'll add the tag if a v4 is required after chatting with the guys working on the AMDGPU tests.
Jose
Quoted 7 lines
Signature · 5 lines
Best regards, Javier Martinez Canillas Linux Engineering Red Hat
Re: [PATCH v3 3/3] drm/doc: Add KUnit documentation
Quoted 16 lines · José Expósito
Hi Javier,
Quoted 13 lines · Javier Martinez Canillas
Hello José,
On 6/13/22 19:17, José Expósito wrote:
[snip]
Documentation/gpu/drm-internals.rst Utilities · line 218
Quoted 3 lines
Documentation/gpu/drm-internals.rst +3
-0+KUnit (Kernel unit testing framework) provides a common framework for unit tests +within the Linux kernel. +I think that it will be useful to have a reference to the KUnit kernel doc here, something like the following:
Quoted 6 lines
Quoted 1 line
KUnit <https://docs.kernel.org/dev-tools/kunit/index.html>_ (Kernel Unit...There is a link in the next paragraph. Once the documentation is generated the path "
Documentation/dev-tools/kunit/start.rst" is transformed into a link.
Ah, I wasn't aware of that. Thanks!
Signature · 5 lines
Best regards, Javier Martinez Canillas Linux Engineering Red Hat
Re: [PATCH v3 3/3] drm/doc: Add KUnit documentation
In reply to Javier Martinez CanillasQuoted 41 lines · Javier Martinez Canillas
Hello José,
On 6/13/22 19:17, José Expósito wrote:
[snip]
Documentation/gpu/drm-internals.rst Utilities · line 218
Quoted 3 lines
Documentation/gpu/drm-internals.rst +3
-0+KUnit (Kernel unit testing framework) provides a common framework for unit tests +within the Linux kernel. +I think that it will be useful to have a reference to the KUnit kernel doc here, something like the following:
KUnit <https://docs.kernel.org/dev-tools/kunit/index.html>_ (Kernel Unit...Quoted 13 lines
Documentation/gpu/drm-internals.rst +13
-0+This section covers the specifics for the DRM subsystem. For general information +about KUnit, please refer to Documentation/dev-tools/kunit/start.rst. + +How to run the tests? +~~~~~~~~~~~~~~~~~~~~~ + +In order to facilitate running the test suite, a configuration file is present +in ``drivers/gpu/drm/kunit/.kunitconfig``. It can be used by ``kunit.py`` as +follows: + +.. code-block:: bash + + $ ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/gpu/drm/kunit \Documentation/gpu/drm-internals.rst Utilities · line 241
Quoted 10 lines
Documentation/gpu/drm-internals.rst +10
-0+ --kconfig_add CONFIG_VIRTIO_UML=y \ + --kconfig_add CONFIG_UML_PCI_OVER_VIRTIO=y + +.. note:: + The configuration included in ``.kunitconfig`` should be as generic as + possible. + ``CONFIG_VIRTIO_UML`` and ``CONFIG_UML_PCI_OVER_VIRTIO`` are not + included in it because they are only required for User Mode Linux. + +Maybe also add something like this ?
Quoted 8 lines
For example, the following command can be used to run the test for
x86_64:$ ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/gpu/drm/kunit \ --arch=x86_64Regardless, the patch looks good to me:
Reviewed-by Javier Martinez Canillas <[email protected]>
Hey so since you have a bunch of patches merged into drm already but seem to lack drm-misc commit rights to push these yourself I think it's time to get those:
https://drm.pages.freedesktop.org/maintainer-tools/commit-access.html#drm-misc
And I guess Javier can help you with any questions you might have and make sure the request gets through by poking folks on #dri-devel irc?
Cheers, Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Re: [PATCH v3 3/3] drm/doc: Add KUnit documentation
Hello Daniel,
Quoted 51 lines · Daniel Vetter
Quoted 41 lines · Javier Martinez Canillas
Hello José,
On 6/13/22 19:17, José Expósito wrote:
[snip]
Documentation/gpu/drm-internals.rst Utilities · line 218
Quoted 3 lines
Documentation/gpu/drm-internals.rst +3
-0+KUnit (Kernel unit testing framework) provides a common framework for unit tests +within the Linux kernel. +I think that it will be useful to have a reference to the KUnit kernel doc here, something like the following:
KUnit <https://docs.kernel.org/dev-tools/kunit/index.html>_ (Kernel Unit...Quoted 13 lines
Documentation/gpu/drm-internals.rst +13
-0+This section covers the specifics for the DRM subsystem. For general information +about KUnit, please refer to Documentation/dev-tools/kunit/start.rst. + +How to run the tests? +~~~~~~~~~~~~~~~~~~~~~ + +In order to facilitate running the test suite, a configuration file is present +in ``drivers/gpu/drm/kunit/.kunitconfig``. It can be used by ``kunit.py`` as +follows: + +.. code-block:: bash + + $ ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/gpu/drm/kunit \Documentation/gpu/drm-internals.rst Utilities · line 241
Quoted 10 lines
Documentation/gpu/drm-internals.rst +10
-0+ --kconfig_add CONFIG_VIRTIO_UML=y \ + --kconfig_add CONFIG_UML_PCI_OVER_VIRTIO=y + +.. note:: + The configuration included in ``.kunitconfig`` should be as generic as + possible. + ``CONFIG_VIRTIO_UML`` and ``CONFIG_UML_PCI_OVER_VIRTIO`` are not + included in it because they are only required for User Mode Linux. + +Maybe also add something like this ?
Quoted 8 lines
For example, the following command can be used to run the test for
x86_64:$ ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/gpu/drm/kunit \ --arch=x86_64Regardless, the patch looks good to me:
Reviewed-by Javier Martinez Canillas <[email protected]>
Quoted 9 lines
Hey so since you have a bunch of patches merged into drm already but seem to lack drm-misc commit rights to push these yourself I think it's time to get those:
https://drm.pages.freedesktop.org/maintainer-tools/commit-access.html#drm-misc
And I guess Javier can help you with any questions you might have and make sure the request gets through by poking folks on #dri-devel irc?
Yes, he already requested commit access and got the acks, so I think is just a matter of time until he has this sorted out.
José, please don't hesitate to ask if you need any help or clarification once you have a setup to push your patches. The dim documentation [0] is superb but I know that it can be somewhat stressful the first time :)
[0]: https://drm.pages.freedesktop.org/maintainer-tools/dim.html
--
Best regards,
Javier Martinez Canillas
Linux Engineering
Red Hat
Re: [PATCH v3 3/3] drm/doc: Add KUnit documentation
Hi Javier, Daniel,
Quoted 16 lines · Javier Martinez Canillas
Hello Daniel,
Quoted 12 lines · Daniel Vetter
[...]
Hey so since you have a bunch of patches merged into drm already but seem to lack drm-misc commit rights to push these yourself I think it's time to get those:
https://drm.pages.freedesktop.org/maintainer-tools/commit-access.html#drm-misc
And I guess Javier can help you with any questions you might have and make sure the request gets through by poking folks on #dri-devel irc?
Quoted 6 lines
Yes, he already requested commit access and got the acks, so I think is just a matter of time until he has this sorted out.
José, please don't hesitate to ask if you need any help or clarification once you have a setup to push your patches. The dim documentation [0] is superb but I know that it can be somewhat stressful the first time :)
Thanks for creating my ssh account :D
The tool is really well documented, setting it up was a piece of cake. I pushed the patches to drm-misc-next. The output didn't show any errors or warnings, hopefully meaning that I didn't mess up.
Jose
Quoted 8 lines
[0]: https://drm.pages.freedesktop.org/maintainer-tools/dim.html
--
Best regards,Javier Martinez Canillas
Linux Engineering
Red Hat
Re: [PATCH v3 3/3] drm/doc: Add KUnit documentation
Hello José,
Quoted 26 lines · José Expósito
Hi Javier, Daniel,
Quoted 16 lines · Javier Martinez Canillas
Hello Daniel,
Quoted 12 lines · Daniel Vetter
[...]
Hey so since you have a bunch of patches merged into drm already but seem to lack drm-misc commit rights to push these yourself I think it's time to get those:
https://drm.pages.freedesktop.org/maintainer-tools/commit-access.html#drm-misc
And I guess Javier can help you with any questions you might have and make sure the request gets through by poking folks on #dri-devel irc?
Quoted 6 lines
Yes, he already requested commit access and got the acks, so I think is just a matter of time until he has this sorted out.
José, please don't hesitate to ask if you need any help or clarification once you have a setup to push your patches. The dim documentation [0] is superb but I know that it can be somewhat stressful the first time :)
Quoted 6 lines
Thanks for creating my ssh account :D
The tool is really well documented, setting it up was a piece of cake. I pushed the patches to drm-misc-next. The output didn't show any errors or warnings, hopefully meaning that I didn't mess up.
Awesome! Yes, everything looks correct. Thanks a lot.
--
Best regards,
Javier Martinez Canillas
Linux Engineering
Red Hat
Hi Jose,
for the whole patchset:
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:
Quoted 47 lines
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ósitoRFC -> v1: https://lore.kernel.org/dri-devel/[email protected]/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/[email protected]/T/
Thomas Zimmermann:
- AddDRM_RECT_INIT()macro
- Move tests todrivers/gpu/drm/kunit
- Improve test documentationv2 -> v3: https://lore.kernel.org/dri-devel/[email protected]/T/
- Use designated initializer in
DRM_RECT_INIT(Jani Nikula)
- Simplify the "conversion_buf_size" helper[1] https://lore.kernel.org/dri-devel/[email protected]/T/
José Expósito (3):
drm/rect: AddDRM_RECT_INIT()macro
drm/format-helper: Add KUnit tests fordrm_fb_xrgb8888_to_rgb332()drm/doc: Add KUnit documentationDocumentation/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/.kunitconfigcreate mode 100644drivers/gpu/drm/kunit/Makefilecreate mode 100644drivers/gpu/drm/kunit/drm_format_helper_test.c
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev
Quoted 8 lines · 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
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/[email protected]/T/
Signature · 5 lines
Best regards, Javier Martinez Canillas Linux Engineering Red Hat
Quoted 9 lines · 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
[+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/[email protected]/
[2]: https://lore.kernel.org/dri-devel/[email protected]/
[3]: https://www.kernel.org/doc/html/latest/dev-tools/kunit/style.html
Hi!
Quoted 10 lines · Javier Martinez Canillas
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
kunitsub-directory while they are doing it in atestssub-dir.Also there may be other things that could be made more consistent, like the naming conventions for the tests, suites, etc.
Quoted 4 lines · David Gow
[+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.
Quoted 7 lines
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
Kconfigfile, 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.
Quoted 10 lines
- 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
Kconfigentries, etc. A mix of the separateKconfigfile 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/[email protected]/
Quoted 5 lines
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
Quoted 6 lines
Cheers,
-- David[1]: https://lore.kernel.org/linux-kselftest/[email protected]/
[2]: https://lore.kernel.org/dri-devel/[email protected]/
[3]: https://www.kernel.org/doc/html/latest/dev-tools/kunit/style.html