[igt-dev] [PATCH i-g-t 8/9] tests/kms_lease: Handle new errno from idr/xa double insert

Daniel Vetter daniel.vetter at ffwll.ch
Thu Feb 28 14:19:17 UTC 2019


The conversion from idr to xarray will change the errno for already
inserted object ids from ENOSPC to EBUSY. Allow both.

Cc: Matthew Wilcox <willy at infradead.org>
Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
---
 tests/kms_lease.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/tests/kms_lease.c b/tests/kms_lease.c
index 7d7576cbb634..b5db37c5d58a 100644
--- a/tests/kms_lease.c
+++ b/tests/kms_lease.c
@@ -797,12 +797,16 @@ static void run_test(data_t *data, void (*testfunc)(data_t *))
 		      "no valid crtc/connector combinations found\n");
 }
 
+#define assert_double_id_err(ret) \
+	igt_assert_f((ret) == -EBUSY || (ret) == -ENOSPC, \
+		     "wrong return code %i, %s\n", ret, \
+		     strerror(ret))
 static void invalid_create_leases(data_t *data)
 {
 	uint32_t object_ids[4];
 	struct local_drm_mode_create_lease mcl;
 	drmModeRes *resources;
-	int tmp_fd;
+	int tmp_fd, ret;
 
 	/* empty lease */
 	mcl.object_ids = 0;
@@ -881,7 +885,8 @@ static void invalid_create_leases(data_t *data)
 	object_ids[3] = object_ids[2];
 	mcl.object_count = 4;
 	/* Note: the ENOSPC is from idr double-insertion failing */
-	igt_assert_eq(create_lease(data->master.fd, &mcl), -ENOSPC);
+	ret = create_lease(data->master.fd, &mcl);
+	assert_double_id_err(ret);
 
 	/* no encoder leasing */
 	resources = drmModeGetResources(data->master.fd);
@@ -1094,7 +1099,7 @@ static void implicit_plane_lease(data_t *data)
 	uint32_t object_ids[3];
 	struct local_drm_mode_create_lease mcl;
 	struct local_drm_mode_get_lease mgl;
-
+	int ret;
 	uint32_t cursor_id = igt_pipe_get_plane_type(&data->master.display.pipes[0],
 						     DRM_PLANE_TYPE_CURSOR)->drm_plane->plane_id;
 
@@ -1127,11 +1132,13 @@ static void implicit_plane_lease(data_t *data)
 	/* check that implicit lease doesn't lead to confusion when
 	 * explicitly adding primary plane */
 	mcl.object_count = 3;
-	igt_assert_eq(create_lease(data->master.fd, &mcl), -ENOSPC);
+	ret = create_lease(data->master.fd, &mcl);
+	assert_double_id_err(ret);
 
 	/* same for the cursor */
 	object_ids[2] = cursor_id;
-	igt_assert_eq(create_lease(data->master.fd, &mcl), -ENOSPC);
+	ret = create_lease(data->master.fd, &mcl);
+	assert_double_id_err(ret);
 
 	drmSetClientCap(data->master.fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1);
 }
-- 
2.14.4



More information about the igt-dev mailing list