diff mbox

[i-g-t,v2,2/4] gem_create: Test huge object creation

Message ID 20170418102934.8608-1-tvrtko.ursulin@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tvrtko Ursulin April 18, 2017, 10:29 a.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Verify that we reject attempts to create object larger than
INT_MAX * PAGE_SIZE since i915 currently cannot support that.

Also removed the skip on simulation since I don't know why
would that be needed here.

v2: Removed basic tag and adjusted commit msg.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 tests/gem_create.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Chris Wilson April 18, 2017, 10:50 a.m. UTC | #1
On Tue, Apr 18, 2017 at 11:29:34AM +0100, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> Verify that we reject attempts to create object larger than
> INT_MAX * PAGE_SIZE since i915 currently cannot support that.
> 
> Also removed the skip on simulation since I don't know why
> would that be needed here.
> 
> v2: Removed basic tag and adjusted commit msg.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  tests/gem_create.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/gem_create.c b/tests/gem_create.c
> index de7b82094545..844ae8ce86cb 100644
> --- a/tests/gem_create.c
> +++ b/tests/gem_create.c
> @@ -44,6 +44,7 @@
>  #include <sys/stat.h>
>  #include <sys/time.h>
>  #include <getopt.h>
> +#include <limits.h>
>  
>  #include <drm.h>
>  
> @@ -95,10 +96,13 @@ static void invalid_flag_test(int fd)
>  
>  static void invalid_size_test(int fd)
>  {
> -	int handle;
> +	uint32_t handle;
>  
>  	handle = __gem_create(fd, 0);
>  	igt_assert(!handle);
> +
> +	handle = __gem_create(fd, INT_MAX * 4096UL + 1);
> +	igt_assert(!handle);

I'm still not going to agree this is the correct behaviour. That it no
longer triggers the warn will be sufficient for you and Daniel without
enshrining a known bug.
-Chris
diff mbox

Patch

diff --git a/tests/gem_create.c b/tests/gem_create.c
index de7b82094545..844ae8ce86cb 100644
--- a/tests/gem_create.c
+++ b/tests/gem_create.c
@@ -44,6 +44,7 @@ 
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <getopt.h>
+#include <limits.h>
 
 #include <drm.h>
 
@@ -95,10 +96,13 @@  static void invalid_flag_test(int fd)
 
 static void invalid_size_test(int fd)
 {
-	int handle;
+	uint32_t handle;
 
 	handle = __gem_create(fd, 0);
 	igt_assert(!handle);
+
+	handle = __gem_create(fd, INT_MAX * 4096UL + 1);
+	igt_assert(!handle);
 }
 
 /*
@@ -146,8 +150,6 @@  igt_main
 {
 	int fd = -1;
 
-	igt_skip_on_simulation();
-
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_INTEL);
 	}