[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-igt-dev
Subject:    [igt-dev] [PATCH i-g-t v2 2/2] tests/i915/gem_mmap: fix bad-object tests error value
From:       Simon Ser <simon.ser () intel ! com>
Date:       2019-05-31 12:07:23
Message-ID: 20190531120723.23889-2-simon.ser () intel ! com
[Download RAW message or body]

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

commit bf79cb914dbfe848add8bb76cbb8ff89110d29ff
Author: Chris Wilson <chris@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@chris-wilson.co.uk>
    Signed-off-by: Dave Airlie <airlied@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@intel.com>
Cc: Chris Wilson <chris@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

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic