[igt-dev] [PATCH i-g-t v2 2/2] tests/i915/gem_mmap: fix bad-object tests error value

Simon Ser simon.ser at intel.com
Fri May 31 12:07:23 UTC 2019


These tests checked for EINVAL, but the correct error value is ENOENT, as
pointed out by Chris Wilson:

commit bf79cb914dbfe848add8bb76cbb8ff89110d29ff
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Aug 4 14:19:46 2010 +0100

    drm: Use ENOENT consistently for the error return for an unmatched handle.

    This is consistent with trying to access a filename that not exist
    within a directory which is a good analogy here. The main reason for the
    change is that it is easy to confuse the error code of EBADF as an
    performing an ioctl on an invalid file descriptor (rather than an
    unknown object).

    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

This commit fixes the two bad tests (the gem_mmap_gtt test already checks for
ENOENT).

Signed-off-by: Simon Ser <simon.ser at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
---
 tests/i915/gem_mmap.c    | 2 +-
 tests/i915/gem_mmap_wc.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/i915/gem_mmap.c b/tests/i915/gem_mmap.c
index c96aa2c0a7a5..f8cf052e3cc5 100644
--- a/tests/i915/gem_mmap.c
+++ b/tests/i915/gem_mmap.c
@@ -173,7 +173,7 @@ igt_main
 			};
 
 			igt_debug("Trying MMAP IOCTL with handle %x\n", handles[i]);
-			igt_assert_eq(mmap_ioctl(fd, &arg), -EINVAL);
+			igt_assert_eq(mmap_ioctl(fd, &arg), -ENOENT);
 		}
 
 		gem_close(fd, real_handle);
diff --git a/tests/i915/gem_mmap_wc.c b/tests/i915/gem_mmap_wc.c
index 63538f791aae..c9e5bf23b868 100644
--- a/tests/i915/gem_mmap_wc.c
+++ b/tests/i915/gem_mmap_wc.c
@@ -510,7 +510,7 @@ igt_main
 				.size = 4096,
 				.flags = I915_MMAP_WC,
 			};
-			igt_assert_eq(mmap_ioctl(fd, &arg), -EINVAL);
+			igt_assert_eq(mmap_ioctl(fd, &arg), -ENOENT);
 		}
 
 		gem_close(fd, real_handle);
-- 
2.21.0



More information about the igt-dev mailing list