Quoting Joonas Lahtinen (2017-10-03 12:47:33)
> Merge the remaining testing coverage delta from gem_bad_length and
> check that creating an object of zero size fails with -EINVAL.
> 
> Suggested-by: Daniele Ceraolo Spurio <[email protected]>
> Signed-off-by: Joonas Lahtinen <[email protected]>
> Cc: Daniele Ceraolo Spurio <[email protected]>
> Cc: Chris Wilson <[email protected]>
> ---
>  tests/gem_create.c | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/tests/gem_create.c b/tests/gem_create.c
> index de7b8209..655f7a4e 100644
> --- a/tests/gem_create.c
> +++ b/tests/gem_create.c
> @@ -70,17 +70,18 @@ struct local_i915_gem_create_v2 {
>         uint32_t pad;
>  #define I915_CREATE_PLACEMENT_STOLEN (1<<0)
>         uint32_t flags;
> -} create;
> +};
>  
>  #define LOCAL_IOCTL_I915_GEM_CREATE       DRM_IOWR(DRM_COMMAND_BASE + 
> DRM_I915_GEM_CREATE, struct local_i915_gem_create_v2)
>  
>  static void invalid_flag_test(int fd)
>  {
> +       struct local_i915_gem_create_v2 create;
>         int ret;
>  
>         gem_require_stolen_support(fd);
>  
> -       create.handle = 0;
> +       CLEAR(create);
>         create.size = PAGE_SIZE;
>         create.flags = ~I915_CREATE_PLACEMENT_STOLEN;
>         ret = drmIoctl(fd, LOCAL_IOCTL_I915_GEM_CREATE, &create);
> @@ -95,10 +96,13 @@ static void invalid_flag_test(int fd)

First chunk, 
Reviewed-by: Chris Wilson <[email protected]>

Second chunk, I think we should fix __gem_create() to follow the
convention of returning the error code.
-Chris

>  static void invalid_size_test(int fd)
>  {
> -       int handle;
> +       struct i915_gem_create create;
> +
> +       CLEAR(create);
> +       create.size = 0;
> +       igt_assert_eq(igt_ioctl(fd, IOCTL_I915_GEM_CREATE, &create), -1);
>  
> -       handle = __gem_create(fd, 0);
> -       igt_assert(!handle);
> +       igt_assert_eq(errno, EINVAL);
>  }
>  
>  /*
> -- 
> 2.13.6
> 
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to