Re: [PATCH v2 2/2] drm/tests: Split drm_test_dp_mst_sideband_msg_req_decode into parameterized tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 27, 2022 at 07:12:06PM -0300, Maíra Canal wrote:
> The drm_test_dp_mst_sideband_msg_req_decode repeats the same test
> structure with different parameters. This could be better represented
> by parameterized tests, provided by KUnit.
> 
> In order to convert the tests to parameterized tests, the test case for
> the client ID was changed: instead of using get_random_bytes to generate
> the client ID, the client ID is now hardcoded in the test case.

Generally "random" usage is not incompatible with parameterized tests, we can
create parameterized tests that use random data.
The idea is to pass a function that generates the actual param (where we have a
pointer to function as one of the members in "params" struct).

For example, see "random_dp_query_enc_client_id" usage here:
https://lore.kernel.org/dri-devel/20220117232259.180459-7-michal.winiarski@xxxxxxxxx/

In this case, we just compare data going in with data going out (and the data
itself is not transformed in any way), so it doesn't really matter for coverage
and we can hardcode.

-Michał

> So, convert drm_test_dp_mst_sideband_msg_req_decode into parameterized
> tests and make the tests' allocations and prints completely managed by KUnit.
> 
> Signed-off-by: Maíra Canal <mcanal@xxxxxxxxxx>
> ---
> v1 -> v2: https://lore.kernel.org/dri-devel/20220925222719.345424-1-mcanal@xxxxxxxxxx/T/#m056610a23a63109484afeafefb5846178c4d36b2
> - Mention on the commit message the change on the test case for the client ID (Michał Winiarski).
> ---
>  .../gpu/drm/tests/drm_dp_mst_helper_test.c    | 370 ++++++++++++------
>  1 file changed, 243 insertions(+), 127 deletions(-)



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux