[igt-dev] [PATCH i-g-t 2/2] tests/kms_addfb_basic: Relax errno assertions

Jeremy Cline jcline at redhat.com
Fri Nov 13 16:49:40 UTC 2020


This adjusts the check on failed calls to DRM_IOCTL_MODE_ADDFB2 in
various scenarios. According to the kernel's
drm_mode_config_funcs.fb_create documentation, a negative return code is
all that is required to signal failure, and different drivers return
different errors in these scenarios.

Particularly, Nouveau returns -ERANGE rather than -EINVAL in scenarios
where the buffer is too small for the proposed configuration.

Signed-off-by: Jeremy Cline <jcline at redhat.com>
---
 tests/kms_addfb_basic.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c
index 0ec583fe..b284bfc1 100644
--- a/tests/kms_addfb_basic.c
+++ b/tests/kms_addfb_basic.c
@@ -282,7 +282,7 @@ static void pitch_tests(int fd)
 		igt_subtest_f("bad-pitch-%i", bad_pitches[i]) {
 			f.pitches[0] = bad_pitches[i];
 			igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f) == -1 &&
-				   errno == EINVAL);
+				   errno != 0);
 		}
 	}
 
@@ -413,11 +413,11 @@ static void size_tests(int fd)
 	f_8.width++;
 	igt_subtest("too-wide") {
 		igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f) == -1 &&
-			   errno == EINVAL);
+			   errno != 0);
 		igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f_16) == -1 &&
-			   errno == EINVAL);
+			   errno != 0);
 		igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f_8) == -1 &&
-			   errno == EINVAL);
+			   errno != 0);
 	}
 	f.width--;
 	f_16.width--;
@@ -427,17 +427,17 @@ static void size_tests(int fd)
 	f_8.height++;
 	igt_subtest("too-high") {
 		igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f) == -1 &&
-			   errno == EINVAL);
+			   errno != 0);
 		igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f_16) == -1 &&
-			   errno == EINVAL);
+			   errno != 0);
 		igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f_8) == -1 &&
-			   errno == EINVAL);
+			   errno != 0);
 	}
 
 	f.handles[0] = gem_bo_small;
 	igt_subtest("bo-too-small") {
 		igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f) == -1 &&
-			   errno == EINVAL);
+			   errno != 0);
 	}
 
 	/* Just to check that the parameters would work. */
-- 
2.28.0



More information about the igt-dev mailing list