[PATCH i-g-t v3 22/41] tests/vkms_configfs: Test enablement without pipeline items
Louis Chauvet
louis.chauvet at bootlin.com
Wed Jul 16 09:53:29 UTC 2025
Le 15/07/2025 à 12:24, José Expósito a écrit :
> It shouldn't be possible to enable a device without creating and
> attaching its pipeline items.
>
> Test that the device is not enabled and also that no actual device was
> created using libdrm.
>
> Signed-off-by: José Expósito <jose.exposito89 at gmail.com>
Reviewed-by: Louis Chauvet <louis.chauvet at bootlin.com>
> ---
> tests/vkms/vkms_configfs.c | 39 ++++++++++++++++++++++++++++++++++++++
> 1 file changed, 39 insertions(+)
>
> diff --git a/tests/vkms/vkms_configfs.c b/tests/vkms/vkms_configfs.c
> index c36a795d6..c2cb9dbc0 100644
> --- a/tests/vkms/vkms_configfs.c
> +++ b/tests/vkms/vkms_configfs.c
> @@ -22,6 +22,7 @@
>
> #include "drmtest.h"
> #include "igt.h"
> +#include "igt_device_scan.h"
> #include "igt_vkms.h"
>
> struct invalid_value {
> @@ -117,6 +118,20 @@ static bool attach(const char *src_path, const char *dst_path,
> return ret == 0;
> }
>
> +static bool find_device(const char *name, struct igt_device_card *card)
> +{
> + igt_devices_scan();
> +
> + return igt_device_find_card_by_sysname(name, card);
> +}
> +
> +static bool device_exists(const char *name)
> +{
> + struct igt_device_card card;
> +
> + return find_device(name, &card);
> +}
> +
> /**
> * SUBTEST: device-default-files
> * Description: Test that creating a VKMS device creates the default files and
> @@ -774,6 +789,29 @@ static void test_attach_connector_to_encoder(void)
> igt_vkms_device_destroy(dev2);
> }
>
> +/**
> + * SUBTEST: enable-no-pipeline-items
> + * Description: Try to enable a VKMS device without adding any pipeline items
> + * and test that it fails.
> + */
> +
> +static void test_enable_no_pipeline_items(void)
> +{
> + igt_vkms_t *dev;
> +
> + dev = igt_vkms_device_create(__func__);
> + igt_assert(dev);
> +
> + /* Try to enable it and check that the device is not set as enabled */
> + igt_vkms_device_set_enabled(dev, true);
> + igt_assert(!igt_vkms_device_is_enabled(dev));
> +
> + /* Check that no actual device was created*/
> + igt_assert(!device_exists(__func__));
> +
> + igt_vkms_device_destroy(dev);
> +}
> +
> igt_main
> {
> struct {
> @@ -799,6 +837,7 @@ igt_main
> { "attach-plane-to-crtc", test_attach_plane_to_crtc },
> { "attach-encoder-to-crtc", test_attach_encoder_to_crtc },
> { "attach-connector-to-encoder", test_attach_connector_to_encoder },
> + { "enable-no-pipeline-items", test_enable_no_pipeline_items },
> };
>
> igt_fixture {
--
Louis Chauvet, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
More information about the igt-dev
mailing list