Re: [PATCH v14 08/28] drm/tests: Add output formats tests

From: Dmitry Baryshkov
Date: Thu May 23 2024 - 05:18:33 EST


On Tue, May 21, 2024 at 12:13:41PM +0200, Maxime Ripard wrote:
> Now that we track the HDMI output format as part of the connector state,
> let's add a few tests to make sure it works as expected.
>
> Reviewed-by: Dave Stevenson <dave.stevenson@xxxxxxxxxxxxxxx>
> Signed-off-by: Maxime Ripard <mripard@xxxxxxxxxx>
> ---
> drivers/gpu/drm/tests/drm_connector_test.c | 99 +++++++++++++++++++++-
> drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 32 +++++++
> 2 files changed, 130 insertions(+), 1 deletion(-)
>
> +
> +KUNIT_ARRAY_PARAM(drm_hdmi_connector_get_output_format_name_valid,
> + drm_hdmi_connector_get_output_format_name_valid_tests,
> + drm_hdmi_connector_get_output_format_name_valid_desc);
> +
> +static void drm_test_drm_hdmi_connector_get_output_format_name_invalid(struct kunit *test)
> +{
> + KUNIT_EXPECT_NULL(test, drm_hdmi_connector_get_output_format_name(4));

Nit: it might be better to use a bigger value here. It's easier to miss
this if other formats get added for whatever reason.

Nevertheless:

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>


> +};
> +
> +static struct kunit_case drm_hdmi_connector_get_output_format_name_tests[] = {
> + KUNIT_CASE_PARAM(drm_test_drm_hdmi_connector_get_output_format_name,
> + drm_hdmi_connector_get_output_format_name_valid_gen_params),
> + KUNIT_CASE(drm_test_drm_hdmi_connector_get_output_format_name_invalid),
> + { }
> +};
> +

--
With best wishes
Dmitry