diff mbox

[igt,v3,06/11] igt/gem_exec_parse: make basic-rejected version agnostic

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

Commit Message

Robert Bragg Nov. 9, 2016, 4:15 p.m. UTC
This adapts the basic-rejected test to focus on invalid commands that
will result in an EINVAL errno being returned to userspace even with the
upcoming version 8 parser change to stop reporting access violations as
EINVAL errors.

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

Comments

Matthew Auld Nov. 14, 2016, 6:57 p.m. UTC | #1
On 9 November 2016 at 16:15, Robert Bragg <robert@sixbynine.org> wrote:
> This adapts the basic-rejected test to focus on invalid commands that
> will result in an EINVAL errno being returned to userspace even with the
> upcoming version 8 parser change to stop reporting access violations as
> EINVAL errors.
>
> Signed-off-by: Robert Bragg <robert@sixbynine.org>
> ---
>  tests/gem_exec_parse.c | 28 +++++++++++++++++-----------
>  1 file changed, 17 insertions(+), 11 deletions(-)
>
> diff --git a/tests/gem_exec_parse.c b/tests/gem_exec_parse.c
> index 368f30b..63f4efe 100644
> --- a/tests/gem_exec_parse.c
> +++ b/tests/gem_exec_parse.c
> @@ -386,33 +386,39 @@ igt_main
>         }
>
>         igt_subtest("basic-rejected") {
> -               uint32_t arb_on_off[] = {
> -                       MI_ARB_ON_OFF,
> +               uint32_t invalid_cmd[] = {
> +                       (0x7<<29), /* Reserved command type,
> +                                     across all engines */
Maybe make this more clear with something like:

   (INSTR_INVALID_CLIENT << INSTR_CLIENT_SHIFT)

Anyway:
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
diff mbox

Patch

diff --git a/tests/gem_exec_parse.c b/tests/gem_exec_parse.c
index 368f30b..63f4efe 100644
--- a/tests/gem_exec_parse.c
+++ b/tests/gem_exec_parse.c
@@ -386,33 +386,39 @@  igt_main
 	}
 
 	igt_subtest("basic-rejected") {
-		uint32_t arb_on_off[] = {
-			MI_ARB_ON_OFF,
+		uint32_t invalid_cmd[] = {
+			(0x7<<29), /* Reserved command type,
+				      across all engines */
 			MI_BATCH_BUFFER_END,
 		};
-		uint32_t display_flip[] = {
-			MI_DISPLAY_FLIP,
-			0, 0, 0,
+		uint32_t invalid_set_context[] = {
+			MI_SET_CONTEXT | 32, /* invalid length */
 			MI_BATCH_BUFFER_END,
-			0
 		};
 		exec_batch(fd, handle,
-			   arb_on_off, sizeof(arb_on_off),
+			   invalid_cmd, sizeof(invalid_cmd),
 			   I915_EXEC_RENDER,
 			   -EINVAL);
 		exec_batch(fd, handle,
-			   arb_on_off, sizeof(arb_on_off),
+			   invalid_cmd, sizeof(invalid_cmd),
 			   I915_EXEC_BSD,
 			   -EINVAL);
+		if (gem_has_blt(fd)) {
+			exec_batch(fd, handle,
+				   invalid_cmd, sizeof(invalid_cmd),
+				   I915_EXEC_BLT,
+				   -EINVAL);
+		}
 		if (gem_has_vebox(fd)) {
 			exec_batch(fd, handle,
-				   arb_on_off, sizeof(arb_on_off),
+				   invalid_cmd, sizeof(invalid_cmd),
 				   I915_EXEC_VEBOX,
 				   -EINVAL);
 		}
+
 		exec_batch(fd, handle,
-			   display_flip, sizeof(display_flip),
-			   I915_EXEC_BLT,
+			   invalid_set_context, sizeof(invalid_set_context),
+			   I915_EXEC_RENDER,
 			   -EINVAL);
 	}