[igt-dev] [PATCH i-g-t v4 01/25] i915/gem_mmap: Modified offset in subtest "bad-size"

Grzegorzek, Dominik dominik.grzegorzek at intel.com
Tue Sep 22 11:56:45 UTC 2020


Added to this series by mistake. Please Ignore.
On Tue, 2020-09-22 at 13:52 +0200, Dominik Grzegorzek wrote:
> From: Apoorva Singh <apoorva1.singh at intel.com>
> 
> 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 at intel.com>
> Cc: Melkaveri, Arjun <arjun.melkaveri at intel.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Priyanka Dandamudi <priyanka.dandamudi at intel.com>
> Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
>  tests/i915/gem_mmap.c    | 25 ++++++++++++++++---------
>  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 f8cf052e..8bad9b14 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 f44b406d..fe1283e5 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);
> +			}
>  		}
>  	}



More information about the igt-dev mailing list