[igt-dev] [PATCH i-g-t 4/9] tests/kms_release: invalid checks for revoke-lease ioctl

Boris Brezillon boris.brezillon at collabora.com
Thu Mar 14 09:35:02 UTC 2019


On Wed, 20 Feb 2019 17:25:25 +0100
Daniel Vetter <daniel.vetter at ffwll.ch> wrote:

> Found a few corner cases to validate. Put them into the existing
> testcase.
> 
> Cc: Keith Packard <keithp at keithp.com>
> Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>

Reviewed-by: Boris Brezillon <boris.brezillon at collabora.com>

> ---
>  tests/kms_lease.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/tests/kms_lease.c b/tests/kms_lease.c
> index 4062a0b365c9..298d81c71ba9 100644
> --- a/tests/kms_lease.c
> +++ b/tests/kms_lease.c
> @@ -511,6 +511,14 @@ static void lease_revoke(data_t *data)
>  
>  	igt_display_require(&lease.display, lease.fd);
>  
> +	/* try to revoke an invalid lease */
> +	mrl.lessee_id = 0;
> +	igt_assert_eq(revoke_lease(data->master.fd, &mrl), -ENOENT);
> +
> +	/* try to revoke with the wrong fd */
> +	mrl.lessee_id = lease.lessee_id;
> +	igt_assert_eq(revoke_lease(lease.fd, &mrl), -EACCES);
> +
>  	/* Revoke the lease using the master fd */
>  	mrl.lessee_id = lease.lessee_id;
>  	igt_assert_eq(revoke_lease(data->master.fd, &mrl), 0);
> @@ -522,6 +530,10 @@ static void lease_revoke(data_t *data)
>  	igt_assert_eq(ret, -ENOENT);
>  
>  	terminate_lease(&lease);
> +
> +	/* make sure the lease is gone */
> +	mrl.lessee_id = lease.lessee_id;
> +	igt_assert_eq(revoke_lease(data->master.fd, &mrl), -ENOENT);
>  }
>  
>  /* Test leasing objects more than once */



More information about the igt-dev mailing list