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

Daniel Vetter daniel.vetter at ffwll.ch
Wed Feb 20 16:25:25 UTC 2019


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>
---
 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 */
-- 
2.14.4



More information about the igt-dev mailing list