diff mbox

[i-g-t,v3] tests/gem_reset_stats: Fix retrieval of hangcheck stats expectation

Message ID 20180116205651.9076-1-antonio.argenziano@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Antonio Argenziano Jan. 16, 2018, 8:56 p.m. UTC
The test expected IOCTL 'I915_GET_RESET_STATS' would return an error
when not root. That is no longer true in the driver since commit
4c9c0d09741d ("drm/i915: Fix retrieval of hangcheck stats") and therefore
the test was incorrectly failing.

v2:
	- Add the commit that changed the behaviour in the Driver to the
	  commit message. (Michel)

v3:
	- Reuse get_reset_count instead of implementing a new function.
	  (Michel)

Cc: Michel Thierry <michel.thierry@intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com>
---
 tests/gem_reset_stats.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

Comments

Michel Thierry Jan. 16, 2018, 9:43 p.m. UTC | #1
On 1/16/2018 12:56 PM, Antonio Argenziano wrote:
> The test expected IOCTL 'I915_GET_RESET_STATS' would return an error
> when not root. That is no longer true in the driver since commit
> 4c9c0d09741d ("drm/i915: Fix retrieval of hangcheck stats") and therefore
> the test was incorrectly failing.
> 
> v2:
> 	- Add the commit that changed the behaviour in the Driver to the
> 	  commit message. (Michel)
> 
> v3:
> 	- Reuse get_reset_count instead of implementing a new function.
> 	  (Michel)
> 
> Cc: Michel Thierry <michel.thierry@intel.com>
> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com>
> ---
>   tests/gem_reset_stats.c | 14 ++++++--------
>   1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/tests/gem_reset_stats.c b/tests/gem_reset_stats.c
> index edc40767..17a9b648 100644
> --- a/tests/gem_reset_stats.c
> +++ b/tests/gem_reset_stats.c
> @@ -605,10 +605,7 @@ static void test_reset_count(const struct intel_execution_engine *e,
>   
>   		c2 = get_reset_count(fd, ctx);
>   
> -		if (ctx == 0)
> -			igt_assert(c2 == -EPERM);
> -		else
> -			igt_assert(c2 == 0);
> +		igt_assert(c2 == 0);
>   	}
>   
>   	igt_waitchildren();
> @@ -644,10 +641,11 @@ static void _check_param_ctx(const int fd, const int ctx, const cap_t cap)
>   	const uint32_t bad = rand() + 1;
>   
>   	if (ctx == 0) {
> -		if (cap == root)
> -			igt_assert_eq(_test_params(fd, ctx, 0, 0), 0);
> -		else
> -			igt_assert_eq(_test_params(fd, ctx, 0, 0), -EPERM);
> +		igt_assert_eq(_test_params(fd, ctx, 0, 0), 0);
> +
> +		if (cap != root) {
> +			igt_assert(get_reset_count(fd, ctx) == 0);
> +		}
>   	}
>   
>   	igt_assert_eq(_test_params(fd, ctx, 0, bad), -EINVAL);
> 

This matches the driver's current behavior, which is better than testing 
for something that is no longer true. Based on that,

Reviewed-by: Michel Thierry <michel.thierry@intel.com>
Daniel Vetter Jan. 17, 2018, 10:05 a.m. UTC | #2
On Tue, Jan 16, 2018 at 12:56:51PM -0800, Antonio Argenziano wrote:
> The test expected IOCTL 'I915_GET_RESET_STATS' would return an error
> when not root. That is no longer true in the driver since commit
> 4c9c0d09741d ("drm/i915: Fix retrieval of hangcheck stats") and therefore
> the test was incorrectly failing.
> 
> v2:
> 	- Add the commit that changed the behaviour in the Driver to the
> 	  commit message. (Michel)
> 
> v3:
> 	- Reuse get_reset_count instead of implementing a new function.
> 	  (Michel)
> 
> Cc: Michel Thierry <michel.thierry@intel.com>
> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com>

Please remember to send igt patches to the new mailing list in the future.
Adding it.
-Daniel
> ---
>  tests/gem_reset_stats.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/tests/gem_reset_stats.c b/tests/gem_reset_stats.c
> index edc40767..17a9b648 100644
> --- a/tests/gem_reset_stats.c
> +++ b/tests/gem_reset_stats.c
> @@ -605,10 +605,7 @@ static void test_reset_count(const struct intel_execution_engine *e,
>  
>  		c2 = get_reset_count(fd, ctx);
>  
> -		if (ctx == 0)
> -			igt_assert(c2 == -EPERM);
> -		else
> -			igt_assert(c2 == 0);
> +		igt_assert(c2 == 0);
>  	}
>  
>  	igt_waitchildren();
> @@ -644,10 +641,11 @@ static void _check_param_ctx(const int fd, const int ctx, const cap_t cap)
>  	const uint32_t bad = rand() + 1;
>  
>  	if (ctx == 0) {
> -		if (cap == root)
> -			igt_assert_eq(_test_params(fd, ctx, 0, 0), 0);
> -		else
> -			igt_assert_eq(_test_params(fd, ctx, 0, 0), -EPERM);
> +		igt_assert_eq(_test_params(fd, ctx, 0, 0), 0);
> +
> +		if (cap != root) {
> +			igt_assert(get_reset_count(fd, ctx) == 0);
> +		}
>  	}
>  
>  	igt_assert_eq(_test_params(fd, ctx, 0, bad), -EINVAL);
> -- 
> 2.14.2
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Daniel Vetter Jan. 17, 2018, 10:06 a.m. UTC | #3
On Tue, Jan 16, 2018 at 12:56:51PM -0800, Antonio Argenziano wrote:
> The test expected IOCTL 'I915_GET_RESET_STATS' would return an error
> when not root. That is no longer true in the driver since commit
> 4c9c0d09741d ("drm/i915: Fix retrieval of hangcheck stats") and therefore
> the test was incorrectly failing.
> 
> v2:
> 	- Add the commit that changed the behaviour in the Driver to the
> 	  commit message. (Michel)
> 
> v3:
> 	- Reuse get_reset_count instead of implementing a new function.
> 	  (Michel)
> 
> Cc: Michel Thierry <michel.thierry@intel.com>
> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com>

Please remember to send igt patches to the new mailing list in the future.
Adding it.
-Daniel
> ---
>  tests/gem_reset_stats.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/tests/gem_reset_stats.c b/tests/gem_reset_stats.c
> index edc40767..17a9b648 100644
> --- a/tests/gem_reset_stats.c
> +++ b/tests/gem_reset_stats.c
> @@ -605,10 +605,7 @@ static void test_reset_count(const struct intel_execution_engine *e,
>  
>  		c2 = get_reset_count(fd, ctx);
>  
> -		if (ctx == 0)
> -			igt_assert(c2 == -EPERM);
> -		else
> -			igt_assert(c2 == 0);
> +		igt_assert(c2 == 0);
>  	}
>  
>  	igt_waitchildren();
> @@ -644,10 +641,11 @@ static void _check_param_ctx(const int fd, const int ctx, const cap_t cap)
>  	const uint32_t bad = rand() + 1;
>  
>  	if (ctx == 0) {
> -		if (cap == root)
> -			igt_assert_eq(_test_params(fd, ctx, 0, 0), 0);
> -		else
> -			igt_assert_eq(_test_params(fd, ctx, 0, 0), -EPERM);
> +		igt_assert_eq(_test_params(fd, ctx, 0, 0), 0);
> +
> +		if (cap != root) {
> +			igt_assert(get_reset_count(fd, ctx) == 0);
> +		}
>  	}
>  
>  	igt_assert_eq(_test_params(fd, ctx, 0, bad), -EINVAL);
> -- 
> 2.14.2
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/tests/gem_reset_stats.c b/tests/gem_reset_stats.c
index edc40767..17a9b648 100644
--- a/tests/gem_reset_stats.c
+++ b/tests/gem_reset_stats.c
@@ -605,10 +605,7 @@  static void test_reset_count(const struct intel_execution_engine *e,
 
 		c2 = get_reset_count(fd, ctx);
 
-		if (ctx == 0)
-			igt_assert(c2 == -EPERM);
-		else
-			igt_assert(c2 == 0);
+		igt_assert(c2 == 0);
 	}
 
 	igt_waitchildren();
@@ -644,10 +641,11 @@  static void _check_param_ctx(const int fd, const int ctx, const cap_t cap)
 	const uint32_t bad = rand() + 1;
 
 	if (ctx == 0) {
-		if (cap == root)
-			igt_assert_eq(_test_params(fd, ctx, 0, 0), 0);
-		else
-			igt_assert_eq(_test_params(fd, ctx, 0, 0), -EPERM);
+		igt_assert_eq(_test_params(fd, ctx, 0, 0), 0);
+
+		if (cap != root) {
+			igt_assert(get_reset_count(fd, ctx) == 0);
+		}
 	}
 
 	igt_assert_eq(_test_params(fd, ctx, 0, bad), -EINVAL);