From b9b82fdc5fdcbc43d0720b6aaf79e1f00f407d3a Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sun, 29 Mar 2015 14:11:28 +0100 Subject: [PATCH] igt/gem_exec_parse: Use a macro for pretty printing the test failure By moving the assert up a level, we get an much improved assertion failure message (e.g. it includes the batch string that fails). Signed-off-by: Chris Wilson --- tests/gem_exec_parse.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/gem_exec_parse.c b/tests/gem_exec_parse.c index fff166a4..6105f496 100644 --- a/tests/gem_exec_parse.c +++ b/tests/gem_exec_parse.c @@ -103,8 +103,8 @@ static void exec_batch_patched(int fd, uint32_t cmd_bo, uint32_t *cmds, gem_close(fd, target_bo); } -static void exec_batch(int fd, uint32_t cmd_bo, uint32_t *cmds, - int size, int ring, int expected_ret) +static int __exec_batch(int fd, uint32_t cmd_bo, uint32_t *cmds, + int size, int ring) { struct drm_i915_gem_execbuffer2 execbuf; struct drm_i915_gem_exec_object2 objs[1]; @@ -132,10 +132,10 @@ static void exec_batch(int fd, uint32_t cmd_bo, uint32_t *cmds, i915_execbuffer2_set_context_id(execbuf, 0); execbuf.rsvd2 = 0; - igt_assert_eq(__gem_execbuf(fd, &execbuf), expected_ret); - - gem_sync(fd, cmd_bo); + return __gem_execbuf(fd, &execbuf); } +#define exec_batch(fd, bo, cmds, sz, ring, expected) \ + igt_assert_eq(__exec_batch(fd, bo, cmds, sz, ring), expected) static void exec_split_batch(int fd, uint32_t *cmds, int size, int ring, int expected_ret)