diff options
author | Apoorva Singh <apoorva1.singh@intel.com> | 2020-09-16 19:58:22 +0530 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2020-09-16 15:50:28 +0100 |
commit | 0ec962017c8131de14e0cb038f7f76b1f17ed637 (patch) | |
tree | 85fc3065a8121d2840e73e4fbd2c6dd73cc150ef | |
parent | 38d5e4b4c2ae375ac90b3e92082d06f9ba1de80c (diff) |
i915/gem_mmap: Modified offset in subtest "bad-size"
Subtest "bad-size" should keep valid/good offset
corresponding to buffer object being mapped.
Currently, subtest will pass for any value of size
provided as the offset value itself will not allow
to map any size of memory which defies the purpose
of this subtest.
The subtest should not pass due to bad offset value
while it should pass only due to bad size provided.
v2: Added new offset. Updated the same changes in
"bad-size" subtest of gem_mmap_wc too.
Signed-off-by: Apoorva Singh <apoorva1.singh@intel.com>
Cc: Melkaveri, Arjun <arjun.melkaveri@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Priyanka Dandamudi <priyanka.dandamudi@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | tests/i915/gem_mmap.c | 25 | ||||
-rw-r--r-- | tests/i915/gem_mmap_wc.c | 26 |
2 files changed, 32 insertions, 19 deletions
diff --git a/tests/i915/gem_mmap.c b/tests/i915/gem_mmap.c index f8cf052e3..8bad9b14e 100644 --- a/tests/i915/gem_mmap.c +++ b/tests/i915/gem_mmap.c @@ -214,18 +214,25 @@ igt_main 2 * 4096, ~0, }; + uint64_t offset[] = { + 4096, + 0 + }; - for (int i = 0; i < ARRAY_SIZE(bad_size); i++) { - struct drm_i915_gem_mmap arg = { - .handle = gem_create(fd, 4096), - .offset = 4096, - .size = bad_size[i], - }; + for(int i = 0; i < ARRAY_SIZE(offset); i++) { + for (int j = 0; j < ARRAY_SIZE(bad_size); j++) { + struct drm_i915_gem_mmap arg = { + .handle = gem_create(fd, 4096), + .offset = offset[i], + .size = bad_size[j], + }; - igt_debug("Trying to mmap bad size; size: %'"PRIu64"\n", bad_size[i]); - igt_assert_eq(mmap_ioctl(fd, &arg), -EINVAL); + igt_debug("Trying to mmap bad size; size: %'"PRIu64", offset: %'"PRIu64"\n", + bad_size[j], offset[i]); + igt_assert_eq(mmap_ioctl(fd, &arg), -EINVAL); - gem_close(fd, arg.handle); + gem_close(fd, arg.handle); + } } } diff --git a/tests/i915/gem_mmap_wc.c b/tests/i915/gem_mmap_wc.c index f44b406de..fe1283e5e 100644 --- a/tests/i915/gem_mmap_wc.c +++ b/tests/i915/gem_mmap_wc.c @@ -563,17 +563,23 @@ igt_main 2 * 4096, ~0, }; + uint64_t offset[] = { + 4096, + 0 + }; - for (int i = 0; i < ARRAY_SIZE(bad_size); i++) { - struct drm_i915_gem_mmap arg = { - .handle = gem_create(fd, 4096), - .offset = 4096, - .size = bad_size[i], - .flags = I915_MMAP_WC, - }; - - igt_assert_eq(mmap_ioctl(fd, &arg), -EINVAL); - gem_close(fd, arg.handle); + for(int i = 0; i < ARRAY_SIZE(offset); i++) { + for (int j = 0; j < ARRAY_SIZE(bad_size); j++) { + struct drm_i915_gem_mmap arg = { + .handle = gem_create(fd, 4096), + .offset = offset[i], + .size = bad_size[j], + .flags = I915_MMAP_WC, + }; + + igt_assert_eq(mmap_ioctl(fd, &arg), -EINVAL); + gem_close(fd, arg.handle); + } } } |