[PATCH i-g-t v3 14/41] lib/vkms: Test connector default files

Louis Chauvet louis.chauvet at bootlin.com
Wed Jul 16 09:34:04 UTC 2025



Le 15/07/2025 à 12:24, José Expósito a écrit :
> Add a helper to create a connector and a test checking that the default
> files and directories are created.
> 
> Signed-off-by: José Expósito <jose.exposito89 at gmail.com>

Reviewed-by: Louis Chauvet <louis.chauvet at bootlin.com>

> ---
>   lib/igt_vkms.c             | 27 +++++++++++++++++++++++++++
>   lib/igt_vkms.h             |  4 ++++
>   tests/vkms/vkms_configfs.c | 33 +++++++++++++++++++++++++++++++++
>   3 files changed, 64 insertions(+)
> 
> diff --git a/lib/igt_vkms.c b/lib/igt_vkms.c
> index ed28adf9b..eecad1977 100644
> --- a/lib/igt_vkms.c
> +++ b/lib/igt_vkms.c
> @@ -273,6 +273,21 @@ void igt_vkms_get_encoder_path(igt_vkms_t *dev, const char *name, char *path,
>   	get_pipeline_item_path(dev, VKMS_PIPELINE_ITEM_ENCODER, name, path, len);
>   }
>   
> +/**
> + * igt_vkms_get_connector_path:
> + * @dev: Device containing the connector
> + * @name: Connector name
> + * @path: Output path
> + * @len: Maximum @path length
> + *
> + * Returns the connector path.
> + */
> +void igt_vkms_get_connector_path(igt_vkms_t *dev, const char *name, char *path,
> +				 size_t len)
> +{
> +	get_pipeline_item_path(dev, VKMS_PIPELINE_ITEM_CONNECTOR, name, path, len);
> +}
> +
>   /**
>    * igt_vkms_device_create:
>    * @name: VKMS device name
> @@ -554,3 +569,15 @@ void igt_vkms_device_add_encoder(igt_vkms_t *dev, const char *name)
>   {
>   	add_pipeline_item(dev, VKMS_PIPELINE_ITEM_ENCODER, name);
>   }
> +
> +/**
> + * igt_vkms_device_add_connector:
> + * @dev: Device to add the connector to
> + * @name: Connector name
> + *
> + * Add a new connector to the VKMS device.
> + */
> +void igt_vkms_device_add_connector(igt_vkms_t *dev, const char *name)
> +{
> +	add_pipeline_item(dev, VKMS_PIPELINE_ITEM_CONNECTOR, name);
> +}
> diff --git a/lib/igt_vkms.h b/lib/igt_vkms.h
> index aa6ff513d..6dd576b41 100644
> --- a/lib/igt_vkms.h
> +++ b/lib/igt_vkms.h
> @@ -33,6 +33,8 @@ void igt_vkms_get_crtc_writeback_path(igt_vkms_t *dev, const char *name,
>   				      char *path, size_t len);
>   void igt_vkms_get_encoder_path(igt_vkms_t *dev, const char *name, char *path,
>   			       size_t len);
> +void igt_vkms_get_connector_path(igt_vkms_t *dev, const char *name, char *path,
> +				 size_t len);
>   
>   igt_vkms_t *igt_vkms_device_create(const char *name);
>   void igt_vkms_device_destroy(igt_vkms_t *dev);
> @@ -52,4 +54,6 @@ void igt_vkms_crtc_set_writeback_enabled(igt_vkms_t *dev, const char *name,
>   
>   void igt_vkms_device_add_encoder(igt_vkms_t *dev, const char *name);
>   
> +void igt_vkms_device_add_connector(igt_vkms_t *dev, const char *name);
> +
>   #endif /* __IGT_VKMS_H__ */
> diff --git a/tests/vkms/vkms_configfs.c b/tests/vkms/vkms_configfs.c
> index 8939ef611..595d258f6 100644
> --- a/tests/vkms/vkms_configfs.c
> +++ b/tests/vkms/vkms_configfs.c
> @@ -434,6 +434,38 @@ static void test_encoder_default_files(void)
>   	igt_vkms_device_destroy(dev);
>   }
>   
> +/**
> + * SUBTEST: connector-default-files
> + * Description: Test that creating a connector creates the default files and
> + *              directories.
> + */
> +
> +static void test_connector_default_files(void)
> +{
> +	igt_vkms_t *dev;
> +	char path[PATH_MAX];
> +
> +	const char *files[] = {
> +		"status",
> +	};
> +
> +	const char *dirs[] = {
> +		"possible_encoders",
> +	};
> +
> +	dev = igt_vkms_device_create(__func__);
> +	igt_assert(dev);
> +
> +	igt_vkms_device_add_connector(dev, "connector0");
> +	igt_vkms_get_connector_path(dev, "connector0", path, sizeof(path));
> +
> +	assert_default_files(path,
> +			     files, ARRAY_SIZE(files),
> +			     dirs, ARRAY_SIZE(dirs));
> +
> +	igt_vkms_device_destroy(dev);
> +}
> +
>   igt_main
>   {
>   	struct {
> @@ -452,6 +484,7 @@ igt_main
>   		{ "crtc-wrong-values", test_crtc_wrong_values },
>   		{ "crtc-valid-values", test_crtc_valid_values },
>   		{ "encoder-default-files", test_encoder_default_files },
> +		{ "connector-default-files", test_connector_default_files },
>   	};
>   
>   	igt_fixture {

-- 
Louis Chauvet, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com



More information about the igt-dev mailing list