From 4384031229b47335b3eee89cf731a9a54d19e322 Mon Sep 17 00:00:00 2001 From: Mika Kuoppala Date: Tue, 23 May 2017 17:38:37 +0300 Subject: tests/gem_exec_store: Verify all reads Verify all reads and report the offsets to observe address patterns. Signed-off-by: Mika Kuoppala --- tests/gem_exec_store.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/gem_exec_store.c b/tests/gem_exec_store.c index f624c78a..d0bb5750 100644 --- a/tests/gem_exec_store.c +++ b/tests/gem_exec_store.c @@ -154,6 +154,7 @@ static void store_cachelines(int fd, unsigned ring, unsigned int flags) #define NCACHELINES (4096/64) uint32_t *batch; int i; + unsigned long writes = 0, reads_verified = 0; if (flags & HANG) hang_ring(fd, ring); @@ -204,6 +205,8 @@ static void store_cachelines(int fd, unsigned ring, unsigned int flags) } batch[++i] = n | ~n << 16; i++; + + writes++; } batch[i++] = MI_BATCH_BUFFER_END; igt_assert(i < 4096 / sizeof(*batch)); @@ -211,16 +214,29 @@ static void store_cachelines(int fd, unsigned ring, unsigned int flags) gem_execbuf(fd, &execbuf); for (unsigned n = 0; n < NCACHELINES; n++) { + const int oi = n % (execbuf.buffer_count - 1); uint32_t result; + bool read_ok; gem_read(fd, reloc[n].target_handle, reloc[n].delta, &result, sizeof(result)); - igt_assert_eq_u32(result, n | ~n << 16); + read_ok = result == (n | ~n << 16); + if (read_ok) + reads_verified++; + + igt_info("%d: 0x%x %s 0x%x, addr 0x%llx\n", + n, + result, + read_ok ? "==" : "!=", + (n | ~n << 16), + obj[oi].offset); } for (unsigned n = 0; n < execbuf.buffer_count; n++) gem_close(fd, obj[n].handle); + + igt_assert_eq(writes, reads_verified); igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0); } -- cgit v1.2.3