mbox series

[v5,0/5] Create tests for the drm_rect functions

Message ID 20230418230146.461129-1-arthurgrillo@riseup.net (mailing list archive)
Headers show
Series Create tests for the drm_rect functions | expand

Message

Arthur Grillo April 18, 2023, 11:01 p.m. UTC
This patchset seeks to add unit tests for the rest of the functions on
the drm_rect.c.

The test coverage report generated by the gcov[1] tool states that this
set reaches 100% of coverage on the drm_rect.c file. This would be
very good for future development on the file.

If you want to see the coverage report, I uploaded on the link below:
https://grillo-0.github.io/coverage-reports/more-rect-tests/drivers/gpu/drm/drm_rect.c.gcov.html

Thanks for reviewing!

Best regards,
~Arthur Grillo

---

v1->v2: https://lore.kernel.org/all/20230322140701.69852-1-arthurgrillo@riseup.net/
- Create parameterized tests for drm_rect_intersect().
- Use .16 binary fixed point values on the drm_rect_calc_hscale() and
  drm_rect_calc_vscale() tests.
- Replace INT_MIN for 0 on the on the drm_rect_calc_hscale() and
  drm_rect_calc_vscale() tests.
- Assign nonzero values to the width and height parameters of the
  drm_rect_rotate() and drm_rect_rotate_inv() tests.
- Switch memcpy to a simple variable assignment on the drm_rect_rotate()
  and drm_rect_rotate_inv() tests.

v2->v3: https://lore.kernel.org/all/20230327133848.5250-1-arthurgrillo@riseup.net/
- Change "x" to lowercase on the drm_rect_intersect() cases.
- Remove the option for no description on the drm_rect_intersect() cases.
- Add a test for rects with zero height and width on the
  drm_rect_intersect().
- Switch to parameterized tests for drm_rect_calc_hscale() and
  drm_rect_calc_vscale().
- Add a test for a dst drm_rect with zero width for
  drm_rect_calc_hscale() and zero height for drm_rect_calc_vscale().
- Place an "-" on the drm_rect_rotate case names to match the userspace.
- s/drm_rect_case_desc/drm_rect_rotate_case_desc/
- Improve the commit messages.

v3->v4: https://lore.kernel.org/all/20230404184158.26290-1-arthurgrillo@riseup.net/
- Place parenthesis around .16 fixed point values before making it
  negative to avoid error when generating tests coverages.

v4->v5: https://lore.kernel.org/all/20230406115338.36228-1-arthurgrillo@riseup.net/
- Use the same parameters for drm_rect_calc_hscale() and
  drm_rect_calc_vscale() by scaling both sides at the same time.
- Place nonzero values for .x1 and .y1 on the drm_rect_rotate() test
  cases.

---

[1]: https://gcc.gnu.org/onlinedocs/gcc/Gcov.html#Gcov

---

Arthur Grillo (5):
  drm/tests: Add test cases for drm_rect_intersect()
  drm/tests: Add test cases for drm_rect_calc_hscale()
  drm/tests: Add test cases for drm_rect_calc_vscale()
  drm/tests: Add test cases for drm_rect_rotate()
  drm/test: Add test cases for drm_rect_rotate_inv()

 drivers/gpu/drm/tests/drm_rect_test.c | 315 ++++++++++++++++++++++++++
 1 file changed, 315 insertions(+)

Comments

Maíra Canal April 24, 2023, 8 p.m. UTC | #1
On 4/18/23 20:01, Arthur Grillo wrote:
> This patchset seeks to add unit tests for the rest of the functions on
> the drm_rect.c.
> 
> The test coverage report generated by the gcov[1] tool states that this
> set reaches 100% of coverage on the drm_rect.c file. This would be
> very good for future development on the file.
> 
> If you want to see the coverage report, I uploaded on the link below:
> https://grillo-0.github.io/coverage-reports/more-rect-tests/drivers/gpu/drm/drm_rect.c.gcov.html
> 
> Thanks for reviewing!
> 
> Best regards,
> ~Arthur Grillo

I just applied the series to drm/drm-misc (drm-misc-next).

Thanks for improving the tests!

Best Regards,
- Maíra Canal

> 
> ---
> 
> v1->v2: https://lore.kernel.org/all/20230322140701.69852-1-arthurgrillo@riseup.net/
> - Create parameterized tests for drm_rect_intersect().
> - Use .16 binary fixed point values on the drm_rect_calc_hscale() and
>    drm_rect_calc_vscale() tests.
> - Replace INT_MIN for 0 on the on the drm_rect_calc_hscale() and
>    drm_rect_calc_vscale() tests.
> - Assign nonzero values to the width and height parameters of the
>    drm_rect_rotate() and drm_rect_rotate_inv() tests.
> - Switch memcpy to a simple variable assignment on the drm_rect_rotate()
>    and drm_rect_rotate_inv() tests.
> 
> v2->v3: https://lore.kernel.org/all/20230327133848.5250-1-arthurgrillo@riseup.net/
> - Change "x" to lowercase on the drm_rect_intersect() cases.
> - Remove the option for no description on the drm_rect_intersect() cases.
> - Add a test for rects with zero height and width on the
>    drm_rect_intersect().
> - Switch to parameterized tests for drm_rect_calc_hscale() and
>    drm_rect_calc_vscale().
> - Add a test for a dst drm_rect with zero width for
>    drm_rect_calc_hscale() and zero height for drm_rect_calc_vscale().
> - Place an "-" on the drm_rect_rotate case names to match the userspace.
> - s/drm_rect_case_desc/drm_rect_rotate_case_desc/
> - Improve the commit messages.
> 
> v3->v4: https://lore.kernel.org/all/20230404184158.26290-1-arthurgrillo@riseup.net/
> - Place parenthesis around .16 fixed point values before making it
>    negative to avoid error when generating tests coverages.
> 
> v4->v5: https://lore.kernel.org/all/20230406115338.36228-1-arthurgrillo@riseup.net/
> - Use the same parameters for drm_rect_calc_hscale() and
>    drm_rect_calc_vscale() by scaling both sides at the same time.
> - Place nonzero values for .x1 and .y1 on the drm_rect_rotate() test
>    cases.
> 
> ---
> 
> [1]: https://gcc.gnu.org/onlinedocs/gcc/Gcov.html#Gcov
> 
> ---
> 
> Arthur Grillo (5):
>    drm/tests: Add test cases for drm_rect_intersect()
>    drm/tests: Add test cases for drm_rect_calc_hscale()
>    drm/tests: Add test cases for drm_rect_calc_vscale()
>    drm/tests: Add test cases for drm_rect_rotate()
>    drm/test: Add test cases for drm_rect_rotate_inv()
> 
>   drivers/gpu/drm/tests/drm_rect_test.c | 315 ++++++++++++++++++++++++++
>   1 file changed, 315 insertions(+)
>