diff mbox

[igt] igt/gem_exec_parse: test_lri check init + add debug msg

Message ID 20161122165035.3184-1-robert@sixbynine.org (mailing list archive)
State New, archived
Headers show

Commit Message

Robert Bragg Nov. 22, 2016, 4:50 p.m. UTC
Just to note I haven't tested yet as I don't have hsw to hand, but seems
simple enough to send out anyway...

--- >8 ---

To make it clear on failure what register was being tested the test_lri
helper now uses igt_debug to log the register address and value being
tested. The test_lri helper now also double checks that the initial
intel_register_write() takes before issuing the LRI.

Signed-off-by: Robert Bragg <robert@sixbynine.org>
---
 tests/gem_exec_parse.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Chris Wilson Nov. 22, 2016, 5:03 p.m. UTC | #1
On Tue, Nov 22, 2016 at 04:50:35PM +0000, Robert Bragg wrote:
> Just to note I haven't tested yet as I don't have hsw to hand, but seems
> simple enough to send out anyway...
> 
> --- >8 ---
> 
> To make it clear on failure what register was being tested the test_lri
> helper now uses igt_debug to log the register address and value being
> tested. The test_lri helper now also double checks that the initial
> intel_register_write() takes before issuing the LRI.
> 
> Signed-off-by: Robert Bragg <robert@sixbynine.org>
> ---
>  tests/gem_exec_parse.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/tests/gem_exec_parse.c b/tests/gem_exec_parse.c
> index cc2103a..534a933 100644
> --- a/tests/gem_exec_parse.c
> +++ b/tests/gem_exec_parse.c
> @@ -272,8 +272,15 @@ test_lri(int fd, uint32_t handle,
>  		MI_BATCH_BUFFER_END,
>  	};
>  
> +	igt_debug("testing lri, reg=%x, val=%x, expected errno=%d\n",
> +		  test->reg, test->test_val, expected_errno);
> +
>  	intel_register_write(test->reg, test->init_val);
>  
> +	igt_assert_eq_u32((intel_register_read(test->reg) &
> +			   test->read_mask),
> +			  test->init_val);

igt_assert_f((intel_register_read(test->reg) & test->read_mask) == test->init_val,
	     "LRI reg=%x overwrote initial value of %x with %x [LRI value=%x]\n",
	     test->reg, test->init_val, intel_register_read(test->reg) & test->read_mask, test->val);

Something like that. I was also hoping to pass in test->name [name of
the register for convenience], which equally lends itself to
igt_subtest_f("test-lri-%s", test->name)
-Chris
diff mbox

Patch

diff --git a/tests/gem_exec_parse.c b/tests/gem_exec_parse.c
index cc2103a..534a933 100644
--- a/tests/gem_exec_parse.c
+++ b/tests/gem_exec_parse.c
@@ -272,8 +272,15 @@  test_lri(int fd, uint32_t handle,
 		MI_BATCH_BUFFER_END,
 	};
 
+	igt_debug("testing lri, reg=%x, val=%x, expected errno=%d\n",
+		  test->reg, test->test_val, expected_errno);
+
 	intel_register_write(test->reg, test->init_val);
 
+	igt_assert_eq_u32((intel_register_read(test->reg) &
+			   test->read_mask),
+			  test->init_val);
+
 	exec_batch(fd, handle,
 		   lri, sizeof(lri),
 		   I915_EXEC_RENDER,