From b3b32e10057a05a6e0b0845453179e25228bd018 Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Fri, 20 Nov 2020 11:52:14 +0100 Subject: tests/fbdev: Add tests for write operations on framebuffer The write tests check the written buffer against the content of the mapped framebuffer. v4: * replace igt_require() by iqt_assert() in "write" (Petri) * add write test to CI v3: * put igt_describe() before igt_subtest() (Petri) Signed-off-by: Thomas Zimmermann Reviewed-by: Chris Wilson Signed-off-by: Chris Wilson --- tests/fbdev.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/fbdev.c') diff --git a/tests/fbdev.c b/tests/fbdev.c index d6bc70e0..f6e2a091 100644 --- a/tests/fbdev.c +++ b/tests/fbdev.c @@ -144,6 +144,22 @@ static void framebuffer_tests(int fd) pos - buf); } + igt_describe("Check write operations on framebuffer memory"); + igt_subtest("write") { + ssize_t ret; + + /* write to framebuffer and compare */ + for (int i = 0; i < ARRAY_SIZE(values); i++) { + memset(buf, values[i], fix_info.smem_len); + ret = pwrite(fd, buf, fix_info.smem_len, 0); + igt_assert_f(ret == (ssize_t)fix_info.smem_len, + "pwrite failed, ret=%zd\n", ret); + igt_assert_f(!memcmp(map, buf, fix_info.smem_len), + "write differs from mapped framebuffer for %x\n", + values[i]); + } + } + igt_fixture { free(buf); /* don't leave garbage on the screen */ -- cgit v1.2.3