Skip to contentSkip to conversation

drm/todo: Add entry for using kunit in the subsystem

PATCH Applied Javier Martinez Canillas 4 participants 7 messages May 4, 2022 – May 5, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/todo: Add entry for using kunit in the subsystem

The Kernel Unit Testing (KUnit) framework provides a common framework for unit tests within the Linux kernel. Having a test suite would allow to identify regressions earlier.

---

 Documentation/gpu/todo.rst | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
Documentation/gpu/todo.rst +14 -0
index 127e76ee0b2d..10bfb50908d1 100644
@@ -603,6 +603,20 @@ Level: Advanced
 Better Testing
 ==============
 
+Add unit tests using the Kernel Unit Testing (KUnit) framework
+--------------------------------------------------------------
+
+The `KUnit <https://www.kernel.org/doc/html/latest/dev-tools/kunit/index.html>`_
+provides a common framework for unit tests within the Linux kernel. Having a
+test suite would allow to identify regressions earlier.
+
+A good candidate for the first unit tests are the format-conversion helpers in
+``drm_format_helper.c``.
+
+Contact: Javier Martinez Canillas <[email protected]>
+
+Level: Intermediate
+
 Enable trinity for DRM
 ----------------------
 
Signature · 1 line
2.35.1
#1 lore raw

Hi,

Quoted 21 lines · Javier Martinez Canillas

The Kernel Unit Testing (KUnit) framework provides a common framework for unit tests within the Linux kernel. Having a test suite would allow to identify regressions earlier.

---

 Documentation/gpu/todo.rst | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
Documentation/gpu/todo.rst +3 -0
index 127e76ee0b2d..10bfb50908d1 100644
@@ -603,6 +603,20 @@ Level: Advanced
 Better Testing
 ==============
 
+Add unit tests using the Kernel Unit Testing (KUnit) framework
+--------------------------------------------------------------
+

Documentation/gpu/todo.rst Level: Advanced · line 618

Quoted 10 lines
Documentation/gpu/todo.rst +10 -0
+The `KUnit <https://www.kernel.org/doc/html/latest/dev-tools/kunit/index.html>`_
+provides a common framework for unit tests within the Linux kernel. Having a
+test suite would allow to identify regressions earlier.
+
+A good candidate for the first unit tests are the format-conversion helpers in
+``drm_format_helper.c``.
+
+Contact: Javier Martinez Canillas <[email protected]>
+
+Level: Intermediate

Kunit is fairly easy to grasp if you have some knowledge of other unit testing frameworks already (pytest, cmocka, etc.)

Another good candidate would be to convert (some ?) selftests to kunit. I'm not sure the others, but at least test-drm_cmdline_parser should be fairly easy to convert.

Maxime

#2 lore raw

Hello Maxime,

Thanks for your feedback.

Quoted 21 lines · Maxime Ripard

Hi,

Quoted 18 lines · Javier Martinez Canillas

The Kernel Unit Testing (KUnit) framework provides a common framework for unit tests within the Linux kernel. Having a test suite would allow to identify regressions earlier.

---

 Documentation/gpu/todo.rst | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
Documentation/gpu/todo.rst +0 -0
index 127e76ee0b2d..10bfb50908d1 100644
@@ -603,6 +603,20 @@ Level: Advanced
 Better Testing
 ==============
 
Quoted 17 lines

Documentation/gpu/todo.rst Level: Advanced · line 618

Quoted 13 lines
Documentation/gpu/todo.rst +13 -0
+Add unit tests using the Kernel Unit Testing (KUnit) framework
+--------------------------------------------------------------
+
+The `KUnit <https://www.kernel.org/doc/html/latest/dev-tools/kunit/index.html>`_
+provides a common framework for unit tests within the Linux kernel. Having a
+test suite would allow to identify regressions earlier.
+
+A good candidate for the first unit tests are the format-conversion helpers in
+``drm_format_helper.c``.
+
+Contact: Javier Martinez Canillas <[email protected]>
+
+Level: Intermediate

Kunit is fairly easy to grasp if you have some knowledge of other unit testing frameworks already (pytest, cmocka, etc.)

Yes, I didn't set to intermediate due kunit but rather due the format conversions, since the functions are not easy to read and understand.

And the person writing the unit tests will have to get familiar with the different formats to verify that conversions are done correctly.

Quoted 4 lines

Another good candidate would be to convert (some ?) selftests to kunit. I'm not sure the others, but at least test-drm_cmdline_parser should be fairly easy to convert.

Indeed. Maybe I would add it as a separate entr though, as a follow-up.

Quoted 1 line

Maxime

Signature · 5 lines
Best regards,

Javier Martinez Canillas
Linux Engineering
Red Hat
Acked-by
#3 lore raw
Quoted 50 lines · Javier Martinez Canillas

Hello Maxime,

Thanks for your feedback.

Quoted 21 lines · Maxime Ripard

Hi,

Quoted 18 lines · Javier Martinez Canillas

The Kernel Unit Testing (KUnit) framework provides a common framework for unit tests within the Linux kernel. Having a test suite would allow to identify regressions earlier.

---

 Documentation/gpu/todo.rst | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
Documentation/gpu/todo.rst +0 -0
index 127e76ee0b2d..10bfb50908d1 100644
@@ -603,6 +603,20 @@ Level: Advanced
 Better Testing
 ==============
 
Quoted 17 lines

Documentation/gpu/todo.rst Level: Advanced · line 618

Quoted 13 lines
Documentation/gpu/todo.rst +13 -0
+Add unit tests using the Kernel Unit Testing (KUnit) framework
+--------------------------------------------------------------
+
+The `KUnit <https://www.kernel.org/doc/html/latest/dev-tools/kunit/index.html>`_
+provides a common framework for unit tests within the Linux kernel. Having a
+test suite would allow to identify regressions earlier.
+
+A good candidate for the first unit tests are the format-conversion helpers in
+``drm_format_helper.c``.
+
+Contact: Javier Martinez Canillas <[email protected]>
+
+Level: Intermediate

Kunit is fairly easy to grasp if you have some knowledge of other unit testing frameworks already (pytest, cmocka, etc.)

Yes, I didn't set to intermediate due kunit but rather due the format conversions, since the functions are not easy to read and understand.

And the person writing the unit tests will have to get familiar with the different formats to verify that conversions are done correctly.

Quoted 6 lines
Quoted 4 lines

Another good candidate would be to convert (some ?) selftests to kunit. I'm not sure the others, but at least test-drm_cmdline_parser should be fairly easy to convert.

Indeed. Maybe I would add it as a separate entr though, as a follow-up.

Yeah, that works for me

Maxime

#4 lore raw
In reply to Maxime Ripard
Quoted 38 lines · Maxime Ripard

Hi,

Quoted 21 lines · Javier Martinez Canillas

The Kernel Unit Testing (KUnit) framework provides a common framework for unit tests within the Linux kernel. Having a test suite would allow to identify regressions earlier.

---

 Documentation/gpu/todo.rst | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
Documentation/gpu/todo.rst +3 -0
index 127e76ee0b2d..10bfb50908d1 100644
@@ -603,6 +603,20 @@ Level: Advanced
 Better Testing
 ==============
 
+Add unit tests using the Kernel Unit Testing (KUnit) framework
+--------------------------------------------------------------
+

Documentation/gpu/todo.rst Level: Advanced · line 618

Quoted 10 lines
Documentation/gpu/todo.rst +10 -0
+The `KUnit <https://www.kernel.org/doc/html/latest/dev-tools/kunit/index.html>`_
+provides a common framework for unit tests within the Linux kernel. Having a
+test suite would allow to identify regressions earlier.
+
+A good candidate for the first unit tests are the format-conversion helpers in
+``drm_format_helper.c``.
+
+Contact: Javier Martinez Canillas <[email protected]>
+
+Level: Intermediate

Kunit is fairly easy to grasp if you have some knowledge of other unit testing frameworks already (pytest, cmocka, etc.)

Quoted 3 lines

Another good candidate would be to convert (some ?) selftests to kunit. I'm not sure the others, but at least test-drm_cmdline_parser should be fairly easy to convert.

All the drm selftest should be good candidates for conversion to kunit.

Either way patch is Acked-by: Daniel Vetter <[email protected]>

Cheers, Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
maintainer Acked-by on v1 1/1
#5 lore raw
In reply to Javier Martinez Canillas

Hi

Am 04.05.22 um 10:02 schrieb Javier Martinez Canillas:

Quoted 19 lines

The Kernel Unit Testing (KUnit) framework provides a common framework for unit tests within the Linux kernel. Having a test suite would allow to identify regressions earlier.

---

  Documentation/gpu/todo.rst | 14 ++++++++++++++
  1 file changed, 14 insertions(+)
Documentation/gpu/todo.rst +1 -0
index 127e76ee0b2d..10bfb50908d1 100644
@@ -603,6 +603,20 @@ Level: Advanced
  Better Testing
  ==============
 
+Add unit tests using the Kernel Unit Testing (KUnit) framework

Documentation/gpu/todo.rst Level: Advanced · line 616

Quoted 10 lines
Documentation/gpu/todo.rst +10 -0
+--------------------------------------------------------------
+
+The `KUnit <https://www.kernel.org/doc/html/latest/dev-tools/kunit/index.html>`_
+provides a common framework for unit tests within the Linux kernel. Having a
+test suite would allow to identify regressions earlier.
+
+A good candidate for the first unit tests are the format-conversion helpers in
+``drm_format_helper.c``.
+
+Contact: Javier Martinez Canillas <[email protected]>
Quoted 6 lines
Documentation/gpu/todo.rst +3 -0
+
+Level: Intermediate
+
  Enable trinity for DRM
  ----------------------
 
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
#6 lore raw
In reply to Javier Martinez Canillas
Quoted 6 lines · Javier Martinez Canillas

The Kernel Unit Testing (KUnit) framework provides a common framework for unit tests within the Linux kernel. Having a test suite would allow to identify regressions earlier.

---

Pushed to drm-misc (drm-misc-next). Thanks all!

Signature · 5 lines
Best regards,

Javier Martinez Canillas
Linux Engineering
Red Hat