[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220929223333.vh6wy45mfx6kccds@nostramo>
Date: Fri, 30 Sep 2022 00:33:33 +0200
From: Michał Winiarski <michal.winiarski@...el.com>
To: Maíra Canal <mcanal@...lia.com>
CC: David Airlie <airlied@...ux.ie>, Daniel Vetter <daniel@...ll.ch>,
"Melissa Wen" <mwen@...lia.com>,
André Almeida <andrealmeid@...lia.com>,
Javier Martinez Canillas <javierm@...hat.com>,
Daniel Latypov <dlatypov@...gle.com>,
David Gow <davidgow@...gle.com>,
"Arthur Grillo" <arthur.grillo@....br>,
Isabella Basso <isabbasso@...eup.net>,
<magalilemes00@...il.com>, <tales.aparecida@...il.com>,
<dri-devel@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 2/2] drm/tests: Split
drm_test_dp_mst_sideband_msg_req_decode into parameterized tests
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@intel.com/
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@...lia.com>
> ---
> v1 -> v2: https://lore.kernel.org/dri-devel/20220925222719.345424-1-mcanal@igalia.com/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(-)
Powered by blists - more mailing lists